File tree Expand file tree Collapse file tree 7 files changed +20
-40
lines changed Expand file tree Collapse file tree 7 files changed +20
-40
lines changed Original file line number Diff line number Diff line change @@ -91,11 +91,10 @@ public function unshift($emitter)
91
91
/**
92
92
* Validate that an emitter implements EmitterInterface.
93
93
*
94
- * @param mixed $emitter
95
94
* @throws Exception\InvalidEmitterException For non-emitter instances.
96
95
* @psalm-assert EmitterInterface $emitter
97
96
*/
98
- private function validateEmitter ($ emitter ): void
97
+ private function validateEmitter (mixed $ emitter ): void
99
98
{
100
99
if (! $ emitter instanceof EmitterInterface) {
101
100
throw Exception \InvalidEmitterException::forEmitter ($ emitter );
Original file line number Diff line number Diff line change @@ -18,12 +18,10 @@ class SapiStreamEmitter implements EmitterInterface
18
18
{
19
19
use SapiEmitterTrait;
20
20
21
- /** @var int Maximum output buffering size for each iteration. */
22
- private int $ maxBufferLength ;
23
-
24
- public function __construct (int $ maxBufferLength = 8192 )
25
- {
26
- $ this ->maxBufferLength = $ maxBufferLength ;
21
+ public function __construct (
22
+ /** @param int Maximum output buffering size for each iteration. */
23
+ private int $ maxBufferLength = 8192
24
+ ) {
27
25
}
28
26
29
27
/**
Original file line number Diff line number Diff line change 7
7
use InvalidArgumentException ;
8
8
use Laminas \HttpHandlerRunner \Emitter ;
9
9
10
- use function gettype ;
11
- use function is_object ;
10
+ use function get_debug_type ;
12
11
use function sprintf ;
13
12
14
13
class InvalidEmitterException extends InvalidArgumentException implements ExceptionInterface
15
14
{
16
15
/**
17
16
* @param mixed $emitter Invalid emitter type
18
17
*/
19
- public static function forEmitter ($ emitter ): self
18
+ public static function forEmitter (mixed $ emitter ): self
20
19
{
21
20
return new self (sprintf (
22
21
'%s can only compose %s implementations; received %s ' ,
23
22
Emitter \EmitterStack::class,
24
23
Emitter \EmitterInterface::class,
25
- is_object ( $ emitter ) ? $ emitter ::class : gettype ($ emitter )
24
+ get_debug_type ($ emitter )
26
25
));
27
26
}
28
27
}
Original file line number Diff line number Diff line change 23
23
*/
24
24
final class RequestHandlerRunner implements RequestHandlerRunnerInterface
25
25
{
26
- private EmitterInterface $ emitter ;
27
-
28
- /**
29
- * A request handler to run as the application.
30
- */
31
- private RequestHandlerInterface $ handler ;
32
-
33
26
/**
34
27
* A factory capable of generating an error response in the scenario that
35
28
* the $serverRequestFactory raises an exception during generation of the
@@ -55,14 +48,14 @@ final class RequestHandlerRunner implements RequestHandlerRunnerInterface
55
48
* @param callable(Throwable):ResponseInterface $serverRequestErrorResponseGenerator
56
49
*/
57
50
public function __construct (
58
- RequestHandlerInterface $ handler ,
59
- EmitterInterface $ emitter ,
51
+ /**
52
+ * A request handler to run as the application.
53
+ */
54
+ private RequestHandlerInterface $ handler ,
55
+ private EmitterInterface $ emitter ,
60
56
callable $ serverRequestFactory ,
61
57
callable $ serverRequestErrorResponseGenerator
62
58
) {
63
- $ this ->handler = $ handler ;
64
- $ this ->emitter = $ emitter ;
65
-
66
59
$ this ->serverRequestFactory = $ serverRequestFactory ;
67
60
$ this ->serverRequestErrorResponseGenerator = $ serverRequestErrorResponseGenerator ;
68
61
}
Original file line number Diff line number Diff line change @@ -49,9 +49,8 @@ public function nonEmitterValues(): iterable
49
49
50
50
/**
51
51
* @dataProvider nonEmitterValues
52
- * @param mixed $value
53
52
*/
54
- public function testCannotPushNonEmitterToStack ($ value ): void
53
+ public function testCannotPushNonEmitterToStack (mixed $ value ): void
55
54
{
56
55
$ this ->expectException (Exception \InvalidEmitterException::class);
57
56
/** @psalm-suppress MixedArgument */
@@ -60,9 +59,8 @@ public function testCannotPushNonEmitterToStack($value): void
60
59
61
60
/**
62
61
* @dataProvider nonEmitterValues
63
- * @param mixed $value
64
62
*/
65
- public function testCannotUnshiftNonEmitterToStack ($ value ): void
63
+ public function testCannotUnshiftNonEmitterToStack (mixed $ value ): void
66
64
{
67
65
$ this ->expectException (Exception \InvalidEmitterException::class);
68
66
/** @psalm-suppress MixedArgument */
@@ -71,9 +69,8 @@ public function testCannotUnshiftNonEmitterToStack($value): void
71
69
72
70
/**
73
71
* @dataProvider nonEmitterValues
74
- * @param mixed $value
75
72
*/
76
- public function testCannotSetNonEmitterToSpecificIndex ($ value ): void
73
+ public function testCannotSetNonEmitterToSpecificIndex (mixed $ value ): void
77
74
{
78
75
$ this ->expectException (Exception \InvalidEmitterException::class);
79
76
/** @psalm-suppress MixedArgument */
Original file line number Diff line number Diff line change @@ -555,7 +555,7 @@ public function emitJsonResponseProvider(): array
555
555
* @dataProvider emitJsonResponseProvider
556
556
* @param mixed $contents Contents stored in stream
557
557
*/
558
- public function testEmitJsonResponse ($ contents ): void
558
+ public function testEmitJsonResponse (mixed $ contents ): void
559
559
{
560
560
$ response = (new JsonResponse ($ contents ))
561
561
->withStatus (200 );
Original file line number Diff line number Diff line change @@ -15,10 +15,6 @@ class MockStreamHelper
15
15
/** @var string|callable(int,?int=null):string */
16
16
private $ contents ;
17
17
18
- private int $ position ;
19
-
20
- private int $ size ;
21
-
22
18
private int $ startPosition ;
23
19
24
20
/** @var null|callable */
@@ -30,14 +26,12 @@ class MockStreamHelper
30
26
*/
31
27
public function __construct (
32
28
$ contents ,
33
- int $ size ,
34
- int $ startPosition ,
29
+ private int $ size ,
30
+ private int $ position ,
35
31
?callable $ trackPeakBufferLength = null
36
32
) {
37
33
$ this ->contents = $ contents ;
38
- $ this ->size = $ size ;
39
- $ this ->position = $ startPosition ;
40
- $ this ->startPosition = $ startPosition ;
34
+ $ this ->startPosition = $ position ;
41
35
$ this ->trackPeakBufferLength = $ trackPeakBufferLength ;
42
36
}
43
37
You can’t perform that action at this time.
0 commit comments