Skip to content

Commit 01494da

Browse files
Enable strict interpretation of scalar type declarations
1 parent afe4b8a commit 01494da

Some content is hidden

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

50 files changed

+133
-134
lines changed

.php_cs.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
$header = <<<'EOF'
33
This file is part of the php-code-coverage package.
44
@@ -51,6 +51,7 @@ return PhpCsFixer\Config::create()
5151
'compact_nullable_typehint' => true,
5252
'concat_space' => ['spacing' => 'one'],
5353
'declare_equal_normalize' => ['space' => 'none'],
54+
'declare_strict_types' => true,
5455
'dir_constant' => true,
5556
'elseif' => true,
5657
'encoding' => true,

src/CodeCoverage.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
* This file is part of the php-code-coverage package.
44
*
@@ -696,7 +696,7 @@ private function getLinesToBeIgnoredInner(string $fileName): array
696696
switch (\get_class($token)) {
697697
case \PHP_Token_COMMENT::class:
698698
case \PHP_Token_DOC_COMMENT::class:
699-
$_token = \trim($token);
699+
$_token = \trim((string) $token);
700700
$_line = \trim($lines[$token->getLine() - 1]);
701701

702702
if ($_token === '// @codeCoverageIgnore' ||
@@ -713,7 +713,7 @@ private function getLinesToBeIgnoredInner(string $fileName): array
713713

714714
if (!$ignore) {
715715
$start = $token->getLine();
716-
$end = $start + \substr_count($token, "\n");
716+
$end = $start + \substr_count((string) $token, "\n");
717717

718718
// Do not ignore the first line when there is a token
719719
// before the comment
@@ -740,7 +740,7 @@ private function getLinesToBeIgnoredInner(string $fileName): array
740740
case \PHP_Token_FUNCTION::class:
741741
/* @var \PHP_Token_Interface $token */
742742

743-
$docblock = $token->getDocblock();
743+
$docblock = (string) $token->getDocblock();
744744

745745
$this->ignoredLines[$fileName][] = $token->getLine();
746746

src/Driver/Driver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
* This file is part of the php-code-coverage package.
44
*

src/Driver/PHPDBG.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
* This file is part of the php-code-coverage package.
44
*

src/Driver/Xdebug.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
* This file is part of the php-code-coverage package.
44
*

src/Exception/CoveredCodeNotExecutedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
* This file is part of the php-code-coverage package.
44
*

src/Exception/Exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
* This file is part of the php-code-coverage package.
44
*

src/Exception/InvalidArgumentException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
* This file is part of the php-code-coverage package.
44
*

src/Exception/MissingCoversAnnotationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
* This file is part of the php-code-coverage package.
44
*

src/Exception/RuntimeException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
* This file is part of the php-code-coverage package.
44
*

0 commit comments

Comments
 (0)