Browse Source

Fixed BaseObject merge

tags/3.0.0-alpha1
Alexander Makarov 7 years ago
parent
commit
742e7b81f6
No known key found for this signature in database
GPG Key ID: 3617B79C6A325E4A
  1. 2
      build/controllers/PhpDocController.php
  2. 2
      framework/caching/MemCachedServer.php
  3. 4
      framework/mail/Composer.php
  4. 4
      framework/mail/Template.php
  5. 25
      tests/framework/base/BCObject.php
  6. 13
      tests/framework/base/BaseObjectTest.php
  7. 4
      tests/framework/di/ServiceLocatorTest.php

2
build/controllers/PhpDocController.php

@ -489,7 +489,7 @@ class PhpDocController extends Controller
return false;
}
if (!$ref->isSubclassOf('yii\base\Object') && $className != 'yii\base\Object' && !$ref->isSubclassOf('yii\base\BaseObject') && $className != 'yii\base\BaseObject') {
if (!$ref->isSubclassOf('yii\base\BaseObject') && $className !== 'yii\base\BaseObject') {
$this->stderr("[INFO] Skipping class $className as it is not a subclass of yii\\base\\BaseObject.\n", Console::FG_BLUE, Console::BOLD);
return false;
}

2
framework/caching/MemCachedServer.php

@ -18,7 +18,7 @@ namespace yii\caching;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class MemCachedServer extends \yii\base\Object
class MemCachedServer extends \yii\base\BaseObject
{
/**
* @var string memcached server hostname or IP address

4
framework/mail/Composer.php

@ -8,8 +8,8 @@
namespace yii\mail;
use Yii;
use yii\base\BaseObject;
use yii\base\InvalidConfigException;
use yii\base\Object;
use yii\web\View;
/**
@ -23,7 +23,7 @@ use yii\web\View;
* @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.1
*/
class Composer extends Object
class Composer extends BaseObject
{
/**
* @var string|bool HTML layout view name.

4
framework/mail/Template.php

@ -8,7 +8,7 @@
namespace yii\mail;
use Yii;
use yii\base\Object;
use yii\base\BaseObject;
use yii\base\ViewContextInterface;
/**
@ -24,7 +24,7 @@ use yii\base\ViewContextInterface;
* @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.1
*/
class Template extends Object implements ViewContextInterface
class Template extends BaseObject implements ViewContextInterface
{
/**
* @var MessageInterface related mail message instance.

25
tests/framework/base/BCObject.php

@ -1,25 +0,0 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yiiunit\framework\base;
use yii\base\Object;
class BCObject extends \yii\base\Object
{
public static $initCalled = false;
public function __construct($config = [])
{
Object::__construct($config);
}
public function init()
{
static::$initCalled = true;
}
}

13
tests/framework/base/BaseObjectTest.php

@ -153,19 +153,6 @@ class BaseObjectTest extends TestCase
$this->expectExceptionMessage('Getting write-only property: yiiunit\framework\base\NewObject::writeOnly');
$this->object->writeOnly;
}
public function testBackwardCompatibilityWithObject()
{
if (PHP_MAJOR_VERSION > 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION >= 2)) {
$this->markTestSkipped('This test is meant to run on PHP <7.2.0 to check BC with yii\base\Object');
}
$this->assertInstanceOf('yii\base\Object', new BCObject());
$this->assertInstanceOf('yii\base\BaseObject', new BCObject());
BCObject::$initCalled = false;
new BCObject();
$this->assertTrue(BCObject::$initCalled);
}
}

4
tests/framework/di/ServiceLocatorTest.php

@ -7,7 +7,7 @@
namespace yiiunit\framework\di;
use yii\base\Object;
use yii\base\BaseObject;
use yii\di\ServiceLocator;
use yiiunit\TestCase;
@ -19,7 +19,7 @@ class Creator
}
}
class TestClass extends Object
class TestClass extends BaseObject
{
public $prop1 = 1;
public $prop2;

Loading…
Cancel
Save