@@ -2728,9 +2728,8 @@ private function getClassConstDeclaration(EvaluatedValue $value, array $allConst
27282728
27292729 if ($ this ->exposedDocComment ) {
27302730 $ 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" ;
27342733 } else {
27352734 $ commentCode = "NULL " ;
27362735 }
@@ -3056,9 +3055,8 @@ public function getDeclaration(array $allConstInfos): string {
30563055
30573056 if ($ this ->exposedDocComment ) {
30583057 $ 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" ;
30623060 } else {
30633061 $ commentCode = "NULL " ;
30643062 }
@@ -3450,7 +3448,7 @@ public function getRegistration(array $allConstInfos): string
34503448 $ code .= "#if (PHP_VERSION_ID >= " . PHP_84_VERSION_ID . ") \n" ;
34513449 }
34523450
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" ;
34543452
34553453 if (!$ php84MinimumCompatibility ) {
34563454 $ code .= "#endif \n" ;
@@ -4278,8 +4276,8 @@ public function escape(): string {
42784276 return str_replace ("\n" , '\n ' , addslashes ($ this ->docComment ));
42794277 }
42804278
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); " ;
42834281 }
42844282
42854283 /** @param array<int, DocComment> $comments */
0 commit comments