Browse Source

removed yii\base\Object::className()

it is easy to upgrade existing code and it serves no purpose since
::class syntax is available.
tags/3.0.0-alpha1
Carsten Brandt 9 years ago
parent
commit
0888d6967b
  1. 4
      framework/CHANGELOG.md
  2. 11
      framework/UPGRADE.md
  3. 11
      framework/base/Object.php

4
framework/CHANGELOG.md

@ -5,7 +5,9 @@ Yii Framework 2 Change Log
-----------------------
- Removed methods marked as deprected in 2.0.x (samdark)
- Chg #11397: Minimum required version of PHP is 5.6.0 now (samdark)
- Chg #11397: Minimum required version of PHP is 5.5.0 now (samdark)
- Chg: Removed `yii\base\Object::className()` in favor of native PHP syntax `::class`, which does not trigger autoloading (cebe)
2.0.9 under development
-----------------------

11
framework/UPGRADE.md

@ -18,7 +18,16 @@ php composer.phar global require "fxp/composer-asset-plugin:~1.1.1"
Upgrade to Yii 2.1.0
--------------------
* 5.6.0 is the minimum required version of PHP now.
* The minimum required PHP version is 5.5.0 now.
* `yii\base\Object::className()` has been removed in favor of the [native PHP syntax](http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class)
`::class`. When upgrading to Yii 2.1, You should do a global search and replace for `::className()` to `::class`.
All calls on objects via `->className()` should be replaced by a call to `get_class()`.
You can make this change even before upgrading to Yii 2.1, Yii 2.0.x does work with it.
`::class` does not trigger auto loading so you can even use it in config.
Upgrade from Yii 2.0.7
----------------------

11
framework/base/Object.php

@ -77,17 +77,6 @@ use Yii;
class Object implements Configurable
{
/**
* Returns the fully qualified name of this class.
* @return string the fully qualified name of this class.
* @deprecated since version 2.1. PHPs `::class` syntax should be used instead.
* For object instances, use `get_class()`.
*/
public static function className()
{
return get_called_class();
}
/**
* Constructor.
* The default implementation does two things:
*

Loading…
Cancel
Save