Skip to content

Commit d1b4cad

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

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

docs/book/v1/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ Programmatically generate Dotkernel project files and directories.
55
## Badges
66

77
![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-maker)
8-
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-maker/1.0)
8+
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-maker/1.0.0)
99

1010
[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-maker)](https://github.com/dotkernel/dot-maker/issues)
1111
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-maker)](https://github.com/dotkernel/dot-maker/network)
1212
[![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-maker)](https://github.com/dotkernel/dot-maker/stargazers)
13-
[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-maker)](https://github.com/dotkernel/dot-maker/blob/1.0/LICENSE.md)
13+
[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-maker)](https://github.com/dotkernel/dot-maker/blob/1.0/LICENSE)
1414

1515
[![Build Static](https://github.com/dotkernel/dot-maker/actions/workflows/continuous-integration.yml/badge.svg?branch=1.0)](https://github.com/dotkernel/dot-maker/actions/workflows/continuous-integration.yml)
1616
[![codecov](https://codecov.io/gh/dotkernel/dot-maker/graph/badge.svg?token=KT9UA402B4)](https://codecov.io/gh/dotkernel/dot-maker)

src/Component/Method.php

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

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

3536
public function __toString(): string

src/Component/Property.php

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

1313
class Property extends Parameter
1414
{
15-
protected VisibilityEnum $visibility = VisibilityEnum::Protected;
16-
protected bool $readonly = false;
17-
protected bool $static = false;
18-
protected string $comment = '';
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->visibility = VisibilityEnum::Protected;
25+
}
1926

2027
public function getVisibility(): VisibilityEnum
2128
{

0 commit comments

Comments
 (0)