Skip to content

Commit

Permalink
Merge branch '1.x' into 250-improvement-default-asset-metadata-should…
Browse files Browse the repository at this point in the history
…-be-in-the-index
  • Loading branch information
lukmzig committed Nov 25, 2024
2 parents f2a2ad9 + 6ff7c7e commit db7e52f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/php-cs-fixer.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "PHP-CS-Fixer"

on:
pull_request:
pull_request_target:
branches:
- "[0-9]+.[0-9]+"
- "[0-9]+.x"
Expand All @@ -24,7 +24,8 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga:latest
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches:
- 1.x
pull_request:
pull_request_target:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
Expand All @@ -13,6 +13,8 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
Expand Down
16 changes: 8 additions & 8 deletions src/QueryLanguage/Pql/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private function expectRightParenthesis(): void
if (!$token || !$token->isA(QueryTokenType::T_RPAREN)) {
$this->throwParsingException(
'token type `' . QueryTokenType::T_RPAREN->value . '`',
'`' . ($token['type']->value ?? 'null') . '`'
'`' . ($token->type ?? 'null') . '`'
);
}
$this->advance();
Expand Down Expand Up @@ -175,7 +175,7 @@ private function parseComparison(array &$subQueries): array|ParseResultSubQuery
$this->validateCurrentTokenNotEmpty();

if (!$this->currentToken() || !$this->currentToken()->isA(...self::FIELD_NAME_TOKENS)) {
$tokenValue = $this->currentToken()['value'] ?? 'null';
$tokenValue = $this->currentToken()->value ?? 'null';
$message = null;
if (in_arrayi($tokenValue, ['and', 'or', 'like', 'not like', 'null', 'empty'])) {
$message = sprintf('Expected %s, found %s.', 'a field name', '`' . $tokenValue . '`')
Expand All @@ -186,15 +186,15 @@ private function parseComparison(array &$subQueries): array|ParseResultSubQuery

/** @var Token $fieldToken */
$fieldToken = $this->currentToken();
$fieldType = $fieldToken['type'];
$field = $fieldToken['value'];
$fieldType = $fieldToken->type;
$field = $fieldToken->value;
$this->advance(); // Move to operator
$this->validateCurrentTokenNotEmpty();

$operatorToken = $this->currentToken();

if ($operatorToken === null || !$operatorToken->isA(...self::OPERATOR_TOKENS)) {
$this->throwParsingException('a comparison operator', '`' . ($operatorToken['value'] ?? 'null') . '`');
$this->throwParsingException('a comparison operator', '`' . $operatorToken->value . '`');
}

$this->advance(); // Move to value
Expand All @@ -205,7 +205,7 @@ private function parseComparison(array &$subQueries): array|ParseResultSubQuery
if (!$valueToken || !$valueToken->isA(...self::VALUE_TOKENS)) {
$this->throwParsingException(
'a string, numeric value or a empty/null keyword',
'`' . ($valueToken['value'] ?? 'null') . '`'
'`' . $valueToken->value . '`'
);
}

Expand All @@ -214,7 +214,7 @@ private function parseComparison(array &$subQueries): array|ParseResultSubQuery
) {
$this->throwParsingException(
'a valid value',
'`' . ($valueToken['value'] ?? 'null') . '`',
'`' . $valueToken->value . '`',
'Operator `' . $operatorToken->value . '` does not support null/empty values'
);
}
Expand Down Expand Up @@ -345,7 +345,7 @@ public function parse(): ParseResult
$query = $this->parseCondition($subQueries);

if ($token = $this->currentToken()) {
$this->throwParsingException('end of input', '`' . ($token['value'] ?? 'null') . '`');
$this->throwParsingException('end of input', '`' . $token->value . '`');
}

return new ParseResult($query, $subQueries);
Expand Down

0 comments on commit db7e52f

Please sign in to comment.