KEMBAR78
Annotating with Annotations - PHPBenelux June/2012 | PDF
*
 PHPBenelux
 -
 June
 Meeting




Annotating
 with
 
  Annotations
   A
 look
 into
 Annotations
 in
 PHP



                                                                                                                             on
 twitter                                 Rafael
 Dohms
                                                                                                                                                                                                                  @rdohms
*
 PHPBenelux
 -
 June
 Meeting




Annotating
 with
 
  Annotations
   A
 look
 into
 Annotations
 in
 PHP



                                                                                                                             on
 twitter                                 Rafael
 Dohms
                                                                                                                                                                                                                  @rdohms
Rafael Dohms




                           photo credit: Eli White
        @rdohms


 Evangelist, Speaker and
      Contributor.

Developer at WEBclusive.

Enabler at AmsterdamPHP.
a
 little
 history                                                                                                                                                 existing
 uses



                                                                                     What?                                  Why?                                                              Where?




                                                                                                                           How?
                                                                                                                                     ustom
 ann otations
                                                                                     Impl ementing
 c DMSFilter
                                                                                             based
 on
 

                                                                                                                                       show
 me
 the
 code!
http://ecdesignrebels.blogspot.com




   w h a t?                                                                           ta tio ns?
                                            re
 an no
W ha t
 a
-- In English --
An annotation is a note that is made while
        reading any form of text.
something
 that
 describes
 an
 aspect
 of
 the
 subject



               -- In English --
An annotation is a note that is made while
        reading any form of text.
-- In Code Speak --


“An annotation describes behavior of code and
     affects your application in runtime.”


 “Annotations do not directly affect program
                semantics”
-- In Code Speak --


“An annotation describes behavior of code and
     affects your application in runtime.”


 “Annotations do not directly affect program
                semantics”
            just
 like
 your
 notes
In
 2004:
 Metadata
 or
 
“General
 purpose
 Annotations”
In
 2004:
 Metadata
 or
 
“General
 purpose
 Annotations”




                                                                       available
 at
 Runtime
 using
 Reflection
In
 2004:
 Metadata
 or
 
“General
 purpose
 Annotations”

                    @Entity
                      @Table(name = people)
                      class Person implements Serializable {
                        @Id
                        @GeneratedValue(strategy = GenerationType.AUTO)
                        private Integer id;

                                    @Column(length = 32)
                                    private String name;




                                                                       available
 at
 Runtime
 using
 Reflection
In
 2004:
 Metadata
 or
 
“General
 purpose
 Annotations”
                                                                                                                                                                    specific
 syntax
                    @Entity
                      @Table(name = people)
                      class Person implements Serializable {
                        @Id
                        @GeneratedValue(strategy = GenerationType.AUTO)
                        private Integer id;

                                    @Column(length = 32)
                                    private String name;




                                                                       available
 at
 Runtime
 using
 Reflection
No
 core
 
annotation
 support
Questions?
Questions?

I’m
 kidding!
phpDoc
~2000
PHP
 5.1
  Reflection
 supports
 
   getDocComments()



phpDoc
~2000                              2005
PHP
 5.1
                 Reflection
 supports

Annotating with Annotations - PHPBenelux June/2012