Attributes and the php Function Get_Declared_Traits
Functions are a powerful programming construct that enable us to encapsulate a block of code that can be reused in the program. Functions are executed by passing them arguments, which is a piece of information that the function can act upon or consume in order to perform its task.
Attributes are a new addition in PHP 8, allowing developers to declare and fetch small pieces of meta-data about classes, functions, closures, class methods, constants and even anonymous classes in a structured way. Many frameworks such as Symfony, Drupal, and Doctrine use Annotations today to provide auxiliary information about a certain class in an organized manner, but Attributes take this concept one step further by providing a native engine-validated implementation.
Attribute values can be either simple scalar types or even arrays. They can also have a number of built-in properties that will be automatically resolved and auto-loaded when an instance of an Attribute is requested.
The php function get_declared_traits retrieves an associative array of all declared traits in a given scope. It returns the names of all traits used by a given class, excluding those that are used by its parent class. The return value is NULL if not found.