Skip to content

Commit c1260fb

Browse files
committed
Fix CS.
1 parent 2c77907 commit c1260fb

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/Method/AssociationTableMixinClassReflectionExtension.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ public function getMethod(ClassReflection $classReflection, string $methodName):
7878
}
7979

8080
// magic findBy* method on Association
81-
if ($classReflection->isSubclassOf(Association::class) && preg_match('/^find(?:\w+)?By/', $methodName) > 0) {
81+
$associationReflection = $this->reflectionProvider->getClass(Association::class);
82+
if (
83+
$classReflection->isSubclassOfClass($associationReflection)
84+
&& preg_match('/^find(?:\w+)?By/', $methodName) > 0
85+
) {
8286
return new TableFindByPropertyMethodReflection($methodName, $this->getTableReflection());
8387
}
8488

tests/test_app/Model/Table/NotesTable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ public function warning(): array
5454
$article->id = '002';
5555
// Test magic findBy methods on association chains (fixes issue #51)
5656
$articleQuery = $this->MyUsers->Articles->findByTitle('Test Title');
57-
$foundArticle = $articleQuery->first();
57+
$articleQuery->first();
5858
// Test findBy with And operator
59-
$articleAndQuery = $this->MyUsers->Articles->findByTitleAndActive('Test', true);
59+
$this->MyUsers->Articles->findByTitleAndActive('Test', true);
6060
// Test findBy with Or operator
61-
$articleOrQuery = $this->MyUsers->Articles->findByTitleOrActive('Test', true);
61+
$this->MyUsers->Articles->findByTitleOrActive('Test', true);
6262
$entity = $this->get(10, cache: 'my_cache');
6363
if ($entity->note === 'Test') {
6464
$entity = $this->newEmptyEntity();

tests/test_app/Model/Table/UsersTable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ public function blockOld(): void
4747
{
4848
// Test magic findBy methods on association (issue #51)
4949
$articleQuery = $this->Articles->findByTitle('Test');
50-
$article = $articleQuery->first();
50+
$articleQuery->first();
5151
}
5252
}

0 commit comments

Comments
 (0)