Skip to content

Commit cbe3798

Browse files
committed
[DebugClassLoader] Ignore __constructor() when checking return types
1 parent 3d54347 commit cbe3798

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

DebugClassLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,10 @@ private function getOwnInterfaces(string $class, ?string $parent): array
750750

751751
private function setReturnType(string $types, string $class, string $method, string $filename, ?string $parent, \ReflectionType $returnType = null): void
752752
{
753+
if ('__construct' === $method) {
754+
return;
755+
}
756+
753757
if ($nullable = 0 === strpos($types, 'null|')) {
754758
$types = substr($types, 5);
755759
} elseif ($nullable = '|null' === substr($types, -5)) {

Tests/Fixtures/ReturnType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
class ReturnType extends ReturnTypeParent implements ReturnTypeInterface, Fixtures\OutsideInterface
99
{
10+
public function __construct() { }
1011
public function returnTypeGrandParent() { }
1112
public function returnTypeParentInterface() { }
1213
public function returnTypeInterface() { }

Tests/Fixtures/ReturnTypeParent.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55
abstract class ReturnTypeParent extends ReturnTypeGrandParent implements ReturnTypeParentInterface
66
{
7+
/**
8+
* @return void
9+
*/
10+
public function __construct()
11+
{
12+
}
13+
714
/**
815
* No return declared here
916
*/

0 commit comments

Comments
 (0)