Skip to content
On this page

no-mixed-spaces-and-tabs

Disallow mixing spaces and tabs for indentation

Examples

  • Examples of correct code for this rule using default options

Code with tabs indentation only

php
<?php
class TabsIndentation {
	public function logActions($message) {
		echo $message;
	}
	
	private function logErrors($message) {
		echo $message;
	}
}

Code with spaces indentation only

php
<?php
class SpaceIndentation {
   public function logActions($message) {
       echo $message;
   }
	
   private function logErrors($message) {
      echo $message;
   }
}

Docblocks are not handled by this rule

php
<?php
/**
    * Docblock are not checked for indentation.
	* because this is handled by another rule
	*/
function log(){
	echo 'log';
}
  • Examples of incorrect code for this rule using default options

Code with mixed indentation

php
<?php
class SpaceIndentation {
   public function logActions($message) {
	   echo $message;
   }
	
	 private function logErrors($message) {
	   echo $message;
   }
}

Released under the MIT License.