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

implements conditionExpression instead of expression #31

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions src/Language/CaseGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace Tpetry\QueryExpressions\Language;

use Illuminate\Contracts\Database\Query\Expression;
use Illuminate\Contracts\Database\Query\ConditionExpression;
use Illuminate\Database\Grammar;
use Tpetry\QueryExpressions\Concerns\IdentifiesDriver;
use Tpetry\QueryExpressions\Concerns\StringizeExpression;

class CaseGroup implements Expression
class CaseGroup implements ConditionExpression
{
use IdentifiesDriver;
use StringizeExpression;
Expand All @@ -19,7 +19,7 @@
*/
public function __construct(
private readonly array $when,
private readonly string|Expression|null $else = null,

Check failure on line 22 in src/Language/CaseGroup.php

View workflow job for this annotation

GitHub Actions / phpstan

Parameter $else of method Tpetry\QueryExpressions\Language\CaseGroup::__construct() has invalid type Tpetry\QueryExpressions\Language\Expression.

Check failure on line 22 in src/Language/CaseGroup.php

View workflow job for this annotation

GitHub Actions / phpstan

Property Tpetry\QueryExpressions\Language\CaseGroup::$else has unknown class Tpetry\QueryExpressions\Language\Expression as its type.
) {}

public function getValue(Grammar $grammar): string
Expand All @@ -32,7 +32,7 @@

return match ($this->else) {
null => "(case {$conditions} end)",
default => "(case {$conditions} else {$this->stringize($grammar, $this->else)} end)",

Check failure on line 35 in src/Language/CaseGroup.php

View workflow job for this annotation

GitHub Actions / phpstan

Parameter #2 $expression of method Tpetry\QueryExpressions\Language\CaseGroup::stringize() expects Illuminate\Contracts\Database\Query\Expression|string, string|Tpetry\QueryExpressions\Language\Expression given.
};
}
}
Loading