xref: /PHP-7.2/Zend/tests/traits/noctor001.phpt (revision 6ef92162)
1--TEST--
2Don't mark trait methods as constructor
3--FILE--
4<?php
5trait Foo {
6    public function Foo() {
7    }
8}
9
10class Bar {
11    use Foo;
12    public function Bar() {
13    }
14}
15
16$rfoofoo = new ReflectionMethod('Foo::Foo');
17var_dump($rfoofoo->isConstructor());
18
19$rbarfoo = new ReflectionMethod('Bar::Foo');
20var_dump($rbarfoo->isConstructor());
21
22$rbarbar = new ReflectionMethod('Bar::Bar');
23var_dump($rbarbar->isConstructor());
24?>
25--EXPECTF--
26Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Bar has a deprecated constructor in %s on line %d
27bool(false)
28bool(false)
29bool(true)
30