#7 phpcallgraph analyse the wrong file in case of inheritance

open
nobody
None
5
2010-03-21
2010-03-21
No

Hi,
Here is a litte example :

dad.php
class Dad { 
function notOverriden() { }
}

child.php
class Child extends Dad() {
function childMethod() { }
}

Well, in phpcallgraph 0.8 , the notOverriden method is analysed in child.php ( using lineStart and lineEnd form dad.php ) ( which leads to incorrect graphs )

Here is my fix :

In ( summarizeClassMethods() ) lib/instantsvc/components/CodeAnalyzer/src/code_analyser.php

i added ( before $result[$method->getName()]['startLine'] = $method->getStartLine(); ) :
// because of inheritance , filename may not be the same as the analysed class
$result[$method->getName()]['file'] = $method->getFilename();

In ( analyseCodeSummary() , src/PHPCallGraph.php ) , replaced $class['file'] by $method['file']

My graphs seems correct now.

Thanks again for the great tool.

Rahal

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks