File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ ext-protobuf :
2+ type : php-extension
3+ artifact :
4+ source :
5+ type : pecl
6+ name : protobuf
7+ metadata :
8+ license-files : [LICENSE]
9+ license : BSD-3-Clause
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Package \Extension ;
6+
7+ use Package \Target \php ;
8+ use StaticPHP \Attribute \Package \Extension ;
9+ use StaticPHP \Attribute \Package \Validate ;
10+ use StaticPHP \Exception \ValidationException ;
11+ use StaticPHP \Package \PackageInstaller ;
12+
13+ #[Extension('protobuf ' )]
14+ class protobuf
15+ {
16+ #[Validate]
17+ public function validate (PackageInstaller $ installer ): void
18+ {
19+ if (php::getPHPVersionID () < 80000 && getenv ('SPC_SKIP_PHP_VERSION_CHECK ' ) !== 'yes ' ) {
20+ throw new ValidationException ('The latest protobuf extension requires PHP 8.0 or later ' );
21+ }
22+ $ grpc = $ installer ->getPhpExtensionPackage ('ext-grpc ' );
23+ // protobuf conflicts with grpc
24+ if ($ grpc ?->isBuildStatic()) {
25+ throw new ValidationException ('protobuf conflicts with grpc, please remove grpc or protobuf extension ' );
26+ }
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments