Skip to content

Commit

Permalink
fix data collector
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Feb 19, 2024
1 parent 20bfba9 commit ff6eb1e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
11 changes: 9 additions & 2 deletions src/Debug/TraceData.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ public function getNestedTraceData(): array
return $this->nestedTraceData;
}

/**
* @return array<int,self>
*/
public function getAcceptedNestedTraceData(): array
{
return array_filter($this->nestedTraceData, fn (self $traceData) => !$traceData->isRefused());
}

public function addNestedTraceData(self $traceData): void
{
$this->nestedTraceData[] = $traceData;
Expand Down Expand Up @@ -141,8 +149,7 @@ public function getPossibleTargetTypesHtml(): string
if ($this->possibleTargetTypes === null) {
return "__unknown__";
}
return TypeUtil::getTypeStringHtml($this->possibleTargetTypes);
;
return TypeUtil::getTypeStringHtml($this->possibleTargetTypes);;
}

public function getSelectedTargetType(): ?Type
Expand Down
7 changes: 4 additions & 3 deletions src/Debug/TraceableTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,7 @@ public function transform(
$caller['type'] ?? null
);

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

try {
Expand All @@ -118,6 +115,10 @@ public function transform(

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

if (!$parentTraceData) {
$this->dataCollector->collectTraceData($traceData);
}

return $result;
} catch (RefuseToTransformException $e) {
$traceData->refusedToTransform();
Expand Down
2 changes: 1 addition & 1 deletion templates/data_collector.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
</td>
</tr>

{% for child in tracedata.nestedTraceData %}
{% for child in tracedata.acceptedNestedTraceData %}
{{ _self.render_row(child, depth + 1) }}
{% endfor %}
{% endmacro %}
Expand Down

0 comments on commit ff6eb1e

Please sign in to comment.