PHP Annotations
Purely code or magic?
Joel Medeiros
Attributes
Slide 2
Slide 2 text
Curious and passionate
about innovation, technology
and agile teams that seeks
to learn everyday how
technology can impact
people lives.
/joelmedeiros
WHO am I?
/_joelmedeiros
Slide 3
Slide 3 text
Remote teams, near collaboration.
Slide 4
Slide 4 text
#COMMUNITYWORKS
Slide 5
Slide 5 text
First of all,
WHAT
is annotation?
Slide 6
Slide 6 text
Something that describes an aspect of the subject
through metadata in runtime. In other words, the
annotation effects on a class, method or object are
only when it is executed
“
”
@rdohms
Slide 7
Slide 7 text
WHAT
is annotation used for?
Slide 8
Slide 8 text
How is
METADATA
MANIPULATION
used?
Slide 9
Slide 9 text
Java - Annotations
Slide 10
Slide 10 text
PYTHON - Decorators
Slide 11
Slide 11 text
JAVASCRIPT ES6 - Decorators
Slide 12
Slide 12 text
RUST - Attributes
Slide 13
Slide 13 text
WHO
does use annotations?
Slide 14
Slide 14 text
PHPUNIT
Slide 15
Slide 15 text
SYMFONY FRAMEWORK
Slide 16
Slide 16 text
DOCTRINE ORM
Slide 17
Slide 17 text
How does that
WORK?
Slide 18
Slide 18 text
ENGINE
TOKENIZATION
Token Args
document “mydoc.txt”
errorlog true
Process document with argument
“mydoc.txt”
Process errorlog with param true
INPUT OUTPUT
PROCESS REMAINING
METHOD INSTRUCTIONS
PATTERNS
PROCESSMENT
RESULT
Slide 19
Slide 19 text
PHP doesn’t have
NATIVE ENGINE
for Annotations
... yet
Slide 20
Slide 20 text
PHP RFC:
Attributes v2
@beberlei
Slide 21
Slide 21 text
Why give the name
ATTRIBUTES?
Slide 22
Slide 22 text
New syntax
Slide 23
Slide 23 text
Reflection API Attribute
Slide 24
Slide 24 text
USE CASE
Slide 25
Slide 25 text
WHY
use annotations?
Slide 26
Slide 26 text
PROS
Slide 27
Slide 27 text
CONS
Slide 28
Slide 28 text
THAT’S ALL
FOLKS
Slide 29
Slide 29 text
THANK YOU
Keep in touch
find by joelmedeiros
in your social network
:)