GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix TokensList::getPrevious which was not able to reach very first token · phpmyadmin/sql-parser@aa8a915

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • TokensList.php
  • tests/Lexer
    • TokensListTest.php
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/TokensList.php‎

Copy file name to clipboardExpand all lines: src/TokensList.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function getNext()
119119
*/
120120
public function getPrevious(): ?Token
121121
{
122-
for (; $this->idx > 0; --$this->idx) {
122+
for (; $this->idx >= 0; --$this->idx) {
123123
if (
124124
($this->tokens[$this->idx]->type !== Token::TYPE_WHITESPACE)
125125
&& ($this->tokens[$this->idx]->type !== Token::TYPE_COMMENT)
Collapse file

‎tests/Lexer/TokensListTest.php‎

Copy file name to clipboardExpand all lines: tests/Lexer/TokensListTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public function testGetPrevious(): void
7979
$this->assertEquals($this->tokens[6], $list->getPrevious());
8080
$this->assertEquals($this->tokens[4], $list->getPrevious());
8181
$this->assertEquals($this->tokens[2], $list->getPrevious());
82+
$this->assertEquals($this->tokens[0], $list->getPrevious());
8283
$this->assertNull($list->getPrevious());
8384
}
8485

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.