From a9ecdfe4bbd3925538ed61125d108f4cb64cfcf0 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Mon, 8 Jul 2024 23:17:14 +0200 Subject: [PATCH] Lint --- app/Dav/AddressBookBackend.php | 3 +- app/Dav/Principal.php | 11 ++++--- app/Dav/ServiceProvider.php | 4 +++ app/Exceptions/Handler.php | 7 ++--- phpstan.neon | 55 ---------------------------------- 5 files changed, 16 insertions(+), 64 deletions(-) diff --git a/app/Dav/AddressBookBackend.php b/app/Dav/AddressBookBackend.php index 39370629..5207e5ba 100644 --- a/app/Dav/AddressBookBackend.php +++ b/app/Dav/AddressBookBackend.php @@ -155,8 +155,9 @@ class AddressBookBackend extends AbstractBackend * If the backend supports this, it may allow for some speed-ups. * * @param mixed $addressBookId + * @param array $uris * - * @return array + * @return array */ public function getMultipleCards($addressBookId, array $uris) { diff --git a/app/Dav/Principal.php b/app/Dav/Principal.php index 5700ac0a..a5c32d54 100644 --- a/app/Dav/Principal.php +++ b/app/Dav/Principal.php @@ -136,10 +136,11 @@ class Principal implements PrincipalBackendInterface * * @param string $principal * - * @return array + * @return array|null */ public function getGroupMemberSet($principal) { + return []; } /** @@ -147,7 +148,7 @@ class Principal implements PrincipalBackendInterface * * @param string $principal * - * @return array + * @return array|null */ public function getGroupMembership($principal) { @@ -155,7 +156,7 @@ class Principal implements PrincipalBackendInterface return null; } - return ['addressbooks/'.$matches[1]]; + return ['addressbooks/' . $matches[1]]; } /** @@ -164,6 +165,8 @@ class Principal implements PrincipalBackendInterface * The principals should be passed as a list of uri's. * * @param string $principal + * @param array $members + * @return void */ public function setGroupMemberSet($principal, array $members) { @@ -176,7 +179,7 @@ class Principal implements PrincipalBackendInterface { return [ '{DAV:}displayname' => $user->name, - 'uri' => 'principals/'.$user->email, + 'uri' => 'principals/' . $user->email, '{http://sabredav.org/ns}email-address' => $user->email, ]; } diff --git a/app/Dav/ServiceProvider.php b/app/Dav/ServiceProvider.php index b32ca6af..f5ffd0be 100644 --- a/app/Dav/ServiceProvider.php +++ b/app/Dav/ServiceProvider.php @@ -9,6 +9,7 @@ use Sabre\CardDAV\AddressBookRoot; use Sabre\CardDAV\Plugin as CardDAVPlugin; use Sabre\DAV\Auth\Plugin as AuthPlugin; use Sabre\DAV\Browser\Plugin as BrowserPlugin; +use Sabre\DAV\ServerPlugin; use Sabre\DAVACL\AbstractPrincipalCollection; use Sabre\DAVACL\Plugin as AclPlugin; use Sabre\DAVACL\PrincipalCollection; @@ -50,6 +51,9 @@ class ServiceProvider extends BaseServiceProvider ]; } + /** + * @return array + */ private function plugins(): array { $authBackend = new AuthBackend(); diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index d9aa7d89..1a8fd144 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -12,15 +12,14 @@ class Handler extends ExceptionHandler /** * A list of the exception types that are not reported. * - * @var string[] + * @var array> */ - protected $dontReport = [ - ]; + protected $dontReport = []; /** * A list of the inputs that are never flashed for validation exceptions. * - * @var string[] + * @var array */ protected $dontFlash = [ 'password', diff --git a/phpstan.neon b/phpstan.neon index 62723251..fbb941ef 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -34,61 +34,6 @@ parameters: count: 1 path: app/Activity.php - - - message: "#^Method App\\\\Dav\\\\AddressBookBackend\\:\\:getMultipleCards\\(\\) has parameter \\$uris with no value type specified in iterable type array\\.$#" - count: 1 - path: app/Dav/AddressBookBackend.php - - - - message: "#^Method App\\\\Dav\\\\AddressBookBackend\\:\\:getMultipleCards\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: app/Dav/AddressBookBackend.php - - - - message: "#^Method App\\\\Dav\\\\Principal\\:\\:getGroupMemberSet\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: app/Dav/Principal.php - - - - message: "#^Method App\\\\Dav\\\\Principal\\:\\:getGroupMemberSet\\(\\) should return array but return statement is missing\\.$#" - count: 1 - path: app/Dav/Principal.php - - - - message: "#^Method App\\\\Dav\\\\Principal\\:\\:getGroupMembership\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: app/Dav/Principal.php - - - - message: "#^Method App\\\\Dav\\\\Principal\\:\\:getGroupMembership\\(\\) should return array but returns null\\.$#" - count: 1 - path: app/Dav/Principal.php - - - - message: "#^Method App\\\\Dav\\\\Principal\\:\\:setGroupMemberSet\\(\\) has no return type specified\\.$#" - count: 1 - path: app/Dav/Principal.php - - - - message: "#^Method App\\\\Dav\\\\Principal\\:\\:setGroupMemberSet\\(\\) has parameter \\$members with no value type specified in iterable type array\\.$#" - count: 1 - path: app/Dav/Principal.php - - - - message: "#^Method App\\\\Dav\\\\ServiceProvider\\:\\:plugins\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: app/Dav/ServiceProvider.php - - - - message: "#^PHPDoc type array\\ of property App\\\\Exceptions\\\\Handler\\:\\:\\$dontFlash is not covariant with PHPDoc type array\\ of overridden property Illuminate\\\\Foundation\\\\Exceptions\\\\Handler\\:\\:\\$dontFlash\\.$#" - count: 1 - path: app/Exceptions/Handler.php - - - - message: "#^PHPDoc type array\\ of property App\\\\Exceptions\\\\Handler\\:\\:\\$dontReport is not covariant with PHPDoc type array\\\\> of overridden property Illuminate\\\\Foundation\\\\Exceptions\\\\Handler\\:\\:\\$dontReport\\.$#" - count: 1 - path: app/Exceptions/Handler.php - - message: "#^Method App\\\\Http\\\\Controllers\\\\Auth\\\\RegisterController\\:\\:create\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" count: 1