File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -48,4 +48,9 @@ public function supportsTrueAndFalseStandaloneType(): TrinaryLogic
4848 return IntegerRangeType::fromInterval (80200 , null )->isSuperTypeOf ($ this ->phpVersions )->result ;
4949 }
5050
51+ public function supportsMaxMemoryLimit (): TrinaryLogic
52+ {
53+ return IntegerRangeType::fromInterval (80500 , null )->isSuperTypeOf ($ this ->phpVersions )->result ;
54+ }
55+
5156}
Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ public function getTypeFromFunctionCall(
4747 'precision ' => $ numericString ,
4848 ];
4949
50+ if ($ scope ->getPhpVersion ()->supportsMaxMemoryLimit ()->yes ()) {
51+ $ types ['max_memory_limit ' ] = new StringType ();
52+ }
53+
5054 $ argType = $ scope ->getType ($ args [0 ]->value );
5155 $ results = [];
5256 foreach ($ argType ->getConstantStrings () as $ constantString ) {
Original file line number Diff line number Diff line change @@ -26,4 +26,16 @@ function doFoo() {
2626 }
2727 assertType ('string|false ' , ini_get ($ key ));
2828 assertType ('string|false ' , ini_get ('unknown ' ));
29+
30+ if (PHP_VERSION_ID >= 80500 ) {
31+ assertType ('string ' , ini_get ("max_memory_limit " ));
32+ } else {
33+ assertType ('string|false ' , ini_get ("max_memory_limit " ));
34+ }
35+ if (PHP_VERSION_ID >= 80300 ) {
36+ assertType ('string|false ' , ini_get ("max_memory_limit " ));
37+ }
38+ if (PHP_VERSION_ID < 80300 ) {
39+ assertType ('string|false ' , ini_get ("max_memory_limit " ));
40+ }
2941}
You can’t perform that action at this time.
0 commit comments