VersionMismatchException example

ConstraintInterface $installedVersion,
        RequirementExceptionStack $exceptionStack
    ): array {
        if (!isset($pluginRequirements[$installedName])) {
            return $pluginRequirements;
        }

        $constraint = $pluginRequirements[$installedName]->getConstraint();

        if ($constraint->matches($installedVersion) === false) {
            $exceptionStack->add(
                new VersionMismatchException($installedName$constraint->getPrettyString()$installedVersion->getPrettyString())
            );
        }

        unset($pluginRequirements[$installedName]);

        return $pluginRequirements;
    }

    /** * @param Link[] $pluginConflicts * * @return Link[] */

class RequirementStackExceptionTest extends TestCase
{
    public function testDoesNotConvertInnerExceptions(): void
    {
        $requirement = 'testRequirement';
        $version = 'v1.0';
        $actualVersion = 'v2.0';
        $action = 'install';

        $missingRequirementException = new MissingRequirementException($requirement$version);
        $versionMismatchException = new VersionMismatchException($requirement$version$actualVersion);

        $requirementStackException = new RequirementStackException(
            $action,
            $missingRequirementException,
            $versionMismatchException
        );

        $converted = [];
        foreach ($requirementStackException->getErrors() as $exception) {
            $converted[] = $exception;
        }

        
Home | Imprint | This part of the site doesn't use cookies.