getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE); if (!$parentNode instanceof \PhpParser\Node\Expr\BinaryOp\Concat) { $this->reset(); } $this->processConcatSide($concat->left); $this->processConcatSide($concat->right); return new \Rector\CodingStyle\ValueObject\ConcatStringAndPlaceholders($this->content, $this->placeholderNodes); } private function reset() : void { $this->content = ''; $this->placeholderNodes = []; } private function processConcatSide(\PhpParser\Node\Expr $expr) : void { if ($expr instanceof \PhpParser\Node\Scalar\String_) { $this->content .= $expr->value; } elseif ($expr instanceof \PhpParser\Node\Expr\BinaryOp\Concat) { $this->joinToStringAndPlaceholderNodes($expr); } else { $objectHash = '____' . \spl_object_hash($expr) . '____'; $this->placeholderNodes[$objectHash] = $expr; $this->content .= $objectHash; } } }