Browse Source

simplify merges and cs

euromark 12 years ago
parent
commit
f9a44170ee

+ 3 - 3
src/Console/Command/Task/TestTask.php

@@ -451,13 +451,13 @@ class TestTask extends BakeTask {
 	public function generateUses($type, $fullClassName) {
 		$uses = [];
 		$type = strtolower($type);
-		if ($type == 'component') {
+		if ($type === 'component') {
 			$uses[] = 'Cake\Controller\ComponentRegistry';
 		}
-		if ($type == 'table') {
+		if ($type === 'table') {
 			$uses[] = 'Cake\ORM\TableRegistry';
 		}
-		if ($type == 'helper') {
+		if ($type === 'helper') {
 			$uses[] = 'Cake\View\View';
 		}
 		$uses[] = $fullClassName;

+ 1 - 1
src/Console/ConsoleInput.php

@@ -46,7 +46,7 @@ class ConsoleInput {
  * @param string $handle The location of the stream to use as input.
  */
 	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');
 	}
 

+ 1 - 1
src/Console/ConsoleOutput.php

@@ -161,7 +161,7 @@ class ConsoleOutput {
 	public function __construct($stream = 'php://stdout') {
 		$this->_output = fopen($stream, 'w');
 
-		if (DS == '\\' && !(bool)env('ANSICON')) {
+		if (DS === '\\' && !(bool)env('ANSICON')) {
 			$this->_outputAs = static::PLAIN;
 		}
 	}

+ 1 - 1
src/Controller/Component/RequestHandlerComponent.php

@@ -563,7 +563,7 @@ class RequestHandlerComponent extends Component {
  */
 	public function respondAs($type, $options = array()) {
 		$defaults = array('index' => null, 'charset' => null, 'attachment' => false);
-		$options = $options + $defaults;
+		$options += $defaults;
 
 		$cType = $type;
 		if (strpos($type, '/') === false) {

+ 2 - 2
src/Database/Expression/QueryExpression.php

@@ -481,8 +481,8 @@ class QueryExpression implements ExpressionInterface, Countable {
 		if (in_array(strtolower(trim($operator)), ['in', 'not in']) || $typeMultiple) {
 			$type = $type ?: 'string';
 			$type .= $typeMultiple ? null : '[]';
-			$operator = $operator == '=' ? 'IN' : $operator;
-			$operator = $operator == '!=' ? 'NOT IN' : $operator;
+			$operator = $operator === '=' ? 'IN' : $operator;
+			$operator = $operator === '!=' ? 'NOT IN' : $operator;
 			$typeMultiple = true;
 		}
 

+ 1 - 1
src/Event/EventManager.php

@@ -104,7 +104,7 @@ class EventManager {
 			$this->_attachSubscriber($callable);
 			return;
 		}
-		$options = $options + array('priority' => static::$defaultPriority);
+		$options += array('priority' => static::$defaultPriority);
 		$this->_listeners[$eventKey][$options['priority']][] = array(
 			'callable' => $callable,
 		);

+ 1 - 1
src/Log/Engine/FileLog.php

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

+ 2 - 2
src/Network/Http/Response.php

@@ -366,7 +366,7 @@ class Response extends Message {
 			return false;
 		}
 		$key = $this->_exposedProperties[$name];
-		if (substr($key, 0, 4) == '_get') {
+		if (substr($key, 0, 4) === '_get') {
 			return $this->{$key}();
 		}
 		return $this->{$key};
@@ -383,7 +383,7 @@ class Response extends Message {
 			return false;
 		}
 		$key = $this->_exposedProperties[$name];
-		if (substr($key, 0, 4) == '_get') {
+		if (substr($key, 0, 4) === '_get') {
 			$val = $this->{$key}();
 			return $val !== null;
 		}

+ 1 - 1
src/Network/Request.php

@@ -209,7 +209,7 @@ class Request implements \ArrayAccess {
  * @return void
  */
 	protected function _setConfig($config) {
-		if (!empty($config['url']) && $config['url'][0] == '/') {
+		if (!empty($config['url']) && $config['url'][0] === '/') {
 			$config['url'] = substr($config['url'], 1);
 		}
 

+ 1 - 1
src/ORM/Association/SelectableAssociationTrait.php

@@ -38,7 +38,7 @@ trait SelectableAssociationTrait {
  *
  */
 	public function eagerLoader(array $options) {
-		$options = $options + $this->_defaultOptions();
+		$options += $this->_defaultOptions();
 		$queryBuilder = false;
 		if (!empty($options['queryBuilder'])) {
 			$queryBuilder = $options['queryBuilder'];

+ 1 - 1
src/TestSuite/TestCase.php

@@ -572,7 +572,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
 		}
 
 		list($plugin, $baseClass) = pluginSplit($alias);
-		$options = $options + ['alias' => $baseClass] + TableRegistry::config($alias);
+		$options += ['alias' => $baseClass] + TableRegistry::config($alias);
 
 		$mock = $this->getMock($options['className'], $methods, array($options));
 		TableRegistry::set($alias, $mock);

+ 1 - 1
src/View/Helper/FormHelper.php

@@ -278,7 +278,7 @@ class FormHelper extends Helper {
 
 		$isCreate = $context->isCreate();
 
-		$options = $options + [
+		$options += [
 			'type' => $isCreate ? 'post' : 'put',
 			'action' => null,
 			'url' => null,

+ 1 - 1
src/View/Helper/HtmlHelper.php

@@ -420,7 +420,7 @@ class HtmlHelper extends Helper {
 			$options = array_diff_key($options, array('fullBase' => null, 'pathPrefix' => null));
 		}
 
-		if ($options['rel'] == 'import') {
+		if ($options['rel'] === 'import') {
 			$out = $this->formatTemplate('style', [
 				'attrs' => $this->templater()->formatAttributes($options, ['rel', 'block']),
 				'content' => '@import url(' . $url . ');',

+ 1 - 1
tests/TestCase/BasicsTest.php

@@ -1001,7 +1001,7 @@ EXPECTED;
  * @return void
  */
 	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();
 		pr('this is a test');
 		$result = ob_get_clean();

+ 1 - 1
tests/TestCase/Log/Engine/ConsoleLogTest.php

@@ -63,7 +63,7 @@ class ConsoleLogTest extends TestCase {
  * test default value of stream 'outputAs'
  */
 	public function testDefaultOutputAs() {
-		if (DS == '\\' && !(bool)env('ANSICON')) {
+		if (DS === '\\' && !(bool)env('ANSICON')) {
 			$expected = ConsoleOutput::PLAIN;
 		} else {
 			$expected = ConsoleOutput::COLOR;

+ 1 - 1
tests/TestCase/Network/RequestTest.php

@@ -934,7 +934,7 @@ class RequestTest extends TestCase {
 		$this->assertTrue($request->is('closure'));
 
 		Request::addDetector('get', function ($request) {
-			return $request->env('REQUEST_METHOD') == 'GET';
+			return $request->env('REQUEST_METHOD') === 'GET';
 		});
 		$request->env('REQUEST_METHOD', 'GET');
 		$this->assertTrue($request->is('get'));

+ 1 - 1
tests/TestCase/Routing/DispatcherTest.php

@@ -1098,7 +1098,7 @@ class DispatcherTest extends TestCase {
  */
 	protected function _cachePath($here) {
 		$path = $here;
-		if ($here == '/') {
+		if ($here === '/') {
 			$path = 'home';
 		}
 		$path = strtolower(Inflector::slug($path));

+ 5 - 5
tests/TestCase/Utility/DebuggerTest.php

@@ -516,8 +516,8 @@ TEXT;
 		Debugger::dump($var);
 		$result = ob_get_clean();
 
-		$open = php_sapi_name() == 'cli' ? "\n" : '<pre>';
-		$close = php_sapi_name() == 'cli' ? "\n" : '</pre>';
+		$open = php_sapi_name() === 'cli' ? "\n" : '<pre>';
+		$close = php_sapi_name() === 'cli' ? "\n" : '</pre>';
 		$expected = <<<TEXT
 {$open}[
 	'People' => [
@@ -540,8 +540,8 @@ TEXT;
 		Debugger::dump($var, 1);
 		$result = ob_get_clean();
 
-		$open = php_sapi_name() == 'cli' ? "\n" : '<pre>';
-		$close = php_sapi_name() == 'cli' ? "\n" : '</pre>';
+		$open = php_sapi_name() === 'cli' ? "\n" : '<pre>';
+		$close = php_sapi_name() === 'cli' ? "\n" : '</pre>';
 		$expected = <<<TEXT
 {$open}[
 	'People' => [
@@ -646,7 +646,7 @@ object(Cake\Test\TestCase\Utility\DebuggableThing) {
 	'inner' => object(Cake\Test\TestCase\Utility\DebuggableThing) {
 
 		[maximum depth reached]
-	
+
 	}
 
 }

+ 1 - 1
tests/test_app/TestApp/Controller/SomePostsController.php

@@ -43,7 +43,7 @@ class SomePostsController extends Controller {
  * @return void
  */
 	public function beforeFilter(Event $event) {
-		if ($this->request->params['action'] == 'index') {
+		if ($this->request->params['action'] === 'index') {
 			$this->request->params['action'] = 'view';
 		} else {
 			$this->request->params['action'] = 'change';