This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
15
{
16
/**
17
* @dataProvider provideExamples
18
*
19
* @param string $example
20
* @param string $classname
21
* @param float $expected
22
*/
23
public function testLackOfCohesionOfMethodsIsWellCalculated($example, $classname, $expected)
24
{
25
$metrics = new Metrics();
26
27
$parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7);
It seems like $stmts defined by $parser->parse($code) on line 36 can also be of type null; however, PhpParser\NodeTraverser::traverse() does only seem to accept array<integer,object<PhpParser\Node>>, maybe add an additional type check?
If a method or function can return multiple different values and unless you are
sure that you only can receive a single value in this context, we recommend
to add an additional type check:
/** * @return array|string */functionreturnsDifferentValues($x){if($x){return'foo';}returnarray();}$x=returnsDifferentValues($y);if(is_array($x)){// $x is an array.}
If this a common case that PHP Analyzer should handle natively, please let us
know by opening an issue.
The doc-type mixed[]*/ could not be parsed: Expected "|" or "end of type", but got "*/" at position 7. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see
which comment annotations we can parse, please refer to our documentation on
supported doc-types.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.