mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 13:58:55 +08:00
PSR-2 try-catch statement
This commit is contained in:
@ -96,7 +96,7 @@ class Widget extends Component implements ViewContextInterface
|
||||
$config['class'] = get_called_class();
|
||||
$widget = Yii::createObject($config);
|
||||
$out = $widget->run();
|
||||
} catch(\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
// close the output buffer opened above if it has not been closed already
|
||||
if(ob_get_level() > 0) {
|
||||
ob_end_clean();
|
||||
|
||||
@ -461,7 +461,7 @@ class BaseFileHelper
|
||||
try {
|
||||
$result = mkdir($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);
|
||||
}
|
||||
|
||||
|
||||
@ -658,7 +658,7 @@ class Formatter extends Component
|
||||
} else {
|
||||
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()
|
||||
. "\n" . print_r(DateTime::getLastErrors(), true), $e->getCode(), $e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user