Showing 151 of 151 total issues
Saw an @param annotation for format,
but the param list of function getDateFormat() : void
is empty Open
* @param string $format
- Exclude checks
Class implements undeclared interface \Illuminate\Contracts\Support\DeferrableProvider
Open
class FeedServiceProvider extends ServiceProvider implements DeferrableProvider
- Exclude checks
Rename "$view" which has the same name as the field declared at line 55. Open
$view = $this->customView;
- Read upRead up
- Exclude checks
Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.
Noncompliant Code Example
class Foo { public $myField; public function doSomething() { $myField = 0; ... } }
See
- CERT, DCL51-J. - Do not shadow or obscure identifiers in subscopes
Call to method put
from undeclared class \Illuminate\Contracts\Cache\Repository
Open
$this->cache->put($this->cacheKey, $this->view->make($view, $viewData)->render(), $this->caching);
- Exclude checks
Saw an @param annotation for a,
but it was not found in the param list of function addItem(array $item) : void
Open
* @param array $a
- Exclude checks
Call to undeclared function \request()
Open
$rssLink = (!empty($this->domain)) ? sprintf('%s/%s', rtrim($this->domain, '/'), ltrim(request()->path(), '/')) : request()->url();
- Exclude checks
Call to undeclared method \Laravelium\Feed\FeedServiceProvider::publishes
Open
$this->publishes([
- Exclude checks
Call to undeclared function \base_path()
Open
__DIR__ . '/../../views' => base_path('resources/views/vendor/feed')
- Exclude checks
Suspicious array access to \Illuminate\Contracts\Container\Container
Open
'files' => $app['files'],
- Exclude checks
Refactor this function to reduce its Cognitive Complexity from 21 to the 15 allowed. Open
public function render($format = null, $cache = null, $key = null)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Define a constant instead of duplicating this literal "title" 4 times. Open
if (isset($item['title'])) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to method get
from undeclared class \Illuminate\Contracts\Config\Repository
Open
$this->lang = $this->configRepository->get('application.language');
- Exclude checks
Call to method toDateTimeString
on non-class type string
Open
$date = ('atom' == $format) ? date('c', strtotime($date->toDateTimeString())) : date('D, d M Y H:i:s O', strtotime($date->toDateTimeString()));
- Exclude checks
Call to undeclared method \Laravelium\Feed\FeedServiceProvider::loadViewsFrom
Open
$this->loadViewsFrom(__DIR__ . '/../../views', 'feed');
- Exclude checks
Reference to constant class
from undeclared class \Illuminate\Contracts\Routing\ResponseFactory
Open
'response' => $app[ResponseFactory::class],
- Exclude checks
Call to method has
from undeclared class \Illuminate\Contracts\Cache\Repository
Open
if ($this->cache->has($this->cacheKey)) {
- Exclude checks
Suspicious array access to \Illuminate\Contracts\Container\Container
Open
'view' => $app['view']
- Exclude checks
Define a constant instead of duplicating this literal "Content-Type" 3 times. Open
return $this->response->make($this->cache->get($this->cacheKey), 200, ['Content-Type' => $this->cache->get($this->cacheKey."_ctype").'; charset='.$this->charset]);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to method get
from undeclared class \Illuminate\Contracts\Cache\Repository
Open
return $this->response->make($this->cache->get($this->cacheKey), 200, ['Content-Type' => $this->cache->get($this->cacheKey."_ctype").'; charset='.$this->charset]);
- Exclude checks
Call to method make
from undeclared class \Illuminate\Contracts\View\Factory
Open
$this->cache->put($this->cacheKey, $this->view->make($view, $viewData)->render(), $this->caching);
- Exclude checks