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 e94355a commit 4b057c7
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions lib/GaletteObjectsLend/Entity/LendCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ class LendCategory
* @param Db $zdb Database instance
* @param Plugins $plugins Plugins instance
* @param int|ArrayObject<string,int|string>|null $args Maybe null, an RS object or an id from database
* @param array<string,bool> $deps Dependencies configuration, see LendCategory::$deps
* @param ?array<string,bool> $deps Dependencies configuration, see LendCategory::$deps
*/
public function __construct(Db $zdb, Plugins $plugins, int|ArrayObject $args = null, array $deps = null)
public function __construct(Db $zdb, Plugins $plugins, int|ArrayObject|null $args = null, ?array $deps = null)
{
$this->zdb = $zdb;
$this->plugins = $plugins;
Expand Down
4 changes: 2 additions & 2 deletions lib/GaletteObjectsLend/Entity/LendObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ class LendObject
* @param Db $zdb Database instance
* @param Plugins $plugins Plugins instance
* @param int|ArrayObject<string,int|string>|null $args Maybe null, an RS object or an id from database
* @param array<string,bool> $deps Dependencies configuration, see LendOb::$deps
* @param ?array<string,bool> $deps Dependencies configuration, see LendOb::$deps
*/
public function __construct(Db $zdb, Plugins $plugins, int|ArrayObject $args = null, array $deps = null)
public function __construct(Db $zdb, Plugins $plugins, int|ArrayObject|null $args = null, ?array $deps = null)
{
$this->zdb = $zdb;
$this->plugins = $plugins;
Expand Down
2 changes: 1 addition & 1 deletion lib/GaletteObjectsLend/Entity/LendRent.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class LendRent
*
* @param int|ArrayObject<string,int|string>|null $args Either an int with rent id, null, or a resultset row
*/
public function __construct(int|ArrayObject $args = null)
public function __construct(int|ArrayObject|null $args = null)
{
global $zdb;

Expand Down
2 changes: 1 addition & 1 deletion lib/GaletteObjectsLend/Entity/LendStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class LendStatus
* @param Db $zdb Database instance
* @param int|ArrayObject<string,int|string>|null $args Can be null, an ID or a database row
*/
public function __construct(Db $zdb, int|ArrayObject $args = null)
public function __construct(Db $zdb, int|ArrayObject|null $args = null)
{
$this->zdb = $zdb;

Expand Down
12 changes: 6 additions & 6 deletions lib/GaletteObjectsLend/Entity/Picture.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ public function displayThumb(Response $response, Preferences $prefs): Response
* Create thumbnail image
* @see \Galette\Core\Picture::resizeImage()
*
* @param string $source the source image
* @param string $ext file's extension
* @param string $dest the destination image.
* If null, we'll use the source image. Defaults to null
* @param string $source the source image
* @param string $ext file's extension
* @param ?string $dest the destination image.
* If null, we'll use the source image. Defaults to null
*
* @return bool
*/
private function createThumb(string $source, string $ext, string $dest = null): bool
private function createThumb(string $source, string $ext, ?string $dest = null): bool
{
$class = get_class($this);

Expand Down Expand Up @@ -260,7 +260,7 @@ public function delete(bool $transaction = true): bool
*
* @return bool|int
*/
public function store(array $file, bool $ajax = false, array $cropping = null): bool|int
public function store(array $file, bool $ajax = false, ?array $cropping = null): bool|int
{
$ext = pathinfo($this->file_path, PATHINFO_EXTENSION);
$filename = substr($this->file_path, 0, strlen($this->file_path) - strlen($ext) - 1);
Expand Down
22 changes: 11 additions & 11 deletions lib/GaletteObjectsLend/Repository/Categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Categories
* @param Plugins $plugins Plugins instance
* @param ?CategoriesList $filters Filtering
*/
public function __construct(Db $zdb, Login $login, Plugins $plugins, CategoriesList $filters = null)
public function __construct(Db $zdb, Login $login, Plugins $plugins, ?CategoriesList $filters = null)
{
$this->zdb = $zdb;
$this->login = $login;
Expand All @@ -91,19 +91,19 @@ public function __construct(Db $zdb, Login $login, Plugins $plugins, CategoriesL
/**
* Get categories list
*
* @param boolean $as_cat return the results as an array of
* Categories object.
* @param array<string> $fields field(s) name(s) to get. Should be a string or
* an array. If null, all fields will be
* returned
* @param boolean $count true if we want to count members
* @param boolean $limit true if we want records pagination
* @param boolean $as_cat return the results as an array of
* Categories object.
* @param ?array<string> $fields field(s) name(s) to get. Should be a string or
* an array. If null, all fields will be
* returned
* @param boolean $count true if we want to count members
* @param boolean $limit true if we want records pagination
*
* @return LendCategory[]|ResultSet
*/
public function getCategoriesList(
bool $as_cat = false,
array $fields = null,
?array $fields = null,
bool $count = true,
bool $limit = true
): array|ResultSet {
Expand Down Expand Up @@ -145,7 +145,7 @@ public function getCategoriesList(
*
* @return LendCategory[]|ResultSet
*/
public function getList(bool $as_cat = false, array $fields = null): array|ResultSet
public function getList(bool $as_cat = false, ?array $fields = null): array|ResultSet
{
return $this->getCategoriesList(
$as_cat,
Expand Down Expand Up @@ -262,7 +262,7 @@ private function proceedCount(Select $select): void
*
* @return array<string> SQL ORDER clauses
*/
private function buildOrderClause(array $fields = null): array
private function buildOrderClause(?array $fields = null): array
{
$order = array();
switch ($this->filters->orderby) {
Expand Down
20 changes: 10 additions & 10 deletions lib/GaletteObjectsLend/Repository/Objects.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Objects
* @param Preferences $lprefs Lends preferences instance
* @param ?ObjectsList $filters Filtering
*/
public function __construct(Db $zdb, Plugins $plugins, Preferences $lprefs, ObjectsList $filters = null)
public function __construct(Db $zdb, Plugins $plugins, Preferences $lprefs, ?ObjectsList $filters = null)
{
$this->zdb = $zdb;
$this->plugins = $plugins;
Expand All @@ -102,18 +102,18 @@ public function __construct(Db $zdb, Plugins $plugins, Preferences $lprefs, Obje
/**
* Get objects list
*
* @param boolean $as_objects return the results as an array of
* Object object.
* @param array<string> $fields field(s) name(s) to get. If null, all fields will be returned
* @param boolean $count true if we want to count members
* @param boolean $limit true if we want records pagination
* @param boolean $all_rents true to load rents along with objects
* @param boolean $as_objects return the results as an array of
* Object object.
* @param ?array<string> $fields field(s) name(s) to get. If null, all fields will be returned
* @param boolean $count true if we want to count members
* @param boolean $limit true if we want records pagination
* @param boolean $all_rents true to load rents along with objects
*
* @return LendObject[]|ResultSet
*/
public function getObjectsList(
bool $as_objects = false,
array $fields = null,
?array $fields = null,
bool $count = true,
bool $limit = true,
bool $all_rents = false
Expand Down Expand Up @@ -218,7 +218,7 @@ public function removeObjects(array $ids): bool
*
* @return LendObject[]|ResultSet
*/
public function getList(bool $as_objects = false, array $fields = null): array|ResultSet
public function getList(bool $as_objects = false, ?array $fields = null): array|ResultSet
{
return $this->getObjectsList(
$as_objects,
Expand Down Expand Up @@ -361,7 +361,7 @@ private function proceedCount(Select $select): void
*
* @return array<string> SQL ORDER clauses
*/
private function buildOrderClause(array $fields = null): array
private function buildOrderClause(?array $fields = null): array
{
$order = array();
switch ($this->filters->orderby) {
Expand Down
18 changes: 9 additions & 9 deletions lib/GaletteObjectsLend/Repository/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Status
* @param Login $login Logged in instance
* @param ?StatusList $filters Filtering
*/
public function __construct(Db $zdb, Login $login, StatusList $filters = null)
public function __construct(Db $zdb, Login $login, ?StatusList $filters = null)
{
$this->zdb = $zdb;
$this->login = $login;
Expand All @@ -101,7 +101,7 @@ public function __construct(Db $zdb, Login $login, StatusList $filters = null)
*/
public function getStatusList(
bool $as_stt = false,
array $fields = null,
?array $fields = null,
bool $count = true,
bool $limit = true
): array|ResultSet {
Expand Down Expand Up @@ -137,15 +137,15 @@ public function getStatusList(
/**
* Get status list
*
* @param boolean $as_stt return the results as an array of
* Status object.
* @param array $fields field(s) name(s) to get. Should be a string or
* an array. If null, all fields will be
* returned
* @param boolean $as_stt return the results as an array of
* Status object.
* @param ?string[] $fields field(s) name(s) to get. Should be a string or
* an array. If null, all fields will be
* returned
*
* @return LendStatus[]|ResultSet
*/
public function getList(bool $as_stt = false, array $fields = null): array|ResultSet
public function getList(bool $as_stt = false, ?array $fields = null): array|ResultSet
{
return $this->getStatusList(
$as_stt,
Expand Down Expand Up @@ -244,7 +244,7 @@ private function proceedCount(Select $select): void
*
* @return array<string> SQL ORDER clauses
*/
private function buildOrderClause(array $fields = null): array
private function buildOrderClause(?array $fields = null): array
{
$order = array();
switch ($this->filters->orderby) {
Expand Down

0 comments on commit 4b057c7

Please sign in to comment.