mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Merge branch 'master' into feature/fix-callable-macros
This commit is contained in:
+24
-1
@@ -10,6 +10,11 @@
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper;
|
||||
|
||||
use Barryvdh\Reflection\DocBlock;
|
||||
use Barryvdh\Reflection\DocBlock\Context;
|
||||
use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
|
||||
use ReflectionClass;
|
||||
|
||||
class Alias
|
||||
{
|
||||
protected $alias;
|
||||
@@ -27,6 +32,7 @@ class Alias
|
||||
protected $valid = false;
|
||||
protected $magicMethods = array();
|
||||
protected $interfaces = array();
|
||||
protected $phpdoc = null;
|
||||
|
||||
/**
|
||||
* @param string $alias
|
||||
@@ -56,7 +62,13 @@ class Alias
|
||||
$this->detectNamespace();
|
||||
$this->detectClassType();
|
||||
$this->detectExtendsNamespace();
|
||||
|
||||
|
||||
if(!empty($this->namespace)) {
|
||||
//Create a DocBlock and serializer instance
|
||||
$this->phpdoc = new DocBlock(new ReflectionClass($alias), new Context($this->namespace));
|
||||
}
|
||||
|
||||
|
||||
if ($facade === '\Illuminate\Database\Eloquent\Model') {
|
||||
$this->usedMethods = array('decrement', 'increment');
|
||||
}
|
||||
@@ -346,6 +358,17 @@ class Alias
|
||||
|
||||
return new \ReflectionFunction($macro_func);
|
||||
}
|
||||
|
||||
* Get the docblock for this alias
|
||||
*
|
||||
* @param string $prefix
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDocComment($prefix = "\t\t")
|
||||
{
|
||||
$serializer = new DocBlockSerializer(1, $prefix);
|
||||
return ($this->phpdoc) ? $serializer->getDocComment($this->phpdoc) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Output an error.
|
||||
|
||||
Reference in New Issue
Block a user