Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSALM issues. (Doc blocks use Expression instead of PredicateInterface) #221

Open
zagovorichev opened this issue Sep 24, 2021 · 1 comment
Labels
Bug Something isn't working

Comments

@zagovorichev
Copy link

Bug Report

Doc blocks use Expression instead of PredicateInterface

Q A
Version(s) from 2.11 (and earlier I guess)

Summary

I can pass Literal to Predicate:

$select->where
                ->equalTo(
                    'something.Status',
                    new Literal(':status'),
                    Where::TYPE_IDENTIFIER,
                    Where::TYPE_VALUE
                );

but method expects Expression only, so psalm told me that I'm using the wrong class (probably @param int|float|bool|string|Expression $right should be changed to using of interface? PredicateInterface)

/**
     * Create "Equal To" predicate
     *
     * Utilizes Operator predicate
     *
     * @param  int|float|bool|string|Expression $left
     * @param  int|float|bool|string|Expression $right
     * @param  string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes}
     * @param  string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes}
     * @return self Provides a fluent interface
     */
    public function equalTo($left, $right, $leftType = self::TYPE_IDENTIFIER, $rightType = self::TYPE_VALUE)
    {
        $this->addPredicate(
            new Operator($left, Operator::OPERATOR_EQUAL_TO, $right, $leftType, $rightType),
            $this->nextPredicateCombineOperator ?: $this->defaultCombination
        );
        $this->nextPredicateCombineOperator = null;

        return $this;
    }

Current behavior

PSALM shows an error

How to reproduce

Run Psalm

Expected behavior

Psalm doesn't show any errors

@zagovorichev zagovorichev added the Bug Something isn't working label Sep 24, 2021
@tptrixtop
Copy link
Contributor

I am just curious does it work when you pass literal?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants