Closed Shadow-Devil closed 7 months ago
Thank you @Shadow-Devil !
I am a bit confused, since when I now run:
vendor/terminal42/contao-build-tools/tools/phpstan/vendor/bin/phpstan analyze system
There is no #Function file_exists is unsafe to use#
matched, which you explicitly ignored. Can you please tell me why you added it?
There are two file_exists
calls in system/modules/isotope/library/Isotope/Template.php
. If I remove the ignoreError
, I get that reported.
------ ------------------------------------------------------------------
Line isotope/library/Isotope/Template.php
------ ------------------------------------------------------------------
50 Function file_exists is unsafe to use, rely on Symfony component
Filesystem::exists instead.
54 Function file_exists is unsafe to use, rely on Symfony component
Filesystem::exists instead.
------ ------------------------------------------------------------------
btw, you can simply run composer run phpstan
😎
Filesystem::exists
is not safer than file_exists
. It only introduces a check for \PHP_MAXPATHLEN
- which file_exists
does itself anyway. It looks like Symfony introduced the check in Symfony 2.3.38 (and later updated it in Symfony 2.7.35 to use \PHP_MAXPATHLEN
) due to this PHP bug, which has since been fixed in PHP 7.1. The only advantage is that it will throw a nice IOException
for you to catch in such a case.
Idk, I get the error when I run phpstan, I never asked for why it is there 😉
Part of #2509. Adds phpstan with level 0, but there were some issues: