Skip to content
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 masterminds-html5 lib php8-1 notice return type use phpstan #231

Conversation

igumnovaleksey
Copy link

The following deprecated notices were found while using the phpstan tool:

all/libraries/composer/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php
180 line Return type mixed of method Masterminds\HTML5\Parser\StringInputStream::current() is not covariant with tentative return type mixed of method Iterator::current().
189 line Return type mixed of method Masterminds\HTML5\Parser\StringInputStream::next() is not covariant with tentative return type void of method Iterator::next()
197 line Return type mixed of method Masterminds\HTML5\Parser\StringInputStream::rewind() is not covariant with tentative return type void of method Iterator::rewind()
207 line Return type mixed of method Masterminds\HTML5\Parser\StringInputStream::valid() is not covariant with tentative return type bool of method Iterator::valid()
327 line Return type mixed of method Masterminds\HTML5\Parser\StringInputStream::key() is not covariant with tentative return type mixed of method Iterator::key()

@goetas
Copy link
Member

goetas commented Apr 9, 2023

This library aims to be compatible with php 5.3, this return types are not supported

@alecpl
Copy link
Contributor

alecpl commented Jun 9, 2023

Use #[ReturnTypeWillChange] instead.

@igumnovaleksey igumnovaleksey force-pushed the masterminds-html5-library-static-analysis-issue branch from 9d24f9c to 987d0c0 Compare August 4, 2023 14:26
@PavelSPN
Copy link

PavelSPN commented Mar 26, 2024

Hi there!

@goetas As I know the #[ReturnTypeWillChange] is not impact on php5.3 it's just for backward compatibility of older code.
Some information: https://stackoverflow.com/questions/71133749/reference-return-type-of-should-either-be-compatible-with-or-the-re
As for me, the PR created by @igumnovaleksey can be merged that allow the code to be more compatible with PHP8.1 and higher.

@goetas goetas merged commit c6979d5 into Masterminds:master Mar 26, 2024
1 check passed
@goetas goetas mentioned this pull request Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants