scopes[] = \T_ANON_CLASS; } return array(\T_FUNCTION); } /** * Processes this test, when one of its tokens is encountered. * * @since 9.0.0 * * @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(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.3') === false) { return; } $funcName = $phpcsFile->getDeclarationName($stackPtr); if (strtolower($funcName) !== 'assert') { return; } if ($phpcsFile->hasCondition($stackPtr, $this->scopes) === true) { return; } if ($this->determineNamespace($phpcsFile, $stackPtr) === '') { // Not a namespaced function declaration. This may be a parse error, but not our concern. return; } $phpcsFile->addWarning('Declaring a free-standing function called assert() is deprecated since PHP 7.3.', $stackPtr, 'Found'); } }