Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Definition/RuntimeDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ protected function processParams(&$def, Reflection\ClassReflection $rClass, Refl
// set the class name, if it exists
$def['parameters'][$methodName][$fqName][] = $actualParamName;
$def['parameters'][$methodName][$fqName][] = ($p->getClass() !== null) ? $p->getClass()->getName() : null;
$def['parameters'][$methodName][$fqName][] = !($optional =$p->isOptional());
$def['parameters'][$methodName][$fqName][] = !($optional =$p->isOptional() && $p->isDefaultValueAvailable());
$def['parameters'][$methodName][$fqName][] = $optional ? $p->getDefaultValue() : null;
}

Expand Down
34 changes: 34 additions & 0 deletions test/Definition/RuntimeDefinitionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,38 @@ public function testIncludesDefaultMethodParameters()
)
);
}

public function testExceptionDefaultValue()
{
$definition = new RuntimeDefinition();

$definition->forceLoadClass('RecursiveIteratorIterator');

$this->assertSame(
array(
'RecursiveIteratorIterator::__construct:0' => array(
'iterator',
'Traversable',
true,
null,
),
'RecursiveIteratorIterator::__construct:1' => Array (
'mode',
null,
true,
null,
),
'RecursiveIteratorIterator::__construct:2' => Array (
'flags',
null,
true,
null,
),
),
$definition->getMethodParameters(
'RecursiveIteratorIterator',
'__construct'
)
);
}
}

0 comments on commit 11c30a7

Please # to comment.