Skip to content

Commit 9b1628d

Browse files
committed
Update for micro/dto
1 parent 30894ba commit 9b1628d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+130
-381
lines changed

ClassDef/ClassDefinition.php

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,10 @@
1717

1818
class ClassDefinition
1919
{
20-
/**
21-
* @var string
22-
*/
2320
private string $extends = ClassMetadataHelperInterface::PROPERTY_TYPE_ABSTRACT_CLASS;
2421

25-
/**
26-
* @var string
27-
*/
2822
private string $namespace = '';
2923

30-
/**
31-
* @var string
32-
*/
3324
private string $name = '';
3425

3526
/**
@@ -52,49 +43,31 @@ class ClassDefinition
5243
*/
5344
private array $comments = [];
5445

55-
/**
56-
* @return string
57-
*/
5846
public function getExtends(): string
5947
{
6048
return $this->extends;
6149
}
6250

63-
/**
64-
* @param string $extends
65-
*/
6651
public function setExtends(string $extends): void
6752
{
6853
$this->extends = $extends;
6954
}
7055

71-
/**
72-
* @return string
73-
*/
7456
public function getNamespace(): string
7557
{
7658
return $this->namespace;
7759
}
7860

79-
/**
80-
* @param string $namespace
81-
*/
8261
public function setNamespace(string $namespace): void
8362
{
8463
$this->namespace = $namespace;
8564
}
8665

87-
/**
88-
* @return string
89-
*/
9066
public function getName(): string
9167
{
9268
return $this->name;
9369
}
9470

95-
/**
96-
* @param string $name
97-
*/
9871
public function setName(string $name): void
9972
{
10073
$this->name = $name;
@@ -108,11 +81,6 @@ public function getProperties(): iterable
10881
return $this->properties;
10982
}
11083

111-
/**
112-
* @param PropertyDefinition $propertyDefinition
113-
*
114-
* @return $this
115-
*/
11684
public function addProperty(PropertyDefinition $propertyDefinition): self
11785
{
11886
$this->properties[] = $propertyDefinition;
@@ -145,11 +113,6 @@ public function getComments(): iterable
145113
return $this->comments;
146114
}
147115

148-
/**
149-
* @param string $comment
150-
*
151-
* @return $this
152-
*/
153116
public function addComment(string $comment): self
154117
{
155118
if (!\in_array($comment, $this->comments)) {

ClassDef/MethodDefinition.php

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,49 +18,41 @@ class MethodDefinition
1818
private string $visibility = 'public';
1919

2020
private string $name = '';
21+
2122
/**
2223
* @var string[]
2324
*/
2425
private array $typesReturn = [];
26+
2527
/**
2628
* @var PropertyDefinition[]
2729
*/
2830
private array $args = [];
2931

3032
private string $body = '';
33+
3134
/**
3235
* @var string[]
3336
*/
3437
private array $comments = [];
38+
3539
private bool $isStatic = false;
3640

37-
/**
38-
* @return string
39-
*/
4041
public function getVisibility(): string
4142
{
4243
return $this->visibility;
4344
}
4445

45-
/**
46-
* @param string $visibility
47-
*/
4846
public function setVisibility(string $visibility): void
4947
{
5048
$this->visibility = $visibility;
5149
}
5250

53-
/**
54-
* @return string
55-
*/
5651
public function getName(): string
5752
{
5853
return $this->name;
5954
}
6055

61-
/**
62-
* @param string $name
63-
*/
6456
public function setName(string $name): void
6557
{
6658
$this->name = $name;
@@ -98,17 +90,11 @@ public function setArgs(array $args): void
9890
$this->args = $args;
9991
}
10092

101-
/**
102-
* @return string
103-
*/
10493
public function getBody(): string
10594
{
10695
return $this->body;
10796
}
10897

109-
/**
110-
* @param string $body
111-
*/
11298
public function setBody(string $body): void
11399
{
114100
$this->body = $body;
@@ -122,17 +108,11 @@ public function getComments(): array
122108
return $this->comments;
123109
}
124110

125-
/**
126-
* @return bool
127-
*/
128111
public function isStatic(): bool
129112
{
130113
return $this->isStatic;
131114
}
132115

133-
/**
134-
* @param bool $isStatic
135-
*/
136116
public function setIsStatic(bool $isStatic): void
137117
{
138118
$this->isStatic = $isStatic;

ClassDef/PropertyDefinition.php

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515

1616
class PropertyDefinition
1717
{
18-
private string $name;
18+
private string $name = '';
1919

2020
/**
2121
* @var string[]
2222
*/
2323
private array $comments = [];
24+
2425
/**
2526
* @var string[]
2627
*/
@@ -32,24 +33,14 @@ class PropertyDefinition
3233
private array $attributes = [];
3334

3435
private bool $isRequired = false;
35-
private bool $isCollection = false;
3636

37-
public function __construct()
38-
{
39-
$this->name = '';
40-
}
37+
private bool $isCollection = false;
4138

42-
/**
43-
* @return string
44-
*/
4539
public function getName(): string
4640
{
4741
return $this->name;
4842
}
4943

50-
/**
51-
* @param string $name
52-
*/
5344
public function setName(string $name): void
5445
{
5546
$this->name = $name;
@@ -86,43 +77,28 @@ public function setTypes(array $types): void
8677
$this->types = $types;
8778
}
8879

89-
/**
90-
* @return bool
91-
*/
9280
public function isRequired(): bool
9381
{
9482
return $this->isRequired;
9583
}
9684

97-
/**
98-
* @param bool $isRequired
99-
*/
10085
public function setIsRequired(bool $isRequired): void
10186
{
10287
$this->isRequired = $isRequired;
10388
}
10489

105-
/**
106-
* @return bool
107-
*/
10890
public function isCollection(): bool
10991
{
11092
return $this->isCollection;
11193
}
11294

113-
/**
114-
* @param bool $isCollection
115-
*/
11695
public function setIsCollection(bool $isCollection): void
11796
{
11897
$this->isCollection = $isCollection;
11998
}
12099

121100
/**
122-
* @param string $attributeName
123101
* @param array<string, mixed> $arguments
124-
*
125-
* @return $this
126102
*/
127103
public function addAttribute(string $attributeName, array $arguments): self
128104
{

ClassGeneratorFacadeDefault.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,18 @@
1818
class ClassGeneratorFacadeDefault extends GeneratorFacade
1919
{
2020
/**
21-
* @param array<string> $filesSchemeCollection
22-
* @param string $outputPath
23-
* @param string $namespaceGeneral
24-
* @param string $classSuffix
25-
* @param LoggerInterface|null $logger
21+
* @param array<string> $filesSchemeCollection
2622
*/
2723
public function __construct(
28-
private array $filesSchemeCollection,
29-
private string $outputPath,
30-
private string $namespaceGeneral = '',
31-
private string $classSuffix = 'Transfer',
32-
private null|LoggerInterface $logger = null
24+
private readonly array $filesSchemeCollection,
25+
private readonly string $outputPath,
26+
private readonly string $namespaceGeneral = '',
27+
private readonly string $classSuffix = 'Transfer',
28+
private readonly ?LoggerInterface $logger = null
3329
) {
3430
parent::__construct($this->createDefaultDependencyInjectionObject());
3531
}
3632

37-
/**
38-
* @return DependencyInjectionInterface
39-
*/
4033
protected function createDefaultDependencyInjectionObject(): DependencyInjectionInterface
4134
{
4235
return new DependencyInjection(

DependencyInjection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
use Psr\Log\LoggerInterface;
8484
use Psr\Log\NullLogger;
8585

86-
class DependencyInjection implements DependencyInjectionInterface
86+
readonly class DependencyInjection implements DependencyInjectionInterface
8787
{
8888
/**
8989
* @param string[] $filesSchemeCollection

DependencyInjectionInterface.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,15 @@
2222

2323
interface DependencyInjectionInterface
2424
{
25-
/**
26-
* @return LoggerInterface
27-
*/
2825
public function getLogger(): LoggerInterface;
2926

30-
/**
31-
* @return CollectionPreparationInterface
32-
*/
3327
public function createClassPreparationProcessor(): CollectionPreparationInterface;
3428

35-
/**
36-
* @return ClassMetadataHelper
37-
*/
3829
public function createClassMetadataHelper(): ClassMetadataHelper;
3930

40-
/**
41-
* @return WriterInterface
42-
*/
4331
public function createWriter(): WriterInterface;
4432

45-
/**
46-
* @return ReaderInterface
47-
*/
4833
public function createReader(): ReaderInterface;
4934

50-
/**
51-
* @return RendererInterface
52-
*/
5335
public function createRenderer(): RendererInterface;
5436
}

DtoFacadeInterface.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@
1515

1616
interface DtoFacadeInterface
1717
{
18-
/**
19-
* @return GeneratorFacadeInterface
20-
*/
2118
public function createGenerator(): GeneratorFacadeInterface;
2219

23-
/**
24-
* @return SerializerFacadeInterface
25-
*/
2620
public function createSerializer(): SerializerFacadeInterface;
2721
}

Generator/Generator.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Micro\Library\DTO\Writer\WriterInterface;
2121
use Psr\Log\LoggerInterface;
2222

23-
class Generator
23+
readonly class Generator
2424
{
2525
public function __construct(
2626
private ReaderInterface $reader,
@@ -31,9 +31,6 @@ public function __construct(
3131
) {
3232
}
3333

34-
/**
35-
* @return void
36-
*/
3734
public function generate(): void
3835
{
3936
/** @var ClassDefinition $classDef */

GeneratorFacade.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@
1818
class GeneratorFacade implements GeneratorFacadeInterface
1919
{
2020
public function __construct(
21-
private DependencyInjectionInterface $dependencyInjection
21+
private readonly DependencyInjectionInterface $dependencyInjection
2222
) {
2323
}
2424

25-
/**
26-
* {@inheritDoc}
27-
*/
2825
public function generate(): void
2926
{
3027
$generator = new Generator(

0 commit comments

Comments
 (0)