MissingRequirementException example


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;
        }


    /** * @param Link[] $pluginRequirements */
    private function addRemainingRequirementsAsException(
        array $pluginRequirements,
        RequirementExceptionStack $exceptionStack
    ): void {
        foreach ($pluginRequirements as $installedPackage => $requirement) {
            $exceptionStack->add(
                new MissingRequirementException($installedPackage$requirement->getPrettyConstraint())
            );
        }
    }

    /** * @param array{'require': Link[], 'conflict': Link[]} $pluginDependencies * * @return array{'require': Link[], 'conflict': Link[]} */
    private function validateShippedDependencies(
        PluginEntity $plugin,
        
Home | Imprint | This part of the site doesn't use cookies.