comparison vendor/psy/psysh/src/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 5fb285c0d0e3
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
13 13
14 class FunctionDefaultParametersMatcher extends AbstractDefaultParametersMatcher 14 class FunctionDefaultParametersMatcher extends AbstractDefaultParametersMatcher
15 { 15 {
16 public function getMatches(array $tokens, array $info = []) 16 public function getMatches(array $tokens, array $info = [])
17 { 17 {
18 array_pop($tokens); // open bracket 18 \array_pop($tokens); // open bracket
19 19
20 $functionName = array_pop($tokens); 20 $functionName = \array_pop($tokens);
21 21
22 try { 22 try {
23 $reflection = new \ReflectionFunction($functionName[1]); 23 $reflection = new \ReflectionFunction($functionName[1]);
24 } catch (\ReflectionException $e) { 24 } catch (\ReflectionException $e) {
25 return []; 25 return [];
30 return $this->getDefaultParameterCompletion($parameters); 30 return $this->getDefaultParameterCompletion($parameters);
31 } 31 }
32 32
33 public function hasMatched(array $tokens) 33 public function hasMatched(array $tokens)
34 { 34 {
35 $openBracket = array_pop($tokens); 35 $openBracket = \array_pop($tokens);
36 36
37 if ($openBracket !== '(') { 37 if ($openBracket !== '(') {
38 return false; 38 return false;
39 } 39 }
40 40
41 $functionName = array_pop($tokens); 41 $functionName = \array_pop($tokens);
42 42
43 if (!self::tokenIs($functionName, self::T_STRING)) { 43 if (!self::tokenIs($functionName, self::T_STRING)) {
44 return false; 44 return false;
45 } 45 }
46 46
47 if (!function_exists($functionName[1])) { 47 if (!\function_exists($functionName[1])) {
48 return false; 48 return false;
49 } 49 }
50 50
51 return true; 51 return true;
52 } 52 }