Skip to content

Commit

Permalink
Merge pull request #9009 from weirdan/allow-no-return-type-on-destruc…
Browse files Browse the repository at this point in the history
…tors

Fixes #9008
  • Loading branch information
weirdan committed Dec 26, 2022
2 parents c1273a8 + 52da29e commit 9f5314b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Psalm/Internal/Analyzer/InterfaceAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public function analyze(): void
$actual_method_id = $method_analyzer->getMethodId();

if ($stmt->name->name !== '__construct'
&& $stmt->name->name !== '__destruct'
&& $config->reportIssueInFile('InvalidReturnType', $this->getFilePath())
) {
ClassAnalyzer::analyzeClassMethodReturnType(
Expand Down
13 changes: 13 additions & 0 deletions tests/MethodSignatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,19 @@ final class B implements I
public function a(mixed $a): void {}
}',
],
'doesNotRequireInterfaceDestructorsToHaveReturnType' => [
'code' => '<?php
interface I
{
public function __destruct();
}
class C implements I
{
public function __destruct() {}
}
',
],
];
}

Expand Down

0 comments on commit 9f5314b

Please sign in to comment.