Releases: MyIntervals/PHP-CSS-Parser
Releases · MyIntervals/PHP-CSS-Parser
V9.0.0: New features, deprecation removals and bug fixes
Added
- Interface
RuleContainer
forRuleSet
Rule
manipulation methods (#1256) - Partial support for CSS Color Module Level 4:
- Add a class diagram to the README (#482)
- Add more tests (#449)
Changed
DeclarationBlock
no longer extendsRuleSet
and instead has aRuleSet
as
a property; usegetRuleSet()
to access it directly (#1194)- The default line (and column) number is now
null
(not zero) (#1288) setPosition()
(inRule
and other classes) now has fluent interface,
returning itself (#1259)RuleSet::removeRule()
now only allowsRule
as the parameter
(implementing classes areAtRuleSet
andDeclarationBlock
);
useremoveMatchingRules()
orremoveAllRules()
for other functions (#1255)RuleSet::getRules()
andgetRulesAssoc()
now only allowstring
ornull
as the parameter (implementing classes areAtRuleSet
andDeclarationBlock
)
(#1253)- Initialize
KeyFrame
properties to sensible defaults (#1146) - Make
OutputFormat
final
(#1128) - Make
Selector
aRenderable
(#1017) - Only allow
string
for someOutputFormat
properties (#885) - Use more native type declarations and strict mode
(#641, #772, #774, #778, #804, #841, #873, #875, #891, #922, #923, #933, #958,
#964, #967, #1000, #1044, #1134, #1136, #1137, #1139, #1140, #1141, #1145,
#1162, #1163, #1166, #1172, #1174, #1178, #1179, #1181, #1183, #1184, #1186,
#1187, #1190, #1192, #1193, #1203) - Add visibility to all class/interface constants (#469)
Removed
- Remove
getLineNo()
from these classes (usegetLineNumber()
instead):
Comment
,CSSList
,SourceException
,Charset
,CSSNamespace
,Import
,
Rule
,DeclarationBlock
,RuleSet
,CSSFunction
,Value
(#1258) - Remove
Rule::getColNo()
(usegetColumnNumber()
instead) (#1287) - Passing a string as the first argument to
getAllValues()
is no longer
supported and will not work;
the search pattern should now be passed as the second argument (#1243) - Passing a Boolean as the second argument to
getAllValues()
is no longer
supported and will not work; the flag for searching in function arguments
should now be passed as the third argument (#1243) - Remove
__toString()
(#1046) - Drop magic method forwarding in
OutputFormat
(#898) - Drop
atRuleArgs()
from theAtRule
interface (#1141) - Remove
OutputFormat::get()
and::set()
(#1108, #1110) - Drop special support for vendor prefixes (#1083)
- Remove the IE hack in
Rule
(#995) - Drop
getLineNo()
from theRenderable
interface (#1038) - Remove
OutputFormat::level()
(#874) - Remove expansion of shorthand properties (#838)
- Remove
Parser::setCharset/getCharset
(#808) - Remove
Rule::getValues()
(#582) - Remove
Rule::setValues()
(#562) - Remove
Document::getAllSelectors()
(#561) - Remove
DeclarationBlock::getSelector()
(#559) - Remove
DeclarationBlock::setSelector()
(#560) - Drop support for PHP < 7.2 (#420)
Fixed
- Remove trailing semicolon from declaration blocks with 'compact'
OutputFormat
(#1345) - Parse selector functions (like
:not
) with comma-separated arguments (#1292) - Parse quoted attribute selector value containing comma (#1323)
- Allow comma in selectors (e.g.
:not(html, body)
) (#1293) - Insert
Rule
before sibling even with different property name
(inRuleSet::addRule()
) (#1270) - Ensure
RuleSet::addRule()
sets non-negative column number when sibling
provided (#1268) - Don't render
rgb
colors with percentage values using hex notation (#803)
Documentation
- Add an API and deprecation policy (#720)
@ziegenberg is a new contributor to this release and did a lot of the heavy
lifting. Thanks! ❤️
8.9.0: New features, bug fixes and deprecations
Added
RuleSet::removeMatchingRules()
method
(for the implementing classesAtRuleSet
andDeclarationBlock
) (#1249)RuleSet::removeAllRules()
method
(for the implementing classesAtRuleSet
andDeclarationBlock
) (#1249)- Add Interface
CSSElement
(#1231) - Methods
getLineNumber
andgetColumnNumber
which return a nullableint
for the following classes:
Comment
,CSSList
,SourceException
,Charset
,CSSNamespace
,Import
,
Rule
,DeclarationBlock
,RuleSet
,CSSFunction
,Value
(#1225, #1263) Positionable
interface for CSS items that may have a position
(line and perhaps column number) in the parsed CSS (#1221)
Changed
- Parameters for
getAllValues()
are deconflated, so it now takes three (all
optional), allowing$element
and$ruleSearchPattern
to be specified
separately (#1241) - Implement
Positionable
in the following CSS item classes:
Comment
,CSSList
,SourceException
,Charset
,CSSNamespace
,Import
,
Rule
,DeclarationBlock
,RuleSet
,CSSFunction
,Value
(#1225)
Deprecated
- Support for PHP < 7.2 is deprecated; version 9.0 will require PHP 7.2 or later
(#1264) - Passing a
string
ornull
toRuleSet::removeRule()
is deprecated
(implementing classes areAtRuleSet
andDeclarationBlock
);
useremoveMatchingRules()
orremoveAllRules()
instead (#1249) - Passing a
Rule
toRuleSet::getRules()
orgetRulesAssoc()
is deprecated,
affecting the implementing classesAtRuleSet
andDeclarationBlock
(call e.g.getRules($rule->getRule())
instead) (#1248) - Passing a string as the first argument to
getAllValues()
is deprecated;
the search pattern should now be passed as the second argument (#1241) - Passing a Boolean as the second argument to
getAllValues()
is deprecated;
the flag for searching in function arguments should now be passed as the third
argument (#1241) getLineNo()
is deprecated in these classes (usegetLineNumber()
instead):
Comment
,CSSList
,SourceException
,Charset
,CSSNamespace
,Import
,
Rule
,DeclarationBlock
,RuleSet
,CSSFunction
,Value
(#1225, #1233)Rule::getColNo()
is deprecated (usegetColumnNumber()
instead)
(#1225, #1233)- Providing zero as the line number argument to
Rule::setPosition()
is
deprecated (passnull
instead if there is no line number) (#1225, #1233)
Fixed
V8.8.0: Bug fixes and deprecations
Added
OutputFormat
properties for space around specific list separators (#880)
Changed
- Mark the
OutputFormat
constructor as@internal
(#1131) - Mark
OutputFormatter
as@internal
(#896) - Mark
Selector::isValid()
as@internal
(#1037) - Mark parsing-related methods of most CSS elements as
@internal
(#908) - Mark
OutputFormat::nextLevel()
as@internal
(#901) - Make all non-private properties
@internal
(#886)
Deprecated
- Deprecate extending
OutputFormat
(#1131) - Deprecate
OutputFormat::get()
and::set()
(#1107) - Deprecate support for
-webkit-calc
and-moz-calc
(#1086) - Deprecate magic method forwarding from
OutputFormat
toOutputFormatter
(#894) - Deprecate
__toString()
(#1006) - Deprecate greedy calculation of selector specificity (#1018)
- Deprecate the IE hack in
Rule
(#993, #1003) OutputFormat
properties for space around list separators as an array (#880)- Deprecate
OutputFormat::level()
(#870)
Fixed
V8.7.0: Add support for PHP 8.4
V8.6.0: Critical features
V8.5.2: Bug fixes
V8.5.1: Bug fixes
Fixed
- Fix (regression) failure to parse at-rules with strict parsing (#456)
V8.5.0
Added
Fixed
V8.4.0
Features
- Support for PHP 8.x
- PHPDoc annotations
- Allow usage of CSS variables inside color functions (by parsing them as regular functions)
- Use PSR-12 code style
- No deprecations
Bugfixes
- Improved handling of whitespace in
calc()
- Fix parsing units whose prefix is also a valid unit, like
vmin
- Allow passing an object to
CSSList#replace
- Fix PHP 7.3 warnings
- Correctly parse keyframes with
%
- Don’t convert large numbers to scientific notation
- Allow a file to end after an
@import
- Preserve case of CSS variables as specced
- Allow identifiers to use escapes the same way as strings
- No longer use
eval
for the comparison ingetSelectorsBySpecificity
, in case it gets passed untrusted input (CVE-2020-13756). Also fixed in 8.3.1, 8.2.1, 8.1.1, 8.0.1, 7.0.4, 6.0.2, 5.2.1, 5.1.3, 5.0.9, 4.0.1, 3.0.1, 2.0.1, 1.0.1. - Prevent an infinite loop when parsing invalid grid line names
- Remove invalid unit
vm
- Retain rule order after expanding shorthands
Backwards-incompatible changes
- PHP ≥ 5.6 is now required
- HHVM compatibility target dropped
8.3.0: The “Ready for the good times” release
8.3.0 (2019-02-22)
- Refactor parsing logic to mostly reside in the class files whose data structure is to be parsed (this should eventually allow us to unit-test specific parts of the parsing logic individually).
- Fix error in parsing
calc
expessions when the first operand is a negative number, thanks to @raxbg. - Support parsing CSS4 colors in hex notation with alpha values, thanks to @raxbg.
- Swallow more errors in lenient mode, thanks to @raxbg.
- Allow specifying arbitrary strings to output before and after declaration blocks, thanks to @westonruter.
- No backwards-incompatible changes
- No deprecations