diff --git a/src/FileParser/FileParser.php b/src/FileParser/FileParser.php index 7605ad1..a2b00da 100644 --- a/src/FileParser/FileParser.php +++ b/src/FileParser/FileParser.php @@ -166,12 +166,13 @@ protected function processStatements($file, array $statements, $prefix = '') $type = strpos($type, '\\') === 0 ? substr($type, 1) : $type; } - if (property_exists($param, 'default') && + if ((property_exists($param, 'default') && $param->default instanceof Expr && property_exists($param->default, 'name') && property_exists($param->default->name, 'parts') && $type !== null && - 'null' === $param->default->name->parts[0] + 'null' === $param->default->name->parts[0]) || + $param->type instanceof NullableType ) { $type .= '|null'; }