Skip to content

Commit

Permalink
Update to new php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Sep 19, 2024
1 parent 0301d68 commit 0411285
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 28 deletions.
19 changes: 19 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

$config = new class extends Amp\CodeStyle\Config {
public function getRules(): array
{
$rules = parent::getRules();
$rules['declare_strict_types'] = false;

return $rules;
}
};

$config->getFinder()
->in(__DIR__ . '/src')
->in(__DIR__ . '/test');

$config->setCacheFile(__DIR__ . '/.php_cs.cache');

return $config;
12 changes: 0 additions & 12 deletions .php_cs.dist

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"require-dev": {
"amphp/amp": "^2",
"amphp/php-cs-fixer-config": "dev-master"
"amphp/php-cs-fixer-config": "^2"
},
"autoload": {
"psr-4": {
Expand Down
11 changes: 3 additions & 8 deletions src/AsyncTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final public function runAsyncTest(...$args)
if (!$this->setUpInvoked) {
$this->fail(\sprintf(
'%s::setUp() overrides %s::setUp() without calling the parent method',
\str_replace("\0", '@', \get_class($this)), // replace NUL-byte in anonymous class name
\str_replace("\0", '@', static::class), // replace NUL-byte in anonymous class name
self::class
));
}
Expand Down Expand Up @@ -129,7 +129,7 @@ private function runAsyncTestCycle(array $args): \Generator
} catch (\Throwable $exception) {
throw new \Error(\sprintf(
'%s::setUpAsync() failed',
\str_replace("\0", '@', \get_class($this)) // replace NUL-byte in anonymous class name
\str_replace("\0", '@', static::class) // replace NUL-byte in anonymous class name
), 0, $exception);
}

Expand All @@ -144,7 +144,7 @@ private function runAsyncTestCycle(array $args): \Generator
} catch (\Throwable $exception) {
throw new \Error(\sprintf(
'%s::tearDownAsync() failed',
\str_replace("\0", '@', \get_class($this)) // replace NUL-byte in anonymous class name
\str_replace("\0", '@', static::class) // replace NUL-byte in anonymous class name
), 0, $exception);
} finally {
if (isset($testException)) {
Expand Down Expand Up @@ -256,11 +256,6 @@ final protected function createCallback(int $invocationCount, ?callable $returnC

/**
* Specialized Amp\call that stores the generator if present for debugging purposes.
*
* @param callable $callback
* @param mixed ...$args
*
* @return Promise
*/
private function call(callable $callback, ...$args): Promise
{
Expand Down
8 changes: 1 addition & 7 deletions test/AsyncTestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ public function argumentSupportProvider(): array
}

/**
* @param string $foo
* @param int $bar
* @param bool $baz
*
* @dataProvider argumentSupportProvider
*/
public function testArgumentSupport(string $foo, int $bar, bool $baz)
Expand All @@ -106,11 +102,9 @@ public function testArgumentSupport(string $foo, int $bar, bool $baz)
}

/**
* @param string|null $value
*
* @depends testReturningPromise
*/
public function testReturnValueFromDependentTest(string $value = null)
public function testReturnValueFromDependentTest(?string $value = null)
{
$this->assertSame('value', $value);
}
Expand Down

0 comments on commit 0411285

Please sign in to comment.