Skip to content

Commit

Permalink
Remove LSB for class constants
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Feb 17, 2020
1 parent 327b6ac commit 26230c7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
26 changes: 13 additions & 13 deletions src/Utils/BufferedQuery.php
Expand Up @@ -185,39 +185,39 @@ public function extract($end = false)
* treated differently, because of the preceding backslash, it will
* be ignored.
*/
if ((($this->status & static::STATUS_COMMENT) === 0) && ($this->query[$i] === '\\')) {
if ((($this->status & self::STATUS_COMMENT) === 0) && ($this->query[$i] === '\\')) {
$this->current .= $this->query[$i] . $this->query[++$i];
continue;
}

/*
* Handling special parses statuses.
*/
if ($this->status === static::STATUS_STRING_SINGLE_QUOTES) {
if ($this->status === self::STATUS_STRING_SINGLE_QUOTES) {
// Single-quoted strings like 'foo'.
if ($this->query[$i] === '\'') {
$this->status = 0;
}

$this->current .= $this->query[$i];
continue;
} elseif ($this->status === static::STATUS_STRING_DOUBLE_QUOTES) {
} elseif ($this->status === self::STATUS_STRING_DOUBLE_QUOTES) {
// Double-quoted strings like "bar".
if ($this->query[$i] === '"') {
$this->status = 0;
}

$this->current .= $this->query[$i];
continue;
} elseif ($this->status === static::STATUS_STRING_BACKTICK) {
} elseif ($this->status === self::STATUS_STRING_BACKTICK) {
if ($this->query[$i] === '`') {
$this->status = 0;
}

$this->current .= $this->query[$i];
continue;
} elseif (($this->status === static::STATUS_COMMENT_BASH)
|| ($this->status === static::STATUS_COMMENT_SQL)
} elseif (($this->status === self::STATUS_COMMENT_BASH)
|| ($this->status === self::STATUS_COMMENT_SQL)
) {
// Bash-like (#) or SQL-like (-- ) comments end in new line.
if ($this->query[$i] === "\n") {
Expand All @@ -226,7 +226,7 @@ public function extract($end = false)

$this->current .= $this->query[$i];
continue;
} elseif ($this->status === static::STATUS_COMMENT_C) {
} elseif ($this->status === self::STATUS_COMMENT_C) {
// C-like comments end in */.
if (($this->query[$i - 1] === '*') && ($this->query[$i] === '/')) {
$this->status = 0;
Expand All @@ -240,15 +240,15 @@ public function extract($end = false)
* Checking if a string started.
*/
if ($this->query[$i] === '\'') {
$this->status = static::STATUS_STRING_SINGLE_QUOTES;
$this->status = self::STATUS_STRING_SINGLE_QUOTES;
$this->current .= $this->query[$i];
continue;
} elseif ($this->query[$i] === '"') {
$this->status = static::STATUS_STRING_DOUBLE_QUOTES;
$this->status = self::STATUS_STRING_DOUBLE_QUOTES;
$this->current .= $this->query[$i];
continue;
} elseif ($this->query[$i] === '`') {
$this->status = static::STATUS_STRING_BACKTICK;
$this->status = self::STATUS_STRING_BACKTICK;
$this->current .= $this->query[$i];
continue;
}
Expand All @@ -257,20 +257,20 @@ public function extract($end = false)
* Checking if a comment started.
*/
if ($this->query[$i] === '#') {
$this->status = static::STATUS_COMMENT_BASH;
$this->status = self::STATUS_COMMENT_BASH;
$this->current .= $this->query[$i];
continue;
} elseif ($i + 2 < $len) {
if (($this->query[$i] === '-')
&& ($this->query[$i + 1] === '-')
&& Context::isWhitespace($this->query[$i + 2])) {
$this->status = static::STATUS_COMMENT_SQL;
$this->status = self::STATUS_COMMENT_SQL;
$this->current .= $this->query[$i];
continue;
} elseif (($this->query[$i] === '/')
&& ($this->query[$i + 1] === '*')
&& ($this->query[$i + 2] !== '!')) {
$this->status = static::STATUS_COMMENT_C;
$this->status = self::STATUS_COMMENT_C;
$this->current .= $this->query[$i];
continue;
}
Expand Down
14 changes: 7 additions & 7 deletions tests/Misc/UtfStringTest.php
Expand Up @@ -25,17 +25,17 @@ class UtfStringTest extends TestCase

public function testArrayAccess()
{
$str = new UtfString(static::TEST_PHRASE);
$str = new UtfString(self::TEST_PHRASE);

// offsetExists
$this->assertArrayHasKey(static::TEST_PHRASE_LEN - 1, $str);
$this->assertArrayHasKey(self::TEST_PHRASE_LEN - 1, $str);
$this->assertArrayNotHasKey(-1, $str);
$this->assertArrayNotHasKey(static::TEST_PHRASE_LEN, $str);
$this->assertArrayNotHasKey(self::TEST_PHRASE_LEN, $str);

// offsetGet
$this->assertEquals('.', $str[static::TEST_PHRASE_LEN - 1]);
$this->assertEquals('.', $str[self::TEST_PHRASE_LEN - 1]);
$this->assertNull($str[-1]);
$this->assertNull($str[static::TEST_PHRASE_LEN]);
$this->assertNull($str[self::TEST_PHRASE_LEN]);
}

public function testSet()
Expand Down Expand Up @@ -77,8 +77,8 @@ public function testGetCharLength()

public function testToString()
{
$str = new UtfString(static::TEST_PHRASE);
$this->assertEquals(static::TEST_PHRASE, (string) $str);
$str = new UtfString(self::TEST_PHRASE);
$this->assertEquals(self::TEST_PHRASE, (string) $str);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tools/ContextGenerator.php
Expand Up @@ -238,7 +238,7 @@ public static function generate($options)
}

return sprintf(
static::TEMPLATE,
self::TEMPLATE,
$options['name'],
$options['class'],
$options['link'],
Expand Down

0 comments on commit 26230c7

Please sign in to comment.