More coding standard corrections.

This commit is contained in:
euromark 2014-04-29 14:19:33 +02:00
parent 1d1a2f859c
commit 7a287a6942
40 changed files with 61 additions and 60 deletions

View file

@ -304,7 +304,7 @@ class ConsoleShell extends AppShell {
$validCurrentAssociation = false; $validCurrentAssociation = false;
foreach ($currentAssociations as $model => $currentAssociation) { foreach ($currentAssociations as $model => $currentAssociation) {
if ($model == $modelB && $association == $currentAssociation) { if ($model === $modelB && $association === $currentAssociation) {
$validCurrentAssociation = true; $validCurrentAssociation = true;
} }
} }

View file

@ -92,7 +92,7 @@ class ServerShell extends AppShell {
} }
// for windows // for windows
if (substr($this->_documentRoot, -1, 1) == DIRECTORY_SEPARATOR) { if (substr($this->_documentRoot, -1, 1) === DIRECTORY_SEPARATOR) {
$this->_documentRoot = substr($this->_documentRoot, 0, strlen($this->_documentRoot) - 1); $this->_documentRoot = substr($this->_documentRoot, 0, strlen($this->_documentRoot) - 1);
} }
if (preg_match("/^([a-z]:)[\\\]+(.+)$/i", $this->_documentRoot, $m)) { if (preg_match("/^([a-z]:)[\\\]+(.+)$/i", $this->_documentRoot, $m)) {

View file

@ -296,7 +296,7 @@ class DbConfigTask extends AppShell {
foreach ($oldConfigs as $key => $oldConfig) { foreach ($oldConfigs as $key => $oldConfig) {
foreach ($configs as $config) { foreach ($configs as $config) {
if ($oldConfig['name'] == $config['name']) { if ($oldConfig['name'] === $config['name']) {
unset($oldConfigs[$key]); unset($oldConfigs[$key]);
} }
} }

View file

@ -411,7 +411,7 @@ class ExtractTask extends AppShell {
$mapCount = count($map); $mapCount = count($map);
$strings = $this->_getStrings($position, $mapCount); $strings = $this->_getStrings($position, $mapCount);
if ($mapCount == count($strings)) { if ($mapCount === count($strings)) {
extract(array_combine($map, $strings)); extract(array_combine($map, $strings));
$category = isset($category) ? $category : 6; $category = isset($category) ? $category : 6;
$category = intval($category); $category = intval($category);

View file

@ -611,13 +611,13 @@ class ModelTask extends BakeTask {
} }
foreach ($tempFieldNames as $fieldName) { foreach ($tempFieldNames as $fieldName) {
$assoc = false; $assoc = false;
if ($fieldName != $model->primaryKey && $fieldName == $foreignKey) { if ($fieldName !== $model->primaryKey && $fieldName === $foreignKey) {
$assoc = array( $assoc = array(
'alias' => $tempOtherModel->name, 'alias' => $tempOtherModel->name,
'className' => $tempOtherModel->name, 'className' => $tempOtherModel->name,
'foreignKey' => $fieldName 'foreignKey' => $fieldName
); );
} elseif ($otherTable == $model->table && $fieldName === 'parent_id') { } elseif ($otherTable === $model->table && $fieldName === 'parent_id') {
$assoc = array( $assoc = array(
'alias' => 'Child' . $model->name, 'alias' => 'Child' . $model->name,
'className' => $model->name, 'className' => $model->name,

View file

@ -302,7 +302,7 @@ class TestTask extends BakeTask {
$position = strpos($class, $type); $position = strpos($class, $type);
if ($position !== false && strlen($class) - $position == strlen($type)) { if ($position !== false && (strlen($class) - $position) === strlen($type)) {
return $class; return $class;
} }
return $class . $type; return $class . $type;

View file

@ -151,7 +151,7 @@ class ViewTask extends BakeTask {
unset($methods[$i]); unset($methods[$i]);
} }
} }
if ($method[0] === '_' || $method == strtolower($this->controllerName . 'Controller')) { if ($method[0] === '_' || $method === strtolower($this->controllerName . 'Controller')) {
unset($methods[$i]); unset($methods[$i]);
} }
} }

View file

@ -581,7 +581,7 @@ class UpgradeShell extends AppShell {
$new = 'View' . DS . Inflector::camelize($old); $new = 'View' . DS . Inflector::camelize($old);
$old = 'View' . DS . $old; $old = 'View' . DS . $old;
if ($new == $old) { if ($new === $old) {
continue; continue;
} }

View file

@ -47,7 +47,7 @@ class ConsoleInput {
* @param string $handle The location of the stream to use as input. * @param string $handle The location of the stream to use as input.
*/ */
public function __construct($handle = 'php://stdin') { public function __construct($handle = 'php://stdin') {
$this->_canReadline = extension_loaded('readline') && $handle == 'php://stdin' ? true : false; $this->_canReadline = extension_loaded('readline') && $handle === 'php://stdin' ? true : false;
$this->_input = fopen($handle, 'r'); $this->_input = fopen($handle, 'r');
} }

View file

@ -23,7 +23,7 @@
<?php <?php
echo "\t<?php\n"; echo "\t<?php\n";
foreach ($fields as $field) { foreach ($fields as $field) {
if (strpos($action, 'add') !== false && $field == $primaryKey) { if (strpos($action, 'add') !== false && $field === $primaryKey) {
continue; continue;
} elseif (!in_array($field, array('created', 'modified', 'updated'))) { } elseif (!in_array($field, array('created', 'modified', 'updated'))) {
echo "\t\techo \$this->Form->input('{$field}');\n"; echo "\t\techo \$this->Form->input('{$field}');\n";

View file

@ -13,7 +13,7 @@
<?php echo $this->Html->charset(); ?> <?php echo $this->Html->charset(); ?>
<title><?php echo $page_title; ?></title> <title><?php echo $page_title; ?></title>
<?php if (Configure::read('debug') == 0): ?> <?php if (!Configure::read('debug')): ?>
<meta http-equiv="Refresh" content="<?php echo $pause; ?>;url=<?php echo $url; ?>"/> <meta http-equiv="Refresh" content="<?php echo $pause; ?>;url=<?php echo $url; ?>"/>
<?php endif ?> <?php endif ?>
<style><!-- <style><!--

View file

@ -462,7 +462,7 @@ class PhpAro {
$mapped = ''; $mapped = '';
if (is_array($aro)) { if (is_array($aro)) {
if (isset($aro['model']) && isset($aro['foreign_key']) && $aro['model'] == $aroGroup) { if (isset($aro['model']) && isset($aro['foreign_key']) && $aro['model'] === $aroGroup) {
$mapped = $aroGroup . '/' . $aro['foreign_key']; $mapped = $aroGroup . '/' . $aro['foreign_key'];
} elseif (isset($aro[$model][$field])) { } elseif (isset($aro[$model][$field])) {
$mapped = $aroGroup . '/' . $aro[$model][$field]; $mapped = $aroGroup . '/' . $aro[$model][$field];
@ -479,7 +479,7 @@ class PhpAro {
$aroModel = Inflector::camelize($aroModel); $aroModel = Inflector::camelize($aroModel);
if ($aroModel == $model || $aroModel == $aroGroup) { if ($aroModel === $model || $aroModel === $aroGroup) {
$mapped = $aroGroup . '/' . $aroValue; $mapped = $aroGroup . '/' . $aroValue;
} }
} }

View file

@ -722,7 +722,7 @@ class AuthComponent extends Component {
$redir = $this->Session->read('Auth.redirect'); $redir = $this->Session->read('Auth.redirect');
$this->Session->delete('Auth.redirect'); $this->Session->delete('Auth.redirect');
if (Router::normalize($redir) == Router::normalize($this->loginAction)) { if (Router::normalize($redir) === Router::normalize($this->loginAction)) {
$redir = $this->loginRedirect; $redir = $this->loginRedirect;
} }
} elseif ($this->loginRedirect) { } elseif ($this->loginRedirect) {

View file

@ -392,7 +392,7 @@ class PaginatorComponent extends Component {
if (strpos($key, '.') !== false) { if (strpos($key, '.') !== false) {
list($alias, $field) = explode('.', $key); list($alias, $field) = explode('.', $key);
} }
$correctAlias = ($object->alias == $alias); $correctAlias = ($object->alias === $alias);
if ($correctAlias && $object->hasField($field)) { if ($correctAlias && $object->hasField($field)) {
$order[$object->alias . '.' . $field] = $value; $order[$object->alias . '.' . $field] = $value;

View file

@ -525,7 +525,7 @@ class RequestHandlerComponent extends Component {
return $this->mapType($contentType); return $this->mapType($contentType);
} }
if (is_string($type)) { if (is_string($type)) {
return ($type == $this->mapType($contentType)); return ($type === $this->mapType($contentType));
} }
} }

View file

@ -230,7 +230,7 @@ class SecurityComponent extends Component {
$controller->request->params['requested'] != 1 $controller->request->params['requested'] != 1
); );
if ($this->_action == $this->blackHoleCallback) { if ($this->_action === $this->blackHoleCallback) {
return $this->blackHole($controller, 'auth'); return $this->blackHole($controller, 'auth');
} }
@ -362,7 +362,7 @@ class SecurityComponent extends Component {
$property = 'require' . $method; $property = 'require' . $method;
if (is_array($this->$property) && !empty($this->$property)) { if (is_array($this->$property) && !empty($this->$property)) {
$require = $this->$property; $require = $this->$property;
if (in_array($this->_action, $require) || $this->$property == array('*')) { if (in_array($this->_action, $require) || $this->$property === array('*')) {
if (!$this->request->is($method)) { if (!$this->request->is($method)) {
if (!$this->blackHole($controller, $method)) { if (!$this->blackHole($controller, $method)) {
return null; return null;
@ -384,7 +384,7 @@ class SecurityComponent extends Component {
if (is_array($this->requireSecure) && !empty($this->requireSecure)) { if (is_array($this->requireSecure) && !empty($this->requireSecure)) {
$requireSecure = $this->requireSecure; $requireSecure = $this->requireSecure;
if (in_array($this->_action, $requireSecure) || $this->requireSecure == array('*')) { if (in_array($this->_action, $requireSecure) || $this->requireSecure === array('*')) {
if (!$this->request->is('ssl')) { if (!$this->request->is('ssl')) {
if (!$this->blackHole($controller, 'secure')) { if (!$this->blackHole($controller, 'secure')) {
return null; return null;
@ -405,7 +405,7 @@ class SecurityComponent extends Component {
if (is_array($this->requireAuth) && !empty($this->requireAuth) && !empty($this->request->data)) { if (is_array($this->requireAuth) && !empty($this->requireAuth) && !empty($this->request->data)) {
$requireAuth = $this->requireAuth; $requireAuth = $this->requireAuth;
if (in_array($this->request->params['action'], $requireAuth) || $this->requireAuth == array('*')) { if (in_array($this->request->params['action'], $requireAuth) || $this->requireAuth === array('*')) {
if (!isset($controller->request->data['_Token'])) { if (!isset($controller->request->data['_Token'])) {
if (!$this->blackHole($controller, 'auth')) { if (!$this->blackHole($controller, 'auth')) {
return null; return null;

View file

@ -668,7 +668,7 @@ class App {
$type = 'Console'; $type = 'Console';
} elseif (isset(self::$types[$originalType]['suffix'])) { } elseif (isset(self::$types[$originalType]['suffix'])) {
$suffix = self::$types[$originalType]['suffix']; $suffix = self::$types[$originalType]['suffix'];
$name .= ($suffix == $name) ? '' : $suffix; $name .= ($suffix === $name) ? '' : $suffix;
} }
if ($parent && isset(self::$types[$originalType]['extends'])) { if ($parent && isset(self::$types[$originalType]['extends'])) {
$extends = self::$types[$originalType]['extends']; $extends = self::$types[$originalType]['extends'];

View file

@ -165,7 +165,7 @@ class FileLog extends BaseLog {
if (!empty($this->_file)) { if (!empty($this->_file)) {
$filename = $this->_file; $filename = $this->_file;
} elseif ($type == 'error' || $type == 'warning') { } elseif ($type === 'error' || $type === 'warning') {
$filename = 'error.log'; $filename = 'error.log';
} elseif (in_array($type, $debugTypes)) { } elseif (in_array($type, $debugTypes)) {
$filename = 'debug.log'; $filename = 'debug.log';

View file

@ -188,7 +188,7 @@ class ContainableBehavior extends ModelBehavior {
foreach (array('hasOne', 'belongsTo') as $type) { foreach (array('hasOne', 'belongsTo') as $type) {
if (!empty($Model->{$type})) { if (!empty($Model->{$type})) {
foreach ($Model->{$type} as $assoc => $data) { foreach ($Model->{$type} as $assoc => $data) {
if ($Model->useDbConfig == $Model->{$assoc}->useDbConfig && !empty($data['fields'])) { if ($Model->useDbConfig === $Model->{$assoc}->useDbConfig && !empty($data['fields'])) {
foreach ((array)$data['fields'] as $field) { foreach ((array)$data['fields'] as $field) {
$query['fields'][] = (strpos($field, '.') === false ? $assoc . '.' : '') . $field; $query['fields'][] = (strpos($field, '.') === false ? $assoc . '.' : '') . $field;
} }
@ -203,7 +203,7 @@ class ContainableBehavior extends ModelBehavior {
$field = $Model->primaryKey; $field = $Model->primaryKey;
} elseif (preg_match('/^.+\.\-\-[^-]+\-\-$/', $field)) { } elseif (preg_match('/^.+\.\-\-[^-]+\-\-$/', $field)) {
list($modelName, $field) = explode('.', $field); list($modelName, $field) = explode('.', $field);
if ($Model->useDbConfig == $Model->{$modelName}->useDbConfig) { if ($Model->useDbConfig === $Model->{$modelName}->useDbConfig) {
$field = $modelName . '.' . ( $field = $modelName . '.' . (
($field === '--primaryKey--') ? $Model->$modelName->primaryKey : $field ($field === '--primaryKey--') ? $Model->$modelName->primaryKey : $field
); );

View file

@ -121,7 +121,7 @@ class TranslateBehavior extends ModelBehavior {
$this->_joinTable = $joinTable; $this->_joinTable = $joinTable;
$this->_runtimeModel = $RuntimeModel; $this->_runtimeModel = $RuntimeModel;
if (is_string($query['fields']) && "COUNT(*) AS {$db->name('count')}" == $query['fields']) { if (is_string($query['fields']) && $query['fields'] === "COUNT(*) AS {$db->name('count')}") {
$query['fields'] = "COUNT(DISTINCT({$db->name($Model->escapeField())})) {$db->alias}count"; $query['fields'] = "COUNT(DISTINCT({$db->name($Model->escapeField())})) {$db->alias}count";
$query['joins'][] = array( $query['joins'][] = array(
'type' => 'INNER', 'type' => 'INNER',

View file

@ -228,7 +228,8 @@ class TreeBehavior extends ModelBehavior {
if (($node[$left] < $parentNode[$left]) && ($parentNode[$right] < $node[$right])) { if (($node[$left] < $parentNode[$left]) && ($parentNode[$right] < $node[$right])) {
return false; return false;
} elseif ($node[$Model->primaryKey] == $parentNode[$Model->primaryKey]) { }
if ($node[$Model->primaryKey] === $parentNode[$Model->primaryKey]) {
return false; return false;
} }
} }
@ -951,7 +952,7 @@ class TreeBehavior extends ModelBehavior {
} }
$parentNode = $parentNode[0]; $parentNode = $parentNode[0];
if (($Model->id == $parentId)) { if (($Model->id === $parentId)) {
return false; return false;
} elseif (($node[$left] < $parentNode[$left]) && ($parentNode[$right] < $node[$right])) { } elseif (($node[$left] < $parentNode[$left]) && ($parentNode[$right] < $node[$right])) {
return false; return false;

View file

@ -190,7 +190,7 @@ class BehaviorCollection extends ObjectCollection implements CakeEventListener {
parent::unload($name); parent::unload($name);
} }
foreach ($this->_methods as $m => $callback) { foreach ($this->_methods as $m => $callback) {
if (is_array($callback) && $callback[0] == $name) { if (is_array($callback) && $callback[0] === $name) {
unset($this->_methods[$m]); unset($this->_methods[$m]);
} }
} }

View file

@ -230,7 +230,7 @@ class CakeSchema extends Object {
} }
if (isset($this->plugin)) { if (isset($this->plugin)) {
if ($model == $this->plugin . 'AppModel') { if ($model === $this->plugin . 'AppModel') {
continue; continue;
} }
$importModel = $model; $importModel = $model;
@ -608,7 +608,7 @@ class CakeSchema extends Object {
$columns = array(); $columns = array();
foreach ($fields as $name => $value) { foreach ($fields as $name => $value) {
if ($Obj->primaryKey == $name) { if ($Obj->primaryKey === $name) {
$value['key'] = 'primary'; $value['key'] = 'primary';
} }
if (!isset($db->columns[$value['type']])) { if (!isset($db->columns[$value['type']])) {

View file

@ -387,7 +387,7 @@ class Mysql extends DboSource {
if (!empty($conditions)) { if (!empty($conditions)) {
$alias = $this->name($model->alias); $alias = $this->name($model->alias);
if ($model->name == $model->alias) { if ($model->name === $model->alias) {
$joins = implode(' ', $this->_getJoins($model)); $joins = implode(' ', $this->_getJoins($model));
} }
} }
@ -516,7 +516,7 @@ class Mysql extends DboSource {
$colList = array(); $colList = array();
foreach ($compare as $curTable => $types) { foreach ($compare as $curTable => $types) {
$indexes = $tableParameters = $colList = array(); $indexes = $tableParameters = $colList = array();
if (!$table || $table == $curTable) { if (!$table || $table === $curTable) {
$out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n"; $out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n";
foreach ($types as $type => $column) { foreach ($types as $type => $column) {
if (isset($column['indexes'])) { if (isset($column['indexes'])) {

View file

@ -238,7 +238,7 @@ class Postgres extends DboSource {
'length' => $length 'length' => $length
); );
if ($model instanceof Model) { if ($model instanceof Model) {
if ($c->name == $model->primaryKey) { if ($c->name === $model->primaryKey) {
$fields[$c->name]['key'] = 'primary'; $fields[$c->name]['key'] = 'primary';
if ($fields[$c->name]['type'] !== 'string') { if ($fields[$c->name]['type'] !== 'string') {
$fields[$c->name]['length'] = 11; $fields[$c->name]['length'] = 11;
@ -507,7 +507,7 @@ class Postgres extends DboSource {
$colList = array(); $colList = array();
foreach ($compare as $curTable => $types) { foreach ($compare as $curTable => $types) {
$indexes = $colList = array(); $indexes = $colList = array();
if (!$table || $table == $curTable) { if (!$table || $table === $curTable) {
$out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n"; $out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n";
foreach ($types as $type => $column) { foreach ($types as $type => $column) {
if (isset($column['indexes'])) { if (isset($column['indexes'])) {
@ -538,7 +538,7 @@ class Postgres extends DboSource {
$default = isset($col['default']) ? $col['default'] : null; $default = isset($col['default']) ? $col['default'] : null;
$nullable = isset($col['null']) ? $col['null'] : null; $nullable = isset($col['null']) ? $col['null'] : null;
$boolToInt = $original['type'] == 'boolean' && $col['type'] == 'integer'; $boolToInt = $original['type'] === 'boolean' && $col['type'] === 'integer';
unset($col['default'], $col['null']); unset($col['default'], $col['null']);
if ($field !== $col['name']) { if ($field !== $col['name']) {
$newName = $this->name($col['name']); $newName = $this->name($col['name']);

View file

@ -681,7 +681,7 @@ class Sqlserver extends DboSource {
} else { } else {
$result = str_replace('DEFAULT NULL', 'NULL', $result); $result = str_replace('DEFAULT NULL', 'NULL', $result);
} }
} elseif (array_keys($column) == array('type', 'name')) { } elseif (array_keys($column) === array('type', 'name')) {
$result .= ' NULL'; $result .= ' NULL';
} elseif (strpos($result, "DEFAULT N'")) { } elseif (strpos($result, "DEFAULT N'")) {
$result = str_replace("DEFAULT N'", "DEFAULT '", $result); $result = str_replace("DEFAULT N'", "DEFAULT '", $result);

View file

@ -991,7 +991,7 @@ class DboSource extends DataSource {
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
$valueInsert[] = $this->value($values[$i], $model->getColumnType($fields[$i])); $valueInsert[] = $this->value($values[$i], $model->getColumnType($fields[$i]));
$fieldInsert[] = $this->name($fields[$i]); $fieldInsert[] = $this->name($fields[$i]);
if ($fields[$i] == $model->primaryKey) { if ($fields[$i] === $model->primaryKey) {
$id = $values[$i]; $id = $values[$i];
} }
} }
@ -1283,7 +1283,7 @@ class DboSource extends DataSource {
if ($type1 === 'belongsTo' || ($deepModel->alias === $modelAlias && $type === 'belongsTo') || ($deepModel->alias !== $modelAlias)) { if ($type1 === 'belongsTo' || ($deepModel->alias === $modelAlias && $type === 'belongsTo') || ($deepModel->alias !== $modelAlias)) {
$tmpStack = $stack; $tmpStack = $stack;
$tmpStack[] = $assoc1; $tmpStack[] = $assoc1;
if ($linkModel->useDbConfig == $deepModel->useDbConfig) { if ($linkModel->useDbConfig === $deepModel->useDbConfig) {
$db = $this; $db = $this;
} else { } else {
$db = ConnectionManager::getDataSource($deepModel->useDbConfig); $db = ConnectionManager::getDataSource($deepModel->useDbConfig);
@ -1973,7 +1973,7 @@ class DboSource extends DataSource {
$joins = array_merge($model->getAssociated('hasOne'), $model->getAssociated('belongsTo')); $joins = array_merge($model->getAssociated('hasOne'), $model->getAssociated('belongsTo'));
foreach ($joins as $assoc) { foreach ($joins as $assoc) {
if (isset($model->{$assoc}) && $model->useDbConfig == $model->{$assoc}->useDbConfig && $model->{$assoc}->getDataSource()) { if (isset($model->{$assoc}) && $model->useDbConfig === $model->{$assoc}->useDbConfig && $model->{$assoc}->getDataSource()) {
$assocData = $model->getAssociated($assoc); $assocData = $model->getAssociated($assoc);
$join[] = $this->buildJoinStatement(array( $join[] = $this->buildJoinStatement(array(
'table' => $model->{$assoc}, 'table' => $model->{$assoc},
@ -2969,7 +2969,7 @@ class DboSource extends DataSource {
$out = ''; $out = '';
foreach ($schema->tables as $curTable => $columns) { foreach ($schema->tables as $curTable => $columns) {
if (!$tableName || $tableName == $curTable) { if (!$tableName || $tableName === $curTable) {
$cols = $indexes = $tableParameters = array(); $cols = $indexes = $tableParameters = array();
$primary = null; $primary = null;
$table = $this->fullTableName($curTable); $table = $this->fullTableName($curTable);

View file

@ -1486,7 +1486,7 @@ class Model extends Object implements CakeEventListener {
if (strpos($field, '.') !== false) { if (strpos($field, '.') !== false) {
list($model, $field) = explode('.', $field); list($model, $field) = explode('.', $field);
if ($model == $this->alias && isset($this->virtualFields[$field])) { if ($model === $this->alias && isset($this->virtualFields[$field])) {
return true; return true;
} }
} }
@ -1930,7 +1930,7 @@ class Model extends Object implements CakeEventListener {
} }
foreach ((array)$data as $row) { foreach ((array)$data as $row) {
if ((is_string($row) && (strlen($row) == 36 || strlen($row) == 16)) || is_numeric($row)) { if ((is_string($row) && (strlen($row) === 36 || strlen($row) === 16)) || is_numeric($row)) {
$newJoins[] = $row; $newJoins[] = $row;
$values = array($id, $row); $values = array($id, $row);
@ -3478,7 +3478,7 @@ class Model extends Object implements CakeEventListener {
if (!empty($oldConfig) && isset($db->config['prefix'])) { if (!empty($oldConfig) && isset($db->config['prefix'])) {
$oldDb = ConnectionManager::getDataSource($oldConfig); $oldDb = ConnectionManager::getDataSource($oldConfig);
if (!isset($this->tablePrefix) || (!isset($oldDb->config['prefix']) || $this->tablePrefix == $oldDb->config['prefix'])) { if (!isset($this->tablePrefix) || (!isset($oldDb->config['prefix']) || $this->tablePrefix === $oldDb->config['prefix'])) {
$this->tablePrefix = $db->config['prefix']; $this->tablePrefix = $db->config['prefix'];
} }
} elseif (isset($db->config['prefix'])) { } elseif (isset($db->config['prefix'])) {

View file

@ -848,7 +848,7 @@ class CakeRequest implements ArrayAccess {
*/ */
public function data($name) { public function data($name) {
$args = func_get_args(); $args = func_get_args();
if (count($args) == 2) { if (count($args) === 2) {
$this->data = Hash::insert($this->data, $name, $args[1]); $this->data = Hash::insert($this->data, $name, $args[1]);
return $this; return $this;
} }

View file

@ -1147,7 +1147,7 @@ class CakeResponse {
$etagMatches = in_array('*', $etags) || in_array($responseTag, $etags); $etagMatches = in_array('*', $etags) || in_array($responseTag, $etags);
} }
if ($modifiedSince) { if ($modifiedSince) {
$timeMatches = strtotime($this->modified()) == strtotime($modifiedSince); $timeMatches = strtotime($this->modified()) === strtotime($modifiedSince);
} }
$checks = compact('etagMatches', 'timeMatches'); $checks = compact('etagMatches', 'timeMatches');
if (empty($checks)) { if (empty($checks)) {

View file

@ -142,7 +142,7 @@ class AssetDispatcher extends DispatcherFilter {
protected function _deliverAsset(CakeResponse $response, $assetFile, $ext) { protected function _deliverAsset(CakeResponse $response, $assetFile, $ext) {
ob_start(); ob_start();
$compressionEnabled = Configure::read('Asset.compress') && $response->compress(); $compressionEnabled = Configure::read('Asset.compress') && $response->compress();
if ($response->type($ext) == $ext) { if ($response->type($ext) === $ext) {
$contentType = 'application/octet-stream'; $contentType = 'application/octet-stream';
$agent = env('HTTP_USER_AGENT'); $agent = env('HTTP_USER_AGENT');
if (preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent) || preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent)) { if (preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent) || preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent)) {

View file

@ -859,7 +859,7 @@ EXPECTED;
* @return void * @return void
*/ */
public function testPr() { public function testPr() {
$this->skipIf(php_sapi_name() == 'cli', 'Skipping web test in cli mode'); $this->skipIf(php_sapi_name() === 'cli', 'Skipping web test in cli mode');
ob_start(); ob_start();
pr('this is a test'); pr('this is a test');
$result = ob_get_clean(); $result = ob_get_clean();

View file

@ -664,7 +664,7 @@ class CakeSessionTest extends CakeTestCase {
$this->assertEquals($expected, TestCakeSession::id()); $this->assertEquals($expected, TestCakeSession::id());
TestCakeSession::renew(); TestCakeSession::renew();
$this->assertFalse($expected == TestCakeSession::id()); $this->assertFalse($expected === TestCakeSession::id());
$expected = session_id(); $expected = session_id();
$this->assertEquals($expected, TestCakeSession::id()); $this->assertEquals($expected, TestCakeSession::id());

View file

@ -1136,11 +1136,11 @@ class MysqlTest extends CakeTestCase {
$linkModel = $this->Model->Category2->{$assoc}; $linkModel = $this->Model->Category2->{$assoc};
$external = isset($assocData['external']); $external = isset($assocData['external']);
if ($this->Model->Category2->alias == $linkModel->alias && $type !== 'hasAndBelongsToMany' && $type !== 'hasMany') { if ($this->Model->Category2->alias === $linkModel->alias && $type !== 'hasAndBelongsToMany' && $type !== 'hasMany') {
$result = $this->Dbo->generateAssociationQuery($this->Model->Category2, $linkModel, $type, $assoc, $assocData, $queryData, $external, $null); $result = $this->Dbo->generateAssociationQuery($this->Model->Category2, $linkModel, $type, $assoc, $assocData, $queryData, $external, $null);
$this->assertFalse(empty($result)); $this->assertFalse(empty($result));
} else { } else {
if ($this->Model->Category2->useDbConfig == $linkModel->useDbConfig) { if ($this->Model->Category2->useDbConfig === $linkModel->useDbConfig) {
$result = $this->Dbo->generateAssociationQuery($this->Model->Category2, $linkModel, $type, $assoc, $assocData, $queryData, $external, $null); $result = $this->Dbo->generateAssociationQuery($this->Model->Category2, $linkModel, $type, $assoc, $assocData, $queryData, $external, $null);
$this->assertFalse(empty($result)); $this->assertFalse(empty($result));
} }

View file

@ -127,7 +127,7 @@ class HtmlCoverageReportTest extends CakeTestCase {
if (in_array($i + 1, array(5, 9, 2))) { if (in_array($i + 1, array(5, 9, 2))) {
$class = 'uncovered'; $class = 'uncovered';
} }
if ($i + 1 == 2) { if ($i + 1 === 2) {
$class .= ' dead'; $class .= ' dead';
} }
$this->assertTrue(strpos($class, $result) !== 0, 'Class name is wrong ' . $i); $this->assertTrue(strpos($class, $result) !== 0, 'Class name is wrong ' . $i);
@ -175,7 +175,7 @@ class HtmlCoverageReportTest extends CakeTestCase {
if (in_array($i + 1, array(5, 9, 2))) { if (in_array($i + 1, array(5, 9, 2))) {
$class = 'uncovered'; $class = 'uncovered';
} }
if ($i + 1 == 2) { if ($i + 1 === 2) {
$class .= ' dead'; $class .= ' dead';
} }
$this->assertTrue(strpos($class, $result) !== 0, 'Class name is wrong ' . $i); $this->assertTrue(strpos($class, $result) !== 0, 'Class name is wrong ' . $i);

View file

@ -493,8 +493,8 @@ TEXT;
Debugger::dump($var); Debugger::dump($var);
$result = ob_get_clean(); $result = ob_get_clean();
$open = php_sapi_name() == 'cli' ? "\n" : '<pre>'; $open = php_sapi_name() === 'cli' ? "\n" : '<pre>';
$close = php_sapi_name() == 'cli' ? "\n" : '</pre>'; $close = php_sapi_name() === 'cli' ? "\n" : '</pre>';
$expected = <<<TEXT $expected = <<<TEXT
{$open}array( {$open}array(
'People' => array( 'People' => array(

View file

@ -472,7 +472,7 @@ class CakeTime {
public static function isToday($dateString, $timezone = null) { public static function isToday($dateString, $timezone = null) {
$timestamp = self::fromString($dateString, $timezone); $timestamp = self::fromString($dateString, $timezone);
$now = self::fromString('now', $timezone); $now = self::fromString('now', $timezone);
return date('Y-m-d', $timestamp) == date('Y-m-d', $now); return date('Y-m-d', $timestamp) === date('Y-m-d', $now);
} }
/** /**

View file

@ -681,7 +681,7 @@ class Folder {
} }
} }
if (is_dir($from) && file_exists($to) && $options['scheme'] == Folder::OVERWRITE) { if (is_dir($from) && file_exists($to) && $options['scheme'] === Folder::OVERWRITE) {
$this->delete($to); $this->delete($to);
} }
@ -698,7 +698,7 @@ class Folder {
} else { } else {
$this->_errors[] = __d('cake_dev', '%s not created', $to); $this->_errors[] = __d('cake_dev', '%s not created', $to);
} }
} elseif (is_dir($from) && $options['scheme'] == Folder::MERGE) { } elseif (is_dir($from) && $options['scheme'] === Folder::MERGE) {
$options = array_merge($options, array('to' => $to, 'from' => $from)); $options = array_merge($options, array('to' => $to, 'from' => $from));
$this->copy($options); $this->copy($options);
} }

View file

@ -1179,7 +1179,7 @@ class FormHelper extends AppHelper {
} elseif (isset($map[$type])) { } elseif (isset($map[$type])) {
$options['type'] = $map[$type]; $options['type'] = $map[$type];
} }
if ($fieldKey == $primaryKey) { if ($fieldKey === $primaryKey) {
$options['type'] = 'hidden'; $options['type'] = 'hidden';
} }
if ( if (

View file

@ -453,7 +453,7 @@ class HtmlHelper extends AppHelper {
} }
} }
if ($options['rel'] == 'import') { if ($options['rel'] === 'import') {
$out = sprintf( $out = sprintf(
$this->_tags['style'], $this->_tags['style'],
$this->_parseAttributes($options, array('rel', 'block'), '', ' '), $this->_parseAttributes($options, array('rel', 'block'), '', ' '),