Annotations in PHP: They Exist

2018-02-03T21:54:00+01:00
About PHP
annotations-in-php-they-exist.jpg

Annotations are more than PHPDoc comments. Annotations are a fully-featured way of including additional information alongside your code.

Annotations in PHP: They Exist from Rafael Dohms

PHP: rfc:annotations

Many languages currently support metadata information. This RFC exposes an idea about how can it be implemented in PHP, providing a powerful tool that many applications can take advantage of.
https://wiki.php.net/rfc/annotations

The Annotation Example

(Source: https://forum.nette.org/…odir-on-null#…)

<?php

/** @return*/
class TestClass
{
}

$rc = new ReflectionClass('TestClass');
var_dump($rc->getDocComment()); // string(13) "/** @return*/"
I Agree and Close We would like to use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We would like to share also information about your use of our site with our social media, advertising and analytics partners who may combine it with other information you’ve provided to them or they’ve collected from your use of their services. See details