Skip to content

Commit 7765768

Browse files
committed
Fix overriding SoapClient old-style constructor
1 parent 53e7534 commit 7765768

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/Rules/Methods/OverridingMethodRule.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ private function findPrototype(ClassReflection $classReflection, string $methodN
375375
return null;
376376
}
377377
}
378+
} elseif (strtolower($methodName) === '__construct') {
379+
return null;
378380
}
379381
}
380382

tests/PHPStan/Rules/Methods/OverridingMethodRuleTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,4 +810,10 @@ public function testBug10153(): void
810810
$this->analyse([__DIR__ . '/data/bug-10153.php'], $errors);
811811
}
812812

813+
public function testBug10165(): void
814+
{
815+
$this->phpVersionId = PHP_VERSION_ID;
816+
$this->analyse([__DIR__ . '/data/bug-10165.php'], []);
817+
}
818+
813819
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace Bug10165;
6+
7+
class CustomSoapClient extends \SoapClient
8+
{
9+
public function __construct(array $options = [])
10+
{
11+
parent::__construct('some.wsdl', $options);
12+
}
13+
}

0 commit comments

Comments
 (0)