Skip to content

Commit

Permalink
Update CS rules
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann committed Nov 9, 2024
1 parent dc2de3a commit 98216f8
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 19 deletions.
25 changes: 16 additions & 9 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()
->path('src')->name('*.php')
Expand All @@ -9,16 +9,18 @@
return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'@DoctrineAnnotation' => true,
'array_syntax' => ['syntax' => 'short'],
'no_unused_imports' => true,
'blank_line_before_statement' => ['statements' => ['return']],
'visibility_required' => true,
'cast_spaces' => ['space' => 'single'],
'concat_space' => ['spacing' => 'one'],
'function_typehint_space' => true,
'type_declaration_spaces' => true,
'lowercase_cast' => true,
'magic_constant_casing' => true,
'class_attributes_separation' => ['elements' => ['method' => 'one']],
'single_blank_line_before_namespace' => true,
'blank_lines_before_namespace' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_around_offset' => true,
'no_whitespace_before_comma_in_array' => true,
Expand All @@ -28,18 +30,23 @@
'no_blank_lines_after_phpdoc' => true,
'no_extra_blank_lines' => true,
'return_type_declaration' => ['space_before' => 'none'],
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_comma_in_singleline' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unneeded_braces' => true,
'short_scalar_cast' => true,
'space_after_semicolon' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline' => true,
'trim_array_spaces' => true,
'single_space_around_construct' => true,
'single_line_comment_spacing' => true,
'fully_qualified_strict_types' => true,
'global_namespace_import' => ['import_classes' => false, 'import_constants' => null, 'import_functions' => null],

'nullable_type_declaration_for_default_null_value' => true,

'no_empty_phpdoc' => true,
// 7.3 only 'no_superfluous_phpdoc_tags' => true,
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
'phpdoc_align' => true,
'general_phpdoc_tag_rename' => true,
'phpdoc_inline_tag_normalizer' => true,
Expand All @@ -52,11 +59,11 @@
'phpdoc_to_comment' => true,
'phpdoc_summary' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_separation' => true,
'phpdoc_separation' => ['skip_unlisted_annotations' => true],
'phpdoc_scalar' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_alias_tag' => true,
])
->setFinder($finder)
;
;
3 changes: 2 additions & 1 deletion tests/Fixtures/Controllers/InvokeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Radebatz\OpenApi\Routing\Tests\Fixtures\Controllers;

use OpenApi\Annotations as OA;
use Radebatz\OpenApi\Extras\Annotations as OAX;

/**
Expand All @@ -17,7 +18,7 @@ class InvokeController
* @OA\Get(
* path="/invoke/{name}",
* x={
* "name": "invoke"
* "name": "invoke"
* },
*
* @OA\Response(response="200", description="All good")
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/Controllers/MiddlewareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class MiddlewareController
* @OA\Get(
* path="/mw",
* x={
* "name": "mw",
* "middleware"={"Radebatz\OpenApi\Routing\Tests\Fixtures\Middleware\FooMiddleware", "Radebatz\OpenApi\Routing\Tests\Fixtures\Middleware\BarMiddleware"}
* "name": "mw",
* "middleware": {"Radebatz\OpenApi\Routing\Tests\Fixtures\Middleware\FooMiddleware", "Radebatz\OpenApi\Routing\Tests\Fixtures\Middleware\BarMiddleware"}
* },
*
* @OA\Response(response="200", description="All good")
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Controllers/NamedRouteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class NamedRouteController
* @OA\Get(
* path="/getya",
* x={
* "name": "getya"
* "name": "getya"
* },
*
* @OA\Response(response="200", description="All good")
Expand Down
10 changes: 5 additions & 5 deletions tests/Fixtures/Controllers/ParametersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ParametersController
* @OA\Get(
* path="/hey/{name}",
* x={
* "name": "hey"
* "name": "hey"
* },
*
* @OA\Parameter(
Expand All @@ -36,7 +36,7 @@ public function hey($name)
* @OA\Get(
* path="/oi/{name}",
* x={
* "name": "oi"
* "name": "oi"
* },
*
* @OA\Parameter(
Expand All @@ -62,7 +62,7 @@ public function oi($name = 'you')
* @OA\Get(
* path="/id/{id}",
* x={
* "name": "id"
* "name": "id"
* },
*
* @OA\Parameter(
Expand All @@ -89,7 +89,7 @@ public function id($id)
* @OA\Get(
* path="/hid/{hid}",
* x={
* "name": "hid"
* "name": "hid"
* },
*
* @OA\Parameter(
Expand All @@ -116,7 +116,7 @@ public function hid($hid)
* @OA\Get(
* path="/multi/{foo}/{bar}",
* x={
* "name": "multi"
* "name": "multi"
* },
*
* @OA\Parameter(
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Controllers/PrefixedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PrefixedController
* @OA\Get(
* path="/prefixed",
* x={
* "name": "prefixed"
* "name": "prefixed"
* },
*
* @OA\Response(response="200", description="All good")
Expand Down

0 comments on commit 98216f8

Please sign in to comment.