PHP 8.5.0 Alpha 4 available for testing

Voting

: min(one, nine)?
(Example: nine)

The Note You're Voting On

info at ensostudio dot ru
4 years ago
Note: you cant change parameter type for abstract method defined in interface.
<?php
abstract class AbstractAssocArray imlements ArrayAccess
{
abstract public function
offsetSet($offset, $value): void;
...
}
abstract class
AbstractAssocArray2 extends AbstractAssocArray
{
abstract public function
offsetSet(string $offset, $value): void;
}
class
AssocArray extends AbstractAssocArray2
{
public function
offsetSet(string $offset, $value): void
{
$this->{$offset} = $value;
}
}
?>
It's throw fatal error: Declaration of AbstractAssocArray::offsetSet(string $offset, $value): void must be compatible with AbstractAssocArrayAccess::offsetSet($offset, $value).

<< Back to user notes page

To Top