@@ -2757,43 +2757,41 @@ public function getClassSynopsisElement(DOMDocument $doc, array $classMap, itera
27572757 "&InheritedProperties; "
27582758 );
27592759
2760- $ isConcreteClassWithoutParentConstructor = $ this ->isConcreteClassWithoutParentConstructor ($ classMap );
2761-
2762- if ($ isConcreteClassWithoutParentConstructor || !empty ($ this ->funcInfos )) {
2760+ if (!empty ($ this ->funcInfos )) {
27632761 $ classSynopsis ->appendChild (new DOMText ("\n\n " ));
27642762 $ classSynopsisInfo = $ doc ->createElement ("classsynopsisinfo " , "&Methods; " );
27652763 $ classSynopsisInfo ->setAttribute ("role " , "comment " );
27662764 $ classSynopsis ->appendChild ($ classSynopsisInfo );
2767- }
27682765
2769- $ classReference = self ::getClassSynopsisReference ($ this ->name );
2770- $ escapedName = addslashes ($ this ->name ->__toString ());
2766+ $ classReference = self ::getClassSynopsisReference ($ this ->name );
2767+ $ escapedName = addslashes ($ this ->name ->__toString ());
27712768
2772- if ( $ isConcreteClassWithoutParentConstructor || $ this ->hasConstructor ()) {
2773- $ classSynopsis ->appendChild (new DOMText ("\n " ));
2774- $ includeElement = $ this ->createIncludeElement (
2775- $ doc ,
2776- "xmlns(db=http://docbook.org/ns/docbook) xpointer(id(' $ classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role=' $ escapedName']) "
2777- );
2778- $ classSynopsis ->appendChild ($ includeElement );
2779- }
2769+ if ( $ this ->hasConstructor ()) {
2770+ $ classSynopsis ->appendChild (new DOMText ("\n " ));
2771+ $ includeElement = $ this ->createIncludeElement (
2772+ $ doc ,
2773+ "xmlns(db=http://docbook.org/ns/docbook) xpointer(id(' $ classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role=' $ escapedName']) "
2774+ );
2775+ $ classSynopsis ->appendChild ($ includeElement );
2776+ }
27802777
2781- if ($ this ->hasMethods ()) {
2782- $ classSynopsis ->appendChild (new DOMText ("\n " ));
2783- $ includeElement = $ this ->createIncludeElement (
2784- $ doc ,
2785- "xmlns(db=http://docbook.org/ns/docbook) xpointer(id(' $ classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role=' $ escapedName']) "
2786- );
2787- $ classSynopsis ->appendChild ($ includeElement );
2788- }
2778+ if ($ this ->hasMethods ()) {
2779+ $ classSynopsis ->appendChild (new DOMText ("\n " ));
2780+ $ includeElement = $ this ->createIncludeElement (
2781+ $ doc ,
2782+ "xmlns(db=http://docbook.org/ns/docbook) xpointer(id(' $ classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role=' $ escapedName']) "
2783+ );
2784+ $ classSynopsis ->appendChild ($ includeElement );
2785+ }
27892786
2790- if ($ this ->hasDestructor ()) {
2791- $ classSynopsis ->appendChild (new DOMText ("\n " ));
2792- $ includeElement = $ this ->createIncludeElement (
2793- $ doc ,
2794- "xmlns(db=http://docbook.org/ns/docbook) xpointer(id(' $ classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:destructorsynopsis[@role=' $ escapedName']) "
2795- );
2796- $ classSynopsis ->appendChild ($ includeElement );
2787+ if ($ this ->hasDestructor ()) {
2788+ $ classSynopsis ->appendChild (new DOMText ("\n " ));
2789+ $ includeElement = $ this ->createIncludeElement (
2790+ $ doc ,
2791+ "xmlns(db=http://docbook.org/ns/docbook) xpointer(id(' $ classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:destructorsynopsis[@role=' $ escapedName']) "
2792+ );
2793+ $ classSynopsis ->appendChild ($ includeElement );
2794+ }
27972795 }
27982796
27992797 if (!empty ($ parentsWithInheritedMethods )) {
@@ -2826,31 +2824,6 @@ public function getClassSynopsisElement(DOMDocument $doc, array $classMap, itera
28262824 return $ classSynopsis ;
28272825 }
28282826
2829- /**
2830- * @param array<string, ClassInfo> $classMap
2831- */
2832- public function getNonExistentDefaultConstructorForManual (array $ classMap ): ?FuncInfo {
2833- if (!$ this ->isConcreteClassWithoutParentConstructor ($ classMap ) || $ this ->hasConstructor ()) {
2834- return null ;
2835- }
2836-
2837- return new FuncInfo (
2838- new MethodName ($ this ->name , "__construct " ),
2839- $ this ->flags ,
2840- 0 ,
2841- null ,
2842- null ,
2843- false ,
2844- false ,
2845- true ,
2846- [],
2847- new ReturnInfo (false , null , null , false , null ),
2848- 0 ,
2849- null ,
2850- false
2851- );
2852- }
2853-
28542827 private static function createOoElement (
28552828 DOMDocument $ doc ,
28562829 ClassInfo $ classInfo ,
@@ -3031,13 +3004,6 @@ private function hasMethods(): bool
30313004 return false ;
30323005 }
30333006
3034- /**
3035- * @param array<string, ClassInfo> $classMap
3036- */
3037- private function isConcreteClassWithoutParentConstructor (array $ classMap ) {
3038- return $ this ->type === "class " && !($ this ->flags & Class_::MODIFIER_ABSTRACT ) && !$ this ->hasParentConstructor ($ classMap );
3039- }
3040-
30413007 private function createIncludeElement (DOMDocument $ doc , string $ query ): DOMElement
30423008 {
30433009 $ includeElement = $ doc ->createElement ("xi:include " );
@@ -3115,18 +3081,6 @@ public function getAllFuncInfos(): iterable {
31153081 }
31163082 }
31173083
3118- /**
3119- * @return array<string, ClassInfo> $classMap
3120- */
3121- public function getAllNonExistentDefaultConstructorsForManual (array $ classMap ): iterable {
3122- foreach ($ this ->classInfos as $ classInfo ) {
3123- $ funcInfo = $ classInfo ->getNonExistentDefaultConstructorForManual ($ classMap );
3124- if ($ funcInfo !== null ) {
3125- yield $ funcInfo ;
3126- }
3127- }
3128- }
3129-
31303084 /**
31313085 * @return iterable<ConstInfo>
31323086 */
@@ -4792,15 +4746,6 @@ function initPhpParser() {
47924746 }
47934747}
47944748
4795- /** @var array<string, FuncInfo> $funcMapForManual */
4796- $ funcMapForManual = $ funcMap ;
4797-
4798- foreach ($ fileInfos as $ fileInfo ) {
4799- foreach ($ fileInfo ->getAllNonExistentDefaultConstructorsForManual ($ classMap ) as $ funcInfo ) {
4800- $ funcMapForManual [$ funcInfo ->name ->__toString ()] = $ funcInfo ;
4801- }
4802- }
4803-
48044749if ($ verify ) {
48054750 $ errors = [];
48064751
@@ -4916,7 +4861,7 @@ function(?ArgInfo $aliasArg, ?ArgInfo $aliasedArg) use ($aliasFunc, $aliasedFunc
49164861if ($ generateMethodSynopses ) {
49174862 $ methodSynopsesDirectory = getcwd () . "/methodsynopses " ;
49184863
4919- $ methodSynopses = generateMethodSynopses ($ funcMapForManual , $ aliasMap );
4864+ $ methodSynopses = generateMethodSynopses ($ funcMap , $ aliasMap );
49204865 if (!empty ($ methodSynopses )) {
49214866 if (!file_exists ($ methodSynopsesDirectory )) {
49224867 mkdir ($ methodSynopsesDirectory );
@@ -4931,7 +4876,7 @@ function(?ArgInfo $aliasArg, ?ArgInfo $aliasedArg) use ($aliasFunc, $aliasedFunc
49314876}
49324877
49334878if ($ replaceMethodSynopses ) {
4934- $ methodSynopses = replaceMethodSynopses ($ targetSynopses , $ funcMapForManual , $ aliasMap , $ verify );
4879+ $ methodSynopses = replaceMethodSynopses ($ targetSynopses , $ funcMap , $ aliasMap , $ verify );
49354880
49364881 foreach ($ methodSynopses as $ filename => $ content ) {
49374882 if (file_put_contents ($ filename , $ content )) {
0 commit comments