@@ -80,10 +80,10 @@ public static function getUsage(string $class): UsageAnnotation
80
80
*
81
81
* @see AnnotationManager::getClassAnnotations()
82
82
*
83
- * @param string| object $class
84
- * @param string|null $type
83
+ * @param object $class The class name or instance.
84
+ * @param string $type The name of the annotation.
85
85
*
86
- * @return array|Annotation []
86
+ * @return IAnnotation []
87
87
*
88
88
* @throws Exceptions\AnnotationException
89
89
*/
@@ -97,11 +97,11 @@ public static function ofClass($class, string $type = null): array
97
97
*
98
98
* @see AnnotationManager::getMethodAnnotations()
99
99
*
100
- * @param $class
101
- * @param string|null $method
102
- * @param string|null $type
100
+ * @param object $class The class name or instance.
101
+ * @param string $method The name of the method.
102
+ * @param string $type The name of the annotation.
103
103
*
104
- * @return array
104
+ * @return IAnnotation[]
105
105
*
106
106
* @throws Exceptions\AnnotationException
107
107
*/
@@ -115,16 +115,63 @@ public static function ofMethod($class, string $method = null, string $type = nu
115
115
*
116
116
* @see AnnotationManager::getPropertyAnnotations()
117
117
*
118
- * @param $class
119
- * @param string|null $property
120
- * @param string|null $type
118
+ * @param object $class The class name or instance.
119
+ * @param string $property The name of the property.
120
+ * @param string $type The name of the annotation.
121
121
*
122
- * @return array| IAnnotation[]
122
+ * @return IAnnotation[]
123
123
*
124
124
* @throws Exceptions\AnnotationException
125
125
*/
126
126
public static function ofProperty ($ class , string $ property = null , string $ type = null ): array
127
127
{
128
128
return self ::getManager ()->getPropertyAnnotations ($ class , $ property , $ type );
129
129
}
130
+
131
+ /**
132
+ * Checks if a class has the given annotation.
133
+ *
134
+ * @param object $class The class name or instance.
135
+ * @param string $type The name of the annotation.
136
+ *
137
+ * @return bool
138
+ *
139
+ * @throws Exceptions\AnnotationException
140
+ */
141
+ public static function classHasAnnotation ($ class , string $ type )
142
+ {
143
+ return count (self ::ofClass ($ class , $ type )) > 0 ;
144
+ }
145
+
146
+ /**
147
+ * Checks if a class method has the given annotation.
148
+ *
149
+ * @param object $class The class name or instance.
150
+ * @param string $method The name of the method.
151
+ * @param string $type The name of the annotation.
152
+ *
153
+ * @return bool
154
+ *
155
+ * @throws Exceptions\AnnotationException
156
+ */
157
+ public static function methodHasAnnotation ($ class , string $ method , string $ type )
158
+ {
159
+ return count (self ::ofMethod ($ class , $ method , $ type )) > 0 ;
160
+ }
161
+
162
+ /**
163
+ * Checks if a class property has the given annotation.
164
+ *
165
+ * @param object $class The class name or instance.
166
+ * @param string $property The name of the property.
167
+ * @param string $type The name of the annotation.
168
+ *
169
+ * @return bool
170
+ *
171
+ * @throws Exceptions\AnnotationException
172
+ */
173
+ public static function propertyHasAnnotation ($ class , string $ property , string $ type )
174
+ {
175
+ return count (self ::ofProperty ($ class , $ property , $ type )) > 0 ;
176
+ }
130
177
}
0 commit comments