@@ -19,23 +19,19 @@ class AnnotationException extends Exception
1919 /**
2020 * Creates a new AnnotationException describing a Syntax error.
2121 *
22- * @param string $message Exception message
23- *
2422 * @return AnnotationException
2523 */
26- public static function syntaxError ($ message )
24+ public static function syntaxError (string $ message )
2725 {
2826 return new self ('[Syntax Error] ' . $ message );
2927 }
3028
3129 /**
3230 * Creates a new AnnotationException describing a Semantical error.
3331 *
34- * @param string $message Exception message
35- *
3632 * @return AnnotationException
3733 */
38- public static function semanticalError ($ message )
34+ public static function semanticalError (string $ message )
3935 {
4036 return new self ('[Semantical Error] ' . $ message );
4137 }
@@ -44,36 +40,29 @@ public static function semanticalError($message)
4440 * Creates a new AnnotationException describing an error which occurred during
4541 * the creation of the annotation.
4642 *
47- * @param string $message
48- *
4943 * @return AnnotationException
5044 */
51- public static function creationError ($ message , ?Throwable $ previous = null )
45+ public static function creationError (string $ message , ?Throwable $ previous = null )
5246 {
5347 return new self ('[Creation Error] ' . $ message , 0 , $ previous );
5448 }
5549
5650 /**
5751 * Creates a new AnnotationException describing a type error.
5852 *
59- * @param string $message
60- *
6153 * @return AnnotationException
6254 */
63- public static function typeError ($ message )
55+ public static function typeError (string $ message )
6456 {
6557 return new self ('[Type Error] ' . $ message );
6658 }
6759
6860 /**
6961 * Creates a new AnnotationException describing a constant semantical error.
7062 *
71- * @param string $identifier
72- * @param string $context
73- *
7463 * @return AnnotationException
7564 */
76- public static function semanticalErrorConstants ($ identifier , $ context = null )
65+ public static function semanticalErrorConstants (string $ identifier , ? string $ context = null )
7766 {
7867 return self ::semanticalError (sprintf (
7968 "Couldn't find constant %s%s. " ,
@@ -85,16 +74,17 @@ public static function semanticalErrorConstants($identifier, $context = null)
8574 /**
8675 * Creates a new AnnotationException describing an type error of an attribute.
8776 *
88- * @param string $attributeName
89- * @param string $annotationName
90- * @param string $context
91- * @param string $expected
92- * @param mixed $actual
77+ * @param mixed $actual
9378 *
9479 * @return AnnotationException
9580 */
96- public static function attributeTypeError ($ attributeName , $ annotationName , $ context , $ expected , $ actual )
97- {
81+ public static function attributeTypeError (
82+ string $ attributeName ,
83+ string $ annotationName ,
84+ string $ context ,
85+ string $ expected ,
86+ $ actual
87+ ) {
9888 return self ::typeError (sprintf (
9989 'Attribute "%s" of @%s declared on %s expects %s, but got %s. ' ,
10090 $ attributeName ,
@@ -108,15 +98,14 @@ public static function attributeTypeError($attributeName, $annotationName, $cont
10898 /**
10999 * Creates a new AnnotationException describing an required error of an attribute.
110100 *
111- * @param string $attributeName
112- * @param string $annotationName
113- * @param string $context
114- * @param string $expected
115- *
116101 * @return AnnotationException
117102 */
118- public static function requiredError ($ attributeName , $ annotationName , $ context , $ expected )
119- {
103+ public static function requiredError (
104+ string $ attributeName ,
105+ string $ annotationName ,
106+ string $ context ,
107+ string $ expected
108+ ) {
120109 return self ::typeError (sprintf (
121110 'Attribute "%s" of @%s declared on %s expects %s. This value should not be null. ' ,
122111 $ attributeName ,
@@ -129,16 +118,18 @@ public static function requiredError($attributeName, $annotationName, $context,
129118 /**
130119 * Creates a new AnnotationException describing a invalid enummerator.
131120 *
132- * @param string $attributeName
133- * @param string $annotationName
134- * @param string $context
135- * @param mixed $given
136- * @phpstan-param list<string> $available
121+ * @param mixed $given
122+ * @phpstan-param list<string> $available
137123 *
138124 * @return AnnotationException
139125 */
140- public static function enumeratorError ($ attributeName , $ annotationName , $ context , $ available , $ given )
141- {
126+ public static function enumeratorError (
127+ string $ attributeName ,
128+ string $ annotationName ,
129+ string $ context ,
130+ array $ available ,
131+ $ given
132+ ) {
142133 return new self (sprintf (
143134 '[Enum Error] Attribute "%s" of @%s declared on %s accepts only [%s], but got %s. ' ,
144135 $ attributeName ,
0 commit comments