Skip to content

Commit 412d6b1

Browse files
committed
Fix callback with false value (#6)
1 parent a5e59dd commit 412d6b1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Generator/AbstractTypeGenerator.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ protected function processFromArray(array $values, $templatePrefix)
157157

158158
protected function callableCallbackFromArrayValue(array $value, $key, $argDefinitions = null, $default = 'null', array $compilerNames = null)
159159
{
160-
if (!isset($value[$key])) {
160+
if (!$this->arrayKeyExistsAndIsNotNull($value, $key)) {
161161
return $default;
162162
}
163163

@@ -259,6 +259,11 @@ protected function types2String(array $types)
259259
return '[' . implode(', ', $types) . ']';
260260
}
261261

262+
protected function arrayKeyExistsAndIsNotNull(array $value, $key)
263+
{
264+
return array_key_exists($key, $value) && null !== $value[$key];
265+
}
266+
262267
/**
263268
* Configs has the following structure:
264269
* <code>

0 commit comments

Comments
 (0)