Skip to content

Commit

Permalink
== to === and != to !== where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed Feb 12, 2013
1 parent ee4a116 commit 111366d
Show file tree
Hide file tree
Showing 89 changed files with 291 additions and 291 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Cache/Engine/MemcacheEngine.php
Expand Up @@ -106,10 +106,10 @@ public function init($settings = array()) {
* @return array Array containing host, port
*/
protected function _parseServerString($server) {
if ($server[0] == 'u') {
if ($server[0] === 'u') {
return array($server, 0);
}
if (substr($server, 0, 1) == '[') {
if (substr($server, 0, 1) === '[') {
$position = strpos($server, ']:');
if ($position !== false) {
$position++;
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Configure/IniReader.php
Expand Up @@ -160,7 +160,7 @@ public function dump($key, $data) {
$result = array();
foreach ($data as $k => $value) {
$isSection = false;
if ($k[0] != '[') {
if ($k[0] !== '[') {
$result[] = "[$k]";
$isSection = true;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Console/Command/AclShell.php
Expand Up @@ -122,14 +122,14 @@ public function create() {
$class = ucfirst($this->args[0]);
$parent = $this->parseIdentifier($this->args[1]);

if (!empty($parent) && $parent != '/' && $parent != 'root') {
if (!empty($parent) && $parent !== '/' && $parent !== 'root') {
$parent = $this->_getNodeId($class, $parent);
} else {
$parent = null;
}

$data = $this->parseIdentifier($this->args[2]);
if (is_string($data) && $data != '/') {
if (is_string($data) && $data !== '/') {
$data = array('alias' => $data);
} elseif (is_string($data)) {
$this->error(__d('cake_console', '/ can not be used as an alias!') . __d('cake_console', " / is the root, please supply a sub alias"));
Expand Down Expand Up @@ -604,7 +604,7 @@ protected function _dataVars($type = null) {
}
$vars = array();
$class = ucwords($type);
$vars['secondary_id'] = (strtolower($class) == 'aro') ? 'foreign_key' : 'object_id';
$vars['secondary_id'] = (strtolower($class) === 'aro') ? 'foreign_key' : 'object_id';
$vars['data_name'] = $type;
$vars['table_name'] = $type . 's';
$vars['class'] = $class;
Expand Down
20 changes: 10 additions & 10 deletions lib/Cake/Console/Command/Task/ControllerTask.php
Expand Up @@ -66,7 +66,7 @@ public function execute() {
if (!isset($this->connection)) {
$this->connection = 'default';
}
if (strtolower($this->args[0]) == 'all') {
if (strtolower($this->args[0]) === 'all') {
return $this->all();
}

Expand Down Expand Up @@ -162,13 +162,13 @@ protected function _interactive() {
}
$doItInteractive = $this->in(implode("\n", $question), array('y', 'n'), 'y');

if (strtolower($doItInteractive) == 'y') {
if (strtolower($doItInteractive) === 'y') {
$this->interactive = true;
$useDynamicScaffold = $this->in(
__d('cake_console', "Would you like to use dynamic scaffolding?"), array('y', 'n'), 'n'
);

if (strtolower($useDynamicScaffold) == 'y') {
if (strtolower($useDynamicScaffold) === 'y') {
$wannaBakeCrud = 'n';
$actions = 'scaffold';
} else {
Expand All @@ -185,20 +185,20 @@ protected function _interactive() {
list($wannaBakeCrud, $wannaBakeAdminCrud) = $this->_askAboutMethods();
}

if (strtolower($wannaBakeCrud) == 'y') {
$actions = $this->bakeActions($controllerName, null, strtolower($wannaUseSession) == 'y');
if (strtolower($wannaBakeCrud) === 'y') {
$actions = $this->bakeActions($controllerName, null, strtolower($wannaUseSession) === 'y');
}
if (strtolower($wannaBakeAdminCrud) == 'y') {
if (strtolower($wannaBakeAdminCrud) === 'y') {
$admin = $this->Project->getPrefix();
$actions .= $this->bakeActions($controllerName, $admin, strtolower($wannaUseSession) == 'y');
$actions .= $this->bakeActions($controllerName, $admin, strtolower($wannaUseSession) === 'y');
}

$baked = false;
if ($this->interactive === true) {
$this->confirmController($controllerName, $useDynamicScaffold, $helpers, $components);
$looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y','n'), 'y');

if (strtolower($looksGood) == 'y') {
if (strtolower($looksGood) === 'y') {
$baked = $this->bake($controllerName, $actions, $helpers, $components);
if ($baked && $this->_checkUnitTest()) {
$this->bakeTest($controllerName);
Expand Down Expand Up @@ -229,7 +229,7 @@ public function confirmController($controllerName, $useDynamicScaffold, $helpers
$this->hr();
$this->out(__d('cake_console', "Controller Name:\n\t%s", $controllerName));

if (strtolower($useDynamicScaffold) == 'y') {
if (strtolower($useDynamicScaffold) === 'y') {
$this->out("public \$scaffold;");
}

Expand Down Expand Up @@ -386,7 +386,7 @@ public function doComponents() {
protected function _doPropertyChoices($prompt, $example) {
$proceed = $this->in($prompt, array('y','n'), 'n');
$property = array();
if (strtolower($proceed) == 'y') {
if (strtolower($proceed) === 'y') {
$propertyList = $this->in($example);
$propertyListTrimmed = str_replace(' ', '', $propertyList);
$property = explode(',', $propertyListTrimmed);
Expand Down
18 changes: 9 additions & 9 deletions lib/Cake/Console/Command/Task/DbConfigTask.php
Expand Up @@ -110,7 +110,7 @@ protected function _interactive() {
$datasource = $this->in(__d('cake_console', 'Datasource:'), array('Mysql', 'Postgres', 'Sqlite', 'Sqlserver'), 'Mysql');

$persistent = $this->in(__d('cake_console', 'Persistent Connection?'), array('y', 'n'), 'n');
if (strtolower($persistent) == 'n') {
if (strtolower($persistent) === 'n') {
$persistent = 'false';
} else {
$persistent = 'true';
Expand All @@ -126,7 +126,7 @@ protected function _interactive() {
$port = $this->in(__d('cake_console', 'Port?'), null, 'n');
}

if (strtolower($port) == 'n') {
if (strtolower($port) === 'n') {
$port = null;
}

Expand All @@ -142,7 +142,7 @@ protected function _interactive() {

if (!$password) {
$blank = $this->in(__d('cake_console', 'The password you supplied was empty. Use an empty password?'), array('y', 'n'), 'n');
if ($blank == 'y') {
if ($blank === 'y') {
$blankPassword = true;
}
}
Expand All @@ -157,25 +157,25 @@ protected function _interactive() {
while (!$prefix) {
$prefix = $this->in(__d('cake_console', 'Table Prefix?'), null, 'n');
}
if (strtolower($prefix) == 'n') {
if (strtolower($prefix) === 'n') {
$prefix = null;
}

$encoding = '';
while (!$encoding) {
$encoding = $this->in(__d('cake_console', 'Table encoding?'), null, 'n');
}
if (strtolower($encoding) == 'n') {
if (strtolower($encoding) === 'n') {
$encoding = null;
}

$schema = '';
if ($datasource == 'postgres') {
if ($datasource === 'postgres') {
while (!$schema) {
$schema = $this->in(__d('cake_console', 'Table schema?'), null, 'n');
}
}
if (strtolower($schema) == 'n') {
if (strtolower($schema) === 'n') {
$schema = null;
}

Expand All @@ -188,7 +188,7 @@ protected function _interactive() {
$dbConfigs[] = $config;
$doneYet = $this->in(__d('cake_console', 'Do you wish to add another database configuration?'), null, 'n');

if (strtolower($doneYet == 'n')) {
if (strtolower($doneYet === 'n')) {
$done = true;
}
}
Expand Down Expand Up @@ -239,7 +239,7 @@ protected function _verify($config) {
$this->hr();
$looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y', 'n'), 'y');

if (strtolower($looksGood) == 'y') {
if (strtolower($looksGood) === 'y') {
return $config;
}
return false;
Expand Down
20 changes: 10 additions & 10 deletions lib/Cake/Console/Command/Task/ExtractTask.php
Expand Up @@ -388,14 +388,14 @@ protected function _parse($functionName, $map) {
}

list($type, $string, $line) = $countToken;
if (($type == T_STRING) && ($string == $functionName) && ($firstParenthesis == '(')) {
if (($type == T_STRING) && ($string == $functionName) && ($firstParenthesis === '(')) {
$position = $count;
$depth = 0;

while (!$depth) {
if ($this->_tokens[$position] == '(') {
if ($this->_tokens[$position] === '(') {
$depth++;
} elseif ($this->_tokens[$position] == ')') {
} elseif ($this->_tokens[$position] === ')') {
$depth--;
}
$position++;
Expand Down Expand Up @@ -537,7 +537,7 @@ protected function _buildFiles() {
}

$this->_store($domain, $header, $sentence);
if ($domain != 'default' && $this->_merge) {
if ($domain !== 'default' && $this->_merge) {
$this->_store('default', $header, $sentence);
}
}
Expand Down Expand Up @@ -640,11 +640,11 @@ protected function _writeHeader() {
protected function _getStrings(&$position, $target) {
$strings = array();
$count = count($strings);
while ($count < $target && ($this->_tokens[$position] == ',' || $this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING)) {
while ($count < $target && ($this->_tokens[$position] === ',' || $this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING)) {
$count = count($strings);
if ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING && $this->_tokens[$position + 1] == '.') {
if ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING && $this->_tokens[$position + 1] === '.') {
$string = '';
while ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING || $this->_tokens[$position] == '.') {
while ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING || $this->_tokens[$position] === '.') {
if ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING) {
$string .= $this->_formatString($this->_tokens[$position][1]);
}
Expand All @@ -668,7 +668,7 @@ protected function _getStrings(&$position, $target) {
protected function _formatString($string) {
$quote = substr($string, 0, 1);
$string = substr($string, 1, -1);
if ($quote == '"') {
if ($quote === '"') {
$string = stripcslashes($string);
} else {
$string = strtr($string, array("\\'" => "'", "\\\\" => "\\"));
Expand Down Expand Up @@ -697,11 +697,11 @@ protected function _markerError($file, $line, $marker, $count) {
$this->out($this->_tokens[$count][1], false);
} else {
$this->out($this->_tokens[$count], false);
if ($this->_tokens[$count] == '(') {
if ($this->_tokens[$count] === '(') {
$parenthesis++;
}

if ($this->_tokens[$count] == ')') {
if ($this->_tokens[$count] === ')') {
$parenthesis--;
}
}
Expand Down
14 changes: 7 additions & 7 deletions lib/Cake/Console/Command/Task/FixtureTask.php
Expand Up @@ -107,7 +107,7 @@ public function execute() {
if (!isset($this->connection)) {
$this->connection = 'default';
}
if (strtolower($this->args[0]) == 'all') {
if (strtolower($this->args[0]) === 'all') {
return $this->all();
}
$model = $this->_modelName($this->args[0]);
Expand Down Expand Up @@ -159,17 +159,17 @@ protected function _interactive() {
public function importOptions($modelName) {
$options = array();
$doSchema = $this->in(__d('cake_console', 'Would you like to import schema for this fixture?'), array('y', 'n'), 'n');
if ($doSchema == 'y') {
if ($doSchema === 'y') {
$options['schema'] = $modelName;
}
$doRecords = $this->in(__d('cake_console', 'Would you like to use record importing for this fixture?'), array('y', 'n'), 'n');
if ($doRecords == 'y') {
if ($doRecords === 'y') {
$options['records'] = true;
}
if ($doRecords == 'n') {
if ($doRecords === 'n') {
$prompt = __d('cake_console', "Would you like to build this fixture with data from %s's table?", $modelName);
$fromTable = $this->in($prompt, array('y', 'n'), 'n');
if (strtolower($fromTable) == 'y') {
if (strtolower($fromTable) === 'y') {
$options['fromTable'] = true;
}
}
Expand Down Expand Up @@ -203,7 +203,7 @@ public function bake($model, $useTable = false, $importOptions = array()) {
if (isset($importOptions['records'])) {
$importBits[] = "'records' => true";
}
if ($this->connection != 'default') {
if ($this->connection !== 'default') {
$importBits[] .= "'connection' => '{$this->connection}'";
}
if (!empty($importBits)) {
Expand Down Expand Up @@ -307,7 +307,7 @@ protected function _generateRecords($tableInfo, $recordCount = 1) {
case 'string':
case 'binary':
$isPrimaryUuid = (
isset($fieldInfo['key']) && strtolower($fieldInfo['key']) == 'primary' &&
isset($fieldInfo['key']) && strtolower($fieldInfo['key']) === 'primary' &&
isset($fieldInfo['length']) && $fieldInfo['length'] == 36
);
if ($isPrimaryUuid) {
Expand Down

0 comments on commit 111366d

Please sign in to comment.