Skip to content
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

AnnotationsToAttributes does not support conversion of @requires #441

Open
andrewnicols opened this issue Jan 16, 2025 · 0 comments
Open

Comments

@andrewnicols
Copy link
Contributor

Examples:

/**
 * @requires PHP > 8.4
 * @requires PHPUNIT >= 10
 * @requires OS Windows
 * @requires OSFAMILY Darwin
 * @requires function someFunction
 * @requires extension mysqli
 * @requires extension mysqli >= 8.3.0
 * @requires setting date.timezone Europe/Berlin
 */

These should be converted to:

#[\PHPUnit\Framework\Attributes\RequiresPhp('> 8.4')]
#[\PHPUnit\Framework\Attributes\RequiresPhpunit('> 10')]
#[\PHPUnit\Framework\Attributes\RequiresOperatingSystem('Windows')]
#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Darwin')]
#[\PHPUnit\Framework\Attributes\RequiresFunction('someFunction')]
#[\PHPUnit\Framework\Attributes\RequiresMethod(\some\className::class, 'someMethod')]
#[\PHPUnit\Framework\Attributes\RequiresExtension('mysqli')]
#[\PHPUnit\Framework\Attributes\RequiresExtension('mysqli', '>= 8.3.0')]
#[\PHPUnit\Framework\Attributes\RequiresSetting('date.timezone', 'Europe/Berlin')]

I don't believe it's possible to use the existing AnnotationWithValueToAttribute rule because the mappings are not exact.

Relevant docs:

andrewnicols added a commit to andrewnicols/rector-phpunit that referenced this issue Jan 16, 2025
andrewnicols added a commit to andrewnicols/rector-phpunit that referenced this issue Jan 16, 2025
andrewnicols added a commit to andrewnicols/rector-phpunit that referenced this issue Jan 20, 2025
andrewnicols added a commit to andrewnicols/rector-phpunit that referenced this issue Jan 20, 2025
andrewnicols added a commit to andrewnicols/rector-phpunit that referenced this issue Jan 21, 2025
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

No branches or pull requests

1 participant