fix(IRegistrationContext): Use SimpleContainer in registerService factory#58261
fix(IRegistrationContext): Use SimpleContainer in registerService factory#58261provokateurin merged 2 commits intomasterfrom
Conversation
…tory Signed-off-by: provokateurin <kate@provokateurin.de>
Signed-off-by: provokateurin <kate@provokateurin.de>
|
|
||
| namespace OCP\AppFramework\Bootstrap; | ||
|
|
||
| use OC\AppFramework\Utility\SimpleContainer; |
There was a problem hiding this comment.
Just noticed but this is in OC, so using that in OCP is bad :(
There was a problem hiding this comment.
Let's see if it breaks something, then we can revert it 🙈
There was a problem hiding this comment.
It breaks our policy that OCP should not expose OC
|
Since this PR, we see the following error message in our psalm pipeline for the mail app (https://github.com/nextcloud/mail/actions/runs/21984802061/job/63516233833?pr=12412#step:7:11): Should we switch to |
|
Good question. I know it's an annoying change, but this helps static analyzers to understand our container properly (which can also be seen in the fixes in this PR), so think it's better for apps to change it as well. What do you think @CarlSchwan ? |
|
Ohh, don't get me wrong @provokateurin: I'm for that change as well! Better static analyzing is always being desired as someone coming from C#. 😄 I just wanted to be sure that it's not being reverted right after I'm doing the change as we would have to use the |
|
You're right, also see the comment above. I think the best solution is to add a container interface to OCP and use that, then we can have correct type information and don't need to rely on OC. I'll do that next week :) |
|
Or we use PSR Container like we already use PSR Logger |
|
Which is what we had before, but the type annotation on it is bad and confuses Psalm and PHPStan, so we need to control the interface ourselves. |
|
@provokateurin can you please provide a guidelines for module maintainers, how they should behave with your changes to make Psalm happy? I had an attempt to add |
|
For tables instead of adding a custom interface and then using that:
|
See the comments above, I will add a proper interface to OCP next week. |
|
Could we revert for now to have passing Psalm CI in the apps @provokateurin? |
|
I'm working on this right now, so reverting will cause more work than just fixing it properly. |
Using SimpleContainer as the type is important so that psalm and PHPstan will get our correct type annotation for the get method, as the ContainerInterface just returns mixed.