Skip to content

Drop annotation key/value pair syntax #335

Closed
@thekid

Description

@thekid

Scope of Change

This RFC suggests dropping annotation key/value pair syntax.

Rationale

Key/value pair syntax is redundant to simply using maps inside annotation values, not much shorter and requires extra effort in parsing.

#[@expect(class= FormatException::class)]

...is the same as:

#[@expect(['class' => FormatException::class])]

...which also already works today!

Functionality

  • XP 10: Deprecation including notice
  • XP 11: Removal, raises parse errors

Security considerations

n/a

Speed impact

Eventually faster once extra parser handling can be removed

Dependencies

Extra handling in https://github.com/xp-framework/compiler

Related documents

https://wiki.php.net/rfc/annotations_v2 - uses map syntax

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions