Skip to content

Commit

Permalink
Fix php 8.4 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
RV7PR authored Jan 15, 2025
1 parent ce6d623 commit d897328
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/Factory/Account/CarrierConfigurationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CarrierConfigurationFactory
public static function create(
array $data,
bool $fetchMissingDropOffPoint = false,
string $apiKey = null
?string $apiKey = null
): CarrierConfiguration {
$data = self::normalizeCarrier($data);

Expand Down Expand Up @@ -55,7 +55,7 @@ public static function create(
private static function createFromApi(
array $data,
bool $fetchMissingDropOffPoint = false,
string $apiKey = null
?string $apiKey = null
): CarrierConfiguration {
return self::createWithDropOffPointIdentifier(
array_merge(
Expand Down Expand Up @@ -85,7 +85,7 @@ private static function createFromApi(
private static function createWithDropOffPointIdentifier(
array $data,
bool $fetchDropOffPoint = false,
string $apiKey = null
?string $apiKey = null
): CarrierConfiguration {
$missingDropOffPoint = empty($data['default_drop_off_point']);
$hasIdentifier = array_key_exists('default_drop_off_point_identifier', $data) && ! empty($data['default_drop_off_point_identifier']);
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/MyParcelCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ public function downloadPdfOfLabels($inline_download = false): void
* @throws \MyParcelNL\Sdk\src\Exception\ApiException
* @throws \MyParcelNL\Sdk\src\Exception\MissingFieldException
*/
public function generateReturnConsignments(bool $sendMail, Closure $modifier = null): self
public function generateReturnConsignments(bool $sendMail, ?Closure $modifier = null): self
{
// Be sure consignments are created
$this->createConcepts();
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function fillObject($object, array $properties): void
*
* @return array $emptyValues
*/
public static function getKeysWithoutValue(array $array, array $requiredKeys = null): array
public static function getKeysWithoutValue(array $array, ?array $requiredKeys = null): array
{
$requiredKeys = $requiredKeys ?? array_keys($array);

Expand Down
2 changes: 1 addition & 1 deletion src/Model/MyParcelRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function getRequestUrl(): string
*
* @return mixed
*/
public function getResult(string $key = null, string $pluck = null)
public function getResult(?string $key = null, ?string $pluck = null)
{
if (null === $key) {
return $this->result;
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Consignment/ShipmentOptionsRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ShipmentOptionsRule extends Rule
* @param null|array $required
* @param null|array $countrySpecificOptions
*/
public function __construct(array $required = null, array $countrySpecificOptions = null)
public function __construct(?array $required = null, ?array $countrySpecificOptions = null)
{
if (is_array($required)) {
$this->requiredOptions = $required;
Expand Down
4 changes: 2 additions & 2 deletions src/Support/Arr.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public static function exists($array, $key)
* @param mixed $default
* @return mixed
*/
public static function first($array, callable $callback = null, $default = null)
public static function first($array, ?callable $callback = null, $default = null)
{
if (is_null($callback)) {
if (empty($array)) {
Expand Down Expand Up @@ -247,7 +247,7 @@ public static function first($array, callable $callback = null, $default = null)
* @param mixed $default
* @return mixed
*/
public static function last($array, callable $callback = null, $default = null)
public static function last($array, ?callable $callback = null, $default = null)
{
if (is_null($callback)) {
return empty($array) ? (new Helpers())->value($default) : end($array);
Expand Down
12 changes: 6 additions & 6 deletions src/Support/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static function unwrap($value)
* @param callable $callback
* @return static
*/
public static function times($number, callable $callback = null)
public static function times($number, ?callable $callback = null)
{
if ($number < 1) {
return new static;
Expand Down Expand Up @@ -466,7 +466,7 @@ public function except($keys)
* @param callable|null $callback
* @return static
*/
public function filter(callable $callback = null)
public function filter(?callable $callback = null)
{
if ($callback) {
return new static(Arr::where($this->items, $callback));
Expand All @@ -483,7 +483,7 @@ public function filter(callable $callback = null)
* @param callable|null $default
* @return static|mixed
*/
public function when($value, callable $callback = null, callable $default = null)
public function when($value, ?callable $callback = null, ?callable $default = null)
{
if (! $callback) {
return new HigherOrderWhenProxy($this, $value);
Expand All @@ -506,7 +506,7 @@ public function when($value, callable $callback = null, callable $default = null
* @param callable $default
* @return mixed
*/
public function unless($value, callable $callback, callable $default = null)
public function unless($value, ?callable $callback, ?callable $default = null)
{
return $this->when(! $value, $callback, $default);
}
Expand Down Expand Up @@ -657,7 +657,7 @@ public function whereInstanceOf($type)
* @param mixed $default
* @return mixed
*/
public function first(callable $callback = null, $default = null)
public function first(?callable $callback = null, $default = null)
{
return Arr::first($this->items, $callback, $default);
}
Expand Down Expand Up @@ -907,7 +907,7 @@ public function keys()
* @param mixed $default
* @return mixed
*/
public function last(callable $callback = null, $default = null)
public function last(?callable $callback = null, $default = null)
{
return Arr::last($this->items, $callback, $default);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Support/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function array_except($array, $keys)
* @param mixed $default
* @return mixed
*/
public function array_first($array, callable $callback = null, $default = null)
public function array_first($array, ?callable $callback = null, $default = null)
{
return Arr::first($array, $callback, $default);
}
Expand Down Expand Up @@ -161,7 +161,7 @@ public function array_has($array, $keys)
* @param mixed $default
* @return mixed
*/
public function array_last($array, callable $callback = null, $default = null)
public function array_last($array, ?callable $callback = null, $default = null)
{
return Arr::last($array, $callback, $default);
}
Expand Down Expand Up @@ -639,7 +639,7 @@ public function object_get($object, $key, $default = null)
* @param callable|null $callback
* @return mixed
*/
public function optional($value = null, callable $callback = null)
public function optional($value = null, ?callable $callback = null)
{
if (is_null($callback)) {
return new Optional($value);
Expand Down Expand Up @@ -1038,7 +1038,7 @@ public function windows_os()
* @param callable|null $callback
* @return mixed
*/
public function with($value, callable $callback = null)
public function with($value, ?callable $callback = null)
{
return is_null($callback) ? $value : $callback($value);
}
Expand Down

0 comments on commit d897328

Please sign in to comment.