Skip to content

Commit 75abe79

Browse files
committed
Re-ensure nullable type on constructor when param has type
1 parent e7d904c commit 75abe79

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rules/DowngradePhp81/Rector/FunctionLike/DowngradeNewInInitializerRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private function replaceNewInParams(ClassMethod|Closure|Function_ $functionLike)
176176
}
177177

178178
// recheck after
179-
if ($isConstructor) {
179+
if ($isConstructor && $param->type !== null) {
180180
$param->type = $this->ensureNullableType($param->type);
181181
}
182182

0 commit comments

Comments
 (0)