@@ -274,10 +274,15 @@ public function test_default_error_handler_is_error_log(): void
274274 {
275275 $ config = Configuration::fromParameters (ParameterCollection::fromArray ([]));
276276
277- static ::assertInstanceOf (ErrorLogHandlerConfig::class, $ config ->errorHandler );
278- static ::assertSame (ErrorLogMessageType::OperatingSystem, $ config ->errorHandler ->messageType );
279- static ::assertFalse ($ config ->errorHandler ->expandNewlines );
280- static ::assertSame (Configuration::DEFAULT_MESSAGE_PREFIX , $ config ->errorHandler ->messagePrefix );
277+ $ errorHandler = $ config ->errorHandler ;
278+
279+ if (!$ errorHandler instanceof ErrorLogHandlerConfig) {
280+ static ::fail ('Expected ErrorLogHandlerConfig, got ' . $ errorHandler ::class);
281+ }
282+
283+ static ::assertSame (ErrorLogMessageType::OperatingSystem, $ errorHandler ->messageType );
284+ static ::assertFalse ($ errorHandler ->expandNewlines );
285+ static ::assertSame (Configuration::DEFAULT_MESSAGE_PREFIX , $ errorHandler ->messagePrefix );
281286 }
282287
283288 public function test_emit_flags_can_be_disabled (): void
@@ -503,10 +508,15 @@ public function test_error_log_handler_options_parsed(): void
503508 'error_handler_message_prefix ' => '[custom] ' ,
504509 ]));
505510
506- static ::assertInstanceOf (ErrorLogHandlerConfig::class, $ config ->errorHandler );
507- static ::assertSame (ErrorLogMessageType::Sapi, $ config ->errorHandler ->messageType );
508- static ::assertTrue ($ config ->errorHandler ->expandNewlines );
509- static ::assertSame ('[custom] ' , $ config ->errorHandler ->messagePrefix );
511+ $ errorHandler = $ config ->errorHandler ;
512+
513+ if (!$ errorHandler instanceof ErrorLogHandlerConfig) {
514+ static ::fail ('Expected ErrorLogHandlerConfig, got ' . $ errorHandler ::class);
515+ }
516+
517+ static ::assertSame (ErrorLogMessageType::Sapi, $ errorHandler ->messageType );
518+ static ::assertTrue ($ errorHandler ->expandNewlines );
519+ static ::assertSame ('[custom] ' , $ errorHandler ->messagePrefix );
510520 }
511521
512522 public function test_grpc_headers_parsed (): void
@@ -725,11 +735,16 @@ public function test_stream_error_handler_parsed(): void
725735 'error_handler_message_prefix ' => '[telemetry] ' ,
726736 ]));
727737
728- static ::assertInstanceOf (StreamErrorHandlerConfig::class, $ config ->errorHandler );
729- static ::assertSame ('/tmp/flow-telemetry.log ' , $ config ->errorHandler ->destination );
730- static ::assertSame (0o640 , $ config ->errorHandler ->filePermissions );
731- static ::assertFalse ($ config ->errorHandler ->createDirectories );
732- static ::assertSame ('[telemetry] ' , $ config ->errorHandler ->messagePrefix );
738+ $ errorHandler = $ config ->errorHandler ;
739+
740+ if (!$ errorHandler instanceof StreamErrorHandlerConfig) {
741+ static ::fail ('Expected StreamErrorHandlerConfig, got ' . $ errorHandler ::class);
742+ }
743+
744+ static ::assertSame ('/tmp/flow-telemetry.log ' , $ errorHandler ->destination );
745+ static ::assertSame (0o640 , $ errorHandler ->filePermissions );
746+ static ::assertFalse ($ errorHandler ->createDirectories );
747+ static ::assertSame ('[telemetry] ' , $ errorHandler ->messagePrefix );
733748 }
734749
735750 public function test_stream_error_handler_rejects_syslog_params (): void
@@ -837,11 +852,16 @@ public function test_syslog_error_handler_parsed(): void
837852 'error_handler_severity ' => 'warning ' ,
838853 ]));
839854
840- static ::assertInstanceOf (SyslogErrorHandlerConfig::class, $ config ->errorHandler );
841- static ::assertSame ('flow-test ' , $ config ->errorHandler ->ident );
842- static ::assertSame (SyslogFacility::Local3, $ config ->errorHandler ->facility );
843- static ::assertSame (5 , $ config ->errorHandler ->logOpts );
844- static ::assertSame (SyslogSeverity::Warning, $ config ->errorHandler ->severity );
855+ $ errorHandler = $ config ->errorHandler ;
856+
857+ if (!$ errorHandler instanceof SyslogErrorHandlerConfig) {
858+ static ::fail ('Expected SyslogErrorHandlerConfig, got ' . $ errorHandler ::class);
859+ }
860+
861+ static ::assertSame ('flow-test ' , $ errorHandler ->ident );
862+ static ::assertSame (SyslogFacility::Local3, $ errorHandler ->facility );
863+ static ::assertSame (5 , $ errorHandler ->logOpts );
864+ static ::assertSame (SyslogSeverity::Warning, $ errorHandler ->severity );
845865 }
846866
847867 public function test_udp_syslog_error_handler_parsed (): void
@@ -855,12 +875,17 @@ public function test_udp_syslog_error_handler_parsed(): void
855875 'error_handler_severity ' => 'info ' ,
856876 ]));
857877
858- static ::assertInstanceOf (UdpSyslogErrorHandlerConfig::class, $ config ->errorHandler );
859- static ::assertSame ('192.0.2.1 ' , $ config ->errorHandler ->host );
860- static ::assertSame (5140 , $ config ->errorHandler ->port );
861- static ::assertSame ('flow-remote ' , $ config ->errorHandler ->ident );
862- static ::assertSame (SyslogFacility::Mail, $ config ->errorHandler ->facility );
863- static ::assertSame (SyslogSeverity::Info, $ config ->errorHandler ->severity );
878+ $ errorHandler = $ config ->errorHandler ;
879+
880+ if (!$ errorHandler instanceof UdpSyslogErrorHandlerConfig) {
881+ static ::fail ('Expected UdpSyslogErrorHandlerConfig, got ' . $ errorHandler ::class);
882+ }
883+
884+ static ::assertSame ('192.0.2.1 ' , $ errorHandler ->host );
885+ static ::assertSame (5140 , $ errorHandler ->port );
886+ static ::assertSame ('flow-remote ' , $ errorHandler ->ident );
887+ static ::assertSame (SyslogFacility::Mail, $ errorHandler ->facility );
888+ static ::assertSame (SyslogSeverity::Info, $ errorHandler ->severity );
864889 }
865890
866891 public function test_udp_syslog_error_handler_requires_host (): void
0 commit comments