PSR-2 try-catch statement

This commit is contained in:
Alexander Mohorev
2015-06-08 23:32:08 +03:00
parent 789cdfea86
commit 38ca276e1f
3 changed files with 3 additions and 3 deletions

View File

@ -96,7 +96,7 @@ class Widget extends Component implements ViewContextInterface
$config['class'] = get_called_class(); $config['class'] = get_called_class();
$widget = Yii::createObject($config); $widget = Yii::createObject($config);
$out = $widget->run(); $out = $widget->run();
} catch(\Exception $e) { } catch (\Exception $e) {
// close the output buffer opened above if it has not been closed already // close the output buffer opened above if it has not been closed already
if(ob_get_level() > 0) { if(ob_get_level() > 0) {
ob_end_clean(); ob_end_clean();

View File

@ -461,7 +461,7 @@ class BaseFileHelper
try { try {
$result = mkdir($path, $mode); $result = mkdir($path, $mode);
chmod($path, $mode); chmod($path, $mode);
} catch(\Exception $e) { } catch (\Exception $e) {
throw new \yii\base\Exception("Failed to create directory '$path': " . $e->getMessage(), $e->getCode(), $e); throw new \yii\base\Exception("Failed to create directory '$path': " . $e->getMessage(), $e->getCode(), $e);
} }

View File

@ -658,7 +658,7 @@ class Formatter extends Component
} else { } else {
return new DateTime($value, new DateTimeZone($this->defaultTimeZone)); return new DateTime($value, new DateTimeZone($this->defaultTimeZone));
} }
} catch(\Exception $e) { } catch (\Exception $e) {
throw new InvalidParamException("'$value' is not a valid date time value: " . $e->getMessage() throw new InvalidParamException("'$value' is not a valid date time value: " . $e->getMessage()
. "\n" . print_r(DateTime::getLastErrors(), true), $e->getCode(), $e); . "\n" . print_r(DateTime::getLastErrors(), true), $e->getCode(), $e);
} }