Add extension version and env check method (#458)

This commit is contained in:
Jerry Ma
2024-05-21 14:56:54 +08:00
committed by GitHub
parent 11076b1355
commit 4ba92b08ca
4 changed files with 29 additions and 8 deletions

View File

@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\util\CustomExt;
#[CustomExt('protobuf')]
class protobuf extends Extension
{
public function validate(): void
{
if ($this->builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
throw new \RuntimeException('The latest protobuf extension requires PHP 8.0 or later');
}
}
}