Skip to content
Closed
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
8 changes: 4 additions & 4 deletions src/Job/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function getParsedBody(): array
*
* @return \Closure
*/
public function getCallable()
public function getCallable(): Closure
{
if ($this->callable) {
return $this->callable;
Expand Down Expand Up @@ -140,7 +140,7 @@ public function getTarget(): array
* @param mixed $default Default value.
* @return mixed
*/
public function getArgument($key = null, $default = null)
public function getArgument(mixed $key = null, mixed $default = null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to use mixed we would have to drop PHP 7.x support. I'd rather not do that in the 1.x branch as this branch supports CakePHP 4.x. However, this change could be made in the 2.x branch which has a min PHP version of 8.1.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markstory

Thank you for your reply!

After switching the base branch from 1.x to 2.x, I noticed that the changes I proposed have already been implemented there.
So I'll go ahead and close this PR. Thanks again for your time and feedback!

{
if (array_key_exists('data', $this->parsedBody)) {
$data = $this->parsedBody['data'];
Expand Down Expand Up @@ -175,7 +175,7 @@ public function getMaxAttempts(): ?int
* @return string
* @psalm-suppress InvalidToString
*/
public function __toString()
public function __toString(): string
{
return (string)json_encode($this);
}
Expand All @@ -184,7 +184,7 @@ public function __toString()
* @return array
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
public function jsonSerialize(): array
{
return $this->parsedBody;
}
Expand Down
8 changes: 4 additions & 4 deletions tests/TestCase/Job/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class MessageTest extends TestCase
*
* @return void
*/
public function testConstructorAndGetters()
public function testConstructorAndGetters(): void
{
$callable = ['TestApp\WelcomeMailer', 'welcome'];
$time = 'sample data ' . time();
Expand Down Expand Up @@ -69,7 +69,7 @@ public function testConstructorAndGetters()
*
* @return void
*/
public function testLegacyArguments()
public function testLegacyArguments(): void
{
$callable = ['TestApp\WelcomeMailer', 'welcome'];
$args = [
Expand Down Expand Up @@ -98,7 +98,7 @@ public function testLegacyArguments()
*
* @return void
*/
public function testGetCallableInvalidClass()
public function testGetCallableInvalidClass(): void
{
$parsedBody = [
'class' => ['Trash', 'trash'],
Expand All @@ -120,7 +120,7 @@ public function testGetCallableInvalidClass()
*
* @return void
*/
public function testGetCallableInvalidType()
public function testGetCallableInvalidType(): void
{
$parsedBody = [
'class' => ['TestApp\WelcomeMailer', 'trash', 'oops'],
Expand Down
Loading