for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Larapie\Actions\Concerns;
use Larapie\Actions\Attribute;
trait ResolveDefaults
{
public function default()
return [];
}
protected function resolveDefaults()
return array_merge($this->resolveClassDefaults(), $this->resolveAttributeDefaults());
protected function resolveClassDefaults()
return $this->default();
protected function resolveAttributeDefaults()
$defaults = collect($this->rules())
rules()
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
$defaults = collect($this->/** @scrutinizer ignore-call */ rules())
->filter(function ($rule, $key) {
$key
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
->filter(function ($rule, /** @scrutinizer ignore-unused */ $key) {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return $rule instanceof Attribute && $rule->hasDefault();
})
->map(function (Attribute $attribute) {
return $attribute->getDefault();
->toArray();
return $defaults;