-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ReflectionMetaSource: improve error messages, add tests
- Loading branch information
Showing
12 changed files
with
334 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Orisai\ObjectMapper\Doubles\Definition; | ||
|
||
use Attribute; | ||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor; | ||
use Orisai\ObjectMapper\Rules\MixedRule; | ||
use Orisai\ObjectMapper\Rules\RuleDefinition; | ||
|
||
/** | ||
* @Annotation | ||
* @NamedArgumentConstructor() | ||
*/ | ||
#[Attribute()] | ||
final class TargetLessRuleDefinition implements RuleDefinition | ||
{ | ||
|
||
public function getType(): string | ||
{ | ||
return MixedRule::class; | ||
} | ||
|
||
public function getArgs(): array | ||
{ | ||
return []; | ||
} | ||
|
||
} |
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,26 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Orisai\ObjectMapper\Doubles\Definition; | ||
|
||
use Attribute; | ||
use Orisai\ObjectMapper\Meta\MetaDefinition; | ||
use stdClass; | ||
|
||
/** | ||
* @Annotation | ||
*/ | ||
#[Attribute] | ||
final class UnsupportedDefinition implements MetaDefinition | ||
{ | ||
|
||
public function getType(): string | ||
{ | ||
return stdClass::class; | ||
} | ||
|
||
public function getArgs(): array | ||
{ | ||
return []; | ||
} | ||
|
||
} |
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,18 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Orisai\ObjectMapper\Doubles\Meta; | ||
|
||
use Orisai\ObjectMapper\MappedObject; | ||
use Orisai\ObjectMapper\Rules\IntValue; | ||
use Orisai\ObjectMapper\Rules\StringValue; | ||
|
||
final class FieldWithMultipleRulesVO implements MappedObject | ||
{ | ||
|
||
/** | ||
* @StringValue() | ||
* @IntValue() | ||
*/ | ||
public string $field; | ||
|
||
} |
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,14 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Orisai\ObjectMapper\Doubles\Meta; | ||
|
||
use Orisai\ObjectMapper\MappedObject; | ||
use Orisai\ObjectMapper\Modifiers\FieldName; | ||
|
||
final class FieldWithNoRuleVO implements MappedObject | ||
{ | ||
|
||
/** @FieldName("foo") */ | ||
public string $field; | ||
|
||
} |
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,14 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Orisai\ObjectMapper\Doubles\Meta; | ||
|
||
use Orisai\ObjectMapper\MappedObject; | ||
use Tests\Orisai\ObjectMapper\Doubles\Definition\TargetLessRuleDefinition; | ||
|
||
/** | ||
* @TargetLessRuleDefinition() | ||
*/ | ||
final class RuleAboveClassVO implements MappedObject | ||
{ | ||
|
||
} |
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,14 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Orisai\ObjectMapper\Doubles\Meta; | ||
|
||
use Orisai\ObjectMapper\MappedObject; | ||
use Tests\Orisai\ObjectMapper\Doubles\Definition\UnsupportedDefinition; | ||
|
||
/** | ||
* @UnsupportedDefinition() | ||
*/ | ||
final class UnsupportedClassDefinitionVO implements MappedObject | ||
{ | ||
|
||
} |
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,14 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Orisai\ObjectMapper\Doubles\Meta; | ||
|
||
use Orisai\ObjectMapper\MappedObject; | ||
use Tests\Orisai\ObjectMapper\Doubles\Definition\UnsupportedDefinition; | ||
|
||
final class UnsupportedPropertyDefinitionVO implements MappedObject | ||
{ | ||
|
||
/** @UnsupportedDefinition() */ | ||
public string $field; | ||
|
||
} |
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,14 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Orisai\ObjectMapper\Doubles\Meta; | ||
|
||
use Orisai\ObjectMapper\MappedObject; | ||
use Orisai\ObjectMapper\Rules\StringValue; | ||
|
||
abstract class VariantFieldParentVO implements MappedObject | ||
{ | ||
|
||
/** @StringValue(notEmpty=true) */ | ||
public string $field; | ||
|
||
} |
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,13 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Orisai\ObjectMapper\Doubles\Meta; | ||
|
||
use Orisai\ObjectMapper\Rules\StringValue; | ||
|
||
final class VariantFieldVO extends VariantFieldParentVO | ||
{ | ||
|
||
/** @StringValue() */ | ||
public string $field; | ||
|
||
} |
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
Oops, something went wrong.