Skip to content

Commit

Permalink
Merge pull request #301 from neos/robertlemke-patch-1
Browse files Browse the repository at this point in the history
Allow "static" return type for constructor methods
  • Loading branch information
robertlemke authored Mar 22, 2022
2 parents 0743f57 + d7c59ed commit 1e2e365
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Classes/EventStore/Normalizer/ValueObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* * they are public
* * they are static
* * they expect a single parameter of the given type
* * they have a "self" or "<TargetClassName>" return type annotation
* * they have a "self", "static" or "<TargetClassName>" return type annotation
*
* Note: For type "array" a named constructor fromArray() is required!
*/
Expand Down Expand Up @@ -116,7 +116,7 @@ private function resolveNamedConstructorMethod(string $dataType, string $classNa
return null;
}
$constructorMethodReturnTypeName = $constructorMethodReturnType->getName();
if ($constructorMethodReturnTypeName !== $className && $constructorMethodReturnTypeName !== 'self') {
if ($constructorMethodReturnTypeName !== $className && $constructorMethodReturnTypeName !== 'self' && $constructorMethodReturnTypeName !== 'static') {
return null;
}
$this->resolveNamedConstructorMethodCache[$cacheIdentifier] = $constructorMethod;
Expand Down

0 comments on commit 1e2e365

Please sign in to comment.