for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace A17\Twill\Helpers;
use A17\Twill\Models\Block;
use Illuminate\Support\Str;
abstract class TwillBlock
{
/**
* @var array
*
* The validation rules for this block.
*/
protected $rules = [];
protected $rulesForTranslatedFields = [];
public function __construct()
}
public function getData(Block $block, array $data): array
$block
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function getData(/** @scrutinizer ignore-unused */ Block $block, array $data): array
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return $data;
public function getRules(): array
return $this->rules;
public function getRulesForTranslatedFields(): array
return $this->rulesForTranslatedFields;
public static function getBlockClassForName(string $name): ?TwillBlock
$transformed = Str::studly($name) . 'Block';
$className = "\App\Twill\Block\\$transformed";
if (class_exists($className)) {
return new $className();
return null;
public static function getBlockClassForView(string $view): ?TwillBlock
$exploded = explode('.', $view);
return self::getBlockClassForName(array_pop($exploded));
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.