Open codeflow-biz opened 2 years ago
Same problem.
Do you have a solution?
Xav
Hi,
I was able to fix the problem by naming the type of the functions public (void, mixed, bool). No more deprecation messages.
Change in class : VCardParser.php
...
public function rewind(): void {
$this->position = 0;
}
public function current(): mixed {
if ($this->valid()) {
return $this->getCardAtIndex($this->position);
}
}
public function key(): mixed {
return $this->position;
}
public function next(): void {
$this->position++;
}
public function valid(): bool {
return !empty($this->vcardObjects[$this->position]);
}
...
I just saw that the answer was already there, by [codeflow-biz]. But I didn't understand.
Xav
PHP8.1 (at least - did not test with PHP8.0) logs deprecated issues because the 5 inherited methods from the Iterator base class in VCardParser do not declare the return type:
Fix: Add return type :mixed to methods current() and key(), add return type :bool to method valid(), add return type :void to methods rewind(), next().