From c054ebb9e5fe3a8a0872238f6c507886c971b67f Mon Sep 17 00:00:00 2001 From: Fred Dysart Date: Sat, 8 Aug 2020 11:41:00 -0600 Subject: [PATCH 1/2] Fix an invalid array access and enable CI for PHP 7.4 --- .travis.yml | 1 + src/ConditionAnalyzer/Analyzer.php | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f52f76f..0dcec37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ stages: php: - '7.2' - '7.3' + - '7.4' before_script: - java -Djava.library.path=./DynamoDBLocal_lib -jar dynamodb_local/DynamoDBLocal.jar --port 3000 & diff --git a/src/ConditionAnalyzer/Analyzer.php b/src/ConditionAnalyzer/Analyzer.php index 5ecba99..80213a4 100644 --- a/src/ConditionAnalyzer/Analyzer.php +++ b/src/ConditionAnalyzer/Analyzer.php @@ -204,10 +204,13 @@ private function hasValidQueryOperator($hash, $range = null) $validQueryOp = ComparisonOperator::isValidQueryDynamoDbOperator($hashCondition['type'] ?? null); if ($validQueryOp && $range) { - $rangeCondition = $this->getCondition($range); + $rangeConditionType = $this->getCondition($range)['type'] ?? null; + if ($rangeConditionType === null) { + return false; + } $validQueryOp = ComparisonOperator::isValidQueryDynamoDbOperator( - $rangeCondition['type'], + $rangeConditionType, true ); } From b9217ae14fd5b2363dae97dacbfe155ab573bdbf Mon Sep 17 00:00:00 2001 From: Fred Dysart Date: Sat, 8 Aug 2020 11:56:13 -0600 Subject: [PATCH 2/2] Be consistent with how the type is accessed --- src/ConditionAnalyzer/Analyzer.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/ConditionAnalyzer/Analyzer.php b/src/ConditionAnalyzer/Analyzer.php index 80213a4..1d023e5 100644 --- a/src/ConditionAnalyzer/Analyzer.php +++ b/src/ConditionAnalyzer/Analyzer.php @@ -199,16 +199,11 @@ private function getIndex() private function hasValidQueryOperator($hash, $range = null) { - $hashCondition = $this->getCondition($hash); - - $validQueryOp = ComparisonOperator::isValidQueryDynamoDbOperator($hashCondition['type'] ?? null); + $hashConditionType = $this->getCondition($hash)['type'] ?? null; + $validQueryOp = ComparisonOperator::isValidQueryDynamoDbOperator($hashConditionType); if ($validQueryOp && $range) { $rangeConditionType = $this->getCondition($range)['type'] ?? null; - if ($rangeConditionType === null) { - return false; - } - $validQueryOp = ComparisonOperator::isValidQueryDynamoDbOperator( $rangeConditionType, true