CakeDC / users

Users Plugin for CakePHP
https://www.cakedc.com
Other
521 stars 297 forks source link

Unable to extend MiddlewareQueueLoader #919

Closed T0mats0 closed 3 years ago

T0mats0 commented 4 years ago

This is a (multiple allowed):

What you did

I created a class that extended MiddlewareQueueLoader. So I could overload the loadAuthenticationMiddleware method.

class MiddlewareQueueLoader extends CakeDCMiddlewareQueueLoader
{
}

What happened

I was not able to extend the class because what I tried to overload was this:

/**

What you expected to happen

I expected to be able to pass my own AuthenticationServiceProviderInterface on AuthorizationServiceProviderInterface and was not able to do so.

What I tried doesn't work because of course you can't change the type hints in strict mode. What would be nice is if this class were changed to use the interfaces on the Plugin class instead of the concretion -- Plugin. So I can overload these methods with my own code.

I would propose to make two classes that do what the plugin is doing and pass those in to the MiddlewareQueueLoader and remove the code from the Plugin class.

I consider this a bug, because interfaces were made but not used where they really would have been useful.

rochamarcelo commented 3 years ago

@T0mats0 Could you send a pull request for it?

T0mats0 commented 3 years ago

Yes, I'll make a PR.

T0mats0 commented 3 years ago

I've created a PR for this issue.

rochamarcelo commented 3 years ago

Closing, PR was created