Skip to content
This repository
Browse code

Supporting namespaces using block format

  • Loading branch information...
commit 037f1727004cbdf4f6bb8fb7e4498d657e2f915c 1 parent c4b92e4
Juan Basso authored October 15, 2012
2  Sniffs/NamingConventions/ValidNamespaceNameSniff.php
@@ -50,7 +50,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
50 50
 		$filename = $phpcsFile->getFilename();
51 51
 		$ns = '';
52 52
 
53  
-		while ($tokens[$stackPtr + $i]['code'] !== T_SEMICOLON) {
  53
+		while (!in_array($tokens[$stackPtr + $i]['code'], array(T_SEMICOLON, T_WHITESPACE, T_OPEN_CURLY_BRACKET))) {
54 54
 			$ns .= $tokens[$stackPtr + $i]['content'];
55 55
 			$i++;
56 56
 		}
5  tests/files/CakePHP/SniffTest/BlockNs_pass.php
... ...
@@ -0,0 +1,5 @@
  1
+<?php
  2
+namespace CakePHP\SniffTest {
  3
+	class TestFile {
  4
+	}
  5
+}

0 notes on commit 037f172

Please sign in to comment.
Something went wrong with that request. Please try again.