Skip to content

Commit

Permalink
fix a horrible thing
Browse files Browse the repository at this point in the history
  • Loading branch information
romalytvynenko committed May 15, 2024
1 parent 1a8aff1 commit 5520b59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/GeneratorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function __construct(
private ?Closure $routeResolver = null,
private ?Closure $afterOpenApiGenerated = null,
) {
$this->routeResolver = $this->routeResolver ?? function (Route $route) {
$this->routeResolver = $this->routeResolver ?: function (Route $route) {
$expectedDomain = $this->get('api_domain');

return Str::startsWith($route->uri, $this->get('api_path', 'api'))
Expand All @@ -35,7 +35,9 @@ public function routes(?Closure $routeResolver = null)
return $this->routeResolver;
}

$this->routeResolver = $routeResolver;
if ($routeResolver) {
$this->routeResolver = $routeResolver;
}

return $this;
}
Expand Down
5 changes: 4 additions & 1 deletion src/Infer/Reflector/MethodReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ public function getReflection(): ReflectionMethod
return new ReflectionMethod($this->className, $this->name);
}

public function getAstNode(): ClassMethod
/**
* @todo: Think if this method can actually return `null` or it should fail.
*/
public function getAstNode(): ?ClassMethod
{
if (! $this->methodNode) {
$className = class_basename($this->className);
Expand Down

0 comments on commit 5520b59

Please sign in to comment.