phpstan-symfony icon indicating copy to clipboard operation
phpstan-symfony copied to clipboard

Support for `ServiceProviderInterface`

Open Wirone opened this issue 3 years ago • 3 comments

@ondrejmirtes I've added support for ServiceProviderInterface and checked it against our codebase - after my changes and implementing this interface in our locators (mentioned here) I don't have errors, so rule is working properly.

But I had tough time with this mostly because of test scenario provided in #151 which IMHO does not work as expected. I started by adding ExampleController::privateServiceFromServiceProvider() but wanted to make it fail and I couldn't. After several tries I just checked what will happen if I remove $isServiceLocator from ContainerInterfacePrivateServiceRule and... tests were still green. So I've just removed those services from tests/Rules/Symfony/container.xml completely and I would like to provide proper test cases for service locator/provider but I don't know how 😅 I've tried to create some example files, loaded in new test method within ContainerInterfacePrivateServiceRuleTest, but I did not manage to achieve failing scenario, which could be fixed by my changes. Could you help me with this (or @lookyman)?

Wirone avatar Feb 08 '22 00:02 Wirone

@ondrejmirtes @lookyman any news on this?

Wirone avatar Jun 22 '22 23:06 Wirone

@ondrejmirtes @lookyman friendly ping 😉

Wirone avatar Sep 09 '22 13:09 Wirone

@ondrejmirtes I described it in the PR's description 🤷‍♂️ I really would like to provide proper test cases, but I had hard time with that and just asked for help here.

Wirone avatar Sep 21 '22 14:09 Wirone