wikimedia / less.php

Less.js ported to PHP. Mirrored from https://gerrit.wikimedia.org/g/mediawiki/libs/less.php/
Apache License 2.0
111 stars 195 forks source link

Parser: deduplicate NewObj* methods #71

Closed DannyS712 closed 3 years ago

DannyS712 commented 3 years ago

Make use of the splat (...) operator available since PHP 5.6 (library currently requires PHP 7.2.9+) for creating various objects with multiple parameters.

Though the old NewObj0() and NewObj1() did not use the ObjCache() helper method to determine their cache strings, the results should be the same.

NewObj1() calls required converting the single argument to an array with that argument - using new [] style despite the rest of the file using old style array() because we no longer need to support versions of PHP that predate the shorter array syntax.

Krinkle commented 3 years ago

I've confirmed via composer cover (and viewing coverage/index.html locally) that these methods are covered by tests. Thanks!

DannyS712 commented 3 years ago

I've confirmed via composer cover (and viewing coverage/index.html locally) that these methods are covered by tests. Thanks!

No problem - I got interested in how less is transformed into css and realized there was some cleanup that could be done, so I'll be sending more patches like this soon