phpmd / phpmd

PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly frontend application for the raw metrics stream measured by PHP Depend.

Home Page:https://phpmd.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Too many PHP Deprecated by PHPMD

farhadsakhaei opened this issue · comments

Hi,
Thank you for developing and maintaining this great package

  • PHPMD version: latest
  • PHP Version: 8.2.4
  • Installation type: composer
  • Operating System / Distribution & Version: (Windows 10)

Current Behavior

There are too many PHP Deprecated in error_log when we activate PHPMD
We need to track every deprecated lines of PHP codes, But these too many deprecated will confuse us to fix them

[10:49:36] PHP Deprecated: Symfony\Component\Config\Resource\FileResource implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/symfony/config/Resource/FileResource.php on line 21
[10:49:36] PHP Deprecated: Function libxml_disable_entity_loader() is deprecated in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/symfony/config/Util/XmlUtils.php on line 54
[10:49:36] PHP Deprecated: Function libxml_disable_entity_loader() is deprecated in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/symfony/config/Util/XmlUtils.php on line 68
[10:49:36] PHP Deprecated: Function libxml_disable_entity_loader() is deprecated in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php on line 517
[10:49:36] PHP Deprecated: Function libxml_disable_entity_loader() is deprecated in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php on line 519
[10:49:36] PHP Deprecated: Return type of PHPMD\RuleSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/src/main/php/PHPMD/RuleSet.php on line 264
[10:49:36] PHP Deprecated: substr(): Passing null to parameter #1 ($string) of type string is deprecated in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/src/main/php/PHPMD/RuleSetFactory.php on line 246
[10:49:36] PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/src/main/php/PHPMD/RuleSetFactory.php on line 369
[10:49:36] PHP Deprecated: substr(): Passing null to parameter #1 ($string) of type string is deprecated in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/src/main/php/PHPMD/RuleSetFactory.php on line 246
[10:49:36] PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/src/main/php/PHPMD/RuleSetFactory.php on line 369
[10:49:36] PHP Deprecated: substr(): Passing null to parameter #1 ($string) of type string is deprecated in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/src/main/php/PHPMD/RuleSetFactory.php on line 246
[10:49:36] PHP Deprecated: Return type of PDepend\Source\Language\PHP\PHPBuilder::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPBuilder.php on line 1841
[10:49:36] PHP Deprecated: Return type of PDepend\Input\Iterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/pdepend/pdepend/src/main/php/PDepend/Input/Iterator.php on line 88
[10:49:36] PHP Deprecated: Return type of PDepend\Source\AST\ASTArtifactList::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList.php on line 178
[10:49:36] PHP Deprecated: Return type of PDepend\Source\AST\ASTArtifactList::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList.php on line 192
[10:49:37] PHP Deprecated: Return type of PDepend\Source\AST\ASTArtifactList::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList.php on line 210
[10:49:37] PHP Deprecated: Return type of PDepend\Source\AST\ASTArtifactList::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList.php on line 224
[10:49:37] PHP Deprecated: Return type of PDepend\Source\AST\ASTArtifactList::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList.php on line 120
[10:49:37] PHP Deprecated: Return type of PDepend\Source\AST\ASTArtifactList::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList.php on line 143
[10:49:37] PHP Deprecated: Return type of PDepend\Source\AST\ASTArtifactList::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList.php on line 133
[10:49:37] PHP Deprecated: Return type of PDepend\Source\AST\ASTArtifactList::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList.php on line 163
[10:49:37] PHP Deprecated: Return type of PDepend\Source\AST\ASTArtifactList::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList.php on line 153
[10:49:37] PHP Deprecated: Return type of PDepend\Source\AST\ASTArtifactList::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList.php on line 110

You appear to be running an extremely old version of PHPMD (1.3.0 from before 2012), please update to the latest (currently 2.15.0). Also when running on recent version of PHP it is best to install via composer as the phar version supports PHP 5.3+ as that unfortunately means it will use some deprecated features. With the composer installation you will get more recent dependencies and thus avoid that.

@AJenbo
Hi,
Thank you for reply,

I use composer and it is latest version

composer show phpmd/phpmd

name : phpmd/phpmd
descrip. : PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.
keywords : dev, mess detection, mess detector, pdepend, phpmd, pmd
versions : * 2.15.0
type : library
license : BSD 3-Clause "New" or "Revised" License (BSD-3-Clause) (OSI approved) https://spdx.org/licenses/BSD-3-Clause.html#licenseText
homepage : https://phpmd.org/
source : [git] https://github.com/phpmd/phpmd.git 74a1f56
dist : [zip] https://api.github.com/repos/phpmd/phpmd/zipball/74a1f56e33afad4128b886e334093e98e1b5e7c0 74a1f56
path : D:\xampp\htdocs\vendor\phpmd\phpmd
names : phpmd/phpmd

support
irc : irc://irc.freenode.org/phpmd
issues : https://github.com/phpmd/phpmd/issues
source : https://github.com/phpmd/phpmd/tree/2.15.0

autoload
psr-0
PHPMD\ => src/main/php

requires
composer/xdebug-handler ^1.0 || ^2.0 || ^3.0
ext-xml *
pdepend/pdepend ^2.16.1
php >=5.3.9

requires (dev)
easy-doc/easy-doc 0.0.0 || ^1.3.2
ext-json *
ext-simplexml *
gregwar/rst ^1.0
mikey179/vfsstream ^1.6.8
squizlabs/php_codesniffer ^2.9.2 || ^3.7.2

your log clearly states that it's the phar build being executed, even if you do have phpmd installed via composer also:

[10:49:36] PHP Deprecated: Function libxml_disable_entity_loader() is deprecated in phar://C:/Users/.vscode/extensions/ecodes.vscode-phpmd-1.3.0/phpmd/phpmd.phar/vendor/symfony/config/Util/XmlUtils.php on line 54

@AJenbo
Yes,
You are right,
I use a extension in VSCode, it seems it is using it's internal package, I changed the settings and everythings are ok
Thank you for your support and great package

no worries, hopefully we can soon star working on the next major version and raise the minimum php version supported so that the phar buold will work nicer on current versions of php.