PHP カンファレンス 2020 の登壇のために PHP 8 で JSON パーサを書いてみました。 https://github.com/shin1x1/php8-toy-json-parser いくつか PHP 8 の新機能を使ったのでその雑感です。 Constructor Property Promotion Named arguments Union Types Match expression Attribute さいごに Constructor Property Promotion https://www.php.net/releases/8.0/en.php#constructor-property-promotion TypeScript のようにスッキリ書けるのが良いです。 コンストラクタ仮引数にアクセス修飾子を足すだけなので、慣れないと一瞬戸惑うかもしれません。以前 T
![PHP 8 の新機能を使ってコードを書いた雑感 - Shin x Blog](https://cdn-ak-scissors.b.st-hatena.com/image/square/4cab0208a329cc98bdc0d4340cb784e378e03dfc/height=288;version=1;width=512/https%3A%2F%2Fcdn-ak.f.st-hatena.com%2Fimages%2Ffotolife%2Fs%2Fshin1x1%2F20201211%2F20201211120801.png)