Lint
continuous-integration/drone/push Build is passing Details

This commit is contained in:
philipp lang 2024-06-29 11:18:40 +02:00
parent 63c62dc958
commit d06ae7acb5
12 changed files with 81 additions and 45 deletions

View File

@ -25,7 +25,7 @@ class ContributionFactory
];
/**
* @return Collection<int, array{title: mixed, class: mixed}>
* @return Collection<int, array{title: string, class: class-string<ContributionDocument>}>
*/
public function compilerSelect(): Collection
{

View File

@ -8,9 +8,6 @@ use Sabre\CardDAV\Backend\AbstractBackend;
use Sabre\DAV\PropPatch;
use Sabre\VObject\Component\VCard;
/**
* @template M as array{lastmodified: int, etag: string, uri: string, id: int, size: int}
*/
class AddressBookBackend extends AbstractBackend
{
/**
@ -115,7 +112,7 @@ class AddressBookBackend extends AbstractBackend
*
* @param mixed $addressbookId
*
* @return array<int, M>
* @return array<int, AddressBookCard>
*/
public function getCards($addressbookId): array
{
@ -133,7 +130,7 @@ class AddressBookBackend extends AbstractBackend
* @param mixed $addressBookId
* @param string $cardUri
*
* @return M
* @return AddressBookCard|bool
*/
public function getCard($addressBookId, $cardUri)
{
@ -248,7 +245,7 @@ class AddressBookBackend extends AbstractBackend
}
/**
* @return M
* @return AddressBookCard
*/
private function cardMeta(Member $member): array
{

View File

@ -12,6 +12,9 @@ class ListFilesAction
{
use AsAction;
/**
* @return DataCollection<int, ResourceData>
*/
public function handle(ActionRequest $request, Fileshare $fileshare): DataCollection
{
return ResourceData::collection($fileshare->type->getSubDirectories($request->input('parent')))->wrap('data');

View File

@ -2,10 +2,9 @@
namespace App\Fileshare\ConnectionTypes;
use App\Fileshare\Data\ResourceData;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Support\Collection;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\DataCollection;
abstract class ConnectionType extends Data
{
@ -30,10 +29,7 @@ abstract class ConnectionType extends Data
*/
public static function forSelect(): array
{
return collect(glob(base_path('app/Fileshare/ConnectionTypes/*')))
->map(fn ($file) => 'App\\Fileshare\\ConnectionTypes\\' . pathinfo($file, PATHINFO_FILENAME))
->filter(fn ($file) => $file !== static::class)
->values()
return self::types()
->map(fn ($file) => ['id' => $file, 'name' => $file::title(), 'defaults' => $file::defaults(), 'fields' => $file::fields()])
->toArray();
}
@ -47,4 +43,15 @@ abstract class ConnectionType extends Data
return $filesystem->directories($parent ?: '/');
}
/**
* @return Collection<int, class-string<ConnectionType>>
*/
private static function types(): Collection
{
return collect(glob(base_path('app/Fileshare/ConnectionTypes/*')))
->map(fn ($file) => 'App\\Fileshare\\ConnectionTypes\\' . pathinfo($file, PATHINFO_FILENAME))
->filter(fn ($file) => $file !== static::class)
->values();
}
}

View File

@ -7,7 +7,7 @@ use Spatie\LaravelData\Data;
class ResourceData extends Data
{
public function __construct(public $name, public $path, public $parent)
public function __construct(public string $name, public string $path, public string $parent)
{
}

View File

@ -8,7 +8,7 @@ use App\Lib\HasMeta;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* @mixin FileshareConnection
* @mixin Fileshare
*/
class FileshareResource extends JsonResource
{

View File

@ -10,7 +10,7 @@ use Spatie\LaravelData\Support\DataProperty;
class FieldCollectionCast implements Cast
{
/**
* @param array<int, array<string, mixed>> $value
* @param array<int, array<string, string>> $value
* @param array<string, mixed> $context
* @return FieldCollection
*/

View File

@ -79,6 +79,9 @@ abstract class Field extends Data
->toArray();
}
/**
* @return class-string<Field>
*/
public static function classFromType(string $type): ?string
{
/** @var class-string<Field> */

@ -1 +1 @@
Subproject commit b8164cd3d204412cd3be95cbf29b9fcc3d23a77d
Subproject commit 84103d40521d77f936635a7f992cf1ae4b01dafe

View File

@ -25,6 +25,7 @@ parameters:
MailgatewayCustomField: 'array{name: string, label: string, type: string, storeValidator: string, updateValidator: string, default: string}'
MailgatewayParsedCustomField: 'array{name: string, label: string, type: string, storeValidator: string, updateValidator: string, default: string, is_required: bool}'
SluggableConfig: 'array<string, array{source: array<int, string>}>'
AddressBookCard: 'array{lastmodified: int, etag: string, uri: string, id: int, size: int}'
ignoreErrors:
-
@ -32,11 +33,6 @@ parameters:
count: 1
path: app/Activity.php
-
message: "#^Method App\\\\Dav\\\\AddressBookBackend\\:\\:getCard\\(\\) should return M of array\\{lastmodified\\: int, etag\\: string, uri\\: string, id\\: int, size\\: int\\} but returns false\\.$#"
count: 1
path: app/Dav/AddressBookBackend.php
-
message: "#^Method App\\\\Dav\\\\AddressBookBackend\\:\\:getMultipleCards\\(\\) has parameter \\$uris with no value type specified in iterable type array\\.$#"
count: 1
@ -162,17 +158,6 @@ parameters:
count: 1
path: database/factories/NationalityFactory.php
-
message: "#^Call to an undefined method Phake\\\\Proxies\\\\StubberProxy.*#"
-
message: "#^Call to an undefined method Phake\\\\Proxies\\\\VerifierProxy.*#"
-
message: "#^PHPDoc tag @param has invalid value \\(\\<class\\-string\\> \\$class\\)\\: Unexpected token \"\\<\", expected type at offset 18$#"
count: 1
path: tests/TestCase.php
-
message: "#^Parameter \\#1 \\$api of class App\\\\Initialize\\\\InitializeGroups constructor expects Zoomyboy\\\\LaravelNami\\\\Api, PHPUnit\\\\Framework\\\\MockObject\\\\Stub given\\.$#"
count: 6
@ -463,16 +448,6 @@ parameters:
count: 1
path: tests/Feature/Member/DavTest.php
-
message: "#^Return type of call to method Illuminate\\\\Support\\\\Collection\\<int,class\\-string\\<App\\\\Contribution\\\\Documents\\\\ContributionDocument\\>\\>\\:\\:map\\(\\) contains unresolvable type\\.$#"
count: 1
path: app/Contribution/ContributionFactory.php
-
message: "#^Return type of call to method Illuminate\\\\Support\\\\Collection\\<int,class\\-string\\<App\\\\Setting\\\\LocalSettings\\>\\>\\:\\:map\\(\\) contains unresolvable type\\.$#"
count: 1
path: app/Setting/SettingFactory.php
-
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$email\\.$#"
count: 2
@ -542,3 +517,53 @@ parameters:
message: "#^Unable to resolve the template type TValue in call to function collect$#"
count: 1
path: app/Form/Fields/NamiField.php
-
message: "#^Method App\\\\Fileshare\\\\ConnectionTypes\\\\ConnectionType\\:\\:types\\(\\) should return Illuminate\\\\Support\\\\Collection\\<int, class\\-string\\<App\\\\Fileshare\\\\ConnectionTypes\\\\ConnectionType\\>\\> but returns Illuminate\\\\Support\\\\Collection\\<int, string\\>\\.$#"
count: 1
path: app/Fileshare/ConnectionTypes/ConnectionType.php
-
message: "#^Call to an undefined method Phake\\\\Proxies\\\\StubberProxy\\:\\:check\\(\\)\\.$#"
count: 1
path: tests/Feature/Mailgateway/IndexTest.php
-
message: "#^Call to an undefined method Phake\\\\Proxies\\\\StubberProxy\\:\\:setCredentials\\(\\)\\.$#"
count: 1
path: tests/Feature/Mailgateway/IndexTest.php
-
message: "#^Call to an undefined method Phake\\\\Proxies\\\\StubberProxy\\:\\:check\\(\\)\\.$#"
count: 2
path: tests/Feature/Mailgateway/MailmanTypeTest.php
-
message: "#^Call to an undefined method Phake\\\\Proxies\\\\StubberProxy\\:\\:setCredentials\\(\\)\\.$#"
count: 2
path: tests/Feature/Mailgateway/MailmanTypeTest.php
-
message: "#^Call to an undefined method Phake\\\\Proxies\\\\StubberProxy\\:\\:setOwner\\(\\)\\.$#"
count: 1
path: tests/Feature/Mailgateway/MailmanTypeTest.php
-
message: "#^Call to an undefined method Phake\\\\Proxies\\\\StubberProxy\\:\\:setOwner\\(\\)\\.$#"
count: 2
path: tests/Feature/Mailgateway/StoreTest.php
-
message: "#^Call to an undefined method Phake\\\\Proxies\\\\StubberProxy\\:\\:setParams\\(\\)\\.$#"
count: 3
path: tests/Feature/Mailgateway/StoreTest.php
-
message: "#^Call to an undefined method Phake\\\\Proxies\\\\StubberProxy\\:\\:works\\(\\)\\.$#"
count: 3
path: tests/Feature/Mailgateway/StoreTest.php
-
message: "#^Call to an undefined method Phake\\\\Proxies\\\\VerifierProxy\\:\\:handle\\(\\)\\.$#"
count: 2
path: tests/Feature/Member/NamiPutMemberActionTest.php

View File

@ -93,7 +93,8 @@ abstract class TestCase extends BaseTestCase
}
/**
* @param <class-string> $class
* @template M of object
* @param class-string<M> $class
*/
public function stubIo(string $class, callable $mocker): self
{

View File

@ -10,7 +10,7 @@ use Symfony\Component\HttpFoundation\File\File;
* @method self assertPdfPageCount(int $count)
* @method self assertPdfName(string $filename)
* @method self assertHasJsonPath(string $path)
* @method self assertComponnet(string $component)
* @method self assertComponent(string $component)
* @method File getFile()
*/
class TestResponse