Last active
February 21, 2016 21:08
-
-
Save ggirtsou/ee09a5a053e0d17e8caa to your computer and use it in GitHub Desktop.
catch (Exception $e) is executed only in PHP 5.x, will not be reached in PHP 7, read: https://trowski.com/2015/06/24/throwable-exceptions-and-errors-in-php7/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(E_ALL); | |
ini_set('display_errors', true); | |
class MyObject { | |
public function getMyObject() : MyObject | |
{ | |
return null; | |
} | |
} | |
try | |
{ | |
$class = new MyObject(); | |
$class->getMyObject(); | |
} | |
catch(Throwable $e) | |
{ | |
// Catch the exception | |
echo 'catched'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment