Opened 4 months ago
Closed 4 months ago
#64488 closed enhancement (fixed)
Code Modernization: replace if isset() return with null coalescing
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 7.0 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | General | Keywords: | has-patch commit |
| Focuses: | coding-standards | Cc: |
Description (last modified by )
In #63430 isset() ternary were replaced with null coalescing.
We also should replace if isset() return with null coalescing.
<?php - if (isset($this->items[$key])) { - return $this->items[$key]; - } - - return 'fallback value'; + return $this->items[$key] ?? 'fallback value';
This is part of #58874.
Change History (7)
This ticket was mentioned in PR #10703 on WordPress/wordpress-develop by @Soean.
4 months ago
#1
- Keywords has-patch added
#2
@
4 months ago
- Summary changed from Coding Standards: replace if isset() return with null coalescing to Code Modernization: replace if isset() return with null coalescing
- Type changed from defect (bug) to enhancement
#3
@
4 months ago
- Milestone changed from Awaiting Review to 7.0
- Owner set to westonruter
- Status changed from new to reviewing
@westonruter commented on PR #10703:
4 months ago
#5
@Soean I found some additional opportunities in de042b59f67db0d6014be62bbe83070962ce8ad1. Take a look.
Note: See
TracTickets for help on using
tickets.
Trac ticket: https://core.trac.wordpress.org/ticket/64488