Update casters

This commit is contained in:
philipp lang 2024-09-22 03:00:09 +02:00
parent aa862f1264
commit 7c876d75c9
5 changed files with 6 additions and 18 deletions

View File

@ -17,9 +17,6 @@ class CarbonCast implements Cast
) {
}
/**
* @param array<string, mixed> $context
*/
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): DateTimeInterface|Uncastable|null
{
if ($property->type->isNullable && !$value) {
@ -27,7 +24,7 @@ class CarbonCast implements Cast
}
try {
return (new DateTimeInterfaceCast($this->format, null, null, null))->cast($property, $value, $context);
return (new DateTimeInterfaceCast($this->format, null, null, null))->cast($property, $value, $properties, $context);
} catch (CannotCastDate $e) {
if (!$property->type->isNullable) {
throw $e;

View File

@ -12,9 +12,6 @@ class GroupCast implements Cast
{
}
/**
* @param array<string, mixed> $context
*/
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): ?string
{
if ($property->type->isNullable && !$value) {

View File

@ -15,9 +15,6 @@ class NullValueCast implements Cast
) {
}
/**
* @param array<string, mixed> $context
*/
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): DateTimeInterface|Uncastable|null|int
{
if ($this->id === $value) {

View File

@ -12,9 +12,6 @@ class StringCast implements Cast
{
}
/**
* @param array<string, mixed> $context
*/
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): ?string
{
if ($property->type->isNullable && !$value) {

View File

@ -11,7 +11,7 @@ class PutMemberTest extends TestCase
public function testPushASingleMember(): void
{
app(MemberFake::class)->stores(103, 16);
$member = Member::factory()->toMember([
$member = Member::toFactory()->toMember([
'firstname' => 'Max',
'lastname' => 'Nach1',
'nickname' => 'spitz1',
@ -79,7 +79,7 @@ class PutMemberTest extends TestCase
app(MemberFake::class)
->updatesSuccessfully(103, 16)
->shows(103, 16);
$member = Member::factory()->toMember([
$member = Member::toFactory()->toMember([
'firstname' => 'Max',
'lastname' => 'Nach1',
'nickname' => 'spitz1',
@ -123,7 +123,7 @@ class PutMemberTest extends TestCase
app(MemberFake::class)
->updatesSuccessfully(103, 16)
->shows(103, 16);
$member = Member::factory()->toMember([
$member = Member::toFactory()->toMember([
'email' => null,
'groupId' => 103,
'id' => 16,
@ -145,7 +145,7 @@ class PutMemberTest extends TestCase
'foreign' => 'fff',
'kontoverbindung' => ['a' => 'b'],
]);
$response = $this->login()->putMember(Member::factory()->inNami(103, 16)->toMember());
$response = $this->login()->putMember(Member::toFactory()->inNami(103, 16)->toMember());
$this->assertEquals(16, $response);
@ -163,7 +163,7 @@ class PutMemberTest extends TestCase
'foreign' => 'fff',
'kontoverbindung' => ['a' => 'b'],
]);
$response = $this->login()->putMember(Member::factory()->inNami(103, 16)->toMember(['genderId' => null, 'regionId' => null]));
$response = $this->login()->putMember(Member::toFactory()->inNami(103, 16)->toMember(['genderId' => null, 'regionId' => null]));
$this->assertEquals(16, $response);