Stolz / Assets

An ultra-simple-to-use assets management library for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

syntax error, unexpected '.', expecting ',' or ';'

eleftrik opened this issue · comments

Today, doing 'composer update', I get this error:

syntax error, unexpected '.', expecting ',' or ';' 

File: vendor\stolz\assets\src\Laravel\ServiceProvider.php  (line 14)

Previously, I got another error:

Class 'Stolz\Assets\ManagerServiceProvider' not found 

after reading the doc, I noticed (maybe) the provider has changed, so after changing it in

Stolz\Assets\Laravel\ServiceProvider

...I get the syntax error.

Thank you.

commented

Thank @eleftrik for the report. It should be fixed now. I'll tag a release in a few minutes.

Thank you. Now, when I run composer update, I get this error:

PHP Fatal error:  Call to undefined method Stolz\Assets\Laravel\ServiceProvider::mergeConfigFrom() in [project]\vendor\stolz\assets\src\Laravel\ServiceProvider.php on line 37
commented

Are you using Laravel 5?. Laravel 4 is no longer supported in the latest version of the library.

If you are using Laravel 4 right now you have a few options:

  • Use old release of the library (i.e: composer require "stolz/assets:0.0.*") but you won't keep up to date with the latest work.
  • Use the old service provider (Instead of Stolz\Assets\Laravel\ServiceProvider use Stolz\Assets\Laravel\LegacyServiceProvider) but that provider will eventually be deleted from the library.
  • Use your own Laravel service provider (you can base your work in current LegacyServiceProvider).

Also, for Laravel 4, the config file expected path is hardcoded so the artisan command to copy the sample config file will fail since it has changed. You'll need to create/copy it by yourself.

I plan to decouple all the Laravel stuff form this repository. I'll create another repo for integrating the library with Laravel as having all that stuff here gives me more headaches than mantaining the assets library itself. Doing so will hopefully allow me to offer support for all versions of Laravel.

I'm still using Laravel 4. Updated composer.json with "0.0.*", but I'm still getting

Class 'Stolz\Assets\Laravel\LegacyServiceProvider' not found in ........\vendor\l

aravel\framework\src\Illuminate\Foundation\ProviderRepository.php on line 157

Thanks for your kind support.

commented

The three options are mutually excluding. You used option1 and 2. If you intend to use option 1 then keep using the same settings as you did before the update.

I already tried to use ony the first option, but I'm still getting errors.
If I use only the second option, Assets is ok, but It seems that the configuration file is not used.
Where have I to put it? I tried

config/assets.php

or
config/packages/stolz/assets/config.php

but it seems not to work.

Thank you.

commented

@eleftrik Thanks for your feedback.

I've updated the legacy service provider to bypass the Laravel 4 hardcoded package namespace definition. It should work now.

I've branded the new release with the same tag (0.1.0) so if composer gets confused please uninstall the package and install it again.

When using the new service provider the configuration file path is config/assets.php.

When using the legacy service provider the configuration file path is app/config/packages/stolz/assets/config.php

@Stolz Thank you Thank you Thank you.
I've updated composer.json to use "dev-master", I'm using 'Stolz\Assets\Laravel\LegacyServiceProvider' and now everything works like a charm again.
Many thanks for your kind and swift support!

@Stolz Are you still planning to delete the LegacyServiceProvider?

commented

Eventually yes. I plan to move all Laravel stuff to other repo so both service providers will be deleted from here. When that happens I'll add a notification to the composer.json so you'll get a notice after a composer update.

Hey, just wanted to say thanks for this info as well as the library.

However, you really should put this stuff inside the actual readme, even if it's just a note in installation saying "If you're using Laravel 4, see: " - Between this issue being closed, thus not showing up by default, and no note, I spent about an hour last night trying to figure this out before deciding to post my issue this morning.

Receiving a different error on Laravel 4.2 attempting to use the older version.

composer.json set to:
"require": {
"laravel/framework": "4.2.*",
"stolz/assets": "dev-master#e8dee1bb2bad74ba75ee0fa9a8dde5688e78dc7d",
...
},

During composer update receive the following error:

[RuntimeException]
Error Output: PHP Fatal error: Class 'Stolz\Assets\ManagerServiceProvider' not found in /var/www/vhosts/sub.domain.com/bootstrap/compiled.php on line 4481

Commenting out this line in app.php
'Stolz\Assets\ManagerServiceProvider',

Makes the composer update go smoothly. However, when you uncomment that line to put it back in app.php the Laravel application then bombs during initialization. A log file is never even generated with an error.

The same happens after a composer dump-autoload.
My config file is in: app/config/packages/stolz/assets/config.php

I'm relatively new with Laravel and Stolz so any suggestions much appreciated. Thanks!

commented

@mba12 , that error means composer can't find the service provider. As you can see the file exists on the version you are using so I guess there is something wrong with your installation.

BTW, that version is almost a year old, please consider updating it, many bugs have being fixed in the latest months.