ndunand / moodle-qtype_matrix

Source code of https://moodle.org/plugins/qtype_matrix
2 stars 10 forks source link

Deprecation warning in PHP 8.1 #60

Open ewallah opened 1 year ago

ewallah commented 1 year ago

Deprecated: Return type of qtype_matrix_question::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in question/type/matrix/question.php on line 520

So this code generates a warning:

    public function getIterator() {
        return new ArrayIterator($this->cells());
    }

This code does not:

    public function getIterator(): ArrayIterator {
        return new ArrayIterator($this->cells());
    }