Skip to content

"defer" annotation as PHP 8 attribute#57

Merged
robertlemke merged 2 commits into
masterfrom
56-php-8-attribute-for-defer-annotation
May 17, 2022
Merged

"defer" annotation as PHP 8 attribute#57
robertlemke merged 2 commits into
masterfrom
56-php-8-attribute-for-defer-annotation

Conversation

@robertlemke

Copy link
Copy Markdown
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

@kdambekalns kdambekalns left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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"?

@robertlemke robertlemke May 17, 2022

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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