mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
correcting coding-standards
This commit is contained in:
parent
76d21c6d56
commit
b7f1740d2b
7 changed files with 70 additions and 70 deletions
|
@ -432,7 +432,7 @@ class ControllerTask extends BakeTask {
|
|||
}
|
||||
}
|
||||
|
||||
if (intval($enteredController) > 0 && intval($enteredController) <= count($controllers) ) {
|
||||
if (intval($enteredController) > 0 && intval($enteredController) <= count($controllers)) {
|
||||
$controllerName = $controllers[intval($enteredController) - 1];
|
||||
} else {
|
||||
$controllerName = Inflector::camelize($enteredController);
|
||||
|
|
|
@ -688,7 +688,7 @@ class ModelTask extends BakeTask {
|
|||
$prompt = __d('cake_console', 'Would you like to define some additional model associations?');
|
||||
$wannaDoMoreAssoc = $this->in($prompt, array('y', 'n'), 'n');
|
||||
$possibleKeys = $this->_generatePossibleKeys();
|
||||
while (strtolower($wannaDoMoreAssoc) == 'y') {
|
||||
while (strtolower($wannaDoMoreAssoc) === 'y') {
|
||||
$assocs = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
||||
$this->out(__d('cake_console', 'What is the association type?'));
|
||||
$assocType = intval($this->inOptions($assocs, __d('cake_console', 'Enter a number')));
|
||||
|
@ -698,9 +698,9 @@ class ModelTask extends BakeTask {
|
|||
$this->hr();
|
||||
|
||||
$alias = $this->in(__d('cake_console', 'What is the alias for this association?'));
|
||||
$className = $this->in(__d('cake_console', 'What className will %s use?', $alias), null, $alias );
|
||||
$className = $this->in(__d('cake_console', 'What className will %s use?', $alias), null, $alias);
|
||||
|
||||
if ($assocType == 0) {
|
||||
if ($assocType === 0) {
|
||||
if (!empty($possibleKeys[$model->table])) {
|
||||
$showKeys = $possibleKeys[$model->table];
|
||||
} else {
|
||||
|
@ -733,7 +733,7 @@ class ModelTask extends BakeTask {
|
|||
if (!isset($foreignKey)) {
|
||||
$foreignKey = $this->in(__d('cake_console', 'What is the foreignKey? Specify your own.'), null, $suggestedForeignKey);
|
||||
}
|
||||
if ($assocType == 3) {
|
||||
if ($assocType === 3) {
|
||||
$associationForeignKey = $this->in(__d('cake_console', 'What is the associationForeignKey?'), null, $this->_modelKey($model->name));
|
||||
$joinTable = $this->in(__d('cake_console', 'What is the joinTable?'));
|
||||
}
|
||||
|
@ -743,7 +743,7 @@ class ModelTask extends BakeTask {
|
|||
$associations[$assocs[$assocType]][$i]['alias'] = $alias;
|
||||
$associations[$assocs[$assocType]][$i]['className'] = $className;
|
||||
$associations[$assocs[$assocType]][$i]['foreignKey'] = $foreignKey;
|
||||
if ($assocType == 3) {
|
||||
if ($assocType === 3) {
|
||||
$associations[$assocs[$assocType]][$i]['associationForeignKey'] = $associationForeignKey;
|
||||
$associations[$assocs[$assocType]][$i]['joinTable'] = $joinTable;
|
||||
}
|
||||
|
|
|
@ -1881,7 +1881,7 @@ class Model extends Object implements CakeEventListener {
|
|||
if ($keepExisting && !empty($links)) {
|
||||
foreach ($links as $link) {
|
||||
$oldJoin = $link[$join][$this->hasAndBelongsToMany[$assoc]['associationForeignKey']];
|
||||
if (! in_array($oldJoin, $newJoins) ) {
|
||||
if (!in_array($oldJoin, $newJoins)) {
|
||||
$conditions[$associationForeignKey] = $oldJoin;
|
||||
$db->delete($this->{$join}, $conditions);
|
||||
} else {
|
||||
|
@ -2735,7 +2735,7 @@ class Model extends Object implements CakeEventListener {
|
|||
*/
|
||||
protected function _findCount($state, $query, $results = array()) {
|
||||
if ($state === 'before') {
|
||||
if (!empty($query['type']) && isset($this->findMethods[$query['type']]) && $query['type'] !== 'count' ) {
|
||||
if (!empty($query['type']) && isset($this->findMethods[$query['type']]) && $query['type'] !== 'count') {
|
||||
$query['operation'] = 'count';
|
||||
$query = $this->{'_find' . ucfirst($query['type'])}('before', $query);
|
||||
}
|
||||
|
|
|
@ -694,7 +694,7 @@ class TestTaskTest extends CakeTestCase {
|
|||
public function testTestCaseFileNamePlugin() {
|
||||
$this->Task->path = DS . 'my' . DS . 'path' . DS . 'tests' . DS;
|
||||
|
||||
CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS ));
|
||||
CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS));
|
||||
$this->Task->plugin = 'TestTest';
|
||||
$result = $this->Task->testCaseFileName('Model', 'Post');
|
||||
$expected = APP . 'Plugin' . DS . 'TestTest' . DS . 'Test' . DS . 'Case' . DS . 'Model' . DS . 'PostTest.php';
|
||||
|
|
|
@ -118,7 +118,7 @@ class PhpAclTest extends CakeTestCase {
|
|||
$this->Acl->Aro->addAlias(array('Role/25' => 'Role/IT'));
|
||||
$this->Acl->allow('Role/IT', '/rules/debugging/*');
|
||||
|
||||
$this->assertEquals(array(array('Role/IT', )), $this->Acl->Aro->roles($user));
|
||||
$this->assertEquals(array(array('Role/IT')), $this->Acl->Aro->roles($user));
|
||||
$this->assertTrue($this->Acl->check($user, '/rules/debugging/stats/pageload'));
|
||||
$this->assertTrue($this->Acl->check($user, '/rules/debugging/sql/queries'));
|
||||
// Role/default is allowed users dashboard, but not Role/IT
|
||||
|
|
|
@ -1893,7 +1893,7 @@ class I18nTest extends CakeTestCase {
|
|||
private function __domainPlural($domain = 'test_plugin') {
|
||||
$plurals = array();
|
||||
for ($number = 0; $number <= 25; $number++) {
|
||||
$plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float)$number), (float)$number );
|
||||
$plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float)$number), (float)$number);
|
||||
}
|
||||
return $plurals;
|
||||
}
|
||||
|
@ -1949,7 +1949,7 @@ class I18nTest extends CakeTestCase {
|
|||
private function __pluralFromCore() {
|
||||
$plurals = array();
|
||||
for ($number = 0; $number <= 25; $number++) {
|
||||
$plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number );
|
||||
$plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number);
|
||||
}
|
||||
return $plurals;
|
||||
}
|
||||
|
|
|
@ -636,8 +636,8 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$parent = $this->Tree->findByName('1. Root', array('id'));
|
||||
$this->Tree->id = $parent[$modelClass]['id'];
|
||||
$result = $this->Tree->children(null, true, array('name'));
|
||||
$expected = array(array($modelClass => array('name' => '1.2', )),
|
||||
array($modelClass => array('name' => '1.1', )));
|
||||
$expected = array(array($modelClass => array('name' => '1.2')),
|
||||
array($modelClass => array('name' => '1.1')));
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
|
||||
|
@ -658,8 +658,8 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$parent = $this->Tree->findByName('1. Root', array('id'));
|
||||
$this->Tree->id = $parent[$modelClass]['id'];
|
||||
$result = $this->Tree->children(null, true, array('name'));
|
||||
$expected = array(array($modelClass => array('name' => '1.1', )),
|
||||
array($modelClass => array('name' => '1.2', )));
|
||||
$expected = array(array($modelClass => array('name' => '1.1')),
|
||||
array($modelClass => array('name' => '1.2')));
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
|
||||
|
@ -680,16 +680,16 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$this->Tree->id = $parent[$modelClass]['id'];
|
||||
$result = $this->Tree->children(null, true, array('name'));
|
||||
$expected = array(
|
||||
array($modelClass => array('name' => '1.1', )),
|
||||
array($modelClass => array('name' => '1.2', )),
|
||||
array($modelClass => array('name' => '1.5', )),
|
||||
array($modelClass => array('name' => '1.3', )),
|
||||
array($modelClass => array('name' => '1.4', )),
|
||||
array($modelClass => array('name' => '1.6', )),
|
||||
array($modelClass => array('name' => '1.7', )),
|
||||
array($modelClass => array('name' => '1.8', )),
|
||||
array($modelClass => array('name' => '1.9', )),
|
||||
array($modelClass => array('name' => '1.10', )));
|
||||
array($modelClass => array('name' => '1.1')),
|
||||
array($modelClass => array('name' => '1.2')),
|
||||
array($modelClass => array('name' => '1.5')),
|
||||
array($modelClass => array('name' => '1.3')),
|
||||
array($modelClass => array('name' => '1.4')),
|
||||
array($modelClass => array('name' => '1.6')),
|
||||
array($modelClass => array('name' => '1.7')),
|
||||
array($modelClass => array('name' => '1.8')),
|
||||
array($modelClass => array('name' => '1.9')),
|
||||
array($modelClass => array('name' => '1.10')));
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
|
||||
|
@ -710,16 +710,16 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$this->Tree->id = $parent[$modelClass]['id'];
|
||||
$result = $this->Tree->children(null, true, array('name'));
|
||||
$expected = array(
|
||||
array($modelClass => array('name' => '1.5', )),
|
||||
array($modelClass => array('name' => '1.1', )),
|
||||
array($modelClass => array('name' => '1.2', )),
|
||||
array($modelClass => array('name' => '1.3', )),
|
||||
array($modelClass => array('name' => '1.4', )),
|
||||
array($modelClass => array('name' => '1.6', )),
|
||||
array($modelClass => array('name' => '1.7', )),
|
||||
array($modelClass => array('name' => '1.8', )),
|
||||
array($modelClass => array('name' => '1.9', )),
|
||||
array($modelClass => array('name' => '1.10', )));
|
||||
array($modelClass => array('name' => '1.5')),
|
||||
array($modelClass => array('name' => '1.1')),
|
||||
array($modelClass => array('name' => '1.2')),
|
||||
array($modelClass => array('name' => '1.3')),
|
||||
array($modelClass => array('name' => '1.4')),
|
||||
array($modelClass => array('name' => '1.6')),
|
||||
array($modelClass => array('name' => '1.7')),
|
||||
array($modelClass => array('name' => '1.8')),
|
||||
array($modelClass => array('name' => '1.9')),
|
||||
array($modelClass => array('name' => '1.10')));
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
|
||||
|
@ -739,8 +739,8 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$parent = $this->Tree->findByName('1. Root', array('id'));
|
||||
$this->Tree->id = $parent[$modelClass]['id'];
|
||||
$result = $this->Tree->children(null, true, array('name'));
|
||||
$expected = array(array($modelClass => array('name' => '1.2', )),
|
||||
array($modelClass => array('name' => '1.1', )));
|
||||
$expected = array(array($modelClass => array('name' => '1.2')),
|
||||
array($modelClass => array('name' => '1.1')));
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
|
||||
|
@ -760,8 +760,8 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$parent = $this->Tree->findByName('1. Root', array('id'));
|
||||
$this->Tree->id = $parent[$modelClass]['id'];
|
||||
$result = $this->Tree->children(null, true, array('name'));
|
||||
$expected = array(array($modelClass => array('name' => '1.1', )),
|
||||
array($modelClass => array('name' => '1.2', )));
|
||||
$expected = array(array($modelClass => array('name' => '1.1')),
|
||||
array($modelClass => array('name' => '1.2')));
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
|
||||
|
@ -782,16 +782,16 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$this->Tree->id = $parent[$modelClass]['id'];
|
||||
$result = $this->Tree->children(null, true, array('name'));
|
||||
$expected = array(
|
||||
array($modelClass => array('name' => '1.1', )),
|
||||
array($modelClass => array('name' => '1.2', )),
|
||||
array($modelClass => array('name' => '1.3', )),
|
||||
array($modelClass => array('name' => '1.4', )),
|
||||
array($modelClass => array('name' => '1.6', )),
|
||||
array($modelClass => array('name' => '1.7', )),
|
||||
array($modelClass => array('name' => '1.8', )),
|
||||
array($modelClass => array('name' => '1.9', )),
|
||||
array($modelClass => array('name' => '1.10', )),
|
||||
array($modelClass => array('name' => '1.5', )));
|
||||
array($modelClass => array('name' => '1.1')),
|
||||
array($modelClass => array('name' => '1.2')),
|
||||
array($modelClass => array('name' => '1.3')),
|
||||
array($modelClass => array('name' => '1.4')),
|
||||
array($modelClass => array('name' => '1.6')),
|
||||
array($modelClass => array('name' => '1.7')),
|
||||
array($modelClass => array('name' => '1.8')),
|
||||
array($modelClass => array('name' => '1.9')),
|
||||
array($modelClass => array('name' => '1.10')),
|
||||
array($modelClass => array('name' => '1.5')));
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
|
||||
|
@ -812,16 +812,16 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$this->Tree->id = $parent[$modelClass]['id'];
|
||||
$result = $this->Tree->children(null, true, array('name'));
|
||||
$expected = array(
|
||||
array($modelClass => array('name' => '1.1', )),
|
||||
array($modelClass => array('name' => '1.2', )),
|
||||
array($modelClass => array('name' => '1.3', )),
|
||||
array($modelClass => array('name' => '1.4', )),
|
||||
array($modelClass => array('name' => '1.6', )),
|
||||
array($modelClass => array('name' => '1.7', )),
|
||||
array($modelClass => array('name' => '1.5', )),
|
||||
array($modelClass => array('name' => '1.8', )),
|
||||
array($modelClass => array('name' => '1.9', )),
|
||||
array($modelClass => array('name' => '1.10', )));
|
||||
array($modelClass => array('name' => '1.1')),
|
||||
array($modelClass => array('name' => '1.2')),
|
||||
array($modelClass => array('name' => '1.3')),
|
||||
array($modelClass => array('name' => '1.4')),
|
||||
array($modelClass => array('name' => '1.6')),
|
||||
array($modelClass => array('name' => '1.7')),
|
||||
array($modelClass => array('name' => '1.5')),
|
||||
array($modelClass => array('name' => '1.8')),
|
||||
array($modelClass => array('name' => '1.9')),
|
||||
array($modelClass => array('name' => '1.10')));
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
|
||||
|
@ -842,16 +842,16 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$this->Tree->id = $parent[$modelClass]['id'];
|
||||
$result = $this->Tree->children(null, true, array('name'));
|
||||
$expected = array(
|
||||
array($modelClass => array('name' => '1.1', )),
|
||||
array($modelClass => array('name' => '1.2', )),
|
||||
array($modelClass => array('name' => '1.3', )),
|
||||
array($modelClass => array('name' => '1.4', )),
|
||||
array($modelClass => array('name' => 'renamed', )),
|
||||
array($modelClass => array('name' => '1.6', )),
|
||||
array($modelClass => array('name' => '1.7', )),
|
||||
array($modelClass => array('name' => '1.8', )),
|
||||
array($modelClass => array('name' => '1.9', )),
|
||||
array($modelClass => array('name' => '1.10', )));
|
||||
array($modelClass => array('name' => '1.1')),
|
||||
array($modelClass => array('name' => '1.2')),
|
||||
array($modelClass => array('name' => '1.3')),
|
||||
array($modelClass => array('name' => '1.4')),
|
||||
array($modelClass => array('name' => 'renamed')),
|
||||
array($modelClass => array('name' => '1.6')),
|
||||
array($modelClass => array('name' => '1.7')),
|
||||
array($modelClass => array('name' => '1.8')),
|
||||
array($modelClass => array('name' => '1.9')),
|
||||
array($modelClass => array('name' => '1.10')));
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue