Skip to content

Commit

Permalink
[#16] Update PhpStan to version 1 and level 9
Browse files Browse the repository at this point in the history
  • Loading branch information
kpicaza committed Nov 3, 2021
1 parent fe3ac01 commit bba6cb0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions composer.json
Expand Up @@ -22,9 +22,9 @@
},
"require-dev": {
"icanhazstring/composer-unused": "^0.7.5",
"infection/infection": "^0.23.0",
"infection/infection": "^0.25",
"phpro/grumphp": "^1.0",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan": "^1.0",
"phpunit/phpunit": "^8.0 || ^9.0",
"roave/infection-static-analysis-plugin": "^1.8",
"squizlabs/php_codesniffer": "^3.4",
Expand Down Expand Up @@ -52,7 +52,7 @@
],
"cs-check": "phpcs src --colors",
"cs-fix": "phpcbf src --colors",
"inspect": "phpstan analyse src -l7 --ansi",
"inspect": "phpstan analyse src -l9 --ansi",
"test": "phpunit --colors=always",
"psalm": "psalm",
"infection": "XDEBUG_MODE=coverage roave-infection-static-analysis-plugin"
Expand Down
13 changes: 8 additions & 5 deletions src/Command/SetStrategy.php
Expand Up @@ -25,22 +25,25 @@ final class SetStrategy
* @param string $featureId
* @param string $strategyId
* @param string $strategyType
* @param array<array<string, mixed>> $segments
* @param array<array<string, string|array<string, mixed>>> $segments
*/
private function __construct(string $featureId, string $strategyId, string $strategyType, array $segments)
{
$this->featureId = FeatureId::fromString($featureId);
$this->strategyId = StrategyId::fromString($strategyId);
$this->strategyType = StrategyType::fromString($strategyType);
$this->segments = array_map(
/** @param array<string, mixed> $segment */
static function (array $segment) {
/** @var array<string, mixed> $criteria */
$criteria = $segment['criteria'];
/** @var string $segmentId */
$segmentId = $segment['segment_id'];
/** @var string $segmentType */
$segmentType = $segment['segment_type'];

return new Segment(
SegmentId::fromString((string)$segment['segment_id']),
SegmentType::fromString((string)$segment['segment_type']),
SegmentId::fromString($segmentId),
SegmentType::fromString($segmentType),
Payload::fromArray($criteria)
);
},
Expand All @@ -52,7 +55,7 @@ static function (array $segment) {
* @param string $featureId
* @param string $strategyId
* @param string $strategyType
* @param array<array<string, mixed>> $segments
* @param array<array<string, string|array<string, mixed>>> $segments
* @return static
*/
public static function withIdTypeAndSegments(
Expand Down

0 comments on commit bba6cb0

Please sign in to comment.