Skip to content

Commit

Permalink
TASK: Simplify expression
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Apr 6, 2024
1 parent cc25848 commit e282c14
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ public function evaluate(FlowQuery $flowQuery, array $arguments): mixed
FindReferencesFilter::create(referenceName: $propertyName)
)->getNodes();

if (($this->getNodeType($element)->getReferences()[$propertyName]['constraints']['maxItems'] ?? -1) === 1) {
$maxItems = $this->getNodeType($element)->getReferences()[$propertyName]['constraints']['maxItems'] ?? null;
if ($maxItems === 1) {
// legacy layer references with only one item like the previous `type: reference`
// (the node type transforms that to constraints.maxItems = 1)
// users still expect the property operation to return a single node instead of an array.
Expand Down

0 comments on commit e282c14

Please sign in to comment.