I am trying to upgrade Magento version from 2.3.0 to 2.3.1 and I am using PHP 7.2 for same but while I run upgrade command getting bellow error is anyone have any idea how to fix?
 Parse error: syntax error, unexpected ':', expecting ';' or '{' in /vendor/magento/inventory-composer-installer/src/Plugin.php on line 55
 Warning: Unsupported declare 'strict_types' in /vendor/magento/inventory-composer-installer/src/Plugin.php on line 6
 Parse error: syntax error, unexpected ':', expecting ';' or '{' in /vendor/magento/inventory-composer-installer/src/Plugin.php on line 55
2 Answers 2
Magento does not require PHP 7.2 since 2.3.1 release, PHP 7.1.3 and later still supported. https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html
in your case, the system has a fatal error encountering void return type
https://github.com/magento-engcom/inventory-composer-installer/blob/master/src/Plugin.php#L55 
Which is added since PHP 7.1 release - https://www.php.net/manual/en/migration71.new-features.php
it was due to a server issue, when I run composer update command it taking wrong PHP version due to some server configuration. so I just download composer.phar file for run composer update using PHP version and it worked. for me, bellow command working php composer.phar update
Magento 2.3.1 required php 7.1 version if version is less then php 7.1 then it give error in my case default php version was 5.6 something so it giving error
php -v?