public function validateNoUnmaintainedPhpVersionsInComposer($composerJson, $maintainedVersions)
    {
        if (empty($composerJson['require']['php'])) {
            return true;
        }

        $versionParser       = new VersionParser();
        $constraintsComposer = $versionParser->parseConstraints($composerJson['require']['php']);
        $versionOk           = false;
        // Second pass - check all maintainedVersions against the composer.json constraint.
        foreach ($maintainedVersions as $maintainedVersion) {
            if ('nightly' === $maintainedVersion) {
                continue;
            }

            $constraintsMaintainedVersion = $versionParser->parseConstraints($maintainedVersion . '.9999999.9999999');
            if ($constraintsComposer->matches($constraintsMaintainedVersion)) {
                $versionOk = true;

                break;
            }
        }

        if (!$versionOk) {
            $this->output->writeln(
                sprintf(
                    '<error>composer.json specifies PHP version "%s" but only "%s" are actively maintained.</error>',
                    $constraintsComposer->getPrettyString(),
                    implode(', ', $maintainedVersions)
                )
            );

            return false;
        }

        return true;
    }