aaronbullard/factory-biscuit

View on GitHub

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(
Severity: Minor
Found in src/Factory.php by phpmd

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){
Severity: Minor
Found in src/FactoryBuilder.php by phpmd

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);
Severity: Minor
Found in src/FactoryBuilder.php by phpmd

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
Severity: Minor
Found in src/FactoryBuilder.php - About 35 mins to fix

    Expected 1 space before opening brace; found 0
    Open

            $data = array_map(function($prop){
    Severity: Minor
    Found in src/FactoryBuilder.php by phpcodesniffer

    Expected 1 space before opening brace; found 0
    Open

            return array_map(function($i) use ($attributes){
    Severity: Minor
    Found in src/FactoryBuilder.php by phpcodesniffer

    TRUE, FALSE and NULL must be lowercase; expected "null" but found "NULL"
    Open

            if ($em == NULL) {
    Severity: Minor
    Found in src/FactoryBuilder.php by phpcodesniffer

    Expected 1 space after FUNCTION keyword; 0 found
    Open

            $data = array_map(function($prop){
    Severity: Minor
    Found in src/FactoryBuilder.php by phpcodesniffer

    Expected 1 space after FUNCTION keyword; 0 found
    Open

            return array_map(function($i) use ($attributes){
    Severity: Minor
    Found in src/FactoryBuilder.php by phpcodesniffer

    Avoid unused local variables such as '$factory'.
    Open

            $factory = $this;
    Severity: Minor
    Found in src/Factory.php by phpmd

    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);
    Severity: Minor
    Found in src/FactoryBuilder.php by phpmd

    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){
    Severity: Minor
    Found in src/FactoryBuilder.php by phpmd

    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;
    Severity: Minor
    Found in src/Factory.php by phpmd

    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);
    Severity: Minor
    Found in src/FactoryBuilder.php by phpcodesniffer

    Expected 1 space after IF keyword; 0 found
    Open

            if(is_null($this->registry)){
    Severity: Minor
    Found in src/FactoryBuilder.php by phpcodesniffer

    Whitespace found at end of line
    Open

         * @param string $path Full path to file 
    Severity: Minor
    Found in src/Factory.php by phpcodesniffer

    Expected 1 space after IF keyword; 0 found
    Open

            if($this->times === 1){
    Severity: Minor
    Found in src/FactoryBuilder.php by phpcodesniffer

    Expected 1 space after closing parenthesis; found 0
    Open

            if($this->times === 1){
    Severity: Minor
    Found in src/FactoryBuilder.php by phpcodesniffer

    Expected 1 newline at end of file; 0 found
    Open

    }
    Severity: Minor
    Found in src/Repository.php by phpcodesniffer

    Expected 1 newline at end of file; 0 found
    Open

    }
    Severity: Minor
    Found in src/Factory.php by phpcodesniffer
    Severity
    Category
    Status
    Source
    Language