-
-
Notifications
You must be signed in to change notification settings - Fork 439
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
Fixed PHPStan error in Mage_HTTP_Client_Socket and Mage_HTTP_Client_Curl #3205
Conversation
I guess PHPStan is a bit wrong here, because list($key, $val) = explode('=', 'foo');
var_dump($key); // string(3) "foo"'
var_dump($val); // NULL I'd be curious if it throws the error if you used It seems like some people might be using this library, see: #913. However, I support the removal of these classes (move it to an external repo, I suppose.) We should encourage people to use the power of Composer here, and just install something like Guzzle or one of the many other helper libraries. These built-in libraries like this are so old-school. |
@justinbeaty I've removed the first unnecessary check. I wouldn't care too much about phpstan sincerely because it also is not perfect... anyway since nowadays if you don't do phpstand you're not cool... it bothers me to have a million errors. what if we deprecate all these classes in lib/Mage, copy them to a separate repo and remove them from |
I think it's okay to deprecate / remove. It's an easy fix for someone to add back if they used it. There's probably a lot more in that lib/Mage folder we can remove... |
I've removed the whole lib/Mage and see no error browsing around... |
I think These are the classes I see defined:
|
ps: same think could be for lib/Magento... more or less.. |
I meant that Mage_Exception was the only class defined in lib/Mage that was used outside of lib/Mage. We're saying the same thing. To figure this out, I grepped for each of those classes in I think we could rewrite Mage_Exception -> Mage_Core_Exceptoin too. I don't know why there's two, probably just legacy crap. If needed, we can even do this somewhere: if (!class_exists('Mage_Exception')) {
class Mage_Exception extends Exception {}
} |
legacy crap 😂 |
I'd do all of these things in separate PRs anyway |
Yeah, so then this PR is fine to me. approved. |
I guess phpstan "thinks The given example throws a notice on php7 (Notice: Undefined offset: 1 in Suggestion:
|
i've refactored this one |
LGTM, but do we need |
mmm I thought it would be better to check the key too and not only the value, in case after the trim it becomes empty, dunno. |
Port to |
I rewrote the
list($key, $val) = explode("=", $values[0]);
But it seems to me that the whole Mage_HTTP* is never used, should we at least deprecate it? or remove it in
next
?