From 43585aff2680c672f39d4a6fae37024d9908fb27 Mon Sep 17 00:00:00 2001 From: Josh Gaber Date: Sun, 20 Feb 2022 16:59:26 -0500 Subject: [PATCH] Update Styles --- .gitignore | 1 + .php-cs-fixer.dist.php | 151 +++++++++++++++++++++++++++++ .php_cs.dist | 143 --------------------------- .styleci.yml | 1 + composer.json | 2 +- src/Actions/MockAction.php | 4 +- src/Actions/MockActionElement.php | 12 +-- src/Actions/MockActionResponse.php | 26 ++--- src/Actions/NovaActionTest.php | 3 +- src/Fields/FieldHelper.php | 10 +- src/Fields/MockFieldElement.php | 48 ++++----- src/Filters/MockFilter.php | 19 ++-- src/Filters/MockFilterQuery.php | 12 +-- src/Filters/NovaFilterTest.php | 3 +- src/Lenses/MockLens.php | 15 +-- src/Lenses/MockLensQuery.php | 16 +-- src/Lenses/NovaLensTest.php | 5 +- src/Resources/NovaResourceTest.php | 5 +- src/Traits/ActionAssertions.php | 15 +-- src/Traits/FieldAssertions.php | 16 +-- src/Traits/FilterAssertions.php | 12 +-- 21 files changed, 269 insertions(+), 250 deletions(-) create mode 100644 .php-cs-fixer.dist.php delete mode 100644 .php_cs.dist diff --git a/.gitignore b/.gitignore index 0a71d0a..4667f94 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ auth.json .phpunit.result.cache .php_cs.cache +.php-cs-fixer.cache diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..2851cac --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,151 @@ + ['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); diff --git a/.php_cs.dist b/.php_cs.dist deleted file mode 100644 index c27f0e4..0000000 --- a/.php_cs.dist +++ /dev/null @@ -1,143 +0,0 @@ - ['syntax' => 'short'], - 'binary_operator_spaces' => [ - 'default' => 'single_space', - ], - 'blank_line_after_namespace' => true, - 'blank_line_after_opening_tag' => true, - 'blank_line_before_statement' => [ - 'statements' => ['return'], - ], - 'braces' => true, - 'cast_spaces' => true, - 'class_attributes_separation' => [ - 'elements' => ['method'], - ], - 'class_definition' => true, - 'concat_space' => [ - 'spacing' => 'none', - ], - '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, - '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_constants' => 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', - 'use_trait', - ], - ], - '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' => ['sortAlgorithm' => 'alpha'], - 'phpdoc_indent' => true, - 'phpdoc_inline_tag' => 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_to_comment' => true, - 'phpdoc_trim' => true, - 'phpdoc_types' => true, - 'phpdoc_var_without_name' => true, - 'psr4' => 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_array' => true, - '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 Config::create() - ->setFinder($finder) - ->setRules($rules) - ->setRiskyAllowed(true) - ->setUsingCache(true); diff --git a/.styleci.yml b/.styleci.yml index f4d3cbc..90a5631 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -2,3 +2,4 @@ preset: laravel disabled: - single_class_element_per_statement + - laravel_braces diff --git a/composer.json b/composer.json index 6bbace3..f849c7a 100644 --- a/composer.json +++ b/composer.json @@ -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": [ diff --git a/src/Actions/MockAction.php b/src/Actions/MockAction.php index 70e3d51..8fbd3be 100644 --- a/src/Actions/MockAction.php +++ b/src/Actions/MockAction.php @@ -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 diff --git a/src/Actions/MockActionElement.php b/src/Actions/MockActionElement.php index f05db5c..2041732 100644 --- a/src/Actions/MockActionElement.php +++ b/src/Actions/MockActionElement.php @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/src/Actions/MockActionResponse.php b/src/Actions/MockActionResponse.php index 69ce732..e8688f0 100644 --- a/src/Actions/MockActionResponse.php +++ b/src/Actions/MockActionResponse.php @@ -18,8 +18,8 @@ public function __construct($response = null) /** * Asserts the handle response is of the given type. * - * @param string $type - * @param string $message + * @param string $type + * @param string $message * @return $this */ public function assertResponseType(string $type, string $message = ''): self @@ -39,7 +39,7 @@ public function assertResponseType(string $type, string $message = ''): self /** * Asserts the handle response is of type "message". * - * @param string $message + * @param string $message * @return $this */ public function assertMessage(string $message = ''): self @@ -50,7 +50,7 @@ public function assertMessage(string $message = ''): self /** * Asserts the handle response is of type "danger". * - * @param string $message + * @param string $message * @return $this */ public function assertDanger(string $message = ''): self @@ -61,7 +61,7 @@ public function assertDanger(string $message = ''): self /** * Asserts the handle response is of type "deleted". * - * @param string $message + * @param string $message * @return $this */ public function assertDeleted(string $message = ''): self @@ -72,7 +72,7 @@ public function assertDeleted(string $message = ''): self /** * Asserts the handle response is of type "redirect". * - * @param string $message + * @param string $message * @return $this */ public function assertRedirect(string $message = ''): self @@ -83,7 +83,7 @@ public function assertRedirect(string $message = ''): self /** * Asserts the handle response is of type "push". * - * @param string $message + * @param string $message * @return $this */ public function assertPush(string $message = ''): self @@ -94,7 +94,7 @@ public function assertPush(string $message = ''): self /** * Asserts the handle response is of type "openInNewTab". * - * @param string $message + * @param string $message * @return $this */ public function assertOpenInNewTab(string $message = ''): self @@ -105,7 +105,7 @@ public function assertOpenInNewTab(string $message = ''): self /** * Asserts the handle response is of type "download". * - * @param string $message + * @param string $message * @return $this */ public function assertDownload(string $message = ''): self @@ -130,8 +130,8 @@ private function assertResponseContains(string $contents, string $type, string $ /** * Asserts the handle response is a "message" and contains the given text. * - * @param string $contents The text to assert is in the response - * @param string $message + * @param string $contents The text to assert is in the response + * @param string $message * @return $this */ public function assertMessageContains(string $contents, string $message = ''): self @@ -142,8 +142,8 @@ public function assertMessageContains(string $contents, string $message = ''): s /** * Asserts the handle response is a "danger" and contains the given text. * - * @param string $contents The text to assert is in the response - * @param string $message + * @param string $contents The text to assert is in the response + * @param string $message * @return $this */ public function assertDangerContains(string $contents, string $message = ''): self diff --git a/src/Actions/NovaActionTest.php b/src/Actions/NovaActionTest.php index 89d816a..39c6648 100644 --- a/src/Actions/NovaActionTest.php +++ b/src/Actions/NovaActionTest.php @@ -9,8 +9,9 @@ trait NovaActionTest /** * Initialize the Nova Action mock. * - * @param string $action The class path of the Action + * @param string $action The class path of the Action * @return MockAction The Action mock instance + * * @throws InvalidNovaActionException If the supplied action class is not a Nova Action */ public static function novaAction(string $action): MockAction diff --git a/src/Fields/FieldHelper.php b/src/Fields/FieldHelper.php index e5f49c0..466270a 100644 --- a/src/Fields/FieldHelper.php +++ b/src/Fields/FieldHelper.php @@ -10,9 +10,9 @@ class FieldHelper /** * Finds the first field with a name or attribute matching the given name. * - * @param array $fields The list of fields to search - * @param string $fieldName The name or attribute of the field to match - * @param bool $allowPanels Whether fields inside panels should also be searched + * @param array $fields The list of fields to search + * @param string $fieldName The name or attribute of the field to match + * @param bool $allowPanels Whether fields inside panels should also be searched * @return Field|null The first matching field if found, or null if not */ public static function findField(array $fields, string $fieldName, bool $allowPanels = false): ?Field @@ -34,8 +34,8 @@ public static function findField(array $fields, string $fieldName, bool $allowPa /** * Determines whether the given field has a name or attribute matching the provided field name. * - * @param mixed $field The field - * @param string $fieldName the field name or attribute to match + * @param mixed $field The field + * @param string $fieldName the field name or attribute to match * @return bool */ public static function fieldMatches($field, string $fieldName): bool diff --git a/src/Fields/MockFieldElement.php b/src/Fields/MockFieldElement.php index d9ea79a..8f52373 100644 --- a/src/Fields/MockFieldElement.php +++ b/src/Fields/MockFieldElement.php @@ -17,8 +17,8 @@ public function __construct(Field $field) /** * Assert that the following rule can be found on the field. * - * @param string $rule The rule to match this field against - * @param string $message + * @param string $rule The rule to match this field against + * @param string $message * @return $this */ public function assertHasRule(string $rule, string $message = ''): self @@ -31,8 +31,8 @@ public function assertHasRule(string $rule, string $message = ''): self /** * Assert that the following rule cannot be found on the field. * - * @param string $rule The rule to match this field against - * @param string $message + * @param string $rule The rule to match this field against + * @param string $message * @return $this */ public function assertRuleMissing(string $rule, string $message = ''): self @@ -46,8 +46,8 @@ public function assertRuleMissing(string $rule, string $message = ''): self * Assert that the following rule can be found on the field when a * resource being created. * - * @param string $rule The rule to match this field against - * @param string $message + * @param string $rule The rule to match this field against + * @param string $message * @return $this */ public function assertHasCreationRule(string $rule, string $message = ''): self @@ -61,8 +61,8 @@ public function assertHasCreationRule(string $rule, string $message = ''): self * Assert that the following rule cannot be found on the field when a * resource being created. * - * @param string $rule The rule to match this field against - * @param string $message + * @param string $rule The rule to match this field against + * @param string $message * @return $this */ public function assertCreationRuleMissing(string $rule, string $message = ''): self @@ -76,8 +76,8 @@ public function assertCreationRuleMissing(string $rule, string $message = ''): s * Assert that the following rule can be found on the field when a * resource being updated. * - * @param string $rule The rule to match this field against - * @param string $message + * @param string $rule The rule to match this field against + * @param string $message * @return $this */ public function assertHasUpdateRule(string $rule, string $message = ''): self @@ -91,8 +91,8 @@ public function assertHasUpdateRule(string $rule, string $message = ''): self * Assert that the following rule cannot be found on the field when a * resource being created. * - * @param string $rule The rule to match this field against - * @param string $message + * @param string $rule The rule to match this field against + * @param string $message * @return $this */ public function assertUpdateRuleMissing(string $rule, string $message = ''): self @@ -105,7 +105,7 @@ public function assertUpdateRuleMissing(string $rule, string $message = ''): sel /** * Assert that the field can be shown on the index view. * - * @param string $message + * @param string $message * @return $this */ public function assertShownOnIndex(string $message = ''): self @@ -122,7 +122,7 @@ public function assertShownOnIndex(string $message = ''): self /** * Assert that the field is hidden from the index view. * - * @param string $message + * @param string $message * @return $this */ public function assertHiddenFromIndex(string $message = ''): self @@ -139,7 +139,7 @@ public function assertHiddenFromIndex(string $message = ''): self /** * Assert that the field can be shown on the detail view. * - * @param string $message + * @param string $message * @return $this */ public function assertShownOnDetail(string $message = ''): self @@ -156,7 +156,7 @@ public function assertShownOnDetail(string $message = ''): self /** * Assert that the field is hidden from the detail view. * - * @param string $message + * @param string $message * @return $this */ public function assertHiddenFromDetail(string $message = ''): self @@ -173,7 +173,7 @@ public function assertHiddenFromDetail(string $message = ''): self /** * Assert that the field can be shown when creating a new record. * - * @param string $message + * @param string $message * @return $this */ public function assertShownWhenCreating(string $message = ''): self @@ -190,7 +190,7 @@ public function assertShownWhenCreating(string $message = ''): self /** * Assert that the field is hidden when creating a new record. * - * @param string $message + * @param string $message * @return $this */ public function assertHiddenWhenCreating(string $message = ''): self @@ -207,7 +207,7 @@ public function assertHiddenWhenCreating(string $message = ''): self /** * Assert that the field can be shown when updating a record. * - * @param string $message + * @param string $message * @return $this */ public function assertShownWhenUpdating(string $message = ''): self @@ -224,7 +224,7 @@ public function assertShownWhenUpdating(string $message = ''): self /** * Assert that the field is hidden when updating a record. * - * @param string $message + * @param string $message * @return $this */ public function assertHiddenWhenUpdating(string $message = ''): self @@ -241,7 +241,7 @@ public function assertHiddenWhenUpdating(string $message = ''): self /** * Assert that the field should be set to null if the value is empty. * - * @param string $message + * @param string $message * @return $this */ public function assertNullable(string $message = ''): self @@ -254,7 +254,7 @@ public function assertNullable(string $message = ''): self /** * Assert that the field should not be set to null if the value is empty. * - * @param string $message + * @param string $message * @return $this */ public function assertNotNullable(string $message = ''): self @@ -267,7 +267,7 @@ public function assertNotNullable(string $message = ''): self /** * Assert that records can be sorted by this field. * - * @param string $message + * @param string $message * @return $this */ public function assertSortable(string $message = ''): self @@ -280,7 +280,7 @@ public function assertSortable(string $message = ''): self /** * Assert that records cannot be sorted by this field. * - * @param string $message + * @param string $message * @return $this */ public function assertNotSortable(string $message = ''): self diff --git a/src/Filters/MockFilter.php b/src/Filters/MockFilter.php index 04dcc10..988d1e7 100644 --- a/src/Filters/MockFilter.php +++ b/src/Filters/MockFilter.php @@ -19,7 +19,7 @@ class MockFilter extends MockComponent /** * Assert that the subject filter is a select filter. * - * @param string $message + * @param string $message * @return $this */ public function assertSelectFilter(string $message = ''): self @@ -40,7 +40,7 @@ public function assertSelectFilter(string $message = ''): self /** * Assert that the subject filter is a boolean filter. * - * @param string $message + * @param string $message * @return $this */ public function assertBooleanFilter(string $message = ''): self @@ -53,7 +53,7 @@ public function assertBooleanFilter(string $message = ''): self /** * Assert that the subject filter is a date filter. * - * @param string $message + * @param string $message * @return $this */ public function assertDateFilter(string $message = ''): self @@ -66,8 +66,8 @@ public function assertDateFilter(string $message = ''): self /** * Assert that the filter has the given option. * - * @param string $option The key or value of the option - * @param string $message + * @param string $option The key or value of the option + * @param string $message * @return $this */ public function assertHasOption(string $option, string $message = ''): self @@ -87,8 +87,8 @@ public function assertHasOption(string $option, string $message = ''): self /** * Assert that the filter does not have the given option. * - * @param string $option The key or value of the option - * @param string $message + * @param string $option The key or value of the option + * @param string $message * @return $this */ public function assertOptionMissing(string $option, string $message = ''): self @@ -110,9 +110,10 @@ public function assertOptionMissing(string $option, string $message = ''): self /** * Apply the filter with the provided value and allow tests on the result. * - * @param string $model The model that the filter should be applied to - * @param mixed|array $value The value returned by the filter + * @param string $model The model that the filter should be applied to + * @param mixed|array $value The value returned by the filter * @return MockFilterQuery + * * @throws InvalidModelException If the class provided is not a valid model class */ public function apply(string $model, $value): MockFilterQuery diff --git a/src/Filters/MockFilterQuery.php b/src/Filters/MockFilterQuery.php index 66096f4..aea23bd 100644 --- a/src/Filters/MockFilterQuery.php +++ b/src/Filters/MockFilterQuery.php @@ -19,8 +19,8 @@ public function __construct(Builder $query) /** * Assert that the query builder will return the given model. * - * @param Model $element The model contained in the query result - * @param string $message + * @param Model $element The model contained in the query result + * @param string $message * @return $this */ public function assertContains(Model $element, string $message = ''): self @@ -37,8 +37,8 @@ public function assertContains(Model $element, string $message = ''): self /** * Assert that the query builder will not return the given model. * - * @param Model $element The model not contained in the query result - * @param string $message + * @param Model $element The model not contained in the query result + * @param string $message * @return $this */ public function assertMissing(Model $element, string $message = ''): self @@ -55,8 +55,8 @@ public function assertMissing(Model $element, string $message = ''): self /** * Assert that the query builder returns the given number of records. * - * @param int $count - * @param string $message + * @param int $count + * @param string $message * @return $this */ public function assertCount(int $count, string $message = ''): self diff --git a/src/Filters/NovaFilterTest.php b/src/Filters/NovaFilterTest.php index 102ca61..998933f 100644 --- a/src/Filters/NovaFilterTest.php +++ b/src/Filters/NovaFilterTest.php @@ -9,8 +9,9 @@ trait NovaFilterTest /** * Initialize the Nova Filter mock. * - * @param string $filter The class path of the Filter + * @param string $filter The class path of the Filter * @return MockFilter The Filter mock instance + * * @throws InvalidNovaFilterException If the supplied action class is not a Nova Filter */ public static function novaFilter(string $filter): MockFilter diff --git a/src/Lenses/MockLens.php b/src/Lenses/MockLens.php index 91d5746..5c50fd0 100644 --- a/src/Lenses/MockLens.php +++ b/src/Lenses/MockLens.php @@ -28,8 +28,8 @@ public function __construct($component, $model = null) * * @deprecated * - * @param Model $element The model contained in the query result - * @param string $message + * @param Model $element The model contained in the query result + * @param string $message * @return $this */ public function assertQueryContains(Model $element, string $message = ''): self @@ -48,8 +48,8 @@ public function assertQueryContains(Model $element, string $message = ''): self * * @deprecated * - * @param Model $element The model not contained in the query result - * @param string $message + * @param Model $element The model not contained in the query result + * @param string $message * @return $this */ public function assertQueryMissing(Model $element, string $message = ''): self @@ -68,7 +68,7 @@ public function assertQueryMissing(Model $element, string $message = ''): self * * @deprecated * - * @param string $message + * @param string $message * @return $this */ public function assertQueryWithFilters(string $message = ''): self @@ -85,7 +85,7 @@ public function assertQueryWithFilters(string $message = ''): self * * @deprecated * - * @param string $message + * @param string $message * @return $this */ public function assertQueryWithOrdering(string $message = ''): self @@ -100,8 +100,9 @@ public function assertQueryWithOrdering(string $message = ''): self /** * Apply lens query and test the response. * - * @param string|null $model + * @param string|null $model * @return MockLensQuery + * * @throws InvalidModelException */ public function query(?string $model = null): MockLensQuery diff --git a/src/Lenses/MockLensQuery.php b/src/Lenses/MockLensQuery.php index 6e12945..4c00210 100644 --- a/src/Lenses/MockLensQuery.php +++ b/src/Lenses/MockLensQuery.php @@ -23,8 +23,8 @@ public function __construct(Builder $query, MockLensRequest $request) /** * Assert that the query builder will return the given model. * - * @param Model $element The model contained in the query result - * @param string $message + * @param Model $element The model contained in the query result + * @param string $message * @return $this */ public function assertContains(Model $element, string $message = ''): self @@ -41,8 +41,8 @@ public function assertContains(Model $element, string $message = ''): self /** * Assert that the query builder will not return the given model. * - * @param Model $element The model not contained in the query result - * @param string $message + * @param Model $element The model not contained in the query result + * @param string $message * @return $this */ public function assertMissing(Model $element, string $message = ''): self @@ -59,8 +59,8 @@ public function assertMissing(Model $element, string $message = ''): self /** * Assert that the query builder returns the given number of records. * - * @param int $count - * @param string $message + * @param int $count + * @param string $message * @return $this */ public function assertCount(int $count, string $message = ''): self @@ -77,7 +77,7 @@ public function assertCount(int $count, string $message = ''): self /** * Assert that the query builder uses the "withFilters" request. * - * @param string $message + * @param string $message * @return $this */ public function assertWithFilters(string $message = ''): self @@ -90,7 +90,7 @@ public function assertWithFilters(string $message = ''): self /** * Assert that the query builder uses the "withOrdering" request. * - * @param string $message + * @param string $message * @return $this */ public function assertWithOrdering(string $message = ''): self diff --git a/src/Lenses/NovaLensTest.php b/src/Lenses/NovaLensTest.php index 0cab160..e1ce006 100644 --- a/src/Lenses/NovaLensTest.php +++ b/src/Lenses/NovaLensTest.php @@ -9,9 +9,10 @@ trait NovaLensTest /** * Initialize the Nova Action mock. * - * @param string $lens The class path of the Lens - * @param string $model The model used for making query assertions + * @param string $lens The class path of the Lens + * @param string $model The model used for making query assertions * @return MockLens The Lens mock instance + * * @throws InvalidNovaLensException If the supplied action class is not a Nova Lens */ public static function novaLens(string $lens, ?string $model = null): MockLens diff --git a/src/Resources/NovaResourceTest.php b/src/Resources/NovaResourceTest.php index 13d91e1..c8ba3d8 100644 --- a/src/Resources/NovaResourceTest.php +++ b/src/Resources/NovaResourceTest.php @@ -10,9 +10,10 @@ trait NovaResourceTest /** * Initialize the Nova Resource mock. * - * @param string $class The class path of the Resource - * @param Model|null $model The object to apply to this Resource + * @param string $class The class path of the Resource + * @param Model|null $model The object to apply to this Resource * @return MockResource The Resource mock instance + * * @throws InvalidNovaResourceException If the supplied action class is not a Nova Resource */ public static function novaResource(string $class, ?Model $model = null): MockResource diff --git a/src/Traits/ActionAssertions.php b/src/Traits/ActionAssertions.php index daf72e9..9b02c06 100644 --- a/src/Traits/ActionAssertions.php +++ b/src/Traits/ActionAssertions.php @@ -16,8 +16,8 @@ trait ActionAssertions /** * Asserts that this component has the specified field. * - * @param string $action The class path of the Action - * @param string $message + * @param string $action The class path of the Action + * @param string $message * @return $this */ public function assertHasAction(string $action, string $message = ''): self @@ -34,8 +34,8 @@ public function assertHasAction(string $action, string $message = ''): self /** * Asserts that this component does not have the specified field. * - * @param string $action The class path of the Action - * @param string $message + * @param string $action The class path of the Action + * @param string $message * @return $this */ public function assertActionMissing(string $action, string $message = ''): self @@ -52,7 +52,7 @@ public function assertActionMissing(string $action, string $message = ''): self /** * Asserts that this component has no Actions specified. * - * @param string $message + * @param string $message * @return $this */ public function assertHasNoActions(string $message = ''): self @@ -65,7 +65,7 @@ public function assertHasNoActions(string $message = ''): self /** * Asserts that all actions on this component are valid Actions. * - * @param string $message + * @param string $message * @return $this */ public function assertHasValidActions(string $message = ''): self @@ -85,8 +85,9 @@ public function assertHasValidActions(string $message = ''): self /** * Searches for a matching action instance on this component for testing. * - * @param string $actionType The class name of the Action + * @param string $actionType The class name of the Action * @return MockActionElement + * * @throws ActionNotFoundException */ public function action(string $actionType): MockActionElement diff --git a/src/Traits/FieldAssertions.php b/src/Traits/FieldAssertions.php index c4643b2..e01ab3a 100644 --- a/src/Traits/FieldAssertions.php +++ b/src/Traits/FieldAssertions.php @@ -18,8 +18,8 @@ trait FieldAssertions /** * Checks that this Nova component has a field with the same name or attribute. * - * @param string $field The name or attribute of the field - * @param string $message + * @param string $field The name or attribute of the field + * @param string $message * @return $this */ public function assertHasField(string $field, string $message = ''): self @@ -37,8 +37,8 @@ public function assertHasField(string $field, string $message = ''): self * Checks that no field on this Nova component has a name or attribute matching * the given parameter. * - * @param string $field - * @param string $message + * @param string $field + * @param string $message * @return $this */ public function assertFieldMissing(string $field, string $message = ''): self @@ -54,7 +54,8 @@ public function assertFieldMissing(string $field, string $message = ''): self /** * Asserts that this Nova Action has no fields defined. - * @param string $message + * + * @param string $message * @return $this */ public function assertHasNoFields(string $message = ''): self @@ -67,7 +68,7 @@ public function assertHasNoFields(string $message = ''): self /** * Asserts that all fields defined on this Nova Action are valid fields. * - * @param string $message + * @param string $message * @return $this */ public function assertHasValidFields(string $message = ''): self @@ -87,8 +88,9 @@ public function assertHasValidFields(string $message = ''): self /** * Searches for a matching field instance on this component for testing. * - * @param string $fieldName The name or attribute of the field to return + * @param string $fieldName The name or attribute of the field to return * @return MockFieldElement + * * @throws FieldNotFoundException */ public function field(string $fieldName): MockFieldElement diff --git a/src/Traits/FilterAssertions.php b/src/Traits/FilterAssertions.php index d766758..e649497 100644 --- a/src/Traits/FilterAssertions.php +++ b/src/Traits/FilterAssertions.php @@ -14,8 +14,8 @@ trait FilterAssertions /** * Asserts that this component has the specified field. * - * @param string $action The class path of the Filter - * @param string $message + * @param string $action The class path of the Filter + * @param string $message * @return $this */ public function assertHasFilter(string $action, string $message = ''): self @@ -32,8 +32,8 @@ public function assertHasFilter(string $action, string $message = ''): self /** * Asserts that this component does not have the specified field. * - * @param string $action The class path of the Filter - * @param string $message + * @param string $action The class path of the Filter + * @param string $message * @return $this */ public function assertFilterMissing(string $action, string $message = ''): self @@ -50,7 +50,7 @@ public function assertFilterMissing(string $action, string $message = ''): self /** * Asserts that this component has no Filters specified. * - * @param string $message + * @param string $message * @return $this */ public function assertHasNoFilters(string $message = ''): self @@ -63,7 +63,7 @@ public function assertHasNoFilters(string $message = ''): self /** * Asserts that all filters on this component are valid Filters. * - * @param string $message + * @param string $message * @return $this */ public function assertHasValidFilters(string $message = ''): self