Skip to content

Commit 7b0340f

Browse files
committed
a node type might have no properties or children, make cnd writer support that
1 parent d23271b commit 7b0340f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/PHPCR/Util/CND/Writer/CndWriter.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ protected function writeNodeType(NodeTypeDefinitionInterface $nodeType)
135135

136136
private function writeProperties($properties)
137137
{
138+
if (null === $properties) {
139+
// getDeclaredPropertyDefinitions is allowed to return null on
140+
// newly created node type definitions
141+
return '';
142+
}
143+
138144
$s = '';
139145

140146
/** @var $property PropertyDefinitionInterface */
@@ -190,6 +196,12 @@ private function writeProperties($properties)
190196

191197
private function writeChildren($children)
192198
{
199+
if (null === $children) {
200+
// getDeclaredChildNodeDefinitions is allowed to return null on
201+
// newly created node type definitions
202+
return '';
203+
}
204+
193205
$s = '';
194206

195207
/** @var $child NodeDefinitionInterface */

0 commit comments

Comments
 (0)