-
Notifications
You must be signed in to change notification settings - Fork 3
Find a replacement for php-parser #46
Copy link
Copy link
Open
Labels
dependenciesPull requests that update a dependency filePull requests that update a dependency fileenhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
Description
It causes too many issues and seems incomplete.
eslint-plugin-php/src/language/php-source-code.ts
Lines 49 to 92 in 4230f6f
| findClosestKeyword( | |
| node: Node, | |
| keyword: string, | |
| ): Omit<Location, 'source'> | null { | |
| const lines = this.lines; | |
| const nodeLoc = this.getLoc(node); | |
| for (let line = nodeLoc.start.line; line >= 0; line--) { | |
| const startColumn = | |
| line === nodeLoc.start.line | |
| ? nodeLoc.start.column | |
| : lines[line]?.length; | |
| for (let column = startColumn ?? 0; column >= 0; column--) { | |
| const sliceStart = Math.max(0, column - keyword.length); | |
| const sliceEnd = sliceStart + keyword.length; | |
| if (lines[line]?.slice(sliceStart, sliceEnd) === keyword) { | |
| const locLine = line + LINE_START; | |
| return { | |
| start: { | |
| line: locLine, | |
| column: sliceStart, | |
| offset: this.getOffset({ | |
| line: locLine, | |
| column: sliceStart, | |
| }), | |
| }, | |
| end: { | |
| line: locLine, | |
| column: sliceEnd, | |
| offset: this.getOffset({ | |
| line: locLine, | |
| column: sliceEnd, | |
| }), | |
| }, | |
| }; | |
| } | |
| } | |
| } | |
| return null; | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
dependenciesPull requests that update a dependency filePull requests that update a dependency fileenhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed