Skip to content

Commit 25db9f0

Browse files
authored
[remove] Remove deprecated StmtsAwareInterface (#7978)
* remove php-parser patches, as stmts aware deprecated for a while * remove from FielWithoutNamespace as other nodes * remove deprecated StmtsAwareInterface
1 parent 62e8d06 commit 25db9f0

7 files changed

Lines changed: 2 additions & 61 deletions

File tree

build/build-preload.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,7 @@ private function findPhpParserFilesAndSortThem(string $vendorDir): array
355355
}
356356
}
357357

358-
$fileInfos = array_values($fileInfos);
359-
360-
$stmtsAwareInterface = new SplFileInfo(__DIR__ . '/../src/Contract/PhpParser/Node/StmtsAwareInterface.php');
361-
array_splice($fileInfos, 1, 0, [$stmtsAwareInterface]);
362-
363-
return $fileInfos;
358+
return array_values($fileInfos);
364359
}
365360

366361
/**

composer.json

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,23 +121,6 @@
121121
"patches": {
122122
"illuminate/container": [
123123
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/illuminate-container-container-php.patch"
124-
],
125-
"nikic/php-parser": [
126-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-expr-closure-php.patch",
127-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-finally-php.patch",
128-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-function-php.patch",
129-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-do-php.patch",
130-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-catch-php.patch",
131-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-trycatch-php.patch",
132-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-for-php.patch",
133-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-classmethod-php.patch",
134-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-else-php.patch",
135-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-while-php.patch",
136-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-foreach-php.patch",
137-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-if-php.patch",
138-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-case-php.patch",
139-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-elseif-php.patch",
140-
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-namespace-php.patch"
141124
]
142125
},
143126
"composer-exit-on-patch-failure": true,

preload-split-package.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ function isPHPStanTestPreloaded(): bool
2626
}
2727

2828
require_once __DIR__ . '/../../../vendor/nikic/php-parser/lib/PhpParser/Node.php';
29-
require_once __DIR__ . '/src/Contract/PhpParser/Node/StmtsAwareInterface.php';
3029
require_once __DIR__ . '/../../../vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php';
3130
require_once __DIR__ . '/../../../vendor/nikic/php-parser/lib/PhpParser/Node/Expr.php';
3231
require_once __DIR__ . '/../../../vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php';

preload.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ function isPHPStanTestPreloaded(): bool
2626
}
2727

2828
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node.php';
29-
require_once __DIR__ . '/src/Contract/PhpParser/Node/StmtsAwareInterface.php';
3029
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php';
3130
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr.php';
3231
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php';

src/Contract/PhpParser/Node/StmtsAwareInterface.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/PhpParser/Node/CustomNode/FileWithoutNamespace.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Rector\PhpParser\Node\CustomNode;
66

77
use Override;
8-
use Rector\Contract\PhpParser\Node\StmtsAwareInterface;
98
use Rector\PhpParser\Node\FileNode;
109

1110
/**
@@ -14,7 +13,7 @@
1413
*
1514
* Inspired by https://github.com/phpstan/phpstan-src/commit/ed81c3ad0b9877e6122c79b4afda9d10f3994092
1615
*/
17-
final class FileWithoutNamespace extends FileNode implements StmtsAwareInterface
16+
final class FileWithoutNamespace extends FileNode
1817
{
1918
#[Override]
2019
public function getType(): string

src/Reporting/DeprecatedRulesReporter.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
use Rector\Configuration\Deprecation\Contract\DeprecatedInterface;
88
use Rector\Configuration\Option;
99
use Rector\Configuration\Parameter\SimpleParameterProvider;
10-
use Rector\Contract\PhpParser\Node\StmtsAwareInterface;
1110
use Rector\Contract\Rector\RectorInterface;
12-
use Rector\PhpParser\Enum\NodeGroup;
1311
use Rector\PhpParser\Node\CustomNode\FileWithoutNamespace;
1412
use Rector\PhpParser\Node\FileNode;
1513
use ReflectionMethod;
@@ -89,26 +87,12 @@ public function reportDeprecatedNodeTypes(): void
8987
continue;
9088
}
9189

92-
if (! in_array(StmtsAwareInterface::class, $rector->getNodeTypes())) {
93-
continue;
94-
}
95-
9690
// already reported, skip
9791
if (in_array($rector::class, $reportedClasses, true)) {
9892
continue;
9993
}
10094

10195
$reportedClasses[] = $rector::class;
102-
103-
$this->symfonyStyle->warning(sprintf(
104-
'Rector rule "%s" uses StmtsAwareInterface that is now deprecated.%sUse "%s::%s" instead.%sSee %s for more',
105-
$rector::class,
106-
PHP_EOL,
107-
NodeGroup::class,
108-
'STMTS_AWARE',
109-
PHP_EOL . PHP_EOL,
110-
'https://github.com/rectorphp/rector-src/pull/7679'
111-
));
11296
}
11397
}
11498

0 commit comments

Comments
 (0)