diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index ffe76a622cd..ce99ee3bc1f 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -21396,18 +21396,6 @@ parameters: count: 1 path: ../../../htdocs/includes/odtphp/Segment.php - - - message: '#^Method Segment\:\:macroReplace\(\) has parameter \$text with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: ../../../htdocs/includes/odtphp/Segment.php - - - - message: '#^PHPDoc tag @param references unknown parameter\: \$value$#' - identifier: parameter.notFound - count: 1 - path: ../../../htdocs/includes/odtphp/Segment.php - - message: '#^Parameter \#3 \$encode of method Segment\:\:setVars\(\) expects string, false given\.$#' identifier: argument.type diff --git a/htdocs/includes/odtphp/Segment.php b/htdocs/includes/odtphp/Segment.php index 85789ee8017..3e8675c65a9 100644 --- a/htdocs/includes/odtphp/Segment.php +++ b/htdocs/includes/odtphp/Segment.php @@ -64,6 +64,7 @@ class Segment implements IteratorAggregate, Countable * * @return int */ + #[\ReturnTypeWillChange] public function count() { return count($this->children); @@ -73,6 +74,7 @@ class Segment implements IteratorAggregate, Countable * * @return Iterator */ + #[\ReturnTypeWillChange] public function getIterator() { return new RecursiveIteratorIterator(new SegmentIterator($this->children), 1); @@ -165,7 +167,7 @@ class Segment implements IteratorAggregate, Countable * * Miguel Erill 09/04/2017 * - * @param string $value String to convert + * @param string $text String to convert */ public function macroReplace($text) { diff --git a/htdocs/includes/odtphp/SegmentIterator.php b/htdocs/includes/odtphp/SegmentIterator.php index 43b730739e6..96c931c4d2e 100644 --- a/htdocs/includes/odtphp/SegmentIterator.php +++ b/htdocs/includes/odtphp/SegmentIterator.php @@ -19,30 +19,43 @@ class SegmentIterator implements RecursiveIterator $this->key = 0; $this->keys = array_keys($this->ref); } + #[\ReturnTypeWillChange] public function hasChildren() { return $this->valid() && $this->current() instanceof Segment; } + #[\ReturnTypeWillChange] public function current() { return $this->ref[$this->keys[$this->key]]; } + #[\ReturnTypeWillChange] function getChildren() { return new self($this->current()->children); } + #[\ReturnTypeWillChange] public function key() { return $this->key; } + #[\ReturnTypeWillChange] public function valid() { return array_key_exists($this->key, $this->keys); } + /** + * @return void + */ + #[\ReturnTypeWillChange] public function rewind() { $this->key = 0; } + /** + * @return void + */ + #[\ReturnTypeWillChange] public function next() { $this->key ++;