It seems your php version does not parse correctly Nullable types (such as that ?PathValidatorInterface
), which were introduced in php7.1 http://php.net/manual/en/migration71.new-features.php
public function __construct(
\Magento\Framework\Filesystem\File\WriteFactory $fileFactory,
\Magento\Framework\Filesystem\DriverInterface $driver,
$path,
$createPermissions = null,
?PathValidatorInterface $pathValidator = null
) {
parent::__construct($fileFactory, $driver, $path, $pathValidator);
if (null !== $createPermissions) {
$this->permissions = $createPermissions;
}
}
Double check your php version in command line, as it does not seem to be 7.2
It is not rare to have more than 1 php version installed, for instance https://stackoverflow.com/a/50591861/1073040