gdbots/enrichments-bundle-php

View on GitHub
tests/TimePartingEnricherTest.php

Summary

Maintainability
A
0 mins
Test Coverage

Missing class import via use statement (line '18', column '64').
Open

        $command->set('occurred_at', Microtime::fromFloat((new \DateTime('2015-12-25T01:15:30.123456Z'))->format('U.u')));
Severity: Minor
Found in tests/TimePartingEnricherTest.php by phpmd

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

Avoid using static access to class '\Gdbots\Pbj\WellKnown\Microtime' in method 'testEnrich'.
Open

        $command->set('occurred_at', Microtime::fromFloat((new \DateTime('2015-12-25T01:15:30.123456Z'))->format('U.u')));
Severity: Minor
Found in tests/TimePartingEnricherTest.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 using static access to class '\Gdbots\Schemas\Common\Enum\DayOfWeek' in method 'testEnrich'.
Open

        $this->assertSame(DayOfWeek::FRIDAY(), $command->get('day_of_week'));
Severity: Minor
Found in tests/TimePartingEnricherTest.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 using static access to class '\Gdbots\Schemas\Common\Enum\Month' in method 'testEnrich'.
Open

        $this->assertSame(Month::DECEMBER(), $command->get('month_of_year'));
Severity: Minor
Found in tests/TimePartingEnricherTest.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 using static access to class 'Gdbots\Tests\Bundle\EnrichmentsBundle\Fixtures\FakeCommand' in method 'testEnrich'.
Open

        $command = Fixtures\FakeCommand::create();
Severity: Minor
Found in tests/TimePartingEnricherTest.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 122 characters
Open

        $command->set('occurred_at', Microtime::fromFloat((new \DateTime('2015-12-25T01:15:30.123456Z'))->format('U.u')));

There are no issues that match your filters.

Category
Status