diff --git a/.phpcs.xml b/.phpcs.xml
index 707dbc41..752ba98d 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -19,8 +19,13 @@
-
-
- /includes
-
+
+
+ /includes
+
+
+ /includes
+
+
+
diff --git a/db/migrations/2018_01_01_000005_add_angel_supporter_permissions.php b/db/migrations/2018_01_01_000005_add_angel_supporter_permissions.php
index 2f23fbe0..eef0575c 100644
--- a/db/migrations/2018_01_01_000005_add_angel_supporter_permissions.php
+++ b/db/migrations/2018_01_01_000005_add_angel_supporter_permissions.php
@@ -53,10 +53,9 @@ class AddAngelSupporterPermissions extends Migration
}
/**
- * @param string $type
* @return string
*/
- protected function getQuery($type)
+ protected function getQuery(string $type)
{
return sprintf('
%s FROM GroupPrivileges
diff --git a/db/migrations/2018_09_24_000000_create_event_config_table.php b/db/migrations/2018_09_24_000000_create_event_config_table.php
index c150c03b..dbd5ef7e 100644
--- a/db/migrations/2018_09_24_000000_create_event_config_table.php
+++ b/db/migrations/2018_09_24_000000_create_event_config_table.php
@@ -113,8 +113,6 @@ class CreateEventConfigTable extends Migration
}
/**
- * @param Collection $config
- * @param string $name
* @return mixed|null
*/
protected function getConfigValue(Collection $config, string $name)
diff --git a/db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php b/db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php
index 0478b138..0d38e107 100644
--- a/db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php
+++ b/db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php
@@ -29,9 +29,6 @@ class ChangeUsersContactDectFieldSize extends Migration
$this->changeDectTo(5);
}
- /**
- * @param int $length
- */
protected function changeDectTo(int $length)
{
foreach ($this->tables as $table => $column) {
diff --git a/db/migrations/2021_05_23_000000_set_admin_password.php b/db/migrations/2021_05_23_000000_set_admin_password.php
index 0f164053..21d0b63c 100644
--- a/db/migrations/2021_05_23_000000_set_admin_password.php
+++ b/db/migrations/2021_05_23_000000_set_admin_password.php
@@ -17,11 +17,6 @@ class SetAdminPassword extends Migration
/** @var Config */
protected Config $config;
- /**
- * @param SchemaBuilder $schemaBuilder
- * @param Authenticator $auth
- * @param Config $config
- */
public function __construct(SchemaBuilder $schemaBuilder, Authenticator $auth, Config $config)
{
parent::__construct($schemaBuilder);
diff --git a/db/migrations/ChangesReferences.php b/db/migrations/ChangesReferences.php
index 95420f19..5acb2999 100644
--- a/db/migrations/ChangesReferences.php
+++ b/db/migrations/ChangesReferences.php
@@ -7,13 +7,6 @@ use stdClass;
trait ChangesReferences
{
- /**
- * @param string $fromTable
- * @param string $fromColumn
- * @param string $targetTable
- * @param string $targetColumn
- * @param string $type
- */
protected function changeReferences(
string $fromTable,
string $fromColumn,
@@ -44,8 +37,6 @@ trait ChangesReferences
}
/**
- * @param string $table
- * @param string $column
*
* @return array
*/
diff --git a/db/migrations/Reference.php b/db/migrations/Reference.php
index 9f20861f..39d1f9bd 100644
--- a/db/migrations/Reference.php
+++ b/db/migrations/Reference.php
@@ -9,8 +9,6 @@ use Illuminate\Support\Str;
trait Reference
{
/**
- * @param Blueprint $table
- * @param bool $setPrimary
* @return ColumnDefinition
*/
protected function referencesUser(Blueprint $table, bool $setPrimary = false): ColumnDefinition
@@ -19,12 +17,6 @@ trait Reference
}
/**
- * @param Blueprint $table
- * @param string $targetTable
- * @param string|null $fromColumn
- * @param string|null $targetColumn
- * @param bool $setPrimary
- * @param string $type
* @return ColumnDefinition
*/
protected function references(
@@ -47,12 +39,6 @@ trait Reference
return $col;
}
- /**
- * @param Blueprint $table
- * @param string $fromColumn
- * @param string $targetTable
- * @param string|null $targetColumn
- */
protected function addReference(
Blueprint $table,
string $fromColumn,
diff --git a/src/Application.php b/src/Application.php
index cb091ea7..66d14310 100644
--- a/src/Application.php
+++ b/src/Application.php
@@ -31,9 +31,8 @@ class Application extends Container
/**
* Application constructor.
*
- * @param string $appPath
*/
- public function __construct($appPath = null)
+ public function __construct(string $appPath = null)
{
if (!is_null($appPath)) {
$this->setAppPath($appPath);
@@ -56,10 +55,9 @@ class Application extends Container
}
/**
- * @param string|ServiceProvider $provider
* @return ServiceProvider
*/
- public function register($provider)
+ public function register(string|ServiceProvider $provider)
{
if (is_string($provider)) {
$provider = $this->make($provider);
@@ -124,10 +122,9 @@ class Application extends Container
/**
* Set app base path
*
- * @param string $appPath
* @return static
*/
- public function setAppPath($appPath)
+ public function setAppPath(string $appPath)
{
$appPath = realpath($appPath);
$appPath = rtrim($appPath, DIRECTORY_SEPARATOR);
diff --git a/src/Config/Config.php b/src/Config/Config.php
index b1a93324..2e1e926d 100644
--- a/src/Config/Config.php
+++ b/src/Config/Config.php
@@ -14,11 +14,9 @@ class Config extends Fluent
protected $attributes = [];
/**
- * @param string|null $key
- * @param mixed $default
- * @return mixed
+ * @param string|array $key
*/
- public function get($key, $default = null)
+ public function get(mixed $key, mixed $default = null)
{
if (is_null($key)) {
return $this->attributes;
@@ -33,9 +31,8 @@ class Config extends Fluent
/**
* @param string|array $key
- * @param mixed $value
*/
- public function set($key, $value = null)
+ public function set(mixed $key, mixed $value = null)
{
if (is_array($key)) {
foreach ($key as $configKey => $configValue) {
@@ -52,7 +49,7 @@ class Config extends Fluent
* @param string $key
* @return bool
*/
- public function has($key)
+ public function has(mixed $key)
{
return $this->offsetExists($key);
}
@@ -60,7 +57,7 @@ class Config extends Fluent
/**
* @param string $key
*/
- public function remove($key)
+ public function remove(mixed $key)
{
$this->offsetUnset($key);
}
diff --git a/src/Config/ConfigServiceProvider.php b/src/Config/ConfigServiceProvider.php
index 02f1274b..eec26ab0 100644
--- a/src/Config/ConfigServiceProvider.php
+++ b/src/Config/ConfigServiceProvider.php
@@ -16,10 +16,6 @@ class ConfigServiceProvider extends ServiceProvider
/** @var EventConfig */
protected $eventConfig;
- /**
- * @param Application $app
- * @param EventConfig $eventConfig
- */
public function __construct(Application $app, EventConfig $eventConfig = null)
{
parent::__construct($app);
@@ -84,10 +80,9 @@ class ConfigServiceProvider extends ServiceProvider
/**
* Get the config path
*
- * @param string $path
* @return string
*/
- protected function getConfigPath($path = ''): string
+ protected function getConfigPath(string $path = ''): string
{
return config_path($path);
}
diff --git a/src/Container/ServiceProvider.php b/src/Container/ServiceProvider.php
index c9a0324e..1cce32f6 100644
--- a/src/Container/ServiceProvider.php
+++ b/src/Container/ServiceProvider.php
@@ -12,7 +12,6 @@ abstract class ServiceProvider
/**
* ServiceProvider constructor.
*
- * @param Application $app
*/
public function __construct(Application $app)
{
diff --git a/src/Controllers/Admin/FaqController.php b/src/Controllers/Admin/FaqController.php
index 927ae24e..fb339049 100644
--- a/src/Controllers/Admin/FaqController.php
+++ b/src/Controllers/Admin/FaqController.php
@@ -32,12 +32,6 @@ class FaqController extends BaseController
'faq.edit',
];
- /**
- * @param LoggerInterface $log
- * @param Faq $faq
- * @param Redirector $redirector
- * @param Response $response
- */
public function __construct(
LoggerInterface $log,
Faq $faq,
@@ -51,7 +45,6 @@ class FaqController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
@@ -65,7 +58,6 @@ class FaqController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
@@ -110,7 +102,6 @@ class FaqController extends BaseController
}
/**
- * @param Faq|null $faq
*
* @return Response
*/
diff --git a/src/Controllers/Admin/LogsController.php b/src/Controllers/Admin/LogsController.php
index b95e4e93..e9ebee0b 100644
--- a/src/Controllers/Admin/LogsController.php
+++ b/src/Controllers/Admin/LogsController.php
@@ -20,10 +20,6 @@ class LogsController extends BaseController
'admin_log',
];
- /**
- * @param LogEntry $log
- * @param Response $response
- */
public function __construct(LogEntry $log, Response $response)
{
$this->log = $log;
@@ -31,7 +27,6 @@ class LogsController extends BaseController
}
/**
- * @param Request $request
* @return Response
*/
public function index(Request $request): Response
diff --git a/src/Controllers/Admin/NewsController.php b/src/Controllers/Admin/NewsController.php
index c7ed963e..b08071e2 100644
--- a/src/Controllers/Admin/NewsController.php
+++ b/src/Controllers/Admin/NewsController.php
@@ -35,13 +35,6 @@ class NewsController extends BaseController
'admin_news',
];
- /**
- * @param Authenticator $auth
- * @param LoggerInterface $log
- * @param News $news
- * @param Redirector $redirector
- * @param Response $response
- */
public function __construct(
Authenticator $auth,
LoggerInterface $log,
@@ -57,7 +50,6 @@ class NewsController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
@@ -72,8 +64,6 @@ class NewsController extends BaseController
}
/**
- * @param News|null $news
- * @param bool $isMeetingDefault
*
* @return Response
*/
@@ -90,7 +80,6 @@ class NewsController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
diff --git a/src/Controllers/Admin/QuestionsController.php b/src/Controllers/Admin/QuestionsController.php
index 585a96b2..3a790e38 100644
--- a/src/Controllers/Admin/QuestionsController.php
+++ b/src/Controllers/Admin/QuestionsController.php
@@ -37,13 +37,6 @@ class QuestionsController extends BaseController
'question.edit',
];
- /**
- * @param Authenticator $auth
- * @param LoggerInterface $log
- * @param Question $question
- * @param Redirector $redirector
- * @param Response $response
- */
public function __construct(
Authenticator $auth,
LoggerInterface $log,
@@ -75,7 +68,6 @@ class QuestionsController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
@@ -96,7 +88,6 @@ class QuestionsController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
@@ -110,7 +101,6 @@ class QuestionsController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
@@ -160,7 +150,6 @@ class QuestionsController extends BaseController
}
/**
- * @param Question|null $question
*
* @return Response
*/
diff --git a/src/Controllers/Admin/UserShirtController.php b/src/Controllers/Admin/UserShirtController.php
index 302216cd..08f27505 100644
--- a/src/Controllers/Admin/UserShirtController.php
+++ b/src/Controllers/Admin/UserShirtController.php
@@ -40,14 +40,6 @@ class UserShirtController extends BaseController
'saveShirt' => 'user.edit.shirt',
];
- /**
- * @param Authenticator $auth
- * @param Config $config
- * @param LoggerInterface $log
- * @param Redirector $redirector
- * @param Response $response
- * @param User $user
- */
public function __construct(
Authenticator $auth,
Config $config,
@@ -65,7 +57,6 @@ class UserShirtController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
@@ -82,7 +73,6 @@ class UserShirtController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
diff --git a/src/Controllers/Admin/UserWorkLogController.php b/src/Controllers/Admin/UserWorkLogController.php
index cee49546..6930eb5f 100644
--- a/src/Controllers/Admin/UserWorkLogController.php
+++ b/src/Controllers/Admin/UserWorkLogController.php
@@ -45,15 +45,6 @@ class UserWorkLogController extends BaseController
'admin_user_worklog',
];
- /**
- * @param Authenticator $auth
- * @param Config $config
- * @param LoggerInterface $log
- * @param Worklog $worklog
- * @param Redirector $redirector
- * @param Response $response
- * @param User $user
- */
public function __construct(
Authenticator $auth,
Config $config,
@@ -73,7 +64,6 @@ class UserWorkLogController extends BaseController
}
/**
- * @param Request $request
* @return Response
*/
public function editWorklog(Request $request): Response
@@ -96,7 +86,6 @@ class UserWorkLogController extends BaseController
}
/**
- * @param Request $request
* @return Response
*/
public function saveWorklog(Request $request): Response
@@ -135,7 +124,6 @@ class UserWorkLogController extends BaseController
}
/**
- * @param Request $request
* @return Response
*/
public function showDeleteWorklog(Request $request): Response
@@ -157,7 +145,6 @@ class UserWorkLogController extends BaseController
}
/**
- * @param Request $request
* @return Response
*/
public function deleteWorklog(Request $request): Response
diff --git a/src/Controllers/ApiController.php b/src/Controllers/ApiController.php
index a9c0be98..eeff8578 100644
--- a/src/Controllers/ApiController.php
+++ b/src/Controllers/ApiController.php
@@ -9,9 +9,6 @@ class ApiController extends BaseController
/** @var Response */
protected $response;
- /**
- * @param Response $response
- */
public function __construct(Response $response)
{
$this->response = $response;
diff --git a/src/Controllers/AuthController.php b/src/Controllers/AuthController.php
index 860d5679..de9ee20a 100644
--- a/src/Controllers/AuthController.php
+++ b/src/Controllers/AuthController.php
@@ -36,13 +36,6 @@ class AuthController extends BaseController
'postLogin' => 'login',
];
- /**
- * @param Response $response
- * @param SessionInterface $session
- * @param Redirector $redirect
- * @param Config $config
- * @param Authenticator $auth
- */
public function __construct(
Response $response,
SessionInterface $session,
@@ -79,7 +72,6 @@ class AuthController extends BaseController
/**
* Posted login form
*
- * @param Request $request
* @return Response
*/
public function postLogin(Request $request): Response
@@ -101,7 +93,6 @@ class AuthController extends BaseController
}
/**
- * @param User $user
*
* @return Response
*/
diff --git a/src/Controllers/ChecksArrivalsAndDepartures.php b/src/Controllers/ChecksArrivalsAndDepartures.php
index 882d171c..6c58792c 100644
--- a/src/Controllers/ChecksArrivalsAndDepartures.php
+++ b/src/Controllers/ChecksArrivalsAndDepartures.php
@@ -8,8 +8,6 @@ use DateTime;
trait ChecksArrivalsAndDepartures
{
/**
- * @param string|null $arrival
- * @param string|null $departure
* @return bool
*/
protected function isArrivalDateValid(?string $arrival, ?string $departure): bool
@@ -29,8 +27,6 @@ trait ChecksArrivalsAndDepartures
}
/**
- * @param string|null $arrival
- * @param string|null $departure
* @return bool
*/
protected function isDepartureDateValid(?string $arrival, ?string $departure): bool
diff --git a/src/Controllers/CreditsController.php b/src/Controllers/CreditsController.php
index ade97649..b57673ef 100644
--- a/src/Controllers/CreditsController.php
+++ b/src/Controllers/CreditsController.php
@@ -17,11 +17,6 @@ class CreditsController extends BaseController
/** @var Version */
protected $version;
- /**
- * @param Response $response
- * @param Config $config
- * @param Version $version
- */
public function __construct(Response $response, Config $config, Version $version)
{
$this->config = $config;
diff --git a/src/Controllers/DesignController.php b/src/Controllers/DesignController.php
index a0490d46..6030000e 100644
--- a/src/Controllers/DesignController.php
+++ b/src/Controllers/DesignController.php
@@ -17,10 +17,6 @@ class DesignController extends BaseController
/** @var Config */
protected $config;
- /**
- * @param Response $response
- * @param Config $config
- */
public function __construct(Response $response, Config $config)
{
$this->config = $config;
diff --git a/src/Controllers/FaqController.php b/src/Controllers/FaqController.php
index 5bf6e6c5..b97dd297 100644
--- a/src/Controllers/FaqController.php
+++ b/src/Controllers/FaqController.php
@@ -24,11 +24,6 @@ class FaqController extends BaseController
'faq.view',
];
- /**
- * @param Config $config
- * @param Faq $faq
- * @param Response $response
- */
public function __construct(
Config $config,
Faq $faq,
diff --git a/src/Controllers/HasUserNotifications.php b/src/Controllers/HasUserNotifications.php
index c5a7d97d..2e8e2f00 100644
--- a/src/Controllers/HasUserNotifications.php
+++ b/src/Controllers/HasUserNotifications.php
@@ -7,11 +7,7 @@ use Illuminate\Support\Collection;
trait HasUserNotifications
{
- /**
- * @param string|array $value
- * @param string $type
- */
- protected function addNotification($value, $type = 'messages')
+ protected function addNotification(string|array $value, string $type = 'messages')
{
session()->set(
$type,
diff --git a/src/Controllers/HealthController.php b/src/Controllers/HealthController.php
index 1ffccdbf..9a0614b9 100644
--- a/src/Controllers/HealthController.php
+++ b/src/Controllers/HealthController.php
@@ -9,9 +9,6 @@ class HealthController extends BaseController
/** @var Response */
protected $response;
- /**
- * @param Response $response
- */
public function __construct(Response $response)
{
$this->response = $response;
diff --git a/src/Controllers/HomeController.php b/src/Controllers/HomeController.php
index 521b7bdc..87693907 100644
--- a/src/Controllers/HomeController.php
+++ b/src/Controllers/HomeController.php
@@ -18,11 +18,6 @@ class HomeController extends BaseController
/** @var Redirector */
protected $redirect;
- /**
- * @param Authenticator $auth
- * @param Config $config
- * @param Redirector $redirect
- */
public function __construct(Authenticator $auth, Config $config, Redirector $redirect)
{
$this->auth = $auth;
diff --git a/src/Controllers/MessagesController.php b/src/Controllers/MessagesController.php
index 463e4dd3..5252f3eb 100644
--- a/src/Controllers/MessagesController.php
+++ b/src/Controllers/MessagesController.php
@@ -41,15 +41,6 @@ class MessagesController extends BaseController
'user_messages',
];
- /**
- * @param Authenticator $auth
- * @param Redirector $redirect
- * @param Response $response
- * @param Request $request
- * @param Database $db
- * @param Message $message
- * @param User $user
- */
public function __construct(
Authenticator $auth,
Redirector $redirect,
@@ -211,7 +202,7 @@ class MessagesController extends BaseController
* The number of unread messages per conversation of the current user.
* @return Collection of unread message amounts. Each object with key=other user, value=amount of unread messages
*/
- protected function numberOfUnreadMessagesPerConversation($currentUser): Collection
+ protected function numberOfUnreadMessagesPerConversation(User $currentUser): Collection
{
return $currentUser->messagesReceived()
->select('user_id', $this->raw('count(*) as amount'))
@@ -228,7 +219,7 @@ class MessagesController extends BaseController
* which were either send by or addressed to the current user.
* @return Collection of messages
*/
- protected function latestMessagePerConversation($currentUser): Collection
+ protected function latestMessagePerConversation(User $currentUser): Collection
{
/* requesting the IDs first, grouped by "conversation".
The more complex grouping is required for associating the messages to the correct conversations.
@@ -252,10 +243,9 @@ class MessagesController extends BaseController
}
/**
- * @param mixed $value
* @return QueryExpression
*/
- protected function raw($value): QueryExpression
+ protected function raw(mixed $value): QueryExpression
{
return $this->db->getConnection()->raw($value);
}
diff --git a/src/Controllers/Metrics/Controller.php b/src/Controllers/Metrics/Controller.php
index c5d16cf8..e0a11de8 100644
--- a/src/Controllers/Metrics/Controller.php
+++ b/src/Controllers/Metrics/Controller.php
@@ -31,14 +31,6 @@ class Controller extends BaseController
/** @var Version */
protected $version;
- /**
- * @param Response $response
- * @param MetricsEngine $engine
- * @param Config $config
- * @param Request $request
- * @param Stats $stats
- * @param Version $version
- */
public function __construct(
Response $response,
MetricsEngine $engine,
@@ -242,9 +234,8 @@ class Controller extends BaseController
/**
* Ensure that the if the request is authorized
*
- * @param bool $isJson
*/
- protected function checkAuth($isJson = false)
+ protected function checkAuth(bool $isJson = false)
{
$apiKey = $this->config->get('api_key');
if (empty($apiKey) || $this->request->get('api_key') == $apiKey) {
@@ -265,10 +256,6 @@ class Controller extends BaseController
/**
* Formats the stats collection as stats data
*
- * @param Collection $data
- * @param string $config
- * @param string $dataField
- * @param string|null $label
* @return array
*/
protected function formatStats(Collection $data, string $config, string $dataField, ?string $label = null): array
diff --git a/src/Controllers/Metrics/MetricsEngine.php b/src/Controllers/Metrics/MetricsEngine.php
index 3da39e2d..1c49213f 100644
--- a/src/Controllers/Metrics/MetricsEngine.php
+++ b/src/Controllers/Metrics/MetricsEngine.php
@@ -12,7 +12,6 @@ class MetricsEngine implements EngineInterface
/**
* Render metrics
*
- * @param string $path
* @param mixed[] $data
*
* @return string
@@ -62,7 +61,6 @@ class MetricsEngine implements EngineInterface
/**
* @param array $row
- * @param string $name
*
* @return array[]
*/
@@ -94,11 +92,9 @@ class MetricsEngine implements EngineInterface
/**
* Expand the value to be an array
*
- * @param $data
- *
* @return array
*/
- protected function expandData($data): array
+ protected function expandData(mixed $data): array
{
$data = is_array($data) ? $data : [$data];
$return = ['labels' => [], 'value' => null];
@@ -124,13 +120,11 @@ class MetricsEngine implements EngineInterface
}
/**
- * @param string $name
- * @param array|mixed $row
*
* @return string
* @see https://prometheus.io/docs/instrumenting/exposition_formats/
*/
- protected function formatData($name, $row): string
+ protected function formatData(string $name, mixed $row): string
{
return sprintf(
'%s%s %s',
@@ -159,11 +153,10 @@ class MetricsEngine implements EngineInterface
}
/**
- * @param array|mixed $row
*
* @return mixed
*/
- protected function renderValue($row)
+ protected function renderValue(mixed $row)
{
if (is_array($row)) {
$row = array_pop($row);
@@ -173,11 +166,10 @@ class MetricsEngine implements EngineInterface
}
/**
- * @param mixed $value
*
* @return mixed
*/
- protected function formatValue($value)
+ protected function formatValue(mixed $value)
{
if (is_bool($value)) {
return (int)$value;
@@ -187,11 +179,10 @@ class MetricsEngine implements EngineInterface
}
/**
- * @param mixed $value
*
* @return mixed
*/
- protected function escape($value)
+ protected function escape(mixed $value)
{
$replace = [
'\\' => '\\\\',
@@ -207,7 +198,6 @@ class MetricsEngine implements EngineInterface
}
/**
- * @param string $path
*
* @return bool
*/
@@ -220,9 +210,8 @@ class MetricsEngine implements EngineInterface
* Does nothing as shared data will only result in unexpected behaviour
*
* @param string|mixed[] $key
- * @param mixed $value
*/
- public function share($key, $value = null): void
+ public function share(string|array $key, mixed $value = null): void
{
}
}
diff --git a/src/Controllers/Metrics/Stats.php b/src/Controllers/Metrics/Stats.php
index 66818ec5..f893ddde 100644
--- a/src/Controllers/Metrics/Stats.php
+++ b/src/Controllers/Metrics/Stats.php
@@ -22,6 +22,7 @@ use Engelsystem\Models\User\Settings;
use Engelsystem\Models\User\State;
use Engelsystem\Models\User\User;
use Engelsystem\Models\Worklog;
+use Illuminate\Contracts\Database\Query\Builder as BuilderContract;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Query\Expression as QueryExpression;
use Illuminate\Support\Collection;
@@ -31,9 +32,6 @@ class Stats
/** @var Database */
protected $db;
- /**
- * @param Database $db
- */
public function __construct(Database $db)
{
$this->db = $db;
@@ -103,7 +101,6 @@ class Stats
}
/**
- * @param string $type
*
* @return int
*/
@@ -315,16 +312,17 @@ class Stats
/**
* @param array $buckets
- * @param QueryBuilder $basicQuery
- * @param string $groupBy
- * @param string $having
- * @param string $count
*
* @return array
* @codeCoverageIgnore As long as its only used for old tables
*/
- protected function getBuckets(array $buckets, $basicQuery, string $groupBy, string $having, string $count): array
- {
+ protected function getBuckets(
+ array $buckets,
+ BuilderContract $basicQuery,
+ string $groupBy,
+ string $having,
+ string $count
+ ): array {
$return = [];
foreach ($buckets as $bucket) {
@@ -512,7 +510,6 @@ class Stats
}
/**
- * @param string $table
* @return QueryBuilder
*/
protected function getQuery(string $table): QueryBuilder
@@ -523,10 +520,9 @@ class Stats
}
/**
- * @param mixed $value
* @return QueryExpression
*/
- protected function raw($value): QueryExpression
+ protected function raw(mixed $value): QueryExpression
{
return $this->db->getConnection()->raw($value);
}
diff --git a/src/Controllers/NewsController.php b/src/Controllers/NewsController.php
index c8f82950..450e6c18 100644
--- a/src/Controllers/NewsController.php
+++ b/src/Controllers/NewsController.php
@@ -48,16 +48,6 @@ class NewsController extends BaseController
'deleteComment' => 'news_comments',
];
- /**
- * @param Authenticator $auth
- * @param Config $config
- * @param NewsComment $comment
- * @param LoggerInterface $log
- * @param News $news
- * @param Redirector $redirector
- * @param Response $response
- * @param Request $request
- */
public function __construct(
Authenticator $auth,
NewsComment $comment,
@@ -95,7 +85,6 @@ class NewsController extends BaseController
}
/**
- * @param Request $request
* @return Response
*/
public function show(Request $request): Response
@@ -111,7 +100,6 @@ class NewsController extends BaseController
}
/**
- * @param Request $request
* @return Response
*/
public function comment(Request $request): Response
@@ -144,7 +132,6 @@ class NewsController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
@@ -180,7 +167,6 @@ class NewsController extends BaseController
}
/**
- * @param bool $onlyMeetings
* @return Response
*/
protected function showOverview(bool $onlyMeetings = false): Response
@@ -216,7 +202,6 @@ class NewsController extends BaseController
}
/**
- * @param string $page
* @param array $data
* @return Response
*/
diff --git a/src/Controllers/OAuthController.php b/src/Controllers/OAuthController.php
index 295abd4c..16a83299 100644
--- a/src/Controllers/OAuthController.php
+++ b/src/Controllers/OAuthController.php
@@ -49,16 +49,6 @@ class OAuthController extends BaseController
/** @var UrlGenerator */
protected $url;
- /**
- * @param Authenticator $auth
- * @param AuthController $authController
- * @param Config $config
- * @param LoggerInterface $log
- * @param OAuth $oauth
- * @param Redirector $redirector
- * @param Session $session
- * @param UrlGenerator $url
- */
public function __construct(
Authenticator $auth,
AuthController $authController,
@@ -80,7 +70,6 @@ class OAuthController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
@@ -213,7 +202,6 @@ class OAuthController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
@@ -229,7 +217,6 @@ class OAuthController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
@@ -249,7 +236,6 @@ class OAuthController extends BaseController
}
/**
- * @param string $name
*
* @return AbstractProvider
*/
@@ -272,8 +258,6 @@ class OAuthController extends BaseController
}
/**
- * @param string $providerName
- * @param ResourceOwner $resourceOwner
* @return mixed
*/
protected function getId(string $providerName, ResourceOwner $resourceOwner)
@@ -287,9 +271,6 @@ class OAuthController extends BaseController
return $data[$config['id']];
}
- /**
- * @param string $provider
- */
protected function requireProvider(string $provider): void
{
if (!$this->isValidProvider($provider)) {
@@ -298,7 +279,6 @@ class OAuthController extends BaseController
}
/**
- * @param string $name
*
* @return bool
*/
@@ -309,11 +289,6 @@ class OAuthController extends BaseController
return isset($config[$name]);
}
- /**
- * @param OAuth $auth
- * @param string $providerName
- * @param ResourceOwner $resourceOwner
- */
protected function handleArrive(
string $providerName,
OAuth $auth,
@@ -342,8 +317,6 @@ class OAuthController extends BaseController
}
/**
- * @param IdentityProviderException $e
- * @param string $providerName
*
* @throws HttpNotFound
*/
@@ -364,11 +337,7 @@ class OAuthController extends BaseController
}
/**
- * @param string $providerName
- * @param string $providerUserIdentifier
- * @param AccessTokenInterface $accessToken
* @param array $config
- * @param Collection $userdata
*
* @return Response
*/
diff --git a/src/Controllers/PasswordResetController.php b/src/Controllers/PasswordResetController.php
index bfcfa54e..02e5bcee 100644
--- a/src/Controllers/PasswordResetController.php
+++ b/src/Controllers/PasswordResetController.php
@@ -35,12 +35,6 @@ class PasswordResetController extends BaseController
'postResetPassword' => 'login',
];
- /**
- * @param Response $response
- * @param SessionInterface $session
- * @param EngelsystemMailer $mail
- * @param LoggerInterface $log
- */
public function __construct(
Response $response,
SessionInterface $session,
@@ -62,7 +56,6 @@ class PasswordResetController extends BaseController
}
/**
- * @param Request $request
* @return Response
*/
public function postReset(Request $request): Response
@@ -96,7 +89,6 @@ class PasswordResetController extends BaseController
}
/**
- * @param Request $request
* @return Response
*/
public function resetPassword(Request $request): Response
@@ -110,7 +102,6 @@ class PasswordResetController extends BaseController
}
/**
- * @param Request $request
* @return Response
*/
public function postResetPassword(Request $request): Response
@@ -135,11 +126,10 @@ class PasswordResetController extends BaseController
}
/**
- * @param string $view
* @param array $data
* @return Response
*/
- protected function showView($view = 'pages/password/reset', $data = []): Response
+ protected function showView(string $view = 'pages/password/reset', array $data = []): Response
{
return $this->response->withView(
$view,
@@ -148,7 +138,6 @@ class PasswordResetController extends BaseController
}
/**
- * @param Request $request
* @return PasswordReset
*/
protected function requireToken(Request $request): PasswordReset
diff --git a/src/Controllers/QuestionsController.php b/src/Controllers/QuestionsController.php
index c1770ef1..1f7714db 100644
--- a/src/Controllers/QuestionsController.php
+++ b/src/Controllers/QuestionsController.php
@@ -34,13 +34,6 @@ class QuestionsController extends BaseController
'question.add',
];
- /**
- * @param Authenticator $auth
- * @param LoggerInterface $log
- * @param Question $question
- * @param Redirector $redirect
- * @param Response $response
- */
public function __construct(
Authenticator $auth,
LoggerInterface $log,
@@ -84,7 +77,6 @@ class QuestionsController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
@@ -112,7 +104,6 @@ class QuestionsController extends BaseController
}
/**
- * @param Request $request
*
* @return Response
*/
diff --git a/src/Controllers/SettingsController.php b/src/Controllers/SettingsController.php
index 11a952c9..28d9bcba 100644
--- a/src/Controllers/SettingsController.php
+++ b/src/Controllers/SettingsController.php
@@ -35,13 +35,6 @@ class SettingsController extends BaseController
'user_settings',
];
- /**
- * @param Authenticator $auth
- * @param Config $config
- * @param LoggerInterface $log
- * @param Redirector $redirector
- * @param Response $response
- */
public function __construct(
Authenticator $auth,
Config $config,
@@ -73,7 +66,6 @@ class SettingsController extends BaseController
}
/**
- * @param Request $request
* @return Response
*/
public function saveProfile(Request $request): Response
@@ -151,7 +143,6 @@ class SettingsController extends BaseController
}
/**
- * @param Request $request
* @return Response
*/
public function savePassword(Request $request): Response
@@ -201,7 +192,6 @@ class SettingsController extends BaseController
}
/**
- * @param Request $request
* @return Response
*/
public function saveTheme(Request $request): Response
@@ -242,7 +232,6 @@ class SettingsController extends BaseController
}
/**
- * @param Request $request
* @return Response
*/
public function saveLanguage(Request $request): Response
diff --git a/src/Database/Database.php b/src/Database/Database.php
index 407a8bf9..cc6a31cd 100644
--- a/src/Database/Database.php
+++ b/src/Database/Database.php
@@ -10,9 +10,6 @@ class Database
/** @var DatabaseConnection */
protected $connection;
- /**
- * @param DatabaseConnection $connection
- */
public function __construct(DatabaseConnection $connection)
{
$this->connection = $connection;
@@ -21,11 +18,10 @@ class Database
/**
* Run a select query
*
- * @param string $query
* @param array $bindings
* @return object[]
*/
- public function select($query, array $bindings = [])
+ public function select(string $query, array $bindings = [])
{
return $this->connection->select($query, $bindings);
}
@@ -33,11 +29,10 @@ class Database
/**
* Run a select query and return only the first result or null if no result is found.
*
- * @param string $query
* @param array $bindings
* @return object|null
*/
- public function selectOne($query, array $bindings = [])
+ public function selectOne(string $query, array $bindings = [])
{
return $this->connection->selectOne($query, $bindings);
}
@@ -45,11 +40,10 @@ class Database
/**
* Run an insert query
*
- * @param string $query
* @param array $bindings
* @return bool
*/
- public function insert($query, array $bindings = [])
+ public function insert(string $query, array $bindings = [])
{
return $this->connection->insert($query, $bindings);
}
@@ -57,11 +51,10 @@ class Database
/**
* Run an update query
*
- * @param string $query
* @param array $bindings
* @return int
*/
- public function update($query, array $bindings = [])
+ public function update(string $query, array $bindings = [])
{
return $this->connection->update($query, $bindings);
}
@@ -69,11 +62,10 @@ class Database
/**
* Run a delete query
*
- * @param string $query
* @param array $bindings
* @return int
*/
- public function delete($query, array $bindings = [])
+ public function delete(string $query, array $bindings = [])
{
return $this->connection->delete($query, $bindings);
}
diff --git a/src/Database/DatabaseServiceProvider.php b/src/Database/DatabaseServiceProvider.php
index 2bee95c1..60ed9386 100644
--- a/src/Database/DatabaseServiceProvider.php
+++ b/src/Database/DatabaseServiceProvider.php
@@ -57,7 +57,6 @@ class DatabaseServiceProvider extends ServiceProvider
}
/**
- * @param Throwable $exception
*
* @throws Exception
*/
diff --git a/src/Database/Db.php b/src/Database/Db.php
index d007f1e5..1bdc84ee 100644
--- a/src/Database/Db.php
+++ b/src/Database/Db.php
@@ -15,9 +15,8 @@ class Db
/**
* Set the database connection manager
*
- * @param CapsuleManager $dbManager
*/
- public static function setDbManager($dbManager)
+ public static function setDbManager(CapsuleManager $dbManager)
{
self::$dbManager = $dbManager;
}
@@ -25,11 +24,10 @@ class Db
/**
* Run a select query
*
- * @param string $query
* @param array $bindings
* @return array[]
*/
- public static function select($query, array $bindings = [])
+ public static function select(string $query, array $bindings = [])
{
$return = self::connection()->select($query, $bindings);
@@ -44,11 +42,10 @@ class Db
/**
* Run a select query and return only the first result or null if no result is found.
*
- * @param string $query
* @param array $bindings
* @return array|null
*/
- public static function selectOne($query, array $bindings = [])
+ public static function selectOne(string $query, array $bindings = [])
{
$result = self::connection()->selectOne($query, $bindings);
@@ -64,11 +61,10 @@ class Db
/**
* Run an insert query
*
- * @param string $query
* @param array $bindings
* @return bool
*/
- public static function insert($query, array $bindings = [])
+ public static function insert(string $query, array $bindings = [])
{
return self::connection()->insert($query, $bindings);
}
@@ -76,11 +72,10 @@ class Db
/**
* Run an update query
*
- * @param string $query
* @param array $bindings
* @return int
*/
- public static function update($query, array $bindings = [])
+ public static function update(string $query, array $bindings = [])
{
return self::connection()->update($query, $bindings);
}
@@ -88,11 +83,10 @@ class Db
/**
* Run a delete query
*
- * @param string $query
* @param array $bindings
* @return int
*/
- public static function delete($query, array $bindings = [])
+ public static function delete(string $query, array $bindings = [])
{
return self::connection()->delete($query, $bindings);
}
diff --git a/src/Database/Migration/Migrate.php b/src/Database/Migration/Migrate.php
index 572d560b..51d8fb00 100644
--- a/src/Database/Migration/Migrate.php
+++ b/src/Database/Migration/Migrate.php
@@ -34,8 +34,6 @@ class Migrate
/**
* Migrate constructor
*
- * @param SchemaBuilder $schema
- * @param Application $app
*/
public function __construct(SchemaBuilder $schema, Application $app)
{
@@ -48,12 +46,9 @@ class Migrate
/**
* Run a migration
*
- * @param string $path
* @param string $type (up|down)
- * @param bool $oneStep
- * @param bool $forceMigration
*/
- public function run($path, $type = self::UP, $oneStep = false, $forceMigration = false)
+ public function run(string $path, string $type = self::UP, bool $oneStep = false, bool $forceMigration = false)
{
$this->initMigration();
@@ -118,8 +113,6 @@ class Migrate
/**
* Merge file migrations with already migrated tables
*
- * @param Collection $migrations
- * @param Collection $migrated
* @return Collection
*/
protected function mergeMigrations(Collection $migrations, Collection $migrated)
@@ -163,11 +156,9 @@ class Migrate
/**
* Migrate a migration
*
- * @param string $file
- * @param string $migration
* @param string $type (up|down)
*/
- protected function migrate($file, $migration, $type = self::UP)
+ protected function migrate(string $file, string $migration, string $type = self::UP)
{
require_once $file;
@@ -183,10 +174,9 @@ class Migrate
/**
* Set a migration to migrated
*
- * @param string $migration
* @param string $type (up|down)
*/
- protected function setMigrated($migration, $type = self::UP)
+ protected function setMigrated(string $migration, string $type = self::UP)
{
$table = $this->getTableQuery();
@@ -201,11 +191,10 @@ class Migrate
/**
* Lock the migrations table
*
- * @param bool $forceMigration
*
* @throws Throwable
*/
- protected function lockTable($forceMigration = false)
+ protected function lockTable(bool $forceMigration = false)
{
$this->schema->getConnection()->transaction(function () use ($forceMigration) {
$lock = $this->getTableQuery()
@@ -235,11 +224,10 @@ class Migrate
/**
* Get a list of migration files
*
- * @param string $dir
*
* @return Collection
*/
- protected function getMigrations($dir)
+ protected function getMigrations(string $dir)
{
$files = $this->getMigrationFiles($dir);
@@ -260,11 +248,10 @@ class Migrate
/**
* List all migration files from the given directory
*
- * @param string $dir
*
* @return array
*/
- protected function getMigrationFiles($dir)
+ protected function getMigrationFiles(string $dir)
{
return glob($dir . '/*_*.php');
}
@@ -282,7 +269,6 @@ class Migrate
/**
* Set the output function
*
- * @param callable $output
*/
public function setOutput(callable $output)
{
diff --git a/src/Database/Migration/Migration.php b/src/Database/Migration/Migration.php
index 586cfcff..60e313cc 100644
--- a/src/Database/Migration/Migration.php
+++ b/src/Database/Migration/Migration.php
@@ -12,7 +12,6 @@ abstract class Migration
/**
* Migration constructor.
*
- * @param SchemaBuilder $schemaBuilder
*/
public function __construct(SchemaBuilder $schemaBuilder)
{
diff --git a/src/Events/EventDispatcher.php b/src/Events/EventDispatcher.php
index f6cc1915..8db55a6e 100644
--- a/src/Events/EventDispatcher.php
+++ b/src/Events/EventDispatcher.php
@@ -10,45 +10,33 @@ class EventDispatcher
/** @var callable[] */
protected $listeners;
- /**
- * @param array|string $events
- * @param callable|string $listener
- */
- public function listen($events, $listener): void
+ public function listen(array|string $events, callable|string $listener): void
{
foreach ((array)$events as $event) {
$this->listeners[$event][] = $listener;
}
}
- /**
- * @param string $event
- */
- public function forget($event): void
+ public function forget(string $event): void
{
unset($this->listeners[$event]);
}
/**
- * @param string|object $event
- * @param array|mixed $payload
- * @param bool $halt
*
* @return array|mixed|null
*/
- public function fire($event, $payload = [], $halt = false)
+ public function fire(string|object $event, mixed $payload = [], bool $halt = false)
{
return $this->dispatch($event, $payload, $halt);
}
/**
- * @param string|object $event
- * @param array|mixed $payload
* @param bool $halt Stop on first non-null return
*
* @return array|null|mixed
*/
- public function dispatch($event, $payload = [], $halt = false)
+ public function dispatch(string|object $event, mixed $payload = [], bool $halt = false)
{
if (is_object($event)) {
$payload = $event;
diff --git a/src/Events/EventsServiceProvider.php b/src/Events/EventsServiceProvider.php
index 50005ded..9eb05dc1 100644
--- a/src/Events/EventsServiceProvider.php
+++ b/src/Events/EventsServiceProvider.php
@@ -17,9 +17,6 @@ class EventsServiceProvider extends ServiceProvider
$this->registerEvents($dispatcher);
}
- /**
- * @param EventDispatcher $dispatcher
- */
protected function registerEvents(EventDispatcher $dispatcher)
{
/** @var Config $config */
diff --git a/src/Events/Listener/News.php b/src/Events/Listener/News.php
index 7cb9836d..e5590f15 100644
--- a/src/Events/Listener/News.php
+++ b/src/Events/Listener/News.php
@@ -21,11 +21,6 @@ class News
/** @var UserSettings */
protected $settings;
- /**
- * @param LoggerInterface $log
- * @param EngelsystemMailer $mailer
- * @param UserSettings $settings
- */
public function __construct(
LoggerInterface $log,
EngelsystemMailer $mailer,
@@ -36,9 +31,6 @@ class News
$this->settings = $settings;
}
- /**
- * @param NewsModel $news
- */
public function created(NewsModel $news)
{
/** @var UserSettings[]|Collection $recipients */
@@ -52,12 +44,6 @@ class News
}
}
- /**
- * @param NewsModel $news
- * @param User $user
- * @param string $subject
- * @param string $template
- */
protected function sendMail(NewsModel $news, User $user, string $subject, string $template)
{
try {
diff --git a/src/Events/Listener/OAuth2.php b/src/Events/Listener/OAuth2.php
index 9d82556e..06d94fcd 100644
--- a/src/Events/Listener/OAuth2.php
+++ b/src/Events/Listener/OAuth2.php
@@ -21,10 +21,6 @@ class OAuth2
/** @var LoggerInterface */
protected LoggerInterface $log;
- /**
- * @param Config $config
- * @param LoggerInterface $log
- */
public function __construct(Config $config, LoggerInterface $log, Authenticator $auth)
{
$this->auth = $auth;
@@ -33,7 +29,6 @@ class OAuth2
}
/**
- * @param string $event
* @param string $provider OAuth provider name
* @param Collection $data OAuth userdata
*/
diff --git a/src/Exceptions/ExceptionsServiceProvider.php b/src/Exceptions/ExceptionsServiceProvider.php
index 4b53c726..6cf6f014 100644
--- a/src/Exceptions/ExceptionsServiceProvider.php
+++ b/src/Exceptions/ExceptionsServiceProvider.php
@@ -32,10 +32,7 @@ class ExceptionsServiceProvider extends ServiceProvider
$this->addLogger($handler);
}
- /**
- * @param Handler $errorHandler
- */
- protected function addProductionHandler($errorHandler)
+ protected function addProductionHandler(Handler $errorHandler)
{
$handler = $this->app->make(Legacy::class);
$this->app->instance('error.handler.production', $handler);
@@ -43,10 +40,7 @@ class ExceptionsServiceProvider extends ServiceProvider
$this->app->bind(HandlerInterface::class, 'error.handler.production');
}
- /**
- * @param Handler $errorHandler
- */
- protected function addDevelopmentHandler($errorHandler)
+ protected function addDevelopmentHandler(Handler $errorHandler)
{
$handler = $this->app->make(LegacyDevelopment::class);
@@ -58,9 +52,6 @@ class ExceptionsServiceProvider extends ServiceProvider
$errorHandler->setHandler(Handler::ENV_DEVELOPMENT, $handler);
}
- /**
- * @param Handler $handler
- */
protected function addLogger(Handler $handler)
{
foreach ($handler->getHandler() as $h) {
diff --git a/src/Exceptions/Handler.php b/src/Exceptions/Handler.php
index 4a063bf4..323bddb6 100644
--- a/src/Exceptions/Handler.php
+++ b/src/Exceptions/Handler.php
@@ -30,7 +30,7 @@ class Handler
*
* @param string $environment prod|dev
*/
- public function __construct($environment = self::ENV_PRODUCTION)
+ public function __construct(string $environment = self::ENV_PRODUCTION)
{
$this->environment = $environment;
}
@@ -44,24 +44,16 @@ class Handler
set_exception_handler([$this, 'exceptionHandler']);
}
- /**
- * @param int $number
- * @param string $message
- * @param string $file
- * @param int $line
- */
- public function errorHandler($number, $message, $file, $line)
+ public function errorHandler(int $number, string $message, string $file, int $line)
{
$exception = new ErrorException($message, 0, $number, $file, $line);
$this->exceptionHandler($exception);
}
/**
- * @param Throwable $e
- * @param bool $return
* @return string
*/
- public function exceptionHandler($e, $return = false)
+ public function exceptionHandler(Throwable $e, bool $return = false)
{
if (!$this->request instanceof Request) {
$this->request = new Request();
@@ -90,9 +82,8 @@ class Handler
* Exit the application
*
* @codeCoverageIgnore
- * @param string $message
*/
- protected function terminateApplicationImmediately($message = '')
+ protected function terminateApplicationImmediately(string $message = '')
{
echo $message;
die(1);
@@ -106,19 +97,15 @@ class Handler
return $this->environment;
}
- /**
- * @param string $environment
- */
- public function setEnvironment($environment)
+ public function setEnvironment(string $environment)
{
$this->environment = $environment;
}
/**
- * @param string $environment
* @return HandlerInterface|HandlerInterface[]
*/
- public function getHandler($environment = null)
+ public function getHandler(string $environment = null)
{
if (!is_null($environment)) {
return $this->handler[$environment];
@@ -127,11 +114,7 @@ class Handler
return $this->handler;
}
- /**
- * @param string $environment
- * @param HandlerInterface $handler
- */
- public function setHandler($environment, HandlerInterface $handler)
+ public function setHandler(string $environment, HandlerInterface $handler)
{
$this->handler[$environment] = $handler;
}
@@ -144,9 +127,6 @@ class Handler
return $this->request;
}
- /**
- * @param Request $request
- */
public function setRequest(Request $request)
{
$this->request = $request;
diff --git a/src/Exceptions/Handlers/HandlerInterface.php b/src/Exceptions/Handlers/HandlerInterface.php
index 838fee4a..d2e80510 100644
--- a/src/Exceptions/Handlers/HandlerInterface.php
+++ b/src/Exceptions/Handlers/HandlerInterface.php
@@ -7,14 +7,7 @@ use Throwable;
interface HandlerInterface
{
- /**
- * @param Request $request
- * @param Throwable $e
- */
- public function render($request, Throwable $e);
+ public function render(Request $request, Throwable $e);
- /**
- * @param Throwable $e
- */
public function report(Throwable $e);
}
diff --git a/src/Exceptions/Handlers/Legacy.php b/src/Exceptions/Handlers/Legacy.php
index 356bd6f4..b42ce437 100644
--- a/src/Exceptions/Handlers/Legacy.php
+++ b/src/Exceptions/Handlers/Legacy.php
@@ -11,18 +11,11 @@ class Legacy implements HandlerInterface
/** @var LoggerInterface */
protected $log;
- /**
- * @param Request $request
- * @param Throwable $e
- */
- public function render($request, Throwable $e)
+ public function render(Request $request, Throwable $e)
{
echo 'An unexpected error occurred. A team of untrained monkeys has been dispatched to fix it.';
}
- /**
- * @param Throwable $e
- */
public function report(Throwable $e)
{
$previous = $e->getPrevious();
@@ -46,19 +39,15 @@ class Legacy implements HandlerInterface
}
}
- /**
- * @param LoggerInterface $logger
- */
public function setLogger(LoggerInterface $logger)
{
$this->log = $logger;
}
/**
- * @param string $path
* @return string
*/
- protected function stripBasePath($path)
+ protected function stripBasePath(string $path)
{
$basePath = realpath(__DIR__ . '/../../..') . '/';
return str_replace($basePath, '', $path);
diff --git a/src/Exceptions/Handlers/LegacyDevelopment.php b/src/Exceptions/Handlers/LegacyDevelopment.php
index 6384d45d..2d87d913 100644
--- a/src/Exceptions/Handlers/LegacyDevelopment.php
+++ b/src/Exceptions/Handlers/LegacyDevelopment.php
@@ -7,11 +7,7 @@ use Throwable;
class LegacyDevelopment extends Legacy
{
- /**
- * @param Request $request
- * @param Throwable $e
- */
- public function render($request, Throwable $e)
+ public function render(Request $request, Throwable $e)
{
$file = $this->stripBasePath($e->getFile());
@@ -40,7 +36,7 @@ class LegacyDevelopment extends Legacy
* @param array $stackTrace
* @return array
*/
- protected function formatStackTrace($stackTrace)
+ protected function formatStackTrace(array $stackTrace)
{
$return = [];
$stackTrace = array_reverse($stackTrace);
diff --git a/src/Exceptions/Handlers/NullHandler.php b/src/Exceptions/Handlers/NullHandler.php
index f38441c4..bcfdcb39 100644
--- a/src/Exceptions/Handlers/NullHandler.php
+++ b/src/Exceptions/Handlers/NullHandler.php
@@ -7,11 +7,7 @@ use Throwable;
class NullHandler extends Legacy
{
- /**
- * @param Request $request
- * @param Throwable $e
- */
- public function render($request, Throwable $e)
+ public function render(Request $request, Throwable $e)
{
return;
}
diff --git a/src/Exceptions/Handlers/Whoops.php b/src/Exceptions/Handlers/Whoops.php
index d328b6af..26013d80 100644
--- a/src/Exceptions/Handlers/Whoops.php
+++ b/src/Exceptions/Handlers/Whoops.php
@@ -19,18 +19,13 @@ class Whoops extends Legacy implements HandlerInterface
/**
* Whoops constructor.
*
- * @param Container $app
*/
public function __construct(Container $app)
{
$this->app = $app;
}
- /**
- * @param Request $request
- * @param Throwable $e
- */
- public function render($request, Throwable $e)
+ public function render(Request $request, Throwable $e)
{
$whoops = $this->app->make(WhoopsRunner::class);
$handler = $this->getPrettyPageHandler($e);
@@ -47,7 +42,6 @@ class Whoops extends Legacy implements HandlerInterface
}
/**
- * @param Throwable $e
* @return PrettyPageHandler
*/
protected function getPrettyPageHandler(Throwable $e)
diff --git a/src/Helpers/Assets.php b/src/Helpers/Assets.php
index a94ebd71..d3c54ba7 100644
--- a/src/Helpers/Assets.php
+++ b/src/Helpers/Assets.php
@@ -19,7 +19,6 @@ class Assets
}
/**
- * @param string $asset
* @return string
*/
public function getAssetPath(string $asset): string
diff --git a/src/Helpers/Authenticator.php b/src/Helpers/Authenticator.php
index 125a3391..bb512251 100644
--- a/src/Helpers/Authenticator.php
+++ b/src/Helpers/Authenticator.php
@@ -35,11 +35,6 @@ class Authenticator
/** @var int */
protected int $guestRole = 10;
- /**
- * @param ServerRequestInterface $request
- * @param Session $session
- * @param UserRepository $userRepository
- */
public function __construct(ServerRequestInterface $request, Session $session, UserRepository $userRepository)
{
$this->request = $request;
@@ -78,7 +73,6 @@ class Authenticator
/**
* Get the user by his api key
*
- * @param string $parameter
* @return User|null
*/
public function apiUser(string $parameter = 'api_key'): ?User
@@ -110,7 +104,7 @@ class Authenticator
* @param string[]|string $abilities
* @return bool
*/
- public function can($abilities): bool
+ public function can(array|string $abilities): bool
{
$abilities = (array)$abilities;
@@ -143,8 +137,6 @@ class Authenticator
}
/**
- * @param string $login
- * @param string $password
* @return User|null
*/
public function authenticate(string $login, string $password): ?User
@@ -167,8 +159,6 @@ class Authenticator
}
/**
- * @param User $user
- * @param string $password
* @return bool
*/
public function verifyPassword(User $user, string $password): bool
@@ -184,10 +174,6 @@ class Authenticator
return true;
}
- /**
- * @param User $user
- * @param string $password
- */
public function setPassword(User $user, string $password)
{
$user->password = password_hash($password, $this->passwordAlgorithm);
@@ -202,10 +188,7 @@ class Authenticator
return $this->passwordAlgorithm;
}
- /**
- * @param int|string|null $passwordAlgorithm
- */
- public function setPasswordAlgorithm($passwordAlgorithm)
+ public function setPasswordAlgorithm(int|string|null $passwordAlgorithm)
{
$this->passwordAlgorithm = $passwordAlgorithm;
}
@@ -218,9 +201,6 @@ class Authenticator
return $this->defaultRole;
}
- /**
- * @param int $defaultRole
- */
public function setDefaultRole(int $defaultRole)
{
$this->defaultRole = $defaultRole;
@@ -234,9 +214,6 @@ class Authenticator
return $this->guestRole;
}
- /**
- * @param int $guestRole
- */
public function setGuestRole(int $guestRole)
{
$this->guestRole = $guestRole;
diff --git a/src/Helpers/Carbon.php b/src/Helpers/Carbon.php
index 31dbd98d..c12747f5 100644
--- a/src/Helpers/Carbon.php
+++ b/src/Helpers/Carbon.php
@@ -18,7 +18,6 @@ class Carbon extends \Carbon\Carbon
/**
* Parses HTML datetime-local and ISO date/time strings.
*
- * @param string $value
* @return \Carbon\Carbon|null Carbon if parseable, else null
* @see self::DATETIME_FORMATS
*/
@@ -36,7 +35,6 @@ class Carbon extends \Carbon\Carbon
/**
* Parses HTML datetime-local and ISO date/time strings.
*
- * @param string $value
* @return int|null Timestamp if parseable, else null
* @see self::DATETIME_FORMATS
*/
diff --git a/src/Helpers/ConfigureEnvironmentServiceProvider.php b/src/Helpers/ConfigureEnvironmentServiceProvider.php
index 6722ce55..cc79a25b 100644
--- a/src/Helpers/ConfigureEnvironmentServiceProvider.php
+++ b/src/Helpers/ConfigureEnvironmentServiceProvider.php
@@ -27,7 +27,6 @@ class ConfigureEnvironmentServiceProvider extends ServiceProvider
}
/**
- * @param CarbonTimeZone $timeZone
* @codeCoverageIgnore
*/
protected function setTimeZone(CarbonTimeZone $timeZone)
@@ -37,7 +36,6 @@ class ConfigureEnvironmentServiceProvider extends ServiceProvider
}
/**
- * @param bool $displayErrors
* @codeCoverageIgnore
*/
protected function displayErrors(bool $displayErrors)
@@ -46,7 +44,6 @@ class ConfigureEnvironmentServiceProvider extends ServiceProvider
}
/**
- * @param int $errorReporting
* @codeCoverageIgnore
*/
protected function errorReporting(int $errorReporting)
diff --git a/src/Helpers/Schedule/CalculatesTime.php b/src/Helpers/Schedule/CalculatesTime.php
index c9dbeea1..497b7cc6 100644
--- a/src/Helpers/Schedule/CalculatesTime.php
+++ b/src/Helpers/Schedule/CalculatesTime.php
@@ -7,7 +7,6 @@ namespace Engelsystem\Helpers\Schedule;
trait CalculatesTime
{
/**
- * @param string $time
* @return int
*/
protected function secondsFromTime(string $time): int
diff --git a/src/Helpers/Schedule/Conference.php b/src/Helpers/Schedule/Conference.php
index 0819d059..d8519cf8 100644
--- a/src/Helpers/Schedule/Conference.php
+++ b/src/Helpers/Schedule/Conference.php
@@ -32,13 +32,6 @@ class Conference
/**
* Event constructor.
*
- * @param string $title
- * @param string $acronym
- * @param string|null $start
- * @param string|null $end
- * @param int|null $days
- * @param string|null $timeslotDuration
- * @param string|null $baseUrl
*/
public function __construct(
string $title,
diff --git a/src/Helpers/Schedule/Day.php b/src/Helpers/Schedule/Day.php
index 03106e8f..708652c2 100644
--- a/src/Helpers/Schedule/Day.php
+++ b/src/Helpers/Schedule/Day.php
@@ -26,10 +26,6 @@ class Day
/**
* Day constructor.
*
- * @param string $date
- * @param Carbon $start
- * @param Carbon $end
- * @param int $index
* @param Room[] $rooms
*/
public function __construct(
diff --git a/src/Helpers/Schedule/Event.php b/src/Helpers/Schedule/Event.php
index ab3b39a5..cb417e1c 100644
--- a/src/Helpers/Schedule/Event.php
+++ b/src/Helpers/Schedule/Event.php
@@ -79,27 +79,10 @@ class Event
/**
* Event constructor.
*
- * @param string $guid
- * @param int $id
- * @param Room $room
- * @param string $title
- * @param string $subtitle
- * @param string $type
- * @param Carbon $date
- * @param string $start
- * @param string $duration
- * @param string $abstract
- * @param string $slug
- * @param string $track
- * @param string|null $logo
* @param string[] $persons
- * @param string|null $language
- * @param string|null $description
* @param string|null $recording license
* @param array $links
* @param array $attachments
- * @param string|null $url
- * @param string|null $videoDownloadUrl
*/
public function __construct(
string $guid,
@@ -183,9 +166,6 @@ class Event
return $this->title;
}
- /**
- * @param string $title
- */
public function setTitle(string $title): void
{
$this->title = $title;
diff --git a/src/Helpers/Schedule/Room.php b/src/Helpers/Schedule/Room.php
index 45a09f5f..b54ab03a 100644
--- a/src/Helpers/Schedule/Room.php
+++ b/src/Helpers/Schedule/Room.php
@@ -15,7 +15,6 @@ class Room
/**
* Room constructor.
*
- * @param string $name
* @param Event[] $events
*/
public function __construct(
diff --git a/src/Helpers/Schedule/Schedule.php b/src/Helpers/Schedule/Schedule.php
index 7150480c..0e81fbfe 100644
--- a/src/Helpers/Schedule/Schedule.php
+++ b/src/Helpers/Schedule/Schedule.php
@@ -18,8 +18,6 @@ class Schedule
protected $day;
/**
- * @param string $version
- * @param Conference $conference
* @param Day[] $days
*/
public function __construct(
diff --git a/src/Helpers/Schedule/XmlParser.php b/src/Helpers/Schedule/XmlParser.php
index 4255be8b..c130e3c5 100644
--- a/src/Helpers/Schedule/XmlParser.php
+++ b/src/Helpers/Schedule/XmlParser.php
@@ -16,7 +16,6 @@ class XmlParser
protected $schedule;
/**
- * @param string $xml
* @return bool
*/
public function load(string $xml): bool
@@ -82,7 +81,6 @@ class XmlParser
/**
* @param SimpleXMLElement[] $eventElements
- * @param Room $room
* @return array
*/
protected function parseEvents(array $eventElements, Room $room): array
@@ -129,8 +127,6 @@ class XmlParser
}
/**
- * @param string $path
- * @param SimpleXMLElement|null $xml
* @return string
*/
protected function getFirstXpathContent(string $path, ?SimpleXMLElement $xml = null): string
@@ -143,10 +139,6 @@ class XmlParser
/**
* Resolves a list from a sequence of elements
*
- * @param SimpleXMLElement $element
- * @param string $firstElement
- * @param string $secondElement
- * @param string $idAttribute
* @return array
*/
protected function getListFromSequence(
diff --git a/src/Helpers/Shifts.php b/src/Helpers/Shifts.php
index c852d25c..f203c989 100644
--- a/src/Helpers/Shifts.php
+++ b/src/Helpers/Shifts.php
@@ -10,8 +10,6 @@ class Shifts
/**
* Check if a time range is a night shift
*
- * @param Carbon $start
- * @param Carbon $end
* @return bool
*/
public static function isNightShift(Carbon $start, Carbon $end): bool
@@ -27,8 +25,6 @@ class Shifts
/**
* Calculate a shifts night multiplier
*
- * @param Carbon $start
- * @param Carbon $end
* @return float
*/
public static function getNightShiftMultiplier(Carbon $start, Carbon $end): float
diff --git a/src/Helpers/Translation/GettextTranslator.php b/src/Helpers/Translation/GettextTranslator.php
index e91d7fa1..bd228be3 100644
--- a/src/Helpers/Translation/GettextTranslator.php
+++ b/src/Helpers/Translation/GettextTranslator.php
@@ -7,9 +7,6 @@ use Gettext\Translator;
class GettextTranslator extends Translator
{
/**
- * @param string|null $domain
- * @param string|null $context
- * @param string $original
* @return string
* @throws TranslationNotFound
*/
@@ -21,11 +18,6 @@ class GettextTranslator extends Translator
}
/**
- * @param string|null $domain
- * @param string|null $context
- * @param string $original
- * @param string $plural
- * @param int $value
* @return string
* @throws TranslationNotFound
*/
@@ -42,12 +34,9 @@ class GettextTranslator extends Translator
}
/**
- * @param string $domain
- * @param string $context
- * @param string $original
* @throws TranslationNotFound
*/
- protected function assertHasTranslation($domain, $context, $original)
+ protected function assertHasTranslation(?string $domain, ?string $context, string $original)
{
if ($this->getTranslation($domain, $context, $original)) {
return;
diff --git a/src/Helpers/Translation/TranslationServiceProvider.php b/src/Helpers/Translation/TranslationServiceProvider.php
index 20fd72a5..de8ca72a 100644
--- a/src/Helpers/Translation/TranslationServiceProvider.php
+++ b/src/Helpers/Translation/TranslationServiceProvider.php
@@ -54,7 +54,6 @@ class TranslationServiceProvider extends ServiceProvider
}
/**
- * @param string $locale
* @codeCoverageIgnore
*/
public function setLocale(string $locale): void
@@ -70,7 +69,6 @@ class TranslationServiceProvider extends ServiceProvider
}
/**
- * @param string $locale
* @return GettextTranslator
*/
public function getTranslator(string $locale): GettextTranslator
@@ -101,8 +99,6 @@ class TranslationServiceProvider extends ServiceProvider
}
/**
- * @param string $locale
- * @param string $name
* @return string
*/
protected function getFile(string $locale, string $name = 'default'): string
diff --git a/src/Helpers/Translation/Translator.php b/src/Helpers/Translation/Translator.php
index d42e4bcf..d8793f20 100644
--- a/src/Helpers/Translation/Translator.php
+++ b/src/Helpers/Translation/Translator.php
@@ -22,11 +22,7 @@ class Translator
/**
* Translator constructor.
*
- * @param string $locale
- * @param string $fallbackLocale
- * @param callable $getTranslatorCallback
* @param string[] $locales
- * @param callable $localeChangeCallback
*/
public function __construct(
string $locale,
@@ -46,7 +42,6 @@ class Translator
/**
* Get the translation for a given key
*
- * @param string $key
* @param array $replace
* @return string
*/
@@ -58,9 +53,6 @@ class Translator
/**
* Get the translation for a given key
*
- * @param string $key
- * @param string $pluralKey
- * @param int $number
* @param array $replace
* @return string
*/
@@ -70,7 +62,6 @@ class Translator
}
/**
- * @param string $type
* @param array $parameters
* @param array $replace
* @return mixed|string
@@ -96,7 +87,6 @@ class Translator
/**
* Replace placeholders
*
- * @param string $key
* @param array $replace
* @return mixed|string
*/
@@ -117,9 +107,6 @@ class Translator
return $this->locale;
}
- /**
- * @param string $locale
- */
public function setLocale(string $locale)
{
$this->locale = $locale;
@@ -138,7 +125,6 @@ class Translator
}
/**
- * @param string $locale
* @return bool
*/
public function hasLocale(string $locale): bool
diff --git a/src/Helpers/Version.php b/src/Helpers/Version.php
index 97fe6ef3..73ab42f4 100644
--- a/src/Helpers/Version.php
+++ b/src/Helpers/Version.php
@@ -15,10 +15,6 @@ class Version
/** @var string */
protected $versionFile = 'VERSION';
- /**
- * @param string $storage
- * @param Config $config
- */
public function __construct(string $storage, Config $config)
{
$this->storage = $storage;
diff --git a/src/Http/Exceptions/HttpAuthExpired.php b/src/Http/Exceptions/HttpAuthExpired.php
index 83ca240f..d72f3263 100644
--- a/src/Http/Exceptions/HttpAuthExpired.php
+++ b/src/Http/Exceptions/HttpAuthExpired.php
@@ -7,9 +7,7 @@ use Throwable;
class HttpAuthExpired extends HttpException
{
/**
- * @param string $message
* @param array $headers
- * @param int $code
* @param Throwable|null $previous
*/
public function __construct(
diff --git a/src/Http/Exceptions/HttpException.php b/src/Http/Exceptions/HttpException.php
index 6efc2fad..0beb6df9 100644
--- a/src/Http/Exceptions/HttpException.php
+++ b/src/Http/Exceptions/HttpException.php
@@ -14,10 +14,7 @@ class HttpException extends RuntimeException
protected $headers = [];
/**
- * @param int $statusCode
- * @param string $message
* @param array $headers
- * @param int $code
* @param Throwable|null $previous
*/
public function __construct(
diff --git a/src/Http/Exceptions/HttpForbidden.php b/src/Http/Exceptions/HttpForbidden.php
index 01c0a5ec..e73eb3ce 100644
--- a/src/Http/Exceptions/HttpForbidden.php
+++ b/src/Http/Exceptions/HttpForbidden.php
@@ -7,9 +7,7 @@ use Throwable;
class HttpForbidden extends HttpException
{
/**
- * @param string $message
* @param array $headers
- * @param int $code
* @param Throwable|null $previous
*/
public function __construct(
diff --git a/src/Http/Exceptions/HttpNotFound.php b/src/Http/Exceptions/HttpNotFound.php
index 324adaf9..15e26caf 100644
--- a/src/Http/Exceptions/HttpNotFound.php
+++ b/src/Http/Exceptions/HttpNotFound.php
@@ -7,9 +7,7 @@ use Throwable;
class HttpNotFound extends HttpException
{
/**
- * @param string $message
* @param array $headers
- * @param int $code
* @param Throwable|null $previous
*/
public function __construct(
diff --git a/src/Http/Exceptions/HttpPermanentRedirect.php b/src/Http/Exceptions/HttpPermanentRedirect.php
index a1aa986f..daef4041 100644
--- a/src/Http/Exceptions/HttpPermanentRedirect.php
+++ b/src/Http/Exceptions/HttpPermanentRedirect.php
@@ -5,7 +5,6 @@ namespace Engelsystem\Http\Exceptions;
class HttpPermanentRedirect extends HttpRedirect
{
/**
- * @param string $url
* @param array $headers
*/
public function __construct(
diff --git a/src/Http/Exceptions/HttpRedirect.php b/src/Http/Exceptions/HttpRedirect.php
index 0e7d0250..14aab65f 100644
--- a/src/Http/Exceptions/HttpRedirect.php
+++ b/src/Http/Exceptions/HttpRedirect.php
@@ -5,8 +5,6 @@ namespace Engelsystem\Http\Exceptions;
class HttpRedirect extends HttpException
{
/**
- * @param string $url
- * @param int $statusCode
* @param array $headers
*/
public function __construct(
diff --git a/src/Http/Exceptions/HttpTemporaryRedirect.php b/src/Http/Exceptions/HttpTemporaryRedirect.php
index ece8d607..22fc87ca 100644
--- a/src/Http/Exceptions/HttpTemporaryRedirect.php
+++ b/src/Http/Exceptions/HttpTemporaryRedirect.php
@@ -5,7 +5,6 @@ namespace Engelsystem\Http\Exceptions;
class HttpTemporaryRedirect extends HttpRedirect
{
/**
- * @param string $url
* @param array $headers
*/
public function __construct(
diff --git a/src/Http/Exceptions/ValidationException.php b/src/Http/Exceptions/ValidationException.php
index e48fb0c3..0bd47f23 100644
--- a/src/Http/Exceptions/ValidationException.php
+++ b/src/Http/Exceptions/ValidationException.php
@@ -12,9 +12,6 @@ class ValidationException extends RuntimeException
protected $validator;
/**
- * @param Validator $validator
- * @param string $message
- * @param int $code
* @param Throwable|null $previous
*/
public function __construct(
diff --git a/src/Http/MessageTrait.php b/src/Http/MessageTrait.php
index a835ba0e..aa8d1602 100644
--- a/src/Http/MessageTrait.php
+++ b/src/Http/MessageTrait.php
@@ -36,10 +36,11 @@ trait MessageTrait
* @param string $version HTTP protocol version
* @return static
*/
- public function withProtocolVersion($version)
+ public function withProtocolVersion(mixed $version)
{
$new = clone $this;
if (method_exists($new, 'setProtocolVersion')) {
+ /** @var MessageTrait */
$new->setProtocolVersion($version);
} else {
$new->server->set('SERVER_PROTOCOL', $version);
@@ -90,7 +91,7 @@ trait MessageTrait
* name using a case-insensitive string comparison. Returns false if
* no matching header name is found in the message.
*/
- public function hasHeader($name)
+ public function hasHeader(mixed $name)
{
return $this->headers->has($name);
}
@@ -109,7 +110,7 @@ trait MessageTrait
* header. If the header does not appear in the message, this method MUST
* return an empty array.
*/
- public function getHeader($name)
+ public function getHeader(mixed $name)
{
return $this->headers->all($name);
}
@@ -133,7 +134,7 @@ trait MessageTrait
* concatenated together using a comma. If the header does not appear in
* the message, this method MUST return an empty string.
*/
- public function getHeaderLine($name)
+ public function getHeaderLine(mixed $name)
{
return implode(',', $this->getHeader($name));
}
@@ -153,7 +154,7 @@ trait MessageTrait
* @return static
* @throws \InvalidArgumentException for invalid header names or values.
*/
- public function withHeader($name, $value)
+ public function withHeader(mixed $name, mixed $value)
{
$new = clone $this;
$new->headers->set($name, $value);
@@ -177,7 +178,7 @@ trait MessageTrait
* @return static
* @throws \InvalidArgumentException for invalid header names or values.
*/
- public function withAddedHeader($name, $value)
+ public function withAddedHeader(mixed $name, mixed $value)
{
$new = clone $this;
$new->headers->set($name, $value, false);
@@ -197,7 +198,7 @@ trait MessageTrait
* @param string $name Case-insensitive header field name to remove.
* @return static
*/
- public function withoutHeader($name)
+ public function withoutHeader(mixed $name)
{
$new = clone $this;
$new->headers->remove($name);
diff --git a/src/Http/Redirector.php b/src/Http/Redirector.php
index fdae3650..e0435dbc 100644
--- a/src/Http/Redirector.php
+++ b/src/Http/Redirector.php
@@ -13,11 +13,6 @@ class Redirector
/** @var UrlGeneratorInterface */
protected $url;
- /**
- * @param Request $request
- * @param Response $response
- * @param UrlGeneratorInterface $url
- */
public function __construct(Request $request, Response $response, UrlGeneratorInterface $url)
{
$this->request = $request;
@@ -28,8 +23,6 @@ class Redirector
/**
* Redirects to a path, generating a full URL
*
- * @param string $path
- * @param int $status
* @param array $headers
* @return Response
*/
@@ -39,7 +32,6 @@ class Redirector
}
/**
- * @param int $status
* @param array $headers
* @return Response
*/
diff --git a/src/Http/Request.php b/src/Http/Request.php
index 49a61b61..c74056fe 100644
--- a/src/Http/Request.php
+++ b/src/Http/Request.php
@@ -16,11 +16,9 @@ class Request extends SymfonyRequest implements ServerRequestInterface
/**
* Get POST input
*
- * @param string $key
- * @param mixed $default
* @return mixed
*/
- public function postData($key, $default = null)
+ public function postData(string $key, mixed $default = null)
{
return $this->request->get($key, $default);
}
@@ -28,11 +26,9 @@ class Request extends SymfonyRequest implements ServerRequestInterface
/**
* Get input data
*
- * @param string $key
- * @param mixed $default
* @return mixed
*/
- public function input($key, $default = null)
+ public function input(string $key, mixed $default = null)
{
return $this->get($key, $default);
}
@@ -40,10 +36,9 @@ class Request extends SymfonyRequest implements ServerRequestInterface
/**
* Checks if the input exists
*
- * @param string $key
* @return bool
*/
- public function has($key)
+ public function has(string $key)
{
$value = $this->input($key);
@@ -53,10 +48,9 @@ class Request extends SymfonyRequest implements ServerRequestInterface
/**
* Checks if the POST data exists
*
- * @param string $key
* @return bool
*/
- public function hasPostData($key)
+ public function hasPostData(string $key)
{
$value = $this->postData($key);
@@ -122,10 +116,9 @@ class Request extends SymfonyRequest implements ServerRequestInterface
*
* @link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various
* request-target forms allowed in request messages)
- * @param mixed $requestTarget
* @return static
*/
- public function withRequestTarget($requestTarget)
+ public function withRequestTarget(mixed $requestTarget)
{
return $this->create($requestTarget);
}
@@ -145,7 +138,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
* @return static
* @throws \InvalidArgumentException for invalid HTTP methods.
*/
- public function withMethod($method)
+ public function withMethod(mixed $method)
{
$new = clone $this;
$new->setMethod($method);
@@ -183,7 +176,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
* @param bool $preserveHost Preserve the original state of the Host header.
* @return static
*/
- public function withUri(UriInterface $uri, $preserveHost = false)
+ public function withUri(UriInterface $uri, mixed $preserveHost = false)
{
$new = $this->create($uri);
if ($preserveHost) {
@@ -409,7 +402,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
* @throws \InvalidArgumentException if an unsupported argument type is
* provided.
*/
- public function withParsedBody($data)
+ public function withParsedBody(mixed $data)
{
$new = clone $this;
$new->request = clone $this->request;
@@ -450,7 +443,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
* @return mixed
* @see getAttributes()
*/
- public function getAttribute($name, $default = null)
+ public function getAttribute(mixed $name, mixed $default = null)
{
return $this->attributes->get($name, $default);
}
@@ -470,7 +463,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
* @return static
* @see getAttributes()
*/
- public function withAttribute($name, $value)
+ public function withAttribute(mixed $name, mixed $value)
{
$new = clone $this;
$new->attributes = clone $this->attributes;
@@ -494,7 +487,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
* @return static
* @see getAttributes()
*/
- public function withoutAttribute($name)
+ public function withoutAttribute(mixed $name)
{
$new = clone $this;
$new->attributes = clone $this->attributes;
diff --git a/src/Http/RequestServiceProvider.php b/src/Http/RequestServiceProvider.php
index f38902cb..1b72c960 100644
--- a/src/Http/RequestServiceProvider.php
+++ b/src/Http/RequestServiceProvider.php
@@ -53,7 +53,7 @@ class RequestServiceProvider extends ServiceProvider
array $cookies = [],
array $files = [],
array $server = [],
- $content = null
+ mixed $content = null
): Request {
if (
!empty($this->appUrl['path'])
@@ -81,15 +81,13 @@ class RequestServiceProvider extends ServiceProvider
*
* Required for unit tests (static methods can't be mocked)
*
- * @param Request $request
* @param array $proxies
- * @param int $trustedHeadersSet
* @codeCoverageIgnore
*/
protected function setTrustedProxies(
- $request,
- $proxies,
- $trustedHeadersSet = Request::HEADER_FORWARDED | Request::HEADER_X_FORWARDED_TRAEFIK
+ Request $request,
+ array $proxies,
+ int $trustedHeadersSet = Request::HEADER_FORWARDED | Request::HEADER_X_FORWARDED_TRAEFIK
) {
$request->setTrustedProxies($proxies, $trustedHeadersSet);
}
diff --git a/src/Http/Response.php b/src/Http/Response.php
index 43bcb5d8..774799c4 100644
--- a/src/Http/Response.php
+++ b/src/Http/Response.php
@@ -21,14 +21,10 @@ class Response extends SymfonyResponse implements ResponseInterface
protected $renderer;
/**
- * @param string $content
- * @param int $status
* @param array $headers
- * @param Renderer $renderer
- * @param SessionInterface $session
*/
public function __construct(
- $content = '',
+ string $content = '',
int $status = 200,
array $headers = [],
Renderer $renderer = null,
@@ -60,7 +56,7 @@ class Response extends SymfonyResponse implements ResponseInterface
* @return static
* @throws InvalidArgumentException For invalid status code arguments.
*/
- public function withStatus($code, $reasonPhrase = '')
+ public function withStatus(mixed $code, mixed $reasonPhrase = '')
{
$new = clone $this;
$new->setStatusCode($code, !empty($reasonPhrase) ? $reasonPhrase : null);
@@ -96,7 +92,7 @@ class Response extends SymfonyResponse implements ResponseInterface
* @param mixed $content Content that can be cast to string
* @return static
*/
- public function withContent($content)
+ public function withContent(mixed $content)
{
$new = clone $this;
$new->setContent($content);
@@ -110,13 +106,11 @@ class Response extends SymfonyResponse implements ResponseInterface
* This method retains the immutability of the message and returns
* an instance with the updated status and headers
*
- * @param string $view
* @param array $data
- * @param int $status
* @param string[]|string[][] $headers
* @return Response
*/
- public function withView($view, $data = [], $status = 200, $headers = [])
+ public function withView(string $view, array $data = [], int $status = 200, array $headers = [])
{
if (!$this->renderer instanceof Renderer) {
throw new InvalidArgumentException('Renderer not defined');
@@ -139,12 +133,10 @@ class Response extends SymfonyResponse implements ResponseInterface
* This method retains the immutability of the message and returns
* an instance with the updated status and headers
*
- * @param string $path
- * @param int $status
* @param array $headers
* @return Response
*/
- public function redirectTo($path, $status = 302, $headers = [])
+ public function redirectTo(string $path, int $status = 302, array $headers = [])
{
$response = $this->withStatus($status);
$response = $response->withHeader('location', $path);
@@ -159,7 +151,6 @@ class Response extends SymfonyResponse implements ResponseInterface
/**
* Set the renderer to use
*
- * @param Renderer $renderer
*/
public function setRenderer(Renderer $renderer)
{
@@ -169,11 +160,9 @@ class Response extends SymfonyResponse implements ResponseInterface
/**
* Sets a session attribute (which is mutable)
*
- * @param string $key
- * @param mixed|mixed[] $value
* @return Response
*/
- public function with(string $key, $value)
+ public function with(string $key, mixed $value)
{
if (!$this->session instanceof SessionInterface) {
throw new InvalidArgumentException('Session not defined');
diff --git a/src/Http/UrlGenerator.php b/src/Http/UrlGenerator.php
index ee800da4..5b11d122 100644
--- a/src/Http/UrlGenerator.php
+++ b/src/Http/UrlGenerator.php
@@ -12,7 +12,6 @@ class UrlGenerator implements UrlGeneratorInterface
/**
* Create a URL for the given path, using the applications base url if configured
*
- * @param string $path
* @param array $parameters
* @return string url in the form [app url]/[path]?[parameters]
*/
@@ -35,7 +34,6 @@ class UrlGenerator implements UrlGeneratorInterface
/**
* Check if the URL is valid
*
- * @param string $path
* @return bool
*/
public function isValidUrl(string $path): bool
diff --git a/src/Http/UrlGeneratorInterface.php b/src/Http/UrlGeneratorInterface.php
index 40c5d462..926251fc 100644
--- a/src/Http/UrlGeneratorInterface.php
+++ b/src/Http/UrlGeneratorInterface.php
@@ -8,7 +8,6 @@ namespace Engelsystem\Http;
interface UrlGeneratorInterface
{
/**
- * @param string $path
* @param array $parameters
* @return string
*/
diff --git a/src/Http/Validation/Rules/Checked.php b/src/Http/Validation/Rules/Checked.php
index d4778919..c6b5e3b3 100644
--- a/src/Http/Validation/Rules/Checked.php
+++ b/src/Http/Validation/Rules/Checked.php
@@ -6,7 +6,7 @@ use Respect\Validation\Rules\AbstractRule;
class Checked extends AbstractRule
{
- public function validate($input)
+ public function validate(mixed $input)
{
return in_array($input, ['yes', 'on', 1, '1', 'true', true], true);
}
diff --git a/src/Http/Validation/Rules/In.php b/src/Http/Validation/Rules/In.php
index d585cc3d..6971f19d 100644
--- a/src/Http/Validation/Rules/In.php
+++ b/src/Http/Validation/Rules/In.php
@@ -6,11 +6,7 @@ use Respect\Validation\Rules\In as RespectIn;
class In extends RespectIn
{
- /**
- * @param mixed $haystack
- * @param bool $compareIdentical
- */
- public function __construct($haystack, $compareIdentical = false)
+ public function __construct(mixed $haystack, bool $compareIdentical = false)
{
if (!is_array($haystack)) {
$haystack = explode(',', $haystack);
diff --git a/src/Http/Validation/Rules/NotIn.php b/src/Http/Validation/Rules/NotIn.php
index 7f223c42..4cdd4d97 100644
--- a/src/Http/Validation/Rules/NotIn.php
+++ b/src/Http/Validation/Rules/NotIn.php
@@ -5,10 +5,9 @@ namespace Engelsystem\Http\Validation\Rules;
class NotIn extends In
{
/**
- * @param mixed $input
* @return bool
*/
- public function validate($input)
+ public function validate(mixed $input)
{
return !parent::validate($input);
}
diff --git a/src/Http/Validation/Rules/StringInputLength.php b/src/Http/Validation/Rules/StringInputLength.php
index 7b5c248b..9d01c50c 100644
--- a/src/Http/Validation/Rules/StringInputLength.php
+++ b/src/Http/Validation/Rules/StringInputLength.php
@@ -11,10 +11,9 @@ trait StringInputLength
/**
* Use the input length of a string
*
- * @param mixed $input
* @return bool
*/
- public function validate($input): bool
+ public function validate(mixed $input): bool
{
if (
is_string($input)
@@ -28,10 +27,9 @@ trait StringInputLength
}
/**
- * @param mixed $input
* @return bool
*/
- protected function isDateTime($input): bool
+ protected function isDateTime(mixed $input): bool
{
try {
new DateTime($input);
diff --git a/src/Http/Validation/ValidatesRequest.php b/src/Http/Validation/ValidatesRequest.php
index 142bd129..5caf00ad 100644
--- a/src/Http/Validation/ValidatesRequest.php
+++ b/src/Http/Validation/ValidatesRequest.php
@@ -11,7 +11,6 @@ trait ValidatesRequest
protected $validator;
/**
- * @param Request $request
* @param array $rules
* @return array
*/
@@ -29,9 +28,6 @@ trait ValidatesRequest
return $this->validator->getData();
}
- /**
- * @param Validator $validator
- */
public function setValidator(Validator $validator)
{
$this->validator = $validator;
diff --git a/src/Http/Validation/Validator.php b/src/Http/Validation/Validator.php
index d4a60635..e686df88 100644
--- a/src/Http/Validation/Validator.php
+++ b/src/Http/Validation/Validator.php
@@ -31,7 +31,7 @@ class Validator
* @param array $rules
* @return bool
*/
- public function validate($data, $rules)
+ public function validate(array $data, array $rules)
{
$this->errors = [];
$this->data = [];
@@ -86,19 +86,17 @@ class Validator
}
/**
- * @param string $rule
* @return string
*/
- protected function map($rule)
+ protected function map(string $rule)
{
return $this->mapping[$rule] ?? $rule;
}
/**
- * @param string $rule
* @return string
*/
- protected function mapBack($rule)
+ protected function mapBack(string $rule)
{
$mapping = array_flip($this->mapping);
diff --git a/src/Logger/Logger.php b/src/Logger/Logger.php
index 7fe579fb..a44699ed 100644
--- a/src/Logger/Logger.php
+++ b/src/Logger/Logger.php
@@ -25,9 +25,6 @@ class Logger extends AbstractLogger
/** @var LogEntry */
protected $log;
- /**
- * @param LogEntry $log
- */
public function __construct(LogEntry $log)
{
$this->log = $log;
@@ -36,12 +33,10 @@ class Logger extends AbstractLogger
/**
* Logs with an arbitrary level.
*
- * @param mixed $level
- * @param string|Stringable $message
* @param array $context
*
*/
- public function log($level, string|Stringable $message, array $context = []): void
+ public function log(mixed $level, string|Stringable $message, array $context = []): void
{
if (!$this->checkLevel($level)) {
throw new InvalidArgumentException('Unknown log level: ' . $level);
@@ -59,11 +54,10 @@ class Logger extends AbstractLogger
/**
* Interpolates context values into the message placeholders.
*
- * @param string $message
* @param array $context
* @return string
*/
- protected function interpolate($message, array $context = []): string
+ protected function interpolate(string $message, array $context = []): string
{
foreach ($context as $key => $val) {
// check that the value can be casted to string
@@ -79,7 +73,6 @@ class Logger extends AbstractLogger
}
/**
- * @param Throwable $e
* @return string
*/
protected function formatException(Throwable $e): string
@@ -95,10 +88,9 @@ class Logger extends AbstractLogger
}
/**
- * @param string $level
* @return bool
*/
- protected function checkLevel($level): bool
+ protected function checkLevel(string $level): bool
{
return in_array($level, $this->allowedLevels);
}
diff --git a/src/Logger/UserAwareLogger.php b/src/Logger/UserAwareLogger.php
index f2fc9e39..b0e7b3be 100644
--- a/src/Logger/UserAwareLogger.php
+++ b/src/Logger/UserAwareLogger.php
@@ -14,13 +14,11 @@ class UserAwareLogger extends Logger
/**
* Logs with an arbitrary level and prepends the user
*
- * @param mixed $level
- * @param string|Stringable $message
* @param array $context
*
* @throws InvalidArgumentException
*/
- public function log($level, string|Stringable $message, array $context = []): void
+ public function log(mixed $level, string|Stringable $message, array $context = []): void
{
if ($this->auth && ($user = $this->auth->user())) {
$message = sprintf('%s (%u): %s', $user->name, $user->id, $message);
@@ -29,9 +27,6 @@ class UserAwareLogger extends Logger
parent::log($level, $message, $context);
}
- /**
- * @param Authenticator $auth
- */
public function setAuth(Authenticator $auth): void
{
$this->auth = $auth;
diff --git a/src/Mail/EngelsystemMailer.php b/src/Mail/EngelsystemMailer.php
index f648337d..57228e6f 100644
--- a/src/Mail/EngelsystemMailer.php
+++ b/src/Mail/EngelsystemMailer.php
@@ -19,7 +19,6 @@ class EngelsystemMailer extends Mailer
protected $subjectPrefix = null;
/**
- * @param MailerInterface $mailer
* @param Renderer|null $view
* @param Translator|null $translation
*/
@@ -33,13 +32,10 @@ class EngelsystemMailer extends Mailer
/**
* @param string|string[]|User $to
- * @param string $subject
- * @param string $template
* @param array $data
- * @param string|null $locale
*/
public function sendViewTranslated(
- $to,
+ string|array|User $to,
string $subject,
string $template,
array $data = [],
@@ -72,11 +68,9 @@ class EngelsystemMailer extends Mailer
* Send a template
*
* @param string|string[] $to
- * @param string $subject
- * @param string $template
* @param array $data
*/
- public function sendView($to, string $subject, string $template, array $data = []): void
+ public function sendView(string|array $to, string $subject, string $template, array $data = []): void
{
$body = $this->view->render($template, $data);
@@ -87,10 +81,8 @@ class EngelsystemMailer extends Mailer
* Send the mail
*
* @param string|string[] $to
- * @param string $subject
- * @param string $body
*/
- public function send($to, string $subject, string $body): void
+ public function send(string|array $to, string $subject, string $body): void
{
if ($this->subjectPrefix) {
$subject = sprintf('[%s] %s', $this->subjectPrefix, trim($subject));
@@ -107,9 +99,6 @@ class EngelsystemMailer extends Mailer
return $this->subjectPrefix;
}
- /**
- * @param string $subjectPrefix
- */
public function setSubjectPrefix(string $subjectPrefix)
{
$this->subjectPrefix = $subjectPrefix;
diff --git a/src/Mail/Mailer.php b/src/Mail/Mailer.php
index c1112909..24591360 100644
--- a/src/Mail/Mailer.php
+++ b/src/Mail/Mailer.php
@@ -25,10 +25,8 @@ class Mailer
* Send the mail
*
* @param string|string[] $to
- * @param string $subject
- * @param string $body
*/
- public function send($to, string $subject, string $body): void
+ public function send(string|array $to, string $subject, string $body): void
{
$message = (new Email())
->to(...(array)$to)
@@ -47,9 +45,6 @@ class Mailer
return $this->fromAddress;
}
- /**
- * @param string $fromAddress
- */
public function setFromAddress(string $fromAddress)
{
$this->fromAddress = $fromAddress;
@@ -63,9 +58,6 @@ class Mailer
return $this->fromName;
}
- /**
- * @param string $fromName
- */
public function setFromName(string $fromName)
{
$this->fromName = $fromName;
diff --git a/src/Mail/MailerServiceProvider.php b/src/Mail/MailerServiceProvider.php
index a9662dd2..ea0f945f 100644
--- a/src/Mail/MailerServiceProvider.php
+++ b/src/Mail/MailerServiceProvider.php
@@ -45,11 +45,10 @@ class MailerServiceProvider extends ServiceProvider
}
/**
- * @param string|null $transport
* @param array $config
* @return TransportInterface
*/
- protected function getTransport($transport, $config)
+ protected function getTransport(?string $transport, array $config)
{
switch ($transport) {
case 'log':
diff --git a/src/Mail/Transport/LogTransport.php b/src/Mail/Transport/LogTransport.php
index 71599fc9..0231f5e5 100644
--- a/src/Mail/Transport/LogTransport.php
+++ b/src/Mail/Transport/LogTransport.php
@@ -21,7 +21,6 @@ class LogTransport extends AbstractTransport
/**
* Send the message to log
*
- * @param SentMessage $message
*/
protected function doSend(SentMessage $message): void
{
diff --git a/src/Middleware/AddHeaders.php b/src/Middleware/AddHeaders.php
index 75383a90..597832e9 100644
--- a/src/Middleware/AddHeaders.php
+++ b/src/Middleware/AddHeaders.php
@@ -13,9 +13,6 @@ class AddHeaders implements MiddlewareInterface
/** @var Config */
protected $config;
- /**
- * @param Config $config
- */
public function __construct(Config $config)
{
$this->config = $config;
@@ -24,8 +21,6 @@ class AddHeaders implements MiddlewareInterface
/**
* Process an incoming server request and setting the locale if required
*
- * @param ServerRequestInterface $request
- * @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
diff --git a/src/Middleware/CallableHandler.php b/src/Middleware/CallableHandler.php
index 0bb666a3..54da0073 100644
--- a/src/Middleware/CallableHandler.php
+++ b/src/Middleware/CallableHandler.php
@@ -20,7 +20,6 @@ class CallableHandler implements MiddlewareInterface, RequestHandlerInterface
/**
* @param callable $callable The callable that should be wrapped
- * @param Container $container
*/
public function __construct(callable $callable, Container $container = null)
{
@@ -32,8 +31,6 @@ class CallableHandler implements MiddlewareInterface, RequestHandlerInterface
* Process an incoming server request and return a response, optionally delegating
* response creation to a handler.
*
- * @param ServerRequestInterface $request
- * @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
@@ -44,7 +41,6 @@ class CallableHandler implements MiddlewareInterface, RequestHandlerInterface
/**
* Handle the request and return a response.
*
- * @param ServerRequestInterface $request
* @return ResponseInterface
*/
public function handle(ServerRequestInterface $request): ResponseInterface
diff --git a/src/Middleware/Dispatcher.php b/src/Middleware/Dispatcher.php
index 48eb0948..afa5834b 100644
--- a/src/Middleware/Dispatcher.php
+++ b/src/Middleware/Dispatcher.php
@@ -27,7 +27,7 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface
* @param MiddlewareInterface[]|string[] $stack
* @param Application|null $container
*/
- public function __construct($stack = [], Application $container = null)
+ public function __construct(array $stack = [], Application $container = null)
{
$this->stack = $stack;
$this->container = $container;
@@ -39,8 +39,6 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface
*
* Could be used to group middleware
*
- * @param ServerRequestInterface $request
- * @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(
@@ -57,7 +55,6 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface
*
* It calls all configured middleware and handles their response
*
- * @param ServerRequestInterface $request
* @return ResponseInterface
*/
public function handle(ServerRequestInterface $request): ResponseInterface
@@ -80,9 +77,6 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface
return $middleware->process($request, $this);
}
- /**
- * @param Application $container
- */
public function setContainer(Application $container)
{
$this->container = $container;
diff --git a/src/Middleware/ErrorHandler.php b/src/Middleware/ErrorHandler.php
index 6caae3c9..f274dd84 100644
--- a/src/Middleware/ErrorHandler.php
+++ b/src/Middleware/ErrorHandler.php
@@ -38,9 +38,6 @@ class ErrorHandler implements MiddlewareInterface
'_token',
];
- /**
- * @param TwigLoader $loader
- */
public function __construct(TwigLoader $loader)
{
$this->loader = $loader;
@@ -51,8 +48,6 @@ class ErrorHandler implements MiddlewareInterface
*
* Should be added at the beginning
*
- * @param ServerRequestInterface $request
- * @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(
@@ -105,7 +100,6 @@ class ErrorHandler implements MiddlewareInterface
/**
* Select a view based on the given status code
*
- * @param int $statusCode
* @return string
*/
protected function selectView(int $statusCode): string
@@ -125,8 +119,6 @@ class ErrorHandler implements MiddlewareInterface
/**
* Create a new response
*
- * @param string $content
- * @param int $status
* @param array $headers
* @return Response
* @codeCoverageIgnore
diff --git a/src/Middleware/ExceptionHandler.php b/src/Middleware/ExceptionHandler.php
index a22e895f..a4e19a1d 100644
--- a/src/Middleware/ExceptionHandler.php
+++ b/src/Middleware/ExceptionHandler.php
@@ -15,9 +15,6 @@ class ExceptionHandler implements MiddlewareInterface
/** @var ContainerInterface */
protected $container;
- /**
- * @param ContainerInterface $container
- */
public function __construct(ContainerInterface $container)
{
$this->container = $container;
@@ -28,8 +25,6 @@ class ExceptionHandler implements MiddlewareInterface
*
* Should be added at the beginning
*
- * @param ServerRequestInterface $request
- * @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(
diff --git a/src/Middleware/LegacyMiddleware.php b/src/Middleware/LegacyMiddleware.php
index af0c5a9c..322adf28 100644
--- a/src/Middleware/LegacyMiddleware.php
+++ b/src/Middleware/LegacyMiddleware.php
@@ -35,10 +35,6 @@ class LegacyMiddleware implements MiddlewareInterface
/** @var Authenticator */
protected $auth;
- /**
- * @param ContainerInterface $container
- * @param Authenticator $auth
- */
public function __construct(ContainerInterface $container, Authenticator $auth)
{
$this->container = $container;
@@ -50,8 +46,6 @@ class LegacyMiddleware implements MiddlewareInterface
*
* Should be used before a 404 is send
*
- * @param ServerRequestInterface $request
- * @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(
@@ -89,11 +83,10 @@ class LegacyMiddleware implements MiddlewareInterface
/**
* Get the legacy page content and title
*
- * @param string $page
* @return array ['title', 'content']
* @codeCoverageIgnore
*/
- protected function loadPage($page)
+ protected function loadPage(string $page)
{
switch ($page) {
case 'ical':
@@ -182,13 +175,10 @@ class LegacyMiddleware implements MiddlewareInterface
/**
* Render the template
*
- * @param string $page
- * @param string $title
- * @param string $content
* @return Response
* @codeCoverageIgnore
*/
- protected function renderPage($page, $title, $content)
+ protected function renderPage(string $page, string $title, string $content)
{
if (!empty($page) && is_int($page)) {
return response($content, (int)$page);
diff --git a/src/Middleware/RequestHandler.php b/src/Middleware/RequestHandler.php
index 46aa4240..ec96491c 100644
--- a/src/Middleware/RequestHandler.php
+++ b/src/Middleware/RequestHandler.php
@@ -19,9 +19,6 @@ class RequestHandler implements MiddlewareInterface
/** @var Application */
protected $container;
- /**
- * @param Application $container
- */
public function __construct(Application $container)
{
$this->container = $container;
@@ -31,8 +28,6 @@ class RequestHandler implements MiddlewareInterface
* Process an incoming server request and return a response, optionally delegating
* response creation to a handler.
*
- * @param ServerRequestInterface $request
- * @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
@@ -63,10 +58,9 @@ class RequestHandler implements MiddlewareInterface
/**
* Resolve the given class
*
- * @param string|callable|MiddlewareInterface|RequestHandlerInterface $handler
* @return MiddlewareInterface|RequestHandlerInterface
*/
- protected function resolveRequestHandler($handler)
+ protected function resolveRequestHandler(string|callable|MiddlewareInterface|RequestHandlerInterface $handler)
{
if (is_string($handler) && mb_strpos($handler, '@') !== false) {
list($class, $method) = explode('@', $handler, 2);
@@ -94,8 +88,6 @@ class RequestHandler implements MiddlewareInterface
/**
* Check required page permissions
*
- * @param BaseController $controller
- * @param string $method
* @return bool
*/
protected function checkPermissions(BaseController $controller, string $method): bool
diff --git a/src/Middleware/ResolvesMiddlewareTrait.php b/src/Middleware/ResolvesMiddlewareTrait.php
index 76557ce6..a2a103e4 100644
--- a/src/Middleware/ResolvesMiddlewareTrait.php
+++ b/src/Middleware/ResolvesMiddlewareTrait.php
@@ -12,10 +12,9 @@ trait ResolvesMiddlewareTrait
/**
* Resolve the middleware with the container
*
- * @param string|callable|MiddlewareInterface|RequestHandlerInterface $middleware
* @return MiddlewareInterface|RequestHandlerInterface
*/
- protected function resolveMiddleware($middleware)
+ protected function resolveMiddleware(string|callable|MiddlewareInterface|RequestHandlerInterface $middleware)
{
if ($this->isMiddleware($middleware)) {
return $middleware;
@@ -46,10 +45,9 @@ trait ResolvesMiddlewareTrait
/**
* Checks if the given object is a middleware or middleware or request handler
*
- * @param mixed $middleware
* @return bool
*/
- protected function isMiddleware($middleware)
+ protected function isMiddleware(mixed $middleware)
{
return ($middleware instanceof MiddlewareInterface || $middleware instanceof RequestHandlerInterface);
}
diff --git a/src/Middleware/RouteDispatcher.php b/src/Middleware/RouteDispatcher.php
index 19c6a343..637a42d2 100644
--- a/src/Middleware/RouteDispatcher.php
+++ b/src/Middleware/RouteDispatcher.php
@@ -22,7 +22,6 @@ class RouteDispatcher implements MiddlewareInterface
protected $notFound;
/**
- * @param FastRouteDispatcher $dispatcher
* @param ResponseInterface $response Default response
* @param MiddlewareInterface|null $notFound Handles any requests if the route can't be found
*/
@@ -40,8 +39,6 @@ class RouteDispatcher implements MiddlewareInterface
* Process an incoming server request and return a response, optionally delegating
* response creation to a handler.
*
- * @param ServerRequestInterface $request
- * @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
diff --git a/src/Middleware/SendResponseHandler.php b/src/Middleware/SendResponseHandler.php
index 66d196d7..0fe3a04b 100644
--- a/src/Middleware/SendResponseHandler.php
+++ b/src/Middleware/SendResponseHandler.php
@@ -14,8 +14,6 @@ class SendResponseHandler implements MiddlewareInterface
*
* This should be the first middleware
*
- * @param ServerRequestInterface $request
- * @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(
@@ -57,12 +55,9 @@ class SendResponseHandler implements MiddlewareInterface
/**
* Send a raw HTTP header
*
- * @param string $content
- * @param bool $replace
- * @param int $code
* @codeCoverageIgnore
*/
- protected function sendHeader($content, $replace = true, $code = null)
+ protected function sendHeader(string $content, bool $replace = true, int $code = null)
{
if (is_null($code)) {
header($content, $replace);
diff --git a/src/Middleware/SessionHandler.php b/src/Middleware/SessionHandler.php
index 9d766383..77fca0b4 100644
--- a/src/Middleware/SessionHandler.php
+++ b/src/Middleware/SessionHandler.php
@@ -18,7 +18,6 @@ class SessionHandler implements MiddlewareInterface
protected $paths = [];
/**
- * @param SessionStorageInterface $session
* @param array $paths
*/
public function __construct(SessionStorageInterface $session, array $paths = [])
@@ -28,8 +27,6 @@ class SessionHandler implements MiddlewareInterface
}
/**
- * @param ServerRequestInterface $request
- * @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
diff --git a/src/Middleware/SetLocale.php b/src/Middleware/SetLocale.php
index da3a1264..f9d957ef 100644
--- a/src/Middleware/SetLocale.php
+++ b/src/Middleware/SetLocale.php
@@ -21,11 +21,6 @@ class SetLocale implements MiddlewareInterface
/** @var Session */
protected $session;
- /**
- * @param Translator $translator
- * @param Session $session
- * @param Authenticator $auth
- */
public function __construct(Translator $translator, Session $session, Authenticator $auth)
{
$this->auth = $auth;
@@ -36,8 +31,6 @@ class SetLocale implements MiddlewareInterface
/**
* Process an incoming server request and setting the locale if required
*
- * @param ServerRequestInterface $request
- * @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
diff --git a/src/Middleware/VerifyCsrfToken.php b/src/Middleware/VerifyCsrfToken.php
index 0623fa72..3aed2208 100644
--- a/src/Middleware/VerifyCsrfToken.php
+++ b/src/Middleware/VerifyCsrfToken.php
@@ -14,9 +14,6 @@ class VerifyCsrfToken implements MiddlewareInterface
/** @var SessionInterface */
protected $session;
- /**
- * @param SessionInterface $session
- */
public function __construct(SessionInterface $session)
{
$this->session = $session;
@@ -25,8 +22,6 @@ class VerifyCsrfToken implements MiddlewareInterface
/**
* Verify csrf tokens
*
- * @param ServerRequestInterface $request
- * @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
@@ -42,7 +37,6 @@ class VerifyCsrfToken implements MiddlewareInterface
}
/**
- * @param ServerRequestInterface $request
* @return bool
*/
protected function isReading(ServerRequestInterface $request): bool
@@ -54,7 +48,6 @@ class VerifyCsrfToken implements MiddlewareInterface
}
/**
- * @param ServerRequestInterface $request
* @return bool
*/
protected function tokensMatch(ServerRequestInterface $request): bool
diff --git a/src/Models/EventConfig.php b/src/Models/EventConfig.php
index 965d2d32..bf154b6c 100644
--- a/src/Models/EventConfig.php
+++ b/src/Models/EventConfig.php
@@ -45,10 +45,9 @@ class EventConfig extends BaseModel
/**
* Value accessor
*
- * @param mixed $value
* @return mixed
*/
- public function getValueAttribute($value)
+ public function getValueAttribute(mixed $value)
{
$value = $value ? $this->fromJson($value) : null;
@@ -68,10 +67,9 @@ class EventConfig extends BaseModel
/**
* Value mutator
*
- * @param mixed $value
* @return static
*/
- public function setValueAttribute($value)
+ public function setValueAttribute(mixed $value)
{
if (!empty($value)) {
switch ($this->getValueCast($this->name)) {
@@ -95,10 +93,9 @@ class EventConfig extends BaseModel
/**
* Check if the value has to be casted
*
- * @param string $value
* @return string|null
*/
- protected function getValueCast($value)
+ protected function getValueCast(string $value)
{
return isset($this->valueCasts[$value]) ? $this->valueCasts[$value] : null;
}
diff --git a/src/Models/LogEntry.php b/src/Models/LogEntry.php
index de6784ec..304200bd 100644
--- a/src/Models/LogEntry.php
+++ b/src/Models/LogEntry.php
@@ -38,10 +38,9 @@ class LogEntry extends BaseModel
];
/**
- * @param $keyword
* @return Builder[]|Collection|SupportCollection|LogEntry[]
*/
- public static function filter($keyword = null)
+ public static function filter(string $keyword = null)
{
$query = self::query()
->select()
diff --git a/src/Models/News.php b/src/Models/News.php
index 131edd08..fa35c28e 100644
--- a/src/Models/News.php
+++ b/src/Models/News.php
@@ -72,7 +72,6 @@ class News extends BaseModel
}
/**
- * @param bool $showMore
* @return string
*/
public function text(bool $showMore = true): string
diff --git a/src/Models/User/User.php b/src/Models/User/User.php
index b0e205b0..fcab6984 100644
--- a/src/Models/User/User.php
+++ b/src/Models/User/User.php
@@ -187,7 +187,6 @@ class User extends BaseModel
}
/**
- * @param AngelType $angelType
* @return bool
*/
public function isAngelTypeSupporter(AngelType $angelType): bool
diff --git a/src/Renderer/Engine.php b/src/Renderer/Engine.php
index e2ff23f2..fc5c6ffe 100644
--- a/src/Renderer/Engine.php
+++ b/src/Renderer/Engine.php
@@ -11,7 +11,7 @@ abstract class Engine implements EngineInterface
* @param mixed[]|string $key
* @param null $value
*/
- public function share($key, $value = null): void
+ public function share(array|string $key, $value = null): void
{
if (!is_array($key)) {
$key = [$key => $value];
diff --git a/src/Renderer/EngineInterface.php b/src/Renderer/EngineInterface.php
index dd713029..a231afbe 100644
--- a/src/Renderer/EngineInterface.php
+++ b/src/Renderer/EngineInterface.php
@@ -7,21 +7,18 @@ interface EngineInterface
/**
* Render a template
*
- * @param string $path
* @param mixed[] $data
* @return string
*/
public function get(string $path, array $data = []): string;
/**
- * @param string $path
* @return bool
*/
public function canRender(string $path): bool;
/**
* @param string|mixed[] $key
- * @param mixed $value
*/
- public function share($key, $value = null): void;
+ public function share(string|array $key, mixed $value = null): void;
}
diff --git a/src/Renderer/HtmlEngine.php b/src/Renderer/HtmlEngine.php
index 0ccffa65..f443bdb0 100644
--- a/src/Renderer/HtmlEngine.php
+++ b/src/Renderer/HtmlEngine.php
@@ -7,7 +7,6 @@ class HtmlEngine extends Engine
/**
* Render a template
*
- * @param string $path
* @param mixed[] $data
* @return string
*/
@@ -26,7 +25,6 @@ class HtmlEngine extends Engine
}
/**
- * @param string $path
* @return bool
*/
public function canRender(string $path): bool
diff --git a/src/Renderer/Renderer.php b/src/Renderer/Renderer.php
index 2cbae027..57562dc6 100644
--- a/src/Renderer/Renderer.php
+++ b/src/Renderer/Renderer.php
@@ -14,7 +14,6 @@ class Renderer
/**
* Render a template
*
- * @param string $template
* @param mixed[] $data
* @return string
*/
@@ -38,7 +37,6 @@ class Renderer
/**
* Add a new renderer engine
*
- * @param EngineInterface $renderer
*/
public function addRenderer(EngineInterface $renderer): void
{
diff --git a/src/Renderer/Twig/Extensions/Assets.php b/src/Renderer/Twig/Extensions/Assets.php
index 9c8cd79a..9615ea50 100644
--- a/src/Renderer/Twig/Extensions/Assets.php
+++ b/src/Renderer/Twig/Extensions/Assets.php
@@ -16,10 +16,6 @@ class Assets extends TwigExtension
/** @var UrlGeneratorInterface */
protected $urlGenerator;
- /**
- * @param AssetsProvider $assets
- * @param UrlGeneratorInterface $urlGenerator
- */
public function __construct(AssetsProvider $assets, UrlGeneratorInterface $urlGenerator)
{
$this->assets = $assets;
@@ -37,7 +33,6 @@ class Assets extends TwigExtension
}
/**
- * @param string $path
* @return string
*/
public function getAsset(string $path): string
diff --git a/src/Renderer/Twig/Extensions/Authentication.php b/src/Renderer/Twig/Extensions/Authentication.php
index 061a9018..195e1d6b 100644
--- a/src/Renderer/Twig/Extensions/Authentication.php
+++ b/src/Renderer/Twig/Extensions/Authentication.php
@@ -11,9 +11,6 @@ class Authentication extends TwigExtension
/** @var Authenticator */
protected $auth;
- /**
- * @param Authenticator $auth
- */
public function __construct(Authenticator $auth)
{
$this->auth = $auth;
diff --git a/src/Renderer/Twig/Extensions/Config.php b/src/Renderer/Twig/Extensions/Config.php
index da106957..db3bbcc5 100644
--- a/src/Renderer/Twig/Extensions/Config.php
+++ b/src/Renderer/Twig/Extensions/Config.php
@@ -11,9 +11,6 @@ class Config extends TwigExtension
/** @var EngelsystemConfig */
protected $config;
- /**
- * @param EngelsystemConfig $config
- */
public function __construct(EngelsystemConfig $config)
{
$this->config = $config;
diff --git a/src/Renderer/Twig/Extensions/Csrf.php b/src/Renderer/Twig/Extensions/Csrf.php
index fee1c1f9..83d8f8f5 100644
--- a/src/Renderer/Twig/Extensions/Csrf.php
+++ b/src/Renderer/Twig/Extensions/Csrf.php
@@ -11,9 +11,6 @@ class Csrf extends TwigExtension
/** @var SessionInterface */
protected $session;
- /**
- * @param SessionInterface $session
- */
public function __construct(SessionInterface $session)
{
$this->session = $session;
diff --git a/src/Renderer/Twig/Extensions/Develop.php b/src/Renderer/Twig/Extensions/Develop.php
index a0de3df5..9740b0eb 100644
--- a/src/Renderer/Twig/Extensions/Develop.php
+++ b/src/Renderer/Twig/Extensions/Develop.php
@@ -15,9 +15,6 @@ class Develop extends TwigExtension
/** @var VarDumper|null */
protected $dumper;
- /**
- * @param Config $config
- */
public function __construct(Config $config)
{
$this->config = $config;
@@ -39,10 +36,9 @@ class Develop extends TwigExtension
}
/**
- * @param mixed $vars
* @return string
*/
- public function dump(...$vars): string
+ public function dump(mixed ...$vars): string
{
ob_start();
@@ -54,10 +50,9 @@ class Develop extends TwigExtension
}
/**
- * @param mixed $vars
* @return string
*/
- public function dd(...$vars): string
+ public function dd(mixed ...$vars): string
{
$this->flushBuffers();
@@ -68,10 +63,7 @@ class Develop extends TwigExtension
return '';
}
- /**
- * @param VarDumper $dumper
- */
- public function setDumper($dumper)
+ public function setDumper(VarDumper $dumper)
{
$this->dumper = $dumper;
}
diff --git a/src/Renderer/Twig/Extensions/Globals.php b/src/Renderer/Twig/Extensions/Globals.php
index 4f19534e..f840c1d0 100644
--- a/src/Renderer/Twig/Extensions/Globals.php
+++ b/src/Renderer/Twig/Extensions/Globals.php
@@ -17,10 +17,6 @@ class Globals extends TwigExtension implements GlobalsInterface
/** @var Request */
protected $request;
- /**
- * @param Authenticator $auth
- * @param Request $request
- */
public function __construct(Authenticator $auth, Request $request)
{
$this->auth = $auth;
diff --git a/src/Renderer/Twig/Extensions/Legacy.php b/src/Renderer/Twig/Extensions/Legacy.php
index 98a97ac6..84ff035a 100644
--- a/src/Renderer/Twig/Extensions/Legacy.php
+++ b/src/Renderer/Twig/Extensions/Legacy.php
@@ -11,9 +11,6 @@ class Legacy extends TwigExtension
/** @var Request */
protected $request;
- /**
- * @param Request $request
- */
public function __construct(Request $request)
{
$this->request = $request;
diff --git a/src/Renderer/Twig/Extensions/Markdown.php b/src/Renderer/Twig/Extensions/Markdown.php
index 0744dae4..45094ed2 100644
--- a/src/Renderer/Twig/Extensions/Markdown.php
+++ b/src/Renderer/Twig/Extensions/Markdown.php
@@ -11,9 +11,6 @@ class Markdown extends TwigExtension
/** @var Parsedown */
protected $renderer;
- /**
- * @param Parsedown $renderer
- */
public function __construct(Parsedown $renderer)
{
$this->renderer = $renderer;
@@ -33,8 +30,6 @@ class Markdown extends TwigExtension
}
/**
- * @param string $text
- * @param bool $escapeHtml
*
* @return string
*/
diff --git a/src/Renderer/Twig/Extensions/Session.php b/src/Renderer/Twig/Extensions/Session.php
index 8e691156..4381874e 100644
--- a/src/Renderer/Twig/Extensions/Session.php
+++ b/src/Renderer/Twig/Extensions/Session.php
@@ -11,9 +11,6 @@ class Session extends TwigExtension
/** @var SymfonySession */
protected $session;
- /**
- * @param SymfonySession $session
- */
public function __construct(SymfonySession $session)
{
$this->session = $session;
diff --git a/src/Renderer/Twig/Extensions/Translation.php b/src/Renderer/Twig/Extensions/Translation.php
index fff3bfa9..f36777e2 100644
--- a/src/Renderer/Twig/Extensions/Translation.php
+++ b/src/Renderer/Twig/Extensions/Translation.php
@@ -12,9 +12,6 @@ class Translation extends TwigExtension
/** @var Translator */
protected $translator;
- /**
- * @param Translator $translator
- */
public function __construct(Translator $translator)
{
$this->translator = $translator;
diff --git a/src/Renderer/Twig/Extensions/Url.php b/src/Renderer/Twig/Extensions/Url.php
index 6c841b74..c8050e0b 100644
--- a/src/Renderer/Twig/Extensions/Url.php
+++ b/src/Renderer/Twig/Extensions/Url.php
@@ -11,9 +11,6 @@ class Url extends TwigExtension
/** @var UrlGeneratorInterface */
protected $urlGenerator;
- /**
- * @param UrlGeneratorInterface $urlGenerator
- */
public function __construct(UrlGeneratorInterface $urlGenerator)
{
$this->urlGenerator = $urlGenerator;
@@ -30,7 +27,6 @@ class Url extends TwigExtension
}
/**
- * @param string $path
* @param array $parameters
* @return string
*/
diff --git a/src/Renderer/TwigEngine.php b/src/Renderer/TwigEngine.php
index 2c77e54f..69c96858 100644
--- a/src/Renderer/TwigEngine.php
+++ b/src/Renderer/TwigEngine.php
@@ -20,7 +20,6 @@ class TwigEngine extends Engine
/**
* Render a twig template
*
- * @param string $path
* @param array $data
* @return string
* @throws LoaderError|RuntimeError|SyntaxError
@@ -33,7 +32,6 @@ class TwigEngine extends Engine
}
/**
- * @param string $path
* @return bool
*/
public function canRender(string $path): bool
diff --git a/src/Renderer/TwigLoader.php b/src/Renderer/TwigLoader.php
index 1bcbbd71..30fbdf59 100644
--- a/src/Renderer/TwigLoader.php
+++ b/src/Renderer/TwigLoader.php
@@ -8,8 +8,6 @@ use Twig\Loader\FilesystemLoader as FilesystemLoader;
class TwigLoader extends FilesystemLoader
{
/**
- * @param string $name
- * @param bool $throw
* @return string|null
* @throws ErrorLoader
*/
diff --git a/src/Renderer/TwigServiceProvider.php b/src/Renderer/TwigServiceProvider.php
index d101dbfb..32331947 100644
--- a/src/Renderer/TwigServiceProvider.php
+++ b/src/Renderer/TwigServiceProvider.php
@@ -102,10 +102,6 @@ class TwigServiceProvider extends ServiceProvider
$this->app->tag('renderer.twigEngine', ['renderer.engine']);
}
- /**
- * @param string $class
- * @param string $alias
- */
protected function registerTwigExtensions(string $class, string $alias)
{
$alias = 'twig.extension.' . $alias;
diff --git a/src/helpers.php b/src/helpers.php
index 94809e91..6f1b3cab 100644
--- a/src/helpers.php
+++ b/src/helpers.php
@@ -15,10 +15,9 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
/**
* Get the global app instance
*
- * @param string $id
* @return mixed|Application
*/
-function app($id = null)
+function app(string $id = null)
{
if (is_null($id)) {
return Application::getInstance();
@@ -36,20 +35,18 @@ function auth(): Authenticator
}
/**
- * @param string $path
* @return string
*/
-function base_path($path = ''): string
+function base_path(string $path = ''): string
{
return app('path') . (empty($path) ? '' : DIRECTORY_SEPARATOR . $path);
}
/**
- * @param int $status
* @param array $headers
* @return Response
*/
-function back($status = 302, $headers = []): Response
+function back(int $status = 302, array $headers = []): Response
{
/** @var Redirector $redirect */
$redirect = app('redirect');
@@ -60,11 +57,9 @@ function back($status = 302, $headers = []): Response
/**
* Get or set config values
*
- * @param string|array $key
- * @param mixed $default
* @return mixed|Config
*/
-function config($key = null, $default = null)
+function config(string|array $key = null, mixed $default = null)
{
/** @var Config $config */
$config = app('config');
@@ -82,21 +77,19 @@ function config($key = null, $default = null)
}
/**
- * @param string $path
* @return string
*/
-function config_path($path = ''): string
+function config_path(string $path = ''): string
{
return app('path.config') . (empty($path) ? '' : DIRECTORY_SEPARATOR . $path);
}
/**
- * @param string|object|null $event
* @param array $payload
*
* @return EventDispatcher
*/
-function event($event = null, $payload = [])
+function event(string|object|null $event = null, array $payload = [])
{
/** @var EventDispatcher $dispatcher */
$dispatcher = app('events.dispatcher');
@@ -109,12 +102,10 @@ function event($event = null, $payload = [])
}
/**
- * @param string $path
- * @param int $status
* @param array $headers
* @return Response
*/
-function redirect(string $path, $status = 302, $headers = []): Response
+function redirect(string $path, int $status = 302, array $headers = []): Response
{
/** @var Redirector $redirect */
$redirect = app('redirect');
@@ -123,11 +114,9 @@ function redirect(string $path, $status = 302, $headers = []): Response
}
/**
- * @param string $key
- * @param mixed $default
* @return Request|mixed
*/
-function request($key = null, $default = null)
+function request(string $key = null, mixed $default = null)
{
/** @var Request $request */
$request = app('request');
@@ -140,12 +129,10 @@ function request($key = null, $default = null)
}
/**
- * @param string $content
- * @param int $status
- * @param array $headers
+ * @param array $headers
* @return Response
*/
-function response($content = '', $status = 200, $headers = []): Response
+function response(mixed $content = '', int $status = 200, array $headers = []): Response
{
/** @var Response $response */
$response = app('psr7.response');
@@ -161,11 +148,9 @@ function response($content = '', $status = 200, $headers = []): Response
}
/**
- * @param string $key
- * @param mixed $default
* @return SessionInterface|mixed
*/
-function session($key = null, $default = null)
+function session(string $key = null, mixed $default = null)
{
/** @var SessionInterface $session */
$session = app('session');
@@ -180,11 +165,10 @@ function session($key = null, $default = null)
/**
* Translate the given message
*
- * @param string $key
* @param array $replace
* @return string|Translator
*/
-function trans($key = null, $replace = [])
+function trans(string $key = null, array $replace = [])
{
/** @var Translator $translator */
$translator = app('translator');
@@ -199,11 +183,10 @@ function trans($key = null, $replace = [])
/**
* Translate the given message
*
- * @param string $key
* @param array $replace
* @return string
*/
-function __($key, $replace = []): string
+function __(string $key, array $replace = []): string
{
/** @var Translator $translator */
$translator = app('translator');
@@ -214,13 +197,10 @@ function __($key, $replace = []): string
/**
* Translate the given message
*
- * @param string $key
- * @param string $keyPlural
- * @param int $number
* @param array $replace
* @return string
*/
-function _e($key, $keyPlural, $number, $replace = []): string
+function _e(string $key, string $keyPlural, int $number, array $replace = []): string
{
/** @var Translator $translator */
$translator = app('translator');
@@ -229,11 +209,10 @@ function _e($key, $keyPlural, $number, $replace = []): string
}
/**
- * @param string $path
* @param array $parameters
* @return UrlGeneratorInterface|string
*/
-function url($path = null, $parameters = [])
+function url(string $path = null, array $parameters = [])
{
/** @var UrlGeneratorInterface $urlGenerator */
$urlGenerator = app('http.urlGenerator');
@@ -246,11 +225,10 @@ function url($path = null, $parameters = [])
}
/**
- * @param string $template
* @param mixed[] $data
* @return Renderer|string
*/
-function view($template = null, $data = [])
+function view(string $template = null, array $data = [])
{
/** @var Renderer $renderer */
$renderer = app('renderer');
diff --git a/tests/Feature/Logger/LoggerTest.php b/tests/Feature/Logger/LoggerTest.php
index 9edec4d3..0c32e894 100644
--- a/tests/Feature/Logger/LoggerTest.php
+++ b/tests/Feature/Logger/LoggerTest.php
@@ -51,9 +51,8 @@ class LoggerTest extends ApplicationFeatureTest
/**
* @covers \Engelsystem\Logger\Logger::log
* @dataProvider provideLogLevels
- * @param string $level
*/
- public function testAllLevels($level)
+ public function testAllLevels(string $level)
{
LogEntry::query()->truncate();
$logger = $this->getLogger();
@@ -98,11 +97,9 @@ class LoggerTest extends ApplicationFeatureTest
* @covers \Engelsystem\Logger\Logger::log
* @dataProvider provideContextReplaceValues
*
- * @param string $message
* @param string[] $context
- * @param string $expected
*/
- public function testContextReplaceValues($message, $context, $expected)
+ public function testContextReplaceValues(string $message, array $context, string $expected)
{
$logger = $this->getLogger();
$logger->log(LogLevel::INFO, $message, $context);
diff --git a/tests/Unit/ApplicationTest.php b/tests/Unit/ApplicationTest.php
index dd319a78..0d6db0ab 100644
--- a/tests/Unit/ApplicationTest.php
+++ b/tests/Unit/ApplicationTest.php
@@ -169,11 +169,10 @@ class ApplicationTest extends TestCase
}
/**
- * @param Application $app
* @param array $methods
* @return ServiceProvider|MockObject
*/
- protected function mockServiceProvider(Application $app, $methods = [])
+ protected function mockServiceProvider(Application $app, array $methods = [])
{
return $this->getMockBuilder(ServiceProvider::class)
->setConstructorArgs([$app])
diff --git a/tests/Unit/Config/ConfigServiceProviderTest.php b/tests/Unit/Config/ConfigServiceProviderTest.php
index d7c060d0..43efcd01 100644
--- a/tests/Unit/Config/ConfigServiceProviderTest.php
+++ b/tests/Unit/Config/ConfigServiceProviderTest.php
@@ -129,7 +129,6 @@ class ConfigServiceProviderTest extends ServiceProviderTest
}
/**
- * @param string $configPath
* @return Application[]|Config[]
*/
protected function getConfiguredApp(string $configPath)
diff --git a/tests/Unit/Controllers/Admin/NewsControllerTest.php b/tests/Unit/Controllers/Admin/NewsControllerTest.php
index eb919c25..0fcedbef 100644
--- a/tests/Unit/Controllers/Admin/NewsControllerTest.php
+++ b/tests/Unit/Controllers/Admin/NewsControllerTest.php
@@ -117,8 +117,6 @@ class NewsControllerTest extends ControllerTest
* @covers \Engelsystem\Controllers\Admin\NewsController::save
* @dataProvider saveCreateEditProvider
*
- * @param string $text
- * @param bool $isMeeting
* @param int|null $id
*/
public function testSaveCreateEdit(
diff --git a/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php b/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php
index e6cb2f67..038346a3 100644
--- a/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php
+++ b/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php
@@ -68,8 +68,11 @@ class UserWorkLogControllerTest extends ControllerTest
*
* @dataProvider buildupConfigsAndWorkDates
*/
- public function testShowAddWorklogWithSuggestedWorkDate($buildup_start, $event_start, $suggested_work_date)
- {
+ public function testShowAddWorklogWithSuggestedWorkDate(
+ Carbon|null $buildup_start,
+ Carbon|null $event_start,
+ Carbon $suggested_work_date
+ ) {
$request = $this->request->withAttribute('user_id', $this->user->id);
config(['buildup_start' => $buildup_start]);
config(['event_start' => $event_start]);
@@ -143,7 +146,7 @@ class UserWorkLogControllerTest extends ControllerTest
*
* @dataProvider invalidSaveWorkLogParams
*/
- public function testSaveWorklogWithInvalidParamsThrows($body)
+ public function testSaveWorklogWithInvalidParamsThrows(array $body)
{
$request = $this->request->withAttribute('user_id', $this->user->id)->withParsedBody($body);
$this->expectException(ValidationException::class);
diff --git a/tests/Unit/Controllers/ChecksArrivalsAndDeparturesTest.php b/tests/Unit/Controllers/ChecksArrivalsAndDeparturesTest.php
index 3373a6ee..c74fe053 100644
--- a/tests/Unit/Controllers/ChecksArrivalsAndDeparturesTest.php
+++ b/tests/Unit/Controllers/ChecksArrivalsAndDeparturesTest.php
@@ -58,8 +58,12 @@ class ChecksArrivalsAndDeparturesTest extends TestCase
* @covers \Engelsystem\Controllers\ChecksArrivalsAndDepartures::isAfterTeardown
* @dataProvider invalidArrivalCombinations
*/
- public function testCheckInvalidDatesForArrival($buildup, $teardown, $arrival, $departure)
- {
+ public function testCheckInvalidDatesForArrival(
+ ?string $buildup,
+ ?string $teardown,
+ ?string $arrival,
+ ?string $departure
+ ) {
config(['buildup_start' => is_null($buildup) ? null : new Carbon($buildup)]);
config(['teardown_end' => is_null($teardown) ? null : new Carbon($teardown)]);
@@ -74,8 +78,12 @@ class ChecksArrivalsAndDeparturesTest extends TestCase
* @covers \Engelsystem\Controllers\ChecksArrivalsAndDepartures::isAfterTeardown
* @dataProvider invalidDepartureCombinations
*/
- public function testCheckInvalidDatesForDeparture($buildup, $teardown, $arrival, $departure)
- {
+ public function testCheckInvalidDatesForDeparture(
+ ?string $buildup,
+ ?string $teardown,
+ ?string $arrival,
+ ?string $departure
+ ) {
config(['buildup_start' => is_null($buildup) ? null : new Carbon($buildup)]);
config(['teardown_end' => is_null($teardown) ? null : new Carbon($teardown)]);
@@ -90,8 +98,12 @@ class ChecksArrivalsAndDeparturesTest extends TestCase
* @covers \Engelsystem\Controllers\ChecksArrivalsAndDepartures::isAfterTeardown
* @dataProvider validArrivalCombinations
*/
- public function testCheckValidDatesForArrival($buildup, $teardown, $arrival, $departure)
- {
+ public function testCheckValidDatesForArrival(
+ ?string $buildup,
+ ?string $teardown,
+ ?string $arrival,
+ ?string $departure
+ ) {
config(['buildup_start' => is_null($buildup) ? null : new Carbon($buildup)]);
config(['teardown_end' => is_null($teardown) ? null : new Carbon($teardown)]);
@@ -106,8 +118,12 @@ class ChecksArrivalsAndDeparturesTest extends TestCase
* @covers \Engelsystem\Controllers\ChecksArrivalsAndDepartures::isAfterTeardown
* @dataProvider validDepartureCombinations
*/
- public function testCheckValidDatesForDeparture($buildup, $teardown, $arrival, $departure)
- {
+ public function testCheckValidDatesForDeparture(
+ ?string $buildup,
+ ?string $teardown,
+ ?string $arrival,
+ ?string $departure
+ ) {
config(['buildup_start' => is_null($buildup) ? null : new Carbon($buildup)]);
config(['teardown_end' => is_null($teardown) ? null : new Carbon($teardown)]);
diff --git a/tests/Unit/Controllers/ControllerTest.php b/tests/Unit/Controllers/ControllerTest.php
index 5a4f9ae6..89f23234 100644
--- a/tests/Unit/Controllers/ControllerTest.php
+++ b/tests/Unit/Controllers/ControllerTest.php
@@ -36,7 +36,6 @@ abstract class ControllerTest extends TestCase
protected $session;
/**
- * @param string $value
* @param string|null $type
*/
protected function assertHasNotification(string $value, string $type = 'messages')
diff --git a/tests/Unit/Controllers/MessagesControllerTest.php b/tests/Unit/Controllers/MessagesControllerTest.php
index cca8ed96..210962e8 100644
--- a/tests/Unit/Controllers/MessagesControllerTest.php
+++ b/tests/Unit/Controllers/MessagesControllerTest.php
@@ -543,7 +543,7 @@ class MessagesControllerTest extends ControllerTest
$this->controller->setValidator(new Validator());
}
- protected function assertArrayOrCollection($obj)
+ protected function assertArrayOrCollection(mixed $obj)
{
$this->assertTrue(gettype($obj) == 'array' || $obj instanceof Collection);
}
diff --git a/tests/Unit/Controllers/Metrics/StatsTest.php b/tests/Unit/Controllers/Metrics/StatsTest.php
index 4be3f734..f25c3d5e 100644
--- a/tests/Unit/Controllers/Metrics/StatsTest.php
+++ b/tests/Unit/Controllers/Metrics/StatsTest.php
@@ -434,8 +434,12 @@ class StatsTest extends TestCase
*
* @return User
*/
- protected function addUser(array $state = [], $personalData = [], $settings = [], $license = []): User
- {
+ protected function addUser(
+ array $state = [],
+ array $personalData = [],
+ array $settings = [],
+ array $license = []
+ ): User {
$name = 'user_' . Str::random(5);
$user = new User([
diff --git a/tests/Unit/Controllers/PasswordResetControllerTest.php b/tests/Unit/Controllers/PasswordResetControllerTest.php
index 1b36beb9..955476c3 100644
--- a/tests/Unit/Controllers/PasswordResetControllerTest.php
+++ b/tests/Unit/Controllers/PasswordResetControllerTest.php
@@ -214,7 +214,6 @@ class PasswordResetControllerTest extends TestCase
}
/**
- * @param string $view
* @param array $data
* @return PasswordResetController
*/
@@ -260,7 +259,6 @@ class PasswordResetControllerTest extends TestCase
}
/**
- * @param User $user
* @return PasswordReset
*/
protected function createToken(User $user): PasswordReset
diff --git a/tests/Unit/Controllers/SettingsControllerTest.php b/tests/Unit/Controllers/SettingsControllerTest.php
index f1fbc778..02cb8741 100644
--- a/tests/Unit/Controllers/SettingsControllerTest.php
+++ b/tests/Unit/Controllers/SettingsControllerTest.php
@@ -382,7 +382,6 @@ class SettingsControllerTest extends ControllerTest
/**
* @covers \Engelsystem\Controllers\SettingsController::savePassword
* @dataProvider savePasswordValidationProvider
- * @param string $password
* @param string $new_password
* @param string $new_password2
*/
diff --git a/tests/Unit/Controllers/Stub/HasUserNotificationsImplementation.php b/tests/Unit/Controllers/Stub/HasUserNotificationsImplementation.php
index 1e71b9db..2083c831 100644
--- a/tests/Unit/Controllers/Stub/HasUserNotificationsImplementation.php
+++ b/tests/Unit/Controllers/Stub/HasUserNotificationsImplementation.php
@@ -8,11 +8,7 @@ class HasUserNotificationsImplementation
{
use HasUserNotifications;
- /**
- * @param string|array $value
- * @param string $type
- */
- public function add($value, $type = 'messages')
+ public function add(string|array $value, string $type = 'messages')
{
$this->addNotification($value, $type);
}
diff --git a/tests/Unit/Database/DatabaseServiceProviderTest.php b/tests/Unit/Database/DatabaseServiceProviderTest.php
index 241c47b7..781659cb 100644
--- a/tests/Unit/Database/DatabaseServiceProviderTest.php
+++ b/tests/Unit/Database/DatabaseServiceProviderTest.php
@@ -73,10 +73,9 @@ class DatabaseServiceProviderTest extends ServiceProviderTest
* Prepare some mocks
*
* @param array $dbConfigData
- * @param bool $getPdoThrowException
* @return array
*/
- protected function prepare($dbConfigData, $getPdoThrowException = false)
+ protected function prepare(array $dbConfigData, bool $getPdoThrowException = false)
{
/** @var Config|MockObject $config */
$config = $this->getMockBuilder(Config::class)
diff --git a/tests/Unit/Events/EventDispatcherTest.php b/tests/Unit/Events/EventDispatcherTest.php
index a62b4bd9..ba8773bc 100644
--- a/tests/Unit/Events/EventDispatcherTest.php
+++ b/tests/Unit/Events/EventDispatcherTest.php
@@ -114,9 +114,6 @@ class EventDispatcherTest extends TestCase
$this->assertEquals(['default' => 'handler'], $response);
}
- /**
- * @param string $event
- */
public function eventHandler(string $event): void
{
if (!isset($this->firedEvents[$event])) {
diff --git a/tests/Unit/Events/EventsServiceProviderTest.php b/tests/Unit/Events/EventsServiceProviderTest.php
index a91abc87..b6f76328 100644
--- a/tests/Unit/Events/EventsServiceProviderTest.php
+++ b/tests/Unit/Events/EventsServiceProviderTest.php
@@ -22,13 +22,13 @@ class EventsServiceProviderTest extends ServiceProviderTest
->withConsecutive(
['test.event', 'someFunction'],
['another.event', 'Foo\Bar@baz'],
- ['another.event', [$this, 'someMethod']]
+ ['another.event', [$this, 'testRegister']]
);
$config = new Config([
'event-handlers' => [
'test.event' => 'someFunction',
- 'another.event' => ['Foo\Bar@baz', [$this, 'someMethod']]
+ 'another.event' => ['Foo\Bar@baz', [$this, 'testRegister']]
]
]);
$this->app->instance('config', $config);
diff --git a/tests/Unit/Helpers/DumpServerServiceProviderTest.php b/tests/Unit/Helpers/DumpServerServiceProviderTest.php
index 3b494702..3757c274 100644
--- a/tests/Unit/Helpers/DumpServerServiceProviderTest.php
+++ b/tests/Unit/Helpers/DumpServerServiceProviderTest.php
@@ -62,8 +62,6 @@ class DumpServerServiceProviderTest extends ServiceProviderTest
* @covers \Engelsystem\Helpers\DumpServerServiceProvider::register
* @dataProvider notEnabledDataProvider
*
- * @param bool $enable
- * @param string $environment
*/
public function testRegisterShouldNotEnable(bool $enable, string $environment): void
{
diff --git a/tests/Unit/Helpers/Schedule/CalculatesTimeTest.php b/tests/Unit/Helpers/Schedule/CalculatesTimeTest.php
index 8f0123e9..eb4ceffd 100644
--- a/tests/Unit/Helpers/Schedule/CalculatesTimeTest.php
+++ b/tests/Unit/Helpers/Schedule/CalculatesTimeTest.php
@@ -16,7 +16,6 @@ class CalculatesTimeTest extends TestCase
use CalculatesTime;
/**
- * @param string $time
* @return int
*/
public function calc(string $time): int
diff --git a/tests/Unit/Helpers/ShiftsTest.php b/tests/Unit/Helpers/ShiftsTest.php
index 8a76cf39..a1ab4fe8 100644
--- a/tests/Unit/Helpers/ShiftsTest.php
+++ b/tests/Unit/Helpers/ShiftsTest.php
@@ -55,7 +55,7 @@ class ShiftsTest extends TestCase
* @covers \Engelsystem\Helpers\Shifts::isNightShift
* @dataProvider nightShiftData
*/
- public function testIsNightShiftEnabled($start, $end, $isNightShift)
+ public function testIsNightShiftEnabled(Carbon $start, Carbon $end, bool $isNightShift)
{
$config = new Config(['night_shifts' => [
'enabled' => true,
diff --git a/tests/Unit/Helpers/Stub/UserModelImplementation.php b/tests/Unit/Helpers/Stub/UserModelImplementation.php
index 69b7732b..d9cc48ca 100644
--- a/tests/Unit/Helpers/Stub/UserModelImplementation.php
+++ b/tests/Unit/Helpers/Stub/UserModelImplementation.php
@@ -19,11 +19,10 @@ class UserModelImplementation extends User
public static $apiKey = null;
/**
- * @param mixed $id
* @param array $columns
* @return User|null
*/
- public function find($id, $columns = ['*'])
+ public function find(mixed $id, array $columns = ['*'])
{
if ($id != static::$id) {
throw new InvalidArgumentException('Wrong user ID searched');
@@ -33,10 +32,9 @@ class UserModelImplementation extends User
}
/**
- * @param string $apiKey
* @return User[]|Collection|QueryBuilder
*/
- public static function whereApiKey($apiKey)
+ public static function whereApiKey(string $apiKey)
{
if ($apiKey != static::$apiKey) {
throw new InvalidArgumentException('Wrong api key searched');
diff --git a/tests/Unit/HelpersTest.php b/tests/Unit/HelpersTest.php
index 30d2dfe7..af1f318d 100644
--- a/tests/Unit/HelpersTest.php
+++ b/tests/Unit/HelpersTest.php
@@ -334,11 +334,9 @@ class HelpersTest extends TestCase
}
/**
- * @param string $alias
- * @param object $object
* @return Application|MockObject
*/
- protected function getAppMock($alias, $object)
+ protected function getAppMock(string $alias, object $object)
{
/** @var Application|MockObject $appMock */
$appMock = $this->getMockBuilder(Container::class)
diff --git a/tests/Unit/Http/RedirectorTest.php b/tests/Unit/Http/RedirectorTest.php
index 12c2215a..78c24d1a 100644
--- a/tests/Unit/Http/RedirectorTest.php
+++ b/tests/Unit/Http/RedirectorTest.php
@@ -73,7 +73,6 @@ class RedirectorTest extends TestCase
/**
* Returns the provided path
*
- * @param string $path
* @return string
*/
public function returnPath(string $path)
diff --git a/tests/Unit/Http/RequestServiceProviderTest.php b/tests/Unit/Http/RequestServiceProviderTest.php
index b0bd5b29..ec6b70d5 100644
--- a/tests/Unit/Http/RequestServiceProviderTest.php
+++ b/tests/Unit/Http/RequestServiceProviderTest.php
@@ -32,10 +32,9 @@ class RequestServiceProviderTest extends ServiceProviderTest
* @dataProvider provideRegister
* @covers \Engelsystem\Http\RequestServiceProvider::register
*
- * @param string|array $configuredProxies
* @param array $trustedProxies
*/
- public function testRegister($configuredProxies, array $trustedProxies)
+ public function testRegister(string|array $configuredProxies, array $trustedProxies)
{
$config = new Config([
'trusted_proxies' => $configuredProxies,
diff --git a/tests/Unit/Http/UrlGeneratorTest.php b/tests/Unit/Http/UrlGeneratorTest.php
index 34293f56..b9eb7c92 100644
--- a/tests/Unit/Http/UrlGeneratorTest.php
+++ b/tests/Unit/Http/UrlGeneratorTest.php
@@ -26,13 +26,9 @@ class UrlGeneratorTest extends TestCase
* @covers \Engelsystem\Http\UrlGenerator::to
* @covers \Engelsystem\Http\UrlGenerator::generateUrl
*
- * @param string $path
- * @param string $willReturn
- * @param string $urlToPath
* @param string[] $arguments
- * @param string $expectedUrl
*/
- public function testTo($urlToPath, $path, $willReturn, $arguments, $expectedUrl)
+ public function testTo(string $urlToPath, string $path, string $willReturn, array $arguments, string $expectedUrl)
{
$request = $this->getMockBuilder(Request::class)
->getMock();
diff --git a/tests/Unit/Http/Validation/Rules/StringInputLengthTest.php b/tests/Unit/Http/Validation/Rules/StringInputLengthTest.php
index 5c4dc512..2c8e0fe9 100644
--- a/tests/Unit/Http/Validation/Rules/StringInputLengthTest.php
+++ b/tests/Unit/Http/Validation/Rules/StringInputLengthTest.php
@@ -11,10 +11,8 @@ class StringInputLengthTest extends TestCase
* @covers \Engelsystem\Http\Validation\Rules\StringInputLength::validate
* @covers \Engelsystem\Http\Validation\Rules\StringInputLength::isDateTime
* @dataProvider validateProvider
- * @param mixed $input
- * @param mixed $expectedInput
*/
- public function testValidate($input, $expectedInput)
+ public function testValidate(mixed $input, mixed $expectedInput)
{
$rule = new UsesStringInputLength();
$rule->validate($input);
diff --git a/tests/Unit/Http/Validation/Rules/Stub/ParentClassImplementation.php b/tests/Unit/Http/Validation/Rules/Stub/ParentClassImplementation.php
index 1b6aaaf5..3611b07a 100644
--- a/tests/Unit/Http/Validation/Rules/Stub/ParentClassImplementation.php
+++ b/tests/Unit/Http/Validation/Rules/Stub/ParentClassImplementation.php
@@ -11,10 +11,9 @@ class ParentClassImplementation
public $lastInput;
/**
- * @param mixed $input
* @return bool
*/
- public function validate($input): bool
+ public function validate(mixed $input): bool
{
$this->lastInput = $input;
diff --git a/tests/Unit/Http/Validation/Stub/ValidatesRequestImplementation.php b/tests/Unit/Http/Validation/Stub/ValidatesRequestImplementation.php
index 772b1dc9..c6e4b59c 100644
--- a/tests/Unit/Http/Validation/Stub/ValidatesRequestImplementation.php
+++ b/tests/Unit/Http/Validation/Stub/ValidatesRequestImplementation.php
@@ -8,7 +8,6 @@ use Engelsystem\Http\Request;
class ValidatesRequestImplementation extends BaseController
{
/**
- * @param Request $request
* @param array $rules
* @return array
*/
diff --git a/tests/Unit/Mail/MailerServiceProviderTest.php b/tests/Unit/Mail/MailerServiceProviderTest.php
index 46585947..4b3957d1 100644
--- a/tests/Unit/Mail/MailerServiceProviderTest.php
+++ b/tests/Unit/Mail/MailerServiceProviderTest.php
@@ -86,11 +86,10 @@ class MailerServiceProviderTest extends ServiceProviderTest
/**
* @covers \Engelsystem\Mail\MailerServiceProvider::getTransport
- * @param string $class
* @param array $emailConfig
* @dataProvider provideTransports
*/
- public function testGetTransport($class, $emailConfig = [])
+ public function testGetTransport(string $class, array $emailConfig = [])
{
$app = $this->getApplication($emailConfig);
@@ -134,7 +133,7 @@ class MailerServiceProviderTest extends ServiceProviderTest
* @param array $configuration
* @return Application
*/
- protected function getApplication($configuration = []): Application
+ protected function getApplication(array $configuration = []): Application
{
$app = new Application();
@@ -149,9 +148,8 @@ class MailerServiceProviderTest extends ServiceProviderTest
/**
* @param string[] $abstracts
- * @param Application $container
*/
- protected function assertExistsInContainer($abstracts, $container)
+ protected function assertExistsInContainer(array $abstracts, Application $container)
{
$first = array_shift($abstracts);
$this->assertContainerHas($first, $container);
@@ -162,11 +160,7 @@ class MailerServiceProviderTest extends ServiceProviderTest
}
}
- /**
- * @param string $abstract
- * @param Application $container
- */
- protected function assertContainerHas($abstract, $container)
+ protected function assertContainerHas(string $abstract, Application $container)
{
$this->assertTrue(
$container->has($abstract) || $container->hasMethodBinding($abstract),
diff --git a/tests/Unit/Middleware/CallableHandlerTest.php b/tests/Unit/Middleware/CallableHandlerTest.php
index 7721aadf..72761bb5 100644
--- a/tests/Unit/Middleware/CallableHandlerTest.php
+++ b/tests/Unit/Middleware/CallableHandlerTest.php
@@ -30,9 +30,8 @@ class CallableHandlerTest extends TestCase
* @dataProvider provideCallable
* @covers \Engelsystem\Middleware\CallableHandler::__construct
* @covers \Engelsystem\Middleware\CallableHandler::getCallable
- * @param callable $callable
*/
- public function testInit($callable)
+ public function testInit(callable $callable)
{
$handler = new CallableHandler($callable);
diff --git a/tests/Unit/Middleware/DispatcherTest.php b/tests/Unit/Middleware/DispatcherTest.php
index 347d2071..6c1d348a 100644
--- a/tests/Unit/Middleware/DispatcherTest.php
+++ b/tests/Unit/Middleware/DispatcherTest.php
@@ -4,7 +4,6 @@ namespace Engelsystem\Test\Unit\Middleware;
use Engelsystem\Application;
use Engelsystem\Middleware\Dispatcher;
-use Engelsystem\Test\Unit\Middleware\Stub\NotARealMiddleware;
use InvalidArgumentException;
use LogicException;
use PHPUnit\Framework\MockObject\MockObject;
@@ -129,20 +128,6 @@ class DispatcherTest extends TestCase
$dispatcher->handle($request);
}
- /**
- * @covers \Engelsystem\Middleware\Dispatcher::handle
- */
- public function testHandleNoRealMiddleware()
- {
- /** @var ServerRequestInterface|MockObject $request */
- $request = $this->createMock(ServerRequestInterface::class);
-
- $this->expectException(InvalidArgumentException::class);
-
- $dispatcher = new Dispatcher([new NotARealMiddleware()]);
- $dispatcher->handle($request);
- }
-
/**
* @covers \Engelsystem\Middleware\Dispatcher::handle
*/
diff --git a/tests/Unit/Middleware/ErrorHandlerTest.php b/tests/Unit/Middleware/ErrorHandlerTest.php
index e18028f7..cca346a2 100644
--- a/tests/Unit/Middleware/ErrorHandlerTest.php
+++ b/tests/Unit/Middleware/ErrorHandlerTest.php
@@ -75,6 +75,10 @@ class ErrorHandlerTest extends TestCase
['application/json']
);
+ $response->expects(self::any())
+ ->method('getHeaders')
+ ->willReturn([]);
+
$returnResponseHandler->setResponse($response);
$return = $errorHandler->process($request, $returnResponseHandler);
$this->assertEquals($response, $return, 'Only Responses >= 400 should be processed');
diff --git a/tests/Unit/Middleware/RequestHandlerTest.php b/tests/Unit/Middleware/RequestHandlerTest.php
index 21bb28c1..a3c529ac 100644
--- a/tests/Unit/Middleware/RequestHandlerTest.php
+++ b/tests/Unit/Middleware/RequestHandlerTest.php
@@ -105,7 +105,7 @@ class RequestHandlerTest extends TestCase
$request->expects($this->exactly(1))
->method('getAttribute')
->with('route-request-handler')
- ->willReturn('FooBarTestController@showStuff');
+ ->willReturn('FooBarTestController@process');
/** @var RequestHandler|MockObject $middleware */
$middleware = $this->getMockBuilder(RequestHandler::class)
@@ -114,7 +114,7 @@ class RequestHandlerTest extends TestCase
->getMock();
$middleware->expects($this->once())
->method('resolveMiddleware')
- ->with([$middlewareInterface, 'showStuff'])
+ ->with([$middlewareInterface, 'process'])
->willReturn($middlewareInterface);
$middlewareInterface->expects($this->once())
diff --git a/tests/Unit/Middleware/Stub/ExceptionMiddlewareHandler.php b/tests/Unit/Middleware/Stub/ExceptionMiddlewareHandler.php
index 5e374bea..f8b9ad96 100644
--- a/tests/Unit/Middleware/Stub/ExceptionMiddlewareHandler.php
+++ b/tests/Unit/Middleware/Stub/ExceptionMiddlewareHandler.php
@@ -12,7 +12,6 @@ class ExceptionMiddlewareHandler implements RequestHandlerInterface
/**
* Throws an exception
*
- * @param ServerRequestInterface $request
* @return ResponseInterface
* @throws Exception
*/
diff --git a/tests/Unit/Middleware/Stub/ResolvesMiddlewareTraitImplementation.php b/tests/Unit/Middleware/Stub/ResolvesMiddlewareTraitImplementation.php
index 2787d74b..542c7757 100644
--- a/tests/Unit/Middleware/Stub/ResolvesMiddlewareTraitImplementation.php
+++ b/tests/Unit/Middleware/Stub/ResolvesMiddlewareTraitImplementation.php
@@ -15,20 +15,16 @@ class ResolvesMiddlewareTraitImplementation
/** @var Application */
protected $container;
- /**
- * @param Application $container
- */
public function __construct(Application $container = null)
{
$this->container = $container;
}
/**
- * @param string|callable|MiddlewareInterface|RequestHandlerInterface $middleware
* @return MiddlewareInterface|RequestHandlerInterface
* @throws InvalidArgumentException
*/
- public function callResolveMiddleware($middleware)
+ public function callResolveMiddleware(string|callable|MiddlewareInterface|RequestHandlerInterface $middleware)
{
return $this->resolveMiddleware($middleware);
}
diff --git a/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php b/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php
index 7c241353..e7fe1a88 100644
--- a/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php
+++ b/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php
@@ -23,8 +23,6 @@ class ReturnResponseMiddleware implements MiddlewareInterface
*
* Could be used to group middleware
*
- * @param ServerRequestInterface $request
- * @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(
diff --git a/tests/Unit/Middleware/Stub/ReturnResponseMiddlewareHandler.php b/tests/Unit/Middleware/Stub/ReturnResponseMiddlewareHandler.php
index 18d7a28b..cf565329 100644
--- a/tests/Unit/Middleware/Stub/ReturnResponseMiddlewareHandler.php
+++ b/tests/Unit/Middleware/Stub/ReturnResponseMiddlewareHandler.php
@@ -20,7 +20,6 @@ class ReturnResponseMiddlewareHandler implements RequestHandlerInterface
/**
* Returns a given response
*
- * @param ServerRequestInterface $request
* @return ResponseInterface
* @throws Exception
*/
@@ -32,7 +31,6 @@ class ReturnResponseMiddlewareHandler implements RequestHandlerInterface
/**
* Set the response
*
- * @param ResponseInterface $response
*/
public function setResponse(ResponseInterface $response)
{
diff --git a/tests/Unit/Models/EventConfigTest.php b/tests/Unit/Models/EventConfigTest.php
index ebc5e827..8dfd9e6c 100644
--- a/tests/Unit/Models/EventConfigTest.php
+++ b/tests/Unit/Models/EventConfigTest.php
@@ -89,7 +89,7 @@ class EventConfigTest extends ModelTest
*/
public function testGetValueCast()
{
- $model = new EventConfig(['value' => 'bar']);
+ $model = new EventConfig(['name' => 'foo', 'value' => 'bar']);
$this->assertEquals('bar', $model->value);
return;
@@ -105,11 +105,9 @@ class EventConfigTest extends ModelTest
return new class extends EventConfig
{
/**
- * @param string $value
- * @param string $type
* @return EventConfig
*/
- public function setValueCast($value, $type)
+ public function setValueCast(string $value, string $type)
{
$this->valueCasts[$value] = $type;
diff --git a/tests/Unit/Models/QuestionTest.php b/tests/Unit/Models/QuestionTest.php
index e05aba83..786914c5 100644
--- a/tests/Unit/Models/QuestionTest.php
+++ b/tests/Unit/Models/QuestionTest.php
@@ -87,8 +87,6 @@ class QuestionTest extends ModelTest
}
/**
- * @param User $user
- * @param User|null $answerer
* @return Question
*/
private function createQuestion(User $user, ?User $answerer = null): Question
diff --git a/tests/Unit/Models/User/UserTest.php b/tests/Unit/Models/User/UserTest.php
index a41df889..5cbec77a 100644
--- a/tests/Unit/Models/User/UserTest.php
+++ b/tests/Unit/Models/User/UserTest.php
@@ -141,12 +141,10 @@ class UserTest extends ModelTest
*
* @dataProvider hasOneRelationsProvider
*
- * @param string $class
- * @param string $name
* @param array $data
* @throws Exception
*/
- public function testHasOneRelations($class, $name, $data)
+ public function testHasOneRelations(string $class, string $name, array $data)
{
$user = new User($this->data);
$user->save();
diff --git a/tests/Unit/Renderer/HtmlEngineTest.php b/tests/Unit/Renderer/HtmlEngineTest.php
index cb8578d3..d6f5088b 100644
--- a/tests/Unit/Renderer/HtmlEngineTest.php
+++ b/tests/Unit/Renderer/HtmlEngineTest.php
@@ -41,11 +41,9 @@ class HtmlEngineTest extends TestCase
}
/**
- * @param string $content
- * @param string $extension
* @return string
*/
- protected function createTempFile($content = '', $extension = '.html')
+ protected function createTempFile(string $content = '', string $extension = '.html')
{
$tmpFileName = tempnam(sys_get_temp_dir(), 'EngelsystemUnitTest');
diff --git a/tests/Unit/Renderer/Twig/Extensions/ExtensionTest.php b/tests/Unit/Renderer/Twig/Extensions/ExtensionTest.php
index be55616b..aa9dce26 100644
--- a/tests/Unit/Renderer/Twig/Extensions/ExtensionTest.php
+++ b/tests/Unit/Renderer/Twig/Extensions/ExtensionTest.php
@@ -16,11 +16,9 @@ abstract class ExtensionTest extends TestCase
/**
* Assert that a twig filter was registered
*
- * @param string $name
- * @param callable $callback
* @param TwigFunction[] $functions
*/
- protected function assertFilterExists($name, $callback, $functions)
+ protected function assertFilterExists(string $name, callable $callback, array $functions)
{
foreach ($functions as $function) {
if ($function->getName() != $name) {
@@ -37,13 +35,11 @@ abstract class ExtensionTest extends TestCase
/**
* Assert that a twig function was registered
*
- * @param string $name
- * @param callable $callback
* @param TwigFunction[] $functions
* @param array $options
* @throws Exception
*/
- protected function assertExtensionExists($name, $callback, $functions, $options = [])
+ protected function assertExtensionExists(string $name, callable $callback, array $functions, array $options = [])
{
foreach ($functions as $function) {
if ($function->getName() != $name) {
@@ -68,12 +64,10 @@ abstract class ExtensionTest extends TestCase
/**
* Assert that a global exists
*
- * @param string $name
- * @param mixed $value
* @param mixed[] $globals
* @throws Exception
*/
- protected function assertGlobalsExists($name, $value, $globals)
+ protected function assertGlobalsExists(string $name, mixed $value, array $globals)
{
if (array_key_exists($name, $globals)) {
$this->assertArraySubset([$name => $value], $globals);
@@ -83,20 +77,4 @@ abstract class ExtensionTest extends TestCase
$this->fail(sprintf('Global %s not found', $name));
}
-
- /**
- * Assert that a token parser was set
- *
- * @param $tokenParser
- * @param $tokenParsers
- * @throws Exception
- */
- protected function assertTokenParserExists($tokenParser, $tokenParsers)
- {
- $this->assertArraySubset(
- [$tokenParser],
- $tokenParsers,
- sprintf('Token parser %s not found', get_class($tokenParser))
- );
- }
}
diff --git a/tests/Unit/Renderer/Twig/Extensions/UrlTest.php b/tests/Unit/Renderer/Twig/Extensions/UrlTest.php
index c7e40bea..f9c30ec7 100644
--- a/tests/Unit/Renderer/Twig/Extensions/UrlTest.php
+++ b/tests/Unit/Renderer/Twig/Extensions/UrlTest.php
@@ -39,14 +39,11 @@ class UrlTest extends ExtensionTest
/**
* @dataProvider getUrls
*
- * @param string $url
- * @param string $return
- * @param string $urlTo
* @param array $parameters
*
* @covers \Engelsystem\Renderer\Twig\Extensions\Url::getUrl
*/
- public function testGetUrl($url, $urlTo, $return, $parameters = [])
+ public function testGetUrl(string $url, string $urlTo, string $return, array $parameters = [])
{
/** @var UrlGenerator|MockObject $urlGenerator */
$urlGenerator = $this->createMock(UrlGenerator::class);
diff --git a/tests/Unit/Renderer/TwigServiceProviderTest.php b/tests/Unit/Renderer/TwigServiceProviderTest.php
index 618f7101..3fed41c5 100644
--- a/tests/Unit/Renderer/TwigServiceProviderTest.php
+++ b/tests/Unit/Renderer/TwigServiceProviderTest.php
@@ -183,11 +183,10 @@ class TwigServiceProviderTest extends ServiceProviderTest
}
/**
- * @param TwigServiceProvider $serviceProvider
* @param array $extensions
* @throws ReflectionException
*/
- protected function setExtensionsTo($serviceProvider, $extensions)
+ protected function setExtensionsTo(TwigServiceProvider $serviceProvider, array $extensions)
{
$reflection = new Reflection(get_class($serviceProvider));
diff --git a/tests/Unit/ServiceProviderTest.php b/tests/Unit/ServiceProviderTest.php
index 3a1c2f77..d840c0c1 100644
--- a/tests/Unit/ServiceProviderTest.php
+++ b/tests/Unit/ServiceProviderTest.php
@@ -11,7 +11,7 @@ abstract class ServiceProviderTest extends TestCase
* @param array $methods
* @return Application|MockObject
*/
- protected function getApp($methods = ['make', 'instance'])
+ protected function getApp(array $methods = ['make', 'instance'])
{
return $this->getMockBuilder(Application::class)
->onlyMethods($methods)
diff --git a/tests/Unit/TestCase.php b/tests/Unit/TestCase.php
index d59c6892..d24bcf1e 100644
--- a/tests/Unit/TestCase.php
+++ b/tests/Unit/TestCase.php
@@ -17,14 +17,15 @@ abstract class TestCase extends PHPUnitTestCase
protected $app;
/**
- * @param MockObject $object
- * @param string $method
* @param array $arguments
- * @param mixed $return
- * @param InvocationOrder $times
*/
- protected function setExpects($object, $method, $arguments = null, $return = null, $times = null)
- {
+ protected function setExpects(
+ MockObject $object,
+ string $method,
+ array $arguments = null,
+ mixed $return = null,
+ InvocationOrder|int $times = null
+ ) {
if (is_null($times)) {
$times = $this->once();
}
@@ -60,7 +61,6 @@ abstract class TestCase extends PHPUnitTestCase
}
/**
- * @param bool $mockImplementation
* @return Translator&MockObject
*/
protected function mockTranslator(bool $mockImplementation = true): Translator