Lint
This commit is contained in:
parent
1359721d67
commit
8c6635ea0b
|
@ -11,10 +11,13 @@ use Spatie\LaravelData\Support\DataProperty;
|
||||||
class CarbonCast implements Cast
|
class CarbonCast implements Cast
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected array|string|null $format = null
|
protected ?string $format = null
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $context
|
||||||
|
*/
|
||||||
public function cast(DataProperty $property, mixed $value, array $context): DateTimeInterface|Uncastable|null
|
public function cast(DataProperty $property, mixed $value, array $context): DateTimeInterface|Uncastable|null
|
||||||
{
|
{
|
||||||
if ($property->type->isNullable && !$value) {
|
if ($property->type->isNullable && !$value) {
|
||||||
|
|
|
@ -14,6 +14,9 @@ class NullValueCast implements Cast
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $context
|
||||||
|
*/
|
||||||
public function cast(DataProperty $property, mixed $value, array $context): DateTimeInterface|Uncastable|null|int
|
public function cast(DataProperty $property, mixed $value, array $context): DateTimeInterface|Uncastable|null|int
|
||||||
{
|
{
|
||||||
if ($this->id === $value) {
|
if ($this->id === $value) {
|
||||||
|
|
|
@ -11,6 +11,9 @@ class StringCast implements Cast
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $context
|
||||||
|
*/
|
||||||
public function cast(DataProperty $property, mixed $value, array $context): ?string
|
public function cast(DataProperty $property, mixed $value, array $context): ?string
|
||||||
{
|
{
|
||||||
if ($property->type->isNullable && !$value) {
|
if ($property->type->isNullable && !$value) {
|
||||||
|
|
|
@ -135,7 +135,6 @@ class Member extends Data
|
||||||
'wiederverwendenFlag' => $this->keepdata,
|
'wiederverwendenFlag' => $this->keepdata,
|
||||||
'regionId' => $this->regionId ?: 23,
|
'regionId' => $this->regionId ?: 23,
|
||||||
'staatsangehoerigkeitId' => $this->nationalityId,
|
'staatsangehoerigkeitId' => $this->nationalityId,
|
||||||
'zeitschriftenversand' => $this->sendNewspaper,
|
|
||||||
'emailVertretungsberechtigter' => $this->emailParents,
|
'emailVertretungsberechtigter' => $this->emailParents,
|
||||||
'ort' => $this->location,
|
'ort' => $this->location,
|
||||||
'plz' => $this->zip,
|
'plz' => $this->zip,
|
||||||
|
|
|
@ -35,6 +35,9 @@ class Membership extends Data
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string|int|null>
|
||||||
|
*/
|
||||||
public function toNami(): array
|
public function toNami(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -7,9 +7,6 @@ use Zoomyboy\LaravelNami\Data\Course;
|
||||||
|
|
||||||
class CourseFake extends Fake
|
class CourseFake extends Fake
|
||||||
{
|
{
|
||||||
private array $defaults = [
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<int> $ids
|
* @param array<int> $ids
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -86,7 +86,7 @@ class MemberFake extends Fake
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<string, string|int|null> $data
|
* @param array<string, string|int|bool|null> $data
|
||||||
*/
|
*/
|
||||||
public function updatesSuccessfully(int $groupId, int $memberId, array $data = []): self
|
public function updatesSuccessfully(int $groupId, int $memberId, array $data = []): self
|
||||||
{
|
{
|
||||||
|
@ -117,7 +117,7 @@ class MemberFake extends Fake
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<string, string|int|null> $body
|
* @param array<string, string|int|bool|null> $body
|
||||||
*/
|
*/
|
||||||
public function assertCreated(int $groupId, array $body): void
|
public function assertCreated(int $groupId, array $body): void
|
||||||
{
|
{
|
||||||
|
@ -145,7 +145,7 @@ class MemberFake extends Fake
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<string, string|int|null> $body
|
* @param array<string, string|int|bool|null> $body
|
||||||
*/
|
*/
|
||||||
public function assertUpdated(int $groupId, int $memberId, array $body): void
|
public function assertUpdated(int $groupId, int $memberId, array $body): void
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,26 +55,6 @@ class Group implements Arrayable
|
||||||
return Nami::feesOf($this->id);
|
return Nami::feesOf($this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function members(): MemberCollection
|
|
||||||
{
|
|
||||||
$members = Nami::membersOf($this->id);
|
|
||||||
|
|
||||||
return MemberCollection::make(function () use ($members) {
|
|
||||||
foreach ($members as $member) {
|
|
||||||
yield $this->member($member['id']);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return new MemberCollection(Nami::membersOf($this->id)->map(function ($member) {
|
|
||||||
return $this->member($member['id']);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function member(int $id): Member
|
|
||||||
{
|
|
||||||
return Member::fromNami(Nami::member($this->id, $id));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function activities(): Collection
|
public function activities(): Collection
|
||||||
{
|
{
|
||||||
return Nami::activities($this->id);
|
return Nami::activities($this->id);
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Zoomyboy\LaravelNami;
|
|
||||||
|
|
||||||
use Illuminate\Support\LazyCollection;
|
|
||||||
|
|
||||||
class MemberCollection extends LazyCollection
|
|
||||||
{
|
|
||||||
public static function fromOverview($items)
|
|
||||||
{
|
|
||||||
$self = new self($items);
|
|
||||||
|
|
||||||
return $self->map(function ($item) {
|
|
||||||
return Member::fromOverview($item);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,13 +2,16 @@
|
||||||
|
|
||||||
namespace Zoomyboy\LaravelNami\Tests\Factories;
|
namespace Zoomyboy\LaravelNami\Tests\Factories;
|
||||||
|
|
||||||
use GuzzleHttp\Promise\FulfilledPromise;
|
use GuzzleHttp\Promise\PromiseInterface;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Worksome\RequestFactories\RequestFactory;
|
use Worksome\RequestFactories\RequestFactory;
|
||||||
use Zoomyboy\LaravelNami\Data\Member;
|
use Zoomyboy\LaravelNami\Data\Member;
|
||||||
|
|
||||||
class MemberRequestFactory extends RequestFactory
|
class MemberRequestFactory extends RequestFactory
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
public function definition(): array
|
public function definition(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -48,7 +51,7 @@ class MemberRequestFactory extends RequestFactory
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toSingleHttp(): FulfilledPromise
|
public function toSingleHttp(): PromiseInterface
|
||||||
{
|
{
|
||||||
return Http::response(json_encode([
|
return Http::response(json_encode([
|
||||||
'success' => true,
|
'success' => true,
|
||||||
|
|
|
@ -116,6 +116,8 @@ class FetchMemberTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* @testWith [{"eintrittsdatum": null}]
|
* @testWith [{"eintrittsdatum": null}]
|
||||||
* [{"landId": null}]
|
* [{"landId": null}]
|
||||||
|
*
|
||||||
|
* @param array<string, mixed> $data
|
||||||
*/
|
*/
|
||||||
public function testFailsFetchingWhenJoinedAtDateIsMissing(array $data): void
|
public function testFailsFetchingWhenJoinedAtDateIsMissing(array $data): void
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,8 +22,6 @@ class PutMemberTest extends TestCase
|
||||||
'birthday' => '2021-02-02 00:00:00',
|
'birthday' => '2021-02-02 00:00:00',
|
||||||
'email' => 'aa@b.de',
|
'email' => 'aa@b.de',
|
||||||
'countryId' => 78,
|
'countryId' => 78,
|
||||||
'keepdata' => false,
|
|
||||||
'sendNewspaper' => false,
|
|
||||||
'regionId' => 11,
|
'regionId' => 11,
|
||||||
'nationalityId' => 12,
|
'nationalityId' => 12,
|
||||||
'beitragsartId' => null,
|
'beitragsartId' => null,
|
||||||
|
@ -55,8 +53,6 @@ class PutMemberTest extends TestCase
|
||||||
'geburtsDatum' => '2021-02-02 00:00:00',
|
'geburtsDatum' => '2021-02-02 00:00:00',
|
||||||
'konfessionId' => 33,
|
'konfessionId' => 33,
|
||||||
'landId' => 78,
|
'landId' => 78,
|
||||||
'wiederverwendenFlag' => false,
|
|
||||||
'zeitschriftenversand' => false,
|
|
||||||
'regionId' => 11,
|
'regionId' => 11,
|
||||||
'staatsangehoerigkeitId' => 12,
|
'staatsangehoerigkeitId' => 12,
|
||||||
'ersteTaetigkeitId' => 78,
|
'ersteTaetigkeitId' => 78,
|
||||||
|
|
Loading…
Reference in New Issue