Refactor get_sites() extension to improve readability#158
Refactor get_sites() extension to improve readability#158szepeviktor merged 3 commits intoszepeviktor:masterfrom
Conversation
|
Hello good-old pass-by-ref :( Please use properties for passing data around. |
Co-authored-by: Viktor Szépe <[email protected]>
|
@szepeviktor I switched to properties and now 15 assertions fail. 😞 I'll need some time to figure out what's going on. |
|
Properties add state to those classes making them mutable. Could be that one line of analysed code sets a property that is then incorrectly used for another line of analysed code? |
|
I replaced |
|
Just one more thing though. A get* method that doesn't return anything but changes some state is one of the things that keeps me from sleeping at night xD Most likely the simplest and safest thing is just to return the relevant values as an array and type it for phpstan with an array shape. You can use it in a sane way via e.g. |
|
OK too slow 😅 as long as it works |
Mine is |
|
Oh no, stop it... |
|
@herndlm Please star my next gen WordPress: https://github.com/szepeviktor/WordPress-the-good-parts |
|
Viktor stop trying to sell me your passive aggressive empty repo 😅 |
Refactors the dynamic function return type extension for
get_sites()to improve readability.Last PR addressing this extension 😇