How do I attach attributes to the controller or action?

  java, question

In the process of web development, is there a way to attach an attribute to the controller or action, similar to putting different tags on the controller or action to distinguish different types, as follows:

/*
 * @Tags("All")
 */
 class UserController extends Controller {
 /*
 * @Tags("Read")
 */
 public function index() {
 bracket
 
 /*
 * @Tags("Write")
 */
 public function add() {
 bracket
 
 /*
 * @Tags("Write")
 */
 public function foo() {
 bracket
 bracket

No? There areAttributeYou can label members.
Python can also be usedDecorative deviceTo achieve.
The others are not familiar.


UPDATE: PHP can get comments through reflection, black magic …
ReflectionClass::getDocComment
Faking method attributes in PHP?