Skip to content

Commit

Permalink
Remove not longer required extension and fix handling of willImplemen…
Browse files Browse the repository at this point in the history
…t and willExtend (#369)

---------

Co-authored-by: Alexander Schranz <[email protected]>
  • Loading branch information
ondrejmirtes and alexander-schranz authored Feb 13, 2025
1 parent 401dba4 commit 9cb6e2a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 171 deletions.
5 changes: 0 additions & 5 deletions extension.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,3 @@ services:
class: JanGregor\Prophecy\Reflection\ObjectProphecy\MethodsClassReflectionExtension
tags:
- phpstan.broker.methodsClassReflectionExtension

-
class: JanGregor\Prophecy\Type\ObjectProphecy\WillExtendOrImplementDynamicReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension
8 changes: 1 addition & 7 deletions phpstan-with-extension-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
parameters:
ignoreErrors:
-
message: '#^Doing instanceof PHPStan\\Type\\Generic\\GenericObjectType is error\-prone and deprecated\.$#'
identifier: phpstanApi.instanceofType
count: 1
path: src/Type/ObjectProphecy/WillExtendOrImplementDynamicReturnTypeExtension.php

ignoreErrors: []
61 changes: 12 additions & 49 deletions phpstan-without-extension-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
parameters:
ignoreErrors:
-
message: '#^Doing instanceof PHPStan\\Type\\Generic\\GenericObjectType is error\-prone and deprecated\.$#'
identifier: phpstanApi.instanceofType
count: 1
path: src/Type/ObjectProphecy/WillExtendOrImplementDynamicReturnTypeExtension.php

-
message: '#^Call to an undefined method Prophecy\\Prophecy\\ObjectProphecy\<JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Bar\>\:\:bar\(\)\.$#'
identifier: method.notFound
Expand Down Expand Up @@ -43,80 +37,49 @@ parameters:
path: test/StaticAnalysis/Test/ObjectProphecy/ProphesizeTest.php

-
message: '#^Call to an undefined method Prophecy\\Prophecy\\ObjectProphecy\<JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Baz\>\:\:baz\(\)\.$#'
message: '#^Call to an undefined method Prophecy\\Prophecy\\ObjectProphecy\<JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Bar&JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Baz\>\:\:bar\(\)\.$#'
identifier: method.notFound
count: 2
count: 1
path: test/StaticAnalysis/Test/ObjectProphecy/WillExtendTest.php

-
message: '#^Call to an undefined method Prophecy\\Prophecy\\ObjectProphecy\<object\>\:\:baz\(\)\.$#'
message: '#^Call to an undefined method Prophecy\\Prophecy\\ObjectProphecy\<JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Baz\>\:\:baz\(\)\.$#'
identifier: method.notFound
count: 1
count: 3
path: test/StaticAnalysis/Test/ObjectProphecy/WillExtendTest.php

-
message: '#^Cannot call method shouldBeCalled\(\) on mixed\.$#'
identifier: method.nonObject
count: 3
count: 4
path: test/StaticAnalysis/Test/ObjectProphecy/WillExtendTest.php

-
message: '#^Cannot call method willReturn\(\) on mixed\.$#'
identifier: method.nonObject
count: 3
path: test/StaticAnalysis/Test/ObjectProphecy/WillExtendTest.php

-
message: '#^Method JanGregor\\Prophecy\\Test\\StaticAnalysis\\Test\\ObjectProphecy\\WillExtendTest\:\:createProphecy\(\) should return Prophecy\\Prophecy\\ObjectProphecy\<JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Baz\> but returns Prophecy\\Prophecy\\ObjectProphecy\<object\>\.$#'
identifier: return.type
count: 1
path: test/StaticAnalysis/Test/ObjectProphecy/WillExtendTest.php

-
message: '#^Parameter \#1 \$baz of method JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\BaseModel\:\:baz\(\) expects JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Baz, object given\.$#'
identifier: argument.type
count: 1
count: 4
path: test/StaticAnalysis/Test/ObjectProphecy/WillExtendTest.php

-
message: '#^Call to an undefined method Prophecy\\Prophecy\\ObjectProphecy\<JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Bar\>\:\:bar\(\)\.$#'
identifier: method.notFound
count: 2
path: test/StaticAnalysis/Test/ObjectProphecy/WillImplementTest.php

-
message: '#^Call to an undefined method Prophecy\\Prophecy\\ObjectProphecy\<JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Foo\>\:\:bar\(\)\.$#'
message: '#^Call to an undefined method Prophecy\\Prophecy\\ObjectProphecy\<JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Bar&JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Foo\>\:\:bar\(\)\.$#'
identifier: method.notFound
count: 1
count: 3
path: test/StaticAnalysis/Test/ObjectProphecy/WillImplementTest.php

-
message: '#^Call to an undefined method Prophecy\\Prophecy\\ObjectProphecy\<JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Foo\>\:\:foo\(\)\.$#'
message: '#^Call to an undefined method Prophecy\\Prophecy\\ObjectProphecy\<JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Bar&JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Foo\>\:\:foo\(\)\.$#'
identifier: method.notFound
count: 1
count: 2
path: test/StaticAnalysis/Test/ObjectProphecy/WillImplementTest.php

-
message: '#^Cannot call method shouldBeCalled\(\) on mixed\.$#'
identifier: method.nonObject
count: 4
count: 5
path: test/StaticAnalysis/Test/ObjectProphecy/WillImplementTest.php

-
message: '#^Cannot call method willReturn\(\) on mixed\.$#'
identifier: method.nonObject
count: 4
path: test/StaticAnalysis/Test/ObjectProphecy/WillImplementTest.php

-
message: '#^Method JanGregor\\Prophecy\\Test\\StaticAnalysis\\Test\\ObjectProphecy\\WillImplementTest\:\:createProphecy\(\) should return Prophecy\\Prophecy\\ObjectProphecy\<JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Bar\> but returns Prophecy\\Prophecy\\ObjectProphecy\<JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Foo\>\.$#'
identifier: return.type
count: 1
count: 5
path: test/StaticAnalysis/Test/ObjectProphecy/WillImplementTest.php

-
message: '#^Parameter \#1 \$bar of method JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\BaseModel\:\:bar\(\) expects JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Bar, JanGregor\\Prophecy\\Test\\StaticAnalysis\\Src\\Foo given\.$#'
identifier: argument.type
count: 1
path: test/StaticAnalysis/Test/ObjectProphecy/WillImplementTest.php

This file was deleted.

5 changes: 5 additions & 0 deletions test/StaticAnalysis/Src/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ public function baz(Baz $baz): string
{
return $baz->baz();
}

public function foo(Foo $foo): string
{
return $foo->foo();
}
}

0 comments on commit 9cb6e2a

Please sign in to comment.