1--TEST--
2ReflectionMethod::isConstructor()
3--FILE--
4<?php
5
6class NewCtor {
7    function __construct() {
8        echo "In " . __METHOD__ . "\n";
9    }
10
11}
12echo "New-style constructor:\n";
13$methodInfo = new ReflectionMethod("NewCtor::__construct");
14var_dump($methodInfo->isConstructor());
15
16class ExtendsNewCtor extends NewCtor {
17}
18echo "\nInherited new-style constructor\n";
19$methodInfo = new ReflectionMethod("ExtendsNewCtor::__construct");
20var_dump($methodInfo->isConstructor());
21
22class X {
23    function Y() {
24        echo "In " . __METHOD__ . "\n";
25    }
26}
27echo "\nNot a constructor:\n";
28$methodInfo = new ReflectionMethod("X::Y");
29var_dump($methodInfo->isConstructor());
30
31class Y extends X {
32}
33echo "\nInherited method of the same name as the class:\n";
34$methodInfo = new ReflectionMethod("Y::Y");
35var_dump($methodInfo->isConstructor());
36
37?>
38--EXPECT--
39New-style constructor:
40bool(true)
41
42Inherited new-style constructor
43bool(true)
44
45Not a constructor:
46bool(false)
47
48Inherited method of the same name as the class:
49bool(false)
50