Bug report
According to https://xdebug.org/docs/all_functions#xdebug_get_profiler_filename :
xdebug_get_profiler_filename() : mixed #
Returns the profile information filename
Returns the name of the file which is used to save profile information to, or false if the profiler is not active.
However, given the code:
<?php
if (!extension_loaded('xdebug')) {
print "Not installed\n";
exit();
}
if (xdebug_is_debugger_active()) {
print "Debugger is not active\n";
}
if (xdebug_code_coverage_started()) {
print "Code coverage is not active\n";
}
if (xdebug_get_gcstats_filename() !== false) {
print "No garbage collection stats enabled\n";
}
if (xdebug_get_profiler_filename() !== false) {
print "No profiler enabled\n";
}
PHPStan v2.1.56 reports:
Line phpstantest.php
------ ------------------------------------------------------------------------------------
:15 Strict comparison using !== between string and false will always evaluate to true.
🪪 notIdentical.alwaysTrue
------ ------------------------------------------------------------------------------------
indicating it is not taking the possible "false" return into account.
I cannot see the xdebug stub on https://github.com/phpstan/phpstan-src/tree/2.1.x/stubs so I do not know how PHPStan is aware of the xdebug_is_debugger_active , xdebug_code_coverage_started and xdebug_get_gcstats_filename functions but is getting xdebug_get_profiler_filename incorrect.
Code snippet that reproduces the problem
https://phpstan.org/r/f7ff962b-5083-4214-81a7-0932db3f86ee
Expected output
None.
Did PHPStan help you today? Did it make you happy in any way?
Slightly annoyed but the issue - but more annoyed that when I went to report this, I got the issue auto-closed with "Looks like you opened an issue without following one of the issue templates:" despite me using the provided issue template "Function signature mismatch".
Bug report
According to https://xdebug.org/docs/all_functions#xdebug_get_profiler_filename :
However, given the code:
PHPStan v2.1.56 reports:
indicating it is not taking the possible "false" return into account.
I cannot see the xdebug stub on https://github.com/phpstan/phpstan-src/tree/2.1.x/stubs so I do not know how PHPStan is aware of the
xdebug_is_debugger_active,xdebug_code_coverage_startedandxdebug_get_gcstats_filenamefunctions but is gettingxdebug_get_profiler_filenameincorrect.Code snippet that reproduces the problem
https://phpstan.org/r/f7ff962b-5083-4214-81a7-0932db3f86ee
Expected output
None.
Did PHPStan help you today? Did it make you happy in any way?
Slightly annoyed but the issue - but more annoyed that when I went to report this, I got the issue auto-closed with "Looks like you opened an issue without following one of the issue templates:" despite me using the provided issue template "Function signature mismatch".