summaryrefslogtreecommitdiff
path: root/Zend/tests/object_types/type_hint_in_class_method.phpt
blob: 72b0f157047dcc3baba8da483bd2c8512539ce3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--TEST--
Adding a class method object type hint
--FILE--
<?php

class One {
    public function a(object $obj) {}
}

$one = new One();
$one->a(new One());
$one->a(123);
--EXPECTF--
Fatal error: Uncaught TypeError: Argument 1 passed to One::a() must be an object, integer given, called in %s:4
Stack trace:
#0 %s(9): One->a(123)
#1 {main}
  thrown in %s on line 4