Skip to content

Commit a7c7217

Browse files
committed
removed useless type juggling
1 parent ac51c9e commit a7c7217

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

src/PhpGenerator/ClassType.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function getType(): string
185185
*/
186186
public function setFinal(bool $state = TRUE): self
187187
{
188-
$this->final = (bool) $state;
188+
$this->final = $state;
189189
return $this;
190190
}
191191

@@ -201,7 +201,7 @@ public function isFinal(): bool
201201
*/
202202
public function setAbstract(bool $state = TRUE): self
203203
{
204-
$this->abstract = (bool) $state;
204+
$this->abstract = $state;
205205
return $this;
206206
}
207207

@@ -241,7 +241,7 @@ public function getExtends()
241241
public function addExtend(string $type): self
242242
{
243243
$this->extends = (array) $this->extends;
244-
$this->extends[] = (string) $type;
244+
$this->extends[] = $type;
245245
return $this;
246246
}
247247

@@ -271,7 +271,7 @@ public function getImplements(): array
271271
*/
272272
public function addImplement(string $type): self
273273
{
274-
$this->implements[] = (string) $type;
274+
$this->implements[] = $type;
275275
return $this;
276276
}
277277

src/PhpGenerator/Helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public static function isNamespace($value): bool
243243
*/
244244
public static function createObject(string $class, array $props)
245245
{
246-
return unserialize('O' . substr(serialize((string) $class), 1, -1) . substr(serialize($props), 1));
246+
return unserialize('O' . substr(serialize($class), 1, -1) . substr(serialize($props), 1));
247247
}
248248

249249

src/PhpGenerator/Method.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function getBody()
108108
*/
109109
public function setStatic(bool $val): self
110110
{
111-
$this->static = (bool) $val;
111+
$this->static = $val;
112112
return $this;
113113
}
114114

@@ -124,7 +124,7 @@ public function isStatic(): bool
124124
*/
125125
public function setFinal(bool $val): self
126126
{
127-
$this->final = (bool) $val;
127+
$this->final = $val;
128128
return $this;
129129
}
130130

@@ -140,7 +140,7 @@ public function isFinal(): bool
140140
*/
141141
public function setAbstract(bool $val): self
142142
{
143-
$this->abstract = (bool) $val;
143+
$this->abstract = $val;
144144
return $this;
145145
}
146146

src/PhpGenerator/Parameter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Parameter
4343
*/
4444
public function setReference(bool $state = TRUE): self
4545
{
46-
$this->reference = (bool) $state;
46+
$this->reference = $state;
4747
return $this;
4848
}
4949

@@ -80,7 +80,7 @@ public function getTypeHint()
8080
*/
8181
public function setOptional(bool $state = TRUE): self
8282
{
83-
$this->hasDefaultValue = (bool) $state;
83+
$this->hasDefaultValue = $state;
8484
return $this;
8585
}
8686

@@ -100,7 +100,7 @@ public function isOptional(): bool
100100
*/
101101
public function setNullable(bool $state = TRUE): self
102102
{
103-
$this->nullable = (bool) $state;
103+
$this->nullable = $state;
104104
return $this;
105105
}
106106

src/PhpGenerator/PhpLiteral.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class PhpLiteral
2121

2222
public function __construct(string $value)
2323
{
24-
$this->value = (string) $value;
24+
$this->value = $value;
2525
}
2626

2727

src/PhpGenerator/PhpNamespace.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(string $name)
4949
if ($name !== '' && !Helpers::isNamespace($name)) {
5050
throw new Nette\InvalidArgumentException("Value '$name' is not valid name.");
5151
}
52-
$this->name = (string) $name;
52+
$this->name = $name;
5353
}
5454

5555

@@ -74,7 +74,7 @@ public function getName(): string
7474
*/
7575
public function setBracketedSyntax(bool $state = TRUE): self
7676
{
77-
$this->bracketedSyntax = (bool) $state;
77+
$this->bracketedSyntax = $state;
7878
return $this;
7979
}
8080

src/PhpGenerator/Property.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function &getValue()
5252
*/
5353
public function setStatic(bool $state = TRUE): self
5454
{
55-
$this->static = (bool) $state;
55+
$this->static = $state;
5656
return $this;
5757
}
5858

src/PhpGenerator/Traits/FunctionLike.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function addParameter(string $name, $defaultValue = NULL): Parameter
112112
*/
113113
public function setVariadic(bool $val): self
114114
{
115-
$this->variadic = (bool) $val;
115+
$this->variadic = $val;
116116
return $this;
117117
}
118118

@@ -148,7 +148,7 @@ public function getReturnType()
148148
*/
149149
public function setReturnReference(bool $val): self
150150
{
151-
$this->returnReference = (bool) $val;
151+
$this->returnReference = $val;
152152
return $this;
153153
}
154154

@@ -164,7 +164,7 @@ public function getReturnReference(): bool
164164
*/
165165
public function setReturnNullable(bool $val): self
166166
{
167-
$this->returnNullable = (bool) $val;
167+
$this->returnNullable = $val;
168168
return $this;
169169
}
170170

0 commit comments

Comments
 (0)