Skip to content

A simple PHP class to parse annotations like @foo, @foo(arg1,arg2), @foo(arg1,x=y)

Notifications You must be signed in to change notification settings

lazyarse/SimpleAnnotationReader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Simple Annotation Reader

A simple annotation reader that parses class and property annotations into arrays

  • @Foo becomes ['foo']
  • @foo(arg1,arg2) becomes ['foo'=>['arg1','arg2']]
  • @foo(x=y,arg1) becomes ['foo' => ['x' => 'y', 'arg1']]

Requirements

Annotations must:

  • be placed on a new line
  • start with an '@'
  • start inside a comment block, started with /** and ending with */
  • be case insensitive. All annotations are converted to lowercase.
  • Not be deeper than one level, e.g. @foo(type=bar) is valid, whilst @foo(type=[x=y]) is not valid.

About

A simple PHP class to parse annotations like @foo, @foo(arg1,arg2), @foo(arg1,x=y)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages