@@ -19,23 +19,19 @@ class AnnotationException extends Exception
19
19
/**
20
20
* Creates a new AnnotationException describing a Syntax error.
21
21
*
22
- * @param string $message Exception message
23
- *
24
22
* @return AnnotationException
25
23
*/
26
- public static function syntaxError ($ message )
24
+ public static function syntaxError (string $ message )
27
25
{
28
26
return new self ('[Syntax Error] ' . $ message );
29
27
}
30
28
31
29
/**
32
30
* Creates a new AnnotationException describing a Semantical error.
33
31
*
34
- * @param string $message Exception message
35
- *
36
32
* @return AnnotationException
37
33
*/
38
- public static function semanticalError ($ message )
34
+ public static function semanticalError (string $ message )
39
35
{
40
36
return new self ('[Semantical Error] ' . $ message );
41
37
}
@@ -44,36 +40,29 @@ public static function semanticalError($message)
44
40
* Creates a new AnnotationException describing an error which occurred during
45
41
* the creation of the annotation.
46
42
*
47
- * @param string $message
48
- *
49
43
* @return AnnotationException
50
44
*/
51
- public static function creationError ($ message , ?Throwable $ previous = null )
45
+ public static function creationError (string $ message , ?Throwable $ previous = null )
52
46
{
53
47
return new self ('[Creation Error] ' . $ message , 0 , $ previous );
54
48
}
55
49
56
50
/**
57
51
* Creates a new AnnotationException describing a type error.
58
52
*
59
- * @param string $message
60
- *
61
53
* @return AnnotationException
62
54
*/
63
- public static function typeError ($ message )
55
+ public static function typeError (string $ message )
64
56
{
65
57
return new self ('[Type Error] ' . $ message );
66
58
}
67
59
68
60
/**
69
61
* Creates a new AnnotationException describing a constant semantical error.
70
62
*
71
- * @param string $identifier
72
- * @param string $context
73
- *
74
63
* @return AnnotationException
75
64
*/
76
- public static function semanticalErrorConstants ($ identifier , $ context = null )
65
+ public static function semanticalErrorConstants (string $ identifier , ? string $ context = null )
77
66
{
78
67
return self ::semanticalError (sprintf (
79
68
"Couldn't find constant %s%s. " ,
@@ -85,16 +74,17 @@ public static function semanticalErrorConstants($identifier, $context = null)
85
74
/**
86
75
* Creates a new AnnotationException describing an type error of an attribute.
87
76
*
88
- * @param string $attributeName
89
- * @param string $annotationName
90
- * @param string $context
91
- * @param string $expected
92
- * @param mixed $actual
77
+ * @param mixed $actual
93
78
*
94
79
* @return AnnotationException
95
80
*/
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
+ ) {
98
88
return self ::typeError (sprintf (
99
89
'Attribute "%s" of @%s declared on %s expects %s, but got %s. ' ,
100
90
$ attributeName ,
@@ -108,15 +98,14 @@ public static function attributeTypeError($attributeName, $annotationName, $cont
108
98
/**
109
99
* Creates a new AnnotationException describing an required error of an attribute.
110
100
*
111
- * @param string $attributeName
112
- * @param string $annotationName
113
- * @param string $context
114
- * @param string $expected
115
- *
116
101
* @return AnnotationException
117
102
*/
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
+ ) {
120
109
return self ::typeError (sprintf (
121
110
'Attribute "%s" of @%s declared on %s expects %s. This value should not be null. ' ,
122
111
$ attributeName ,
@@ -129,16 +118,18 @@ public static function requiredError($attributeName, $annotationName, $context,
129
118
/**
130
119
* Creates a new AnnotationException describing a invalid enummerator.
131
120
*
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
137
123
*
138
124
* @return AnnotationException
139
125
*/
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
+ ) {
142
133
return new self (sprintf (
143
134
'[Enum Error] Attribute "%s" of @%s declared on %s accepts only [%s], but got %s. ' ,
144
135
$ attributeName ,
0 commit comments