public function aliasDefinition($definition): self
    {
        if (is_object($definition)) {
            $definition = (array) $definition;
        }
        if (!is_array($definition)) {
            throw new \InvalidArgumentException("Invalid alias definition: must be an object or an associative array");
        }
        if (!isset($definition['name']) || !isset($definition['rules'])) {
            throw new \InvalidArgumentException("Invalid alias definition: must have 'name' and 'rules' fields");
        }
        return $this->alias($definition['name'], $definition['rules'], $definition['error'] ?? null);
    }
public function aliasDefinition($definition): self
    {
        if (is_object($definition)) {
            $definition = (array) $definition;
        }
        if (!is_array($definition)) {
            throw new \InvalidArgumentException("Invalid alias definition: must be an object or an associative array");
        }
        if (!isset($definition['name']) || !isset($definition['rules'])) {
            throw new \InvalidArgumentException("Invalid alias definition: must have 'name' and 'rules' fields");
        }
        return $this->alias($definition['name'], $definition['rules'], $definition['error'] ?? null);
    }
public function aliasDefinition ( $ definition ) : self { if ( is_object ( $ definition ) ) { $ definition = ( array ) $ definition ; } if ( ! is_array ( $ definition ) ) { throw new \ InvalidArgumentException ( "Invalid alias definition: must be an object or an associative array" ) ; } if ( ! isset ( $ definition [ 'name' ] ) || ! isset ( $ definition [ 'rules' ] ) ) { throw new \ InvalidArgumentException ( "Invalid alias definition: must have 'name' and 'rules' fields" ) ; } return $ this -> alias ( $ definition [ 'name' ] , $ definition [ 'rules' ] , $ definition [ 'error' ] ?? null ) ; }
Registers an alias for a ruleset, using a LIVR-compliant definition.

```javascript
// alias.json
{
"name": "valid_address",
"rules": { "nested_object": {
"country": "required",
"city": "required",
"zip": "positive_integer"
}},
error: "WRONG_ADDRESS"
}
```
```php
$registry->aliasDefinition(json_decode(file_get_contents('alias.json')));
```

@param array|object $definition The rule definition
@return $this provides a fluent interface
@throws \InvalidArgumentException if the definition is invalid
Registers an alias for a ruleset using a LIVR - compliant definition .