Advertisement
Guest User

Your thoughts on using class constants of an exception class

a guest
Mar 10th, 2020
657
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.41 KB | None | 0 0
  1. <?php
  2.  
  3. namespace mine;
  4. use RuntimeException;
  5. use Something as Controller;
  6.  
  7. class SomeKindOfException extends RuntimeException{
  8.     public const REASON1 = "Sorry, but you hit reason 1";
  9.     public const REASON2 = "Sorry, but you hit reason 2";
  10. }
  11.  
  12. class SomeController extends Controller{
  13.     public class somePublicAction(){
  14.         throw new SomeKindOfException(SomeKindOfException::REASON2);
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement