class ReflectionClassNewInstancePatch in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatch.php \Prophecy\Doubler\ClassPatch\ReflectionClassNewInstancePatch
ReflectionClass::newInstance patch. Makes first argument of newInstance optional, since it works but signature is misleading
@author Florian Klein <florian.klein@free.fr>
Hierarchy
- class \Prophecy\Doubler\ClassPatch\ReflectionClassNewInstancePatch implements ClassPatchInterface
Expanded class hierarchy of ReflectionClassNewInstancePatch
File
- vendor/
phpspec/ prophecy/ src/ Prophecy/ Doubler/ ClassPatch/ ReflectionClassNewInstancePatch.php, line 22
Namespace
Prophecy\Doubler\ClassPatchView source
class ReflectionClassNewInstancePatch implements ClassPatchInterface {
/**
* Supports ReflectionClass
*
* @param ClassNode $node
*
* @return bool
*/
public function supports(ClassNode $node) {
return 'ReflectionClass' === $node
->getParentClass();
}
/**
* Updates newInstance's first argument to make it optional
*
* @param ClassNode $node
*/
public function apply(ClassNode $node) {
foreach ($node
->getMethod('newInstance')
->getArguments() as $argument) {
$argument
->setDefault(null);
}
}
/**
* Returns patch priority, which determines when patch will be applied.
*
* @return int Priority number (higher = earlier)
*/
public function getPriority() {
return 50;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ReflectionClassNewInstancePatch:: |
public | function |
Updates newInstance's first argument to make it optional Overrides ClassPatchInterface:: |
|
ReflectionClassNewInstancePatch:: |
public | function |
Returns patch priority, which determines when patch will be applied. Overrides ClassPatchInterface:: |
|
ReflectionClassNewInstancePatch:: |
public | function |
Supports ReflectionClass Overrides ClassPatchInterface:: |