-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TASK] Use sabberworm/php-css-parser to parse the CSS #912
Conversation
I don't expect to have much time to follow up on this in the next few weeks, so this is just a "where I have got to" should anyone else want to take this on. It is the self-contained initial change to begin using Frankly, I am finding some of the tools, particularly Psalm (but also PHPMD), to be more a PITA than offering any justifiable benefit. I would be more than happy to drop Psalm; it does not seem to be up to scratch to me, and generally hinders development because it is simply not smart enough, and lacks thorough (or even any) documentation. |
7469f5e
to
90b1bdf
Compare
I think we should keep using a type analysis tool. We could try using PHPStan instead of Psalm. And in this case, I agree with PHPMD: The coupling is very high, and we should reduce it. Maybe we can add another class instead of stapling it all to |
Let's stick with Psalm for now. Part of the problem was the pre-existing code using associative arrays instead of objects. If the use of Sabberworm is followed through, these would I hope be eliminated anyway. However, it did seem that I had to follow a whole call stack chain telling Psalm more about the data that it should have been possible for it to determine itself. And I could not manage to get the
Perhaps some separate classes could be introduced, e.g. one for the return value of |
Would #810 + friends still make sense to do first? Or does it make more sense I abandon my work on them? |
Yes, that's the direction I was thinking of. |
And maybe it would make sense to split up the |
I think if we follow through the changes to use Sabberworm throughout we would or could end up replacing those new classes with Sabberworm classes, and could end up duplicating effort. It's not 100% clear to me at this stage, and when it will become clearer seems futher away now than it did a couple of weeks ago, but mostly because we have day jobs. (If this was our full time job, we could wrap this up in a couple of weeks, but I think more realistically we are looking at months, and several of them.) This PR itself may never be merged, but represents a vision of a direction we'd like to take (I say we, and I hope I can include you all in that). So, I would say: please keep the work done on the branches as it may be useful/required; but don't spend any time on it for the time being (except as an academic exercise if you are bored), as it may become redundant.
I think this would be a good line of attack. We would need to think carefully about how it should be split up. There is already some functionality in there that is duplicated in sister classes; that could be a starting point (see #734, #738 and #739 - whether it should be in a trait or separate class is not written in stone). Other than that, at this stage, all I can say is "OOD" - think about what the objects are, and see if that suggests a route for refactoring...? :) Which sort of brings us back full-circle into some kind of philosophical dilemma:
Hmm... |
90b1bdf
to
3c2baea
Compare
I will switch the default git branch from |
No description provided.