Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
parameters:
checkMissingOverrideMethodAttribute: true
level: max
paths:
- %rootDir%/../../../src
Expand Down
6 changes: 6 additions & 0 deletions tests/AbstractLexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Doctrine\Common\Lexer\AbstractLexer;
use Doctrine\Common\Lexer\Token;
use Override;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

Expand All @@ -22,11 +23,13 @@ class AbstractLexerTest extends TestCase
{
private ConcreteLexer $concreteLexer;

#[Override]
public function setUp(): void
{
$this->concreteLexer = new ConcreteLexer();
}

#[Override]
public function tearDown(): void
{
setlocale(LC_ALL, null);
Expand Down Expand Up @@ -291,6 +294,7 @@ public function testCanTokenizeFloatValue(): void
final public const int T_FLOAT = 4;
final public const int T_BOOL = 8;

#[Override]
protected function getType(string|int|float|bool &$value): int
{
if ($value === 'y') {
Expand All @@ -313,6 +317,7 @@ protected function getType(string|int|float|bool &$value): int
}

/** {@inheritDoc} */
#[Override]
protected function getCatchablePatterns(): array
{
return [
Expand All @@ -322,6 +327,7 @@ protected function getCatchablePatterns(): array
}

/** {@inheritDoc} */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't you also remove those {@inheritDoc} phpdoc that were (ab)used to document that it is an override with types documented in the parent) ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely, however I plan to do it at least when slevomat/coding-standard#1828 is released. And maybe there could be a fixer to automate that.

#[Override]
protected function getNonCatchablePatterns(): array
{
return ['\s+'];
Expand Down
4 changes: 4 additions & 0 deletions tests/ConcreteLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\Tests\Common\Lexer;

use Doctrine\Common\Lexer\AbstractLexer;
use Override;

use function in_array;
use function is_numeric;
Expand All @@ -17,6 +18,7 @@ class ConcreteLexer extends AbstractLexer
/**
* {@inheritDoc}
*/
#[Override]
protected function getCatchablePatterns(): array
{
return [
Expand All @@ -29,6 +31,7 @@ protected function getCatchablePatterns(): array
/**
* {@inheritDoc}
*/
#[Override]
protected function getNonCatchablePatterns(): array
{
return [
Expand All @@ -37,6 +40,7 @@ protected function getNonCatchablePatterns(): array
];
}

#[Override]
protected function getType(string|int|float &$value): string
{
if (is_numeric($value)) {
Expand Down
4 changes: 4 additions & 0 deletions tests/EnumLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\Tests\Common\Lexer;

use Doctrine\Common\Lexer\AbstractLexer;
use Override;

use function in_array;
use function is_numeric;
Expand All @@ -15,6 +16,7 @@ class EnumLexer extends AbstractLexer
/**
* {@inheritDoc}
*/
#[Override]
protected function getCatchablePatterns(): array
{
return [
Expand All @@ -27,6 +29,7 @@ protected function getCatchablePatterns(): array
/**
* {@inheritDoc}
*/
#[Override]
protected function getNonCatchablePatterns(): array
{
return [
Expand All @@ -35,6 +38,7 @@ protected function getNonCatchablePatterns(): array
];
}

#[Override]
protected function getType(string &$value): TokenType
{
if (is_numeric($value)) {
Expand Down
4 changes: 4 additions & 0 deletions tests/MutableLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\Tests\Common\Lexer;

use Doctrine\Common\Lexer\AbstractLexer;
use Override;

/** @extends AbstractLexer<int, string> */
class MutableLexer extends AbstractLexer
Expand All @@ -20,6 +21,7 @@ public function addCatchablePattern(string $pattern): void
/**
* {@inheritDoc}
*/
#[Override]
protected function getCatchablePatterns(): array
{
return $this->catchablePatterns;
Expand All @@ -28,11 +30,13 @@ protected function getCatchablePatterns(): array
/**
* {@inheritDoc}
*/
#[Override]
protected function getNonCatchablePatterns(): array
{
return ['[\s,]+'];
}

#[Override]
protected function getType(string &$value): int
{
return 1;
Expand Down