66
77use Ock \ClassDiscovery \Exception \MalformedDeclarationException ;
88use Ock \Helpers \Util \MessageUtil ;
9- use Ock \Reflection \FactoryReflectionInterface ;
109use Ock \Reflection \NameHavingReflectionInterface ;
1110use function Ock \ReflectorAwareAttributes \get_attributes ;
1211
@@ -20,22 +19,22 @@ class AttributesUtil {
2019 *
2120 * @template T as object
2221 *
23- * @param \ReflectionClass<object>|\ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionClassConstant|\ReflectionProperty|\Ock\Reflection\FactoryReflectionInterface<object> $reflector
22+ * @param \ReflectionClass<object>|\ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionClassConstant|\ReflectionProperty $reflector
2423 * @param class-string<T> $name
2524 *
2625 * @return list<T>
2726 *
2827 * @throws \Ock\ClassDiscovery\Exception\MalformedDeclarationException
2928 */
3029 public static function getAll (
31- \ReflectionClass |\ReflectionFunctionAbstract |\ReflectionParameter |\ReflectionClassConstant |\ReflectionProperty | FactoryReflectionInterface $ reflector ,
30+ \ReflectionClass |\ReflectionFunctionAbstract |\ReflectionParameter |\ReflectionClassConstant |\ReflectionProperty $ reflector ,
3231 string $ name ,
3332 ): array {
3433 return get_attributes ($ reflector , $ name );
3534 }
3635
3736 /**
38- * @param \ReflectionClass<object>|\ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionClassConstant|\ReflectionProperty|\Ock\Reflection\FactoryReflectionInterface<object> $reflector
37+ * @param \ReflectionClass<object>|\ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionClassConstant|\ReflectionProperty $reflector
3938 * @param class-string $name
4039 *
4140 * @return bool
@@ -47,7 +46,7 @@ public static function getAll(
4746 * More than one attribute of the given type.
4847 */
4948 public static function hasSingle (
50- \ReflectionClass |\ReflectionFunctionAbstract |\ReflectionParameter |\ReflectionClassConstant |\ReflectionProperty | FactoryReflectionInterface $ reflector ,
49+ \ReflectionClass |\ReflectionFunctionAbstract |\ReflectionParameter |\ReflectionClassConstant |\ReflectionProperty $ reflector ,
5150 string $ name ,
5251 ): bool {
5352 $ attributes = $ reflector ->getAttributes ($ name , \ReflectionAttribute::IS_INSTANCEOF );
@@ -65,7 +64,7 @@ public static function hasSingle(
6564 *
6665 * @template T of object
6766 *
68- * @param \ReflectionClass<object>|\ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionClassConstant|\ReflectionProperty|\Ock\Reflection\FactoryReflectionInterface<object> $reflector
67+ * @param \ReflectionClass<object>|\ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionClassConstant|\ReflectionProperty $reflector
6968 * @param class-string<T> $name
7069 *
7170 * @return object
@@ -76,7 +75,7 @@ public static function hasSingle(
7675 * None or more than one attribute of the given type.
7776 */
7877 public static function requireSingle (
79- \ReflectionClass |\ReflectionFunctionAbstract |\ReflectionParameter |\ReflectionClassConstant |\ReflectionProperty | FactoryReflectionInterface $ reflector ,
78+ \ReflectionClass |\ReflectionFunctionAbstract |\ReflectionParameter |\ReflectionClassConstant |\ReflectionProperty $ reflector ,
8079 string $ name ,
8180 ): object {
8281 $ instances = get_attributes ($ reflector , $ name );
@@ -94,7 +93,7 @@ public static function requireSingle(
9493 *
9594 * @template T of object
9695 *
97- * @param \ReflectionClass<object>|\ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionClassConstant|\ReflectionProperty|\Ock\Reflection\FactoryReflectionInterface<object> $reflector
96+ * @param \ReflectionClass<object>|\ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionClassConstant|\ReflectionProperty $reflector
9897 * Element that has the attribute.
9998 * @param class-string<T> $name
10099 * Expected attribute type/name.
@@ -108,7 +107,7 @@ public static function requireSingle(
108107 * More than one attribute of the given type.
109108 */
110109 public static function getSingle (
111- \ReflectionClass |\ReflectionFunctionAbstract |\ReflectionParameter |\ReflectionClassConstant |\ReflectionProperty | FactoryReflectionInterface $ reflector ,
110+ \ReflectionClass |\ReflectionFunctionAbstract |\ReflectionParameter |\ReflectionClassConstant |\ReflectionProperty $ reflector ,
112111 string $ name ,
113112 ): ?object {
114113 $ instances = get_attributes ($ reflector , $ name );
@@ -126,14 +125,14 @@ public static function getSingle(
126125 *
127126 * @param class-string $name
128127 * Expected attribute class or interface.
129- * @param \ReflectionClass|\ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionClassConstant|\ReflectionProperty|\Ock\Reflection\FactoryReflectionInterface $reflector
128+ * @param \ReflectionClass|\ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionClassConstant|\ReflectionProperty $reflector
130129 * Reflector on which the attribute was expected.
131130 *
132131 * @return never
133132 */
134133 private static function failForAttributeMissing (
135134 string $ name ,
136- \ReflectionClass |\ReflectionFunctionAbstract |\ReflectionParameter |\ReflectionClassConstant |\ReflectionProperty | FactoryReflectionInterface $ reflector ,
135+ \ReflectionClass |\ReflectionFunctionAbstract |\ReflectionParameter |\ReflectionClassConstant |\ReflectionProperty $ reflector ,
137136 ): never {
138137 throw new MalformedDeclarationException (sprintf (
139138 'Required attribute %s missing on %s. ' ,
@@ -149,14 +148,14 @@ private static function failForAttributeMissing(
149148 *
150149 * @param class-string $name
151150 * Filtering attribute class or interface.
152- * @param \ReflectionClass|\ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionClassConstant|\ReflectionProperty|\Ock\Reflection\FactoryReflectionInterface $reflector
151+ * @param \ReflectionClass|\ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionClassConstant|\ReflectionProperty $reflector
153152 * Reflector on which the attributes were found.
154153 *
155154 * @return never
156155 */
157156 private static function failForRepeatedAttribute (
158157 string $ name ,
159- \ReflectionClass |\ReflectionFunctionAbstract |\ReflectionParameter |\ReflectionClassConstant |\ReflectionProperty | FactoryReflectionInterface $ reflector ,
158+ \ReflectionClass |\ReflectionFunctionAbstract |\ReflectionParameter |\ReflectionClassConstant |\ReflectionProperty $ reflector ,
160159 ): never {
161160 throw new MalformedDeclarationException (\sprintf (
162161 'More than one %s attribute found on %s. ' ,
0 commit comments