diff --git a/composer.json b/composer.json index f37cf7698..5b238138d 100644 --- a/composer.json +++ b/composer.json @@ -59,7 +59,7 @@ "league/flysystem-memory": "^1.0", "phpbench/phpbench": "^1.3", "phpstan/extension-installer": "^1.3", - "phpstan/phpstan": "^1.11", + "phpstan/phpstan": "^1.12", "phpstan/phpstan-strict-rules": "^1.6", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^10.5", diff --git a/composer.lock b/composer.lock index 07cdea1ac..5759764a6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5c44fdb9ce8b1709c92d86b1d5c127e8", + "content-hash": "c4c01865a1c16ea349f6be54fcf8ea1b", "packages": [ { "name": "dflydev/dot-access-data", @@ -5901,16 +5901,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.3", + "version": "1.12.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e64220a05c1209fc856d58e789c3b7a32c0bb9a5" + "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e64220a05c1209fc856d58e789c3b7a32c0bb9a5", - "reference": "e64220a05c1209fc856d58e789c3b7a32c0bb9a5", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", + "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", "shasum": "" }, "require": { @@ -5955,7 +5955,7 @@ "type": "github" } ], - "time": "2024-05-31T13:53:37+00:00" + "time": "2024-10-18T11:12:07+00:00" }, { "name": "phpstan/phpstan-strict-rules", diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/RoleDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/RoleDirective.php index e0448aaea..5cf51be96 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/RoleDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/RoleDirective.php @@ -47,7 +47,7 @@ public function processAction( ): void { $name = $directive->getData(); $role = 'span'; - if (preg_match('/^([A-Za-z-]*)\(([A-Za-z-]*)\)$/', trim($name), $match) > 0) { + if (preg_match('/^([A-Za-z-]*)\(([A-Za-z-]*)\)$/', trim($name), $match) === 1) { $name = $match[1]; $role = $match[2]; } diff --git a/packages/guides-restructured-text/src/RestructuredText/Parser/Interlink/DefaultInterlinkParser.php b/packages/guides-restructured-text/src/RestructuredText/Parser/Interlink/DefaultInterlinkParser.php index b56cc699a..6e58f0933 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Parser/Interlink/DefaultInterlinkParser.php +++ b/packages/guides-restructured-text/src/RestructuredText/Parser/Interlink/DefaultInterlinkParser.php @@ -26,6 +26,6 @@ public function extractInterlink(string $fullReference): InterlinkData return new InterlinkData($fullReference, ''); } - return new InterlinkData($matches[2], $matches[1] ?? ''); + return new InterlinkData($matches[2], $matches[1]); } } diff --git a/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/DirectiveRule.php b/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/DirectiveRule.php index 39ff9ce16..178eb004a 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/DirectiveRule.php +++ b/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/DirectiveRule.php @@ -256,11 +256,11 @@ private function isDirectiveOption(string|null $line): bool */ private function parseDirectiveOption(string $line): DirectiveOption { - if (preg_match('/^(\s+):(.+): (.*)$/mUsi', $line, $match) > 0) { + if (preg_match('/^(\s+):(.+): (.*)$/mUsi', $line, $match) === 1) { return new DirectiveOption($match[2], trim($match[3])); } - if (preg_match('/^(\s+):(.+):(\s*)$/mUsi', $line, $match) > 0) { + if (preg_match('/^(\s+):(.+):(\s*)$/mUsi', $line, $match) === 1) { return new DirectiveOption($match[2], true); } diff --git a/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/LinkRule.php b/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/LinkRule.php index 5b814ae9a..f648a724f 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/LinkRule.php +++ b/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/LinkRule.php @@ -61,30 +61,30 @@ public function apply(BlockContext $blockContext, CompoundNode|null $on = null): private function parseLink(string $line): LinkParser|null { // Links - if (preg_match('/^\.\.\s+_`(.+)`: (.+)$/mUsi', $line, $match) > 0) { + if (preg_match('/^\.\.\s+_`(.+)`: (.+)$/mUsi', $line, $match) === 1) { return $this->createLink($match[1], $match[2], LinkParser::TYPE_LINK); } // anonymous links - if (preg_match('/^\.\.\s+_(.+): (.+)$/mUsi', $line, $match) > 0) { + if (preg_match('/^\.\.\s+_(.+): (.+)$/mUsi', $line, $match) === 1) { return $this->createLink($match[1], $match[2], LinkParser::TYPE_LINK); } // Short anonymous links - if (preg_match('/^__\s+(.+)$/mUsi', trim($line), $match) > 0) { + if (preg_match('/^__\s+(.+)$/mUsi', trim($line), $match) === 1) { $url = $match[1]; return $this->createLink('_', $url, LinkParser::TYPE_LINK); } // Anchor links - ".. _`anchor-link`:" - if (preg_match('/^\.\.\s+_`(.+)`:$/mUsi', trim($line), $match) > 0) { + if (preg_match('/^\.\.\s+_`(.+)`:$/mUsi', trim($line), $match) === 1) { $anchor = $match[1]; return new LinkParser($anchor, '#' . $anchor, LinkParser::TYPE_ANCHOR); } - if (preg_match('/^\.\.\s+_(.+):$/mUsi', trim($line), $match) > 0) { + if (preg_match('/^\.\.\s+_(.+):$/mUsi', trim($line), $match) === 1) { $anchor = $match[1]; return $this->createLink($anchor, '#' . $anchor, LinkParser::TYPE_ANCHOR); diff --git a/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/ListRule.php b/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/ListRule.php index a97d996dd..0bd50f823 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/ListRule.php +++ b/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/ListRule.php @@ -127,7 +127,7 @@ private function isListLine(string|null $line): bool /** @return array{marker: string, indenting: int} */ public function getItemConfig(string $line): array { - $isList = preg_match(self::LIST_MARKER_REGEX, $line, $m) > 0; + $isList = preg_match(self::LIST_MARKER_REGEX, $line, $m) === 1; if (!$isList) { throw new InvalidArgumentException('Line is not a valid item line'); } @@ -144,7 +144,7 @@ private function isListItemStart(string|null $line, string|null $listMarker = nu return false; } - $isList = preg_match(self::LIST_MARKER_REGEX, $line, $m) > 0; + $isList = preg_match(self::LIST_MARKER_REGEX, $line, $m) === 1; if (!$isList) { return false; } diff --git a/packages/guides-restructured-text/src/RestructuredText/TextRoles/AbbreviationTextRole.php b/packages/guides-restructured-text/src/RestructuredText/TextRoles/AbbreviationTextRole.php index 22c1f98c0..4d4422f39 100644 --- a/packages/guides-restructured-text/src/RestructuredText/TextRoles/AbbreviationTextRole.php +++ b/packages/guides-restructured-text/src/RestructuredText/TextRoles/AbbreviationTextRole.php @@ -52,7 +52,7 @@ public function processNode( string $content, string $rawContent, ): InlineNode { - if (preg_match('/([^\(]+)\(([^\)]+)\)$/', $content, $matches) !== 0) { + if (preg_match('/([^\(]+)\(([^\)]+)\)$/', $content, $matches) === 1) { return new AbbreviationInlineNode(trim($matches[1]), trim($matches[2])); } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 374965cf7..a9c069328 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -85,11 +85,6 @@ parameters: count: 1 path: packages/guides-graphs/src/Graphs/DependencyInjection/GraphsExtension.php - - - message: "#^Parameter \\#1 \\$filename of function file_put_contents expects string, string\\|false given\\.$#" - count: 1 - path: packages/guides-graphs/src/Graphs/Renderer/PlantumlRenderer.php - - message: "#^Method phpDocumentor\\\\Guides\\\\Markdown\\\\Parsers\\\\InlineParsers\\\\AbstractInlineTextDecoratorParser\\\\:\\:createInlineNode\\(\\) invoked with 3 parameters, 2 required\\.$#" count: 2 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 58414e0c2..26c50cb2f 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -23,11 +23,6 @@ - - - - - diff --git a/tests/Functional/FunctionalTest.php b/tests/Functional/FunctionalTest.php index ac5103041..5c8cdc733 100644 --- a/tests/Functional/FunctionalTest.php +++ b/tests/Functional/FunctionalTest.php @@ -160,6 +160,7 @@ public function testFunctional( $logHandler = $this->getContainer()->get(TestHandler::class); assert($logHandler instanceof TestHandler); + /** @var list $logRecords */ $logRecords = array_map( static fn (array|LogRecord $log) => $log['level_name'] . ': ' . $log['message'], array_filter($logHandler->getRecords(), static fn (array|LogRecord $log) => $log['level'] >= Logger::WARNING &&