diff --git a/rules-tests/Php81/Rector/ClassMethod/NewInInitializerRector/Fixture/skip_static_call_null_coalesce_operator.php.inc b/rules-tests/Php81/Rector/ClassMethod/NewInInitializerRector/Fixture/skip_static_call_null_coalesce_operator.php.inc new file mode 100644 index 00000000000..055535b8e3d --- /dev/null +++ b/rules-tests/Php81/Rector/ClassMethod/NewInInitializerRector/Fixture/skip_static_call_null_coalesce_operator.php.inc @@ -0,0 +1,13 @@ +foo ??= InstantiableViaNamedConstructor::make(100); + } +} diff --git a/rules-tests/Php81/Rector/ClassMethod/NewInInitializerRector/Fixture/skip_static_call_right_coalesce.php.inc b/rules-tests/Php81/Rector/ClassMethod/NewInInitializerRector/Fixture/skip_static_call_right_coalesce.php.inc new file mode 100644 index 00000000000..b39541a2ed6 --- /dev/null +++ b/rules-tests/Php81/Rector/ClassMethod/NewInInitializerRector/Fixture/skip_static_call_right_coalesce.php.inc @@ -0,0 +1,16 @@ +foo = $foo ?? InstantiableViaNamedConstructor::make(100); + } + +} diff --git a/rules-tests/Php81/Rector/ClassMethod/NewInInitializerRector/Source/InstantiableViaNamedConstructor.php b/rules-tests/Php81/Rector/ClassMethod/NewInInitializerRector/Source/InstantiableViaNamedConstructor.php new file mode 100644 index 00000000000..53a05e8f4d2 --- /dev/null +++ b/rules-tests/Php81/Rector/ClassMethod/NewInInitializerRector/Source/InstantiableViaNamedConstructor.php @@ -0,0 +1,17 @@ +expr->right instanceof New_) { + continue; + } + /** @var NullableType $currentParamType */ $currentParamType = $param->type; $param->type = $currentParamType->type;