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

support of php attributes #90

Open
eric-therond opened this issue Jan 8, 2024 · 2 comments · May be fixed by #91
Open

support of php attributes #90

eric-therond opened this issue Jan 8, 2024 · 2 comments · May be fixed by #91

Comments

@eric-therond
Copy link
Contributor

I would like to improve php-cfg to add information about php attributes in the CFG.

For this code sample:

#[ExampleAttribute('Hello world', 42)]
class NameOfClass {
}

Do you think the following output to generate is correct?

Block#1
    Stmt_Class
        name: LITERAL('NameOfClass')
        stmts: Block#2
        attrs_group: Block#3

Block#2

Block#3
    AttributeGroup
        attrs[0]: Block#4

Block#4
    Attribute
        name: LITERAL('ExampleAttribute')
        args[0]: LITERAL('Hello world')
        args[1]: LITERAL(42)

Eric

@nikic
Copy link
Collaborator

nikic commented Jan 8, 2024

I don't think it makes sense to put attributes in a "block". They should be in a property on the class, just like in the AST.

@eric-therond
Copy link
Contributor Author

So more something like that:

Block#1
    Stmt_Class
        name: LITERAL('NameOfClass')
        stmts: Block#2
        attrs_group[0]: ExampleAttribute('Hello world', 42)

@eric-therond eric-therond linked a pull request Jan 11, 2024 that will close this issue
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 a pull request may close this issue.

2 participants