Zend certified PHP/Magento developer

Syntax error on class name added to property declaration?

I’m using Magento 2.4.2-p1, Apache 2.4.54, php 7.4, and am getting a ParseError: syntax error when a class name is declared with a property declaration – is this expected? is there a work around?

From what I can tell you should be able to use a classname as of 7.4, and the same code is working in an nginx environment:

use MagentoCustomerApiDataGroupInterfaceFactory;
...
class CreateCustomerGroup
{
    protected GroupInterfaceFactory $groupFactory;

Thx for any insights –