Commit d0ddb566 by Alexander Makarov

Fixes #699: fixed wrong usage of self and static

parent 4ccf0931
...@@ -54,7 +54,7 @@ class Widget extends Component implements ViewContextInterface ...@@ -54,7 +54,7 @@ class Widget extends Component implements ViewContextInterface
$config['class'] = get_called_class(); $config['class'] = get_called_class();
/** @var Widget $widget */ /** @var Widget $widget */
$widget = Yii::createObject($config); $widget = Yii::createObject($config);
self::$stack[] = $widget; static::$stack[] = $widget;
return $widget; return $widget;
} }
...@@ -67,8 +67,8 @@ class Widget extends Component implements ViewContextInterface ...@@ -67,8 +67,8 @@ class Widget extends Component implements ViewContextInterface
*/ */
public static function end() public static function end()
{ {
if (!empty(self::$stack)) { if (!empty(static::$stack)) {
$widget = array_pop(self::$stack); $widget = array_pop(static::$stack);
if (get_class($widget) === get_called_class()) { if (get_class($widget) === get_called_class()) {
echo $widget->run(); echo $widget->run();
return $widget; return $widget;
...@@ -108,7 +108,7 @@ class Widget extends Component implements ViewContextInterface ...@@ -108,7 +108,7 @@ class Widget extends Component implements ViewContextInterface
public function getId($autoGenerate = true) public function getId($autoGenerate = true)
{ {
if ($autoGenerate && $this->_id === null) { if ($autoGenerate && $this->_id === null) {
$this->_id = self::$autoIdPrefix . self::$counter++; $this->_id = static::$autoIdPrefix . static::$counter++;
} }
return $this->_id; return $this->_id;
......
...@@ -98,9 +98,9 @@ class GettextMessageSource extends MessageSource ...@@ -98,9 +98,9 @@ class GettextMessageSource extends MessageSource
{ {
$messageFile = Yii::getAlias($this->basePath) . '/' . $language . '/' . $this->catalog; $messageFile = Yii::getAlias($this->basePath) . '/' . $language . '/' . $this->catalog;
if ($this->useMoFile) { if ($this->useMoFile) {
$messageFile .= static::MO_FILE_EXT; $messageFile .= self::MO_FILE_EXT;
} else { } else {
$messageFile .= static::PO_FILE_EXT; $messageFile .= self::PO_FILE_EXT;
} }
return $messageFile; return $messageFile;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment