Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update psalm, improve it config #32

Merged
merged 6 commits into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading