1--TEST--
2Using invalid self/parent types in closure
3--FILE--
4<?php
5
6$fn1 = function(self $x) {};
7try {
8    (new ReflectionFunction($fn1))->getParameters()[0]->getClass();
9} catch (ReflectionException $e) {
10    echo $e->getMessage(), "\n";
11}
12
13$fn2 = function(parent $x) {};
14try {
15    (new ReflectionFunction($fn2))->getParameters()[0]->getClass();
16} catch (ReflectionException $e) {
17    echo $e->getMessage(), "\n";
18}
19
20class Test {}
21$fn3 = (function(parent $x) {})->bindTo(new Test, Test::class);
22try {
23    (new ReflectionFunction($fn3))->getParameters()[0]->getClass();
24} catch (ReflectionException $e) {
25    echo $e->getMessage(), "\n";
26}
27
28?>
29--EXPECTF--
30Deprecated: Method ReflectionParameter::getClass() is deprecated in %s on line %d
31Parameter uses "self" as type but function is not a class member
32
33Deprecated: Method ReflectionParameter::getClass() is deprecated in %s on line %d
34Parameter uses "parent" as type but function is not a class member
35
36Deprecated: Method ReflectionParameter::getClass() is deprecated in %s on line %d
37Parameter uses "parent" as type although class does not have a parent
38