Skip to content

Releases: MyIntervals/PHP-CSS-Parser

V9.3.0: Support for modern CSS at-rules and autoloading bugfix

03 Mar 17:35
Immutable release. Only release title and notes can be modified.
v9.3.0
88dbd0f

Choose a tag to compare

Added

  • Add support for modern CSS at-rules: @layer, @scope, and @starting-style (#1549)

Fixed

  • Avoid double autoloading of class aliases (#1552)

New Contributors

Full Changelog: v9.2.0...v9.3.0

V9.2.0: New features and deprecations

21 Feb 18:25
Immutable release. Only release title and notes can be modified.
v9.2.0
5937304

Choose a tag to compare

Added

  • Add OutputFormat::setSpaceAroundSelectorCombinator() (#1504)
  • Add support for escaped quotes in the selectors (#1485, #1489)
  • Provide line number in exception message for mismatched parentheses in
    selector (#1435)
  • Add support for CSS container queries (#1400)

Changed

  • RuleSet\RuleContainer is renamed to RuleSet\DeclarationList (#1530, #1539)
  • Methods like setRule() in RuleSet and DeclarationBlock have been renamed
    to setDeclaration(), etc. (#1521)
  • Rule\Rule class is renamed to Property\Declaration
    (#1508, #1512, #1513, #1522)
  • Rule::setRule() and getRule() are replaced with setPropertyName() and
    getPropertyName() (#1506)
  • Selector is now represented as a sequence of Selector\Component objects
    which can be accessed via getComponents(), manipulated individually, or set
    via setComponents() (#1478, #1486, #1487, #1488, #1494, #1496, #1536, #1537)
  • Selector::setSelector() and Selector constructor will now throw exception
    upon provision of an invalid selectior (#1498, #1502)
  • Clean up extra whitespace in CSS selector (#1398)
  • The array keys passed to DeclarationBlock::setSelectors() are no longer
    preserved (#1407)

Deprecated

  • RuleSet\RuleContainer is deprecated; use RuleSet\DeclarationList instead
    (#1530)
  • Methods like setRule() in RuleSet and DeclarationBlock are deprecated;
    there are direct replacements such as setDeclaration() (#1521)
  • Rule\Rule class is deprecated; Property\Declaration is a direct
    replacement (#1508)
  • Rule::setRule() and getRule() are deprecated and replaced with
    setPropertyName() and getPropertyName() (#1506, #1519)

Fixed

  • Do not escape characters that do not need escaping in CSS string (#1444)
  • Reject selector comprising only whitespace (#1433)
  • Improve recovery parsing when a rogue } is encountered (#1425, #1426)
  • Parse comment(s) immediately preceding a selector (#1421, #1424)
  • Parse consecutive comments (#1421)
  • Support attribute selectors with values containing commas in
    DeclarationBlock::setSelectors() (#1419)
  • Allow removeDeclarationBlockBySelector() to be order-insensitve (#1406)
  • Fix parsing of calc expressions when a newline immediately precedes or
    follows a + or - operator (#1399)
  • Use typesafe versions of PHP functions (#1379, #1380, #1382, #1383, #1384)

New Contributors

Full Changelog: v9.1.0...v9.2.0

V9.1.0: Add support for PHP 8.5

14 Sep 08:13
v9.1.0
1b363fd

Choose a tag to compare

Added

  • Add support for PHP 8.5 (#1355)

Fixed

  • Improve performance of selector validation
    (avoiding silent PCRE catastrophic failure) (#1372)
  • Use typesafe versions of PHP functions (#1368, #1370)

V9.0.0: New features, deprecation removals and bug fixes

27 Jul 07:29
v9.0.0
54574e3

Choose a tag to compare

Added

  • Interface RuleContainer for RuleSet Rule manipulation methods (#1256)
  • Partial support for CSS Color Module Level 4:
    • rgb and rgba, and hsl and hsla are now aliases (#797)
    • Parse color functions that use the "modern" syntax (#800)
    • Render RGB functions with "modern" syntax when required (#840)
    • Support none as color function component value (#859)
  • Add a class diagram to the README (#482)
  • Add more tests (#449)

Changed

  • DeclarationBlock no longer extends RuleSet and instead has a RuleSet as
    a property; use getRuleSet() to access it directly (#1194)
  • The default line (and column) number is now null (not zero) (#1288)
  • setPosition() (in Rule and other classes) now has fluent interface,
    returning itself (#1259)
  • RuleSet::removeRule() now only allows Rule as the parameter
    (implementing classes are AtRuleSet and DeclarationBlock);
    use removeMatchingRules() or removeAllRules() for other functions (#1255)
  • RuleSet::getRules() and getRulesAssoc() now only allow string or null
    as the parameter (implementing classes are AtRuleSet and DeclarationBlock)
    (#1253)
  • Initialize KeyFrame properties to sensible defaults (#1146)
  • Make OutputFormat final (#1128)
  • Make Selector a Renderable (#1017)
  • Only allow string for some OutputFormat 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 (use getLineNumber() instead):
    Comment, CSSList, SourceException, Charset, CSSNamespace, Import,
    Rule, DeclarationBlock, RuleSet, CSSFunction, Value (#1258)
  • Remove Rule::getColNo() (use getColumnNumber() 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 the AtRule 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 the Renderable 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
    (in RuleSet::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

11 Jul 13:36
v8.9.0
d8e9165

Choose a tag to compare

Added

  • RuleSet::removeMatchingRules() method
    (for the implementing classes AtRuleSet and DeclarationBlock) (#1249)
  • RuleSet::removeAllRules() method
    (for the implementing classes AtRuleSet and DeclarationBlock) (#1249)
  • Add Interface CSSElement (#1231)
  • Methods getLineNumber and getColumnNumber which return a nullable int
    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 or null to RuleSet::removeRule() is deprecated
    (implementing classes are AtRuleSet and DeclarationBlock);
    use removeMatchingRules() or removeAllRules() instead (#1249)
  • Passing a Rule to RuleSet::getRules() or getRulesAssoc() is deprecated,
    affecting the implementing classes AtRuleSet and DeclarationBlock
    (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 (use getLineNumber() instead):
    Comment, CSSList, SourceException, Charset, CSSNamespace, Import,
    Rule, DeclarationBlock, RuleSet, CSSFunction, Value (#1225, #1233)
  • Rule::getColNo() is deprecated (use getColumnNumber() instead)
    (#1225, #1233)
  • Providing zero as the line number argument to Rule::setPosition() is
    deprecated (pass null instead if there is no line number) (#1225, #1233)

Fixed

  • Set line number when RuleSet::addRule() called with only column number set
    (#1265)
  • Ensure first rule added with RuleSet::addRule() has valid position (#1262)

V8.8.0: Bug fixes and deprecations

23 Mar 19:04
v8.8.0
3de493b

Choose a tag to compare

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 to OutputFormatter
    (#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

  • Include comments for all rules in declaration block (#1169)
  • Render rules in line and column number order (#1059)
  • Create Size with correct types in expandBackgroundShorthand (#814)
  • Parse @font-face src property as comma-delimited list (#794)

V8.7.0: Add support for PHP 8.4

27 Oct 17:43
v8.7.0
f414ff9

Choose a tag to compare

Added

Changed

  • Mark parsing-internal classes and methods as @internal (#711)
  • Block installations on unsupported higher PHP versions (#691)

Deprecated

  • Deprecate the expansion of shorthand properties (#719)
  • Deprecate Parser::setCharset() and Parser::getCharset() (#703)

V8.6.0: Critical features

01 Jul 07:35
v8.6.0
d2fb94a

Choose a tag to compare

Added

  • Support arithmetic operators in CSS function arguments (#607)
  • Add support for inserting an item in a CSS list (#545)
  • Add support for the dvh, lvh and svh length units (#415)

Changed

  • Improve performance of Value::parseValue with many delimiters by refactoring to remove array_search() (#413)

V8.5.2: Bug fixes

28 Jun 16:39
v8.5.2
ef8c59c

Choose a tag to compare

Changed

  • Mark all class constants as @internal (#500)

Fixed

  • Fix undefined local variable in CalcFunction::parse() (#593)

V8.5.1: Bug fixes

15 Feb 17:41
v8.5.1
4a3d572

Choose a tag to compare

Fixed

  • Fix (regression) failure to parse at-rules with strict parsing (#456)