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

Handle false return in substr with PHP < 8 #1144

Merged
merged 5 commits into from
Mar 30, 2022

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Mar 30, 2022

Closes phpstan/phpstan#6939

https://www.php.net/manual/en/function.substr.php#refsect1-function.substr-changelog

Initially I duplicated the benevolent union from the stubs and added a new method to PhpVersion, buuuut let's see if #1061 takes care of that :)

Related: 9ee914b

@herndlm
Copy link
Contributor Author

herndlm commented Mar 30, 2022

I love how easy #1061 made the fix here by falling back to the correct stubs :)

@herndlm
Copy link
Contributor Author

herndlm commented Mar 30, 2022

Hmm, the failing integration tests look like valid pre PHP 8 errors to me (see https://3v4l.org/eu588), but not sure how to "handle" them. Target 1.6.x maybe? :D

I'm going to open PRs over there. UPDATE: nope, not that easy, phpstan fails in slevomat/coding-standard then with

 ------ ----------------------------------------------------
  Line   Helpers/AnnotationTypeHelper.php
 ------ ----------------------------------------------------
  343    Casting to string something that's already string.
 ------ ----------------------------------------------------

same thing for nextras/orm

advise please :) I think similar things regularly happend in the past and were fixed with/after a release, but I don't want to be the one that breaks PHPStan CI :/ I'll happily open PRs though in those projects fixing it and upgrading phpstan if you want to release it like that

@herndlm herndlm marked this pull request as ready for review March 30, 2022 08:16
@ondrejmirtes
Copy link
Member

It's fine, you can fix those projects after the release but I'll just regenerate their baselines so that our CI is green :)

The situation in slevomat CS is a bit complicated because PHP 7.x is still supported by PHPStan is ran only on PHP 8.

@ondrejmirtes ondrejmirtes merged commit ae67ac8 into phpstan:1.5.x Mar 30, 2022
@ondrejmirtes
Copy link
Member

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants