cvs: pear /PHP_CodeSniffer package.xml /PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Formatting OutputBufferingIndentSniff.php /PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Tests/Formatting OutputBufferingIndentUnitTest.inc OutputBufferingIndentUnitTest.php

[email protected] ("Greg Sherwood")
Newsgroups php.pear.cvs
Message-ID <cvssquiz1209710235@cvsserver>
squiz		Fri May  2 06:37:15 2008 UTC

  Modified files:              
    /pear/PHP_CodeSniffer	package.xml 
    /pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Formatting	
                                                                       	OutputBufferingIndentSniff.php 
    /pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Tests/Formatting	
                                                                      	OutputBufferingIndentUnitTest.inc 
                                                                      	OutputBufferingIndentUnitTest.php 
  Log:
  Squiz OutputBufferingIndentSniff now ignores the indentation of inline HTML
  
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/package.xml?r1=1.263&r2=1.264&diff_format=u
Index: pear/PHP_CodeSniffer/package.xml
diff -u pear/PHP_CodeSniffer/package.xml:1.263 pear/PHP_CodeSniffer/package.xml:1.264
--- pear/PHP_CodeSniffer/package.xml:1.263	Thu May  1 00:49:31 2008
+++ pear/PHP_CodeSniffer/package.xml	Fri May  2 06:37:14 2008
@@ -35,6 +35,7 @@
   - Fixed error in PEAR ValidClassNameSniff when checking class names with double underscores
   - Moved Squiz InlineControlStructureSniff into Generic standard
   - PEAR standard now throws warnings for inline control structures
+  - Squiz OutputBufferingIndentSniff now ignores the indentation of inline HTML
  </notes>
  <contents>
   <dir name="/">
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Formatting/OutputBufferingIndentSniff.php?r1=1.5&r2=1.6&diff_format=u
Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Formatting/OutputBufferingIndentSniff.php
diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Formatting/OutputBufferingIndentSniff.php:1.5 pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Formatting/OutputBufferingIndentSniff.php:1.6
--- pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Formatting/OutputBufferingIndentSniff.php:1.5	Mon Jul 23 01:47:53 2007
+++ pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Formatting/OutputBufferingIndentSniff.php	Fri May  2 06:37:15 2008
@@ -10,7 +10,7 @@
  * @author    Marc McIntyre <[email protected]>
  * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
  * @license   http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version   CVS: $Id: OutputBufferingIndentSniff.php,v 1.5 2007/07/23 01:47:53 squiz Exp $
+ * @version   CVS: $Id: OutputBufferingIndentSniff.php,v 1.6 2008/05/02 06:37:15 squiz Exp $
  * @link      http://pear.php.net/package/PHP_CodeSniffer
  */
 
@@ -100,8 +100,16 @@
                 continue;
             }
 
-            // The line has content, now if it is less than the required indent, throw error.
+            // The spaces at the start of inline HTML are not considered indent by
+            // PHP_CodeSniffer, so we need to ignore them because their indentation
+            // if not a coding standard issue, it is a HTML output issue.
+            if ($tokens[$nextContent]['code'] === T_INLINE_HTML) {
+                continue;
+            }
+
             $foundIndent = ($tokens[$nextContent]['column'] - 1);
+
+            // The line has content, now if it is less than the required indent, throw error.
             if ($foundIndent < $requiredIndent) {
                 $error = "Buffered line not indented correctly. Expected at least $requiredIndent spaces; found $foundIndent.";
                 $phpcsFile->addError($error, $nextContent);
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Tests/Formatting/OutputBufferingIndentUnitTest.inc?r1=1.3&r2=1.4&diff_format=u
Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Tests/Formatting/OutputBufferingIndentUnitTest.inc
diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Tests/Formatting/OutputBufferingIndentUnitTest.inc:1.3 pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Tests/Formatting/OutputBufferingIndentUnitTest.inc:1.4
--- pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Tests/Formatting/OutputBufferingIndentUnitTest.inc:1.3	Fri Mar 23 03:30:56 2007
+++ pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Tests/Formatting/OutputBufferingIndentUnitTest.inc	Fri May  2 06:37:15 2008
@@ -47,5 +47,17 @@
 }
 
 ob_start();
+    ?><h2>Sign up for a new account</h2>
+    <form action="<?php echo $submitTo; ?>" method="post">
+    <?php
+ob_end_clean();
+
+ob_start();
+    ?><h2>Sign up for a new account</h2>
+<form action="<?php echo $submitTo; ?>" method="post">
+   <?php
+ob_end_clean();
+
+ob_start();
     echo $hello;
 ?>
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Tests/Formatting/OutputBufferingIndentUnitTest.php?r1=1.3&r2=1.4&diff_format=u
Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Tests/Formatting/OutputBufferingIndentUnitTest.php
diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Tests/Formatting/OutputBufferingIndentUnitTest.php:1.3 pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Tests/Formatting/OutputBufferingIndentUnitTest.php:1.4
--- pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Tests/Formatting/OutputBufferingIndentUnitTest.php:1.3	Fri Mar 23 03:30:56 2007
+++ pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Tests/Formatting/OutputBufferingIndentUnitTest.php	Fri May  2 06:37:15 2008
@@ -10,7 +10,7 @@
  * @author    Marc McIntyre <[email protected]>
  * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
  * @license   http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version   CVS: $Id: OutputBufferingIndentUnitTest.php,v 1.3 2007/03/23 03:30:56 squiz Exp $
+ * @version   CVS: $Id: OutputBufferingIndentUnitTest.php,v 1.4 2008/05/02 06:37:15 squiz Exp $
  * @link      http://pear.php.net/package/PHP_CodeSniffer
  */
 
@@ -51,7 +51,7 @@
                 25 => 1,
                 33 => 1,
                 34 => 2,
-                49 => 1,
+                61 => 1,
                );
 
     }//end getErrorList()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.