Skip to content

Commit 06eeb52

Browse files
authored
Merge pull request #30 from open-code-modeling/0.8.x-merge-up-into-0.9.x_5fac59d2c22b73.89506518
Merge release 0.8.1 into 0.9.x
2 parents ec1bbaf + ad83cc5 commit 06eeb52

File tree

3 files changed

+41
-16
lines changed

3 files changed

+41
-16
lines changed

CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,33 @@ All notable changes to this project will be documented in this file, in reverse
2424

2525
- Nothing.
2626

27+
## 0.8.1 - 2020-11-11
28+
29+
30+
-----
31+
32+
### Release Notes for [0.8.1](https://github.com/open-code-modeling/php-code-ast/milestone/6)
33+
34+
0.8.x bugfix release (patch)
35+
36+
### 0.8.1
37+
38+
- Total issues resolved: **0**
39+
- Total pull requests resolved: **1**
40+
- Total contributors: **1**
41+
42+
#### bug
43+
44+
- [28: Merge release 0.7.1 into 0.8.x](https://github.com/open-code-modeling/php-code-ast/pull/28) thanks to @github-actions[bot]
45+
2746
## 0.8.0 - 2020-11-09
2847

2948

3049
-----
3150

3251
### Release Notes for [0.8.0](https://github.com/open-code-modeling/php-code-ast/milestone/5)
3352

34-
53+
Feature release (minor)
3554

3655
### 0.8.0
3756

@@ -58,6 +77,8 @@ All notable changes to this project will be documented in this file, in reverse
5877
-----
5978
### Release Notes for [0.7.0](https://github.com/open-code-modeling/php-code-ast/milestone/4)
6079

80+
Feature release (minor)
81+
6182
### 0.7.0
6283

6384
- Total issues resolved: **1**
@@ -73,6 +94,8 @@ All notable changes to this project will be documented in this file, in reverse
7394
-----
7495
### Release Notes for [0.6.0](https://github.com/open-code-modeling/php-code-ast/milestone/3)
7596

97+
Feature release (minor)
98+
7699
### 0.6.0
77100

78101
- Total issues resolved: **3**
@@ -90,6 +113,8 @@ All notable changes to this project will be documented in this file, in reverse
90113
-----
91114
### Release Notes for [0.5.0](https://github.com/open-code-modeling/php-code-ast/milestone/2)
92115

116+
Feature release (minor)
117+
93118
### 0.5.0
94119

95120
- Total issues resolved: **1**

src/Builder/ClassBuilder.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static function fromNodes(Node ...$nodes): self
8080
}
8181

8282
public static function fromScratch(
83-
string $className,
83+
?string $className,
8484
string $namespace = null,
8585
bool $typed = true,
8686
bool $strict = true
@@ -196,6 +196,11 @@ public function getNamespace(): ?string
196196
return $this->namespace;
197197
}
198198

199+
public function setName(?string $name): void
200+
{
201+
$this->name = $name;
202+
}
203+
199204
public function getName(): ?string
200205
{
201206
return $this->name;

src/Code/ClassGenerator.php

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
namespace OpenCodeModeling\CodeAst\Code;
1212

13-
use PhpParser\Builder;
1413
use PhpParser\Node\Stmt\Class_;
1514

1615
/**
@@ -37,11 +36,11 @@ final class ClassGenerator implements StatementGenerator
3736
private $flags = 0;
3837

3938
/**
40-
* @param string $name
39+
* @param string|null $name
4140
* @param array|string $flags
4241
*/
4342
public function __construct(
44-
$name,
43+
?string $name,
4544
$flags = null
4645
) {
4746
$this->setName($name);
@@ -53,19 +52,15 @@ public function __construct(
5352

5453
public function generate(): Class_
5554
{
56-
$classBuilder = new Builder\Class_($this->name);
57-
$node = $classBuilder->getNode();
58-
59-
$node->flags = $this->flags;
60-
61-
return $node;
55+
return new Class_(
56+
$this->name,
57+
[
58+
'flags' => $this->flags,
59+
]
60+
);
6261
}
6362

64-
/**
65-
* @param string $name
66-
* @return self
67-
*/
68-
public function setName(string $name): self
63+
public function setName(?string $name): self
6964
{
7065
$this->name = $name;
7166

0 commit comments

Comments
 (0)