4 * This file is part of Psy Shell.
6 * (c) 2012-2018 Justin Hileman
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Psy\TabCompletion\Matcher;
14 class ClassMethodDefaultParametersMatcher extends AbstractDefaultParametersMatcher
16 public function getMatches(array $tokens, array $info = [])
18 $openBracket = array_pop($tokens);
19 $functionName = array_pop($tokens);
20 $methodOperator = array_pop($tokens);
22 $class = $this->getNamespaceAndClass($tokens);
25 $reflection = new \ReflectionClass($class);
26 } catch (\ReflectionException $e) {
27 // In this case the class apparently does not exist, so we can do nothing
31 $methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC);
33 foreach ($methods as $method) {
34 if ($method->getName() === $functionName[1]) {
35 return $this->getDefaultParameterCompletion($method->getParameters());
42 public function hasMatched(array $tokens)
44 $openBracket = array_pop($tokens);
46 if ($openBracket !== '(') {
50 $functionName = array_pop($tokens);
52 if (!self::tokenIs($functionName, self::T_STRING)) {
56 $operator = array_pop($tokens);
58 if (!self::tokenIs($operator, self::T_DOUBLE_COLON)) {