diff --git a/lib/Activity/Provider.php b/lib/Activity/Provider.php index 6782a791..9cda792e 100644 --- a/lib/Activity/Provider.php +++ b/lib/Activity/Provider.php @@ -48,7 +48,7 @@ public function __construct(IFactory $languageFactory, IURLGenerator $urlGenerat $this->urlGenerator = $urlGenerator; } - public function parse($language, IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== Application::APP_NAME || $event->getType() !== self::TYPE_VIRUS_DETECTED) { throw new \InvalidArgumentException(); } diff --git a/lib/AvirWrapper.php b/lib/AvirWrapper.php index 74138f05..04fe887a 100644 --- a/lib/AvirWrapper.php +++ b/lib/AvirWrapper.php @@ -76,7 +76,7 @@ public function fopen($path, $mode) { return $stream; } - public function writeStream(string $path, $stream, int $size = null): int { + public function writeStream(string $path, $stream, ?int $size = null): int { if ($this->shouldWrap($path)) { $stream = $this->wrapSteam($path, $stream); } diff --git a/lib/Command/Test.php b/lib/Command/Test.php index 54b7c4f8..73444f19 100644 --- a/lib/Command/Test.php +++ b/lib/Command/Test.php @@ -72,7 +72,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $details = $result->getDetails(); $output->writeln("❌ $details"); return 1; - } else if ($result->getNumericStatus() === Status::SCANRESULT_UNCHECKED) { + } elseif ($result->getNumericStatus() === Status::SCANRESULT_UNCHECKED) { $output->writeln("- file not scanned or scan still pending"); } else { $output->writeln(""); @@ -92,7 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $details = $result->getDetails(); $output->writeln("❌ file not detected $details"); return 1; - } else if ($result->getNumericStatus() === Status::SCANRESULT_UNCHECKED) { + } elseif ($result->getNumericStatus() === Status::SCANRESULT_UNCHECKED) { $output->writeln("- file not scanned or scan still pending"); } else { $output->writeln(""); @@ -113,7 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $details = $result->getDetails(); $output->writeln("❌ file not detected $details"); return 1; - } else if ($result->getNumericStatus() === Status::SCANRESULT_UNCHECKED) { + } elseif ($result->getNumericStatus() === Status::SCANRESULT_UNCHECKED) { $output->writeln("- file not scanned or scan still pending"); } else { $output->writeln(""); diff --git a/lib/Controller/RuleController.php b/lib/Controller/RuleController.php index 1d6c3185..f25a86b5 100644 --- a/lib/Controller/RuleController.php +++ b/lib/Controller/RuleController.php @@ -8,12 +8,12 @@ namespace OCA\Files_Antivirus\Controller; -use \OCA\Files_Antivirus\Db\Rule; -use \OCA\Files_Antivirus\Db\RuleMapper; -use \OCP\AppFramework\Controller; +use OCA\Files_Antivirus\Db\Rule; +use OCA\Files_Antivirus\Db\RuleMapper; +use OCP\AppFramework\Controller; -use \OCP\IRequest; use OCP\AppFramework\Http\JSONResponse; +use OCP\IRequest; class RuleController extends Controller { /** @var RuleMapper */ diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index d6913129..c44c1e99 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -8,14 +8,14 @@ namespace OCA\Files_Antivirus\Controller; -use \OCA\Files_Antivirus\AppConfig; -use \OCP\AppFramework\Controller; -use \OCP\AppFramework\Http\JSONResponse; -use \OCP\IL10N; -use \OCP\IRequest; +use OCA\Files_Antivirus\AppConfig; use OCA\Files_Antivirus\Scanner\ScannerFactory; - use OCA\Files_Antivirus\Status; +use OCP\AppFramework\Controller; +use OCP\AppFramework\Http\JSONResponse; +use OCP\IL10N; + +use OCP\IRequest; class SettingsController extends Controller { /** diff --git a/lib/ICAP/ICAPRequest.php b/lib/ICAP/ICAPRequest.php index edcb0b2f..9031232e 100644 --- a/lib/ICAP/ICAPRequest.php +++ b/lib/ICAP/ICAPRequest.php @@ -42,7 +42,7 @@ public function __construct( array $headers, array $requestHeaders, array $responseHeaders, - callable $responseCallback = null + ?callable $responseCallback = null ) { $this->stream = $stream; $this->responseCallback = $responseCallback; diff --git a/lib/ICAP/ResponseParser.php b/lib/ICAP/ResponseParser.php index a4d6ce09..4ce713f8 100644 --- a/lib/ICAP/ResponseParser.php +++ b/lib/ICAP/ResponseParser.php @@ -23,7 +23,7 @@ namespace OCA\Files_Antivirus\ICAP; -use \RuntimeException; +use RuntimeException; class ResponseParser { /** diff --git a/lib/Scanner/ICAP.php b/lib/Scanner/ICAP.php index 143c6074..1d717f4c 100644 --- a/lib/Scanner/ICAP.php +++ b/lib/Scanner/ICAP.php @@ -31,7 +31,6 @@ use OCA\Files_Antivirus\Status; use OCA\Files_Antivirus\StatusFactory; use OCP\ICertificateManager; -use OCP\IRequest; use Psr\Log\LoggerInterface; class ICAP extends ScannerBase { @@ -133,8 +132,9 @@ protected function scanBuffer() { if (\strpos($respHeader, '403 Forbidden') || \strpos($respHeader, '403 VirusFound')) { $this->status->setNumericStatus(Status::SCANRESULT_INFECTED); } - } else if ($code === 202) { - $this->status->setNumericStatus(Status::SCANRESULT_UNCHECKED);; + } elseif ($code === 202) { + $this->status->setNumericStatus(Status::SCANRESULT_UNCHECKED); + ; } else { throw new \RuntimeException('Invalid response from ICAP server'); } diff --git a/lib/Scanner/ScannerFactory.php b/lib/Scanner/ScannerFactory.php index 63078c94..9d9e6cfc 100644 --- a/lib/Scanner/ScannerFactory.php +++ b/lib/Scanner/ScannerFactory.php @@ -10,7 +10,6 @@ use OCA\Files_Antivirus\AppConfig; use OCP\IRequest; -use OCP\IServerContainer; use Psr\Container\ContainerInterface; class ScannerFactory {