public function validateTravisContainsAllSupportedPhpVersions($composerJson, $travisYml, $supportedPhpByTravis)
    {
        $travisVersions      = !empty($travisYml['php']) ? $travisYml['php'] : array();
        $unsupportedVersions = array_diff($travisVersions, $supportedPhpByTravis);
        if ($unsupportedVersions) {
            $this->output->writeln(
                sprintf(
                    '<error>travis.yml contains a php version which is unavailable at travis-ci: %s</error>',
                    implode(', ', $unsupportedVersions)
                )
            );

            return false;
        }

        if (empty($composerJson['require']['php'])) {
            return true;
        }

        $versionParser       = new VersionParser();
        $constraintsComposer = $versionParser->parseConstraints($composerJson['require']['php']);
        $missingVersions     = $this->determineMissingVersions(
            $supportedPhpByTravis,
            $travisVersions,
            $constraintsComposer
        );

        if (!empty($missingVersions)) {
            $this->output->writeln(
                sprintf(
                    '<error>composer.json version constraint "%s" covers more versions than defined in travis.yml. ' .
                    'Please add the missing PHP versions "%s" to .travis.yml</error>',
                    $constraintsComposer->getPrettyString(),
                    implode(',', $missingVersions)
                )
            );

            return false;
        }

        return true;
    }
public function validateTravisContainsAllSupportedPhpVersions($composerJson, $travisYml, $supportedPhpByTravis)
    {
        $travisVersions      = !empty($travisYml['php']) ? $travisYml['php'] : array();
        $unsupportedVersions = array_diff($travisVersions, $supportedPhpByTravis);
        if ($unsupportedVersions) {
            $this->output->writeln(
                sprintf(
                    '<error>travis.yml contains a php version which is unavailable at travis-ci: %s</error>',
                    implode(', ', $unsupportedVersions)
                )
            );

            return false;
        }

        if (empty($composerJson['require']['php'])) {
            return true;
        }

        $versionParser       = new VersionParser();
        $constraintsComposer = $versionParser->parseConstraints($composerJson['require']['php']);
        $missingVersions     = $this->determineMissingVersions(
            $supportedPhpByTravis,
            $travisVersions,
            $constraintsComposer
        );

        if (!empty($missingVersions)) {
            $this->output->writeln(
                sprintf(
                    '<error>composer.json version constraint "%s" covers more versions than defined in travis.yml. ' .
                    'Please add the missing PHP versions "%s" to .travis.yml</error>',
                    $constraintsComposer->getPrettyString(),
                    implode(',', $missingVersions)
                )
            );

            return false;
        }

        return true;
    }
public function validateTravisContainsAllSupportedPhpVersions ( $ composerJson , $ travisYml , $ supportedPhpByTravis ) { $ travisVersions = ! empty ( $ travisYml [ 'php' ] ) ? $ travisYml [ 'php' ] : array ( ) ; $ unsupportedVersions = array_diff ( $ travisVersions , $ supportedPhpByTravis ) ; if ( $ unsupportedVersions ) { $ this -> output -> writeln ( sprintf ( '<error>travis.yml contains a php version which is unavailable at travis-ci: %s</error>' , implode ( ', ' , $ unsupportedVersions ) ) ) ; return false ; } if ( empty ( $ composerJson [ 'require' ] [ 'php' ] ) ) { return true ; } $ versionParser = new VersionParser ( ) ; $ constraintsComposer = $ versionParser -> parseConstraints ( $ composerJson [ 'require' ] [ 'php' ] ) ; $ missingVersions = $ this -> determineMissingVersions ( $ supportedPhpByTravis , $ travisVersions , $ constraintsComposer ) ; if ( ! empty ( $ missingVersions ) ) { $ this -> output -> writeln ( sprintf ( '<error>composer.json version constraint "%s" covers more versions than defined in travis.yml. ' . 'Please add the missing PHP versions "%s" to .travis.yml</error>' , $ constraintsComposer -> getPrettyString ( ) , implode ( ',' , $ missingVersions ) ) ) ; return false ; } return true ; }
Ensure all PHP versions covered by the constraint in composer.json are noted in .travis.yml.

@param array $composerJson         The contents of the composer.json.

@param array $travisYml            The contents of the .travis.yml.

@param array $supportedPhpByTravis The available versions at travis-ci.

@return bool
Ensure all PHP versions covered by the constraint in composer . json are noted in . travis . yml .