From e5ed49eed2da2bb783ae4bd08dd31cb2120950b1 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sat, 14 Aug 2021 23:32:53 +0100 Subject: [PATCH] Fix static analysis (#15) --- .gitattributes | 1 - .github/workflows/static.yml | 13 ------ .gitignore | 3 -- .php_cs.dist | 87 ------------------------------------ src/UriTemplate.php | 3 +- 5 files changed, 2 insertions(+), 105 deletions(-) delete mode 100644 .php_cs.dist diff --git a/.gitattributes b/.gitattributes index 8a937d8..eb549df 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,7 +8,6 @@ /.editorconfig export-ignore /.gitattributes export-ignore /.gitignore export-ignore -/.php_cs.dist export-ignore /Makefile export-ignore /phpstan.neon.dist export-ignore /phpunit.xml.dist export-ignore diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index e643245..c894d2a 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -21,16 +21,3 @@ jobs: REQUIRE_DEV: true with: args: analyze --no-progress - - php-cs-fixer: - name: PHP-CS-Fixer - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: PHP-CS-Fixer - uses: OskarStark/php-cs-fixer-ga@2.16.4 - with: - args: --dry-run --diff-format udiff diff --git a/.gitignore b/.gitignore index 564598c..4cb3ae9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,3 @@ vendor phpstan.neon phpunit.xml .phpunit.result.cache - -.php_cs -.php_cs.cache diff --git a/.php_cs.dist b/.php_cs.dist deleted file mode 100644 index 1ef5741..0000000 --- a/.php_cs.dist +++ /dev/null @@ -1,87 +0,0 @@ -setRiskyAllowed(true) - ->setRules([ - '@PSR2' => true, - 'array_syntax' => ['syntax' => 'short'], - 'binary_operator_spaces' => ['operators' => ['=>' => null]], - 'blank_line_after_opening_tag' => true, - 'class_attributes_separation' => ['elements' => ['method']], - 'compact_nullable_typehint' => true, - 'concat_space' => ['spacing' => 'one'], - 'declare_equal_normalize' => ['space' => 'none'], - 'declare_strict_types' => false, - 'dir_constant' => true, - 'final_static_access' => true, - 'fully_qualified_strict_types' => true, - 'function_to_constant' => true, - 'function_typehint_space' => true, - 'header_comment' => false, - 'is_null' => ['use_yoda_style' => false], - 'list_syntax' => ['syntax' => 'short'], - 'lowercase_cast' => true, - 'magic_method_casing' => true, - 'modernize_types_casting' => true, - 'multiline_comment_opening_closing' => true, - 'native_constant_invocation' => true, - 'no_alias_functions' => true, - 'no_alternative_syntax' => true, - 'no_blank_lines_after_phpdoc' => true, - 'no_empty_comment' => true, - 'no_empty_phpdoc' => true, - 'no_extra_blank_lines' => true, - 'no_leading_import_slash' => true, - 'no_leading_namespace_whitespace' => true, - 'no_spaces_around_offset' => true, - 'no_superfluous_phpdoc_tags' => ['allow_mixed' => true], - 'no_trailing_comma_in_singleline_array' => true, - 'no_unneeded_control_parentheses' => true, - 'no_unset_cast' => true, - 'no_unused_imports' => true, - 'no_useless_else' => true, - 'no_useless_return' => true, - 'no_whitespace_in_blank_line' => true, - 'normalize_index_brace' => true, - 'ordered_imports' => true, - 'php_unit_construct' => true, - 'php_unit_dedicate_assert' => ['target' => 'newest'], - 'php_unit_dedicate_assert_internal_type' => ['target' => 'newest'], - 'php_unit_expectation' => ['target' => 'newest'], - 'php_unit_mock' => ['target' => 'newest'], - 'php_unit_mock_short_will_return' => true, - 'php_unit_no_expectation_annotation' => ['target' => 'newest'], - 'php_unit_test_annotation' => ['style' => 'prefix'], - 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], - 'phpdoc_align' => ['align' => 'vertical'], - 'phpdoc_line_span' => ['method' => 'multi', 'property' => 'multi'], - 'phpdoc_no_package' => true, - 'phpdoc_no_useless_inheritdoc' => true, - 'phpdoc_scalar' => true, - 'phpdoc_separation' => true, - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_trim' => true, - 'phpdoc_trim_consecutive_blank_line_separation' => true, - 'phpdoc_types' => true, - 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], - 'phpdoc_var_without_name' => true, - 'return_assignment' => true, - 'short_scalar_cast' => true, - 'single_trait_insert_per_statement' => true, - 'standardize_not_equals' => true, - 'static_lambda' => true, - 'ternary_to_null_coalescing' => true, - 'trim_array_spaces' => true, - 'visibility_required' => true, - 'yoda_style' => false, - 'native_function_invocation' => true, - ]) - ->setFinder( - PhpCsFixer\Finder::create() - ->in(__DIR__.'/src') - ->in(__DIR__.'/tests') - ->name('*.php') - ) -; - -return $config; diff --git a/src/UriTemplate.php b/src/UriTemplate.php index 31915f4..c699164 100644 --- a/src/UriTemplate.php +++ b/src/UriTemplate.php @@ -169,7 +169,8 @@ private static function expandMatch(array $matches, array $variables): string } } - /** @var string */ + /** @var string $var */ + $kvp[$key] = $var; }