Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump phpstan #1164

Merged
merged 1 commit into from
Oct 25, 2024
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
}

Expand Down
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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\\<TValue of phpDocumentor\\\\Guides\\\\Nodes\\\\Inline\\\\InlineNodeInterface\\>\\:\\:createInlineNode\\(\\) invoked with 3 parameters, 2 required\\.$#"
count: 2
Expand Down
5 changes: 0 additions & 5 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
<code><![CDATA[scalarNode]]></code>
</UndefinedInterfaceMethod>
</file>
<file src="packages/guides-restructured-text/src/RestructuredText/Parser/Productions/InlineMarkupRule.php">
<MoreSpecificImplementedParamType>
<code><![CDATA[$on]]></code>
</MoreSpecificImplementedParamType>
</file>
<file src="packages/guides/src/Compiler/NodeTransformers/CustomNodeTransformerFactory.php">
<ReservedWord>
<code><![CDATA[NodeTransformer]]></code>
Expand Down
1 change: 1 addition & 0 deletions tests/Functional/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public function testFunctional(
$logHandler = $this->getContainer()->get(TestHandler::class);
assert($logHandler instanceof TestHandler);

/** @var list<string> $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 &&
Expand Down
Loading