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 Well, this certainly is an opinion. Sometimes you simply want an array of ints or strings or whatever. Feels pretty sane to use an array for that.

@chrastecky Array as a simple list, sure. But then you're going to most likely iterate it, and so you can type it iterable instead.

But yes, the real villain is arrays as pseudo-objects.

@Crell iterable is fine if you're going to iterate, but if you want to use one of the plethora of array functions, you have to either write your own which work with iterables, typehint it as an array or convert the iterable to an array.

Iterables are sadly not as usable out of the box as arrays are.

Edit: But yeah, arrays as object wannabes are the biggest problem.