File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
rules/TypeDeclaration/Rector/ClassMethod Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 99use PhpParser \Node \Stmt \Function_ ;
1010use Rector \Rector \AbstractRector ;
1111use Rector \TypeDeclaration \NodeAnalyzer \VariableInSprintfMaskMatcher ;
12+ use Rector \VendorLocker \ParentClassMethodTypeOverrideGuard ;
1213use Symplify \RuleDocGenerator \ValueObject \CodeSample \CodeSample ;
1314use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
1415/**
@@ -20,9 +21,14 @@ final class AddParamStringTypeFromSprintfUseRector extends AbstractRector
2021 * @readonly
2122 */
2223 private VariableInSprintfMaskMatcher $ variableInSprintfMaskMatcher ;
23- public function __construct (VariableInSprintfMaskMatcher $ variableInSprintfMaskMatcher )
24+ /**
25+ * @readonly
26+ */
27+ private ParentClassMethodTypeOverrideGuard $ parentClassMethodTypeOverrideGuard ;
28+ public function __construct (VariableInSprintfMaskMatcher $ variableInSprintfMaskMatcher , ParentClassMethodTypeOverrideGuard $ parentClassMethodTypeOverrideGuard )
2429 {
2530 $ this ->variableInSprintfMaskMatcher = $ variableInSprintfMaskMatcher ;
31+ $ this ->parentClassMethodTypeOverrideGuard = $ parentClassMethodTypeOverrideGuard ;
2632 }
2733 public function getRuleDefinition (): RuleDefinition
2834 {
@@ -65,6 +71,9 @@ public function refactor(Node $node)
6571 if ($ node ->getParams () === []) {
6672 return null ;
6773 }
74+ if ($ node instanceof ClassMethod && $ this ->parentClassMethodTypeOverrideGuard ->hasParentClassMethod ($ node )) {
75+ return null ;
76+ }
6877 $ hasChanged = \false;
6978 foreach ($ node ->getParams () as $ param ) {
7079 if ($ param ->type instanceof Node) {
Original file line number Diff line number Diff line change @@ -19,12 +19,12 @@ final class VersionResolver
1919 * @api
2020 * @var string
2121 */
22- public const PACKAGE_VERSION = '0a555c872e86970e85f5466675eabf5962fed325 ' ;
22+ public const PACKAGE_VERSION = '4b409e1205b1e98535cf5b9dc76eb37d8ed6dc94 ' ;
2323 /**
2424 * @api
2525 * @var string
2626 */
27- public const RELEASE_DATE = '2025-10-11 22:50:45 ' ;
27+ public const RELEASE_DATE = '2025-10-11 21:01:06 ' ;
2828 /**
2929 * @var int
3030 */
You can’t perform that action at this time.
0 commit comments