ofbeaton / granite-php

Opinionated coding style enforcement for PHP.
https://github.com/ofbeaton/granite/wiki/PHP
MIT License
1 stars 0 forks source link

disallowed functions error_log, var_dump #12

Closed ofbeaton closed 9 years ago

ofbeaton commented 9 years ago

A version of Squiz.PHP.DiscouragedFunctions that only disallows error_log and var_dump. We may be able to do this with properties. Have to look into it.

error_log should be considered heavily. Writting logs to the php error log is sort of like writing to the main linux log. It can be extremely useful when writing libraries and not having access to the application log. Writting to STDERR is not always the right move. Should we really disallow it?

ofbeaton commented 9 years ago

https://github.com/squizlabs/PHP_CodeSniffer/issues/655 asked for a clarification/improvement upstream.

ofbeaton commented 9 years ago

Greg told us we can do <property name="variable" type="array" value="key1=>val1,key2=>val2"/>, and it worked.

We used Squiz.PHP.DiscouragedFunctions to do it.

At this time we will allow error_log as it has legitimate uses, but maybe we want to set up something for code reviews, as really we should be using a logging class that then uses error_log.