Add useless comment phpcs sniff

This commit is contained in:
Michael Weimann 2022-12-15 20:20:33 +01:00
parent 61139e03c3
commit 2ad4203dd3
No known key found for this signature in database
GPG Key ID: 34F0524D4DA694A1
144 changed files with 18 additions and 554 deletions

View File

@ -38,4 +38,5 @@
</rule>
<rule ref="SlevomatCodingStandard.Classes.RequireConstructorPropertyPromotion" />
<rule ref="SlevomatCodingStandard.Commenting.EmptyComment" />
<rule ref="SlevomatCodingStandard.Commenting.UselessFunctionDocComment" />
</ruleset>

View File

@ -10,9 +10,6 @@ class AngelTypeFactory extends Factory
/** @var string */
protected $model = AngelType::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -10,9 +10,6 @@ class FaqFactory extends Factory
/** @var string */
protected $model = Faq::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -10,9 +10,6 @@ class GroupFactory extends Factory
/** @var string */
protected $model = Group::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -11,9 +11,6 @@ class MessageFactory extends Factory
/** @var string */
protected $model = Message::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -12,9 +12,6 @@ class NewsCommentFactory extends Factory
/** @var string */
protected $model = NewsComment::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -11,9 +11,6 @@ class NewsFactory extends Factory
/** @var string */
protected $model = News::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -10,9 +10,6 @@ class PrivilegeFactory extends Factory
/** @var string */
protected $model = Privilege::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -12,9 +12,6 @@ class QuestionFactory extends Factory
/** @var string */
protected $model = Question::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -10,9 +10,6 @@ class RoomFactory extends Factory
/** @var string */
protected $model = Room::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -10,9 +10,6 @@ class ScheduleFactory extends Factory
/** @var string */
protected $model = Schedule::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -10,9 +10,6 @@ class ShiftTypeFactory extends Factory
/** @var string */
protected $model = ShiftType::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -10,9 +10,6 @@ class ContactFactory extends Factory
/** @var string */
protected $model = Contact::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -10,9 +10,6 @@ class LicenseFactory extends Factory
/** @var string */
protected $model = License::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
$drive_car = $this->faker->boolean(.8);

View File

@ -10,9 +10,6 @@ class PasswordResetFactory extends Factory
/** @var string */
protected $model = PasswordReset::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -11,9 +11,6 @@ class PersonalDataFactory extends Factory
/** @var string */
protected $model = PersonalData::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
$arrival = $this->faker->optional()->dateTimeThisMonth('2 weeks');

View File

@ -10,9 +10,6 @@ class SettingsFactory extends Factory
/** @var string */
protected $model = Settings::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -11,9 +11,6 @@ class StateFactory extends Factory
/** @var string */
protected $model = State::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
$arrival = $this->faker->optional()->dateTimeThisMonth();
@ -30,7 +27,6 @@ class StateFactory extends Factory
/**
* Indicate that the user is arrived
*
*/
public function arrived(): self
{

View File

@ -10,9 +10,6 @@ class UserFactory extends Factory
/** @var string */
protected $model = User::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -12,9 +12,6 @@ class UserAngelTypeFactory extends Factory
/** @var string */
protected $model = UserAngelType::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -11,9 +11,6 @@ class WorklogFactory extends Factory
/** @var string */
protected $model = Worklog::class; // phpcs:ignore
/**
* @return array
*/
public function definition(): array
{
return [

View File

@ -36,10 +36,6 @@ trait ChangesReferences
}
}
/**
*
* @return array
*/
protected function getReferencingTables(string $table, string $column): array
{
return $this->schema

View File

@ -186,11 +186,6 @@ function user_angeltype_confirm_controller(): array
];
}
/**
* @param User $user
* @param AngelType $angeltype
* @return void
*/
function user_angeltype_confirm_email(User $user, AngelType $angeltype): void
{
if (!$user->settings->email_shiftinfo) {
@ -216,11 +211,6 @@ function user_angeltype_confirm_email(User $user, AngelType $angeltype): void
}
}
/**
* @param User $user
* @param AngelType $angeltype
* @return void
*/
function user_angeltype_add_email(User $user, AngelType $angeltype): void
{
if (!$user->settings->email_shiftinfo || $user->id == auth()->user()->id) {

View File

@ -4,9 +4,6 @@ declare(strict_types=1);
use Engelsystem\Renderer\Twig\Extensions\Globals;
/**
* @return int
*/
function theme_id(): int
{
/** @var Globals $globals */
@ -24,9 +21,6 @@ function theme(): array
return config('themes')[$theme_id];
}
/**
* @return string
*/
function theme_type(): string
{
return theme()['type'];

View File

@ -13,26 +13,12 @@ use Symfony\Component\Mailer\Exception\TransportException;
class Shift
{
/**
* @param LoggerInterface $log
* @param EngelsystemMailer $mailer
*/
public function __construct(
protected LoggerInterface $log,
protected EngelsystemMailer $mailer
) {
}
/**
* @param User $user
* @param Carbon $start
* @param Carbon $end
* @param string $name
* @param string $title
* @param string $type
* @param Room $room
* @return void
*/
public function deletedEntryCreateWorklog(
User $user,
Carbon $start,
@ -71,16 +57,6 @@ class Shift
);
}
/**
* @param User $user
* @param Carbon $start
* @param Carbon $end
* @param string $name
* @param string $title
* @param string $type
* @param Room $room
* @return void
*/
public function deletedEntrySendEmail(
User $user,
Carbon $start,

View File

@ -511,9 +511,6 @@ function admin_shifts()
);
}
/**
* @return string
*/
function admin_shifts_history_title(): string
{
return __('Shifts history');

View File

@ -58,14 +58,6 @@ class ImportSchedule extends BaseController
/** @var GuzzleClient */
protected $guzzle;
/**
* @param Response $response
* @param SessionInterface $session
* @param GuzzleClient $guzzle
* @param XmlParser $parser
* @param DatabaseConnection $db
* @param LoggerInterface $log
*/
public function __construct(
Response $response,
SessionInterface $session,
@ -82,9 +74,6 @@ class ImportSchedule extends BaseController
$this->log = $log;
}
/**
* @return Response
*/
public function index(): Response
{
return $this->response->withView(
@ -96,11 +85,6 @@ class ImportSchedule extends BaseController
);
}
/**
* @param Request $request
*
* @return Response
*/
public function edit(Request $request): Response
{
$scheduleId = $request->getAttribute('schedule_id'); // optional
@ -116,11 +100,6 @@ class ImportSchedule extends BaseController
);
}
/**
* @param Request $request
*
* @return Response
*/
public function save(Request $request): Response
{
$scheduleId = $request->getAttribute('schedule_id'); // optional
@ -164,10 +143,6 @@ class ImportSchedule extends BaseController
return redirect('/admin/schedule/load/' . $schedule->id);
}
/**
* @param Request $request
* @return Response
*/
public function loadSchedule(Request $request): Response
{
try {
@ -213,11 +188,6 @@ class ImportSchedule extends BaseController
);
}
/**
* @param Request $request
*
* @return Response
*/
public function importSchedule(Request $request): Response
{
try {
@ -282,9 +252,6 @@ class ImportSchedule extends BaseController
->with('messages', ['schedule.import.success']);
}
/**
* @param Room $room
*/
protected function createRoom(Room $room): void
{
$roomModel = new RoomModel();
@ -294,9 +261,6 @@ class ImportSchedule extends BaseController
$this->log('Created schedule room "{room}"', ['room' => $room->getName()]);
}
/**
* @param Event $event
*/
protected function fireDeleteShiftEntryEvents(Event $event): void
{
$shiftEntries = $this->db
@ -327,12 +291,6 @@ class ImportSchedule extends BaseController
}
}
/**
* @param Event $shift
* @param int $shiftTypeId
* @param RoomModel $room
* @param ScheduleUrl $scheduleUrl
*/
protected function createEvent(Event $shift, int $shiftTypeId, RoomModel $room, ScheduleUrl $scheduleUrl): void
{
$user = auth()->user();
@ -372,11 +330,6 @@ class ImportSchedule extends BaseController
);
}
/**
* @param Event $shift
* @param int $shiftTypeId
* @param RoomModel $room
*/
protected function updateEvent(Event $shift, int $shiftTypeId, RoomModel $room): void
{
$user = auth()->user();
@ -410,9 +363,6 @@ class ImportSchedule extends BaseController
);
}
/**
* @param Event $shift
*/
protected function deleteEvent(Event $shift): void
{
$this->db
@ -557,10 +507,6 @@ class ImportSchedule extends BaseController
return [$newEvents, $changeEvents, $deleteEvents];
}
/**
* @param ScheduleShift $scheduleShift
* @return Event
*/
protected function eventFromScheduleShift(ScheduleShift $scheduleShift): Event
{
$shift = $this->loadShift($scheduleShift->shift_id);

View File

@ -21,14 +21,11 @@ class Application extends Container
/**
* Registered service providers
*
* @var array
*/
protected array $serviceProviders = [];
/**
* Application constructor.
*
*/
public function __construct(string $appPath = null)
{

View File

@ -8,8 +8,6 @@ class Config extends Fluent
{
/**
* The config values
*
* @var array
*/
protected $attributes = []; // phpcs:ignore

View File

@ -10,7 +10,6 @@ use Illuminate\Database\QueryException;
class ConfigServiceProvider extends ServiceProvider
{
/** @var array */
protected array $configFiles = ['app.php', 'config.default.php', 'config.php'];
public function __construct(Application $app, protected ?EventConfig $eventConfig = null)
@ -74,7 +73,6 @@ class ConfigServiceProvider extends ServiceProvider
/**
* Get the config path
*
*/
protected function getConfigPath(string $path = ''): string
{

View File

@ -8,7 +8,6 @@ abstract class ServiceProvider
{
/**
* ServiceProvider constructor.
*
*/
public function __construct(protected Application $app)
{

View File

@ -16,7 +16,7 @@ class FaqController extends BaseController
protected Redirector $redirect;
/** @var array */
/** @var array<string> */
protected array $permissions = [
'faq.view',
'faq.edit',

View File

@ -9,7 +9,7 @@ use Engelsystem\Models\LogEntry;
class LogsController extends BaseController
{
/** @var array */
/** @var array<string> */
protected array $permissions = [
'admin_log',
];

View File

@ -17,7 +17,7 @@ class NewsController extends BaseController
protected Redirector $redirect;
/** @var array */
/** @var array<string> */
protected array $permissions = [
'admin_news',
];

View File

@ -18,7 +18,7 @@ class QuestionsController extends BaseController
protected Redirector $redirect;
/** @var array */
/** @var array<string> */
protected array $permissions = [
'question.add',
'question.edit',

View File

@ -18,7 +18,7 @@ class UserShirtController extends BaseController
protected Redirector $redirect;
/** @var array */
/** @var array<string, string> */
protected array $permissions = [
'editShirt' => 'user.edit.shirt',
'saveShirt' => 'user.edit.shirt',

View File

@ -21,7 +21,7 @@ class UserWorkLogController extends BaseController
protected Redirector $redirect;
/** @var array */
/** @var array<string> */
protected array $permissions = [
'admin_user_worklog',
];

View File

@ -15,7 +15,7 @@ class AuthController extends BaseController
{
use HasUserNotifications;
/** @var array */
/** @var array<string, string> */
protected array $permissions = [
'login' => 'login',
'postLogin' => 'login',
@ -45,7 +45,6 @@ class AuthController extends BaseController
/**
* Posted login form
*
*/
public function postLogin(Request $request): Response
{

View File

@ -17,7 +17,6 @@ class DesignController extends BaseController
/**
* Show the design overview page
*
*/
public function index(): Response
{

View File

@ -15,9 +15,6 @@ trait HasUserNotifications
);
}
/**
* @return array
*/
protected function getNotifications(): array
{
$return = [];

View File

@ -203,7 +203,6 @@ class Controller extends BaseController
/**
* Ensure that the if the request is authorized
*
*/
protected function checkAuth(bool $isJson = false): void
{
@ -225,8 +224,6 @@ class Controller extends BaseController
/**
* Formats the stats collection as stats data
*
* @return array
*/
protected function formatStats(Collection $data, string $config, string $dataField, ?string $label = null): array
{

View File

@ -58,8 +58,6 @@ class MetricsEngine implements EngineInterface
}
/**
* @param array $row
*
* @return array[]
*/
protected function formatHistogram(array $row, string $name): array
@ -89,8 +87,6 @@ class MetricsEngine implements EngineInterface
/**
* Expand the value to be an array
*
* @return array
*/
protected function expandData(mixed $data): array
{
@ -131,11 +127,6 @@ class MetricsEngine implements EngineInterface
);
}
/**
* @param array $labels
*
* @return mixed
*/
protected function renderLabels(array $labels): string
{
if (empty($labels)) {

View File

@ -72,7 +72,6 @@ class Stats
/**
* The number of not arrived users
*
*/
public function newUsers(): int
{
@ -142,11 +141,6 @@ class Stats
return (int)$this->vouchersQuery()->sum('got_voucher');
}
/**
* @param array $buckets
*
* @return array
*/
public function vouchersBuckets(array $buckets): array
{
$return = [];
@ -255,11 +249,9 @@ class Stats
/**
* The number of worked shifts
*
* @param array $buckets
* @param bool|null $done
* @param bool|null $freeloaded
*
* @return array
* @codeCoverageIgnore
*/
public function workBuckets(array $buckets, bool $done = null, bool $freeloaded = null): array
@ -274,9 +266,6 @@ class Stats
}
/**
* @param array $buckets
*
* @return array
* @codeCoverageIgnore As long as its only used for old tables
*/
protected function getBuckets(
@ -312,9 +301,6 @@ class Stats
}
/**
* @param array $buckets
*
* @return array
* @codeCoverageIgnore
*/
public function worklogBuckets(array $buckets): array

View File

@ -18,7 +18,7 @@ class NewsController extends BaseController
protected Redirector $redirect;
/** @var array */
/** @var array<string, string> */
protected array $permissions = [
'news',
'meetings' => 'user_meetings',
@ -153,9 +153,6 @@ class NewsController extends BaseController
);
}
/**
* @param array $data
*/
protected function renderView(string $page, array $data): Response
{
$data += $this->getNotifications();

View File

@ -281,10 +281,6 @@ class OAuthController extends BaseController
throw new HttpNotFound('oauth.provider-error');
}
/**
* @param array $config
*
*/
protected function redirectRegister(
string $providerName,
string $providerUserIdentifier,

View File

@ -15,7 +15,7 @@ class PasswordResetController extends BaseController
{
use HasUserNotifications;
/** @var array */
/** @var array<string, string> */
protected array $permissions = [
'reset' => 'login',
'postReset' => 'login',
@ -97,9 +97,6 @@ class PasswordResetController extends BaseController
return $this->showView('pages/password/reset-success', ['type' => 'reset']);
}
/**
* @param array $data
*/
protected function showView(string $view = 'pages/password/reset', array $data = []): Response
{
return $this->response->withView(

View File

@ -229,9 +229,6 @@ class SettingsController extends BaseController
);
}
/**
* @return array
*/
public function settingsMenu(): array
{
$menu = [

View File

@ -14,7 +14,6 @@ class Database
/**
* Run a select query
*
* @param array $bindings
* @return object[]
*/
public function select(string $query, array $bindings = []): array
@ -24,8 +23,6 @@ class Database
/**
* Run a select query and return only the first result or null if no result is found.
*
* @param array $bindings
*/
public function selectOne(string $query, array $bindings = []): ?object
{
@ -34,8 +31,6 @@ class Database
/**
* Run an insert query
*
* @param array $bindings
*/
public function insert(string $query, array $bindings = []): bool
{
@ -44,8 +39,6 @@ class Database
/**
* Run an update query
*
* @param array $bindings
*/
public function update(string $query, array $bindings = []): int
{
@ -54,8 +47,6 @@ class Database
/**
* Run a delete query
*
* @param array $bindings
*/
public function delete(string $query, array $bindings = []): int
{
@ -64,7 +55,6 @@ class Database
/**
* Get the PDO instance
*
*/
public function getPdo(): PDO
{

View File

@ -13,7 +13,6 @@ class Db
/**
* Set the database connection manager
*
*/
public static function setDbManager(CapsuleManager $dbManager): void
{
@ -23,7 +22,6 @@ class Db
/**
* Run a select query
*
* @param array $bindings
* @return array[]
*/
public static function select(string $query, array $bindings = []): array
@ -41,7 +39,6 @@ class Db
/**
* Run a select query and return only the first result or null if no result is found.
*
* @param array $bindings
* @return array|null
*/
public static function selectOne(string $query, array $bindings = []): ?array
@ -59,8 +56,6 @@ class Db
/**
* Run an insert query
*
* @param array $bindings
*/
public static function insert(string $query, array $bindings = []): bool
{
@ -69,8 +64,6 @@ class Db
/**
* Run an update query
*
* @param array $bindings
*/
public static function update(string $query, array $bindings = []): int
{
@ -79,8 +72,6 @@ class Db
/**
* Run a delete query
*
* @param array $bindings
*/
public static function delete(string $query, array $bindings = []): int
{
@ -94,7 +85,6 @@ class Db
/**
* Get the PDO instance
*
*/
public static function getPdo(): PDO
{

View File

@ -26,7 +26,6 @@ class Migrate
/**
* Migrate constructor
*
*/
public function __construct(protected SchemaBuilder $schema, protected Application $app)
{
@ -107,7 +106,6 @@ class Migrate
/**
* Merge file migrations with already migrated tables
*
*/
protected function mergeMigrations(Collection $migrations, Collection $migrated): Collection
{
@ -136,7 +134,6 @@ class Migrate
/**
* Get all migrated migrations
*
*/
protected function getMigrated(): Collection
{
@ -216,8 +213,6 @@ class Migrate
/**
* Get a list of migration files
*
*
*/
protected function getMigrations(string $dir): Collection
{
@ -239,9 +234,6 @@ class Migrate
/**
* List all migration files from the given directory
*
*
* @return array
*/
protected function getMigrationFiles(string $dir): array
{
@ -250,7 +242,6 @@ class Migrate
/**
* Init a table query
*
*/
protected function getTableQuery(): Builder
{
@ -259,7 +250,6 @@ class Migrate
/**
* Set the output function
*
*/
public function setOutput(callable $output): void
{

View File

@ -10,7 +10,6 @@ abstract class Migration
/**
* Migration constructor.
*
*/
public function __construct(SchemaBuilder $schemaBuilder)
{

View File

@ -29,7 +29,6 @@ class EventDispatcher
/**
* @param bool $halt Stop on first non-null return
*
*/
public function dispatch(string|object $event, mixed $payload = [], bool $halt = false): mixed
{

View File

@ -12,7 +12,6 @@ use Psr\Log\LoggerInterface;
class OAuth2
{
/** @var array */
protected array $config;
public function __construct(Config $config, protected LoggerInterface $log, protected Authenticator $auth)

View File

@ -32,10 +32,6 @@ class LegacyDevelopment extends Legacy
echo '</pre>';
}
/**
* @param array $stackTrace
* @return array
*/
protected function formatStackTrace(array $stackTrace): array
{
$return = [];

View File

@ -17,7 +17,6 @@ class Whoops extends Legacy implements HandlerInterface
/**
* Whoops constructor.
*
*/
public function __construct(Container $app)
{
@ -71,8 +70,6 @@ class Whoops extends Legacy implements HandlerInterface
/**
* Aggregate application data
*
* @return array
*/
protected function getData(): array
{

View File

@ -31,7 +31,6 @@ class Authenticator
/**
* Load the user from session
*
*/
public function user(): ?User
{
@ -58,7 +57,6 @@ class Authenticator
/**
* Get the user by his api key
*
*/
public function apiUser(string $parameter = 'api_key'): ?User
{

View File

@ -10,7 +10,6 @@ class Conference
/**
* Event constructor.
*
*/
public function __construct(
protected string $title,

View File

@ -14,8 +14,6 @@ class Event
protected Carbon $endDate;
/**
* Event constructor.
*
* @param string $guid globally unique
* @param int $id globally unique
* @param string $start time (hh:mm:ss || hh:mm)
@ -153,17 +151,11 @@ class Event
return $this->recording;
}
/**
* @return array
*/
public function getLinks(): array
{
return $this->links;
}
/**
* @return array
*/
public function getAttachments(): array
{
return $this->attachments;

View File

@ -76,7 +76,6 @@ class XmlParser
/**
* @param SimpleXMLElement[] $eventElements
* @return array
*/
protected function parseEvents(array $eventElements, Room $room): array
{
@ -130,8 +129,6 @@ class XmlParser
/**
* Resolves a list from a sequence of elements
*
* @return array
*/
protected function getListFromSequence(
SimpleXMLElement $element,

View File

@ -9,7 +9,6 @@ class Shifts
{
/**
* Check if a time range is a night shift
*
*/
public static function isNightShift(Carbon $start, Carbon $end): bool
{
@ -23,7 +22,6 @@ class Shifts
/**
* Calculate a shifts night multiplier
*
*/
public static function getNightShiftMultiplier(Carbon $start, Carbon $end): float
{

View File

@ -32,8 +32,6 @@ class Translator
/**
* Get the translation for a given key
*
* @param array $replace
*/
public function translate(string $key, array $replace = []): string
{
@ -42,18 +40,12 @@ class Translator
/**
* Get the translation for a given key
*
* @param array $replace
*/
public function translatePlural(string $key, string $pluralKey, int $number, array $replace = []): string
{
return $this->translateText('ngettext', [$key, $pluralKey, $number], $replace);
}
/**
* @param array $parameters
* @param array $replace
*/
protected function translateText(string $type, array $parameters, array $replace = []): mixed
{
$translated = $parameters[0];
@ -74,8 +66,6 @@ class Translator
/**
* Replace placeholders
*
* @param array $replace
*/
protected function replaceText(string $key, array $replace = []): mixed
{

View File

@ -7,7 +7,6 @@ use Throwable;
class HttpAuthExpired extends HttpException
{
/**
* @param array $headers
* @param Throwable|null $previous
*/
public function __construct(

View File

@ -8,7 +8,6 @@ use Throwable;
class HttpException extends RuntimeException
{
/**
* @param array $headers
* @param Throwable|null $previous
*/
public function __construct(
@ -22,9 +21,6 @@ class HttpException extends RuntimeException
parent::__construct($message, $code, $previous);
}
/**
* @return array
*/
public function getHeaders(): array
{
return $this->headers;

View File

@ -7,7 +7,6 @@ use Throwable;
class HttpForbidden extends HttpException
{
/**
* @param array $headers
* @param Throwable|null $previous
*/
public function __construct(

View File

@ -7,7 +7,6 @@ use Throwable;
class HttpNotFound extends HttpException
{
/**
* @param array $headers
* @param Throwable|null $previous
*/
public function __construct(

View File

@ -4,9 +4,6 @@ namespace Engelsystem\Http\Exceptions;
class HttpPermanentRedirect extends HttpRedirect
{
/**
* @param array $headers
*/
public function __construct(
string $url,
array $headers = []

View File

@ -4,9 +4,6 @@ namespace Engelsystem\Http\Exceptions;
class HttpRedirect extends HttpException
{
/**
* @param array $headers
*/
public function __construct(
string $url,
int $statusCode = 302,

View File

@ -4,9 +4,6 @@ namespace Engelsystem\Http\Exceptions;
class HttpTemporaryRedirect extends HttpRedirect
{
/**
* @param array $headers
*/
public function __construct(
string $url,
array $headers = []

View File

@ -13,17 +13,12 @@ class Redirector
/**
* Redirects to a path, generating a full URL
*
* @param array $headers
*/
public function to(string $path, int $status = 302, array $headers = []): Response
{
return $this->response->redirectTo($this->url->to($path), $status, $headers);
}
/**
* @param array $headers
*/
public function back(int $status = 302, array $headers = []): Response
{
return $this->to($this->getPreviousUrl(), $status, $headers);

View File

@ -15,7 +15,6 @@ class Request extends SymfonyRequest implements ServerRequestInterface
/**
* Get POST input
*
*/
public function postData(string $key, mixed $default = null): mixed
{
@ -24,7 +23,6 @@ class Request extends SymfonyRequest implements ServerRequestInterface
/**
* Get input data
*
*/
public function input(string $key, mixed $default = null): mixed
{
@ -33,7 +31,6 @@ class Request extends SymfonyRequest implements ServerRequestInterface
/**
* Checks if the input exists
*
*/
public function has(string $key): bool
{
@ -44,7 +41,6 @@ class Request extends SymfonyRequest implements ServerRequestInterface
/**
* Checks if the POST data exists
*
*/
public function hasPostData(string $key): bool
{
@ -55,7 +51,6 @@ class Request extends SymfonyRequest implements ServerRequestInterface
/**
* Get the requested path
*
*/
public function path(): string
{
@ -66,7 +61,6 @@ class Request extends SymfonyRequest implements ServerRequestInterface
/**
* Return the current URL
*
*/
public function url(): string
{
@ -87,7 +81,6 @@ class Request extends SymfonyRequest implements ServerRequestInterface
*
* If no URI is available, and no request-target has been specifically
* provided, this method MUST return the string "/".
*
*/
public function getRequestTarget(): string
{
@ -185,8 +178,6 @@ class Request extends SymfonyRequest implements ServerRequestInterface
* Retrieves data related to the incoming request environment,
* typically derived from PHP's $_SERVER superglobal. The data IS NOT
* REQUIRED to originate from $_SERVER.
*
* @return array
*/
public function getServerParams(): array
{
@ -200,8 +191,6 @@ class Request extends SymfonyRequest implements ServerRequestInterface
*
* The data MUST be compatible with the structure of the $_COOKIE
* superglobal.
*
* @return array
*/
public function getCookieParams(): array
{
@ -243,8 +232,6 @@ class Request extends SymfonyRequest implements ServerRequestInterface
* params. If you need to ensure you are only getting the original
* values, you may need to parse the query string from `getUri()->getQuery()`
* or from the `QUERY_STRING` server param.
*
* @return array
*/
public function getQueryParams(): array
{

View File

@ -9,7 +9,6 @@ use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
class RequestServiceProvider extends ServiceProvider
{
/** @var array */
protected array $appUrl;
public function register(): void
@ -79,8 +78,6 @@ class RequestServiceProvider extends ServiceProvider
* Set the trusted Proxies
*
* Required for unit tests (static methods can't be mocked)
*
* @param array $proxies
* @codeCoverageIgnore
*/
protected function setTrustedProxies(

View File

@ -92,7 +92,6 @@ 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 array $data
* @param string[]|string[][] $headers
*/
public function withView(string $view, array $data = [], int $status = 200, array $headers = []): Response
@ -117,8 +116,6 @@ 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 array $headers
*/
public function redirectTo(string $path, int $status = 302, array $headers = []): Response
{
@ -134,7 +131,6 @@ class Response extends SymfonyResponse implements ResponseInterface
/**
* Set the renderer to use
*
*/
public function setRenderer(Renderer $renderer): void
{
@ -143,7 +139,6 @@ class Response extends SymfonyResponse implements ResponseInterface
/**
* Sets a session attribute (which is mutable)
*
*/
public function with(string $key, mixed $value): Response
{
@ -163,8 +158,6 @@ class Response extends SymfonyResponse implements ResponseInterface
/**
* Sets form data to the mutable session
*
* @param array $input
*/
public function withInput(array $input): Response
{

View File

@ -38,7 +38,6 @@ class SessionServiceProvider extends ServiceProvider
/**
* Returns the session storage
*
*/
protected function getSessionStorage(): SessionStorageInterface
{
@ -69,7 +68,6 @@ class SessionServiceProvider extends ServiceProvider
/**
* Test if is called from cli
*
*/
protected function isCli(): bool
{

View File

@ -12,7 +12,6 @@ class UrlGenerator implements UrlGeneratorInterface
/**
* Create a URL for the given path, using the applications base url if configured
*
* @param array $parameters
* @return string url in the form [app url]/[path]?[parameters]
*/
public function to(string $path, array $parameters = []): string
@ -33,7 +32,6 @@ class UrlGenerator implements UrlGeneratorInterface
/**
* Check if the URL is valid
*
*/
public function isValidUrl(string $path): bool
{

View File

@ -7,8 +7,5 @@ namespace Engelsystem\Http;
*/
interface UrlGeneratorInterface
{
/**
* @param array $parameters
*/
public function to(string $path, array $parameters = []): string;
}

View File

@ -10,7 +10,6 @@ trait StringInputLength
{
/**
* Use the input length of a string
*
*/
public function validate(mixed $input): bool
{

View File

@ -9,10 +9,6 @@ trait ValidatesRequest
{
protected Validator $validator;
/**
* @param array $rules
* @return array
*/
protected function validate(Request $request, array $rules): array
{
$isValid = $this->validator->validate(

View File

@ -12,10 +12,8 @@ class Validator
/** @var string[] */
protected array $errors = [];
/** @var array */
protected array $data = [];
/** @var array */
protected array $mapping = [
'accepted' => 'TrueVal',
'int' => 'IntVal',
@ -23,13 +21,8 @@ class Validator
'required' => 'NotEmpty',
];
/** @var array */
protected array $nestedRules = ['optional', 'not'];
/**
* @param array $data
* @param array $rules
*/
public function validate(array $data, array $rules): bool
{
$this->errors = [];
@ -96,9 +89,6 @@ class Validator
return $mapping[$rule] ?? $rule;
}
/**
* @return array
*/
public function getData(): array
{
return $this->data;

View File

@ -29,9 +29,6 @@ class Logger extends AbstractLogger
/**
* Logs with an arbitrary level.
*
* @param array $context
*
*/
public function log(mixed $level, string|Stringable $message, array $context = []): void
{
@ -50,8 +47,6 @@ class Logger extends AbstractLogger
/**
* Interpolates context values into the message placeholders.
*
* @param array $context
*/
protected function interpolate(string $message, array $context = []): string
{

View File

@ -12,9 +12,6 @@ class UserAwareLogger extends Logger
/**
* Logs with an arbitrary level and prepends the user
*
* @param array $context
*
* @throws InvalidArgumentException
*/
public function log(mixed $level, string|Stringable $message, array $context = []): void

View File

@ -29,7 +29,6 @@ class EngelsystemMailer extends Mailer
/**
* @param string|string[]|User $to
* @param array $data
*/
public function sendViewTranslated(
string|array|User $to,
@ -65,7 +64,6 @@ class EngelsystemMailer extends Mailer
* Send a template
*
* @param string|string[] $to
* @param array $data
*/
public function sendView(string|array $to, string $subject, string $template, array $data = []): void
{

View File

@ -44,9 +44,6 @@ class MailerServiceProvider extends ServiceProvider
$this->app->instance('mailer', $mailer);
}
/**
* @param array $config
*/
protected function getTransport(?string $transport, array $config): TransportInterface
{
switch ($transport) {
@ -62,9 +59,6 @@ class MailerServiceProvider extends ServiceProvider
}
}
/**
* @param array $config
*/
protected function getSmtpTransport(array $config): SmtpTransport
{
/** @var EsmtpTransport $transport */

View File

@ -16,7 +16,6 @@ class LogTransport extends AbstractTransport
/**
* Send the message to log
*
*/
protected function doSend(SentMessage $message): void
{

View File

@ -16,7 +16,6 @@ class AddHeaders implements MiddlewareInterface
/**
* Process an incoming server request and setting the locale if required
*
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{

View File

@ -29,7 +29,6 @@ class CallableHandler implements MiddlewareInterface, RequestHandlerInterface
/**
* Process an incoming server request and return a response, optionally delegating
* response creation to a handler.
*
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
@ -38,7 +37,6 @@ class CallableHandler implements MiddlewareInterface, RequestHandlerInterface
/**
* Handle the request and return a response.
*
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
@ -47,8 +45,6 @@ class CallableHandler implements MiddlewareInterface, RequestHandlerInterface
/**
* Execute the callable and return a response
*
* @param array $arguments
*/
protected function execute(array $arguments = []): ResponseInterface
{

View File

@ -28,7 +28,6 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface
* response creation to a handler.
*
* Could be used to group middleware
*
*/
public function process(
ServerRequestInterface $request,
@ -43,7 +42,6 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface
* Handle the request and return a response.
*
* It calls all configured middleware and handles their response
*
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{

View File

@ -21,7 +21,7 @@ class ErrorHandler implements MiddlewareInterface
/**
* A list of inputs that are not saved from form input
*
* @var array
* @var array<string>
*/
protected array $formIgnore = [
'password',
@ -42,7 +42,6 @@ class ErrorHandler implements MiddlewareInterface
* Handles any error messages
*
* Should be added at the beginning
*
*/
public function process(
ServerRequestInterface $request,
@ -93,7 +92,6 @@ class ErrorHandler implements MiddlewareInterface
/**
* Select a view based on the given status code
*
*/
protected function selectView(int $statusCode): string
{
@ -112,7 +110,6 @@ class ErrorHandler implements MiddlewareInterface
/**
* Create a new response
*
* @param array $headers
* @codeCoverageIgnore
*/
protected function createResponse(string $content = '', int $status = 200, array $headers = []): ResponseInterface
@ -122,7 +119,6 @@ class ErrorHandler implements MiddlewareInterface
/**
* Create a redirect back response
*
*/
protected function redirectBack(): Response
{

View File

@ -20,7 +20,6 @@ class ExceptionHandler implements MiddlewareInterface
* Handles any exceptions that occurred inside other middleware while returning it to the default response handler
*
* Should be added at the beginning
*
*/
public function process(
ServerRequestInterface $request,

View File

@ -37,7 +37,6 @@ class LegacyMiddleware implements MiddlewareInterface
* Handle the request the old way
*
* Should be used before a 404 is send
*
*/
public function process(
ServerRequestInterface $request,

View File

@ -23,7 +23,6 @@ class RequestHandler implements MiddlewareInterface
/**
* Process an incoming server request and return a response, optionally delegating
* response creation to a handler.
*
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
@ -52,7 +51,6 @@ class RequestHandler implements MiddlewareInterface
/**
* Resolve the given class
*
*/
protected function resolveRequestHandler(
string|callable|MiddlewareInterface|RequestHandlerInterface $handler
@ -82,7 +80,6 @@ class RequestHandler implements MiddlewareInterface
/**
* Check required page permissions
*
*/
protected function checkPermissions(BaseController $controller, string $method): bool
{

View File

@ -11,7 +11,6 @@ trait ResolvesMiddlewareTrait
{
/**
* Resolve the middleware with the container
*
*/
protected function resolveMiddleware(
string|callable|MiddlewareInterface|RequestHandlerInterface $middleware
@ -44,7 +43,6 @@ trait ResolvesMiddlewareTrait
/**
* Checks if the given object is a middleware or middleware or request handler
*
*/
protected function isMiddleware(mixed $middleware): bool
{

View File

@ -29,7 +29,6 @@ class RouteDispatcher implements MiddlewareInterface
/**
* Process an incoming server request and return a response, optionally delegating
* response creation to a handler.
*
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{

View File

@ -43,7 +43,6 @@ class RouteDispatcherServiceProvider extends ServiceProvider
/**
* Includes the routes.php file
*
* @param array $options
* @codeCoverageIgnore
*/
protected function generateRouting(array $options = []): FastRouteDispatcher

View File

@ -13,7 +13,6 @@ class SendResponseHandler implements MiddlewareInterface
* Send the server response to the client
*
* This should be the first middleware
*
*/
public function process(
ServerRequestInterface $request,

View File

@ -11,9 +11,6 @@ use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface;
class SessionHandler implements MiddlewareInterface
{
/**
* @param array $paths
*/
public function __construct(protected SessionStorageInterface $session, protected array $paths = [])
{
}

View File

@ -21,7 +21,6 @@ class SetLocale implements MiddlewareInterface
/**
* Process an incoming server request and setting the locale if required
*
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{

View File

@ -17,7 +17,6 @@ class VerifyCsrfToken implements MiddlewareInterface
/**
* Verify csrf tokens
*
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{

View File

@ -44,7 +44,6 @@ class EventConfig extends BaseModel
/**
* Value accessor
*
*/
public function getValueAttribute(mixed $value): mixed
{
@ -91,7 +90,6 @@ class EventConfig extends BaseModel
/**
* Check if the value has to be casted
*
*/
protected function getValueCast(string $value): ?string
{

View File

@ -29,8 +29,6 @@ class LogEntry extends BaseModel
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [ // phpcs:ignore
'level',

View File

@ -64,7 +64,6 @@ class License extends HasUserModel
/**
* If the user wants to drive at the event
*
*/
public function wantsToDrive(): bool
{

Some files were not shown because too many files have changed in this diff Show More