Laravel-medialibrary: Unable to use Tinkerwell after installing Laravel Medialibrary 8

Created on 10 Mar 2020  路  10Comments  路  Source: spatie/laravel-medialibrary

Hi,

I've installed Laravel Medialibrary 8 on a new Laravel 7 project. The package works as expected, but I'm unable to use Tinkerwell on this project now. The regular php artisan tinker also works as normal. So I'm not sure is this is related to the medialibrary package, but this is the only package that makes Tinkerwell stop working.

  syntax error, unexpected '$conversion' (T_VARIABLE), expecting ')'

  at vendor/spatie/laravel-medialibrary/src/MediaCollections/Models/Media.php:174
    170|     public function getMediaConversionNames(): array
    171|     {
    172|         $conversions = ConversionCollection::createForMedia($this);
    173| 
  > 174|         return $conversions->map(fn (Conversion $conversion) => $conversion->getName())->toArray();
    175|     }
    176| 
    177|     public function hasGeneratedConversion(string $conversionName): bool
    178|     {

      +1 vendor frames 
  2   [internal]:0
      Composer\Autoload\ClassLoader::loadClass("Spatie\MediaLibrary\MediaCollections\Models\Media")

      +9 vendor frames 
  12  [internal]:0
      Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Spatie\MediaLibrary\MediaLibraryServiceProvider))

Most helpful comment

You're absolutely right! Tinkerwell was pointed to a PHP version 7.3 bin on my machine.
I'm terribly sorry to have bothered you with this. It has nothing to do with this package.

All 10 comments

Not sure what I did really, but I had this error as well. I either updated Tinkerwell to 2.4.0 or cleared cache or something.

Interesting @bkintanar 馃
I've tried clearing the cache and updated to the latest Tinkerwell. The problem stays in this project with Media-library 8.

I've just upgraded to Tinkerwell 2.5. Still, the same errors.
Strangely all other projects (even with Media-library 7) work fine.

I'm thinking this error isn't related to this package. Judging by the error message you're using a wrong version of PHP.

You're absolutely right! Tinkerwell was pointed to a PHP version 7.3 bin on my machine.
I'm terribly sorry to have bothered you with this. It has nothing to do with this package.

No need to apologize! Glad you found the solution 馃憤

You're absolutely right! Tinkerwell was pointed to a PHP version 7.3 bin on my machine.
I'm terribly sorry to have bothered you with this. It has nothing to do with this package.

how you did fix it ?

@niypoo Tinkerwell was pointed to the wrong PHP version on my machine.
Settings > Advanced > PHP binary

I had the same problem, thanks for pointing to the solution

I had the same issue but resolved in php version 7.4

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nks picture Nks  路  3Comments

drtheuns picture drtheuns  路  3Comments

aaronfullerton picture aaronfullerton  路  4Comments

denitsa-md picture denitsa-md  路  3Comments

mohammad6006 picture mohammad6006  路  4Comments