-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Precise type for
$matches
from preg_match
generally available, ou…
…t of bleeding edge
- Loading branch information
1 parent
c541ce1
commit bd2cec1
Showing
3 changed files
with
10 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bd2cec1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI @staabm @Seldaek I'm going to enable this for everyone in PHPStan 1.12, it's not a BC break, it's just smarter analysis. The time in bleeding edge in 1.11 allowed us to test this without greater impact because of bugs, but I think it's solid now. I'd welcome the extension for preg_match_all and preg_replace_callback too. Thanks.
bd2cec1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might be a problem for composer/pcre which relies on the feature-flag. this might mean composer/pcre needs to define a phpstan-version conflict with 1.11.x when 1.12.x is released as it cannot be compatible with both versions (the parameter schema removal is a BC break, I guess)
bd2cec1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand why you used it.
But again, I'm making an exception for this one.
bd2cec1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ondrejmirtes
Would it be possible to make the
featureToggles
part a genericarray<string, mixed>
at parameterSchema level?I run a script that runs the analysis of my codebase on multiple phpstan versions to catch regressions/improvements. So far I played only with some feature flags that existed throughout 1.10.x and 1.11.x but I was exactly wondering how to solve the problem once it will occur.
Having the
featureToggles
a generic key-value map would solve the problem by generally ignoring what it doesn't know, instead of complaining about it.bd2cec1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thg2k I guess you should always grab the current schema and filter the toggles you're trying through that. Or expect a validation error and fix it once it occurs.
bd2cec1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not what I meant, I mean that if version 2 introduces a featureToggle: X, and I enable it in my config file, it will not work in version 1 and version 3 if they don't have it. I'd like to run the same config file on all versions at the same time...
bd2cec1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I discussed it with Jordi and we came to the conclusion that we - fearless developers as we are - will drop the feature-flag usage of composer/pcre, so no additional BC stuff is needed at PHPStan-src level ;-)