File tree 2 files changed +8
-0
lines changed
2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -403,6 +403,9 @@ protected static function getAttributeDescription($value): ?string
403
403
$ reflection = self ::getReflection ();
404
404
$ constantName = static ::getKey ($ value );
405
405
$ constReflection = $ reflection ->getReflectionConstant ($ constantName );
406
+ if ($ constReflection === false ) {
407
+ return null ;
408
+ }
406
409
$ descriptionAttributes = $ constReflection ->getAttributes (Description::class);
407
410
408
411
if (count ($ descriptionAttributes ) === 1 ) {
Original file line number Diff line number Diff line change @@ -25,4 +25,9 @@ public function test_an_exception_is_thrown_when_accessing_a_description_which_i
25
25
26
26
DescriptionFromAttribute::InvalidCaseWithMultipleDescriptions ()->description ;
27
27
}
28
+
29
+ public function test_an_exception_is_not_thrown_when_accessing_a_description_for_an_invalid_value ()
30
+ {
31
+ $ this ->assertSame ('' , DescriptionFromAttribute::getDescription ('invalid ' ));
32
+ }
28
33
}
You can’t perform that action at this time.
0 commit comments