88use phpDocumentor \Reflection \DocBlockFactoryInterface ;
99use phpDocumentor \Reflection \Fqsen ;
1010use phpDocumentor \Reflection \Location ;
11+ use phpDocumentor \Reflection \Php \AsyncVisibility ;
1112use phpDocumentor \Reflection \Php \Class_ as ClassElement ;
1213use phpDocumentor \Reflection \Php \Factory \Reducer \Reducer ;
1314use phpDocumentor \Reflection \Php \ProjectFactoryStrategy ;
1415use phpDocumentor \Reflection \Php \Property ;
1516use phpDocumentor \Reflection \Php \StrategyContainer ;
1617use phpDocumentor \Reflection \Php \Visibility ;
18+ use PhpParser \Modifiers ;
1719use PhpParser \Node \Expr \Variable ;
1820use PhpParser \Node \Param ;
19- use PhpParser \Node \Stmt \Class_ ;
2021use PhpParser \Node \Stmt \ClassMethod ;
2122use PhpParser \PrettyPrinter \Standard as PrettyPrinter ;
2223use Webmozart \Assert \Assert ;
@@ -91,11 +92,36 @@ private function promoteParameterToProperty(ContextStack $context, StrategyConta
9192
9293 private function buildPropertyVisibilty (int $ flags ): Visibility
9394 {
94- if ((bool ) ($ flags & Class_::MODIFIER_PRIVATE ) === true ) {
95+ if ((bool ) ($ flags & Modifiers::VISIBILITY_SET_MASK ) !== false ) {
96+ return new AsyncVisibility (
97+ $ this ->buildReadVisibility ($ flags ),
98+ $ this ->buildWriteVisibility ($ flags ),
99+ );
100+ }
101+
102+ return $ this ->buildReadVisibility ($ flags );
103+ }
104+
105+ private function buildReadVisibility (int $ flags ): Visibility
106+ {
107+ if ((bool ) ($ flags & Modifiers::PRIVATE ) === true ) {
108+ return new Visibility (Visibility::PRIVATE_ );
109+ }
110+
111+ if ((bool ) ($ flags & Modifiers::PROTECTED ) === true ) {
112+ return new Visibility (Visibility::PROTECTED_ );
113+ }
114+
115+ return new Visibility (Visibility::PUBLIC_ );
116+ }
117+
118+ private function buildWriteVisibility (int $ flags ): Visibility
119+ {
120+ if ((bool ) ($ flags & Modifiers::PRIVATE_SET ) === true ) {
95121 return new Visibility (Visibility::PRIVATE_ );
96122 }
97123
98- if ((bool ) ($ flags & Class_:: MODIFIER_PROTECTED ) === true ) {
124+ if ((bool ) ($ flags & Modifiers:: PROTECTED_SET ) === true ) {
99125 return new Visibility (Visibility::PROTECTED_ );
100126 }
101127
@@ -104,6 +130,6 @@ private function buildPropertyVisibilty(int $flags): Visibility
104130
105131 private function readOnly (int $ flags ): bool
106132 {
107- return (bool ) ($ flags & Class_:: MODIFIER_READONLY ) === true ;
133+ return (bool ) ($ flags & Modifiers:: READONLY ) === true ;
108134 }
109135}
0 commit comments