Psalm
Get started
Documentation
Paid support
Plugins
Blog
GitHub
<?php declare(strict_types=1); namespace test; /** * @template TKey is array-key * @template TValue */ interface A { /** * @psalm-param array<int, TKey> $keys * @psalm-return A<TKey, TValue> */ public function without(...$keys): A; } /** * @template TKey is array-key * @template TValue * @implements A<TKey, TValue> */ class AI implements A { /** @psalm-var array<TKey, TValue> */ private array $items; /** * @psalm-param array<TKey, TValue> $items */ public function __construct(array $items) { $this->items = $items; } /** * @psalm-param array<int, TKey> $keys * @psalm-return A<TKey, TValue> */ public function without(...$keys): A { return new self([]); } }
Snippet created on April 21 2020 at 18:59 UTC
Settings
Get link