comparison vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodsMatcher.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 5fb285c0d0e3
children 129ea1e6d783
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
40 $reflection = new \ReflectionClass($class); 40 $reflection = new \ReflectionClass($class);
41 } catch (\ReflectionException $re) { 41 } catch (\ReflectionException $re) {
42 return []; 42 return [];
43 } 43 }
44 44
45 $methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC); 45 if (self::needCompleteClass($tokens[1])) {
46 $methods = $reflection->getMethods();
47 } else {
48 $methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC);
49 }
50
46 $methods = array_map(function (\ReflectionMethod $method) { 51 $methods = array_map(function (\ReflectionMethod $method) {
47 return $method->getName(); 52 return $method->getName();
48 }, $methods); 53 }, $methods);
49 54
50 return array_map( 55 return array_map(
51 function ($name) use ($class) { 56 function ($name) use ($class) {
52 return $class . '::' . $name; 57 $chunks = explode('\\', $class);
58 $className = array_pop($chunks);
59
60 return $className . '::' . $name;
53 }, 61 },
54 array_filter($methods, function ($method) use ($input) { 62 array_filter($methods, function ($method) use ($input) {
55 return AbstractMatcher::startsWith($input, $method); 63 return AbstractMatcher::startsWith($input, $method);
56 }) 64 })
57 ); 65 );