Skip to content

[Notifier] LightSMS duplicated $errorCode variable fix #40735

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

Merged
merged 1 commit into from
Apr 8, 2021
Merged

[Notifier] LightSMS duplicated $errorCode variable fix #40735

merged 1 commit into from
Apr 8, 2021

Conversation

StaffNowa
Copy link
Contributor

Q A
Branch? 5.x
Bug fix? no
New feature? no
Deprecations? no
Tickets Fix #40712, #40733
License MIT
Doc PR -

Removed duplicated variable $errorCode.

Many thanks for:
@OskarStark, @jderusse and special thanks for @chalasr for fast rebase course at night :)))

@StaffNowa StaffNowa requested a review from OskarStark as a code owner April 8, 2021 03:51
@Nyholm Nyholm added the Notifier label Apr 8, 2021
@carsonbot carsonbot changed the title LightSMS duplicated $errorCode variable fix [Notifier] LightSMS duplicated $errorCode variable fix Apr 8, 2021
@@ -124,8 +124,7 @@ protected function doSend(MessageInterface $message): SentMessage

$content = $response->toArray(false);

if (0 !== (int) ($content['error'] ?? $content['']['error'] ?? $content[$phone]['error']) ?? -1) {
$errorCode = (int) ($content['error'] ?? $content['']['error'] ?? $content[$phone]['error']) ?? -1;
if ($errorCode = (int) ($content['error'] ?? $content['']['error'] ?? $content[$phone]['error']) ?? -1) {
Copy link
Member

Choose a reason for hiding this comment

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

Im sure this code is correct. But could we make it a bit more readable?

$errorCode = (int) ($content['error'] ?? $content['']['error'] ?? $content[$phone]['error']) ?? -1
if (0 !== $errorCode) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Nyholm good question :) For now do not have any suggestions how to make it more readable :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yesterday, I created new method with if isset, but it is not good as understand @jderusse

Copy link
Member

Choose a reason for hiding this comment

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

What do you think about my suggestion?

Copy link
Member

Choose a reason for hiding this comment

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

👍 for Tobias' suggestion. That's also what ##40733 (comment) suggested to do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chalasr is it not the same like here #40735? :) changed :) little bit confused now :D

Copy link
Member

Choose a reason for hiding this comment

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

we both suggested

$errorCode = (int) ($content['error'] ?? $content['']['error'] ?? $content[$phone]['error']) ?? -1;
if (0 !== $code) {

you implemented

if ($errorCode = (int) ($content['error'] ?? $content['']['error'] ?? $content[$phone]['error']) ?? -1) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jderusse sorry misunderstanding :) @Nyholm show me screen 👍

@chalasr chalasr added this to the 5.x milestone Apr 8, 2021
@OskarStark OskarStark requested review from Nyholm and jderusse April 8, 2021 10:49
@Nyholm
Copy link
Member

Nyholm commented Apr 8, 2021

Thanks Vasilij.

@Nyholm Nyholm merged commit 1d8ad1d into symfony:5.x Apr 8, 2021
@StaffNowa StaffNowa deleted the lightsms-suggestion branch April 9, 2021 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy