Psalm
Get started
Documentation
Paid support
Plugins
Blog
GitHub
<?php declare(strict_types = 1); enum Foo { case Bar; case Baz; case Gar; case Gaz; public function startsWithB(): bool { return inArray($this, [static::Baz, static::Bar]); } } /** * @template T * @psalm-param T $needle * @psalm-param array<array-key, T> $haystack */ function inArray(mixed $needle, array $haystack): bool { return \in_array($needle, $haystack, true); }
Snippet created on May 10 2022 at 06:13 UTC
Settings
Get link