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