-
Notifications
You must be signed in to change notification settings - Fork 523
Allow getenv(null) for PHP > 8 #4007
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
Changes from 5 commits
4942824
a0b4504
9c05317
ebe11b8
6bc4f2c
647fc09
b4d3410
7b176f3
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 |
---|---|---|
|
@@ -57,6 +57,12 @@ private static function findTestFiles(): iterable | |
yield __DIR__ . '/data/explode-php80.php'; | ||
} | ||
|
||
if (PHP_VERSION_ID < 80000) { | ||
yield __DIR__ . '/data/getenv-php74.php'; | ||
} else { | ||
yield __DIR__ . '/data/getenv-php80.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. This doesn't need to be in NodeScopeResolverTest. Move the files to nsrt/ and label them with proper 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. There is already similar conditions checks like above
The expectated type are different based on the PHP version, that's why I split the files. 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. Files in nsrt/ when testing type inference are filtered based on 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. Oh ! Awesome ! |
||
} | ||
|
||
if (PHP_VERSION_ID >= 80000) { | ||
yield __DIR__ . '/../Reflection/data/unionTypes.php'; | ||
yield __DIR__ . '/../Reflection/data/mixedType.php'; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace GetenvPHP74; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
class Foo | ||
{ | ||
|
||
public function test() | ||
{ | ||
assertType('string|false', getenv(null)); | ||
assertType('array<string, string>', getenv()); | ||
assertType('string|false', getenv('foo')); | ||
} | ||
VincentLanglet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace GetenvPHP80; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
class Foo | ||
{ | ||
|
||
public function test() | ||
{ | ||
assertType('array<string, string>', getenv(null)); | ||
assertType('array<string, string>', getenv()); | ||
assertType('string|false', getenv('foo')); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Bug13065; | ||
|
||
class Foo | ||
{ | ||
|
||
public function test() | ||
{ | ||
getenv(null); | ||
getenv(); | ||
getenv('foo'); | ||
} | ||
|
||
} |
Uh oh!
There was an error while loading. Please reload this page.