Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jul 30, 2023
1 parent b2aebf0 commit bdb3fc6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/PhpGenerator/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


/**
* Creates a representation based on reflection.
* Creates a representations based on reflection or source code.
*/
final class Factory
{
Expand Down
7 changes: 1 addition & 6 deletions src/PhpGenerator/Traits/MethodsAware.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ public function getMethods(): array

public function getMethod(string $name): Method
{
$m = $this->methods[strtolower($name)] ?? null;
if (!$m) {
throw new Nette\InvalidArgumentException("Method '$name' not found.");
}

return $m;
return $this->methods[strtolower($name)] ?? throw new Nette\InvalidArgumentException("Method '$name' not found.");
}


Expand Down
6 changes: 1 addition & 5 deletions src/PhpGenerator/Traits/PropertiesAware.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ public function getProperties(): array

public function getProperty(string $name): Property
{
if (!isset($this->properties[$name])) {
throw new Nette\InvalidArgumentException("Property '$name' not found.");
}

return $this->properties[$name];
return $this->properties[$name] ?? throw new Nette\InvalidArgumentException("Property '$name' not found.");
}


Expand Down

0 comments on commit bdb3fc6

Please sign in to comment.