11<?php
22
3- declare (strict_types=1 );
4-
53/**
64 * This file is part of the friends-of-phpspec/phpspec-code-coverage package.
75 *
1210 * that was distributed with this source code.
1311 */
1412
13+ declare (strict_types=1 );
14+
1515namespace FriendsOfPhpSpec \PhpSpec \CodeCoverage ;
1616
1717use FriendsOfPhpSpec \PhpSpec \CodeCoverage \Exception \NoCoverageDriverAvailableException ;
1818use FriendsOfPhpSpec \PhpSpec \CodeCoverage \Listener \CodeCoverageListener ;
1919use PhpSpec \Extension ;
2020use PhpSpec \ServiceContainer ;
21+ use RuntimeException ;
2122use SebastianBergmann \CodeCoverage \CodeCoverage ;
2223use SebastianBergmann \CodeCoverage \Filter ;
2324use SebastianBergmann \CodeCoverage \Report ;
2425use SebastianBergmann \CodeCoverage \Version ;
2526use Symfony \Component \Console \Input \InputOption ;
2627
28+ use function count ;
29+ use function is_array ;
30+
2731/**
2832 * Injects Code Coverage Event Subscriber into the EventDispatcher.
2933 * The Subscriber will add Code Coverage information before each example.
@@ -48,12 +52,8 @@ public function load(ServiceContainer $container, array $params = []): void
4852 $ container ->define ('code_coverage ' , static function ($ container ) {
4953 try {
5054 $ coverage = new CodeCoverage (null , $ container ->get ('code_coverage.filter ' ));
51- } catch (\RuntimeException $ error ) {
52- throw new NoCoverageDriverAvailableException (
53- 'There is no available coverage driver to be used. ' ,
54- 0 ,
55- $ error
56- );
55+ } catch (RuntimeException $ error ) {
56+ throw new NoCoverageDriverAvailableException ('There is no available coverage driver to be used. ' , 0 , $ error );
5757 }
5858
5959 return $ coverage ;
@@ -64,15 +64,13 @@ public function load(ServiceContainer $container, array $params = []): void
6464
6565 if (!isset ($ options ['format ' ])) {
6666 $ options ['format ' ] = ['html ' ];
67- } elseif (!\ is_array ($ options ['format ' ])) {
67+ } elseif (!is_array ($ options ['format ' ])) {
6868 $ options ['format ' ] = (array ) $ options ['format ' ];
6969 }
7070
71- if (isset ($ options ['output ' ])) {
72- if (!\is_array ($ options ['output ' ]) && 1 === \count ($ options ['format ' ])) {
73- $ format = $ options ['format ' ][0 ];
74- $ options ['output ' ] = [$ format => $ options ['output ' ]];
75- }
71+ if (isset ($ options ['output ' ]) && !is_array ($ options ['output ' ]) && 1 === count ($ options ['format ' ])) {
72+ $ format = $ options ['format ' ][0 ];
73+ $ options ['output ' ] = [$ format => $ options ['output ' ]];
7674 }
7775
7876 if (!isset ($ options ['show_uncovered_files ' ])) {
0 commit comments