PHP | ReflectionClass getTraitAliases() Function Last Updated : 12 Apr, 2021 Comments Improve Suggest changes Like Article Like Report The ReflectionClass::getTraitAliases() function is an inbuilt function in PHP which is used to return an array of trait aliases used by the user-defined class.Syntax: array ReflectionClass::getTraitAliases( void ) Parameters: This function does not accept any parameters.Return Value: This function returns an array of trait aliases used by the user-defined class.Below programs illustrate the ReflectionClass::getTraitAliases() function in PHP:Program 1: php <?php // Defining a trait class trait Company { public function GeeksforGeeks() { } } // Defining a user-defined class Department class Department{ use Company { Company::GeeksforGeeks as Portal; } } // Using ReflectionClass over the // user-defined class Department $obj=new ReflectionClass('Department'); // Calling the getTraitAliases() function $A = $obj->getTraitAliases(); // Getting an array of the trait aliases var_dump($A); ?> Output: array(1) { ["Portal"]=> string(22) "Company::GeeksforGeeks" } Program 2: php <?php // Defining a user-defined class Department class Department{ } // Using ReflectionClass over the // user-defined class Department $obj=new ReflectionClass('Department'); // Calling the getTraitAliases() function and // getting an array of the trait aliases var_dump($obj->getTraitAliases()); ?> Output: array(0) { } Reference: https://secure.php.net/manual/en/reflectionclass.gettraitaliases.php Comment More infoAdvertise with us Next Article PHP | ReflectionClass getTraitAliases() Function K Kanchan_Ray Follow Improve Article Tags : Web Technologies PHP PHP-function PHP- ReflectionClass PHP- Reflection +1 More Similar Reads PHP | ReflectionClass getTraitNames() Function The ReflectionClass::getTraitNames() function is an inbuilt function in PHP which is used to return an array of name of traits used by the user-defined class. Syntax: array ReflectionClass::getTraitNames( void ) Parameters: This function does not accept any parameters. Return Value: This function re 1 min read PHP | ReflectionClass getStartLine() Function The ReflectionClass::getStartLine() function is an inbuilt function in PHP which is used to return the line number from where the user defined class get started. Syntax: int ReflectionClass::getStartLine( void ) Parameters: This function does not accept any parameters. Return Value: This function re 1 min read PHP | ReflectionClass getParentClass() Function The ReflectionClass::getParentClass() function is an inbuilt function in PHP which is used to return the specified parent class or false if there is no parent class is present. Syntax: ReflectionClass ReflectionClass::getParentClass ( void ) Parameters: This function does not accept any parameters. 2 min read PHP | ReflectionClass getProperties() Function The ReflectionClass::getProperties() function is an inbuilt function in PHP which is used to return an array of the reflected properties. Syntax: ReflectionClass::getProperties($filter) : array Parameters: This function accepts a parameter filter which helps to remove some of the reflected propertie 2 min read PHP | ReflectionClass getInterfaces() Function The ReflectionClass::getInterfaces() function is an inbuilt function in PHP which is used to return an associative array of interfaces. These returned array is containing keys as interface names and the array values as ReflectionClass objects. Syntax: array ReflectionClass::getInterfaces( void ) Par 2 min read Like