Skip to content

Commit 1188030

Browse files
Fix
1 parent 3f47f95 commit 1188030

6 files changed

Lines changed: 19 additions & 55 deletions

File tree

tests/Admin/AdminTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313

1414
namespace Sonata\ClassificationBundle\Tests\Admin;
1515

16+
use PHPUnit\Framework\MockObject\MockObject;
1617
use PHPUnit\Framework\TestCase;
1718
use Sonata\AdminBundle\Admin\AbstractAdmin;
1819
use Sonata\AdminBundle\Admin\AdminExtensionInterface;
1920
use Sonata\ClassificationBundle\Admin\ContextAdmin;
2021
use Sonata\ClassificationBundle\Admin\ContextAwareAdmin;
22+
use Sonata\ClassificationBundle\Model\ContextAwareInterface;
2123
use Sonata\ClassificationBundle\Model\ContextManagerInterface;
2224

2325
final class AdminTest extends TestCase
@@ -44,13 +46,15 @@ public function testGetPersistentParametersWithNoExtension(): void
4446
'hide_context' => 0,
4547
];
4648

49+
/** @phpstan-extends ContextAwareAdmin<ContextAwareInterface> */
4750
$admin = new class($this->contextManager) extends ContextAwareAdmin {};
4851

4952
static::assertSame($expected, $admin->getPersistentParameters());
5053
}
5154

5255
public function testGetPersistentParametersWithValidExtension(): void
5356
{
57+
/** @phpstan-extends ContextAwareAdmin<ContextAwareInterface> */
5458
$admin = new class($this->contextManager) extends ContextAwareAdmin {
5559
public function __construct(ContextManagerInterface $contextManager)
5660
{

tests/Controller/CategoryAdminControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public function testTreeAction(string|false $context, array $categories): void
266266
$categoriesMock = [];
267267
foreach ($categories as $category) {
268268
$categoryMock = new class extends Category {
269-
public function getId()
269+
public function getId(): int
270270
{
271271
return 42;
272272
}

tests/Entity/CategoryTest.php

Lines changed: 0 additions & 40 deletions
This file was deleted.

tests/Model/CategoryTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testSetterGetter(): void
2929
$context = $this->createMock(ContextInterface::class);
3030

3131
$category = new class extends Category {
32-
public function getId()
32+
public function getId(): int
3333
{
3434
return 42;
3535
}
@@ -67,14 +67,14 @@ public function getId()
6767
public function testParent(): void
6868
{
6969
$parent = new class extends Category {
70-
public function getId()
70+
public function getId(): int
7171
{
7272
return 33;
7373
}
7474
};
7575

7676
$category = new class extends Category {
77-
public function getId()
77+
public function getId(): int
7878
{
7979
return 42;
8080
}
@@ -87,19 +87,19 @@ public function getId()
8787
public function testChildren(): void
8888
{
8989
$cat1 = new class extends Category {
90-
public function getId()
90+
public function getId(): int
9191
{
9292
return 1;
9393
}
9494
};
9595
$cat2 = new class extends Category {
96-
public function getId()
96+
public function getId(): int
9797
{
9898
return 2;
9999
}
100100
};
101101
$cat3 = new class extends Category {
102-
public function getId()
102+
public function getId(): int
103103
{
104104
return 3;
105105
}
@@ -108,7 +108,7 @@ public function getId()
108108
$context = $this->createMock(ContextInterface::class);
109109

110110
$category = new class extends Category {
111-
public function getId()
111+
public function getId(): int
112112
{
113113
return 42;
114114
}
@@ -136,7 +136,7 @@ public function getId()
136136
public function testPrePersist(): void
137137
{
138138
$category = new class extends Category {
139-
public function getId()
139+
public function getId(): int
140140
{
141141
return 42;
142142
}
@@ -150,7 +150,7 @@ public function getId()
150150
public function testPreUpdate(): void
151151
{
152152
$category = new class extends Category {
153-
public function getId()
153+
public function getId(): int
154154
{
155155
return 42;
156156
}

tests/Model/CollectionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testSetterGetter(): void
2929
$context = $this->createMock(ContextInterface::class);
3030

3131
$collection = new class extends Collection {
32-
public function getId()
32+
public function getId(): int
3333
{
3434
return 42;
3535
}
@@ -65,7 +65,7 @@ public function getId()
6565
public function testPrePersist(): void
6666
{
6767
$collection = new class extends Collection {
68-
public function getId()
68+
public function getId(): int
6969
{
7070
return 42;
7171
}
@@ -79,7 +79,7 @@ public function getId()
7979
public function testPreUpdate(): void
8080
{
8181
$collection = new class extends Collection {
82-
public function getId()
82+
public function getId(): int
8383
{
8484
return 42;
8585
}

tests/Model/TagTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testSetterGetter(): void
2929
$context = $this->createMock(ContextInterface::class);
3030

3131
$tag = new class extends Tag {
32-
public function getId()
32+
public function getId(): int
3333
{
3434
return 42;
3535
}
@@ -63,7 +63,7 @@ public function getId()
6363
public function testPreUpdate(): void
6464
{
6565
$tag = new class extends Tag {
66-
public function getId()
66+
public function getId(): int
6767
{
6868
return 42;
6969
}

0 commit comments

Comments
 (0)