Skip to content

Commit

Permalink
Default children property to empty array
Browse files Browse the repository at this point in the history
This makes sure the property is countable and doesn't lead
to warnings in newer versions of PHP.
  • Loading branch information
wyrfel committed May 15, 2020
1 parent b102543 commit 3851dcd
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/AbstractSynopsis.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class AbstractSynopsis
/**
* @var array the kiddos
*/
protected $children;
protected $children = [];

/**
* @var Factory the synopsis factory (used for cascaded creation of synopsises)
Expand Down
4 changes: 2 additions & 2 deletions tests/BooleanSynopsisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public function testProcess()
$this->assertEquals(1, $synopsis->getLength());
$this->assertEquals('true', $synopsis->getValue());
$this->assertFalse($synopsis->hasChildren());
$this->assertNull($synopsis->getChildren());
$this->assertEquals([], $synopsis->getChildren());
}
}
}
4 changes: 2 additions & 2 deletions tests/DoubleSynopsisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public function testProcess()
$this->assertEquals(3, $synopsis->getLength());
$this->assertEquals(3.4, $synopsis->getValue());
$this->assertFalse($synopsis->hasChildren());
$this->assertNull($synopsis->getChildren());
$this->assertEquals([], $synopsis->getChildren());
}
}
}
4 changes: 2 additions & 2 deletions tests/IntegerSynopsisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public function testProcess()
$this->assertEquals(1, $synopsis->getLength());
$this->assertEquals(3, $synopsis->getValue());
$this->assertFalse($synopsis->hasChildren());
$this->assertNull($synopsis->getChildren());
$this->assertEquals([], $synopsis->getChildren());
}
}
}
4 changes: 2 additions & 2 deletions tests/NullSynopsisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public function testProcess()
$this->assertEquals(0, $synopsis->getLength());
$this->assertEquals(null, $synopsis->getValue());
$this->assertFalse($synopsis->hasChildren());
$this->assertNull($synopsis->getChildren());
$this->assertEquals([], $synopsis->getChildren());
}
}
}
4 changes: 2 additions & 2 deletions tests/Resource/FileSynopsisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public function testProcess()
$this->assertEquals(11, $synopsis->getLength());
$this->assertEquals('php://stdin', $synopsis->getValue());
$this->assertFalse($synopsis->hasChildren());
$this->assertNull($synopsis->getChildren());
$this->assertEquals([], $synopsis->getChildren());
}
}
}
4 changes: 2 additions & 2 deletions tests/Resource/StreamSynopsisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public function testProcess()
$this->assertEquals(11, $synopsis->getLength());
$this->assertEquals('php://stdin', $synopsis->getValue());
$this->assertFalse($synopsis->hasChildren());
$this->assertNull($synopsis->getChildren());
$this->assertEquals([], $synopsis->getChildren());
}
}
}
4 changes: 2 additions & 2 deletions tests/ResourceSynopsisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public function testProcess()
$this->assertEquals(0, $synopsis->getLength());
$this->assertEquals('', $synopsis->getValue());
$this->assertFalse($synopsis->hasChildren());
$this->assertNull($synopsis->getChildren());
$this->assertEquals([], $synopsis->getChildren());
}
}
}
4 changes: 2 additions & 2 deletions tests/StandardSynopsisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ public function testProcess($original, $type, $length, $value)
$this->assertSame($length, $synopsis->getLength());
$this->assertSame($value, $synopsis->getValue());
$this->assertFalse($synopsis->hasChildren());
$this->assertNull($synopsis->getChildren());
$this->assertEquals([], $synopsis->getChildren());
}
}
}
4 changes: 2 additions & 2 deletions tests/StringSynopsisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public function testProcess()
$this->assertEquals(12, $synopsis->getLength());
$this->assertEquals('Hello World!', $synopsis->getValue());
$this->assertFalse($synopsis->hasChildren());
$this->assertNull($synopsis->getChildren());
$this->assertEquals([], $synopsis->getChildren());
}
}
}

0 comments on commit 3851dcd

Please sign in to comment.