Skip to content

Commit ca4e2a7

Browse files
github-actions[bot]claude
authored andcommitted
(fix): CI — define Query::LOGICAL_TYPES/TYPE_ELEM_MATCH, drop Database::VAR_STRING in MirrorTest
Two undefined-constant errors from the main-branch merge surfaced in run 24884705670: 1) Query::shape() referenced self::LOGICAL_TYPES with no declaration, causing testShape/testFingerprint/testFingerprintNestedLogicalQueries to error. Added the constant plus TYPE_ELEM_MATCH (which the test uses to construct elemMatch queries), and stringified $method via ->value since Method is a backed enum and cannot concat directly. 2) MirrorTest::testCreateDocumentsSkipDuplicatesBackfillsDestination used the removed Database::VAR_STRING constant. Replaced with the current Attribute(key:, type: ColumnType::String, ...) form that the rest of the file already uses. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 997093a commit ca4e2a7

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

src/Database/Query.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ class Query extends BaseQuery
2424
*/
2525
public const DEFAULT_ALIAS = 'table_main';
2626

27+
/**
28+
* Methods that compose child queries and contribute their inner
29+
* structure to a shape/fingerprint.
30+
*
31+
* @var array<Method>
32+
*/
33+
private const LOGICAL_TYPES = [Method::And, Method::Or, Method::ElemMatch];
34+
35+
public const TYPE_ELEM_MATCH = 'elemMatch';
36+
2737
/**
2838
* @param array<mixed> $values
2939
*/
@@ -174,7 +184,7 @@ public function shape(): string
174184
$id = \spl_object_id($node);
175185

176186
if (!\in_array($node->method, self::LOGICAL_TYPES, true)) {
177-
$shapes[$id] = $node->method . ':' . $node->attribute;
187+
$shapes[$id] = $node->method->value . ':' . $node->attribute;
178188
continue;
179189
}
180190

@@ -186,7 +196,7 @@ public function shape(): string
186196
}
187197
\sort($childShapes);
188198
// Attribute is empty for and/or; meaningful for elemMatch (the field being matched).
189-
$shapes[$id] = $node->method . ':' . $node->attribute . '(' . \implode('|', $childShapes) . ')';
199+
$shapes[$id] = $node->method->value . ':' . $node->attribute . '(' . \implode('|', $childShapes) . ')';
190200
}
191201

192202
return $shapes[\spl_object_id($this)];

tests/e2e/Adapter/MirrorTest.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,7 @@ public function testCreateDocumentsSkipDuplicatesBackfillsDestination(): void
325325
$collection = 'mirrorSkipDup';
326326

327327
$database->createCollection($collection, attributes: [
328-
new Document([
329-
'$id' => 'name',
330-
'type' => Database::VAR_STRING,
331-
'required' => true,
332-
'size' => Database::LENGTH_KEY,
333-
]),
328+
new Attribute(key: 'name', type: ColumnType::String, size: Database::LENGTH_KEY, required: true),
334329
], permissions: [
335330
Permission::create(Role::any()),
336331
Permission::read(Role::any()),

0 commit comments

Comments
 (0)