I have php7.3 and symfony2.8 When I try to create the classes with the console I get this error:
[Symfony\Component\Debug\Exception\ContextErrorException]Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
Warning: “continue” targeting switch is equivalent to “break”. did you mean to use “continue 2” – What’s going on? When you are using PHP 7.3, you may get a Warning: “continue” targeting switch is equivalent to “break”.
When you are using PHP 7.3, you may get a Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”. This issue appears because of a backward incompatibility with PHP 7.3 for the continue keyword in Switch statements.
Note: In PHP the switch statement is considered a looping structure for the purposes of continue. continue behaves like break (when no arguments are passed) but will raise a warning as this is likely to be a mistake. If a switch is inside a loop, continue 2 will continue with the next iteration of the outer loop.
In most sanelanguages, in particular those that derive from C, the two keywords do not have the same meaning: breakmeans “exit from the current loop immediatly”; continuemeans “stop the current iteration and restart the loop from the very next one”.
I've got same problem and got this error too, but in my case this error shows when i'm trying to run composer install
or composer update
.
and i solve this issue by running composer self-update
. it works on my project.
Maybe your composer is outdated. Below are the steps to get rid of the error.
Note: For Windows professionals, Only Step2 and Step3 is needed and done.
Step1
Remove the composer:
sudo apt-get remove composer
Step2
Download the composer:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
Step3
Run composer-setup.php file
php composer-setup.php
Step4
Finally move the composer:
sudo mv composer.phar /usr/local/bin/composer
Your composer should be updated now. To check it run command:
composer
You can remove the downloaded composer by php command
php -r "unlink('composer-setup.php');"
The issue looks to me to be a backward incompatibility with PHP 7.3 for the continue
keyword in Switch statements. Take a look at the "Continue Targeting Switch issues Warning" section in Backward Incompatible Changes.
I ran into the same issue with Symfony 3.3 using PHP 7.3 and downgrading to PHP 7.2 resolved the warning.
I upgraded to PHP 7.3, and None of these worked for me before I used,
sudo wget https://getcomposer.org/download/1.8.0/composer.phar -O /usr/local/bin/composer && sudo chmod 755 /usr/local/bin/composer
It's just the version dependency. PHP 7.3
and composer update worked like a charm!
I changed continue to continue 2 on line 1579 in shortcodeComon.php and it fixed my problem
if(trim($custom_link[$i]) == ""){
continue;
}
Change to:
if(trim($custom_link[$i]) == ""){
continue 2;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With