MontealegreLuis/php-testing-tools

View on GitHub

Showing 68 of 68 total issues

Avoid using static access to class '\Webmozart\Assert\Assert' in method 'setPath'.
Open

        Assert::true($path->isDir(), 'Application base path must be a directory. Got %s');
Severity: Minor
Found in ewallet/src/Application/BasePath.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 '$input'.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int

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 '\Doctrine\ORM\Tools\Setup' in method 'create'.
Open

        $configuration = Setup::createXMLMetadataConfiguration(
            $config['mapping_dirs'],
            $config['dev_mode'],
            $config['proxy_dir']
        );

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 '\Webmozart\Assert\Assert' in method 'setAddress'.
Open

        Assert::email($address, "{$address} is not a valid email address");

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 '$output'.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int

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 '\Closure' in method 'execute'.
Open

        return $this->session->executeAtomically(Closure::fromCallable($operation));

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 '$platform'.
Open

    public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string

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 '\Doctrine\DBAL\Types\ConversionException' in method 'convertToDatabaseValue'.
Open

        throw ConversionException::conversionFailed((string) $value, Types::GUID);

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 '\Closure' in method 'execute'.
Open

        $this->consumer->consume($this->exchangeName, Closure::fromCallable(function (stdClass $message, string $event): void {
            $this->notify($message, $event);
        }));

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 '\Webmozart\Assert\Assert' in method 'setId'.
Open

        Assert::notEmpty($value);

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 '\Doctrine\DBAL\Types\Type' in method 'create'.
Open

            if (! Type::hasType($type)) {

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 '\Webmozart\Assert\Assert' in method 'setPath'.
Open

        Assert::true($path->isReadable(), '%s is not readable a directory');
Severity: Minor
Found in ewallet/src/Application/BasePath.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 '\Dotenv\Dotenv' in method 'load'.
Open

            $environment = Dotenv::createImmutable($basePath->absolutePath());

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

fromGlobals accesses the super-global variable $_ENV.
Open

    public static function fromGlobals(BasePath $basePath): Environment
    {
        self::load($basePath);
        $name = trim($_ENV['APP_ENV'] ?? 'local');
        $envDebug = trim($_ENV['APP_DEBUG'] ?? 'false');

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

fromGlobals accesses the super-global variable $_ENV.
Open

    public static function fromGlobals(BasePath $basePath): Environment
    {
        self::load($basePath);
        $name = trim($_ENV['APP_ENV'] ?? 'local');
        $envDebug = trim($_ENV['APP_DEBUG'] ?? 'false');

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Avoid using Adapters\RabbitMq\Application\Messaging\count() function in while loops.
Open

        while (count($this->channel->callbacks)) {
            if ($this->consumed) {
                break;
            }
            $this->channel->wait(null, false, $idle = 30); // Only wait 30 seconds

CountInLoopExpression

Since: 2.7.0

Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.

Example

class Foo {

  public function bar()
  {
    $array = array();

    for ($i = 0; count($array); $i++) {
      // ...
    }
  }
}

Source https://phpmd.org/rules/design.html#countinloopexpression

load accesses the super-global variable $_ENV.
Open

    private static function load(BasePath $basePath): void
    {
        if (! isset($_ENV['APP_ENV'])) {
            $environment = Dotenv::createImmutable($basePath->absolutePath());
            $environment->load();

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Only one argument is allowed per line in a multi-line function call
Open

                fn (string $routeName, array $arguments = []): string => $this->urlFor($routeName, $arguments)

Line exceeds 120 characters; contains 127 characters
Open

        $this->consumer->consume($this->exchangeName, Closure::fromCallable(function (stdClass $message, string $event): void {

Space before opening parenthesis of function call prohibited
Open

            new TwigFunction('money_amount', fn (int $amount): string => $this->formatMoneyAmount($amount)),
Severity
Category
Status
Source
Language