From 532362bfabca1301cec9c1ceabf307a8d2a4b7b4 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 13 Dec 2021 21:16:45 +0100 Subject: [PATCH] add e2e parse match on PHP 7.4 --- .github/workflows/e2e_php74.yaml | 32 +++++++++++++++++++ e2e/parse-match-class-on-php74/composer.json | 11 +++++++ e2e/parse-match-class-on-php74/rector.php | 14 ++++++++ .../src/QueryMatching.php | 15 +++++++++ upgrade/rector_010.php | 25 --------------- 5 files changed, 72 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/e2e_php74.yaml create mode 100644 e2e/parse-match-class-on-php74/composer.json create mode 100644 e2e/parse-match-class-on-php74/rector.php create mode 100644 e2e/parse-match-class-on-php74/src/QueryMatching.php delete mode 100644 upgrade/rector_010.php diff --git a/.github/workflows/e2e_php74.yaml b/.github/workflows/e2e_php74.yaml new file mode 100644 index 00000000000..27d46770bec --- /dev/null +++ b/.github/workflows/e2e_php74.yaml @@ -0,0 +1,32 @@ +# This workflow runs system tests: Use the Rector application from the source +# checkout to process "fixture" projects in tests/system-tests +# to see if those can be processed successfully +name: End to End tests on PHP 7.4 + +on: + pull_request: null + push: + branches: + - main + +jobs: + end_to_end_on_php74: + runs-on: ubuntu-latest + + name: End to end test - PHP 7.4 and Match class name + + steps: + - uses: actions/checkout@v2 + + - uses: shivammathur/setup-php@v2 + with: + php-version: "7.4" + coverage: none + + - + run: composer install --ansi + working-directory: e2e/parse-match-class-on-php74 + + - + run: ../../bin/rector process --dry-run --ansi + working-directory: e2e/parse-match-class-on-php74 diff --git a/e2e/parse-match-class-on-php74/composer.json b/e2e/parse-match-class-on-php74/composer.json new file mode 100644 index 00000000000..53e22d406b0 --- /dev/null +++ b/e2e/parse-match-class-on-php74/composer.json @@ -0,0 +1,11 @@ +{ + "require": { + "php": "7.4.*", + "ruflin/elastica": "6.1.5" + }, + "autoload": { + "psr-4": { + "Foo\\": "src" + } + } +} diff --git a/e2e/parse-match-class-on-php74/rector.php b/e2e/parse-match-class-on-php74/rector.php new file mode 100644 index 00000000000..68b98378604 --- /dev/null +++ b/e2e/parse-match-class-on-php74/rector.php @@ -0,0 +1,14 @@ +parameters(); + $parameters->set(Option::PATHS, [__DIR__.'/src']); + + $containerConfigurator->import(SetList::DEAD_CODE); +}; diff --git a/e2e/parse-match-class-on-php74/src/QueryMatching.php b/e2e/parse-match-class-on-php74/src/QueryMatching.php new file mode 100644 index 00000000000..002007c5d35 --- /dev/null +++ b/e2e/parse-match-class-on-php74/src/QueryMatching.php @@ -0,0 +1,15 @@ +services(); - $services->set(\Rector\Arguments\Rector\MethodCall\ValueObjectWrapArgRector::class)->call('configure', [[\Rector\Arguments\Rector\MethodCall\ValueObjectWrapArgRector::VALUE_OBJECT_WRAP_ARGS => \Symplify\SymfonyPhpConfig\ValueObjectInliner::inline([new \Rector\Arguments\ValueObject\ValueObjectWrapArg('Rector\\NodeTypeResolver\\NodeTypeResolver', 'isMethodStaticCallOrClassMethodObjectType', 1, 'PHPStan\\Type\\ObjectType'), new \Rector\Arguments\ValueObject\ValueObjectWrapArg('Rector\\NodeTypeResolver\\NodeTypeResolver', 'isObjectType', 1, 'PHPStan\\Type\\ObjectType'), new \Rector\Arguments\ValueObject\ValueObjectWrapArg('Rector\\NodeTypeResolver\\NodeTypeResolver', 'isObjectTypes', 1, 'PHPStan\\Type\\ObjectType'), new \Rector\Arguments\ValueObject\ValueObjectWrapArg('Rector\\Core\\Rector\\AbstractRector', 'isObjectType', 1, 'PHPStan\\Type\\ObjectType')])]]); - $services->set(\Rector\Renaming\Rector\Name\RenameClassRector::class)->call('configure', [[ - 'Rector\\Core\\Console\\Command\\AbstractCommand' => 'Symfony\\Component\\Console\\Command\\Command', - 'Rector\\Testing\\PHPUnit\\AbstractCommunityRectorTestCase' => 'Rector\\Testing\\PHPUnit\\AbstractRectorTestCase', - 'Rector\\AttributeAwarePhpDoc\\Ast\\PhpDoc\\AttributeAwareParamTagValueNode' => 'Rector\\BetterPhpDocParser\\ValueObject\\PhpDoc\\VariadicAwareParamTagValueNode', - // @see https://github.com/rectorphp/rector/pull/5841 - 'Rector\\AttributeAwarePhpDoc\\Ast\\PhpDoc\\AttributeAwarePhpDocTagNode' => 'PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode', - 'Rector\\AttributeAwarePhpDoc\\Ast\\Type\\AttributeAwareGenericTypeNode' => 'PHPStan\\PhpDocParser\\Ast\\Type\\GenericTypeNode', - ]]); - $services->set(\Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector::class)->call('configure', [[\Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector::CLASS_CONSTANT_RENAME => \Symplify\SymfonyPhpConfig\ValueObjectInliner::inline([new \Rector\Renaming\ValueObject\RenameClassAndConstFetch('Rector\\PHPStanStaticTypeMapper\\PHPStanStaticTypeMapper', 'KIND_PARAM', 'Rector\\PHPStanStaticTypeMapper\\ValueObject\\TypeKind', 'KIND_PARAM')])]]); -};