-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PHPStan 2.0] replace instanceof usages #347
[PHPStan 2.0] replace instanceof usages #347
Conversation
@alexander-schranz |
It is caused by level I got green with
|
when debugging with diff --git a/test/StaticAnalysis/Test/ObjectProphecy/ProphesizeTest.php b/test/StaticAnalysis/Test/ObjectProphecy/ProphesizeTest.php
index edcc659..7d3d20f 100644
--- a/test/StaticAnalysis/Test/ObjectProphecy/ProphesizeTest.php
+++ b/test/StaticAnalysis/Test/ObjectProphecy/ProphesizeTest.php
@@ -29,10 +29,12 @@ final class ProphesizeTest extends Framework\TestCase
protected function setUp(): void
{
$this->prophecy = $this->prophesize(Src\BaseModel::class);
+ \PHPStan\dumpType($this->prophecy);
}
public function testCreateProphecyInSetUp(): void
{
+ \PHPStan\dumpType($this->prophecy);
$this->prophecy
->getFoo()
->willReturn('bar'); got ( both
|
Thanks @sasezaki for the suggestion! It now works, the test failure seems unrelated and probably it's failing on master too. |
This pull request is on top of #345
I attempts to replace all deprecated usages of
instaceof
in favor of dedicated methods: https://phpstan.org/developing-extensions/type-system#querying-a-specific-typeIt seems to work on the majority of cases, but it still fails in propagating the type outside of a method with no return type; I'm not sure if this is a change on PHPStan's side; maybe it now requires to declare the return type explicitly in the code, so that errors arise if it doesn't match?