Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #289

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ infection.log
.idea/
.php_cs.cache
*.swp
.phpunit.result.cache
.php-cs-fixer.cache
11 changes: 5 additions & 6 deletions .phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
// Note that the **only** effect of choosing `'5.6'` is to infer that functions removed in php 7.0 exist.
// (See `backward_compatibility_checks` for additional options)
// Automatically inferred from composer.json requirement for "php" of ">=7.1"
'target_php_version' => '7.1',
'target_php_version' => '7.3',

// If enabled, missing properties will be created when
// they are first seen. If false, we'll report an
Expand Down Expand Up @@ -367,12 +367,11 @@
// your application should be included in this list.
'directory_list' => [
'src/PHPHtmlParser',
'vendor/infection/infection/src',
'vendor/mockery/mockery/library',
'vendor/myclabs/php-enum/src',
'vendor/paquettg/string-encode/src',
'vendor/phan/phan/src/Phan',
'vendor/php-coveralls/php-coveralls/src',
'vendor/phpunit/phpunit/src',
'vendor/guzzlehttp/psr7/src',
'vendor/guzzlehttp/guzzle/src',
'vendor/psr/http-client/src',
],

// A list of individual files to include in analysis
Expand Down
303 changes: 154 additions & 149 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,149 +1,154 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in('src')
->in('tests')
;

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => ['align_double_arrow'=>true],
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => ['statements'=>['return']],
'braces' => ['allow_single_line_closure' => false],
'cast_spaces' => true,
'class_attributes_separation' => ['elements'=>['method']],
'class_definition' => ['single_line'=>true],
'combine_consecutive_issets' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => true,
'elseif' => true,
'encoding' => true,
'full_opening_tag' => true,
'function_declaration' => true,
'function_typehint_space' => true,
'include' => true,
'increment_style' => true,
'indentation_type' => true,
'line_ending' => true,
'linebreak_after_opening_tag' => true,
'lowercase_cast' => true,
'lowercase_keywords' => true,
'lowercase_static_reference' => true,
'magic_constant_casing' => true,
'magic_method_casing' => true,
'mb_str_functions' => false,
'method_argument_space' => true,
'native_function_casing' => true,
'native_function_invocation' => true,
'native_function_type_declaration_casing' => true,
'new_with_braces' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_break_comment' => true,
'no_closing_tag' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => ['tokens'=>[
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'square_brace_block',
'throw',
'use',
]],
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_null_property_initialization' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_superfluous_elseif' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => true,
'no_spaces_inside_parenthesis' => true,
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'allow_unused_params' => 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_unneeded_curly_braces' => ['namespaces' => true],
'no_unused_imports' => true,
'no_useless_else' => 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_space' => false,
'object_operator_without_whitespace' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'php_unit_fqcn_annotation' => true,
'phpdoc_align' => ['tags' => [
'method',
'param',
'property',
'property-read',
'return',
'throws',
'type',
'var',
]],
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_annotation_without_dot' => true,
'phpdoc_indent' => true,
'phpdoc_inline_tag' => true,
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => false,
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_order' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => true,
'phpdoc_to_comment' => 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,
'return_type_declaration' => true,
'semicolon_after_instruction' => true,
'simplified_null_return' => true,
'short_scalar_cast' => 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_line_throw' => true,
'single_quote' => true,
'single_trait_insert_per_statement' => true,
'space_after_semicolon' => ['remove_in_empty_for_expressions'=>true],
'standardize_increment' => true,
'standardize_not_equals' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => true,
'whitespace_after_comma_in_array' => true,
'yoda_style' => false,
])
->setFinder($finder)
->setCacheFile(__DIR__.'/.php_cs.cache')
;
<?php

$config = new PhpCsFixer\Config();
return $config
->setRiskyAllowed(true)
->setRules([
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => true,
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => ['statements'=>['return']],
'braces' => ['allow_single_line_closure' => false],
'cast_spaces' => true,
// 'class_attributes_separation' => ['const' => 'one','method' => 'one','property' => 'one','trait_import' => 'none'],
'class_definition' => ['single_line'=>true],
'combine_consecutive_issets' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => true,
'elseif' => true,
'encoding' => true,
'full_opening_tag' => true,
'function_declaration' => true,
'function_typehint_space' => true,
'include' => true,
'increment_style' => true,
'indentation_type' => true,
'line_ending' => true,
'linebreak_after_opening_tag' => true,
'lowercase_cast' => true,
'lowercase_keywords' => true,
'lowercase_static_reference' => true,
'magic_constant_casing' => true,
'magic_method_casing' => true,
'mb_str_functions' => false,
'method_argument_space' => true,
'native_function_casing' => true,
'native_function_invocation' => ['include'=>['@all']],
'native_function_type_declaration_casing' => true,
'new_with_braces' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_break_comment' => true,
'no_closing_tag' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' =>
['tokens'=>
[
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'square_brace_block',
'throw',
'use',
]
],
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_null_property_initialization' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_superfluous_elseif' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => true,
'no_spaces_inside_parenthesis' => true,
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'allow_unused_params' => 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_unneeded_curly_braces' => ['namespaces' => true],
'no_unused_imports' => true,
'no_useless_else' => 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_space' => false,
'object_operator_without_whitespace' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'php_unit_fqcn_annotation' => true,
'phpdoc_align' =>
['tags' =>
[
'method',
'param',
'property',
'property-read',
'return',
'throws',
'type',
'var',
]
],
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_annotation_without_dot' => true,
'phpdoc_indent' => true,
'phpdoc_inline_tag_normalizer' => true,
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => false,
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_order' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => true,
'phpdoc_to_comment' => 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,
'return_type_declaration' => true,
'semicolon_after_instruction' => true,
'simplified_null_return' => true,
'short_scalar_cast' => 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_line_throw' => true,
'single_quote' => true,
'single_trait_insert_per_statement' => true,
'space_after_semicolon' => ['remove_in_empty_for_expressions'=>true],
'standardize_increment' => true,
'standardize_not_equals' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => true,
'whitespace_after_comma_in_array' => true,
'yoda_style' => false,
])
->setFinder(PhpCsFixer\Finder::create()
->exclude('vendor')
->in('src')
->in('tests')
)
;
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@
}
],
"require": {
"php": ">=7.2",
"php": ">=7.3",
"ext-mbstring": "*",
"ext-zlib": "*",
"ext-curl": "*",
"paquettg/string-encode": "~1.0.0",
"paquettg/string-encode": "^2.0",
"php-http/httplug": "^2.1",
"guzzlehttp/guzzle": "^7.0",
"guzzlehttp/psr7": "^1.6",
"myclabs/php-enum": "^1.7"
"guzzlehttp/psr7": "^2.0",
"myclabs/php-enum": "^1.8",
"psr/http-client": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5.1",
"phpunit/phpunit": "^8.0 || ^9.0",
"mockery/mockery": "^1.2",
"infection/infection": "^0.13.4",
"phan/phan": "^2.4",
"friendsofphp/php-cs-fixer": "^2.16"
"friendsofphp/php-cs-fixer": "^3.0",
"phan/phan": "^5.2"
},
"autoload": {
"psr-4": {
"psr-4": {
"PHPHtmlParser\\": "src/PHPHtmlParser"
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/PHPHtmlParser/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ public function char(?int $char = null): string

/**
* Gets a string from the current character position.
*
* @param int $length
* @return string
*/
public function string(int $length = 1): string
{
Expand All @@ -85,6 +82,7 @@ public function string(int $length = 1): string
do {
$string .= $this->char($position++);
} while ($position < $this->pos + $length);

return $string;
}

Expand Down
Loading