Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: MyIntervals/PHP-CSS-Parser
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: NitroPack/PHP-CSS-Parser
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 2 commits
  • 0 files changed
  • 4 contributors

Commits on Oct 6, 2025

  1. Catchup with upstream (#6)

    * [TASK] Extract value parsing functional tests (part 1) (#1084)
    
    In the tests, we should test parsing and rendering separately
    as this makes debugging test failures a lot easier.
    
    Part of #1057
    
    * [TASK] Drop special support for vendor prefixes (#1083)
    
    In the past, vendor prefixes like `-moz-` or `-webkit-` were
    used for experimental CSS features in browsers. Nowadays,
    the browsers use features for this instead. Hence, special
    support for vendor prefixes is no longer needed.
    
    https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix
    
    * [CLEANUP] Avoid Hungarian notation for `size` (#1085)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `unit` and `sizeUnits` (#1088)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `isColorComponent` (#1090)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation in `Size::render()` (#1092)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `url` (#1093)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `tokenLength` (#1089)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `character` (#1094)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `sizeUnit` (#1095)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `useUrl` (#1096)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation in `OutputFormatter` (#1097)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation in `OutputFormat` (part 1) (#1098)
    
    Part of #756
    
    * [CLEANUP] Improve some `OutputFormat` property and getter names (#1099)
    
    As suggested in #1098.
    
    The setters are not changed as those are part of the public
    API.
    
    * [CLEANUP] Avoid Hungarian notation in the tests (#1101)
    
    Part of #756
    
    Co-authored-by: JakeQZ <jake.github@qzdesign.co.uk>
    
    * [CLEANUP] Avoid Hungarian notation in `SpecificityCalculator` (#1102)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation in `CSSBlockList` (#1104)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation in `DeclarationBlock` (#1105)
    
    Part of #756
    
    * [CLEANUP] Use the explicit `OutputFormat` setters in the tests (#1106)
    
    The `set()` method will be removed soon.
    
    Also unify the tests a bit.
    
    Part of #1103
    
    * [TASK] Remove `OutputFormat::get()` (#1108)
    
    We now have beautiful, cleanly-typed getters to use instead.
    
    Part of #1103
    
    * [CLEANUP] Avoid Hungarian notation in comments (#1109)
    
    Part of #756
    
    * [TASK ] Remove `OutputFormat::set()` (#1110)
    
    Part of #1103
    Closes #1103
    
    * [CLEANUP] Avoid Hungarian notation in `OutputFormat` (part 2) (#1100)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation in `Size` (#1111)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `numberOfLines` (#1112)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `matches` (#1113)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation in `OutputFormat` (part 3) (#1114)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation in `OutputFormat` (part 4) (#1115)
    
    Also rename the (internal) getters to match the changed property
    names.
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `input` (#1116)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation in `OutputFormat` (part 5) (#1117)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation in `OutputFormat` (part 6) (#1118)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `expression` (#1119)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `peek` (#1120)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation in `OutputFormat` (part 7) (#1121)
    
    Also rename the getters to match the new property names.
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `maximumLength` (#1122)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `comment` (#1123)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation for `stopCharacters` (#1124)
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation in `OutputFormat` (part 8) (#1125)
    
    Also rename the getters to match the new property names.
    
    Part of #756
    
    * [CLEANUP] Avoid Hungarian notation in `OutputFormat` (part 9) (#1126)
    
    Also rename the getters to match the new property names.
    
    Part of #756
    
    * [CLEANUP] Improve some variable names in `ParserState` (#1129)
    
    * [CLEANUP] Fix some type annotations in `ParserState` (#1130)
    
    Also make the parameter names non-Hungarian.
    
    Part of #756
    
    Co-authored-by: JakeQZ <jake.github@qzdesign.co.uk>
    
    * [BUGFIX] Fix a typo in `indentationLevel` (#1132)
    
    * [TASK] Mark `OutputFormat` as not extendable (#1131)
    
    Also mark the constructor as `@internal`.
    
    Co-authored-by: JakeQZ <jake.github@qzdesign.co.uk>
    
    * [TASK] Make `OutputFormat` `final` (#1128)
    
    This class is not intended to be extended, and it's intended to
    be created using the factory methods anyway.
    
    (Also, we most probably won't need to have mocks of this class
    in the tests as it's mostly a data object.)
    
    * [CLEANUP] Drop empty `OutputFormat` constructor (#1127)
    
    * [TASK] Use native type declarations for `$lineNumber` (#1134)
    
    Part of #811
    
    Co-authored-by: JakeQZ <jake.github@qzdesign.co.uk>
    
    * [TASK] Add some rendering tests for `Document` (#1138)
    
    Part of #757
    
    * [TASK] Add some more type declarations (#1139)
    
    These are some random changes the Rector would do as a result
    of the changes of some open PRs.
    
    * [TASK] Use native type declarations in `Document` (#1137)
    
    Part of #811
    
    * [TASK] Use native type declarations in `ParserState` (#1136)
    
    Part of #811
    
    Co-authored-by: JakeQZ <jake.github@qzdesign.co.uk>
    
    * [TASK] Use native type declarations in `Parser` (#1140)
    
    Part of #811
    
    * [TASK] Use native type declarations in `Anchor` (#1141)
    
    Part of #811
    
    * [CLEANUP] Make a type annotation more specific (#1143)
    
    * [CLEANUP] Drop an unused internal constant (#1144)
    
    * [TASK] Initialize `KeyFrame` properties (#1146)
    
    They fortunately have obvious default values.
    This change means it can be enforced that they are always non-empty strings.
    Type declarations have been updated to reflect that.
    
    * [TASK] Add native type declarations for `atRuleName()` (#1145)
    
    Part of #811
    
    * [CLEANUP] Avoid magic method forwarding in `AtRuleBlockList` (#1148)
    
    Part of #1147
    
    * [CLEANUP] Avoid magic method forwarding in `ValueList` (#1149)
    
    Part of #1147
    
    * [CLEANUP] Avoid magic method forwarding in `Rule` (#1150)
    
    Part of #1147
    
    * [TASK] Drop `atRuleArgs()` from the `AtRule` interface (#1142)
    
    The classes implementing this interface use a wide variaty
    of inconsistent return types when they implement this method.
    
    This is a hard blocker for introducing native return type
    declaration for this method.
    
    Co-authored-by: JakeQZ <jake.github@qzdesign.co.uk>
    
    * [CLEANUP] Avoid magic method forwarding in `CSSList` (#1151)
    
    Part of #1147
    
    * [CLEANUP] Avoid magic method forwarding in `Color` (#1152)
    
    Part of #1147
    
    * [CLEANUP] Avoid magic method forwarding in `AtRuleSet` (#1153)
    
    Part of #1147
    
    * [CLEANUP] Avoid magic method forwarding in `Document` (#1155)
    
    Part of #1147
    
    * [CLEANUP] Avoid magic method forwarding in `Import` (#1156)
    
    Part of #1147
    
    * [CLEANUP] Avoid magic method forwarding in `CalcRuleValueList` (#1157)
    
    Part of #1147
    
    * [DOCS] Avoid Hungarian notation in the README (#1154)
    
    Co-authored-by: JakeQZ <jake.github@qzdesign.co.uk>
    
    * [CLEANUP] Avoid magic method forwarding in `KeyFrame` (#1158)
    
    Part of #1147
    
    * [CLEANUP] Avoid magic method forwarding in `RuleSet` (#1159)
    
    Part of #1147
    
    * [CLEANUP] Avoid magic method forwarding in `Charset` (#1160)
    
    Part of #1147
    
    * [CLEANUP] Avoid magic method forwarding in `DeclarationBlock` (#1161)
    
    Part of #1147
    
    * [TASK] Add native type declarations in `Size` (#1162)
    
    Part of #811
    
    * [TASK] Add more unit tests for `Size` (#1165)
    
    Part of #757
    
    * [TASK] Add some basic unit tests for `URL` (#1164)
    
    Part of #757
    
    Co-authored-by: JakeQZ <jake.github@qzdesign.co.uk>
    
    * [TASK] Add native type declarations in `URL` (#1163)
    
    Part of #811
    
    * [TASK] Add native return type for `render*` methods (#1166)
    
    Part of #811
    
    * [TASK] Drop magic method forwarding in `OutputFormat` (#898)
    
    * [CLEANUP] Fix method name casing in a call (#1167)
    
    * [BUGFIX] Include comments for all rules in declaration block (#1169)
    
    - `Rule::parse()` will no longer consume anything after the semicolon
      terminating the rule - it does not belong to that rule;
    - The whitespace and comments before a rule will be processed by
      `RuleSet::parseRuleSet()` and passed as a parameter to `Rule::parse()` -
      - This is only required while 'strict mode' parsing is an option,
        to avoid having an exception thrown during normal operation
        (i.e. when `Rule::parse()` encounters normal `}`
        as opposed to some other junk, which is not distinguished).
    
    Fixes #173.
    See also #672, #741.
    
    * [CLEANUP] Clean up `ParserState` a bit (#1173)
    
    * [TASK] Add native type declarations for `Import` (#1172)
    
    Part of #811
    
    * [BUGFIX] Fix the return type of `Selector::isValid()` (#1174)
    
    Fixes #1043
    Part of #811
    
    * [CLEANUP] Make `Commentable` type annotations more specific (#1171)
    
    * [TASK] Add native type declarations for `Charset` (#1178)
    
    Part of #811
    
    * [TASK] Add native type declarations for `CSSString` (#1179)
    
    Part of #811
    
    * [TASK] Avoid the deprecated `__toString()` in tests (#1180)
    
    Moving some tests to functional tests and splitting them up
    will come in later changes for #1057.
    
    * [TASK] Remove `__toString()` (#1046)
    
    Closes #998
    
    * [TASK] Add native type declarations for `CSSList` (#1181)
    
    Part of #811
    
    * [CLEANUP] Fix type annotation of `::getSelectors()` (#1184)
    
    Also add a native type declaration.
    
    This will need more cleanup and refactoring later on.
    
    * [TASK] Add native type declarations for `CSSBlockList` (#1183)
    
    Also add some more type checks to ensure that the corresponding
    types are actually returned.
    
    Part of #811
    
    * [TASK] Add native type declarations for `RuleSet` (#1186)
    
    Part of #811
    
    * [TASK] Add native type declarations for `CSSNamespace` (#1187)
    
    Part of #811
    
    * [TASK] Reduce and finetune the scope of `@covers` annotations (#1188)
    
    The legacy tests are not very focused. Until we have split them
    up, try to avoid false positives for code coverage.
    
    Also add `@covers` annotations for the parent classes of the
    tested classes.
    
    * [TASK] Add native type declarations for `Rule` (#1190)
    
    Part of #811
    
    * [TASK] Add native type declarations for `AtRuleSet` (#1192)
    
    Part of #811
    
    * [TASK] Add native type declarations for `DeclarationBlock` (#1193)
    
    Part of #811
    
    * [TASK] Add native type declarations for `ValueList` (#1196)
    
    Also polish some PHPDoc type annotations.
    
    Part of #811.
    
    * [TASK] Add native type declarations for `CSSFunction` (#1197)
    
    Also improve the related type annotations and declarations
    in other classes in order to keep things consistent and
    to keep Rector from changing things.
    
    * [CLEANUP] And some more annotations for non-empty strings (#1199)
    
    * [CLEANUP] Make annotations for `OutputFormat` more specific (#1200)
    
    * [TASK] Drop the unused `ParserState::strpos()` method (#1202)
    
    * [TASK] Add native type declarations for `RuleValueList` (#1203)
    
    Part of #811
    
    * [CLEANUP] Improve type annotations in `LineName` (#1198)
    
    * [TASK] Add native type declarations for `Color` (#1204)
    
    Also make some types more specific. Also improve code
    formatting a bit.
    
    Part of #811
    
    * [CLEANUP] Return `null` from `DeclarationBlock::parse()` on failure (#1209)
    
    Also add clarification of meaning of return value from
    `CSSList::parseListItem()`, where `null` and `false` have different meanings.
    
    Part of #1176.
    
    * [TASK] Add (and use) a `CSSListItem` type (#1212)
    
    This allows a single type to be used for the contents of a `CSSList`,
    instead of a long list of orred types, and helps with static analysis.
    
    Various `assertInstanceOf()` tests are added to the test cases to confirm that
    the list items are of the type expected.
    
    Some `implements` and `exetends` lists are now alphabetically sorted.
    
    Also don't implement interfaces extended by another that is also implemented
    
    PHP<7.4 does not allow this.
    Instead, for clarity,
    add a DocBlock comment stating which additional interfaces should be
    implemented that are not explicitly listed in the `implements` section.
    
    When our minimum PHP version becomes 7.4 or above, we can revisit this.
    
    * [TASK] Configure the target PHP version for PHPStan (#1216)
    
    This will help avoid it suggesting things that are only
    possile in later PHP versions.
    
    Fixes #1214
    
    * [TASK] Add trait providing standard implementation of `Commentable` (#1206)
    
    Part of #813.
    
    * [TASK] Use `CommentContainer` trait to implement `Commentable` (#1217)
    
    Closes #813.
    
    * [TASK] Prevent Dependabot updating "rawr/cross-data-providers" (#1219)
    
    Version 3.0 of this package is not compatible.
    
    * [TASK] Add rebasing guidelines to `CONTRIBUTING.md` (#1220)
    
    This section is copied directly from the sister project, Emogrifier.
    
    Resolves #1215.
    
    * [TASK] Integrate changelog entries from 8.8 release (#1222)
    
    (And one that was missed from 8.7.)
    
    * [TASK] Add to UML diagram that `Selector` implements `Renderable` (#1224)
    
    Followup to #1017
    
    * [TASK] Add `Positionable` interface and implementing trait (#1221)
    
    This is for CSS items which have a position in the document.
    
    New methods are added:
    - `getLineNumber` to replace `getLineNo`;
    - `getColumnNumber` to replace `getColNo`.
    
    These return a nullable `int`, instead of using zero to indicate absence.
    
    The old methods are now deprecated,
    but defined in the interface and implemented in the trait.
    
    Note that this change only adds the interface and trait.
    It does not modify any classes to actually implement or use these.
    
    Part of #1207.
    
    * [TASK] Update class diagram to include `CSSListItem` (#1226)
    
    Follow-up to #1212.
    
    * [CLEANUP] Autoformat the code and drop unused imports (#1228)
    
    * [CLEANUP] Fix typos in test method names (#1229)
    
    * [TASK] Migrate to `rawr/phpunit-data-provider` (#1227)
    
    The package `rawr/cross-data-providers` that we used has been
    abandoned and should not be used anymore.
    
    * [TASK] Implement `Positionable` (#1225)
    
    Closes #1207.
    
    * [TASK] Deprecate `getLineNo()` etc. in v8.9.0 (#1233)
    
    The deprecation and changes from #1207 can be merged to 8.x.
    See #1232.
    
    So the deprecation can be brought forward.
    
    * [TASK] Update CHANGELOG for #1233 (#1235)
    
    * [BUGFIX] Correct `AtRuleBlockListTest::implementsAtRule()` (#1238)
    
    Use the interface type to be tested for in the assertion,
    not the type of the object itself.
    
    * [TASK] Add and implement `CSSElement` interface (#1231)
    
    Also add tests to confirm that the supplanted types in the DocBlock actually
    implement the new interface.
    
    And correct a DocBlock type to also allow `string`,
    which is currently possible.
    
    cf. #1230
    
    * [TASK] Add `assertInstanceOf` tests for `CSSListItem` (#1237)
    
    These should probably have been added as part of #1212.
    They confirm that the various types supplanted by `CSSListItem` in the API all
    implement the new interface.
    
    Resolves #1236.
    
    * [CLEANUP] Remove `CSSBlockList::allDeclarationBlocks()` (#1239)
    
    Change the one remaining usage instance to use `getAllDeclarationBlocks()`,
    which was refactored in #990.
    
    Part of #994.
    
    * [TASK] Move `getAllValues()` to `CSSBlockList` (#1240)
    
    Also add unit tests for this method.
    
    Part of #994.  Relates to #1230.
    
    * [TASK] Deconflate `getAllValues()` parameters (#1241)
    
    The `$element` parameter was overloaded with a dual purpose.
    
    A second separate parameter has been added for rule filtering,
    which is not actually mutually exclusive with CSS subtree selection.
    
    Since `getAllValues()` is part of the public API,
    the method now supports being called with the old or new signatures,
    with the old signature being deprecated.
    
    Once the deprecation has been included in the 8.x release branch,
    the messiness of supporting the previous API can be removed.
    
    Part of #994.  Also relates to #1230.
    
    * [TASK] Remove original `getAllValues()` API (#1243)
    
    The method still exists with the same (slightly improved) functionality,
    but the optional arguments have been refactored, and may require changes.
    
    Part of #994.  Closes #1230.
    
    * [TASK] Refactor `getAllValues()` (#1244)
    
    Move functionality from `allValues()` directly into to `getAllValues()`,
    so as to avoid passing array by reference, removing `allValues()`.
    Avoid making the recursive call for nested items that are not `CSSElement`s.
    
    Part of #994.
    Closes #1230.
    
    * [CLEANUP] `allSelectors()` -> `getAllSelectors()` (#1245)
    
    The renamed (internal) method now returns the result,
    instead of having a reference parameter for it.
    
    Closes #994.
    
    * [CLEANUP] Avoid negated non-Boolean in `RuleSet` (#1246)
    
    Use `=== null` instead to be more precise.
    
    * [TASK] Deprecate passing `Rule` to `RuleSet::getRules()` (#1248)
    
    And also `getRulesAssoc()`.
    
    Relates to #1247.
    
    * [Dependabot] Update phpunit/phpunit requirement from 8.5.41 to 8.5.42 (#1250)
    
    Updates the requirements on [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) to permit the latest version.
    - [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
    - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/8.5.42/ChangeLog-8.5.md)
    - [Commits](sebastianbergmann/phpunit@8.5.41...8.5.42)
    
    ---
    updated-dependencies:
    - dependency-name: phpunit/phpunit
      dependency-version: 8.5.42
      dependency-type: direct:development
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    
    * [TASK] Add separate methods for `RuleSet::removeRule()`, with deprecation (#1249)
    
    Passing `string` or `null` to `removeRule()` is deprecated.
    The new method handles that functionality.
    
    Relates to #1247.
    
    * [CLEANUP] Use `RuleSet::removeMatchingRules()` in tests (#1254)
    
    Now this method has been added, using it appropriately in the tests,
    rather than the deprecated functionality, will eliminate a PHPStan warning.
    
    Note that PHPStan seems to erroneously place the warning against the callee
    rather than the caller.
    
    * [TASK] Drop allowing `Rule` to be passed to `RuleSet::getRules()` (#1253)
    
    ... and `getRulesAssoc()`.
    
    Relates to #1247.
    
    * [TASK] Allow only `Rule` to be passed to `RuleSet::removeRule()` (#1255)
    
    Relates to #1247.
    
    * [CLEANUP] Check for `Positionable` in `lineNumbersParsing()` test (#1257)
    
    Now the interface has been added,
    it is no longer necessary to check the object is one of a long list of types.
    
    Also use the new `getLineNumber()` instead of the deprecated `getLineNo()`.
    
    * [TASK] Add interface `RuleContainer` for `RuleSet` (#1256)
    
    This covers the maniplation of `Rule`s within the container,
    and may be implemented by other classes in future (e.g. #1194).
    
    Note that the naming is consistent with the current codebase,
    rather than what the CSS entities are now called:
    - `Rule` represents what is now called a "declaration";
    - `RuleSet` represents what is now called a "declaration block";
    - `DeclarationBlock` represents what is now called a "style rule";
    - `CSSListItem` (closely) represents what is now generically called a "rule".
    
    Renaming things is part of a longer-term plan touched on in #1189.
    
    * [TASK] Have `setPosition()` implement fluent interface (#1259)
    
    This will aid writing tests for `RuleSet`.
    
    Note that the PHP type annotation cannot be `self` because an interface is
    involved and PHP 7 is still supported.
    
    Part of #974.
    
    * [BUGFIX] Don't return objects from data providers (#1260)
    
    The same objects may be provided to multiple tests.
    If a test manipulates an object,
    it will no longer be in the initial expected state for other tests.
    
    * [TASK] Add tests for `RuleSet::addRule()` without sibling argument (#1261)
    
    Some are currently skipped, pending some minor bug fixes.
    
    * [BUGFIX] Ensure column number set after `RuleSet::addRule()` (#1263)
    
    Note that this bug (or inconsistency) only occurs following the addtion of
    `getColumnNumber()` returning a nullable `int` (#1221 and #1225).
    These changes are not yet included in any release.
    
    Part of #974.
    
    * [BUGFIX] Ensure valid position for first `Rule` added to `RuleSet` (#1262)
    
    Part of #974.
    
    * [BUGFIX] Set line number for `AddRule()` with only column number (#1265)
    
    Continue to preserve the column number.
    Also tighten the test to confirm the `Rule` is added at the end.
    
    Note that the reason for `markTestSkipped()` was incorrect - the line number
    was not being set at all.
    
    Part of #974.
    
    * [TASK] Add tests for `addRule()` with a sibling (#1266)
    
    Some tests are skipped pending bug fixes.
    
    Part of #974.
    
    * [BUGFIX] Ensure non-negative column number in `RuleSet` (#1268)
    
    When inserting a `Rule` before a sibling, increment the column number of
    other `Rule`s, instead of assigning a lower column number.
    
    Part of #974.
    
    * [CLEANUP] Extract method `RuleSet::comparePositionable` (#1272)
    
    As well as being used with `usort()`, it may have other uses.
    
    The deprecated `getLineNo()` and `getColNo()` are still used for now.
    Replacing these will be done separately.
    
    Relates to #974.
    
    * [BUGFIX] `AddRule` before sibling with different property name (#1270)
    
    Part of #974.
    
    * [TASK] Add unit tests for `RuleSet::removeRule` (#1273)
    
    This re-uses some data providers, which have been renamed to reflect their
    more generic usage.
    Also, the PHPDoc type has been tightened to `non-empty-list` where applicable.
    
    Part of #974.
    
    * [CLEANUP] Separate some test methods in `RuleSetTest` (#1274)
    
    These were previously testing more than one aspect of a `RuleSet` method.
    Now each behaviour has a dedicated test method (albeit with some duplication
    of the set-up).
    
    Also added an additional assertion when there are no expected remaining items
    following removal, so that an assertion is made.
    
    * [DOCS] Switch to the new CoC email address (#1275)
    
    * [TASK] Add unit tests for `RuleSet::setRules` (#1276)
    
    Also rename a data provider to indicate its (now) more generic purpose.
    
    * [TASK] Add unit tests for `RuleSet::getRules` (#1277)
    
    Part of #974.
    
    * [TASK] Add tests for `RuleSet::getRules` with `$searchPattern` (#1278)
    
    Part of #974.
    
    * [TASK] Add unit tests for `RuleSet::getRulesAssoc` (#1279)
    
    Part of #974.
    
    * [CLEANUP] Split data provider for search pattern (#1281)
    
    A separate data provider now provides patterns which don't match any property
    names, and a separate test caters for the non-matching situation.
    
    * [TASK] Add tests for `RuleSet::getRulesAssoc` with `$searchPattern` (#1280)
    
    Part of #974.
    
    * [CLEANUP] Streamline tests for `getRules` with matching pattern (#1282)
    
    Combine two tests into one, by asserting an exact set match,
    instead of two-way subset matches.
    
    * [TASK] Update `RuleSet::addRule` to use `getLineNumber` (#1284)
    
    Part of #974
    
    * [TASK] Update `RuleSet::comparePositionable` to use new methods (#1283)
    
    `getLineNo` and `getColNo` are deprecated.
    When the titled method was extracted, use of the above-mentioned methods was
    retained to ease backporting and transition to their replacement counterparts:
    `getLineNumber` and `getColumnNumber`,
    which differ by returning `null` in the case of 'not set'.
    
    This replaces all instances of calls to `getColNo`.
    
    Part of #974
    
    * [TASK] Add tests for `getLineNumber` (#1286)
    
    These correspond to the existing tests for `getLineNo` for classes that
    implement `Positionable`.
    
    Also correct an existing test method name to refer to `getLineNo`.
    
    * [TASK] Use `getLineNumber` in `ParserTest` (#1285)
    
    `getLineNo` is deprecated and will be removed.
    
    Part of #974
    
    * [TASK] Remove `getColNo()` (#1287)
    
    Note that the removed tests are in `UnitDeprecated`.
    Equivalent tests already exist for the replacement `getColumnNumber()`.
    
    Part of #974
    
    * [TASK] Set line number to `null` by default (#1288)
    
    No longer allow or support `0` as a default line or column number.
    
    Part of #974
    
    * [TASK] Remove `getLineNo()` (#1258)
    
    Closes #974.
    
    * [BUGFIX] Exclude absent line number from exception message (#1290)
    
    The bug was introduced by #1288, so has not been included in any release;
    thus a changelog entry is not justified.
    
    * [TASK] Add `RuleContainerTest` trait, use in `RuleSetTest` (#1291)
    
    The trait provides tests for classes implementing `RuleContainer`.
    The test methods and data providers have been moved verbatim to the trait from
    `RuleSetTest`.
    
    Will be needed for #1194
    
    * [BUGFIX] Allow comma in selectors (#1293)
    
    Also add a note that the specificity is incorrectly calculated in such cases.
    This will be addressed with a separate fix.
    
    * [CLEANUP] Tidy up `DeclarationBlock::parse()` (#1294)
    
    - Assign the result of `ParserState::peek()` to a local variable, for
      efficiency;
    - Use a switch statement to branch on its value, for extensibility (e.g.
      #1292);
    - Don't unnecessarily test that a quote character is not escaped when not
      within a string.
    
    * [TASK] Add `assertInstanceOf` tests for `DeclarationBlock` (#1295)
    
    * [BUGFIX] Correct an exception message (#1296)
    
    This correction is not worthy of a changelog entry or any tests.
    
    * [CLEANUP] Avoid spaces before colons in the Mermaid code (#1300)
    
    * [CLEANUP] Order class names in the class diagram alphabetically (#1299)
    
    * [DOCS] Fix class list in class diagram (#1301)
    
    - adapt the sorting to how the diagram generator sorts
    - add `SpecificityCalculator` which had been missing
    
    * [DOCS] Remove cardinalities from the class diagram (#1303)
    
    This brings our class diagram closer to what the latest version
    of the diagram generator creates.
    
    * [DOCS] Make the class diagram markers generator-friendly (#1302)
    
    This is in preparation for adding a script for generating
    the class diagram in #1297.
    
    * [DOCS] Change some arrow types in the class diagram (#1304)
    
    * [DOCS] Label dependencies in the class diagram as such (#1305)
    
    This corresponds to what the latest version of our diagram
    generator does.
    
    * [DOCS] Temporarily drop some markers from the class diagram (#1307)
    
    As long as we manually edit the source of the class diagram,
    having markers for a part being autogenerated does not make
    sense.
    
    * [DOCS] Reorder some lines in the class diagram (part 1) (#1306)
    
    This is in preparation for #1298.
    
    * [DOCS] Reorder some lines in the class diagram (part 2) (#1308)
    
    This is in preparation for #1298.
    
    * [DOCS] Reorder some lines in the class diagram (part 3) (#1309)
    
    This is in preparation for #1298.
    
    * [DOCS] Reorder some lines in the class diagram (part 4) (#1310)
    
    This is in preparation for #1298.
    
    * [DOCS] Reorder some lines in the class diagram (part 5) (#1311)
    
    This is in preparation for #1298.
    
    * [DOCS] Reorder some lines in the class diagram (part 6) (#1312)
    
    This is in preparation for #1298.
    
    * [DOCS] Reorder some lines in the class diagram (part 7) (#1313)
    
    This is in preparation for #1298.
    
    * [DOCS] Reorder some lines in the class diagram (part 8) (#1314)
    
    This is in preparation for #1298.
    
    * [DOCS] Reorder some lines in the class diagram (part 9) (#1315)
    
    This is in preparation for #1298.
    
    * [DOCS] Reorder some lines in the class diagram (part 10) (#1316)
    
    This is in preparation for #1298.
    
    * [DOCS] Reorder some lines in the class diagram (part 11) (#1317)
    
    This is in preparation for #1298.
    
    * [DOCS] Reorder some lines in the class diagram (part 12) (#1318)
    
    This is in preparation for #1298.
    
    * [DOCS] Reorder some lines in the class diagram (part 13) (#1319)
    
    This is in preparation for #1298.
    
    * [CLEANUP] Use static variable for stop characters (#1321)
    
    ... in `DeclarationBlock::parse()`.
    
    This improves readability in preparation for #1292 which will extend the list.
    (It may also slightly improve performance.)
    
    * [TASK] Add unit tests for selector parsing (#1322)
    
    The tests broadly cover what currently works, and will be extended to cover
    the fixes in #1292.
    
    * [BUGFIX] Allow comma in quoted string in selector (#1323)
    
    Split by commas during parsing, not after.
    
    * [BUGFIX] Allow comma-separated arguments in selectors (#1292)
    
    Fixes #138.
    Fixes #360.
    Fixes #1289.
    
    * [TASK] Update the development tools (#786)
    
    * [DOCS] Integrate the 8.9.0 changelog into main changelog (#1329)
    
    This way, the upcoming 9.0.0 release won't have changes
    in the changelog that already are part of the 8.9.0 changelog.
    
    * [TASK] Raise PHPStan to level 4 (#1201)
    
    Also allow `assertInstanceOf` checks in the tests (as we find
    those useful).
    
    * [TASK] Use strict equality (#1331)
    
    One instance is left out, but is covered by #1330.
    
    * [TASK] Make Boolean tests explicit (#1332)
    
    * [CLEANUP] Remove superfluous Rector rule (#1333)
    
    Since #1201, this becomes a duplicate.
    
    * [TASK] Add tests for `removeDeclarationBlockBySelector()` (#1335)
    
    * [CLEANUP] Avoid use of short-ternary operator (#1336)
    
    (I share a birthday with Elvis, but needs must.)
    
    * [CLEANUP] Remove impossible conditional (#1337)
    
    The parameter `$parserState` is specified to be a `ParserState`, so it can
    never be a string.
    
    * [BUGFIX] Correct DocBlock for `ParserState::consumeUntil()` (#1338)
    
    The special `EOF` constant is actually defined as `null`, so the stop
    characters may be strings or `null`.
    
    * [BUGFIX] Provide the authentication token for PHIVE on CI (#1340)
    
    This will hopefully avoid the 403 errors when installing the
    PHIVE packages.
    
    Fixes #1339
    
    * [TASK] Make `RuleSet` concrete (#1341)
    
    ... adding internal `render` method.
    
    Precursor to #1194.
    
    * [CLEANUP] Update `RuleSet` DocBlock (#1343)
    
    ... to be consistent with the class now being concrete.
    
    Missed in #1341.
    
    * [CLEANUP] Reorder `use`s in `DeclarationBlockTest` (#1344)
    
    Order alphabetically.
    
    * [BUGFIX] Remove trailing semicolon with compact format (#1345)
    
    Fixes #1342.
    
    * [CLEANUP] Use `getAllDeclarationBlocks` in `colorParsing` test (#1346)
    
    ... instead of `getAllRuleSets`.
    
    This avoids testing if `RuleSet`s are `DeclarationBlock`s, and will be needed
    for #1194.
    
    * [TASK] Add tests for `RuleSet` constructor (#1348)
    
    * [BUGFIX] Correct an `assert` added in #1348 (#1349)
    
    * [TASK] Add tests for `DeclarationBlock` constructor (#1350)
    
    The class extends `RuleSet`, but the constructor behaviour needs to be tested
    for each class.
    
    * [TASK] Test `RuleSet` constructor with `null` explicitly passed (#1351)
    
    * [BUGFIX] Update class diagram to show `RuleSet` as concrete (#1352)
    
    Missed in #1341.
    
    * [TASK] Use delegation for `DeclarationBlock` -> `RuleSet` (#1194)
    
    ... rather than inheritance.
    
    This will allow `DeclarationBlock` to instead extend `CSSBlockList` in order
    to support
    [CSS nesting](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_nesting).
    
    This is a slightly-breaking change, since now `CSSBlockList::getAllRuleSets()`
    will include the `RuleSet` property of the `DeclarationBlock` instead of the
    `DeclarationBlock` itself.
    
    Part of #1170.
    
    * [TASK] Update the development tools (#1334)
    
    * [TASK] Prepare release of version 9.0.0 (#1328)
    
    Closes #1326
    
    * [DOCS] Correct `}` to `)` in changelog (#1354)
    
    * [TASK] Raise PHPStan to level 5 (#1356)
    
    * [CLEANUP] Ignore warnings for explicitly invalid values in tests (#1358)
    
    * [Dependabot] Update phpunit/phpunit requirement from 8.5.42 to 8.5.43 (#1360)
    
    Updates the requirements on [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) to permit the latest version.
    - [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
    - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/8.5.43/ChangeLog-8.5.md)
    - [Commits](sebastianbergmann/phpunit@8.5.42...8.5.43)
    
    ---
    updated-dependencies:
    - dependency-name: phpunit/phpunit
      dependency-version: 8.5.43
      dependency-type: direct:development
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    
    * [Dependabot] Bump actions/checkout from 4 to 5 (#1361)
    
    Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
    - [Release notes](https://github.com/actions/checkout/releases)
    - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
    - [Commits](actions/checkout@v4...v5)
    
    ---
    updated-dependencies:
    - dependency-name: actions/checkout
      dependency-version: '5'
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    
    * [Dependabot] Update phpunit/phpunit requirement from 8.5.43 to 8.5.44 (#1362)
    
    Updates the requirements on [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) to permit the latest version.
    - [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
    - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/8.5.44/ChangeLog-8.5.md)
    - [Commits](sebastianbergmann/phpunit@8.5.43...8.5.44)
    
    ---
    updated-dependencies:
    - dependency-name: phpunit/phpunit
      dependency-version: 8.5.44
      dependency-type: direct:development
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    
    * [TASK] Raise PHPStan to level 6 (#1364)
    
    * [TASK] Add `thecodingmachine/safe` (#1453) (#1366)
    
    Safe-PHP https://github.com/thecodingmachine/safe provides
    rewrites of PHP functions to throw an exception instead of
    returning `false` when an error is encountered.
    
    This will allow us to drop out custom `preg_*` wrapper class
    and to increase type safety in our codebase.
    
    Also drop the PHP-CS-Fixer rule that adds a trailing backslash
    to calls to native PHP functions (as this would change the
    Safe-PHP calls back to their unsafe versions).
    
    The actual code changes will come in subsequent commits.
    
    Part of #1168
    
    * [BUGFIX] Use the safe `file_get_contents` in `quickdump.php` (#1367)
    
    * [BUGFIX] Use the safe regexp functions in `CSSList` (#1368)
    
    * [CLEANUP] Avoid Hungarian notation in `quickdump.php` (#1369)
    
    * [BUGFIX] Use the safe regexp functions in `ParserState` (#1370)
    
    Part of #1168
    
    * [BUGFIX] Improve selector validation performance (#1372)
    
    Avoid [catastrophic backtracking](https://www.regular-expressions.info/catastrophic.html)
    in selector validation regular expression by using possessive quantifier with
    mutually exclusive alternations.
    
    Also remove outdated description from DocBlock,
    but add description for extended class summarizing differences.
    
    * [BUGFIX] Use the safe regexp functions in `Selector` (#1371)
    
    Part of #1168
    
    * [BUGFIX] Use safe `file_get_contents` in `LenientParsingTest` (#1373)
    
    Part of #1168
    
    * [Dependabot] Update phpunit/phpunit requirement from 8.5.44 to 8.5.45 (#1375)
    
    Updates the requirements on [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) to permit the latest version.
    - [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
    - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/8.5.45/ChangeLog-8.5.md)
    - [Commits](sebastianbergmann/phpunit@8.5.44...8.5.45)
    
    ---
    updated-dependencies:
    - dependency-name: phpunit/phpunit
      dependency-version: 8.5.45
      dependency-type: direct:development
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    
    * [TASK] Update the development tools (#1353)
    
    * [FEATURE] Add support for PHP 8.5 (#1355)
    
    * [TASK] Prepare release of version 9.1.0 (#1376)
    
    * [Dependabot] Update phpunit/phpunit requirement from 8.5.45 to 8.5.46 (#1377)
    
    Updates the requirements on [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) to permit the latest version.
    - [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
    - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/8.5.46/ChangeLog-8.5.md)
    - [Commits](sebastianbergmann/phpunit@8.5.45...8.5.46)
    
    ---
    updated-dependencies:
    - dependency-name: phpunit/phpunit
      dependency-version: 8.5.46
      dependency-type: direct:development
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    
    * [BUGFIX] Use safe file functions in `ParserTest` (#1378)
    
    Part of #1168
    
    * [BUGFIX] Use safe preg functions in `Value` (#1379)
    
    Also use typesafe comparisons in the affected line.
    
    Part of #1168
    
    * [BUGFIX] Use safe preg functions in `Size` (#1380)
    
    Also use typesafe comparisons in the affected line.
    
    Part of #1168
    
    * [BUGFIX] Use safe preg functions in `CSSString` (#1382)
    
    Part of #1168
    
    * [BUGFIX] Use safe preg functions in `Rule` (#1383)
    
    Part of #1168
    
    * [BUGFIX] Use safe preg functions in `SpecificityCalculator` (#1384)
    
    Part of #1168
    
    * [TASK] Add PHPStan rules for Safe-PHP (#1385)
    
    This will prevent unsafe function usage from getting added.
    
    Closes #1168
    
    * [Dependabot] Update phpunit/phpunit requirement from 8.5.46 to 8.5.47 (#1386)
    
    Updates the requirements on [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) to permit the latest version.
    - [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
    - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/8.5.47/ChangeLog-8.5.md)
    - [Commits](sebastianbergmann/phpunit@8.5.46...8.5.47)
    
    ---
    updated-dependencies:
    - dependency-name: phpunit/phpunit
      dependency-version: 8.5.47
      dependency-type: direct:development
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    
    * [Dependabot] Update phpunit/phpunit requirement from 8.5.47 to 8.5.48 (#1387)
    
    Updates the requirements on [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) to permit the latest version.
    - [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
    - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/8.5.48/ChangeLog-8.5.md)
    - [Commits](sebastianbergmann/phpunit@8.5.47...8.5.48)
    
    ---
    updated-dependencies:
    - dependency-name: phpunit/phpunit
      dependency-version: 8.5.48
      dependency-type: direct:development
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    
    ---------
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: Oliver Klee <github@oliverklee.de>
    Co-authored-by: JakeQZ <jake.github@qzdesign.co.uk>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    4 people authored Oct 6, 2025
    Configuration menu
    Copy the full SHA
    6f5a736 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a66e9c3 View commit details
    Browse the repository at this point in the history
Loading