Skip to content

[meta] Annotations 2.0 (ng) #232

@Majkl578

Description

@Majkl578

Annotations 2.0 (ng)

This is a meta issue to track Annotations 2.0 milestones/features and aims. It's also a follow-up of #75 which collected some dust over time.

Backward Compatibility

One of the main goals of the 2.0 version is on minimizing breakages of existing annotations and syntax compatibility with Annotations 1.x. Therefore, when talking about custom annotations and docblocks, most of the user-land stuff should work without any significant effort or none at all. However most of the internal stuff is expected to be changed.

Namespace change

Dropped features

Some features will be dropped:


New parser

Initial work is split into three different stages and will come as a new code without refactoring existing stuff:

  1. Parser - this is the docblock parser
    • PP language - Doctrine Annotations syntax definition
    • Compiler - docblock to AST converter
    • AST structure - rich domain-specicic AST
    • AST builder - internal AST walker that builds rich AST
    • AST walker - interface for traversing AST
    • AST dumper- utility walker to display AST structure
    • Parser parity tests - compatibility testing between old and new parsers
  2. Metadata - this represents an @Annotation
    • Annotation and Property metadata - information needed to construct annotation objects [Introduce annotation metadata #247]
    • Property type and enum hiearchy [Type hiearchy for property types and enums #256]
    • AST metadata collector (walker)
    • Scope - holds information about subject (origin), active imports, ignored annotations and nesting level
    • Reference resolver - resolves unqualified annotation references based on given scope and strategy
    • Property type parser - parses @var to constraint value types
  3. Assembling
    • Annotation assembler - builds actual annotation objects based on AST and metadata
    • Acceptor - determines whether visited annotation AST node should produce an annotation or be skipped (used to build internal/public or skip ignored annotations)
    • Constraint validator - validates annotation's property values against constraints (i.e. Required, Enum, @var)
    • Constructor - instantiates annotation objects based on chosen strategy (using a constructor or using property hydration)

Other problems to likely be resolved (but not guaranteed)

Generally issues marked with 2.0 milestone. Notably:


Any feedback is welcomed, either here or (preferably) on Doctrine Slack in #annotations-ng-dev channel.

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