HasClassProperties::check()
Not yet in a tagged release
Description
HasClassProperties::check()
- does a class have static properties?
// remember to import first
use GanbaroDigital\MissingBits\ClassesAndObjects\HasClassProperties;
// our method signature
bool HasClassProperties::check(string $target, $propTypes = ReflectionProperty::IS_PUBLIC);
Parameters
HasClassProperties::check()
takes two parameters:
$target
(string) - the class to examine$propTypes
(int) - optional scope filter
Return Values
HasClassProperties::check()
returns a boolean:
true
if$target
is a class with 1 or more static properties that match$propTypes
false
otherwise
Throws
HasClassProperties::check()
throws an InvalidArgumentException
if:
$target
is not a string, or something that PHP will automatically convert to a string,$target
refers to a class that has not been defined
Notes
HasClassProperties::check()
will also check parent classes and all the traits used by this class for static properties.HasClassProperties::check()
only works on classes. UseHasObjectProperties::check()
to check an object for non-static properties.