AlexaCRM / dynamics-webapi-toolkit

Dynamics 365 Web API Toolkit for PHP
MIT License
77 stars 58 forks source link

PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in /var/www/clients/client1/web498/web/templates/tx_morph/includes/vendor/alexacrm/dynamics-webapi-toolkit/src/WebAPI/ClientFactory.php on line 50 #35

Closed grunam closed 4 years ago

grunam commented 4 years ago

Hi,

My PHP version is 7.4. When i try to connect I have a php error.

php code => $client = \AlexaCRM\WebAPI\ClientFactory::createOnlineClient( $api, $clientIdApplication, $clientSecretKey );

Output => PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in /var/www/clients/client1/web498/web/templates/tx_morph/includes/vendor/alexacrm/dynamics-webapi-toolkit/src/WebAPI/ClientFactory.php on line 50

My visual studio code editor highlights ): Client { in the code below

`public static function createOnlineClient( string $instanceURI, string $applicationID, string $applicationSecret, array $services = [] ): Client { $settings = new OnlineSettings(); $settings->instanceURI = $instanceURI; $settings->applicationID = $applicationID; $settings->applicationSecret = $applicationSecret;

    if ( isset ( $services['logger'] ) && $services['logger'] instanceof LoggerInterface ) {
        $settings->setLogger( $services['logger'] );
    }
    if ( isset ( $services['cachePool'] ) && $services['cachePool'] instanceof CacheItemPoolInterface ) {
        $settings->cachePool = $services['cachePool'];
    }

    $middleware = new OnlineAuthMiddleware( $settings );
    $odataClient = new OData\Client( $settings, $middleware );

    return new Client( $odataClient );
}

}`

Could you help me please.

georged commented 4 years ago

@grunam

return type covariance is definitely in php 7.4

HTH George