-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
[Dep] Update to php 8.1 requirement #1364
Conversation
it seems
|
Also there are errors: ERROR] Could not process
"packages/PHPStanStaticTypeMapper/TypeMapper/CallableTypeMapper.php"
file, due to:
"Rector\Core\PhpParser\ClassLikeAstResolver::resolveClassFromClassRefle
ction(): Return value must be of type
PhpParser\Node\Stmt\Trait_|PhpParser\Node\Stmt\Class_|PhpParser\Node\St
mt\Interface_|null, PhpParser\Node\Stmt\Enum_ returned". On line: 70
[ERROR] Could not process
"packages/PHPStanStaticTypeMapper/TypeMapper/ClosureTypeMapper.php"
file, due to:
"Rector\Core\PhpParser\ClassLikeAstResolver::resolveClassFromClassRefle
ction(): Return value must be of type
PhpParser\Node\Stmt\Trait_|PhpParser\Node\Stmt\Class_|PhpParser\Node\St
mt\Interface_|null, PhpParser\Node\Stmt\Enum_ returned". On line: 41
[ERROR] Could not process
"packages/PHPStanStaticTypeMapper/TypeMapper/NeverTypeMapper.php" file,
due to:
"Rector\Core\PhpParser\ClassLikeAstResolver::resolveClassFromClassRefle
ction(): Return value must be of type
PhpParser\Node\Stmt\Trait_|PhpParser\Node\Stmt\Class_|PhpParser\Node\St
mt\Interface_|null, PhpParser\Node\Stmt\Enum_ returned". On line: 41
[ERROR] Could not process
"packages/PHPStanStaticTypeMapper/TypeMapper/NullTypeMapper.php" file,
due to:
"Rector\Core\PhpParser\ClassLikeAstResolver::resolveClassFromClassRefle
ction(): Return value must be of type
PhpParser\Node\Stmt\Trait_|PhpParser\Node\Stmt\Class_|PhpParser\Node\St
mt\Interface_|null, PhpParser\Node\Stmt\Enum_ returned". On line: 41
|
I added Enum_ return to |
rectify seems cause error in phpunit https://github.com/rectorphp/rector-src/pull/1364/files#diff-4dc6b2e58922af67eeb5d15d229c3b540f5ba436383dc4ff2b506c3bfd1ffaf8 : 1s
Run vendor/bin/phpunit
PHPUnit 9.5.10 by Sebastian Bergmann and contributors.
PHP Fatal error: Case REFACTORING of non-backed enum Rector\Core\Enum\ApplicationPhase must not have a value, try adding ": string" to the enum declaration in /home/runner/work/rector-src/rector-src/vendor/rector/rector-src/src/Enum/ApplicationPhase.php on line 12
Error: Process completed with exit code 255. |
There is also error on .EFE....PHP Fatal error: Readonly property Rector\Caching\ValueObject\CacheItem::$data must have type in /Users/samsonasik/www/rector-src/packages/Caching/ValueObject/CacheItem.php on line 16
Fatal error: Readonly property Rector\Caching\ValueObject\CacheItem::$data must have type in /Users/samsonasik/www/rector-src/packages/Caching/ValueObject/CacheItem.php on line 16 |
2e40830
to
acb3ad4
Compare
rebased. |
a1b223a
to
6ea553c
Compare
@TomasVotruba I think use MyCLabs\Enum\Enum;
- final class PhpVersion extends Enum
+ enum PhpVersion : int which will need update currently manually of its usage: -PhpVersion::PHP_52;
+PhpVersion::PHP_52->value; and it seems cause change also other Enums, eg - if ($node->toString() === ObjectReference::PARENT()->getValue()) {
+ if ($node->toString() === ObjectReference::PARENT()->value) { - }, ApplicationPhase::PARSING());
+ }, ApplicationPhase::PARSING->value); and we need to create a downgrade rule for it to keep working on scoping. I commented the rules at 6ea553c |
It seems readonly rule make error: 1) Rector\Tests\BetterPhpDocParser\PhpDocInlineHtml\TestInlineHtmlTest::test with data set #0 (Symplify\SmartFileSystem\SmartFileInfo Object (...))
Error: Cannot modify readonly property Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace::$stmts
/home/runner/work/rector-src/rector-src/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:111
/home/runner/work/rector-src/rector-src/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
/home/runner/work/rector-src/rector-src/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:91
/home/runner/work/rector-src/rector-src/src/PhpParser/NodeTraverser/RectorNodeTraverser.php:41
/home/runner/work/rector-src/rector-src/src/Application/FileProcessor.php:43
/home/runner/work/rector-src/rector-src/src/Application/FileProcessor/PhpFileProcessor.php:107
/home/runner/work/rector-src/rector-src/src/Application/FileProcessor/PhpFileProcessor.php:122
/home/runner/work/rector-src/rector-src/src/Application/FileProcessor/PhpFileProcessor.php:108
/home/runner/work/rector-src/rector-src/src/Application/FileProcessor/PhpFileProcessor.php:61
/home/runner/work/rector-src/rector-src/src/Application/ApplicationFileProcessor.php:59
/home/runner/work/rector-src/rector-src/src/Application/ApplicationFileProcessor.php:36
/home/runner/work/rector-src/rector-src/packages/Testing/PHPUnit/AbstractRectorTestCase.php:177
/home/runner/work/rector-src/rector-src/packages/Testing/PHPUnit/AbstractRectorTestCase.php:131
/home/runner/work/rector-src/rector-src/packages/Testing/PHPUnit/AbstractRectorTestCase.php:115
/home/runner/work/rector-src/rector-src/packages-tests/BetterPhpDocParser/PhpDocInlineHtml/TestInlineHtmlTest.php:18 Also it seems there is diff change on There were 55 failures:
1) Rector\Tests\BetterPhpDocParser\PhpDocInfo\PhpDocInfoPrinter\DoctrineTest::testClass with data set #0 ('/home/runner/work/rector-src/...le.txt', PhpParser\Node\Stmt\Class_ Object (...))
packages-tests/BetterPhpDocParser/PhpDocInfo/PhpDocInfoPrinter/Source/Doctrine/index_in_table.txt
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
'/**
- * @ORM\Table(
- * name="building",
- * indexes={
- * @ORM\Index(name="isDemoBuilding", columns={"is_demo_building"})
/home/runner/work/rector-src/rector-src/packages-tests/BetterPhpDocParser/PhpDocParser/TagValueNodeReprint/TagValueNodeReprintTest.php:99
/home/runner/work/rector-src/rector-src/packages-tests/BetterPhpDocParser/PhpDocParser/TagValueNodeReprint/TagValueNodeReprintTest.php:57
53) Rector\Tests\BetterPhpDocParser\PhpDocParser\TagValueNodeReprint\TagValueNodeReprintTest::test with data set #50 (Symplify\SmartFileSystem\SmartFileInfo Object (...))
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
'/**
- * @ORM\JoinTable(name="PushCampaignCluster", joinColumns={
- * @ORM\JoinColumn(name="pushCampaignId", referencedColumnName="id")
- * })
+ * @ORM\JoinTable(name="PushCampaignCluster", joinColumns={(name="pushCampaignId", referencedColumnName="id")})
*/'
/home/runner/work/rector-src/rector-src/packages-tests/BetterPhpDocParser/PhpDocParser/TagValueNodeReprint/TagValueNodeReprintTest.php:99
/home/runner/work/rector-src/rector-src/packages-tests/BetterPhpDocParser/PhpDocParser/TagValueNodeReprint/TagValueNodeReprintTest.php:57
54) Rector\Tests\BetterPhpDocParser\PhpDocParser\TagValueNodeReprint\TagValueNodeReprintTest::test with data set #51 (Symplify\SmartFileSystem\SmartFileInfo Object (...))
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
'/**
- * @ORM\JoinTable(name="page_template_area",
- * joinColumns={@ORM\JoinColumn(name="template_id", referencedColumnName="id", onDelete="CASCADE")},
- * inverseJoinColumns={@ORM\JoinColumn(name="area_id", referencedColumnName="id")}
- * )
+ * @ORM\JoinTable(name="page_template_area", joinColumns={(name="template_id", referencedColumnName="id", onDelete="CASCADE")}, inverseJoinColumns={(name="area_id", referencedColumnName="id")})
*/'
/home/runner/work/rector-src/rector-src/packages-tests/BetterPhpDocParser/PhpDocParser/TagValueNodeReprint/TagValueNodeReprintTest.php:99
/home/runner/work/rector-src/rector-src/packages-tests/BetterPhpDocParser/PhpDocParser/TagValueNodeReprint/TagValueNodeReprintTest.php:57
55) Rector\Tests\BetterPhpDocParser\PhpDocParser\TagValueNodeReprint\TestModifyReprintTest::test
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
'/**
* @Route("/hello/", methods={"GET", "HEAD"})
- * @Template("some_path")
+ * @Template("some_path")
*/'
|
edd5d91
to
9bb7746
Compare
rebased. |
I updated |
1 more error: Run bin/rector process rules --ansi --no-progress-bar
bin/rector process rules --ansi --no-progress-bar
shell: /usr/bin/bash -e {0}
env:
COMPOSER_ROOT_VERSION: dev-main
In UnionTypeMapper.php line 137:
Look at "Rector\PHPStanStaticTypeMapper\TypeMapper\UnionTypeMapper::mapToPh
pParserNode()" on line 137 |
debug output: [applying] Rector\CodeQuality\Rector\PropertyFetch\ExplicitMethodCallOverMagicGetSetRector
In UnionTypeMapper.php line 137:
[Rector\Core\Exception\ShouldNotHappenException]
Look at "Rector\PHPStanStaticTypeMapper\TypeMapper\UnionTypeMapper::mapToPhpParserNode()" on line 137
Exception trace:
at /Users/samsonasik/www/rector-src/packages/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php:137
Rector\PHPStanStaticTypeMapper\TypeMapper\UnionTypeMapper->mapToPhpParserNode() at /Users/samsonasik/www/rector-src/packages/PHPStanStaticTypeMapper/PHPStanStaticTypeMapper.php:56
Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper->mapToPhpParserNode() at /Users/samsonasik/www/rector-src/packages/StaticTypeMapper/StaticTypeMapper.php:53
Rector\StaticTypeMapper\StaticTypeMapper->mapPHPStanTypeToPhpParserNode() at /Users/samsonasik/www/rector-src/rules/TypeDeclaration/TypeAlreadyAddedChecker/ReturnTypeAlreadyAddedChecker.php:56
Rector\TypeDeclaration\TypeAlreadyAddedChecker\ReturnTypeAlreadyAddedChecker->isSameOrBetterReturnTypeAlreadyAdded() at /Users/samsonasik/www/rector-src/rules/TypeDeclaration/Rector/FunctionLike/ReturnTypeDeclarationRector.php:113
Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector->refactor() at /Users/samsonasik/www/rector-src/src/Rector/AbstractRector.php:232
Rector\Core\Rector\AbstractRector->enterNode() at /Users/samsonasik/www/rector-src/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:200
PhpParser\NodeTraverser->traverseArray() at /Users/samsonasik/www/rector-src/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:114
PhpParser\NodeTraverser->traverseNode() at /Users/samsonasik/www/rector-src/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
PhpParser\NodeTraverser->traverseArray() at /Users/samsonasik/www/rector-src/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:114
PhpParser\NodeTraverser->traverseNode() at /Users/samsonasik/www/rector-src/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
PhpParser\NodeTraverser->traverseArray() at /Users/samsonasik/www/rector-src/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:91
PhpParser\NodeTraverser->traverse() at /Users/samsonasik/www/rector-src/src/PhpParser/NodeTraverser/RectorNodeTraverser.php:44
Rector\Core\PhpParser\NodeTraverser\RectorNodeTraverser->traverse() at /Users/samsonasik/www/rector-src/src/Application/FileProcessor.php:43
Rector\Core\Application\FileProcessor->refactor() at /Users/samsonasik/www/rector-src/src/Application/FileProcessor/PhpFileProcessor.php:107
Rector\Core\Application\FileProcessor\PhpFileProcessor->Rector\Core\Application\FileProcessor\{closure}() at /Users/samsonasik/www/rector-src/src/Application/FileProcessor/PhpFileProcessor.php:122
Rector\Core\Application\FileProcessor\PhpFileProcessor->tryCatchWrapper() at /Users/samsonasik/www/rector-src/src/Application/FileProcessor/PhpFileProcessor.php:108
Rector\Core\Application\FileProcessor\PhpFileProcessor->refactorNodesWithRectors() at /Users/samsonasik/www/rector-src/src/Application/FileProcessor/PhpFileProcessor.php:61
Rector\Core\Application\FileProcessor\PhpFileProcessor->process() at /Users/samsonasik/www/rector-src/src/Application/ApplicationFileProcessor.php:59
Rector\Core\Application\ApplicationFileProcessor->processFiles() at /Users/samsonasik/www/rector-src/src/Application/ApplicationFileProcessor.php:36
Rector\Core\Application\ApplicationFileProcessor->run() at /Users/samsonasik/www/rector-src/src/Console/Command/ProcessCommand.php:115
Rector\Core\Console\Command\ProcessCommand->execute() at /Users/samsonasik/www/rector-src/vendor/symfony/console/Command/Command.php:298
Symfony\Component\Console\Command\Command->run() at /Users/samsonasik/www/rector-src/vendor/symfony/console/Application.php:1005
Symfony\Component\Console\Application->doRunCommand() at /Users/samsonasik/www/rector-src/vendor/symfony/console/Application.php:299
Symfony\Component\Console\Application->doRun() at /Users/samsonasik/www/rector-src/src/Console/ConsoleApplication.php:79
Rector\Core\Console\ConsoleApplication->doRun() at /Users/samsonasik/www/rector-src/vendor/symfony/console/Application.php:171
Symfony\Component\Console\Application->run() at /Users/samsonasik/www/rector-src/bin/rector.php:71
require_once() at /Users/samsonasik/www/rector-src/bin/rector:4
process [-o|--output-format [OUTPUT-FORMAT]] [-n|--dry-run] [-a|--autoload-file AUTOLOAD-FILE] [--no-progress-bar] [--no-diffs] [--clear-cache] [--port PORT] [--identifier IDENTIFIER] [--] [<source>...] |
handled with |
bad7dd5
to
919c18b
Compare
Using
[RuntimeException]
Failed to clone
https://github.com/samsonasik/Stringy
via https, ssh protocols, aborting.
-
https://github.com/samsonasik/Stringy
Cloning into bare repository '/home/runner/.cache/composer/vcs/https---github.com-samsonasik-Stringy'...
BUG: refs/files-backend.c:2992: initial ref transaction called with existing refs
Aborted (core dumped) |
b2e5a80
to
f963e98
Compare
I updated stringy with vendor-patches |
@TomasVotruba All green 🎉 , there are pending status workflow that I can't found in the workflows list, are they cache? PHP 8.0 tests for packages-tests Expected — Waiting for status to be reported
Required
PHP 8.0 tests for rules-tests Expected — Waiting for status to be reported
Required
PHP 8.0 tests for tests Expected — Waiting for status to be reported |
I tried downgrade script locally from php 8.1 and it seems got error on scoping: [NOTE] Running scoper to rector-prefixed-downgraded
SSL_INIT
SSL_INIT
PHP Deprecated: Return type of HumbugBox383\KevinGH\RequirementChecker\RequirementCollection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///Users/samsonasik/www/rector-src/php-scoper.phar/.box/src/RequirementCollection.php on line 15
Deprecated: Return type of HumbugBox383\KevinGH\RequirementChecker\RequirementCollection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///Users/samsonasik/www/rector-src/php-scoper.phar/.box/src/RequirementCollection.php on line 15
PHP Deprecated: Return type of HumbugBox383\KevinGH\RequirementChecker\RequirementCollection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///Users/samsonasik/www/rector-src/php-scoper.phar/.box/src/RequirementCollection.php on line 19
Deprecated: Return type of HumbugBox383\KevinGH\RequirementChecker\RequirementCollection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///Users/samsonasik/www/rector-src/php-scoper.phar/.box/src/RequirementCollection.php on line 19
PHP Fatal error: During inheritance of IteratorAggregate: Uncaught ErrorException: Return type of _HumbugBox016dd6921859\Symfony\Component\Finder\Finder::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///Users/samsonasik/www/rector-src/php-scoper.phar/vendor/symfony/finder/Finder.php:219
Stack trace:
#0 phar:///Users/samsonasik/www/rector-src/php-scoper.phar/vendor/symfony/finder/Finder.php(16): _HumbugBox016dd6921859\Humbug\PhpScoper\{closure}(8192, 'Return type of ...', 'phar:///Users/s...', 219)
#1 phar:///Users/samsonasik/www/rector-src/php-scoper.phar/.box/vendor/composer/ClassLoader.php(444): include('phar:///Users/s...')
#2 phar:///Users/samsonasik/www/rector-src/php-scoper.phar/.box/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('phar:///Users/s...')
#3 [internal function]: Composer\Autoload\ClassLoader->loadClass('_HumbugBox016dd...')
#4 phar:///Users/samsonasik/www/rector-src/php-scoper.phar/bin/php-scoper(42): class_alias('_HumbugBox016dd...', 'Isolated\\Symfon...')
#5 /Users/samsonasik/www/rector-src/php-scoper.phar(19): require('phar:///Users/s...')
#6 {main} in phar:///Users/samsonasik/www/rector-src/php-scoper.phar/vendor/symfony/finder/Finder.php on line 16
Fatal error: During inheritance of IteratorAggregate: Uncaught ErrorException: Return type of _HumbugBox016dd6921859\Symfony\Component\Finder\Finder::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///Users/samsonasik/www/rector-src/php-scoper.phar/vendor/symfony/finder/Finder.php:219
Stack trace:
#0 phar:///Users/samsonasik/www/rector-src/php-scoper.phar/vendor/symfony/finder/Finder.php(16): _HumbugBox016dd6921859\Humbug\PhpScoper\{closure}(8192, 'Return type of ...', 'phar:///Users/s...', 219)
#1 phar:///Users/samsonasik/www/rector-src/php-scoper.phar/.box/vendor/composer/ClassLoader.php(444): include('phar:///Users/s...')
#2 phar:///Users/samsonasik/www/rector-src/php-scoper.phar/.box/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('phar:///Users/s...')
#3 [internal function]: Composer\Autoload\ClassLoader->loadClass('_HumbugBox016dd...')
#4 phar:///Users/samsonasik/www/rector-src/php-scoper.phar/bin/php-scoper(42): class_alias('_HumbugBox016dd...', 'Isolated\\Symfon...')
#5 /Users/samsonasik/www/rector-src/php-scoper.phar(19): require('phar:///Users/s...')
#6 {main} in phar:///Users/samsonasik/www/rector-src/php-scoper.phar/vendor/symfony/finder/Finder.php on line 16 @TomasVotruba do you think we need to use php 8.0 on build scoped as the scoper is inside
|
@TomasVotruba I set php to 8.0 on build scoped due #[\ReturnTypeWillChange] required inside php-scoper.phar when running on php 8.1, ref #1364 (comment) |
dfe3413
to
ea1ad5d
Compare
@TomasVotruba rebased, I think it is ready for merge. |
08f70ae
to
b5286e0
Compare
rebased. |
e195c04
to
ca435dc
Compare
rebased. |
It's still too huge. And another PR can be just about readonly properties. It's better to send PR-per single rule, in case it's huge. |
It mostly a rectify PR, the manual part mostly phpstan on string array key unpack. I will try to do enable php-81 config per-service on different PR (comment one by one). |
b3c3abd
to
170f083
Compare
rebased. |
…s syntax update usage and downgrade rule for it
…nfig set, but skip in rector.php
1a07c04
to
982c544
Compare
rebased. |
@TomasVotruba I think the rest of change mostly on finalize public constant, I think this PR can be merged instead of other per-service rule PRs. |
Enabling the rest (except the Enum rectors), seems this is ready. |
No description provided.