Skip to content

Commit

Permalink
Merge pull request #9691 from cakephp/master-fqcn
Browse files Browse the repository at this point in the history
Remove inline FQCN into use statements.
  • Loading branch information
markstory committed Nov 2, 2016
2 parents 5684659 + 8ebb54d commit 1a1263e
Show file tree
Hide file tree
Showing 35 changed files with 152 additions and 149 deletions.
2 changes: 1 addition & 1 deletion src/Collection/CollectionTrait.php
Expand Up @@ -371,7 +371,7 @@ public function last()
*/
public function append($items)
{
$list = new AppendIterator;
$list = new AppendIterator();
$list->append($this->unwrap());
$list->append((new Collection($items))->unwrap());

Expand Down
2 changes: 1 addition & 1 deletion src/Collection/Iterator/BufferedIterator.php
Expand Up @@ -77,7 +77,7 @@ class BufferedIterator extends Collection implements Countable, Serializable
*/
public function __construct($items)
{
$this->_buffer = new SplDoublyLinkedList;
$this->_buffer = new SplDoublyLinkedList();
parent::__construct($items);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Controller.php
Expand Up @@ -245,7 +245,7 @@ public function __construct(Request $request = null, Response $response = null,
}

$this->setRequest($request !== null ? $request : new Request);
$this->response = $response !== null ? $response : new Response;
$this->response = $response !== null ? $response : new Response();

if ($eventManager !== null) {
$this->eventManager($eventManager);
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Plugin.php
Expand Up @@ -158,7 +158,7 @@ public static function load($plugin, array $config = [])

if ($config['autoload'] === true) {
if (empty(static::$_loader)) {
static::$_loader = new ClassLoader;
static::$_loader = new ClassLoader();
static::$_loader->register();
}
static::$_loader->addNamespace(
Expand Down
4 changes: 2 additions & 2 deletions src/Database/Connection.php
Expand Up @@ -690,7 +690,7 @@ public function logger($instance = null)
{
if ($instance === null) {
if ($this->_logger === null) {
$this->_logger = new QueryLogger;
$this->_logger = new QueryLogger();
}

return $this->_logger;
Expand All @@ -706,7 +706,7 @@ public function logger($instance = null)
*/
public function log($sql)
{
$query = new LoggedQuery;
$query = new LoggedQuery();
$query->query = $sql;
$this->logger()->log($query);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Driver.php
Expand Up @@ -340,7 +340,7 @@ public function compileQuery(Query $query, ValueBinder $generator)
*/
public function newCompiler()
{
return new QueryCompiler;
return new QueryCompiler();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Database/Query.php
Expand Up @@ -1583,7 +1583,7 @@ public function newExpr($rawExpression = null)
public function func()
{
if (empty($this->_functionsBuilder)) {
$this->_functionsBuilder = new FunctionsBuilder;
$this->_functionsBuilder = new FunctionsBuilder();
}

return $this->_functionsBuilder;
Expand Down Expand Up @@ -1763,7 +1763,7 @@ public function valueBinder($binder = null)
{
if ($binder === null) {
if ($this->_valueBinder === null) {
$this->_valueBinder = new ValueBinder;
$this->_valueBinder = new ValueBinder();
}

return $this->_valueBinder;
Expand Down
2 changes: 1 addition & 1 deletion src/Datasource/RulesAwareTrait.php
Expand Up @@ -49,7 +49,7 @@ trait RulesAwareTrait
public function checkRules(EntityInterface $entity, $operation = RulesChecker::CREATE, $options = null)
{
$rules = $this->rulesChecker();
$options = $options ?: new ArrayObject;
$options = $options ?: new ArrayObject();
$options = is_array($options) ? new ArrayObject($options) : $options;
$hasEvents = ($this instanceof EventDispatcherInterface);

Expand Down
2 changes: 1 addition & 1 deletion src/I18n/ChainMessagesLoader.php
Expand Up @@ -76,6 +76,6 @@ public function __invoke()
}
}

return new Package;
return new Package();
}
}
4 changes: 2 additions & 2 deletions src/I18n/I18n.php
Expand Up @@ -66,10 +66,10 @@ public static function translators()
new PackageLocator,
new FormatterLocator([
'sprintf' => function () {
return new SprintfFormatter;
return new SprintfFormatter();
},
'default' => function () {
return new IcuFormatter;
return new IcuFormatter();
},
]),
new TranslatorFactory,
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Association/BelongsToMany.php
Expand Up @@ -818,7 +818,7 @@ function () use ($sourceEntity, $targetEntities, $options) {
return true;
}

$storage = new SplObjectStorage;
$storage = new SplObjectStorage();
foreach ($targetEntities as $e) {
$storage->attach($e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Query.php
Expand Up @@ -231,7 +231,7 @@ public function eagerLoader(EagerLoader $instance = null)
{
if ($instance === null) {
if ($this->_eagerLoader === null) {
$this->_eagerLoader = new EagerLoader;
$this->_eagerLoader = new EagerLoader();
}

return $this->_eagerLoader;
Expand Down
6 changes: 3 additions & 3 deletions src/Validation/Validator.php
Expand Up @@ -155,7 +155,7 @@ public function errors(array $data, $newRecord = true)
public function field($name, ValidationSet $set = null)
{
if (empty($this->_fields[$name])) {
$set = $set ?: new ValidationSet;
$set = $set ?: new ValidationSet();
$this->_fields[$name] = $set;
}

Expand Down Expand Up @@ -193,7 +193,7 @@ public function provider($name, $object = null)
return $this->_providers[$name];
}
if ($name === 'default') {
return $this->_providers[$name] = new RulesProvider;
return $this->_providers[$name] = new RulesProvider();
}

return null;
Expand Down Expand Up @@ -245,7 +245,7 @@ public function offsetGet($field)
public function offsetSet($field, $rules)
{
if (!$rules instanceof ValidationSet) {
$set = new ValidationSet;
$set = new ValidationSet();
foreach ((array)$rules as $name => $rule) {
$set->add($name, $rule);
}
Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/Cache/Engine/MemcachedEngineTest.php
Expand Up @@ -16,9 +16,8 @@

use Cake\Cache\Cache;
use Cake\Cache\Engine\MemcachedEngine;
use Cake\Core\Configure;
use Cake\TestSuite\TestCase;
use \Memcached;
use Memcached;

/**
* TestMemcachedEngine
Expand Down
Expand Up @@ -21,6 +21,7 @@
use Cake\Datasource\ConnectionManager;
use Cake\Network\Exception\NotFoundException;
use Cake\Network\Request;
use Cake\ORM\Entity;
use Cake\ORM\TableRegistry;
use Cake\TestSuite\TestCase;

Expand Down Expand Up @@ -930,7 +931,7 @@ public function testPaginateCustomFind()

$table = TableRegistry::get('PaginatorPosts');
$data = ['author_id' => 3, 'title' => 'Fourth Post', 'body' => 'Article Body, unpublished', 'published' => 'N'];
$result = $table->save(new \Cake\ORM\Entity($data));
$result = $table->save(new Entity($data));
$this->assertNotEmpty($result);

$result = $this->Paginator->paginate($table);
Expand Down Expand Up @@ -985,7 +986,7 @@ public function testPaginateCustomFindFieldsArray()
$this->loadFixtures('Posts');
$table = TableRegistry::get('PaginatorPosts');
$data = ['author_id' => 3, 'title' => 'Fourth Article', 'body' => 'Article Body, unpublished', 'published' => 'N'];
$table->save(new \Cake\ORM\Entity($data));
$table->save(new Entity($data));

$settings = [
'finder' => 'list',
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Database/Driver/MysqlTest.php
Expand Up @@ -16,7 +16,7 @@

use Cake\Datasource\ConnectionManager;
use Cake\TestSuite\TestCase;
use \PDO;
use PDO;

/**
* Tests Mysql driver
Expand Down
7 changes: 4 additions & 3 deletions tests/TestCase/Database/Driver/PostgresTest.php
Expand Up @@ -14,8 +14,9 @@
*/
namespace Cake\Test\TestCase\Database\Driver;

use Cake\Database\Query;
use Cake\TestSuite\TestCase;
use \PDO;
use PDO;

/**
* Tests Postgres driver
Expand Down Expand Up @@ -155,15 +156,15 @@ public function testInsertReturning()
->disableOriginalConstructor()
->getMock();

$query = new \Cake\Database\Query($connection);
$query = new Query($connection);
$query->insert(['id', 'title'])
->into('articles')
->values([1, 'foo']);
$translator = $driver->queryTranslator('insert');
$query = $translator($query);
$this->assertEquals('RETURNING *', $query->clause('epilog'));

$query = new \Cake\Database\Query($connection);
$query = new Query($connection);
$query->insert(['id', 'title'])
->into('articles')
->values([1, 'foo'])
Expand Down
22 changes: 11 additions & 11 deletions tests/TestCase/Database/Driver/SqlserverTest.php
Expand Up @@ -14,9 +14,9 @@
*/
namespace Cake\Test\TestCase\Database\Driver;

use Cake\Core\Configure;
use Cake\Database\Query;
use Cake\TestSuite\TestCase;
use \PDO;
use PDO;

/**
* Tests Sqlserver driver
Expand Down Expand Up @@ -119,28 +119,28 @@ public function testSelectLimitVersion12()
->method('driver')
->will($this->returnValue($driver));

$query = new \Cake\Database\Query($connection);
$query = new Query($connection);
$query->select(['id', 'title'])
->from('articles')
->order(['id'])
->offset(10);
$this->assertEquals('SELECT id, title FROM articles ORDER BY id OFFSET 10 ROWS', $query->sql());

$query = new \Cake\Database\Query($connection);
$query = new Query($connection);
$query->select(['id', 'title'])
->from('articles')
->order(['id'])
->limit(10)
->offset(50);
$this->assertEquals('SELECT id, title FROM articles ORDER BY id OFFSET 50 ROWS FETCH FIRST 10 ROWS ONLY', $query->sql());

$query = new \Cake\Database\Query($connection);
$query = new Query($connection);
$query->select(['id', 'title'])
->from('articles')
->offset(10);
$this->assertEquals('SELECT id, title FROM articles ORDER BY (SELECT NULL) OFFSET 10 ROWS', $query->sql());

$query = new \Cake\Database\Query($connection);
$query = new Query($connection);
$query->select(['id', 'title'])
->from('articles')
->limit(10);
Expand Down Expand Up @@ -172,14 +172,14 @@ public function testSelectLimitOldServer()
->method('driver')
->will($this->returnValue($driver));

$query = new \Cake\Database\Query($connection);
$query = new Query($connection);
$query->select(['id', 'title'])
->from('articles')
->limit(10);
$expected = 'SELECT TOP 10 id, title FROM articles';
$this->assertEquals($expected, $query->sql());

$query = new \Cake\Database\Query($connection);
$query = new Query($connection);
$query->select(['id', 'title'])
->from('articles')
->offset(10);
Expand All @@ -188,7 +188,7 @@ public function testSelectLimitOldServer()
'WHERE _cake_paging_._cake_page_rownum_ > 10';
$this->assertEquals($expected, $query->sql());

$query = new \Cake\Database\Query($connection);
$query = new Query($connection);
$query->select(['id', 'title'])
->from('articles')
->order(['id'])
Expand All @@ -198,7 +198,7 @@ public function testSelectLimitOldServer()
'WHERE _cake_paging_._cake_page_rownum_ > 10';
$this->assertEquals($expected, $query->sql());

$query = new \Cake\Database\Query($connection);
$query = new Query($connection);
$query->select(['id', 'title'])
->from('articles')
->order(['id'])
Expand Down Expand Up @@ -230,7 +230,7 @@ public function testInsertUsesOutput()
->expects($this->any())
->method('driver')
->will($this->returnValue($driver));
$query = new \Cake\Database\Query($connection);
$query = new Query($connection);
$query->insert(['title'])
->into('articles')
->values(['title' => 'A new article']);
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Database/Type/BinaryTypeTest.php
Expand Up @@ -16,7 +16,7 @@

use Cake\Database\Type;
use Cake\TestSuite\TestCase;
use \PDO;
use PDO;

/**
* Test for the Binary type.
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Database/Type/BoolTypeTest.php
Expand Up @@ -16,7 +16,7 @@

use Cake\Database\Type;
use Cake\TestSuite\TestCase;
use \PDO;
use PDO;

/**
* Test for the Boolean type.
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Database/Type/DecimalTypeTest.php
Expand Up @@ -18,7 +18,7 @@
use Cake\Database\Type\DecimalType;
use Cake\I18n\I18n;
use Cake\TestSuite\TestCase;
use \PDO;
use PDO;

/**
* Test for the Decimal type.
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Database/Type/FloatTypeTest.php
Expand Up @@ -18,7 +18,7 @@
use Cake\Database\Type\FloatType;
use Cake\I18n\I18n;
use Cake\TestSuite\TestCase;
use \PDO;
use PDO;

/**
* Test for the Float type.
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Database/Type/IntegerTypeTest.php
Expand Up @@ -16,7 +16,7 @@

use Cake\Database\Type;
use Cake\TestSuite\TestCase;
use \PDO;
use PDO;

/**
* Test for the Integer type.
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Database/Type/StringTypeTest.php
Expand Up @@ -16,7 +16,7 @@

use Cake\Database\Type;
use Cake\TestSuite\TestCase;
use \PDO;
use PDO;

/**
* Test for the String type.
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Database/Type/UuidTypeTest.php
Expand Up @@ -16,7 +16,7 @@

use Cake\Database\Type;
use Cake\TestSuite\TestCase;
use \PDO;
use PDO;

/**
* Test for the Uuid type.
Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/DatabaseSuite.php
Expand Up @@ -15,9 +15,8 @@
namespace Cake\Test\TestCase;

use Cake\Datasource\ConnectionManager;
use Cake\TestSuite\TestPermutationDecorator;
use Cake\TestSuite\TestSuite;
use \PHPUnit_Framework_TestResult;
use PHPUnit_Framework_TestResult;

/**
* All tests related to database
Expand Down

0 comments on commit 1a1263e

Please sign in to comment.