Support for PHP 8.0 class attributes generation#145
Support for PHP 8.0 class attributes generation#145jakublabno wants to merge 4 commits intolaminas:4.8.xfrom
Conversation
Ocramius
left a comment
There was a problem hiding this comment.
Did a first skim: endorse simplifying and removing flexibility in a first step.
The factory and the builder are not necessary, if the attribute generator can act as an immutable builder (most common use-case anyway)
src/Generator/AttributeGenerator.php
Outdated
There was a problem hiding this comment.
We should probably make this final, since it's a new symbol, and inheritance abuse is strong :-)
There was a problem hiding this comment.
Yes, I don't know why I extended it, maybe in the beginning when I didn't know the code, I'll stay on with interface GeneratorInterface :)
There was a problem hiding this comment.
Let's not make this Stringable: Stringable is a terrible API.
See also ShittySoft/symfony-live-berlin-2018-doctrine-tutorial#3 (comment) for more clarity
There was a problem hiding this comment.
This code can all be inlined into the AttributeGenerator: no need to make a separate class out of it.
| namespace Laminas\Code\Generator\AttributeGenerator; | ||
|
|
||
| //TODO Enum in PHP8.1 | ||
| final class AttributePart |
There was a problem hiding this comment.
Let's mark all internally used symbols as @internal, to allow refactoring/rewrite as soon as we are allowed to.
|
Sorry, didn't get to work on this at all, due to other priorities. |
| return new self(...$assemblers); | ||
| } | ||
|
|
||
| public static function fromArray(array $definitions): self |
|
After digging further into this, I decided to skip it for Specifically, I would simplify the I understand that you wanted to split generator and data structure, but practically, it doesn't really help with the use-case of this library, IMO. What I'd end up with in the end is probably a single class with a thin
Everything else would be Therefore needing to put this patch aside: it needs a good weekend of thinking it through, which I didn't manage to find, sorry. |
|
Hello. 👋🏻 Is there anything I can do to help moving this PR forward? I'm working on a small code generator tool at the moment and I need the ability to emit class and property attributes. |
Sorry, I have no time to work it out, I'll try to close this next month. |
|
If there is no objections I would pick this up, make the requested changes and see to add method support along the way. |
I don't understand this object type parameter, there is AttributePrototype for it @kitsunet I've pushed some changes |
|
Cool, thanks! I guess I'll wait for ocramius verdict then and start in parallel to create changes for class members and methods on top of this. |
|
I've already started working on methods 😱 |
|
Hi, any updates on this? |
I'm waiting for @Ocramius review |
|
@Ocramius ?? |
|
This PR is already 17mo old almost 1 and a half years, still waiting for @Ocramius re-review for 7mo now. |
|
Colleagues, what the current status of this PR, as I can see, this feature is awaited by many developers. |
|
I'm still waiting for @Ocramius review |
|
Is there anyone else that could review this? |
|
Haven't touched this component in a while, and OSS efforts currently compete with the time I'm dedicating to sleep. |
|
Any updates here? Trying to generate code with |
|
Hello @Ocramius, I hope you're doing well. I saw that this PR has been on hold for quite some time. Do you have any updates regarding its progress or any thoughts on how it could move forward? Thanks in advance for your time! |
|
Hi, just poking for update ;) |
|
Hello (sorry for ping), I believe this merge request is too old for it to be productive. What I suggest is that we help The changes I see:
@jakublabno do you think you have the time to do this? I believe that once this is done |
Sure, I could do this, but I’m not sure it makes sense — @Ocramius hasn’t been here for months. |
Description
Feature that allows attribute generation for classes (methods/properties is the next step)
Either non-arguments attributes and named arguments are supported.
Nested attributes are not supported yet.
You can use it in a few ways: