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 null coalescing operator #2543

Merged
merged 10 commits into from
Sep 12, 2022
Merged

Use null coalescing operator #2543

merged 10 commits into from
Sep 12, 2022

Conversation

sreichel
Copy link
Contributor

@sreichel sreichel commented Sep 3, 2022

Description (*)

There were a few comments in PRs to use null coalescing operator ... here we go.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)
  • Add yourself to contributors list

@github-actions github-actions bot added Component: AdminNotification Relates to Mage_AdminNotification Component: Adminhtml Relates to Mage_Adminhtml Component: Admin Relates to Mage_Admin Component: Api PageRelates to Mage_Api Component: Api2 Relates to Mage_Api2 Component: Authorizenet Relates to Mage_Authorizenet Component: Backup Relates to Mage_Backup Component: Bundle Relates to Mage_Bundle Component: Captcha Relates to Mage_Captcha Component: Catalog Relates to Mage_Catalog Component: CatalogInventory Relates to Mage_CatalogInventory Component: CatalogRule Relates to Mage_CatalogRule Component: CatalogSearch Relates to Mage_CatalogSearch Component: Centinel Relates to Mage_Centinel Component: Checkout Relates to Mage_Checkout Component: ConfigurableSwatches Relates to Mage_ConfigurableSwatches Component: Core Relates to Mage_Core Component: Customer Relates to Mage_Customer Component: Dataflow Relates to Mage_Dataflow Component: Directory Relates to Mage_Directory Component: Downloadable Relates to Mage_Downloadable Component: Eav Relates to Mage_Eav Component: ImportExport Relates to Mage_ImportExport Component: Index Relates to Mage_Index Component: Install Relates to Mage_Install Component: Log Relates to Mage_Log labels Sep 3, 2022
Sdfendor
Sdfendor previously approved these changes Sep 6, 2022
Copy link
Contributor

@Sdfendor Sdfendor left a comment

Choose a reason for hiding this comment

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

LGTM, great effort!

@sreichel sreichel requested a review from kiatng September 6, 2022 20:05
@fballiano
Copy link
Contributor

did you do this manually?

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@sreichel
Copy link
Contributor Author

sreichel commented Sep 6, 2022

did you do this manually?

PHPstorm shows possible usage of null coalescing operator ... i've run inspection for only that and changed that half-automated. (Y, i've checked every change)

fballiano
fballiano previously approved these changes Sep 6, 2022
Copy link
Contributor

@fballiano fballiano left a comment

Choose a reason for hiding this comment

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

i've no way of testing all this so i'll just trust the process :-)

@sreichel sreichel dismissed stale reviews from fballiano and Sdfendor via 4388124 September 9, 2022 11:08
Co-authored-by: Ng Kiat Siong <kiatsiong.ng@gmail.com>
@github-actions

This comment has been minimized.

$this->setAggregator($arr['aggregator'] ?? ($arr['attribute'] ?? null))
->setValue($arr['value'] ?? ($arr['operator'] ?? null));
$this->setAggregator($arr['aggregator'] ?? $arr['attribute'] ?? null)
->setValue($arr['value'] ?? $arr['operator'] ?? null);
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO this is hard to understard, extremely short code is already less easy on the brain, but this (to me) it's a no. with the parenthesis was a bit better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

imho ... for me its easier to read w/o parenthesis. I can revert it later if you think it was better before.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ref https://www.php.net/manual/en/migration70.new-features.php, the operator can be chained. With parenthesis, it defeats the feature.

Copy link
Contributor

Choose a reason for hiding this comment

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

Chaining seems to me a good argument against the additional parentheses.

kiatng
kiatng previously approved these changes Sep 9, 2022
Sdfendor
Sdfendor previously approved these changes Sep 9, 2022
@sreichel sreichel dismissed stale reviews from Sdfendor and kiatng via a09a053 September 9, 2022 15:41
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@fballiano fballiano merged commit 3c51a90 into 1.9.4.x Sep 12, 2022
@fballiano fballiano deleted the null-coalescing-operator branch September 12, 2022 07:39
@github-actions
Copy link
Contributor

Unit Test Results

1 files  ±0  1 suites  ±0   0s ⏱️ ±0s
0 tests ±0  0 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
7 runs  ±0  5 ✔️ ±0  2 💤 ±0  0 ❌ ±0 

Results for commit 3c51a90. ± Comparison against base commit d433ae9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Admin Relates to Mage_Admin Component: Adminhtml Relates to Mage_Adminhtml Component: AdminNotification Relates to Mage_AdminNotification Component: Api PageRelates to Mage_Api Component: Api2 Relates to Mage_Api2 Component: Authorizenet Relates to Mage_Authorizenet Component: Backup Relates to Mage_Backup Component: Bundle Relates to Mage_Bundle Component: Captcha Relates to Mage_Captcha Component: Catalog Relates to Mage_Catalog Component: CatalogInventory Relates to Mage_CatalogInventory Component: CatalogRule Relates to Mage_CatalogRule Component: CatalogSearch Relates to Mage_CatalogSearch Component: Centinel Relates to Mage_Centinel Component: Checkout Relates to Mage_Checkout Component: ConfigurableSwatches Relates to Mage_ConfigurableSwatches Component: Core Relates to Mage_Core Component: Customer Relates to Mage_Customer Component: Dataflow Relates to Mage_Dataflow Component: Directory Relates to Mage_Directory Component: Downloadable Relates to Mage_Downloadable Component: Eav Relates to Mage_Eav Component: ImportExport Relates to Mage_ImportExport Component: Index Relates to Mage_Index Component: Install Relates to Mage_Install Component: Log Relates to Mage_Log Component: Media Relates to Mage_Media Component: Oauth Relates to Mage_Oauth Component: Page Relates to Mage_Page Component: Paygate Relates to Mage_Paygate Component: Payment Relates to Mage_Payment Component: PayPal Relates to Mage_Paypal Component: Reports Relates to Mage_Reports Component: Review Relates to Mage_Review Component: Rss Relates to Mage_Rss Component: Rule Relates to Mage_Rule Component: Sales Relates to Mage_Sales Component: SalesRule Relates to Mage_SalesRule Component: Sendfriend Relates to Mage_Sendfriend Component: Shipping Relates to Mage_Shipping Component: Tax Relates to Mage_Tax Component: Uploader Relates to Mage_Uploader Component: Usa Relates to Mage_Usa Component: Weee Relates to Mage_Weee Component: Widget Relates to Mage_Widget Component: Wishlist Relates to Mage_Wishlist environment phpstan
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants