Modern PHP Cheat Sheet
Genuine question from a php hobbyist : what is the equivalent of Typescript’s ability to declare an object’s structure?<p>It’s really weird to me, I mean don’t we do this all the time? Work with eg. an $options array&#x2F;obj passedto a constructor, or say, a message decoded from JSON…<p>I could write $name = $message[‘username’] … and there is no checks in ide or runtime, while the phpdoc will just document $message to be an object or array… what am I missing?<p>It looks like php devs create full blown classes to represent just about every data strcuture, but what if it’s just data and you don’t need any attached logic’ Isn’t there a concise way to declare a complex type?