tests
This commit is contained in:
parent
6b1a385292
commit
bba10b455f
10 changed files with 296 additions and 514 deletions
|
|
@ -5,7 +5,7 @@ declare(strict_types=1);
|
|||
namespace Icefox\DTO;
|
||||
|
||||
use Icefox\DTO\Attributes\Flat;
|
||||
use Icefox\DTO\Attributes\OverwriteRules;
|
||||
use Icefox\DTO\Attributes\Overwrite;
|
||||
use Icefox\DTO\Config;
|
||||
use Icefox\DTO\ParameterMeta;
|
||||
use Icefox\DTO\ReflectionHelper;
|
||||
|
|
@ -30,7 +30,7 @@ use phpDocumentor\Reflection\Types\Object_;
|
|||
final class RuleFactory
|
||||
{
|
||||
/**
|
||||
* @return array<string, array<string|Rule>>
|
||||
* @return array<string, array<int, mixed>>
|
||||
*/
|
||||
public function getRulesFromDocBlock(
|
||||
Type $type,
|
||||
|
|
@ -63,7 +63,7 @@ final class RuleFactory
|
|||
|
||||
/**
|
||||
* @param array<ParameterMeta> $parameters
|
||||
* @return array<string,array<int,string|Rule>>
|
||||
* @return array<string,array<int,mixed>>
|
||||
*/
|
||||
public function infer(array $parameters, string $basePrefix): array
|
||||
{
|
||||
|
|
@ -80,7 +80,7 @@ final class RuleFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array<int, string|Rule>>
|
||||
* @return array<string, array<int, mixed>>
|
||||
*/
|
||||
public function buildParameterRule(ParameterMeta $parameter, string $prefix): array
|
||||
{
|
||||
|
|
@ -150,7 +150,7 @@ final class RuleFactory
|
|||
|
||||
/**
|
||||
* @param class-string $class
|
||||
* @return array<string,array<int, string>>
|
||||
* @return array<string,array<int, mixed>>
|
||||
*/
|
||||
public function make(string $class): array
|
||||
{
|
||||
|
|
@ -162,7 +162,7 @@ final class RuleFactory
|
|||
$customRules = $hasRulesMethod ? App::call("$class::rules", []) : [];
|
||||
|
||||
|
||||
if ($hasRulesMethod && !empty($classReflection->getMethod('rules')->getAttributes(OverwriteRules::class))) {
|
||||
if ($hasRulesMethod && !empty($classReflection->getMethod('rules')->getAttributes(Overwrite::class))) {
|
||||
$rules = $customRules;
|
||||
} else {
|
||||
$inferredRules = RuleFactory::infer($parameters, '');
|
||||
|
|
@ -173,9 +173,9 @@ final class RuleFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array<string,array<int, string>> $first
|
||||
* @param array<string,array<int, string>> $second
|
||||
* @return array<string,array<int, string>>
|
||||
* @param array<string,array<int, mixed>> $first
|
||||
* @param array<string,array<int, mixed>> $second
|
||||
* @return array<string,array<int, mixed>>
|
||||
*/
|
||||
public function mergeRules(array $first, array $second): array
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue