1
0
Fork 0

Trimmed Trailing Whitespace

pull/682/head
Gabriel Noé González 2018-11-10 17:44:05 +01:00
parent df898ec633
commit e71e4e0ff0
4 changed files with 23 additions and 7 deletions

View File

@ -3,5 +3,6 @@
"search.exclude": { "search.exclude": {
"**/validation": true, "**/validation": true,
"**/tests/Validation/cases": true "**/tests/Validation/cases": true
} },
"files.trimTrailingWhitespace": true,
} }

View File

@ -0,0 +1,15 @@
<?php
class Foo
{
public function canAccess()
{
}
private function cantAccess()
{
}
}

View File

@ -247,14 +247,14 @@ class CompletionProvider
// Collect all definitions that match any of the prefixes // Collect all definitions that match any of the prefixes
foreach ($this->index->getDefinitions() as $fqn => $def) { foreach ($this->index->getDefinitions() as $fqn => $def) {
foreach ($prefixes as $prefix) { foreach ($prefixes as $prefix) {
if (substr($fqn, 0, strlen($prefix)) === $prefix && if (substr($fqn, 0, strlen($prefix)) === $prefix &&
$def->isMember && $def->isMember &&
$def->isVisible($prefix, $prefixes[0], $isInMethodDeclaration)) { $def->isVisible($prefix, $prefixes[0], $isInMethodDeclaration)) {
$list->items[] = CompletionItemFactory::fromDefinition($def); $list->items[] = CompletionItemFactory::fromDefinition($def);
} }
} }
} }
} elseif ( } elseif (
($scoped = $node->parent) instanceof Node\Expression\ScopedPropertyAccessExpression || ($scoped = $node->parent) instanceof Node\Expression\ScopedPropertyAccessExpression ||
($scoped = $node) instanceof Node\Expression\ScopedPropertyAccessExpression ($scoped = $node) instanceof Node\Expression\ScopedPropertyAccessExpression

View File

@ -133,17 +133,17 @@ class Definition
} }
} }
} }
/** /**
* Checks the definition's visibility. * Checks the definition's visibility.
* @param string $match Owner of the FQNS * @param string $match Owner of the FQNS
* @param string $caller Descendant of the FQNS owner * @param string $caller Descendant of the FQNS owner
* @param bool $isInMethodDeclaration checking if the call is from inside a * @param bool $isInMethodDeclaration checking if the call is from inside a
* method * method
* @return bool * @return bool
*/ */
public function isVisible(string $match, string $caller, bool $isInMethodDeclaration): bool public function isVisible(string $match, string $caller, bool $isInMethodDeclaration): bool
{ {
if ($isInMethodDeclaration) { if ($isInMethodDeclaration) {
if ($match !== $caller && $this->isPrivate()) { if ($match !== $caller && $this->isPrivate()) {
return false; return false;
@ -151,7 +151,7 @@ class Definition
} else if ($this->isProtected() || $this->isPrivate()) { } else if ($this->isProtected() || $this->isPrivate()) {
return false; return false;
} }
return true; return true;
} }