This repository was archived by the owner on Jul 8, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +41
-21
lines changed Expand file tree Collapse file tree 6 files changed +41
-21
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 1313 ],
1414 "type" : " phpstan-extension" ,
1515 "require" : {
16- "php" : " >=7.2 " ,
16+ "php" : " ^7.3 || ^8 " ,
1717 "phpstan/phpstan" : " ^0.12"
1818 },
1919 "require-dev" : {
20- "eloquent/code-style" : " ^1 " ,
21- "eloquent/phony" : " ^4 " ,
22- "eloquent/phony-kahlan" : " ^3 " ,
23- "eloquent/phony-phpunit" : " ^6 " ,
24- "friendsofphp/php-cs-fixer" : " ^2 " ,
25- "kahlan/kahlan" : " ^4.1 "
20+ "eloquent/code-style" : " ^2 " ,
21+ "eloquent/phony" : " ^5 " ,
22+ "eloquent/phony-kahlan" : " ^4 " ,
23+ "eloquent/phony-phpunit" : " ^7 " ,
24+ "friendsofphp/php-cs-fixer" : " ^3 " ,
25+ "kahlan/kahlan" : " ^5 "
2626 },
2727 "autoload" : {
2828 "psr-4" : {
Original file line number Diff line number Diff line change 55namespace Eloquent \Phpstan \Phony \Type ;
66
77use Eloquent \Phony \Mock \Handle \InstanceHandle ;
8+ use PhpParser \Node \Arg ;
89use PhpParser \Node \Expr \MethodCall ;
910use PHPStan \Analyser \Scope ;
1011use PHPStan \Reflection \MethodReflection ;
@@ -28,18 +29,21 @@ public function isMethodSupported(
2829
2930 public function getTypeFromMethodCall (
3031 MethodReflection $ methodReflection ,
31- MethodCall $ methodCall ,
32+ MethodCall $ call ,
3233 Scope $ scope
3334 ): Type {
34- $ calledOnType = $ scope ->getType ($ methodCall ->var );
35+ $ calledOnType = $ scope ->getType ($ call ->var );
3536
3637 if ($ calledOnType instanceof InstanceHandleType) {
3738 return TypeFactory::createMockType (...$ calledOnType ->types ());
3839 }
3940
41+ /** @var Arg[] */
42+ $ args = $ call ->args ;
43+
4044 $ acceptor = ParametersAcceptorSelector::selectFromArgs (
4145 $ scope ,
42- $ methodCall -> args ,
46+ $ args ,
4347 $ methodReflection ->getVariants ()
4448 );
4549
Original file line number Diff line number Diff line change 55namespace Eloquent \Phpstan \Phony \Type ;
66
77use Eloquent \Phony \Mock \Builder \MockBuilder ;
8+ use PhpParser \Node \Arg ;
89use PhpParser \Node \Expr \MethodCall ;
910use PHPStan \Analyser \Scope ;
1011use PHPStan \Reflection \MethodReflection ;
@@ -33,18 +34,21 @@ public function isMethodSupported(
3334
3435 public function getTypeFromMethodCall (
3536 MethodReflection $ methodReflection ,
36- MethodCall $ methodCall ,
37+ MethodCall $ call ,
3738 Scope $ scope
3839 ): Type {
39- $ calledOnType = $ scope ->getType ($ methodCall ->var );
40+ $ calledOnType = $ scope ->getType ($ call ->var );
4041
4142 if ($ calledOnType instanceof MockBuilderType) {
4243 return TypeFactory::createMockType (...$ calledOnType ->types ());
4344 }
4445
46+ /** @var Arg[] */
47+ $ args = $ call ->args ;
48+
4549 $ acceptor = ParametersAcceptorSelector::selectFromArgs (
4650 $ scope ,
47- $ methodCall -> args ,
51+ $ args ,
4852 $ methodReflection ->getVariants ()
4953 );
5054
Original file line number Diff line number Diff line change @@ -48,27 +48,33 @@ public function getTypeFromFunctionCall(
4848 FuncCall $ call ,
4949 Scope $ scope
5050 ): Type {
51+ /** @var Arg[] */
52+ $ args = $ call ->args ;
53+
5154 $ acceptor = ParametersAcceptorSelector::selectFromArgs (
5255 $ scope ,
53- $ call -> args ,
56+ $ args ,
5457 $ reflection ->getVariants ()
5558 );
5659
57- return $ this ->getTypeFromCall ($ acceptor , $ scope , ...$ call -> args );
60+ return $ this ->getTypeFromCall ($ acceptor , $ scope , ...$ args );
5861 }
5962
6063 public function getTypeFromStaticMethodCall (
6164 MethodReflection $ reflection ,
6265 StaticCall $ call ,
6366 Scope $ scope
6467 ): Type {
68+ /** @var Arg[] */
69+ $ args = $ call ->args ;
70+
6571 $ acceptor = ParametersAcceptorSelector::selectFromArgs (
6672 $ scope ,
67- $ call -> args ,
73+ $ args ,
6874 $ reflection ->getVariants ()
6975 );
7076
71- return $ this ->getTypeFromCall ($ acceptor , $ scope , ...$ call -> args );
77+ return $ this ->getTypeFromCall ($ acceptor , $ scope , ...$ args );
7278 }
7379
7480 private function getTypeFromCall (
Original file line number Diff line number Diff line change @@ -54,27 +54,33 @@ public function getTypeFromFunctionCall(
5454 FuncCall $ call ,
5555 Scope $ scope
5656 ): Type {
57+ /** @var Arg[] */
58+ $ args = $ call ->args ;
59+
5760 $ acceptor = ParametersAcceptorSelector::selectFromArgs (
5861 $ scope ,
59- $ call -> args ,
62+ $ args ,
6063 $ reflection ->getVariants ()
6164 );
6265
63- return $ this ->getTypeFromCall ($ acceptor , $ scope , ...$ call -> args );
66+ return $ this ->getTypeFromCall ($ acceptor , $ scope , ...$ args );
6467 }
6568
6669 public function getTypeFromStaticMethodCall (
6770 MethodReflection $ reflection ,
6871 StaticCall $ call ,
6972 Scope $ scope
7073 ): Type {
74+ /** @var Arg[] */
75+ $ args = $ call ->args ;
76+
7177 $ acceptor = ParametersAcceptorSelector::selectFromArgs (
7278 $ scope ,
73- $ call -> args ,
79+ $ args ,
7480 $ reflection ->getVariants ()
7581 );
7682
77- return $ this ->getTypeFromCall ($ acceptor , $ scope , ...$ call -> args );
83+ return $ this ->getTypeFromCall ($ acceptor , $ scope , ...$ args );
7884 }
7985
8086 private function getTypeFromCall (
You can’t perform that action at this time.
0 commit comments