@@ -18,10 +18,6 @@ class PhpDocReader
18
18
*/
19
19
private $ phpParser ;
20
20
21
-
22
- /**
23
- * Constructor
24
- */
25
21
public function __construct ()
26
22
{
27
23
$ this ->phpParser = new PhpParser ();
@@ -77,14 +73,21 @@ public function getPropertyType(ReflectionProperty $property)
77
73
}
78
74
79
75
if (!$ found ) {
80
- throw new AnnotationException ("The @var annotation on {$ class ->name }:: " . $ property ->getName ()
81
- . " contains a non existent class. Did you maybe forget to add a 'use' statement for this annotation? " );
76
+ throw new AnnotationException (sprintf (
77
+ 'The @var annotation on %s::%s contains a non existent class. '
78
+ . 'Did you maybe forget to add a \'use \' statement for this annotation? ' ,
79
+ $ class ->name ,
80
+ $ property ->getName ()
81
+ ));
82
82
}
83
83
}
84
84
85
85
if (!$ this ->classExists ($ type )) {
86
- throw new AnnotationException ("The @var annotation on {$ class ->name }:: " . $ property ->getName ()
87
- . " contains a non existent class " );
86
+ throw new AnnotationException (sprintf (
87
+ 'The @var annotation on %s::%s contains a non existent class ' ,
88
+ $ class ->name ,
89
+ $ property ->getName ()
90
+ ));
88
91
}
89
92
90
93
// Remove the leading \ (FQN shouldn't contain it)
@@ -97,8 +100,8 @@ public function getPropertyType(ReflectionProperty $property)
97
100
* Parse the docblock of the property to get the param annotation.
98
101
*
99
102
* @param ReflectionParameter $parameter
100
- * @throws AnnotationException
101
103
*
104
+ * @throws AnnotationException
102
105
* @return string|null Type of the property (content of var annotation)
103
106
*/
104
107
public function getParameterType (ReflectionParameter $ parameter )
@@ -151,14 +154,23 @@ public function getParameterType(ReflectionParameter $parameter)
151
154
}
152
155
153
156
if (!$ found ) {
154
- throw new AnnotationException ("The @param annotation for parameter $ parameterName of {$ class ->name }:: " . $ method ->name
155
- . " contains a non existent class. Did you maybe forget to add a 'use' statement for this annotation? " );
157
+ throw new AnnotationException (sprintf (
158
+ 'The @param annotation for parameter %s of %s::%s contains a non existent class. '
159
+ . 'Did you maybe forget to add a \'use \' statement for this annotation? ' ,
160
+ $ parameterName ,
161
+ $ class ->name ,
162
+ $ method ->name
163
+ ));
156
164
}
157
165
}
158
166
159
167
if (!$ this ->classExists ($ type )) {
160
- throw new AnnotationException ("The @param annotation for parameter $ parameterName of {$ class ->name }:: " . $ method ->name
161
- . " contains a non existent class " );
168
+ throw new AnnotationException (sprintf (
169
+ 'The @param annotation for parameter %s of %s::%s contains a non existent class ' ,
170
+ $ parameterName ,
171
+ $ class ->name ,
172
+ $ method ->name
173
+ ));
162
174
}
163
175
164
176
// Remove the leading \ (FQN shouldn't contain it)
0 commit comments