Skip to content

Commit 4a28cdf

Browse files
committed
Issue #10: Fixed invalid property initializations
Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
1 parent 9b062d2 commit 4a28cdf

3 files changed

Lines changed: 9 additions & 13 deletions

File tree

.laminas-ci.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
2+
"tests": {
3+
"php": ["8.1", "8.2", "8.3", "8.4"],
4+
"cs": true
5+
},
26
"backwardCompatibilityCheck": true,
37
"exclude": {
48
"bc-check": [

src/Component/Method.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class Method implements MethodInterface
1919
{
20-
protected VisibilityEnum $visibility;
20+
protected VisibilityEnum $visibility = VisibilityEnum::Public;
2121
/** @var ParameterInterface[] $parameters */
2222
protected array $parameters = [];
2323
/** @var Inject[] $injects */
@@ -30,7 +30,6 @@ class Method implements MethodInterface
3030
public function __construct(
3131
public readonly string $name,
3232
) {
33-
$this->setVisibility(VisibilityEnum::Public);
3433
}
3534

3635
public function __toString(): string

src/Component/Property.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,10 @@
1212

1313
class Property extends Parameter
1414
{
15-
protected VisibilityEnum $visibility;
16-
protected bool $readonly = false;
17-
protected bool $static = false;
18-
protected string $comment = '';
19-
20-
public function __construct(string $name, string $type, bool $nullable = false, ?string $default = null)
21-
{
22-
parent::__construct($name, $type, $nullable, $default);
23-
24-
$this->setVisibility(VisibilityEnum::Protected);
25-
}
15+
protected VisibilityEnum $visibility = VisibilityEnum::Protected;
16+
protected bool $readonly = false;
17+
protected bool $static = false;
18+
protected string $comment = '';
2619

2720
public function getVisibility(): VisibilityEnum
2821
{

0 commit comments

Comments
 (0)