fix phpstan

This commit is contained in:
Frédéric France 2025-01-09 21:38:06 +01:00
parent 1ba37602bc
commit 74b445ac31
No known key found for this signature in database
GPG Key ID: CE25B0B7B53B9177
3 changed files with 16 additions and 13 deletions

View File

@ -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

View File

@ -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)
{

View File

@ -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 ++;