summaryrefslogtreecommitdiff
path: root/Zend/tests/parent_class_name_without_parent.phpt
blob: 033b5ad4ec91eb6cd5a532c786f71d9b49b4f29c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--TEST--
Getting parent class name when there is no parent generates an error
--FILE--
<?php

trait T {
    public function f() {
        var_dump(parent::class);
    }
}

class C {
    use T;
}

(new C)->f();

?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot use "parent" when current class scope has no parent in %s:5
Stack trace:
#0 %s(%d): C->f()
#1 {main}
  thrown in %s on line 5