You are here

public function NodeAssignmentFilter::__invoke in Drupal 7 to 8/9 Module Upgrader 8

Tests if the given node is on the left side of an assignment.

Parameters

\Pharborist\Node $node: The node to test.

Return value

bool

File

src/Utility/Filter/NodeAssignmentFilter.php, line 18

Class

NodeAssignmentFilter

Namespace

Drupal\drupalmoduleupgrader\Utility\Filter

Code

public function __invoke(Node $node) {

  /** @var \Pharborist\Operators\AssignNode $assignment */
  $assignment = $node
    ->closest(Filter::isInstanceOf('\\Pharborist\\Operators\\AssignNode'));
  return $assignment ? $assignment
    ->getLeftOperand() === $node : FALSE;
}