mirror of
https://github.com/protocolbuffers/protobuf
synced 2026-08-26 02:23:14 -04:00
This PR does the following:
* Special-case descriptor.proto to allow for codegen despite being proto2
* Fix a pre-existing bug that gets exercised now during descriptor builds
* Expand test coverage of conformance tests, and fix pre-existing issues
* Properly hook up gencode to staleness infrastructure for automated regen
Closes #18610
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/18610 from protocolbuffers:php-regen 773a1bf01a
PiperOrigin-RevId: 682477438
25 lines
879 B
PHP
25 lines
879 B
PHP
<?php
|
|
|
|
define("GOOGLE_INTERNAL_NAMESPACE", "Google\\Protobuf\\Internal\\");
|
|
define("GOOGLE_NAMESPACE", "Google\\Protobuf\\");
|
|
define("GOOGLE_GPBMETADATA_NAMESPACE", "GPBMetadata\\Google\\Protobuf\\");
|
|
|
|
function protobuf_autoloader_impl($class, $prefix) {
|
|
$length = strlen($prefix);
|
|
if ((substr($class, 0, $length) === $prefix)) {
|
|
$path = 'src/' . implode('/', array_map('ucwords', explode('\\', $class))) . '.php';
|
|
if (file_exists('php/' . $path)) {
|
|
include_once 'php/' . $path;
|
|
} else {
|
|
include_once 'php/generated/' . $path;
|
|
}
|
|
}
|
|
}
|
|
|
|
function protobuf_autoloader($class) {
|
|
protobuf_autoloader_impl($class, GOOGLE_INTERNAL_NAMESPACE);
|
|
protobuf_autoloader_impl($class, GOOGLE_NAMESPACE);
|
|
protobuf_autoloader_impl($class, GOOGLE_GPBMETADATA_NAMESPACE);
|
|
}
|
|
|
|
spl_autoload_register('protobuf_autoloader');
|