-
Notifications
You must be signed in to change notification settings - Fork 509
Resolve substr based on configured PHP version #4061
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
base: 1.12.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can add the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The lint comment is for the runtime PHP version no ? (Like it's done for a lot of NodeScopeResolverPHPTest). Here I want to allow Analysing this file on both PHP 7 and PHP 8, but telling PHPStan to consider he's in PHP 7. |
||
|
||
namespace Bug13129PHP7; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
assertType("false", substr("test", 5)); | ||
assertType("false", substr("test", -1, -5)); | ||
assertType("false", substr("test", 1, -4)); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Bug13129PHP8; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
assertType("''", substr("test", 5)); | ||
assertType("''", substr("test", -1, -5)); | ||
assertType("''", substr("test", 1, -4)); |
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.
Since the neon file is only
we could use those TestCase for all the configured-phpVersion-related tests instead of creating a TestCase every time.