@@ -51,8 +51,8 @@ class LoggerMiddleware
5151 public function __construct (
5252 LoggerInterface $ logger ,
5353 HandlerInterface $ handler = null ,
54- $ onExceptionOnly = false ,
55- $ logStatistics = false
54+ bool $ onExceptionOnly = false ,
55+ bool $ logStatistics = false
5656 ) {
5757 $ this ->logger = $ logger ;
5858 $ this ->onExceptionOnly = $ onExceptionOnly ;
@@ -64,9 +64,9 @@ public function __construct(
6464 * Called when the middleware is handled by the client.
6565 *
6666 * @param callable $handler
67- * @return Closure
67+ * @return callable
6868 */
69- public function __invoke (callable $ handler )
69+ public function __invoke (callable $ handler ): callable
7070 {
7171 return function (RequestInterface $ request , array $ options ) use ($ handler ) {
7272 $ this ->setOptions ($ options );
@@ -94,7 +94,7 @@ public function __invoke(callable $handler)
9494 * @param array $options
9595 * @return Closure
9696 */
97- private function handleSuccess (RequestInterface $ request , array $ options )
97+ private function handleSuccess (RequestInterface $ request , array $ options ): callable
9898 {
9999 return function (ResponseInterface $ response ) use ($ request , $ options ) {
100100 // On exception only is true then it must not log the response since it was successful.
@@ -113,7 +113,7 @@ private function handleSuccess(RequestInterface $request, array $options)
113113 * @param array $options
114114 * @return Closure
115115 */
116- private function handleFailure (RequestInterface $ request , array $ options )
116+ private function handleFailure (RequestInterface $ request , array $ options ): callable
117117 {
118118 return function (\Exception $ reason ) use ($ request , $ options ) {
119119 if ($ this ->onExceptionOnly === true ) {
@@ -135,7 +135,7 @@ private function handleFailure(RequestInterface $request, array $options)
135135 * @param array $options
136136 * @return void
137137 */
138- private function setOptions (array $ options )
138+ private function setOptions (array $ options ): void
139139 {
140140 if (!isset ($ options ['log ' ])) {
141141 return ;
0 commit comments