Skip to content

Commit

Permalink
Update psalm, improve it config (#32)
Browse files Browse the repository at this point in the history
* Update vimeo/psalm requirement from ^4.18 to ^5.14

Updates the requirements on [vimeo/psalm](https://github.com/vimeo/psalm) to permit the latest version.
- [Release notes](https://github.com/vimeo/psalm/releases)
- [Commits](vimeo/psalm@4.18...5.14.0)

---
updated-dependencies:
- dependency-name: vimeo/psalm
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update composer.json

* improve psalm config

* Fix 1

* Fix 2

* fix

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sergei Predvoditelev <[email protected]>
Co-authored-by: Sergei Predvoditelev <[email protected]>
  • Loading branch information
3 people authored Aug 6, 2023
1 parent 56a1888 commit 2cc323c
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"phpunit/phpunit": "^9.5",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.18"
"vimeo/psalm": "^4.30|^5.14"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 6 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?xml version="1.0"?>
<psalm
errorLevel="2"
findUnusedBaselineEntry="true"
findUnusedCode="false"
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"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<issueHandlers>
<MixedAssignment errorLevel="suppress" />
<PropertyNotSetInConstructor>
<errorLevel type="suppress">
<file name="src/Filter/*.php" />
Expand Down
Empty file removed src/.gitkeep
Empty file.
20 changes: 19 additions & 1 deletion src/AbstractQueryDataReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ protected function applyHaving(QueryInterface $query): QueryInterface

/**
* @psalm-mutation-free
* @psalm-return static<TKey, TValue>
*/
public function withOffset(int $offset): static
{
Expand All @@ -203,6 +204,7 @@ public function withOffset(int $offset): static

/**
* @psalm-mutation-free
* @psalm-return static<TKey, TValue>
*/
public function withLimit(int $limit): static
{
Expand All @@ -217,6 +219,10 @@ public function withLimit(int $limit): static
return $new;
}

/**
* @psalm-mutation-free
* @psalm-return static<TKey, TValue>
*/
public function withCountParam(?string $countParam): static
{
if ($this->countParam === $countParam) {
Expand All @@ -232,6 +238,7 @@ public function withCountParam(?string $countParam): static

/**
* @psalm-mutation-free
* @psalm-return static<TKey, TValue>
*/
public function withSort(?Sort $sort): static
{
Expand All @@ -244,6 +251,7 @@ public function withSort(?Sort $sort): static

/**
* @psalm-mutation-free
* @psalm-return static<TKey, TValue>
*/
public function withFilter(FilterInterface $filter): static
{
Expand All @@ -254,6 +262,10 @@ public function withFilter(FilterInterface $filter): static
return $new;
}

/**
* @psalm-mutation-free
* @psalm-return static<TKey, TValue>
*/
public function withHaving(?FilterInterface $having): static
{
$new = clone $this;
Expand All @@ -263,6 +275,10 @@ public function withHaving(?FilterInterface $having): static
return $new;
}

/**
* @psalm-mutation-free
* @psalm-return static<TKey, TValue>
*/
public function withBatchSize(?int $batchSize): static
{
if ($batchSize !== null && $batchSize < 1) {
Expand All @@ -278,7 +294,9 @@ public function withBatchSize(?int $batchSize): static
/**
* @param FilterHandlerInterface ...$filterHandlers
* @return $this
* @psalm-suppress ArgumentTypeCoercion
*
* @psalm-suppress ArgumentTypeCoercion *
* @psalm-return static<TKey, TValue>
*/
public function withFilterHandlers(FilterHandlerInterface ...$filterHandlers): static
{
Expand Down
7 changes: 6 additions & 1 deletion src/QueryDataReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
namespace Yiisoft\Data\Db;

/**
* Base class for QueryDataReaderInterface
* Base class for `QueryDataReaderInterface`
*
* @template TKey as array-key
* @template TValue as array|object
*
* @extends AbstractQueryDataReader<TKey, TValue>
*/
final class QueryDataReader extends AbstractQueryDataReader
{
Expand Down

0 comments on commit 2cc323c

Please sign in to comment.