Skip to content

Commit

Permalink
nette/schema 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Oct 5, 2024
1 parent bdde973 commit 9803f87
Show file tree
Hide file tree
Showing 17 changed files with 527 additions and 0 deletions.
31 changes: 31 additions & 0 deletions schema/bg/@home.texy
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
// ОК, връща {'optional' => null, 'nullable' => null}
```

Масивът от всички свойства на структурата се връща от метода `getShape()`.

По подразбиране във входните данни не може да има допълнителни елементи:

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

Можете да създадете нова структура, като я извлечете от друга с помощта на `extend()`:

```php
$dog = Expect::structure([
'name' => Expect::string(),
'age' => Expect::int(),
]);

$dogWithBreed = $dog->extend([
'breed': Expect::string(),
]);
```


Кортежи .[#toc-tuples]
----------------------

Tuples са индексирани масиви, които имат фиксиран брой елементи и всеки елемент може да бъде от различен тип:

```php
$schema = Expect::tuple([
Expect::int(),
Expect::string(),
Expect::bool(),
]);

$processor->process($schema, [1, 'hello', true]); // OK
```


Остарели елементи .[#toc-ustarevsie-elementy]
---------------------------------------------
Expand Down
31 changes: 31 additions & 0 deletions schema/cs/@home.texy
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
// OK, vrací {'optional' => null, 'nullable' => null}
```

Pole všech vlastností struktury vrací metoda `getShape()`.

Ve výchozím nastavení nemohou být ve vstupních datech žádné položky navíc:

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

Novou strukturu můžete vytvořit odvozením od jiné pomocí `extend()`:

```php
$dog = Expect::structure([
'name' => Expect::string(),
'age' => Expect::int(),
]);

$dogWithBreed = $dog->extend([
'breed': Expect::string(),
]);
```


Tuples .{data-version:1.3.1}
----------------------------

Tuples jsou indexované pole, které mají pevný počet prvků a každý prvek může mít jiný typ:

```php
$schema = Expect::tuple([
Expect::int(),
Expect::string(),
Expect::bool(),
]);

$processor->process($schema, [1, 'hello', true]); // OK
```


Zastaralé vlastnosti
--------------------
Expand Down
31 changes: 31 additions & 0 deletions schema/de/@home.texy
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
// OK, liefert {'optional' => null, 'nullable' => null}
```

Das Array mit allen Struktureigenschaften wird von der Methode `getShape()` zurückgegeben.

Standardmäßig können keine zusätzlichen Elemente in den Eingabedaten enthalten sein:

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

Sie können eine neue Struktur erstellen, indem Sie mit `extend()` von einer anderen ableiten:

```php
$dog = Expect::structure([
'name' => Expect::string(),
'age' => Expect::int(),
]);

$dogWithBreed = $dog->extend([
'breed': Expect::string(),
]);
```


Tupel .[#toc-tuples]
--------------------

Tupel sind indizierte Arrays mit einer festen Anzahl von Elementen, wobei jedes Element einen anderen Typ haben kann:

```php
$schema = Expect::tuple([
Expect::int(),
Expect::string(),
Expect::bool(),
]);

$processor->process($schema, [1, 'hello', true]); // OK
```


Verwerfungen .[#toc-deprecations]
---------------------------------
Expand Down
31 changes: 31 additions & 0 deletions schema/el/@home.texy
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
// OK, επιστρέφει {'optional' => null, 'nullable' => null}
```

Ο πίνακας όλων των ιδιοτήτων της δομής επιστρέφεται από τη μέθοδο `getShape()`.

Από προεπιλογή, δεν μπορούν να υπάρχουν επιπλέον στοιχεία στα δεδομένα εισόδου:

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

Μπορείτε να δημιουργήσετε μια νέα δομή παράγοντας από μια άλλη χρησιμοποιώντας το `extend()`:

```php
$dog = Expect::structure([
'name' => Expect::string(),
'age' => Expect::int(),
]);

$dogWithBreed = $dog->extend([
'breed': Expect::string(),
]);
```


Tuples .[#toc-tuples]
---------------------

Οι ταπλέτες είναι πίνακες με ευρετήριο που έχουν σταθερό αριθμό στοιχείων και κάθε στοιχείο μπορεί να έχει διαφορετικό τύπο:

```php
$schema = Expect::tuple([
Expect::int(),
Expect::string(),
Expect::bool(),
]);

$processor->process($schema, [1, 'hello', true]); // OK
```


Αποσβέσεις .[#toc-deprecations]
-------------------------------
Expand Down
31 changes: 31 additions & 0 deletions schema/en/@home.texy
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
// OK, returns {'optional' => null, 'nullable' => null}
```

The array of all structure properties is returned by the `getShape()` method.

By default, there can be no extra items in the input data:

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

You can create a new structure by deriving from another using `extend()`:

```php
$dog = Expect::structure([
'name' => Expect::string(),
'age' => Expect::int(),
]);

$dogWithBreed = $dog->extend([
'breed': Expect::string(),
]);
```


Tuples .{data-version:1.3.1}
----------------------------

Tuples are indexed arrays that have a fixed number of elements and each element can have a different type:

```php
$schema = Expect::tuple([
Expect::int(),
Expect::string(),
Expect::bool(),
]);

$processor->process($schema, [1, 'hello', true]); // OK
```


Deprecations
------------
Expand Down
31 changes: 31 additions & 0 deletions schema/es/@home.texy
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
// OK, devuelve {'optional' => null, 'nullable' => null}
```

El array de todas las propiedades de la estructura es devuelto por el método `getShape()`.

Por defecto, no puede haber elementos adicionales en los datos de entrada:

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

Puede crear una nueva estructura derivando de otra mediante `extend()`:

```php
$dog = Expect::structure([
'name' => Expect::string(),
'age' => Expect::int(),
]);

$dogWithBreed = $dog->extend([
'breed': Expect::string(),
]);
```


Tuplas .[#toc-tuples]
---------------------

Las tuplas son matrices indexadas que tienen un número fijo de elementos y cada elemento puede tener un tipo diferente:

```php
$schema = Expect::tuple([
Expect::int(),
Expect::string(),
Expect::bool(),
]);

$processor->process($schema, [1, 'hello', true]); // OK
```


Depreciaciones .[#toc-deprecations]
-----------------------------------
Expand Down
31 changes: 31 additions & 0 deletions schema/fr/@home.texy
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
// OK, retourne {'optional' => null, 'nullable' => null}.
```

Le tableau de toutes les propriétés de la structure est renvoyé par la méthode `getShape()`.

Par défaut, il ne peut y avoir aucun élément supplémentaire dans les données d'entrée :

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

Vous pouvez créer une nouvelle structure en dérivant d'une autre à l'aide de `extend()`:

```php
$dog = Expect::structure([
'name' => Expect::string(),
'age' => Expect::int(),
]);

$dogWithBreed = $dog->extend([
'breed': Expect::string(),
]);
```


Tuples .[#toc-tuples]
---------------------

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 :

```php
$schema = Expect::tuple([
Expect::int(),
Expect::string(),
Expect::bool(),
]);

$processor->process($schema, [1, 'hello', true]); // OK
```


Dépréciations .[#toc-deprecations]
----------------------------------
Expand Down
31 changes: 31 additions & 0 deletions schema/hu/@home.texy
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ $processor->process($schema, ['nullable' => null]);
// OK, visszatér {'optional' => null, 'nullable' => null}
```

A `getShape()` módszer a struktúra összes tulajdonságát tartalmazó tömböt adja vissza.

Alapértelmezés szerint a bemeneti adatokban nem lehetnek extra elemek:

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

Új struktúrát hozhat létre egy másik struktúrából származtatva a `extend()` segítségével:

```php
$dog = Expect::structure([
'name' => Expect::string(),
'age' => Expect::int(),
]);

$dogWithBreed = $dog->extend([
'breed': Expect::string(),
]);
```


Tuples .[#toc-tuples]
---------------------

A Tuple-ek indexelt tömbök, amelyek fix számú elemmel rendelkeznek, és minden elem különböző típusú lehet:

```php
$schema = Expect::tuple([
Expect::int(),
Expect::string(),
Expect::bool(),
]);

$processor->process($schema, [1, 'hello', true]); // OK
```


Deprecations .[#toc-deprecations]
---------------------------------
Expand Down
Loading

0 comments on commit 9803f87

Please sign in to comment.