Skip to content

Commit 78f5d71

Browse files
authored
Merge pull request #150 from greg0ire/override
Use Override attribute where applicable
2 parents 23da848 + 067edf6 commit 78f5d71

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ includes:
44

55
parameters:
66
level: max
7+
checkMissingOverrideMethodAttribute: true
78
phpVersion: 80400
89
paths:
910
- src

src/Doctrine/Instantiator/Instantiator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Doctrine\Instantiator\Exception\InvalidArgumentException;
1010
use Doctrine\Instantiator\Exception\UnexpectedValueException;
1111
use Exception;
12+
use Override;
1213
use ReflectionClass;
1314
use ReflectionException;
1415
use Serializable;
@@ -55,6 +56,7 @@ final class Instantiator implements InstantiatorInterface
5556
*
5657
* @template T of object
5758
*/
59+
#[Override]
5860
public function instantiate(string $className): object
5961
{
6062
if (isset(self::$cachedCloneables[$className])) {

tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use DoctrineTest\InstantiatorTestAsset\XMLReaderAsset;
2626
use Exception;
2727
use Generator;
28+
use Override;
2829
use PDORow;
2930
use PharException;
3031
use PHPUnit\Framework\TestCase;
@@ -42,6 +43,7 @@ class InstantiatorTest extends TestCase
4243
{
4344
private Instantiator $instantiator;
4445

46+
#[Override]
4547
protected function setUp(): void
4648
{
4749
parent::setUp();

tests/DoctrineTest/InstantiatorTestAsset/SerializableArrayObjectAsset.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use ArrayObject;
88
use BadMethodCallException;
9+
use Override;
910
use Serializable;
1011

1112
/**
@@ -27,18 +28,18 @@ public function __construct()
2728
}
2829

2930
/**
30-
* {@inheritDoc}
31-
*
3231
* Should not be called
3332
*
3433
* @throws BadMethodCallException
3534
*/
36-
public function unserialize($serialized): void
35+
#[Override]
36+
public function unserialize(string $serialized): void
3737
{
3838
throw new BadMethodCallException('Not supposed to be called!');
3939
}
4040

4141
/** @param mixed[] $data */
42+
#[Override]
4243
public function __unserialize(array $data): void
4344
{
4445
throw new BadMethodCallException('Not supposed to be called!');

tests/DoctrineTest/InstantiatorTestAsset/SimpleSerializableAsset.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace DoctrineTest\InstantiatorTestAsset;
66

77
use BadMethodCallException;
8+
use Override;
89
use Serializable;
910

1011
/**
@@ -22,6 +23,7 @@ public function __construct()
2223
throw new BadMethodCallException('Not supposed to be called!');
2324
}
2425

26+
#[Override]
2527
public function serialize(): string
2628
{
2729
return '';
@@ -34,6 +36,7 @@ public function serialize(): string
3436
*
3537
* @throws BadMethodCallException
3638
*/
39+
#[Override]
3740
public function unserialize(string $serialized): void
3841
{
3942
throw new BadMethodCallException('Not supposed to be called!');

0 commit comments

Comments
 (0)