Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Sairahcaz authored and github-actions[bot] committed Jul 19, 2023
1 parent 710208f commit 2000464
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"php":"8.2.7","version":"3.20.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_typehint":true,"curly_braces_position":{"allow_single_line_empty_anonymous_classes":true},"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"sort_algorithm":"alpha"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"class_attributes_separation":{"elements":{"method":"one"}}},"hashes":{"src\/Commands\/GenerateRulesCommand.php":"a500ac55c779ee5246dd3e77417d4fe2","src\/LaravelSchemaRulesServiceProvider.php":"c368b1f24fdf572c8c5da6d90e4fe8f9","src\/Resolvers\/SchemaRulesResolverMySql.php":"6ce5e561e87b6885fe800a331b3a832f","src\/Resolvers\/SchemaRulesResolverPgSql.php":"fa8d9ec3061744b5e48b5f3207fcb5ee","src\/Resolvers\/SchemaRulesResolverSqlite.php":"3a790800d813e42ada906e20fc70a399","src\/Resolvers\/SchemaRulesResolverInterface.php":"c40de2c178467b5a592a80fab75d4e37","src\/Exceptions\/FailedToCreateRequestClassException.php":"88d97c20dfda22508445696a600edd8f","src\/Exceptions\/UnsupportedDbDriverException.php":"55e1f4f48764869ea78e5444357e7a3a","src\/Exceptions\/ColumnDoesNotExistException.php":"e1b74bfac1771e4ae77962805adb3173","src\/Exceptions\/MultipleTablesSuppliedException.php":"44534013008741de6a024fd8c0fc62e2","src\/Exceptions\/TableDoesNotExistException.php":"d19bb30aab5ede9920cc925f9d4b3cde","tests\/TestCase.php":"17d5b78ef193fff416305ee717483177","tests\/Pest.php":"71da07894ee59b1ebc0e98d205618731","tests\/SchemaRulesTest.php":"90e6c084c25da8aab935b3e50a5eba4e"}}
{"php":"8.2.7","version":"3.20.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_typehint":true,"curly_braces_position":{"allow_single_line_empty_anonymous_classes":true},"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"sort_algorithm":"alpha"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"class_attributes_separation":{"elements":{"method":"one"}}},"hashes":{"src\/Commands\/GenerateRulesCommand.php":"efe430d939ae29e942fd34608d465458","src\/LaravelSchemaRulesServiceProvider.php":"7e21700c24396b1b3ae4093f5a611a34","src\/Resolvers\/SchemaRulesResolverMySql.php":"c50b48648ad7adbc48b871e9f4c9dff2","src\/Resolvers\/SchemaRulesResolverPgSql.php":"4a3570d5b48c8e007966c392522b4771","src\/Resolvers\/SchemaRulesResolverSqlite.php":"f6d30cd50082722c8991f8afeaf6bbbd","src\/Resolvers\/SchemaRulesResolverInterface.php":"c40de2c178467b5a592a80fab75d4e37","src\/Exceptions\/FailedToCreateRequestClassException.php":"88d97c20dfda22508445696a600edd8f","src\/Exceptions\/UnsupportedDbDriverException.php":"55e1f4f48764869ea78e5444357e7a3a","src\/Exceptions\/ColumnDoesNotExistException.php":"e1b74bfac1771e4ae77962805adb3173","src\/Exceptions\/MultipleTablesSuppliedException.php":"44534013008741de6a024fd8c0fc62e2","src\/Exceptions\/TableDoesNotExistException.php":"d19bb30aab5ede9920cc925f9d4b3cde","tests\/TestCase.php":"17d5b78ef193fff416305ee717483177","tests\/Pest.php":"71da07894ee59b1ebc0e98d205618731","tests\/SchemaRulesTest.php":"2279a35708710e8a0a78b4edfc8f0095","src\/Resolvers\/BaseSchemaRulesResolver.php":"85f5dcca23e897416d93b4830437a445","src\/Contracts\/SchemaRulesResolverInterface.php":"0661d95c8ab20c86180132b20002e8b9"}}
2 changes: 1 addition & 1 deletion src/Commands/GenerateRulesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
use LaracraftTech\LaravelSchemaRules\Contracts\SchemaRulesResolverInterface;
use LaracraftTech\LaravelSchemaRules\Exceptions\ColumnDoesNotExistException;
use LaracraftTech\LaravelSchemaRules\Exceptions\FailedToCreateRequestClassException;
use LaracraftTech\LaravelSchemaRules\Exceptions\MultipleTablesSuppliedException;
use LaracraftTech\LaravelSchemaRules\Exceptions\TableDoesNotExistException;
use LaracraftTech\LaravelSchemaRules\Contracts\SchemaRulesResolverInterface;

class GenerateRulesCommand extends Command
{
Expand Down
2 changes: 1 addition & 1 deletion src/LaravelSchemaRulesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace LaracraftTech\LaravelSchemaRules;

use LaracraftTech\LaravelSchemaRules\Commands\GenerateRulesCommand;
use LaracraftTech\LaravelSchemaRules\Exceptions\UnsupportedDbDriverException;
use LaracraftTech\LaravelSchemaRules\Contracts\SchemaRulesResolverInterface;
use LaracraftTech\LaravelSchemaRules\Exceptions\UnsupportedDbDriverException;
use LaracraftTech\LaravelSchemaRules\Resolvers\SchemaRulesResolverMySql;
use LaracraftTech\LaravelSchemaRules\Resolvers\SchemaRulesResolverPgSql;
use LaracraftTech\LaravelSchemaRules\Resolvers\SchemaRulesResolverSqlite;
Expand Down
6 changes: 2 additions & 4 deletions src/Resolvers/BaseSchemaRulesResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

abstract class BaseSchemaRulesResolver implements SchemaRulesResolverInterface
{

private string $table;
private array $columns;

Expand Down Expand Up @@ -58,12 +57,11 @@ protected function columns()
return $this->columns;
}

abstract protected function isAutoIncrement($column) : bool;
abstract protected function isAutoIncrement($column): bool;

abstract protected function getField($column) : string;
abstract protected function getField($column): string;

abstract protected function getColumnsDefinitionsFromTable();

abstract protected function generateColumnRules(stdClass $column): array;

}
6 changes: 2 additions & 4 deletions src/Resolvers/SchemaRulesResolverMySql.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

class SchemaRulesResolverMySql extends BaseSchemaRulesResolver implements SchemaRulesResolverInterface
{

public static array $integerTypes = [
'tinyint' => [
'unsigned' => ['0', '255'],
Expand Down Expand Up @@ -140,14 +139,13 @@ protected function generateColumnRules(stdClass $column): array
return $columnRules;
}

protected function isAutoIncrement($column) : bool
protected function isAutoIncrement($column): bool
{
return $column->Extra === 'auto_increment';
}

protected function getField($column) : string
protected function getField($column): string
{
return $column->Field;
}

}
6 changes: 2 additions & 4 deletions src/Resolvers/SchemaRulesResolverPgSql.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

class SchemaRulesResolverPgSql extends BaseSchemaRulesResolver implements SchemaRulesResolverInterface
{

public static array $integerTypes = [
'smallint' => ['-32768', '32767'],
'integer' => ['-2147483648', '2147483647'],
Expand Down Expand Up @@ -120,14 +119,13 @@ protected function generateColumnRules(stdClass $column): array
return $columnRules;
}

protected function isAutoIncrement($column) : bool
protected function isAutoIncrement($column): bool
{
return Str::contains($column->column_default, 'nextval');
}

protected function getField($column) : string
protected function getField($column): string
{
return $column->column_name;
}

}
5 changes: 2 additions & 3 deletions src/Resolvers/SchemaRulesResolverSqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

class SchemaRulesResolverSqlite extends BaseSchemaRulesResolver implements SchemaRulesResolverInterface
{

protected function getColumnsDefinitionsFromTable()
{

Expand Down Expand Up @@ -73,12 +72,12 @@ protected function generateColumnRules(stdClass $column): array
return $columnRules;
}

protected function isAutoIncrement($column) : bool
protected function isAutoIncrement($column): bool
{
return $column->pk;
}

protected function getField($column) : string
protected function getField($column): string
{
return $column->name;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/SchemaRulesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use LaracraftTech\LaravelSchemaRules\Contracts\SchemaRulesResolverInterface;
use LaracraftTech\LaravelSchemaRules\Exceptions\ColumnDoesNotExistException;
use LaracraftTech\LaravelSchemaRules\Exceptions\MultipleTablesSuppliedException;
use LaracraftTech\LaravelSchemaRules\Exceptions\TableDoesNotExistException;
use LaracraftTech\LaravelSchemaRules\Contracts\SchemaRulesResolverInterface;
use LaracraftTech\LaravelSchemaRules\Resolvers\SchemaRulesResolverMySql;

beforeEach(function () {
Expand Down

0 comments on commit 2000464

Please sign in to comment.