Php Cannot Use Object Of Type Assertion