bitwise-operators/utils-reflection
最新稳定版本:1.0.0
Composer 安装命令:
composer require bitwise-operators/utils-reflection
包简介
A set of utility function for use with PHP Reflection
关键字:
README 文档
README
A set of utility function for use with PHP Reflection.
Available functions
The following functions are supplied
All functions live in the BitwiseOperators\Reflection namespace.
Checking if a class is an Attribute implementation
is_attribute_class(): bool
Arguments:
- class:
object|string
Checking if an attribute is set on a PHP entity
The following functions check if an attribute is set on the supplied class, function, method or property.
For all functions, the attribute can be supplied as a class-string or as a ReflectionAttribute object for the desired attribute.
Attributes are checked in instance-mode, so descendant implementations of the supplied attribute also return true
If no attribute class is specified, the functions return true when the subject has any attributes.
class_has_attribute(): bool
Arguments:
- class:
object|string, - attribute:
null|string|ReflectionAttribute
Checks the supplied class for attributes $attribute.
The class can be supplied as an object, a string, or as a ReflectionClass containing the subject.
function_has_attribute(): bool
Arguments:
- function:
ReflectionFunctionAbstract|string, - attribute:
null|string|ReflectionAttribute
Checks the supplied function for attributes.
The function can be supplied as a string or as a ReflectionFunctionAbstract containing the subject.
Make sure the function is fully namespaced if applicable.
method_has_attribute(): bool
This function has two possible signatures:
Arguments:
- class:
object|string - method:
ReflectionMethod|string - attribute:
null|string|ReflectionAttribute
The method can be supplied as a combination of class and method-name, where the class arguments follow the same requirements as for
the class_has_attributes function. The method can be either a string or a ReflectionMethod containing the method.
When using a ReflectionMethod object, the class argument can be omitted completely:
Arguments:
- method:
ReflectionMethod - attribute:
null|string|ReflectionAttribute
property_has_attribute(): bool
This function has two possible signatures:
Arguments:
- class:
object|string - property:
ReflectionProperty|string - attribute:
null|string|ReflectionAttribute
The property can be supplied as a combination of class and property-name, where the class arguments follow the same requirements as for
the class_has_attributes function. The property can be either a string or a ReflectionProperty containing the method.
When using a ReflectionProperty object, the class argument can be omitted completely:
Arguments:
- property:
ReflectionProperty - attribute:
null|string|ReflectionAttribute
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2025-12-05