-
-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1492 from pmysiak/feat/allow-stringable
feat(stringable-type): Allow stringable object as type.
- Loading branch information
Showing
5 changed files
with
128 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace JMS\Serializer\Tests\Fixtures; | ||
|
||
use JMS\Serializer\Annotation as Serializer; | ||
|
||
class ObjectWithTypeAsNonStringableObject | ||
{ | ||
#[Serializer\Type(name: new NonStringableObjectType())] | ||
private $array; | ||
|
||
/** | ||
* @param array<string> $array | ||
*/ | ||
public function __construct(array $array) | ||
{ | ||
$this->array = $array; | ||
} | ||
} | ||
|
||
class NonStringableObjectType | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace JMS\Serializer\Tests\Fixtures; | ||
|
||
use JMS\Serializer\Annotation as Serializer; | ||
|
||
class ObjectWithTypeAsStringableObject | ||
{ | ||
#[Serializer\Type(name: new StringableObjectType())] | ||
private $array; | ||
|
||
/** | ||
* @param array<string> $array | ||
*/ | ||
public function __construct(array $array) | ||
{ | ||
$this->array = $array; | ||
} | ||
} | ||
|
||
class StringableObjectType | ||
{ | ||
public function __toString(): string | ||
{ | ||
return 'array<string>'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters