rfc:multiple-catch
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:multiple-catch [2016/03/08 18:17] – pierrick | rfc:multiple-catch [2016/04/18 04:40] – updates RFC status to 'Voting' marcio | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2016-03-06 | * Date: 2016-03-06 | ||
* Author: Pierrick Charron < | * Author: Pierrick Charron < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | When two different types of exceptions are handled the same way, it is sometimes required to duplicate code of the catch statements. | + | When two different types of exceptions are handled the same way, it is sometimes required to duplicate |
- | For exemple | + | For example |
<code php> | <code php> | ||
Line 26: | Line 26: | ||
</ | </ | ||
- | A solution to fix this problem on the user level would be to implement a common interface for ExceptionType1 and ExceptionType2 and catch it. However, this is only possible when you control the exception hierarchy in your own code, but not possible when you don't control the code. | + | A solution to fix this problem on the user level would be to implement a common interface for '' |
===== Proposal ===== | ===== Proposal ===== | ||
- | This RFC introduce | + | This RFC introduces |
<code php> | <code php> | ||
Line 45: | Line 45: | ||
This syntax and functionality is compatible with the Union types RFC proposed here : https:// | This syntax and functionality is compatible with the Union types RFC proposed here : https:// | ||
+ | |||
+ | ==== When is it usefull ? ==== | ||
+ | |||
+ | * When a single method/ | ||
+ | * When libraries are leaking their dependency' | ||
+ | |||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 63: | Line 69: | ||
==== To Opcache ==== | ==== To Opcache ==== | ||
None | None | ||
+ | |||
+ | ==== To PHP tools/IDE ==== | ||
+ | This change will require every PHP tools and IDE based on an AST parser to be modified to take this syntax change into account. | ||
===== Links and Literature ===== | ===== Links and Literature ===== | ||
Line 70: | Line 79: | ||
Request on StackOverflow: | Request on StackOverflow: | ||
- | ===== Proposed Voting Choices | + | ===== Vote ===== |
- | As this is a language change, a 2/3 majority is required. The vote is a straight Yes/No vote for accepting the RFC and merging the patch. | + | As this is a language change, a 2/3 majority is required. The vote is a straight Yes/No vote for accepting the RFC and merging the patch. |
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
- | Patch : [[https:// | + | Patch : [[https:// |
rfc/multiple-catch.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1