Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ Install the latest version with
$ composer require omasn/object-handler
```

### Symfony Configuring

```
services:
_instanceof:
Omasn\ObjectHandler\HandleTypeInterface:
tags: [ 'omasn.objectHandlerType' ]

Omasn\ObjectHandler\ObjectHandlerInterface:
class: Omasn\ObjectHandler\ObjectHandler
autowire: true
bind:
$handleTypes: !tagged_iterator omasn.objectHandlerType
```

## Basic Usage

```php
Expand Down
4 changes: 2 additions & 2 deletions src/ObjectHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class ObjectHandler extends AbstractHandler
/**
* @var HandleTypeInterface[]
*/
protected array $handleTypes = [];
protected iterable $handleTypes = [];

private PropertyInfoExtractorInterface $propertyInfoExtractor;
private PropertyAccessorInterface $propertyAccessor;
Expand All @@ -40,7 +40,7 @@ final class ObjectHandler extends AbstractHandler
* @param HandleTypeInterface[]|callable[] $handleTypes
*/
public function __construct(
array $handleTypes,
iterable $handleTypes,
PropertyInfoExtractorInterface $propertyInfoExtractor,
PropertyAccessorInterface $propertyAccessor = null,
ViolationFactoryInterface $violationFactory = null
Expand Down