-
Notifications
You must be signed in to change notification settings - Fork 144
[TASK] Deprecate sSpaceAfterListArgumentSeparator
being an array
#876
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. I couldn't think of a way of achieving the seemingly impossible (well, not impossible but it looked like a lot of work). But you just have. Very clever. (Do you play chess?)
But there's a premature change here, I think.
* @var string | ||
* #866 `array` is deprecated in version V8.8.0, will be changed to `string` only in V9.0.0. | ||
* | ||
* @var string|array<string, string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too soon. We need to still allow array
until 9.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, was looking at the diff the wrong way round. But...
Can we use @deprecated
in the DocBlock here for partial deprecation?
I was mistaken about that, but wonder if it's possible to use |
As far as I know, that's not possible. |
Working within the limits of written communication, I'm not completely sure whether you meant this as genuine appreciation, or whether you were being sarcastic. Assuming it was the former: Why, thanks! ❤️ (I used to play some chess as a child, but gave up on it quite soon. Nowadays, I really enjoy escape rooms and also logic puzzles. What, you wanted to get some real work done today instead? 😉) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about this a bit more, I'm not convinced we can deprecate/drop support for the array arguments for list separator spacing.
Consider
color: rgba(0, 85, 0, 0.5); /* "legacy" syntax */
color: rgba(0 85 0 / 0.5); /* "modern syntax */
These examples use the typical human-readable format which is also used in MDN and W3C examples.
Both /
and ,
are list separators. But if we stop allowing a distinction between them for output spacing, the above output would not be possible. The choice would be between
color: rgba(0 , 85 , 0 , 0.5); /* "legacy" syntax */
color: rgba(0 85 0 / 0.5); /* "modern syntax */
and
color: rgba(0, 85, 0, 0.5); /* "legacy" syntax */
color: rgba(0 85 0/ 0.5); /* "modern syntax */
both of which are ugly and not as humanly-readable.
I was mistaken about that, but wonder if it's possible to use
@deprecated
in the DocBlock for a partial deprecation...As far as I know, that's not possible.
@deprecated
annotations always refer to one "thing" in its entirety, be it class, method, property or parameter.
Indeed that seems so. Moreover,
Structural Elements tagged with the @deprecated tag will be listed in the Deprecated elements report and their name will be shown as strike through,
So bending the rules won't work. And the tag does not have an inline option (e.g. {@deprecated}
within a parameter description).
Wow. I couldn't think of a way of achieving the seemingly impossible...
Working within the limits of written communication, I'm not completely sure whether you meant this as genuine appreciation, or whether you were being sarcastic.
The former. See #866 (comment). I didn't think of simply deprecating the test method referred to in the documentation along with adding a deprecation note to the property.
(I used to play some chess as a child, but gave up on it quite soon. Nowadays, I really enjoy escape rooms and also logic puzzles. What, you wanted to get some real work done today instead? 😉)
(I wondered, because chess often involves seeing a cunning yet simple way through - and we could do with more participants in our online chess tourneys. Thanks for the puzzles link. Some are the same type that appear in daily newspapers along with the crossword. I occasionally try them. My Mum loves them, so I'll pass on the link.)
Maybe we can for 'after' (though not 'before'), but I'm not 100% convinced we may not have missed a case where the variation for different separators is actually needed to render human-readable CSS. |
I didn’t follow any of the discussions leading up to this so I’m curious: what’s the rationale for this change? |
I'm generally working on these things: In the process, I added tests for the (hitherto) magic getters and setters of This lead me to discover that at least the test deprecated here relied on I prefer to have types that are as narrow is possible, and to use native type declarations as much as possible. So that's the rationale. :-) @sabberworm Maybe you can shed some light on this: Does it make sense to enforce this property being |
I suppose it’s sensible to allow customizing the whitespace for specific separators but I agree it should not clash with type annotations. IMO we could change |
Thanks! I propose we add a new typesafe property and method when we need it. |
We'd need to add this before deprecating the possibility of the property being an array, wouldn't we? So the deprecation message can become
|
I propose we drop the functionality of setting this to an array without replacement altogether for the time being, and re-add it (with the corresponding method) when and if we need this. |
For the reasons I mentioned in #876 (review), I think we need this, at least for the counterpart I think the ability to unminify CSS and/or render it in a human-readable format is an important feature of the library. Removing the option of different-spacing-according-to-separator breaks that feature. Also, that feature is almost zero-cost in terms of maintenance. (By far the biggest maintenance cost is changes to the CSS spec for parsing, dictated by the GAFAMs, who are beyond reproach.) I'd be more than happy to create a PR to add the |
Yes, let's do this. 🙏 Please go ahead! |
I‘d prefer the new method to be specific to passing an array, though (both in naming as well as the parameter type), instead of adding a general method that allows passing the type of the other parameter. |
`SpaceBeforeListArgumentSeparators` and `SpaceAfterListArgumentSeparators` are added to allow for different spacing for different separators. `SpaceBeforeListArgumentSeparator` and `SpaceAfterListArgumentSeparator` will specify the default spacing. Setting these as an array is deprecated. Resolves #866, #876, #878.
`SpaceBeforeListArgumentSeparators` and `SpaceAfterListArgumentSeparators` are added to allow for different spacing for different separators. `SpaceBeforeListArgumentSeparator` and `SpaceAfterListArgumentSeparator` will specify the default spacing. Setting these as an array is deprecated. Resolves #866, #876, #878.
Sorry for the confusion. The method I suggested would take two strings. The |
In #880, I added an additional separate method accepting an array (only), whose values would override the default string set by the original method. This was simpler to implement than having methods to set the values in the array individually, which would have also needed a means to unset elements. |
No description provided.