Skip to content

Commit b1acab0

Browse files
authored
fix empty short root node (#16)
1 parent b956a3b commit b1acab0

File tree

4 files changed

+4
-1
lines changed

4 files changed

+4
-1
lines changed

cs2pr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if ($argc === 1) {
3131

3232
$root = @simplexml_load_string($xml);
3333

34-
if (!$root) {
34+
if ($root === false) {
3535
$errors = libxml_get_errors();
3636
if ($errors) {
3737
fwrite(STDERR, $errors[0]->message.' on line '.$errors[0]->line.', column '.$errors[0]->column);

tests/noerrors/only-header-php-cs-fixer.expect

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<checkstyle/>

tests/tests.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ function testXml($xmlPath, $expectedExit, $expectedOutput = null)
4444
testXml(__DIR__.'/errors/minimal.xml', 1, file_get_contents(__DIR__.'/errors/minimal.expect'));
4545

4646
testXml(__DIR__.'/noerrors/only-header.xml', 0, file_get_contents(__DIR__.'/noerrors/only-header.expect'));
47+
testXml(__DIR__.'/noerrors/only-header-php-cs-fixer.xml', 0, file_get_contents(__DIR__.'/noerrors/only-header-php-cs-fixer.expect'));

0 commit comments

Comments
 (0)