Bump min to PHP 7.2 (#1955)

Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com>
This commit is contained in:
Tomas Votruba 2022-03-24 22:17:08 +01:00 committed by GitHub
parent 6ebf140ee5
commit 278cd56de5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 22 additions and 37 deletions

View File

@ -72,11 +72,11 @@ jobs:
# 3. prefix classes # 3. prefix classes
- run: sh build/build-rector-scoped.sh rector-build rector-prefixed-downgraded - run: sh build/build-rector-scoped.sh rector-build rector-prefixed-downgraded
# 4. lint the code for PHP 7.1 - this must happen here, as setup-php allows only one PHP version switch: https://github.com/shivammathur/setup-php/issues/434 # 4. lint the code for PHP 7.2 - this must happen here, as setup-php allows only one PHP version switch: https://github.com/shivammathur/setup-php/issues/434
- -
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: 7.1 php-version: 7.2
coverage: none coverage: none
- run: composer global require php-parallel-lint/php-parallel-lint - run: composer global require php-parallel-lint/php-parallel-lint
- run: /home/runner/.composer/vendor/bin/parallel-lint rector-prefixed-downgraded --exclude rector-prefixed-downgraded/stubs --exclude rector-prefixed-downgraded/vendor/rector/rector-nette/tests --exclude rector-prefixed-downgraded/vendor/symfony/polyfill-mbstring/bootstrap80.php --exclude rector-prefixed-downgraded/vendor/tracy/tracy/examples --exclude rector-prefixed-downgraded/vendor/ssch/typo3-rector/templates/maker --exclude rector-prefixed-downgraded/vendor/symfony/console/Event --exclude rector-prefixed-downgraded/vendor/symfony/console/EventListener --exclude rector-prefixed-downgraded/vendor/symfony/console/Tester --exclude rector-prefixed-downgraded/vendor/rector/rector-generator/templates --exclude rector-prefixed-downgraded/vendor/symfony/contracts/Cache/ItemInterface.php --exclude rector-prefixed-downgraded/vendor/symfony/dependency-injection/ExpressionLanguageProvider.php - run: /home/runner/.composer/vendor/bin/parallel-lint rector-prefixed-downgraded --exclude rector-prefixed-downgraded/stubs --exclude rector-prefixed-downgraded/vendor/rector/rector-nette/tests --exclude rector-prefixed-downgraded/vendor/symfony/polyfill-mbstring/bootstrap80.php --exclude rector-prefixed-downgraded/vendor/tracy/tracy/examples --exclude rector-prefixed-downgraded/vendor/ssch/typo3-rector/templates/maker --exclude rector-prefixed-downgraded/vendor/symfony/console/Event --exclude rector-prefixed-downgraded/vendor/symfony/console/EventListener --exclude rector-prefixed-downgraded/vendor/symfony/console/Tester --exclude rector-prefixed-downgraded/vendor/rector/rector-generator/templates --exclude rector-prefixed-downgraded/vendor/symfony/contracts/Cache/ItemInterface.php --exclude rector-prefixed-downgraded/vendor/symfony/dependency-injection/ExpressionLanguageProvider.php

View File

@ -11,7 +11,7 @@ Head to [`rectorphp/rector`](http://github.com/rectorphp/rector) for documentati
## Building `rectorphp/rector` ## Building `rectorphp/rector`
Code of this repository requires PHP 8. For `rector/rector` package user the build downgrades code to PHP 7.1 and higher. Code of this repository requires PHP 8. For `rector/rector` package user the build downgrades code to PHP 7.2 and higher.
## How to Contribute ## How to Contribute

View File

@ -4,10 +4,7 @@ declare(strict_types=1);
use Rector\Core\Configuration\Option; use Rector\Core\Configuration\Option;
use Rector\Core\Stubs\PHPStanStubLoader; use Rector\Core\Stubs\PHPStanStubLoader;
use Rector\DowngradePhp72\Rector\ClassMethod\DowngradeParameterTypeWideningRector;
use Rector\Set\ValueObject\DowngradeLevelSetList; use Rector\Set\ValueObject\DowngradeLevelSetList;
use Symfony\Component\Config\Loader\Loader;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
$phpStanStubLoader = new PHPStanStubLoader(); $phpStanStubLoader = new PHPStanStubLoader();
@ -25,15 +22,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
$parameters->set(Option::SKIP, DowngradeRectorConfig::DEPENDENCY_EXCLUDE_PATHS); $parameters->set(Option::SKIP, DowngradeRectorConfig::DEPENDENCY_EXCLUDE_PATHS);
$parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, __DIR__ . '/phpstan-for-downgrade.neon'); $parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, __DIR__ . '/phpstan-for-downgrade.neon');
$containerConfigurator->import(DowngradeLevelSetList::DOWN_TO_PHP_71); $containerConfigurator->import(DowngradeLevelSetList::DOWN_TO_PHP_72);
$services = $containerConfigurator->services();
$services->set(DowngradeParameterTypeWideningRector::class)
->configure([
LoaderInterface::class => ['load'],
Loader::class => ['import'],
]);
}; };
/** /**

View File

@ -13,7 +13,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php_version: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] php_version: ['7.2', '7.3', '7.4', '8.0', '8.1']
commands: commands:
- -
name: 'Composer Dependency' name: 'Composer Dependency'

View File

@ -13,7 +13,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php_version: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] php_version: ['7.2', '7.3', '7.4', '8.0', '8.1']
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -15,7 +15,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php_version: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] php_version: ['7.2', '7.3', '7.4', '8.0', '8.1']
directory: directory:
- 'e2e/attributes' - 'e2e/attributes'
- 'e2e/define-constant' - 'e2e/define-constant'

View File

@ -12,7 +12,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php_version: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] php_version: ['7.2', '7.3', '7.4', '8.0', '8.1']
directory: directory:
- 'e2e/global-install' - 'e2e/global-install'

View File

@ -6,8 +6,8 @@
"bin/rector" "bin/rector"
], ],
"require": { "require": {
"php": "^7.1|^8.0", "php": "^7.2|^8.0",
"phpstan/phpstan": "^1.4.8" "phpstan/phpstan": "^1.5"
}, },
"autoload": { "autoload": {
"files": [ "files": [

View File

@ -23,7 +23,7 @@
"nikic/php-parser": "^4.13.2", "nikic/php-parser": "^4.13.2",
"ondram/ci-detector": "^4.1", "ondram/ci-detector": "^4.1",
"phpstan/phpdoc-parser": "^1.2", "phpstan/phpdoc-parser": "^1.2",
"phpstan/phpstan": "^1.4.8", "phpstan/phpstan": "^1.5",
"phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-phpunit": "^1.0",
"psr/log": "^2.0", "psr/log": "^2.0",
"react/child-process": "^0.6.4", "react/child-process": "^0.6.4",

View File

@ -26,25 +26,25 @@ sh build/downgrade-rector.sh rector-build
cd rector-build cd rector-build
# avoid syntax error in php 7.1 and 7.2 # avoid syntax error in php 7.2
rm rector.php rm rector.php
cp ../build/target-repository/bootstrap.php . cp ../build/target-repository/bootstrap.php .
cp ../preload.php . cp ../preload.php .
# Check php 7.1 can be used locally with PHP71_BIN_PATH env # Check php 7.2 can be used locally with PHP72_BIN_PATH env
# Prefixing build only works on php < 8.0, can be used locally with PHP80_BIN_PATH env # Prefixing build only works on php < 8.0, can be used locally with PHP80_BIN_PATH env
# #
# usage: # usage:
# #
# export PHP71_BIN_PATH=/opt/homebrew/Cellar/php@7.1/7.1.33_4/bin/php PHP80_BIN_PATH=/opt/homebrew/Cellar/php@8.0/8.0.14/bin/php && sh ./full_build.sh # export PHP72_BIN_PATH=/opt/homebrew/Cellar/php@7.2/7.2.34_4/bin/php PHP80_BIN_PATH=/opt/homebrew/Cellar/php@8.0/8.0.17/bin/php && sh ./full_build.sh
# #
if test -z ${PHP71_BIN_PATH+y}; then if test -z ${PHP72_BIN_PATH+y}; then
bin/rector list --ansi; bin/rector list --ansi;
else else
echo "verify downgraded rector with specify PHP71_BIN_PATH env"; echo "verify downgraded rector with specify PHP72_BIN_PATH env";
$PHP71_BIN_PATH bin/rector list --ansi; $PHP72_BIN_PATH bin/rector list --ansi;
fi fi
cd .. cd ..
@ -59,16 +59,16 @@ cd rector-prefixed-downgraded
cp ../build/target-repository/bootstrap.php . cp ../build/target-repository/bootstrap.php .
cp ../preload.php . cp ../preload.php .
if test -z ${PHP71_BIN_PATH+y}; then if test -z ${PHP72_BIN_PATH+y}; then
bin/rector list --ansi; bin/rector list --ansi;
bin/rector process vendor/symfony/string/Slugger/ --dry-run; bin/rector process vendor/symfony/string/Slugger/ --dry-run;
else else
echo "verify scoped rector with specify PHP71_BIN_PATH env"; echo "verify scoped rector with specify PHP72_BIN_PATH env";
$PHP71_BIN_PATH bin/rector list --ansi; $PHP72_BIN_PATH bin/rector list --ansi;
$PHP71_BIN_PATH bin/rector process vendor/symfony/string/Slugger/ --dry-run; $PHP72_BIN_PATH bin/rector process vendor/symfony/string/Slugger/ --dry-run;
fi fi
cd .. cd ..
rm -rf rector-prefixed-downgraded rm -rf rector-prefixed-downgraded
rm -rf rector-build rm -rf rector-build

View File

@ -43,10 +43,6 @@ final class PHPStanStubLoader
continue; continue;
} }
if ($vendorPath === '') {
continue;
}
foreach (self::STUBS as $stub) { foreach (self::STUBS as $stub) {
$path = $this->getStubPath($vendorPath, $stub); $path = $this->getStubPath($vendorPath, $stub);
if ($path === null) { if ($path === null) {