Commit: 031bebd2721620ddd4a0c5cc5ac0310fc6ae8c0c

Author: David Persson | Date: 2010-02-01 07:56:59 +0100
Tabs to spaces for PHPca related code.
diff --git a/extensions/phpca/Rule/ConstantsUppercaseRule.php b/extensions/phpca/Rule/ConstantsUppercaseRule.php index cc28cfc..ba09e59 100644 --- a/extensions/phpca/Rule/ConstantsUppercaseRule.php +++ b/extensions/phpca/Rule/ConstantsUppercaseRule.php @@ -8,40 +8,40 @@ use spriebsch\PHPca\Token; * Ensures that Constants are upper case */ class ConstantsUppercaseRule extends Rule { - /** + /** * Performs the rule check. * * @returns null */ - public function doCheck() { - $source = $this->file->getSourceCode(); - - $namedConstants = array(); - $definePattern = '/' . $this->configuration->getLineEndings() . '.*?define\("(.*?)".*[^'; - $definePattern .= $this->configuration->getLineEndings() . ']/'; - - preg_match_all($definePattern, $source, $namedConstants); - $declarations = array_shift($namedConstants); - $namedConstants = array_shift($namedConstants); - - foreach($namedConstants as $i => $const) { - if($const != strtoupper($const)) { - $lines = array(); - $line = preg_match_all( - '/.*?' . $this->configuration->getLineEndings() . '.*?/', - substr($source, 0, strpos($source, 'define("' . $const)), - $lines - ); - - $this->addViolation( - "Named Constant `" . $const . "` not upper case", - null, - $line + 1, - strpos($declarations[$i], $const) - ); - } - } - } + public function doCheck() { + $source = $this->file->getSourceCode(); + + $namedConstants = array(); + $definePattern = '/' . $this->configuration->getLineEndings() . '.*?define\("(.*?)".*[^'; + $definePattern .= $this->configuration->getLineEndings() . ']/'; + + preg_match_all($definePattern, $source, $namedConstants); + $declarations = array_shift($namedConstants); + $namedConstants = array_shift($namedConstants); + + foreach($namedConstants as $i => $const) { + if($const != strtoupper($const)) { + $lines = array(); + $line = preg_match_all( + '/.*?' . $this->configuration->getLineEndings() . '.*?/', + substr($source, 0, strpos($source, 'define("' . $const)), + $lines + ); + + $this->addViolation( + "Named Constant `" . $const . "` not upper case", + null, + $line + 1, + strpos($declarations[$i], $const) + ); + } + } + } } ?> \ No newline at end of file diff --git a/extensions/phpca/Rule/DocTagsOrderRule.php b/extensions/phpca/Rule/DocTagsOrderRule.php index 4a506ab..f3166ce 100644 --- a/extensions/phpca/Rule/DocTagsOrderRule.php +++ b/extensions/phpca/Rule/DocTagsOrderRule.php @@ -9,58 +9,58 @@ use spriebsch\PHPca\Token; */ class DocTagsOrderRule extends Rule { - /** - * List of possible tags, ordered - * - * All tags will be referenced against this list. If they - * appear out of order, a violation will be raised. Simple - * order check regardless of missing tags. - */ - protected $tagsOrdered = array ( - "@link", - "@see", - "@params", - "@return" - ); + /** + * List of possible tags, ordered + * + * All tags will be referenced against this list. If they + * appear out of order, a violation will be raised. Simple + * order check regardless of missing tags. + */ + protected $tagsOrdered = array ( + "@link", + "@see", + "@params", + "@return" + ); - /** - * Performs the rule check - * - * @return null - */ - protected function doCheck() { - while ($this->file->seekTokenId(T_DOC_COMMENT)) { - $token = $this->file->current(); - $docText = $token->getText(); + /** + * Performs the rule check + * + * @return null + */ + protected function doCheck() { + while ($this->file->seekTokenId(T_DOC_COMMENT)) { + $token = $this->file->current(); + $docText = $token->getText(); - //Grab ordered array of the tags in this token - $docTags = array(); - preg_match_all('/@.*?\s/', $docText, $docTags); - $docTags = array_shift($docTags); + //Grab ordered array of the tags in this token + $docTags = array(); + preg_match_all('/@.*?\s/', $docText, $docTags); + $docTags = array_shift($docTags); - $docIndex = 0; - $lastTag = ""; - foreach ($docTags as $tag) { - $tag = trim($tag); - $tagIndex = array_search($tag, $this->tagsOrdered); + $docIndex = 0; + $lastTag = ""; + foreach ($docTags as $tag) { + $tag = trim($tag); + $tagIndex = array_search($tag, $this->tagsOrdered); - if ($tagIndex !== false) { - if ($tagIndex < $docIndex) { - $this->addViolation( - "Doc tag `" . $tag . "` not ordered correctly, came after `" . $lastTag . "`", - $token - ); - continue; - } + if ($tagIndex !== false) { + if ($tagIndex < $docIndex) { + $this->addViolation( + "Doc tag `" . $tag . "` not ordered correctly, came after `" . $lastTag . "`", + $token + ); + continue; + } - $docIndex = $tagIndex; - $lastTag = $tag; - } + $docIndex = $tagIndex; + $lastTag = $tag; + } - } - $this->file->next(); - } - } + } + $this->file->next(); + } + } } ?> \ No newline at end of file