Skip to content

Commit 5637768

Browse files
committed
Clean up #[\Deprecated] tests
1 parent 9b0155e commit 5637768

File tree

5 files changed

+29
-18
lines changed

5 files changed

+29
-18
lines changed

Zend/tests/attributes/deprecated/001.phpt

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

66
error_reporting(E_ALL | E_DEPRECATED);
77
ini_set('display_errors', true);
88

9-
#[Deprecated]
9+
#[\Deprecated]
1010
function test() {
1111
}
1212

13-
#[Deprecated("use test() instead")]
13+
#[\Deprecated("use test() instead")]
1414
function test2() {
1515
}
1616

1717
class Clazz {
18-
#[Deprecated]
18+
#[\Deprecated]
1919
function test() {
2020
}
2121

22-
#[Deprecated("use test() instead")]
22+
#[\Deprecated("use test() instead")]
2323
function test2() {
2424
}
2525
}
Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,40 @@
11
--TEST--
2-
#[Deprecated] attribute
2+
#[\Deprecated]: Instantiating via Reflection.
33
--FILE--
44
<?php
55

6-
#[Deprecated()]
7-
function test() {
6+
#[\Deprecated]
7+
function test1() {
88
}
99

10-
#[Deprecated("use test() instead")]
10+
#[\Deprecated()]
1111
function test2() {
1212
}
1313

14-
$reflection = new ReflectionFunction('test');
14+
#[\Deprecated("use test() instead")]
15+
function test3() {
16+
}
17+
18+
$reflection = new ReflectionFunction('test1');
1519
var_dump($reflection->getAttributes()[0]->newInstance());
1620

1721
$reflection = new ReflectionFunction('test2');
1822
var_dump($reflection->getAttributes()[0]->newInstance());
1923

24+
$reflection = new ReflectionFunction('test3');
25+
var_dump($reflection->getAttributes()[0]->newInstance());
26+
2027
?>
2128
--EXPECTF--
22-
object(Deprecated)#3 (1) {
29+
object(Deprecated)#%d (1) {
30+
["message"]=>
31+
NULL
32+
}
33+
object(Deprecated)#%d (1) {
2334
["message"]=>
2435
NULL
2536
}
26-
object(Deprecated)#2 (1) {
37+
object(Deprecated)#%d (1) {
2738
["message"]=>
2839
string(18) "use test() instead"
2940
}

Zend/tests/attributes/deprecated/003.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
--TEST--
2-
#[Deprecated] attribute with wrong type
2+
#[\Deprecated]: Type validation of $message parameter.
33
--FILE--
44
<?php
55

6-
#[Deprecated(1234)]
6+
#[\Deprecated(1234)]
77
function test() {
88
}
99

Zend/tests/attributes/deprecated/004.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
--TEST--
2-
#[Deprecated] attribute with user error handler converting to exceptions
2+
#[\Deprecated]: Throwing error handler.
33
--FILE--
44
<?php
55

66
set_error_handler(function (int $errno, string $errstr, ?string $errfile = null, ?int $errline = null) {
77
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
88
});
99

10-
#[Deprecated("convert to exception")]
10+
#[\Deprecated("convert to exception")]
1111
function test() {
1212
}
1313

Zend/tests/attributes/deprecated/005.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
--TEST--
2-
#[Deprecated]’s $message property is readonly.
2+
#[\Deprecated]: $message property is readonly.
33
--FILE--
44
<?php
55

6-
$d = new Deprecated("foo");
6+
$d = new \Deprecated("foo");
77
$d->__construct("bar");
88

99
?>

0 commit comments

Comments
 (0)