Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  fix NoBrokenRefDirective false positive (#1823)
  Remove deprecated PHPStan options
  • Loading branch information
OskarStark committed Aug 28, 2024
2 parents 99b24f8 + f91bd2f commit d726549
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
7 changes: 5 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ includes:
- phpstan-baseline.neon

parameters:
ignoreErrors:
-
identifier: missingType.iterableValue
-
identifier: missingType.generics
paths:
- src
- tests
level: max
checkGenericClassInNonGenericObjectType: false
checkMissingIterableValueType: false
2 changes: 1 addition & 1 deletion src/Rule/NoBrokenRefDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function check(Lines $lines, int $number, string $filename): ViolationInt
$lines->seek($number);
$line = $lines->current();

if ($line->clean()->match('/(:ref\s|ref:)/') && !$line->clean()->match('/:ref:/')) {
if ($line->clean()->match('/(:ref\s|\sref:)/') && !$line->clean()->match('/:ref:/')) {
return Violation::from(
'Please use correct syntax for :ref: directive',
$filename,
Expand Down
14 changes: 9 additions & 5 deletions tests/Rule/NoBrokenRefDirectiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ public static function checkProvider(): iterable
'Please use correct syntax for :ref: directive',
'filename',
1,
'ref:`Redis section <messenger-redis-transport>` below',
'see ref:`Redis section <messenger-redis-transport>` below',
),
new RstSample('ref:`Redis section <messenger-redis-transport>` below'),
new RstSample('see ref:`Redis section <messenger-redis-transport>` below'),
],
[
Violation::from(
'Please use correct syntax for :ref: directive',
'filename',
1,
':ref `Redis section <messenger-redis-transport>` below',
'see :ref `Redis section <messenger-redis-transport>` below',
),
new RstSample(':ref `Redis section <messenger-redis-transport>` below'),
new RstSample('see :ref `Redis section <messenger-redis-transport>` below'),
],
[
NullViolation::create(),
new RstSample(':ref:`Redis section <messenger-redis-transport>` below'),
new RstSample('see :ref:`Redis section <messenger-redis-transport>` below'),
],
[
NullViolation::create(),
Expand All @@ -68,6 +68,10 @@ public static function checkProvider(): iterable
NullViolation::create(),
new RstSample('Then use the :method:`Symfony\\Component\\Lock\\LockInterface::refresh` method'),
],
[
NullViolation::create(),
new RstSample('new Link(href: style.css'),
],
];
}
}

0 comments on commit d726549

Please sign in to comment.