Skip to content

Commit 61f8b3c

Browse files
committed
Strict types fixes
1 parent ad986e0 commit 61f8b3c

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/Commands/EnumAnnotateCommand.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ class EnumAnnotateCommand extends AbstractAnnotationCommand
3434
protected function annotate(ReflectionClass $reflectionClass): void
3535
{
3636
$docBlock = DocBlockGenerator::fromArray([]);
37-
$originalDocBlock = null;
3837

39-
if (strlen($reflectionClass->getDocComment()) !== 0) {
40-
$originalDocBlock = DocBlockGenerator::fromReflection(new DocBlockReflection($reflectionClass));
41-
$docBlock->setShortDescription($originalDocBlock->getShortDescription());
38+
if ($reflectionClass->getDocComment()) {
39+
$docBlock->setShortDescription(
40+
DocBlockGenerator::fromReflection(new DocBlockReflection($reflectionClass))
41+
->getShortDescription()
42+
);
4243
}
4344

4445
$this->updateClassDocblock($reflectionClass, $this->getDocBlock($reflectionClass));

src/Rules/EnumKey.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(
3131
*/
3232
public function passes($attribute, $value): bool
3333
{
34-
return $this->enumClass::hasKey($value);
34+
return is_string($value) && $this->enumClass::hasKey($value);
3535
}
3636

3737
/**

tests/FlaggedEnumTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function test_shortcut_values_are_comparable_to_explicit_set()
161161
$powers = new SuperPowers([SuperPowers::Strength, SuperPowers::LaserVision, SuperPowers::Flight]);
162162
$this->assertTrue($powers->hasFlag(SuperPowers::Superman));
163163

164-
$powers->removeFlag([SuperPowers::LaserVision]);
164+
$powers->removeFlag(SuperPowers::LaserVision);
165165
$this->assertFalse($powers->hasFlag(SuperPowers::Superman));
166166
}
167167

0 commit comments

Comments
 (0)