Skip to content

Replace Sulu 3.0 packages PHPUnit Annotations with Attributes #7819

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

Merged

Conversation

mamazu
Copy link
Contributor

@mamazu mamazu commented Feb 24, 2025

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets -
Related issues/PRs #6988
License MIT
Documentation PR -

What's in this PR?

Adding a rector rule that enforces the use of Attributes over Annotations.
Also adding the "packages" directory to the rector files.

Why?

Since the introduction of PhpUnit 10 we can use Attributes for everything. They're better supported by PHP than annotations.

Example Usage

See changes.

*/
#[\PHPUnit\Framework\Attributes\CoversNothing]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Technically this does cover the controller, just not everything else.

@@ -44,6 +46,7 @@
// SymfonySetList::SYMFONY_CODE_QUALITY,
// DoctrineSetList::DOCTRINE_CODE_QUALITY,
// LevelSetList::UP_TO_PHP_80,
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
Copy link
Member

Choose a reason for hiding this comment

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

is PHPUnit 10 used on 2.6? then we probably should enable this also there?

@alexander-schranz alexander-schranz changed the title Using Attributes for all phpunit things Replace PHPUnit annotations with Attributes Feb 24, 2025
@alexander-schranz alexander-schranz changed the title Replace PHPUnit annotations with Attributes Replace PHPUnit Annotations with Attributes Feb 24, 2025
@alexander-schranz alexander-schranz changed the title Replace PHPUnit Annotations with Attributes Replace Sulu 3.0 packages PHPUnit Annotations with Attributes Feb 24, 2025
@alexander-schranz alexander-schranz merged commit 638f38a into sulu:3.0 Feb 24, 2025
9 checks passed
@alexander-schranz alexander-schranz added the DX Affecting the end developer label Feb 24, 2025
@mamazu mamazu deleted the phpunit_attributes_over_annotations branch February 24, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Affecting the end developer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants