Skip to content

Commit

Permalink
Merge pull request #1083 from ceeram/2.3-pmdvars
Browse files Browse the repository at this point in the history
Remove unused local vars.
  • Loading branch information
markstory committed Jan 23, 2013
2 parents a03cbdd + 16be9d4 commit 6ade91e
Show file tree
Hide file tree
Showing 70 changed files with 132 additions and 169 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Console/Command/Task/TestTask.php
Expand Up @@ -398,7 +398,7 @@ protected function _processModel($subject) {
}
if ($type == 'hasAndBelongsToMany') {
if (!empty($subject->hasAndBelongsToMany[$alias]['with'])) {
list($plugin, $joinModel) = pluginSplit($subject->hasAndBelongsToMany[$alias]['with']);
list(, $joinModel) = pluginSplit($subject->hasAndBelongsToMany[$alias]['with']);
} else {
$joinModel = Inflector::classify($subject->hasAndBelongsToMany[$alias]['joinTable']);
}
Expand All @@ -423,7 +423,7 @@ protected function _processController($subject) {
$models = $subject->uses;
}
foreach ($models as $model) {
list($plugin, $model) = pluginSplit($model);
list(, $model) = pluginSplit($model);
$this->_processModel($subject->{$model});
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/DboSource.php
Expand Up @@ -2448,7 +2448,7 @@ public function conditionKeysToString($conditions, $quoteValues = true, $model =
if (is_numeric($key) && empty($value)) {
continue;
} elseif (is_numeric($key) && is_string($value)) {
$out[] = $not . $this->_quoteFields($value);
$out[] = $this->_quoteFields($value);
} elseif ((is_numeric($key) && is_array($value)) || in_array(strtolower(trim($key)), $bool)) {
if (in_array(strtolower(trim($key)), $bool)) {
$join = ' ' . strtoupper($key) . ' ';
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Model.php
Expand Up @@ -1609,7 +1609,7 @@ public function save($data = null, $validate = true, $fieldList = array()) {
$fields = array();

if (!is_array($validate)) {
$options = array_merge($defaults, compact('validate', 'fieldList', 'callbacks'));
$options = array_merge($defaults, compact('validate', 'fieldList'));
} else {
$options = array_merge($defaults, $validate);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/Case/Cache/CacheTest.php
Expand Up @@ -136,7 +136,7 @@ public function testInvalidConfig() {
'serialize' => true,
'random' => 'wii'
));
$read = Cache::read('Test', 'invalid');
Cache::read('Test', 'invalid');
}

/**
Expand Down Expand Up @@ -402,7 +402,7 @@ public function testSet() {

Cache::delete('test_cache');

$global = Cache::settings();
Cache::settings();

Cache::set($_cacheSet);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
Expand Up @@ -181,7 +181,7 @@ public function testSerialize() {

$newread = Cache::read('serialize_test', 'file_test');

$delete = Cache::delete('serialize_test', 'file_test');
Cache::delete('serialize_test', 'file_test');

$this->assertSame($read, serialize($data));

Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Test/Case/Console/Command/AclShellTest.php
Expand Up @@ -115,6 +115,7 @@ public function testViewWithArgument() {
public function testParsingModelAndForeignKey() {
$result = $this->Task->parseIdentifier('Model.foreignKey');
$expected = array('model' => 'Model', 'foreign_key' => 'foreignKey');
$this->assertEquals($expected, $result);

$result = $this->Task->parseIdentifier('mySuperUser');
$this->assertEquals('mySuperUser', $result);
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Console/Command/SchemaShellTest.php
Expand Up @@ -294,7 +294,7 @@ public function testGenerateNoOverwrite() {
$this->Shell->Schema->path = TMP;
$this->Shell->Schema->expects($this->never())->method('read');

$result = $this->Shell->generate();
$this->Shell->generate();
unlink(TMP . 'schema.php');
}

Expand Down
Expand Up @@ -128,6 +128,6 @@ public function testExecuteIntoInteractive() {
)
));

$result = $this->Task->execute();
$this->Task->execute();
}
}
Expand Up @@ -49,7 +49,7 @@ public function setUp() {
array($out, $out, $in)
);
$this->path = TMP . 'tests' . DS . 'extract_task_test';
$Folder = new Folder($this->path . DS . 'locale', true);
new Folder($this->path . DS . 'locale', true);
}

/**
Expand Down
Expand Up @@ -381,7 +381,7 @@ public function testGeneratePluginFixtureFile() {
$this->Task->expects($this->at(0))->method('createFile')
->with($filename, $this->stringContains('class Article'));

$result = $this->Task->generateFixtureFile('Article', array());
$this->Task->generateFixtureFile('Article', array());
CakePlugin::unload();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php
Expand Up @@ -173,7 +173,7 @@ public function testGetNameWithOutOfBoundsOption() {
$this->Task->expects($this->any())->method('in')->will($this->onConsecutiveCalls(99, 1));
$this->Task->expects($this->once())->method('err');

$result = $this->Task->getName('test');
$this->Task->getName('test');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
Expand Up @@ -349,7 +349,7 @@ public function testRegistryClearWhenBuildingTestObjects() {
));
$keys = ClassRegistry::keys();
$this->assertTrue(in_array('test_task_comment', $keys));
$object = $this->Task->buildTestSubject('Model', 'TestTaskComment');
$this->Task->buildTestSubject('Model', 'TestTaskComment');

$keys = ClassRegistry::keys();
$this->assertFalse(in_array('random', $keys));
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php
Expand Up @@ -259,7 +259,7 @@ public function testOptionThatDoesNotExist() {
$parser = new ConsoleOptionParser('test', false);
$parser->addOption('no-commit', array('boolean' => true));

$result = $parser->parse(array('--fail', 'other'));
$parser->parse(array('--fail', 'other'));
}

/**
Expand All @@ -271,7 +271,7 @@ public function testShortOptionThatDoesNotExist() {
$parser = new ConsoleOptionParser('test', false);
$parser->addOption('no-commit', array('boolean' => true));

$result = $parser->parse(array('-f'));
$parser->parse(array('-f'));
}

/**
Expand Down
11 changes: 4 additions & 7 deletions lib/Cake/Test/Case/Console/ShellTest.php
Expand Up @@ -545,7 +545,7 @@ public function testCreateFileNonInteractive() {
$path = TMP . 'shell_test';
$file = $path . DS . 'file1.php';

$Folder = new Folder($path, true);
new Folder($path, true);

$this->Shell->interactive = false;

Expand All @@ -572,7 +572,7 @@ public function testCreateFileInteractive() {

$path = TMP . 'shell_test';
$file = $path . DS . 'file1.php';
$Folder = new Folder($path, true);
new Folder($path, true);

$this->Shell->interactive = true;

Expand Down Expand Up @@ -663,7 +663,6 @@ public function testHasMethod() {
* @return void
*/
public function testRunCommandMain() {
$methods = get_class_methods('Shell');
$Mock = $this->getMock('Shell', array('main', 'startup'), array(), '', false);

$Mock->expects($this->once())->method('main')->will($this->returnValue(true));
Expand All @@ -677,7 +676,6 @@ public function testRunCommandMain() {
* @return void
*/
public function testRunCommandWithMethod() {
$methods = get_class_methods('Shell');
$Mock = $this->getMock('Shell', array('hit_me', 'startup'), array(), '', false);

$Mock->expects($this->once())->method('hit_me')->will($this->returnValue(true));
Expand All @@ -700,7 +698,7 @@ public function testRunCommandBaseclassMethod() {
$Mock->expects($this->never())->method('hr');
$Mock->expects($this->once())->method('out');

$result = $Mock->runCommand('hr', array());
$Mock->runCommand('hr', array());
}

/**
Expand All @@ -709,7 +707,6 @@ public function testRunCommandBaseclassMethod() {
* @return void
*/
public function testRunCommandMissingMethod() {
$methods = get_class_methods('Shell');
$Mock = $this->getMock('Shell', array('startup', 'getOptionParser', 'out'), array(), '', false);
$Parser = $this->getMock('ConsoleOptionParser', array(), array(), '', false);

Expand Down Expand Up @@ -762,7 +759,7 @@ public function testRunCommandHittingTask() {

$Shell->RunCommand = $task;

$result = $Shell->runCommand('run_command', array('run_command', 'one', 'value'));
$Shell->runCommand('run_command', array('run_command', 'one', 'value'));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Console/TaskCollectionTest.php
Expand Up @@ -78,7 +78,7 @@ public function testLoadWithEnableFalse() {
* @return void
*/
public function testLoadMissingTask() {
$result = $this->Tasks->load('ThisTaskShouldAlwaysBeMissing');
$this->Tasks->load('ThisTaskShouldAlwaysBeMissing');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
Expand Up @@ -521,7 +521,7 @@ protected function _debug($printTreesToo = false) {
$values = array_map(array(&$this, '_pad'), $values);
$permissions[$key] = implode (' ', $values);
}
$permisssions = array_map(array(&$this, '_pad'), $permissions);
$permissions = array_map(array(&$this, '_pad'), $permissions);
array_unshift($permissions, 'Current Permissions :');
if ($printTreesToo) {
debug(array('aros' => $this->Acl->Aro->generateTreeList(), 'acos' => $this->Acl->Aco->generateTreeList()));
Expand Down
1 change: 0 additions & 1 deletion lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php
Expand Up @@ -59,7 +59,6 @@ public function testAddRole() {
}

public function testAroResolve() {
$map = $this->Acl->Aro->map;
$this->Acl->Aro->map = array(
'User' => 'FooModel/nickname',
'Role' => 'FooModel/role',
Expand Down
Expand Up @@ -61,7 +61,7 @@ public function tearDown() {
public function testConstrutorException() {
Configure::write('Acl.classname', 'AclClassNameThatDoesNotExist');
$Collection = new ComponentCollection();
$acl = new AclComponent($Collection);
new AclComponent($Collection);
}

/**
Expand Down
Expand Up @@ -848,7 +848,7 @@ public function testBeforeRedirectCallingHeader() {

ob_start();
$RequestHandler->beforeRedirect($controller, 'request_handler_test/param_method/first/second', 403);
$result = ob_get_clean();
ob_get_clean();
}

/**
Expand Down
Expand Up @@ -732,7 +732,7 @@ public function testValidatePostCheckbox() {
$this->Controller->Security->startup($this->Controller);
$key = $this->Controller->request->params['_Token']['key'];

$this->Controller->request->data = $data = array(
$this->Controller->request->data = array(
'Model' => array('username' => '', 'password' => '', 'valid' => '0'),
'_Token' => compact('key', 'fields', 'unlocked')
);
Expand Down Expand Up @@ -1174,7 +1174,7 @@ public function testCsrfSettingMultipleNonces() {

$token = $this->Security->Session->read('_Token');
$this->assertEquals(2, count($token['csrfTokens']), 'Missing the csrf token.');
foreach ($token['csrfTokens'] as $key => $expires) {
foreach ($token['csrfTokens'] as $expires) {
$diff = $csrfExpires - $expires;
$this->assertTrue($diff === 0 || $diff === 1, 'Token expiry does not match');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Controller/ScaffoldTest.php
Expand Up @@ -230,7 +230,7 @@ public function testScaffoldChangingViewProperty() {
$this->Controller->theme = 'TestTheme';
$this->Controller->viewClass = 'Theme';
$this->Controller->constructClasses();
$Scaffold = new TestScaffoldMock($this->Controller, $this->Controller->request);
new TestScaffoldMock($this->Controller, $this->Controller->request);

$this->assertEquals('Scaffold', $this->Controller->viewClass);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Core/ConfigureTest.php
Expand Up @@ -239,7 +239,7 @@ public function testCheckEmpty() {
*/
public function testLoadExceptionOnNonExistantFile() {
Configure::config('test', new PhpReader());
$result = Configure::load('non_existing_configuration_file', 'test');
Configure::load('non_existing_configuration_file', 'test');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Core/ObjectTest.php
Expand Up @@ -105,7 +105,7 @@ public function return_here() {
* @return void
*/
public function paginate_request_action() {
$data = $this->paginate();
$this->paginate();
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Error/ExceptionRendererTest.php
Expand Up @@ -497,7 +497,7 @@ public function testExceptionResponseHeader() {
$ExceptionRenderer->controller->response->expects($this->at(1))->method('_sendHeader')->with('Allow', 'POST, DELETE');
ob_start();
$ExceptionRenderer->render();
$result = ob_get_clean();
ob_get_clean();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Log/CakeLogTest.php
Expand Up @@ -654,7 +654,7 @@ public function testCustomLevelWrites() {
$this->_deleteLogs();
$this->_resetLogConfig();

$levels = CakeLog::levels(array('spam', 'eggs'));
CakeLog::levels(array('spam', 'eggs'));

$testMessage = 'error message';
CakeLog::write('error', $testMessage);
Expand Down
8 changes: 4 additions & 4 deletions lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
Expand Up @@ -152,7 +152,7 @@ public function testContainments() {
* @return void
*/
public function testInvalidContainments() {
$r = $this->_containments($this->Article, array('Comment', 'InvalidBinding'));
$this->_containments($this->Article, array('Comment', 'InvalidBinding'));
}

/**
Expand All @@ -162,7 +162,7 @@ public function testInvalidContainments() {
*/
public function testInvalidContainmentsNoNotices() {
$this->Article->Behaviors->attach('Containable', array('notices' => false));
$r = $this->_containments($this->Article, array('Comment', 'InvalidBinding'));
$this->_containments($this->Article, array('Comment', 'InvalidBinding'));
}

/**
Expand Down Expand Up @@ -243,7 +243,7 @@ public function testBeforeFind() {
* @return void
*/
public function testBeforeFindWithNonExistingBinding() {
$r = $this->Article->find('all', array('contain' => array('Comment' => 'NonExistingBinding')));
$this->Article->find('all', array('contain' => array('Comment' => 'NonExistingBinding')));
}

/**
Expand Down Expand Up @@ -3252,7 +3252,7 @@ public function testOriginalAssociations() {

$firstResult = $this->Article->Comment->find('all', $options);

$dummyResult = $this->Article->Comment->find('all', array(
$this->Article->Comment->find('all', array(
'conditions' => array(
'User.user' => 'mariano'
),
Expand Down

0 comments on commit 6ade91e

Please sign in to comment.