PHPのType Declaration
型は明示しているだけで、異なった値を与えてもエラーにはならない
strict_typesを使用しない場合は暗黙のcastが行われる
型の種類
bool, int, float, string, array, object
iterable
self, parent
任意のクラスおよびインターフェイス名
?type
nullable
e.g. ?int
, ?string
Undefined type
というエラーはなに?
SymfonyをDockerで動かしてるからかな

vendorディレクトリをsyncしてなかったからだった
Stubを追加するなどもあるらしい
型宣言は実行時に影響がある
union types
v8.0以降
phpfunction processInput(int|string $input): void {}
null許容型
phpfunction getUserName(?int $userId): ?string {}
配列型
array
v8.1から iterable
を使える
genricsの表現ができる?
callable
型
phpfunction executeCallback(callable $callback): void {
$callback();
}