Skip to content

Commit

Permalink
typos
Browse files Browse the repository at this point in the history
  • Loading branch information
rodber committed Jan 9, 2024
1 parent 0ae82e8 commit 174df72
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Parameter is a library around parameter-argument which provides additional funct

Parameter enables to spawn dynamic parameters of any type with extra rules.

For example, an integer of minimum value 10:
For example, an integer of minimum value 10.

```php
use function Chevere\Parameter\int;
Expand All @@ -37,7 +37,7 @@ $int = int(min: 10);
$int($var); // exception if $var < 10
```

In function or method parameters you can use attributes to define validation rules for parameters and return value:
Use attributes to define validation rules for parameters and return value.

```php
use Chevere\Parameter\Attributes\FloatAttr;
Expand Down Expand Up @@ -89,6 +89,8 @@ int(min: 1, max: 10)($var);

### Attribute-based usage

Use attributes to define rules for parameters and return value.

Use [attribute delegated validation](#attribute-delegated-validation) with the `validated()` function to go from this:

```php
Expand Down Expand Up @@ -191,7 +193,7 @@ function myCallable(): ParameterInterface

A Parameter is an object implementing `ParameterInterface`. There are several Parameter types, each one with its own validation rules. Every Parameter can define a `description` and a `default` value, plus additional validation rules depending on the type.

A Parameter can be defined using functions and/or attributes, it takes the same arguments for both. Use attributes when needing to define rules for parameters and return value.
A Parameter can be defined using functions and/or attributes, it takes the same arguments for both.

When invoking a Parameter it will trigger validation against the passed argument.

Expand Down Expand Up @@ -507,10 +509,15 @@ Use `ArrayAttr` attribute to define an array parameter.

```php
use Chevere\Parameter\Attributes\ArrayAttr;
use Chevere\Parameter\Attributes\StringAttr;
use Chevere\Parameter\Attributes\FloatAttr;
use Chevere\Parameter\Attributes\IntAttr;

#[ArrayAttr(
a: new StringAttr(),
id: new IntAttr(),
items: new ArrayAttr(
id: new IntAttr(),
price: new FloatAttr(),
),
)]
```

Expand Down

0 comments on commit 174df72

Please sign in to comment.