diff --git a/src/Cache/Engine/FileEngine.php b/src/Cache/Engine/FileEngine.php index 9252607fd1a..ad24b764d8c 100644 --- a/src/Cache/Engine/FileEngine.php +++ b/src/Cache/Engine/FileEngine.php @@ -394,7 +394,8 @@ protected function _setKey($key, $createKey = false) if (!$createKey && !$path->isFile()) { return false; } - if (empty($this->_File) || + if ( + empty($this->_File) || $this->_File->getBasename() !== $key || $this->_File->valid() === false ) { diff --git a/src/Cache/Engine/MemcachedEngine.php b/src/Cache/Engine/MemcachedEngine.php index ff2b9cdcc44..c97745caedf 100644 --- a/src/Cache/Engine/MemcachedEngine.php +++ b/src/Cache/Engine/MemcachedEngine.php @@ -204,7 +204,8 @@ protected function _setOptions() ); } - if ($serializer !== 'php' && + if ( + $serializer !== 'php' && !constant('Memcached::HAVE_' . strtoupper($serializer)) ) { throw new InvalidArgumentException( @@ -218,7 +219,8 @@ protected function _setOptions() ); // Check for Amazon ElastiCache instance - if (defined('Memcached::OPT_CLIENT_MODE') && + if ( + defined('Memcached::OPT_CLIENT_MODE') && defined('Memcached::DYNAMIC_CLIENT_MODE') ) { $this->_Memcached->setOption( diff --git a/src/Collection/ExtractTrait.php b/src/Collection/ExtractTrait.php index b78094b92c7..5a7db8af5af 100644 --- a/src/Collection/ExtractTrait.php +++ b/src/Collection/ExtractTrait.php @@ -70,8 +70,10 @@ protected function _extract($data, $path) continue; } - if ($collectionTransform && - !($data instanceof Traversable || is_array($data))) { + if ( + $collectionTransform && + !($data instanceof Traversable || is_array($data)) + ) { return null; } diff --git a/src/Console/ConsoleOutput.php b/src/Console/ConsoleOutput.php index ed9affccd2a..0ba41906628 100644 --- a/src/Console/ConsoleOutput.php +++ b/src/Console/ConsoleOutput.php @@ -164,7 +164,8 @@ public function __construct($stream = 'php://stdout') { $this->_output = fopen($stream, 'wb'); - if ((DIRECTORY_SEPARATOR === '\\' && !(bool)env('ANSICON') && env('ConEmuANSI') !== 'ON') || + if ( + (DIRECTORY_SEPARATOR === '\\' && !(bool)env('ANSICON') && env('ConEmuANSI') !== 'ON') || (function_exists('posix_isatty') && !posix_isatty($this->_output)) ) { $this->_outputAs = self::PLAIN; diff --git a/src/Controller/Component/AuthComponent.php b/src/Controller/Component/AuthComponent.php index 9956748c87f..de5b24870e0 100644 --- a/src/Controller/Component/AuthComponent.php +++ b/src/Controller/Component/AuthComponent.php @@ -320,7 +320,8 @@ public function authCheck(Event $event) return $result; } - if ($isLoginAction || + if ( + $isLoginAction || empty($this->_config['authorize']) || $this->isAuthorized($this->user()) ) { diff --git a/src/Controller/Component/RequestHandlerComponent.php b/src/Controller/Component/RequestHandlerComponent.php index 837bf265121..a460d248d54 100644 --- a/src/Controller/Component/RequestHandlerComponent.php +++ b/src/Controller/Component/RequestHandlerComponent.php @@ -342,7 +342,8 @@ public function beforeRender(Event $event) $response = $response->withCharset(Configure::read('App.encoding')); } - if ($this->_config['checkHttpCache'] && + if ( + $this->_config['checkHttpCache'] && $response->checkNotModified($request) ) { $controller->setResponse($response); @@ -497,7 +498,8 @@ public function requestedWith($type = null) $request = $controller->getRequest(); $response = $controller->getResponse(); - if (!$request->is('post') && + if ( + !$request->is('post') && !$request->is('put') && !$request->is('patch') && !$request->is('delete') diff --git a/src/Controller/Component/SecurityComponent.php b/src/Controller/Component/SecurityComponent.php index d1e47562357..ba072dd41a8 100644 --- a/src/Controller/Component/SecurityComponent.php +++ b/src/Controller/Component/SecurityComponent.php @@ -115,7 +115,8 @@ public function startup(Event $event) throw new AuthSecurityException(sprintf('Action %s is defined as the blackhole callback.', $this->_action)); } - if (!in_array($this->_action, (array)$this->_config['unlockedActions']) && + if ( + !in_array($this->_action, (array)$this->_config['unlockedActions']) && $hasData && $isNotRequestAction && $this->_config['validatePost'] @@ -236,7 +237,8 @@ protected function _requireMethod($method, $actions = []) */ protected function _secureRequired(Controller $controller) { - if (is_array($this->_config['requireSecure']) && + if ( + is_array($this->_config['requireSecure']) && !empty($this->_config['requireSecure']) ) { $requireSecure = $this->_config['requireSecure']; @@ -263,7 +265,8 @@ protected function _secureRequired(Controller $controller) protected function _authRequired(Controller $controller) { $request = $controller->getRequest(); - if (is_array($this->_config['requireAuth']) && + if ( + is_array($this->_config['requireAuth']) && !empty($this->_config['requireAuth']) && $request->getData() ) { @@ -278,8 +281,10 @@ protected function _authRequired(Controller $controller) if ($this->session->check('_Token')) { $tData = $this->session->read('_Token'); - if (!empty($tData['allowedControllers']) && - !in_array($request->getParam('controller'), $tData['allowedControllers'])) { + if ( + !empty($tData['allowedControllers']) && + !in_array($request->getParam('controller'), $tData['allowedControllers']) + ) { throw new AuthSecurityException( sprintf( 'Controller \'%s\' was not found in allowed controllers: \'%s\'.', @@ -288,7 +293,8 @@ protected function _authRequired(Controller $controller) ) ); } - if (!empty($tData['allowedActions']) && + if ( + !empty($tData['allowedActions']) && !in_array($request->getParam('action'), $tData['allowedActions']) ) { throw new AuthSecurityException( diff --git a/src/Database/Dialect/SqlserverDialectTrait.php b/src/Database/Dialect/SqlserverDialectTrait.php index 4cee7998637..22e4905d2e3 100644 --- a/src/Database/Dialect/SqlserverDialectTrait.php +++ b/src/Database/Dialect/SqlserverDialectTrait.php @@ -115,7 +115,8 @@ protected function _pagingSubquery($original, $limit, $offset) ->clause('order') ->iterateParts(function ($direction, $orderBy) use ($select, $order) { $key = $orderBy; - if (isset($select[$orderBy]) && + if ( + isset($select[$orderBy]) && $select[$orderBy] instanceof ExpressionInterface ) { $key = $select[$orderBy]->sql(new ValueBinder()); diff --git a/src/Database/Driver.php b/src/Database/Driver.php index a11e829729f..a590f20795b 100644 --- a/src/Database/Driver.php +++ b/src/Database/Driver.php @@ -302,7 +302,8 @@ public function schemaValue($value) if (is_float($value)) { return str_replace(',', '.', (string)$value); } - if ((is_int($value) || $value === '0') || ( + if ( + (is_int($value) || $value === '0') || ( is_numeric($value) && strpos($value, ',') === false && $value[0] !== '0' && strpos($value, 'e') === false) ) { diff --git a/src/Database/Expression/ValuesExpression.php b/src/Database/Expression/ValuesExpression.php index a952ec96385..389caa438b2 100644 --- a/src/Database/Expression/ValuesExpression.php +++ b/src/Database/Expression/ValuesExpression.php @@ -83,7 +83,8 @@ public function __construct(array $columns, $typeMap) */ public function add($data) { - if ((count($this->_values) && $data instanceof Query) || + if ( + (count($this->_values) && $data instanceof Query) || ($this->_query && is_array($data)) ) { throw new Exception( diff --git a/src/Database/QueryCompiler.php b/src/Database/QueryCompiler.php index d8d838044eb..d28ecefd771 100644 --- a/src/Database/QueryCompiler.php +++ b/src/Database/QueryCompiler.php @@ -124,7 +124,8 @@ public function compile(Query $query, ValueBinder $generator) protected function _sqlCompiler(&$sql, $query, $generator) { return function ($parts, $name) use (&$sql, $query, $generator) { - if (!isset($parts) || + if ( + !isset($parts) || ((is_array($parts) || $parts instanceof \Countable) && !count($parts)) ) { return; diff --git a/src/Database/Schema/MysqlSchema.php b/src/Database/Schema/MysqlSchema.php index 260b5fd63e9..bee0d9eaaca 100644 --- a/src/Database/Schema/MysqlSchema.php +++ b/src/Database/Schema/MysqlSchema.php @@ -405,7 +405,8 @@ public function columnSql(TableSchema $schema, $name) TableSchema::TYPE_FLOAT, TableSchema::TYPE_DECIMAL, ]; - if (in_array($data['type'], $hasUnsigned, true) && + if ( + in_array($data['type'], $hasUnsigned, true) && isset($data['unsigned']) && $data['unsigned'] === true ) { $out .= ' UNSIGNED'; @@ -427,7 +428,8 @@ public function columnSql(TableSchema $schema, $name) !$schema->hasAutoincrement() && !isset($data['autoIncrement']) ); - if (in_array($data['type'], [TableSchema::TYPE_INTEGER, TableSchema::TYPE_BIGINTEGER]) && + if ( + in_array($data['type'], [TableSchema::TYPE_INTEGER, TableSchema::TYPE_BIGINTEGER]) && ($data['autoIncrement'] === true || $addAutoIncrement) ) { $out .= ' AUTO_INCREMENT'; @@ -436,7 +438,8 @@ public function columnSql(TableSchema $schema, $name) $out .= ' NULL'; unset($data['default']); } - if (isset($data['default']) && + if ( + isset($data['default']) && in_array($data['type'], [TableSchema::TYPE_TIMESTAMP, TableSchema::TYPE_DATETIME]) && in_array(strtolower($data['default']), ['current_timestamp', 'current_timestamp()']) ) { diff --git a/src/Database/Schema/PostgresSchema.php b/src/Database/Schema/PostgresSchema.php index de2348939b0..cb0da6dca26 100644 --- a/src/Database/Schema/PostgresSchema.php +++ b/src/Database/Schema/PostgresSchema.php @@ -115,7 +115,8 @@ protected function _convertColumn($column) } // money is 'string' as it includes arbitrary text content // before the number value. - if (strpos($col, 'char') !== false || + if ( + strpos($col, 'char') !== false || strpos($col, 'money') !== false ) { return ['type' => TableSchema::TYPE_STRING, 'length' => $length]; @@ -129,7 +130,8 @@ protected function _convertColumn($column) if ($col === 'real' || strpos($col, 'double') !== false) { return ['type' => TableSchema::TYPE_FLOAT, 'length' => null]; } - if (strpos($col, 'numeric') !== false || + if ( + strpos($col, 'numeric') !== false || strpos($col, 'decimal') !== false ) { return ['type' => TableSchema::TYPE_DECIMAL, 'length' => null]; @@ -389,7 +391,8 @@ public function columnSql(TableSchema $schema, $name) $out .= ' BYTEA'; } - if ($data['type'] === TableSchema::TYPE_STRING || + if ( + $data['type'] === TableSchema::TYPE_STRING || ($data['type'] === TableSchema::TYPE_TEXT && $data['length'] === TableSchema::LENGTH_TINY) ) { $isFixed = !empty($data['fixed']); @@ -412,7 +415,8 @@ public function columnSql(TableSchema $schema, $name) $out .= '(' . (int)$data['precision'] . ')'; } - if ($data['type'] === TableSchema::TYPE_DECIMAL && + if ( + $data['type'] === TableSchema::TYPE_DECIMAL && (isset($data['length']) || isset($data['precision'])) ) { $out .= '(' . (int)$data['length'] . ',' . (int)$data['precision'] . ')'; @@ -422,7 +426,8 @@ public function columnSql(TableSchema $schema, $name) $out .= ' NOT NULL'; } - if (isset($data['default']) && + if ( + isset($data['default']) && in_array($data['type'], [TableSchema::TYPE_TIMESTAMP, TableSchema::TYPE_DATETIME]) && strtolower($data['default']) === 'current_timestamp' ) { diff --git a/src/Database/Schema/SqliteSchema.php b/src/Database/Schema/SqliteSchema.php index 65b5b381fdb..a4f42b52310 100644 --- a/src/Database/Schema/SqliteSchema.php +++ b/src/Database/Schema/SqliteSchema.php @@ -317,7 +317,8 @@ public function columnSql(TableSchema $schema, $name) TableSchema::TYPE_DECIMAL, ]; - if (in_array($data['type'], $hasUnsigned, true) && + if ( + in_array($data['type'], $hasUnsigned, true) && isset($data['unsigned']) && $data['unsigned'] === true ) { if ($data['type'] !== TableSchema::TYPE_INTEGER || [$name] !== (array)$schema->primaryKey()) { @@ -333,7 +334,8 @@ public function columnSql(TableSchema $schema, $name) $out .= ' TEXT'; } - if ($data['type'] === TableSchema::TYPE_STRING || + if ( + $data['type'] === TableSchema::TYPE_STRING || ($data['type'] === TableSchema::TYPE_TEXT && $data['length'] === TableSchema::LENGTH_TINY) ) { $out .= ' VARCHAR'; @@ -356,14 +358,16 @@ public function columnSql(TableSchema $schema, $name) TableSchema::TYPE_SMALLINTEGER, TableSchema::TYPE_INTEGER, ]; - if (in_array($data['type'], $integerTypes, true) && + if ( + in_array($data['type'], $integerTypes, true) && isset($data['length']) && [$name] !== (array)$schema->primaryKey() ) { $out .= '(' . (int)$data['length'] . ')'; } $hasPrecision = [TableSchema::TYPE_FLOAT, TableSchema::TYPE_DECIMAL]; - if (in_array($data['type'], $hasPrecision, true) && + if ( + in_array($data['type'], $hasPrecision, true) && (isset($data['length']) || isset($data['precision'])) ) { $out .= '(' . (int)$data['length'] . ',' . (int)$data['precision'] . ')'; @@ -397,7 +401,8 @@ public function columnSql(TableSchema $schema, $name) public function constraintSql(TableSchema $schema, $name) { $data = $schema->getConstraint($name); - if ($data['type'] === TableSchema::CONSTRAINT_PRIMARY && + if ( + $data['type'] === TableSchema::CONSTRAINT_PRIMARY && count($data['columns']) === 1 && $schema->getColumn($data['columns'][0])['type'] === TableSchema::TYPE_INTEGER ) { diff --git a/src/Database/Schema/SqlserverSchema.php b/src/Database/Schema/SqlserverSchema.php index 442f9836598..540e159eac7 100644 --- a/src/Database/Schema/SqlserverSchema.php +++ b/src/Database/Schema/SqlserverSchema.php @@ -106,7 +106,8 @@ protected function _convertColumn($col, $length = null, $precision = null, $scal if ($col === 'bit') { return ['type' => TableSchema::TYPE_BOOLEAN, 'length' => null]; } - if (strpos($col, 'numeric') !== false || + if ( + strpos($col, 'numeric') !== false || strpos($col, 'money') !== false || strpos($col, 'decimal') !== false ) { @@ -375,8 +376,10 @@ public function columnSql(TableSchema $schema, $name) } if ($data['type'] === TableSchema::TYPE_BINARY) { - if (!isset($data['length']) - || in_array($data['length'], [TableSchema::LENGTH_MEDIUM, TableSchema::LENGTH_LONG], true)) { + if ( + !isset($data['length']) + || in_array($data['length'], [TableSchema::LENGTH_MEDIUM, TableSchema::LENGTH_LONG], true) + ) { $data['length'] = 'MAX'; } @@ -389,7 +392,8 @@ public function columnSql(TableSchema $schema, $name) } } - if ($data['type'] === TableSchema::TYPE_STRING || + if ( + $data['type'] === TableSchema::TYPE_STRING || ($data['type'] === TableSchema::TYPE_TEXT && $data['length'] === TableSchema::LENGTH_TINY) ) { $type = ' NVARCHAR'; @@ -414,7 +418,8 @@ public function columnSql(TableSchema $schema, $name) $out .= '(' . (int)$data['precision'] . ')'; } - if ($data['type'] === TableSchema::TYPE_DECIMAL && + if ( + $data['type'] === TableSchema::TYPE_DECIMAL && (isset($data['length']) || isset($data['precision'])) ) { $out .= '(' . (int)$data['length'] . ',' . (int)$data['precision'] . ')'; @@ -424,7 +429,8 @@ public function columnSql(TableSchema $schema, $name) $out .= ' NOT NULL'; } - if (isset($data['default']) && + if ( + isset($data['default']) && in_array($data['type'], [TableSchema::TYPE_TIMESTAMP, TableSchema::TYPE_DATETIME]) && strtolower($data['default']) === 'current_timestamp' ) { diff --git a/src/Database/SqlDialectTrait.php b/src/Database/SqlDialectTrait.php index 53b96aacd67..c0eda4f9d8e 100644 --- a/src/Database/SqlDialectTrait.php +++ b/src/Database/SqlDialectTrait.php @@ -225,7 +225,8 @@ protected function _removeAliasesFromConditions($query) $conditions->traverse(function ($expression) { if ($expression instanceof Comparison) { $field = $expression->getField(); - if (is_string($field) && + if ( + is_string($field) && strpos($field, '.') !== false ) { list(, $unaliasedField) = explode('.', $field, 2); diff --git a/src/Database/Type/BinaryType.php b/src/Database/Type/BinaryType.php index 9f5ba7ad62b..7d4944ecbba 100644 --- a/src/Database/Type/BinaryType.php +++ b/src/Database/Type/BinaryType.php @@ -79,7 +79,8 @@ public function toPHP($value, Driver $driver) if ($value === null) { return null; } - if (is_string($value) + if ( + is_string($value) && $driver instanceof Sqlserver && version_compare(PHP_VERSION, '7.0', '<') ) { diff --git a/src/Database/Type/DateTimeType.php b/src/Database/Type/DateTimeType.php index 2c33751ead5..3eb3be058af 100644 --- a/src/Database/Type/DateTimeType.php +++ b/src/Database/Type/DateTimeType.php @@ -139,7 +139,8 @@ public function toDatabase($value, Driver $driver) $format = (array)$this->_format; - if ($this->dbTimezone !== null + if ( + $this->dbTimezone !== null && $this->dbTimezone->getName() !== $value->getTimezone()->getName() ) { if (!$value instanceof DateTimeImmutable) { @@ -267,7 +268,8 @@ public function marshal($value) $value += ['hour' => 0, 'minute' => 0, 'second' => 0]; $format = ''; - if (isset($value['year'], $value['month'], $value['day']) && + if ( + isset($value['year'], $value['month'], $value['day']) && (is_numeric($value['year']) && is_numeric($value['month']) && is_numeric($value['day'])) ) { $format .= sprintf('%d-%02d-%02d', $value['year'], $value['month'], $value['day']); diff --git a/src/Database/Type/DecimalType.php b/src/Database/Type/DecimalType.php index 9a5fd665cab..15b377f0de7 100644 --- a/src/Database/Type/DecimalType.php +++ b/src/Database/Type/DecimalType.php @@ -178,7 +178,8 @@ public function useLocaleParser($enable = true) return $this; } - if (static::$numberClass === 'Cake\I18n\Number' || + if ( + static::$numberClass === 'Cake\I18n\Number' || is_subclass_of(static::$numberClass, 'Cake\I18n\Number') ) { $this->_useLocaleParser = $enable; diff --git a/src/Database/Type/FloatType.php b/src/Database/Type/FloatType.php index 69725f577a9..2cf1c1d54ac 100644 --- a/src/Database/Type/FloatType.php +++ b/src/Database/Type/FloatType.php @@ -167,7 +167,8 @@ public function useLocaleParser($enable = true) return $this; } - if (static::$numberClass === 'Cake\I18n\Number' || + if ( + static::$numberClass === 'Cake\I18n\Number' || is_subclass_of(static::$numberClass, 'Cake\I18n\Number') ) { $this->_useLocaleParser = $enable; diff --git a/src/Datasource/EntityTrait.php b/src/Datasource/EntityTrait.php index a728d29ecde..d90a48dd864 100644 --- a/src/Datasource/EntityTrait.php +++ b/src/Datasource/EntityTrait.php @@ -247,7 +247,8 @@ public function set($property, $value = null, array $options = []) $this->setDirty($p, true); - if (!array_key_exists($p, $this->_original) && + if ( + !array_key_exists($p, $this->_original) && array_key_exists($p, $this->_properties) && $this->_properties[$p] !== $value ) { @@ -391,7 +392,8 @@ public function has($property) public function isEmpty($property) { $value = $this->get($property); - if ($value === null + if ( + $value === null || (is_array($value) && empty($value) || (is_string($value) && empty($value))) ) { @@ -1124,7 +1126,8 @@ protected function _nestedErrors($field) $val = isset($entity[$part]) ? $entity[$part] : false; } - if (is_array($val) || + if ( + is_array($val) || $val instanceof Traversable || $val instanceof EntityInterface ) { diff --git a/src/Datasource/Paginator.php b/src/Datasource/Paginator.php index 8270e3ecfda..d2ea1e9671a 100644 --- a/src/Datasource/Paginator.php +++ b/src/Datasource/Paginator.php @@ -394,7 +394,8 @@ public function validateSort(RepositoryInterface $object, array $options) } } - if ($options['sort'] === null + if ( + $options['sort'] === null && count($options['order']) === 1 && !is_numeric(key($options['order'])) ) { diff --git a/src/Error/ExceptionRenderer.php b/src/Error/ExceptionRenderer.php index 6a44a4566e0..7e8bd909536 100644 --- a/src/Error/ExceptionRenderer.php +++ b/src/Error/ExceptionRenderer.php @@ -293,7 +293,8 @@ protected function _message(Exception $exception, $code) $exception = $this->_unwrap($exception); $message = $exception->getMessage(); - if (!Configure::read('debug') && + if ( + !Configure::read('debug') && !($exception instanceof HttpException) ) { if ($code < 500) { diff --git a/src/Form/Form.php b/src/Form/Form.php index 08eae4fff2e..db85722e718 100644 --- a/src/Form/Form.php +++ b/src/Form/Form.php @@ -45,13 +45,6 @@ */ class Form implements EventListenerInterface, EventDispatcherInterface, ValidatorAwareInterface { - /** - * Schema class. - * - * @var string - */ - protected $_schemaClass = Schema::class; - use EventDispatcherTrait; use ValidatorAwareTrait; @@ -69,6 +62,13 @@ class Form implements EventListenerInterface, EventDispatcherInterface, Validato */ const BUILD_VALIDATOR_EVENT = 'Form.buildValidator'; + /** + * Schema class. + * + * @var string + */ + protected $_schemaClass = Schema::class; + /** * The schema used by this form. * diff --git a/src/Http/ControllerFactory.php b/src/Http/ControllerFactory.php index 237c07254fc..6d5b06301e4 100644 --- a/src/Http/ControllerFactory.php +++ b/src/Http/ControllerFactory.php @@ -81,7 +81,8 @@ public function getControllerClass(ServerRequest $request) // Disallow plugin short forms, / and \\ from // controller names as they allow direct references to // be created. - if (strpos($controller, '\\') !== false || + if ( + strpos($controller, '\\') !== false || strpos($controller, '/') !== false || strpos($controller, '.') !== false || $firstChar === strtolower($firstChar) diff --git a/src/Http/Middleware/CsrfProtectionMiddleware.php b/src/Http/Middleware/CsrfProtectionMiddleware.php index 4b11e35c676..516c5e10d13 100644 --- a/src/Http/Middleware/CsrfProtectionMiddleware.php +++ b/src/Http/Middleware/CsrfProtectionMiddleware.php @@ -95,7 +95,8 @@ public function __construct(array $config = []) */ public function __invoke(ServerRequest $request, Response $response, $next) { - if ($this->whitelistCallback !== null + if ( + $this->whitelistCallback !== null && call_user_func($this->whitelistCallback, $request) === true ) { return $next($request, $response); diff --git a/src/Http/MiddlewareQueue.php b/src/Http/MiddlewareQueue.php index 56172d4a5a5..7e05983c1dd 100644 --- a/src/Http/MiddlewareQueue.php +++ b/src/Http/MiddlewareQueue.php @@ -176,7 +176,8 @@ public function insertBefore($class, $middleware) $found = false; $i = 0; foreach ($this->queue as $i => $object) { - if ((is_string($object) && $object === $class) + if ( + (is_string($object) && $object === $class) || is_a($object, $class) ) { $found = true; @@ -205,7 +206,8 @@ public function insertAfter($class, $middleware) $found = false; $i = 0; foreach ($this->queue as $i => $object) { - if ((is_string($object) && $object === $class) + if ( + (is_string($object) && $object === $class) || is_a($object, $class) ) { $found = true; diff --git a/src/Http/Response.php b/src/Http/Response.php index 657fe89485f..9b5aff04a43 100644 --- a/src/Http/Response.php +++ b/src/Http/Response.php @@ -592,7 +592,8 @@ protected function _setContentType() ]; $charset = false; - if ($this->_charset && + if ( + $this->_charset && (strpos($this->_contentType, 'text/') === 0 || in_array($this->_contentType, $whitelist)) ) { $charset = true; diff --git a/src/Http/ServerRequest.php b/src/Http/ServerRequest.php index 96a470d1f21..dfe640852a7 100644 --- a/src/Http/ServerRequest.php +++ b/src/Http/ServerRequest.php @@ -383,7 +383,8 @@ protected function _processPost($data) $method = $this->getEnv('REQUEST_METHOD'); $override = false; - if (in_array($method, ['PUT', 'DELETE', 'PATCH'], true) && + if ( + in_array($method, ['PUT', 'DELETE', 'PATCH'], true) && strpos($this->contentType(), 'application/x-www-form-urlencoded') === 0 ) { $data = $this->input(); @@ -1335,7 +1336,8 @@ public function withMethod($method) { $new = clone $this; - if (!is_string($method) || + if ( + !is_string($method) || !preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method) ) { throw new InvalidArgumentException(sprintf( diff --git a/src/Http/ServerRequestFactory.php b/src/Http/ServerRequestFactory.php index a882a288cb9..4c7ea6d9591 100644 --- a/src/Http/ServerRequestFactory.php +++ b/src/Http/ServerRequestFactory.php @@ -132,7 +132,8 @@ protected static function updatePath($base, $uri) } $endsWithIndex = '/' . (Configure::read('App.webroot') ?: 'webroot') . '/index.php'; $endsWithLength = strlen($endsWithIndex); - if (strlen($path) >= $endsWithLength && + if ( + strlen($path) >= $endsWithLength && substr($path, -$endsWithLength) === $endsWithIndex ) { $path = '/'; diff --git a/src/Log/Engine/FileLog.php b/src/Log/Engine/FileLog.php index 62c9807b608..e9114529dea 100644 --- a/src/Log/Engine/FileLog.php +++ b/src/Log/Engine/FileLog.php @@ -85,7 +85,8 @@ public function __construct(array $config = []) if (!empty($this->_config['path'])) { $this->_path = $this->_config['path']; } - if ($this->_path !== null && + if ( + $this->_path !== null && Configure::read('debug') && !is_dir($this->_path) ) { @@ -184,7 +185,8 @@ protected function _rotateFile($filename) $filePath = $this->_path . $filename; clearstatcache(true, $filePath); - if (!file_exists($filePath) || + if ( + !file_exists($filePath) || filesize($filePath) < $this->_size ) { return null; diff --git a/src/Mailer/Email.php b/src/Mailer/Email.php index 050b3266b6e..02c936ae16a 100644 --- a/src/Mailer/Email.php +++ b/src/Mailer/Email.php @@ -2835,7 +2835,8 @@ protected function _checkViewVars(&$item, $key) $item = (string)$item; } - if (is_resource($item) || + if ( + is_resource($item) || $item instanceof Closure || $item instanceof PDO ) { diff --git a/src/ORM/Association.php b/src/ORM/Association.php index a7eec733222..8d20cbd691a 100644 --- a/src/ORM/Association.php +++ b/src/ORM/Association.php @@ -344,7 +344,8 @@ public function cascadeCallbacks($cascadeCallbacks = null) */ public function setClassName($className) { - if ($this->_targetTable !== null && + if ( + $this->_targetTable !== null && get_class($this->_targetTable) !== App::className($className, 'Model/Table', 'Table') ) { throw new InvalidArgumentException( diff --git a/src/ORM/Association/HasMany.php b/src/ORM/Association/HasMany.php index 1b0cc94a9f2..3b2e5e8156d 100644 --- a/src/ORM/Association/HasMany.php +++ b/src/ORM/Association/HasMany.php @@ -170,7 +170,8 @@ public function saveAssociated(EntityInterface $entity, array $options = []) $isEmpty = in_array($targetEntities, [null, [], '', false], true); if ($isEmpty) { - if ($entity->isNew() || + if ( + $entity->isNew() || $this->getSaveStrategy() !== self::SAVE_REPLACE ) { return $entity; @@ -179,7 +180,8 @@ public function saveAssociated(EntityInterface $entity, array $options = []) $targetEntities = []; } - if (!is_array($targetEntities) && + if ( + !is_array($targetEntities) && !($targetEntities instanceof Traversable) ) { $name = $this->getProperty(); @@ -194,7 +196,8 @@ public function saveAssociated(EntityInterface $entity, array $options = []) $options['_sourceTable'] = $this->getSource(); - if ($this->_saveStrategy === self::SAVE_REPLACE && + if ( + $this->_saveStrategy === self::SAVE_REPLACE && !$this->_unlinkAssociated($foreignKeyReference, $entity, $this->getTarget(), $targetEntities, $options) ) { return false; diff --git a/src/ORM/Behavior.php b/src/ORM/Behavior.php index a304a522b9c..ff595232217 100644 --- a/src/ORM/Behavior.php +++ b/src/ORM/Behavior.php @@ -402,7 +402,8 @@ protected function _reflectionCache() foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { $methodName = $method->getName(); - if (in_array($methodName, $baseMethods, true) || + if ( + in_array($methodName, $baseMethods, true) || isset($eventMethods[$methodName]) ) { continue; diff --git a/src/ORM/Behavior/CounterCacheBehavior.php b/src/ORM/Behavior/CounterCacheBehavior.php index 18d437eb439..f9b63de3e00 100644 --- a/src/ORM/Behavior/CounterCacheBehavior.php +++ b/src/ORM/Behavior/CounterCacheBehavior.php @@ -133,7 +133,8 @@ public function beforeSave(Event $event, EntityInterface $entity, $options) $registryAlias = $assoc->getTarget()->getRegistryAlias(); $entityAlias = $assoc->getProperty(); - if (!is_callable($config) && + if ( + !is_callable($config) && isset($config['ignoreDirty']) && $config['ignoreDirty'] === true && $entity->$entityAlias->isDirty($field) @@ -226,7 +227,8 @@ protected function _processAssociation(Event $event, EntityInterface $entity, As $config = []; } - if (isset($this->_ignoreDirty[$assoc->getTarget()->getRegistryAlias()][$field]) && + if ( + isset($this->_ignoreDirty[$assoc->getTarget()->getRegistryAlias()][$field]) && $this->_ignoreDirty[$assoc->getTarget()->getRegistryAlias()][$field] === true ) { continue; diff --git a/src/ORM/Behavior/TimestampBehavior.php b/src/ORM/Behavior/TimestampBehavior.php index 90daaf1421d..415cbba8d84 100644 --- a/src/ORM/Behavior/TimestampBehavior.php +++ b/src/ORM/Behavior/TimestampBehavior.php @@ -103,7 +103,8 @@ public function handleEvent(Event $event, EntityInterface $entity) sprintf('When should be one of "always", "new" or "existing". The passed value "%s" is invalid', $when) ); } - if ($when === 'always' || + if ( + $when === 'always' || ($when === 'new' && $new) || ($when === 'existing' && !$new) ) { diff --git a/src/ORM/Behavior/TranslateBehavior.php b/src/ORM/Behavior/TranslateBehavior.php index a745e164ed2..7bfb5017e6c 100644 --- a/src/ORM/Behavior/TranslateBehavior.php +++ b/src/ORM/Behavior/TranslateBehavior.php @@ -222,7 +222,8 @@ public function beforeFind(Event $event, Query $query, $options) $q->where([$q->getRepository()->aliasField('locale') => $locale]); /** @var \Cake\ORM\Query $query */ - if ($query->isAutoFieldsEnabled() || + if ( + $query->isAutoFieldsEnabled() || in_array($field, $select, true) || in_array($this->_table->aliasField($field), $select, true) ) { diff --git a/src/ORM/EagerLoader.php b/src/ORM/EagerLoader.php index 2adf6d15204..55eb4a08fea 100644 --- a/src/ORM/EagerLoader.php +++ b/src/ORM/EagerLoader.php @@ -557,8 +557,9 @@ protected function _normalizeContain(Table $parent, $alias, $options, $paths) $paths += ['aliasPath' => '', 'propertyPath' => '', 'root' => $alias]; $paths['aliasPath'] .= '.' . $alias; - if (isset($options['matching']) && - $options['matching'] === true + if ( + isset($options['matching']) && + $options['matching'] === true ) { $paths['propertyPath'] = '_matchingData.' . $alias; } else { diff --git a/src/ORM/Marshaller.php b/src/ORM/Marshaller.php index 1d69f776675..7abf0c61ac8 100644 --- a/src/ORM/Marshaller.php +++ b/src/ORM/Marshaller.php @@ -586,7 +586,8 @@ public function merge(EntityInterface $entity, array $data, array $options = []) // change. Arrays will always be marked as dirty because // the original/updated list could contain references to the // same objects, even though those objects may have changed internally. - if ((is_scalar($value) && $original === $value) || + if ( + (is_scalar($value) && $original === $value) || ($value === null && $original === $value) || (is_object($value) && !($value instanceof EntityInterface) && $original == $value) ) { diff --git a/src/ORM/Table.php b/src/ORM/Table.php index 496d163e463..7f834e597fc 100644 --- a/src/ORM/Table.php +++ b/src/ORM/Table.php @@ -1450,7 +1450,8 @@ public function findList(Query $query, array $options) deprecationWarning('Option "idField" is deprecated, use "keyField" instead.'); } - if (!$query->clause('select') && + if ( + !$query->clause('select') && !is_object($options['keyField']) && !is_object($options['valueField']) && !is_object($options['groupField']) diff --git a/src/Routing/Route/Route.php b/src/Routing/Route/Route.php index 411f2e947d4..f1fca520cc9 100644 --- a/src/Routing/Route/Route.php +++ b/src/Routing/Route/Route.php @@ -391,7 +391,8 @@ public function getName() ]; foreach ($keys as $key => $glue) { $value = null; - if (strpos($this->template, ':' . $key) !== false + if ( + strpos($this->template, ':' . $key) !== false || strpos($this->template, '{' . $key . '}') !== false ) { $value = '_' . $key; @@ -623,7 +624,8 @@ public function match(array $url, array $context = []) $defaults = $this->defaults; $context += ['params' => [], '_port' => null, '_scheme' => null, '_host' => null]; - if (!empty($this->options['persist']) && + if ( + !empty($this->options['persist']) && is_array($this->options['persist']) ) { $url = $this->_persistParams($url, $context['params']); @@ -648,7 +650,8 @@ public function match(array $url, array $context = []) // Check for properties that will cause an // absolute url. Copy the other properties over. - if (isset($hostOptions['_scheme']) || + if ( + isset($hostOptions['_scheme']) || isset($hostOptions['_port']) || isset($hostOptions['_host']) ) { @@ -830,7 +833,8 @@ protected function _writeUrl($params, $pass = [], $query = []) } $out = str_replace('//', '/', $out); - if (isset($params['_scheme']) || + if ( + isset($params['_scheme']) || isset($params['_host']) || isset($params['_port']) ) { diff --git a/src/Routing/Router.php b/src/Routing/Router.php index 8c1fe08b437..d10edf6f71f 100644 --- a/src/Routing/Router.php +++ b/src/Routing/Router.php @@ -705,7 +705,8 @@ public static function url($url = null, $full = false) if (!isset($url['_name'])) { // Copy the current action if the controller is the current one. - if (empty($url['action']) && + if ( + empty($url['action']) && (empty($url['controller']) || $params['controller'] === $url['controller']) ) { $url['action'] = $params['action']; diff --git a/src/Shell/Task/AssetsTask.php b/src/Shell/Task/AssetsTask.php index 315bf13244d..9f26183a606 100644 --- a/src/Shell/Task/AssetsTask.php +++ b/src/Shell/Task/AssetsTask.php @@ -146,7 +146,8 @@ protected function _process($plugins, $copy = false, $overwrite = false) $this->out('For plugin: ' . $plugin); $this->hr(); - if ($config['namespaced'] && + if ( + $config['namespaced'] && !is_dir($config['destDir']) && !$this->_createDirectory($config['destDir']) ) { diff --git a/src/Shell/Task/CommandTask.php b/src/Shell/Task/CommandTask.php index 1bca3aaf158..04cf2f8d9d3 100644 --- a/src/Shell/Task/CommandTask.php +++ b/src/Shell/Task/CommandTask.php @@ -144,7 +144,8 @@ public function commands() foreach ($shellList as $type => $commands) { foreach ($commands as $shell) { $prefix = ''; - if (!in_array(strtolower($type), ['app', 'core']) && + if ( + !in_array(strtolower($type), ['app', 'core']) && isset($duplicates[$type]) && in_array($shell, $duplicates[$type]) ) { diff --git a/src/TestSuite/Constraint/Email/MailSentWith.php b/src/TestSuite/Constraint/Email/MailSentWith.php index 34743e48c7e..a4c5beb5d0b 100644 --- a/src/TestSuite/Constraint/Email/MailSentWith.php +++ b/src/TestSuite/Constraint/Email/MailSentWith.php @@ -49,7 +49,8 @@ public function matches($other) $emails = $this->getEmails(); foreach ($emails as $email) { $value = $email->{'get' . ucfirst($this->method)}(); - if (in_array($this->method, ['to', 'cc', 'bcc', 'from']) + if ( + in_array($this->method, ['to', 'cc', 'bcc', 'from']) && array_key_exists($other, $value) ) { return true; diff --git a/src/Utility/Hash.php b/src/Utility/Hash.php index be82cd20499..3693841dfb6 100644 --- a/src/Utility/Hash.php +++ b/src/Utility/Hash.php @@ -173,7 +173,8 @@ public static function extract($data, $path) if ($conditions) { $filter = []; foreach ($next as $item) { - if ((is_array($item) || $item instanceof ArrayAccess) && + if ( + (is_array($item) || $item instanceof ArrayAccess) && static::_matches($item, $conditions) ) { $filter[] = $item; @@ -280,7 +281,8 @@ protected static function _matches($data, $selector) if (!preg_match($val, $prop)) { return false; } - } elseif (($op === '=' && $prop != $val) || + } elseif ( + ($op === '=' && $prop != $val) || ($op === '!=' && $prop == $val) || ($op === '>' && $prop <= $val) || ($op === '<' && $prop >= $val) || diff --git a/src/Utility/MergeVariablesTrait.php b/src/Utility/MergeVariablesTrait.php index 861a365262a..d77264c31c4 100644 --- a/src/Utility/MergeVariablesTrait.php +++ b/src/Utility/MergeVariablesTrait.php @@ -67,7 +67,8 @@ protected function _mergeProperty($property, $parentClasses, $options) { $thisValue = $this->{$property}; $isAssoc = false; - if (isset($options['associative']) && + if ( + isset($options['associative']) && in_array($property, (array)$options['associative']) ) { $isAssoc = true; diff --git a/src/Utility/Text.php b/src/Utility/Text.php index d0c305d5c55..ceaecd500c8 100644 --- a/src/Utility/Text.php +++ b/src/Utility/Text.php @@ -827,7 +827,8 @@ protected static function _substr($text, $start, $length, array $options) $len = self::_strlen($part, $options); if ($offset !== 0 || $totalLength + $len > $length) { - if (strpos($part, '&') === 0 && preg_match($pattern, $part) + if ( + strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) { // Entities cannot be passed substr. diff --git a/src/Validation/Validation.php b/src/Validation/Validation.php index 6d16c24e2c9..73936f01417 100644 --- a/src/Validation/Validation.php +++ b/src/Validation/Validation.php @@ -1688,7 +1688,8 @@ public static function iban($check) protected static function _getDateString($value) { $formatted = ''; - if (isset($value['year'], $value['month'], $value['day']) && + if ( + isset($value['year'], $value['month'], $value['day']) && (is_numeric($value['year']) && is_numeric($value['month']) && is_numeric($value['day'])) ) { $formatted .= sprintf('%d-%02d-%02d ', $value['year'], $value['month'], $value['day']); diff --git a/src/Validation/Validator.php b/src/Validation/Validator.php index af30280dc59..ba805d02e50 100644 --- a/src/Validation/Validator.php +++ b/src/Validation/Validator.php @@ -809,7 +809,8 @@ public function allowEmptyFor($field, $flags, $when = true, $message = null) protected function sortMessageAndWhen($first, $second, $method) { // Called with `$message, $when`. No order change necessary - if (( + if ( + ( in_array($second, [true, false, 'create', 'update'], true) || is_callable($second) ) && ( @@ -2558,7 +2559,8 @@ protected function isEmpty($data, $flags) } if (is_array($data)) { - if (($flags & self::EMPTY_FILE) + if ( + ($flags & self::EMPTY_FILE) && isset($data['name'], $data['type'], $data['tmp_name'], $data['error']) && (int)$data['error'] === UPLOAD_ERR_NO_FILE ) { diff --git a/src/View/Form/ArrayContext.php b/src/View/Form/ArrayContext.php index bf28abf2863..e009d832548 100644 --- a/src/View/Form/ArrayContext.php +++ b/src/View/Form/ArrayContext.php @@ -105,7 +105,8 @@ public function __construct(ServerRequest $request, array $context) */ public function primaryKey() { - if (empty($this->_context['schema']['_constraints']) || + if ( + empty($this->_context['schema']['_constraints']) || !is_array($this->_context['schema']['_constraints']) ) { return []; diff --git a/src/View/Form/EntityContext.php b/src/View/Form/EntityContext.php index b810c5b0186..90857cc59c8 100644 --- a/src/View/Form/EntityContext.php +++ b/src/View/Form/EntityContext.php @@ -254,7 +254,8 @@ public function val($field, $options = []) if ($val !== null) { return $val; } - if ($options['default'] !== null + if ( + $options['default'] !== null || !$options['schemaDefault'] || !$entity->isNew() ) { diff --git a/src/View/Helper/FormHelper.php b/src/View/Helper/FormHelper.php index 8da41cc95fd..a291ea73ac6 100644 --- a/src/View/Helper/FormHelper.php +++ b/src/View/Helper/FormHelper.php @@ -533,7 +533,8 @@ protected function _formUrl($context, $options) return $request->getRequestTarget(); } - if (is_string($options['url']) || + if ( + is_string($options['url']) || (is_array($options['url']) && isset($options['url']['_name'])) ) { return $options['url']; @@ -1503,7 +1504,8 @@ protected function _magicOptions($fieldName, $options, $allowOverride) } $typesWithMaxLength = ['text', 'textarea', 'email', 'tel', 'url', 'search']; - if (!array_key_exists('maxlength', $options) + if ( + !array_key_exists('maxlength', $options) && in_array($options['type'], $typesWithMaxLength) ) { $maxLength = null; @@ -2158,7 +2160,8 @@ public function select($fieldName, $options = [], array $attributes = []) // Secure the field if there are options, or it's a multi select. // Single selects with no options don't submit, but multiselects do. - if ($attributes['secure'] && + if ( + $attributes['secure'] && empty($options) && empty($attributes['empty']) && empty($attributes['multiple']) diff --git a/src/View/Helper/PaginatorHelper.php b/src/View/Helper/PaginatorHelper.php index 0aa01200b21..1c3139e0f96 100644 --- a/src/View/Helper/PaginatorHelper.php +++ b/src/View/Helper/PaginatorHelper.php @@ -565,7 +565,8 @@ public function generateUrlParams(array $options = [], $model = null) $url['page'] = false; } - if (isset($paging['sortDefault'], $paging['directionDefault'], $url['sort'], $url['direction']) && + if ( + isset($paging['sortDefault'], $paging['directionDefault'], $url['sort'], $url['direction']) && $url['sort'] === $paging['sortDefault'] && strtolower($url['direction']) === strtolower($paging['directionDefault']) ) { diff --git a/src/View/Helper/UrlHelper.php b/src/View/Helper/UrlHelper.php index dac98748cd6..4fc675d4e43 100644 --- a/src/View/Helper/UrlHelper.php +++ b/src/View/Helper/UrlHelper.php @@ -177,7 +177,8 @@ public function assetUrl($path, array $options = []) if (!empty($options['pathPrefix']) && $path[0] !== '/') { $path = $options['pathPrefix'] . $path; } - if (!empty($options['ext']) && + if ( + !empty($options['ext']) && strpos($path, '?') === false && substr($path, -strlen($options['ext'])) !== $options['ext'] ) { diff --git a/src/View/Widget/RadioWidget.php b/src/View/Widget/RadioWidget.php index 66bd508721b..13f6b4d4bd1 100644 --- a/src/View/Widget/RadioWidget.php +++ b/src/View/Widget/RadioWidget.php @@ -208,7 +208,8 @@ protected function _renderInput($val, $text, $data, $context) $escape ); - if ($label === false && + if ( + $label === false && strpos($this->_templates->get('radioWrapper'), '{{input}}') === false ) { $label = $input; diff --git a/src/View/Widget/SelectBoxWidget.php b/src/View/Widget/SelectBoxWidget.php index 554d4338c52..65c1e6336c7 100644 --- a/src/View/Widget/SelectBoxWidget.php +++ b/src/View/Widget/SelectBoxWidget.php @@ -234,7 +234,8 @@ protected function _renderOptions($options, $disabled, $selected, $templateVars, foreach ($options as $key => $val) { // Option groups $arrayVal = (is_array($val) || $val instanceof Traversable); - if ((!is_int($key) && $arrayVal) || + if ( + (!is_int($key) && $arrayVal) || (is_int($key) && $arrayVal && (isset($val['options']) || !isset($val['value']))) ) { $out[] = $this->_renderOptgroup($key, $val, $disabled, $selected, $templateVars, $escape); diff --git a/src/View/Widget/WidgetLocator.php b/src/View/Widget/WidgetLocator.php index f07720850f1..e8a61a2bb26 100644 --- a/src/View/Widget/WidgetLocator.php +++ b/src/View/Widget/WidgetLocator.php @@ -114,7 +114,8 @@ public function load($file) public function add(array $widgets) { foreach ($widgets as $object) { - if (is_object($object) && + if ( + is_object($object) && !($object instanceof WidgetInterface) ) { throw new RuntimeException( diff --git a/tests/PHPStan/AssociationTableMixinClassReflectionExtension.php b/tests/PHPStan/AssociationTableMixinClassReflectionExtension.php index 72f7332834d..52f65318f7e 100644 --- a/tests/PHPStan/AssociationTableMixinClassReflectionExtension.php +++ b/tests/PHPStan/AssociationTableMixinClassReflectionExtension.php @@ -1,4 +1,5 @@ -listTables(); - if (in_array('schema_articles', $result) && + if ( + in_array('schema_articles', $result) && in_array('schema_authors', $result) ) { return; diff --git a/tests/TestCase/Datasource/ModelAwareTraitTest.php b/tests/TestCase/Datasource/ModelAwareTraitTest.php index ccf30118204..21bfaa432ef 100644 --- a/tests/TestCase/Datasource/ModelAwareTraitTest.php +++ b/tests/TestCase/Datasource/ModelAwareTraitTest.php @@ -23,7 +23,6 @@ */ class Stub { - use ModelAwareTrait; public function setProps($name) diff --git a/tests/TestCase/Filesystem/FileTest.php b/tests/TestCase/Filesystem/FileTest.php index 7cbb58268db..a9400f0e57e 100644 --- a/tests/TestCase/Filesystem/FileTest.php +++ b/tests/TestCase/Filesystem/FileTest.php @@ -82,7 +82,8 @@ public function testBasic() 'filesize' => filesize($file), 'mime' => 'text/plain', ]; - if (!function_exists('finfo_open') && + if ( + !function_exists('finfo_open') && (!function_exists('mime_content_type') || function_exists('mime_content_type') && mime_content_type($this->File->pwd()) === false) diff --git a/tests/TestCase/Mailer/MailerAwareTraitTest.php b/tests/TestCase/Mailer/MailerAwareTraitTest.php index 8bd5befe3b7..cad22f8d0cb 100644 --- a/tests/TestCase/Mailer/MailerAwareTraitTest.php +++ b/tests/TestCase/Mailer/MailerAwareTraitTest.php @@ -22,7 +22,6 @@ */ class Stub { - use MailerAwareTrait { getMailer as public; } diff --git a/tests/TestCase/ORM/Behavior/BehaviorRegressionTest.php b/tests/TestCase/ORM/Behavior/BehaviorRegressionTest.php index 46dd3e9a6c2..f05913567f9 100644 --- a/tests/TestCase/ORM/Behavior/BehaviorRegressionTest.php +++ b/tests/TestCase/ORM/Behavior/BehaviorRegressionTest.php @@ -23,7 +23,6 @@ */ class NumberTree extends Entity { - use TranslateTrait; } diff --git a/tests/TestCase/ORM/Behavior/TranslateBehaviorTest.php b/tests/TestCase/ORM/Behavior/TranslateBehaviorTest.php index 1124b6ea04d..30b11b4460b 100644 --- a/tests/TestCase/ORM/Behavior/TranslateBehaviorTest.php +++ b/tests/TestCase/ORM/Behavior/TranslateBehaviorTest.php @@ -28,7 +28,6 @@ */ class Article extends Entity { - use TranslateTrait; } diff --git a/tests/TestCase/TestSuite/EmailAssertTraitTest.php b/tests/TestCase/TestSuite/EmailAssertTraitTest.php index e914a76f2ad..cb58c171744 100644 --- a/tests/TestCase/TestSuite/EmailAssertTraitTest.php +++ b/tests/TestCase/TestSuite/EmailAssertTraitTest.php @@ -23,7 +23,6 @@ class EmailAssertTraitTest extends TestCase { - use EmailAssertTrait; public function setUp() diff --git a/tests/TestCase/Utility/MergeVariablesTraitTest.php b/tests/TestCase/Utility/MergeVariablesTraitTest.php index bca21f77bcc..484163ccfd7 100644 --- a/tests/TestCase/Utility/MergeVariablesTraitTest.php +++ b/tests/TestCase/Utility/MergeVariablesTraitTest.php @@ -19,7 +19,6 @@ class Base { - use MergeVariablesTrait; public $hasBoolean = false; diff --git a/tests/TestCase/View/StringTemplateTraitTest.php b/tests/TestCase/View/StringTemplateTraitTest.php index cb197fc23b0..16c5723ea83 100644 --- a/tests/TestCase/View/StringTemplateTraitTest.php +++ b/tests/TestCase/View/StringTemplateTraitTest.php @@ -23,7 +23,6 @@ */ class TestStringTemplate { - use InstanceConfigTrait; use StringTemplateTrait; diff --git a/tests/test_app/TestApp/Model/Entity/NonExtending.php b/tests/test_app/TestApp/Model/Entity/NonExtending.php index 6ae325b4705..26a787fef55 100644 --- a/tests/test_app/TestApp/Model/Entity/NonExtending.php +++ b/tests/test_app/TestApp/Model/Entity/NonExtending.php @@ -10,7 +10,6 @@ */ class NonExtending implements EntityInterface { - use EntityTrait; public function __construct(array $properties = [], array $options = [])