Disallows assignments in some control structures

[MAILPOET-2090]
This commit is contained in:
Pavel Dohnal
2019-05-20 12:27:21 +02:00
committed by M. Shull
parent b9af15e19f
commit d1529a03c3
4 changed files with 8 additions and 3 deletions

View File

@@ -142,7 +142,8 @@ class SendingQueue extends Model {
$subscribers = $this->getSubscribers(); $subscribers = $this->getSubscribers();
return in_array($subscriber_id, $subscribers['processed']); return in_array($subscriber_id, $subscribers['processed']);
} else { } else {
if ($task = $this->task()->findOne()) { $task = $this->task()->findOne();
if ($task) {
$task_subscribers = new TaskSubscribers($task); $task_subscribers = new TaskSubscribers($task);
return $task_subscribers->isSubscriberProcessed($subscriber_id); return $task_subscribers->isSubscriberProcessed($subscriber_id);
} }

View File

@@ -65,7 +65,8 @@ class API {
$code = $this->wp->wpRemoteRetrieveResponseCode($result); $code = $this->wp->wpRemoteRetrieveResponseCode($result);
switch ($code) { switch ($code) {
case 200: case 200:
if ($body = $this->wp->wpRemoteRetrieveBody($result)) { $body = $this->wp->wpRemoteRetrieveBody($result);
if ($body) {
$body = json_decode($body, true); $body = json_decode($body, true);
} }
break; break;

View File

@@ -23,7 +23,8 @@ class API {
$code = $this->wp->wpRemoteRetrieveResponseCode($result); $code = $this->wp->wpRemoteRetrieveResponseCode($result);
switch ($code) { switch ($code) {
case 200: case 200:
if ($body = $this->wp->wpRemoteRetrieveBody($result)) { $body = $this->wp->wpRemoteRetrieveBody($result);
if ($body) {
$body = json_decode($body); $body = json_decode($body);
} }
break; break;

View File

@@ -5,6 +5,8 @@
<!-- This sniff enforces trailing commas in multi-line arrays --> <!-- This sniff enforces trailing commas in multi-line arrays -->
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/> <rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/>
<!-- Disallows assignments in if, elseif and do-while loop conditions -->
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
<!-- Control structures must have at least one statement in the body --> <!-- Control structures must have at least one statement in the body -->
<!--<rule ref="Generic.CodeAnalysis.EmptyStatement"/>--> <!--<rule ref="Generic.CodeAnalysis.EmptyStatement"/>-->
<!-- For loops with only second expression should be while loops --> <!-- For loops with only second expression should be while loops -->