Skip to content

Commit

Permalink
Merge pull request #16 from spiral/analysis-yrvn3o
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
butschster committed Jun 28, 2022
2 parents 7191894 + 77f0e31 commit ce8aa38
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 29 deletions.
4 changes: 2 additions & 2 deletions src/Config/TcpConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ final class TcpConfig extends InjectableConfig
public const CONFIG = 'tcp';

/**
* @return array<object>|array<class-string<ServiceInterface>>
* @return array<class-string<ServiceInterface>>|array<object>
*/
public function getServices(): array
{
return (array) ($this->config['services'] ?? []);
}

/**
* @return array<object>|array<class-string<CoreInterceptorInterface>>
* @return array<class-string<CoreInterceptorInterface>>|array<object>
*/
public function getInterceptors(): array
{
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/Cache/ClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Spiral\Cache\CacheStorageProviderInterface;
use Spiral\Console\Command;
use Symfony\Component\Console\Input\InputArgument;

final class ClearCommand extends Command
{
Expand Down
3 changes: 1 addition & 2 deletions src/Console/Command/GRPC/GenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
use Spiral\Files\FilesInterface;
use Spiral\RoadRunnerBridge\Config\GRPCConfig;
use Spiral\RoadRunnerBridge\GRPC\ProtoCompiler;
use Symfony\Component\Console\Input\InputArgument;

final class GenerateCommand extends Command
{
protected const SIGNATURE = 'grpc:generate
protected const SIGNATURE = 'grpc:generate
{path=auto : Base path for generated service code}
{namespace=auto : Base namespace for generated service code}';
protected const DESCRIPTION = 'Generate GPRC service code using protobuf specification';
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/Queue/PauseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Spiral\Console\Command;
use Spiral\RoadRunner\Jobs\JobsInterface;
use Symfony\Component\Console\Input\InputArgument;

final class PauseCommand extends Command
{
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/Queue/ResumeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Spiral\Console\Command;
use Spiral\RoadRunner\Jobs\JobsInterface;
use Symfony\Component\Console\Input\InputArgument;

final class ResumeCommand extends Command
{
Expand Down
2 changes: 1 addition & 1 deletion tests/app/config/queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
'connector' => new MemoryCreateInfo('local'),
'serializerFormat' => 'serializer',
'consume' => true,
]
],
// 'amqp' => [
// 'connector' => new AMQPCreateInfo('bus', ...),
// // Don't consume jobs for this pipeline on start
Expand Down
1 change: 0 additions & 1 deletion tests/src/Bootloader/BroadcastingBootloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Spiral\Tests\Bootloader;

use Mockery as m;
use Psr\Http\Message\ResponseFactoryInterface;
use Spiral\Goridge\RPC\RPCInterface;
use Spiral\RoadRunner\Broadcast\Broadcast;
Expand Down
7 changes: 3 additions & 4 deletions tests/src/Bootloader/GRPCBootloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Spiral\Tests\Bootloader;

use Spiral\Boot\KernelInterface;
use Spiral\Core\ConfigsInterface;
use Spiral\RoadRunner\GRPC\Invoker;
use Spiral\RoadRunner\GRPC\InvokerInterface;
Expand Down Expand Up @@ -56,10 +55,10 @@ public function testConfigShouldBeDefined()
$config = $configurator->getConfig('grpc');

$this->assertSame([
'binaryPath' => $this->getDirectoryByAlias('app').'../protoc-gen-php-grpc',
'binaryPath' => $this->getDirectoryByAlias('app') . '../protoc-gen-php-grpc',
'services' => [
$this->getDirectoryByAlias('app').'proto/echo.proto',
$this->getDirectoryByAlias('app').'proto/foo.proto',
$this->getDirectoryByAlias('app') . 'proto/echo.proto',
$this->getDirectoryByAlias('app') . 'proto/foo.proto',
],
], $config);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/src/Bootloader/QueueBootloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ public function testFormatIsDefined(): void
'connections' => [
'roadrunner' => [
'driver' => 'roadrunner',
'serializerFormat' => 'defined'
]
]
'serializerFormat' => 'defined',
],
],
]));

$serializer = $this->getContainer()->get(JobsAdapterSerializer::class);
Expand Down
6 changes: 3 additions & 3 deletions tests/src/Console/Command/GRPC/GenerateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ public function testGenerateServices()
];

$this->assertStringContainsString(
sprintf('Compiling `%s`:', $this->getDirectoryByAlias('app').'proto/echo.proto'),
sprintf('Compiling `%s`:', $this->getDirectoryByAlias('app') . 'proto/echo.proto'),
$result
);

foreach ($files as $file) {
$this->assertFileExists($this->getDirectoryByAlias('app').$file);
$this->assertFileExists($this->getDirectoryByAlias('app') . $file);
$this->assertStringContainsString(
$file,
$result
);
}

$this->assertStringContainsString(
sprintf('Proto file `%s` not found.', $this->getDirectoryByAlias('app').'proto/foo.proto'),
sprintf('Proto file `%s` not found.', $this->getDirectoryByAlias('app') . 'proto/foo.proto'),
$result
);
}
Expand Down
11 changes: 4 additions & 7 deletions tests/src/ConsoleTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
namespace Spiral\Tests;

use Spiral\Files\Files;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\OutputInterface;

abstract class ConsoleTestCase extends TestCase
{
Expand All @@ -17,7 +14,7 @@ public function generateGRPCService(): string

$result = $this->runCommand('grpc:generate', [
'path' => $appPath,
'namespace' => 'Spiral\\App'
'namespace' => 'Spiral\\App',
]);

$files = [
Expand All @@ -27,7 +24,7 @@ public function generateGRPCService(): string
];

foreach ($files as $file) {
require_once $appPath.$file;
require_once $appPath . $file;
}

return $result;
Expand All @@ -36,8 +33,8 @@ public function generateGRPCService(): string
public function deleteGRPCService(): void
{
$fs = new Files();
if ($fs->isDirectory($this->getDirectoryByAlias('app').'GRPC/EchoService')) {
$fs->deleteDirectory($this->getDirectoryByAlias('app').'GRPC/EchoService');
if ($fs->isDirectory($this->getDirectoryByAlias('app') . 'GRPC/EchoService')) {
$fs->deleteDirectory($this->getDirectoryByAlias('app') . 'GRPC/EchoService');
}
}
}
4 changes: 2 additions & 2 deletions tests/src/Queue/ConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testGetPayloadWithDefaultSerializer(): void
// default json serializer
$payload = new Payload(\json_encode([
'test' => 'test',
'other' => 'data'
'other' => 'data',
]));

$result = $ref->invoke($consumer, $payload, 'memory');
Expand All @@ -36,7 +36,7 @@ public function testGetPayloadWithConfiguredSerializer(): void
// php serialize from config
$payload = new Payload(\serialize([
'test' => 'test',
'other' => 'data'
'other' => 'data',
]));

$result = $ref->invoke($consumer, $payload, 'withSerializer');
Expand Down
2 changes: 1 addition & 1 deletion tests/src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function defineBootloaders(): array

public function rootDirectory(): string
{
return __DIR__.'/../';
return __DIR__ . '/../';
}

protected function tearDown(): void
Expand Down

0 comments on commit ce8aa38

Please sign in to comment.