1--TEST--
2ReflectionParameter Check for parameter being optional
3--FILE--
4<?php
5
6class Test {
7	function func($x, $y = NULL){
8	}
9}
10
11
12$f = new ReflectionMethod('Test', 'func');
13var_dump($f->getNumberOfParameters());
14var_dump($f->getNumberOfRequiredParameters());
15
16$p = new ReflectionParameter(array('Test', 'func'), 'x');
17var_dump($p->isOptional());
18
19$p = new ReflectionParameter(array('Test', 'func'), 'y');
20var_dump($p->isOptional());
21
22try {
23	$p = new ReflectionParameter(array('Test', 'func'), 'z');
24	var_dump($p->isOptional());
25}
26catch (Exception $e) {
27	var_dump($e->getMessage());
28}
29
30?>
31===DONE===
32--EXPECT--
33int(2)
34int(1)
35bool(false)
36bool(true)
37string(54) "The parameter specified by its name could not be found"
38===DONE===
39