note 128740 added to language.types.never
| From: | mateusz dot charytoniuk at protonmail dot com | Date: | Mon, 17 Jul 2023 14:51:53 +0000 |
| Subject: | note 128740 added to language.types.never | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220700@lists.php.net to get a copy of this message | ||
Overriding the return type of native interfaces:
<?php
class ReadonlyArrayAccess implements ArrayAccess
{
public function __construct(private readonly $array) {}
public function offsetExists(mixed $offset): bool
{
return isset($this->array[$offset]);
}
public function offsetGet(mixed $offset): mixed
{
return $this->array[$offset];
}
public function offsetSet(mixed $offset, mixed $value): never
{
throw new LogicException('This array is read only');
}
public function offsetUnset(mixed $offset): never
{
throw new LogicException('This array is read only');
}
}
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.159.168 (proxied: 89.65.23.75)
----
Manual Page -- https://php.net/manual/en/language.types.never.php
Edit -- https://main.php.net/note/edit/128740
Del: integrated -- https://main.php.net/note/delete/128740/integrated
Del: useless -- https://main.php.net/note/delete/128740/useless
Del: bad code -- https://main.php.net/note/delete/128740/bad+code
Del: spam -- https://main.php.net/note/delete/128740/spam
Del: non-english -- https://main.php.net/note/delete/128740/non-english
Del: in docs -- https://main.php.net/note/delete/128740/in+docs
Del: other reasons-- https://main.php.net/note/delete/128740
Reject -- https://main.php.net/note/reject/128740
Search -- https://main.php.net/manage/user-notes.php