3 ms·
> You know it returns an array, but you don't know what the array contains. So you don't know how to use it. That's a limitation of your specific example, not
by castwide 6y ago
> You know it returns an array, but you don't know what the array contains. So you don't know how to use it.
That's a limitation of your specific example, not type systems in general.
- TooCreative 6y agoFor the example I took a random line from Symfony and shortened it a bit: https://github.com/symfony/http-client/blob/master/HttpClientTrait.php#L33 https://github.com/symfony/http-client/blob/master/HttpClien... You are free to link to some other example.
- castwide 6y agoAny example where the type is defined as something more specific than an array (especially in PHP, where the `array` type doesn't even differentiate between numerically indexed arrays and dictionaries). Regardless, I still think the type hints in Symfony's version are better than nothing. It's also worth noting that `private static` is concerned with scope, not types.