Merge pull request #497 from pestphp/feature/style

style: apply fixes from PHP-CS-Fixer
This commit is contained in:
Owen Voke
2022-03-08 10:58:16 +00:00
committed by GitHub
17 changed files with 33 additions and 33 deletions

View File

@ -43,7 +43,7 @@ trait Pipeable
$this->pipe($name, function ($next, ...$arguments) use ($handler, $filter) { $this->pipe($name, function ($next, ...$arguments) use ($handler, $filter) {
/* @phpstan-ignore-next-line */ /* @phpstan-ignore-next-line */
if ($filter($this->value, ...$arguments)) { if ($filter($this->value, ...$arguments)) {
//@phpstan-ignore-next-line // @phpstan-ignore-next-line
$handler->bindTo($this, get_class($this))(...$arguments); $handler->bindTo($this, get_class($this))(...$arguments);
return; return;

View File

@ -307,7 +307,7 @@ final class Expectation
private function getExpectationClosure(string $name): Closure private function getExpectationClosure(string $name): Closure
{ {
if (method_exists(Mixins\Expectation::class, $name)) { if (method_exists(Mixins\Expectation::class, $name)) {
//@phpstan-ignore-next-line // @phpstan-ignore-next-line
return Closure::fromCallable([new Mixins\Expectation($this->value), $name]); return Closure::fromCallable([new Mixins\Expectation($this->value), $name]);
} }

View File

@ -37,7 +37,7 @@ final class Kernel
public static function boot(): self public static function boot(): self
{ {
foreach (self::$bootstrappers as $bootstrapper) { foreach (self::$bootstrappers as $bootstrapper) {
//@phpstan-ignore-next-line // @phpstan-ignore-next-line
(new $bootstrapper())->__invoke(); (new $bootstrapper())->__invoke();
} }

View File

@ -283,7 +283,7 @@ final class Expectation
{ {
$this->toBeObject(); $this->toBeObject();
//@phpstan-ignore-next-line // @phpstan-ignore-next-line
Assert::assertTrue(property_exists($this->value, $name)); Assert::assertTrue(property_exists($this->value, $name));
if (func_num_args() > 1) { if (func_num_args() > 1) {
@ -534,7 +534,7 @@ final class Expectation
{ {
Assert::assertIsString($this->value); Assert::assertIsString($this->value);
//@phpstan-ignore-next-line // @phpstan-ignore-next-line
Assert::assertJson($this->value); Assert::assertJson($this->value);
return $this; return $this;
@ -580,7 +580,7 @@ final class Expectation
try { try {
Assert::assertTrue(Arr::has($array, $key)); Assert::assertTrue(Arr::has($array, $key));
/* @phpstan-ignore-next-line */ /* @phpstan-ignore-next-line */
} catch (ExpectationFailedException $exception) { } catch (ExpectationFailedException $exception) {
throw new ExpectationFailedException("Failed asserting that an array has the key '$key'", $exception->getComparisonFailure()); throw new ExpectationFailedException("Failed asserting that an array has the key '$key'", $exception->getComparisonFailure());
} }

View File

@ -156,11 +156,11 @@ final class DatasetsRepository
$datasets[$index] = iterator_to_array($datasets[$index]); $datasets[$index] = iterator_to_array($datasets[$index]);
} }
//@phpstan-ignore-next-line // @phpstan-ignore-next-line
foreach ($datasets[$index] as $key => $values) { foreach ($datasets[$index] as $key => $values) {
$values = is_array($values) ? $values : [$values]; $values = is_array($values) ? $values : [$values];
$processedDataset[] = [ $processedDataset[] = [
'label' => self::getDatasetDescription($key, $values), //@phpstan-ignore-line 'label' => self::getDatasetDescription($key, $values), // @phpstan-ignore-line
'values' => $values, 'values' => $values,
]; ];
} }
@ -189,7 +189,7 @@ final class DatasetsRepository
$result = $tmp; $result = $tmp;
} }
//@phpstan-ignore-next-line // @phpstan-ignore-next-line
return $result; return $result;
} }

View File

@ -85,7 +85,7 @@ final class Container
} }
} }
//@phpstan-ignore-next-line // @phpstan-ignore-next-line
return $this->get($candidate); return $this->get($candidate);
}, },
$constructor->getParameters() $constructor->getParameters()

View File

@ -40,7 +40,7 @@ final class HigherOrderMessageCollection
public function chain(object $target): void public function chain(object $target): void
{ {
foreach ($this->messages as $message) { foreach ($this->messages as $message) {
//@phpstan-ignore-next-line // @phpstan-ignore-next-line
$target = $message->call($target) ?? $target; $target = $message->call($target) ?? $target;
} }
} }

View File

@ -8,7 +8,7 @@ use Symfony\Component\Console\Output\ConsoleOutput;
it('has plugin')->assertTrue(class_exists(CoveragePlugin::class)); it('has plugin')->assertTrue(class_exists(CoveragePlugin::class));
it('adds coverage if --coverage exist', function () { it('adds coverage if --coverage exist', function () {
$plugin = new CoveragePlugin(new ConsoleOutput()); $plugin = new CoveragePlugin(new ConsoleOutput());
$testSuite = TestSuite::getInstance(); $testSuite = TestSuite::getInstance();
expect($plugin->coverage)->toBeFalse(); expect($plugin->coverage)->toBeFalse();

View File

@ -12,7 +12,7 @@ class Number
public function __construct( public function __construct(
public int $value public int $value
) { ) {
//.. // ..
} }
} }
@ -21,7 +21,7 @@ class Char
public function __construct( public function __construct(
public string $value public string $value
) { ) {
//.. // ..
} }
} }
@ -30,7 +30,7 @@ class Symbol
public function __construct( public function __construct(
public string $value public string $value
) { ) {
//.. // ..
} }
} }
@ -69,11 +69,11 @@ expect()->pipe('toBe', function ($next, $expected) use ($state) {
assertInstanceOf(Char::class, $expected); assertInstanceOf(Char::class, $expected);
assertEquals($this->value->value, $expected->value); assertEquals($this->value->value, $expected->value);
//returning nothing stops pipeline execution // returning nothing stops pipeline execution
return; return;
} }
//calling $next(); let the pipeline to keep running // calling $next(); let the pipeline to keep running
$next(); $next();
}); });

View File

@ -5,7 +5,7 @@ use PHPUnit\Framework\ExpectationFailedException;
expect(true)->toBeTrue()->and(false)->toBeFalse(); expect(true)->toBeTrue()->and(false)->toBeFalse();
test('strict comparisons', function () { test('strict comparisons', function () {
$nuno = new stdClass(); $nuno = new stdClass();
$dries = new stdClass(); $dries = new stdClass();
expect($nuno)->toBe($nuno)->not->toBe($dries); expect($nuno)->toBe($nuno)->not->toBe($dries);

View File

@ -3,24 +3,24 @@
use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () { test('pass', function () {
$object = new stdClass(); $object = new stdClass();
$object->name = 'Jhon'; $object->name = 'Jhon';
$object->age = 21; $object->age = 21;
expect($object)->toHaveProperties(['name', 'age']); expect($object)->toHaveProperties(['name', 'age']);
}); });
test('failures', function () { test('failures', function () {
$object = new stdClass(); $object = new stdClass();
$object->name = 'Jhon'; $object->name = 'Jhon';
expect($object)->toHaveProperties(['name', 'age']); expect($object)->toHaveProperties(['name', 'age']);
})->throws(ExpectationFailedException::class); })->throws(ExpectationFailedException::class);
test('not failures', function () { test('not failures', function () {
$object = new stdClass(); $object = new stdClass();
$object->name = 'Jhon'; $object->name = 'Jhon';
$object->age = 21; $object->age = 21;
expect($object)->not->toHaveProperties(['name', 'age']); expect($object)->not->toHaveProperties(['name', 'age']);
})->throws(ExpectationFailedException::class); })->throws(ExpectationFailedException::class);

View File

@ -3,9 +3,9 @@
use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\ExpectationFailedException;
beforeEach(function () { beforeEach(function () {
$this->unlessObject = new stdClass(); $this->unlessObject = new stdClass();
$this->unlessObject->trueValue = true; $this->unlessObject->trueValue = true;
$this->unlessObject->foo = 'foo'; $this->unlessObject->foo = 'foo';
}); });
it('pass', function () { it('pass', function () {

View File

@ -3,9 +3,9 @@
use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\ExpectationFailedException;
beforeEach(function () { beforeEach(function () {
$this->whenObject = new stdClass(); $this->whenObject = new stdClass();
$this->whenObject->trueValue = true; $this->whenObject->trueValue = true;
$this->whenObject->foo = 'foo'; $this->whenObject->foo = 'foo';
}); });
it('pass', function () { it('pass', function () {

View File

@ -10,7 +10,7 @@ it('gets file name from closure', function () {
}); });
it('gets property values', function () { it('gets property values', function () {
$class = new class() { $class = new class() {
private $foo = 'bar'; private $foo = 'bar';
}; };

View File

@ -8,7 +8,7 @@ use Pest\TestSuite;
it('does not allow to add the same test description twice', function () { it('does not allow to add the same test description twice', function () {
$testSuite = new TestSuite(getcwd(), 'tests'); $testSuite = new TestSuite(getcwd(), 'tests');
$method = new TestCaseMethodFactory('foo', 'bar', null); $method = new TestCaseMethodFactory('foo', 'bar', null);
$testSuite->tests->set($method); $testSuite->tests->set($method);
$testSuite->tests->set($method); $testSuite->tests->set($method);
@ -43,7 +43,7 @@ it('can return an array of all test suite filenames', function () {
it('can filter the test suite filenames to those with the only method', function () { it('can filter the test suite filenames to those with the only method', function () {
$testSuite = new TestSuite(getcwd(), 'tests'); $testSuite = new TestSuite(getcwd(), 'tests');
$testWithOnly = new TestCaseMethodFactory('a', 'b', null); $testWithOnly = new TestCaseMethodFactory('a', 'b', null);
$testWithOnly->only = true; $testWithOnly->only = true;
$testSuite->tests->set($testWithOnly); $testSuite->tests->set($testWithOnly);
@ -61,7 +61,7 @@ it('does not filter the test suite filenames to those with the only method when
$test = function () {}; $test = function () {};
$testWithOnly = new TestCaseMethodFactory('a', 'b', null); $testWithOnly = new TestCaseMethodFactory('a', 'b', null);
$testWithOnly->only = true; $testWithOnly->only = true;
$testSuite->tests->set($testWithOnly); $testSuite->tests->set($testWithOnly);

View File

@ -8,7 +8,7 @@ test('visual snapshot of help command output', function () {
if (getenv('REBUILD_SNAPSHOTS')) { if (getenv('REBUILD_SNAPSHOTS')) {
$outputBuffer = new BufferedOutput(); $outputBuffer = new BufferedOutput();
$plugin = new Help($outputBuffer); $plugin = new Help($outputBuffer);
$plugin(); $plugin();

View File

@ -2,7 +2,7 @@
test('visual snapshot of test suite on success', function () { test('visual snapshot of test suite on success', function () {
$testsPath = dirname(__DIR__); $testsPath = dirname(__DIR__);
$snapshot = implode(DIRECTORY_SEPARATOR, [ $snapshot = implode(DIRECTORY_SEPARATOR, [
$testsPath, $testsPath,
'.snapshots', '.snapshots',
'success.txt', 'success.txt',