minor fixes
This commit is contained in:
Родитель
ec5dd42da2
Коммит
e64688067d
|
@ -405,7 +405,8 @@ class Node implements \JsonSerializable {
|
|||
$descendants = iterator_to_array($this->getDescendantNodes(), false);
|
||||
for ($i = \count($descendants) - 1; $i >= 0; $i--) {
|
||||
$childNode = $descendants[$i];
|
||||
if ($pos >= $childNode->getFullStart() && $pos <= $childNode->getEndPosition()) {
|
||||
$start = $childNode->getStart();
|
||||
if ($pos >= $start && $pos <= $childNode->getEndPosition()) {
|
||||
return $childNode;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class QualifiedName extends Node implements NamespacedNameInterface {
|
|||
public $globalSpecifier; // \_opt
|
||||
/** @var RelativeSpecifier */
|
||||
public $relativeSpecifier; // namespace\
|
||||
/** @var DelimitedList\QualifiedNameParts */
|
||||
/** @var array */
|
||||
public $nameParts;
|
||||
|
||||
/**
|
||||
|
@ -121,7 +121,7 @@ class QualifiedName extends Node implements NamespacedNameInterface {
|
|||
return $resolvedName;
|
||||
} elseif ($this->parent instanceof CallExpression) { // TODO how to handle scoped method calls?
|
||||
$resolvedName = $this->tryResolveFromImportTable($functionImportTable);
|
||||
if ($this->getNamespaceDefinition()->name === null) {
|
||||
if (($namespaceDefinition = $this->getNamespaceDefinition()) === null || $namespaceDefinition->name === null) {
|
||||
$resolvedName = $resolvedName ?? ResolvedName::buildName($this->nameParts, $this->getFileContents());
|
||||
}
|
||||
return $resolvedName;
|
||||
|
|
|
@ -24,7 +24,14 @@ class Token implements \JsonSerializable {
|
|||
return substr($document, $this->fullStart, $this->start - $this->fullStart);
|
||||
}
|
||||
|
||||
public function getText(string $document) : string {
|
||||
/**
|
||||
* @param string|null $document
|
||||
* @return bool|null|string
|
||||
*/
|
||||
public function getText(string $document = null) {
|
||||
if ($document === null) {
|
||||
return null;
|
||||
}
|
||||
return substr($document, $this->start, $this->length - ($this->start - $this->fullStart));
|
||||
}
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ export function activate(context: ExtensionContext) {
|
|||
documentSelector: ['php'],
|
||||
synchronize: {
|
||||
// Synchronize the setting section 'php' to the server
|
||||
configurationSection: 'php',
|
||||
configurationSection: 'php'
|
||||
// Notify the server about file changes to '.clientrc files contain in the workspace
|
||||
fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
|
||||
// fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
require __DIR__ . "/LexerInvariantsTest.php";
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
|
Загрузка…
Ссылка в новой задаче