Skip to content

Commit a17f60a

Browse files
committed
Add missing param doc blocks to avoid code sniffer errors - close #30
1 parent 2dd550a commit a17f60a

19 files changed

+559
-393
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"require": {
3535
"php": "^7.4 || ^8.0",
3636
"open-code-modeling/json-schema-to-php": "^0.3.0 || 0.4.x-dev",
37-
"open-code-modeling/php-code-ast": "^0.12.0 || 0.13.x-dev"
37+
"open-code-modeling/php-code-ast": "^0.13.0 || 0.13.x-dev"
3838
},
3939
"require-dev": {
4040
"laminas/laminas-filter": "^2.9",

composer.lock

Lines changed: 504 additions & 380 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ValueObject/Bcp47Factory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,12 @@ public function methodEquals(string $propertyName, string $argumentName = 'other
170170
$method = new MethodGenerator(
171171
'equals',
172172
[
173-
new ParameterGenerator($argumentName),
173+
(new ParameterGenerator($argumentName))->setTypeDocBlockHint('mixed'),
174174
],
175175
MethodGenerator::FLAG_PUBLIC,
176176
new BodyGenerator($this->parser, $body)
177177
);
178+
$method->setDocBlockComment('');
178179
$method->setTyped($this->typed);
179180
$method->setReturnType('bool');
180181

src/ValueObject/BooleanFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,12 @@ public function methodEquals(string $propertyName, string $argumentName = 'other
188188
$method = new MethodGenerator(
189189
'equals',
190190
[
191-
new ParameterGenerator($argumentName),
191+
(new ParameterGenerator($argumentName))->setTypeDocBlockHint('mixed'),
192192
],
193193
MethodGenerator::FLAG_PUBLIC,
194194
new BodyGenerator($this->parser, $body)
195195
);
196+
$method->setDocBlockComment('');
196197
$method->setTyped($this->typed);
197198
$method->setReturnType('bool');
198199

src/ValueObject/EnumFactory.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ public function methodEquals(string $propertyName, string $argumentName = 'other
360360
return \$this->$propertyName === \$$argumentName->$propertyName;
361361
PHP;
362362

363-
$parameter = new ParameterGenerator($argumentName);
363+
$parameter = (new ParameterGenerator($argumentName))->setTypeDocBlockHint('mixed');
364364

365365
$method = new MethodGenerator(
366366
'equals',
@@ -370,6 +370,7 @@ public function methodEquals(string $propertyName, string $argumentName = 'other
370370
MethodGenerator::FLAG_PUBLIC,
371371
new BodyGenerator($this->parser, $body)
372372
);
373+
$method->setDocBlockComment('');
373374
$method->setTyped($this->typed);
374375
$method->setReturnType('bool');
375376

@@ -420,7 +421,7 @@ public function methodIsOneOf(string $argumentName, ?string $className): MethodG
420421
}
421422
return false;
422423
PHP;
423-
$parameter = (new ParameterGenerator($argumentName))->setVariadic(true);
424+
$parameter = (new ParameterGenerator($argumentName))->setVariadic(true)->setTypeDocBlockHint('mixed');
424425

425426
if ($className !== null) {
426427
$parameter->setType($className);
@@ -434,6 +435,7 @@ public function methodIsOneOf(string $argumentName, ?string $className): MethodG
434435
MethodGenerator::FLAG_PUBLIC,
435436
new BodyGenerator($this->parser, $body)
436437
);
438+
$method->setDocBlockComment('');
437439
$method->setTyped($this->typed);
438440
$method->setReturnType('bool');
439441

src/ValueObject/IntegerFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,12 @@ public function methodEquals(string $propertyName, string $argumentName = 'other
188188
$method = new MethodGenerator(
189189
'equals',
190190
[
191-
new ParameterGenerator($argumentName),
191+
(new ParameterGenerator($argumentName))->setTypeDocBlockHint('mixed'),
192192
],
193193
MethodGenerator::FLAG_PUBLIC,
194194
new BodyGenerator($this->parser, $body)
195195
);
196+
$method->setDocBlockComment('');
196197
$method->setTyped($this->typed);
197198
$method->setReturnType('bool');
198199

src/ValueObject/NumberFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,12 @@ public function methodEquals(string $propertyName, string $argumentName = 'other
188188
$method = new MethodGenerator(
189189
'equals',
190190
[
191-
new ParameterGenerator($argumentName),
191+
(new ParameterGenerator($argumentName))->setTypeDocBlockHint('mixed'),
192192
],
193193
MethodGenerator::FLAG_PUBLIC,
194194
new BodyGenerator($this->parser, $body)
195195
);
196+
$method->setDocBlockComment('');
196197
$method->setTyped($this->typed);
197198
$method->setReturnType('bool');
198199

src/ValueObject/StringFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,12 @@ public function methodEquals(string $propertyName, string $argumentName = 'other
188188
$method = new MethodGenerator(
189189
'equals',
190190
[
191-
new ParameterGenerator($argumentName),
191+
(new ParameterGenerator($argumentName))->setTypeDocBlockHint('mixed'),
192192
],
193193
MethodGenerator::FLAG_PUBLIC,
194194
new BodyGenerator($this->parser, $body)
195195
);
196+
$method->setDocBlockComment('');
196197
$method->setTyped($this->typed);
197198
$method->setReturnType('bool');
198199

src/ValueObject/UuidFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,12 @@ public function methodEquals(string $propertyName, string $argumentName = 'other
192192
$method = new MethodGenerator(
193193
'equals',
194194
[
195-
new ParameterGenerator($argumentName),
195+
(new ParameterGenerator($argumentName))->setTypeDocBlockHint('mixed'),
196196
],
197197
MethodGenerator::FLAG_PUBLIC,
198198
new BodyGenerator($this->parser, $body)
199199
);
200+
$method->setDocBlockComment('');
200201
$method->setTyped($this->typed);
201202
$method->setReturnType('bool');
202203

src/ValueObjectFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
use OpenCodeModeling\CodeAst\Builder\ClassBuilder;
1414
use OpenCodeModeling\CodeAst\Builder\ClassPropertyBuilder;
15-
use OpenCodeModeling\CodeAst\Builder\File;
1615
use OpenCodeModeling\CodeAst\Builder\FileCollection;
16+
use OpenCodeModeling\CodeAst\Builder\PhpFile;
1717
use OpenCodeModeling\CodeAst\Code\ClassConstGenerator;
1818
use OpenCodeModeling\CodeAst\FileCodeGenerator;
1919
use OpenCodeModeling\CodeAst\Package\ClassInfo;
@@ -141,7 +141,7 @@ public function __construct(
141141
|| $classBuilder->hasMethod('toBool');
142142
};
143143

144-
$this->currentFileAst = static function (File $classBuilder, ClassInfo $classInfo) use ($parser): array {
144+
$this->currentFileAst = static function (PhpFile $classBuilder, ClassInfo $classInfo) use ($parser): array {
145145
$path = $classInfo->getPath($classBuilder->getNamespace() . '\\' . $classBuilder->getName());
146146
$filename = $classInfo->getFilenameFromPathAndName($path, $classBuilder->getName());
147147

tests/ValueObject/ArrayFactoryTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ public function toArray() : array
228228
}
229229
/**
230230
* @param mixed $other
231-
* @return bool
232231
*/
233232
public function equals($other) : bool
234233
{

tests/ValueObject/Bcp47FactoryTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ public function toString() : string
9696
{
9797
return $this->bcp47;
9898
}
99+
/**
100+
* @param mixed $other
101+
*/
99102
public function equals($other) : bool
100103
{
101104
if (!$other instanceof self) {

tests/ValueObject/BooleanFactoryTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public function toBool() : bool
8787
{
8888
return $this->boolean;
8989
}
90+
/**
91+
* @param mixed $other
92+
*/
9093
public function equals($other) : bool
9194
{
9295
if (!$other instanceof self) {

tests/ValueObject/EnumFactoryTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,19 @@ public function toString() : string
128128
{
129129
return $this->status;
130130
}
131+
/**
132+
* @param mixed $other
133+
*/
131134
public function equals($other) : bool
132135
{
133136
if (!$other instanceof self) {
134137
return false;
135138
}
136139
return $this->status === $other->status;
137140
}
141+
/**
142+
* @param mixed ...$status
143+
*/
138144
public function isOneOf(...$status) : bool
139145
{
140146
foreach ($status as $otherStatus) {

tests/ValueObject/IntegerFactoryTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public function toInt() : int
8787
{
8888
return $this->number;
8989
}
90+
/**
91+
* @param mixed $other
92+
*/
9093
public function equals($other) : bool
9194
{
9295
if (!$other instanceof self) {

tests/ValueObject/NumberFactoryTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public function toFloat() : float
8787
{
8888
return $this->number;
8989
}
90+
/**
91+
* @param mixed $other
92+
*/
9093
public function equals($other) : bool
9194
{
9295
if (!$other instanceof self) {

tests/ValueObject/StringFactoryTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public function toString() : string
8787
{
8888
return $this->name;
8989
}
90+
/**
91+
* @param mixed $other
92+
*/
9093
public function equals($other) : bool
9194
{
9295
if (!$other instanceof self) {

tests/ValueObject/UuidFactoryTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ public function toString() : string
103103
{
104104
return $this->uuid->toString();
105105
}
106+
/**
107+
* @param mixed $other
108+
*/
106109
public function equals($other) : bool
107110
{
108111
if (!$other instanceof self) {

tests/ValueObjectFactoryTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,6 @@ public function toArray() : array
529529
}
530530
/**
531531
* @param mixed $other
532-
* @return bool
533532
*/
534533
public function equals($other) : bool
535534
{
@@ -621,6 +620,9 @@ public function toString() : string
621620
{
622621
return $this->city;
623622
}
623+
/**
624+
* @param mixed $other
625+
*/
624626
public function equals($other) : bool
625627
{
626628
if (!$other instanceof self) {
@@ -660,6 +662,9 @@ public function toString() : string
660662
{
661663
return $this->streetAddress;
662664
}
665+
/**
666+
* @param mixed $other
667+
*/
663668
public function equals($other) : bool
664669
{
665670
if (!$other instanceof self) {
@@ -713,13 +718,19 @@ public function toString() : string
713718
{
714719
return $this->state;
715720
}
721+
/**
722+
* @param mixed $other
723+
*/
716724
public function equals($other) : bool
717725
{
718726
if (!$other instanceof self) {
719727
return false;
720728
}
721729
return $this->state === $other->state;
722730
}
731+
/**
732+
* @param mixed ...$state
733+
*/
723734
public function isOneOf(...$state) : bool
724735
{
725736
foreach ($state as $otherState) {

0 commit comments

Comments
 (0)