for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace BrenoRoosevelt\Validation\Rules;
use Attribute;
use BrenoRoosevelt\Validation\AbstractRule;
#[Attribute(Attribute::TARGET_PROPERTY|Attribute::TARGET_METHOD)]
class IsEmpty extends AbstractRule
{
protected function evaluate($input, array $context = []): bool
if (is_array($input) && empty($input)) {
return true;
}
if (is_iterable($input) && iterator_count($input) === 0) {
if (is_string($input) && mb_strlen(trim($input)) === 0) {
return false;