Skip to content

[TASK] Rename RuleContainer to DeclarationList#1530

Merged
oliverklee merged 1 commit intomainfrom
task/rename-rulecontainer
Feb 17, 2026
Merged

[TASK] Rename RuleContainer to DeclarationList#1530
oliverklee merged 1 commit intomainfrom
task/rename-rulecontainer

Conversation

@JakeQZ
Copy link
Copy Markdown
Collaborator

@JakeQZ JakeQZ commented Feb 16, 2026

It contains property declarations not rules, and describing it as a 'list' rather than a 'container' seems more apt, as the declarations are ordered.

Changes to use the new interface name in the source code and tests will be submitted as follow-up PRs.

@JakeQZ JakeQZ requested a review from oliverklee February 16, 2026 19:23
@JakeQZ JakeQZ self-assigned this Feb 16, 2026
@JakeQZ JakeQZ added deprecation A method, property, or some functionality has been deprecated. refactor For PRs that refactor code without changing functionality labels Feb 16, 2026
@coveralls
Copy link
Copy Markdown

coveralls commented Feb 16, 2026

Coverage Status

coverage: 72.114% (-0.03%) from 72.147%
when pulling 0f080ff on task/rename-rulecontainer
into 015a17b on main.

@JakeQZ JakeQZ force-pushed the task/rename-rulecontainer branch from 4b6803f to 8ce7499 Compare February 16, 2026 22:08
@JakeQZ
Copy link
Copy Markdown
Collaborator Author

JakeQZ commented Feb 16, 2026

I forgot to add the phpstan.neon config file. Now added.

If I'd pushed the changes as two separate commits (first rename, then add replacement with class_alias) diffing might have been easier. But I'm not sure about creating a PR from a branch with multiple commits. Let me know if I should try that next time.

It contains property declarations not rules, and describing it as a 'list'
rather than a 'container' seems more apt, as the declarations are ordered.

Changes to use the new interface name in the source code and tests will be
submitted as follow-up PRs.
@JakeQZ JakeQZ force-pushed the task/rename-rulecontainer branch from 8ce7499 to 0f080ff Compare February 16, 2026 22:14
Comment thread config/phpstan.neon

bootstrapFiles:
- %currentWorkingDirectory%/src/Rule/Rule.php
- %currentWorkingDirectory%/src/RuleSet/RuleContainer.php
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to replace these additional bootstrap file as soon as possible (in a dedicated PR) with something that also works for consumers of our library. At the moment, PHPStan fails to find these aliases within Emogrifier, and other consumers will run into the same problem.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to replace these additional bootstrap file

Oh. I don't know of a way of doing that.

The aliases allow us to make a minor release using the new class names, with the old class names deprecated. Then they will be dropped in the next major release.

I expected Stan to find the alias files; when I found it didn't, I discoved this means of telling it.

Is there a way of providing some PHPStan config for consumers? Or maybe a 'dev' Composer autoload setting could work?

Copy link
Copy Markdown
Collaborator

@oliverklee oliverklee Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can try these approaches (in this order until one solves the problem):

  1. Add a file autoloading/class-aliases.php (or something similar), move all class aliases there, and add it to autoload.files in composer.json.
  2. Try the TYPO3 class alias loader (in PHP-CSS-Parser, not in Emogrifier, so we know this works for consumers)

Copy link
Copy Markdown
Collaborator Author

@JakeQZ JakeQZ Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤞

I see there is a branch in Emogrifier that uses the dev branch of PHP-CSS-Parser, but not sure how to experimentally hack Composer's vendor directory. Though maybe if there is a way via Composer to avoid the PHPStan bootstrap settings within PHP-CSS-Parser itself, that may solve the problem for consumers.

Copy link
Copy Markdown
Collaborator

@oliverklee oliverklee Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can create a PR (or a branch) here in PHP-CSS-Parser and then create a branch in Emogrifier that uses that branch (similar to the PR that uses PHP-CSS-Parser main) and then either run the tests locally or on CI for a PR.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just entered #1532 for this and will give it a try.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JakeQZ This is how I tested this in Emogrifier without having to push to GitHub first: MyIntervals/emogrifier#1570

@oliverklee oliverklee merged commit a3cc167 into main Feb 17, 2026
24 checks passed
@oliverklee oliverklee deleted the task/rename-rulecontainer branch February 17, 2026 17:26
JakeQZ added a commit that referenced this pull request Feb 19, 2026
The interface was renamed from `RuleContainer` in #1530.

Also rename the trait that transitionally provides a mapping for the methods
deprecated in #1521 for the implementing classes.
JakeQZ added a commit that referenced this pull request Feb 20, 2026
The interface was renamed from `RuleContainer` in #1530.

Also accordingly rename the trait that provides test methods for implementing
classes.
JakeQZ added a commit that referenced this pull request Feb 20, 2026
The interface was renamed from `RuleContainer` in #1530.

Also accordingly rename the trait that provides test methods for implementing
classes.
oliverklee pushed a commit that referenced this pull request Feb 20, 2026
The interface was renamed from `RuleContainer` in #1530.

Also rename the trait that transitionally provides a mapping for the methods
deprecated in #1521 for the implementing classes.
JakeQZ added a commit that referenced this pull request Feb 20, 2026
The interface was renamed from `RuleContainer` in #1530.

Also accordingly rename the trait that provides test methods for implementing
classes.
JakeQZ added a commit that referenced this pull request Feb 20, 2026
The interface was renamed from `RuleContainer` in #1530.

Also accordingly rename the trait that provides test methods for implementing
classes.
oliverklee pushed a commit that referenced this pull request Feb 20, 2026
The interface was renamed from `RuleContainer` in #1530.

Also accordingly rename the trait that provides test methods for implementing
classes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deprecation A method, property, or some functionality has been deprecated. refactor For PRs that refactor code without changing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants