for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* PHPCompatibility_Sniffs_PHP_DefaultTimeZoneRequiredSniff.
*
* PHP version 5.4
* @category PHP
* @package PHPCompatibility
* @author Wim Godden <[email protected]>
* @copyright 2012 Cu.be Solutions bvba
*/
* Discourages the use of deprecated INI directives through ini_set() or ini_get().
class PHPCompatibility_Sniffs_PHP_DefaultTimezoneRequiredSniff extends PHPCompatibility_Sniff
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
* Returns an array of tokens this test wants to listen for.
* Maybe not ideal to do this on each open tag. But I don't feel like digging further into PHP_CodeSniffer right now
* @return array
public function register()
return array(T_OPEN_TAG);
}//end register()
* Processes this test, when one of its tokens is encountered.
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token in the
* stack passed in $tokens.
* @return void
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
if ($this->supportsAbove('5.4')) {
$ini_value = ini_get('date.timezone');
if (is_string($ini_value) === false || $ini_value === '') {
$phpcsFile->addError(
'Default timezone is required since PHP 5.4',
$stackPtr,
'Missing'
);
}
}//end process()
}//end class
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.