Skip to content

Commit 0c260a9

Browse files
committed
* Add Override attributes instead of disabling psalm feature
Signed-off-by: Thomas Rieschl <[email protected]>
1 parent 1dc9e2e commit 0c260a9

11 files changed

+28
-1
lines changed

psalm.xml

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
xmlns="https://getpsalm.org/schema/config"
66
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
77
errorLevel="1"
8-
ensureOverrideAttribute="false"
98
findUnusedPsalmSuppress="true"
109
findUnusedCode="true"
1110
findUnusedBaselineEntry="true"

src/PHPUnit/Constraint/HasRedirectConstraint.php

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Laminas\Http\Header\Location;
88
use Laminas\Http\PhpEnvironment\Response;
99
use Laminas\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
10+
use Override;
1011
use PHPUnit\Framework\Constraint\Constraint;
1112

1213
final class HasRedirectConstraint extends Constraint
@@ -15,12 +16,14 @@ public function __construct(private readonly AbstractHttpControllerTestCase $act
1516
{
1617
}
1718

19+
#[Override]
1820
public function toString(): string
1921
{
2022
return 'has a redirect';
2123
}
2224

2325
/** @param mixed $other */
26+
#[Override]
2427
public function matches($other): bool
2528
{
2629
$response = $this->activeTestCase->getResponse();

src/PHPUnit/Constraint/IsCurrentModuleNameConstraint.php

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Laminas\Test\PHPUnit\Constraint;
66

7+
use Override;
8+
79
use function ltrim;
810
use function str_contains;
911
use function strrpos;
@@ -12,19 +14,22 @@
1214

1315
final class IsCurrentModuleNameConstraint extends LaminasConstraint
1416
{
17+
#[Override]
1518
public function toString(): string
1619
{
1720
return 'is the actual module name';
1821
}
1922

2023
/** @param mixed $other */
24+
#[Override]
2125
public function failureDescription($other): string
2226
{
2327
$other = (string) $other;
2428
return "\"$other\" {$this->toString()}, actual module name is \"{$this->getCurrentModuleName()}\"";
2529
}
2630

2731
/** @param mixed $other */
32+
#[Override]
2833
public function matches($other): bool
2934
{
3035
$other = (string) $other;

src/PHPUnit/Constraint/IsRedirectedRouteNameConstraint.php

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Laminas\Mvc\Controller\Plugin\Url;
1313
use Laminas\Router\RouteMatch;
1414
use Laminas\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
15+
use Override;
1516
use PHPUnit\Framework\Constraint\Constraint;
1617
use RuntimeException;
1718

@@ -25,12 +26,14 @@ public function __construct(private readonly AbstractHttpControllerTestCase $act
2526
{
2627
}
2728

29+
#[Override]
2830
public function toString(): string
2931
{
3032
return 'is the redirected route name';
3133
}
3234

3335
/** @param mixed $other */
36+
#[Override]
3437
public function matches($other): bool
3538
{
3639
if (! is_string($other)) {

src/PHPUnit/Constraint/LaminasConstraint.php

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Exception;
88
use Laminas\Test\PHPUnit\Controller\AbstractControllerTestCase;
9+
use Override;
910
use PHPUnit\Framework\Constraint\Constraint;
1011
use PHPUnit\Framework\ExpectationFailedException;
1112
use SebastianBergmann\Comparator\ComparisonFailure;
@@ -33,6 +34,7 @@ final public function getTestCase(): AbstractControllerTestCase
3334
/**
3435
* @psalm-return never
3536
*/
37+
#[Override]
3638
final public function fail(mixed $other, string $description, ?ComparisonFailure $comparisonFailure = null): never
3739
{
3840
try {

src/PHPUnit/Controller/AbstractControllerTestCase.php

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Laminas\Test\PHPUnit\Constraint\IsCurrentModuleNameConstraint;
2424
use Laminas\Uri\Http as HttpUri;
2525
use Laminas\View\Model\ModelInterface;
26+
use Override;
2627
use PHPUnit\Framework\Assert;
2728
use PHPUnit\Framework\ExpectationFailedException;
2829
use PHPUnit\Framework\TestCase;
@@ -66,6 +67,7 @@ abstract class AbstractControllerTestCase extends TestCase
6667
/**
6768
* Reset the application for isolation
6869
*/
70+
#[Override]
6971
protected function setUp(): void
7072
{
7173
$this->reset();
@@ -74,6 +76,7 @@ protected function setUp(): void
7476
/**
7577
* Restore params
7678
*/
79+
#[Override]
7780
protected function tearDown(): void
7881
{
7982
// Prevent memory leak

test/PHPUnit/Controller/AbstractControllerTestCaseTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use LaminasTest\Test\ExpectedExceptionTrait;
1616
use org\bovigo\vfs\vfsStream;
1717
use org\bovigo\vfs\vfsStreamWrapper;
18+
use Override;
1819
use PHPUnit\Framework\AssertionFailedError;
1920
use PHPUnit\Framework\Attributes\DataProvider;
2021
use PHPUnit\Framework\ExpectationFailedException;
@@ -70,6 +71,7 @@ public static function rmdir(string $dir): bool
7071
return rmdir($dir);
7172
}
7273

74+
#[Override]
7375
protected function setUp(): void
7476
{
7577
$this->traceErrorCache = $this->traceError;
@@ -80,6 +82,7 @@ protected function setUp(): void
8082
parent::setUp();
8183
}
8284

85+
#[Override]
8386
protected function tearDown(): void
8487
{
8588
$this->traceError = $this->traceErrorCache;

test/PHPUnit/Controller/AbstractHttpControllerTestCaseTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Laminas\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
1212
use Laminas\View\Model\ViewModel;
1313
use LaminasTest\Test\ExpectedExceptionTrait;
14+
use Override;
1415
use PHPUnit\Framework\ExpectationFailedException;
1516
use RuntimeException;
1617

@@ -24,6 +25,7 @@ class AbstractHttpControllerTestCaseTest extends AbstractHttpControllerTestCase
2425
{
2526
use ExpectedExceptionTrait;
2627

28+
#[Override]
2729
protected function setUp(): void
2830
{
2931
$this->setApplicationConfig(

test/PHPUnit/Controller/MemoryLeakTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace LaminasTest\Test\PHPUnit\Controller;
66

77
use Laminas\Test\PHPUnit\Controller\AbstractControllerTestCase;
8+
use Override;
89
use PHPUnit\Framework\Attributes\DataProvider;
910

1011
use function array_fill;
@@ -15,6 +16,7 @@ class MemoryLeakTest extends AbstractControllerTestCase
1516
/** @var int|null */
1617
public static $memStart;
1718

19+
#[Override]
1820
public static function setUpBeforeClass(): void
1921
{
2022
self::$memStart = memory_get_usage(true);

test/PHPUnit/Util/ModuleLoaderTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Laminas\Test\Util\ModuleLoader;
1212
use LaminasTest\Test\ExpectedExceptionTrait;
1313
use ModuleWithNamespace\TestModule\Module;
14+
use Override;
1415
use PHPUnit\Framework\TestCase;
1516

1617
use function array_diff;
@@ -48,11 +49,13 @@ public static function rmdir($dir): bool
4849
return rmdir($dir);
4950
}
5051

52+
#[Override]
5153
protected function setUp(): void
5254
{
5355
$this->tearDownCacheDir();
5456
}
5557

58+
#[Override]
5659
protected function tearDown(): void
5760
{
5861
$this->tearDownCacheDir();

test/_files/modules-path/with-subdir/Qux/Module.php

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Laminas\ModuleManager\Feature\InitProviderInterface;
88
use Laminas\ModuleManager\ModuleManagerInterface;
9+
use Override;
910
use stdClass;
1011

1112
/** @psalm-suppress UnusedClass */
@@ -22,6 +23,7 @@ public function getConfig(): array
2223
];
2324
}
2425

26+
#[Override]
2527
public function init(ModuleManagerInterface $manager): void
2628
{
2729
$manager->loadModule('Foo');

0 commit comments

Comments
 (0)