catches as $catch) { if (\count($catch->types) === 1) { $catches []= $catch; } else { foreach ($catch->types as $type) { $ncatch = clone $catch; $ncatch->types = [$type]; $catches []= $ncatch; } } } $node->catches = $catches; } }