for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace BiiiiiigMonster\LaravelEnum\Rules;
use BiiiiiigMonster\LaravelEnum\EnumServiceProvider;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class Enum implements ValidationRule
{
public function __construct(protected string $enum)
}
public function passes(string $attribute, mixed $value): bool
$attribute
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function passes(/** @scrutinizer ignore-unused */ string $attribute, mixed $value): bool
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
if (! enum_exists($this->enum)) {
enum_exists
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
if (! /** @scrutinizer ignore-call */ enum_exists($this->enum)) {
return false;
if ($value instanceof $this->enum) {
return true;
if (! method_exists($this->enum, 'tryFrom')) {
return ! is_null($this->enum::tryFrom($value));
public function validate(string $attribute, mixed $value, Closure $fail): void
if (! $this->passes($attribute, $value)) {
$fail(EnumServiceProvider::LANG_NAMESPACE.'::validations.enumerate')->translate();
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.