Skip to content

Commit

Permalink
feat: Map now accepts false, for the more expressive #[Map(false)] (
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi authored Oct 23, 2024
1 parent f21b1ac commit d7d7bd3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.13.2

* feat: `Map` now accepts false, for the more expressive `#[Map(false)]`

## 1.13.1

* fix: allow interfaces as the target type of object mapper
Expand Down
12 changes: 10 additions & 2 deletions src/Attribute/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::TARGET_PARAMETER | \Attribute::IS_REPEATABLE)]
final readonly class Map
{
public ?string $property;

/**
* @param class-string|null $class
*/
public function __construct(
public ?string $property = null,
null|string|false $property = null,
public ?string $class = null,
) {}
) {
if ($property === false) {
$this->property = null;
} else {
$this->property = $property;
}
}
}

0 comments on commit d7d7bd3

Please sign in to comment.