Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sagittaracc committed Apr 1, 2024
1 parent 471a3f1 commit e08c0ac
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,28 @@ $timerOnSum = (new Timer)->wrapper(fn($a, $b) => $calc->sum($a, $b));
echo $timerOnSum(1, 2); // Total execution: 1.00034234 ms; Result: 3
```

# Generics
```php
use Sagittaracc\PhpPythonDecorator\Decorator;
use Sagittaracc\PhpPythonDecorator\T;

#[T]
class Box
{
use Decorator;

#[T]
public array $items;
}

$box = new Box();
$box(Pencil::class); // new Box<Pencil>();

$pencil = new Pencil();
$pen = new Pen();
$box->_items = [$pencil, $pen]; // throws a GenericError
```

# Validation
```php

Expand Down

0 comments on commit e08c0ac

Please sign in to comment.