Skip to content

Commit

Permalink
Fixed PHPStan error in Mage_HTTP_Client_Socket and Mage_HTTP_Client_C…
Browse files Browse the repository at this point in the history
…url (OpenMage#3205)
  • Loading branch information
fballiano authored May 15, 2023
1 parent 7055d19 commit f12eb44
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
12 changes: 6 additions & 6 deletions lib/Mage/HTTP/Client/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ public function getCookies()
if (!$c) {
continue;
}
list($key, $val) = explode("=", $values[0]);
if (is_null($val)) {
list($key, $val) = array_pad(array_map('trim', explode('=', $values[0])), 2, null);
if (is_null($val) || !strlen($key)) {
continue;
}
$out[trim($key)] = trim($val);
$out[$key] = $val;
}
return $out;
}
Expand All @@ -290,11 +290,11 @@ public function getCookiesFull()
if (!$c) {
continue;
}
list($key, $val) = explode("=", $values[0]);
if (is_null($val)) {
list($key, $val) = array_pad(array_map('trim', explode('=', $values[0])), 2, null);
if (is_null($val) || !strlen($key)) {
continue;
}
$out[trim($key)] = ['value' => trim($val)];
$out[$key] = ['value' => $val];
array_shift($values);
$c--;
if (!$c) {
Expand Down
12 changes: 6 additions & 6 deletions lib/Mage/HTTP/Client/Socket.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,11 @@ public function getCookies()
if (!$c) {
continue;
}
list($key, $val) = explode("=", $values[0]);
if (is_null($val)) {
list($key, $val) = array_pad(array_map('trim', explode('=', $values[0])), 2, null);
if (is_null($val) || !strlen($key)) {
continue;
}
$out[trim($key)] = trim($val);
$out[$key] = $val;
}
return $out;
}
Expand All @@ -329,11 +329,11 @@ public function getCookiesFull()
if (!$c) {
continue;
}
list($key, $val) = explode("=", $values[0]);
if (is_null($val)) {
list($key, $val) = array_pad(array_map('trim', explode('=', $values[0])), 2, null);
if (is_null($val) || !strlen($key)) {
continue;
}
$out[trim($key)] = ['value' => trim($val)];
$out[$key] = ['value' => $val];
array_shift($values);
$c--;
if (!$c) {
Expand Down
6 changes: 0 additions & 6 deletions phpstan.dist.issues.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,3 @@ parameters:
-
message: "#Call to function is_null\\(\\) with bool will always evaluate to false.$#"
path: app/code/core/Mage/Newsletter/Model/Subscriber.php
-
message: "#Call to function is_null\\(\\) with string will always evaluate to false.$#"
path: lib/Mage/HTTP/Client/Curl.php
-
message: "#Call to function is_null\\(\\) with string will always evaluate to false.$#"
path: lib/Mage/HTTP/Client/Socket.php

0 comments on commit f12eb44

Please sign in to comment.