Skip to content

Commit

Permalink
simplify null
Browse files Browse the repository at this point in the history
  • Loading branch information
DjordyKoert committed Jan 2, 2024
1 parent 4604673 commit 9590366
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 2 additions & 3 deletions OpenApiPhp/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,8 @@ public static function getCollectionItem(OA\AbstractAnnotation $parent, $class,
$properties
);
}
if (null === $key) {
$key = self::createCollectionItem($parent, $collection, $class, $properties);
}

$key ??= self::createCollectionItem($parent, $collection, $class, $properties);

return $parent->{$collection}[$key];
}
Expand Down
5 changes: 1 addition & 4 deletions RouteDescriber/PhpDocDescriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ final class PhpDocDescriber implements RouteDescriberInterface

public function __construct(?DocBlockFactoryInterface $docBlockFactory = null)
{
if (null === $docBlockFactory) {
$docBlockFactory = DocBlockFactory::createInstance();
}
$this->docBlockFactory = $docBlockFactory;
$this->docBlockFactory = $docBlockFactory ?? DocBlockFactory::createInstance();
}

public function describe(OA\OpenApi $api, Route $route, \ReflectionMethod $reflectionMethod)
Expand Down

0 comments on commit 9590366

Please sign in to comment.