File tree Expand file tree Collapse file tree 3 files changed +32
-3
lines changed
Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,11 @@ public static function parseAnnotation($value)
5353 {
5454 $ parts = explode (' ' , trim ($ value ), 3 );
5555
56+ if (count ($ parts ) < 2 ) {
57+ // Malformed value, let "initAnnotation" report about it.
58+ return array ();
59+ }
60+
5661 return array ('type ' => $ parts [0 ], 'name ' => substr ($ parts [1 ], 1 ));
5762 }
5863
Original file line number Diff line number Diff line change @@ -104,7 +104,8 @@ class SingleNonUsageAnnotation extends Annotation
104104
105105}
106106
107- class WrongInterfaceAnnotation {
107+ class WrongInterfaceAnnotation
108+ {
108109
109110}
110111
@@ -252,6 +253,19 @@ class TestClassFileAwareAnnotation
252253
253254}
254255
255- interface TestInterface {
256+ interface TestInterface
257+ {
258+
259+ }
260+
261+ class BrokenParamAnnotationClass
262+ {
256263
264+ /**
265+ * @param $paramName
266+ */
267+ protected function brokenParamAnnotation ($ paramName )
268+ {
269+
270+ }
257271}
Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ public function run(xTestRunner $testRunner)
4646
4747 // disable some annotations not used during testing:
4848 Annotations::getManager ()->registry ['var ' ] = false ;
49- Annotations::getManager ()->registry ['param ' ] = false ;
5049 Annotations::getManager ()->registry ['undefined ' ] = 'UndefinedAnnotation ' ;
5150 $ testRunner ->stopCoverageCollector ();
5251
@@ -750,6 +749,17 @@ protected function testFilterUnresolvedAnnotationClass()
750749
751750 $ this ->check ($ annotations === array (), 'empty annotation list when filtering failed ' );
752751 }
752+
753+ public function testMalformedParamAnnotationThrowsException ()
754+ {
755+ $ this ->setExpectedException (
756+ self ::ANNOTATION_EXCEPTION ,
757+ 'ParamAnnotation requires a type property '
758+ );
759+
760+ Annotations::ofMethod ('BrokenParamAnnotationClass ' , 'brokenParamAnnotation ' );
761+ }
762+
753763}
754764
755765return new AnnotationsTest ;
You can’t perform that action at this time.
0 commit comments