@@ -2728,9 +2728,8 @@ private function getClassConstDeclaration(EvaluatedValue $value, array $allConst
2728
2728
2729
2729
if ($ this ->exposedDocComment ) {
2730
2730
$ commentCode = "const_ {$ constName }_comment " ;
2731
- $ escapedComment = $ this ->exposedDocComment ->escape ();
2732
- $ escapedCommentLength = $ this ->exposedDocComment ->getLength ();
2733
- $ code .= "\tzend_string * $ commentCode = zend_string_init_interned( \"$ escapedComment \", $ escapedCommentLength, 1); \n" ;
2731
+ $ escapedCommentInit = $ this ->exposedDocComment ->getInitCode ();
2732
+ $ code .= "\tzend_string * $ commentCode = $ escapedCommentInit \n" ;
2734
2733
} else {
2735
2734
$ commentCode = "NULL " ;
2736
2735
}
@@ -3056,9 +3055,8 @@ public function getDeclaration(array $allConstInfos): string {
3056
3055
3057
3056
if ($ this ->exposedDocComment ) {
3058
3057
$ commentCode = "property_ {$ propertyName }_comment " ;
3059
- $ escapedComment = $ this ->exposedDocComment ->escape ();
3060
- $ escapedCommentLength = $ this ->exposedDocComment ->getLength ();
3061
- $ code .= "\tzend_string * $ commentCode = zend_string_init_interned( \"$ escapedComment \", $ escapedCommentLength, 1); \n" ;
3058
+ $ escapedCommentInit = $ this ->exposedDocComment ->getInitCode ();
3059
+ $ code .= "\tzend_string * $ commentCode = $ escapedCommentInit \n" ;
3062
3060
} else {
3063
3061
$ commentCode = "NULL " ;
3064
3062
}
@@ -3450,7 +3448,7 @@ public function getRegistration(array $allConstInfos): string
3450
3448
$ code .= "#if (PHP_VERSION_ID >= " . PHP_84_VERSION_ID . ") \n" ;
3451
3449
}
3452
3450
3453
- $ code .= "\tclass_entry->doc_comment = zend_string_init_interned( \"" . $ this ->exposedDocComment ->escape () . "\" , " . $ this -> exposedDocComment -> getLength () . " , 1); \n" ;
3451
+ $ code .= "\tclass_entry->doc_comment = " . $ this ->exposedDocComment ->getInitCode () . "\n" ;
3454
3452
3455
3453
if (!$ php84MinimumCompatibility ) {
3456
3454
$ code .= "#endif \n" ;
@@ -4278,8 +4276,8 @@ public function escape(): string {
4278
4276
return str_replace ("\n" , '\n ' , addslashes ($ this ->docComment ));
4279
4277
}
4280
4278
4281
- public function getLength (): int {
4282
- return strlen ($ this ->docComment );
4279
+ public function getInitCode (): string {
4280
+ return " zend_string_init_interned( \"" . $ this -> escape () . "\" , " . strlen ($ this ->docComment ) . " , 1); " ;
4283
4281
}
4284
4282
4285
4283
/** @param array<int, DocComment> $comments */
0 commit comments