Skip to content

Commit dfe9fc3

Browse files
committed
php-cs-fixer & fixes
1 parent e903124 commit dfe9fc3

5 files changed

Lines changed: 60 additions & 18 deletions

File tree

.php-cs-fixer.dist.php

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,60 @@
1313
->setRules([
1414
'@PSR12' => true,
1515
'@PER-CS' => true,
16-
'@PHP82Migration' => true,
16+
'@PHP8x2Migration' => true,
1717
'trailing_comma_in_multiline' => false,
18-
'cast_spaces' => false,
18+
'cast_spaces' => ['space' => 'none'],
1919
'single_line_empty_body' => false,
20-
'no_unused_imports' => true
20+
'no_unused_imports' => true,
21+
// rules for phpdoc
22+
// Removes @param, @return and @var tags that don't provide any useful information - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:no_superfluous_phpdoc_tags
23+
'no_superfluous_phpdoc_tags' => [
24+
'allow_mixed' => true,
25+
'remove_inheritdoc' => true,
26+
],
27+
// require phpdoc for non typed arguments - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_add_missing_param_annotation
28+
'phpdoc_add_missing_param_annotation' => true,
29+
// no @access - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_no_access
30+
'phpdoc_no_access' => true,
31+
// no @package - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_no_package
32+
'phpdoc_no_package' => true,
33+
// order phpdoc tags - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_order
34+
'phpdoc_order' => ['order' => ['since', 'var', 'see', 'param', 'return', 'throw', 'todo', 'deprecated']],
35+
// phpdoc param in same order as signature - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_param_order
36+
'phpdoc_param_order' => true,
37+
// align tags - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_align
38+
'phpdoc_align' => [
39+
'align' => 'vertical',
40+
'tags' => [
41+
'param',
42+
'property',
43+
'property-read',
44+
'property-write',
45+
'phpstan-param',
46+
'phpstan-property',
47+
'phpstan-property-read',
48+
'phpstan-property-write',
49+
'phpstan-assert',
50+
'phpstan-assert-if-true',
51+
'phpstan-assert-if-false',
52+
'psalm-param',
53+
'psalm-param-out',
54+
'psalm-property',
55+
'psalm-property-read',
56+
'psalm-property-write',
57+
'psalm-assert',
58+
'psalm-assert-if-true',
59+
'psalm-assert-if-false'
60+
],
61+
],
62+
// Check types case - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_types
63+
'phpdoc_types' => true,
64+
// Use native scalar types - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_scalar
65+
'phpdoc_scalar' => true,
66+
// remove extra empty lines - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_trim
67+
'phpdoc_trim' => true,
68+
// remove empty lines inside phpdoc block - https://mlocati.github.io/php-cs-fixer-configurator/#version:3.90|fixer:phpdoc_trim_consecutive_blank_line_separation
69+
'phpdoc_trim_consecutive_blank_line_separation' => true,
2170
])
2271
->setFinder($finder)
2372
;

lib/GaletteMaps/Controllers/MapsController.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ class MapsController extends AbstractPluginController
5151
*
5252
* @param Request $request PSR Request
5353
* @param Response $response PSR Response
54-
*
55-
* @return Response
5654
*/
5755
public function map(Request $request, Response $response): Response
5856
{
@@ -89,8 +87,6 @@ public function map(Request $request, Response $response): Response
8987
* @param Request $request PSR Request
9088
* @param Response $response PSR Response
9189
* @param ?int $id Member ID
92-
*
93-
* @return Response
9490
*/
9591
public function localizeMember(Request $request, Response $response, ?int $id = null): Response
9692
{
@@ -178,8 +174,6 @@ public function localizeMember(Request $request, Response $response, ?int $id =
178174
* @param Request $request PSR Request
179175
* @param Response $response PSR Response
180176
* @param ?int $id Member ID
181-
*
182-
* @return Response
183177
*/
184178
public function ILiveHere(Request $request, Response $response, ?int $id = null): Response
185179
{

lib/GaletteMaps/Coordinates.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,6 @@ public function listCoords(): array
196196
* @param int $id Member id
197197
* @param float $latitude Latitude
198198
* @param float $longitude Longitude
199-
*
200-
* @return bool
201199
*/
202200
public function setCoords(int $id, float $latitude, float $longitude): bool
203201
{
@@ -243,8 +241,6 @@ public function setCoords(int $id, float $latitude, float $longitude): bool
243241
* Remove member coordinates
244242
*
245243
* @param int $id Member id
246-
*
247-
* @return bool
248244
*/
249245
public function removeCoords(int $id): bool
250246
{
@@ -267,8 +263,6 @@ public function removeCoords(int $id): bool
267263

268264
/**
269265
* Get table's name
270-
*
271-
* @return string
272266
*/
273267
protected function getTableName(): string
274268
{

tests/GaletteMaps/tests/units/Coordinates.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* along with Galette. If not, see <http://www.gnu.org/licenses/>.
2020
*/
2121

22+
declare(strict_types=1);
23+
2224
namespace GaletteMaps\tests\units;
2325

2426
use Galette\Tests\GaletteTestCase;
@@ -34,8 +36,6 @@ class Coordinates extends GaletteTestCase
3436

3537
/**
3638
* Cleanup after each test method
37-
*
38-
* @return void
3939
*/
4040
public function tearDown(): void
4141
{
@@ -44,6 +44,9 @@ public function tearDown(): void
4444
parent::tearDown();
4545
}
4646

47+
/**
48+
* Test coordinates
49+
*/
4750
public function testCoordinates(): void
4851
{
4952
$member = $this->getMemberOne();

tests/TestsBootstrap.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@
1919
* along with Galette. If not, see <http://www.gnu.org/licenses/>.
2020
*/
2121

22+
declare(strict_types=1);
23+
2224
/**
2325
* Bootstrap tests file for Galette Auto plugin
2426
*
2527
* @author Johan Cwiklinski <johan@x-tnd.be>
2628
*/
2729

2830
define('GALETTE_PLUGINS_PATH', __DIR__ . '/../../');
29-
$basepath = '../../../galette/';
31+
$basepath = '../../../galette/'; // phpcs:ignore SlevomatCodingStandard.Variables.UnusedVariable.UnusedVariable -- used from Core testBootstrap
3032

3133
include_once '../../../tests/TestsBootstrap.php';
3234
require_once __DIR__ . '/../_config.inc.php';

0 commit comments

Comments
 (0)