Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the new cast funchon brakes laravel-ide-helper ide-helper:models #38

Open
DTS-And-Eaglepoint-Funding opened this issue Mar 28, 2024 · 1 comment · May be fixed by #39
Open

the new cast funchon brakes laravel-ide-helper ide-helper:models #38

DTS-And-Eaglepoint-Funding opened this issue Mar 28, 2024 · 1 comment · May be fixed by #39

Comments

@DTS-And-Eaglepoint-Funding
Copy link

DTS-And-Eaglepoint-Funding commented Mar 28, 2024

i found that if you change src/Casts/ConfigValueCast.php line 12 and line 24 from
line 12:
public function get(Model $model, string $key, mixed $value, array $attributes)
to:
public function get($model, string $key, mixed $value, array $attributes)
and line 24 from:
public function set(Model $model, string $key, mixed $value, array $attributes)
to:
public function set($model, string $key, mixed $value, array $attributes)
it works fixing all the problems
this is the error

Symfony\Component\ErrorHandler\Error\FatalError 

  Declaration of TarfinLabs\LaravelConfig\Casts\ConfigValueCast::get(Illuminate\Database\Eloquent\Model $model, string $key, $value, array $attributes) must be compatible with Illuminate\Contracts\Database\Eloquent\CastsAttributes::get($model, string $key, $value, array $attributes)

  at vendor/tarfin-labs/laravel-config/src/Casts/ConfigValueCast.php:12
      8▕ use TarfinLabs\LaravelConfig\Enums\ConfigDataType;
      9▕ 
     10▕ class ConfigValueCast implements CastsAttributes
     11▕ {
  ➜  12▕     public function get(Model $model, string $key, $value, array $attributes)
     13▕     {
     14▕         return match ($attributes['type']) {
     15▕             ConfigDataType::BOOLEAN->value => (bool) $value,
     16▕             ConfigDataType::INTEGER->value => (int) $value,

      vendor frames
  5   artisan:0
      {main}()

   Whoops\Exception\ErrorException 

  Declaration of TarfinLabs\LaravelConfig\Casts\ConfigValueCast::get(Illuminate\Database\Eloquent\Model $model, string $key, $value, array $attributes) must be compatible with Illuminate\Contracts\Database\Eloquent\CastsAttributes::get($model, string $key, $value, array $attributes)

  at vendor/tarfin-labs/laravel-config/src/Casts/ConfigValueCast.php:12
      8▕ use TarfinLabs\LaravelConfig\Enums\ConfigDataType;
      9▕ 
     10▕ class ConfigValueCast implements CastsAttributes
     11▕ {
  ➜  12▕     public function get(Model $model, string $key, $value, array $attributes)
     13▕     {
     14▕         return match ($attributes['type']) {
     15▕             ConfigDataType::BOOLEAN->value => (bool) $value,
     16▕             ConfigDataType::INTEGER->value => (int) $value,

      vendor frames
  2   [internal]:0
      Whoops\Run::handleShutdown() 
@DTS-And-Eaglepoint-Funding DTS-And-Eaglepoint-Funding linked a pull request Apr 9, 2024 that will close this issue
@mjamilasfihani
Copy link

mjamilasfihani commented Apr 13, 2024

the defined of parameter was came from Laravel 10.x, if you are using lower than 10.x it would be like that. idk, it could work across versions or not.

edit:
if the problem is only from ide, not the Laravel. then, it should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants