Remove usage of static vars or properties#59002
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
4620c0f to
91ba91a
Compare
068218c to
2a29e8e
Compare
2a29e8e to
93cbab6
Compare
|
5ac54b5 to
af33409
Compare
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Support was added in PHP 8.3 and we need to support 8.2 Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
It’s not easy to remove this one but at least make it visible Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
The behaviour of getAppNameFromPath is really different from what was mocked, so I’m not sure whether the class behaves as initially intended. I adapted the test to match the class behavior for now. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
There is only one instance so caching in a property is enough. There were two levels of caching, removed one. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
It’s actually more correct to cache this per-instance. What’s less clear is whether this can always fit in memory. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
…er_ldap Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
…aces Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
We will keep these legacy ones for now. We can search for the ImpureStaticProperty suppression and add special treatement for them in the frankenphp PR if needed. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
af33409 to
19a85a9
Compare
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This comment was marked as resolved.
This comment was marked as resolved.
Tests were stuck forever waiting for a semaphore because concurrency was returning 0. It was previously working by chance because cache of the value in a static var was leaking through tests. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
bba8e07 to
a1036fe
Compare
|
Can you add an explanation for all |
I’ve put an explanation where I could. I’d like to avoid putting a generic But if there are some of them specifically where you want an explanation comment on them and I’ll try to add one. |
Summary
Static properties, and even worse static vars in methods are hard to reset from outside, and become a major problem when wanting to make use of the worker mode of FrankenPHP or any similar project.
So this PR removes such declarations and adds a psalm custom plugin to forbid their use.
Checklist
3. to review, feature component)stable32)AI (if applicable)