mirror of
https://github.com/superhelio/commands.git
synced 2026-01-26 03:33:59 +00:00
PSR2 fixes
This commit is contained in:
19
phpcs.xml
Normal file
19
phpcs.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="Project"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
|
||||||
|
<description>Project PHP Code Style Rules</description>
|
||||||
|
|
||||||
|
<file>src</file>
|
||||||
|
<file>tests</file>
|
||||||
|
|
||||||
|
<arg name="basepath" value="."/>
|
||||||
|
<arg name="colors"/>
|
||||||
|
<arg name="parallel" value="75"/>
|
||||||
|
<arg value="np"/>
|
||||||
|
|
||||||
|
<exclude-pattern>*/.git/*</exclude-pattern>
|
||||||
|
<exclude-pattern>*/vendor/*</exclude-pattern>
|
||||||
|
|
||||||
|
<rule ref="PSR2" />
|
||||||
|
</ruleset>
|
||||||
@@ -135,14 +135,12 @@ class Gozer extends Command
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
/** @var \Doctrine\DBAL\Schema\AbstractSchemaManager $connection */
|
/** @var \Doctrine\DBAL\Schema\AbstractSchemaManager $connection */
|
||||||
$connection = app('db')->connection()->getDoctrineSchemaManager();
|
return app('db')->connection()->getDoctrineSchemaManager();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->error($e->getMessage());
|
$this->error($e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $connection;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,7 +178,7 @@ class Gozer extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $tables
|
* @param array|\Illuminate\Support\Collection $tables
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Superhelio\Commands;
|
namespace Superhelio\Commands;
|
||||||
|
|
||||||
class Facade extends \Illuminate\Support\Facades\Facade
|
class Facade extends \Illuminate\Support\Facades\Facade
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class ServiceProvider extends BaseServiceProvider
|
|||||||
private function registerReloader()
|
private function registerReloader()
|
||||||
{
|
{
|
||||||
$this->app->singleton('command.superhelio.reload', function ($app) {
|
$this->app->singleton('command.superhelio.reload', function ($app) {
|
||||||
return $app[ \Superhelio\Commands\Commands\Reload::class ];
|
return $app[\Superhelio\Commands\Commands\Reload::class];
|
||||||
});
|
});
|
||||||
$this->commands('command.superhelio.reload');
|
$this->commands('command.superhelio.reload');
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ class ServiceProvider extends BaseServiceProvider
|
|||||||
private function registerGozer()
|
private function registerGozer()
|
||||||
{
|
{
|
||||||
$this->app->singleton('command.superhelio.gozer', function ($app) {
|
$this->app->singleton('command.superhelio.gozer', function ($app) {
|
||||||
return $app[ \Superhelio\Commands\Commands\Gozer::class ];
|
return $app[\Superhelio\Commands\Commands\Gozer::class];
|
||||||
});
|
});
|
||||||
$this->commands('command.superhelio.gozer');
|
$this->commands('command.superhelio.gozer');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Superhelio\Commands\Tests;
|
namespace Superhelio\Commands\Tests;
|
||||||
|
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
@@ -11,7 +12,7 @@ class GozerTest extends \Orchestra\Testbench\TestCase
|
|||||||
/**
|
/**
|
||||||
* Setup the test environment.
|
* Setup the test environment.
|
||||||
*/
|
*/
|
||||||
public function setUp() : void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->artisan('migrate', ['--database' => 'testbench']);
|
$this->artisan('migrate', ['--database' => 'testbench']);
|
||||||
@@ -101,12 +102,12 @@ class GozerTest extends \Orchestra\Testbench\TestCase
|
|||||||
$connection = $gozer->getConnection();
|
$connection = $gozer->getConnection();
|
||||||
|
|
||||||
$tables = $gozer->getTables($connection);
|
$tables = $gozer->getTables($connection);
|
||||||
self::assertContains( 'gozerTest__users', $tables );
|
self::assertContains('gozerTest__users', $tables);
|
||||||
|
|
||||||
$gozer->setDatabasePrefix('gozerTest__');
|
$gozer->setDatabasePrefix('gozerTest__');
|
||||||
$filteredTables = $gozer->getFilteredTables($tables);
|
$filteredTables = $gozer->getFilteredTables($tables);
|
||||||
self::assertTrue(is_a($filteredTables, \Illuminate\Support\Collection::class));
|
self::assertTrue(is_a($filteredTables, \Illuminate\Support\Collection::class));
|
||||||
self::assertContains( 'gozerTest__users', $filteredTables->toArray() );
|
self::assertContains('gozerTest__users', $filteredTables->toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_gozer_table_filtering_works()
|
public function test_gozer_table_filtering_works()
|
||||||
@@ -123,9 +124,9 @@ class GozerTest extends \Orchestra\Testbench\TestCase
|
|||||||
$filtered = $gozer->getFilteredTables($tables);
|
$filtered = $gozer->getFilteredTables($tables);
|
||||||
$array = $filtered->toArray();
|
$array = $filtered->toArray();
|
||||||
|
|
||||||
self::assertNotContains( 'this_should_be_filtered', $array );
|
self::assertNotContains('this_should_be_filtered', $array);
|
||||||
self::assertNotContains( 'filter_me_too', $array );
|
self::assertNotContains('filter_me_too', $array);
|
||||||
self::assertContains( 'gozerTest__users', $array );
|
self::assertContains('gozerTest__users', $array);
|
||||||
self::assertContains( 'gozerTest__migrations', $array );
|
self::assertContains('gozerTest__migrations', $array);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Superhelio\Commands\Tests;
|
namespace Superhelio\Commands\Tests;
|
||||||
|
|
||||||
use Superhelio\Commands\Commands\Reload;
|
use Superhelio\Commands\Commands\Reload;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Superhelio\Commands\Tests\Stubs;
|
namespace Superhelio\Commands\Tests\Stubs;
|
||||||
|
|
||||||
class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||||
|
|||||||
Reference in New Issue
Block a user