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

"defer" annotation as PHP 8 attribute #57

Merged
merged 2 commits into from
May 17, 2022

Conversation

robertlemke
Copy link
Member

This changes the implementation of the @defer annotation so that it
can also be used as a PHP 8 attribute. The annotation is backwards
compatible and can still be used in the previous way as part of a
doc comment.

Example:

    #[Defer(queueName: "MyJobQueue")]
    public function handle(SomeCommand $command): void
    {
       ...
    }

This changes the implementation of the @defer annotation so that it
can also be used as a PHP 8 attribute. The annotation is backwards
compatible and can still be used in the previous way as part of a
doc comment.

Example:

```php
    #[Defer(queueName: "MyJobQueue")]
    public function handle(SomeCommand $command): void
    {
       ...
    }
```
@robertlemke robertlemke linked an issue May 17, 2022 that may be closed by this pull request
Copy link
Member

@kdambekalns kdambekalns left a comment

Choose a reason for hiding this comment

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

Looks good… I wonder if we could adjust the dependencies to this along the way:

        "php": "^7.4 || ^8.0",
        "neos/flow": "^6.3 || ^7.0 || ^8.0 || dev-master",


/**
* @Annotation
* @DoctrineAnnotation\Target("METHOD")
* @NamedArgumentConstructor
* @Target("METHOD")
Copy link
Member

Choose a reason for hiding this comment

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

Why can @Target now be resolved, even though it's no longer imported "properly"?

Copy link
Member Author

@robertlemke robertlemke May 17, 2022

Choose a reason for hiding this comment

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

To be honest – I also wondered about it.But the Flow @around annotation does the same and @Annotation doesn't have to be imported, either. It seems to work. 🤷🏻

@robertlemke
Copy link
Member Author

Ah … but the type declarations are a breaking change, because they require at least PHP 7.4 (not 7.1, which is currently declared in composer.json). So what do we do about that? Raise the requirement? Please?

@kdambekalns
Copy link
Member

require at least PHP 7.4 (not 7.1, which is currently declared in composer.json). So what do we do about that? Raise the requirement? Please?

Yes, as I already suggested…

@robertlemke
Copy link
Member Author

require at least PHP 7.4 (not 7.1, which is currently declared in composer.json). So what do we do about that? Raise the requirement? Please?

Yes, as I already suggested…

Ah 🤦🏻

@robertlemke
Copy link
Member Author

@kdambekalns here we go: #58

@robertlemke robertlemke merged commit 7dd6a6a into master May 17, 2022
@robertlemke robertlemke deleted the 56-php-8-attribute-for-defer-annotation branch May 17, 2022 16:25
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 this pull request may close these issues.

PHP 8 attribute for "defer" annotation
3 participants