src/TranslatableTrait.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class 'Atk4\Core\TraitUtil' in method '_'.
Open

        if (TraitUtil::hasAppScopeTrait($this) && $this->issetApp() && method_exists($this->getApp(), '_')) {
Severity: Minor
Found in src/TranslatableTrait.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 short method names like TranslatableTrait::_(). The configured minimum method name length is 3.
Open

    public function _(string $message, array $parameters = [], ?string $domain = null, ?string $locale = null): string
    {
        if (TraitUtil::hasAppScopeTrait($this) && $this->issetApp() && method_exists($this->getApp(), '_')) {
            return $this->getApp()->_($message, $parameters, $domain, $locale);
        }
Severity: Minor
Found in src/TranslatableTrait.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

The method _ is not named in camelCase.
Open

    public function _(string $message, array $parameters = [], ?string $domain = null, ?string $locale = null): string
    {
        if (TraitUtil::hasAppScopeTrait($this) && $this->issetApp() && method_exists($this->getApp(), '_')) {
            return $this->getApp()->_($message, $parameters, $domain, $locale);
        }
Severity: Minor
Found in src/TranslatableTrait.php by phpmd

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

There are no issues that match your filters.

Category
Status