summaryrefslogtreecommitdiff
path: root/Zend/tests/object_types/type_hint_in_class_method.phpt
blob: e41caa0e70968357b5883b2425fe697797ecf7c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--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