src/ThaidateServiceProvider.php
Avoid using static access to class '\Illuminate\Support\Carbon' in method 'boot'. Open
Open
Carbon::macro('thaidate', function ($format = 'j F Y') {
return thaidate($format, $this->timestamp);
});
- Read upRead up
- Exclude checks
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
Open
return thaidate($format, $this->timestamp);
- Exclude checks
Class extends undeclared class \Carbon\Laravel\ServiceProvider
Open
Open
class ThaidateServiceProvider extends ServiceProvider
- Exclude checks
Call to method macro
from undeclared class \Illuminate\Support\Carbon
Open
Open
Carbon::macro('thaidate', function ($format = 'j F Y') {
- Exclude checks
The closing brace for the class must go on the next line after the body Open
Open
}
- Exclude checks