Skip to content

Commit

Permalink
Bump psalm to v4.9.2
Browse files Browse the repository at this point in the history
- Lock to v4.9 otherwise it bumps automatically, finds new issues and builds start failing without any change in this lib
- fix some psalm issues
- enable `findUnusedPsalmSuppress`
  • Loading branch information
simPod committed Aug 24, 2021
1 parent 8bb24a0 commit b0bd8e2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
"require-dev": {
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "1.*",
"vimeo/psalm": "^4.6.2"
"vimeo/psalm": "~4.9.0"
}
}
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<psalm
totallyTyped="true"
resolveFromConfigFile="true"
findUnusedPsalmSuppress="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down
6 changes: 3 additions & 3 deletions src/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public function __construct($value)
/** @psalm-suppress ImplicitToStringCast assertValidValueReturningKey returns always a string but psalm has currently an issue here */
$this->key = static::assertValidValueReturningKey($value);

/** @psalm-var T */
$this->value = $value;
}

Expand Down Expand Up @@ -126,7 +125,6 @@ public function getKey()

/**
* @psalm-pure
* @psalm-suppress InvalidCast
* @return string
*/
public function __toString()
Expand Down Expand Up @@ -176,6 +174,7 @@ public static function values()

/** @psalm-var T $value */
foreach (static::toArray() as $key => $value) {
/** @psalm-suppress UnsafeGenericInstantiation */
$values[$key] = new static($value);
}

Expand All @@ -186,7 +185,6 @@ public static function values()
* Returns all possible values as an array
*
* @psalm-pure
* @psalm-suppress ImpureStaticProperty
*
* @psalm-return array<string, mixed>
* @return array Constant name in key, constant value in value
Expand Down Expand Up @@ -297,6 +295,7 @@ public static function __callStatic($name, $arguments)
$message = "No static method or enum constant '$name' in class " . static::class;
throw new \BadMethodCallException($message);
}
/** @psalm-suppress UnsafeGenericInstantiation */
return self::$instances[$class][$name] = new static($array[$name]);
}
return clone self::$instances[$class][$name];
Expand All @@ -309,6 +308,7 @@ public static function __callStatic($name, $arguments)
* @return mixed
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
* @psalm-pure
* @psalm-suppress UndefinedAttributeClass ReturnTypeWillChange is not available on <PHP8
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
Expand Down

0 comments on commit b0bd8e2

Please sign in to comment.