Showing 40 of 40 total issues
File TestHelperTest.php
has 519 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* Copyright (c) 2016 Refinery29, Inc.
*
TestHelperTest
has 49 functions (exceeds 20 allowed). Consider refactoring. Open
final class TestHelperTest extends Framework\TestCase
{
use TestHelper;
public function testCanGetFakerStatically()
The class TestHelperTest has 49 non-getter- and setter-methods. Consider refactoring TestHelperTest to keep number of methods under 25. Open
final class TestHelperTest extends Framework\TestCase
{
use TestHelper;
public function testCanGetFakerStatically()
- Read upRead up
- Exclude checks
TooManyMethods
Since: 0.1
A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
The default was changed from 10 to 25 in PHPMD 2.3.
Example
Source https://phpmd.org/rules/codesize.html#toomanymethods
The class TestHelperTest has 48 public methods. Consider refactoring TestHelperTest to keep number of public methods under 10. Open
final class TestHelperTest extends Framework\TestCase
{
use TestHelper;
public function testCanGetFakerStatically()
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class TestHelperTest has an overall complexity of 53 which is very high. The configured complexity threshold is 50. Open
final class TestHelperTest extends Framework\TestCase
{
use TestHelper;
public function testCanGetFakerStatically()
- Exclude checks
Method assertClassesSatisfy
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function assertClassesSatisfy(callable $specification, $path, array $excludeDirectories = [], $message = null)
{
if (!\is_string($path)) {
throw new \InvalidArgumentException(\sprintf(
'Path needs to be specified as a string, got "%s".',
Avoid excessively long variable names like $classNamesNeitherAbstractNorFinal. Keep variable name length under 20. Open
$classNamesNeitherAbstractNorFinal = [
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $classNamesNotSatisfyingSpecification. Keep variable name length under 20. Open
$classNamesNotSatisfyingSpecification = \array_filter($classNames, function ($className) use ($specification) {
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Method testProvideCombinedDataFromYieldsCombinedValuesFromMultipleDataProviders
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testProvideCombinedDataFromYieldsCombinedValuesFromMultipleDataProviders()
{
$valuesOne = [
1,
2,
The class TestHelperTest has 48 public methods and attributes. Consider reducing the number of public items to less than 45. Open
final class TestHelperTest extends Framework\TestCase
{
use TestHelper;
public function testCanGetFakerStatically()
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
The class TestHelperTest has a coupling between objects value of 21. Consider to reduce the number of dependencies under 13. Open
final class TestHelperTest extends Framework\TestCase
{
use TestHelper;
public function testCanGetFakerStatically()
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '20', column '27'). Open
$reflection = new \ReflectionClass(Generator::class);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '26', column '29'). Open
'object' => new \stdClass(),
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '138', column '27'). Open
$reflection = new \ReflectionClass($childName);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '25', column '29'). Open
'object' => new \stdClass(),
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '274', column '31'). Open
$reflection = new \ReflectionClass($className);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '220', column '27'). Open
throw new \InvalidArgumentException(\sprintf(
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '27', column '29'). Open
'object' => new \stdClass(),
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '27', column '29'). Open
'object' => new \stdClass(),
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '25', column '29'). Open
'object' => new \stdClass(),
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}