Skip to content

Commit f78f7cb

Browse files
committed
fix type get information
1 parent a2783b2 commit f78f7cb

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/Service/ServiceInformationsTrait.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function getServiceInformations(ServiceIdentificator $service): Servic
4949
} catch (\Win32ServiceException $e) {
5050
$infos = $e->getCode();
5151
}
52-
$this->checkResponseAndConvertInExceptionIfNeed($infos, $service);
52+
$this->checkResponseAndConvertInExceptionIfNeed(\is_array($infos) ? null : $infos, $service);
5353

5454
if (!\is_array($infos)) {
5555
throw new ServiceStatusException('Error on read service status', $infos);
@@ -65,10 +65,10 @@ protected function getServiceInformations(ServiceIdentificator $service): Servic
6565
protected function checkResponseAndConvertInExceptionIfNeed(?int $value, ServiceIdentificator $service): void
6666
{
6767
if ($value === WIN32_ERROR_SERVICE_DOES_NOT_EXIST) {
68-
throw new ServiceNotFoundException('Service '.$service->serviceId().' is not found');
68+
throw new ServiceNotFoundException('Service ' . $service->serviceId() . ' is not found');
6969
}
7070
if ($value === WIN32_ERROR_ACCESS_DENIED) {
71-
throw new ServiceAccessDeniedException('Access to service '.$service->serviceId().' is denied');
71+
throw new ServiceAccessDeniedException('Access to service ' . $service->serviceId() . ' is denied');
7272
}
7373
}
7474

@@ -78,11 +78,12 @@ protected function checkResponseAndConvertInExceptionIfNeed(?int $value, Service
7878
protected function throwExceptionIfError(?int $value, string $exceptionClass, string $message): void
7979
{
8080
if (class_exists($exceptionClass) === false || is_a(
81-
$exceptionClass,
82-
Win32ServiceException::class,
83-
true
84-
) === false) {
85-
throw new Win32ServiceException(sprintf('Cannot throw object as it does not extend Exception or implement Throwable. Class provided "%s"', $exceptionClass));
81+
$exceptionClass,
82+
Win32ServiceException::class,
83+
true
84+
) === false) {
85+
throw new Win32ServiceException(sprintf('Cannot throw object as it does not extend Exception or implement Throwable. Class provided "%s"',
86+
$exceptionClass));
8687
}
8788

8889
if ($value !== null && $value !== WIN32_NO_ERROR) {

0 commit comments

Comments
 (0)