@@ -10,24 +10,36 @@ class PrivateUser {
10
10
private function __construct () {
11
11
return new stdClass ();
12
12
}
13
+ public function __destruct () {
14
+ echo 'Destructor for ' , __CLASS__ , PHP_EOL ;
15
+ }
13
16
}
14
17
15
18
class ThrowingUser {
16
19
public function __construct () {
17
20
throw new Exception ("Don't construct " );
18
21
}
22
+ public function __destruct () {
23
+ echo 'Destructor for ' , __CLASS__ , PHP_EOL ;
24
+ }
19
25
}
20
26
21
27
abstract class AbstractClass {
22
28
public function __construct () {
23
29
return new stdClass ();
24
30
}
31
+ public function __destruct () {
32
+ echo 'Destructor for ' , __CLASS__ , PHP_EOL ;
33
+ }
25
34
}
26
35
27
36
class TestUser {
28
37
public function __construct (int $ int_param , string $ string_param ) {
29
38
return new stdClass ();
30
39
}
40
+ public function __destruct () {
41
+ echo 'Destructor for ' , __CLASS__ , PHP_EOL ;
42
+ }
31
43
}
32
44
33
45
echo "Testing impossible initializations \n" ;
@@ -102,10 +114,15 @@ Error: Cannot instantiate trait _ZendTestTrait
102
114
Error: Cannot instantiate enum ZendTestUnitEnum
103
115
Error: Cannot instantiate abstract class AbstractClass
104
116
Error: Cannot directly construct SysvMessageQueue, use msg_get_queue() instead
117
+ Destructor for PrivateUser
105
118
Error: Call to private PrivateUser::__construct() from global scope
119
+ Destructor for ThrowingUser
106
120
Exception: Don't construct
107
121
Testing param passing
122
+ Destructor for TestUser
108
123
ArgumentCountError: Too few arguments to function TestUser::__construct(), 0 passed and exactly 2 expected
124
+ Destructor for TestUser
109
125
TypeError: TestUser::__construct(): Argument #1 ($int_param) must be of type int, string given
110
- object(TestUser)#1 (0) {
126
+ object(TestUser)#3 (0) {
111
127
}
128
+ Destructor for TestUser
0 commit comments