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

ForbiddenFunctions: Add more basic blackisted aliases #23

Closed
wants to merge 1 commit into from

Conversation

Majkl578
Copy link
Contributor

@Majkl578 Majkl578 commented Feb 5, 2018

Based on http://php.net/manual/en/aliases.php#aliases (thanks @carusogabriel for the link + squizlabs/PHP_CodeSniffer#1838)

Currently contains only Base syntax aliases.

Not auto-fixable. :/

is_null => null,
is_real => is_float,
is_writeable => is_writable,
join => implode,
Copy link
Member

Choose a reason for hiding this comment

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

No clue why but I was always using join :D

Copy link
Member

Choose a reason for hiding this comment

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

This will help you cure it :P

is_double => is_float,
is_integer => is_int,
is_long => is_int,
is_null => null,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this right?

Copy link
Member

@alcaeus alcaeus Feb 5, 2018

Choose a reason for hiding this comment

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

I suppose it just forbids using is_null without suggesting an alternative function since you should be using === null.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, if null is provided, then the function is forbidden without alias being suggested, i.e.:

 11 | ERROR | The use of function chop() is forbidden; use rtrim() instead
 12 | ERROR | The use of function sizeof() is forbidden; use count() instead
 13 | ERROR | The use of function is_null() is forbidden

@Majkl578 Majkl578 force-pushed the sniff/ForbiddenFunctions branch 2 times, most recently from c5f8e7c to 71dbcdc Compare February 5, 2018 16:42
@Majkl578 Majkl578 added this to the 3.0.0 milestone Feb 5, 2018
@Ocramius Ocramius self-assigned this Feb 6, 2018
@Ocramius Ocramius closed this in f70481d Feb 6, 2018
@Ocramius
Copy link
Member

Ocramius commented Feb 6, 2018

Manually merged in f70481d - thanks @Majkl578!

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

Successfully merging this pull request may close these issues.

None yet

5 participants