Skip to content

Commit b8639b0

Browse files
committed
CS fixes
1 parent 285ceae commit b8639b0

11 files changed

+27
-39
lines changed

src/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function all(array $promisesOrValues)
4444
function race(array $promisesOrValues)
4545
{
4646
if (!$promisesOrValues) {
47-
return new Promise(function() {});
47+
return new Promise(function () {});
4848
}
4949

5050
$cancellationQueue = new Internal\CancellationQueue();

tests/FunctionAnyTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function shouldRejectWithLengthExceptionWithEmptyInputArray()
1414
->expects($this->once())
1515
->method('__invoke')
1616
->with(
17-
$this->callback(function($exception){
17+
$this->callback(function ($exception) {
1818
return $exception instanceof LengthException &&
1919
'Input array must contain at least 1 item but contains only 0 items.' === $exception->getMessage();
2020
})
@@ -98,8 +98,8 @@ public function shouldNotRelyOnArryIndexesWhenUnwrappingToASingleResolutionValue
9898
/** @test */
9999
public function shouldCancelInputArrayPromises()
100100
{
101-
$promise1 = new Promise(function() {}, $this->expectCallableOnce());
102-
$promise2 = new Promise(function() {}, $this->expectCallableOnce());
101+
$promise1 = new Promise(function () {}, $this->expectCallableOnce());
102+
$promise2 = new Promise(function () {}, $this->expectCallableOnce());
103103

104104
any([$promise1, $promise2])->cancel();
105105
}
@@ -110,7 +110,7 @@ public function shouldNotCancelOtherPendingInputArrayPromisesIfOnePromiseFulfill
110110
$deferred = new Deferred($this->expectCallableNever());
111111
$deferred->resolve();
112112

113-
$promise2 = new Promise(function() {}, $this->expectCallableNever());
113+
$promise2 = new Promise(function () {}, $this->expectCallableNever());
114114

115115
some([$deferred->promise(), $promise2], 1)->cancel();
116116
}

tests/FunctionCheckTypehintTest.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,36 @@ class FunctionCheckTypehintTest extends TestCase
77
/** @test */
88
public function shouldAcceptClosureCallbackWithTypehint()
99
{
10-
$this->assertTrue(_checkTypehint(function (\InvalidArgumentException $e) {
11-
}, new \InvalidArgumentException()));
12-
$this->assertfalse(_checkTypehint(function (\InvalidArgumentException $e) {
13-
}, new \Exception()));
10+
$this->assertTrue(_checkTypehint(function (\InvalidArgumentException $e) {}, new \InvalidArgumentException()));
11+
$this->assertFalse(_checkTypehint(function (\InvalidArgumentException $e) {}, new \Exception()));
1412
}
1513

1614
/** @test */
1715
public function shouldAcceptFunctionStringCallbackWithTypehint()
1816
{
1917
$this->assertTrue(_checkTypehint('React\Promise\testCallbackWithTypehint', new \InvalidArgumentException()));
20-
$this->assertfalse(_checkTypehint('React\Promise\testCallbackWithTypehint', new \Exception()));
18+
$this->assertFalse(_checkTypehint('React\Promise\testCallbackWithTypehint', new \Exception()));
2119
}
2220

2321
/** @test */
2422
public function shouldAcceptInvokableObjectCallbackWithTypehint()
2523
{
2624
$this->assertTrue(_checkTypehint(new TestCallbackWithTypehintClass(), new \InvalidArgumentException()));
27-
$this->assertfalse(_checkTypehint(new TestCallbackWithTypehintClass(), new \Exception()));
25+
$this->assertFalse(_checkTypehint(new TestCallbackWithTypehintClass(), new \Exception()));
2826
}
2927

3028
/** @test */
3129
public function shouldAcceptObjectMethodCallbackWithTypehint()
3230
{
3331
$this->assertTrue(_checkTypehint([new TestCallbackWithTypehintClass(), 'testCallback'], new \InvalidArgumentException()));
34-
$this->assertfalse(_checkTypehint([new TestCallbackWithTypehintClass(), 'testCallback'], new \Exception()));
32+
$this->assertFalse(_checkTypehint([new TestCallbackWithTypehintClass(), 'testCallback'], new \Exception()));
3533
}
3634

3735
/** @test */
3836
public function shouldAcceptStaticClassCallbackWithTypehint()
3937
{
4038
$this->assertTrue(_checkTypehint(['React\Promise\TestCallbackWithTypehintClass', 'testCallbackStatic'], new \InvalidArgumentException()));
41-
$this->assertfalse(_checkTypehint(['React\Promise\TestCallbackWithTypehintClass', 'testCallbackStatic'], new \Exception()));
39+
$this->assertFalse(_checkTypehint(['React\Promise\TestCallbackWithTypehintClass', 'testCallbackStatic'], new \Exception()));
4240
}
4341

4442
/** @test */
@@ -85,34 +83,28 @@ class TestCallbackWithTypehintClass
8583
{
8684
public function __invoke(\InvalidArgumentException $e)
8785
{
88-
8986
}
9087

9188
public function testCallback(\InvalidArgumentException $e)
9289
{
93-
9490
}
9591

9692
public static function testCallbackStatic(\InvalidArgumentException $e)
9793
{
98-
9994
}
10095
}
10196

10297
class TestCallbackWithoutTypehintClass
10398
{
10499
public function __invoke()
105100
{
106-
107101
}
108102

109103
public function testCallback()
110104
{
111-
112105
}
113106

114107
public static function testCallbackStatic()
115108
{
116-
117109
}
118110
}

tests/FunctionMapTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ public function shouldRejectWhenInputContainsRejection()
115115
/** @test */
116116
public function shouldCancelInputArrayPromises()
117117
{
118-
$promise1 = new Promise(function() {}, $this->expectCallableOnce());
119-
$promise2 = new Promise(function() {}, $this->expectCallableOnce());
118+
$promise1 = new Promise(function () {}, $this->expectCallableOnce());
119+
$promise2 = new Promise(function () {}, $this->expectCallableOnce());
120120

121121
map(
122122
[$promise1, $promise2],

tests/FunctionRaceTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ public function shouldRejectIfFirstSettledPromiseRejects()
8989
/** @test */
9090
public function shouldCancelInputArrayPromises()
9191
{
92-
$promise1 = new Promise(function() {}, $this->expectCallableOnce());
93-
$promise2 = new Promise(function() {}, $this->expectCallableOnce());
92+
$promise1 = new Promise(function () {}, $this->expectCallableOnce());
93+
$promise2 = new Promise(function () {}, $this->expectCallableOnce());
9494

9595
race([$promise1, $promise2])->cancel();
9696
}
@@ -101,7 +101,7 @@ public function shouldNotCancelOtherPendingInputArrayPromisesIfOnePromiseFulfill
101101
$deferred = new Deferred($this->expectCallableNever());
102102
$deferred->resolve();
103103

104-
$promise2 = new Promise(function() {}, $this->expectCallableNever());
104+
$promise2 = new Promise(function () {}, $this->expectCallableNever());
105105

106106
race([$deferred->promise(), $promise2])->cancel();
107107
}
@@ -112,7 +112,7 @@ public function shouldNotCancelOtherPendingInputArrayPromisesIfOnePromiseRejects
112112
$deferred = new Deferred($this->expectCallableNever());
113113
$deferred->reject();
114114

115-
$promise2 = new Promise(function() {}, $this->expectCallableNever());
115+
$promise2 = new Promise(function () {}, $this->expectCallableNever());
116116

117117
race([$deferred->promise(), $promise2])->cancel();
118118
}

tests/FunctionReduceTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ public function shouldProvideCorrectBasisValue()
259259
/** @test */
260260
public function shouldCancelInputArrayPromises()
261261
{
262-
$promise1 = new Promise(function() {}, $this->expectCallableOnce());
263-
$promise2 = new Promise(function() {}, $this->expectCallableOnce());
262+
$promise1 = new Promise(function () {}, $this->expectCallableOnce());
263+
$promise2 = new Promise(function () {}, $this->expectCallableOnce());
264264

265265
reduce(
266266
[$promise1, $promise2],

tests/FunctionResolveTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function shouldSupportVeryDeepNestedPromises()
132132

133133
$last = $p;
134134
for ($j = 0; $j < 250; $j++) {
135-
$last = $last->then(function($result) {
135+
$last = $last->then(function ($result) {
136136
return $result;
137137
});
138138
}

tests/FunctionSomeTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function shouldRejectWithLengthExceptionWithEmptyInputArray()
1414
->expects($this->once())
1515
->method('__invoke')
1616
->with(
17-
$this->callback(function($exception){
17+
$this->callback(function ($exception) {
1818
return $exception instanceof LengthException &&
1919
'Input array must contain at least 1 item but contains only 0 items.' === $exception->getMessage();
2020
})
@@ -34,7 +34,7 @@ public function shouldRejectWithLengthExceptionWithInputArrayContainingNotEnough
3434
->expects($this->once())
3535
->method('__invoke')
3636
->with(
37-
$this->callback(function($exception){
37+
$this->callback(function ($exception) {
3838
return $exception instanceof LengthException &&
3939
'Input array must contain at least 4 items but contains only 3 items.' === $exception->getMessage();
4040
})
@@ -125,8 +125,8 @@ public function shouldResolveWithEmptyArrayIfHowManyIsLessThanOne()
125125
/** @test */
126126
public function shouldCancelInputArrayPromises()
127127
{
128-
$promise1 = new Promise(function() {}, $this->expectCallableOnce());
129-
$promise2 = new Promise(function() {}, $this->expectCallableOnce());
128+
$promise1 = new Promise(function () {}, $this->expectCallableOnce());
129+
$promise2 = new Promise(function () {}, $this->expectCallableOnce());
130130

131131
some([$promise1, $promise2], 1)->cancel();
132132
}
@@ -137,7 +137,7 @@ public function shouldCancelOtherPendingInputArrayPromisesIfEnoughPromisesFulfil
137137
$deferred = new Deferred($this->expectCallableNever());
138138
$deferred->resolve();
139139

140-
$promise2 = new Promise(function() {}, $this->expectCallableNever());
140+
$promise2 = new Promise(function () {}, $this->expectCallableNever());
141141

142142
some([$deferred->promise(), $promise2], 1);
143143
}
@@ -148,7 +148,7 @@ public function shouldNotCancelOtherPendingInputArrayPromisesIfEnoughPromisesRej
148148
$deferred = new Deferred($this->expectCallableNever());
149149
$deferred->reject();
150150

151-
$promise2 = new Promise(function() {}, $this->expectCallableNever());
151+
$promise2 = new Promise(function () {}, $this->expectCallableNever());
152152

153153
some([$deferred->promise(), $promise2], 2);
154154
}

tests/Internal/QueueTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function excutesNestedEnqueuedTasks()
2222

2323
$nested = $this->expectCallableOnce();
2424

25-
$task = function() use ($queue, $nested) {
25+
$task = function () use ($queue, $nested) {
2626
$queue->enqueue($nested);
2727
};
2828

tests/PromiseAdapter/CallbackPromiseAdapter.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace React\Promise\PromiseAdapter;
44

5-
use React\Promise;
6-
75
class CallbackPromiseAdapter implements PromiseAdapterInterface
86
{
97
private $callbacks;

0 commit comments

Comments
 (0)