You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Review what annotations are to be considered standard #65
If we consider that standard annotations are any of listed above (combined list from both PhpDoc versions), then here is the list of what's left (looking at current code):
display
editable
editor
enum
format
length
match
range
required
text
usage - this one isn't standard, but we use it to configure annotations, we keep it 😄
validate
view
I propose to remove all but usage annotations from above list (gladly they all map to false in the AnnotationManager::registry anyway).
In fact if we also miss some of PHPDoc v2 ones, like @api, then adding them would be a plus as well, because I know for certain that Symfony is using @api tag extensively.
The annotations you listed above (display, editable, editor, etc.) were a proposed set of default standard annotations - the list was based on part on referencing C# and Java standard annotations.
The point of standardizing those, is that they are common enough that anyone may need them - C# for example standardizes most of these, without providing services that consume most of them, but the point is that once third parties need this metadata, they will write services that consistently consume these standard types using the same names and properties.
Better than scrapping them would be implementing them, which I never got around to. But, as they are, they aren't really any use, since they aren't implemented, so... do whatever feels right :-)
I'd be careful with removing any annotations (except ones I proposed) since we're not in perfect world and classes that might be introspected for annotations by this library might contain all sort of old PHPDoc tags in them. We don't want for users to have exceptions throwing at them just because they haven't made their DocBlocks PSR-5 ready 😄
I might add some comments next to each annotation mapped to false in the registry to indicate from where it comes.
Looking at fact, that @var is deprecated is PSR-5 and now @type annotation supersedes it makes me a bit worried, since we don't have @type annotation support. I think they deprecated @var because it reminds of times, where var was used to define class property instead of private/protected/public word 😄
Adding @type support however will be piece of cake, since it just will extend VarAnnotation
Oh no, I'm saying you might want to add new annotations defined in PSR-5 - you don't want to remove any, even deprecated ones most likely, if there are any...
Looking at fact, that @var is deprecated is PSR-5 and now @type annotation supersedes it makes me a bit worried
I think they use the same syntax? You can probably just map @type to VarAnnotation, and possibly rename the class to TypeAnnotation which might be more descriptive... @var should definitely still work, even if it is deprecated.
I might add some comments next to each annotation mapped to false in the registry to indicate from where it comes.
A single comment should do it? Just explain briefly that those mapped to false are standard PHP-DOC annotations that aren't useful at run-time, but we don't want run-time errors when encountering them.
On a related note, you might want to start thinking about @typedef, which looks like it's going to be difficult to support - it uses nested annotations, which is an entirely new concept and syntax. It's syntax isn't final yet though, so I don't recommend implementing it yet, but you might want to think about it. (or prototype it in a feature branch, since it looks like it's going to happen.)
I think they use the same syntax? You can probably just map @type to VarAnnotation, and possibly rename the class to TypeAnnotation which might be more descriptive... @var should definitely still work, even if it is deprecated.
OK.
A single comment should do it? Just explain briefly that those mapped to false are standard PHP-DOC annotations that aren't useful at run-time, but we don't want run-time errors when encountering them.
I thought to have more historical data, e.g. split annotations in 3 groups: PhpDoc v1, PhpDoc v2, PSR-5.
Activity
aik099 commentedon Aug 17, 2014
In fact if we also miss some of PHPDoc v2 ones, like
@api, then adding them would be a plus as well, because I know for certain that Symfony is using@apitag extensively.mindplay-dk commentedon Aug 18, 2014
You should probably go by PSR-5 which looks like it will be the first official standard.
https://github.com/phpDocumentor/fig-standards/blob/master/proposed/phpdoc.md
The annotations you listed above (display, editable, editor, etc.) were a proposed set of default standard annotations - the list was based on part on referencing C# and Java standard annotations.
The point of standardizing those, is that they are common enough that anyone may need them - C# for example standardizes most of these, without providing services that consume most of them, but the point is that once third parties need this metadata, they will write services that consistently consume these standard types using the same names and properties.
Better than scrapping them would be implementing them, which I never got around to. But, as they are, they aren't really any use, since they aren't implemented, so... do whatever feels right :-)
aik099 commentedon Aug 18, 2014
I'd be careful with removing any annotations (except ones I proposed) since we're not in perfect world and classes that might be introspected for annotations by this library might contain all sort of old PHPDoc tags in them. We don't want for users to have exceptions throwing at them just because they haven't made their DocBlocks PSR-5 ready 😄
I might add some comments next to each annotation mapped to false in the registry to indicate from where it comes.
Looking at fact, that
@varis deprecated is PSR-5 and now@typeannotation supersedes it makes me a bit worried, since we don't have@typeannotation support. I think they deprecated@varbecause it reminds of times, wherevarwas used to define class property instead ofprivate/protected/publicword 😄Adding
@typesupport however will be piece of cake, since it just will extendVarAnnotationmindplay-dk commentedon Aug 18, 2014
Oh no, I'm saying you might want to add new annotations defined in PSR-5 - you don't want to remove any, even deprecated ones most likely, if there are any...
I think they use the same syntax? You can probably just map
@typetoVarAnnotation, and possibly rename the class toTypeAnnotationwhich might be more descriptive...@varshould definitely still work, even if it is deprecated.A single comment should do it? Just explain briefly that those mapped to
falseare standard PHP-DOC annotations that aren't useful at run-time, but we don't want run-time errors when encountering them.mindplay-dk commentedon Aug 18, 2014
On a related note, you might want to start thinking about
@typedef, which looks like it's going to be difficult to support - it uses nested annotations, which is an entirely new concept and syntax. It's syntax isn't final yet though, so I don't recommend implementing it yet, but you might want to think about it. (or prototype it in a feature branch, since it looks like it's going to happen.)aik099 commentedon Aug 19, 2014
OK.
I thought to have more historical data, e.g. split annotations in 3 groups: PhpDoc v1, PhpDoc v2, PSR-5.