rfc:variadic_empty
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
rfc:variadic_empty [2015/02/20 11:46] – created tpunt | rfc:variadic_empty [2015/03/28 15:54] – tpunt | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== PHP RFC: Your Title Here ====== | + | ====== PHP RFC: Make empty() a Variadic |
* Version: 0.1 | * Version: 0.1 | ||
* Date: 2015-02-20 | * Date: 2015-02-20 | ||
* Author: Thomas Punt, tpunt@hotmail.co.uk | * Author: Thomas Punt, tpunt@hotmail.co.uk | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | This RFC aims to make the '' | + | This RFC aims make '' |
<code php> | <code php> | ||
- | // current usage 1: | + | // example |
- | if (empty($a) || empty($b) || empty($c)) { | + | if (empty($a) || empty($b) || empty($c)) {} |
- | // | + | |
- | } | + | |
- | // proposed | + | // example current |
- | if (empty($a, $b, $c)) { | + | if (!empty($a) && !empty($b) && !empty($c)) {} |
- | // error here | + | |
- | } | + | |
- | // current | + | // new proposed |
- | if (!empty($a) && !empty($b) && !empty($c)) { | + | if (empty($a, $b, $c)) {} |
- | // all good! | + | |
- | } | + | |
- | // proposed usage 2: | + | // new proposed usage #2: |
- | if (!empty($a, $b, $c)) { | + | if (!empty($a, $b, $c)) {} |
- | // all good! | + | |
- | } | + | |
</ | </ | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | By making | + | The proposal is to change |
- | ===== Backward Incompatible Changes ===== | + | As the above snippet demonstrates, the semantics of a variadic '' |
- | What breaks, and what is the justification for it? | + | |
- | ===== Proposed PHP Version(s) | + | ===== Justification |
- | List the proposed PHP versions that the feature will be included in. Use relative versions such as "next PHP 5.x" or "next PHP 5.x.y" | + | |
- | ===== RFC Impact ===== | + | In PHP, it is not uncommon |
- | ==== To SAPIs ==== | + | |
- | Describe the impact | + | |
- | ==== To Existing Extensions ==== | + | WordPress (( https:// |
- | Will existing extensions be affected? | + | <code php> |
+ | if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args[' | ||
+ | </ | ||
+ | OpenCart (( https:// | ||
+ | <code php> | ||
+ | if (empty($setting[' | ||
+ | </ | ||
+ | phpBB (( https:// | ||
+ | <code php> | ||
+ | return !( | ||
+ | empty($this-> | ||
+ | empty($this-> | ||
+ | empty($this-> | ||
+ | empty($this-> | ||
+ | !@extension_loaded(' | ||
+ | ); | ||
+ | </ | ||
- | ==== To Opcache ==== | + | And so on... |
- | It is necessary to develop RFC's with opcache in mind, since opcache is a core extension distributed with PHP. | + | |
- | Please explain how you have verified your RFC' | + | So this seems like quite a common need for users, and one that cannot be emulated in user-land code because of '' |
- | ==== New Constants ==== | + | This change will also make '' |
- | Describe any new constants so they can be accurately and comprehensively explained in the PHP documentation. | + | |
- | ==== php.ini Defaults | + | ===== Backward Incompatible Changes ===== |
- | If there are any php.ini settings then list: | + | No BC breakages. |
- | * hardcoded default values | + | |
- | * php.ini-development values | + | |
- | * php.ini-production values | + | |
- | ===== Open Issues | + | ===== Proposed PHP Version(s) |
- | Make sure there are no open issues when the vote starts! | + | PHP 7.0 |
===== Unaffected PHP Functionality ===== | ===== Unaffected PHP Functionality ===== | ||
- | List existing areas/ | + | The current functionality |
- | This helps avoid any ambiguity, shows that you have thought deeply about the RFC's impact, and helps reduces mail list noise. | + | ===== Vote ===== |
+ | Because this is a language change, a 2/3 majority is required. It is a simple yes/no vote on whether | ||
- | ===== Future Scope ===== | + | <doodle title="Make empty() a Variadic" |
- | This sections details areas where the feature might be improved in future, but that are not currently proposed in this RFC. | + | * Yes |
+ | * No | ||
+ | </ | ||
- | ===== Proposed | + | Voting |
- | Include these so readers know where you are heading | + | |
- | + | ||
- | State whether this project requires a 2/3 or 50%+1 majority (see [[voting]]) | + | |
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
- | Links to any external patches and tests go here. | ||
- | |||
- | If there is no patch, make it clear who will create a patch, or whether a volunteer to help with implementation is needed. | ||
- | |||
- | Make it clear if the patch is intended to be the final patch, or is just a prototype. | ||
- | |||
- | ===== Implementation ===== | ||
- | After the project is implemented, | ||
- | - the version(s) it was merged to | ||
- | - a link to the git commit(s) | ||
- | - a link to the PHP manual entry for the feature | ||
- | |||
- | ===== References ===== | ||
- | Links to external references, discussions or RFCs | ||
- | ===== Rejected Features ===== | + | PR: https:// |
- | Keep this updated with features that were discussed on the mail lists. | + |
rfc/variadic_empty.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1