Skip to content

Commit 4441969

Browse files
committed
ComponentReflection::parseAnnotation() returns NULL instead of FALSE (BC break)
1 parent e9dbb9b commit 4441969

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Application/UI/ComponentReflection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ public static function convertType(&$val, $type, $isClass = FALSE)
192192

193193
/**
194194
* Returns an annotation value.
195-
* @return array|FALSE
195+
* @return array|NULL
196196
*/
197197
public static function parseAnnotation(\Reflector $ref, $name)
198198
{
199199
if (!preg_match_all('#[\\s*]@' . preg_quote($name, '#') . '(?:\(\\s*([^)]*)\\s*\)|\\s|$)#', (string) $ref->getDocComment(), $m)) {
200-
return FALSE;
200+
return NULL;
201201
}
202202
static $tokens = ['true' => TRUE, 'false' => FALSE, 'null' => NULL];
203203
$res = [];

tests/UI/ComponentReflection.parseAnnotation.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ class TestClass {}
3434
$rc = new ReflectionClass('TestClass');
3535

3636
Assert::same(['value ="Johno\'s addendum"', 'mode=True', TRUE, TRUE], Reflection::parseAnnotation($rc, 'title'));
37-
Assert::same(FALSE, Reflection::parseAnnotation($rc, 'public'));
38-
Assert::same(FALSE, Reflection::parseAnnotation($rc, 'private'));
37+
Assert::null(Reflection::parseAnnotation($rc, 'public'));
38+
Assert::null(Reflection::parseAnnotation($rc, 'private'));
3939
Assert::same(['item 1'], Reflection::parseAnnotation($rc, 'components'));
4040
Assert::same([TRUE, FALSE, NULL], Reflection::parseAnnotation($rc, 'persistent'));
4141
Assert::same([TRUE], Reflection::parseAnnotation($rc, 'renderable'));
4242
Assert::same(['loggedIn'], Reflection::parseAnnotation($rc, 'Secured\User'));
43-
Assert::false(Reflection::parseAnnotation($rc, 'missing'));
43+
Assert::null(Reflection::parseAnnotation($rc, 'missing'));

0 commit comments

Comments
 (0)