Skip to content

Commit d078b79

Browse files
authored
Laravel Pint (#112)
* migration * automated fixes
1 parent 16a979f commit d078b79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2766
-2816
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ root = true
22

33
[*]
44
charset = utf-8
5-
indent_size = 2
5+
indent_size = 4
66
indent_style = space
77
end_of_line = lf
88
insert_final_newline = true

.github/workflows/php-cs-fixer.yml renamed to .github/workflows/pint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
php-cs-fixer:
11-
name: PHP CS Fixer
11+
name: Pint
1212

1313
runs-on: ubuntu-latest
1414

@@ -26,4 +26,4 @@ jobs:
2626
run: composer install --prefer-dist --no-interaction
2727

2828
- name: Run PHP CS Fixer
29-
run: PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes --diff --dry-run
29+
run: ./vendor/bin/pint --test

.php-cs-fixer.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
},
1919
"require-dev": {
2020
"doctrine/dbal": "^3.5.3",
21-
"friendsofphp/php-cs-fixer": "^3.14.3",
22-
"jubeki/laravel-code-style": "^1.2",
2321
"larastan/larastan": "^1.0|^2.4",
22+
"laravel/pint": "^1.14",
2423
"orchestra/testbench": "^8.0",
2524
"pestphp/pest": "^2.0",
2625
"pestphp/pest-plugin-laravel": "^2.0"
@@ -36,7 +35,7 @@
3635
}
3736
},
3837
"scripts": {
39-
"php-cs-fixer": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes",
38+
"pint": "./vendor/bin/pint",
4039
"phpstan": "./vendor/bin/phpstan analyse --memory-limit=2G",
4140
"pest:mysql": "DB_PORT=3307 ./vendor/bin/pest",
4241
"pest:postgres": "DB_CONNECTION=pgsql DB_PORT=5433 ./vendor/bin/pest",

src/AxisOrder.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,37 @@
1111
/** @codeCoverageIgnore */
1212
class AxisOrder
1313
{
14-
public static function supported(ConnectionInterface $connection): bool
15-
{
16-
if (self::isMariaDb($connection)) {
17-
return false;
18-
}
19-
20-
if (self::isMySql8OrAbove($connection)) {
21-
return true;
22-
}
14+
public static function supported(ConnectionInterface $connection): bool
15+
{
16+
if (self::isMariaDb($connection)) {
17+
return false;
18+
}
2319

24-
return false;
25-
}
20+
if (self::isMySql8OrAbove($connection)) {
21+
return true;
22+
}
2623

27-
private static function isMariaDb(ConnectionInterface $connection): bool
28-
{
29-
if (! ($connection instanceof MySqlConnection)) {
30-
return false;
24+
return false;
3125
}
3226

33-
return $connection->isMaria();
34-
}
27+
private static function isMariaDb(ConnectionInterface $connection): bool
28+
{
29+
if (! ($connection instanceof MySqlConnection)) {
30+
return false;
31+
}
3532

36-
private static function isMySql8OrAbove(ConnectionInterface $connection): bool
37-
{
38-
if (! ($connection instanceof MySqlConnection)) {
39-
return false;
33+
return $connection->isMaria();
4034
}
4135

42-
/** @var string $version */
43-
$version = $connection->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION);
36+
private static function isMySql8OrAbove(ConnectionInterface $connection): bool
37+
{
38+
if (! ($connection instanceof MySqlConnection)) {
39+
return false;
40+
}
4441

45-
return version_compare($version, '8.0.0', '>=');
46-
}
42+
/** @var string $version */
43+
$version = $connection->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION);
44+
45+
return version_compare($version, '8.0.0', '>=');
46+
}
4747
}

src/Doctrine/GeographyType.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
/** @codeCoverageIgnore */
1111
class GeographyType extends Type
1212
{
13-
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14-
{
15-
return 'geography';
16-
}
13+
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14+
{
15+
return 'geography';
16+
}
1717

18-
public function getName(): string
19-
{
20-
return 'geography';
21-
}
18+
public function getName(): string
19+
{
20+
return 'geography';
21+
}
2222
}

src/Doctrine/GeometryCollectionType.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
/** @codeCoverageIgnore */
1111
class GeometryCollectionType extends Type
1212
{
13-
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14-
{
15-
return 'geometrycollection';
16-
}
13+
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14+
{
15+
return 'geometrycollection';
16+
}
1717

18-
public function getName(): string
19-
{
20-
return 'geometrycollection';
21-
}
18+
public function getName(): string
19+
{
20+
return 'geometrycollection';
21+
}
2222
}

src/Doctrine/GeometryType.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
/** @codeCoverageIgnore */
1111
class GeometryType extends Type
1212
{
13-
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14-
{
15-
return 'geometry';
16-
}
13+
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14+
{
15+
return 'geometry';
16+
}
1717

18-
public function getName(): string
19-
{
20-
return 'geometry';
21-
}
18+
public function getName(): string
19+
{
20+
return 'geometry';
21+
}
2222
}

src/Doctrine/LineStringType.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
/** @codeCoverageIgnore */
1111
class LineStringType extends Type
1212
{
13-
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14-
{
15-
return 'linestring';
16-
}
13+
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14+
{
15+
return 'linestring';
16+
}
1717

18-
public function getName(): string
19-
{
20-
return 'linestring';
21-
}
18+
public function getName(): string
19+
{
20+
return 'linestring';
21+
}
2222
}

src/Doctrine/MultiLineStringType.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
/** @codeCoverageIgnore */
1111
class MultiLineStringType extends Type
1212
{
13-
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14-
{
15-
return 'multilinestring';
16-
}
13+
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14+
{
15+
return 'multilinestring';
16+
}
1717

18-
public function getName(): string
19-
{
20-
return 'multilinestring';
21-
}
18+
public function getName(): string
19+
{
20+
return 'multilinestring';
21+
}
2222
}

src/Doctrine/MultiPointType.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
/** @codeCoverageIgnore */
1111
class MultiPointType extends Type
1212
{
13-
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14-
{
15-
return 'multipoint';
16-
}
13+
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14+
{
15+
return 'multipoint';
16+
}
1717

18-
public function getName(): string
19-
{
20-
return 'multipoint';
21-
}
18+
public function getName(): string
19+
{
20+
return 'multipoint';
21+
}
2222
}

src/Doctrine/MultiPolygonType.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
/** @codeCoverageIgnore */
1111
class MultiPolygonType extends Type
1212
{
13-
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14-
{
15-
return 'multipolygon';
16-
}
13+
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14+
{
15+
return 'multipolygon';
16+
}
1717

18-
public function getName(): string
19-
{
20-
return 'multipolygon';
21-
}
18+
public function getName(): string
19+
{
20+
return 'multipolygon';
21+
}
2222
}

src/Doctrine/PointType.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
/** @codeCoverageIgnore */
1111
class PointType extends Type
1212
{
13-
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14-
{
15-
return 'point';
16-
}
13+
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14+
{
15+
return 'point';
16+
}
1717

18-
public function getName(): string
19-
{
20-
return 'point';
21-
}
18+
public function getName(): string
19+
{
20+
return 'point';
21+
}
2222
}

src/Doctrine/PolygonType.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
/** @codeCoverageIgnore */
1111
class PolygonType extends Type
1212
{
13-
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14-
{
15-
return 'polygon';
16-
}
13+
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
14+
{
15+
return 'polygon';
16+
}
1717

18-
public function getName(): string
19-
{
20-
return 'polygon';
21-
}
18+
public function getName(): string
19+
{
20+
return 'polygon';
21+
}
2222
}

src/EloquentSpatialServiceProvider.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,34 @@
1919

2020
class EloquentSpatialServiceProvider extends DatabaseServiceProvider
2121
{
22-
public function boot(): void
23-
{
24-
/** @var Connection $connection */
25-
$connection = DB::connection();
22+
public function boot(): void
23+
{
24+
/** @var Connection $connection */
25+
$connection = DB::connection();
2626

27-
if ($connection->isDoctrineAvailable()) {
28-
$this->registerDoctrineTypes($connection);
27+
if ($connection->isDoctrineAvailable()) {
28+
$this->registerDoctrineTypes($connection);
29+
}
2930
}
30-
}
3131

32-
protected function registerDoctrineTypes(Connection $connection): void
33-
{
34-
$geometries = [
35-
'point' => PointType::class,
36-
'linestring' => LineStringType::class,
37-
'multipoint' => MultiPointType::class,
38-
'polygon' => PolygonType::class,
39-
'multilinestring' => MultiLineStringType::class,
40-
'multipolygon' => MultiPolygonType::class,
41-
'geometrycollection' => GeometryCollectionType::class,
42-
'geomcollection' => GeometryCollectionType::class,
43-
'geography' => GeographyType::class,
44-
'geometry' => GeometryType::class,
45-
];
32+
protected function registerDoctrineTypes(Connection $connection): void
33+
{
34+
$geometries = [
35+
'point' => PointType::class,
36+
'linestring' => LineStringType::class,
37+
'multipoint' => MultiPointType::class,
38+
'polygon' => PolygonType::class,
39+
'multilinestring' => MultiLineStringType::class,
40+
'multipolygon' => MultiPolygonType::class,
41+
'geometrycollection' => GeometryCollectionType::class,
42+
'geomcollection' => GeometryCollectionType::class,
43+
'geography' => GeographyType::class,
44+
'geometry' => GeometryType::class,
45+
];
4646

47-
foreach ($geometries as $type => $class) {
48-
DB::registerDoctrineType($class, $type, $type);
49-
$connection->registerDoctrineType($class, $type, $type);
47+
foreach ($geometries as $type => $class) {
48+
DB::registerDoctrineType($class, $type, $type);
49+
$connection->registerDoctrineType($class, $type, $type);
50+
}
5051
}
51-
}
5252
}

src/Enums/Srid.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
enum Srid: int
66
{
7-
case WGS84 = 4326; // https://epsg.org/crs_4326/WGS-84.html
8-
case WEB_MERCATOR = 3857; //https://epsg.org/crs_3857/WGS-84-Pseudo-Mercator.html
7+
case WGS84 = 4326; // https://epsg.org/crs_4326/WGS-84.html
8+
case WEB_MERCATOR = 3857; //https://epsg.org/crs_3857/WGS-84-Pseudo-Mercator.html
99
}

0 commit comments

Comments
 (0)