Skip to content

Commit ccf8c12

Browse files
committed
apply php-cs-fixer
1 parent b06dd78 commit ccf8c12

File tree

80 files changed

+219
-219
lines changed

Some content is hidden

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

80 files changed

+219
-219
lines changed

.php_cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ return PhpCsFixer\Config::create()
1818
'syntax' => 'short'
1919
],
2020
'blank_line_after_namespace' => true,
21-
'concat_space' => true,
21+
'concat_space' => [
22+
'spacing' => 'one'
23+
],
2224
'encoding' => true,
2325
'full_opening_tag' => true,
2426
'function_declaration' => [

src/config/CodeGeneratorConfig.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ public function setGenerateEmptyDocblock(bool $generate) {
143143
public function getGenerateScalarTypeHints(): bool {
144144
return $this->options['generateScalarTypeHints'];
145145
}
146-
147-
148146

149147
/**
150148
* Returns whether sorting is enabled
@@ -230,7 +228,7 @@ public function setGenerateReturnTypeHints(bool $generate) {
230228
$this->options['generateReturnTypeHints'] = $generate;
231229
return $this;
232230
}
233-
231+
234232
/**
235233
* Returns whether return nullable type hints will be generated (PHP 7.3)
236234
*
@@ -239,7 +237,7 @@ public function setGenerateReturnTypeHints(bool $generate) {
239237
public function getGenerateNullableTypes(): bool {
240238
return $this->options['generateNullableTypes'];
241239
}
242-
240+
243241
/**
244242
* Sets whether return nullable type hints will be generated (PHP 7.3)
245243
*

src/generator/ComparatorFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ public static function createMethodComparator(string $type): Comparator {
7070
// }
7171
return new DefaultMethodComparator();
7272
}
73-
}
73+
}

src/generator/ModelGenerator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ModelGenerator {
2323

2424
/** @var CodeGeneratorConfig */
2525
private $config;
26-
26+
2727
/** @var Formatter */
2828
private $formatter;
2929

src/generator/builder/AbstractBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ protected function buildDocblock(DocblockInterface $model): void {
6565
}
6666
}
6767

68-
}
68+
}

src/generator/builder/ConstantBuilder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
namespace gossi\codegen\generator\builder;
55

6-
use gossi\codegen\model\AbstractModel;
76
use gossi\codegen\generator\builder\parts\ValueBuilderPart;
7+
use gossi\codegen\model\AbstractModel;
88

99
class ConstantBuilder extends AbstractBuilder {
1010

@@ -17,4 +17,4 @@ public function build(AbstractModel $model): void {
1717
$this->writer->writeln(';');
1818
}
1919

20-
}
20+
}

src/generator/builder/FunctionBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ public function build(AbstractModel $model): void {
1717
$this->writeBody($model);
1818
}
1919

20-
}
20+
}

src/generator/builder/InterfaceBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ private function sort(PhpInterface $model) {
4141
$this->sortConstants($model);
4242
$this->sortMethods($model);
4343
}
44-
}
44+
}

src/generator/builder/MethodBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ public function build(AbstractModel $model): void {
3939
$this->writeBody($model);
4040
}
4141

42-
}
42+
}

src/generator/builder/ParameterBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ public function build(AbstractModel $model): void {
3131
}
3232
}
3333

34-
}
34+
}

src/generator/builder/PropertyBuilder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
namespace gossi\codegen\generator\builder;
55

6-
use gossi\codegen\model\AbstractModel;
76
use gossi\codegen\generator\builder\parts\ValueBuilderPart;
7+
use gossi\codegen\model\AbstractModel;
88

99
class PropertyBuilder extends AbstractBuilder {
1010

@@ -25,4 +25,4 @@ public function build(AbstractModel $model): void {
2525
$this->writer->writeln(';');
2626
}
2727

28-
}
28+
}

src/generator/builder/TraitBuilder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
namespace gossi\codegen\generator\builder;
55

6-
use gossi\codegen\model\AbstractModel;
76
use gossi\codegen\generator\builder\parts\StructBuilderPart;
7+
use gossi\codegen\model\AbstractModel;
88
use gossi\codegen\model\PhpTrait;
99

1010
class TraitBuilder extends AbstractBuilder {
@@ -37,4 +37,4 @@ private function sort(PhpTrait $model) {
3737
$this->sortProperties($model);
3838
$this->sortMethods($model);
3939
}
40-
}
40+
}

src/generator/builder/parts/RoutineBuilderPart.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
use gossi\codegen\model\AbstractModel;
77
use gossi\codegen\model\RoutineInterface;
88

9-
Trait RoutineBuilderPart {
9+
trait RoutineBuilderPart {
1010

1111
use TypeBuilderPart;
1212

1313
/**
1414
* @param AbstractModel $model
1515
* @return void
1616
*/
17-
protected abstract function generate(AbstractModel $model): void;
17+
abstract protected function generate(AbstractModel $model): void;
1818

1919
protected function writeFunctionStatement(RoutineInterface $model): void {
2020
$this->writer->write('function ');

src/generator/builder/parts/ValueBuilderPart.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
namespace gossi\codegen\generator\builder\parts;
55

6-
use gossi\codegen\model\ValueInterface;
76
use gossi\codegen\model\PhpConstant;
7+
use gossi\codegen\model\ValueInterface;
88

99
trait ValueBuilderPart {
1010

@@ -30,4 +30,4 @@ private function exportVar($value) {
3030

3131
return var_export($value, true);
3232
}
33-
}
33+
}

src/generator/comparator/DefaultConstantComparator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ public function compare($a, $b) {
2727
return $this->comparator->compare($a->getName(), $b->getName());
2828
}
2929

30-
}
30+
}

src/generator/comparator/DefaultMethodComparator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ public function compare($a, $b) {
3232
return strcasecmp($a->getName(), $b->getName());
3333
}
3434

35-
}
35+
}

src/generator/comparator/DefaultPropertyComparator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ public function compare($a, $b) {
2828
return strcasecmp($a->getName(), $b->getName());
2929
}
3030

31-
}
31+
}

src/generator/comparator/DefaultUseStatementComparator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ private function getAscii($str) {
4242
return $ord;
4343
}
4444

45-
}
45+
}

src/model/PhpClass.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class PhpClass extends AbstractPhpStruct implements GenerateableInterface, Trait
3838
* @param string $filename
3939
* @return PhpClass
4040
*/
41-
public static function fromFile(string $filename): PhpClass {
42-
$class = new PhpClass();
41+
public static function fromFile(string $filename): self {
42+
$class = new self();
4343
$parser = new FileParser($filename);
4444
$parser->addVisitor(new ClassParserVisitor($class));
4545
$parser->addVisitor(new MethodParserVisitor($class));
@@ -83,7 +83,7 @@ public function setParentClassName(?string $name) {
8383
return $this;
8484
}
8585

86-
public function generateDocblock() {
86+
public function generateDocblock(): void {
8787
parent::generateDocblock();
8888

8989
foreach ($this->constants as $constant) {

src/model/PhpConstant.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function __construct($name = null, $value = null, $isExpression = false)
5959
/**
6060
* @inheritDoc
6161
*/
62-
public function generateDocblock() {
62+
public function generateDocblock(): void {
6363
$docblock = $this->getDocblock();
6464
$docblock->setShortDescription($this->getDescription());
6565
$docblock->setLongDescription($this->getLongDescription());

src/model/PhpFunction.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function __construct($name = null) {
9898
/**
9999
* @inheritDoc
100100
*/
101-
public function generateDocblock() {
101+
public function generateDocblock(): void {
102102
$docblock = $this->getDocblock();
103103
$docblock->setShortDescription($this->getDescription());
104104
$docblock->setLongDescription($this->getLongDescription());

src/model/PhpInterface.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class PhpInterface extends AbstractPhpStruct implements GenerateableInterface, C
2626
* @param string $filename
2727
* @return PhpInterface
2828
*/
29-
public static function fromFile(string $filename): PhpInterface {
30-
$interface = new PhpInterface();
29+
public static function fromFile(string $filename): self {
30+
$interface = new self();
3131
$parser = new FileParser($filename);
3232
$parser->addVisitor(new InterfaceParserVisitor($interface));
3333
$parser->addVisitor(new MethodParserVisitor($interface));
@@ -51,7 +51,7 @@ public function __construct($name = null) {
5151
/**
5252
* @inheritDoc
5353
*/
54-
public function generateDocblock() {
54+
public function generateDocblock(): void {
5555
parent::generateDocblock();
5656

5757
foreach ($this->constants as $constant) {

src/model/PhpTrait.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class PhpTrait extends AbstractPhpStruct implements GenerateableInterface, Trait
2727
* @param string $filename
2828
* @return PhpTrait
2929
*/
30-
public static function fromFile(string $filename): PhpTrait {
31-
$trait = new PhpTrait();
30+
public static function fromFile(string $filename): self {
31+
$trait = new self();
3232
$parser = new FileParser($filename);
3333
$parser->addVisitor(new TraitParserVisitor($trait));
3434
$parser->addVisitor(new MethodParserVisitor($trait));
@@ -52,7 +52,7 @@ public function __construct($name = null) {
5252
/**
5353
* @inheritDoc
5454
*/
55-
public function generateDocblock() {
55+
public function generateDocblock(): void {
5656
parent::generateDocblock();
5757

5858
foreach ($this->properties as $prop) {

src/model/PropertiesInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ public function getPropertyNames(): Set;
7070
* @return $this
7171
*/
7272
public function clearProperties();
73-
}
73+
}

src/model/ValueInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ public function getExpression(): ?string;
6262
* @return $this
6363
*/
6464
public function unsetExpression();
65-
}
65+
}

src/model/parts/ParametersPart.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
namespace gossi\codegen\model\parts;
55

66
use gossi\codegen\model\PhpParameter;
7-
use gossi\docblock\tags\ParamTag;
87
use gossi\docblock\Docblock;
8+
use gossi\docblock\tags\ParamTag;
99

1010
/**
1111
* Parameters Part

src/model/parts/TypeDocblockGeneratorPart.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
namespace gossi\codegen\model\parts;
55

6-
use gossi\docblock\tags\AbstractTag;
76
use gossi\docblock\Docblock;
7+
use gossi\docblock\tags\AbstractTag;
88

99
/**
1010
* Type docblock generator part

src/model/parts/TypePart.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ trait TypePart {
1717

1818
/** @var string */
1919
private $typeDescription;
20-
20+
2121
/** @var bool */
2222
private $typeNullable;
2323

@@ -65,7 +65,7 @@ public function getType(): ?string {
6565
public function getTypeDescription(): ?string {
6666
return $this->typeDescription;
6767
}
68-
68+
6969
/**
7070
* Returns whether the type is nullable
7171
*
@@ -74,7 +74,7 @@ public function getTypeDescription(): ?string {
7474
public function getNullable(): bool {
7575
return $this->typeNullable;
7676
}
77-
77+
7878
/**
7979
* Sets the type nullable
8080
*

src/model/parts/ValuePart.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function hasDefaultValue(): bool {
6363
* Returns whether the given value is a primitive
6464
*
6565
* @param mixed $value
66-
* @return boolean
66+
* @return bool
6767
*/
6868
private function isPrimitive($value): bool {
6969
return (is_string($value)
@@ -77,7 +77,7 @@ private function isPrimitive($value): bool {
7777
/**
7878
* Sets the value
7979
*
80-
* @param string|integer|float|bool|null|PhpConstant $value
80+
* @param string|int|float|bool|null|PhpConstant $value
8181
* @throws \InvalidArgumentException if the value is not an accepted primitve
8282
* @return $this
8383
*/
@@ -106,7 +106,7 @@ public function unsetValue() {
106106
/**
107107
* Returns the value
108108
*
109-
* @return string|integer|float|bool|null|PhpConstant
109+
* @return string|int|float|bool|null|PhpConstant
110110
*/
111111
public function getValue() {
112112
return $this->value;

src/parser/FileParser.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
namespace gossi\codegen\parser;
55

6+
use gossi\codegen\parser\visitor\ParserVisitorInterface;
7+
use phootwork\collection\Set;
8+
use phootwork\file\exception\FileNotFoundException;
9+
use phootwork\file\File;
610
use PhpParser\Node;
711
use PhpParser\NodeTraverser;
812
use PhpParser\NodeVisitorAbstract;
913
use PhpParser\Parser;
10-
use gossi\codegen\parser\visitor\ParserVisitorInterface;
11-
use phootwork\collection\Set;
12-
use phootwork\file\File;
13-
use phootwork\file\exception\FileNotFoundException;
1414

1515
class FileParser extends NodeVisitorAbstract {
1616

0 commit comments

Comments
 (0)