Task #27627

Overhaul annotation support/syntax

Added by Karsten Dambekalns about 4 years ago. Updated almost 4 years ago.

Status:Resolved Start date:2011-06-21
Priority:Must have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:Reflection
Target version:TYPO3 Flow Base Distribution - 1.0.0
Sprint: Has patch:
PHP Version: Complexity:

Description

I think it would be wise to decide on this before 1.0.0, the earlier the better. It has been discussed here and there in the past, but we need to get this thought through.

So, here are the basic questions:

  1. Do we adopt UpperCamelCase and case-sensitivity, like Doctrine 2 and Symfony 2 use it?
  2. Do we switch annotation parsing to the Doctrine Common library?
The case thing means The parser library switch would
  • move the burden of maintaining a parser away from us
  • force us to adapt the current annotation syntax
  • possibly allow more flexibility

Related issues

related to TYPO3.Flow - Bug #31015: Second classloader in ReflectionService doesn't know abou... Resolved 2011-10-17

History

#1 Updated by Bastian Waidelich about 4 years ago

I would go for 1 & 2.
If I got it right, this would change the annotations like this:

@scope prototype -> @Scope(type="prototype")
@scope singleton -> @Scope(type="singleton")
@validate StringLength(minimum = 1, maximum = 100) -> @Validate(validator="StringLength", options="{"minimum" = "1", "maximum" = "100"}")

I don't think, that the inconsistency with "normal" docblock API annotations is a problem, because IMO there's a "mental gap" between those anyways, but that's just my subjective opinion.

#2 Updated by Sebastian Kurfuerst about 4 years ago

  • 1): +1 from my side
  • 2): it definitely makes sense to use another framework, as maintaining such a parser always sucks ;)

If I got it correctly, we'd need to decide between the following annotation formats:

  • @Scope(type="prototype") vs @f3:Scope(type="prototype")
  • @Validate(validator) vs @f3:Validate....

So we still have to decide whether we put all FLOW3 annotations into F3\FLOW3\Annotations (so that they can be referenced without namespace), or if we define prefixes. For validation, things like:

  • @validate:StringLength(....) would also make a lot of sense IMHO.

What do you think? So it basically boils down how to set "defaultAnnotationNamespace" and "annotationNamespaceAlias" in http://www.doctrine-project.org/projects/common/2.0/docs/reference/annotations/en#annotations

#3 Updated by Sebastian Kurfuerst almost 5 years ago

  • Target version changed from 1230 to 1.0 beta 2

#4 Updated by Karsten Dambekalns almost 4 years ago

  • Target version changed from 1.0 beta 2 to 1.0.0

#5 Updated by Karsten Dambekalns almost 4 years ago

  • Category set to Reflection
  • Status changed from Needs Feedback to Accepted

#6 Updated by Karsten Dambekalns almost 4 years ago

  • Status changed from Accepted to Under Review

#7 Updated by Karsten Dambekalns almost 4 years ago

  • Status changed from Under Review to Accepted
  • % Done changed from 0 to 90

Documentation update is pending.

#8 Updated by Karsten Dambekalns almost 4 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 90 to 100

Also available in: Atom PDF