php-html-parser icon indicating copy to clipboard operation
php-html-parser copied to clipboard

PHP 8.1 error

Open bartonlp opened this issue 3 years ago • 3 comments

If you are using php 8.1 you will get a depreciated error in Collections.php function offsetGet() because it does not have a 'mixed' return type. This can be fixed by either adding #[\ReturnTypeWillChange] before the function or adding 'mixed' as the return type.

bartonlp avatar Feb 01 '22 13:02 bartonlp

https://github.com/paquettg/php-html-parser/pull/291

AkioSarkiz avatar Feb 20 '22 17:02 AkioSarkiz

After waiting for a while, did the update and pushed to packages https://packagist.org/packages/minasm/php-html-parser :)

minasm avatar Oct 17 '22 18:10 minasm

@minasm, First of all, thank you for providing an updated version of the package. I'm getting a different warning:

Deprecated: Return type of PHPHtmlParser\Dom\Node\Collection::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 /vendor/minasm/php-html-parser/src/PHPHtmlParser/Dom/Node/Collection.php on line 133

Would it be possible to make this correction in your version, since @paquettg's doesn't seem to be being updated?

FYI: I'm using PHP 8.2

paulodetarsofm avatar Oct 19 '23 19:10 paulodetarsofm