- OS: macOS Big Sur
- PHP version: 7.4.1
- Package name and version: google/apiclient: ^2.12.3
Whenever I switch the PHP version to 7.4.1 I get this error
Parse error: syntax error, unexpected 'static' (T_STATIC) in /Users/webtechstreet4/Local Sites/fvtest/app/public/wp-content/plugins/form-vibes-pro/vendor/psr/cache/src/CacheItemInterface.php on line 75
The library works great on PHP 8 but gives the above error when switching to PHP 7.
Screenshot
2
Answers
Actually, I sorted it out by changing the system PHP version and running
composer update
. I thought I needed to change the site PHP version but it was actually the system PHP version.here is the GitHub issue link: https://github.com/googleapis/google-api-php-client/issues/2246
it is because, static return type is available only for PHP 8, I have same issue, just for temporary you can change
.vendorpsrcachesrcCacheItemInterface.php
line number 75 just remove return type static like this
public function set($value);