As it's specified in the title when I run php artisan ide-helper:generate it firstly works fine but then it prints out part of some file. This is one of that
/**
* Unset the value for a given offset.
*
* @param mixed $offset
* @return void
*/
public function offsetUnset($offset)
{
unset($this->attributes[$offset], $this->relations[$offset]);
}
/**
* Determine if an attribute or relation exists on the model.
*
* @param string $key
* @return bool
*/
public function __isset($key)
{
return $this->offsetExists($key);
}
/**
* Unset an attribute on the model.
*
* @param string $key
* @return void
*/
public function __unset($key)
{
$this->offsetUnset($key);
}
/**
* Handle dynamic method calls into the model.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
if (in_array($method, ['increment', 'decrement'])) {
return $this->$method(...$parameters);
}
return $this->newQuery()->$method(...$parameters);
}
/**
* Handle dynamic static method calls into the method.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public static function __callStatic($method, $parameters)
{
return (new static)->$method(...$parameters);
}
/**
* Convert the model to its string representation.
*
* @return string
*/
public function __toString()
{
return $this->toJson();
}
/**
* When a model is being unserialized, check if it needs to be booted.
*
* @return void
*/
public function __wakeup()
{
$this->bootIfNotBooted();
}
}
+1
@barryvdh ping
+1
+1
Same here. I was really worried until I realized about the problem. I had the command added to post-update-cmd script, so I couldn't see the composer update output.
So is there a PR?
Same here, both ide-helper:eloquent and Ide-helper:generate gave the same error.
Php 7.2.2
Laravel v5.6.38
barryvdh/laravel-ide-helper v2.5.0
doctrine/dbal v2.8.0
As a quick fix one might replace line 61 here https://github.com/barryvdh/laravel-ide-helper/blob/master/src/Eloquent.php#L61
to
$model = 'abstract class Model ';
$contents = str_replace($model, $docComment."\n". $model, $contents, $count);
...but that might not be optimal solution...
The problem is that generate command tries to add @mixin to docBlock of Model, which was removed, seemingly quite some time ago https://github.com/illuminate/database/commit/1528af27ac65340188d2e494edeeb8436494e9c8
Or a dirty hack (add @mixin via grep/sed):
composer.json:
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"grep -q '@mixin \\\\Eloquent' vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php || sed -i.bak $'s|abstract class Model implements ArrayAccess|/**\\\\\\n * @mixin \\\\\\\\Eloquent\\\\\\n */\\\\\\nabstract class Model implements ArrayAccess|' vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php",
"php artisan ide-helper:generate",
:1st_place_medal:
https://github.com/barryvdh/laravel-ide-helper/issues/697#issuecomment-418754764
I've created a proper PR https://github.com/barryvdh/laravel-ide-helper/pull/700.
Most helpful comment
As a quick fix one might replace line 61 here https://github.com/barryvdh/laravel-ide-helper/blob/master/src/Eloquent.php#L61
to
...but that might not be optimal solution...
The problem is that
generatecommand tries to add@mixinto docBlock ofModel, which was removed, seemingly quite some time ago https://github.com/illuminate/database/commit/1528af27ac65340188d2e494edeeb8436494e9c8Or a dirty hack (add
@mixinvia grep/sed):composer.json: