Closed asgraf closed 11 months ago
@asgraf thanks for the suggestion. If it's not too much work, please create a pull request with your poposed changes.
Let's see what these changes could mean. May be the current test coverage could point us to something, already.
I could see object
being a reasonable narrowing. Having to implement an interface is not something we should be adding, as it creates a huge BC break with no actual value.
Couldn't that break all sorts of custom resolvers? I remember the talk around string resolvers, and support for it added explicitly somewhere.
Couldn't that break all sorts of custom resolvers? I remember the talk around string resolvers, and support for it added explicitly somewhere.
Yes, any constraint we try and put on mixed
runs the chance of breaking someone's application. I don't see many practical use cases of the resource being null|resource
but I bet there is someone out there using it.
Can we revisited for Cake6
Currently, the
$resource
variable is defined as amixed
type. The mixed type is an alias forstring|int|float|bool|null|array|object|callable|resource
. I'll frankly admit that I can't imagine a use-case in which$resource
could take a value other than object Therefore, I suggest that we narrow down the type of$resource
down toobject
(or even down to hypothetical\Authorization\Policy\ResourceInterface
)