From 6ce97136e7d387343374b2fdc333181a0d58a0ed Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Sat, 3 Jan 2026 17:20:18 +0100 Subject: [PATCH 1/4] cs-fixer --- .php-cs-fixer.dist.php | 55 ++++++++++++++++++- lib/GaletteEvents/Activity.php | 24 -------- lib/GaletteEvents/Booking.php | 46 ---------------- .../Controllers/Crud/ActivitiesController.php | 20 ------- .../Controllers/Crud/BookingsController.php | 26 --------- .../Controllers/Crud/EventsController.php | 25 --------- .../Controllers/CsvController.php | 2 - lib/GaletteEvents/Event.php | 54 ------------------ lib/GaletteEvents/Filters/ActivitiesList.php | 6 -- lib/GaletteEvents/Filters/BookingsList.php | 16 ++---- lib/GaletteEvents/Filters/EventsList.php | 10 +--- lib/GaletteEvents/PluginGaletteEvents.php | 4 -- lib/GaletteEvents/Repository/Activities.php | 6 -- lib/GaletteEvents/Repository/Bookings.php | 12 ---- lib/GaletteEvents/Repository/Events.php | 6 -- tests/GaletteEvents/tests/units/Activity.php | 10 +--- 16 files changed, 59 insertions(+), 263 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 3fba081..bc03d75 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -13,11 +13,60 @@ ->setRules([ '@PSR12' => true, '@PER-CS' => true, - '@PHP82Migration' => true, + '@PHP8x2Migration' => true, 'trailing_comma_in_multiline' => false, - 'cast_spaces' => false, + 'cast_spaces' => ['space' => 'none'], 'single_line_empty_body' => false, - 'no_unused_imports' => true + 'no_unused_imports' => true, + // rules for phpdoc + // Removes @param, @return and @var tags that don't provide any useful information - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:no_superfluous_phpdoc_tags + 'no_superfluous_phpdoc_tags' => [ + 'allow_mixed' => true, + 'remove_inheritdoc' => true, + ], + // require phpdoc for non typed arguments - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_add_missing_param_annotation + 'phpdoc_add_missing_param_annotation' => true, + // no @access - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_no_access + 'phpdoc_no_access' => true, + // no @package - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_no_package + 'phpdoc_no_package' => true, + // order phpdoc tags - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_order + 'phpdoc_order' => ['order' => ['since', 'var', 'see', 'param', 'return', 'throw', 'todo', 'deprecated']], + // phpdoc param in same order as signature - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_param_order + 'phpdoc_param_order' => true, + // align tags - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_align + 'phpdoc_align' => [ + 'align' => 'vertical', + 'tags' => [ + 'param', + 'property', + 'property-read', + 'property-write', + 'phpstan-param', + 'phpstan-property', + 'phpstan-property-read', + 'phpstan-property-write', + 'phpstan-assert', + 'phpstan-assert-if-true', + 'phpstan-assert-if-false', + 'psalm-param', + 'psalm-param-out', + 'psalm-property', + 'psalm-property-read', + 'psalm-property-write', + 'psalm-assert', + 'psalm-assert-if-true', + 'psalm-assert-if-false' + ], + ], + // Check types case - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_types + 'phpdoc_types' => true, + // Use native scalar types - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_scalar + 'phpdoc_scalar' => true, + // remove extra empty lines - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_trim + 'phpdoc_trim' => true, + // remove empty lines inside phpdoc block - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_trim_consecutive_blank_line_separation + 'phpdoc_trim_consecutive_blank_line_separation' => true, ]) ->setFinder($finder) ; diff --git a/lib/GaletteEvents/Activity.php b/lib/GaletteEvents/Activity.php index 30a9dd0..f0f5ba9 100644 --- a/lib/GaletteEvents/Activity.php +++ b/lib/GaletteEvents/Activity.php @@ -108,8 +108,6 @@ public function load(int $id): bool * Populate object from a resultset row * * @param ArrayObject $r the resultset row - * - * @return void */ private function loadFromRS(ArrayObject $r): void { @@ -122,8 +120,6 @@ private function loadFromRS(ArrayObject $r): void /** * Remove specified event - * - * @return bool */ public function remove(): bool { @@ -163,8 +159,6 @@ public function remove(): bool * * @param array $values All values to check, basically the $_POST array * after sending the form - * - * @return bool */ public function check(array $values): bool { @@ -204,8 +198,6 @@ public function check(array $values): bool /** * Store the activity - * - * @return bool */ public function store(): bool { @@ -281,8 +273,6 @@ public function store(): bool /** * Get event id - * - * @return ?int */ public function getId(): ?int { @@ -291,8 +281,6 @@ public function getId(): ?int /** * Get event name - * - * @return string */ public function getName(): string { @@ -304,8 +292,6 @@ public function getName(): string * * @param string $prop Property to use * @param bool $formatted Return date formatted, raw if false - * - * @return string */ private function getDate(string $prop, bool $formatted = true): string { @@ -325,8 +311,6 @@ private function getDate(string $prop, bool $formatted = true): string * Get creation date * * @param bool $formatted Return date formatted, raw if false - * - * @return string */ public function getCreationDate(bool $formatted = true): string { @@ -335,8 +319,6 @@ public function getCreationDate(bool $formatted = true): string /** * Is actvity active? - * - * @return bool */ public function isActive(): bool { @@ -345,8 +327,6 @@ public function isActive(): bool /** * Get table's name - * - * @return string */ protected function getTableName(): string { @@ -355,8 +335,6 @@ protected function getTableName(): string /** * Get comment - * - * @return string */ public function getComment(): string { @@ -365,8 +343,6 @@ public function getComment(): string /** * Count number of events using this Activity - * - * @return int */ public function countEvents(): int { diff --git a/lib/GaletteEvents/Booking.php b/lib/GaletteEvents/Booking.php index 7d49066..7103d8b 100644 --- a/lib/GaletteEvents/Booking.php +++ b/lib/GaletteEvents/Booking.php @@ -119,8 +119,6 @@ public function load(int $id): bool * Populate object from a resultset row * * @param ArrayObject $r the resultset row - * - * @return void */ private function loadFromRS(ArrayObject $r): void { @@ -139,8 +137,6 @@ private function loadFromRS(ArrayObject $r): void /** * Remove specified event - * - * @return bool */ public function remove(): bool { @@ -351,8 +347,6 @@ public function check(array $values): array|bool /** * Store the booking - * - * @return bool */ public function store(): bool { @@ -548,8 +542,6 @@ public function store(): bool /** * Get event id - * - * @return ?int */ public function getId(): ?int { @@ -558,8 +550,6 @@ public function getId(): ?int /** * Get event id - * - * @return ?int */ public function getEventId(): ?int { @@ -568,8 +558,6 @@ public function getEventId(): ?int /** * Get event - * - * @return ?Event */ public function getEvent(): ?Event { @@ -581,8 +569,6 @@ public function getEvent(): ?Event /** * Get member id - * - * @return ?int */ public function getMemberId(): ?int { @@ -591,8 +577,6 @@ public function getMemberId(): ?int /** * Get member - * - * @return Adherent */ public function getMember(): Adherent { @@ -603,8 +587,6 @@ public function getMember(): Adherent * Get date * * @param bool $formatted Return date formatted, raw if false - * - * @return string */ public function getDate(bool $formatted = true): string { @@ -618,8 +600,6 @@ public function getDate(bool $formatted = true): string /** * Is booking paid? - * - * @return bool */ public function isPaid(): bool { @@ -628,8 +608,6 @@ public function isPaid(): bool /** * Get amount - * - * @return ?float */ public function getAmount(): ?float { @@ -638,8 +616,6 @@ public function getAmount(): ?float /** * Get payment method - * - * @return int */ public function getPaymentMethod(): int { @@ -648,8 +624,6 @@ public function getPaymentMethod(): int /** * Get payment method name - * - * @return string */ public function getPaymentMethodName(): string { @@ -659,8 +633,6 @@ public function getPaymentMethodName(): string /** * Get bank name - * - * @return ?string */ public function getBankName(): ?string { @@ -669,8 +641,6 @@ public function getBankName(): ?string /** * Get check number - * - * @return ?string */ public function getCheckNumber(): ?string { @@ -679,8 +649,6 @@ public function getCheckNumber(): ?string /** * Get number of persons - * - * @return int */ public function getNumberPeople(): int { @@ -691,8 +659,6 @@ public function getNumberPeople(): int * Get creation date * * @param bool $formatted Return date formatted, raw if false - * - * @return string */ public function getCreationDate(bool $formatted = true): string { @@ -708,8 +674,6 @@ public function getCreationDate(bool $formatted = true): string * Set event * * @param int $event Event id - * - * @return self */ public function setEvent(int $event): self { @@ -721,8 +685,6 @@ public function setEvent(int $event): self * Set member * * @param int $member Member id - * - * @return self */ public function setMember(int $member): self { @@ -732,8 +694,6 @@ public function setMember(int $member): self /** * Get table's name - * - * @return string */ protected function getTableName(): string { @@ -742,8 +702,6 @@ protected function getTableName(): string /** * Get comment - * - * @return string */ public function getComment(): string { @@ -754,8 +712,6 @@ public function getComment(): string * Has Activity * * @param int $activity Activity - * - * @return bool */ public function has(int $activity): bool { @@ -764,8 +720,6 @@ public function has(int $activity): bool /** * Load linked activities - * - * @return void */ public function loadActivities(): void { diff --git a/lib/GaletteEvents/Controllers/Crud/ActivitiesController.php b/lib/GaletteEvents/Controllers/Crud/ActivitiesController.php index 4284279..8a1deed 100644 --- a/lib/GaletteEvents/Controllers/Crud/ActivitiesController.php +++ b/lib/GaletteEvents/Controllers/Crud/ActivitiesController.php @@ -52,8 +52,6 @@ class ActivitiesController extends AbstractPluginController * * @param Request $request PSR Request * @param Response $response PSR Response - * - * @return Response */ public function add(Request $request, Response $response): Response { @@ -65,8 +63,6 @@ public function add(Request $request, Response $response): Response * * @param Request $request PSR Request * @param Response $response PSR Response - * - * @return Response */ public function doAdd(Request $request, Response $response): Response { @@ -83,8 +79,6 @@ public function doAdd(Request $request, Response $response): Response * @param Response $response PSR Response * @param string|null $option One of 'page' or 'order' * @param string|int|null $value Value of the option - * - * @return Response */ public function list(Request $request, Response $response, ?string $option = null, string|int|null $value = null): Response { @@ -133,8 +127,6 @@ public function list(Request $request, Response $response, ?string $option = nul * * @param Request $request PSR Request * @param Response $response PSR Response - * - * @return Response */ public function filter(Request $request, Response $response): Response { @@ -172,8 +164,6 @@ public function filter(Request $request, Response $response): Response * @param Response $response PSR Response * @param int|null $id Model id * @param string $action Action - * - * @return Response */ public function edit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response { @@ -218,8 +208,6 @@ public function edit(Request $request, Response $response, ?int $id = null, stri * @param Response $response PSR Response * @param null|int $id Model id for edit * @param string $action Either add or edit - * - * @return Response */ public function doEdit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response { @@ -305,8 +293,6 @@ public function doEdit(Request $request, Response $response, ?int $id = null, st * Get redirection URI * * @param array $args Route arguments - * - * @return string */ public function redirectUri(array $args): string { @@ -317,8 +303,6 @@ public function redirectUri(array $args): string * Get form URI * * @param array $args Route arguments - * - * @return string */ public function formUri(array $args): string { @@ -332,8 +316,6 @@ public function formUri(array $args): string * Get confirmation removal page title * * @param array $args Route arguments - * - * @return string */ public function confirmRemoveTitle(array $args): string { @@ -350,8 +332,6 @@ public function confirmRemoveTitle(array $args): string * * @param array $args Route arguments * @param array $post POST values - * - * @return bool */ protected function doDelete(array $args, array $post): bool { diff --git a/lib/GaletteEvents/Controllers/Crud/BookingsController.php b/lib/GaletteEvents/Controllers/Crud/BookingsController.php index 32c1599..8ca24ed 100644 --- a/lib/GaletteEvents/Controllers/Crud/BookingsController.php +++ b/lib/GaletteEvents/Controllers/Crud/BookingsController.php @@ -59,8 +59,6 @@ class BookingsController extends AbstractPluginController * @param Request $request PSR Request * @param Response $response PSR Response * @param int|null $id_adh Member id - * - * @return Response */ public function add(Request $request, Response $response, ?int $id_adh = null): Response { @@ -72,8 +70,6 @@ public function add(Request $request, Response $response, ?int $id_adh = null): * * @param Request $request PSR Request * @param Response $response PSR Response - * - * @return Response */ public function doAdd(Request $request, Response $response): Response { @@ -90,8 +86,6 @@ public function doAdd(Request $request, Response $response): Response * @param Response $response PSR Response * @param string|null $option One of 'page' or 'order' * @param string|int|null $value Value of the option - * - * @return Response */ public function list(Request $request, Response $response, ?string $option = null, string|int|null $value = null): Response { @@ -107,8 +101,6 @@ public function list(Request $request, Response $response, ?string $option = nul * @param string|int $event Linked event. May be an event ID, 'all' or 'guess'. * @param string|null $option One of 'page' or 'order' * @param string|int|null $value Value of the option - * - * @return Response */ public function listBookings(Request $request, Response $response, string|int $event, ?string $option = null, string|int|null $value = null): Response { @@ -180,8 +172,6 @@ public function listBookings(Request $request, Response $response, string|int $e * * @param Request $request PSR Request * @param Response $response PSR Response - * - * @return Response */ public function filter(Request $request, Response $response): Response { @@ -195,8 +185,6 @@ public function filter(Request $request, Response $response): Response * @param Request $request PSR Request * @param Response $response PSR Response * @param string|int $event Linked event. May be an event ID, 'all' or 'guess'. - * - * @return Response */ public function filterBookings(Request $request, Response $response, string|int $event): Response { @@ -257,8 +245,6 @@ public function filterBookings(Request $request, Response $response, string|int * * @param Request $request PSR Request * @param Response $response PSR Response - * - * @return Response */ public function handleBatch(Request $request, Response $response): Response { @@ -357,8 +343,6 @@ public function handleBatch(Request $request, Response $response): Response * @param int|null $id Model id * @param string $action Action * @param int|null $id_adh Member ID (for add) - * - * @return Response */ public function edit(Request $request, Response $response, ?int $id = null, string $action = 'edit', ?int $id_adh = null): Response { @@ -463,8 +447,6 @@ public function edit(Request $request, Response $response, ?int $id = null, stri * @param Response $response PSR Response * @param null|int $id Model id for edit * @param string $action Either add or edit - * - * @return Response */ public function doEdit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response { @@ -586,8 +568,6 @@ public function doEdit(Request $request, Response $response, ?int $id = null, st * Get redirection URI * * @param array $args Route arguments - * - * @return string */ public function redirectUri(array $args): string { @@ -598,8 +578,6 @@ public function redirectUri(array $args): string * Get form URI * * @param array $args Route arguments - * - * @return string */ public function formUri(array $args): string { @@ -613,8 +591,6 @@ public function formUri(array $args): string * Get confirmation removal page title * * @param array $args Route arguments - * - * @return string */ public function confirmRemoveTitle(array $args): string { @@ -634,8 +610,6 @@ public function confirmRemoveTitle(array $args): string * * @param array $args Route arguments * @param array $post POST values - * - * @return bool */ protected function doDelete(array $args, array $post): bool { diff --git a/lib/GaletteEvents/Controllers/Crud/EventsController.php b/lib/GaletteEvents/Controllers/Crud/EventsController.php index 4f1c618..893b54a 100644 --- a/lib/GaletteEvents/Controllers/Crud/EventsController.php +++ b/lib/GaletteEvents/Controllers/Crud/EventsController.php @@ -38,7 +38,6 @@ * * @category Controllers * @name EventsController - * @package GaletteEvents * @author Johan Cwiklinski * @copyright 2021-2025 The Galette Team * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version @@ -61,8 +60,6 @@ class EventsController extends AbstractPluginController * * @param Request $request PSR Request * @param Response $response PSR Response - * - * @return Response */ public function add(Request $request, Response $response): Response { @@ -74,8 +71,6 @@ public function add(Request $request, Response $response): Response * * @param Request $request PSR Request * @param Response $response PSR Response - * - * @return Response */ public function doAdd(Request $request, Response $response): Response { @@ -92,8 +87,6 @@ public function doAdd(Request $request, Response $response): Response * @param Response $response PSR Response * @param string|null $option One of 'page' or 'order' * @param string|int|null $value Value of the option - * - * @return Response */ public function list(Request $request, Response $response, ?string $option = null, string|int|null $value = null): Response { @@ -144,8 +137,6 @@ public function list(Request $request, Response $response, ?string $option = nul * @param Response $response PSR Response * @param string|null $option One of 'page' or 'order' * @param string|int|null $value Value of the option - * - * @return Response */ public function calendar( Request $request, @@ -207,8 +198,6 @@ public function calendar( * * @param Request $request PSR Request * @param Response $response PSR Response - * - * @return Response */ public function ajaxCalendar(Request $request, Response $response): Response { @@ -228,8 +217,6 @@ public function ajaxCalendar(Request $request, Response $response): Response * * @param Request $request PSR Request * @param Response $response PSR Response - * - * @return Response */ public function filter(Request $request, Response $response): Response { @@ -267,8 +254,6 @@ public function filter(Request $request, Response $response): Response * @param Response $response PSR Response * @param int|null $id Model id * @param string $action Action - * - * @return Response */ public function edit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response { @@ -335,8 +320,6 @@ public function edit(Request $request, Response $response, ?int $id = null, stri * @param Response $response PSR Response * @param null|int $id Model id for edit * @param string $action Either add or edit - * - * @return Response */ public function doEdit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response { @@ -466,8 +449,6 @@ public function doEdit(Request $request, Response $response, ?int $id = null, st * Get redirection URI * * @param array $args Route arguments - * - * @return string */ public function redirectUri(array $args): string { @@ -478,8 +459,6 @@ public function redirectUri(array $args): string * Get form URI * * @param array $args Route arguments - * - * @return string */ public function formUri(array $args): string { @@ -493,8 +472,6 @@ public function formUri(array $args): string * Get confirmation removal page title * * @param array $args Route arguments - * - * @return string */ public function confirmRemoveTitle(array $args): string { @@ -511,8 +488,6 @@ public function confirmRemoveTitle(array $args): string * * @param array $args Route arguments * @param array $post POST values - * - * @return bool */ protected function doDelete(array $args, array $post): bool { diff --git a/lib/GaletteEvents/Controllers/CsvController.php b/lib/GaletteEvents/Controllers/CsvController.php index a2512c3..16cd364 100644 --- a/lib/GaletteEvents/Controllers/CsvController.php +++ b/lib/GaletteEvents/Controllers/CsvController.php @@ -44,8 +44,6 @@ class CsvController extends \Galette\Controllers\CsvController * @param Request $request PSR Request * @param Response $response PSR Response * @param ?int $id Event ID, if any - * - * @return Response */ public function bookingsExport(Request $request, Response $response, ?int $id = null): Response { diff --git a/lib/GaletteEvents/Event.php b/lib/GaletteEvents/Event.php index b52d196..0b1f918 100644 --- a/lib/GaletteEvents/Event.php +++ b/lib/GaletteEvents/Event.php @@ -131,8 +131,6 @@ public function load(int $id): bool * Populate object from a resultset row * * @param ArrayObject $r the resultset row - * - * @return void */ private function loadFromRS(ArrayObject $r): void { @@ -153,8 +151,6 @@ private function loadFromRS(ArrayObject $r): void /** * Remove specified event - * - * @return bool */ public function remove(): bool { @@ -360,8 +356,6 @@ public function check(array $values): bool|array /** * Store the event - * - * @return bool */ public function store(): bool { @@ -534,8 +528,6 @@ public function store(): bool /** * Get event id - * - * @return ?int */ public function getId(): ?int { @@ -544,8 +536,6 @@ public function getId(): ?int /** * Get event name - * - * @return ?string */ public function getName(): ?string { @@ -554,8 +544,6 @@ public function getName(): ?string /** * Get event address - * - * @return ?string */ public function getAddress(): ?string { @@ -564,8 +552,6 @@ public function getAddress(): ?string /** * Get event zip - * - * @return ?string */ public function getZip(): ?string { @@ -574,8 +560,6 @@ public function getZip(): ?string /** * Get event town - * - * @return ?string */ public function getTown(): ?string { @@ -584,8 +568,6 @@ public function getTown(): ?string /** * Get event country - * - * @return ?string */ public function getCountry(): ?string { @@ -594,8 +576,6 @@ public function getCountry(): ?string /** * Get event group - * - * @return ?int */ public function getGroup(): ?int { @@ -604,8 +584,6 @@ public function getGroup(): ?int /** * Get group name - * - * @return string */ public function getGroupName(): string { @@ -622,8 +600,6 @@ public function getGroupName(): string * * @param string $prop Property to use * @param bool $formatted Return date formatted, raw if false - * - * @return string */ private function getDate(string $prop, bool $formatted = true): string { @@ -639,8 +615,6 @@ private function getDate(string $prop, bool $formatted = true): string * Get creation date * * @param bool $formatted Return date formatted, raw if false - * - * @return string */ public function getCreationDate(bool $formatted = true): string { @@ -651,8 +625,6 @@ public function getCreationDate(bool $formatted = true): string * Get begin date * * @param bool $formatted Return date formatted, raw if false - * - * @return string */ public function getBeginDate(bool $formatted = true): string { @@ -663,8 +635,6 @@ public function getBeginDate(bool $formatted = true): string * Get end date * * @param bool $formatted Return date formatted, raw if false - * - * @return string */ public function getEndDate(bool $formatted = true): string { @@ -675,8 +645,6 @@ public function getEndDate(bool $formatted = true): string * Is activity required * * @param int $activity Activity ID - * - * @return bool */ public function isActivityRequired(int $activity): bool { @@ -687,8 +655,6 @@ public function isActivityRequired(int $activity): bool * Does current event propose activity * * @param int $activity Activity ID - * - * @return bool */ public function hasActivity(int $activity): bool { @@ -698,8 +664,6 @@ public function hasActivity(int $activity): bool /** * Is event open? * Will return false once the begin date has been exceeded - * - * @return bool */ public function isOpen(): bool { @@ -721,8 +685,6 @@ public function isOpen(): bool * Set name * * @param string $name Event name - * - * @return void */ public function setName(string $name): void { @@ -731,8 +693,6 @@ public function setName(string $name): void /** * Get table's name - * - * @return string */ protected function getTableName(): string { @@ -761,8 +721,6 @@ public function availableActivities(): array /** * Load linked activities - * - * @return void */ public function loadActivities(): void { @@ -794,8 +752,6 @@ public function getActivities(): array /** * Get comment - * - * @return string */ public function getComment(): string { @@ -804,8 +760,6 @@ public function getComment(): string /** * Get color - * - * @return string */ public function getColor(): string { @@ -814,8 +768,6 @@ public function getColor(): string /** * Count attendees per event - * - * @return ResultSet */ public function countAttendees(): ResultSet { @@ -841,8 +793,6 @@ public function countAttendees(): ResultSet * Can member edit event * * @param Login $login Login instance - * - * @return bool */ public function canEdit(Login $login): bool { @@ -866,8 +816,6 @@ public function canEdit(Login $login): bool * Can memebr create an event * * @param Login $login Login instance - * - * @return bool */ public function canCreate(Login $login): bool { @@ -876,8 +824,6 @@ public function canCreate(Login $login): bool /** * Get foreground contrasted color for current background color - * - * @return string */ public function getForegoundColor(): string { diff --git a/lib/GaletteEvents/Filters/ActivitiesList.php b/lib/GaletteEvents/Filters/ActivitiesList.php index 9e5e77e..0be0b73 100644 --- a/lib/GaletteEvents/Filters/ActivitiesList.php +++ b/lib/GaletteEvents/Filters/ActivitiesList.php @@ -69,8 +69,6 @@ protected function getDefaultOrder(): int|string /** * Return the default direction for ordering - * - * @return SQLOrder */ protected function getDefaultDirection(): SQLOrder { @@ -79,8 +77,6 @@ protected function getDefaultDirection(): SQLOrder /** * Reinit default parameters - * - * @return void */ public function reinit(): void { @@ -120,8 +116,6 @@ public function __get(string $name): mixed * * @param string $name name of the property we want to assign a value to * @param mixed $value a relevant value for the property - * - * @return void */ public function __set(string $name, mixed $value): void { diff --git a/lib/GaletteEvents/Filters/BookingsList.php b/lib/GaletteEvents/Filters/BookingsList.php index b00b891..4306155 100644 --- a/lib/GaletteEvents/Filters/BookingsList.php +++ b/lib/GaletteEvents/Filters/BookingsList.php @@ -33,11 +33,11 @@ * * @author Johan Cwiklinski * - * @property string $query + * @property string $query * @property string|int|null $event_filter - * @property int|string $paid_filter - * @property int $payment_type_filter - * @property array $selected + * @property int|string $paid_filter + * @property int $payment_type_filter + * @property array $selected * @property string|int|null $group_filter */ @@ -82,8 +82,6 @@ protected function getDefaultOrder(): int|string /** * Return the default direction for ordering - * - * @return SQLOrder */ protected function getDefaultDirection(): SQLOrder { @@ -92,8 +90,6 @@ protected function getDefaultDirection(): SQLOrder /** * Reinit default parameters - * - * @return void */ public function reinit(): void { @@ -136,8 +132,6 @@ public function __get(string $name): mixed * * @param string $name name of the property we want to assign a value to * @param mixed $value a relevant value for the property - * - * @return void */ public function __set(string $name, mixed $value): void { @@ -176,8 +170,6 @@ public function __set(string $name, mixed $value): void * Override to add "event" parameter * * @param int $page Page - * - * @return string */ protected function getHref(int $page): string { diff --git a/lib/GaletteEvents/Filters/EventsList.php b/lib/GaletteEvents/Filters/EventsList.php index a8db834..0a08800 100644 --- a/lib/GaletteEvents/Filters/EventsList.php +++ b/lib/GaletteEvents/Filters/EventsList.php @@ -33,8 +33,8 @@ * * @author Johan Cwiklinski * - * @property string $query - * @property bool $calendar_filter + * @property string $query + * @property bool $calendar_filter * @property ?string $start_date_filter * @property ?string $raw_start_date_filter */ @@ -86,8 +86,6 @@ protected function getDefaultOrder(): int|string /** * Return the default direction for ordering - * - * @return SQLOrder */ protected function getDefaultDirection(): SQLOrder { @@ -96,8 +94,6 @@ protected function getDefaultDirection(): SQLOrder /** * Reinit default parameters - * - * @return void */ public function reinit(): void { @@ -167,8 +163,6 @@ public function __get(string $name): mixed * * @param string $name name of the property we want to assign a value to * @param mixed $value a relevant value for the property - * - * @return void */ public function __set(string $name, mixed $value): void { diff --git a/lib/GaletteEvents/PluginGaletteEvents.php b/lib/GaletteEvents/PluginGaletteEvents.php index 00a22a7..2ed572d 100644 --- a/lib/GaletteEvents/PluginGaletteEvents.php +++ b/lib/GaletteEvents/PluginGaletteEvents.php @@ -198,8 +198,6 @@ public static function getMyDashboardsContents(): array /** * Get plugin upcoming events - * - * @return ?Entry */ public function getNews(): ?Entry { @@ -229,8 +227,6 @@ public function getNews(): ?Entry /** * Is the plugin fully installed (including database, extra configuration, etc)? - * - * @return bool */ public function isInstalled(): bool { diff --git a/lib/GaletteEvents/Repository/Activities.php b/lib/GaletteEvents/Repository/Activities.php index c2fc8f1..9ece448 100644 --- a/lib/GaletteEvents/Repository/Activities.php +++ b/lib/GaletteEvents/Repository/Activities.php @@ -135,8 +135,6 @@ private function buildOrderClause(?array $fields = null): array * Count events from the query * * @param Select $select Original select - * - * @return void */ private function proceedCount(Select $select): void { @@ -187,8 +185,6 @@ private function proceedCount(Select $select): void /** * Get count for current query - * - * @return int */ public function getCount(): int { @@ -199,8 +195,6 @@ public function getCount(): int * Add default activities in database * * @param bool $check_first Check first if it seems initialized - * - * @return bool */ public function installInit(bool $check_first = true): bool { diff --git a/lib/GaletteEvents/Repository/Bookings.php b/lib/GaletteEvents/Repository/Bookings.php index 091a58d..d9cf7fc 100644 --- a/lib/GaletteEvents/Repository/Bookings.php +++ b/lib/GaletteEvents/Repository/Bookings.php @@ -167,8 +167,6 @@ private function buildSelect(?array $fields, bool $count = false): Select * Calculate sum of all selected contributions * * @param Select $select Original select - * - * @return void */ private function calculateSum(Select $select): void { @@ -211,8 +209,6 @@ private function calculateSum(Select $select): void * Builds where clause, for filtering on simple list mode * * @param Select $select Original select - * - * @return void */ private function buildWhereClause(Select $select): void { @@ -323,8 +319,6 @@ private function buildWhereClause(Select $select): void * * @param string $field_name Field name to order by * @param ?array $fields SELECTE'ed fields - * - * @return bool */ private function canOrderBy(string $field_name, ?array $fields): bool { @@ -385,8 +379,6 @@ private function buildOrderClause(?array $fields = null): array * Count events from the query * * @param Select $select Original select - * - * @return void */ private function proceedCount(Select $select): void { @@ -437,8 +429,6 @@ private function proceedCount(Select $select): void /** * Get count for current query - * - * @return int */ public function getCount(): int { @@ -447,8 +437,6 @@ public function getCount(): int /** * Get sum - * - * @return double */ public function getSum(): float { diff --git a/lib/GaletteEvents/Repository/Events.php b/lib/GaletteEvents/Repository/Events.php index 4e07fb0..4054c01 100644 --- a/lib/GaletteEvents/Repository/Events.php +++ b/lib/GaletteEvents/Repository/Events.php @@ -274,8 +274,6 @@ public function getList(bool $onlyevents = false, bool $fullcalendar = false): a * * @param string $field_name Field name to order by * @param ?array $fields SELECTE'ed fields - * - * @return bool */ private function canOrderBy(string $field_name, ?array $fields = null): bool { @@ -330,8 +328,6 @@ private function buildOrderClause(?array $fields = null): array * Count events from the query * * @param Select $select Original select - * - * @return void */ private function proceedCount(Select $select): void { @@ -385,8 +381,6 @@ private function proceedCount(Select $select): void /** * Get count for current query - * - * @return int */ public function getCount(): int { diff --git a/tests/GaletteEvents/tests/units/Activity.php b/tests/GaletteEvents/tests/units/Activity.php index 61887d9..dbc3ab5 100644 --- a/tests/GaletteEvents/tests/units/Activity.php +++ b/tests/GaletteEvents/tests/units/Activity.php @@ -23,7 +23,7 @@ namespace GaletteEvents\tests\units; -use Galette\GaletteTestCase; +use Galette\Tests\GaletteTestCase; use function PHPUnit\Framework\assertSame; @@ -38,8 +38,6 @@ class Activity extends GaletteTestCase /** * Cleanup after each test method - * - * @return void */ public function tearDown(): void { @@ -50,8 +48,6 @@ public function tearDown(): void /** * Test empty - * - * @return void */ public function testEmpty(): void { @@ -67,8 +63,6 @@ public function testEmpty(): void /** * Test add and update - * - * @return void */ public function testCrud(): void { @@ -161,8 +155,6 @@ public function testCrud(): void /** * Test load error - * - * @return void */ public function testLoadError(): void { From 2f6547541d1522baa2a9176c93967bc8ba6988f3 Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Sat, 3 Jan 2026 17:21:53 +0100 Subject: [PATCH 2/4] =?UTF-8?q?Update=20=C2=A9=20date?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.inc.php | 2 +- _define.php | 2 +- _routes.php | 2 +- lib/GaletteEvents/Activity.php | 2 +- lib/GaletteEvents/Booking.php | 2 +- lib/GaletteEvents/Controllers/Crud/ActivitiesController.php | 2 +- lib/GaletteEvents/Controllers/Crud/BookingsController.php | 2 +- lib/GaletteEvents/Controllers/Crud/EventsController.php | 2 +- lib/GaletteEvents/Controllers/CsvController.php | 2 +- lib/GaletteEvents/Event.php | 2 +- lib/GaletteEvents/Filters/ActivitiesList.php | 2 +- lib/GaletteEvents/Filters/BookingsList.php | 2 +- lib/GaletteEvents/Filters/EventsList.php | 2 +- lib/GaletteEvents/PluginGaletteEvents.php | 2 +- lib/GaletteEvents/Repository/Activities.php | 2 +- lib/GaletteEvents/Repository/Bookings.php | 2 +- lib/GaletteEvents/Repository/Events.php | 2 +- tests/GaletteEvents/tests/units/Activity.php | 2 +- tests/TestsBootstrap.php | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/_config.inc.php b/_config.inc.php index 18bf534..0df44d0 100644 --- a/_config.inc.php +++ b/_config.inc.php @@ -1,7 +1,7 @@ Date: Sat, 3 Jan 2026 17:24:58 +0100 Subject: [PATCH 3/4] Fix core composer path --- .github/workflows/ci-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index a561b73..67e7c97 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -64,7 +64,7 @@ jobs: - name: Install dependencies run: | - cd galette-core/galette + cd galette-core composer install --ignore-platform-reqs - name: CS From 76848a522b7723a4419f22ebfdcfe2cbb515eb09 Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Sat, 3 Jan 2026 17:36:20 +0100 Subject: [PATCH 4/4] phpstan level 6, remove useless doc and params --- .../Controllers/Crud/ActivitiesController.php | 37 ++++-------- .../Controllers/Crud/BookingsController.php | 57 ++++++------------- .../Controllers/Crud/EventsController.php | 46 +++++---------- .../Controllers/CsvController.php | 4 +- lib/GaletteEvents/Repository/Activities.php | 4 +- phpstan.neon | 2 +- 6 files changed, 46 insertions(+), 104 deletions(-) diff --git a/lib/GaletteEvents/Controllers/Crud/ActivitiesController.php b/lib/GaletteEvents/Controllers/Crud/ActivitiesController.php index 5c54b90..5fccda3 100644 --- a/lib/GaletteEvents/Controllers/Crud/ActivitiesController.php +++ b/lib/GaletteEvents/Controllers/Crud/ActivitiesController.php @@ -49,9 +49,6 @@ class ActivitiesController extends AbstractPluginController /** * Add page - * - * @param Request $request PSR Request - * @param Response $response PSR Response */ public function add(Request $request, Response $response): Response { @@ -60,9 +57,6 @@ public function add(Request $request, Response $response): Response /** * Add action - * - * @param Request $request PSR Request - * @param Response $response PSR Response */ public function doAdd(Request $request, Response $response): Response { @@ -75,10 +69,8 @@ public function doAdd(Request $request, Response $response): Response /** * List page * - * @param Request $request PSR Request - * @param Response $response PSR Response - * @param string|null $option One of 'page' or 'order' - * @param string|int|null $value Value of the option + * @param string|null $option One of 'page' or 'order' + * @param string|int|null $value Value of the option */ public function list(Request $request, Response $response, ?string $option = null, string|int|null $value = null): Response { @@ -124,9 +116,6 @@ public function list(Request $request, Response $response, ?string $option = nul /** * Filtering - * - * @param Request $request PSR Request - * @param Response $response PSR Response */ public function filter(Request $request, Response $response): Response { @@ -160,10 +149,8 @@ public function filter(Request $request, Response $response): Response /** * Edit page * - * @param Request $request PSR Request - * @param Response $response PSR Response - * @param int|null $id Model id - * @param string $action Action + * @param int|null $id Model id + * @param string $action Action */ public function edit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response { @@ -204,10 +191,8 @@ public function edit(Request $request, Response $response, ?int $id = null, stri /** * Edit action * - * @param Request $request PSR Request - * @param Response $response PSR Response - * @param null|int $id Model id for edit - * @param string $action Either add or edit + * @param null|int $id Model id for edit + * @param string $action Either add or edit */ public function doEdit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response { @@ -292,7 +277,7 @@ public function doEdit(Request $request, Response $response, ?int $id = null, st /** * Get redirection URI * - * @param array $args Route arguments + * @param array $args Route arguments */ public function redirectUri(array $args): string { @@ -302,7 +287,7 @@ public function redirectUri(array $args): string /** * Get form URI * - * @param array $args Route arguments + * @param array $args Route arguments */ public function formUri(array $args): string { @@ -315,7 +300,7 @@ public function formUri(array $args): string /** * Get confirmation removal page title * - * @param array $args Route arguments + * @param array $args Route arguments */ public function confirmRemoveTitle(array $args): string { @@ -330,8 +315,8 @@ public function confirmRemoveTitle(array $args): string /** * Remove object * - * @param array $args Route arguments - * @param array $post POST values + * @param array $args Route arguments + * @param array $post POST values */ protected function doDelete(array $args, array $post): bool { diff --git a/lib/GaletteEvents/Controllers/Crud/BookingsController.php b/lib/GaletteEvents/Controllers/Crud/BookingsController.php index 0aceea9..8400930 100644 --- a/lib/GaletteEvents/Controllers/Crud/BookingsController.php +++ b/lib/GaletteEvents/Controllers/Crud/BookingsController.php @@ -56,9 +56,7 @@ class BookingsController extends AbstractPluginController /** * Add page * - * @param Request $request PSR Request - * @param Response $response PSR Response - * @param int|null $id_adh Member id + * @param int|null $id_adh Booking id */ public function add(Request $request, Response $response, ?int $id_adh = null): Response { @@ -67,9 +65,6 @@ public function add(Request $request, Response $response, ?int $id_adh = null): /** * Add action - * - * @param Request $request PSR Request - * @param Response $response PSR Response */ public function doAdd(Request $request, Response $response): Response { @@ -82,10 +77,8 @@ public function doAdd(Request $request, Response $response): Response /** * List page * - * @param Request $request PSR Request - * @param Response $response PSR Response - * @param string|null $option One of 'page' or 'order' - * @param string|int|null $value Value of the option + * @param string|null $option One of 'page' or 'order' + * @param string|int|null $value Value of the option */ public function list(Request $request, Response $response, ?string $option = null, string|int|null $value = null): Response { @@ -96,13 +89,11 @@ public function list(Request $request, Response $response, ?string $option = nul /** * List page * - * @param Request $request PSR Request - * @param Response $response PSR Response - * @param string|int $event Linked event. May be an event ID, 'all' or 'guess'. - * @param string|null $option One of 'page' or 'order' - * @param string|int|null $value Value of the option + * @param string|int $event Linked event. May be an event ID, 'all' or 'guess'. + * @param string|null $option One of 'page' or 'order' + * @param string|int|null $value Value of the option */ - public function listBookings(Request $request, Response $response, string|int $event, ?string $option = null, string|int|null $value = null): Response + public function listBookings(Response $response, string|int $event, ?string $option = null, string|int|null $value = null): Response { $filters = $this->session->filter_bookings ?? new BookingsList(); @@ -169,9 +160,6 @@ public function listBookings(Request $request, Response $response, string|int $e /** * Filtering - * - * @param Request $request PSR Request - * @param Response $response PSR Response */ public function filter(Request $request, Response $response): Response { @@ -182,9 +170,7 @@ public function filter(Request $request, Response $response): Response /** * Filtering * - * @param Request $request PSR Request - * @param Response $response PSR Response - * @param string|int $event Linked event. May be an event ID, 'all' or 'guess'. + * @param string|int $event Linked event. May be an event ID, 'all' or 'guess'. */ public function filterBookings(Request $request, Response $response, string|int $event): Response { @@ -242,9 +228,6 @@ public function filterBookings(Request $request, Response $response, string|int /** * Batch actions handler - * - * @param Request $request PSR Request - * @param Response $response PSR Response */ public function handleBatch(Request $request, Response $response): Response { @@ -338,11 +321,9 @@ public function handleBatch(Request $request, Response $response): Response /** * Edit page * - * @param Request $request PSR Request - * @param Response $response PSR Response - * @param int|null $id Model id - * @param string $action Action - * @param int|null $id_adh Member ID (for add) + * @param int|null $id Model id + * @param string $action Action + * @param int|null $id_adh Member ID (for add) */ public function edit(Request $request, Response $response, ?int $id = null, string $action = 'edit', ?int $id_adh = null): Response { @@ -443,10 +424,8 @@ public function edit(Request $request, Response $response, ?int $id = null, stri /** * Edit action * - * @param Request $request PSR Request - * @param Response $response PSR Response - * @param null|int $id Model id for edit - * @param string $action Either add or edit + * @param null|int $id Model id for edit + * @param string $action Either add or edit */ public function doEdit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response { @@ -567,7 +546,7 @@ public function doEdit(Request $request, Response $response, ?int $id = null, st /** * Get redirection URI * - * @param array $args Route arguments + * @param array $args Route arguments */ public function redirectUri(array $args): string { @@ -577,7 +556,7 @@ public function redirectUri(array $args): string /** * Get form URI * - * @param array $args Route arguments + * @param array $args Route arguments */ public function formUri(array $args): string { @@ -590,7 +569,7 @@ public function formUri(array $args): string /** * Get confirmation removal page title * - * @param array $args Route arguments + * @param array $args Route arguments */ public function confirmRemoveTitle(array $args): string { @@ -608,8 +587,8 @@ public function confirmRemoveTitle(array $args): string /** * Remove object * - * @param array $args Route arguments - * @param array $post POST values + * @param array $args Route arguments + * @param array $post POST values */ protected function doDelete(array $args, array $post): bool { diff --git a/lib/GaletteEvents/Controllers/Crud/EventsController.php b/lib/GaletteEvents/Controllers/Crud/EventsController.php index af7b6a9..3635b3b 100644 --- a/lib/GaletteEvents/Controllers/Crud/EventsController.php +++ b/lib/GaletteEvents/Controllers/Crud/EventsController.php @@ -57,9 +57,6 @@ class EventsController extends AbstractPluginController /** * Add page - * - * @param Request $request PSR Request - * @param Response $response PSR Response */ public function add(Request $request, Response $response): Response { @@ -68,9 +65,6 @@ public function add(Request $request, Response $response): Response /** * Add action - * - * @param Request $request PSR Request - * @param Response $response PSR Response */ public function doAdd(Request $request, Response $response): Response { @@ -83,10 +77,8 @@ public function doAdd(Request $request, Response $response): Response /** * List page * - * @param Request $request PSR Request - * @param Response $response PSR Response - * @param string|null $option One of 'page' or 'order' - * @param string|int|null $value Value of the option + * @param string|null $option One of 'page' or 'order' + * @param string|int|null $value Value of the option */ public function list(Request $request, Response $response, ?string $option = null, string|int|null $value = null): Response { @@ -133,10 +125,8 @@ public function list(Request $request, Response $response, ?string $option = nul /** * Calendar view * - * @param Request $request PSR Request - * @param Response $response PSR Response - * @param string|null $option One of 'page' or 'order' - * @param string|int|null $value Value of the option + * @param string|null $option One of 'page' or 'order' + * @param string|int|null $value Value of the option */ public function calendar( Request $request, @@ -195,9 +185,6 @@ public function calendar( /** * Calendar view - * - * @param Request $request PSR Request - * @param Response $response PSR Response */ public function ajaxCalendar(Request $request, Response $response): Response { @@ -214,9 +201,6 @@ public function ajaxCalendar(Request $request, Response $response): Response /** * Filtering - * - * @param Request $request PSR Request - * @param Response $response PSR Response */ public function filter(Request $request, Response $response): Response { @@ -250,10 +234,8 @@ public function filter(Request $request, Response $response): Response /** * Edit page * - * @param Request $request PSR Request - * @param Response $response PSR Response - * @param int|null $id Model id - * @param string $action Action + * @param int|null $id Model id + * @param string $action Action */ public function edit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response { @@ -316,10 +298,8 @@ public function edit(Request $request, Response $response, ?int $id = null, stri /** * Edit action * - * @param Request $request PSR Request - * @param Response $response PSR Response - * @param null|int $id Model id for edit - * @param string $action Either add or edit + * @param null|int $id Model id for edit + * @param string $action Either add or edit */ public function doEdit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response { @@ -448,7 +428,7 @@ public function doEdit(Request $request, Response $response, ?int $id = null, st /** * Get redirection URI * - * @param array $args Route arguments + * @param array $args Route arguments */ public function redirectUri(array $args): string { @@ -458,7 +438,7 @@ public function redirectUri(array $args): string /** * Get form URI * - * @param array $args Route arguments + * @param array $args Route arguments */ public function formUri(array $args): string { @@ -471,7 +451,7 @@ public function formUri(array $args): string /** * Get confirmation removal page title * - * @param array $args Route arguments + * @param array $args Route arguments */ public function confirmRemoveTitle(array $args): string { @@ -486,8 +466,8 @@ public function confirmRemoveTitle(array $args): string /** * Remove object * - * @param array $args Route arguments - * @param array $post POST values + * @param array $args Route arguments + * @param array $post POST values */ protected function doDelete(array $args, array $post): bool { diff --git a/lib/GaletteEvents/Controllers/CsvController.php b/lib/GaletteEvents/Controllers/CsvController.php index 15c6e92..6ac05f6 100644 --- a/lib/GaletteEvents/Controllers/CsvController.php +++ b/lib/GaletteEvents/Controllers/CsvController.php @@ -41,9 +41,7 @@ class CsvController extends \Galette\Controllers\CsvController /** * Bookings CSV exports * - * @param Request $request PSR Request - * @param Response $response PSR Response - * @param ?int $id Event ID, if any + * @param ?int $id Event ID, if any */ public function bookingsExport(Request $request, Response $response, ?int $id = null): Response { diff --git a/lib/GaletteEvents/Repository/Activities.php b/lib/GaletteEvents/Repository/Activities.php index 59fd9a6..aabfb13 100644 --- a/lib/GaletteEvents/Repository/Activities.php +++ b/lib/GaletteEvents/Repository/Activities.php @@ -106,8 +106,8 @@ public function getList(): array|ResultSet /** * Builds the order clause * - * @param ?array $fields Fields list to ensure ORDER clause - * references selected fields. Optional. + * @param ?array $fields Fields list to ensure ORDER clause + * references selected fields. Optional. * * @return array SQL ORDER clauses */ diff --git a/phpstan.neon b/phpstan.neon index 9817277..299cd45 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,7 @@ parameters: parallel: maximumNumberOfProcesses: 2 - level: 5 + level: 6 paths: - lib/ scanFiles: