-
Notifications
You must be signed in to change notification settings - Fork 799
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
Fix properties for XML-related classes #1526
base: master
Are you sure you want to change the base?
Conversation
These properties are real (non-dynamic): https://github.com/php/php-src/blob/master/ext/xmlreader/php_xmlreader.stub.php https://www.php.net/manual/en/class.domnamednodemap.php Current usage of `@property-read` annotations makes PHPStan fail on PHP 8.2.
That's true, they are real, but only for PHP >= 8.1 (https://3v4l.org/V82V3 and https://github.com/php/php-src/blob/PHP-8.0/ext/xmlreader/php_xmlreader_arginfo.h), and stubs should be valid also for older PHP versions that's why tests will fail in this case. Also,
But in this case, we would get multi-resolve because there is another declaration in |
I basically took it from other stub: Thanks for the response, I'll prepare changes today. |
@isfedorov I've prepared changes, please let me know if it's what you were thinking of. I decided to extract One question: should I remove But on a side note I have to ask: does it really matter from the code's perspective? 🤔 Those properties were not defined explicitly and were dynamic, but they were there for reading. So basically in the users' code, if e.g. |
@isfedorov friendly reminder 🙂 Those changes are the last PHPStan errors in our App, which we're migrating to PHP8.2, and I really would like to proceed with the process. |
Yes, generally those attributes can be removed for the version for PHP >=8.1.
There are next differences here: PhpStorm highlights write access to property marked with But we can't just convert |
any chance to wrap this up? (coming here after following up phpstan false alert on xmlreader->nodeType with PHP 8.2) can we maybe do a simple change to convert the the property annotations to property declarations but leave out the complicated problems that require further discussion? |
These properties are real (non-dynamic):
https://github.com/php/php-src/blob/master/ext/xmlreader/php_xmlreader.stub.php https://www.php.net/manual/en/class.domnamednodemap.php
Current usage of
@property-read
annotations makes PHPStan fail on PHP 8.2.Related to phpstan/phpstan#8629.