Closure names aliased & ambiguous in reports
NoiseByNorthwest opened this issue · comments
A closure name, as returned/generated by the Zend Engine, follows this pattern \Foo\Bar{closure}
(when created by a class method) where Foo
is the namespace and Bar
the class.
Thus if the class's methods create several closures at several places then they will appear as a single closure and theirs stats will be merged.
Moreover a closure name does not bring any information about where it is created.
I just ran into this issue as well.
I think it would be good if SPX could append the line numbers of the closure, for example \Foo\Bar{closure}150-157
This way it's easy to identify exactly which closure in a given class was called.
Yes, we need something like this, but the line range will still fail with short arrow functions defined on the same line.
Do you know how other profilers handle this case ?
My initial goal was to build a callgraph out of the data that SPX collects - similar to Blackfire.io
They add the line numbers as the suffix - and in some cases also have some "ID"/hash, but I don't know how that gets calculated.