Slide 121
Slide 121 text
traverseNodesWithCallable()
private function renameVariableInStmts(Catch_ $catch, string $oldName, string $newName) : void
{
$this->traverseNodesWithCallable(
$catch->stmts,
function (Node $node) use($oldName, $newName) {
if (!$node instanceof Variable) {
return null;
}
if (!$this->nodeNameResolver->isName($node, $oldName)) {
return null;
}
$node->name = $newName;
return null;
}
);
※紙面の都合でアレンジしています
121