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

PHP Warning when configuring referencedMethod #8759

Closed
Chi-teck opened this issue Nov 25, 2022 · 2 comments · Fixed by #8766
Closed

PHP Warning when configuring referencedMethod #8759

Chi-teck opened this issue Nov 25, 2022 · 2 comments · Fixed by #8766
Labels
bug easy problems Issues that can be fixed without background knowledge of Psalm good first issue Help wanted

Comments

@Chi-teck
Copy link
Contributor

Problem

I have the following in my psalm.xml file.

<issueHandlers>
    <UndefinedInterfaceMethod>
        <errorLevel type="suppress">
            <referencedMethod name="ask"/>
        </errorLevel>
    </UndefinedInterfaceMethod>
</issueHandlers>

When running psalm the following error shows up.

PHP Warning: preg_match(): Delimiter must not be alphanumeric or backslash in /var/www/project/vendor/vimeo/psalm/src/Psalm/Config/FileFilter.php on line 440

After checking the corresponding code I think the idea was to suppress the warnings while validating the regexp. However, it doesn't work because the temporary error handler returns false which causes the default error handler to continue.

Proposed solution

Return true from the error handler or use @ to suppress any errors from preg_match().

@psalm-github-bot
Copy link

Hey @Chi-teck, can you reproduce the issue on https://psalm.dev ?

@weirdan
Copy link
Collaborator

weirdan commented Nov 25, 2022

Return true from the error handler

Yeah, I believe this was the idea. Feel free to PR.

@weirdan weirdan added easy problems Issues that can be fixed without background knowledge of Psalm Help wanted good first issue bug labels Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug easy problems Issues that can be fixed without background knowledge of Psalm good first issue Help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants