<!-- First, thank you for making a request. That takes time and we appreciate that! --> ## Before ``` if (time() > strtotime('30 Nov 2018')) { // do something1 } else if (time() > strtotime('30 Nov 2019')) { // do something2 } else { // do something3 } ``` ## After running with min php version = 7.3 ``` // do something3 ``` Inspired by https://github.com/redaxo/redaxo/blob/46d0ace6cd1ca0d40fa233abd637bea53c694daa/redaxo/src/core/pages/setup.php#L147 Phpstan e.g. does similar things with printf() in case the format pattern can be constructed at parse time, some validation runs I guess its implemented in https://github.com/phpstan/phpstan-src/blob/699c420f8193da66927e54494a0afa0c323c6458/src/Rules/Functions/PrintfParametersRule.php https://github.com/phpstan/phpstan-src/blob/699c420f8193da66927e54494a0afa0c323c6458/src/Type/Php/SprintfFunctionDynamicReturnTypeExtension.php https://github.com/phpstan/phpstan-src/blob/699c420f8193da66927e54494a0afa0c323c6458/src/Type/Php/StrtotimeFunctionReturnTypeExtension.php Related https://github.com/phpstan/phpstan/issues/2812
Before
After running with min php version = 7.3
Inspired by https://github.com/redaxo/redaxo/blob/46d0ace6cd1ca0d40fa233abd637bea53c694daa/redaxo/src/core/pages/setup.php#L147
Phpstan e.g. does similar things with printf() in case the format pattern can be constructed at parse time, some validation runs
I guess its implemented in https://github.com/phpstan/phpstan-src/blob/699c420f8193da66927e54494a0afa0c323c6458/src/Rules/Functions/PrintfParametersRule.php
https://github.com/phpstan/phpstan-src/blob/699c420f8193da66927e54494a0afa0c323c6458/src/Type/Php/SprintfFunctionDynamicReturnTypeExtension.php
https://github.com/phpstan/phpstan-src/blob/699c420f8193da66927e54494a0afa0c323c6458/src/Type/Php/StrtotimeFunctionReturnTypeExtension.php
Related phpstan/phpstan#2812