Skip to content

Commit 8fb464e

Browse files
authored
Merge pull request #1164 from phpDocumentor/bump/phpstan
Bump phpstan
2 parents 6b8ce65 + e58bcba commit 8fb464e

File tree

11 files changed

+20
-29
lines changed

11 files changed

+20
-29
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"league/flysystem-memory": "^1.0",
6060
"phpbench/phpbench": "^1.3",
6161
"phpstan/extension-installer": "^1.3",
62-
"phpstan/phpstan": "^1.11",
62+
"phpstan/phpstan": "^1.12",
6363
"phpstan/phpstan-strict-rules": "^1.6",
6464
"phpstan/phpstan-webmozart-assert": "^1.2",
6565
"phpunit/phpunit": "^10.5",

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/guides-restructured-text/src/RestructuredText/Directives/RoleDirective.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function processAction(
4747
): void {
4848
$name = $directive->getData();
4949
$role = 'span';
50-
if (preg_match('/^([A-Za-z-]*)\(([A-Za-z-]*)\)$/', trim($name), $match) > 0) {
50+
if (preg_match('/^([A-Za-z-]*)\(([A-Za-z-]*)\)$/', trim($name), $match) === 1) {
5151
$name = $match[1];
5252
$role = $match[2];
5353
}

packages/guides-restructured-text/src/RestructuredText/Parser/Interlink/DefaultInterlinkParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ public function extractInterlink(string $fullReference): InterlinkData
2626
return new InterlinkData($fullReference, '');
2727
}
2828

29-
return new InterlinkData($matches[2], $matches[1] ?? '');
29+
return new InterlinkData($matches[2], $matches[1]);
3030
}
3131
}

packages/guides-restructured-text/src/RestructuredText/Parser/Productions/DirectiveRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,11 @@ private function isDirectiveOption(string|null $line): bool
256256
*/
257257
private function parseDirectiveOption(string $line): DirectiveOption
258258
{
259-
if (preg_match('/^(\s+):(.+): (.*)$/mUsi', $line, $match) > 0) {
259+
if (preg_match('/^(\s+):(.+): (.*)$/mUsi', $line, $match) === 1) {
260260
return new DirectiveOption($match[2], trim($match[3]));
261261
}
262262

263-
if (preg_match('/^(\s+):(.+):(\s*)$/mUsi', $line, $match) > 0) {
263+
if (preg_match('/^(\s+):(.+):(\s*)$/mUsi', $line, $match) === 1) {
264264
return new DirectiveOption($match[2], true);
265265
}
266266

packages/guides-restructured-text/src/RestructuredText/Parser/Productions/LinkRule.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,30 +61,30 @@ public function apply(BlockContext $blockContext, CompoundNode|null $on = null):
6161
private function parseLink(string $line): LinkParser|null
6262
{
6363
// Links
64-
if (preg_match('/^\.\.\s+_`(.+)`: (.+)$/mUsi', $line, $match) > 0) {
64+
if (preg_match('/^\.\.\s+_`(.+)`: (.+)$/mUsi', $line, $match) === 1) {
6565
return $this->createLink($match[1], $match[2], LinkParser::TYPE_LINK);
6666
}
6767

6868
// anonymous links
69-
if (preg_match('/^\.\.\s+_(.+): (.+)$/mUsi', $line, $match) > 0) {
69+
if (preg_match('/^\.\.\s+_(.+): (.+)$/mUsi', $line, $match) === 1) {
7070
return $this->createLink($match[1], $match[2], LinkParser::TYPE_LINK);
7171
}
7272

7373
// Short anonymous links
74-
if (preg_match('/^__\s+(.+)$/mUsi', trim($line), $match) > 0) {
74+
if (preg_match('/^__\s+(.+)$/mUsi', trim($line), $match) === 1) {
7575
$url = $match[1];
7676

7777
return $this->createLink('_', $url, LinkParser::TYPE_LINK);
7878
}
7979

8080
// Anchor links - ".. _`anchor-link`:"
81-
if (preg_match('/^\.\.\s+_`(.+)`:$/mUsi', trim($line), $match) > 0) {
81+
if (preg_match('/^\.\.\s+_`(.+)`:$/mUsi', trim($line), $match) === 1) {
8282
$anchor = $match[1];
8383

8484
return new LinkParser($anchor, '#' . $anchor, LinkParser::TYPE_ANCHOR);
8585
}
8686

87-
if (preg_match('/^\.\.\s+_(.+):$/mUsi', trim($line), $match) > 0) {
87+
if (preg_match('/^\.\.\s+_(.+):$/mUsi', trim($line), $match) === 1) {
8888
$anchor = $match[1];
8989

9090
return $this->createLink($anchor, '#' . $anchor, LinkParser::TYPE_ANCHOR);

packages/guides-restructured-text/src/RestructuredText/Parser/Productions/ListRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private function isListLine(string|null $line): bool
127127
/** @return array{marker: string, indenting: int} */
128128
public function getItemConfig(string $line): array
129129
{
130-
$isList = preg_match(self::LIST_MARKER_REGEX, $line, $m) > 0;
130+
$isList = preg_match(self::LIST_MARKER_REGEX, $line, $m) === 1;
131131
if (!$isList) {
132132
throw new InvalidArgumentException('Line is not a valid item line');
133133
}
@@ -144,7 +144,7 @@ private function isListItemStart(string|null $line, string|null $listMarker = nu
144144
return false;
145145
}
146146

147-
$isList = preg_match(self::LIST_MARKER_REGEX, $line, $m) > 0;
147+
$isList = preg_match(self::LIST_MARKER_REGEX, $line, $m) === 1;
148148
if (!$isList) {
149149
return false;
150150
}

packages/guides-restructured-text/src/RestructuredText/TextRoles/AbbreviationTextRole.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function processNode(
5252
string $content,
5353
string $rawContent,
5454
): InlineNode {
55-
if (preg_match('/([^\(]+)\(([^\)]+)\)$/', $content, $matches) !== 0) {
55+
if (preg_match('/([^\(]+)\(([^\)]+)\)$/', $content, $matches) === 1) {
5656
return new AbbreviationInlineNode(trim($matches[1]), trim($matches[2]));
5757
}
5858

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ parameters:
8585
count: 1
8686
path: packages/guides-graphs/src/Graphs/DependencyInjection/GraphsExtension.php
8787

88-
-
89-
message: "#^Parameter \\#1 \\$filename of function file_put_contents expects string, string\\|false given\\.$#"
90-
count: 1
91-
path: packages/guides-graphs/src/Graphs/Renderer/PlantumlRenderer.php
92-
9388
-
9489
message: "#^Method phpDocumentor\\\\Guides\\\\Markdown\\\\Parsers\\\\InlineParsers\\\\AbstractInlineTextDecoratorParser\\<TValue of phpDocumentor\\\\Guides\\\\Nodes\\\\Inline\\\\InlineNodeInterface\\>\\:\\:createInlineNode\\(\\) invoked with 3 parameters, 2 required\\.$#"
9590
count: 2

psalm-baseline.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
<code><![CDATA[scalarNode]]></code>
2424
</UndefinedInterfaceMethod>
2525
</file>
26-
<file src="packages/guides-restructured-text/src/RestructuredText/Parser/Productions/InlineMarkupRule.php">
27-
<MoreSpecificImplementedParamType>
28-
<code><![CDATA[$on]]></code>
29-
</MoreSpecificImplementedParamType>
30-
</file>
3126
<file src="packages/guides/src/Compiler/NodeTransformers/CustomNodeTransformerFactory.php">
3227
<ReservedWord>
3328
<code><![CDATA[NodeTransformer]]></code>

tests/Functional/FunctionalTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ public function testFunctional(
160160
$logHandler = $this->getContainer()->get(TestHandler::class);
161161
assert($logHandler instanceof TestHandler);
162162

163+
/** @var list<string> $logRecords */
163164
$logRecords = array_map(
164165
static fn (array|LogRecord $log) => $log['level_name'] . ': ' . $log['message'],
165166
array_filter($logHandler->getRecords(), static fn (array|LogRecord $log) => $log['level'] >= Logger::WARNING &&

0 commit comments

Comments
 (0)