Problem/Motivation
Use phpstan tool was found deprecated function notice occurs in PHP 8.1
------ ----------------------------------------------------------------------------------------------------------------------------------------------
Line /tmgmt/translators/file/tmgmt_file.recursive_iterator.inc
------ ----------------------------------------------------------------------------------------------------------------------------------------------
42 Return type mixed of method RecursiveDOMIterator::current() is not covariant with tentative return type mixed of method Iterator::current().
52 Return type mixed of method RecursiveDOMIterator::getChildren() is not covariant with tentative return type RecursiveIterator|null of method RecursiveIterator::getChildren().
62 Return type mixed of method RecursiveDOMIterator::hasChildren() is not covariant with tentative return type bool of method
RecursiveIterator::hasChildren().
72 Return type mixed of method RecursiveDOMIterator::key() is not covariant with tentative return type mixed of method Iterator::key().
79 Return type mixed of method RecursiveDOMIterator::next() is not covariant with tentative return type void of method Iterator::next().
86 Return type mixed of method RecursiveDOMIterator::rewind() is not covariant with tentative return type void of method Iterator::rewind().
96 Return type mixed of method RecursiveDOMIterator::valid() is not covariant with tentative return type bool of method Iterator::valid().
------ ----------------------------------------------------------------------------------------------------------------------------------------------
Proposed resolution
Update the function type of return value.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | tmgmt-deprecated-function-errors-in-php8.1-3352636-3.patch | 1.9 KB | Igumnov_aleksey |
Comments
Comment #2
Igumnov_aleksey commentedComment #3
Igumnov_aleksey commentedAccording to documentation:
https://php.net/manual/en/recursiveiteratoriterator.valid.php
https://php.net/manual/en/recursiveiteratoriterator.rewind.php
https://php.net/manual/en/recursiveiteratoriterator.key.php
https://php.net/manual/en/recursiveiteratoriterator.next.php
https://php.net/manual/en/recursiveiteratoriterator.current.php
https://php.net/manual/en/recursiveiterator.haschildren.php
https://php.net/manual/en/recursiveiterator.getchildren.php
Comment #4
Igumnov_aleksey commentedComment #5
berdirWhile the configured php version is very old, this will break compatibility with older php versions. We should add the annotation like I did in #3352099: Fix D10.1 test fails for 8.x-1.x instaed.
Comment #6
Igumnov_aleksey commentedThis decision is made from the fact that if Drupal 7 will work on php8.1