mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-21 11:33:11 +00:00
CS tweaks
This commit is contained in:
@@ -257,7 +257,7 @@ class ModelsCommand extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$comment = $column->getComment();
|
$comment = $column->getComment();
|
||||||
$this->setProperty($name, $type, true, true,$comment);
|
$this->setProperty($name, $type, true, true, $comment);
|
||||||
$this->setMethod(
|
$this->setMethod(
|
||||||
Str::camel("where_" . $name),
|
Str::camel("where_" . $name),
|
||||||
'\Illuminate\Database\Query\Builder|\\' . get_class($model),
|
'\Illuminate\Database\Query\Builder|\\' . get_class($model),
|
||||||
@@ -363,13 +363,14 @@ class ModelsCommand extends Command
|
|||||||
* @param bool|null $write
|
* @param bool|null $write
|
||||||
* @param string|null $comment
|
* @param string|null $comment
|
||||||
*/
|
*/
|
||||||
protected function setProperty($name, $type = null, $read = null, $write = null,$comment=null)
|
protected function setProperty($name, $type = null, $read = null, $write = null, $comment='')
|
||||||
{
|
{
|
||||||
if (!isset($this->properties[$name])) {
|
if (!isset($this->properties[$name])) {
|
||||||
$this->properties[$name] = array();
|
$this->properties[$name] = array();
|
||||||
$this->properties[$name]['type'] = 'mixed';
|
$this->properties[$name]['type'] = 'mixed';
|
||||||
$this->properties[$name]['read'] = false;
|
$this->properties[$name]['read'] = false;
|
||||||
$this->properties[$name]['write'] = false;
|
$this->properties[$name]['write'] = false;
|
||||||
|
$this->properties[$name]['comment'] = (string) $comment;
|
||||||
}
|
}
|
||||||
if ($type !== null) {
|
if ($type !== null) {
|
||||||
$this->properties[$name]['type'] = $type;
|
$this->properties[$name]['type'] = $type;
|
||||||
@@ -380,9 +381,6 @@ class ModelsCommand extends Command
|
|||||||
if ($write !== null) {
|
if ($write !== null) {
|
||||||
$this->properties[$name]['write'] = $write;
|
$this->properties[$name]['write'] = $write;
|
||||||
}
|
}
|
||||||
if ($comment !== null ) {
|
|
||||||
$this->properties[$name]['comment'] = $comment;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setMethod($name, $type = '', $arguments = array())
|
protected function setMethod($name, $type = '', $arguments = array())
|
||||||
@@ -439,8 +437,7 @@ class ModelsCommand extends Command
|
|||||||
} else {
|
} else {
|
||||||
$attr = 'property-read';
|
$attr = 'property-read';
|
||||||
}
|
}
|
||||||
$comment = isset($property['comment'])?$property['comment']:'';
|
$tag = Tag::createInstance("@{$attr} {$property['type']} {$name} {$property['comment']}", $phpdoc);
|
||||||
$tag = Tag::createInstance("@{$attr} {$property['type']} {$name} {$comment}", $phpdoc);
|
|
||||||
$phpdoc->appendTag($tag);
|
$phpdoc->appendTag($tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,12 +519,12 @@ class ModelsCommand extends Command
|
|||||||
private function getClassName($className, $model)
|
private function getClassName($className, $model)
|
||||||
{
|
{
|
||||||
// If the class name was resolved via get_class($this) or static::class
|
// If the class name was resolved via get_class($this) or static::class
|
||||||
if(strpos($className, 'get_class($this)') !== false || strpos($className, 'static::class') !== false) {
|
if (strpos($className, 'get_class($this)') !== false || strpos($className, 'static::class') !== false) {
|
||||||
return get_class($model);
|
return get_class($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the class name was resolved via ::class (PHP 5.5+)
|
// If the class name was resolved via ::class (PHP 5.5+)
|
||||||
if(strpos($className, '::class') !== false) {
|
if (strpos($className, '::class') !== false) {
|
||||||
$end = -1 * strlen('::class');
|
$end = -1 * strlen('::class');
|
||||||
return substr($className, 0, $end);
|
return substr($className, 0, $end);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user