Commit: 3a5bafd773c0dfd1aadd6609e68227b0b19c3acf
Author: David Persson | Date: 2009-12-26 20:50:00 +0100
diff --git a/config/phpca_lithium_standard.ini b/config/phpca_lithium_standard.ini
index dbaf5fb..2de23ba 100644
--- a/config/phpca_lithium_standard.ini
+++ b/config/phpca_lithium_standard.ini
@@ -18,10 +18,10 @@ additional_rules = extensions/phpca/Rule
[NoEvalStatementsRule]
[NoGlobalStatementsRule]
[NoGotoStatementsRule]
-;[NoEchoStatementsRule]
+; [NoEchoStatementsRule]
[NoPrintStatementsRule]
[NoVarDumpStatementsRule]
-;[NoInlineHtmlRule]
+; [NoInlineHtmlRule]
[NoAlternativeSyntaxStatementsRule]
[NoShutupOperatorsRule]
; [MethodsMustHaveVisibilityOperatorRule]
@@ -30,8 +30,8 @@ additional_rules = extensions/phpca/Rule
[MaximumLineLengthRule]
line_length = 100
[NoShortTypeNamesRule]
-[NoWhitespaceWithinCastRule]
-[OneSpaceAfterCastRule]
+[NoWhitespaceWithinCastsRule]
+[OneSpaceAfterCastsRule]
; Documentation
; [ClassesMustHaveDocBlockRule]
diff --git a/extensions/phpca/Rule/NoWhitespaceWithinCastRule.php b/extensions/phpca/Rule/NoWhitespaceWithinCastRule.php
deleted file mode 100644
index 006a875..0000000
--- a/extensions/phpca/Rule/NoWhitespaceWithinCastRule.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-namespace spriebsch\PHPca\Rule;
-
-/**
- * Ensures that there are no whitespaces within a cast.
- */
-class NoWhitespaceWithinCastRule extends Rule
-{
- /**
- * Performs the rule check.
- *
- * @returns null
- */
- protected function doCheck()
- {
- $casts = array(
- T_BOOL_CAST, T_INT_CAST, T_ARRAY_CAST,
- T_DOUBLE_CAST, T_OBJECT_CAST, T_UNSET_CAST
- );
- foreach ($casts as $id) {
- while ($this->file->seekTokenId($id)) {
- $token = $this->file->current();
-
- if ($token->hasWhitespace()) {
- $this->addViolation('Whitespace whithin cast', $token);
- }
- $this->file->next();
- }
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/extensions/phpca/Rule/NoWhitespaceWithinCastsRule.php b/extensions/phpca/Rule/NoWhitespaceWithinCastsRule.php
new file mode 100644
index 0000000..e677555
--- /dev/null
+++ b/extensions/phpca/Rule/NoWhitespaceWithinCastsRule.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace spriebsch\PHPca\Rule;
+
+/**
+ * Ensures that there are no whitespaces within a cast.
+ */
+class NoWhitespaceWithinCastsRule extends Rule
+{
+ /**
+ * Performs the rule check.
+ *
+ * @returns null
+ */
+ protected function doCheck()
+ {
+ $casts = array(
+ T_BOOL_CAST, T_INT_CAST, T_ARRAY_CAST,
+ T_DOUBLE_CAST, T_OBJECT_CAST, T_UNSET_CAST
+ );
+ foreach ($casts as $id) {
+ while ($this->file->seekTokenId($id)) {
+ $token = $this->file->current();
+
+ if ($token->hasWhitespace()) {
+ $this->addViolation('Whitespace whithin cast', $token);
+ }
+ $this->file->next();
+ }
+ }
+ }
+}
+?>
\ No newline at end of file
diff --git a/extensions/phpca/Rule/OneSpaceAfterCastRule.php b/extensions/phpca/Rule/OneSpaceAfterCastRule.php
deleted file mode 100644
index 82349f3..0000000
--- a/extensions/phpca/Rule/OneSpaceAfterCastRule.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-namespace spriebsch\PHPca\Rule;
-
-/**
- * Ensures that there is one space after a cast.
- */
-class OneSpaceAfterCastRule extends Rule
-{
- /**
- * Performs the rule check.
- *
- * @returns null
- */
- protected function doCheck()
- {
- $casts = array(
- T_BOOL_CAST, T_INT_CAST, T_ARRAY_CAST,
- T_DOUBLE_CAST, T_OBJECT_CAST, T_UNSET_CAST
- );
- foreach ($casts as $id) {
- while ($this->file->seekTokenId($id)) {
- $this->file->next();
- $token = $this->file->current();
-
- if ($token->getId() !== T_WHITESPACE) {
- $this->addViolation('No space after cast', $token);
- } elseif (strlen($token->getText()) > 1) {
- $this->addViolation('More than one space after cast', $token);
- }
- }
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/extensions/phpca/Rule/OneSpaceAfterCastsRule.php b/extensions/phpca/Rule/OneSpaceAfterCastsRule.php
new file mode 100644
index 0000000..1b24d6f
--- /dev/null
+++ b/extensions/phpca/Rule/OneSpaceAfterCastsRule.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace spriebsch\PHPca\Rule;
+
+/**
+ * Ensures that there is one space after a cast.
+ */
+class OneSpaceAfterCastsRule extends Rule
+{
+ /**
+ * Performs the rule check.
+ *
+ * @returns null
+ */
+ protected function doCheck()
+ {
+ $casts = array(
+ T_BOOL_CAST, T_INT_CAST, T_ARRAY_CAST,
+ T_DOUBLE_CAST, T_OBJECT_CAST, T_UNSET_CAST
+ );
+ foreach ($casts as $id) {
+ while ($this->file->seekTokenId($id)) {
+ $this->file->next();
+ $token = $this->file->current();
+
+ if ($token->getId() !== T_WHITESPACE) {
+ $this->addViolation('No space after cast', $token);
+ } elseif (strlen($token->getText()) > 1) {
+ $this->addViolation('More than one space after cast', $token);
+ }
+ }
+ }
+ }
+}
+?>
\ No newline at end of file