Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sgolemon/table-flip
Not the exceptions we need, but the ones we deserve.
https://github.com/sgolemon/table-flip
exceptions php silly
Last synced: 2 days ago
JSON representation
Not the exceptions we need, but the ones we deserve.
- Host: GitHub
- URL: https://github.com/sgolemon/table-flip
- Owner: sgolemon
- Created: 2016-05-26T04:10:47.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-08T15:47:06.000Z (about 7 years ago)
- Last Synced: 2024-11-06T17:09:23.771Z (5 days ago)
- Topics: exceptions, php, silly
- Language: PHP
- Homepage: https://packagist.org/packages/sgolemon/table-flip
- Size: 13.7 KB
- Stars: 339
- Watchers: 11
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-hilarious-repos - PHP Table Flip - if doesn't work, f\*ck this sh\*t (Libraries, Frameworks and SDKs)
README
Inspired by Adam Harvey: https://twitter.com/LGnome/status/735573024825430016
`if ($situation === SHIT::HAPPENED) {(╯°□°)╯︵┻━┻(); }`
Usages:
* throw new (╯°□°)╯︵┻━┻; // TableFlip
* throw new (ノ゜Д゜)ノ︵┻━┻; // PudgyTableFlip
* throw new (ノಥ益ಥ)ノ︵┻━┻; // AgroTableFlip
* (╯°□°)╯︵┻━┻(); // Function shorthand
* assert((╯°□°)╯︵┻━┻() ); // Use in an assert to only flip in devAll three table-flip classes extend \Exception and implement the ┻━┻ interface,
so the following works:```
try {
$ret = doSomething();
if ($ret === null) {
throw new (╯°□°)╯︵┻━┻;
} elseif ($ret === false) {
throw new (ノಥ益ಥ)ノ︵┻━┻;
} elseif (!is_string($ret)) {
throw new (ノ゜Д゜)ノ︵┻━┻;
}
} catch (┻━┻ $e) {
┬─┬ノ(・_・ノ);
}
```Note that the parentheses used in the class/function names here are
U+FF08 FULLWIDTH LEFT PARENTHESIS and U+FF09 FULLWIDTH RIGHT PARENTHESIS
since normal parens (U+0028/U+0029) are not allowed in PHP labels.Similarly, the customary space is omitted entirely to make this a valid PHP label.