PHP-DI / Slim-Bridge

PHP-DI integration with the Slim framework
http://php-di.org/doc/frameworks/slim.html
MIT License
176 stars 38 forks source link

Upgraded CallableResolver to Advanced interface #71

Closed Rarst closed 2 years ago

Rarst commented 3 years ago
  1. Adds support for Slim callable notation with single colon (name:method).
  2. Enables resolving PSR objects, so that addressing them by class name isn't broken.

Fixes #51

Alternative to #70, I tried to not change constructor signature. Since interface extends the previously used one, backwards compatibility should be intact.

One implementation difference with upstream is that resolver there depends directly on container and can do container lookups. I would prefer to do that, but backwards compatibility issue, same as above.

Related disparity with Slim is closure callbacks not binding to container, see #52.

Includes unit tests for everything I could think of, but needs more people to look at. A lot of possible cases between all the syntaxes and contexts.

shadowhand commented 3 years ago

Love this. I would like to see types added, but otherwise this is 💯 !

Rarst commented 3 years ago

I would like to see types added

Where do you think types could be improved? :) The inputs/outputs are very mixed...

shadowhand commented 3 years ago

Where do you think types could be improved? :) The inputs/outputs are very mixed...

Ah, I see that the typing is largely controlled by the interface, and that there are callable|string|array types, which is annoying. Seems this is as good as it can get. 👍

mnapoli commented 3 years ago

@Rarst that looks great, thanks a lot!

Related disparity with Slim is closure callbacks not binding to container, see #52.

I think this is a very good thing 👍 no problem here.

@Rarst would you be interested that I add you as maintainer to this project? This is a non-trivial change, and I want to avoid being a blocker on any fix or other change like this in the future. There is no commitment, it's mostly to give you a bit more room.

Rarst commented 3 years ago

would you be interested that I add you as maintainer to this project?

I don't mind, but I tend to hop around, that is things have most of my attention when I am actively messing with them for my needs. :)

mnapoli commented 2 years ago

Very sorry for the delay, thanks a lot for all the work!

🚀