Skip to content

Commit 6c2cb70

Browse files
committed
Test ReflectionClassConstant::isDeprecated() for userland constants
1 parent cb9b5c1 commit 6c2cb70

File tree

4 files changed

+30
-13
lines changed

4 files changed

+30
-13
lines changed

Zend/tests/attributes/deprecated/001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
#[\Deprecated]: Functions and Methods
2+
#[\Deprecated]: Functions and Methods.
33
--FILE--
44
<?php
55

Zend/tests/attributes/deprecated/018.phpt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
#[\Deprecated]: Class Constants
2+
#[\Deprecated]: Class Constants.
33
--FILE--
44
<?php
55

@@ -11,7 +11,7 @@ set_error_handler(function (int $errno, string $errstr, ?string $errfile = null,
1111
}
1212
});
1313

14-
class Foo {
14+
class Clazz {
1515
#[\Deprecated]
1616
public const TEST = 1;
1717

@@ -28,21 +28,21 @@ class Foo {
2828
public const TEST5 = 5;
2929
}
3030

31-
var_dump(Foo::TEST);
32-
var_dump(Foo::TEST2);
33-
var_dump(Foo::TEST3);
31+
var_dump(Clazz::TEST);
32+
var_dump(Clazz::TEST2);
33+
var_dump(Clazz::TEST3);
3434

35-
var_dump(constant('Foo::TEST4'));
36-
var_dump(defined('Foo::TEST5'));
35+
var_dump(constant('Clazz::TEST4'));
36+
var_dump(defined('Clazz::TEST5'));
3737

3838
?>
3939
--EXPECT--
40-
Constant Foo::TEST is deprecated
40+
Constant Clazz::TEST is deprecated
4141
int(1)
42-
Constant Foo::TEST2 is deprecated
42+
Constant Clazz::TEST2 is deprecated
4343
int(2)
44-
Constant Foo::TEST3 is deprecated, use Clazz::TEST instead
44+
Constant Clazz::TEST3 is deprecated, use Clazz::TEST instead
4545
int(3)
46-
Constant Foo::TEST4 is deprecated
46+
Constant Clazz::TEST4 is deprecated
4747
int(4)
4848
bool(true)

Zend/tests/attributes/deprecated/019.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
#[\Deprecated]: Enum cases
2+
#[\Deprecated]: Enum cases.
33
--FILE--
44
<?php
55

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
#[\Deprecated]: ReflectionClassConstant::isDeprecated() returns true.
3+
--FILE--
4+
<?php
5+
6+
class Clazz {
7+
#[\Deprecated]
8+
public const TEST = 'test';
9+
}
10+
11+
12+
$r = new ReflectionClassConstant('Clazz', 'TEST');
13+
var_dump($r->isDeprecated());
14+
15+
?>
16+
--EXPECTF--
17+
bool(true)

0 commit comments

Comments
 (0)