-
-
Notifications
You must be signed in to change notification settings - Fork 680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CI] Add PHP 8.0 to Github actions tests #4779
Conversation
Got php 8 downgrade errors: Downgrade Class On Object To Get Class Rector (Rector\DowngradePhp80\Tests\Rector\ClassConstFetch\DowngradeClassOnObjectToGetClassRector\DowngradeClassOnObjectToGetClassRector)
✘ with data set #0
│
│ rules/downgrade-php80/tests/Rector/ClassConstFetch/DowngradeClassOnObjectToGetClassRector/Fixture/fixture.php.inc
│ Failed asserting that string matches format description.
│ --- Expected
│ +++ Actual
│ @@ @@
│ {
│ public function run($object)
│ {
│ - return get_class($object);
│ + return $object::class;
│ }
│ }
│
│ /home/runner/work/rector/rector/packages/testing/src/PHPUnit/AbstractRectorTestCase.php:486
│ /home/runner/work/rector/rector/packages/testing/src/PHPUnit/AbstractRectorTestCase.php:308
│ /home/runner/work/rector/rector/rules/downgrade-php80/tests/Rector/ClassConstFetch/DowngradeClassOnObjectToGetClassRector/DowngradeClassOnObjectToGetClassRectorTest.php:21
│
Downgrade Return Static Type Declaration Rector (Rector\DowngradePhp80\Tests\Rector\FunctionLike\DowngradeReturnStaticTypeDeclarationRector\DowngradeReturnStaticTypeDeclarationRector)
✘ with data set #0
│
│ rules/downgrade-php80/tests/Rector/FunctionLike/DowngradeReturnStaticTypeDeclarationRector/Fixture/fixture.php.inc
│ /home/runner/work/rector/rector/src/Application/FileProcessor.php:143
│ /home/runner/work/rector/rector/packages/testing/src/PHPUnit/AbstractRectorTestCase.php:439
│ /home/runner/work/rector/rector/packages/testing/src/PHPUnit/AbstractRectorTestCase.php:308
│ /home/runner/work/rector/rector/rules/downgrade-php80/tests/Rector/FunctionLike/DowngradeUnionTypeReturnDeclarationRector/DowngradeUnionTypeReturnDeclarationRectorTest.php:23
│
Downgrade Union Type Typed Property Rector (Rector\DowngradePhp80\Tests\Rector\Property\DowngradeUnionTypeTypedPropertyRector\DowngradeUnionTypeTypedPropertyRector)
✘ with data set #0
│
│ Rector\Core\Exception\NotImplementedException: PhpParser\Node\UnionType
│
│ /home/runner/work/rector/rector/packages/static-type-mapper/src/Mapper/PhpParserNodeMapper.php:45
│ /home/runner/work/rector/rector/packages/static-type-mapper/src/StaticTypeMapper.php:82
│ /home/runner/work/rector/rector/rules/downgrade-php74/src/Rector/Property/AbstractDowngradeTypedPropertyRector.php:45
│ /home/runner/work/rector/rector/src/Rector/AbstractRector.php:231
│ /home/runner/work/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:200
│ /home/runner/work/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:114
│ /home/runner/work/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
│ /home/runner/work/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:114
│ /home/runner/work/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
│ /home/runner/work/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:91
│ /home/runner/work/rector/rector/src/PhpParser/NodeTraverser/RectorNodeTraverser.php:119
│ /home/runner/work/rector/rector/src/Application/FileProcessor.php:143
│ /home/runner/work/rector/rector/packages/testing/src/PHPUnit/AbstractRectorTestCase.php:439
│ /home/runner/work/rector/rector/packages/testing/src/PHPUnit/AbstractRectorTestCase.php:308
│ /home/runner/work/rector/rector/rules/downgrade-php80/tests/Rector/Property/DowngradeUnionTypeTypedPropertyRector/DowngradeUnionTypeTypedPropertyRectorTest.php:2 |
@TomasVotruba It seems dump(
PHP_VERSION,
$this->isAtLeastPhpVersion(PhpVersionFeature::CLASS_ON_OBJECT)
); got: "8.0.0" (5)
false |
It seems because of test definition: protected function getPhpVersion(): int
{
return PhpVersionFeature::CLASS_ON_OBJECT - 1;
} |
Got weird error at Php74 (Rector\Naming\Tests\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector\Php74)
✘ with data set #0
│
│ rules/naming/tests/Rector/Assign/RenameVariableToMatchMethodCallReturnTypeRector/FixturePhp74/arrow_function.php.inc
│ Failed asserting that string matches format description.
│ --- Expected
│ +++ Actual
│ @@ @@
│ {
│ $datetime = new DateTime();
│
│ - $fn1 = fn($x) => $x + $dateTimeZone = $datetime->getTimezone();
│ + $fn1 = fn($x) => $x + $timezone = $datetime->getTimezone();
│ }
│ } |
More error in test in php 8 : To String To Method Call Rector (Rector\MagicDisclosure\Tests\Rector\String_\ToStringToMethodCallRector\ToStringToMethodCallRector)
✔ with data set #0
PHP Fatal error: Cannot use "parent" when current class scope has no parent in /tmp/_temp_fixture_easy_testing/input_d61e4d22d14036671bb8_rename_class_method_and_parent_call.php on line 19 seems need to be fixed in somewhere in the code instead |
@@ -13,7 +13,7 @@ | |||
final class DowngradeReturnStaticTypeDeclarationRectorTest extends AbstractRectorTestCase | |||
{ | |||
/** | |||
* @requires PHP >= 8.0 | |||
* @requires PHP >= 9.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TomasVotruba I set temporary this as test is not working:
Downgrade Union Type Typed Property Rector (Rector\DowngradePhp80\Tests\Rector\Property\DowngradeUnionTypeTypedPropertyRector\DowngradeUnionTypeTypedPropertyRector)
✘ with data set #0
│
│ Rector\Core\Exception\NotImplementedException: PhpParser\Node\UnionType
│
│ /home/runner/work/rector/rector/packages/static-type-mapper/src/Mapper/PhpParserNodeMapper.php:45
│ /home/runner/work/rector/rector/packages/static-type-mapper/src/StaticTypeMapper.php:82
│ /home/runner/work/rector/rector/rules/downgrade-php74/src/Rector/Property/AbstractDowngradeTypedPropertyRector.php:45
│ /home/runner/work/rector/rector/src/Rector/AbstractRector.php:231
│ /home/runner/work/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:200
│ /home/runner/work/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:114
│ /home/runner/work/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
│ /home/runner/work/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:114
│ /home/runner/work/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
│ /home/runner/work/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:91
│ /home/runner/work/rector/rector/src/PhpParser/NodeTraverser/RectorNodeTraverser.php:119
│ /home/runner/work/rector/rector/src/Application/FileProcessor.php:143
│ /home/runner/work/rector/rector/packages/testing/src/PHPUnit/AbstractRectorTestCase.php:439
│ /home/runner/work/rector/rector/packages/testing/src/PHPUnit/AbstractRectorTestCase.php:308
│ /home/runner/work/rector/rector/rules/downgrade-php80/tests/Rector/Property/DowngradeUnionTypeTypedPropertyRector/DowngradeUnionTypeTypedPropertyRectorTest.php:23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
marked to 8.1 seems works, this is temporary to be fixed in the future.
All checks have passed 🎉 @TomasVotruba it is ready for review. |
...Property/DowngradeUnionTypeTypedPropertyRector/DowngradeUnionTypeTypedPropertyRectorTest.php
Show resolved
Hide resolved
Instead of |
Let's go :) |
Most of the skipped test cases are fixed here: |
Thank you |
rectorphp/rector-src@2970fa1 [TypeDeclaration] Skip in conditional on AddParamTypeFromPropertyTypeRector (#4779)
No description provided.