Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel: [ErrorException] "continue" targeting switch is equivalent to "break". during "composer install"

When I run ...

composer install

... on a server with PHP and nginx installed.

I get the following exception:

[ErrorException]
"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

How can I fix this?

like image 462
Kumanan Avatar asked Aug 12 '19 11:08

Kumanan


2 Answers

This is a new warning introduced in PHP 7.3.

It means you are not allowed to have a continue statement inside of a switch, you should use break instead.

To fix this you most likely just have to update composer, this can be done simply by running composer self-update.

You can also just run php without warnings, this can be done by setting the ini config values as a start parameter.

php -d error_reporting=0 composer.phar
like image 153
Oliver Nybroe Avatar answered Nov 08 '22 04:11

Oliver Nybroe


Check your current PHP version if it's greater than 7.2, then execute follow below simple steps

1. Disable the latest php version

sudo a2dismod php7.3

2. Restart the nginx service

sudo service nginx restart

3. If you are using Apache2 run as below

sudo service apache2 restart

4. Set alternatives

sudo update-alternatives --set php /usr/bin/php7.2

5. Check the PHP version

php -v

6. Now, Install Composer as below

composer install
like image 2
Kumanan Avatar answered Nov 08 '22 06:11

Kumanan