diff --git a/src/main/php/lang/reflect/ClassParser.class.php b/src/main/php/lang/reflect/ClassParser.class.php index 8d351b2e30..a5d5332fee 100755 --- a/src/main/php/lang/reflect/ClassParser.class.php +++ b/src/main/php/lang/reflect/ClassParser.class.php @@ -319,6 +319,7 @@ public function parseAnnotations($bytes, $context, $imports= [], $line= -1) { $value= null; $i++; $state= 1; + trigger_error('XP annotation syntax is deprecated in '.$context, E_USER_DEPRECATED); } else if (T_STRING === $tokens[$i][0]) { $annotation= lcfirst($tokens[$i][1]); $param= null; diff --git a/src/test/php/net/xp_framework/unittest/annotations/AnnotationParsingTest.class.php b/src/test/php/net/xp_framework/unittest/annotations/AnnotationParsingTest.class.php index e53f4a6a28..6e36f4d8ea 100755 --- a/src/test/php/net/xp_framework/unittest/annotations/AnnotationParsingTest.class.php +++ b/src/test/php/net/xp_framework/unittest/annotations/AnnotationParsingTest.class.php @@ -29,9 +29,13 @@ class AnnotationParsingTest extends AbstractAnnotationParsingTest { * @return [:var] */ protected function parse($input, $imports= []) { - return (new ClassParser())->parseAnnotations($input, nameof($this), array_merge($imports, [ - 'Namespaced' => 'net.xp_framework.unittest.annotations.fixture.Namespaced' - ])); + try { + return (new ClassParser())->parseAnnotations($input, nameof($this), array_merge($imports, [ + 'Namespaced' => 'net.xp_framework.unittest.annotations.fixture.Namespaced' + ])); + } finally { + \xp::gc(); // Strip deprecation warning + } } #[Test] diff --git a/src/test/php/net/xp_framework/unittest/annotations/BrokenAnnotationTest.class.php b/src/test/php/net/xp_framework/unittest/annotations/BrokenAnnotationTest.class.php index a77c05129a..fb71584576 100755 --- a/src/test/php/net/xp_framework/unittest/annotations/BrokenAnnotationTest.class.php +++ b/src/test/php/net/xp_framework/unittest/annotations/BrokenAnnotationTest.class.php @@ -21,7 +21,11 @@ class BrokenAnnotationTest extends TestCase { * @return [:var] */ protected function parse($input) { - return (new ClassParser())->parseAnnotations($input, nameof($this)); + try { + return (new ClassParser())->parseAnnotations($input, nameof($this)); + } finally { + \xp::gc(); // Strip deprecation warning + } } #[Test, Action(eval: 'new RuntimeVersion("<8.0")'), Expect(['class' => ClassFormatException::class, 'withMessage' => '/Unterminated annotation/'])]