Skip to content

Commit e4e5564

Browse files
committed
Apply fixes from StyleCI
1 parent 417739d commit e4e5564

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+206
-180
lines changed

.styleci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ preset: symfony
33
enabled:
44
- align_double_arrow
55
- align_equals
6+
- short_array_syntax
67

78
disabled:
89
- unalign_double_arrow

examples/diff-intersect-sum.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66

77
echo array_sum(array_intersect(
88
array_diff([1, 2, 3, 4, 5], [0, 1, 9]),
9-
array_filter([2, 3, 4], function ($v) { return !($v & 1); })
9+
array_filter([2, 3, 4], function ($v) {
10+
return !($v & 1);
11+
})
1012
));
1113

1214
echo "\n";
1315

1416
echo (new Chain([1, 2, 3, 4, 5]))
1517
->diff([0, 1, 9])
16-
->intersect((new Chain([2, 3, 4]))->filter(function ($v) { return !($v & 1); }))
18+
->intersect((new Chain([2, 3, 4]))->filter(function ($v) {
19+
return !($v & 1);
20+
}))
1721
->sum();

examples/fill-map-filter.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,23 @@
66

77
$arr = array_filter(
88
array_map(
9-
function ($v) { return rand(0, $v); },
9+
function ($v) {
10+
return rand(0, $v);
11+
},
1012
array_fill(0, 10, 20)
1113
),
12-
function ($v) { return $v & 1; }
14+
function ($v) {
15+
return $v & 1;
16+
}
1317
);
1418

1519
print_r($arr);
1620

1721
$chain = Chain::fill(0, 10, 20)
18-
->map(function ($v) { return rand(0, $v); })
19-
->filter(function ($v) { return $v & 1; });
22+
->map(function ($v) {
23+
return rand(0, $v);
24+
})
25+
->filter(function ($v) {
26+
return $v & 1;
27+
});
2028
print_r($chain->array);

src/Chain.php

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -51,45 +51,45 @@
5151
*/
5252
class Chain extends AbstractChain implements Countable
5353
{
54-
use ChangeKeyCase,
55-
Combine,
56-
Count,
57-
CountValues,
58-
Diff,
59-
Fill,
60-
Filter,
61-
Find,
62-
First,
63-
FlatMap,
64-
Flip,
65-
Intersect,
66-
IntersectAssoc,
67-
IntersectKey,
68-
Join,
69-
KeyExists,
70-
Keys,
71-
Last,
72-
Map,
73-
Merge,
74-
Pad,
75-
Pop,
76-
Product,
77-
Push,
78-
Rand,
79-
Reduce,
80-
Replace,
81-
Reverse,
82-
Search,
83-
Shift,
84-
Shuffle,
85-
Slice,
86-
Sort,
87-
SortKeys,
88-
Splice,
89-
Sum,
90-
Unique,
91-
Unshift,
92-
Values;
54+
use ChangeKeyCase;
55+
use Combine;
56+
use Count;
57+
use CountValues;
58+
use Diff;
59+
use Fill;
60+
use Filter;
61+
use Find;
62+
use First;
63+
use FlatMap;
64+
use Flip;
65+
use Intersect;
66+
use IntersectAssoc;
67+
use IntersectKey;
68+
use Join;
69+
use KeyExists;
70+
use Keys;
71+
use Last;
72+
use Map;
73+
use Merge;
74+
use Pad;
75+
use Pop;
76+
use Product;
77+
use Push;
78+
use Rand;
79+
use Reduce;
80+
use Replace;
81+
use Reverse;
82+
use Search;
83+
use Shift;
84+
use Shuffle;
85+
use Slice;
86+
use Sort;
87+
use SortKeys;
88+
use Splice;
89+
use Sum;
90+
use Unique;
91+
use Unshift;
92+
use Values;
9393

9494
/**
9595
* @param array $array
@@ -112,8 +112,8 @@ public static function create(array $array = []): self
112112
/**
113113
* @param string $delimiter If the option `regexp` is `true` this must be a regular expression
114114
* @param string $string
115-
* @param array $options If the option `regexp` is `true` the string is split by using `preg_split()`, otherwise
116-
* `explode()` is used.
115+
* @param array $options if the option `regexp` is `true` the string is split by using `preg_split()`, otherwise
116+
* `explode()` is used
117117
*
118118
* @return self
119119
*/

src/Link/ChangeKeyCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ trait ChangeKeyCase
1414
*
1515
* Changes all keys from lowercased or uppercased. Numbered indices are left as is.
1616
*
17-
* @param int $case Either `CASE_UPPER` or `CASE_LOWER` (default).
17+
* @param int $case either `CASE_UPPER` or `CASE_LOWER` (default)
1818
*
1919
* @return self
2020
*/

src/Link/Combine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ trait Combine
1616
*
1717
* @param Chain|array $keys Array or instance of `Cocur\Chain\Chain` of keys to be used. Illegal values for key
1818
* will be converted to string.
19-
* @param Chain|array $values Array or instance of `Cocur\Chain\Chain` of values to be used.
19+
* @param Chain|array $values array or instance of `Cocur\Chain\Chain` of values to be used
2020
*
2121
* @return self
2222
*/

src/Link/Count.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trait Count
1313
/**
1414
* Counts all elements in the array.
1515
*
16-
* @return int Returns the number of elements in the array.
16+
* @return int returns the number of elements in the array
1717
*/
1818
public function count(): int
1919
{

src/Link/CountValues.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trait CountValues
1515
*
1616
* Returns an array using the values of the array as keys and their frequency as values.
1717
*
18-
* @return array An associative array of values from the array as keys and their count value.
18+
* @return array an associative array of values from the array as keys and their count value
1919
*/
2020
public function countValues(): array
2121
{

src/Link/Diff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ trait Diff
1818
* Compares the array to another array or instance of `Cocur\Chain\Chain` and will set the array of elements that
1919
* are not present in the other array.
2020
*
21-
* @param Chain|array $array2 An array or instance of `Cocur\Chain\Chain` to compare against.
21+
* @param Chain|array $array2 an array or instance of `Cocur\Chain\Chain` to compare against
2222
*
2323
* @return self
2424
*/

src/Link/Fill.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ trait Fill
1919
* @param int $startIndex The first index of the array. If `startIndex` is negative, the first index of the
2020
* returned array will be `startIndex` and the following indices will start from zero.
2121
* @param int $num Number of elements to insert. Must be greater than or equal to zero.
22-
* @param mixed $value Value to use for filling.
22+
* @param mixed $value value to use for filling
2323
*
2424
* @return self
2525
*/

0 commit comments

Comments
 (0)