-
Notifications
You must be signed in to change notification settings - Fork 843
LESS: Address issues in legacy library #46057
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
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
anomiex
left a comment
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.
One thing inline, otherwise it seems reasonable.
...cts/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css/preprocessors/lessc.inc.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Brad Jorsch <[email protected]>
anomiex
left a comment
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.
Looks reasonable
Closes MONOREP-252
This addresses lots of warnings, deprecations, and fatals in the
lessphpLESS library (https://github.com/leafo/lessphp). The library hasn't been updated in years, but it's been patched here and there to maintain compatibility.In my edits I tried to respect the library's current style; it seems to not be linted anyway.
Proposed changes:
The above (and a dozen other variants) are resolved by adding the
#[\AllowDynamicProperties]attribute to the relevant classes. Were it not a copy/pasted library the better solution is to add them as properties, but this way allows us to reduce lines-of-code changes for easier comparison to the original.For the above, the flags param expects an
int, andnullultimately is treated as0, so I updated them to use0explicitly.For the above, we now make sure the key exists before trying to access its value.
For the above, we cast the values to float. A non-numeric string would become0, which then can be used in math operations.Correction (h/t @anomiex): For the above, the keys were off by one, with
$color[0]being a string that was used to determine how to process the remaining keys.For the above, we cast the value to int so we can do modulo math.
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions: