mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-19 02:23:11 +00:00
- Improve MetaCommand to allow to ignore some abstract names
- Auto-correct `Method` FQN type name if missing first \ - Implement unit-tests
This commit is contained in:
+10
-2
@@ -24,7 +24,6 @@ class Method
|
||||
/** @var \ReflectionMethod */
|
||||
protected $method;
|
||||
|
||||
protected $output = '';
|
||||
protected $name;
|
||||
protected $namespace;
|
||||
protected $params = array();
|
||||
@@ -230,7 +229,16 @@ class Method
|
||||
*/
|
||||
protected static function convertKeywords($string)
|
||||
{
|
||||
return preg_replace(array('/(^|\|)Closure(\||$)/', '/(^|\|)dynamic(\||$)/'), array('$1\Closure$2', '$1mixed$2'), $string);
|
||||
$types = explode('|', $string);
|
||||
foreach ($types as &$type) {
|
||||
if ($type === 'Closure')
|
||||
$type = '\Closure';
|
||||
elseif ($type === 'dynamic')
|
||||
$type = 'mixed';
|
||||
elseif (strrpos($type, '\\') && $type[0] !== '\\' && (class_exists($type) || interface_exists($type)))
|
||||
$type = '\\' . $type;
|
||||
}
|
||||
return implode('|', $types);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user