Skip to content

Commit

Permalink
Fix php84 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed Dec 1, 2024
1 parent f36dd33 commit bfa1e2f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/midgard/collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class midgard_collector extends midgard_query_builder

private array $value_properties = [];

public function __construct(string $class, string $field = null, $value = null)
public function __construct(string $class, ?string $field = null, $value = null)
{
parent::__construct($class);
if ($field) {
Expand Down
4 changes: 2 additions & 2 deletions src/api/error/exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class exception extends base_exception
self::OBJECT_IS_LOCKED => "Object is locked",
];

public function __construct($message = "Undefined error", $code = self::ERROR, base_exception $previous = null)
public function __construct($message = "Undefined error", $code = self::ERROR, ?base_exception $previous = null)
{
midgard_connection::get_instance()->set_error($code);
midgard_connection::get_instance()->set_error_string($message);
Expand Down Expand Up @@ -164,7 +164,7 @@ public static function object_no_parent() : self
return new self(self::$messages[self::OBJECT_NO_PARENT], self::OBJECT_NO_PARENT);
}

public static function invalid_property_value(string $message = null) : self
public static function invalid_property_value(?string $message = null) : self
{
$message ??= self::$messages[self::INVALID_PROPERTY_VALUE];
return new self($message, self::INVALID_PROPERTY_VALUE);
Expand Down
2 changes: 1 addition & 1 deletion src/api/mgdobject.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ public function has_parameters() : bool
return !$this->get_collection('midgard_parameter')->is_empty($this->guid);
}

public function list_parameters(string $domain = null) : array
public function list_parameters(?string $domain = null) : array
{
$constraints = [];
if ($domain) {
Expand Down
2 changes: 1 addition & 1 deletion src/mgdschema/type.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct(SimpleXMLElement $attributes)
}
}

public function add_property(node $property, string $name = null)
public function add_property(node $property, ?string $name = null)
{
$name ??= $property->name;

Expand Down
2 changes: 1 addition & 1 deletion src/storage/connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static function get_user() : ?user
return self::$instance->user;
}

public static function set_user(user $user = null)
public static function set_user(?user $user = null)
{
if (self::$instance === null) {
throw new \Exception('Not initialized');
Expand Down

0 comments on commit bfa1e2f

Please sign in to comment.