I have just encountered a problem where I can't explain why this works.
I have a function that only accepts string type parameters.
Example class
class A {
public function __construct() {
$data = new \Illuminate\Support\Collection();
// getType($data) => object
$this->make($data);
}
private function make(string $str): string {
// getType($str) => string
...
}
}
Question: Why can I pass a collection even though only string is allowed?