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

@param 'AND'|'OR' interpreted as 'AND'|'OR'|string, but 'AND'|'OR' when in @method definition. #4836

Open
mdeweerd opened this issue Feb 5, 2024 · 0 comments

Comments

@mdeweerd
Copy link

mdeweerd commented Feb 5, 2024

@param 'AND'|'OR' $operator is converted to 'AND'|'OR'|string by phan when comparing to method PHPdoc definition which also says `@param 'AND'|'OR' but is not converted.

PhanParamSignaturePHPDocMismatchParamType Declaration of real/@method function is_active(mixed|string $value = 1, bool $partialMatch = false, 'AND'|'OR' $operator = 'AND', bool $escape = true) should be compatible with real/@method function is_active($value = '>=1', $partialMatch = false, $operator = 'AND', $escape = true) (parameter #3 of type ''AND'|'OR'' cannot replace original parameter of type ''AND'|'OR'|string') defined in tests\testconststroverride.txt:15
class TestBase {
    /**
     * @param mixed      $value
     * @param bool       $partialMatch
     * @param 'AND'|'OR' $operator
     * @param bool       $escape
     *
     * @return   static
     * @suppress PhanParamSignaturePHPDocMismatchHasNoParamType
     */
    public function is_active($value = ">=1", $partialMatch = false, $operator = 'AND', $escape = true)
    {
        return $this;
    }
}


/**
 * @method TestChild is_active(mixed|string $value=1, boolean $partialMatch=false, 'AND'|'OR' $operator='AND', boolean $escape=true)
 */
class TestChild extends TestBase {
}

I'ld prefer to compare and test to 'AND'|'OR'

Phan 5.4.2
php-ast version 1.0.16
PHP version used to run Phan: 8.1.13
@mdeweerd mdeweerd changed the title @param 'AND'|'OR' interpreted as 'AND'|'OR'|string, but 'AND'|'OR' when in @method definition. @param 'AND'|'OR' interpreted as 'AND'|'OR'|string, but 'AND'|'OR' when in @method definition. Feb 5, 2024
@mdeweerd mdeweerd changed the title @param 'AND'|'OR' interpreted as 'AND'|'OR'|string, but 'AND'|'OR' when in @method definition. @param 'AND'|'OR' interpreted as 'AND'|'OR'|string, but 'AND'|'OR' when in @method definition. Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant