You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running PHPCS on an existing codebase, the following error occurred:
An error occurred during processing; checking has been aborted. The error message was: Uninitialized string offset: 0 in /usr/share/pear/PHP/CodeSniffer/src/Standards/PEAR/Sniffs/NamingConventions/ValidFunctionNameSniff.php on line 239 (Internal.Exception)
This occurred on the following function name: send_system_email__to_user
After removing the double underscore, the error goes away.
Example code
<?php
function send_system_email__to_user($body, $recipient){
echo 'test';
}
I am using version 3.2.3 of PHP_CodeSniffer and PHP v 5.6.36
The text was updated successfully, but these errors were encountered:
gsherwood
changed the title
PHP Error when function name includes double underscore in the middle of the name
PEAR.NamingConventions.ValidFunctionName error when function name includes double underscore
Jun 1, 2018
This was fixed by PR #2028. You now get the following error messages for the sample code:
Function name "send_system_email__to_user" is prefixed with a package name but does not begin with a capital letter
Function name "send_system_email__to_user" is invalid; consider "Send_System_Email_To_user" instead
The PEAR standard only allows underscores for namespacing, which is why it assumes each word is a directory and needs to begin with a capital. If you don't want to use camelCase for function names, you should disable this specific sniff.
When running PHPCS on an existing codebase, the following error occurred:
An error occurred during processing; checking has been aborted. The error message was: Uninitialized string offset: 0 in /usr/share/pear/PHP/CodeSniffer/src/Standards/PEAR/Sniffs/NamingConventions/ValidFunctionNameSniff.php on line 239 (Internal.Exception)
This occurred on the following function name: send_system_email__to_user
After removing the double underscore, the error goes away.
Example code
I am using version 3.2.3 of PHP_CodeSniffer and PHP v 5.6.36
The text was updated successfully, but these errors were encountered: