Skip to content

InstanceOfX not taking context into account #321

@cyrnetix

Description

@cyrnetix

I was just trying to apply filtering on a collection with InstanceOfX but it failed while the DQL version works fine. I figured out that the isStatisfiedBy() method does not take context into account in any way but the DQL does.

Would this be a proper fix?

public function isSatisfiedBy($candidate, ?string $context = null): bool
{
	if (null !== $this->context) {
		$candidate = ArgumentToOperandConverter::toField($this->context)
			->execute($candidate, $context);
	}

        return $candidate instanceof $this->value;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions