Skip to content

Commit a5f473e

Browse files
committed
Replaces deprecated InvalidParamException to InvalidArgumentException
1 parent 12aea44 commit a5f473e

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"require": {
1919
"php": ">=5.5.0",
20-
"yiisoft/yii2": "~2.0.13",
20+
"yiisoft/yii2": "~2.0.14",
2121
"symfony/process": "*"
2222
},
2323
"require-dev": {

src/Queue.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
use Yii;
1111
use yii\base\Component;
12-
use yii\base\InvalidParamException;
12+
use yii\base\InvalidArgumentException;
1313
use yii\di\Instance;
1414
use yii\helpers\VarDumper;
1515
use yii\queue\serializers\PhpSerializer;
@@ -155,7 +155,7 @@ public function push($job)
155155
}
156156

157157
if ($this->strictJobType && !($event->job instanceof JobInterface)) {
158-
throw new InvalidParamException('Job must be instance of JobInterface.');
158+
throw new InvalidArgumentException('Job must be instance of JobInterface.');
159159
}
160160

161161
$message = $this->serializer->serialize($event->job);
@@ -197,7 +197,7 @@ protected function handleMessage($id, $message, $ttr, $attempt)
197197
$job = $this->serializer->unserialize($message);
198198
if (!($job instanceof JobInterface)) {
199199
$dump = VarDumper::dumpAsString($job);
200-
throw new InvalidParamException("Job $id must be a JobInterface instance instead of $dump.");
200+
throw new InvalidArgumentException("Job $id must be a JobInterface instance instead of $dump.");
201201
}
202202

203203
$event = new ExecEvent([

src/drivers/beanstalk/Queue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Pheanstalk\Exception\ServerException;
1111
use Pheanstalk\Pheanstalk;
1212
use Pheanstalk\PheanstalkInterface;
13-
use yii\base\InvalidParamException;
13+
use yii\base\InvalidArgumentException;
1414
use yii\queue\cli\Queue as CliQueue;
1515

1616
/**
@@ -74,7 +74,7 @@ public function run($repeat, $timeout = 0)
7474
public function status($id)
7575
{
7676
if (!is_numeric($id) || $id <= 0) {
77-
throw new InvalidParamException("Unknown message ID: $id.");
77+
throw new InvalidArgumentException("Unknown message ID: $id.");
7878
}
7979

8080
try {

src/drivers/db/Queue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace yii\queue\db;
99

1010
use yii\base\Exception;
11-
use yii\base\InvalidParamException;
11+
use yii\base\InvalidArgumentException;
1212
use yii\db\Connection;
1313
use yii\db\Query;
1414
use yii\di\Instance;
@@ -108,7 +108,7 @@ public function status($id)
108108
return self::STATUS_DONE;
109109
}
110110

111-
throw new InvalidParamException("Unknown message ID: $id.");
111+
throw new InvalidArgumentException("Unknown message ID: $id.");
112112
}
113113

114114
if (!$payload['reserved_at']) {

src/drivers/file/Queue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
namespace yii\queue\file;
99

1010
use Yii;
11+
use yii\base\InvalidArgumentException;
1112
use yii\base\InvalidConfigException;
12-
use yii\base\InvalidParamException;
1313
use yii\base\NotSupportedException;
1414
use yii\helpers\FileHelper;
1515
use yii\queue\cli\Queue as CliQueue;
@@ -92,7 +92,7 @@ public function run($repeat, $timeout = 0)
9292
public function status($id)
9393
{
9494
if (!is_numeric($id) || $id <= 0) {
95-
throw new InvalidParamException("Unknown message ID: $id.");
95+
throw new InvalidArgumentException("Unknown message ID: $id.");
9696
}
9797

9898
if (file_exists("$this->path/job$id.data")) {

src/drivers/redis/Queue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace yii\queue\redis;
99

10-
use yii\base\InvalidParamException;
10+
use yii\base\InvalidArgumentException;
1111
use yii\base\NotSupportedException;
1212
use yii\di\Instance;
1313
use yii\redis\Connection;
@@ -74,7 +74,7 @@ public function run($repeat, $timeout = 0)
7474
public function status($id)
7575
{
7676
if (!is_numeric($id) || $id <= 0) {
77-
throw new InvalidParamException("Unknown message ID: $id.");
77+
throw new InvalidArgumentException("Unknown message ID: $id.");
7878
}
7979

8080
if ($this->redis->hexists("$this->channel.attempts", $id)) {

src/drivers/sync/Queue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
use Yii;
1111
use yii\base\Application;
12-
use yii\base\InvalidParamException;
12+
use yii\base\InvalidArgumentException;
1313
use yii\queue\Queue as BaseQueue;
1414

1515
/**
@@ -86,7 +86,7 @@ protected function pushMessage($message, $ttr, $delay, $priority)
8686
public function status($id)
8787
{
8888
if (!is_int($id) || $id <= 0 || $id > $this->pushedId) {
89-
throw new InvalidParamException("Unknown messages ID: $id.");
89+
throw new InvalidArgumentException("Unknown messages ID: $id.");
9090
}
9191

9292
if ($id <= $this->finishedId) {

0 commit comments

Comments
 (0)