1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 13:51:54 +01:00

Merge pull request #9009 from weirdan/allow-no-return-type-on-destructors

Fixes https://github.com/vimeo/psalm/issues/9008
This commit is contained in:
Bruce Weirdan 2022-12-26 15:58:50 -04:00 committed by GitHub
commit 9f5314b146
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -139,6 +139,7 @@ class InterfaceAnalyzer extends ClassLikeAnalyzer
$actual_method_id = $method_analyzer->getMethodId();
if ($stmt->name->name !== '__construct'
&& $stmt->name->name !== '__destruct'
&& $config->reportIssueInFile('InvalidReturnType', $this->getFilePath())
) {
ClassAnalyzer::analyzeClassMethodReturnType(

View File

@ -916,6 +916,19 @@ class MethodSignatureTest extends TestCase
public function a(mixed $a): void {}
}',
],
'doesNotRequireInterfaceDestructorsToHaveReturnType' => [
'code' => '<?php
interface I
{
public function __destruct();
}
class C implements I
{
public function __destruct() {}
}
',
],
];
}