Skip to content
Merged
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
17 changes: 17 additions & 0 deletions .github/workflows/cs-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---

on: # yamllint disable-line rule:truthy
push:
branches:
- '**'

name: Fix Code Style

jobs:
cs-fix:
permissions:
contents: write
uses: spiral/gh-actions/.github/workflows/cs-fix.yml@master
with:
php: >-
['8.4']
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ Thumbs.db
clover.xml
.env
builds

# Runtime
runtime/
13 changes: 13 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

require_once 'vendor/autoload.php';

return \Spiral\CodeStyle\Builder::create()
->include(__DIR__ . '/src')
->include(__DIR__ . '/tests')
->include(__FILE__)
->cache('./runtime/php-cs-fixer.cache')
->allowRisky(false)
->build();
73 changes: 0 additions & 73 deletions .styleci.yml

This file was deleted.

3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"require-dev": {
"mockery/mockery": "^1.5",
"phpunit/phpunit": "^10.0",
"spiral/code-style": "^2.3.1",
"vimeo/psalm": ">=5.8"
},
"autoload-dev": {
Expand All @@ -57,6 +58,8 @@
}
},
"scripts": {
"cs:diff": "php-cs-fixer fix --dry-run -v --diff",
"cs:fix": "php-cs-fixer fix -v",
"tests": "phpunit",
"psalm": "psalm --no-cache"
},
Expand Down
5 changes: 1 addition & 4 deletions src/Exception/ServiceException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@

namespace Spiral\RoadRunner\Services\Exception;

class ServiceException extends \Exception
{

}
class ServiceException extends \Exception {}
4 changes: 2 additions & 2 deletions src/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function create(
array $env = [],
int $restartSec = 30,
bool $serviceNameInLogs = false,
int $stopTimeout = 5
int $stopTimeout = 5,
): bool {
\assert($processNum > 0, 'Process number must be greater than 0.');
\assert($execTimeout >= 0, 'Execution timeout must be greater or equal to 0.');
Expand Down Expand Up @@ -181,7 +181,7 @@ public function statuses(string $name): array
$error = [
'code' => $statusError->getCode(),
'message' => $statusError->getMessage(),
'details' => \array_map(static fn (Any $any) => [
'details' => \array_map(static fn(Any $any) => [
'message' => $any->getValue(),
'type_url' => $any->getTypeUrl(),
], \iterator_to_array($statusError->getDetails()->getIterator())),
Expand Down
36 changes: 18 additions & 18 deletions tests/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,6 @@ final class ManagerTest extends TestCase
private Manager $manager;
private m\LegacyMockInterface|m\MockInterface|RPCInterface $rpc;

protected function setUp(): void
{
parent::setUp();

$this->rpc = m::mock(RPCInterface::class);

$this->rpc
->shouldReceive('withCodec')
->once()
->withArgs(static fn($codec): bool => $codec instanceof ProtobufCodec)
->andReturnSelf();

$this->manager = new Manager($this->rpc);
}

public function testListServices(): void
{
$this->rpc
Expand Down Expand Up @@ -96,8 +81,8 @@ public function testServiceShouldBeCreated(): void
['FOO' => 'bar', 'BAZ' => 'foo'],
50,
true,
10
)
10,
),
);
}

Expand Down Expand Up @@ -197,7 +182,7 @@ public function testServiceStatusesShouldBeReturned(): void
]),
]),
],
])
]),
);

$status = $this->manager->statuses('foo');
Expand All @@ -218,4 +203,19 @@ public function testServiceStatusesShouldBeReturned(): void
],
], $status);
}

protected function setUp(): void
{
parent::setUp();

$this->rpc = m::mock(RPCInterface::class);

$this->rpc
->shouldReceive('withCodec')
->once()
->withArgs(static fn($codec): bool => $codec instanceof ProtobufCodec)
->andReturnSelf();

$this->manager = new Manager($this->rpc);
}
}
5 changes: 1 addition & 4 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,4 @@

use PHPUnit\Framework\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{

}
abstract class TestCase extends BaseTestCase {}
Loading