<commit_before><?php
/**
 * Fork_Sniffs_PHP_DeprecatedNewReferenceSniff.
 *
 * PHP version 5.3
 *
 * @category  PHP
 * @package   Fork
 * @author    <NAME> <<EMAIL>>
 * @copyright 2010 Cu.be Solutions bvba
 */

/**
 * Fork_Sniffs_PHP_DeprecatedNewReferenceSniff.
 *
 * Discourages the use of assigning the return value of new by reference
 *
 * PHP version 5.3
 *
 * @category  PHP
 * @package   Fork
 * @author    <NAME> <<EMAIL>>
 * @copyright 2010 Cu.be Solutions bvba
 */
class Fork_Sniffs_PHP_DeprecatedNewReferenceSniff implements PHP_CodeSniffer_Sniff
{

    /**
     * If true, an error will be thrown; otherwise a warning.
     *
     * @var bool
     */
    protected $error = true;


    /**
     * Returns an array of tokens this test wants to listen for.
     *
     * @return array
     */
    public function register()
    {
        return array(T_NEW);

    }//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)
    {
        $tokens = $phpcsFile->getTokens();
        if ($tokens[$stackPtr - 1]['type'] == 'T_BITWISE_AND' || $tokens[$stackPtr - 2]['type'] == 'T_BITWISE_AND') {
            $error = 'Assigning the return value of new by reference is deprecated in PHP 5.3';
            $phpcsFile->addError($error, $stackPtr);
        }

    }//end process()


}//end class
<commit_msg>Cleaned up deprecated new reference sniff.<commit_after><?php

/**
 * Discourages the use of assigning the return value of new by reference
 *
 * @author <NAME> <<EMAIL>>
 */
class Fork_Sniffs_PHP_DeprecatedNewReferenceSniff implements PHP_CodeSniffer_Sniff
{
	/**
	 * If true, an error will be thrown; otherwise a warning.
	 *
	 * @var bool
	 */
	protected $error = true;

	/**
	 * Processes this test, when one of its tokens is encountered.
	 *
	 * @param PHP_CodeSniffer_File $phpcsFile
	 * @param int $stackPtr
	 */
	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
	{
		$tokens = $phpcsFile->getTokens();
		if($tokens[$stackPtr - 1]['type'] == 'T_BITWISE_AND' || $tokens[$stackPtr - 2]['type'] == 'T_BITWISE_AND')
		{
			$error = 'Assigning the return value of new by reference is deprecated in PHP 5.3';
			$phpcsFile->addError($error, $stackPtr);
		}
	}

	/**
	 * Returns an array of tokens this test wants to listen for.
	 *
	 * @return array
	 */
	public function register()
	{
		return array(T_NEW);
	}
}

{'fraction_non_alphanumeric': 0.11723631018008085, 'fraction_numerical': 0.00735023888276369, 'mean_word_length': 2.728767123287671, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6614638', 'n_tokens_mistral': 897, 'n_tokens_neox': 841, 'n_words': 255}