v1.1.1
This commit is contained in:
parent
92d56fe84d
commit
7dd3eeaa8a
97 changed files with 4912 additions and 1581 deletions
32
vendor/nette/schema/src/Schema/Message.php
vendored
32
vendor/nette/schema/src/Schema/Message.php
vendored
|
|
@ -1,16 +1,13 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of the Nette Framework (https://nette.org)
|
||||
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Nette\Schema;
|
||||
|
||||
use Nette;
|
||||
use function implode, preg_last_error_msg, preg_replace_callback;
|
||||
use function implode, preg_replace_callback;
|
||||
|
||||
|
||||
final class Message
|
||||
|
|
@ -63,22 +60,15 @@ final class Message
|
|||
/** @deprecated use Message::Deprecated */
|
||||
public const DEPRECATED = self::Deprecated;
|
||||
|
||||
public string $message;
|
||||
public string $code;
|
||||
|
||||
/** @var string[] */
|
||||
public array $path;
|
||||
|
||||
/** @var string[] */
|
||||
public array $variables;
|
||||
|
||||
|
||||
public function __construct(string $message, string $code, array $path, array $variables = [])
|
||||
{
|
||||
$this->message = $message;
|
||||
$this->code = $code;
|
||||
$this->path = $path;
|
||||
$this->variables = $variables;
|
||||
public function __construct(
|
||||
public string $message,
|
||||
public string $code,
|
||||
/** @var list<int|string> */
|
||||
public array $path,
|
||||
/** @var array<string, mixed> */
|
||||
public array $variables = [],
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -94,6 +84,6 @@ final class Message
|
|||
return preg_replace_callback('~( ?)%(\w+)%~', function ($m) use ($vars) {
|
||||
[, $space, $key] = $m;
|
||||
return $vars[$key] === null ? '' : $space . $vars[$key];
|
||||
}, $this->message) ?? throw new Nette\InvalidStateException(preg_last_error_msg());
|
||||
}, $this->message);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue