---
title: "RuleOverrides – API-Referenz · Quittio"
description: "Changes to the PHP rules by rule code: rules switched off, findings with another severity and rules replaced by own implementations. Codes match exactly or, with a trailing \"*\", by prefix (e.g. \"DE-USTG-*\"). The overrides apply to the PHP rules only; the findings of the XSD schema, KoSIT and veraPDF are never changed."
canonical_url: "https://quittio.dev/docs/api/Quittio/Core/Validation/RuleOverrides"
locale: de
meta:
  "og:description": "Changes to the PHP rules by rule code: rules switched off, findings with another severity and rules replaced by own implementations. Codes match exactly or, with a trailing \"*\", by prefix (e.g. \"DE-USTG-*\"). The overrides apply to the PHP rules only; the findings of the XSD schema, KoSIT and veraPDF are never changed."
  "og:image": "https://quittio.dev/og/quittio-de.jpg"
  "og:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
  "og:image:height": "630"
  "og:image:type": image/jpeg
  "og:image:width": "1200"
  "og:title": "RuleOverrides – API-Referenz · Quittio"
  "twitter:image": "https://quittio.dev/og/quittio-de.jpg"
  "twitter:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
---

> Index of every page on this site: [llms.txt](https://quittio.dev/llms.txt)

[API reference](https://quittio.dev/docs/api) / [Quittio](https://quittio.dev/docs/api/Quittio) \\ [Core](https://quittio.dev/docs/api/Quittio/Core) \\ [Validation](https://quittio.dev/docs/api/Quittio/Core/Validation)

# RuleOverrides

final readonly class in quittio/core

`Quittio\Core\Validation\RuleOverrides` · [Source](https://github.com/Quittio/quittio/blob/v0.7.1/packages/core/src/Validation/RuleOverrides.php#L19)

Changes to the PHP rules by rule code: rules switched off, findings with another severity and rules replaced by own implementations. Codes match exactly or, with a trailing "\*", by prefix (e.g. "DE-USTG-\*"). The overrides apply to the PHP rules only; the findings of the XSD schema, KoSIT and veraPDF are never changed.

The rules of EN 16931 (BR-*) and Peppol (PEPPOL-*) are official: switching them off, changing their severity or replacing them needs $allowOfficial, because an invoice that breaks them is rejected by the receiver.

## Properties \#

| Property | Type | Description |
| --- | --- | --- |
| `$allowOfficial` readonly | `bool` | |
| `$disabled` readonly | `list<string>` | codes or prefixes ending with "\*" whose rules and findings are dropped |
| `$replacements` readonly | `array<string, [Rule](https://quittio.dev/docs/api/Quittio/Core/Validation/Rule)>` | rules that replace the rule with the code of the key |
| `$severities` readonly | `array<string, [Severity](https://quittio.dev/docs/api/Quittio/Core/Validation/Severity)>` | severity of the findings per code or prefix |

## Methods \#

| Method | Description |
| --- | --- |
| `->__construct()` | |
| `->apply()` | The rules without the disabled ones, replaced rules exchanged in place. |
| `->applyToMessages()` | The findings without those of disabled codes, with the configured severities. Rules may report other codes than their own (e.g. QUITTIO-PROFILE-REQUIRED), so the findings are filtered as well. |
| `::fromArray()` | From the configuration keys disabled (list of codes), severity (code => error, warning or info) and allow\_official. |
| `->isDisabled()` | Whether findings with this code are dropped. |
| `->isEmpty()` | Whether nothing is disabled, re-rated or replaced. |
| `::matches()` | Whether a pattern matches a code: exactly, or by prefix with a trailing "\*". |
| `->merge()` | These overrides with those of $other on top: $other wins for the same code. |
| `->patterns()` | Every pattern of these overrides, e.g. to check them against the known rule codes. |

### `__construct()`#

```
public function __construct(
    list<string> $disabled = [],
    array<string, Severity> $severities = [],
    array<string, Rule> $replacements = [],
    bool $allowOfficial = false,
)
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$disabled` | `list<string>` = `[]` | codes or prefixes ending with "\*" whose rules and findings are dropped |
| `$severities` | `array<string, [Severity](https://quittio.dev/docs/api/Quittio/Core/Validation/Severity)>` = `[]` | severity of the findings per code or prefix |
| `$replacements` | `array<string, [Rule](https://quittio.dev/docs/api/Quittio/Core/Validation/Rule)>` = `[]` | rules that replace the rule with the code of the key |
| `$allowOfficial` | `bool` = `false` | |

<dl><dt>Throws</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Exceptions/ConfigurationException">ConfigurationException</a></code> – when an official rule is changed without $allowOfficial or a pattern is empty</dd></dl>

### `apply()`#

```
public function apply(list<Rule> $rules): list<Rule>
```

The rules without the disabled ones, replaced rules exchanged in place.

| Parameter | Type | Description |
| --- | --- | --- |
| `$rules` | `list< [Rule](https://quittio.dev/docs/api/Quittio/Core/Validation/Rule)>` | |

<dl><dt>Returns</dt>
<dd><code>list&lt;<a href="https://quittio.dev/docs/api/Quittio/Core/Validation/Rule">Rule</a>&gt;</code></dd>
</dl>

### `applyToMessages()`#

```
public function applyToMessages(
    list<ValidationMessage> $messages,
): list<ValidationMessage>
```

The findings without those of disabled codes, with the configured severities. Rules may report other codes than their own (e.g. QUITTIO-PROFILE-REQUIRED), so the findings are filtered as well.

| Parameter | Type | Description |
| --- | --- | --- |
| `$messages` | `list< [ValidationMessage](https://quittio.dev/docs/api/Quittio/Core/Validation/ValidationMessage)>` | |

<dl><dt>Returns</dt>
<dd><code>list&lt;<a href="https://quittio.dev/docs/api/Quittio/Core/Validation/ValidationMessage">ValidationMessage</a>&gt;</code></dd>
</dl>

### `fromArray()`#

```
public static function fromArray(array<array-key, mixed> $config): self
```

static

From the configuration keys disabled (list of codes), severity (code => error, warning or info) and allow\_official.

| Parameter | Type | Description |
| --- | --- | --- |
| `$config` | `array<array-key, mixed>` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
<dt>Throws</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Exceptions/ConfigurationException">ConfigurationException</a></code> – for an unknown severity or an official rule without allow_official</dd></dl>

### `isDisabled()`#

```
public function isDisabled(string $code): bool
```

Whether findings with this code are dropped.

| Parameter | Type | Description |
| --- | --- | --- |
| `$code` | `string` | |

<dl><dt>Returns</dt>
<dd><code>bool</code></dd>
</dl>

### `isEmpty()`#

```
public function isEmpty(): bool
```

Whether nothing is disabled, re-rated or replaced.

<dl><dt>Returns</dt>
<dd><code>bool</code></dd>
</dl>

### `matches()`#

```
public static function matches(string $pattern, string $code): bool
```

static

Whether a pattern matches a code: exactly, or by prefix with a trailing "\*".

| Parameter | Type | Description |
| --- | --- | --- |
| `$pattern` | `string` | |
| `$code` | `string` | |

<dl><dt>Returns</dt>
<dd><code>bool</code></dd>
</dl>

### `merge()`#

```
public function merge(self $other): self
```

These overrides with those of $other on top: $other wins for the same code.

| Parameter | Type | Description |
| --- | --- | --- |
| `$other` | `self` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `patterns()`#

```
public function patterns(): list<string>
```

Every pattern of these overrides, e.g. to check them against the known rule codes.

<dl><dt>Returns</dt>
<dd><code>list&lt;string&gt;</code></dd>
</dl>

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://quittio.dev/#website","@type":"WebSite","description":"E-Rechnungen für PHP und Laravel: ZUGFeRD, XRechnung und Peppol erstellen, prüfen, lesen und archivieren.","inLanguage":"de-DE","name":"Quittio","url":"https://quittio.dev/","publisher":{"@id":"https://quittio.dev/#identity"},"workTranslation":{"@id":"https://quittio.dev/en#website"}},{"@id":"https://quittio.dev/docs/api/Quittio/Core/Validation/RuleOverrides#webpage","@type":"WebPage","description":"Changes to the PHP rules by rule code: rules switched off, findings with another severity and rules replaced by own implementations. Codes match exactly or, with a trailing \"*\", by prefix (e.g. \"DE-USTG-*\"). The overrides apply to the PHP rules only; the findings of the XSD schema, KoSIT and veraPDF are never changed.","name":"RuleOverrides – API-Referenz","url":"https://quittio.dev/docs/api/Quittio/Core/Validation/RuleOverrides","isPartOf":{"@id":"https://quittio.dev/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://quittio.dev/docs/api/Quittio/Core/Validation/RuleOverrides"]}],"primaryImageOfPage":{"@id":"https://quittio.dev/#logo"}},{"@id":"https://quittio.dev/#identity","@type":"Organization","description":"Open-Source-Bibliothek für E-Rechnungen in PHP und Laravel (ZUGFeRD, XRechnung, Peppol) und Quittio Managed.","email":"kontakt@niklasforst.de","legalName":"Niklas Forst – Softwareentwicklung","name":"Quittio","url":"https://quittio.dev","founder":{"@type":"Person","name":"Niklas Forst","url":"https://quittio.dev/ueber"},"logo":{"@id":"https://quittio.dev/#logo"},"sameAs":["https://github.com/Quittio/quittio","https://packagist.org/packages/quittio/quittio"]},{"@id":"https://quittio.dev/#logo","@type":"ImageObject","caption":"Quittio","contentUrl":"https://quittio.dev/logo.png","inLanguage":"de-DE","url":"https://quittio.dev/logo.png"}]}
```