Skip to content

Commit

Permalink
fix(styles): code styles fix by phpcsfixer
Browse files Browse the repository at this point in the history
  • Loading branch information
Rastusik committed Feb 6, 2023
1 parent 8cf9cd6 commit 7dfc682
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
5 changes: 2 additions & 3 deletions src/Bridge/Doctrine/DBAL/ConnectionKeepAliveResetter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

namespace K911\Swoole\Bridge\Doctrine\DBAL;

use Doctrine\DBAL\Connection;
use K911\Swoole\Bridge\Symfony\Container\Resetter;
use PixelFederation\DoctrineResettableEmBundle\DBAL\Connection\AliveKeeper;
Expand All @@ -22,9 +23,7 @@ public function __construct(AliveKeeper $aliveKeeper, string $connectionName)
public function reset(object $service): void
{
if (!$service instanceof Connection) {
throw new \UnexpectedValueException(
\sprintf('Unexpected class instance: %s ', \get_class($service))
);
throw new \UnexpectedValueException(\sprintf('Unexpected class instance: %s ', \get_class($service)));
}

$this->aliveKeeper->keepAlive($service, $this->connectionName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\ResettableServicePass;

final class FinalizeDefinitionsAfterRemovalPass implements CompilerPassInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use K911\Swoole\Bridge\Symfony\Bundle\DependencyInjection\ContainerConstants;
use K911\Swoole\Bridge\Symfony\Container\Proxy\UnmanagedFactoryInstantiator;
use K911\Swoole\Bridge\Symfony\Container\SimpleResetter;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public function __construct(string $serviceClass, array $tags)
* @return array<array{
* factoryMethod: string,
* returnType: class-string|string,
* limit?: int
* limit?: int,
* resetter?: string
* }>
*/
public function getFactoryMethodConfigs(ContainerBuilder $container): array
Expand Down
10 changes: 5 additions & 5 deletions tests/Feature/SwooleServerCoroutinesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ public function testCoroutinesWithDebugOff(): void
$this->assertStringContainsString('Check was true.', $response['body']);
$this->assertStringContainsString('Checks: 10.', $response['body']);

// without coroutines, it should be 8, expected is 2, 1.5s is slowness tolerance in initialization
self::assertLessThan(3.5, $end - $start);
// without coroutines, it should be 8, expected is 2, 2s is slowness tolerance in initialization
self::assertLessThan(4, $end - $start);
});
}

Expand Down Expand Up @@ -228,7 +228,7 @@ public function testCoroutinesWithDoctrineAndWithDebugOff(): void
$wg->wait(10);
$end = microtime(true);

self::assertLessThan(self::coverageEnabled() ? 3 : 0.5, $end - $start);
self::assertLessThan(self::coverageEnabled() ? 6 : 0.5, $end - $start);

$client = HttpClient::fromDomain('localhost', 9999, false);
$this->assertTrue($client->connect());
Expand Down Expand Up @@ -314,7 +314,7 @@ public function testCoroutinesWithDoctrineAndWithDebugOn(): void
$wg->wait(10);
$end = microtime(true);

self::assertLessThan(self::coverageEnabled() ? 3 : 0.5, $end - $start);
self::assertLessThan(self::coverageEnabled() ? 5 : 0.5, $end - $start);

$client = HttpClient::fromDomain('localhost', 9999, false);
$this->assertTrue($client->connect());
Expand Down Expand Up @@ -401,7 +401,7 @@ public function testCoroutinesWithTaskWorkers(): void

$end = microtime(true);
// after one second, three rows should be in the file, not after 1.6s
self::assertLessThan(self::coverageEnabled() ? 1.4 : 1.1, $end - $start);
self::assertLessThan(self::coverageEnabled() ? 2 : 1.1, $end - $start);
});

$content = file_get_contents($fileName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ final class ResetCountCompileProcessor implements CompileProcessor
{
public function process(ContainerBuilder $container, Proxifier $proxifier): void
{
$this->decorateResetter($container,'swoole_bundle.coroutines_support.doctrine.connection_resetter.default');
$this->decorateResetter($container,'inmemory_repository_resetter');
$this->decorateResetter($container, 'swoole_bundle.coroutines_support.doctrine.connection_resetter.default');
$this->decorateResetter($container, 'inmemory_repository_resetter');
}

private function decorateResetter(ContainerBuilder $container, string $resetterId): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

namespace K911\Swoole\Tests\Fixtures\Symfony\TestBundle\Resetter;

use K911\Swoole\Bridge\Symfony\Container\Resetter;

final class CountingResetter implements Resetter
Expand All @@ -18,7 +19,7 @@ public function __construct(Resetter $decorated)

public function reset(object $service): void
{
$this->counter++;
++$this->counter;
$this->decorated->reset($service);
}

Expand Down

0 comments on commit 7dfc682

Please sign in to comment.