Skip to content

[TASK] Rename methods in RuleContainer#1521

Merged
oliverklee merged 3 commits intomainfrom
task/rename-rulecontainer-methods
Feb 15, 2026
Merged

[TASK] Rename methods in RuleContainer#1521
oliverklee merged 3 commits intomainfrom
task/rename-rulecontainer-methods

Conversation

@JakeQZ
Copy link
Copy Markdown
Collaborator

@JakeQZ JakeQZ commented Feb 14, 2026

E.g. addRule() is changed to addDeclaration(), with addRule() deprecated and changed to a wrapper method to call on to addDeclaration().

RuleContainer itself should be renamed to DeclarationContainer as a separate change.

The tests will also be updated as a separate change.

@JakeQZ JakeQZ requested a review from oliverklee February 14, 2026 17:08
@JakeQZ JakeQZ self-assigned this Feb 14, 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 14, 2026
@coveralls
Copy link
Copy Markdown

coveralls commented Feb 14, 2026

Coverage Status

coverage: 73.032% (+0.2%) from 72.791%
when pulling a936709 on task/rename-rulecontainer-methods
into b1d0988 on main.

@JakeQZ
Copy link
Copy Markdown
Collaborator Author

JakeQZ commented Feb 15, 2026

This could probably be split into a separate PR for each method rename if desired...

Also there are a couple of comments I updated with alterations not entirely related to this PR, so I'll commit those first.

@JakeQZ JakeQZ marked this pull request as draft February 15, 2026 00:50
Copy link
Copy Markdown
Collaborator

@oliverklee oliverklee left a comment

Choose a reason for hiding this comment

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

I'd be fine with not splitting this up.

*/
trait LegacyRuleContainerMethods
{
public function addRule(Declaration $declarationToAdd, ?Declaration $sibling = null): void
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.

All these methods should get an @deprecated annotation stating since which version they are deprecated and in which version they will be removed (like in RuleContainer).

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.

I wondered about this, as I had marked the trait as @internal, but the methods are public and implemented in the classes using the trait, and this would be the only place to see the deprecation notice other than in the interface.

I've added the deprecation notices into the trait.

Should the trait nonetheless be marked as @internal?

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.

No, the trait should not be @internal. The reason is that IDEs mark usages of @internal methods and classes (so that the devs know that they should switch to something else), but probably not if only the trait it @internal.

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.

I've removed @internal and also added a description for the trait.

@JakeQZ JakeQZ force-pushed the task/rename-rulecontainer-methods branch from 87e9ba5 to 2fa42c0 Compare February 15, 2026 14:56
E.g. `addRule()` is changed to `addDeclaration()`, with `addRule()` deprecated
and changed to a wrapper method to call on to `addDeclaration()`.

`RuleContainer` itself should be renamed to `DeclarationContainer` as a
separate change.

The tests will also be updated as a separate change.
@JakeQZ JakeQZ force-pushed the task/rename-rulecontainer-methods branch from 2fa42c0 to 6a3fec8 Compare February 15, 2026 15:24
@JakeQZ JakeQZ marked this pull request as ready for review February 15, 2026 15:35
@JakeQZ JakeQZ requested a review from oliverklee February 15, 2026 15:35
Also add a description for the trait.
@oliverklee oliverklee merged commit e8ef816 into main Feb 15, 2026
24 checks passed
@oliverklee oliverklee deleted the task/rename-rulecontainer-methods branch February 15, 2026 16:13
JakeQZ added a commit that referenced this pull request Feb 16, 2026
The methods of the `RuleContainer` interface were renamed in #1521.
oliverklee pushed a commit that referenced this pull request Feb 16, 2026
The methods of the `RuleContainer` interface were renamed in #1521.
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.
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.
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