Skip to content

Commit 6209fc3

Browse files
committed
nette/schema 1.3.1
1 parent bdde973 commit 6209fc3

17 files changed

+527
-0
lines changed

schema/bg/@home.texy

+31
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
241241
// ОК, връща {'optional' => null, 'nullable' => null}
242242
```
243243

244+
Масивът от всички свойства на структурата се връща от метода `getShape()`.
245+
244246
По подразбиране във входните данни не може да има допълнителни елементи:
245247

246248
```php
@@ -263,6 +265,35 @@ $processor->process($schema, ['additional' => 1]); // OK
263265
$processor->process($schema, ['additional' => true]); // ОШИБКА
264266
```
265267

268+
Можете да създадете нова структура, като я извлечете от друга с помощта на `extend()`:
269+
270+
```php
271+
$dog = Expect::structure([
272+
'name' => Expect::string(),
273+
'age' => Expect::int(),
274+
]);
275+
276+
$dogWithBreed = $dog->extend([
277+
'breed' => Expect::string(),
278+
]);
279+
```
280+
281+
282+
Кортежи .[#toc-tuples]
283+
----------------------
284+
285+
Tuples са индексирани масиви, които имат фиксиран брой елементи и всеки елемент може да бъде от различен тип:
286+
287+
```php
288+
$schema = Expect::tuple([
289+
Expect::int(),
290+
Expect::string(),
291+
Expect::bool(),
292+
]);
293+
294+
$processor->process($schema, [1, 'hello', true]); // OK
295+
```
296+
266297

267298
Остарели елементи .[#toc-ustarevsie-elementy]
268299
---------------------------------------------

schema/cs/@home.texy

+31
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
241241
// OK, vrací {'optional' => null, 'nullable' => null}
242242
```
243243

244+
Pole všech vlastností struktury vrací metoda `getShape()`.
245+
244246
Ve výchozím nastavení nemohou být ve vstupních datech žádné položky navíc:
245247

246248
```php
@@ -263,6 +265,35 @@ $processor->process($schema, ['additional' => 1]); // OK
263265
$processor->process($schema, ['additional' => true]); // CHYBA
264266
```
265267

268+
Novou strukturu můžete vytvořit odvozením od jiné pomocí `extend()`:
269+
270+
```php
271+
$dog = Expect::structure([
272+
'name' => Expect::string(),
273+
'age' => Expect::int(),
274+
]);
275+
276+
$dogWithBreed = $dog->extend([
277+
'breed' => Expect::string(),
278+
]);
279+
```
280+
281+
282+
Tuples .{data-version:1.3.1}
283+
----------------------------
284+
285+
Tuples jsou indexované pole, které mají pevný počet prvků a každý prvek může mít jiný typ:
286+
287+
```php
288+
$schema = Expect::tuple([
289+
Expect::int(),
290+
Expect::string(),
291+
Expect::bool(),
292+
]);
293+
294+
$processor->process($schema, [1, 'hello', true]); // OK
295+
```
296+
266297

267298
Zastaralé vlastnosti
268299
--------------------

schema/de/@home.texy

+31
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
241241
// OK, liefert {'optional' => null, 'nullable' => null}
242242
```
243243

244+
Das Array mit allen Struktureigenschaften wird von der Methode `getShape()` zurückgegeben.
245+
244246
Standardmäßig können keine zusätzlichen Elemente in den Eingabedaten enthalten sein:
245247

246248
```php
@@ -263,6 +265,35 @@ $processor->process($schema, ['additional' => 1]); // OK
263265
$processor->process($schema, ['additional' => true]); // ERROR
264266
```
265267

268+
Sie können eine neue Struktur erstellen, indem Sie mit `extend()` von einer anderen ableiten:
269+
270+
```php
271+
$dog = Expect::structure([
272+
'name' => Expect::string(),
273+
'age' => Expect::int(),
274+
]);
275+
276+
$dogWithBreed = $dog->extend([
277+
'breed' => Expect::string(),
278+
]);
279+
```
280+
281+
282+
Tupel .[#toc-tuples]
283+
--------------------
284+
285+
Tupel sind indizierte Arrays mit einer festen Anzahl von Elementen, wobei jedes Element einen anderen Typ haben kann:
286+
287+
```php
288+
$schema = Expect::tuple([
289+
Expect::int(),
290+
Expect::string(),
291+
Expect::bool(),
292+
]);
293+
294+
$processor->process($schema, [1, 'hello', true]); // OK
295+
```
296+
266297

267298
Verwerfungen .[#toc-deprecations]
268299
---------------------------------

schema/el/@home.texy

+31
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
241241
// OK, επιστρέφει {'optional' => null, 'nullable' => null}
242242
```
243243

244+
Ο πίνακας όλων των ιδιοτήτων της δομής επιστρέφεται από τη μέθοδο `getShape()`.
245+
244246
Από προεπιλογή, δεν μπορούν να υπάρχουν επιπλέον στοιχεία στα δεδομένα εισόδου:
245247

246248
```php
@@ -263,6 +265,35 @@ $processor->process($schema, ['additional' => 1]); // OK
263265
$processor->process($schema, ['additional' => true]); // ΣΦΑΛΜΑ
264266
```
265267

268+
Μπορείτε να δημιουργήσετε μια νέα δομή παράγοντας από μια άλλη χρησιμοποιώντας το `extend()`:
269+
270+
```php
271+
$dog = Expect::structure([
272+
'name' => Expect::string(),
273+
'age' => Expect::int(),
274+
]);
275+
276+
$dogWithBreed = $dog->extend([
277+
'breed' => Expect::string(),
278+
]);
279+
```
280+
281+
282+
Tuples .[#toc-tuples]
283+
---------------------
284+
285+
Οι ταπλέτες είναι πίνακες με ευρετήριο που έχουν σταθερό αριθμό στοιχείων και κάθε στοιχείο μπορεί να έχει διαφορετικό τύπο:
286+
287+
```php
288+
$schema = Expect::tuple([
289+
Expect::int(),
290+
Expect::string(),
291+
Expect::bool(),
292+
]);
293+
294+
$processor->process($schema, [1, 'hello', true]); // OK
295+
```
296+
266297

267298
Αποσβέσεις .[#toc-deprecations]
268299
-------------------------------

schema/en/@home.texy

+31
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
241241
// OK, returns {'optional' => null, 'nullable' => null}
242242
```
243243

244+
The array of all structure properties is returned by the `getShape()` method.
245+
244246
By default, there can be no extra items in the input data:
245247

246248
```php
@@ -263,6 +265,35 @@ $processor->process($schema, ['additional' => 1]); // OK
263265
$processor->process($schema, ['additional' => true]); // ERROR
264266
```
265267

268+
You can create a new structure by deriving from another using `extend()`:
269+
270+
```php
271+
$dog = Expect::structure([
272+
'name' => Expect::string(),
273+
'age' => Expect::int(),
274+
]);
275+
276+
$dogWithBreed = $dog->extend([
277+
'breed' => Expect::string(),
278+
]);
279+
```
280+
281+
282+
Tuples .{data-version:1.3.1}
283+
----------------------------
284+
285+
Tuples are indexed arrays that have a fixed number of elements and each element can have a different type:
286+
287+
```php
288+
$schema = Expect::tuple([
289+
Expect::int(),
290+
Expect::string(),
291+
Expect::bool(),
292+
]);
293+
294+
$processor->process($schema, [1, 'hello', true]); // OK
295+
```
296+
266297

267298
Deprecations
268299
------------

schema/es/@home.texy

+31
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
241241
// OK, devuelve {'optional' => null, 'nullable' => null}
242242
```
243243

244+
El array de todas las propiedades de la estructura es devuelto por el método `getShape()`.
245+
244246
Por defecto, no puede haber elementos adicionales en los datos de entrada:
245247

246248
```php
@@ -263,6 +265,35 @@ $processor->process($schema, ['additional' => 1]); // OK
263265
$processor->process($schema, ['additional' => true]); // ERROR
264266
```
265267

268+
Puede crear una nueva estructura derivando de otra mediante `extend()`:
269+
270+
```php
271+
$dog = Expect::structure([
272+
'name' => Expect::string(),
273+
'age' => Expect::int(),
274+
]);
275+
276+
$dogWithBreed = $dog->extend([
277+
'breed' => Expect::string(),
278+
]);
279+
```
280+
281+
282+
Tuplas .[#toc-tuples]
283+
---------------------
284+
285+
Las tuplas son matrices indexadas que tienen un número fijo de elementos y cada elemento puede tener un tipo diferente:
286+
287+
```php
288+
$schema = Expect::tuple([
289+
Expect::int(),
290+
Expect::string(),
291+
Expect::bool(),
292+
]);
293+
294+
$processor->process($schema, [1, 'hello', true]); // OK
295+
```
296+
266297

267298
Depreciaciones .[#toc-deprecations]
268299
-----------------------------------

schema/fr/@home.texy

+31
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
241241
// OK, retourne {'optional' => null, 'nullable' => null}.
242242
```
243243

244+
Le tableau de toutes les propriétés de la structure est renvoyé par la méthode `getShape()`.
245+
244246
Par défaut, il ne peut y avoir aucun élément supplémentaire dans les données d'entrée :
245247

246248
```php
@@ -263,6 +265,35 @@ $processor->process($schema, ['additional' => 1]); // OK
263265
$processor->process($schema, ['additional' => true]); // ERREUR
264266
```
265267

268+
Vous pouvez créer une nouvelle structure en dérivant d'une autre à l'aide de `extend()`:
269+
270+
```php
271+
$dog = Expect::structure([
272+
'name' => Expect::string(),
273+
'age' => Expect::int(),
274+
]);
275+
276+
$dogWithBreed = $dog->extend([
277+
'breed' => Expect::string(),
278+
]);
279+
```
280+
281+
282+
Tuples .[#toc-tuples]
283+
---------------------
284+
285+
Les tuples sont des tableaux indexés qui ont un nombre fixe d'éléments et chaque élément peut avoir un type différent :
286+
287+
```php
288+
$schema = Expect::tuple([
289+
Expect::int(),
290+
Expect::string(),
291+
Expect::bool(),
292+
]);
293+
294+
$processor->process($schema, [1, 'hello', true]); // OK
295+
```
296+
266297

267298
Dépréciations .[#toc-deprecations]
268299
----------------------------------

schema/hu/@home.texy

+31
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
241241
// OK, visszatér {'optional' => null, 'nullable' => null}
242242
```
243243

244+
A `getShape()` módszer a struktúra összes tulajdonságát tartalmazó tömböt adja vissza.
245+
244246
Alapértelmezés szerint a bemeneti adatokban nem lehetnek extra elemek:
245247

246248
```php
@@ -263,6 +265,35 @@ $processor->process($schema, ['additional' => 1]); // OK
263265
$processor->process($schema, ['additional' => true]); // HIBA
264266
```
265267

268+
Új struktúrát hozhat létre egy másik struktúrából származtatva a `extend()` segítségével:
269+
270+
```php
271+
$dog = Expect::structure([
272+
'name' => Expect::string(),
273+
'age' => Expect::int(),
274+
]);
275+
276+
$dogWithBreed = $dog->extend([
277+
'breed' => Expect::string(),
278+
]);
279+
```
280+
281+
282+
Tuples .[#toc-tuples]
283+
---------------------
284+
285+
A Tuple-ek indexelt tömbök, amelyek fix számú elemmel rendelkeznek, és minden elem különböző típusú lehet:
286+
287+
```php
288+
$schema = Expect::tuple([
289+
Expect::int(),
290+
Expect::string(),
291+
Expect::bool(),
292+
]);
293+
294+
$processor->process($schema, [1, 'hello', true]); // OK
295+
```
296+
266297

267298
Deprecations .[#toc-deprecations]
268299
---------------------------------

0 commit comments

Comments
 (0)