title: Composer not working after specifying platform php version
body: <p>I am working on a project for a WebApp and I would like to specify types for my class properties. I didn't realise this is a PHP version 7.4.* feature, so I read <a href="https://andy-carter.com/blog/composer-php-platform" rel="nofollow noreferrer">this</a> and updated my <code>composer.json</code> to include the relevant material:</p>
  
  <pre><code>{
      "name": "srmes/shopping-app-test",
      "description": "an assignment from `scandiweb.com`. A simple php-based web application to display and inventory a range of products",
      "require-dev":  {
          "phpunit/phpunit":"~9.0",
          "squizlabs/php_codesniffer": "~3.0"
      },
      "require": {
          "doctrine/orm": "~2.7",
          "php": "7.4.4"
      },
      "config": {
          "platform": {
              "php": "7.4.4"
          }
      },
      "autoload" : {
          "psr-4": {
              "WebApp\\": "src/"
           }
      },
      "autoload-dev" : {
          "psr-4": {
              "WebApp\\Tests\\" : "tests/"
          }
      }
  }
  </code></pre>
  
  <p>I then ran <code>composer install</code> and <code>composer update</code>.</p>
  
  <p>No problems seemed to occur with the install, except that now my phpunit tests don't run:</p>
  
  <pre><code>PHPUnit 9.1.1 by Sebastian Bergmann and contributors.
  
  
  
  Time: 58 ms, Memory: 4.00 MB
  
  No tests executed!
  </code></pre>
  
  <p>And all <code>composer</code> commands give the following error:</p>
  
  <pre><code>Parse error: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /Users/ScottAnderson/Documents/Tech/commissions/shopping_app_test/vendor/ocramius/package-versions/src/PackageVersions/Installer.php on line 33
  </code></pre>
  
  <p>Ironically this is syntax exception about the php feature I was trying to utilise! I can't even run <code>composer -vvv</code> to debug which php executable is being used by composer.</p>
  
  <p>In order to resolve this should I use a package like <a href="https://github.com/phpbrew/phpbrew" rel="nofollow noreferrer">phpbrew</a> to make directory environments of php? </p>
  
  <p>My assumption was that after requiring php 7.4.4 in <code>composer.json</code> that the correct php executable would be installed and used by composer and phpunit</p>