Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"ondram/ci-detector": "^4.2",
"phpstan/phpdoc-parser": "^2.3",
"phpstan/phpstan": "^2.1.32",
"react/event-loop": "^1.5",
"react/event-loop": "^1.6",
"react/promise": "^3.3",
"react/socket": "^1.16",
"rector/extension-installer": "^0.11.2",
Expand All @@ -39,7 +39,7 @@
"symfony/process": "^6.4",
"symplify/easy-parallel": "^11.2.2",
"symplify/rule-doc-generator-contracts": "^11.2",
"webmozart/assert": "^1.11"
"webmozart/assert": "^1.12"
},
"require-dev": {
"nette/robot-loader": "^4.1",
Expand All @@ -59,7 +59,7 @@
"symplify/phpstan-rules": "^14.8",
"symplify/vendor-patches": "^11.5",
"tomasvotruba/class-leak": "^2.0",
"tracy/tracy": "^2.10"
"tracy/tracy": "^2.11"
},
"replace": {
"rector/rector": "self.version"
Expand Down Expand Up @@ -133,8 +133,7 @@
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-if-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-case-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-elseif-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-namespace-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-nodetraverser-php.patch"
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-namespace-php.patch"
]
},
"composer-exit-on-patch-failure": true,
Expand Down
24 changes: 22 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ parameters:

# optional as changes behavior, should be used explicitly outside PHP upgrade
- '#Register "Rector\\Php73\\Rector\\FuncCall\\JsonThrowOnErrorRector" service to "php73\.php" config set#'
- '#Register "Rector\\Php81\\Rector\\ClassMethod\\NewInInitializerRector" service to "php81\.php" config set#'
- '#Register "Rector\\Php80\\Rector\\NotIdentical\\MbStrContainsRector" service to "php80\.php" config set#'
- '#Register "Rector\\Php85\\Rector\\StmtsAwareInterface\\SequentialAssignmentsToPipeOperatorRector" service to "php85\.php" config set#'
- '#Register "Rector\\Php85\\Rector\\Expression\\NestedFuncCallsToPipeOperatorRector" service to "php85\.php" config set#'
Expand Down Expand Up @@ -356,6 +355,27 @@ parameters:

- '#Method Rector\\Utils\\Rector\\RemoveRefactorDuplicatedNodeInstanceCheckRector\:\:getInstanceofNodeClass\(\) should return class\-string<PhpParser\\Node>\|null but returns class\-string#'

# helper classes for bin script
-
path: bin/list-unused-rules.php
path: scripts
identifier: symplify.multipleClassLikeInFile

# copied from /vendor, to keep as original as possible
-
identifier: symplify.forbiddenNode
path: src/PhpParser/NodeTraverser/AbstractImmutableNodeTraverser.php
-
identifier: missingType.iterableValue
path: src/PhpParser/NodeTraverser/AbstractImmutableNodeTraverser.php
-
identifier: symplify.noDynamicName
path: src/PhpParser/NodeTraverser/AbstractImmutableNodeTraverser.php
-
identifier: offsetAccess.nonArray
path: src/PhpParser/NodeTraverser/AbstractImmutableNodeTraverser.php
-
message: '#Property PhpParser\\Node\\Stmt\\ClassMethod\:\:\$stmts \(array<PhpParser\\Node\\Stmt>\|null\) does not accept array<PhpParser\\Node>#'
path: scripts/create-immutable-node-visitor.php
-
message: '#Property Rector\\PhpParser\\NodeTraverser\\AbstractImmutableNodeTraverser\:\:\$visitors \(list<PhpParser\\NodeVisitor>\) does not accept array<int\|string, PhpParser\\NodeVisitor>#'
path: src/PhpParser/NodeTraverser/AbstractImmutableNodeTraverser.php
3 changes: 2 additions & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
->withPhpSets()
->withPaths([
__DIR__ . '/bin',
__DIR__ . '/config',
__DIR__ . '/src',
__DIR__ . '/rules',
__DIR__ . '/rules-tests',
__DIR__ . '/tests',
__DIR__ . '/utils',
__DIR__ . '/config',
__DIR__ . '/scripts',
__DIR__ . '/build/build-preload.php',
])
->withRootFiles()
Expand Down
14 changes: 8 additions & 6 deletions scripts/avoid-short-node-names-in-fixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;

require __DIR__ . '/../vendor/autoload.php';

$fixtureFiles = FixtureFinder::find([__DIR__ . '/../tests', __DIR__ . '/../rules-tests']);

// get short node names

$nodeFileFinder = \Symfony\Component\Finder\Finder::create()
$nodeFileFinder = Finder::create()
->files()
->name('*.php')
->in(__DIR__ . '/../vendor/nikic/php-parser/lib/PhpParser/Node');

/** @var \Symfony\Component\Finder\SplFileInfo[] $nodeFileInfos */
/** @var SplFileInfo[] $nodeFileInfos */
$nodeFileInfos = iterator_to_array($nodeFileFinder->getIterator());

$shortNodeClassNames = [];
Expand All @@ -33,10 +35,10 @@

$hasErrors = false;

foreach ($fixtureFiles as $fixtureFileInfo) {
foreach ($fixtureFiles as $fixtureFile) {
$shortClassNameMatch = Strings::match(
$fixtureFileInfo->getContents(),
'/\b(?:class|interface)\s+(?<name>[A-Z][A-Za-z0-9_]*)/'
$fixtureFile->getContents(),
'/\b(?:class|interface)\s+(?<name>[A-Z]\w*)/'
);
if ($shortClassNameMatch === null) {
continue;
Expand All @@ -52,7 +54,7 @@
$fixtureClassName,
PHP_EOL,
PHP_EOL,
$fixtureFileInfo->getRealPath(),
$fixtureFile->getRealPath(),
PHP_EOL
));

Expand Down
3 changes: 2 additions & 1 deletion scripts/check-before-after-same-fixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

use Nette\Utils\Strings;
use Rector\Scripts\Finder\FixtureFinder;

require __DIR__ . '/../vendor/autoload.php';

Expand All @@ -27,7 +28,7 @@ public function __construct()
*/
public function run(array $testDirectories): int
{
$fixtureFiles = \Rector\Scripts\Finder\FixtureFinder::find($testDirectories);
$fixtureFiles = FixtureFinder::find($testDirectories);

$invalidFixturePaths = [];
foreach ($fixtureFiles as $fixtureFile) {
Expand Down
Loading