Page MenuHomePhabricator

'continue' statement PHP 7.3 backward incompatibility
Closed, InvalidPublic

Description

The error is:

PHP Fatal error:
Uncaught PHP_CodeSniffer\Exceptions\RuntimeException:
"continue" targeting switch is equivalent to "break".
Did you mean to use "continue 2"?
 
in /src/vendor/squizlabs/php_codesniffer/src/Files/File.php on line 1351
in /src/vendor/squizlabs/php_codesniffer/src/Runner.php:562

That is not a style issue (the php 7.2 build would have failed as well) but a runtime error in squizlabs/php_codesniffer which is a dependency of mediawiki/mediawiki-codesniffer.

The code is:

vendor/squizlabs/php_codesniffer/src/Files/File.php
 
1281             switch ($this->tokens[$i]['code']) {
...
1347             case T_COMMA:
1348                 // If it's null, then there must be no parameters for this
1349                 // method.
1350                 if ($currVar === null) {
1351                     continue;
1352                 }

There is a "continue" statement in a switch block which is a php 7.3 backward incompatibility. See https://www.php.net/manual/en/migration73.incompatible.php#migration73.incompatible.core.continue-targeting-switch

It should be filled as a task against PHP 7.3 support and MediaWiki-Codesniffer , though it might already have been.

Workboard for php7.3 https://phabricator.wikimedia.org/project/board/3494/

Reporting as suggested. Thanks.