phplaraveldockercode-cleanupphpmd

Problem with phpmd and Function libxml_disable_entity_loader()


I'm trying to run this command: docker run -it --rm -v ${pwd}:/project -w /project jakzal/phpqa phpmd app text cleancode,codesize,controversial,design,naming,unusedcode

And it returns:

Deprecated: Function libxml_disable_entity_loader() is deprecated in phar:///tools/.phive/phars/phpmd-2.9.1.phar/vendor/symfony/config/Util/XmlUtils.php on line 54

Deprecated: Function libxml_disable_entity_loader() is deprecated in phar:///tools/.phive/phars/phpmd-2.9.1.phar/vendor/symfony/config/Util/XmlUtils.php on line 68

Deprecated:Function libxml_disable_entity_loader() is deprecated in phar:///tools/.phive/phars/phpmd-2.9.1.phar/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php on line 517
Deprecated: Function libxml_disable_entity_loader() is deprecated in phar:///tools/.phive/phars/phpmd-2.9.1.phar/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php on line 519
The given file "app" does not exist.

I've been looking for the solution for a few hours and I couldn't find anything. I already update phpmd in my project, but apparently the error comes from some other location that I couldn't find.

I'm developing a Laravel + docker project and trying to do some code validations.


Solution

  • About the error

    The given file "app" does not exist.

    It happens because you are not running this command inside the project's folder as suggested in the ${pwd} syntax (Environment variable for actual working directory).

    And the warnings regarding "libxml_disable_entity_loader", it's a bug related php8. It's openly discussed in the PHPMD GitHub issues, and you can skip this by just using the php7.4 version instead. Your command should look like the following:

    docker run -it --rm -v ${pwd}:/project -w /project jakzal/phpqa:php7.4 phpmd app text cleancode,codesize,controversial,design,naming,unusedcode