Skip to content

Commit 64a4f53

Browse files
committed
Added support of @mixin annotation to the BuilderMethodExtension
1 parent 1d05f7d commit 64a4f53

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/BuilderMethodExtension.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ public function setBroker(Broker $broker)
5151
*/
5252
public function hasMethod(ClassReflection $classReflection, string $methodName): bool
5353
{
54-
if ($classReflection->isSubclassOf(Model::class) && !isset($this->methods[$classReflection->getName()])) {
54+
if (!isset($this->methods[$classReflection->getName()]) && (
55+
$classReflection->isSubclassOf(Model::class)
56+
|| preg_match(
57+
'/@mixin\s+' . preg_quote('\\' . Builder::class) . '/',
58+
(string) $classReflection->getNativeReflection()->getDocComment()
59+
)
60+
)) {
5561
$builder = $this->broker->getClass(Builder::class);
5662
$this->methods[$classReflection->getName()] = $this->createWrappedMethods($classReflection, $builder);
5763

0 commit comments

Comments
 (0)