Skip to content
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
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
Loading