Skip to content

Commit b190bce

Browse files
committed
Dummy
1 parent 7777939 commit b190bce

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

build/gen_stub.php

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3283,15 +3283,7 @@ public function getRegistration(array $allConstInfos): string
32833283
$code .= "{\n";
32843284

32853285
$flagCodes = generateVersionDependentFlagCode("%s", $this->getFlagsByPhpVersion(), $this->phpVersionIdMinimumCompatibility);
3286-
if (count($flagCodes) > 1) {
3287-
// If we have more than one entry, there will be preprocessor conditions,
3288-
// thus we need to start with a newline.
3289-
$flags = "\n" . implode("\n", $flagCodes);
3290-
} else if (count($flagCodes) === 1) {
3291-
$flags = " " . $flagCodes[0];
3292-
} else {
3293-
$flags = "";
3294-
}
3286+
$flags = implode("", $flagCodes);
32953287

32963288
$classMethods = ($this->funcInfos === []) ? 'NULL' : "class_{$escapedName}_methods";
32973289
if ($this->type === "enum") {
@@ -3300,7 +3292,7 @@ public function getRegistration(array $allConstInfos): string
33003292
? $this->enumBackingType->toTypeCode() : "IS_UNDEF";
33013293
$code .= "\tzend_class_entry *class_entry = zend_register_internal_enum(\"$name\", $backingType, $classMethods);\n";
33023294
if ($flags !== "") {
3303-
$code .= "\tclass_entry->ce_flags |=$flags\n";
3295+
$code .= "\tclass_entry->ce_flags |= $flags\n";
33043296
}
33053297
} else {
33063298
$code .= "\tzend_class_entry ce, *class_entry;\n\n";
@@ -3318,21 +3310,21 @@ public function getRegistration(array $allConstInfos): string
33183310
$code .= "#if (PHP_VERSION_ID >= " . PHP_84_VERSION_ID . ")\n";
33193311
}
33203312

3321-
$code .= "\tclass_entry = zend_register_internal_class_with_flags(&ce, " . (isset($this->extends[0]) ? "class_entry_" . str_replace("\\", "_", $this->extends[0]->toString()) : "NULL") . "," . ($flags ?: " 0") . ");\n";
3313+
$code .= "\tclass_entry = zend_register_internal_class_with_flags(&ce, " . (isset($this->extends[0]) ? "class_entry_" . str_replace("\\", "_", $this->extends[0]->toString()) : "NULL") . ", " . ($flags ?: 0) . ");\n";
33223314

33233315
if (!$php84MinimumCompatibility) {
33243316
$code .= "#else\n";
33253317

33263318
$code .= "\tclass_entry = zend_register_internal_class_ex(&ce, " . (isset($this->extends[0]) ? "class_entry_" . str_replace("\\", "_", $this->extends[0]->toString()) : "NULL") . ");\n";
33273319
if ($flags !== "") {
3328-
$code .= "\tclass_entry->ce_flags |=$flags;\n";
3320+
$code .= "\tclass_entry->ce_flags |= $flags;\n";
33293321
}
33303322
$code .= "#endif\n";
33313323
}
33323324
} else {
33333325
$code .= "\tclass_entry = zend_register_internal_interface(&ce);\n";
33343326
if ($flags !== "") {
3335-
$code .= "\tclass_entry->ce_flags |=$flags\n";
3327+
$code .= "\tclass_entry->ce_flags |= $flags\n";
33363328
}
33373329
}
33383330
}
@@ -5399,16 +5391,12 @@ static function (array $value): bool {
53995391
$code = "";
54005392

54015393
$if = $i === 0 ? "#if" : "#elif";
5394+
$endif = $i === $flagCount - 1 ? "#endif\n" : "";
54025395

54035396
$code .= "$if (PHP_VERSION_ID >= $version)\n";
54045397

54055398
$code .= sprintf($codeTemplate, implode("|", $versionFlags));
5406-
if ($i === $flagCount - 1) {
5407-
if (!str_ends_with($code, "\n")) {
5408-
$code .= "\n";
5409-
}
5410-
$code .= "#endif\n";
5411-
}
5399+
$code .= $endif;
54125400

54135401
$result[] = $code;
54145402
$i++;

0 commit comments

Comments
 (0)