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

Add test for ValidConstantFunctionRule #282

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
{{ constant('ThisDoesNotExist::SomeKey') }}
{{ constant(someVar) }}
{{ constant('ThisDoesNotExist::class') }}
{{ constant(1) }}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruudk you wrote in your initial PR bffffcb

        $constant = $argument->getAttribute('value');
        if (!\is_string($constant)) {
            return $node;
        }

Is there valid case when the value is not a string or should we display an error for this case ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this because the return type was mixed according to psalm or PHPStan. Shouldn't be the case I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So maybe beter to report an error in that case.

{{ notConstant('ThisDoesNotExist::class') }}
{% endblock %}
Loading