2727use Neos \Flow \Aop \JoinPointInterface ;
2828use Neos \Flow \ResourceManagement \PersistentResource ;
2929use Neos \Media \Domain \Model \AssetInterface ;
30- use Neos \Utility \ObjectAccess ;
30+ use Psr \Http \Message \ResponseInterface ;
31+ use Psr \Http \Message \StreamInterface ;
3132
3233#[Flow \Scope('singleton ' )]
3334#[Flow \Aspect]
@@ -73,18 +74,18 @@ public function debuggingActive(): void
7374 }
7475
7576 #[Flow \Around("method(Neos\Neos\View\FusionView->render()) && Flowpack\Neos\Debug\Aspect\CollectDebugInformationAspect->debuggingActive " )]
76- public function addDebugValuesToNeosFusionView (JoinPointInterface $ joinPoint ): string |Response
77+ public function addDebugValuesToNeosFusionView (JoinPointInterface $ joinPoint ): string |ResponseInterface | StreamInterface
7778 {
7879 return $ this ->addDebugValues ($ joinPoint );
7980 }
8081
8182 #[Flow \Around("method(Neos\Fusion\View\FusionView->render()) && Flowpack\Neos\Debug\Aspect\CollectDebugInformationAspect->debuggingActive " )]
82- public function addDebugValuesToDefaultFusionView (JoinPointInterface $ joinPoint ): string |Response
83+ public function addDebugValuesToDefaultFusionView (JoinPointInterface $ joinPoint ): string |ResponseInterface | StreamInterface
8384 {
8485 return $ this ->addDebugValues ($ joinPoint );
8586 }
8687
87- protected function addDebugValues (JoinPointInterface $ joinPoint ): string |Response
88+ protected function addDebugValues (JoinPointInterface $ joinPoint ): string |ResponseInterface | StreamInterface
8889 {
8990 $ startRenderAt = microtime (true ) * 1000 ;
9091 $ response = $ joinPoint ->getAdviceChain ()->proceed ($ joinPoint );
@@ -107,7 +108,7 @@ protected function addDebugValues(JoinPointInterface $joinPoint): string|Respons
107108 return $ response ;
108109 }
109110
110- if ($ response instanceof Response ) {
111+ if ($ response instanceof ResponseInterface ) {
111112 $ output = $ response ->getBody ()?->getContents();
112113 $ response ->getBody ()?->rewind();
113114
@@ -145,7 +146,7 @@ protected function addDebugValues(JoinPointInterface $joinPoint): string|Respons
145146 $ this ->contentContextMetricsCollector ->getName () => $ this ->contentContextMetricsCollector ->collect (),
146147 ]
147148 ];
148-
149+ $ output = ( string ) $ output ;
149150 $ debugOutput = '<!--__NEOS_DEBUG__ ' . json_encode ($ data ) . '--> ' ;
150151 $ htmlEndPosition = strpos ($ output , '</html> ' );
151152
@@ -158,6 +159,11 @@ protected function addDebugValues(JoinPointInterface $joinPoint): string|Respons
158159 if ($ response instanceof Response) {
159160 return $ response ->withBody (Utils::streamFor ($ output ));
160161 }
162+
163+ if ($ response instanceof StreamInterface) {
164+ return Utils::streamFor ($ output );
165+ }
166+
161167 return $ output ;
162168 }
163169
0 commit comments