Bug report
Using phpstan version 1.9.4, setting rememberPossiblyImpureFunctionValues to false incorrectly fails on use of nonexistent classes guarded by class_exists.
Code snippet that reproduces the problem
test-class_exists.php
<?php
if (!class_exists('nonexistentclass')) throw new \Exception('nonexistentclass');
$x = new \nonexistentclass();
phpstan.neon
parameters:
phpVersion: 80024
level: 5
paths: [ . ]
rememberPossiblyImpureFunctionValues: false
(I could not reproduce the issue on phpstan.org/try because this does not allow to specify the config parameters)
Expected output
phpstan should not report any errors, as it does with rememberPossiblyImpureFunctionValues: true. Instead it reports Instantiated class nonexistentclass not found.
Bug report
Using phpstan version 1.9.4, setting
rememberPossiblyImpureFunctionValuestofalseincorrectly fails on use of nonexistent classes guarded by class_exists.Code snippet that reproduces the problem
test-class_exists.php
phpstan.neon
(I could not reproduce the issue on phpstan.org/try because this does not allow to specify the config parameters)
Expected output
phpstan should not report any errors, as it does with
rememberPossiblyImpureFunctionValues: true. Instead it reportsInstantiated class nonexistentclass not found.