phattarachai/thaidate

View on GitHub
src/ThaidateServiceProvider.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class '\Illuminate\Support\Carbon' in method 'boot'.
Open

        Carbon::macro('thaidate', function ($format = 'j F Y') {
            return thaidate($format, $this->timestamp);
        });
Severity: Minor
Found in src/ThaidateServiceProvider.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

Reference to undeclared property \Phattarachai\Thaidate\ThaidateServiceProvider->timestamp
Open

            return thaidate($format, $this->timestamp);
Severity: Minor
Found in src/ThaidateServiceProvider.php by phan

Class extends undeclared class \Carbon\Laravel\ServiceProvider
Open

class ThaidateServiceProvider extends ServiceProvider
Severity: Critical
Found in src/ThaidateServiceProvider.php by phan

Call to method macro from undeclared class \Illuminate\Support\Carbon
Open

        Carbon::macro('thaidate', function ($format = 'j F Y') {
Severity: Critical
Found in src/ThaidateServiceProvider.php by phan

The closing brace for the class must go on the next line after the body
Open

}

There are no issues that match your filters.

Category
Status