Skip to content

Commit 3e5439b

Browse files
committed
ComponentReflection::parseAnnotation() returns NULL instead of FALSE (BC break)
1 parent 62c894f commit 3e5439b

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
@@ -194,12 +194,12 @@ public static function convertType(&$val, $type, $isClass = FALSE)
194194

195195
/**
196196
* Returns an annotation value.
197-
* @return array|FALSE
197+
* @return array|NULL
198198
*/
199199
public static function parseAnnotation(\Reflector $ref, $name)
200200
{
201201
if (!preg_match_all('#[\\s*]@' . preg_quote($name, '#') . '(?:\(\\s*([^)]*)\\s*\)|\\s|$)#', (string) $ref->getDocComment(), $m)) {
202-
return FALSE;
202+
return NULL;
203203
}
204204
static $tokens = ['true' => TRUE, 'false' => FALSE, 'null' => NULL];
205205
$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)