<?php /** * @template-implements ArrayAccess<int, string> */ class C implements ArrayAccess { /** * @param int $offset * @return bool */ public function offsetExists($offset) { return true; } /** * @param int $offset * @return string */ public function offsetGet($offset) { return "";} /** * @param ?int $offset * @return void */ public function offsetSet($offset, $value) { /** @psalm-suppress ForbiddenCode */ var_dump(__METHOD__, array("offset" => $offset, "value" => $value)); } /** * @param int $offset * @return void */ public function offsetUnset($offset) { } } $q = new C; $q[] = '123'; // should only be forbidden when offsetSet does not accept null as its first parameter
You have javascript disabled. You will not be able to edit any code.