You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updated Rector to commit 7188ba60120f5a561746893436390c24bc08d44a
rectorphp/rector-src@7188ba6 [depre] Deprecate IncreaseDeclareStrictTypesRector as adds declares randomly on consequent run, use DeclareStrictTypesRector instead (#7726)
Copy file name to clipboardExpand all lines: rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -69,7 +69,7 @@ public function getNodeTypes(): array
69
69
*/
70
70
publicfunctionrefactor(Node$node): ?Node
71
71
{
72
-
thrownewShouldNotHappenException(sprintf('%s is deprecated as opinonated and group size depends on context. Cannot be automated. Use manually where needed instead', self::class));
72
+
thrownewShouldNotHappenException(sprintf('"%s" is deprecated as opinionated and group size depends on context. Cannot be automated. Use manually where needed instead', self::class));
* @deprecated As keeps changing files randomly on every run. Not deterministic. Use more reliable @see \Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector instead on specific paths.
returnnewRuleDefinition('Add declare strict types to a limited amount of classes at a time, to try out in the wild and increase level gradually', [newConfiguredCodeSample(<<<'CODE_SAMPLE'
@@ -51,35 +33,6 @@ function someFunction()
51
33
CODE_SAMPLE
52
34
, [self::LIMIT => 10])]);
53
35
}
54
-
/**
55
-
* @param Stmt[] $nodes
56
-
* @return Stmt[]|null
57
-
*/
58
-
publicfunctionbeforeTraverse(array$nodes): ?array
59
-
{
60
-
parent::beforeTraverse($nodes);
61
-
if ($nodes === []) {
62
-
returnnull;
63
-
}
64
-
$rootStmt = \current($nodes);
65
-
$stmt = $rootStmt;
66
-
// skip classes without namespace for safety reasons
67
-
if ($rootStmtinstanceof FileWithoutNamespace) {
68
-
returnnull;
69
-
}
70
-
if ($this->declareStrictTypeFinder->hasDeclareStrictTypes($stmt)) {
@@ -92,20 +45,12 @@ public function getNodeTypes(): array
92
45
*/
93
46
publicfunctionrefactor(Node$node): ?Node
94
47
{
95
-
// workaround, as Rector now only hooks to specific nodes, not arrays
96
-
returnnull;
48
+
thrownewShouldNotHappenException(sprintf('"%s" is deprecated as changes strict types randomly on each run.. Use "%s" Rector on specific paths instead.', self::class, \Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector::class));
0 commit comments