Let's be controversial: In modern #PHP, you should never type-hint an array.

https://peakd.com/php/@crell/php-never-type-hint-on-arrays

PHP: Never type hint on arrays | PeakD

Let's be controversial: In modern PHP, you should never type-hint an array. Before you start throwing tomatoes, hear me... by crell

PeakD
@Crell I would be honest if I tell that I use data-array objects for quick prototyping because I'm too lazy to create a class when I don't know if my data object may actually represent 2 or more classes later on.
@Crell and afterwards there is sometimes no time budget to convert these arrays to classes, or gets overlooked during code quality checks or reviews
@anthonyvdg Sounds like several problems rolled up into one.

@Crell mostly in my case, I want to retrieve data, transform it into something, maybe do validation on it and then get the data out.

With quick prototyping I end up propping all that data into 1 array, with each step sometimes not knowing if my array should have a different shape (because I want to put "wires" between an object and where the data should go.

@anthonyvdg Deserialize it into a classed object using Crell/Serde, build the validation into that. Using either Serde's callbacks, or property hooks, or something like Symfony/Validator.

Your object completed? Great, it's valid. And now you have an object to use!

@Crell yes, there is composer, though I rarely check for packages during development, though now you mention that ;-)
@Crell Actually, Magento has their own class that acts as a parameter bag and it is sort of a fundamental data type that is used for things like db-objects, http request objects, ... just to add a small note ;-)
@Crell (and oh, naming variables vs naming classes...)