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

Custom "define" function triggers a warning about declaring new symbols #1769

Closed
Rudloff opened this issue Dec 5, 2017 · 1 comment
Closed
Milestone

Comments

@Rudloff
Copy link

Rudloff commented Dec 5, 2017

Hello,

I have a function called define():

<?php
Foo::define();

When I use phpcs --standard=PSR2, I get this warning:

---------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------------
 1 | WARNING | A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should
   |         | execute logic with side effects, but should not do both. The first symbol is defined on line 2 and the first side
   |         | effect is on line 2.
---------------------------------------------------------------------------------------------------------------------------------------

I suppose PHPCS mistakes my function for the define function included in PHP?

@gsherwood gsherwood added this to the 3.2.0 milestone Dec 8, 2017
gsherwood added a commit that referenced this issue Dec 8, 2017
@gsherwood
Copy link
Member

The sniff wasn't supporting statically called define methods, but is now. Thanks for reporting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants