Skip to content

Commit

Permalink
Initialise optional context properties with null rather than `Gener…
Browse files Browse the repository at this point in the history
…ator::UNDEFINED` (#1209)
  • Loading branch information
DerManoMann authored Apr 19, 2022
1 parent 3e41d60 commit f4fb8d0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Analysers/ReflectionAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ protected function analyzeFqdn(string $fqdn, Analysis $analysis, array $details)
$contextType = $rc->isInterface() ? 'interface' : ($rc->isTrait() ? 'trait' : ((method_exists($rc, 'isEnum') && $rc->isEnum()) ? 'enum' : 'class'));
$context = new Context([
$contextType => $rc->getShortName(),
'namespace' => $rc->getNamespaceName() ?: Generator::UNDEFINED,
'comment' => $rc->getDocComment() ?: Generator::UNDEFINED,
'filename' => $rc->getFileName() ?: Generator::UNDEFINED,
'namespace' => $rc->getNamespaceName() ?: null,
'comment' => $rc->getDocComment() ?: null,
'filename' => $rc->getFileName() ?: null,
'line' => $rc->getStartLine(),
'annotations' => [],
'scanned' => $details,
Expand Down Expand Up @@ -120,8 +120,8 @@ protected function analyzeFqdn(string $fqdn, Analysis $analysis, array $details)
if (in_array($method->name, $details['methods'])) {
$definition['methods'][$method->getName()] = $ctx = new Context([
'method' => $method->getName(),
'comment' => $method->getDocComment() ?: Generator::UNDEFINED,
'filename' => $method->getFileName() ?: Generator::UNDEFINED,
'comment' => $method->getDocComment() ?: null,
'filename' => $method->getFileName() ?: null,
'line' => $method->getStartLine(),
'annotations' => [],
], $context);
Expand All @@ -135,7 +135,7 @@ protected function analyzeFqdn(string $fqdn, Analysis $analysis, array $details)
if (in_array($property->name, $details['properties'])) {
$definition['properties'][$property->getName()] = $ctx = new Context([
'property' => $property->getName(),
'comment' => $property->getDocComment() ?: Generator::UNDEFINED,
'comment' => $property->getDocComment() ?: null,
'annotations' => [],
], $context);
if ($property->isStatic()) {
Expand All @@ -161,7 +161,7 @@ protected function analyzeFqdn(string $fqdn, Analysis $analysis, array $details)
foreach ($this->annotationFactories as $annotationFactory) {
$definition['constants'][$constant->getName()] = $ctx = new Context([
'constant' => $constant->getName(),
'comment' => $constant->getDocComment() ?: Generator::UNDEFINED,
'comment' => $constant->getDocComment() ?: null,
'annotations' => [],
], $context);
foreach ($annotationFactory->build($constant, $ctx) as $annotation) {
Expand Down

0 comments on commit f4fb8d0

Please sign in to comment.