Skip to content

Commit

Permalink
Upgrade Psalm up to v5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
msmakouz committed Apr 10, 2023
1 parent 084c8ca commit 48ecae0
Show file tree
Hide file tree
Showing 145 changed files with 293 additions and 108 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -139,7 +139,7 @@
"spiral/testing": "^2.2",
"spiral/validator": "^1.2",
"symplify/monorepo-builder": "^10.2.7",
"vimeo/psalm": "^4.27"
"vimeo/psalm": "^5.9"
},
"autoload-dev": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion monorepo-builder.php
Expand Up @@ -102,7 +102,7 @@
'mockery/mockery' => '^1.5',
'spiral/code-style' => '^1.1',
'symplify/monorepo-builder' => '^10.2.7',
'vimeo/psalm' => '^4.27',
'vimeo/psalm' => '^5.9',
],
]);

Expand Down
2 changes: 2 additions & 0 deletions psalm.xml
Expand Up @@ -11,6 +11,8 @@
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src/*/src" />
Expand Down
2 changes: 1 addition & 1 deletion src/AnnotatedRoutes/composer.json
Expand Up @@ -41,7 +41,7 @@
"phpunit/phpunit": "^9.5.20",
"spiral/framework": "^3.1",
"spiral/nyholm-bridge": "^1.2",
"vimeo/psalm": "^4.27"
"vimeo/psalm": "^5.9"
},
"autoload-dev": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/AnnotatedRoutes/psalm.xml
Expand Up @@ -11,6 +11,8 @@
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
2 changes: 1 addition & 1 deletion src/Auth/composer.json
Expand Up @@ -32,7 +32,7 @@
},
"require-dev": {
"phpunit/phpunit": "^9.5.20",
"vimeo/psalm": "^4.27"
"vimeo/psalm": "^5.9"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/Auth/psalm.xml
Expand Up @@ -11,6 +11,8 @@
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
2 changes: 1 addition & 1 deletion src/AuthHttp/composer.json
Expand Up @@ -39,7 +39,7 @@
"spiral/http": "^3.7",
"spiral/debug": "^3.7",
"nyholm/psr7": "^1.5",
"vimeo/psalm": "^4.27"
"vimeo/psalm": "^5.9"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/AuthHttp/psalm.xml
Expand Up @@ -11,6 +11,8 @@
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
3 changes: 3 additions & 0 deletions src/AuthHttp/src/Transport/CookieTransport.php
Expand Up @@ -79,6 +79,9 @@ public function removeToken(Request $request, Response $response, string $tokenI
return $this->commitToken($request, $response, null, null);
}

/**
* @return int<0, max>|null
*/
private function getLifetime(\DateTimeInterface $expiresAt = null): ?int
{
if ($expiresAt === null) {
Expand Down
2 changes: 1 addition & 1 deletion src/Boot/composer.json
Expand Up @@ -39,7 +39,7 @@
"require-dev": {
"phpunit/phpunit": "^9.5.20",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^4.27"
"vimeo/psalm": "^5.9"
},
"autoload": {
"files": [
Expand Down
2 changes: 2 additions & 0 deletions src/Boot/psalm.xml
Expand Up @@ -11,6 +11,8 @@
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
1 change: 0 additions & 1 deletion src/Boot/src/BootloadManager/Initializer.php
Expand Up @@ -144,7 +144,6 @@ protected function shouldBeBooted(\ReflectionNamedType $type): bool
/** @var TClass $class */
$class = $type->getName();

/** @psalm-suppress InvalidArgument */
return $this->isBootloader($class)
&& !$this->bootloaders->isBooted($class);
}
Expand Down
1 change: 1 addition & 0 deletions src/Boot/src/Injector/EnumInjector.php
Expand Up @@ -39,6 +39,7 @@ public function createInjection(\ReflectionClass $class, string $context = null)
}

$this->validateClass($class, $attribute);
/** @var ?\Closure $closure */
$closure = $class->getMethod($attribute->method)->getClosure();
\assert($closure !== null);

Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Dotenv/composer.json
Expand Up @@ -34,7 +34,7 @@
"mockery/mockery": "^1.5",
"phpunit/phpunit": "^9.5.20",
"spiral/boot": "^3.7",
"vimeo/psalm": "^4.27"
"vimeo/psalm": "^5.9"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/Bridge/Dotenv/psalm.xml
Expand Up @@ -11,6 +11,8 @@
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Monolog/composer.json
Expand Up @@ -34,7 +34,7 @@
"spiral/boot": "^3.7",
"phpunit/phpunit": "^9.5.20",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^4.27"
"vimeo/psalm": "^5.9"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/Bridge/Monolog/psalm.xml
Expand Up @@ -11,6 +11,8 @@
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Stempler/composer.json
Expand Up @@ -39,7 +39,7 @@
"spiral/boot": "^3.7",
"phpunit/phpunit": "^9.5.20",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^4.27"
"vimeo/psalm": "^5.9"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/Bridge/Stempler/psalm.xml
Expand Up @@ -11,6 +11,8 @@
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
1 change: 0 additions & 1 deletion src/Bridge/Stempler/src/StemplerEngine.php
Expand Up @@ -201,7 +201,6 @@ public function render(array $data=[]): string {
*/
private function className(ViewSource $source, ContextInterface $context): string
{
/** @psalm-suppress LessSpecificReturnStatement */
return $this->classPrefix . $this->cacheKey($source, $context);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Broadcasting/composer.json
Expand Up @@ -45,7 +45,7 @@
"mockery/mockery": "^1.5",
"phpunit/phpunit": "^9.5.20",
"spiral/boot": "^3.7",
"vimeo/psalm": "^4.27"
"vimeo/psalm": "^5.9"
},
"autoload-dev": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/Broadcasting/psalm.xml
Expand Up @@ -11,6 +11,8 @@
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
4 changes: 2 additions & 2 deletions src/Broadcasting/src/BroadcastInterface.php
Expand Up @@ -7,8 +7,8 @@
use Spiral\Broadcasting\Exception\BroadcastException;

/**
* @psalm-type TopicsList = non-empty-list<string> | non-empty-list<\Stringable> | string | Stringable
* @psalm-type MessagesList = non-empty-list<string> | non-empty-list<\Stringable> | string | Stringable
* @psalm-type TopicsList = non-empty-list<string> | non-empty-list<\Stringable> | string | \Stringable
* @psalm-type MessagesList = non-empty-list<string> | non-empty-list<\Stringable> | string | \Stringable
*/
interface BroadcastInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cache/composer.json
Expand Up @@ -43,7 +43,7 @@
"spiral/boot": "^3.7",
"mockery/mockery": "^1.5",
"phpunit/phpunit": "^9.5.20",
"vimeo/psalm": "^4.27"
"vimeo/psalm": "^5.9"
},
"autoload-dev": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/Cache/psalm.xml
Expand Up @@ -11,6 +11,8 @@
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
1 change: 1 addition & 0 deletions src/Cache/src/Bootloader/CacheBootloader.php
Expand Up @@ -43,6 +43,7 @@ public function init(BinderInterface $binder, EnvironmentInterface $env, Directo
{
$this->initConfig($env, $dirs);

/** @psalm-suppress InvalidCast https://github.com/vimeo/psalm/issues/8810 */
$binder->bindInjector(CacheInterface::class, CacheInjector::class);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Config/composer.json
Expand Up @@ -34,7 +34,7 @@
"require-dev": {
"phpunit/phpunit": "^9.5.20",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^4.27"
"vimeo/psalm": "^5.9"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/Config/psalm.xml
Expand Up @@ -11,6 +11,8 @@
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
6 changes: 3 additions & 3 deletions src/Config/src/Patch/Prepend.php
Expand Up @@ -26,12 +26,12 @@ public function __construct(
public function patch(array $config): array
{
try {
$target = &$this->dotGet($config, $this->position);
$_target = &$this->dotGet($config, $this->position);

if ($this->key !== null) {
$target = \array_merge([$this->key => $this->value], $target);
$_target = \array_merge([$this->key => $this->value], $_target);
} else {
\array_unshift($target, $this->value);
\array_unshift($_target, $this->value);
}
} catch (DotNotFoundException $e) {
throw new PatchException($e->getMessage(), $e->getCode(), $e);
Expand Down
4 changes: 2 additions & 2 deletions src/Config/src/Patch/Set.php
Expand Up @@ -25,8 +25,8 @@ public function __construct(
public function patch(array $config): array
{
try {
$target = &$this->dotGet($config, $this->key);
$target = $this->value;
$_target = &$this->dotGet($config, $this->key);
$_target = $this->value;
} catch (DotNotFoundException $e) {
throw new PatchException($e->getMessage(), $e->getCode(), $e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Console/composer.json
Expand Up @@ -38,7 +38,7 @@
"spiral/boot": "^3.7",
"phpunit/phpunit": "^9.5.20",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^4.27"
"vimeo/psalm": "^5.9"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/Console/psalm.xml
Expand Up @@ -11,6 +11,8 @@
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
2 changes: 1 addition & 1 deletion src/Console/src/Traits/HelpersTrait.php
Expand Up @@ -19,7 +19,7 @@ trait HelpersTrait
/**
* OutputInterface is the interface implemented by all Output classes. Only exists when command
* are being executed.
* @var OutputInterface|SymfonyStyle|null
* @var SymfonyStyle|null
*/
protected ?OutputInterface $output = null;

Expand Down
2 changes: 1 addition & 1 deletion src/Cookies/composer.json
Expand Up @@ -37,7 +37,7 @@
"mockery/mockery": "^1.5",
"spiral/http": "^3.7",
"nyholm/psr7": "^1.5",
"vimeo/psalm": "^4.27"
"vimeo/psalm": "^5.9"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/Cookies/psalm.xml
Expand Up @@ -11,6 +11,8 @@
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
2 changes: 1 addition & 1 deletion src/Core/composer.json
Expand Up @@ -33,7 +33,7 @@
"require-dev": {
"mockery/mockery": "^1.5",
"phpunit/phpunit": "^9.5.20",
"vimeo/psalm": "^5.6"
"vimeo/psalm": "^5.9"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions src/Core/src/Container.php
Expand Up @@ -32,7 +32,6 @@
*
* @psalm-import-type TResolver from BinderInterface
* @psalm-import-type TInvokable from InvokerInterface
* @psalm-suppress PropertyNotSetInConstructor
*/
final class Container implements
ContainerInterface,
Expand Down Expand Up @@ -64,7 +63,6 @@ public function __construct(
$this->initServices($this, $scopeName);

// Bind himself
/** @psalm-suppress PossiblyNullPropertyAssignment */
$this->state->bindings = \array_merge($this->state->bindings, [
self::class => \WeakReference::create($this),
ContainerInterface::class => self::class,
Expand Down Expand Up @@ -107,6 +105,7 @@ public function validateArguments(ContextFunction $reflection, array $arguments
*/
public function make(string $alias, array $parameters = [], string $context = null): mixed
{
/** @psalm-suppress TooManyArguments */
return $this->factory->make($alias, $parameters, $context);
}

Expand All @@ -132,6 +131,7 @@ public function make(string $alias, array $parameters = [], string $context = nu
*/
public function get(string|Autowire $id, string $context = null): mixed
{
/** @psalm-suppress TooManyArguments */
return $this->container->get($id, $context);
}

Expand Down
1 change: 1 addition & 0 deletions src/Core/src/Internal/Container.php
Expand Up @@ -53,6 +53,7 @@ public function get(string|Autowire $id, string $context = null): mixed
return $id->resolve($this->factory);
}

/** @psalm-suppress TooManyArguments */
return $this->factory->make($id, [], $context);
}

Expand Down

0 comments on commit 48ecae0

Please sign in to comment.