Commit: cb9ddc9e0f290f184b46235d3a83f3dbed816bb8
Author: David Persson | Date: 2010-02-01 08:03:46 +0100
diff --git a/extensions/phpca/Rule/ConstantsUppercaseRule.php b/extensions/phpca/Rule/ConstantsUppercaseRule.php
index ba09e59..a0b2e21 100644
--- a/extensions/phpca/Rule/ConstantsUppercaseRule.php
+++ b/extensions/phpca/Rule/ConstantsUppercaseRule.php
@@ -5,15 +5,17 @@ namespace spriebsch\PHPca\Rule;
use spriebsch\PHPca\Token;
/**
- * Ensures that Constants are upper case
+ * Ensures that constants are upper case.
*/
-class ConstantsUppercaseRule extends Rule {
+class ConstantsUppercaseRule extends Rule
+{
/**
* Performs the rule check.
*
* @returns null
*/
- public function doCheck() {
+ public function doCheck()
+ {
$source = $this->file->getSourceCode();
$namedConstants = array();
@@ -24,20 +26,20 @@ class ConstantsUppercaseRule extends Rule {
$declarations = array_shift($namedConstants);
$namedConstants = array_shift($namedConstants);
- foreach($namedConstants as $i => $const) {
- if($const != strtoupper($const)) {
+ foreach($namedConstants as $i => $constant) {
+ if ($constant != strtoupper($constant)) {
$lines = array();
$line = preg_match_all(
'/.*?' . $this->configuration->getLineEndings() . '.*?/',
- substr($source, 0, strpos($source, 'define("' . $const)),
+ substr($source, 0, strpos($source, 'define("' . $constant)),
$lines
);
$this->addViolation(
- "Named Constant `" . $const . "` not upper case",
+ "Named Constant `{$constant}` not upper case",
null,
$line + 1,
- strpos($declarations[$i], $const)
+ strpos($declarations[$i], $constant)
);
}
}
diff --git a/extensions/phpca/Rule/DocTagsOrderRule.php b/extensions/phpca/Rule/DocTagsOrderRule.php
index f3166ce..d6a31a0 100644
--- a/extensions/phpca/Rule/DocTagsOrderRule.php
+++ b/extensions/phpca/Rule/DocTagsOrderRule.php
@@ -5,18 +5,19 @@ namespace spriebsch\PHPca\Rule;
use spriebsch\PHPca\Token;
/**
- * Ensures documentation Tags are ordered properly
+ * Ensures documentation tags have a specific order.
*/
-class DocTagsOrderRule extends Rule {
+class DocTagsOrderRule extends Rule
+{
/**
- * List of possible tags, ordered
+ * 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 (
+ protected $tagsOrdered = array(
"@link",
"@see",
"@params",
@@ -24,16 +25,17 @@ class DocTagsOrderRule extends Rule {
);
/**
- * Performs the rule check
+ * Performs the rule check.
*
* @return null
*/
- protected function doCheck() {
+ 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
+ // Grab ordered array of the tags in this token
$docTags = array();
preg_match_all('/@.*?\s/', $docText, $docTags);
$docTags = array_shift($docTags);
@@ -47,7 +49,7 @@ class DocTagsOrderRule extends Rule {
if ($tagIndex !== false) {
if ($tagIndex < $docIndex) {
$this->addViolation(
- "Doc tag `" . $tag . "` not ordered correctly, came after `" . $lastTag . "`",
+ "Doc tag `{$tag}` not ordered correctly, came after `{$lastTag}`",
$token
);
continue;