Migrate to modular strict rules v2.2.0

This commit is contained in:
Enes Yakıştır
2026-05-13 12:13:32 +03:00
parent 4e1eda888a
commit 30c981eb68
7 changed files with 154 additions and 50 deletions
+10 -7
View File
@@ -2,23 +2,26 @@
namespace YakNet\AccessibilityConsole\Core;
use YakNet\AccessibilityConsole\Rules\RuleInterface;
class RuleEngine
{
/** @var RuleInterface[] */
/** @var AbstractRule[] */
private array $rules = [];
public function addRule(RuleInterface $rule): void
public function addRule(AbstractRule $rule): void
{
$this->rules[] = $rule;
}
/**
* @return RuleInterface[]
* @return Violation[]
*/
public function getRules(): array
public function run(\DOMDocument $doc): array
{
return $this->rules;
$allViolations = [];
foreach ($this->rules as $rule) {
$violations = $rule->check($doc);
$allViolations = array_merge($allViolations, $violations);
}
return $allViolations;
}
}