aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Wells <brucekwells@gmail.com>2023-08-18 19:11:23 +0300
committerGitHub <noreply@github.com>2023-08-18 19:11:23 +0300
commit1968057f42210e3f5675d46126a1dc6506616ef3 (patch)
tree322d148ff35a38737692c2cc75a4414196b15d2b
parentad839b7858d31f4025598193b15ac422f11203d2 (diff)
Phpcs fixer (#129)
* PHPCSFixer V3.23 * Run PHPCSFixer
-rw-r--r--.php-cs-fixer.php4
-rw-r--r--src/NXP/Classes/Tokenizer.php3
-rw-r--r--tests/MathTest.php1
3 files changed, 6 insertions, 2 deletions
diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
index 7017c03..b661109 100644
--- a/.php-cs-fixer.php
+++ b/.php-cs-fixer.php
@@ -148,8 +148,6 @@ $config
'no_short_bool_cast' => true,
// When making a method or function call, there MUST NOT be a space between the method or function name and the opening parenthesis.
'no_spaces_after_function_name' => true,
- // There MUST NOT be a space after the opening parenthesis. There MUST NOT be a space before the closing parenthesis.
- 'no_spaces_inside_parenthesis' => true,
// Removes `@param`, `@return` and `@var` tags that don't provide any useful information.
'no_superfluous_phpdoc_tags' => true,
// Remove trailing whitespace at the end of non-blank lines.
@@ -242,6 +240,8 @@ $config
'single_quote' => true,
// Each trait `use` must be done as single statement.
'single_trait_insert_per_statement' => true,
+ // There MUST NOT be a space after the opening parenthesis. There MUST NOT be a space before the closing parenthesis.
+ 'spaces_inside_parentheses' => false,
// Replace all `<>` with `!=`.
'standardize_not_equals' => true,
// Lambdas not (indirect) referencing `$this` must be declared `static`.
diff --git a/src/NXP/Classes/Tokenizer.php b/src/NXP/Classes/Tokenizer.php
index 656961a..e3c3e6a 100644
--- a/src/NXP/Classes/Tokenizer.php
+++ b/src/NXP/Classes/Tokenizer.php
@@ -133,6 +133,7 @@ class Tokenizer
$this->allowNegative = false;
break;
+
/** @noinspection PhpMissingBreakStatementInspection */
case 'e' === \strtolower($ch):
if (\strlen($this->numberBuffer) && \str_contains($this->numberBuffer, '.')) {
@@ -141,6 +142,7 @@ class Tokenizer
break;
}
+
// no break
// Intentionally fall through
case $this->isAlpha($ch):
@@ -207,6 +209,7 @@ class Tokenizer
continue 2;
}
+
// could be in exponent, in which case negative should be added to the numberBuffer
if ($this->numberBuffer && 'e' == $this->numberBuffer[\strlen($this->numberBuffer) - 1]) {
$this->numberBuffer .= $ch;
diff --git a/tests/MathTest.php b/tests/MathTest.php
index 573b634..8c22224 100644
--- a/tests/MathTest.php
+++ b/tests/MathTest.php
@@ -1018,6 +1018,7 @@ class MathTest extends TestCase
if (\is_scalar($variable) || null === $variable) {
return;
}
+
// Allow variables of type DateTime, but not others
if (! $variable instanceof \DateTime) {
throw new MathExecutorException('Invalid variable type');