Skip to content

Commit

Permalink
Update Styles
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgaber committed Feb 20, 2022
1 parent 3c1b094 commit 43585af
Show file tree
Hide file tree
Showing 21 changed files with 269 additions and 250 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ auth.json

.phpunit.result.cache
.php_cs.cache
.php-cs-fixer.cache
151 changes: 151 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?php

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$rules = [
'array_syntax' => ['syntax' => 'short'],
'align_multiline_comment' => ['comment_type' => 'phpdocs_only'],
'binary_operator_spaces' => [
'default' => 'single_space',
],
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => [
'statements' => ['return'],
],
'braces' => [
'position_after_anonymous_constructs' => 'next',
],
'cast_spaces' => true,
'class_attributes_separation' => [
'elements' => ['method' => 'one', 'trait_import' => 'none'],
],
'class_definition' => true,
'concat_space' => [
'spacing' => 'none',
],
'constant_case' => ['case' => 'lower'],
'declare_equal_normalize' => true,
'elseif' => true,
'encoding' => true,
'full_opening_tag' => true,
'fully_qualified_strict_types' => true, // added by Shift
'function_declaration' => true,
'function_typehint_space' => true,
'general_phpdoc_tag_rename' => true,
'heredoc_to_nowdoc' => true,
'include' => true,
'increment_style' => ['style' => 'post'],
'indentation_type' => true,
'linebreak_after_opening_tag' => true,
'line_ending' => true,
'lowercase_cast' => true,
'lowercase_keywords' => true,
'lowercase_static_reference' => true, // added from Symfony
'magic_method_casing' => true, // added from Symfony
'magic_constant_casing' => true,
'method_argument_space' => true,
'native_function_casing' => true,
'no_alias_functions' => true,
'no_extra_blank_lines' => [
'tokens' => [
'extra',
'throw',
'use',
],
],
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_closing_tag' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => [
'use' => 'echo',
],
'no_multiline_whitespace_around_double_arrow' => true,
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => true,
'no_spaces_inside_parenthesis' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unneeded_control_parentheses' => true,
'no_unreachable_default_argument_value' => true,
'no_unused_imports' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'normalize_index_brace' => true,
'not_operator_with_successor_space' => true,
'object_operator_without_whitespace' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'phpdoc_indent' => true,
'phpdoc_inline_tag_normalizer' => true,
'phpdoc_no_access' => true,
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_scalar' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => true,
'phpdoc_tag_type' => [
'tags' => ['inheritdoc' => 'inline'],
],
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'psr_autoloading' => true,
'self_accessor' => true,
'short_scalar_cast' => true,
'simplified_null_return' => true,
'single_blank_line_at_eof' => true,
'single_blank_line_before_namespace' => true,
'single_class_element_per_statement' => true,
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'single_line_comment_style' => [
'comment_types' => ['hash'],
],
'single_quote' => true,
'space_after_semicolon' => true,
'standardize_not_equals' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline' => [
'elements' => ['arrays'],
],
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => [
'elements' => ['method', 'property'],
],
'whitespace_after_comma_in_array' => true,
];
$finder = Finder::create()
->notPath('bootstrap')
->notPath('storage')
->notPath('vendor')
->in(getcwd())
->name('*.php')
->notName('*.blade.php')
->notName('index.php')
->notName('server.php')
->notName('_ide_helper.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

return (new Config)
->setFinder($finder)
->setRules($rules)
->setRiskyAllowed(true)
->setUsingCache(true);
143 changes: 0 additions & 143 deletions .php_cs.dist

This file was deleted.

1 change: 1 addition & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ preset: laravel

disabled:
- single_class_element_per_statement
- laravel_braces
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"phpunit/phpunit": "^9.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
"friendsofphp/php-cs-fixer": "^3.0",
"orchestra/testbench": "^6.0"
},
"repositories": [
Expand Down
4 changes: 2 additions & 2 deletions src/Actions/MockAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class MockAction extends MockComponent
/**
* Dispatches the Action, and returns a test handler for the Action response.
*
* @param array $fields A set of action fields send to the Action, as a key-value array
* @param Model|Model[]|Collection $models A set of models sent to the Action
* @param array $fields A set of action fields send to the Action, as a key-value array
* @param Model|Model[]|Collection $models A set of models sent to the Action
* @return MockActionResponse A mock class for testing Nova Action responses
*/
public function handle(array $fields, $models): MockActionResponse
Expand Down
12 changes: 6 additions & 6 deletions src/Actions/MockActionElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct(Action $action)
/**
* Assert that the action can be shown on the index view.
*
* @param string $message
* @param string $message
* @return $this
*/
public function assertShownOnIndex(string $message = ''): self
Expand All @@ -30,7 +30,7 @@ public function assertShownOnIndex(string $message = ''): self
/**
* Assert that the action is hidden from the index view.
*
* @param string $message
* @param string $message
* @return $this
*/
public function assertHiddenFromIndex(string $message = ''): self
Expand All @@ -43,7 +43,7 @@ public function assertHiddenFromIndex(string $message = ''): self
/**
* Assert that the action can be shown on the detail view.
*
* @param string $message
* @param string $message
* @return $this
*/
public function assertShownOnDetail(string $message = ''): self
Expand All @@ -56,7 +56,7 @@ public function assertShownOnDetail(string $message = ''): self
/**
* Assert that the action is hidden from the detail view.
*
* @param string $message
* @param string $message
* @return $this
*/
public function assertHiddenFromDetail(string $message = ''): self
Expand All @@ -69,7 +69,7 @@ public function assertHiddenFromDetail(string $message = ''): self
/**
* Assert that the action can be shown on table rows.
*
* @param string $message
* @param string $message
* @return $this
*/
public function assertShownOnTableRow(string $message = ''): self
Expand All @@ -82,7 +82,7 @@ public function assertShownOnTableRow(string $message = ''): self
/**
* Assert that the action is hidden from table rows.
*
* @param string $message
* @param string $message
* @return $this
*/
public function assertHiddenFromTableRow(string $message = ''): self
Expand Down
Loading

0 comments on commit 43585af

Please sign in to comment.