Skip to content

Commit bdb3fc6

Browse files
committed
refactoring
1 parent b2aebf0 commit bdb3fc6

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

src/PhpGenerator/Factory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
/**
17-
* Creates a representation based on reflection.
17+
* Creates a representations based on reflection or source code.
1818
*/
1919
final class Factory
2020
{

src/PhpGenerator/Traits/MethodsAware.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,7 @@ public function getMethods(): array
4949

5050
public function getMethod(string $name): Method
5151
{
52-
$m = $this->methods[strtolower($name)] ?? null;
53-
if (!$m) {
54-
throw new Nette\InvalidArgumentException("Method '$name' not found.");
55-
}
56-
57-
return $m;
52+
return $this->methods[strtolower($name)] ?? throw new Nette\InvalidArgumentException("Method '$name' not found.");
5853
}
5954

6055

src/PhpGenerator/Traits/PropertiesAware.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@ public function getProperties(): array
4444

4545
public function getProperty(string $name): Property
4646
{
47-
if (!isset($this->properties[$name])) {
48-
throw new Nette\InvalidArgumentException("Property '$name' not found.");
49-
}
50-
51-
return $this->properties[$name];
47+
return $this->properties[$name] ?? throw new Nette\InvalidArgumentException("Property '$name' not found.");
5248
}
5349

5450

0 commit comments

Comments
 (0)