Skip to content

FEATURE: Consider PHP attributes in proxy class and method building #3075

Closed
@robertlemke

Description

@robertlemke

Is there an existing issue for this?

  • I have searched the existing issues

Description

Proxy classes and methods which are generated through ProxyClassGenerator and ProxyMethodGenerator respectively don't support PHP 8 attributes yet. For example, while generating a proxy method, the DocBlock including the annotations are preserved and thus generated for the new method, but the attributes of the original method are not. This leads to errors when using attributes instead of annotations in certain situations.

One way to produce an error due to this missing feature is to use a Defer attribute from the Flowpack Job Queue package. While generating the proxy classes, Flow will recognize the attribute and generate an advice for the DeferAspect. However, the proxy method does not have the attribute anymore and the ReflectionService therefore can't provide the aspect with any arguments of the Defer attribute. The error will be something like "Attempt to read property 'queueName' on null".

Possible Solution

In Flow 9 we are using laminas/laminas-code for proxy class and method generation. There is an unfinished pull request (laminas/laminas-code#145) which introduces support for attributes for classes. We may want to help them finishing that pull request and also provide support for generating attributes for methods.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions