Skip to content

Commit

Permalink
Fix implicit nullables
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Dec 28, 2024
1 parent 577a6d5 commit 3815570
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function doAdd(Request $request, Response $response): Response
*
* @return Response
*/
public function list(Request $request, Response $response, string $option = null, string|int $value = null): Response
public function list(Request $request, Response $response, ?string $option = null, string|int|null $value = null): Response
{
$filter_name = $this->getFilterName($this->getDefaultFilterName());
if (isset($this->session->$filter_name)) {
Expand Down Expand Up @@ -182,7 +182,7 @@ public function filter(Request $request, Response $response): Response
*
* @return Response
*/
public function edit(Request $request, Response $response, int $id = null, string $action = 'edit'): Response
public function edit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response
{
if ($this->session->activity !== null) {
$activity = $this->session->activity;
Expand Down Expand Up @@ -233,7 +233,7 @@ public function edit(Request $request, Response $response, int $id = null, strin
*
* @return Response
*/
public function doEdit(Request $request, Response $response, int $id = null, string $action = 'edit'): Response
public function doEdit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response
{
$post = $request->getParsedBody();
$activity = new Activity($this->zdb);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class SubscriptionsController extends AbstractPluginController
*
* @return Response
*/
public function add(Request $request, Response $response, int $id_adh = null): Response
public function add(Request $request, Response $response, ?int $id_adh = null): Response
{
return $this->edit($request, $response, null, 'add', $id_adh);
}
Expand Down Expand Up @@ -92,7 +92,7 @@ public function doAdd(Request $request, Response $response): Response
*
* @return Response
*/
public function list(Request $request, Response $response, string $option = null, string|int $value = null): Response
public function list(Request $request, Response $response, ?string $option = null, string|int|null $value = null): Response
{
$filters = $this->session->{$this->getFilterName($this->getDefaultFilterName())} ?? new SubscriptionsList();

Expand Down Expand Up @@ -250,7 +250,7 @@ public function filter(Request $request, Response $response): Response
*
* @return Response
*/
public function edit(Request $request, Response $response, int $id = null, string $action = 'edit', int $id_adh = null): Response
public function edit(Request $request, Response $response, ?int $id = null, string $action = 'edit', ?int $id_adh = null): Response
{
$route_params = [];

Expand Down Expand Up @@ -332,7 +332,7 @@ public function edit(Request $request, Response $response, int $id = null, strin
*
* @return Response
*/
public function doEdit(Request $request, Response $response, int $id = null, string $action = 'edit'): Response
public function doEdit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response
{
$post = $request->getParsedBody();
$subscription = new Subscription($this->zdb);
Expand Down
2 changes: 1 addition & 1 deletion lib/GaletteActivities/Entity/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Activity
* a specific activity, or null to just
* instanciate object
*/
public function __construct(Db $zdb, int|ArrayObject $args = null)
public function __construct(Db $zdb, int|ArrayObject|null $args = null)
{
$this->zdb = $zdb;
$this->setFields();
Expand Down
10 changes: 5 additions & 5 deletions lib/GaletteActivities/Filters/SubscriptionsList.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ class SubscriptionsList extends Pagination
public const DATE_SUBSCRIPTION = 1;
public const DATE_CREATION = 2;
//filters
private string|int|null $activity_filter;
private string|int|null $member_filter;
private string|int|null $activity_filter; //@phpstan-ignore-line
private string|int|null $member_filter; //@phpstan-ignore-line

private int|string $paid_filter;
private int|string $paid_filter; //@phpstan-ignore-line
private int $payment_type_filter;
private ?int $date_field = null;
private ?string $start_date_filter;
private ?string $end_date_filter;
private ?string $start_date_filter; //@phpstan-ignore-line
private ?string $end_date_filter; //@phpstan-ignore-line

/** @var array<int> */
private array $selected;
Expand Down
4 changes: 2 additions & 2 deletions lib/GaletteActivities/Repository/Activities.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Activities extends Repository
* @param Preferences $preferences Preferences instance
* @param ?ActivitiesList $filters Filtering
*/
public function __construct(Db $zdb, Login $login, Preferences $preferences, ActivitiesList $filters = null)
public function __construct(Db $zdb, Login $login, Preferences $preferences, ?ActivitiesList $filters = null)
{
$this->zdb = $zdb;
$this->login = $login;
Expand Down Expand Up @@ -108,7 +108,7 @@ public function getList(): array|ResultSet
*
* @return array<string> SQL ORDER clauses
*/
private function buildOrderClause(array $fields = null): array
private function buildOrderClause(?array $fields = null): array
{
$order = array();

Expand Down
4 changes: 2 additions & 2 deletions lib/GaletteActivities/Repository/Subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Subscriptions
* @param Db $zdb Database instance
* @param ?SubscriptionsList $filters Filtering
*/
public function __construct(Db $zdb, SubscriptionsList $filters = null)
public function __construct(Db $zdb, ?SubscriptionsList $filters = null)
{
$this->zdb = $zdb;

Expand Down Expand Up @@ -319,7 +319,7 @@ private function canOrderBy(string $field_name, ?array $fields): bool
*
* @return array<string> SQL ORDER clauses
*/
private function buildOrderClause(array $fields = null): array
private function buildOrderClause(?array $fields = null): array
{
$order = array();

Expand Down

0 comments on commit 3815570

Please sign in to comment.