Skip to content
Permalink
Browse files

Add space after closures' function keyword

  • Loading branch information...
bcrowe committed Sep 19, 2014
1 parent 0ad4219 commit 608e1c5ae739eb8a5bf236455c8a9f6b2a29dd76
Showing with 338 additions and 338 deletions.
  1. +1 −1 src/Cache/Cache.php
  2. +20 −20 src/Collection/CollectionTrait.php
  3. +1 −1 src/Collection/ExtractTrait.php
  4. +1 −1 src/Collection/Iterator/SortIterator.php
  5. +2 −2 src/Collection/Iterator/TreeIterator.php
  6. +1 −1 src/Controller/Component/PaginatorComponent.php
  7. +1 −1 src/Database/Connection.php
  8. +1 −1 src/Database/Dialect/PostgresDialectTrait.php
  9. +2 −2 src/Database/Dialect/SqliteDialectTrait.php
  10. +1 −1 src/Database/Dialect/SqlserverDialectTrait.php
  11. +1 −1 src/Database/Dialect/TupleComparisonTranslatorTrait.php
  12. +1 −1 src/Database/IdentifierQuoter.php
  13. +1 −1 src/Database/Log/QueryLogger.php
  14. +6 −6 src/Database/Query.php
  15. +2 −2 src/Database/QueryCompiler.php
  16. +3 −3 src/Database/SqlDialectTrait.php
  17. +2 −2 src/Datasource/EntityTrait.php
  18. +4 −4 src/Datasource/QueryTrait.php
  19. +6 −6 src/I18n/I18n.php
  20. +5 −5 src/I18n/TranslatorRegistry.php
  21. +5 −5 src/Model/Behavior/TranslateBehavior.php
  22. +8 −8 src/Model/Behavior/TreeBehavior.php
  23. +1 −1 src/Network/Request.php
  24. +1 −1 src/ORM/Association.php
  25. +3 −3 src/ORM/Association/BelongsToMany.php
  26. +2 −2 src/ORM/Association/SelectableAssociationTrait.php
  27. +6 −6 src/ORM/Query.php
  28. +1 −1 src/ORM/ResultSet.php
  29. +6 −6 src/ORM/Table.php
  30. +1 −1 src/Routing/RouteBuilder.php
  31. +3 −3 src/Routing/Router.php
  32. +5 −5 src/TestSuite/Fixture/FixtureManager.php
  33. +2 −2 src/TestSuite/IntegrationTestCase.php
  34. +3 −3 src/Validation/Validator.php
  35. +2 −2 src/View/Form/EntityContext.php
  36. +1 −1 src/View/Helper/FormHelper.php
  37. +1 −1 tests/TestCase/Cache/CacheTest.php
  38. +10 −10 tests/TestCase/Collection/CollectionTest.php
  39. +2 −2 tests/TestCase/Collection/Iterator/MapReduceTest.php
  40. +5 −5 tests/TestCase/Collection/Iterator/SortIteratorTest.php
  41. +1 −1 tests/TestCase/Collection/Iterator/TreeIteratorTest.php
  42. +5 −5 tests/TestCase/Controller/Component/AuthComponentTest.php
  43. +1 −1 tests/TestCase/Controller/Component/RequestHandlerComponentTest.php
  44. +1 −1 tests/TestCase/Core/AppTest.php
  45. +3 −3 tests/TestCase/Database/ConnectionTest.php
  46. +1 −1 tests/TestCase/Database/Expression/CaseExpressionTest.php
  47. +1 −1 tests/TestCase/Database/Expression/TupleComparisonTest.php
  48. +50 −50 tests/TestCase/Database/QueryTest.php
  49. +2 −2 tests/TestCase/DatabaseSuite.php
  50. +2 −2 tests/TestCase/Datasource/QueryCacherTest.php
  51. +10 −10 tests/TestCase/I18n/I18nTest.php
  52. +7 −7 tests/TestCase/Model/Behavior/TranslateBehaviorTest.php
  53. +5 −5 tests/TestCase/Model/Behavior/TreeBehaviorTest.php
  54. +2 −2 tests/TestCase/Model/ModelAwareTraitTest.php
  55. +2 −2 tests/TestCase/Network/Email/SmtpTransportTest.php
  56. +3 −3 tests/TestCase/ORM/Association/BelongsToManyTest.php
  57. +1 −1 tests/TestCase/ORM/Association/BelongsToTest.php
  58. +1 −1 tests/TestCase/ORM/Association/HasManyTest.php
  59. +1 −1 tests/TestCase/ORM/Association/HasOneTest.php
  60. +2 −2 tests/TestCase/ORM/EagerLoaderTest.php
  61. +6 −6 tests/TestCase/ORM/EntityTest.php
  62. +3 −3 tests/TestCase/ORM/QueryRegressionTest.php
  63. +53 −53 tests/TestCase/ORM/QueryTest.php
  64. +13 −13 tests/TestCase/ORM/TableTest.php
  65. +3 −3 tests/TestCase/Routing/DispatcherFilterTest.php
  66. +7 −7 tests/TestCase/Routing/RouteBuilderTest.php
  67. +10 −10 tests/TestCase/Routing/RouterTest.php
  68. +4 −4 tests/TestCase/TestSuite/ControllerTestCaseTest.php
  69. +2 −2 tests/TestCase/Validation/ValidationRuleTest.php
  70. +5 −5 tests/TestCase/Validation/ValidatorTest.php
  71. +1 −1 tests/test_app/config/routes.php
@@ -454,7 +454,7 @@ public static function enabled() {
* Using a Closure to provide data, assume `$this` is a Table object:
*
* {{{
* $results = Cache::remember('all_articles', function() {
* $results = Cache::remember('all_articles', function () {
* return $this->find('all');
* });
* }}}
@@ -42,7 +42,7 @@ trait CollectionTrait {
* ###Example:
*
* {{{
* $collection = (new Collection($items))->each(function($value, $key) {
* $collection = (new Collection($items))->each(function ($value, $key) {
* echo "Element $key: $value";
* });
* }}}
@@ -73,7 +73,7 @@ public function each(callable $c) {
* be present in the resulting collection:
*
* {{{
* $collection = (new Collection([1, 2, 3]))->filter(function($value, $key) {
* $collection = (new Collection([1, 2, 3]))->filter(function ($value, $key) {
* return $value % 2 === 0;
* });
* }}}
@@ -106,7 +106,7 @@ public function filter(callable $c = null) {
* be present in the resulting collection:
*
* {{{
* $collection = (new Collection([1, 2, 3]))->reject(function($value, $key) {
* $collection = (new Collection([1, 2, 3]))->reject(function ($value, $key) {
* return $value % 2 === 0;
* });
* }}}
@@ -132,7 +132,7 @@ public function reject(callable $c) {
* ###Example:
*
* {{{
* $overTwentyOne = (new Collection([24, 45, 60, 15]))->every(function($value, $key) {
* $overTwentyOne = (new Collection([24, 45, 60, 15]))->every(function ($value, $key) {
* return $value > 21;
* });
* }}}
@@ -161,7 +161,7 @@ public function every(callable $c) {
* ###Example:
*
* {{{
* $hasYoungPeople = (new Collection([24, 45, 15]))->every(function($value, $key) {
* $hasYoungPeople = (new Collection([24, 45, 15]))->every(function ($value, $key) {
* return $value < 21;
* });
* }}}
@@ -208,7 +208,7 @@ public function contains($value) {
* Getting a collection of booleans where true indicates if a person is female:
*
* {{{
* $collection = (new Collection($people))->map(function($person, $key) {
* $collection = (new Collection($people))->map(function ($person, $key) {
* return $person->gender === 'female';
* });
* }}}
@@ -282,7 +282,7 @@ public function extract($matcher) {
* // For a collection of employees
* $max = $collection->max('age');
* $max = $collection->max('user.salary');
* $max = $collection->max(function($e) {
* $max = $collection->max(function ($e) {
* return $e->get('user')->get('salary');
* });
*
@@ -311,7 +311,7 @@ public function max($callback, $type = SORT_NUMERIC) {
* // For a collection of employees
* $min = $collection->min('age');
* $min = $collection->min('user.salary');
* $min = $collection->min(function($e) {
* $min = $collection->min(function ($e) {
* return $e->get('user')->get('salary');
* });
*
@@ -344,7 +344,7 @@ public function min($callback, $type = SORT_NUMERIC) {
* ###Example:
*
* {{{
* $items = $collection->sortBy(function($user) {
* $items = $collection->sortBy(function ($user) {
* return $user->age;
* });
*
@@ -391,7 +391,7 @@ public function sortBy($callback, $dir = SORT_DESC, $type = SORT_NUMERIC) {
* $group = (new Collection($items))->groupBy('parent_id');
*
* // Or
* $group = (new Collection($items))->groupBy(function($e) {
* $group = (new Collection($items))->groupBy(function ($e) {
* return $e['parent_id'];
* });
*
@@ -441,7 +441,7 @@ public function groupBy($callback) {
* $indexed = (new Collection($items))->indexBy('id');
*
* // Or
* $indexed = (new Collection($items))->indexBy(function($e) {
* $indexed = (new Collection($items))->indexBy(function ($e) {
* return $e['id'];
* });
*
@@ -487,7 +487,7 @@ public function indexBy($callback) {
* $group = (new Collection($items))->countBy('parent_id');
*
* // Or
* $group = (new Collection($items))->countBy(function($e) {
* $group = (new Collection($items))->countBy(function ($e) {
* return $e['parent_id'];
* });
*
@@ -505,7 +505,7 @@ public function indexBy($callback) {
public function countBy($callback) {
$callback = $this->_propertyExtractor($callback);
$mapper = function($value, $key, $mr) use ($callback) {
$mapper = function ($value, $key, $mr) use ($callback) {
$mr->emitIntermediate($value, $callback($value));
};
@@ -613,12 +613,12 @@ public function match(array $conditions) {
$matchers = [];
foreach ($conditions as $property => $value) {
$extractor = $this->_propertyExtractor($property);
$matchers[] = function($v) use ($extractor, $value) {
$matchers[] = function ($v) use ($extractor, $value) {
return $extractor($v) == $value;
};
}
$filter = function($value) use ($matchers) {
$filter = function ($value) use ($matchers) {
$valid = true;
foreach ($matchers as $match) {
$valid = $valid && $match($value);
@@ -714,7 +714,7 @@ public function combine($keyPath, $valuePath, $groupPath = null) {
'groupPath' => $groupPath ? $this->_propertyExtractor($groupPath) : null
];
$mapper = function($value, $key, $mapReduce) use ($options) {
$mapper = function ($value, $key, $mapReduce) use ($options) {
$rowKey = $options['keyPath'];
$rowVal = $options['valuePath'];
@@ -730,7 +730,7 @@ public function combine($keyPath, $valuePath, $groupPath = null) {
);
};
$reducer = function($values, $key, $mapReduce) {
$reducer = function ($values, $key, $mapReduce) {
$result = [];
foreach ($values as $value) {
$result += $value;
@@ -757,15 +757,15 @@ public function nest($idPath, $parentPath) {
$parentPath = $this->_propertyExtractor($parentPath);
$isObject = !is_array((new Collection($this))->first());
$mapper = function($row, $key, $mapReduce) use (&$parents, $idPath, $parentPath) {
$mapper = function ($row, $key, $mapReduce) use (&$parents, $idPath, $parentPath) {
$row['children'] = [];
$id = $idPath($row, $key);
$parentId = $parentPath($row, $key);
$parents[$id] =& $row;
$mapReduce->emitIntermediate($id, $parentId);
};
$reducer = function($values, $key, $mapReduce) use (&$parents, $isObject) {
$reducer = function ($values, $key, $mapReduce) use (&$parents, $isObject) {
if (empty($key) || !isset($parents[$key])) {
foreach ($values as $id) {
$parents[$id] = $isObject ? $parents[$id] : new ArrayObject($parents[$id]);
@@ -781,7 +781,7 @@ public function nest($idPath, $parentPath) {
$collection = new MapReduce($this, $mapper, $reducer);
if (!$isObject) {
$collection = (new Collection($collection))->map(function($value) {
$collection = (new Collection($collection))->map(function ($value) {
return (array)$value;
});
}
@@ -32,7 +32,7 @@ trait ExtractTrait {
protected function _propertyExtractor($callback) {
if (is_string($callback)) {
$path = explode('.', $callback);
$callback = function($element) use ($path) {
$callback = function ($element) use ($path) {
return $this->_extract($element, $path);
};
}
@@ -25,7 +25,7 @@
*
* {{{
* $items = [$user1, $user2, $user3];
* $sorted = new SortIterator($items, function($user) {
* $sorted = new SortIterator($items, function ($user) {
* return $user->age;
* });
*
@@ -72,7 +72,7 @@ public function __construct(RecursiveIterator $items, $mode = RecursiveIteratorI
* {{{
* $printer = (new Collection($treeStructure))
* ->listNested()
* ->printer(function($item, $key, $iterator) {
* ->printer(function ($item, $key, $iterator) {
* return $item->name;
* });
* }}}
@@ -88,7 +88,7 @@ public function __construct(RecursiveIterator $items, $mode = RecursiveIteratorI
public function printer($valuePath, $keyPath = null, $spacer = '__') {
if (!$keyPath) {
$counter = 0;
$keyPath = function() use (&$counter) {
$keyPath = function () use (&$counter) {
return $counter++;
};
}
@@ -131,7 +131,7 @@ public function implementedEvents() {
* You can also pass an already created instance of a query to this method:
*
* {{{
* $query = $this->Articles->find('popular')->matching('Tags', function($q) {
* $query = $this->Articles->find('popular')->matching('Tags', function ($q) {
* return $q->where(['name' => 'CakePHP'])
* });
* $results = $paginator->paginate($query);
@@ -499,7 +499,7 @@ public function enableForeignKeys() {
* ### Example:
*
* {{{
* $connection->transactional(function($connection) {
* $connection->transactional(function ($connection) {
* $connection->newQuery()->delete('users')->execute();
* });
* }}}
@@ -103,7 +103,7 @@ protected function _transformFunctionExpression(FunctionExpression $expression)
$expression
->name('')
->type('-')
->iterateParts(function($p) {
->iterateParts(function ($p) {
return new FunctionExpression('DATE', [$p['value']], [$p['type']]);
});
break;
@@ -82,7 +82,7 @@ protected function _transformFunctionExpression(FunctionExpression $expression)
$expression
->name('ROUND')
->type('-')
->iterateParts(function($p) {
->iterateParts(function ($p) {
return new FunctionExpression('JULIANDAY', [$p['value']], [$p['type']]);
});
break;
@@ -122,7 +122,7 @@ protected function _insertQueryTranslator($query) {
if ($fillLength > 0) {
$val = array_merge($val, array_fill(0, $fillLength, null));
}
$val = array_map(function($val) {
$val = array_map(function ($val) {
return $val instanceof ExpressionInterface ? $val : '?';
}, $val);
@@ -156,7 +156,7 @@ protected function _transformFunctionExpression(FunctionExpression $expression)
break;
case 'DATEDIFF':
$hasDay = false;
$visitor = function($value) use (&$hasDay){
$visitor = function ($value) use (&$hasDay) {
if ($value === 'day') {
$hasDay = true;
}
@@ -76,7 +76,7 @@ protected function _transformTupleComparison(TupleComparison $expression, $query
}
foreach ($value as $tuple) {
$surrogate->orWhere(function($exp) use ($fields, $tuple) {
$surrogate->orWhere(function ($exp) use ($fields, $tuple) {
foreach ($tuple as $i => $value) {
$exp->add([$fields[$i] => $value]);
}
@@ -206,7 +206,7 @@ protected function _quoteComparison(Comparison $expression) {
* @return void
*/
protected function _quoteOrderBy(OrderByExpression $expression) {
$expression->iterateParts(function($part, &$field) {
$expression->iterateParts(function ($part, &$field) {
if (is_string($field)) {
$field = $this->_driver->quoteIdentifier($field);
}
@@ -56,7 +56,7 @@ protected function _log($query) {
* @return string
*/
protected function _interpolate($query) {
$params = array_map(function($p) {
$params = array_map(function ($p) {
if ($p === null) {
return 'NULL';
}
@@ -200,7 +200,7 @@ public function sql(ValueBinder $generator = null) {
*
* ## Example:
* {{{
* $query->select(['title'])->from('articles')->traverse(function($value, $clause) {
* $query->select(['title'])->from('articles')->traverse(function ($value, $clause) {
* if ($clause === 'select') {
* var_dump($value);
* }
@@ -694,7 +694,7 @@ protected function _makeJoin($table, $conditions, $type) {
* {{{
* $query
* ->where(['title !=' => 'Hello World'])
* ->where(function($exp, $query) {
* ->where(function ($exp, $query) {
* $or = $exp->or_(['id' => 1]);
* $and = $exp->and_(['id >' => 2, 'id <' => 10]);
* return $or->add($and);
@@ -775,7 +775,7 @@ public function where($conditions = null, $types = [], $overwrite = false) {
* {{{
* $query
* ->where(['title' => 'Foo'])
* ->andWhere(function($exp, $query) {
* ->andWhere(function ($exp, $query) {
* return $exp
* ->add(['author_id' => 1])
* ->or_(['author_id' => 2]);
@@ -836,7 +836,7 @@ public function andWhere($conditions, $types = []) {
* {{{
* $query
* ->where(['title' => 'Foo'])
* ->orWhere(function($exp, $query) {
* ->orWhere(function ($exp, $query) {
* return $exp
* ->add(['author_id' => 1])
* ->or_(['author_id' => 2]);
@@ -1434,7 +1434,7 @@ public function clause($name) {
* ## Example
*
* {{{
* $query->decorateResults(function($row) {
* $query->decorateResults(function ($row) {
* $row['order_total'] = $row['subtotal'] + ($row['subtotal'] * $row['tax']);
* return $row;
* });
@@ -1469,7 +1469,7 @@ public function decorateResults($callback, $overwrite = false) {
* @return $this
*/
public function traverseExpressions(callable $callback) {
$visitor = function($expression) use (&$visitor, $callback) {
$visitor = function ($expression) use (&$visitor, $callback) {
if (is_array($expression)) {
foreach ($expression as $e) {
$visitor($e);
@@ -102,7 +102,7 @@ public function compile(Query $query, ValueBinder $generator) {
* @return \Closure
*/
protected function _sqlCompiler(&$sql, $query, $generator) {
return function($parts, $name) use (&$sql, $query, $generator) {
return function ($parts, $name) use (&$sql, $query, $generator) {
if (!count($parts)) {
return;
}
@@ -242,7 +242,7 @@ protected function _buildSetPart($parts, $query, $generator) {
* @return string
*/
protected function _buildUnionPart($parts, $query, $generator) {
$parts = array_map(function($p) use ($generator) {
$parts = array_map(function ($p) use ($generator) {
$p['query'] = $p['query']->sql($generator);
$p['query'] = $p['query'][0] === '(' ? trim($p['query'], '()') : $p['query'];
return $p['all'] ? 'ALL ' . $p['query'] : $p['query'];
Oops, something went wrong.

0 comments on commit 608e1c5

Please sign in to comment.
You can’t perform that action at this time.