Skip to content

Refactor code in CSSList #994

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

Closed
10 tasks done
oliverklee opened this issue Feb 25, 2025 · 0 comments · Fixed by #1245
Closed
10 tasks done

Refactor code in CSSList #994

oliverklee opened this issue Feb 25, 2025 · 0 comments · Fixed by #1245
Assignees

Comments

@oliverklee
Copy link
Collaborator

oliverklee commented Feb 25, 2025

The goal is to get rid of redundant code and to reduce functions that have return parameters (which are both hard to understand as well as hard analyze with PHPStan).

  • move getAllDeclarationBlocks from Document to the parent class CSSBlockList
  • refactor getAllDeclarationBlocks
  • replace usages of CSSBlockList::allDeclarationBlocks with calls to ::getAllDeclarationBlocks and drop allDeclarationBlocks
  • move getAllRuleSets from Document to the parent class CSSBlockList
  • refactor getAllRuleSets
  • replace usages of CSSBlockList::allRuleSets with calls to ::getAllRuleSets and drop allRuleSets
  • move getAllValues from Document to the parent class CSSBlockList
  • refactor getAllValues
  • replace usages of CSSBlockList::allValues with calls to ::getAllValues and drop allValues
  • rename CSSBlockList::allSelectors to ::getAllSelectors and change its interface to return the result
@oliverklee oliverklee self-assigned this Feb 25, 2025
oliverklee added a commit that referenced this issue Feb 25, 2025
This is a pre-patch to moving `getAllDeclarationBlocks()` up
to `CSSBlockList`.

Part of #994.
oliverklee added a commit that referenced this issue Feb 25, 2025
This is a pre-patch to moving `getAllDeclarationBlocks()` up
to `CSSBlockList`.

Part of #994.
oliverklee added a commit that referenced this issue Feb 25, 2025
Move this method up without any changes to the method or its
callers.

We'll clean this up in later changes.

Part of #994.
oliverklee added a commit that referenced this issue Feb 25, 2025
Move this method up without any changes to the method or its
callers.

We'll clean this up in later changes.

Part of #994.
oliverklee added a commit that referenced this issue Feb 26, 2025
Move this method up without any changes to the method or its
callers.

We'll clean this up in later changes.

Part of #994.
oliverklee added a commit that referenced this issue Feb 26, 2025
oliverklee added a commit that referenced this issue Feb 26, 2025
Move this method up without any changes to the method or its
callers.

We'll clean this up in later changes.

Part of #994.
JakeQZ pushed a commit that referenced this issue Feb 26, 2025
Move this method up without any changes to the method or its
callers.

We'll clean this up in later changes.

Part of #994.
oliverklee added a commit that referenced this issue Feb 26, 2025
oliverklee added a commit that referenced this issue Feb 27, 2025
JakeQZ pushed a commit that referenced this issue Feb 27, 2025
oliverklee added a commit that referenced this issue Mar 1, 2025
Move this method up without any changes to the method or its callers.

We'll clean this up in later changes.

Part of #994.
JakeQZ pushed a commit that referenced this issue Mar 2, 2025
Move this method up without any changes to the method or its callers.

We'll clean this up in later changes.

Part of #994.
oliverklee added a commit that referenced this issue Mar 2, 2025
Also remove the now-unused method `allRuleSets()`.

Part of #994.
JakeQZ pushed a commit that referenced this issue Mar 2, 2025
Also remove the now-unused method `allRuleSets()`.

Part of #994.
JakeQZ added a commit that referenced this issue Apr 9, 2025
Change the one remaining usage instance to use `getAllDeclarationBlocks()`,
which was refactored in #990.

Part of #994.
oliverklee pushed a commit that referenced this issue Apr 9, 2025
Change the one remaining usage instance to use `getAllDeclarationBlocks()`,
which was refactored in #990.

Part of #994.
JakeQZ added a commit that referenced this issue Apr 10, 2025
Also add unit tests for this method.

Part of #994.  Relates to #1230.
JakeQZ added a commit that referenced this issue Apr 10, 2025
Also add unit tests for this method.

Part of #994.  Relates to #1230.
JakeQZ added a commit that referenced this issue Apr 10, 2025
Also add unit tests for this method.

Part of #994.  Relates to #1230.
oliverklee pushed a commit that referenced this issue Apr 10, 2025
Also add unit tests for this method.

Part of #994.  Relates to #1230.
JakeQZ added a commit that referenced this issue Apr 11, 2025
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.
oliverklee pushed a commit that referenced this issue Apr 11, 2025
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.
JakeQZ added a commit that referenced this issue Apr 12, 2025
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.
oliverklee pushed a commit that referenced this issue Apr 12, 2025
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.
JakeQZ added a commit that referenced this issue Apr 13, 2025
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.
JakeQZ added a commit that referenced this issue Apr 13, 2025
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.
JakeQZ added a commit that referenced this issue Apr 13, 2025
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.
oliverklee pushed a commit that referenced this issue Apr 13, 2025
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.
JakeQZ added a commit that referenced this issue Apr 13, 2025
The renamed (internal) method now returns the result,
instead of having a reference parameter for it.

Closes #994.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant