Guest User

Untitled

a guest
Jun 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. <?php
  2.  
  3. class ReflectionClassUsedSniff implements PHP_CodeSniffer_Sniff
  4. {
  5. public function register()
  6. {
  7. return array(T_STRING);
  8.  
  9. }
  10.  
  11. public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
  12. {
  13. $tokens = $phpcsFile->getTokens();
  14. $token = $tokens[$stackPtr];
  15.  
  16. if(strncmp($token['content'], 'Reflection', 10) === 0) {
  17. $phpcsFile->addError('Usage of the Reflection API is not allowed', $stackPtr, 'Found');
  18. }
  19. }
  20.  
  21.  
  22. }
Add Comment
Please, Sign In to add comment