Comments (6)
Alright, I understand the issue now. PHPStan does not support conditional clauses in regard to PHP version so it's still going to complain in these situations. It'd require a lot of refactoring to make it understand that.
You can use method_exists
which is understood by both PHPStan and PHP 8.3: https://3v4l.org/WAmpt, https://phpstan.org/r/690e2da6-8ad3-4f61-9442-d22971dc836d
Alternatively, you can split the $callable
string by ::
and call new ReflectionMethod()
with 2 arguments.
from phpstan.
I don't yet accept issues for PHP 8.4 as things might change. The work on PHP 8.4 support will start after feature freeze. Thanks for understanding.
from phpstan.
But the bug is that function exists in PHP 8.3 but PhpStan complains for no reason
from phpstan.
In the code sample you've provided there's no error on 8.3.
from phpstan.
Yes, 3v4l said code valid but playground complains on 8.1/8.2 as the method does not exist but code valid
CI also using PHP 8.3 but fails as composer require 8.1+ https://git.drupalcode.org/project/drupal/-/jobs/1481141
from phpstan.
Thank you a lot!
from phpstan.
Related Issues (20)
- param-closure-this should report an invalid type being used
- Incompatible usages of callable param- tags should be reported as errors HOT 1
- Typehint for $this in included file requires fully qualified name HOT 1
- Duplicate code does not generate a helpfull message
- Can't check if Iterator is empty HOT 1
- [False positive] "yield from" doesn't seem to be considered executed HOT 3
- Detect all possible implementations of abstract class in match HOT 1
- Wrong Parameter #3 $x ... of method B::foo() should be contravariant with parameter $x ... of method A::foo()
- Order of docblocks and attributes might need to mentioned in the docs? HOT 1
- Error reported using static create method with generics HOT 2
- Array count in match results in incorrect offset error in lower branch of match HOT 3
- Strict comparison using PPP between XXX and YYY will always evaluate to false. HOT 2
- Array is not considered equal to itself if it contains NANs HOT 2
- Variable X in isset() always exists and is not nullable for any array item HOT 1
- Multiple interfaces not supported HOT 2
- sprintf with only literal-string should return literal-string HOT 3
- array_change_key_case() is not reported to return different case keys
- Unary operation on string results in error HOT 2
- Generic trait: type of a method parameter in an abstract method is not specified HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpstan.