Showing 36 of 36 total issues
Avoid using short method names like Factory::of(). The configured minimum method name length is 3. Open
public function of(string $class, string $name = 'default'): FactoryBuilder
{
$template = $this->definitions[$class][$name];
return new FactoryBuilder(
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid variables with short names like $i. Configured minimum length is 3. Open
return array_map(function($i) use ($attributes){
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $em. Configured minimum length is 3. Open
$em = $this->registry->getRepositoryForClass($this->class);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$class,
callable $template,
Factory $factory,
Faker $faker,
ManagerRegistry $registry = null
Expected 1 space before opening brace; found 0 Open
$data = array_map(function($prop){
- Exclude checks
Expected 1 space before opening brace; found 0 Open
return array_map(function($i) use ($attributes){
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "null" but found "NULL" Open
if ($em == NULL) {
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
$data = array_map(function($prop){
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
return array_map(function($i) use ($attributes){
- Exclude checks
Avoid unused local variables such as '$factory'. Open
$factory = $this;
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid using static access to class '\Firehose\Hydrator' in method 'build'. Open
return Hydrator::newInstance($this->class, $data);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid unused parameters such as '$i'. Open
return array_map(function($i) use ($attributes){
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid using static access to class '\Faker\Factory' in method '__construct'. Open
$this->faker = is_null($faker) ? FakerFactory::create() : $faker;
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Line exceeds 120 characters; contains 150 characters Open
throw new RuntimeException(__CLASS__."::".__FUNCTION__." will not work without an implementation of interface " . ManagerRegistry::class);
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if(is_null($this->registry)){
- Exclude checks
Whitespace found at end of line Open
* @param string $path Full path to file
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if($this->times === 1){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
if($this->times === 1){
- Exclude checks
Expected 1 newline at end of file; 0 found Open
}
- Exclude checks
Expected 1 newline at end of file; 0 found Open
}
- Exclude checks