Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corona: Add stricter type to client data http exception data input #13

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading