Skip to content

Commit

Permalink
Merge branch '9.2' into improved-cobertura-report & fix CS issues
Browse files Browse the repository at this point in the history
* 9.2:
  Fix CS/WS issues
  Update PHP-CS-Fixer configuration
  Update ChangeLog
  Assert that we have an Identifier here
  Test binary concat the same as binary plus
  Fix else is not executable
  Fix executable lines analysis
  • Loading branch information
jhoffland committed Nov 16, 2022
2 parents 8aacc7e + 2dfaeeb commit 0dd6723
Show file tree
Hide file tree
Showing 46 changed files with 912 additions and 236 deletions.
12 changes: 10 additions & 2 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,16 @@
'multiline_whitespace_before_semicolons' => true,
'native_constant_invocation' => false,
'native_function_casing' => false,
'native_function_invocation' => false,
'native_function_invocation' => [
'include' => [
'@internal',
],
],
'native_function_type_declaration_casing' => true,
'new_with_braces' => false,
'new_with_braces' => [
'named_class' => false,
'anonymous_class' => false,
],
'no_alias_functions' => true,
'no_alias_language_construct_call' => true,
'no_alternative_syntax' => true,
Expand Down Expand Up @@ -158,6 +165,7 @@
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unneeded_final_method' => true,
'no_unneeded_import_alias' => true,
'no_unreachable_default_argument_value' => true,
'no_unset_cast' => true,
'no_unset_on_property' => true,
Expand Down
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt

## [9.2.19] - 2022-MM-DD

### Fixed

* [#949](https://github.com/sebastianbergmann/php-code-coverage/pull/949): Various issues related to identifying executable lines

### Changed

* Tweaked CSS for HTML report
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
},
"extra": {
"branch-alias": {
"dev-master": "9.2-dev"
"dev-master": "9.2-dev",
"dev-improved-cobertura-report": "9.2-dev"
}
}
}
4 changes: 4 additions & 0 deletions src/RawCodeCoverageData.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@
use function array_intersect;
use function array_intersect_key;
use function count;
use function explode;
use function file_get_contents;
use function in_array;
use function is_file;
use function range;
use function trim;
use SebastianBergmann\CodeCoverage\Driver\Driver;
use SebastianBergmann\CodeCoverage\StaticAnalysis\FileAnalyser;

Expand Down
2 changes: 2 additions & 0 deletions src/Report/Cobertura/CoberturaClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
namespace SebastianBergmann\CodeCoverage\Report\Cobertura;

use function array_merge;
use function range;
use DOMDocument;
use DOMElement;

Expand Down
9 changes: 9 additions & 0 deletions src/Report/Cobertura/CoberturaCoverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
*/
namespace SebastianBergmann\CodeCoverage\Report\Cobertura;

use function array_reduce;
use function basename;
use function count;
use function date;
use function getcwd;
use function in_array;
use function sprintf;
use function str_replace;
use function time;
use Composer\InstalledVersions;
use DOMDocument;
use DOMElement;
Expand Down
1 change: 1 addition & 0 deletions src/Report/Cobertura/CoberturaLine.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
namespace SebastianBergmann\CodeCoverage\Report\Cobertura;

use function count;
use DOMDocument;
use DOMElement;

Expand Down
1 change: 1 addition & 0 deletions src/Report/Cobertura/CoberturaMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
namespace SebastianBergmann\CodeCoverage\Report\Cobertura;

use function range;
use DOMDocument;
use DOMElement;

Expand Down
2 changes: 2 additions & 0 deletions src/Report/Cobertura/CoberturaPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
namespace SebastianBergmann\CodeCoverage\Report\Cobertura;

use function array_reduce;
use function explode;
use DOMDocument;
use DOMElement;

Expand Down
5 changes: 5 additions & 0 deletions src/Report/Html/Renderer/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
use const T_YIELD;
use const T_YIELD_FROM;
use function array_key_exists;
use function array_keys;
use function array_merge;
use function array_pop;
use function array_unique;
use function constant;
Expand All @@ -89,6 +91,9 @@
use function file_get_contents;
use function htmlspecialchars;
use function is_string;
use function ksort;
use function range;
use function sort;
use function sprintf;
use function str_replace;
use function substr;
Expand Down
2 changes: 1 addition & 1 deletion src/Report/Xml/Coverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(DOMElement $context, string $line)
{
$this->contextNode = $context;

$this->writer = new XMLWriter();
$this->writer = new XMLWriter;
$this->writer->openMemory();
$this->writer->startElementNS(null, $context->nodeName, 'https://schema.phpunit.de/coverage/1.0');
$this->writer->writeAttribute('nr', $line);
Expand Down
2 changes: 1 addition & 1 deletion src/Report/Xml/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class Report extends File
{
public function __construct(string $name)
{
$dom = new DOMDocument();
$dom = new DOMDocument;
$dom->loadXML('<?xml version="1.0" ?><phpunit xmlns="https://schema.phpunit.de/coverage/1.0"><file /></phpunit>');

$contextNode = $dom->getElementsByTagNameNS(
Expand Down
2 changes: 1 addition & 1 deletion src/Report/Xml/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function setSourceCode(string $source): void
{
$context = $this->context;

$tokens = (new Tokenizer())->parse($source);
$tokens = (new Tokenizer)->parse($source);
$srcDom = (new XMLSerializer(new NamespaceUri($context->namespaceURI)))->toDom($tokens);

$context->parentNode->replaceChild(
Expand Down
1 change: 1 addition & 0 deletions src/StaticAnalysis/CachingFileAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use function is_file;
use function md5;
use function serialize;
use function unserialize;
use SebastianBergmann\CodeCoverage\Util\Filesystem;
use SebastianBergmann\FileIterator\Facade as FileIteratorFacade;

Expand Down
3 changes: 3 additions & 0 deletions src/StaticAnalysis/CodeUnitFindingVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
namespace SebastianBergmann\CodeCoverage\StaticAnalysis;

use function assert;
use function implode;
use function rtrim;
use function trim;
Expand Down Expand Up @@ -314,6 +315,8 @@ private function unionOrIntersectionAsString(ComplexType $type): string
if ($_type instanceof Name) {
$types[] = $_type->toCodeString();
} else {
assert($_type instanceof Identifier);

$types[] = $_type->toString();
}
}
Expand Down
Loading

0 comments on commit 0dd6723

Please sign in to comment.