Skip to content
Permalink
Browse files

Always import classes.

  • Loading branch information...
ndm2
ndm2 committed Sep 23, 2015
1 parent 3ac3154 commit c8d3974a48489e22a873e39bcd663db6ac2dd773
Showing with 227 additions and 139 deletions.
  1. +13 −9 src/Cache/Engine/FileEngine.php
  2. +2 −1 src/Collection/Collection.php
  3. +2 −1 src/Collection/CollectionTrait.php
  4. +2 −1 src/Collection/ExtractTrait.php
  5. +4 −2 src/Collection/Iterator/MapReduce.php
  6. +2 −1 src/Collection/Iterator/NestIterator.php
  7. +2 −1 src/Collection/Iterator/SortIterator.php
  8. +2 −1 src/Console/ConsoleInputArgument.php
  9. +2 −1 src/Console/ConsoleInputOption.php
  10. +2 −1 src/Console/ConsoleInputSubcommand.php
  11. +2 −1 src/Console/HelpFormatter.php
  12. +4 −2 src/Console/Shell.php
  13. +2 −1 src/Controller/Component/FlashComponent.php
  14. +4 −3 src/Database/Connection.php
  15. +2 −1 src/Database/Dialect/MysqlDialectTrait.php
  16. +2 −1 src/Database/Dialect/PostgresDialectTrait.php
  17. +2 −1 src/Database/Dialect/SqliteDialectTrait.php
  18. +2 −1 src/Database/Dialect/SqlserverDialectTrait.php
  19. +2 −1 src/Database/Driver.php
  20. +2 −1 src/Database/Driver/Mysql.php
  21. +2 −1 src/Database/Driver/Postgres.php
  22. +2 −1 src/Database/Driver/Sqlite.php
  23. +2 −1 src/Database/Driver/Sqlserver.php
  24. +2 −1 src/Database/Expression/QueryExpression.php
  25. +2 −1 src/Database/Log/LoggingStatement.php
  26. +2 −1 src/Database/Schema/Collection.php
  27. +3 −1 src/Database/Statement/StatementDecorator.php
  28. +6 −3 src/Database/Type/DateTimeType.php
  29. +3 −2 src/Database/Type/DateType.php
  30. +2 −1 src/Database/Type/FloatType.php
  31. +2 −1 src/Datasource/QueryTrait.php
  32. +2 −1 src/Datasource/ResultSetDecorator.php
  33. +6 −4 src/Error/Debugger.php
  34. +7 −6 src/Error/ExceptionRenderer.php
  35. +1 −1 src/Event/EventManager.php
  36. +12 −8 src/Filesystem/Folder.php
  37. +9 −7 src/I18n/Time.php
  38. +2 −1 src/I18n/TranslatorRegistry.php
  39. +2 −1 src/Mailer/Transport/SmtpTransport.php
  40. +3 −2 src/Network/Http/FormData.php
  41. +6 −4 src/Network/Response.php
  42. +2 −1 src/Network/Socket.php
  43. +4 −2 src/ORM/Association/BelongsToMany.php
  44. +2 −1 src/ORM/Association/HasMany.php
  45. +4 −2 src/ORM/Behavior.php
  46. +4 −2 src/ORM/Behavior/TimestampBehavior.php
  47. +4 −3 src/ORM/Marshaller.php
  48. +2 −1 src/ORM/Query.php
  49. +2 −2 src/ORM/Table.php
  50. +2 −1 src/Routing/Filter/ControllerFactoryFilter.php
  51. +2 −1 src/Shell/CommandListShell.php
  52. +2 −1 src/Shell/I18nShell.php
  53. +5 −3 src/TestSuite/Fixture/FixtureManager.php
  54. +6 −5 src/TestSuite/Fixture/TestFixture.php
  55. +2 −1 src/TestSuite/TestCase.php
  56. +2 −1 src/TestSuite/TestSuite.php
  57. +2 −1 src/Utility/Crypto/OpenSsl.php
  58. +11 −7 src/Utility/Xml.php
  59. +5 −4 src/Validation/Validation.php
  60. +2 −1 src/Validation/ValidationSet.php
  61. +2 −1 src/Validation/Validator.php
  62. +2 −1 src/View/Cell.php
  63. +6 −3 src/View/CellTrait.php
  64. +1 −1 src/View/Form/EntityContext.php
  65. +2 −1 src/View/Helper/FlashHelper.php
  66. +3 −2 src/View/Helper/TimeHelper.php
  67. +3 −3 src/View/View.php
  68. +8 −6 src/View/Widget/DateTimeWidget.php
@@ -18,6 +18,10 @@
use Cake\Utility\Inflector;
use Exception;
use LogicException;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use SplFileInfo;
use SplFileObject;
/**
* File Storage engine for cache. Filestorage is the slowest cache storage
@@ -264,10 +268,10 @@ public function clear($check)
$this->_clearDirectory($this->_config['path'], $now, $threshold);
$directory = new \RecursiveDirectoryIterator($this->_config['path']);
$contents = new \RecursiveIteratorIterator(
$directory = new RecursiveDirectoryIterator($this->_config['path']);
$contents = new RecursiveIteratorIterator(
$directory,
\RecursiveIteratorIterator::SELF_FIRST
RecursiveIteratorIterator::SELF_FIRST
);
$cleared = [];
foreach ($contents as $path) {
@@ -306,7 +310,7 @@ protected function _clearDirectory($path, $now, $threshold)
}
try {
$file = new \SplFileObject($path . $entry, 'r');
$file = new SplFileObject($path . $entry, 'r');
} catch (Exception $e) {
continue;
}
@@ -378,7 +382,7 @@ protected function _setKey($key, $createKey = false)
if (!is_dir($dir)) {
mkdir($dir, 0775, true);
}
$path = new \SplFileInfo($dir . $key);
$path = new SplFileInfo($dir . $key);
if (!$createKey && !$path->isFile()) {
return false;
@@ -411,7 +415,7 @@ protected function _setKey($key, $createKey = false)
*/
protected function _active()
{
$dir = new \SplFileInfo($this->_config['path']);
$dir = new SplFileInfo($this->_config['path']);
$path = $dir->getPathname();
if (!is_dir($path)) {
mkdir($path, 0775, true);
@@ -457,10 +461,10 @@ public function key($key)
public function clearGroup($group)
{
$this->_File = null;
$directoryIterator = new \RecursiveDirectoryIterator($this->_config['path']);
$contents = new \RecursiveIteratorIterator(
$directoryIterator = new RecursiveDirectoryIterator($this->_config['path']);
$contents = new RecursiveIteratorIterator(
$directoryIterator,
\RecursiveIteratorIterator::CHILD_FIRST
RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($contents as $object) {
$containsGroup = strpos($object->getPathname(), DS . $group . DS) !== false;
@@ -18,6 +18,7 @@
use InvalidArgumentException;
use IteratorIterator;
use Serializable;
use Traversable;
/**
* A collection is an immutable list of elements with a handful of functions to
@@ -40,7 +41,7 @@ public function __construct($items)
$items = new ArrayIterator($items);
}
if (!($items instanceof \Traversable)) {
if (!($items instanceof Traversable)) {
$msg = 'Only an array or \Traversable is allowed for Collection';
throw new InvalidArgumentException($msg);
}
@@ -31,6 +31,7 @@
use Countable;
use LimitIterator;
use RecursiveIteratorIterator;
use Traversable;
/**
* Offers a handful of method to manipulate iterators
@@ -164,7 +165,7 @@ public function extract($matcher)
if (is_string($matcher) && strpos($matcher, '{*}') !== false) {
$extractor = $extractor
->filter(function ($data) {
return $data !== null && ($data instanceof \Traversable || is_array($data));
return $data !== null && ($data instanceof Traversable || is_array($data));
})
->unfold();
}
@@ -13,6 +13,7 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Collection;
use Traversable;
/**
* Provides utility protected methods for extracting a property or column
@@ -70,7 +71,7 @@ protected function _extract($data, $path)
}
if ($collectionTransform &&
!($data instanceof \Traversable || is_array($data))) {
!($data instanceof Traversable || is_array($data))) {
return null;
}
@@ -15,6 +15,8 @@
use ArrayIterator;
use IteratorAggregate;
use LogicException;
use Traversable;
/**
* Implements a simplistic version of the popular Map-Reduce algorithm. Acts
@@ -111,7 +113,7 @@ class MapReduce implements IteratorAggregate
* of the bucket that was created during the mapping phase and third one is an
* instance of this class.
*/
public function __construct(\Traversable $data, callable $mapper, callable $reducer = null)
public function __construct(Traversable $data, callable $mapper, callable $reducer = null)
{
$this->_data = $data;
$this->_mapper = $mapper;
@@ -177,7 +179,7 @@ protected function _execute()
$this->_data = null;
if (!empty($this->_intermediate) && empty($this->_reducer)) {
throw new \LogicException('No reducer function was provided');
throw new LogicException('No reducer function was provided');
}
$reducer = $this->_reducer;
@@ -16,6 +16,7 @@
use Cake\Collection\Collection;
use RecursiveIterator;
use Traversable;
/**
* A type of collection that is aware of nested items and exposes methods to
@@ -71,6 +72,6 @@ public function hasChildren()
return !empty($children);
}
return $children instanceof \Traversable;
return $children instanceof Traversable;
}
}
@@ -15,6 +15,7 @@
namespace Cake\Collection\Iterator;
use Cake\Collection\Collection;
use DateTime;
/**
* An iterator that will return the passed items in order. The order is given by
@@ -67,7 +68,7 @@ public function __construct($items, $callback, $dir = SORT_DESC, $type = SORT_NU
$results = [];
foreach ($items as $key => $value) {
$value = $callback($value);
if ($value instanceof \DateTime && $type === SORT_NUMERIC) {
if ($value instanceof DateTime && $type === SORT_NUMERIC) {
$value = $value->format('U');
}
$results[$key] = $value;
@@ -15,6 +15,7 @@
namespace Cake\Console;
use Cake\Console\Exception\ConsoleException;
use SimpleXmlElement;
/**
* An object to represent a single argument used in the command line.
@@ -177,7 +178,7 @@ public function validChoice($value)
* @param \SimpleXmlElement $parent The parent element.
* @return \SimpleXmlElement The parent with this argument appended.
*/
public function xml(\SimpleXmlElement $parent)
public function xml(SimpleXmlElement $parent)
{
$option = $parent->addChild('argument');
$option->addAttribute('name', $this->_name);
@@ -15,6 +15,7 @@
namespace Cake\Console;
use Cake\Console\Exception\ConsoleException;
use SimpleXmlElement;
/**
* An object to represent a single option used in the command line.
@@ -213,7 +214,7 @@ public function validChoice($value)
* @param \SimpleXmlElement $parent The parent element.
* @return \SimpleXmlElement The parent with this option appended.
*/
public function xml(\SimpleXmlElement $parent)
public function xml(SimpleXmlElement $parent)
{
$option = $parent->addChild('option');
$option->addAttribute('name', '--' . $this->_name);
@@ -15,6 +15,7 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Console;
use SimpleXmlElement;
/**
* An object to represent a single subcommand used in the command line.
@@ -115,7 +116,7 @@ public function parser()
* @param \SimpleXmlElement $parent The parent element.
* @return \SimpleXmlElement The parent with this subcommand appended.
*/
public function xml(\SimpleXmlElement $parent)
public function xml(SimpleXmlElement $parent)
{
$command = $parent->addChild('command');
$command->addAttribute('name', $this->_name);
@@ -15,6 +15,7 @@
namespace Cake\Console;
use Cake\Utility\Text;
use SimpleXmlElement;
/**
* HelpFormatter formats help for console shells. Can format to either
@@ -188,7 +189,7 @@ protected function _getMaxLength($collection)
public function xml($string = true)
{
$parser = $this->_parser;
$xml = new \SimpleXmlElement('<shell></shell>');
$xml = new SimpleXmlElement('<shell></shell>');
$xml->addChild('command', $parser->command());
$xml->addChild('description', $parser->description());
@@ -24,6 +24,8 @@
use Cake\Utility\Inflector;
use Cake\Utility\MergeVariablesTrait;
use Cake\Utility\Text;
use ReflectionException;
use ReflectionMethod;
/**
* Base class for command-line utilities for automating programmer chores.
@@ -271,12 +273,12 @@ public function hasTask($task)
public function hasMethod($name)
{
try {
$method = new \ReflectionMethod($this, $name);
$method = new ReflectionMethod($this, $name);
if (!$method->isPublic()) {
return false;
}
return $method->getDeclaringClass()->name !== 'Cake\Console\Shell';
} catch (\ReflectionException $e) {
} catch (ReflectionException $e) {
return false;
}
}
@@ -18,6 +18,7 @@
use Cake\Controller\ComponentRegistry;
use Cake\Network\Exception\InternalErrorException;
use Cake\Utility\Inflector;
use Exception;
/**
* The CakePHP FlashComponent provides a way for you to write a flash variable
@@ -82,7 +83,7 @@ public function set($message, array $options = [])
{
$options += $this->config();
if ($message instanceof \Exception) {
if ($message instanceof Exception) {
$options['params'] += ['code' => $message->getCode()];
$message = $message->getMessage();
}
@@ -24,6 +24,7 @@
use Cake\Database\Schema\Collection as SchemaCollection;
use Cake\Database\ValueBinder;
use Cake\Datasource\ConnectionInterface;
use Exception;
/**
* Represents a connection with a database server.
@@ -180,7 +181,7 @@ public function connect()
try {
$this->_driver->connect();
return true;
} catch (\Exception $e) {
} catch (Exception $e) {
throw new MissingConnectionException(['reason' => $e->getMessage()]);
}
}
@@ -544,7 +545,7 @@ public function transactional(callable $callback)
try {
$result = $callback($this);
} catch (\Exception $e) {
} catch (Exception $e) {
$this->rollback();
throw $e;
}
@@ -575,7 +576,7 @@ public function disableConstraints(callable $callback)
try {
$result = $callback($this);
} catch (\Exception $e) {
} catch (Exception $e) {
$this->enableForeignKeys();
throw $e;
}
@@ -14,6 +14,7 @@
*/
namespace Cake\Database\Dialect;
use Cake\Database\Schema\MysqlSchema;
use Cake\Database\SqlDialectTrait;
/**
@@ -59,7 +60,7 @@ trait MysqlDialectTrait
public function schemaDialect()
{
if (!$this->_schemaDialect) {
$this->_schemaDialect = new \Cake\Database\Schema\MysqlSchema($this);
$this->_schemaDialect = new MysqlSchema($this);
}
return $this->_schemaDialect;
}
@@ -15,6 +15,7 @@
namespace Cake\Database\Dialect;
use Cake\Database\Expression\FunctionExpression;
use Cake\Database\Schema\PostgresSchema;
use Cake\Database\SqlDialectTrait;
/**
@@ -161,7 +162,7 @@ protected function _transformFunctionExpression(FunctionExpression $expression)
public function schemaDialect()
{
if (!$this->_schemaDialect) {
$this->_schemaDialect = new \Cake\Database\Schema\PostgresSchema($this);
$this->_schemaDialect = new PostgresSchema($this);
}
return $this->_schemaDialect;
}
@@ -16,6 +16,7 @@
use Cake\Database\ExpressionInterface;
use Cake\Database\Expression\FunctionExpression;
use Cake\Database\Schema\SqliteSchema;
use Cake\Database\SqlDialectTrait;
use Cake\Database\SqliteCompiler;
@@ -212,7 +213,7 @@ protected function _insertQueryTranslator($query)
public function schemaDialect()
{
if (!$this->_schemaDialect) {
$this->_schemaDialect = new \Cake\Database\Schema\SqliteSchema($this);
$this->_schemaDialect = new SqliteSchema($this);
}
return $this->_schemaDialect;
}
@@ -18,6 +18,7 @@
use Cake\Database\Expression\OrderByExpression;
use Cake\Database\Expression\UnaryExpression;
use Cake\Database\Query;
use Cake\Database\Schema\SqlserverSchema;
use Cake\Database\SqlDialectTrait;
use Cake\Database\SqlserverCompiler;
use PDO;
@@ -281,7 +282,7 @@ protected function _transformFunctionExpression(FunctionExpression $expression)
*/
public function schemaDialect()
{
return new \Cake\Database\Schema\SqlserverSchema($this);
return new SqlserverSchema($this);
}
/**
Oops, something went wrong.

0 comments on commit c8d3974

Please sign in to comment.
You can’t perform that action at this time.