1--TEST--
2ReflectionClass::getMethod() - error cases
3--CREDITS--
4Robin Fernandes <robinf@php.net>
5Steve Seear <stevseea@php.net>
6--FILE--
7<?php
8class C {
9    function f() {}
10}
11
12$rc = new ReflectionClass("C");
13echo "Check invalid params:\n";
14try {
15    var_dump($rc->getMethod());
16} catch (TypeError $e) {
17    echo $e->getMessage() . "\n";
18}
19try {
20    var_dump($rc->getMethod("f", "f"));
21} catch (TypeError $e) {
22    echo $e->getMessage() . "\n";
23}
24try {
25    var_dump($rc->getMethod(null));
26} catch (Exception $e) {
27    echo $e->getMessage() . "\n";
28}
29try {
30    var_dump($rc->getMethod(1));
31} catch (Exception $e) {
32    echo $e->getMessage() . "\n";
33}
34try {
35    var_dump($rc->getMethod(1.5));
36} catch (Exception $e) {
37    echo $e->getMessage() . "\n";
38}
39try {
40    var_dump($rc->getMethod(true));
41} catch (Exception $e) {
42    echo $e->getMessage() . "\n";
43}
44try {
45    var_dump($rc->getMethod(array(1,2,3)));
46} catch (TypeError $e) {
47    echo $e->getMessage() . "\n";
48}
49try {
50    var_dump($rc->getMethod(new C));
51} catch (TypeError $e) {
52    echo $e->getMessage() . "\n";
53}
54
55
56?>
57--EXPECTF--
58Check invalid params:
59ReflectionClass::getMethod() expects exactly 1 argument, 0 given
60ReflectionClass::getMethod() expects exactly 1 argument, 2 given
61
62Deprecated: ReflectionClass::getMethod(): Passing null to parameter #1 ($name) of type string is deprecated in %s on line %d
63Method C::() does not exist
64Method C::1() does not exist
65Method C::1.5() does not exist
66Method C::1() does not exist
67ReflectionClass::getMethod(): Argument #1 ($name) must be of type string, array given
68ReflectionClass::getMethod(): Argument #1 ($name) must be of type string, C given
69