Skip to content

Commit 43b8dd6

Browse files
authored
fix: PHP mixed type is never nullable
The PHP "mixed" type is a union type including null, see: https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.mixed Therefore the type is never nullable, e.g. `?mixed $someParameter` is invalid and will generate a Fatal PHP Error: "Mixed types cannot be nullable, null is already part of the mixed type." This commit will fix mixed parameters.
1 parent 1c8d02b commit 43b8dd6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/internal/Magento/Framework/Code/Generator/EntityAbstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ private function extractParameterType(
352352
$typeName = $parameterType;
353353
}
354354

355-
if ($parameter->allowsNull()) {
355+
if ($parameter->allowsNull() && $typeName !== 'mixed') {
356356
$typeName = '?' . $typeName;
357357
}
358358

0 commit comments

Comments
 (0)