Skip to content

Commit

Permalink
Switch CS to @psr12
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann committed Jan 7, 2025
1 parent 11d00ed commit 31b0c0e
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 20 deletions.
13 changes: 10 additions & 3 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
$finder = PhpCsFixer\Finder::create()
->path('src')->name('*.php')
->path('tests')->name('*.php')
// ContextTest::testFullyQualifiedName relies on the 'use Exception' statement...
->filter(function (\SplFileInfo $file) {
return !strpos($file->getPathname(), 'tests/Fixtures/Customer.php');
return
// ContextTest::testFullyQualifiedName relies on the 'use Exception' statement...
!strpos($file->getPathname(), 'tests/Fixtures/Customer.php')
// multi arg use; 'use a, b;`
&& !strpos($file->getPathname(), 'tests/Fixtures/Parser/HelloTrait.php')
// FQDN in docblock
&& !strpos($file->getPathname(), 'tests/Fixtures/TypedProperties.php')
;
})
->path('Examples')->name('*.php')
->filter(function (\SplFileInfo $file) {
Expand All @@ -24,10 +30,11 @@
(new ScopedDeclareStrictTypesFixer())->scope(['/src/', '/tests/']),
])
->setRules([
'@PSR2' => true,
'@PSR12' => true,
'@DoctrineAnnotation' => true,
'OpenApi/license' => true,
'OpenApi/declare_strict_types' => true,
'blank_line_after_opening_tag' => false,
'array_syntax' => ['syntax' => 'short'],
'no_unused_imports' => true,
'blank_line_before_statement' => ['statements' => ['return']],
Expand Down
1 change: 0 additions & 1 deletion src/OpenApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@

class OpenApiException extends \Exception
{

}
1 change: 0 additions & 1 deletion src/Processors/AugmentTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
class AugmentTags implements ProcessorInterface
{

/** @var array<string> */
protected array $whitelist = [];

Expand Down
2 changes: 1 addition & 1 deletion tests/Analysers/ReflectionAnalyserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ReflectionAnalyserTest extends OpenApiTestCase
{
protected function collectingAnnotationFactory(): AnnotationFactoryInterface
{
return new class() implements AnnotationFactoryInterface {
return new class () implements AnnotationFactoryInterface {
public $reflectors = [];

public function build(\Reflector $reflector, Context $context): array
Expand Down
1 change: 0 additions & 1 deletion tests/Annotations/AnnotationPropertiesDefinedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

namespace OpenApi\Tests\Annotations;

use function \get_class_vars;
use OpenApi\Annotations as OA;
use OpenApi\Tests\OpenApiTestCase;

Expand Down
1 change: 0 additions & 1 deletion tests/Fixtures/BadExampleParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@
)]
class BadExampleParameter
{

}
2 changes: 1 addition & 1 deletion tests/Fixtures/PHP/AnonymousFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function index($ding)

protected function query()
{
return new class() {
return new class () {
public function leftJoin(string $foo, callable $callback)
{
return $this;
Expand Down
16 changes: 8 additions & 8 deletions tests/Fixtures/PHP/php7.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,49 @@

use PHPUnit\Framework\TestCase;

$a = new class {
$a = new class () {
public function foo()
{
}
};

$b = new class() {
$b = new class () {
public function bar()
{
}
};

$c = new class extends \stdClass {
$c = new class () extends \stdClass {
public function baz()
{
}
};

$d = new class() extends \stdClass {
$d = new class () extends \stdClass {
public function boz()
{
}
};

new class implements i1 {
new class () implements i1 {
public function biz()
{
}
};

new class() implements i1 {
new class () implements i1 {
public function buz()
{
}
};

$e = new class() extends \stdClass {
$e = new class () extends \stdClass {
public function fuz()
{
}
};

$f = new class() implements i2 {
$f = new class () implements i2 {
public function fuu()
{
}
Expand Down
2 changes: 1 addition & 1 deletion tests/GeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function processorCases(): iterable
{
return [
[new OperationId(), true],
[new class(false) extends OperationId {
[new class (false) extends OperationId {
}, false],
];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/OpenApiTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function tearDown(): void

public function getTrackingLogger(bool $debug = false): ?LoggerInterface
{
return new class($this, $debug) extends AbstractLogger {
return new class ($this, $debug) extends AbstractLogger {
/** @var OpenApiTestCase */
protected $testCase;

Expand Down
2 changes: 1 addition & 1 deletion tests/PipelineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __invoke($payload)

protected function pipe(string $add)
{
return new class($add) {
return new class ($add) {
protected $add;

public function __construct(string $add)
Expand Down

0 comments on commit 31b0c0e

Please sign in to comment.