laravel-ide-helper icon indicating copy to clipboard operation
laravel-ide-helper copied to clipboard

CastsInboundAttributes generates incorrect property type

Open bbprojectnet opened this issue 3 years ago • 1 comments

Versions:

  • ide-helper Version: 2.12.3
  • Laravel Version: 9.29.0
  • PHP Version: 8.1

Description:

If castable implements CastsInboundAttributes IDE helper generates incorrect PHP doc type, for example:

	protected $casts = [
		'password' => AsHash::class,
	];
class AsHash implements CastsInboundAttributes
{
	/**
	 * @inheritDoc
	 */
	public function set($model, string $key, $value, array $attributes): ?string
	{
		if ($value === null) {
			return null;
		}

		return Hash::make($value); // @codeCoverageIgnore
	}
}

User.php php doc block:

@property \BBProjectNet\LaravelCasts\AsHash|null $password

If castable implements CastsInboundAttributes type should by inherit from database type.

bbprojectnet avatar Sep 12 '22 10:09 bbprojectnet

Seems there's already a PR => https://github.com/barryvdh/laravel-ide-helper/pull/1329

mfn avatar Sep 12 '22 11:09 mfn

Closing, as PR was merged and released

mfn avatar Feb 16 '24 22:02 mfn