Skip to content

Commit

Permalink
Corona: Add stricter type to client data http exception data input
Browse files Browse the repository at this point in the history
  • Loading branch information
brianstoop committed Jul 12, 2024
1 parent e193926 commit 05950ca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
14 changes: 7 additions & 7 deletions src/Lunr/Corona/Exceptions/ClientDataHttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ abstract class ClientDataHttpException extends HttpException

/**
* Input data value
* @var mixed
* @var null|scalar
*/
protected $value;
protected null|string|int|float|bool $value;

/**
* Report data
Expand All @@ -51,12 +51,12 @@ public function __construct(?string $message = NULL, int $code = 0, int $app_cod
/**
* Set input data that caused the request.
*
* @param string $key Key/URL parameter name
* @param mixed $value Input value
* @param string $key Key/URL parameter name
* @param null|scalar $value Input value
*
* @return void
*/
public function setData(string $key, $value): void
public function setData(string $key, null|string|int|float|bool $value): void
{
$this->key = $key;
$this->value = $value;
Expand Down Expand Up @@ -117,9 +117,9 @@ public function getDataKey(): ?string
/**
* Get the input data value.
*
* @return mixed Input data value
* @return null|scalar Input data value
*/
public function getDataValue()
public function getDataValue(): null|string|int|float|bool
{
return $this->value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ public function testApplicationErrorCodeSetCorrectly(): void
$this->assertPropertySame('app_code', $this->code);
}

/**
* Test that the input data value was set correctly.
*/
public function testInputDataValueIsNull(): void
{
$this->assertNull($this->get_reflection_property_value('value'));
}

/**
* Test that the input data flag was set correctly.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ public function testApplicationErrorCodeSetCorrectly(): void
$this->assertPropertySame('app_code', $this->code);
}

/**
* Test that the input data value was set correctly.
*/
public function testInputDataValueIsNull(): void
{
$this->assertNull($this->get_reflection_property_value('value'));
}

/**
* Test that the error message was passed correctly.
*/
Expand Down

0 comments on commit 05950ca

Please sign in to comment.