You are here

public function KeywordPatch::apply in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/KeywordPatch.php \Prophecy\Doubler\ClassPatch\KeywordPatch::apply()

Remove methods that clash with php keywords

Parameters

ClassNode $node:

Overrides ClassPatchInterface::apply

File

vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/KeywordPatch.php, line 40

Class

KeywordPatch
Remove method functionality from the double which will clash with php keywords.

Namespace

Prophecy\Doubler\ClassPatch

Code

public function apply(ClassNode $node) {
  $methodNames = array_keys($node
    ->getMethods());
  $methodsToRemove = array_intersect($methodNames, $this
    ->getKeywords());
  foreach ($methodsToRemove as $methodName) {
    $node
      ->removeMethod($methodName);
  }
}