Skip to content

Commit c0ba631

Browse files
committed
PSR2 fixes
1 parent dd33dcb commit c0ba631

File tree

7 files changed

+36
-15
lines changed

7 files changed

+36
-15
lines changed

phpcs.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Project"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
5+
<description>Project PHP Code Style Rules</description>
6+
7+
<file>src</file>
8+
<file>tests</file>
9+
10+
<arg name="basepath" value="."/>
11+
<arg name="colors"/>
12+
<arg name="parallel" value="75"/>
13+
<arg value="np"/>
14+
15+
<exclude-pattern>*/.git/*</exclude-pattern>
16+
<exclude-pattern>*/vendor/*</exclude-pattern>
17+
18+
<rule ref="PSR2" />
19+
</ruleset>

src/Commands/Gozer.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,12 @@ public function getConnection()
135135
{
136136
try {
137137
/** @var \Doctrine\DBAL\Schema\AbstractSchemaManager $connection */
138-
$connection = app('db')->connection()->getDoctrineSchemaManager();
138+
return app('db')->connection()->getDoctrineSchemaManager();
139139
} catch (\Exception $e) {
140140
$this->error($e->getMessage());
141141

142142
return false;
143143
}
144-
145-
return $connection;
146144
}
147145

148146
/**
@@ -180,7 +178,7 @@ public function setDatabasePrefix($prefix = '')
180178
}
181179

182180
/**
183-
* @param array $tables
181+
* @param array|\Illuminate\Support\Collection $tables
184182
*
185183
* @return \Illuminate\Support\Collection
186184
*/

src/Facade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Superhelio\Commands;
34

45
class Facade extends \Illuminate\Support\Facades\Facade

src/ServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ public function register()
3636
private function registerReloader()
3737
{
3838
$this->app->singleton('command.superhelio.reload', function ($app) {
39-
return $app[ \Superhelio\Commands\Commands\Reload::class ];
39+
return $app[\Superhelio\Commands\Commands\Reload::class];
4040
});
4141
$this->commands('command.superhelio.reload');
4242
}
4343

4444
private function registerGozer()
4545
{
4646
$this->app->singleton('command.superhelio.gozer', function ($app) {
47-
return $app[ \Superhelio\Commands\Commands\Gozer::class ];
47+
return $app[\Superhelio\Commands\Commands\Gozer::class];
4848
});
4949
$this->commands('command.superhelio.gozer');
5050
}

tests/GozerTest.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Superhelio\Commands\Tests;
34

45
use ReflectionClass;
@@ -11,7 +12,7 @@ class GozerTest extends \Orchestra\Testbench\TestCase
1112
/**
1213
* Setup the test environment.
1314
*/
14-
public function setUp() : void
15+
public function setUp(): void
1516
{
1617
parent::setUp();
1718
$this->artisan('migrate', ['--database' => 'testbench']);
@@ -20,7 +21,7 @@ public function setUp() : void
2021
/**
2122
* Define environment setup.
2223
*
23-
* @param \Illuminate\Foundation\Application $app
24+
* @param \Illuminate\Foundation\Application $app
2425
*
2526
* @return void
2627
*/
@@ -42,7 +43,7 @@ protected function getEnvironmentSetUp($app)
4243
* In a normal app environment these would be added to
4344
* the 'providers' array in the config/app.php file.
4445
*
45-
* @param \Illuminate\Foundation\Application $app
46+
* @param \Illuminate\Foundation\Application $app
4647
*
4748
* @return array
4849
*/
@@ -101,12 +102,12 @@ public function test_gozer_finds_users_table()
101102
$connection = $gozer->getConnection();
102103

103104
$tables = $gozer->getTables($connection);
104-
self::assertContains( 'gozerTest__users', $tables );
105+
self::assertContains('gozerTest__users', $tables);
105106

106107
$gozer->setDatabasePrefix('gozerTest__');
107108
$filteredTables = $gozer->getFilteredTables($tables);
108109
self::assertTrue(is_a($filteredTables, \Illuminate\Support\Collection::class));
109-
self::assertContains( 'gozerTest__users', $filteredTables->toArray() );
110+
self::assertContains('gozerTest__users', $filteredTables->toArray());
110111
}
111112

112113
public function test_gozer_table_filtering_works()
@@ -123,9 +124,9 @@ public function test_gozer_table_filtering_works()
123124
$filtered = $gozer->getFilteredTables($tables);
124125
$array = $filtered->toArray();
125126

126-
self::assertNotContains( 'this_should_be_filtered', $array );
127-
self::assertNotContains( 'filter_me_too', $array );
128-
self::assertContains( 'gozerTest__users', $array );
129-
self::assertContains( 'gozerTest__migrations', $array );
127+
self::assertNotContains('this_should_be_filtered', $array);
128+
self::assertNotContains('filter_me_too', $array);
129+
self::assertContains('gozerTest__users', $array);
130+
self::assertContains('gozerTest__migrations', $array);
130131
}
131132
}

tests/ReloadTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Superhelio\Commands\Tests;
34

45
use Superhelio\Commands\Commands\Reload;

tests/Stubs/ServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Superhelio\Commands\Tests\Stubs;
34

45
class ServiceProvider extends \Illuminate\Support\ServiceProvider

0 commit comments

Comments
 (0)