Skip to content

Commit ff6eb1e

Browse files
committed
fix data collector
1 parent 20bfba9 commit ff6eb1e

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/Debug/TraceData.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ public function getNestedTraceData(): array
108108
return $this->nestedTraceData;
109109
}
110110

111+
/**
112+
* @return array<int,self>
113+
*/
114+
public function getAcceptedNestedTraceData(): array
115+
{
116+
return array_filter($this->nestedTraceData, fn (self $traceData) => !$traceData->isRefused());
117+
}
118+
111119
public function addNestedTraceData(self $traceData): void
112120
{
113121
$this->nestedTraceData[] = $traceData;
@@ -141,8 +149,7 @@ public function getPossibleTargetTypesHtml(): string
141149
if ($this->possibleTargetTypes === null) {
142150
return "__unknown__";
143151
}
144-
return TypeUtil::getTypeStringHtml($this->possibleTargetTypes);
145-
;
152+
return TypeUtil::getTypeStringHtml($this->possibleTargetTypes);;
146153
}
147154

148155
public function getSelectedTargetType(): ?Type

src/Debug/TraceableTransformer.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ public function transform(
104104
$caller['type'] ?? null
105105
);
106106

107-
// if we are the root transformer, add the trace data to the
108-
// context, and collect it
109107
$context = $context->with($traceData);
110-
$this->dataCollector->collectTraceData($traceData);
111108
}
112109

113110
try {
@@ -118,6 +115,10 @@ public function transform(
118115

119116
$traceData->finalize($time, $result);
120117

118+
if (!$parentTraceData) {
119+
$this->dataCollector->collectTraceData($traceData);
120+
}
121+
121122
return $result;
122123
} catch (RefuseToTransformException $e) {
123124
$traceData->refusedToTransform();

templates/data_collector.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
</td>
232232
</tr>
233233

234-
{% for child in tracedata.nestedTraceData %}
234+
{% for child in tracedata.acceptedNestedTraceData %}
235235
{{ _self.render_row(child, depth + 1) }}
236236
{% endfor %}
237237
{% endmacro %}

0 commit comments

Comments
 (0)