Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: PHP tests

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run php-cs-fixer
run: ./vendor/bin/php-cs-fixer fix
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
composer.lock
.php_cs.cache
/vendor/
/.idea/
16 changes: 16 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in([__DIR__ . '/src', __DIR__ . '/tests'])
->name('*.php')
;

return PhpCsFixer\Config::create()
->setRules([
'@PSR1' => true,
'@PSR2' => true,
'full_opening_tag' => true,
'no_closing_tag' => true,
])
->setFinder($finder)
;
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"psr-4": {"Utopia\\Tests\\": "tests/ClamAV"}
},
"require": {
"php": ">=7.1"
"php": ">=7.1",
"friendsofphp/php-cs-fixer": "^2.16"
},
"require-dev": {
"phpunit/phpunit": "^7.0"
Expand Down
2 changes: 1 addition & 1 deletion src/ClamAV/ClamAV.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function continueScan(string $file)
{
$return = [];

foreach(\explode("\n", \trim($this->sendCommand('CONTSCAN ' . $file))) as $results ) {
foreach (\explode("\n", \trim($this->sendCommand('CONTSCAN ' . $file))) as $results) {
list($file, $stats) = \explode(':', $results);
\array_push($return, [ 'file' => $file, 'stats' => \trim($stats) ]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ClamAV/Network.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function getSocket()
$socket = @\socket_create(AF_INET, SOCK_STREAM, 0);
$status = @\socket_connect($socket, $this->host, $this->port);

if(!$status) {
if (!$status) {
throw new \Exception('Unable to connect to ClamAV server');
}
return $socket;
Expand Down