How to resolve "PHP requirement incompatible with your PHP version (7.0.8)" error message in Pantheon?

Submitted by galactus on Sat, 02/08/2020 - 21:01

I was updating one of my modules and then I encountered this error message.

InvalidArgumentException

This error message means that the module is incompatible to PHP 7.0.8. When I saw this message first thing comes in my mind is why I'm getting this error message? I have higher PHP version in my local machine than this PHP version. Then I realize there might be a PHP version hardcoded on my composer.json file, I checked my composer.json file and at the bottom of the file there's a PHP version hardcoded.

"config": {
  "optimize-autoloader": true,
   "preferred-install": "dist",
   "sort-packages": true,
     "platform": {
       "php": "7.0.8"
     }
}

In the platform section the PHP version is set to PHP 7.0.8.

To resolve the error message just update the version of PHP and match it with the current PHP version of your Live environment.

After that update your module again.

update module

And that's it you should have the latest version of your module.