Skip to content

Commit

Permalink
Fix overriding SoapClient old-style constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Nov 20, 2023
1 parent 53e7534 commit 7765768
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Rules/Methods/OverridingMethodRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ private function findPrototype(ClassReflection $classReflection, string $methodN
return null;
}
}
} elseif (strtolower($methodName) === '__construct') {
return null;
}
}

Expand Down
6 changes: 6 additions & 0 deletions tests/PHPStan/Rules/Methods/OverridingMethodRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -810,4 +810,10 @@ public function testBug10153(): void
$this->analyse([__DIR__ . '/data/bug-10153.php'], $errors);
}

public function testBug10165(): void
{
$this->phpVersionId = PHP_VERSION_ID;
$this->analyse([__DIR__ . '/data/bug-10165.php'], []);
}

}
13 changes: 13 additions & 0 deletions tests/PHPStan/Rules/Methods/data/bug-10165.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types = 1);

namespace Bug10165;

class CustomSoapClient extends \SoapClient
{
public function __construct(array $options = [])
{
parent::__construct('some.wsdl', $options);
}
}

0 comments on commit 7765768

Please sign in to comment.