Skip to content

Commit 41b3de2

Browse files
Wes1262sebastianbergmann
authored andcommitted
Normalize usages of directory separators.
1 parent bc44f8b commit 41b3de2

File tree

12 files changed

+72
-45
lines changed

12 files changed

+72
-45
lines changed

src/Node/AbstractNode.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ abstract class AbstractNode implements \Countable
4343

4444
public function __construct(string $name, self $parent = null)
4545
{
46-
if (\substr($name, -1) == '/') {
46+
if (\substr($name, -1) == \DIRECTORY_SEPARATOR) {
4747
$name = \substr($name, 0, -1);
4848
}
4949

@@ -80,10 +80,14 @@ public function getId(): string
8080
public function getPath(): string
8181
{
8282
if ($this->path === null) {
83-
if ($this->parent === null || $this->parent->getPath() === null || $this->parent->getPath() === false) {
83+
if (
84+
$this->parent === null ||
85+
$this->parent->getPath() === null ||
86+
$this->parent->getPath() === false
87+
) {
8488
$this->path = $this->name;
8589
} else {
86-
$this->path = $this->parent->getPath() . '/' . $this->name;
90+
$this->path = $this->parent->getPath() . \DIRECTORY_SEPARATOR . $this->name;
8791
}
8892
}
8993

src/Node/Builder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private function buildDirectoryStructure(array $files): array
9393
$result = [];
9494

9595
foreach ($files as $path => $file) {
96-
$path = \explode('/', $path);
96+
$path = \explode(\DIRECTORY_SEPARATOR, $path);
9797
$pointer = &$result;
9898
$max = \count($path);
9999

@@ -160,7 +160,7 @@ private function reducePaths(array &$files): string
160160
$paths = \array_keys($files);
161161

162162
if (\count($files) === 1) {
163-
$commonPath = \dirname($paths[0]) . '/';
163+
$commonPath = \dirname($paths[0]) . \DIRECTORY_SEPARATOR;
164164
$files[\basename($paths[0])] = $files[$paths[0]];
165165

166166
unset($files[$paths[0]]);
@@ -214,7 +214,7 @@ private function reducePaths(array &$files): string
214214
$max = \count($original);
215215

216216
for ($i = 0; $i < $max; $i++) {
217-
$files[\implode('/', $paths[$i])] = $files[$original[$i]];
217+
$files[\implode(\DIRECTORY_SEPARATOR, $paths[$i])] = $files[$original[$i]];
218218
unset($files[$original[$i]]);
219219
}
220220

tests/_files/BankAccount-clover.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<coverage generated="%i">
33
<project timestamp="%i" name="BankAccount">
4-
<file name="%s/BankAccount.php">
4+
<file name="%s%eBankAccount.php">
55
<class name="BankAccount" namespace="global">
66
<metrics complexity="5" methods="4" coveredmethods="3" conditionals="0" coveredconditionals="0" statements="10" coveredstatements="5" elements="14" coveredelements="8"/>
77
</class>

tests/_files/Report/HTML/CoverageForBankAccount/BankAccount.php.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title>Code Coverage for %s/BankAccount.php</title>
5+
<title>Code Coverage for %s%eBankAccount.php</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77
<link href=".css/bootstrap.min.css" rel="stylesheet" type="text/css">
88
<link href=".css/octicons.css" rel="stylesheet" type="text/css">

tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title>Code Coverage for %s/source_with_class_and_anonymous_function.php</title>
5+
<title>Code Coverage for %s%esource_with_class_and_anonymous_function.php</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77
<link href=".css/bootstrap.min.css" rel="stylesheet" type="text/css">
88
<link href=".css/octicons.css" rel="stylesheet" type="text/css">

tests/_files/Report/XML/CoverageForBankAccount/BankAccount.php.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<phpunit xmlns="https://schema.phpunit.de/coverage/1.0">
3-
<file name="BankAccount.php" path="/">
3+
<file name="BankAccount.php" path="%e">
44
<totals>
55
<lines total="33" comments="0" code="33" executable="10" executed="5" percent="50.00"/>
66
<methods count="4" tested="3" percent="75.00"/>

tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<phpunit xmlns="https://schema.phpunit.de/coverage/1.0">
3-
<file name="source_with_class_and_anonymous_function.php" path="/">
3+
<file name="source_with_class_and_anonymous_function.php" path="%e">
44
<totals>
55
<lines total="19" comments="2" code="17" executable="8" executed="7" percent="87.50"/>
66
<methods count="1" tested="0" percent="0.00"/>

tests/_files/Report/XML/CoverageForFileWithIgnoredLines/source_with_ignore.php.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<phpunit xmlns="https://schema.phpunit.de/coverage/1.0">
3-
<file name="source_with_ignore.php" path="/">
3+
<file name="source_with_ignore.php" path="%e">
44
<totals>
55
<lines total="37" comments="12" code="25" executable="2" executed="1" percent="50.00"/>
66
<methods count="0" tested="0" percent="0"/>

tests/_files/class-with-anonymous-function-clover.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<coverage generated="%i">
33
<project timestamp="%i">
4-
<file name="%s/source_with_class_and_anonymous_function.php">
4+
<file name="%s%esource_with_class_and_anonymous_function.php">
55
<class name="CoveredClassWithAnonymousFunctionInStaticMethod" namespace="global">
66
<metrics complexity="1" methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="8" coveredstatements="7" elements="9" coveredelements="7"/>
77
</class>

tests/_files/ignored-lines-clover.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<coverage generated="%i">
33
<project timestamp="%i">
4-
<file name="%s/source_with_ignore.php">
4+
<file name="%s%esource_with_ignore.php">
55
<class name="Foo" namespace="global">
66
<metrics complexity="1" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
77
</class>

0 commit comments

Comments
 (0)