Skip to content
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

Use in_array instead of array_search + comparison #24886

Closed
wants to merge 1 commit into from
Closed

Use in_array instead of array_search + comparison #24886

wants to merge 1 commit into from

Conversation

carusogabriel
Copy link
Contributor

Description (*)

This has some benefits, such as reducing the tasks, as well as improving the readability of the code.

Fixed Issues (if relevant)

None

Manual testing scenarios (*)

Not necessary

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

This has some benefits, such as reducing the tasks, as well as improving the readability of the code.
@m2-assistant
Copy link

m2-assistant bot commented Oct 6, 2019

Hi @carusogabriel. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

@osrecio
Copy link
Member

osrecio commented Oct 8, 2019

Hi @carusogabriel . Thanks for your PR.

Can you check the tests details and solve the errors.

@carusogabriel
Copy link
Contributor Author

Hello @osrecio. I thought the failings were false-positives in my PRs. I'll fix them, thanks 👍

@@ -135,6 +135,6 @@ private function validateCipherMethod($cipherMethod)
);
$cipherMethod = strtolower($cipherMethod);

return (false !== array_search($cipherMethod, $methods));
return in_array($cipherMethod, $methods);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to replace both array_search & in_array to array_flip + isset.
Reason: magento/magento-coding-standard#143

@carusogabriel @osrecio what do you think about it?

Copy link
Member

Choose a reason for hiding this comment

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

Followin the thread I think is better to usee array_flip + isset.

If @carusogabriel agree with us, he can perform the changes and for me will be ready to be merged :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@osrecio I'll do it :)

@sidolov sidolov changed the base branch from 2.3-develop to 2.4-develop December 5, 2019 17:19
@m2-assistant
Copy link

m2-assistant bot commented Feb 7, 2020

Hi @carusogabriel, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

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