mirror of
https://github.com/danog/psalm.git
synced 2024-12-02 09:37:59 +01:00
parent
ba4e312594
commit
6b405937ab
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<files psalm-version="5.x-dev@76364ab2ccde9930513b0e3cc7e1757d3d0469f1">
|
<files psalm-version="5.x-dev@ba4e312594006059b0d9afb0c5ebeea649a59112">
|
||||||
<file src="vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php">
|
<file src="vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php">
|
||||||
<PossiblyUndefinedStringArrayOffset>
|
<PossiblyUndefinedStringArrayOffset>
|
||||||
<code><![CDATA[$subNodes['expr']]]></code>
|
<code><![CDATA[$subNodes['expr']]]></code>
|
||||||
@ -1057,6 +1057,7 @@
|
|||||||
<file src="src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php">
|
<file src="src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php">
|
||||||
<PossiblyUndefinedIntArrayOffset>
|
<PossiblyUndefinedIntArrayOffset>
|
||||||
<code><![CDATA[$method_name]]></code>
|
<code><![CDATA[$method_name]]></code>
|
||||||
|
<code><![CDATA[$method_name]]></code>
|
||||||
</PossiblyUndefinedIntArrayOffset>
|
</PossiblyUndefinedIntArrayOffset>
|
||||||
<RiskyTruthyFalsyComparison>
|
<RiskyTruthyFalsyComparison>
|
||||||
<code><![CDATA[!$context->calling_function_id]]></code>
|
<code><![CDATA[!$context->calling_function_id]]></code>
|
||||||
|
@ -257,6 +257,18 @@ final class ReturnAnalyzer
|
|||||||
$statements_analyzer,
|
$statements_analyzer,
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
[, $method_name] = explode('::', $cased_method_id);
|
||||||
|
if ($method_name === '__construct') {
|
||||||
|
IssueBuffer::maybeAdd(
|
||||||
|
new InvalidReturnStatement(
|
||||||
|
'No return values are expected for ' . $cased_method_id,
|
||||||
|
new CodeLocation($source, $stmt->expr),
|
||||||
|
),
|
||||||
|
$statements_analyzer->getSuppressedIssues(),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$declared_return_type = $storage->return_type;
|
$declared_return_type = $storage->return_type;
|
||||||
}
|
}
|
||||||
|
@ -1863,6 +1863,17 @@ class ReturnTypeTest extends TestCase
|
|||||||
'ignored_issues' => [],
|
'ignored_issues' => [],
|
||||||
'php_version' => '8.1',
|
'php_version' => '8.1',
|
||||||
],
|
],
|
||||||
|
'constructorsShouldReturnVoid' => [
|
||||||
|
'code' => <<<'PHP'
|
||||||
|
<?php
|
||||||
|
class A {
|
||||||
|
public function __construct() {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PHP,
|
||||||
|
'error_message' => 'InvalidReturnStatement',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user