summaryrefslogtreecommitdiff
path: root/ext/reflection/tests/traits001.phpt
blob: 4e36ceeaf085b032749ade7907e883c96e824247 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
--TEST--
ReflectionClass and Traits
--FILE--
<?php
trait Foo {
    public function someMethod() { }
}

class Bar {
    use Foo;

    public function someOtherMethod() { }
}

$rFoo = new ReflectionClass('Foo');
$rBar = new ReflectionClass('Bar');

var_dump($rFoo->isTrait());
var_dump($rBar->isTrait());
echo $rFoo;
echo $rBar;
--EXPECTF--
bool(true)
bool(false)
Trait [ <user> trait Foo ] {
  @@ %straits001.php 2-4

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [1] {
    Method [ <user> public method someMethod ] {
      @@ %straits001.php 3 - 3
    }
  }
}
Class [ <user> class Bar ] {
  @@ %straits001.php 6-10

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [2] {
    Method [ <user> public method someOtherMethod ] {
      @@ %straits001.php 9 - 9
    }

    Method [ <user> public method someMethod ] {
      @@ %straits001.php 3 - 3
    }
  }
}