File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
rules/Php81/Rector/ClassMethod Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -87,10 +87,7 @@ public function getNodeTypes(): array
8787 */
8888 public function refactor (Node $ node ): ?Node
8989 {
90- if ($ node ->stmts === null || $ node ->stmts === []) {
91- return null ;
92- }
93- if ($ node ->isAbstract () || $ node ->isAnonymous ()) {
90+ if ($ this ->shouldSkipClass ($ node )) {
9491 return null ;
9592 }
9693 $ constructClassMethod = $ node ->getMethod (MethodName::CONSTRUCT );
@@ -105,6 +102,9 @@ public function refactor(Node $node): ?Node
105102 foreach ((array ) $ constructClassMethod ->stmts as $ key => $ stmt ) {
106103 foreach ($ params as $ param ) {
107104 $ paramName = $ this ->getName ($ param );
105+ if ($ param ->type instanceof NullableType && $ param ->default === null ) {
106+ continue ;
107+ }
108108 $ coalesce = $ this ->coalescePropertyAssignMatcher ->matchCoalesceAssignsToLocalPropertyNamed ($ stmt , $ paramName );
109109 if (!$ coalesce instanceof Coalesce) {
110110 continue ;
@@ -185,4 +185,14 @@ private function matchConstructorParams(ClassMethod $classMethod): array
185185 }
186186 return $ params ;
187187 }
188+ private function shouldSkipClass (Class_ $ class ): bool
189+ {
190+ if ($ class ->stmts === []) {
191+ return \true;
192+ }
193+ if ($ class ->isAbstract ()) {
194+ return \true;
195+ }
196+ return $ class ->isAnonymous ();
197+ }
188198}
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 = 'b4e964f35fd53d681d1ac646dbcaed5b92ebe5fe ' ;
22+ public const PACKAGE_VERSION = 'f4f91968125ad521a0d7e7e3e70139489f476476 ' ;
2323 /**
2424 * @api
2525 * @var string
2626 */
27- public const RELEASE_DATE = '2025-10-23 09:29:10 ' ;
27+ public const RELEASE_DATE = '2025-10-23 11:17:34 ' ;
2828 /**
2929 * @var int
3030 */
You can’t perform that action at this time.
0 commit comments