diff --git a/.php_cs.dist b/.php_cs.dist index 23216924..28c85900 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -1,11 +1,8 @@ exclude(['vendor', 'tests/data/Calculation']) - ->in('samples') - ->in('src') - ->in('tests/PhpSpreadsheetTests') - ; + ->exclude('vendor') + ->in(__DIR__); return PhpCsFixer\Config::create() ->setRiskyAllowed(true) @@ -13,21 +10,27 @@ return PhpCsFixer\Config::create() ->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer' . preg_replace('~\W~', '-', __DIR__)) ->setRules([ 'align_multiline_comment' => true, + 'array_indentation' => true, 'array_syntax' => ['syntax' => 'short'], 'backtick_to_shell_exec' => true, 'binary_operator_spaces' => true, 'blank_line_after_namespace' => true, 'blank_line_after_opening_tag' => true, + 'blank_line_before_return' => false, // Deprecated 'blank_line_before_statement' => true, 'braces' => true, 'cast_spaces' => true, 'class_attributes_separation' => ['elements' => ['method', 'property']], // const are often grouped with other related const 'class_definition' => true, - 'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE + 'class_keyword_remove' => false, // ::class keyword gives us better support in IDE 'combine_consecutive_issets' => true, 'combine_consecutive_unsets' => true, + 'combine_nested_dirname' => true, + 'comment_to_phpdoc' => true, 'compact_nullable_typehint' => true, 'concat_space' => ['spacing' => 'one'], + 'constant_case' => true, + 'date_time_immutable' => false, // Break our unit tests 'declare_equal_normalize' => true, 'declare_strict_types' => false, // Too early to adopt strict types 'dir_constant' => true, @@ -38,39 +41,57 @@ return PhpCsFixer\Config::create() 'elseif' => true, 'encoding' => true, 'ereg_to_preg' => true, + 'error_suppression' => true, 'escape_implicit_backslashes' => true, 'explicit_indirect_variable' => false, // I feel it makes the code actually harder to read 'explicit_string_variable' => false, // I feel it makes the code actually harder to read + 'final_class' => false, // We need non-final classes 'final_internal_class' => true, + 'final_public_method_for_abstract_class' => false, // We need non-final methods + 'final_static_access' => true, + 'fopen_flag_order' => true, + 'fopen_flags' => true, 'full_opening_tag' => true, + 'fully_qualified_strict_types' => true, 'function_declaration' => true, 'function_to_constant' => true, 'function_typehint_space' => true, 'general_phpdoc_annotation_remove' => false, // No use for that - 'hash_to_slash_comment' => true, + 'global_namespace_import' => true, + 'hash_to_slash_comment' => false, // Deprecated 'header_comment' => false, // We don't use common header in all our files + 'heredoc_indentation' => false, // Requires PHP >= 7.3 'heredoc_to_nowdoc' => false, // Not sure about this one + 'implode_call' => true, 'include' => true, 'increment_style' => true, 'indentation_type' => true, - 'is_null' => ['use_yoda_style' => false], - 'linebreak_after_opening_tag' => true, + 'is_null' => true, 'line_ending' => true, + 'linebreak_after_opening_tag' => true, 'list_syntax' => ['syntax' => 'short'], + 'logical_operators' => true, 'lowercase_cast' => true, - 'lowercase_constants' => true, + 'lowercase_constants' => false, // Deprecated 'lowercase_keywords' => true, + 'lowercase_static_reference' => true, 'magic_constant_casing' => true, + 'magic_method_casing' => true, 'mb_str_functions' => false, // No, too dangerous to change that 'method_argument_space' => true, 'method_chaining_indentation' => true, - 'method_separation' => true, + 'method_separation' => false, // Deprecated 'modernize_types_casting' => true, 'multiline_comment_opening_closing' => true, + 'multiline_whitespace_before_semicolons' => true, + 'native_constant_invocation' => false, // Micro optimization that look messy 'native_function_casing' => true, - 'native_function_invocation' => false, // This is risky and seems to be micro-optimization that make code uglier so not worth it, at least for now + 'native_function_invocation' => false, // I suppose this would be best, but I am still unconvinced about the visual aspect of it + 'native_function_type_declaration_casing' => true, 'new_with_braces' => true, 'no_alias_functions' => true, + 'no_alternative_syntax' => true, + 'no_binary_string' => true, 'no_blank_lines_after_class_opening' => true, 'no_blank_lines_after_phpdoc' => true, 'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace @@ -80,16 +101,15 @@ return PhpCsFixer\Config::create() 'no_empty_phpdoc' => true, 'no_empty_statement' => true, 'no_extra_blank_lines' => true, + 'no_extra_consecutive_blank_lines' => false, // Deprecated 'no_homoglyph_names' => true, 'no_leading_import_slash' => true, 'no_leading_namespace_whitespace' => true, 'no_mixed_echo_print' => true, 'no_multiline_whitespace_around_double_arrow' => true, - 'no_multiline_whitespace_before_semicolons' => true, - 'non_printable_character' => true, + 'no_multiline_whitespace_before_semicolons' => false, // Deprecated 'no_null_property_initialization' => true, 'no_php4_constructor' => true, - 'normalize_index_brace' => true, 'no_short_bool_cast' => true, 'no_short_echo_tag' => true, 'no_singleline_whitespace_before_semicolons' => true, @@ -97,29 +117,55 @@ return PhpCsFixer\Config::create() 'no_spaces_around_offset' => true, 'no_spaces_inside_parenthesis' => true, 'no_superfluous_elseif' => false, // Might be risky on a huge code base - 'not_operator_with_space' => false, // No we prefer to keep '!' without spaces - 'not_operator_with_successor_space' => false, // idem + 'no_superfluous_phpdoc_tags' => ['allow_mixed' => true], 'no_trailing_comma_in_list_call' => true, 'no_trailing_comma_in_singleline_array' => true, - 'no_trailing_whitespace_in_comment' => true, 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, 'no_unneeded_control_parentheses' => true, 'no_unneeded_curly_braces' => true, 'no_unneeded_final_method' => true, 'no_unreachable_default_argument_value' => true, + 'no_unset_cast' => true, + 'no_unset_on_property' => 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, + 'non_printable_character' => true, + 'normalize_index_brace' => true, + 'not_operator_with_space' => false, // No we prefer to keep '!' without spaces + 'not_operator_with_successor_space' => false, // idem + 'nullable_type_declaration_for_default_null_value' => true, 'object_operator_without_whitespace' => true, 'ordered_class_elements' => false, // We prefer to keep some freedom 'ordered_imports' => true, + 'ordered_interfaces' => true, + 'php_unit_construct' => true, + 'php_unit_dedicate_assert' => true, + 'php_unit_dedicate_assert_internal_type' => true, + 'php_unit_expectation' => true, + 'php_unit_fqcn_annotation' => true, + 'php_unit_internal_class' => false, // Because tests are excluded from package + 'php_unit_method_casing' => true, + 'php_unit_mock' => true, + 'php_unit_mock_short_will_return' => true, + 'php_unit_namespaced' => true, + 'php_unit_no_expectation_annotation' => true, + 'php_unit_ordered_covers' => true, + 'php_unit_set_up_tear_down_visibility' => true, + 'php_unit_size_class' => false, // That seems extra work to maintain for little benefits + 'php_unit_strict' => false, // We sometime actually need assertEquals + 'php_unit_test_annotation' => true, + 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], + 'php_unit_test_class_requires_covers' => false, // We don't care as much as we should about coverage 'phpdoc_add_missing_param_annotation' => true, 'phpdoc_align' => false, // Waste of time 'phpdoc_annotation_without_dot' => true, 'phpdoc_indent' => true, 'phpdoc_inline_tag' => true, + 'phpdoc_line_span' => false, // Unfortunately our old comments turn even uglier with this 'phpdoc_no_access' => true, 'phpdoc_no_alias_tag' => true, 'phpdoc_no_empty_return' => true, @@ -132,43 +178,46 @@ return PhpCsFixer\Config::create() 'phpdoc_single_line_var_spacing' => true, 'phpdoc_summary' => true, 'phpdoc_to_comment' => true, + 'phpdoc_to_param_type' => false, // Because experimental, but interesting for one shot use + 'phpdoc_to_return_type' => false, // idem 'phpdoc_trim' => true, - 'phpdoc_types_order' => true, + 'phpdoc_trim_consecutive_blank_line_separation' => true, 'phpdoc_types' => true, + 'phpdoc_types_order' => true, + 'phpdoc_var_annotation_correct_order' => true, 'phpdoc_var_without_name' => true, - 'php_unit_construct' => true, - 'php_unit_dedicate_assert' => true, - 'php_unit_expectation' => true, - 'php_unit_fqcn_annotation' => true, - 'php_unit_mock' => true, - 'php_unit_namespaced' => true, - 'php_unit_no_expectation_annotation' => true, - 'php_unit_strict' => false, // We sometime actually need assertEquals - 'php_unit_test_annotation' => true, - 'php_unit_test_class_requires_covers' => false, // We don't care as much as we should about coverage - 'pow_to_exponentiation' => false, + 'pow_to_exponentiation' => true, + 'pre_increment' => false, // Deprecated 'protected_to_private' => true, 'psr0' => true, 'psr4' => true, - 'random_api_migration' => false, // This breaks our unit tests + 'random_api_migration' => true, + 'return_assignment' => false, // Sometimes useful for clarity or debug 'return_type_declaration' => true, 'self_accessor' => true, + 'self_static_accessor' => true, 'semicolon_after_instruction' => false, // Buggy in `samples/index.php` + 'set_type_to_cast' => true, 'short_scalar_cast' => true, - 'silenced_deprecation_error' => true, - 'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null + 'silenced_deprecation_error' => false, // Deprecated + 'simple_to_complex_string_variable' => false, // Would differ from TypeScript without obvious advantages + 'simplified_null_return' => false, // Even if technically correct we prefer to be explicit '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' => true, + 'single_line_throw' => false, // I don't see any reason for having a special case for Exception 'single_quote' => true, + 'single_trait_insert_per_statement' => true, 'space_after_semicolon' => true, + 'standardize_increment' => true, 'standardize_not_equals' => true, 'static_lambda' => false, // Risky if we can't guarantee nobody use `bindTo()` 'strict_comparison' => false, // No, too dangerous to change that 'strict_param' => false, // No, too dangerous to change that + 'string_line_ending' => true, 'switch_case_semicolon_to_colon' => true, 'switch_case_space' => true, 'ternary_operator_spaces' => true, @@ -177,7 +226,7 @@ return PhpCsFixer\Config::create() 'trim_array_spaces' => true, 'unary_operator_spaces' => true, 'visibility_required' => true, - 'void_return' => false, // Cannot use that with PHP 5.6 + 'void_return' => true, 'whitespace_after_comma_in_array' => true, 'yoda_style' => false, ]); diff --git a/samples/Autofilter/10_Autofilter_selection_1.php b/samples/Autofilter/10_Autofilter_selection_1.php index 464b8c18..556ef61c 100644 --- a/samples/Autofilter/10_Autofilter_selection_1.php +++ b/samples/Autofilter/10_Autofilter_selection_1.php @@ -59,18 +59,18 @@ foreach ($years as $year) { $period, $i ); - $value = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); + $value = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4)); $salesValue = $invoiceValue = null; - $incomeOrExpenditure = rand(-1, 1); + $incomeOrExpenditure = mt_rand(-1, 1); if ($incomeOrExpenditure == -1) { - $expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4)); + $expenditure = mt_rand(-1000, -500) * (1 + (mt_rand(-1, 1) / 4)); $income = null; } elseif ($incomeOrExpenditure == 1) { - $expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4)); - $income = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); + $expenditure = mt_rand(-1000, -500) * (1 + (mt_rand(-1, 1) / 4)); + $income = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4)); } else { $expenditure = null; - $income = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); + $income = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4)); } $dataArray = [$year, $period, diff --git a/samples/Autofilter/10_Autofilter_selection_2.php b/samples/Autofilter/10_Autofilter_selection_2.php index 1c55a0cf..4bae0aba 100644 --- a/samples/Autofilter/10_Autofilter_selection_2.php +++ b/samples/Autofilter/10_Autofilter_selection_2.php @@ -59,18 +59,18 @@ foreach ($years as $year) { $period, $i ); - $value = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); + $value = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4)); $salesValue = $invoiceValue = null; - $incomeOrExpenditure = rand(-1, 1); + $incomeOrExpenditure = mt_rand(-1, 1); if ($incomeOrExpenditure == -1) { - $expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4)); + $expenditure = mt_rand(-1000, -500) * (1 + (mt_rand(-1, 1) / 4)); $income = null; } elseif ($incomeOrExpenditure == 1) { - $expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4)); - $income = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); + $expenditure = mt_rand(-1000, -500) * (1 + (mt_rand(-1, 1) / 4)); + $income = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4)); } else { $expenditure = null; - $income = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); + $income = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4)); } $dataArray = [$year, $period, diff --git a/samples/Autofilter/10_Autofilter_selection_display.php b/samples/Autofilter/10_Autofilter_selection_display.php index 55211552..4810348c 100644 --- a/samples/Autofilter/10_Autofilter_selection_display.php +++ b/samples/Autofilter/10_Autofilter_selection_display.php @@ -59,18 +59,18 @@ foreach ($years as $year) { $period, $i ); - $value = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); + $value = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4)); $salesValue = $invoiceValue = null; - $incomeOrExpenditure = rand(-1, 1); + $incomeOrExpenditure = mt_rand(-1, 1); if ($incomeOrExpenditure == -1) { - $expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4)); + $expenditure = mt_rand(-1000, -500) * (1 + (mt_rand(-1, 1) / 4)); $income = null; } elseif ($incomeOrExpenditure == 1) { - $expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4)); - $income = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); + $expenditure = mt_rand(-1000, -500) * (1 + (mt_rand(-1, 1) / 4)); + $income = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4)); } else { $expenditure = null; - $income = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); + $income = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4)); } $dataArray = [$year, $period, diff --git a/samples/Basic/22_Heavily_formatted.php b/samples/Basic/22_Heavily_formatted.php index d7ba861b..aadb5b92 100644 --- a/samples/Basic/22_Heavily_formatted.php +++ b/samples/Basic/22_Heavily_formatted.php @@ -26,22 +26,22 @@ $spreadsheet->setActiveSheetIndex(0); $spreadsheet->getActiveSheet()->getStyle('A1:T100')->applyFromArray( ['fill' => [ - 'fillType' => Fill::FILL_SOLID, - 'color' => ['argb' => 'FFCCFFCC'], - ], - 'borders' => [ - 'bottom' => ['borderStyle' => Border::BORDER_THIN], - 'right' => ['borderStyle' => Border::BORDER_MEDIUM], - ], - ] + 'fillType' => Fill::FILL_SOLID, + 'color' => ['argb' => 'FFCCFFCC'], + ], + 'borders' => [ + 'bottom' => ['borderStyle' => Border::BORDER_THIN], + 'right' => ['borderStyle' => Border::BORDER_MEDIUM], + ], + ] ); $spreadsheet->getActiveSheet()->getStyle('C5:R95')->applyFromArray( ['fill' => [ - 'fillType' => Fill::FILL_SOLID, - 'color' => ['argb' => 'FFFFFF00'], - ], - ] + 'fillType' => Fill::FILL_SOLID, + 'color' => ['argb' => 'FFFFFF00'], + ], + ] ); // Save diff --git a/samples/Basic/23_Sharedstyles.php b/samples/Basic/23_Sharedstyles.php index b5398883..8e75a488 100644 --- a/samples/Basic/23_Sharedstyles.php +++ b/samples/Basic/23_Sharedstyles.php @@ -30,26 +30,26 @@ $sharedStyle2 = new Style(); $sharedStyle1->applyFromArray( ['fill' => [ - 'fillType' => Fill::FILL_SOLID, - 'color' => ['argb' => 'FFCCFFCC'], - ], - 'borders' => [ - 'bottom' => ['borderStyle' => Border::BORDER_THIN], - 'right' => ['borderStyle' => Border::BORDER_MEDIUM], - ], - ] + 'fillType' => Fill::FILL_SOLID, + 'color' => ['argb' => 'FFCCFFCC'], + ], + 'borders' => [ + 'bottom' => ['borderStyle' => Border::BORDER_THIN], + 'right' => ['borderStyle' => Border::BORDER_MEDIUM], + ], + ] ); $sharedStyle2->applyFromArray( ['fill' => [ - 'fillType' => Fill::FILL_SOLID, - 'color' => ['argb' => 'FFFFFF00'], - ], - 'borders' => [ - 'bottom' => ['borderStyle' => Border::BORDER_THIN], - 'right' => ['borderStyle' => Border::BORDER_MEDIUM], - ], - ] + 'fillType' => Fill::FILL_SOLID, + 'color' => ['argb' => 'FFFFFF00'], + ], + 'borders' => [ + 'bottom' => ['borderStyle' => Border::BORDER_THIN], + 'right' => ['borderStyle' => Border::BORDER_MEDIUM], + ], + ] ); $spreadsheet->getActiveSheet()->duplicateStyle($sharedStyle1, 'A1:T100'); diff --git a/samples/Basic/25_In_memory_image.php b/samples/Basic/25_In_memory_image.php index 5985a0a0..af02c64a 100644 --- a/samples/Basic/25_In_memory_image.php +++ b/samples/Basic/25_In_memory_image.php @@ -21,7 +21,11 @@ $spreadsheet->getProperties()->setCreator('Maarten Balliauw') // Generate an image $helper->log('Generate an image'); -$gdImage = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream'); +$gdImage = @imagecreatetruecolor(120, 20); +if (!$gdImage) { + die('Cannot Initialize new GD image stream'); +} + $textColor = imagecolorallocate($gdImage, 255, 255, 255); imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor); diff --git a/samples/Basic/30_Template.php b/samples/Basic/30_Template.php index b70c18b6..409acb66 100644 --- a/samples/Basic/30_Template.php +++ b/samples/Basic/30_Template.php @@ -11,9 +11,9 @@ $spreadsheet = $reader->load(__DIR__ . '/../templates/30template.xls'); $helper->log('Add new data to the template'); $data = [['title' => 'Excel for dummies', - 'price' => 17.99, - 'quantity' => 2, - ], + 'price' => 17.99, + 'quantity' => 2, +], ['title' => 'PHP for dummies', 'price' => 15.99, 'quantity' => 1, diff --git a/samples/Chart/33_Chart_create_area.php b/samples/Chart/33_Chart_create_area.php index 860c16a6..57db90fc 100644 --- a/samples/Chart/33_Chart_create_area.php +++ b/samples/Chart/33_Chart_create_area.php @@ -15,12 +15,12 @@ $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $worksheet->fromArray( [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] + ['', 2010, 2011, 2012], + ['Q1', 12, 15, 21], + ['Q2', 56, 73, 86], + ['Q3', 52, 61, 69], + ['Q4', 30, 32, 0], + ] ); // Set the Labels for each data series we want to plot diff --git a/samples/Chart/33_Chart_create_bar_stacked.php b/samples/Chart/33_Chart_create_bar_stacked.php index 0aa211a9..0c87224e 100644 --- a/samples/Chart/33_Chart_create_bar_stacked.php +++ b/samples/Chart/33_Chart_create_bar_stacked.php @@ -15,12 +15,12 @@ $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $worksheet->fromArray( [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] + ['', 2010, 2011, 2012], + ['Q1', 12, 15, 21], + ['Q2', 56, 73, 86], + ['Q3', 52, 61, 69], + ['Q4', 30, 32, 0], + ] ); // Set the Labels for each data series we want to plot diff --git a/samples/Chart/33_Chart_create_column.php b/samples/Chart/33_Chart_create_column.php index 694082a4..5af0908c 100644 --- a/samples/Chart/33_Chart_create_column.php +++ b/samples/Chart/33_Chart_create_column.php @@ -15,12 +15,12 @@ $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $worksheet->fromArray( [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] + ['', 2010, 2011, 2012], + ['Q1', 12, 15, 21], + ['Q2', 56, 73, 86], + ['Q3', 52, 61, 69], + ['Q4', 30, 32, 0], + ] ); // Set the Labels for each data series we want to plot diff --git a/samples/Chart/33_Chart_create_column_2.php b/samples/Chart/33_Chart_create_column_2.php index f5a529b9..a62b4906 100644 --- a/samples/Chart/33_Chart_create_column_2.php +++ b/samples/Chart/33_Chart_create_column_2.php @@ -15,20 +15,20 @@ $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $worksheet->fromArray( [ - ['', '', 'Budget', 'Forecast', 'Actual'], - ['2010', 'Q1', 47, 44, 43], - ['', 'Q2', 56, 53, 50], - ['', 'Q3', 52, 46, 45], - ['', 'Q4', 45, 40, 40], - ['2011', 'Q1', 51, 42, 46], - ['', 'Q2', 53, 58, 56], - ['', 'Q3', 64, 66, 69], - ['', 'Q4', 54, 55, 56], - ['2012', 'Q1', 49, 52, 58], - ['', 'Q2', 68, 73, 86], - ['', 'Q3', 72, 78, 0], - ['', 'Q4', 50, 60, 0], - ] + ['', '', 'Budget', 'Forecast', 'Actual'], + ['2010', 'Q1', 47, 44, 43], + ['', 'Q2', 56, 53, 50], + ['', 'Q3', 52, 46, 45], + ['', 'Q4', 45, 40, 40], + ['2011', 'Q1', 51, 42, 46], + ['', 'Q2', 53, 58, 56], + ['', 'Q3', 64, 66, 69], + ['', 'Q4', 54, 55, 56], + ['2012', 'Q1', 49, 52, 58], + ['', 'Q2', 68, 73, 86], + ['', 'Q3', 72, 78, 0], + ['', 'Q4', 50, 60, 0], + ] ); // Set the Labels for each data series we want to plot diff --git a/samples/Chart/33_Chart_create_composite.php b/samples/Chart/33_Chart_create_composite.php index dfeacae3..ce42d2fc 100644 --- a/samples/Chart/33_Chart_create_composite.php +++ b/samples/Chart/33_Chart_create_composite.php @@ -15,20 +15,20 @@ $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $worksheet->fromArray( [ - ['', 'Rainfall (mm)', 'Temperature (°F)', 'Humidity (%)'], - ['Jan', 78, 52, 61], - ['Feb', 64, 54, 62], - ['Mar', 62, 57, 63], - ['Apr', 21, 62, 59], - ['May', 11, 75, 60], - ['Jun', 1, 75, 57], - ['Jul', 1, 79, 56], - ['Aug', 1, 79, 59], - ['Sep', 10, 75, 60], - ['Oct', 40, 68, 63], - ['Nov', 69, 62, 64], - ['Dec', 89, 57, 66], - ] + ['', 'Rainfall (mm)', 'Temperature (°F)', 'Humidity (%)'], + ['Jan', 78, 52, 61], + ['Feb', 64, 54, 62], + ['Mar', 62, 57, 63], + ['Apr', 21, 62, 59], + ['May', 11, 75, 60], + ['Jun', 1, 75, 57], + ['Jul', 1, 79, 56], + ['Aug', 1, 79, 59], + ['Sep', 10, 75, 60], + ['Oct', 40, 68, 63], + ['Nov', 69, 62, 64], + ['Dec', 89, 57, 66], + ] ); // Set the Labels for each data series we want to plot diff --git a/samples/Chart/33_Chart_create_multiple_charts.php b/samples/Chart/33_Chart_create_multiple_charts.php index c25328a8..608ffc53 100644 --- a/samples/Chart/33_Chart_create_multiple_charts.php +++ b/samples/Chart/33_Chart_create_multiple_charts.php @@ -15,12 +15,12 @@ $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $worksheet->fromArray( [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] + ['', 2010, 2011, 2012], + ['Q1', 12, 15, 21], + ['Q2', 56, 73, 86], + ['Q3', 52, 61, 69], + ['Q4', 30, 32, 0], + ] ); // Set the Labels for each data series we want to plot diff --git a/samples/Chart/33_Chart_create_pie.php b/samples/Chart/33_Chart_create_pie.php index 0df41143..5480a18a 100644 --- a/samples/Chart/33_Chart_create_pie.php +++ b/samples/Chart/33_Chart_create_pie.php @@ -16,12 +16,12 @@ $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $worksheet->fromArray( [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] + ['', 2010, 2011, 2012], + ['Q1', 12, 15, 21], + ['Q2', 56, 73, 86], + ['Q3', 52, 61, 69], + ['Q4', 30, 32, 0], + ] ); // Set the Labels for each data series we want to plot diff --git a/samples/Chart/33_Chart_create_pie_custom_colors.php b/samples/Chart/33_Chart_create_pie_custom_colors.php index 137e6e75..ca5397a1 100644 --- a/samples/Chart/33_Chart_create_pie_custom_colors.php +++ b/samples/Chart/33_Chart_create_pie_custom_colors.php @@ -16,12 +16,12 @@ $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $worksheet->fromArray( [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] + ['', 2010, 2011, 2012], + ['Q1', 12, 15, 21], + ['Q2', 56, 73, 86], + ['Q3', 52, 61, 69], + ['Q4', 30, 32, 0], + ] ); // Custom colors for dataSeries (gray, blue, red, orange) diff --git a/samples/Chart/33_Chart_create_radar.php b/samples/Chart/33_Chart_create_radar.php index 1c5c435f..eba4dc39 100644 --- a/samples/Chart/33_Chart_create_radar.php +++ b/samples/Chart/33_Chart_create_radar.php @@ -16,20 +16,20 @@ $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $worksheet->fromArray( [ - ['', 2010, 2011, 2012], - ['Jan', 47, 45, 71], - ['Feb', 56, 73, 86], - ['Mar', 52, 61, 69], - ['Apr', 40, 52, 60], - ['May', 42, 55, 71], - ['Jun', 58, 63, 76], - ['Jul', 53, 61, 89], - ['Aug', 46, 69, 85], - ['Sep', 62, 75, 81], - ['Oct', 51, 70, 96], - ['Nov', 55, 66, 89], - ['Dec', 68, 62, 0], - ] + ['', 2010, 2011, 2012], + ['Jan', 47, 45, 71], + ['Feb', 56, 73, 86], + ['Mar', 52, 61, 69], + ['Apr', 40, 52, 60], + ['May', 42, 55, 71], + ['Jun', 58, 63, 76], + ['Jul', 53, 61, 89], + ['Aug', 46, 69, 85], + ['Sep', 62, 75, 81], + ['Oct', 51, 70, 96], + ['Nov', 55, 66, 89], + ['Dec', 68, 62, 0], + ] ); // Set the Labels for each data series we want to plot diff --git a/samples/Chart/33_Chart_create_scatter.php b/samples/Chart/33_Chart_create_scatter.php index 02fa866d..c67e4e95 100644 --- a/samples/Chart/33_Chart_create_scatter.php +++ b/samples/Chart/33_Chart_create_scatter.php @@ -15,12 +15,12 @@ $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $worksheet->fromArray( [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] + ['', 2010, 2011, 2012], + ['Q1', 12, 15, 21], + ['Q2', 56, 73, 86], + ['Q3', 52, 61, 69], + ['Q4', 30, 32, 0], + ] ); // Set the Labels for each data series we want to plot diff --git a/samples/Chart/33_Chart_create_stock.php b/samples/Chart/33_Chart_create_stock.php index 4e8ffe8e..58686784 100644 --- a/samples/Chart/33_Chart_create_stock.php +++ b/samples/Chart/33_Chart_create_stock.php @@ -16,13 +16,13 @@ $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $worksheet->fromArray( [ - ['Counts', 'Max', 'Min', 'Min Threshold', 'Max Threshold'], - [10, 10, 5, 0, 50], - [30, 20, 10, 0, 50], - [20, 30, 15, 0, 50], - [40, 10, 0, 0, 50], - [100, 40, 5, 0, 50], - ], + ['Counts', 'Max', 'Min', 'Min Threshold', 'Max Threshold'], + [10, 10, 5, 0, 50], + [30, 20, 10, 0, 50], + [20, 30, 15, 0, 50], + [40, 10, 0, 0, 50], + [100, 40, 5, 0, 50], + ], null, 'A1', true diff --git a/samples/Chart/34_Chart_update.php b/samples/Chart/34_Chart_update.php index 638d2e0a..a4287927 100644 --- a/samples/Chart/34_Chart_update.php +++ b/samples/Chart/34_Chart_update.php @@ -20,11 +20,11 @@ $helper->log('Update cell data values that are displayed in the chart'); $worksheet = $spreadsheet->getActiveSheet(); $worksheet->fromArray( [ - [50 - 12, 50 - 15, 50 - 21], - [50 - 56, 50 - 73, 50 - 86], - [50 - 52, 50 - 61, 50 - 69], - [50 - 30, 50 - 32, 50], - ], + [50 - 12, 50 - 15, 50 - 21], + [50 - 56, 50 - 73, 50 - 86], + [50 - 52, 50 - 61, 50 - 69], + [50 - 30, 50 - 32, 50], + ], null, 'B2' ); diff --git a/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php b/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php index 1f39ec4d..61f624b2 100644 --- a/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php +++ b/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php @@ -23,7 +23,7 @@ class ChunkReadFilter implements IReadFilter * @param mixed $startRow * @param mixed $chunkSize */ - public function setRows($startRow, $chunkSize) + public function setRows($startRow, $chunkSize): void { $this->startRow = $startRow; $this->endRow = $startRow + $chunkSize; diff --git a/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php b/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php index efe68582..02d3d939 100644 --- a/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php +++ b/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php @@ -24,7 +24,7 @@ class ChunkReadFilter implements IReadFilter * @param mixed $startRow * @param mixed $chunkSize */ - public function setRows($startRow, $chunkSize) + public function setRows($startRow, $chunkSize): void { $this->startRow = $startRow; $this->endRow = $startRow + $chunkSize; diff --git a/samples/templates/chartSpreadsheet.php b/samples/templates/chartSpreadsheet.php index 44d7b543..2ad61d32 100644 --- a/samples/templates/chartSpreadsheet.php +++ b/samples/templates/chartSpreadsheet.php @@ -12,12 +12,12 @@ $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $worksheet->fromArray( [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] + ['', 2010, 2011, 2012], + ['Q1', 12, 15, 21], + ['Q2', 56, 73, 86], + ['Q3', 52, 61, 69], + ['Q4', 30, 32, 0], + ] ); // Set the Labels for each data series we want to plot diff --git a/samples/templates/sampleSpreadsheet.php b/samples/templates/sampleSpreadsheet.php index c668f447..6d9568be 100644 --- a/samples/templates/sampleSpreadsheet.php +++ b/samples/templates/sampleSpreadsheet.php @@ -184,59 +184,59 @@ $spreadsheet->getActiveSheet()->getStyle('A1:E1')->getFill()->getStartColor()->s $helper->log('Set style for header row using alternative method'); $spreadsheet->getActiveSheet()->getStyle('A3:E3')->applyFromArray( [ - 'font' => [ - 'bold' => true, + 'font' => [ + 'bold' => true, + ], + 'alignment' => [ + 'horizontal' => Alignment::HORIZONTAL_RIGHT, + ], + 'borders' => [ + 'top' => [ + 'borderStyle' => Border::BORDER_THIN, ], - 'alignment' => [ - 'horizontal' => Alignment::HORIZONTAL_RIGHT, + ], + 'fill' => [ + 'fillType' => Fill::FILL_GRADIENT_LINEAR, + 'rotation' => 90, + 'startColor' => [ + 'argb' => 'FFA0A0A0', ], - 'borders' => [ - 'top' => [ - 'borderStyle' => Border::BORDER_THIN, - ], + 'endColor' => [ + 'argb' => 'FFFFFFFF', ], - 'fill' => [ - 'fillType' => Fill::FILL_GRADIENT_LINEAR, - 'rotation' => 90, - 'startColor' => [ - 'argb' => 'FFA0A0A0', - ], - 'endColor' => [ - 'argb' => 'FFFFFFFF', - ], - ], - ] + ], + ] ); $spreadsheet->getActiveSheet()->getStyle('A3')->applyFromArray( [ - 'alignment' => [ - 'horizontal' => Alignment::HORIZONTAL_LEFT, + 'alignment' => [ + 'horizontal' => Alignment::HORIZONTAL_LEFT, + ], + 'borders' => [ + 'left' => [ + 'borderStyle' => Border::BORDER_THIN, ], - 'borders' => [ - 'left' => [ - 'borderStyle' => Border::BORDER_THIN, - ], - ], - ] + ], + ] ); $spreadsheet->getActiveSheet()->getStyle('B3')->applyFromArray( [ - 'alignment' => [ - 'horizontal' => Alignment::HORIZONTAL_LEFT, - ], - ] + 'alignment' => [ + 'horizontal' => Alignment::HORIZONTAL_LEFT, + ], + ] ); $spreadsheet->getActiveSheet()->getStyle('E3')->applyFromArray( [ - 'borders' => [ - 'right' => [ - 'borderStyle' => Border::BORDER_THIN, - ], + 'borders' => [ + 'right' => [ + 'borderStyle' => Border::BORDER_THIN, ], - ] + ], + ] ); // Unprotect a cell diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 447ae588..0be9ab6f 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -11,6 +11,7 @@ use PhpOffice\PhpSpreadsheet\NamedRange; use PhpOffice\PhpSpreadsheet\Shared; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; +use ReflectionMethod; class Calculation { @@ -2263,16 +2264,16 @@ class Calculation ], ]; - public function __construct(Spreadsheet $spreadsheet = null) + public function __construct(?Spreadsheet $spreadsheet = null) { - $this->delta = 1 * pow(10, 0 - ini_get('precision')); + $this->delta = 1 * 10 ** (0 - ini_get('precision')); $this->spreadsheet = $spreadsheet; $this->cyclicReferenceStack = new CyclicReferenceStack(); $this->debugLog = new Logger($this->cyclicReferenceStack); } - private static function loadLocales() + private static function loadLocales(): void { $localeFileDirectory = __DIR__ . '/locale/'; foreach (glob($localeFileDirectory . '*', GLOB_ONLYDIR) as $filename) { @@ -2291,7 +2292,7 @@ class Calculation * * @return Calculation */ - public static function getInstance(Spreadsheet $spreadsheet = null) + public static function getInstance(?Spreadsheet $spreadsheet = null) { if ($spreadsheet !== null) { $instance = $spreadsheet->getCalculationEngine(); @@ -2311,7 +2312,7 @@ class Calculation * Flush the calculation cache for any existing instance of this class * but only if a Calculation instance exists. */ - public function flushInstance() + public function flushInstance(): void { $this->clearCalculationCache(); $this->clearBranchStore(); @@ -2400,7 +2401,7 @@ class Calculation * * @param bool $pValue */ - public function setCalculationCacheEnabled($pValue) + public function setCalculationCacheEnabled($pValue): void { $this->calculationCacheEnabled = $pValue; $this->clearCalculationCache(); @@ -2409,7 +2410,7 @@ class Calculation /** * Enable calculation cache. */ - public function enableCalculationCache() + public function enableCalculationCache(): void { $this->setCalculationCacheEnabled(true); } @@ -2417,7 +2418,7 @@ class Calculation /** * Disable calculation cache. */ - public function disableCalculationCache() + public function disableCalculationCache(): void { $this->setCalculationCacheEnabled(false); } @@ -2425,7 +2426,7 @@ class Calculation /** * Clear calculation cache. */ - public function clearCalculationCache() + public function clearCalculationCache(): void { $this->calculationCache = []; } @@ -2435,7 +2436,7 @@ class Calculation * * @param string $worksheetName */ - public function clearCalculationCacheForWorksheet($worksheetName) + public function clearCalculationCacheForWorksheet($worksheetName): void { if (isset($this->calculationCache[$worksheetName])) { unset($this->calculationCache[$worksheetName]); @@ -2448,7 +2449,7 @@ class Calculation * @param string $fromWorksheetName * @param string $toWorksheetName */ - public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName) + public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName): void { if (isset($this->calculationCache[$fromWorksheetName])) { $this->calculationCache[$toWorksheetName] = &$this->calculationCache[$fromWorksheetName]; @@ -2459,25 +2460,24 @@ class Calculation /** * Enable/disable calculation cache. * - * @param bool $pValue * @param mixed $enabled */ - public function setBranchPruningEnabled($enabled) + public function setBranchPruningEnabled($enabled): void { $this->branchPruningEnabled = $enabled; } - public function enableBranchPruning() + public function enableBranchPruning(): void { $this->setBranchPruningEnabled(true); } - public function disableBranchPruning() + public function disableBranchPruning(): void { $this->setBranchPruningEnabled(false); } - public function clearBranchStore() + public function clearBranchStore(): void { $this->branchStoreKeyCounter = 0; } @@ -2779,7 +2779,7 @@ class Calculation * * @return mixed */ - public function calculate(Cell $pCell = null) + public function calculate(?Cell $pCell = null) { try { return $this->calculateCellValue($pCell); @@ -2796,7 +2796,7 @@ class Calculation * * @return mixed */ - public function calculateCellValue(Cell $pCell = null, $resetLog = true) + public function calculateCellValue(?Cell $pCell = null, $resetLog = true) { if ($pCell === null) { return null; @@ -2898,7 +2898,7 @@ class Calculation * * @return mixed */ - public function calculateFormula($formula, $cellID = null, Cell $pCell = null) + public function calculateFormula($formula, $cellID = null, ?Cell $pCell = null) { // Initialise the logging settings $this->formulaError = null; @@ -2957,7 +2957,7 @@ class Calculation * @param string $cellReference * @param mixed $cellValue */ - public function saveValueToCache($cellReference, $cellValue) + public function saveValueToCache($cellReference, $cellValue): void { if ($this->calculationCacheEnabled) { $this->calculationCache[$cellReference] = $cellValue; @@ -2973,7 +2973,7 @@ class Calculation * * @return mixed */ - public function _calculateFormulaValue($formula, $cellID = null, Cell $pCell = null) + public function _calculateFormulaValue($formula, $cellID = null, ?Cell $pCell = null) { $cellValue = null; @@ -3119,7 +3119,7 @@ class Calculation * @param int $matrix2Rows Row size of second matrix operand * @param int $matrix2Columns Column size of second matrix operand */ - private static function resizeMatricesShrink(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns) + private static function resizeMatricesShrink(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns): void { if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) { if ($matrix2Rows < $matrix1Rows) { @@ -3162,7 +3162,7 @@ class Calculation * @param int $matrix2Rows Row size of second matrix operand * @param int $matrix2Columns Column size of second matrix operand */ - private static function resizeMatricesExtend(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns) + private static function resizeMatricesExtend(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns): void { if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) { if ($matrix2Columns < $matrix1Columns) { @@ -3371,11 +3371,10 @@ class Calculation /** * @param string $formula - * @param null|\PhpOffice\PhpSpreadsheet\Cell\Cell $pCell * * @return bool */ - private function _parseFormula($formula, Cell $pCell = null) + private function _parseFormula($formula, ?Cell $pCell = null) { if (($formula = $this->convertMatrixReferences(trim($formula))) === false) { return false; @@ -3469,7 +3468,7 @@ class Calculation ++$index; // Drop the redundant plus symbol } elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde or pipe, because they are legal return $this->raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression - } elseif ((isset(self::$operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack? + } elseif ((isset(self::$operators[$opCharacter]) || $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack? while ($stack->count() > 0 && ($o2 = $stack->last()) && isset(self::$operators[$o2['value']]) && @@ -3495,7 +3494,7 @@ class Calculation // Branch pruning we decrease the depth whether is it a function // call or a parenthesis if (!empty($pendingStoreKey)) { - $parenthesisDepthMap[$pendingStoreKey] -= 1; + --$parenthesisDepthMap[$pendingStoreKey]; } if (is_array($d) && preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? @@ -3509,7 +3508,7 @@ class Calculation } $expectingThenMap[$pendingStoreKey] = false; $expectingElseMap[$pendingStoreKey] = false; - $parenthesisDepthMap[$pendingStoreKey] -= 1; + --$parenthesisDepthMap[$pendingStoreKey]; array_pop($pendingStoreKeysStack); unset($pendingStoreKey); } @@ -3615,7 +3614,7 @@ class Calculation ++$index; } elseif ($opCharacter == '(' && !$expectingOperator) { if (!empty($pendingStoreKey)) { // Branch pruning: we go deeper - $parenthesisDepthMap[$pendingStoreKey] += 1; + ++$parenthesisDepthMap[$pendingStoreKey]; } $stack->push('Brace', '(', null, $currentCondition, $currentOnlyIf, $currentOnlyIf); ++$index; @@ -3641,7 +3640,7 @@ class Calculation $parenthesisDepthMap[$pendingStoreKey] = 0; } else { // this is not an if but we go deeper if (!empty($pendingStoreKey) && array_key_exists($pendingStoreKey, $parenthesisDepthMap)) { - $parenthesisDepthMap[$pendingStoreKey] += 1; + ++$parenthesisDepthMap[$pendingStoreKey]; } } @@ -3818,11 +3817,10 @@ class Calculation /** * @param mixed $tokens * @param null|string $cellID - * @param null|Cell $pCell * * @return bool */ - private function processTokenStack($tokens, $cellID = null, Cell $pCell = null) + private function processTokenStack($tokens, $cellID = null, ?Cell $pCell = null) { if ($tokens == false) { return false; @@ -4361,7 +4359,6 @@ class Calculation * @param mixed $operand1 * @param mixed $operand2 * @param string $operation - * @param Stack $stack * @param bool $recursingArrays * * @return mixed @@ -4583,7 +4580,7 @@ class Calculation break; // Power case '^': - $result = pow($operand1, $operand2); + $result = $operand1 ** $operand2; break; } @@ -4620,7 +4617,7 @@ class Calculation * * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. */ - public function extractCellRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true) + public function extractCellRange(&$pRange = 'A1', ?Worksheet $pSheet = null, $resetLog = true) { // Return value $returnValue = []; @@ -4673,7 +4670,7 @@ class Calculation * * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. */ - public function extractNamedRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true) + public function extractNamedRange(&$pRange = 'A1', ?Worksheet $pSheet = null, $resetLog = true) { // Return value $returnValue = []; @@ -4773,21 +4770,19 @@ class Calculation /** * Add cell reference if needed while making sure that it is the last argument. * - * @param array $args * @param bool $passCellReference * @param array|string $functionCall - * @param null|Cell $pCell * * @return array */ - private function addCellReference(array $args, $passCellReference, $functionCall, Cell $pCell = null) + private function addCellReference(array $args, $passCellReference, $functionCall, ?Cell $pCell = null) { if ($passCellReference) { if (is_array($functionCall)) { $className = $functionCall[0]; $methodName = $functionCall[1]; - $reflectionMethod = new \ReflectionMethod($className, $methodName); + $reflectionMethod = new ReflectionMethod($className, $methodName); $argumentCount = count($reflectionMethod->getParameters()); while (count($args) < $argumentCount - 1) { $args[] = null; diff --git a/src/PhpSpreadsheet/Calculation/DateTime.php b/src/PhpSpreadsheet/Calculation/DateTime.php index 9e1e4cf5..a57be297 100644 --- a/src/PhpSpreadsheet/Calculation/DateTime.php +++ b/src/PhpSpreadsheet/Calculation/DateTime.php @@ -2,6 +2,8 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; +use DateTimeImmutable; +use DateTimeInterface; use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; @@ -66,7 +68,7 @@ class DateTime public static function getDateValue($dateValue) { if (!is_numeric($dateValue)) { - if ((is_object($dateValue)) && ($dateValue instanceof \DateTimeInterface)) { + if ((is_object($dateValue)) && ($dateValue instanceof DateTimeInterface)) { $dateValue = Date::PHPToExcel($dateValue); } else { $saveReturnDateType = Functions::getReturnDateType(); @@ -768,9 +770,9 @@ class DateTime * * @category Date/Time Functions * - * @param \DateTimeImmutable|float|int|string $endDate Excel date serial value (float), + * @param DateTimeImmutable|float|int|string $endDate Excel date serial value (float), * PHP date timestamp (integer), PHP DateTime object, or a standard date string - * @param \DateTimeImmutable|float|int|string $startDate Excel date serial value (float), + * @param DateTimeImmutable|float|int|string $startDate Excel date serial value (float), * PHP date timestamp (integer), PHP DateTime object, or a standard date string * * @return int|string Number of days between start date and end date or an error @@ -1301,7 +1303,7 @@ class DateTime self::DOW_SATURDAY, self::DOW_SUNDAY, self::STARTWEEK_MONDAY_ISO => self::STARTWEEK_MONDAY_ISO, - ]; + ]; /** * WEEKNUM. diff --git a/src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php b/src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php index 5a54d83a..b688e056 100644 --- a/src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php +++ b/src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php @@ -26,7 +26,7 @@ class CyclicReferenceStack * * @param mixed $value */ - public function push($value) + public function push($value): void { $this->stack[$value] = $value; } @@ -56,7 +56,7 @@ class CyclicReferenceStack /** * Clear the stack. */ - public function clear() + public function clear(): void { $this->stack = []; } diff --git a/src/PhpSpreadsheet/Calculation/Engine/Logger.php b/src/PhpSpreadsheet/Calculation/Engine/Logger.php index 6793dade..d69ea56d 100644 --- a/src/PhpSpreadsheet/Calculation/Engine/Logger.php +++ b/src/PhpSpreadsheet/Calculation/Engine/Logger.php @@ -39,8 +39,6 @@ class Logger /** * Instantiate a Calculation engine logger. - * - * @param CyclicReferenceStack $stack */ public function __construct(CyclicReferenceStack $stack) { @@ -52,7 +50,7 @@ class Logger * * @param bool $pValue */ - public function setWriteDebugLog($pValue) + public function setWriteDebugLog($pValue): void { $this->writeDebugLog = $pValue; } @@ -72,7 +70,7 @@ class Logger * * @param bool $pValue */ - public function setEchoDebugLog($pValue) + public function setEchoDebugLog($pValue): void { $this->echoDebugLog = $pValue; } @@ -90,11 +88,11 @@ class Logger /** * Write an entry to the calculation engine debug log. */ - public function writeDebugLog(...$args) + public function writeDebugLog(...$args): void { // Only write the debug log if logging is enabled if ($this->writeDebugLog) { - $message = implode($args); + $message = implode('', $args); $cellReference = implode(' -> ', $this->cellStack->showStack()); if ($this->echoDebugLog) { echo $cellReference, @@ -111,7 +109,7 @@ class Logger /** * Clear the calculation engine debug log. */ - public function clearLog() + public function clearLog(): void { $this->debugLog = []; } diff --git a/src/PhpSpreadsheet/Calculation/Engineering.php b/src/PhpSpreadsheet/Calculation/Engineering.php index 1a79ff71..aad35eec 100644 --- a/src/PhpSpreadsheet/Calculation/Engineering.php +++ b/src/PhpSpreadsheet/Calculation/Engineering.php @@ -799,7 +799,7 @@ class Engineering } if (abs($x) <= 30) { - $fResult = $fTerm = pow($x / 2, $ord) / MathTrig::FACT($ord); + $fResult = $fTerm = ($x / 2) ** $ord / MathTrig::FACT($ord); $ordK = 1; $fSqrX = ($x * $x) / 4; do { @@ -854,7 +854,7 @@ class Engineering $fResult = 0; if (abs($x) <= 30) { - $fResult = $fTerm = pow($x / 2, $ord) / MathTrig::FACT($ord); + $fResult = $fTerm = ($x / 2) ** $ord / MathTrig::FACT($ord); $ordK = 1; $fSqrX = ($x * $x) / -4; do { @@ -2357,7 +2357,7 @@ class Engineering } elseif (is_numeric($value)) { if ($value == (int) ($value)) { $value = (int) ($value); - if (($value > pow(2, 48) - 1) || ($value < 0)) { + if (($value > 2 ** 48 - 1) || ($value < 0)) { throw new Exception(Functions::NAN()); } @@ -2477,7 +2477,7 @@ class Engineering $shiftAmount = Functions::flattenSingleValue($shiftAmount); $result = $number << $shiftAmount; - if ($result > pow(2, 48) - 1) { + if ($result > 2 ** 48 - 1) { return Functions::NAN(); } diff --git a/src/PhpSpreadsheet/Calculation/Exception.php b/src/PhpSpreadsheet/Calculation/Exception.php index fccf0af7..87c7d222 100644 --- a/src/PhpSpreadsheet/Calculation/Exception.php +++ b/src/PhpSpreadsheet/Calculation/Exception.php @@ -15,7 +15,7 @@ class Exception extends PhpSpreadsheetException * @param mixed $line * @param mixed $context */ - public static function errorHandlerCallback($code, $string, $file, $line, $context) + public static function errorHandlerCallback($code, $string, $file, $line, $context): void { $e = new self($string, $code); $e->line = $line; diff --git a/src/PhpSpreadsheet/Calculation/Financial.php b/src/PhpSpreadsheet/Calculation/Financial.php index 1a49ac1c..624f035a 100644 --- a/src/PhpSpreadsheet/Calculation/Financial.php +++ b/src/PhpSpreadsheet/Calculation/Financial.php @@ -851,7 +851,7 @@ class Financial return Functions::NAN(); } // Set Fixed Depreciation Rate - $fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life)); + $fixedDepreciationRate = 1 - ($salvage / $cost) ** (1 / $life); $fixedDepreciationRate = round($fixedDepreciationRate, 3); // Loop through each period calculating the depreciation @@ -917,7 +917,7 @@ class Financial return Functions::NAN(); } // Set Fixed Depreciation Rate - $fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life)); + $fixedDepreciationRate = 1 - ($salvage / $cost) ** (1 / $life); $fixedDepreciationRate = round($fixedDepreciationRate, 3); // Loop through each period calculating the depreciation @@ -1021,7 +1021,7 @@ class Financial $dollars = floor($fractional_dollar); $cents = fmod($fractional_dollar, 1); $cents /= $fraction; - $cents *= pow(10, ceil(log10($fraction))); + $cents *= 10 ** ceil(log10($fraction)); return $dollars + $cents; } @@ -1059,7 +1059,7 @@ class Financial $dollars = floor($decimal_dollar); $cents = fmod($decimal_dollar, 1); $cents *= $fraction; - $cents *= pow(10, -ceil(log10($fraction))); + $cents *= 10 ** (-ceil(log10($fraction))); return $dollars + $cents; } @@ -1090,7 +1090,7 @@ class Financial return Functions::NAN(); } - return pow((1 + $nominal_rate / $npery), $npery) - 1; + return (1 + $nominal_rate / $npery) ** $npery - 1; } /** @@ -1131,7 +1131,7 @@ class Financial // Calculate if ($rate !== null && $rate != 0) { - return -$pv * pow(1 + $rate, $nper) - $pmt * (1 + $rate * $type) * (pow(1 + $rate, $nper) - 1) / $rate; + return -$pv * (1 + $rate) ** $nper - $pmt * (1 + $rate * $type) * ((1 + $rate) ** $nper - 1) / $rate; } return -$pv - $pmt * $nper; @@ -1400,9 +1400,9 @@ class Financial $npv_pos = $npv_neg = 0.0; foreach ($values as $i => $v) { if ($v >= 0) { - $npv_pos += $v / pow($rr, $i); + $npv_pos += $v / $rr ** $i; } else { - $npv_neg += $v / pow($fr, $i); + $npv_neg += $v / $fr ** $i; } } @@ -1410,8 +1410,8 @@ class Financial return Functions::VALUE(); } - $mirr = pow((-$npv_pos * pow($rr, $n)) - / ($npv_neg * ($rr)), (1.0 / ($n - 1))) - 1.0; + $mirr = ((-$npv_pos * $rr ** $n) + / ($npv_neg * ($rr))) ** (1.0 / ($n - 1)) - 1.0; return is_finite($mirr) ? $mirr : Functions::VALUE(); } @@ -1437,7 +1437,7 @@ class Financial } // Calculate - return $npery * (pow($effect_rate + 1, 1 / $npery) - 1); + return $npery * (($effect_rate + 1) ** (1 / $npery) - 1); } /** @@ -1502,7 +1502,7 @@ class Financial for ($i = 1; $i <= $countArgs; ++$i) { // Is it a numeric value? if (is_numeric($aArgs[$i - 1])) { - $returnValue += $aArgs[$i - 1] / pow(1 + $rate, $i); + $returnValue += $aArgs[$i - 1] / (1 + $rate) ** $i; } } @@ -1565,7 +1565,7 @@ class Financial // Calculate if ($rate !== null && $rate != 0) { - return (-$fv - $pv * pow(1 + $rate, $nper)) / (1 + $rate * $type) / ((pow(1 + $rate, $nper) - 1) / $rate); + return (-$fv - $pv * (1 + $rate) ** $nper) / (1 + $rate * $type) / (((1 + $rate) ** $nper - 1) / $rate); } return (-$pv - $fv) / $nper; @@ -1672,9 +1672,9 @@ class Financial $rfp = 100 * ($rate / $frequency); $de = $dsc / $e; - $result = $redemption / pow($baseYF, (--$n + $de)); + $result = $redemption / $baseYF ** (--$n + $de); for ($k = 0; $k <= $n; ++$k) { - $result += $rfp / (pow($baseYF, ($k + $de))); + $result += $rfp / ($baseYF ** ($k + $de)); } $result -= $rfp * ($a / $e); @@ -1820,7 +1820,7 @@ class Financial // Calculate if ($rate !== null && $rate != 0) { - return (-$pmt * (1 + $rate * $type) * ((pow(1 + $rate, $nper) - 1) / $rate) - $fv) / pow(1 + $rate, $nper); + return (-$pmt * (1 + $rate * $type) * (((1 + $rate) ** $nper - 1) / $rate) - $fv) / (1 + $rate) ** $nper; } return -$fv - $pmt * $nper; @@ -1889,8 +1889,8 @@ class Financial if ($rate == 0) { return Functions::NAN(); } - $tt1 = pow($rate + 1, $nper); - $tt2 = pow($rate + 1, $nper - 1); + $tt1 = ($rate + 1) ** $nper; + $tt2 = ($rate + 1) ** ($nper - 1); $numerator = $fv + $tt1 * $pv + $pmt * ($tt1 - 1) * ($rate * $type + 1) / $rate; $denominator = $nper * $tt2 * $pv - $pmt * ($tt1 - 1) * ($rate * $type + 1) / ($rate * $rate) + $nper * $pmt * $tt2 * ($rate * $type + 1) / $rate @@ -1971,7 +1971,7 @@ class Financial return Functions::NAN(); } - return pow($fv / $pv, 1 / $nper) - 1; + return ($fv / $pv) ** (1 / $nper) - 1; } /** @@ -2377,7 +2377,7 @@ class Financial if (!is_numeric($dif)) { return $dif; } - $xnpv += $values[$i] / pow(1 + $rate, $dif / 365); + $xnpv += $values[$i] / (1 + $rate) ** ($dif / 365); } return is_finite($xnpv) ? $xnpv : Functions::VALUE(); diff --git a/src/PhpSpreadsheet/Calculation/FormulaParser.php b/src/PhpSpreadsheet/Calculation/FormulaParser.php index 38c725c2..f6c88b26 100644 --- a/src/PhpSpreadsheet/Calculation/FormulaParser.php +++ b/src/PhpSpreadsheet/Calculation/FormulaParser.php @@ -125,7 +125,7 @@ class FormulaParser /** * Parse to tokens. */ - private function parseToTokens() + private function parseToTokens(): void { // No attempt is made to verify formulas; assumes formulas are derived from Excel, where // they can only exist if valid; stack overflows/underflows sunk as nulls without exceptions. diff --git a/src/PhpSpreadsheet/Calculation/FormulaToken.php b/src/PhpSpreadsheet/Calculation/FormulaToken.php index 66618d4a..4d225de2 100644 --- a/src/PhpSpreadsheet/Calculation/FormulaToken.php +++ b/src/PhpSpreadsheet/Calculation/FormulaToken.php @@ -103,7 +103,7 @@ class FormulaToken * * @param string $value */ - public function setValue($value) + public function setValue($value): void { $this->value = $value; } @@ -123,7 +123,7 @@ class FormulaToken * * @param string $value */ - public function setTokenType($value) + public function setTokenType($value): void { $this->tokenType = $value; } @@ -143,7 +143,7 @@ class FormulaToken * * @param string $value */ - public function setTokenSubType($value) + public function setTokenSubType($value): void { $this->tokenSubType = $value; } diff --git a/src/PhpSpreadsheet/Calculation/Functions.php b/src/PhpSpreadsheet/Calculation/Functions.php index 1862b008..af872dd7 100644 --- a/src/PhpSpreadsheet/Calculation/Functions.php +++ b/src/PhpSpreadsheet/Calculation/Functions.php @@ -660,7 +660,7 @@ class Functions * * @return bool|string */ - public static function isFormula($cellReference = '', Cell $pCell = null) + public static function isFormula($cellReference = '', ?Cell $pCell = null) { if ($pCell === null) { return self::REF(); diff --git a/src/PhpSpreadsheet/Calculation/LookupRef.php b/src/PhpSpreadsheet/Calculation/LookupRef.php index 48434300..2d196aef 100644 --- a/src/PhpSpreadsheet/Calculation/LookupRef.php +++ b/src/PhpSpreadsheet/Calculation/LookupRef.php @@ -238,7 +238,7 @@ class LookupRef * * @return mixed The value of $displayName (or $linkURL if $displayName was blank) */ - public static function HYPERLINK($linkURL = '', $displayName = null, Cell $pCell = null) + public static function HYPERLINK($linkURL = '', $displayName = null, ?Cell $pCell = null) { $linkURL = ($linkURL === null) ? '' : Functions::flattenSingleValue($linkURL); $displayName = ($displayName === null) ? '' : Functions::flattenSingleValue($displayName); @@ -275,7 +275,7 @@ class LookupRef * * @todo Support for the optional a1 parameter introduced in Excel 2010 */ - public static function INDIRECT($cellAddress = null, Cell $pCell = null) + public static function INDIRECT($cellAddress = null, ?Cell $pCell = null) { $cellAddress = Functions::flattenSingleValue($cellAddress); if ($cellAddress === null || $cellAddress === '') { @@ -339,11 +339,10 @@ class LookupRef * starting reference). * @param mixed $height The height, in number of rows, that you want the returned reference to be. Height must be a positive number. * @param mixed $width The width, in number of columns, that you want the returned reference to be. Width must be a positive number. - * @param null|Cell $pCell * * @return string A reference to a cell or range of cells */ - public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $height = null, $width = null, Cell $pCell = null) + public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $height = null, $width = null, ?Cell $pCell = null) { $rows = Functions::flattenSingleValue($rows); $columns = Functions::flattenSingleValue($columns); @@ -419,14 +418,6 @@ class LookupRef * Excel Function: * =CHOOSE(index_num, value1, [value2], ...) * - * @param mixed $index_num Specifies which value argument is selected. - * Index_num must be a number between 1 and 254, or a formula or reference to a cell containing a number - * between 1 and 254. - * @param mixed $value1 ... Value1 is required, subsequent values are optional. - * Between 1 to 254 value arguments from which CHOOSE selects a value or an action to perform based on - * index_num. The arguments can be numbers, cell references, defined names, formulas, functions, or - * text. - * * @return mixed The selected value */ public static function CHOOSE(...$chooseArgs) @@ -945,7 +936,7 @@ class LookupRef * * @return string */ - public static function FORMULATEXT($cellReference = '', Cell $pCell = null) + public static function FORMULATEXT($cellReference = '', ?Cell $pCell = null) { if ($pCell === null) { return Functions::REF(); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig.php b/src/PhpSpreadsheet/Calculation/MathTrig.php index f94c8fcc..3db3fb8d 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig.php @@ -2,6 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; +use Exception; use Matrix\Exception as MatrixException; use Matrix\Matrix; @@ -68,7 +69,7 @@ class MathTrig try { $arabic = self::calculateArabic(str_split($roman)); - } catch (\Exception $e) { + } catch (Exception $e) { return Functions::VALUE(); // Invalid character detected } @@ -82,7 +83,6 @@ class MathTrig /** * Recursively calculate the arabic value of a roman numeral. * - * @param array $roman * @param int $sum * @param int $subtract * @@ -102,7 +102,7 @@ class MathTrig $numeral = array_shift($roman); if (!isset($lookup[$numeral])) { - throw new \Exception('Invalid character detected'); + throw new Exception('Invalid character detected'); } $arabic = $lookup[$numeral]; @@ -618,7 +618,7 @@ class MathTrig $myCountedFactors = array_count_values($myFactors); $myPoweredFactors = []; foreach ($myCountedFactors as $myCountedFactor => $myCountedPower) { - $myPoweredFactors[$myCountedFactor] = pow($myCountedFactor, $myCountedPower); + $myPoweredFactors[$myCountedFactor] = $myCountedFactor ** $myCountedPower; } foreach ($myPoweredFactors as $myPoweredValue => $myPoweredFactor) { if (isset($allPoweredFactors[$myPoweredValue])) { @@ -986,7 +986,7 @@ class MathTrig } // Return - $result = pow($x, $y); + $result = $x ** $y; return (!is_nan($result) && !is_infinite($result)) ? $result : Functions::NAN(); } @@ -1139,10 +1139,10 @@ class MathTrig if ((is_numeric($number)) && (is_numeric($digits))) { if ($number < 0.0) { - return round($number - 0.5 * pow(0.1, $digits), $digits, PHP_ROUND_HALF_DOWN); + return round($number - 0.5 * 0.1 ** $digits, $digits, PHP_ROUND_HALF_DOWN); } - return round($number + 0.5 * pow(0.1, $digits), $digits, PHP_ROUND_HALF_DOWN); + return round($number + 0.5 * 0.1 ** $digits, $digits, PHP_ROUND_HALF_DOWN); } return Functions::VALUE(); @@ -1165,10 +1165,10 @@ class MathTrig if ((is_numeric($number)) && (is_numeric($digits))) { if ($number < 0.0) { - return round($number + 0.5 * pow(0.1, $digits), $digits, PHP_ROUND_HALF_UP); + return round($number + 0.5 * 0.1 ** $digits, $digits, PHP_ROUND_HALF_UP); } - return round($number - 0.5 * pow(0.1, $digits), $digits, PHP_ROUND_HALF_UP); + return round($number - 0.5 * 0.1 ** $digits, $digits, PHP_ROUND_HALF_UP); } return Functions::VALUE(); @@ -1179,9 +1179,6 @@ class MathTrig * * Returns the sum of a power series * - * @param float $x Input value to the power series - * @param float $n Initial power to which you want to raise $x - * @param float $m Step by which to increase $n for each term in the series * @param array of mixed Data Series * * @return float|string The result, or a string containing an error @@ -1203,7 +1200,7 @@ class MathTrig foreach ($aArgs as $arg) { // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { - $returnValue += $arg * pow($x, $n + ($m * $i++)); + $returnValue += $arg * $x ** ($n + ($m * $i++)); } else { return Functions::VALUE(); } @@ -1445,7 +1442,6 @@ class MathTrig * @category Mathematical and Trigonometric Functions * * @param mixed $args Data values - * @param string $condition the criteria that defines which cells will be summed * * @return float */ @@ -1663,7 +1659,7 @@ class MathTrig $digits = floor($digits); // Truncate - $adjust = pow(10, $digits); + $adjust = 10 ** $digits; if (($digits > 0) && (rtrim((int) ((abs($value) - abs((int) $value)) * $adjust), '0') < $adjust / 10)) { return $value; diff --git a/src/PhpSpreadsheet/Calculation/Statistical.php b/src/PhpSpreadsheet/Calculation/Statistical.php index 2b7fd8c9..675f88ef 100644 --- a/src/PhpSpreadsheet/Calculation/Statistical.php +++ b/src/PhpSpreadsheet/Calculation/Statistical.php @@ -397,10 +397,10 @@ class Statistical for ($i = 1; $i <= $n; ++$i) { $divisor *= ($a + $i); } - $summer += (pow($x, $n) / $divisor); + $summer += ($x ** $n / $divisor); } - return pow($x, $a) * exp(0 - $x) * $summer; + return $x ** $a * exp(0 - $x) * $summer; } // @@ -874,13 +874,13 @@ class Statistical if ($cumulative) { $summer = 0; for ($i = 0; $i <= $value; ++$i) { - $summer += MathTrig::COMBIN($trials, $i) * pow($probability, $i) * pow(1 - $probability, $trials - $i); + $summer += MathTrig::COMBIN($trials, $i) * $probability ** $i * (1 - $probability) ** ($trials - $i); } return $summer; } - return MathTrig::COMBIN($trials, $value) * pow($probability, $value) * pow(1 - $probability, $trials - $value); + return MathTrig::COMBIN($trials, $value) * $probability ** $value * (1 - $probability) ** ($trials - $value); } } @@ -1320,7 +1320,7 @@ class Statistical $t = sqrt(log(1 / ($alpha * $alpha))); $trialsApprox = 0 - ($t + (2.515517 + 0.802853 * $t + 0.010328 * $t * $t) / (1 + 1.432788 * $t + 0.189269 * $t * $t + 0.001308 * $t * $t * $t)); } else { - $t = sqrt(log(1 / pow(1 - $alpha, 2))); + $t = sqrt(log(1 / (1 - $alpha) ** 2)); $trialsApprox = $t - (2.515517 + 0.802853 * $t + 0.010328 * $t * $t) / (1 + 1.432788 * $t + 0.189269 * $t * $t + 0.001308 * $t * $t * $t); } @@ -1441,9 +1441,9 @@ class Statistical } if ((is_numeric($arg)) && (!is_string($arg))) { if ($returnValue === null) { - $returnValue = pow(($arg - $aMean), 2); + $returnValue = ($arg - $aMean) ** 2; } else { - $returnValue += pow(($arg - $aMean), 2); + $returnValue += ($arg - $aMean) ** 2; } ++$aCount; } @@ -1603,7 +1603,7 @@ class Statistical return self::incompleteGamma($a, $value / $b) / self::gamma($a); } - return (1 / (pow($b, $a) * self::gamma($a))) * pow($value, $a - 1) * exp(0 - ($value / $b)); + return (1 / ($b ** $a * self::gamma($a))) * $value ** ($a - 1) * exp(0 - ($value / $b)); } } @@ -1721,7 +1721,7 @@ class Statistical if (is_numeric($aMean) && ($aMean > 0)) { $aCount = self::COUNT($aArgs); if (self::MIN($aArgs) > 0) { - return pow($aMean, (1 / $aCount)); + return $aMean ** (1 / $aCount); } } @@ -1900,7 +1900,7 @@ class Statistical } else { // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { - $summer += pow((($arg - $mean) / $stdDev), 4); + $summer += (($arg - $mean) / $stdDev) ** 4; ++$count; } } @@ -1908,7 +1908,7 @@ class Statistical // Return if ($count > 3) { - return $summer * ($count * ($count + 1) / (($count - 1) * ($count - 2) * ($count - 3))) - (3 * pow($count - 1, 2) / (($count - 2) * ($count - 3))); + return $summer * ($count * ($count + 1) / (($count - 1) * ($count - 2) * ($count - 3))) - (3 * ($count - 1) ** 2 / (($count - 2) * ($count - 3))); } } @@ -1927,7 +1927,6 @@ class Statistical * @category Statistical Functions * * @param mixed $args Data values - * @param int $entry Position (ordered from the largest) in the array or range of data to return * * @return float|string The result, or a string containing an error */ @@ -2013,9 +2012,9 @@ class Statistical } return [ - $bestFitLinear->getSlope(), - $bestFitLinear->getIntersect(), - ]; + $bestFitLinear->getSlope(), + $bestFitLinear->getIntersect(), + ]; } /** @@ -2078,9 +2077,9 @@ class Statistical } return [ - $bestFitExponential->getSlope(), - $bestFitExponential->getIntersect(), - ]; + $bestFitExponential->getSlope(), + $bestFitExponential->getIntersect(), + ]; } /** @@ -2579,7 +2578,7 @@ class Statistical } } - return (MathTrig::COMBIN($failures + $successes - 1, $successes - 1)) * (pow($probability, $successes)) * (pow(1 - $probability, $failures)); + return (MathTrig::COMBIN($failures + $successes - 1, $successes - 1)) * ($probability ** $successes) * ((1 - $probability) ** $failures); } return Functions::VALUE(); @@ -2614,7 +2613,7 @@ class Statistical return 0.5 * (1 + Engineering::erfVal(($value - $mean) / ($stdDev * sqrt(2)))); } - return (1 / (self::SQRT2PI * $stdDev)) * exp(0 - (pow($value - $mean, 2) / (2 * ($stdDev * $stdDev)))); + return (1 / (self::SQRT2PI * $stdDev)) * exp(0 - (($value - $mean) ** 2 / (2 * ($stdDev * $stdDev)))); } } @@ -2695,7 +2694,6 @@ class Statistical * @category Statistical Functions * * @param mixed $args Data values - * @param float $entry Percentile value in the range 0..1, inclusive. * * @return float|string The result, or a string containing an error */ @@ -2841,13 +2839,13 @@ class Statistical $summer = 0; $floor = floor($value); for ($i = 0; $i <= $floor; ++$i) { - $summer += pow($mean, $i) / MathTrig::FACT($i); + $summer += $mean ** $i / MathTrig::FACT($i); } return exp(0 - $mean) * $summer; } - return (exp(0 - $mean) * pow($mean, $value)) / MathTrig::FACT($value); + return (exp(0 - $mean) * $mean ** $value) / MathTrig::FACT($value); } } @@ -2865,7 +2863,6 @@ class Statistical * @category Statistical Functions * * @param mixed $args Data values - * @param int $entry Quartile value in the range 1..3, inclusive. * * @return float|string The result, or a string containing an error */ @@ -2979,7 +2976,7 @@ class Statistical } else { // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { - $summer += pow((($arg - $mean) / $stdDev), 3); + $summer += (($arg - $mean) / $stdDev) ** 3; ++$count; } } @@ -3033,7 +3030,6 @@ class Statistical * @category Statistical Functions * * @param mixed $args Data values - * @param int $entry Position (ordered from the smallest) in the array or range of data to return * * @return float|string The result, or a string containing an error */ @@ -3126,9 +3122,9 @@ class Statistical // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { if ($returnValue === null) { - $returnValue = pow(($arg - $aMean), 2); + $returnValue = ($arg - $aMean) ** 2; } else { - $returnValue += pow(($arg - $aMean), 2); + $returnValue += ($arg - $aMean) ** 2; } ++$aCount; } @@ -3178,9 +3174,9 @@ class Statistical $arg = 0; } if ($returnValue === null) { - $returnValue = pow(($arg - $aMean), 2); + $returnValue = ($arg - $aMean) ** 2; } else { - $returnValue += pow(($arg - $aMean), 2); + $returnValue += ($arg - $aMean) ** 2; } ++$aCount; } @@ -3226,9 +3222,9 @@ class Statistical // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { if ($returnValue === null) { - $returnValue = pow(($arg - $aMean), 2); + $returnValue = ($arg - $aMean) ** 2; } else { - $returnValue += pow(($arg - $aMean), 2); + $returnValue += ($arg - $aMean) ** 2; } ++$aCount; } @@ -3277,9 +3273,9 @@ class Statistical $arg = 0; } if ($returnValue === null) { - $returnValue = pow(($arg - $aMean), 2); + $returnValue = ($arg - $aMean) ** 2; } else { - $returnValue += pow(($arg - $aMean), 2); + $returnValue += ($arg - $aMean) ** 2; } ++$aCount; } @@ -3491,7 +3487,6 @@ class Statistical * @category Statistical Functions * * @param mixed $args Data values - * @param float $discard Percentage to discard * * @return float|string */ @@ -3746,10 +3741,10 @@ class Statistical } if ((is_numeric($cumulative)) || (is_bool($cumulative))) { if ($cumulative) { - return 1 - exp(0 - pow($value / $beta, $alpha)); + return 1 - exp(0 - ($value / $beta) ** $alpha); } - return ($alpha / pow($beta, $alpha)) * pow($value, $alpha - 1) * exp(0 - pow($value / $beta, $alpha)); + return ($alpha / $beta ** $alpha) * $value ** ($alpha - 1) * exp(0 - ($value / $beta) ** $alpha); } } diff --git a/src/PhpSpreadsheet/Calculation/TextData.php b/src/PhpSpreadsheet/Calculation/TextData.php index bbb03926..8f4b7d87 100644 --- a/src/PhpSpreadsheet/Calculation/TextData.php +++ b/src/PhpSpreadsheet/Calculation/TextData.php @@ -167,7 +167,7 @@ class TextData if ($decimals > 0) { $mask .= '.' . str_repeat('0', $decimals); } else { - $round = pow(10, abs($decimals)); + $round = 10 ** abs($decimals); if ($value < 0) { $round = 0 - $round; } @@ -623,7 +623,7 @@ class TextData $percentageAdjustment = strlen($value) - strlen($percentageString); if ($percentageAdjustment) { $value = (float) $percentageString; - $value /= pow(10, $percentageAdjustment * 2); + $value /= 10 ** ($percentageAdjustment * 2); } } diff --git a/src/PhpSpreadsheet/Calculation/Token/Stack.php b/src/PhpSpreadsheet/Calculation/Token/Stack.php index 341a0179..941e1ad7 100644 --- a/src/PhpSpreadsheet/Calculation/Token/Stack.php +++ b/src/PhpSpreadsheet/Calculation/Token/Stack.php @@ -49,7 +49,7 @@ class Stack $storeKey = null, $onlyIf = null, $onlyIfNot = null - ) { + ): void { $stackItem = $this->getStackItem($type, $value, $reference, $storeKey, $onlyIf, $onlyIfNot); $this->stack[$this->count++] = $stackItem; @@ -124,7 +124,7 @@ class Stack /** * Clear the stack. */ - public function clear() + public function clear(): void { $this->stack = []; $this->count = 0; diff --git a/src/PhpSpreadsheet/Cell/Cell.php b/src/PhpSpreadsheet/Cell/Cell.php index 30be3353..0bca2fc0 100644 --- a/src/PhpSpreadsheet/Cell/Cell.php +++ b/src/PhpSpreadsheet/Cell/Cell.php @@ -76,12 +76,12 @@ class Cell return $this; } - public function detach() + public function detach(): void { $this->parent = null; } - public function attach(Cells $parent) + public function attach(Cells $parent): void { $this->parent = $parent; } @@ -91,7 +91,6 @@ class Cell * * @param mixed $pValue * @param string $pDataType - * @param Worksheet $pSheet */ public function __construct($pValue, $pDataType, Worksheet $pSheet) { @@ -386,7 +385,7 @@ class Cell * * @return Cell */ - public function setDataValidation(DataValidation $pDataValidation = null) + public function setDataValidation(?DataValidation $pDataValidation = null) { if (!isset($this->parent)) { throw new Exception('Cannot set data validation for cell that is not bound to a worksheet'); @@ -444,7 +443,7 @@ class Cell * * @return Cell */ - public function setHyperlink(Hyperlink $pHyperlink = null) + public function setHyperlink(?Hyperlink $pHyperlink = null) { if (!isset($this->parent)) { throw new Exception('Cannot set hyperlink for cell that is not bound to a worksheet'); @@ -532,8 +531,6 @@ class Cell /** * Re-bind parent. * - * @param Worksheet $parent - * * @return Cell */ public function rebindParent(Worksheet $parent) @@ -600,10 +597,8 @@ class Cell /** * Set value binder to use. - * - * @param IValueBinder $binder */ - public static function setValueBinder(IValueBinder $binder) + public static function setValueBinder(IValueBinder $binder): void { self::$valueBinder = $binder; } diff --git a/src/PhpSpreadsheet/Cell/Coordinate.php b/src/PhpSpreadsheet/Cell/Coordinate.php index 70fed25a..8c679913 100644 --- a/src/PhpSpreadsheet/Cell/Coordinate.php +++ b/src/PhpSpreadsheet/Cell/Coordinate.php @@ -503,7 +503,7 @@ abstract class Coordinate * @param int $currentRow * @param int $endRow */ - private static function validateRange($cellBlock, $startColumnIndex, $endColumnIndex, $currentRow, $endRow) + private static function validateRange($cellBlock, $startColumnIndex, $endColumnIndex, $currentRow, $endRow): void { if ($startColumnIndex >= $endColumnIndex || $currentRow > $endRow) { throw new Exception('Invalid range: "' . $cellBlock . '"'); diff --git a/src/PhpSpreadsheet/Chart/Axis.php b/src/PhpSpreadsheet/Chart/Axis.php index 66242e34..7995c3b3 100644 --- a/src/PhpSpreadsheet/Chart/Axis.php +++ b/src/PhpSpreadsheet/Chart/Axis.php @@ -178,7 +178,7 @@ class Axis extends Properties * @param string $major_unit * @param string $minor_unit */ - public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null) + public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null): void { $this->axisOptions['axis_labels'] = (string) $axis_labels; ($horizontal_crosses_value !== null) ? $this->axisOptions['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null; @@ -210,7 +210,7 @@ class Axis extends Properties * * @param string $orientation */ - public function setAxisOrientation($orientation) + public function setAxisOrientation($orientation): void { $this->axisOptions['orientation'] = (string) $orientation; } @@ -222,7 +222,7 @@ class Axis extends Properties * @param int $alpha * @param string $type */ - public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) + public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB): void { $this->fillProperties = $this->setColorProperties($color, $alpha, $type); } @@ -234,7 +234,7 @@ class Axis extends Properties * @param int $alpha * @param string $type */ - public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) + public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB): void { $this->lineProperties = $this->setColorProperties($color, $alpha, $type); } @@ -276,7 +276,7 @@ class Axis extends Properties * @param string $end_arrow_type * @param string $end_arrow_size */ - public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null) + public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null): void { ($line_width !== null) ? $this->lineStyleProperties['width'] = $this->getExcelPointsWidth((float) $line_width) : null; ($compound_type !== null) ? $this->lineStyleProperties['compound'] = (string) $compound_type : null; @@ -336,7 +336,7 @@ class Axis extends Properties * @param int $sh_angle * @param float $sh_distance */ - public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null) + public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null): void { $this->setShadowPresetsProperties((int) $sh_presets) ->setShadowColor( @@ -367,7 +367,6 @@ class Axis extends Properties /** * Set Shadow Properties from Mapped Values. * - * @param array $properties_map * @param mixed &$reference * * @return $this @@ -479,7 +478,7 @@ class Axis extends Properties * @param int $color_alpha * @param string $color_type */ - public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null) + public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null): void { $this->setGlowSize($size) ->setGlowColor( @@ -538,7 +537,7 @@ class Axis extends Properties * * @param float $size */ - public function setSoftEdges($size) + public function setSoftEdges($size): void { if ($size !== null) { $softEdges['size'] = (string) $this->getExcelPointsWidth($size); diff --git a/src/PhpSpreadsheet/Chart/Chart.php b/src/PhpSpreadsheet/Chart/Chart.php index 7064160e..20eb2aee 100644 --- a/src/PhpSpreadsheet/Chart/Chart.php +++ b/src/PhpSpreadsheet/Chart/Chart.php @@ -144,19 +144,10 @@ class Chart * Create a new Chart. * * @param mixed $name - * @param null|Title $title - * @param null|Legend $legend - * @param null|PlotArea $plotArea * @param mixed $plotVisibleOnly * @param string $displayBlanksAs - * @param null|Title $xAxisLabel - * @param null|Title $yAxisLabel - * @param null|Axis $xAxis - * @param null|Axis $yAxis - * @param null|GridLines $majorGridlines - * @param null|GridLines $minorGridlines */ - public function __construct($name, Title $title = null, Legend $legend = null, PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = DataSeries::EMPTY_AS_GAP, Title $xAxisLabel = null, Title $yAxisLabel = null, Axis $xAxis = null, Axis $yAxis = null, GridLines $majorGridlines = null, GridLines $minorGridlines = null) + public function __construct($name, ?Title $title = null, ?Legend $legend = null, ?PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = DataSeries::EMPTY_AS_GAP, ?Title $xAxisLabel = null, ?Title $yAxisLabel = null, ?Axis $xAxis = null, ?Axis $yAxis = null, ?GridLines $majorGridlines = null, ?GridLines $minorGridlines = null) { $this->name = $name; $this->title = $title; @@ -199,7 +190,7 @@ class Chart * * @return $this */ - public function setWorksheet(Worksheet $pValue = null) + public function setWorksheet(?Worksheet $pValue = null) { $this->worksheet = $pValue; @@ -219,8 +210,6 @@ class Chart /** * Set Title. * - * @param Title $title - * * @return $this */ public function setTitle(Title $title) @@ -243,8 +232,6 @@ class Chart /** * Set Legend. * - * @param Legend $legend - * * @return $this */ public function setLegend(Legend $legend) @@ -267,8 +254,6 @@ class Chart /** * Set X-Axis Label. * - * @param Title $label - * * @return $this */ public function setXAxisLabel(Title $label) @@ -291,8 +276,6 @@ class Chart /** * Set Y-Axis Label. * - * @param Title $label - * * @return $this */ public function setYAxisLabel(Title $label) @@ -645,7 +628,7 @@ class Chart return $this->bottomRightYOffset; } - public function refresh() + public function refresh(): void { if ($this->worksheet !== null) { $this->plotArea->refresh($this->worksheet); diff --git a/src/PhpSpreadsheet/Chart/DataSeries.php b/src/PhpSpreadsheet/Chart/DataSeries.php index 79f4e8d1..3a44b335 100644 --- a/src/PhpSpreadsheet/Chart/DataSeries.php +++ b/src/PhpSpreadsheet/Chart/DataSeries.php @@ -373,7 +373,7 @@ class DataSeries return $this; } - public function refresh(Worksheet $worksheet) + public function refresh(Worksheet $worksheet): void { foreach ($this->plotValues as $plotValues) { if ($plotValues !== null) { diff --git a/src/PhpSpreadsheet/Chart/DataSeriesValues.php b/src/PhpSpreadsheet/Chart/DataSeriesValues.php index e15f5da5..c1bd973a 100644 --- a/src/PhpSpreadsheet/Chart/DataSeriesValues.php +++ b/src/PhpSpreadsheet/Chart/DataSeriesValues.php @@ -352,7 +352,7 @@ class DataSeriesValues return $this; } - public function refresh(Worksheet $worksheet, $flatten = true) + public function refresh(Worksheet $worksheet, $flatten = true): void { if ($this->dataSource !== null) { $calcEngine = Calculation::getInstance($worksheet->getParent()); diff --git a/src/PhpSpreadsheet/Chart/GridLines.php b/src/PhpSpreadsheet/Chart/GridLines.php index b07fcae5..2e424bc2 100644 --- a/src/PhpSpreadsheet/Chart/GridLines.php +++ b/src/PhpSpreadsheet/Chart/GridLines.php @@ -107,7 +107,7 @@ class GridLines extends Properties * @param int $alpha * @param string $type */ - public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD) + public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD): void { $this->activateObject() ->lineProperties['color'] = $this->setColorProperties( @@ -130,7 +130,7 @@ class GridLines extends Properties * @param string $end_arrow_type * @param string $end_arrow_size */ - public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null) + public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null): void { $this->activateObject(); ($line_width !== null) @@ -194,7 +194,7 @@ class GridLines extends Properties * @param int $color_alpha * @param string $color_type */ - public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null) + public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null): void { $this ->activateObject() @@ -286,7 +286,7 @@ class GridLines extends Properties * @param int $sh_angle * @param float $sh_distance */ - public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null) + public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null): void { $this->activateObject() ->setShadowPresetsProperties((int) $sh_presets) @@ -318,7 +318,6 @@ class GridLines extends Properties /** * Set Shadow Properties Values. * - * @param array $properties_map * @param mixed &$reference * * @return $this @@ -435,7 +434,7 @@ class GridLines extends Properties * * @param float $size */ - public function setSoftEdgesSize($size) + public function setSoftEdgesSize($size): void { if ($size !== null) { $this->activateObject(); diff --git a/src/PhpSpreadsheet/Chart/Layout.php b/src/PhpSpreadsheet/Chart/Layout.php index 3e989c6d..51c8995b 100644 --- a/src/PhpSpreadsheet/Chart/Layout.php +++ b/src/PhpSpreadsheet/Chart/Layout.php @@ -110,8 +110,6 @@ class Layout /** * Create a new Layout. - * - * @param array $layout */ public function __construct(array $layout = []) { diff --git a/src/PhpSpreadsheet/Chart/Legend.php b/src/PhpSpreadsheet/Chart/Legend.php index d0776265..fc0ed140 100644 --- a/src/PhpSpreadsheet/Chart/Legend.php +++ b/src/PhpSpreadsheet/Chart/Legend.php @@ -52,10 +52,9 @@ class Legend * Create a new Legend. * * @param string $position - * @param null|Layout $layout * @param bool $overlay */ - public function __construct($position = self::POSITION_RIGHT, Layout $layout = null, $overlay = false) + public function __construct($position = self::POSITION_RIGHT, ?Layout $layout = null, $overlay = false) { $this->setPosition($position); $this->layout = $layout; diff --git a/src/PhpSpreadsheet/Chart/PlotArea.php b/src/PhpSpreadsheet/Chart/PlotArea.php index 9da4aa32..954777cf 100644 --- a/src/PhpSpreadsheet/Chart/PlotArea.php +++ b/src/PhpSpreadsheet/Chart/PlotArea.php @@ -23,10 +23,9 @@ class PlotArea /** * Create a new PlotArea. * - * @param null|Layout $layout * @param DataSeries[] $plotSeries */ - public function __construct(Layout $layout = null, array $plotSeries = []) + public function __construct(?Layout $layout = null, array $plotSeries = []) { $this->layout = $layout; $this->plotSeries = $plotSeries; @@ -103,7 +102,7 @@ class PlotArea return $this; } - public function refresh(Worksheet $worksheet) + public function refresh(Worksheet $worksheet): void { foreach ($this->plotSeries as $plotSeries) { $plotSeries->refresh($worksheet); diff --git a/src/PhpSpreadsheet/Chart/Renderer/IRenderer.php b/src/PhpSpreadsheet/Chart/Renderer/IRenderer.php index c6fcfbfc..3032f6ba 100644 --- a/src/PhpSpreadsheet/Chart/Renderer/IRenderer.php +++ b/src/PhpSpreadsheet/Chart/Renderer/IRenderer.php @@ -8,8 +8,6 @@ interface IRenderer { /** * IRenderer constructor. - * - * @param \PhpOffice\PhpSpreadsheet\Chart\Chart $chart */ public function __construct(Chart $chart); diff --git a/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php b/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php index 9dcab049..bd931c66 100644 --- a/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php +++ b/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php @@ -2,8 +2,24 @@ namespace PhpOffice\PhpSpreadsheet\Chart\Renderer; +use AccBarPlot; +use AccLinePlot; +use BarPlot; +use ContourPlot; +use Graph; +use GroupBarPlot; +use LinePlot; use PhpOffice\PhpSpreadsheet\Chart\Chart; use PhpOffice\PhpSpreadsheet\Style\NumberFormat; +use PieGraph; +use PiePlot; +use PiePlot3D; +use PiePlotC; +use RadarGraph; +use RadarPlot; +use ScatterPlot; +use Spline; +use StockPlot; require_once __DIR__ . '/Polyfill.php'; @@ -33,8 +49,6 @@ class JpGraph implements IRenderer /** * Create a new jpgraph. - * - * @param Chart $chart */ public function __construct(Chart $chart) { @@ -43,7 +57,7 @@ class JpGraph implements IRenderer $this->chart = $chart; } - private static function init() + private static function init(): void { static $loaded = false; if ($loaded) { @@ -179,7 +193,7 @@ class JpGraph implements IRenderer return $caption; } - private function renderTitle() + private function renderTitle(): void { $title = $this->getCaption($this->chart->getTitle()); if ($title !== null) { @@ -187,7 +201,7 @@ class JpGraph implements IRenderer } } - private function renderLegend() + private function renderLegend(): void { $legend = $this->chart->getLegend(); if ($legend !== null) { @@ -220,9 +234,9 @@ class JpGraph implements IRenderer } } - private function renderCartesianPlotArea($type = 'textlin') + private function renderCartesianPlotArea($type = 'textlin'): void { - $this->graph = new \Graph(self::$width, self::$height); + $this->graph = new Graph(self::$width, self::$height); $this->graph->SetScale($type); $this->renderTitle(); @@ -257,22 +271,22 @@ class JpGraph implements IRenderer } } - private function renderPiePlotArea() + private function renderPiePlotArea(): void { - $this->graph = new \PieGraph(self::$width, self::$height); + $this->graph = new PieGraph(self::$width, self::$height); $this->renderTitle(); } - private function renderRadarPlotArea() + private function renderRadarPlotArea(): void { - $this->graph = new \RadarGraph(self::$width, self::$height); + $this->graph = new RadarGraph(self::$width, self::$height); $this->graph->SetScale('lin'); $this->renderTitle(); } - private function renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d') + private function renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d'): void { $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); @@ -308,7 +322,7 @@ class JpGraph implements IRenderer ++$testCurrentIndex; } - $seriesPlot = new \LinePlot($dataValues); + $seriesPlot = new LinePlot($dataValues); if ($combination) { $seriesPlot->SetBarCenter(); } @@ -330,12 +344,12 @@ class JpGraph implements IRenderer if ($grouping == 'standard') { $groupPlot = $seriesPlots; } else { - $groupPlot = new \AccLinePlot($seriesPlots); + $groupPlot = new AccLinePlot($seriesPlots); } $this->graph->Add($groupPlot); } - private function renderPlotBar($groupID, $dimensions = '2d') + private function renderPlotBar($groupID, $dimensions = '2d'): void { $rotation = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection(); // Rotate for bar rather than column chart @@ -385,7 +399,7 @@ class JpGraph implements IRenderer if ($rotation == 'bar') { $dataValues = array_reverse($dataValues); } - $seriesPlot = new \BarPlot($dataValues); + $seriesPlot = new BarPlot($dataValues); $seriesPlot->SetColor('black'); $seriesPlot->SetFillColor(self::$colourSet[self::$plotColour++]); if ($dimensions == '3d') { @@ -406,11 +420,11 @@ class JpGraph implements IRenderer } if ($grouping == 'clustered') { - $groupPlot = new \GroupBarPlot($seriesPlots); + $groupPlot = new GroupBarPlot($seriesPlots); } elseif ($grouping == 'standard') { - $groupPlot = new \GroupBarPlot($seriesPlots); + $groupPlot = new GroupBarPlot($seriesPlots); } else { - $groupPlot = new \AccBarPlot($seriesPlots); + $groupPlot = new AccBarPlot($seriesPlots); if ($dimensions == '3d') { $groupPlot->SetShadow(); } @@ -419,7 +433,7 @@ class JpGraph implements IRenderer $this->graph->Add($groupPlot); } - private function renderPlotScatter($groupID, $bubble) + private function renderPlotScatter($groupID, $bubble): void { $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); $scatterStyle = $bubbleSize = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); @@ -436,14 +450,14 @@ class JpGraph implements IRenderer $dataValuesY[$k] = $k; } - $seriesPlot = new \ScatterPlot($dataValuesX, $dataValuesY); + $seriesPlot = new ScatterPlot($dataValuesX, $dataValuesY); if ($scatterStyle == 'lineMarker') { $seriesPlot->SetLinkPoints(); $seriesPlot->link->SetColor(self::$colourSet[self::$plotColour]); } elseif ($scatterStyle == 'smoothMarker') { - $spline = new \Spline($dataValuesY, $dataValuesX); + $spline = new Spline($dataValuesY, $dataValuesX); [$splineDataY, $splineDataX] = $spline->Get(count($dataValuesX) * self::$width / 20); - $lplot = new \LinePlot($splineDataX, $splineDataY); + $lplot = new LinePlot($splineDataX, $splineDataY); $lplot->SetColor(self::$colourSet[self::$plotColour]); $this->graph->Add($lplot); @@ -464,7 +478,7 @@ class JpGraph implements IRenderer } } - private function renderPlotRadar($groupID) + private function renderPlotRadar($groupID): void { $radarStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); @@ -488,7 +502,7 @@ class JpGraph implements IRenderer $this->graph->SetTitles(array_reverse($dataValues)); - $seriesPlot = new \RadarPlot(array_reverse($dataValuesX)); + $seriesPlot = new RadarPlot(array_reverse($dataValuesX)); $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue(); $seriesPlot->SetColor(self::$colourSet[self::$plotColour++]); @@ -502,7 +516,7 @@ class JpGraph implements IRenderer } } - private function renderPlotContour($groupID) + private function renderPlotContour($groupID): void { $contourStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); @@ -517,12 +531,12 @@ class JpGraph implements IRenderer $dataValues[$i] = $dataValuesX; } - $seriesPlot = new \ContourPlot($dataValues); + $seriesPlot = new ContourPlot($dataValues); $this->graph->Add($seriesPlot); } - private function renderPlotStock($groupID) + private function renderPlotStock($groupID): void { $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); $plotOrder = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder(); @@ -556,13 +570,13 @@ class JpGraph implements IRenderer $this->graph->xaxis->SetTickLabels($datasetLabels); } - $seriesPlot = new \StockPlot($dataValuesPlot); + $seriesPlot = new StockPlot($dataValuesPlot); $seriesPlot->SetWidth(20); $this->graph->Add($seriesPlot); } - private function renderAreaChart($groupCount, $dimensions = '2d') + private function renderAreaChart($groupCount, $dimensions = '2d'): void { $this->renderCartesianPlotArea(); @@ -571,7 +585,7 @@ class JpGraph implements IRenderer } } - private function renderLineChart($groupCount, $dimensions = '2d') + private function renderLineChart($groupCount, $dimensions = '2d'): void { $this->renderCartesianPlotArea(); @@ -580,7 +594,7 @@ class JpGraph implements IRenderer } } - private function renderBarChart($groupCount, $dimensions = '2d') + private function renderBarChart($groupCount, $dimensions = '2d'): void { $this->renderCartesianPlotArea(); @@ -589,7 +603,7 @@ class JpGraph implements IRenderer } } - private function renderScatterChart($groupCount) + private function renderScatterChart($groupCount): void { $this->renderCartesianPlotArea('linlin'); @@ -598,7 +612,7 @@ class JpGraph implements IRenderer } } - private function renderBubbleChart($groupCount) + private function renderBubbleChart($groupCount): void { $this->renderCartesianPlotArea('linlin'); @@ -607,7 +621,7 @@ class JpGraph implements IRenderer } } - private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = false, $multiplePlots = false) + private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = false, $multiplePlots = false): void { $this->renderPiePlotArea(); @@ -643,12 +657,12 @@ class JpGraph implements IRenderer } if ($dimensions == '3d') { - $seriesPlot = new \PiePlot3D($dataValues); + $seriesPlot = new PiePlot3D($dataValues); } else { if ($doughnut) { - $seriesPlot = new \PiePlotC($dataValues); + $seriesPlot = new PiePlotC($dataValues); } else { - $seriesPlot = new \PiePlot($dataValues); + $seriesPlot = new PiePlot($dataValues); } } @@ -679,7 +693,7 @@ class JpGraph implements IRenderer } } - private function renderRadarChart($groupCount) + private function renderRadarChart($groupCount): void { $this->renderRadarPlotArea(); @@ -688,7 +702,7 @@ class JpGraph implements IRenderer } } - private function renderStockChart($groupCount) + private function renderStockChart($groupCount): void { $this->renderCartesianPlotArea('intint'); @@ -697,7 +711,7 @@ class JpGraph implements IRenderer } } - private function renderContourChart($groupCount, $dimensions) + private function renderContourChart($groupCount, $dimensions): void { $this->renderCartesianPlotArea('intint'); diff --git a/src/PhpSpreadsheet/Chart/Renderer/Polyfill.php b/src/PhpSpreadsheet/Chart/Renderer/Polyfill.php index 7fa38394..5e233abd 100644 --- a/src/PhpSpreadsheet/Chart/Renderer/Polyfill.php +++ b/src/PhpSpreadsheet/Chart/Renderer/Polyfill.php @@ -2,7 +2,7 @@ // This is a dirty workaround to output JpGraph charts even when antialiasing is not available if (!function_exists('imageantialias')) { - function imageantialias(...$args) + function imageantialias(...$args): void { // Do nothing } diff --git a/src/PhpSpreadsheet/Chart/Title.php b/src/PhpSpreadsheet/Chart/Title.php index 650bcdc1..af9fa088 100644 --- a/src/PhpSpreadsheet/Chart/Title.php +++ b/src/PhpSpreadsheet/Chart/Title.php @@ -22,9 +22,8 @@ class Title * Create a new Title. * * @param null|mixed $caption - * @param null|Layout $layout */ - public function __construct($caption = null, Layout $layout = null) + public function __construct($caption = null, ?Layout $layout = null) { $this->caption = $caption; $this->layout = $layout; diff --git a/src/PhpSpreadsheet/Collection/Cells.php b/src/PhpSpreadsheet/Collection/Cells.php index b9017e0e..48f34f41 100644 --- a/src/PhpSpreadsheet/Collection/Cells.php +++ b/src/PhpSpreadsheet/Collection/Cells.php @@ -2,6 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Collection; +use Generator; use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; @@ -61,7 +62,6 @@ class Cells * Initialise this new cell collection. * * @param Worksheet $parent The worksheet for this cell collection - * @param CacheInterface $cache */ public function __construct(Worksheet $parent, CacheInterface $cache) { @@ -117,7 +117,7 @@ class Cells * * @param string $pCoord Coordinate of the cell to delete */ - public function delete($pCoord) + public function delete($pCoord): void { if ($pCoord === $this->currentCoordinate && $this->currentCell !== null) { $this->currentCell->detach(); @@ -346,7 +346,7 @@ class Cells * * @param string $row Row number to remove */ - public function removeRow($row) + public function removeRow($row): void { foreach ($this->getCoordinates() as $coord) { $c = ''; @@ -364,7 +364,7 @@ class Cells * * @param string $column Column ID to remove */ - public function removeColumn($column) + public function removeColumn($column): void { foreach ($this->getCoordinates() as $coord) { $c = ''; @@ -381,7 +381,7 @@ class Cells * Store cell data in cache for the current cell object if it's "dirty", * and the 'nullify' the current cell object. */ - private function storeCurrentCell() + private function storeCurrentCell(): void { if ($this->currentCellIsDirty && !empty($this->currentCoordinate)) { $this->currentCell->detach(); @@ -459,7 +459,7 @@ class Cells /** * Clear the cell collection and disconnect from our parent. */ - public function unsetWorksheetCells() + public function unsetWorksheetCells(): void { if ($this->currentCell !== null) { $this->currentCell->detach(); @@ -487,7 +487,7 @@ class Cells /** * Returns all known cache keys. * - * @return \Generator|string[] + * @return Generator|string[] */ private function getAllCacheKeys() { diff --git a/src/PhpSpreadsheet/Comment.php b/src/PhpSpreadsheet/Comment.php index 8041ddaf..31f76640 100644 --- a/src/PhpSpreadsheet/Comment.php +++ b/src/PhpSpreadsheet/Comment.php @@ -118,8 +118,6 @@ class Comment implements IComparable /** * Set Rich text comment. * - * @param RichText $pValue - * * @return $this */ public function setText(RichText $pValue) diff --git a/src/PhpSpreadsheet/Document/Properties.php b/src/PhpSpreadsheet/Document/Properties.php index 58fd2ef6..cbaae2db 100644 --- a/src/PhpSpreadsheet/Document/Properties.php +++ b/src/PhpSpreadsheet/Document/Properties.php @@ -458,10 +458,10 @@ class Properties public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = null) { if (($propertyType === null) || (!in_array($propertyType, [self::PROPERTY_TYPE_INTEGER, - self::PROPERTY_TYPE_FLOAT, - self::PROPERTY_TYPE_STRING, - self::PROPERTY_TYPE_DATE, - self::PROPERTY_TYPE_BOOLEAN, ]))) { + self::PROPERTY_TYPE_FLOAT, + self::PROPERTY_TYPE_STRING, + self::PROPERTY_TYPE_DATE, + self::PROPERTY_TYPE_BOOLEAN, ]))) { if ($propertyValue === null) { $propertyType = self::PROPERTY_TYPE_STRING; } elseif (is_float($propertyValue)) { diff --git a/src/PhpSpreadsheet/DocumentGenerator.php b/src/PhpSpreadsheet/DocumentGenerator.php index 8baba6e5..5e06af97 100644 --- a/src/PhpSpreadsheet/DocumentGenerator.php +++ b/src/PhpSpreadsheet/DocumentGenerator.php @@ -11,8 +11,6 @@ class DocumentGenerator { /** * @param array[] $phpSpreadsheetFunctions - * - * @return string */ public static function generateFunctionListByCategory(array $phpSpreadsheetFunctions): string { @@ -40,7 +38,7 @@ class DocumentGenerator return (new ReflectionClass(Category::class))->getConstants(); } - private static function tableRow(array $lengths, array $values = null): string + private static function tableRow(array $lengths, ?array $values = null): string { $result = ''; foreach (array_map(null, $lengths, $values ?? []) as $i => [$length, $value]) { @@ -73,8 +71,6 @@ class DocumentGenerator /** * @param array[] $phpSpreadsheetFunctions - * - * @return string */ public static function generateFunctionListByName(array $phpSpreadsheetFunctions): string { diff --git a/src/PhpSpreadsheet/HashTable.php b/src/PhpSpreadsheet/HashTable.php index 4d1e7b4d..90ea806b 100644 --- a/src/PhpSpreadsheet/HashTable.php +++ b/src/PhpSpreadsheet/HashTable.php @@ -36,7 +36,7 @@ class HashTable * * @param IComparable[] $pSource Source array to create HashTable from */ - public function addFromSource(array $pSource = null) + public function addFromSource(?array $pSource = null): void { // Check if an array was passed if ($pSource == null) { @@ -53,7 +53,7 @@ class HashTable * * @param IComparable $pSource Item to add */ - public function add(IComparable $pSource) + public function add(IComparable $pSource): void { $hash = $pSource->getHashCode(); if (!isset($this->items[$hash])) { @@ -67,7 +67,7 @@ class HashTable * * @param IComparable $pSource Item to remove */ - public function remove(IComparable $pSource) + public function remove(IComparable $pSource): void { $hash = $pSource->getHashCode(); if (isset($this->items[$hash])) { @@ -90,7 +90,7 @@ class HashTable /** * Clear HashTable. */ - public function clear() + public function clear(): void { $this->items = []; $this->keyMap = []; diff --git a/src/PhpSpreadsheet/Helper/Html.php b/src/PhpSpreadsheet/Helper/Html.php index eaf73028..252e14a5 100644 --- a/src/PhpSpreadsheet/Helper/Html.php +++ b/src/PhpSpreadsheet/Helper/Html.php @@ -593,7 +593,7 @@ class Html */ protected $richTextObject; - protected function initialise() + protected function initialise(): void { $this->face = $this->size = $this->color = null; $this->bold = $this->italic = $this->underline = $this->superscript = $this->subscript = $this->strikethrough = false; @@ -632,7 +632,7 @@ class Html return $this->richTextObject; } - protected function cleanWhitespace() + protected function cleanWhitespace(): void { foreach ($this->richTextObject->getRichTextElements() as $key => $element) { $text = $element->getText(); @@ -646,7 +646,7 @@ class Html } } - protected function buildTextRun() + protected function buildTextRun(): void { $text = $this->stringData; if (trim($text) === '') { @@ -691,7 +691,7 @@ class Html $value = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } - return implode($values[0]); + return implode('', $values[0]); } protected function colourNameLookup($rgb) @@ -699,7 +699,7 @@ class Html return self::$colourMap[$rgb]; } - protected function startFontTag($tag) + protected function startFontTag($tag): void { foreach ($tag->attributes as $attribute) { $attributeName = strtolower($attribute->name); @@ -719,77 +719,77 @@ class Html } } - protected function endFontTag() + protected function endFontTag(): void { $this->face = $this->size = $this->color = null; } - protected function startBoldTag() + protected function startBoldTag(): void { $this->bold = true; } - protected function endBoldTag() + protected function endBoldTag(): void { $this->bold = false; } - protected function startItalicTag() + protected function startItalicTag(): void { $this->italic = true; } - protected function endItalicTag() + protected function endItalicTag(): void { $this->italic = false; } - protected function startUnderlineTag() + protected function startUnderlineTag(): void { $this->underline = true; } - protected function endUnderlineTag() + protected function endUnderlineTag(): void { $this->underline = false; } - protected function startSubscriptTag() + protected function startSubscriptTag(): void { $this->subscript = true; } - protected function endSubscriptTag() + protected function endSubscriptTag(): void { $this->subscript = false; } - protected function startSuperscriptTag() + protected function startSuperscriptTag(): void { $this->superscript = true; } - protected function endSuperscriptTag() + protected function endSuperscriptTag(): void { $this->superscript = false; } - protected function startStrikethruTag() + protected function startStrikethruTag(): void { $this->strikethrough = true; } - protected function endStrikethruTag() + protected function endStrikethruTag(): void { $this->strikethrough = false; } - protected function breakTag() + protected function breakTag(): void { $this->stringData .= "\n"; } - protected function parseTextNode(DOMText $textNode) + protected function parseTextNode(DOMText $textNode): void { $domText = preg_replace( '/\s+/u', @@ -801,11 +801,9 @@ class Html } /** - * @param DOMElement $element * @param string $callbackTag - * @param array $callbacks */ - protected function handleCallback(DOMElement $element, $callbackTag, array $callbacks) + protected function handleCallback(DOMElement $element, $callbackTag, array $callbacks): void { if (isset($callbacks[$callbackTag])) { $elementHandler = $callbacks[$callbackTag]; @@ -815,7 +813,7 @@ class Html } } - protected function parseElementNode(DOMElement $element) + protected function parseElementNode(DOMElement $element): void { $callbackTag = strtolower($element->nodeName); $this->stack[] = $callbackTag; @@ -828,7 +826,7 @@ class Html $this->handleCallback($element, $callbackTag, $this->endTagCallbacks); } - protected function parseElements(DOMNode $element) + protected function parseElements(DOMNode $element): void { foreach ($element->childNodes as $child) { if ($child instanceof DOMText) { diff --git a/src/PhpSpreadsheet/Helper/Sample.php b/src/PhpSpreadsheet/Helper/Sample.php index e199c807..a91b195e 100644 --- a/src/PhpSpreadsheet/Helper/Sample.php +++ b/src/PhpSpreadsheet/Helper/Sample.php @@ -11,6 +11,7 @@ use RecursiveIteratorIterator; use RecursiveRegexIterator; use ReflectionClass; use RegexIterator; +use RuntimeException; /** * Helper class to be used in sample code. @@ -106,11 +107,10 @@ class Sample /** * Write documents. * - * @param Spreadsheet $spreadsheet * @param string $filename * @param string[] $writers */ - public function write(Spreadsheet $spreadsheet, $filename, array $writers = ['Xlsx', 'Xls']) + public function write(Spreadsheet $spreadsheet, $filename, array $writers = ['Xlsx', 'Xls']): void { // Set active sheet index to the first sheet, so Excel opens this as the first sheet $spreadsheet->setActiveSheetIndex(0); @@ -142,7 +142,7 @@ class Sample $tempFolder = sys_get_temp_dir() . '/phpspreadsheet'; if (!is_dir($tempFolder)) { if (!mkdir($tempFolder) && !is_dir($tempFolder)) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $tempFolder)); + throw new RuntimeException(sprintf('Directory "%s" was not created', $tempFolder)); } } @@ -179,7 +179,7 @@ class Sample return $temporaryFilename . '.' . $extension; } - public function log($message) + public function log($message): void { $eol = $this->isCli() ? PHP_EOL : '
'; echo date('H:i:s ') . $message . $eol; @@ -188,7 +188,7 @@ class Sample /** * Log ending notes. */ - public function logEndingNotes() + public function logEndingNotes(): void { // Do not show execution time for index $this->log('Peak memory usage: ' . (memory_get_peak_usage(true) / 1024 / 1024) . 'MB'); @@ -197,11 +197,10 @@ class Sample /** * Log a line about the write operation. * - * @param IWriter $writer * @param string $path * @param float $callStartTime */ - public function logWrite(IWriter $writer, $path, $callStartTime) + public function logWrite(IWriter $writer, $path, $callStartTime): void { $callEndTime = microtime(true); $callTime = $callEndTime - $callStartTime; @@ -219,7 +218,7 @@ class Sample * @param string $path * @param float $callStartTime */ - public function logRead($format, $path, $callStartTime) + public function logRead($format, $path, $callStartTime): void { $callEndTime = microtime(true); $callTime = $callEndTime - $callStartTime; diff --git a/src/PhpSpreadsheet/IOFactory.php b/src/PhpSpreadsheet/IOFactory.php index 38c0f221..ab04e969 100644 --- a/src/PhpSpreadsheet/IOFactory.php +++ b/src/PhpSpreadsheet/IOFactory.php @@ -37,7 +37,6 @@ abstract class IOFactory /** * Create Writer\IWriter. * - * @param Spreadsheet $spreadsheet * @param string $writerType Example: Xlsx * * @return Writer\IWriter @@ -192,7 +191,7 @@ abstract class IOFactory * @param string $writerType * @param string $writerClass */ - public static function registerWriter($writerType, $writerClass) + public static function registerWriter($writerType, $writerClass): void { if (!is_a($writerClass, Writer\IWriter::class, true)) { throw new Writer\Exception('Registered writers must implement ' . Writer\IWriter::class); @@ -207,7 +206,7 @@ abstract class IOFactory * @param string $readerType * @param string $readerClass */ - public static function registerReader($readerType, $readerClass) + public static function registerReader($readerType, $readerClass): void { if (!is_a($readerClass, Reader\IReader::class, true)) { throw new Reader\Exception('Registered readers must implement ' . Reader\IReader::class); diff --git a/src/PhpSpreadsheet/NamedRange.php b/src/PhpSpreadsheet/NamedRange.php index 576f17d7..94fe8190 100644 --- a/src/PhpSpreadsheet/NamedRange.php +++ b/src/PhpSpreadsheet/NamedRange.php @@ -45,7 +45,6 @@ class NamedRange * Create a new NamedRange. * * @param string $pName - * @param Worksheet $pWorksheet * @param string $pRange * @param bool $pLocalOnly * @param null|Worksheet $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope. @@ -123,7 +122,7 @@ class NamedRange * * @return $this */ - public function setWorksheet(Worksheet $value = null) + public function setWorksheet(?Worksheet $value = null) { if ($value !== null) { $this->worksheet = $value; @@ -196,11 +195,9 @@ class NamedRange /** * Set scope. * - * @param null|Worksheet $value - * * @return $this */ - public function setScope(Worksheet $value = null) + public function setScope(?Worksheet $value = null) { $this->scope = $value; $this->localOnly = $value != null; diff --git a/src/PhpSpreadsheet/Reader/BaseReader.php b/src/PhpSpreadsheet/Reader/BaseReader.php index 35466e73..77a6421b 100644 --- a/src/PhpSpreadsheet/Reader/BaseReader.php +++ b/src/PhpSpreadsheet/Reader/BaseReader.php @@ -145,12 +145,12 @@ abstract class BaseReader implements IReader * * @param string $pFilename */ - protected function openFile($pFilename) + protected function openFile($pFilename): void { File::assertFile($pFilename); // Open file - $this->fileHandle = fopen($pFilename, 'r'); + $this->fileHandle = fopen($pFilename, 'rb'); if ($this->fileHandle === false) { throw new Exception('Could not open file ' . $pFilename . ' for reading.'); } diff --git a/src/PhpSpreadsheet/Reader/Csv.php b/src/PhpSpreadsheet/Reader/Csv.php index 2e485109..db2b50b9 100644 --- a/src/PhpSpreadsheet/Reader/Csv.php +++ b/src/PhpSpreadsheet/Reader/Csv.php @@ -2,6 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader; +use InvalidArgumentException; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Spreadsheet; @@ -85,7 +86,7 @@ class Csv extends BaseReader /** * Move filepointer past any BOM marker. */ - protected function skipBOM() + protected function skipBOM(): void { rewind($this->fileHandle); @@ -101,7 +102,7 @@ class Csv extends BaseReader /** * Identify any separator that is explicitly set in the file. */ - protected function checkSeparator() + protected function checkSeparator(): void { $line = fgets($this->fileHandle); if ($line === false) { @@ -120,7 +121,7 @@ class Csv extends BaseReader /** * Infer the separator if it isn't explicitly set in the file or specified by the user. */ - protected function inferSeparator() + protected function inferSeparator(): void { if ($this->delimiter !== null) { return; @@ -178,7 +179,7 @@ class Csv extends BaseReader $meanSquareDeviations[$delimiter] = array_reduce( $series, function ($sum, $value) use ($median) { - return $sum + pow($value - $median, 2); + return $sum + ($value - $median) ** 2; } ) / count($series); } @@ -292,7 +293,7 @@ class Csv extends BaseReader return $this->loadIntoExisting($pFilename, $spreadsheet); } - private function openFileOrMemory($pFilename) + private function openFileOrMemory($pFilename): void { // Open file $fhandle = $this->canRead($pFilename); @@ -303,7 +304,7 @@ class Csv extends BaseReader if ($this->inputEncoding !== 'UTF-8') { fclose($this->fileHandle); $entireFile = file_get_contents($pFilename); - $this->fileHandle = fopen('php://memory', 'r+'); + $this->fileHandle = fopen('php://memory', 'r+b'); $data = StringHelper::convertEncoding($entireFile, 'UTF-8', $this->inputEncoding); fwrite($this->fileHandle, $data); rewind($this->fileHandle); @@ -314,7 +315,6 @@ class Csv extends BaseReader * Loads PhpSpreadsheet from file into PhpSpreadsheet instance. * * @param string $pFilename - * @param Spreadsheet $spreadsheet * * @return Spreadsheet */ @@ -508,7 +508,7 @@ class Csv extends BaseReader // Check if file exists try { $this->openFile($pFilename); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { return false; } diff --git a/src/PhpSpreadsheet/Reader/Gnumeric.php b/src/PhpSpreadsheet/Reader/Gnumeric.php index 83ff293c..f9768029 100644 --- a/src/PhpSpreadsheet/Reader/Gnumeric.php +++ b/src/PhpSpreadsheet/Reader/Gnumeric.php @@ -58,7 +58,7 @@ class Gnumeric extends BaseReader } // Read signature data (first 3 bytes) - $fh = fopen($pFilename, 'r'); + $fh = fopen($pFilename, 'rb'); $data = fread($fh, 2); fclose($fh); @@ -182,7 +182,6 @@ class Gnumeric extends BaseReader * Loads from file into Spreadsheet instance. * * @param string $pFilename - * @param Spreadsheet $spreadsheet * * @return Spreadsheet */ @@ -473,7 +472,7 @@ class Gnumeric extends BaseReader $endColumn = ($styleAttributes['endCol'] > $maxCol) ? $maxCol : (int) $styleAttributes['endCol']; $endColumn = Coordinate::stringFromColumnIndex($endColumn + 1); $endRow = ($styleAttributes['endRow'] > $maxRow) ? $maxRow : $styleAttributes['endRow']; - $endRow += 1; + ++$endRow; $cellRange = $startColumn . $startRow . ':' . $endColumn . $endRow; $styleAttributes = $styleRegion->Style->attributes(); diff --git a/src/PhpSpreadsheet/Reader/Html.php b/src/PhpSpreadsheet/Reader/Html.php index 86263a20..5e12a2fb 100644 --- a/src/PhpSpreadsheet/Reader/Html.php +++ b/src/PhpSpreadsheet/Reader/Html.php @@ -270,7 +270,7 @@ class Html extends BaseReader return array_pop($this->nestedColumn); } - protected function flushCell(Worksheet $sheet, $column, $row, &$cellContent) + protected function flushCell(Worksheet $sheet, $column, $row, &$cellContent): void { if (is_string($cellContent)) { // Simple String content @@ -290,13 +290,11 @@ class Html extends BaseReader } /** - * @param DOMNode $element - * @param Worksheet $sheet * @param int $row * @param string $column * @param string $cellContent */ - protected function processDomElement(DOMNode $element, Worksheet $sheet, &$row, &$column, &$cellContent) + protected function processDomElement(DOMNode $element, Worksheet $sheet, &$row, &$column, &$cellContent): void { foreach ($element->childNodes as $child) { if ($child instanceof DOMText) { @@ -577,7 +575,6 @@ class Html extends BaseReader * Loads PhpSpreadsheet from file into PhpSpreadsheet instance. * * @param string $pFilename - * @param Spreadsheet $spreadsheet * * @return Spreadsheet */ @@ -603,9 +600,6 @@ class Html extends BaseReader * Spreadsheet from content. * * @param string $content - * @param null|Spreadsheet $spreadsheet - * - * @return Spreadsheet */ public function loadFromString($content, ?Spreadsheet $spreadsheet = null): Spreadsheet { @@ -622,11 +616,6 @@ class Html extends BaseReader /** * Loads PhpSpreadsheet from DOMDocument into PhpSpreadsheet instance. - * - * @param DOMDocument $document - * @param Spreadsheet $spreadsheet - * - * @return Spreadsheet */ private function loadDocument(DOMDocument $document, Spreadsheet $spreadsheet): Spreadsheet { @@ -687,7 +676,7 @@ class Html extends BaseReader * @param string $column * @param array $attributeArray */ - private function applyInlineStyle(&$sheet, $row, $column, $attributeArray) + private function applyInlineStyle(&$sheet, $row, $column, $attributeArray): void { if (!isset($attributeArray['style'])) { return; @@ -852,12 +841,10 @@ class Html extends BaseReader } /** - * @param Worksheet $sheet * @param string $column * @param int $row - * @param array $attributes */ - private function insertImage(Worksheet $sheet, $column, $row, array $attributes) + private function insertImage(Worksheet $sheet, $column, $row, array $attributes): void { if (!isset($attributes['src'])) { return; @@ -941,11 +928,10 @@ class Html extends BaseReader } /** - * @param Style $cellStyle * @param string $styleValue * @param string $type */ - private function setBorderStyle(Style $cellStyle, $styleValue, $type) + private function setBorderStyle(Style $cellStyle, $styleValue, $type): void { [, $borderStyle, $color] = explode(' ', $styleValue); diff --git a/src/PhpSpreadsheet/Reader/IReader.php b/src/PhpSpreadsheet/Reader/IReader.php index 3f5a7e49..a8bd3606 100644 --- a/src/PhpSpreadsheet/Reader/IReader.php +++ b/src/PhpSpreadsheet/Reader/IReader.php @@ -118,8 +118,6 @@ interface IReader /** * Set read filter. * - * @param IReadFilter $pValue - * * @return IReader */ public function setReadFilter(IReadFilter $pValue); diff --git a/src/PhpSpreadsheet/Reader/Ods.php b/src/PhpSpreadsheet/Reader/Ods.php index 41fd34a8..d638d1fb 100644 --- a/src/PhpSpreadsheet/Reader/Ods.php +++ b/src/PhpSpreadsheet/Reader/Ods.php @@ -4,6 +4,10 @@ namespace PhpOffice\PhpSpreadsheet\Reader; use DateTime; use DateTimeZone; +use DOMAttr; +use DOMDocument; +use DOMElement; +use DOMNode; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Cell\DataType; @@ -242,7 +246,6 @@ class Ods extends BaseReader * Loads PhpSpreadsheet from file into PhpSpreadsheet instance. * * @param string $pFilename - * @param Spreadsheet $spreadsheet * * @return Spreadsheet */ @@ -251,7 +254,7 @@ class Ods extends BaseReader File::assertFile($pFilename); $timezoneObj = new DateTimeZone('Europe/London'); - $GMT = new \DateTimeZone('UTC'); + $GMT = new DateTimeZone('UTC'); $zip = new ZipArchive(); if (!$zip->open($pFilename)) { @@ -275,7 +278,7 @@ class Ods extends BaseReader // Content - $dom = new \DOMDocument('1.01', 'UTF-8'); + $dom = new DOMDocument('1.01', 'UTF-8'); $dom->loadXML( $this->securityScanner->scan($zip->getFromName('content.xml')), Settings::getLibXmlLoaderOptions() @@ -291,12 +294,12 @@ class Ods extends BaseReader ->getElementsByTagNameNS($officeNs, 'spreadsheet'); foreach ($spreadsheets as $workbookData) { - /** @var \DOMElement $workbookData */ + /** @var DOMElement $workbookData */ $tables = $workbookData->getElementsByTagNameNS($tableNs, 'table'); $worksheetID = 0; foreach ($tables as $worksheetDataSet) { - /** @var \DOMElement $worksheetDataSet */ + /** @var DOMElement $worksheetDataSet */ $worksheetName = $worksheetDataSet->getAttributeNS($tableNs, 'name'); // Check loadSheetsOnly @@ -322,7 +325,7 @@ class Ods extends BaseReader // Go through every child of table element $rowID = 1; foreach ($worksheetDataSet->childNodes as $childNode) { - /** @var \DOMElement $childNode */ + /** @var DOMElement $childNode */ // Filter elements which are not under the "table" ns if ($childNode->namespaceURI != $tableNs) { @@ -395,11 +398,11 @@ class Ods extends BaseReader // Content - /** @var \DOMElement[] $paragraphs */ + /** @var DOMElement[] $paragraphs */ $paragraphs = []; foreach ($cellData->childNodes as $item) { - /** @var \DOMElement $item */ + /** @var DOMElement $item */ // Filter text:p elements if ($item->nodeName == 'text:p') { @@ -649,22 +652,20 @@ class Ods extends BaseReader /** * Recursively scan element. * - * @param \DOMNode $element - * * @return string */ - protected function scanElementForText(\DOMNode $element) + protected function scanElementForText(DOMNode $element) { $str = ''; foreach ($element->childNodes as $child) { - /** @var \DOMNode $child */ + /** @var DOMNode $child */ if ($child->nodeType == XML_TEXT_NODE) { $str .= $child->nodeValue; } elseif ($child->nodeType == XML_ELEMENT_NODE && $child->nodeName == 'text:s') { // It's a space // Multiple spaces? - /** @var \DOMAttr $cAttr */ + /** @var DOMAttr $cAttr */ $cAttr = $child->attributes->getNamedItem('c'); if ($cAttr) { $multiplier = (int) $cAttr->nodeValue; diff --git a/src/PhpSpreadsheet/Reader/Ods/Properties.php b/src/PhpSpreadsheet/Reader/Ods/Properties.php index c5c7caf8..c0b309a9 100644 --- a/src/PhpSpreadsheet/Reader/Ods/Properties.php +++ b/src/PhpSpreadsheet/Reader/Ods/Properties.php @@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Ods; use PhpOffice\PhpSpreadsheet\Document\Properties as DocumentProperties; use PhpOffice\PhpSpreadsheet\Spreadsheet; +use SimpleXMLElement; class Properties { @@ -14,7 +15,7 @@ class Properties $this->spreadsheet = $spreadsheet; } - public function load(\SimpleXMLElement $xml, $namespacesMeta) + public function load(SimpleXMLElement $xml, $namespacesMeta): void { $docProps = $this->spreadsheet->getProperties(); $officeProperty = $xml->children($namespacesMeta['office']); @@ -35,7 +36,7 @@ class Properties } } - private function setCoreProperties(DocumentProperties $docProps, \SimpleXMLElement $officePropertyDC) + private function setCoreProperties(DocumentProperties $docProps, SimpleXMLElement $officePropertyDC): void { foreach ($officePropertyDC as $propertyName => $propertyValue) { $propertyValue = (string) $propertyValue; @@ -73,10 +74,10 @@ class Properties private function setMetaProperties( $namespacesMeta, - \SimpleXMLElement $propertyValue, + SimpleXMLElement $propertyValue, $propertyName, DocumentProperties $docProps - ) { + ): void { $propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']); $propertyValue = (string) $propertyValue; switch ($propertyName) { @@ -100,7 +101,7 @@ class Properties } } - private function setUserDefinedProperty($propertyValueAttributes, $propertyValue, DocumentProperties $docProps) + private function setUserDefinedProperty($propertyValueAttributes, $propertyValue, DocumentProperties $docProps): void { $propertyValueName = ''; $propertyValueType = DocumentProperties::PROPERTY_TYPE_STRING; diff --git a/src/PhpSpreadsheet/Reader/Security/XmlScanner.php b/src/PhpSpreadsheet/Reader/Security/XmlScanner.php index 33e21f9d..55bba632 100644 --- a/src/PhpSpreadsheet/Reader/Security/XmlScanner.php +++ b/src/PhpSpreadsheet/Reader/Security/XmlScanner.php @@ -61,7 +61,7 @@ class XmlScanner return false; } - private function disableEntityLoaderCheck() + private function disableEntityLoaderCheck(): void { if (Settings::getLibXmlDisableEntityLoader()) { $libxmlDisableEntityLoaderValue = libxml_disable_entity_loader(true); @@ -72,7 +72,7 @@ class XmlScanner } } - public static function shutdown() + public static function shutdown(): void { if (self::$libxmlDisableEntityLoaderValue !== null) { libxml_disable_entity_loader(self::$libxmlDisableEntityLoaderValue); @@ -85,7 +85,7 @@ class XmlScanner self::shutdown(); } - public function setAdditionalCallback(callable $callback) + public function setAdditionalCallback(callable $callback): void { $this->callback = $callback; } diff --git a/src/PhpSpreadsheet/Reader/Slk.php b/src/PhpSpreadsheet/Reader/Slk.php index 278abd58..f40eba74 100644 --- a/src/PhpSpreadsheet/Reader/Slk.php +++ b/src/PhpSpreadsheet/Reader/Slk.php @@ -190,7 +190,6 @@ class Slk extends BaseReader * Loads PhpSpreadsheet from file into PhpSpreadsheet instance. * * @param string $pFilename - * @param Spreadsheet $spreadsheet * * @return Spreadsheet */ diff --git a/src/PhpSpreadsheet/Reader/Xls.php b/src/PhpSpreadsheet/Reader/Xls.php index ec5879a9..b206f8ac 100644 --- a/src/PhpSpreadsheet/Reader/Xls.php +++ b/src/PhpSpreadsheet/Reader/Xls.php @@ -1248,10 +1248,10 @@ class Xls extends BaseReader [$firstColumn, $firstRow] = Coordinate::coordinateFromString($coordinateStrings[0]); [$lastColumn, $lastRow] = Coordinate::coordinateFromString($coordinateStrings[1]); - if ($firstColumn == 'A' and $lastColumn == 'IV') { + if ($firstColumn == 'A' && $lastColumn == 'IV') { // then we have repeating rows $docSheet->getPageSetup()->setRowsToRepeatAtTop([$firstRow, $lastRow]); - } elseif ($firstRow == 1 and $lastRow == 65536) { + } elseif ($firstRow == 1 && $lastRow == 65536) { // then we have repeating columns $docSheet->getPageSetup()->setColumnsToRepeatAtLeft([$firstColumn, $lastColumn]); } @@ -1348,7 +1348,7 @@ class Xls extends BaseReader * * @param string $pFilename */ - private function loadOLE($pFilename) + private function loadOLE($pFilename): void { // OLE reader $ole = new OLERead(); @@ -1365,7 +1365,7 @@ class Xls extends BaseReader /** * Read summary information. */ - private function readSummaryInformation() + private function readSummaryInformation(): void { if (!isset($this->summaryInformation)) { return; @@ -1512,7 +1512,7 @@ class Xls extends BaseReader /** * Read additional document summary information. */ - private function readDocumentSummaryInformation() + private function readDocumentSummaryInformation(): void { if (!isset($this->documentSummaryInformation)) { return; @@ -1650,7 +1650,7 @@ class Xls extends BaseReader /** * Reads a general type of BIFF record. Does nothing except for moving stream pointer forward to next record. */ - private function readDefault() + private function readDefault(): void { $length = self::getUInt2d($this->data, $this->pos + 2); @@ -1662,7 +1662,7 @@ class Xls extends BaseReader * The NOTE record specifies a comment associated with a particular cell. In Excel 95 (BIFF7) and earlier versions, * this record stores a note (cell note). This feature was significantly enhanced in Excel 97. */ - private function readNote() + private function readNote(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -1715,7 +1715,7 @@ class Xls extends BaseReader /** * The TEXT Object record contains the text associated with a cell annotation. */ - private function readTextObject() + private function readTextObject(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -1762,7 +1762,7 @@ class Xls extends BaseReader /** * Read BOF. */ - private function readBof() + private function readBof(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = substr($this->data, $this->pos + 4, $length); @@ -1813,7 +1813,7 @@ class Xls extends BaseReader * are based on the source of Spreadsheet-ParseExcel: * https://metacpan.org/release/Spreadsheet-ParseExcel */ - private function readFilepass() + private function readFilepass(): void { $length = self::getUInt2d($this->data, $this->pos + 2); @@ -1963,7 +1963,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readCodepage() + private function readCodepage(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -1989,7 +1989,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readDateMode() + private function readDateMode(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -2007,7 +2007,7 @@ class Xls extends BaseReader /** * Read a FONT record. */ - private function readFont() + private function readFont(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -2115,7 +2115,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readFormat() + private function readFormat(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -2152,7 +2152,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readXf() + private function readXf(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -2449,7 +2449,7 @@ class Xls extends BaseReader } } - private function readXfExt() + private function readXfExt(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -2498,7 +2498,7 @@ class Xls extends BaseReader if (isset($this->mapCellXfIndex[$ixfe])) { $fill = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFill(); $fill->getStartColor()->setRGB($rgb); - unset($fill->startcolorIndex); // normal color index does not apply, discard + $fill->startcolorIndex = null; // normal color index does not apply, discard } } @@ -2514,7 +2514,7 @@ class Xls extends BaseReader if (isset($this->mapCellXfIndex[$ixfe])) { $fill = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFill(); $fill->getEndColor()->setRGB($rgb); - unset($fill->endcolorIndex); // normal color index does not apply, discard + $fill->endcolorIndex = null; // normal color index does not apply, discard } } @@ -2530,7 +2530,7 @@ class Xls extends BaseReader if (isset($this->mapCellXfIndex[$ixfe])) { $top = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getTop(); $top->getColor()->setRGB($rgb); - unset($top->colorIndex); // normal color index does not apply, discard + $top->colorIndex = null; // normal color index does not apply, discard } } @@ -2546,7 +2546,7 @@ class Xls extends BaseReader if (isset($this->mapCellXfIndex[$ixfe])) { $bottom = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getBottom(); $bottom->getColor()->setRGB($rgb); - unset($bottom->colorIndex); // normal color index does not apply, discard + $bottom->colorIndex = null; // normal color index does not apply, discard } } @@ -2562,7 +2562,7 @@ class Xls extends BaseReader if (isset($this->mapCellXfIndex[$ixfe])) { $left = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getLeft(); $left->getColor()->setRGB($rgb); - unset($left->colorIndex); // normal color index does not apply, discard + $left->colorIndex = null; // normal color index does not apply, discard } } @@ -2578,7 +2578,7 @@ class Xls extends BaseReader if (isset($this->mapCellXfIndex[$ixfe])) { $right = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getRight(); $right->getColor()->setRGB($rgb); - unset($right->colorIndex); // normal color index does not apply, discard + $right->colorIndex = null; // normal color index does not apply, discard } } @@ -2594,7 +2594,7 @@ class Xls extends BaseReader if (isset($this->mapCellXfIndex[$ixfe])) { $diagonal = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getDiagonal(); $diagonal->getColor()->setRGB($rgb); - unset($diagonal->colorIndex); // normal color index does not apply, discard + $diagonal->colorIndex = null; // normal color index does not apply, discard } } @@ -2610,7 +2610,7 @@ class Xls extends BaseReader if (isset($this->mapCellXfIndex[$ixfe])) { $font = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFont(); $font->getColor()->setRGB($rgb); - unset($font->colorIndex); // normal color index does not apply, discard + $font->colorIndex = null; // normal color index does not apply, discard } } @@ -2625,7 +2625,7 @@ class Xls extends BaseReader /** * Read STYLE record. */ - private function readStyle() + private function readStyle(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -2662,7 +2662,7 @@ class Xls extends BaseReader /** * Read PALETTE record. */ - private function readPalette() + private function readPalette(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -2694,7 +2694,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readSheet() + private function readSheet(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -2749,7 +2749,7 @@ class Xls extends BaseReader /** * Read EXTERNALBOOK record. */ - private function readExternalBook() + private function readExternalBook(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -2811,7 +2811,7 @@ class Xls extends BaseReader /** * Read EXTERNNAME record. */ - private function readExternName() + private function readExternName(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -2845,7 +2845,7 @@ class Xls extends BaseReader /** * Read EXTERNSHEET record. */ - private function readExternSheet() + private function readExternSheet(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -2881,7 +2881,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readDefinedName() + private function readDefinedName(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -2935,7 +2935,7 @@ class Xls extends BaseReader /** * Read MSODRAWINGGROUP record. */ - private function readMsoDrawingGroup() + private function readMsoDrawingGroup(): void { $length = self::getUInt2d($this->data, $this->pos + 2); @@ -2957,7 +2957,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readSst() + private function readSst(): void { // offset within (spliced) record data $pos = 0; @@ -3138,7 +3138,7 @@ class Xls extends BaseReader /** * Read PRINTGRIDLINES record. */ - private function readPrintGridlines() + private function readPrintGridlines(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3156,7 +3156,7 @@ class Xls extends BaseReader /** * Read DEFAULTROWHEIGHT record. */ - private function readDefaultRowHeight() + private function readDefaultRowHeight(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3173,7 +3173,7 @@ class Xls extends BaseReader /** * Read SHEETPR record. */ - private function readSheetPr() + private function readSheetPr(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3199,7 +3199,7 @@ class Xls extends BaseReader /** * Read HORIZONTALPAGEBREAKS record. */ - private function readHorizontalPageBreaks() + private function readHorizontalPageBreaks(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3226,7 +3226,7 @@ class Xls extends BaseReader /** * Read VERTICALPAGEBREAKS record. */ - private function readVerticalPageBreaks() + private function readVerticalPageBreaks(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3253,7 +3253,7 @@ class Xls extends BaseReader /** * Read HEADER record. */ - private function readHeader() + private function readHeader(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3280,7 +3280,7 @@ class Xls extends BaseReader /** * Read FOOTER record. */ - private function readFooter() + private function readFooter(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3306,7 +3306,7 @@ class Xls extends BaseReader /** * Read HCENTER record. */ - private function readHcenter() + private function readHcenter(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3325,7 +3325,7 @@ class Xls extends BaseReader /** * Read VCENTER record. */ - private function readVcenter() + private function readVcenter(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3344,7 +3344,7 @@ class Xls extends BaseReader /** * Read LEFTMARGIN record. */ - private function readLeftMargin() + private function readLeftMargin(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3361,7 +3361,7 @@ class Xls extends BaseReader /** * Read RIGHTMARGIN record. */ - private function readRightMargin() + private function readRightMargin(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3378,7 +3378,7 @@ class Xls extends BaseReader /** * Read TOPMARGIN record. */ - private function readTopMargin() + private function readTopMargin(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3395,7 +3395,7 @@ class Xls extends BaseReader /** * Read BOTTOMMARGIN record. */ - private function readBottomMargin() + private function readBottomMargin(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3412,7 +3412,7 @@ class Xls extends BaseReader /** * Read PAGESETUP record. */ - private function readPageSetup() + private function readPageSetup(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3475,7 +3475,7 @@ class Xls extends BaseReader * PROTECT - Sheet protection (BIFF2 through BIFF8) * if this record is omitted, then it also means no sheet protection. */ - private function readProtect() + private function readProtect(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3497,7 +3497,7 @@ class Xls extends BaseReader /** * SCENPROTECT. */ - private function readScenProtect() + private function readScenProtect(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3520,7 +3520,7 @@ class Xls extends BaseReader /** * OBJECTPROTECT. */ - private function readObjectProtect() + private function readObjectProtect(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3543,7 +3543,7 @@ class Xls extends BaseReader /** * PASSWORD - Sheet protection (hashed) password (BIFF2 through BIFF8). */ - private function readPassword() + private function readPassword(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3561,7 +3561,7 @@ class Xls extends BaseReader /** * Read DEFCOLWIDTH record. */ - private function readDefColWidth() + private function readDefColWidth(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3579,7 +3579,7 @@ class Xls extends BaseReader /** * Read COLINFO record. */ - private function readColInfo() + private function readColInfo(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3637,7 +3637,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readRow() + private function readRow(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3706,7 +3706,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readRk() + private function readRk(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3750,7 +3750,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readLabelSst() + private function readLabelSst(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3834,7 +3834,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readMulRk() + private function readMulRk(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3887,7 +3887,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readNumber() + private function readNumber(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -3928,7 +3928,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readFormula() + private function readFormula(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4054,7 +4054,7 @@ class Xls extends BaseReader * which usually contains relative references. * These will be used to construct the formula in each shared formula part after the sheet is read. */ - private function readSharedFmla() + private function readSharedFmla(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4112,7 +4112,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readBoolErr() + private function readBoolErr(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4171,7 +4171,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readMulBlank() + private function readMulBlank(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4212,7 +4212,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readLabel() + private function readLabel(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4256,7 +4256,7 @@ class Xls extends BaseReader /** * Read BLANK record. */ - private function readBlank() + private function readBlank(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4286,7 +4286,7 @@ class Xls extends BaseReader /** * Read MSODRAWING record. */ - private function readMsoDrawing() + private function readMsoDrawing(): void { $length = self::getUInt2d($this->data, $this->pos + 2); @@ -4300,7 +4300,7 @@ class Xls extends BaseReader /** * Read OBJ record. */ - private function readObj() + private function readObj(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4340,7 +4340,7 @@ class Xls extends BaseReader /** * Read WINDOW2 record. */ - private function readWindow2() + private function readWindow2(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4411,7 +4411,7 @@ class Xls extends BaseReader /** * Read PLV Record(Created by Excel2007 or upper). */ - private function readPageLayoutView() + private function readPageLayoutView(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4448,7 +4448,7 @@ class Xls extends BaseReader /** * Read SCL record. */ - private function readScl() + private function readScl(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4469,7 +4469,7 @@ class Xls extends BaseReader /** * Read PANE record. */ - private function readPane() + private function readPane(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4503,7 +4503,7 @@ class Xls extends BaseReader /** * Read SELECTION record. There is one such record for each pane in the sheet. */ - private function readSelection() + private function readSelection(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4580,7 +4580,7 @@ class Xls extends BaseReader * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function readMergedCells() + private function readMergedCells(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4602,7 +4602,7 @@ class Xls extends BaseReader /** * Read HYPERLINK record. */ - private function readHyperLink() + private function readHyperLink(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4775,7 +4775,7 @@ class Xls extends BaseReader /** * Read DATAVALIDATIONS record. */ - private function readDataValidations() + private function readDataValidations(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4787,7 +4787,7 @@ class Xls extends BaseReader /** * Read DATAVALIDATION record. */ - private function readDataValidation() + private function readDataValidation(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -4997,7 +4997,7 @@ class Xls extends BaseReader /** * Read SHEETLAYOUT record. Stores sheet tab color information. */ - private function readSheetLayout() + private function readSheetLayout(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -5037,7 +5037,7 @@ class Xls extends BaseReader /** * Read SHEETPROTECTION record (FEATHEADR). */ - private function readSheetProtection() + private function readSheetProtection(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -5137,7 +5137,7 @@ class Xls extends BaseReader * Reading of this record is based on Microsoft Office Excel 97-2000 Binary File Format Specification, * where it is referred to as FEAT record. */ - private function readRangeProtection() + private function readRangeProtection(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -5199,7 +5199,7 @@ class Xls extends BaseReader * When MSODRAWING data on a sheet exceeds 8224 bytes, CONTINUE records are used instead. Undocumented. * In this case, we must treat the CONTINUE record as a MSODRAWING record. */ - private function readContinue() + private function readContinue(): void { $length = self::getUInt2d($this->data, $this->pos + 2); $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); @@ -5319,7 +5319,7 @@ class Xls extends BaseReader // start parsing the formula data $tokens = []; - while (strlen($formulaData) > 0 and $token = $this->getNextToken($formulaData, $baseCell)) { + while (strlen($formulaData) > 0 && $token = $this->getNextToken($formulaData, $baseCell)) { $tokens[] = $token; $formulaData = substr($formulaData, $token['size']); } @@ -7203,7 +7203,7 @@ class Xls extends BaseReader $fc = Coordinate::stringFromColumnIndex($fc + 1); $lc = Coordinate::stringFromColumnIndex($lc + 1); - if ($fr == $lr and $fc == $lc) { + if ($fr == $lr && $fc == $lc) { return "$fc$fr"; } @@ -7242,7 +7242,7 @@ class Xls extends BaseReader $fc = Coordinate::stringFromColumnIndex($fc + 1); $lc = Coordinate::stringFromColumnIndex($lc + 1); - if ($fr == $lr and $fc == $lc) { + if ($fr == $lr && $fc == $lc) { return "$fc$fr"; } @@ -7463,7 +7463,7 @@ class Xls extends BaseReader switch ($type) { case 'internal': // check if we have a deleted 3d reference - if ($this->ref[$index]['firstSheetIndex'] == 0xFFFF or $this->ref[$index]['lastSheetIndex'] == 0xFFFF) { + if ($this->ref[$index]['firstSheetIndex'] == 0xFFFF || $this->ref[$index]['lastSheetIndex'] == 0xFFFF) { throw new Exception('Deleted sheet reference'); } @@ -7688,7 +7688,7 @@ class Xls extends BaseReader $string = self::readUnicodeString(substr($subData, 1), $characterCount); // add 1 for the string length - $string['size'] += 1; + ++$string['size']; return $string; } @@ -7781,13 +7781,13 @@ class Xls extends BaseReader $mantissa = (0x100000 | ($rknumhigh & 0x000fffff)); $mantissalow1 = ($rknumlow & 0x80000000) >> 31; $mantissalow2 = ($rknumlow & 0x7fffffff); - $value = $mantissa / pow(2, (20 - $exp)); + $value = $mantissa / 2 ** (20 - $exp); if ($mantissalow1 != 0) { - $value += 1 / pow(2, (21 - $exp)); + $value += 1 / 2 ** (21 - $exp); } - $value += $mantissalow2 / pow(2, (52 - $exp)); + $value += $mantissalow2 / 2 ** (52 - $exp); if ($sign) { $value *= -1; } @@ -7813,7 +7813,7 @@ class Xls extends BaseReader $sign = ($rknum & 0x80000000) >> 31; $exp = ($rknum & 0x7ff00000) >> 20; $mantissa = (0x100000 | ($rknum & 0x000ffffc)); - $value = $mantissa / pow(2, (20 - ($exp - 1023))); + $value = $mantissa / 2 ** (20 - ($exp - 1023)); if ($sign) { $value = -1 * $value; } diff --git a/src/PhpSpreadsheet/Reader/Xls/Escher.php b/src/PhpSpreadsheet/Reader/Xls/Escher.php index 858d6bbb..306fc8f1 100644 --- a/src/PhpSpreadsheet/Reader/Xls/Escher.php +++ b/src/PhpSpreadsheet/Reader/Xls/Escher.php @@ -178,7 +178,7 @@ class Escher /** * Read a generic record. */ - private function readDefault() + private function readDefault(): void { // offset 0; size: 2; recVer and recInstance $verInstance = Xls::getUInt2d($this->data, $this->pos); @@ -199,7 +199,7 @@ class Escher /** * Read DggContainer record (Drawing Group Container). */ - private function readDggContainer() + private function readDggContainer(): void { $length = Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); @@ -217,7 +217,7 @@ class Escher /** * Read Dgg record (Drawing Group). */ - private function readDgg() + private function readDgg(): void { $length = Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); @@ -229,7 +229,7 @@ class Escher /** * Read BstoreContainer record (Blip Store Container). */ - private function readBstoreContainer() + private function readBstoreContainer(): void { $length = Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); @@ -247,7 +247,7 @@ class Escher /** * Read BSE record. */ - private function readBSE() + private function readBSE(): void { // offset: 0; size: 2; recVer and recInstance @@ -313,7 +313,7 @@ class Escher /** * Read BlipJPEG record. Holds raw JPEG image data. */ - private function readBlipJPEG() + private function readBlipJPEG(): void { // offset: 0; size: 2; recVer and recInstance @@ -340,7 +340,7 @@ class Escher // offset: var; size: 1; tag $tag = ord($recordData[$pos]); - $pos += 1; + ++$pos; // offset: var; size: var; the raw image data $data = substr($recordData, $pos); @@ -354,7 +354,7 @@ class Escher /** * Read BlipPNG record. Holds raw PNG image data. */ - private function readBlipPNG() + private function readBlipPNG(): void { // offset: 0; size: 2; recVer and recInstance @@ -381,7 +381,7 @@ class Escher // offset: var; size: 1; tag $tag = ord($recordData[$pos]); - $pos += 1; + ++$pos; // offset: var; size: var; the raw image data $data = substr($recordData, $pos); @@ -395,7 +395,7 @@ class Escher /** * Read OPT record. This record may occur within DggContainer record or SpContainer. */ - private function readOPT() + private function readOPT(): void { // offset: 0; size: 2; recVer and recInstance @@ -414,7 +414,7 @@ class Escher /** * Read TertiaryOPT record. */ - private function readTertiaryOPT() + private function readTertiaryOPT(): void { // offset: 0; size: 2; recVer and recInstance @@ -431,7 +431,7 @@ class Escher /** * Read SplitMenuColors record. */ - private function readSplitMenuColors() + private function readSplitMenuColors(): void { $length = Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); @@ -443,7 +443,7 @@ class Escher /** * Read DgContainer record (Drawing Container). */ - private function readDgContainer() + private function readDgContainer(): void { $length = Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); @@ -461,7 +461,7 @@ class Escher /** * Read Dg record (Drawing). */ - private function readDg() + private function readDg(): void { $length = Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); @@ -473,7 +473,7 @@ class Escher /** * Read SpgrContainer record (Shape Group Container). */ - private function readSpgrContainer() + private function readSpgrContainer(): void { // context is either context DgContainer or SpgrContainer @@ -501,7 +501,7 @@ class Escher /** * Read SpContainer record (Shape Container). */ - private function readSpContainer() + private function readSpContainer(): void { $length = Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); @@ -521,7 +521,7 @@ class Escher /** * Read Spgr record (Shape Group). */ - private function readSpgr() + private function readSpgr(): void { $length = Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); @@ -533,7 +533,7 @@ class Escher /** * Read Sp record (Shape). */ - private function readSp() + private function readSp(): void { // offset: 0; size: 2; recVer and recInstance @@ -550,7 +550,7 @@ class Escher /** * Read ClientTextbox record. */ - private function readClientTextbox() + private function readClientTextbox(): void { // offset: 0; size: 2; recVer and recInstance @@ -567,7 +567,7 @@ class Escher /** * Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet. */ - private function readClientAnchor() + private function readClientAnchor(): void { $length = Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); @@ -621,7 +621,7 @@ class Escher /** * Read ClientData record. */ - private function readClientData() + private function readClientData(): void { $length = Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); @@ -636,7 +636,7 @@ class Escher * @param string $data Binary data * @param int $n Number of properties */ - private function readOfficeArtRGFOPTE($data, $n) + private function readOfficeArtRGFOPTE($data, $n): void { $splicedComplexData = substr($data, 6 * $n); diff --git a/src/PhpSpreadsheet/Reader/Xls/MD5.php b/src/PhpSpreadsheet/Reader/Xls/MD5.php index 6a10e591..c0417ba6 100644 --- a/src/PhpSpreadsheet/Reader/Xls/MD5.php +++ b/src/PhpSpreadsheet/Reader/Xls/MD5.php @@ -24,7 +24,7 @@ class MD5 /** * Reset the MD5 stream context. */ - public function reset() + public function reset(): void { $this->a = 0x67452301; $this->b = 0xEFCDAB89; @@ -56,7 +56,7 @@ class MD5 * * @param string $data Data to add */ - public function add($data) + public function add($data): void { $words = array_values(unpack('V16', $data)); @@ -168,7 +168,7 @@ class MD5 return $Y ^ ($X | (~$Z)); // Y XOR (X OR NOT Z) } - private static function step($func, &$A, $B, $C, $D, $M, $s, $t) + private static function step($func, &$A, $B, $C, $D, $M, $s, $t): void { $A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff; $A = self::rotate($A, $s); diff --git a/src/PhpSpreadsheet/Reader/Xlsx.php b/src/PhpSpreadsheet/Reader/Xlsx.php index 40814c64..77035a39 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/src/PhpSpreadsheet/Reader/Xlsx.php @@ -35,6 +35,8 @@ use PhpOffice\PhpSpreadsheet\Style\Style; use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use SimpleXMLElement; +use stdClass; +use Throwable; use XMLReader; use ZipArchive; @@ -256,7 +258,7 @@ class Xlsx extends BaseReader return isset($c->v) ? (string) $c->v : null; } - private function castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType) + private function castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType): void { $cellDataType = 'f'; $value = "={$c->f}"; @@ -282,7 +284,6 @@ class Xlsx extends BaseReader } /** - * @param ZipArchive $archive * @param string $fileName * * @return string @@ -658,7 +659,7 @@ class Xlsx extends BaseReader $coordinates = Coordinate::coordinateFromString($r); if (!$this->getReadFilter()->readCell($coordinates[0], (int) $coordinates[1], $docSheet->getTitle())) { - $rowIndex += 1; + ++$rowIndex; continue; } @@ -744,9 +745,9 @@ class Xlsx extends BaseReader (int) ($c['s']) : 0); } } - $rowIndex += 1; + ++$rowIndex; } - $cIndex += 1; + ++$cIndex; } } @@ -891,7 +892,7 @@ class Xlsx extends BaseReader Settings::getLibXmlLoaderOptions() ); $vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); - } catch (\Throwable $ex) { + } catch (Throwable $ex) { //Ignore unparsable vmlDrawings. Later they will be moved from $unparsedVmlDrawings to $unparsedLoadedData continue; } @@ -1115,7 +1116,7 @@ class Xlsx extends BaseReader $xfrm = $oneCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->xfrm; /** @var SimpleXMLElement $outerShdw */ $outerShdw = $oneCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->effectLst->outerShdw; - /** @var \SimpleXMLElement $hlinkClick */ + /** @var SimpleXMLElement $hlinkClick */ $hlinkClick = $oneCellAnchor->pic->nvPicPr->cNvPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->hlinkClick; $objDrawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing(); @@ -1556,10 +1557,9 @@ class Xlsx extends BaseReader } /** - * @param Style $docStyle - * @param SimpleXMLElement|\stdClass $style + * @param SimpleXMLElement|stdClass $style */ - private static function readStyle(Style $docStyle, $style) + private static function readStyle(Style $docStyle, $style): void { $docStyle->getNumberFormat()->setFormatCode($style->numFmt); @@ -1684,10 +1684,9 @@ class Xlsx extends BaseReader } /** - * @param Border $docBorder * @param SimpleXMLElement $eleBorder */ - private static function readBorder(Border $docBorder, $eleBorder) + private static function readBorder(Border $docBorder, $eleBorder): void { if (isset($eleBorder['style'])) { $docBorder->setBorderStyle((string) $eleBorder['style']); @@ -1760,11 +1759,10 @@ class Xlsx extends BaseReader } /** - * @param Spreadsheet $excel * @param mixed $customUITarget * @param mixed $zip */ - private function readRibbon(Spreadsheet $excel, $customUITarget, $zip) + private function readRibbon(Spreadsheet $excel, $customUITarget, $zip): void { $baseDir = dirname($customUITarget); $nameCustomUI = basename($customUITarget); @@ -1866,10 +1864,10 @@ class Xlsx extends BaseReader /** * @param \PhpOffice\PhpSpreadsheet\Worksheet\Drawing $objDrawing - * @param \SimpleXMLElement $cellAnchor + * @param SimpleXMLElement $cellAnchor * @param array $hyperlinks */ - private function readHyperLinkDrawing($objDrawing, $cellAnchor, $hyperlinks) + private function readHyperLinkDrawing($objDrawing, $cellAnchor, $hyperlinks): void { $hlinkClick = $cellAnchor->pic->nvPicPr->cNvPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->hlinkClick; @@ -1885,7 +1883,7 @@ class Xlsx extends BaseReader $objDrawing->setHyperlink($hyperlink); } - private function readProtection(Spreadsheet $excel, SimpleXMLElement $xmlWorkbook) + private function readProtection(Spreadsheet $excel, SimpleXMLElement $xmlWorkbook): void { if (!$xmlWorkbook->workbookProtection) { return; @@ -1912,7 +1910,7 @@ class Xlsx extends BaseReader } } - private function readFormControlProperties(Spreadsheet $excel, ZipArchive $zip, $dir, $fileWorksheet, $docSheet, array &$unparsedLoadedData) + private function readFormControlProperties(Spreadsheet $excel, ZipArchive $zip, $dir, $fileWorksheet, $docSheet, array &$unparsedLoadedData): void { if (!$zip->locateName(dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels')) { return; @@ -1944,7 +1942,7 @@ class Xlsx extends BaseReader unset($unparsedCtrlProps); } - private function readPrinterSettings(Spreadsheet $excel, ZipArchive $zip, $dir, $fileWorksheet, $docSheet, array &$unparsedLoadedData) + private function readPrinterSettings(Spreadsheet $excel, ZipArchive $zip, $dir, $fileWorksheet, $docSheet, array &$unparsedLoadedData): void { if (!$zip->locateName(dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels')) { return; diff --git a/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php b/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php index 69d5f69e..f52bfd41 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php @@ -5,6 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column; use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; +use SimpleXMLElement; class AutoFilter { @@ -12,13 +13,13 @@ class AutoFilter private $worksheetXml; - public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml) + public function __construct(Worksheet $workSheet, SimpleXMLElement $worksheetXml) { $this->worksheet = $workSheet; $this->worksheetXml = $worksheetXml; } - public function load() + public function load(): void { // Remove all "$" in the auto filter range $autoFilterRange = preg_replace('/\$/', '', $this->worksheetXml->autoFilter['ref']); @@ -27,7 +28,7 @@ class AutoFilter } } - private function readAutoFilter($autoFilterRange, $xmlSheet) + private function readAutoFilter($autoFilterRange, $xmlSheet): void { $autoFilter = $this->worksheet->getAutoFilter(); $autoFilter->setRange($autoFilterRange); @@ -62,7 +63,7 @@ class AutoFilter } } - private function readDateRangeAutoFilter(\SimpleXMLElement $filters, Column $column) + private function readDateRangeAutoFilter(SimpleXMLElement $filters, Column $column): void { foreach ($filters->dateGroupItem as $dateGroupItem) { // Operator is undefined, but always treated as EQUAL @@ -81,7 +82,7 @@ class AutoFilter } } - private function readCustomAutoFilter(\SimpleXMLElement $filterColumn, Column $column) + private function readCustomAutoFilter(SimpleXMLElement $filterColumn, Column $column): void { if ($filterColumn->customFilters) { $column->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER); @@ -100,7 +101,7 @@ class AutoFilter } } - private function readDynamicAutoFilter(\SimpleXMLElement $filterColumn, Column $column) + private function readDynamicAutoFilter(SimpleXMLElement $filterColumn, Column $column): void { if ($filterColumn->dynamicFilter) { $column->setFilterType(Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER); @@ -122,7 +123,7 @@ class AutoFilter } } - private function readTopTenAutoFilter(\SimpleXMLElement $filterColumn, Column $column) + private function readTopTenAutoFilter(SimpleXMLElement $filterColumn, Column $column): void { if ($filterColumn->top10) { $column->setFilterType(Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER); diff --git a/src/PhpSpreadsheet/Reader/Xlsx/Chart.php b/src/PhpSpreadsheet/Reader/Xlsx/Chart.php index 2b920d70..c9a230c2 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/Chart.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/Chart.php @@ -17,7 +17,6 @@ use SimpleXMLElement; class Chart { /** - * @param SimpleXMLElement $component * @param string $name * @param string $format * @@ -51,7 +50,6 @@ class Chart } /** - * @param SimpleXMLElement $chartElements * @param string $chartName * * @return \PhpOffice\PhpSpreadsheet\Chart\Chart @@ -529,10 +527,9 @@ class Chart } /** - * @param Layout $plotArea * @param mixed $plotAttributes */ - private static function setChartAttributes(Layout $plotArea, $plotAttributes) + private static function setChartAttributes(Layout $plotArea, $plotAttributes): void { foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) { switch ($plotAttributeKey) { diff --git a/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php b/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php index e901d990..339c0584 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php @@ -5,6 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Reader\IReadFilter; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; +use SimpleXMLElement; class ColumnAndRowAttributes extends BaseParserClass { @@ -12,7 +13,7 @@ class ColumnAndRowAttributes extends BaseParserClass private $worksheetXml; - public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml = null) + public function __construct(Worksheet $workSheet, ?SimpleXMLElement $worksheetXml = null) { $this->worksheet = $workSheet; $this->worksheetXml = $worksheetXml; @@ -25,7 +26,7 @@ class ColumnAndRowAttributes extends BaseParserClass * @param array $columnAttributes array of attributes (indexes are attribute name, values are value) * 'xfIndex', 'visible', 'collapsed', 'outlineLevel', 'width', ... ? */ - private function setColumnAttributes($columnAddress, array $columnAttributes) + private function setColumnAttributes($columnAddress, array $columnAttributes): void { if (isset($columnAttributes['xfIndex'])) { $this->worksheet->getColumnDimension($columnAddress)->setXfIndex($columnAttributes['xfIndex']); @@ -51,7 +52,7 @@ class ColumnAndRowAttributes extends BaseParserClass * @param array $rowAttributes array of attributes (indexes are attribute name, values are value) * 'xfIndex', 'visible', 'collapsed', 'outlineLevel', 'rowHeight', ... ? */ - private function setRowAttributes($rowNumber, array $rowAttributes) + private function setRowAttributes($rowNumber, array $rowAttributes): void { if (isset($rowAttributes['xfIndex'])) { $this->worksheet->getRowDimension($rowNumber)->setXfIndex($rowAttributes['xfIndex']); @@ -74,7 +75,7 @@ class ColumnAndRowAttributes extends BaseParserClass * @param IReadFilter $readFilter * @param bool $readDataOnly */ - public function load(IReadFilter $readFilter = null, $readDataOnly = false) + public function load(?IReadFilter $readFilter = null, $readDataOnly = false): void { if ($this->worksheetXml === null) { return; @@ -125,7 +126,7 @@ class ColumnAndRowAttributes extends BaseParserClass return false; } - private function readColumnAttributes(\SimpleXMLElement $worksheetCols, $readDataOnly) + private function readColumnAttributes(SimpleXMLElement $worksheetCols, $readDataOnly) { $columnAttributes = []; @@ -145,7 +146,7 @@ class ColumnAndRowAttributes extends BaseParserClass return $columnAttributes; } - private function readColumnRangeAttributes(\SimpleXMLElement $column, $readDataOnly) + private function readColumnRangeAttributes(SimpleXMLElement $column, $readDataOnly) { $columnAttributes = []; @@ -177,7 +178,7 @@ class ColumnAndRowAttributes extends BaseParserClass return false; } - private function readRowAttributes(\SimpleXMLElement $worksheetRow, $readDataOnly) + private function readRowAttributes(SimpleXMLElement $worksheetRow, $readDataOnly) { $rowAttributes = []; diff --git a/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php b/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php index 722b7795..668bfd18 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php @@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PhpOffice\PhpSpreadsheet\Style\Conditional; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; +use SimpleXMLElement; class ConditionalStyles { @@ -13,14 +14,14 @@ class ConditionalStyles private $dxfs; - public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml, array $dxfs = []) + public function __construct(Worksheet $workSheet, SimpleXMLElement $worksheetXml, array $dxfs = []) { $this->worksheet = $workSheet; $this->worksheetXml = $worksheetXml; $this->dxfs = $dxfs; } - public function load() + public function load(): void { $this->setConditionalStyles( $this->worksheet, @@ -48,7 +49,7 @@ class ConditionalStyles return $conditionals; } - private function setConditionalStyles(Worksheet $worksheet, array $conditionals) + private function setConditionalStyles(Worksheet $worksheet, array $conditionals): void { foreach ($conditionals as $ref => $cfRules) { ksort($cfRules); diff --git a/src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php b/src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php index 4bb44129..41a8c9fb 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php @@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; +use SimpleXMLElement; class DataValidations { @@ -11,13 +12,13 @@ class DataValidations private $worksheetXml; - public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml) + public function __construct(Worksheet $workSheet, SimpleXMLElement $worksheetXml) { $this->worksheet = $workSheet; $this->worksheetXml = $worksheetXml; } - public function load() + public function load(): void { foreach ($this->worksheetXml->dataValidations->dataValidation as $dataValidation) { // Uppercase coordinate diff --git a/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php b/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php index 400b2725..9e6aeaf7 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php @@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; +use SimpleXMLElement; class Hyperlinks { @@ -16,7 +17,7 @@ class Hyperlinks $this->worksheet = $workSheet; } - public function readHyperlinks(\SimpleXMLElement $relsWorksheet) + public function readHyperlinks(SimpleXMLElement $relsWorksheet): void { foreach ($relsWorksheet->Relationship as $element) { if ($element['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink') { @@ -25,14 +26,14 @@ class Hyperlinks } } - public function setHyperlinks(\SimpleXMLElement $worksheetXml) + public function setHyperlinks(SimpleXMLElement $worksheetXml): void { foreach ($worksheetXml->hyperlink as $hyperlink) { $this->setHyperlink($hyperlink, $this->worksheet); } } - private function setHyperlink(\SimpleXMLElement $hyperlink, Worksheet $worksheet) + private function setHyperlink(SimpleXMLElement $hyperlink, Worksheet $worksheet): void { // Link url $linkRel = $hyperlink->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'); diff --git a/src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php b/src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php index 6f286769..bfb7a1f5 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php @@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; +use SimpleXMLElement; class PageSetup extends BaseParserClass { @@ -11,7 +12,7 @@ class PageSetup extends BaseParserClass private $worksheetXml; - public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml = null) + public function __construct(Worksheet $workSheet, ?SimpleXMLElement $worksheetXml = null) { $this->worksheet = $workSheet; $this->worksheetXml = $worksheetXml; @@ -31,7 +32,7 @@ class PageSetup extends BaseParserClass return $unparsedLoadedData; } - private function margins(\SimpleXMLElement $xmlSheet, Worksheet $worksheet) + private function margins(SimpleXMLElement $xmlSheet, Worksheet $worksheet): void { if ($xmlSheet->pageMargins) { $docPageMargins = $worksheet->getPageMargins(); @@ -44,7 +45,7 @@ class PageSetup extends BaseParserClass } } - private function pageSetup(\SimpleXMLElement $xmlSheet, Worksheet $worksheet, array $unparsedLoadedData) + private function pageSetup(SimpleXMLElement $xmlSheet, Worksheet $worksheet, array $unparsedLoadedData) { if ($xmlSheet->pageSetup) { $docPageSetup = $worksheet->getPageSetup(); @@ -78,7 +79,7 @@ class PageSetup extends BaseParserClass return $unparsedLoadedData; } - private function headerFooter(\SimpleXMLElement $xmlSheet, Worksheet $worksheet) + private function headerFooter(SimpleXMLElement $xmlSheet, Worksheet $worksheet): void { if ($xmlSheet->headerFooter) { $docHeaderFooter = $worksheet->getHeaderFooter(); @@ -117,7 +118,7 @@ class PageSetup extends BaseParserClass } } - private function pageBreaks(\SimpleXMLElement $xmlSheet, Worksheet $worksheet) + private function pageBreaks(SimpleXMLElement $xmlSheet, Worksheet $worksheet): void { if ($xmlSheet->rowBreaks && $xmlSheet->rowBreaks->brk) { $this->rowBreaks($xmlSheet, $worksheet); @@ -127,7 +128,7 @@ class PageSetup extends BaseParserClass } } - private function rowBreaks(\SimpleXMLElement $xmlSheet, Worksheet $worksheet) + private function rowBreaks(SimpleXMLElement $xmlSheet, Worksheet $worksheet): void { foreach ($xmlSheet->rowBreaks->brk as $brk) { if ($brk['man']) { @@ -136,7 +137,7 @@ class PageSetup extends BaseParserClass } } - private function columnBreaks(\SimpleXMLElement $xmlSheet, Worksheet $worksheet) + private function columnBreaks(SimpleXMLElement $xmlSheet, Worksheet $worksheet): void { foreach ($xmlSheet->colBreaks->brk as $brk) { if ($brk['man']) { diff --git a/src/PhpSpreadsheet/Reader/Xlsx/Properties.php b/src/PhpSpreadsheet/Reader/Xlsx/Properties.php index bf8e57d8..b6f3c61f 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/Properties.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/Properties.php @@ -5,6 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PhpOffice\PhpSpreadsheet\Document\Properties as DocumentProperties; use PhpOffice\PhpSpreadsheet\Reader\Security\XmlScanner; use PhpOffice\PhpSpreadsheet\Settings; +use SimpleXMLElement; class Properties { @@ -27,7 +28,7 @@ class Properties ); } - public function readCoreProperties($propertyData) + public function readCoreProperties($propertyData): void { $xmlCore = $this->extractPropertyData($propertyData); @@ -48,7 +49,7 @@ class Properties } } - public function readExtendedProperties($propertyData) + public function readExtendedProperties($propertyData): void { $xmlCore = $this->extractPropertyData($propertyData); @@ -62,13 +63,13 @@ class Properties } } - public function readCustomProperties($propertyData) + public function readCustomProperties($propertyData): void { $xmlCore = $this->extractPropertyData($propertyData); if (is_object($xmlCore)) { foreach ($xmlCore as $xmlProperty) { - /** @var \SimpleXMLElement $xmlProperty */ + /** @var SimpleXMLElement $xmlProperty */ $cellDataOfficeAttributes = $xmlProperty->attributes(); if (isset($cellDataOfficeAttributes['name'])) { $propertyName = (string) $cellDataOfficeAttributes['name']; diff --git a/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php b/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php index eb61a5d3..b3bee899 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php @@ -3,6 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; +use SimpleXMLElement; class SheetViewOptions extends BaseParserClass { @@ -10,7 +11,7 @@ class SheetViewOptions extends BaseParserClass private $worksheetXml; - public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml = null) + public function __construct(Worksheet $workSheet, ?SimpleXMLElement $worksheetXml = null) { $this->worksheet = $workSheet; $this->worksheetXml = $worksheetXml; @@ -19,7 +20,7 @@ class SheetViewOptions extends BaseParserClass /** * @param bool $readDataOnly */ - public function load($readDataOnly = false) + public function load($readDataOnly = false): void { if ($this->worksheetXml === null) { return; @@ -41,21 +42,21 @@ class SheetViewOptions extends BaseParserClass } } - private function tabColor(\SimpleXMLElement $sheetPr) + private function tabColor(SimpleXMLElement $sheetPr): void { if (isset($sheetPr->tabColor, $sheetPr->tabColor['rgb'])) { $this->worksheet->getTabColor()->setARGB((string) $sheetPr->tabColor['rgb']); } } - private function codeName(\SimpleXMLElement $sheetPr) + private function codeName(SimpleXMLElement $sheetPr): void { if (isset($sheetPr['codeName'])) { $this->worksheet->setCodeName((string) $sheetPr['codeName'], false); } } - private function outlines(\SimpleXMLElement $sheetPr) + private function outlines(SimpleXMLElement $sheetPr): void { if (isset($sheetPr->outlinePr)) { if (isset($sheetPr->outlinePr['summaryRight']) && @@ -74,7 +75,7 @@ class SheetViewOptions extends BaseParserClass } } - private function pageSetup(\SimpleXMLElement $sheetPr) + private function pageSetup(SimpleXMLElement $sheetPr): void { if (isset($sheetPr->pageSetUpPr)) { if (isset($sheetPr->pageSetUpPr['fitToPage']) && @@ -86,7 +87,7 @@ class SheetViewOptions extends BaseParserClass } } - private function sheetFormat(\SimpleXMLElement $sheetFormatPr) + private function sheetFormat(SimpleXMLElement $sheetFormatPr): void { if (isset($sheetFormatPr['customHeight']) && self::boolean((string) $sheetFormatPr['customHeight']) && @@ -106,7 +107,7 @@ class SheetViewOptions extends BaseParserClass } } - private function printOptions(\SimpleXMLElement $printOptions) + private function printOptions(SimpleXMLElement $printOptions): void { if (self::boolean((string) $printOptions['gridLinesSet'])) { $this->worksheet->setShowGridlines(true); diff --git a/src/PhpSpreadsheet/Reader/Xlsx/SheetViews.php b/src/PhpSpreadsheet/Reader/Xlsx/SheetViews.php index 88c01ead..f6c47929 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/SheetViews.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/SheetViews.php @@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; +use SimpleXMLElement; class SheetViews extends BaseParserClass { @@ -11,13 +12,13 @@ class SheetViews extends BaseParserClass private $worksheet; - public function __construct(\SimpleXMLElement $sheetViewXml, Worksheet $workSheet) + public function __construct(SimpleXMLElement $sheetViewXml, Worksheet $workSheet) { $this->sheetViewXml = $sheetViewXml; $this->worksheet = $workSheet; } - public function load() + public function load(): void { $this->zoomScale(); $this->view(); @@ -34,7 +35,7 @@ class SheetViews extends BaseParserClass } } - private function zoomScale() + private function zoomScale(): void { if (isset($this->sheetViewXml['zoomScale'])) { $zoomScale = (int) ($this->sheetViewXml['zoomScale']); @@ -59,14 +60,14 @@ class SheetViews extends BaseParserClass } } - private function view() + private function view(): void { if (isset($this->sheetViewXml['view'])) { $this->worksheet->getSheetView()->setView((string) $this->sheetViewXml['view']); } } - private function gridLines() + private function gridLines(): void { if (isset($this->sheetViewXml['showGridLines'])) { $this->worksheet->setShowGridLines( @@ -75,7 +76,7 @@ class SheetViews extends BaseParserClass } } - private function headers() + private function headers(): void { if (isset($this->sheetViewXml['showRowColHeaders'])) { $this->worksheet->setShowRowColHeaders( @@ -84,7 +85,7 @@ class SheetViews extends BaseParserClass } } - private function direction() + private function direction(): void { if (isset($this->sheetViewXml['rightToLeft'])) { $this->worksheet->setRightToLeft( @@ -93,7 +94,7 @@ class SheetViews extends BaseParserClass } } - private function showZeros() + private function showZeros(): void { if (isset($this->sheetViewXml['showZeros'])) { $this->worksheet->getSheetView()->setShowZeros( @@ -102,7 +103,7 @@ class SheetViews extends BaseParserClass } } - private function pane() + private function pane(): void { $xSplit = 0; $ySplit = 0; @@ -126,7 +127,7 @@ class SheetViews extends BaseParserClass ); } - private function selection() + private function selection(): void { $sqref = (string) $this->sheetViewXml->selection['sqref']; $sqref = explode(' ', $sqref); diff --git a/src/PhpSpreadsheet/Reader/Xlsx/Styles.php b/src/PhpSpreadsheet/Reader/Xlsx/Styles.php index 40106258..43de8787 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/Styles.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/Styles.php @@ -11,6 +11,7 @@ use PhpOffice\PhpSpreadsheet\Style\Font; use PhpOffice\PhpSpreadsheet\Style\NumberFormat; use PhpOffice\PhpSpreadsheet\Style\Protection; use PhpOffice\PhpSpreadsheet\Style\Style; +use SimpleXMLElement; class Styles extends BaseParserClass { @@ -27,19 +28,19 @@ class Styles extends BaseParserClass private $styleXml; - public function __construct(\SimpleXMLElement $styleXml) + public function __construct(SimpleXMLElement $styleXml) { $this->styleXml = $styleXml; } - public function setStyleBaseData(Theme $theme = null, $styles = [], $cellStyles = []) + public function setStyleBaseData(?Theme $theme = null, $styles = [], $cellStyles = []): void { self::$theme = $theme; $this->styles = $styles; $this->cellStyles = $cellStyles; } - private static function readFontStyle(Font $fontStyle, \SimpleXMLElement $fontStyleXml) + private static function readFontStyle(Font $fontStyle, SimpleXMLElement $fontStyleXml): void { $fontStyle->setName((string) $fontStyleXml->name['val']); $fontStyle->setSize((float) $fontStyleXml->sz['val']); @@ -72,7 +73,7 @@ class Styles extends BaseParserClass } } - private static function readNumberFormat(NumberFormat $numfmtStyle, \SimpleXMLElement $numfmtStyleXml) + private static function readNumberFormat(NumberFormat $numfmtStyle, SimpleXMLElement $numfmtStyleXml): void { if ($numfmtStyleXml->count() === 0) { return; @@ -83,10 +84,10 @@ class Styles extends BaseParserClass } } - private static function readFillStyle(Fill $fillStyle, \SimpleXMLElement $fillStyleXml) + private static function readFillStyle(Fill $fillStyle, SimpleXMLElement $fillStyleXml): void { if ($fillStyleXml->gradientFill) { - /** @var \SimpleXMLElement $gradientFill */ + /** @var SimpleXMLElement $gradientFill */ $gradientFill = $fillStyleXml->gradientFill[0]; if (!empty($gradientFill['type'])) { $fillStyle->setFillType((string) $gradientFill['type']); @@ -109,7 +110,7 @@ class Styles extends BaseParserClass } } - private static function readBorderStyle(Borders $borderStyle, \SimpleXMLElement $borderStyleXml) + private static function readBorderStyle(Borders $borderStyle, SimpleXMLElement $borderStyleXml): void { $diagonalUp = self::boolean((string) $borderStyleXml['diagonalUp']); $diagonalDown = self::boolean((string) $borderStyleXml['diagonalDown']); @@ -130,7 +131,7 @@ class Styles extends BaseParserClass self::readBorder($borderStyle->getDiagonal(), $borderStyleXml->diagonal); } - private static function readBorder(Border $border, \SimpleXMLElement $borderXml) + private static function readBorder(Border $border, SimpleXMLElement $borderXml): void { if (isset($borderXml['style'])) { $border->setBorderStyle((string) $borderXml['style']); @@ -140,7 +141,7 @@ class Styles extends BaseParserClass } } - private static function readAlignmentStyle(Alignment $alignment, \SimpleXMLElement $alignmentXml) + private static function readAlignmentStyle(Alignment $alignment, SimpleXMLElement $alignmentXml): void { $alignment->setHorizontal((string) $alignmentXml->alignment['horizontal']); $alignment->setVertical((string) $alignmentXml->alignment['vertical']); @@ -159,9 +160,9 @@ class Styles extends BaseParserClass $alignment->setReadOrder((int) ((string) $alignmentXml->alignment['readingOrder']) > 0 ? (int) ((string) $alignmentXml->alignment['readingOrder']) : 0); } - private function readStyle(Style $docStyle, $style) + private function readStyle(Style $docStyle, $style): void { - if ($style->numFmt instanceof \SimpleXMLElement) { + if ($style->numFmt instanceof SimpleXMLElement) { self::readNumberFormat($docStyle->getNumberFormat(), $style->numFmt); } else { $docStyle->getNumberFormat()->setFormatCode($style->numFmt); @@ -195,7 +196,7 @@ class Styles extends BaseParserClass } } - private function readProtectionLocked(Style $docStyle, $style) + private function readProtectionLocked(Style $docStyle, $style): void { if (isset($style->protection['locked'])) { if (self::boolean((string) $style->protection['locked'])) { @@ -206,7 +207,7 @@ class Styles extends BaseParserClass } } - private function readProtectionHidden(Style $docStyle, $style) + private function readProtectionHidden(Style $docStyle, $style): void { if (isset($style->protection['hidden'])) { if (self::boolean((string) $style->protection['hidden'])) { diff --git a/src/PhpSpreadsheet/Reader/Xml.php b/src/PhpSpreadsheet/Reader/Xml.php index 03099e3e..15fb34ad 100644 --- a/src/PhpSpreadsheet/Reader/Xml.php +++ b/src/PhpSpreadsheet/Reader/Xml.php @@ -101,7 +101,7 @@ class Xml extends BaseReader * * @param string $pFilename * - * @return false|\SimpleXMLElement + * @return false|SimpleXMLElement */ public function trySimpleXMLLoadString($pFilename) { @@ -288,7 +288,6 @@ class Xml extends BaseReader * Loads from file into Spreadsheet instance. * * @param string $pFilename - * @param Spreadsheet $spreadsheet * * @return Spreadsheet */ @@ -653,11 +652,7 @@ class Xml extends BaseReader return $value; } - /** - * @param SimpleXMLElement $xml - * @param array $namespaces - */ - private function parseStyles(SimpleXMLElement $xml, array $namespaces) + private function parseStyles(SimpleXMLElement $xml, array $namespaces): void { if (!isset($xml->Styles)) { return; @@ -697,9 +692,8 @@ class Xml extends BaseReader /** * @param string $styleID - * @param SimpleXMLElement $styleAttributes */ - private function parseStyleAlignment($styleID, SimpleXMLElement $styleAttributes) + private function parseStyleAlignment($styleID, SimpleXMLElement $styleAttributes): void { $verticalAlignmentStyles = [ Alignment::VERTICAL_BOTTOM, @@ -741,10 +735,8 @@ class Xml extends BaseReader /** * @param $styleID - * @param SimpleXMLElement $styleData - * @param array $namespaces */ - private function parseStyleBorders($styleID, SimpleXMLElement $styleData, array $namespaces) + private function parseStyleBorders($styleID, SimpleXMLElement $styleData, array $namespaces): void { foreach ($styleData->Border as $borderStyle) { $borderAttributes = $borderStyle->attributes($namespaces['ss']); @@ -778,9 +770,8 @@ class Xml extends BaseReader /** * @param $styleID - * @param SimpleXMLElement $styleAttributes */ - private function parseStyleFont($styleID, SimpleXMLElement $styleAttributes) + private function parseStyleFont($styleID, SimpleXMLElement $styleAttributes): void { $underlineStyles = [ Font::UNDERLINE_NONE, @@ -825,9 +816,8 @@ class Xml extends BaseReader /** * @param $styleID - * @param SimpleXMLElement $styleAttributes */ - private function parseStyleInterior($styleID, SimpleXMLElement $styleAttributes) + private function parseStyleInterior($styleID, SimpleXMLElement $styleAttributes): void { foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { switch ($styleAttributeKey) { @@ -845,9 +835,8 @@ class Xml extends BaseReader /** * @param $styleID - * @param SimpleXMLElement $styleAttributes */ - private function parseStyleNumberFormat($styleID, SimpleXMLElement $styleAttributes) + private function parseStyleNumberFormat($styleID, SimpleXMLElement $styleAttributes): void { $fromFormats = ['\-', '\ ']; $toFormats = ['-', ' ']; diff --git a/src/PhpSpreadsheet/ReferenceHelper.php b/src/PhpSpreadsheet/ReferenceHelper.php index 6d655730..0b0f6dd3 100644 --- a/src/PhpSpreadsheet/ReferenceHelper.php +++ b/src/PhpSpreadsheet/ReferenceHelper.php @@ -152,7 +152,7 @@ class ReferenceHelper * @param int $beforeRow Number of the row we're inserting/deleting before * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustPageBreaks(Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + protected function adjustPageBreaks(Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void { $aBreaks = $pSheet->getBreaks(); ($pNumCols > 0 || $pNumRows > 0) ? @@ -185,7 +185,7 @@ class ReferenceHelper * @param int $beforeRow Number of the row we're inserting/deleting before * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + protected function adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void { $aComments = $pSheet->getComments(); $aNewComments = []; // the new array of all comments @@ -212,7 +212,7 @@ class ReferenceHelper * @param int $beforeRow Number of the row we're inserting/deleting before * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + protected function adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void { $aHyperlinkCollection = $pSheet->getHyperlinkCollection(); ($pNumCols > 0 || $pNumRows > 0) ? @@ -237,7 +237,7 @@ class ReferenceHelper * @param int $beforeRow Number of the row we're inserting/deleting before * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + protected function adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void { $aDataValidationCollection = $pSheet->getDataValidationCollection(); ($pNumCols > 0 || $pNumRows > 0) ? @@ -262,7 +262,7 @@ class ReferenceHelper * @param int $beforeRow Number of the row we're inserting/deleting before * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + protected function adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void { $aMergeCells = $pSheet->getMergeCells(); $aNewMergeCells = []; // the new array of all merge cells @@ -283,7 +283,7 @@ class ReferenceHelper * @param int $beforeRow Number of the row we're inserting/deleting before * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + protected function adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void { $aProtectedCells = $pSheet->getProtectedCells(); ($pNumCols > 0 || $pNumRows > 0) ? @@ -307,7 +307,7 @@ class ReferenceHelper * @param int $beforeRow Number of the row we're inserting/deleting before * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + protected function adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void { $aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true); if (!empty($aColumnDimensions)) { @@ -332,7 +332,7 @@ class ReferenceHelper * @param int $beforeRow Number of the row we're inserting/deleting before * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + protected function adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void { $aRowDimensions = array_reverse($pSheet->getRowDimensions(), true); if (!empty($aRowDimensions)) { @@ -364,7 +364,7 @@ class ReferenceHelper * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param Worksheet $pSheet The worksheet that we're editing */ - public function insertNewBefore($pBefore, $pNumCols, $pNumRows, Worksheet $pSheet) + public function insertNewBefore($pBefore, $pNumCols, $pNumRows, Worksheet $pSheet): void { $remove = ($pNumCols < 0 || $pNumRows < 0); $allCoordinates = $pSheet->getCoordinates(); @@ -789,7 +789,7 @@ class ReferenceHelper * @param string $oldName Old name (name to replace) * @param string $newName New name */ - public function updateNamedFormulas(Spreadsheet $spreadsheet, $oldName = '', $newName = '') + public function updateNamedFormulas(Spreadsheet $spreadsheet, $oldName = '', $newName = ''): void { if ($oldName == '') { return; diff --git a/src/PhpSpreadsheet/RichText/RichText.php b/src/PhpSpreadsheet/RichText/RichText.php index 4fa5f2bd..104177bd 100644 --- a/src/PhpSpreadsheet/RichText/RichText.php +++ b/src/PhpSpreadsheet/RichText/RichText.php @@ -20,7 +20,7 @@ class RichText implements IComparable * * @param Cell $pCell */ - public function __construct(Cell $pCell = null) + public function __construct(?Cell $pCell = null) { // Initialise variables $this->richTextElements = []; diff --git a/src/PhpSpreadsheet/RichText/Run.php b/src/PhpSpreadsheet/RichText/Run.php index aa4a8e46..592d0e36 100644 --- a/src/PhpSpreadsheet/RichText/Run.php +++ b/src/PhpSpreadsheet/RichText/Run.php @@ -42,7 +42,7 @@ class Run extends TextElement implements ITextElement * * @return $this */ - public function setFont(Font $pFont = null) + public function setFont(?Font $pFont = null) { $this->font = $pFont; diff --git a/src/PhpSpreadsheet/Settings.php b/src/PhpSpreadsheet/Settings.php index 56f778e5..4e0c91ef 100644 --- a/src/PhpSpreadsheet/Settings.php +++ b/src/PhpSpreadsheet/Settings.php @@ -60,7 +60,7 @@ class Settings * @param string $rendererClass Class name of the chart renderer * eg: PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph */ - public static function setChartRenderer($rendererClass) + public static function setChartRenderer($rendererClass): void { if (!is_a($rendererClass, IRenderer::class, true)) { throw new Exception('Chart renderer must implement ' . IRenderer::class); @@ -85,7 +85,7 @@ class Settings * * @param int $options Default options for libxml loader */ - public static function setLibXmlLoaderOptions($options) + public static function setLibXmlLoaderOptions($options): void { if ($options === null && defined('LIBXML_DTDLOAD')) { $options = LIBXML_DTDLOAD | LIBXML_DTDATTR; @@ -120,7 +120,7 @@ class Settings * * @param bool $state */ - public static function setLibXmlDisableEntityLoader($state) + public static function setLibXmlDisableEntityLoader($state): void { self::$libXmlDisableEntityLoader = (bool) $state; } @@ -137,10 +137,8 @@ class Settings /** * Sets the implementation of cache that should be used for cell collection. - * - * @param CacheInterface $cache */ - public static function setCache(CacheInterface $cache) + public static function setCache(CacheInterface $cache): void { self::$cache = $cache; } diff --git a/src/PhpSpreadsheet/Shared/Date.php b/src/PhpSpreadsheet/Shared/Date.php index 8be255c5..fd49c1ec 100644 --- a/src/PhpSpreadsheet/Shared/Date.php +++ b/src/PhpSpreadsheet/Shared/Date.php @@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; use DateTimeInterface; use DateTimeZone; +use Exception; use PhpOffice\PhpSpreadsheet\Calculation\DateTime; use PhpOffice\PhpSpreadsheet\Calculation\Functions; use PhpOffice\PhpSpreadsheet\Cell\Cell; @@ -57,7 +58,7 @@ class Date /** * Default timezone to use for DateTime objects. * - * @var null|\DateTimeZone + * @var null|DateTimeZone */ protected static $defaultTimeZone; @@ -139,7 +140,7 @@ class Date return new DateTimeZone($timeZone); } - throw new \Exception('Invalid timezone'); + throw new Exception('Invalid timezone'); } /** @@ -311,8 +312,6 @@ class Date /** * Is a given cell a date/time? * - * @param Cell $pCell - * * @return bool */ public static function isDateTime(Cell $pCell) @@ -328,8 +327,6 @@ class Date /** * Is a given number format a date/time? * - * @param NumberFormat $pFormat - * * @return bool */ public static function isDateTimeFormat(NumberFormat $pFormat) diff --git a/src/PhpSpreadsheet/Shared/Escher/DgContainer.php b/src/PhpSpreadsheet/Shared/Escher/DgContainer.php index e9d387da..b0d75d78 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DgContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DgContainer.php @@ -25,7 +25,7 @@ class DgContainer return $this->dgId; } - public function setDgId($value) + public function setDgId($value): void { $this->dgId = $value; } @@ -35,7 +35,7 @@ class DgContainer return $this->lastSpId; } - public function setLastSpId($value) + public function setLastSpId($value): void { $this->lastSpId = $value; } diff --git a/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php b/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php index 7e2c3460..1da87726 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php @@ -23,7 +23,7 @@ class SpgrContainer * * @param \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer $parent */ - public function setParent($parent) + public function setParent($parent): void { $this->parent = $parent; } @@ -43,7 +43,7 @@ class SpgrContainer * * @param mixed $child */ - public function addChild($child) + public function addChild($child): void { $this->children[] = $child; $child->setParent($this); diff --git a/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php b/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php index bbf51df1..8a81ff57 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php @@ -95,7 +95,7 @@ class SpContainer * * @param SpgrContainer $parent */ - public function setParent($parent) + public function setParent($parent): void { $this->parent = $parent; } @@ -115,7 +115,7 @@ class SpContainer * * @param bool $value */ - public function setSpgr($value) + public function setSpgr($value): void { $this->spgr = $value; } @@ -135,7 +135,7 @@ class SpContainer * * @param int $value */ - public function setSpType($value) + public function setSpType($value): void { $this->spType = $value; } @@ -155,7 +155,7 @@ class SpContainer * * @param int $value */ - public function setSpFlag($value) + public function setSpFlag($value): void { $this->spFlag = $value; } @@ -175,7 +175,7 @@ class SpContainer * * @param int $value */ - public function setSpId($value) + public function setSpId($value): void { $this->spId = $value; } @@ -196,7 +196,7 @@ class SpContainer * @param int $property The number specifies the option * @param mixed $value */ - public function setOPT($property, $value) + public function setOPT($property, $value): void { $this->OPT[$property] = $value; } @@ -232,7 +232,7 @@ class SpContainer * * @param string $value eg: 'A1' */ - public function setStartCoordinates($value) + public function setStartCoordinates($value): void { $this->startCoordinates = $value; } @@ -252,7 +252,7 @@ class SpContainer * * @param int $startOffsetX */ - public function setStartOffsetX($startOffsetX) + public function setStartOffsetX($startOffsetX): void { $this->startOffsetX = $startOffsetX; } @@ -272,7 +272,7 @@ class SpContainer * * @param int $startOffsetY */ - public function setStartOffsetY($startOffsetY) + public function setStartOffsetY($startOffsetY): void { $this->startOffsetY = $startOffsetY; } @@ -292,7 +292,7 @@ class SpContainer * * @param string $value eg: 'A1' */ - public function setEndCoordinates($value) + public function setEndCoordinates($value): void { $this->endCoordinates = $value; } @@ -312,7 +312,7 @@ class SpContainer * * @param int $endOffsetX */ - public function setEndOffsetX($endOffsetX) + public function setEndOffsetX($endOffsetX): void { $this->endOffsetX = $endOffsetX; } @@ -332,7 +332,7 @@ class SpContainer * * @param int $endOffsetY */ - public function setEndOffsetY($endOffsetY) + public function setEndOffsetY($endOffsetY): void { $this->endOffsetY = $endOffsetY; } diff --git a/src/PhpSpreadsheet/Shared/Escher/DggContainer.php b/src/PhpSpreadsheet/Shared/Escher/DggContainer.php index 96da3213..1bd15b9e 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DggContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DggContainer.php @@ -61,7 +61,7 @@ class DggContainer * * @param int $value */ - public function setSpIdMax($value) + public function setSpIdMax($value): void { $this->spIdMax = $value; } @@ -81,7 +81,7 @@ class DggContainer * * @param int $value */ - public function setCDgSaved($value) + public function setCDgSaved($value): void { $this->cDgSaved = $value; } @@ -101,7 +101,7 @@ class DggContainer * * @param int $value */ - public function setCSpSaved($value) + public function setCSpSaved($value): void { $this->cSpSaved = $value; } @@ -121,7 +121,7 @@ class DggContainer * * @param DggContainer\BstoreContainer $bstoreContainer */ - public function setBstoreContainer($bstoreContainer) + public function setBstoreContainer($bstoreContainer): void { $this->bstoreContainer = $bstoreContainer; } @@ -132,7 +132,7 @@ class DggContainer * @param int $property The number specifies the option * @param mixed $value */ - public function setOPT($property, $value) + public function setOPT($property, $value): void { $this->OPT[$property] = $value; } @@ -168,7 +168,7 @@ class DggContainer * * @param array $pValue */ - public function setIDCLs($pValue) + public function setIDCLs($pValue): void { $this->IDCLs = $pValue; } diff --git a/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer.php b/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer.php index 9d1e68ec..b07786ff 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer.php @@ -16,7 +16,7 @@ class BstoreContainer * * @param BstoreContainer\BSE $BSE */ - public function addBSE($BSE) + public function addBSE($BSE): void { $this->BSECollection[] = $BSE; $BSE->setParent($this); diff --git a/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php b/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php index f83bdc7e..e8851465 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php +++ b/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php @@ -41,7 +41,7 @@ class BSE * * @param \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer $parent */ - public function setParent($parent) + public function setParent($parent): void { $this->parent = $parent; } @@ -61,7 +61,7 @@ class BSE * * @param BSE\Blip $blip */ - public function setBlip($blip) + public function setBlip($blip): void { $this->blip = $blip; $blip->setParent($this); @@ -82,7 +82,7 @@ class BSE * * @param int $blipType */ - public function setBlipType($blipType) + public function setBlipType($blipType): void { $this->blipType = $blipType; } diff --git a/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php b/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php index 88bc117a..500d7eaf 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php +++ b/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php @@ -33,7 +33,7 @@ class Blip * * @param string $data */ - public function setData($data) + public function setData($data): void { $this->data = $data; } @@ -43,7 +43,7 @@ class Blip * * @param \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE $parent */ - public function setParent($parent) + public function setParent($parent): void { $this->parent = $parent; } diff --git a/src/PhpSpreadsheet/Shared/File.php b/src/PhpSpreadsheet/Shared/File.php index 6b1fe6f5..7525df8a 100644 --- a/src/PhpSpreadsheet/Shared/File.php +++ b/src/PhpSpreadsheet/Shared/File.php @@ -19,7 +19,7 @@ class File * * @param bool $useUploadTempDir Use File Upload Temporary directory (true or false) */ - public static function setUseUploadTempDirectory($useUploadTempDir) + public static function setUseUploadTempDirectory($useUploadTempDir): void { self::$useUploadTempDirectory = (bool) $useUploadTempDir; } @@ -129,7 +129,7 @@ class File * * @param string $filename */ - public static function assertFile($filename) + public static function assertFile($filename): void { if (!is_file($filename)) { throw new InvalidArgumentException('File "' . $filename . '" does not exist.'); diff --git a/src/PhpSpreadsheet/Shared/Font.php b/src/PhpSpreadsheet/Shared/Font.php index 89d91be7..ca94529c 100644 --- a/src/PhpSpreadsheet/Shared/Font.php +++ b/src/PhpSpreadsheet/Shared/Font.php @@ -198,7 +198,7 @@ class Font * * @param string $pValue */ - public static function setTrueTypeFontPath($pValue) + public static function setTrueTypeFontPath($pValue): void { self::$trueTypeFontPath = $pValue; } @@ -223,7 +223,7 @@ class Font * * @return int Column width */ - public static function calculateColumnWidth(\PhpOffice\PhpSpreadsheet\Style\Font $font, $cellText = '', $rotation = 0, \PhpOffice\PhpSpreadsheet\Style\Font $defaultFont = null) + public static function calculateColumnWidth(\PhpOffice\PhpSpreadsheet\Style\Font $font, $cellText = '', $rotation = 0, ?\PhpOffice\PhpSpreadsheet\Style\Font $defaultFont = null) { // If it is rich text, use plain text if ($cellText instanceof RichText) { @@ -303,7 +303,6 @@ class Font * Get approximate width in pixels for a string of text in a certain font at a certain rotation angle. * * @param string $columnText - * @param \PhpOffice\PhpSpreadsheet\Style\Font $font * @param int $rotation * * @return int Text width in pixels (no padding added) diff --git a/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php index ba59e0e5..f6fbccb8 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php +++ b/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php @@ -73,7 +73,7 @@ class EigenvalueDecomposition /** * Symmetric Householder reduction to tridiagonal form. */ - private function tred2() + private function tred2(): void { // This is derived from the Algol procedures tred2 by // Bowdler, Martin, Reinsch, and Wilkinson, Handbook for @@ -96,7 +96,7 @@ class EigenvalueDecomposition // Generate Householder vector. for ($k = 0; $k < $i; ++$k) { $this->d[$k] /= $scale; - $h += pow($this->d[$k], 2); + $h += $this->d[$k] ** 2; } $f = $this->d[$i_]; $g = sqrt($h); @@ -180,7 +180,7 @@ class EigenvalueDecomposition * Auto. Comp., Vol.ii-Linear Algebra, and the corresponding * Fortran subroutine in EISPACK. */ - private function tql2() + private function tql2(): void { for ($i = 1; $i < $this->n; ++$i) { $this->e[$i - 1] = $this->e[$i]; @@ -188,7 +188,7 @@ class EigenvalueDecomposition $this->e[$this->n - 1] = 0.0; $f = 0.0; $tst1 = 0.0; - $eps = pow(2.0, -52.0); + $eps = 2.0 ** (-52.0); for ($l = 0; $l < $this->n; ++$l) { // Find small subdiagonal element @@ -206,7 +206,7 @@ class EigenvalueDecomposition $iter = 0; do { // Could check iteration count here. - $iter += 1; + ++$iter; // Compute implicit shift $g = $this->d[$l]; $p = ($this->d[$l + 1] - $g) / (2.0 * $this->e[$l]); @@ -287,7 +287,7 @@ class EigenvalueDecomposition * Vol.ii-Linear Algebra, and the corresponding * Fortran subroutines in EISPACK. */ - private function orthes() + private function orthes(): void { $low = 0; $high = $this->n - 1; @@ -372,7 +372,7 @@ class EigenvalueDecomposition * @param mixed $yr * @param mixed $yi */ - private function cdiv($xr, $xi, $yr, $yi) + private function cdiv($xr, $xi, $yr, $yi): void { if (abs($yr) > abs($yi)) { $r = $yi / $yr; @@ -395,21 +395,21 @@ class EigenvalueDecomposition * Vol.ii-Linear Algebra, and the corresponding * Fortran subroutine in EISPACK. */ - private function hqr2() + private function hqr2(): void { // Initialize $nn = $this->n; $n = $nn - 1; $low = 0; $high = $nn - 1; - $eps = pow(2.0, -52.0); + $eps = 2.0 ** (-52.0); $exshift = 0.0; $p = $q = $r = $s = $z = 0; // Store roots isolated by balanc and compute matrix norm $norm = 0.0; for ($i = 0; $i < $nn; ++$i) { - if (($i < $low) or ($i > $high)) { + if (($i < $low) || ($i > $high)) { $this->d[$i] = $this->H[$i][$i]; $this->e[$i] = 0.0; } diff --git a/src/PhpSpreadsheet/Shared/JAMA/Matrix.php b/src/PhpSpreadsheet/Shared/JAMA/Matrix.php index a67b6c2d..a5cb6de0 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/Matrix.php +++ b/src/PhpSpreadsheet/Shared/JAMA/Matrix.php @@ -159,11 +159,6 @@ class Matrix * * Get a submatrix * - * @param int $i0 Initial row index - * @param int $iF Final row index - * @param int $j0 Initial column index - * @param int $jF Final column index - * * @return Matrix Submatrix */ public function getMatrix(...$args) @@ -477,8 +472,6 @@ class Matrix * * A + B * - * @param mixed $B Matrix/Array - * * @return Matrix Sum */ public function plus(...$args) @@ -522,8 +515,6 @@ class Matrix * * A = A + B * - * @param mixed $B Matrix/Array - * * @return $this */ public function plusEquals(...$args) @@ -581,8 +572,6 @@ class Matrix * * A - B * - * @param mixed $B Matrix/Array - * * @return Matrix Sum */ public function minus(...$args) @@ -626,8 +615,6 @@ class Matrix * * A = A - B * - * @param mixed $B Matrix/Array - * * @return $this */ public function minusEquals(...$args) @@ -686,8 +673,6 @@ class Matrix * Element-by-element multiplication * Cij = Aij * Bij * - * @param mixed $B Matrix/Array - * * @return Matrix Matrix Cij */ public function arrayTimes(...$args) @@ -732,8 +717,6 @@ class Matrix * Element-by-element multiplication * Aij = Aij * Bij * - * @param mixed $B Matrix/Array - * * @return $this */ public function arrayTimesEquals(...$args) @@ -792,8 +775,6 @@ class Matrix * Element-by-element right division * A / B * - * @param Matrix $B Matrix B - * * @return Matrix Division result */ public function arrayRightDivide(...$args) @@ -857,8 +838,6 @@ class Matrix * Element-by-element right division * Aij = Aij / Bij * - * @param mixed $B Matrix/Array - * * @return Matrix Matrix Aij */ public function arrayRightDivideEquals(...$args) @@ -903,8 +882,6 @@ class Matrix * Element-by-element Left division * A / B * - * @param Matrix $B Matrix B - * * @return Matrix Division result */ public function arrayLeftDivide(...$args) @@ -949,8 +926,6 @@ class Matrix * Element-by-element Left division * Aij = Aij / Bij * - * @param mixed $B Matrix/Array - * * @return Matrix Matrix Aij */ public function arrayLeftDivideEquals(...$args) @@ -994,8 +969,6 @@ class Matrix * * Matrix multiplication * - * @param mixed $n Matrix/Array/Scalar - * * @return Matrix Product */ public function times(...$args) @@ -1089,8 +1062,6 @@ class Matrix * * A = A ^ B * - * @param mixed $B Matrix/Array - * * @return $this */ public function power(...$args) @@ -1130,7 +1101,7 @@ class Matrix $validValues &= StringHelper::convertToNumberIfFraction($value); } if ($validValues) { - $this->A[$i][$j] = pow($this->A[$i][$j], $value); + $this->A[$i][$j] = $this->A[$i][$j] ** $value; } else { $this->A[$i][$j] = Functions::NAN(); } @@ -1148,8 +1119,6 @@ class Matrix * * A = A & B * - * @param mixed $B Matrix/Array - * * @return $this */ public function concat(...$args) diff --git a/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php index 3ca95619..b997fb7c 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php +++ b/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php @@ -117,7 +117,7 @@ class SingularValueDecomposition } } - if ($wantu and ($k < $nct)) { + if ($wantu && ($k < $nct)) { // Place the transformation in U for subsequent back // multiplication. for ($i = $k; $i < $this->m; ++$i) { @@ -143,7 +143,7 @@ class SingularValueDecomposition $e[$k + 1] += 1.0; } $e[$k] = -$e[$k]; - if (($k + 1 < $this->m) and ($e[$k] != 0.0)) { + if (($k + 1 < $this->m) && ($e[$k] != 0.0)) { // Apply the transformation. for ($i = $k + 1; $i < $this->m; ++$i) { $work[$i] = 0.0; @@ -221,7 +221,7 @@ class SingularValueDecomposition // If required, generate V. if ($wantv) { for ($k = $this->n - 1; $k >= 0; --$k) { - if (($k < $nrt) and ($e[$k] != 0.0)) { + if (($k < $nrt) && ($e[$k] != 0.0)) { for ($j = $k + 1; $j < $nu; ++$j) { $t = 0; for ($i = $k + 1; $i < $this->n; ++$i) { @@ -243,7 +243,7 @@ class SingularValueDecomposition // Main iteration loop for the singular values. $pp = $p - 1; $iter = 0; - $eps = pow(2.0, -52.0); + $eps = 2.0 ** (-52.0); while ($p > 0) { // Here is where a test for too many iterations would go. @@ -415,14 +415,14 @@ class SingularValueDecomposition $t = $this->s[$k]; $this->s[$k] = $this->s[$k + 1]; $this->s[$k + 1] = $t; - if ($wantv and ($k < $this->n - 1)) { + if ($wantv && ($k < $this->n - 1)) { for ($i = 0; $i < $this->n; ++$i) { $t = $this->V[$i][$k + 1]; $this->V[$i][$k + 1] = $this->V[$i][$k]; $this->V[$i][$k] = $t; } } - if ($wantu and ($k < $this->m - 1)) { + if ($wantu && ($k < $this->m - 1)) { for ($i = 0; $i < $this->m; ++$i) { $t = $this->U[$i][$k + 1]; $this->U[$i][$k + 1] = $this->U[$i][$k]; @@ -513,7 +513,7 @@ class SingularValueDecomposition */ public function rank() { - $eps = pow(2.0, -52.0); + $eps = 2.0 ** (-52.0); $tol = max($this->m, $this->n) * $this->s[0] * $eps; $r = 0; $iMax = count($this->s); diff --git a/src/PhpSpreadsheet/Shared/OLE.php b/src/PhpSpreadsheet/Shared/OLE.php index 81ebaa34..27c72acd 100644 --- a/src/PhpSpreadsheet/Shared/OLE.php +++ b/src/PhpSpreadsheet/Shared/OLE.php @@ -117,7 +117,7 @@ class OLE */ public function read($file) { - $fh = fopen($file, 'r'); + $fh = fopen($file, 'rb'); if (!$fh) { throw new ReaderException("Can't open file $file"); } @@ -133,8 +133,8 @@ class OLE throw new ReaderException('Only Little-Endian encoding is supported.'); } // Size of blocks and short blocks in bytes - $this->bigBlockSize = pow(2, self::_readInt2($fh)); - $this->smallBlockSize = pow(2, self::_readInt2($fh)); + $this->bigBlockSize = 2 ** self::_readInt2($fh); + $this->smallBlockSize = 2 ** self::_readInt2($fh); // Skip UID, revision number and version number fseek($fh, 44); @@ -239,7 +239,7 @@ class OLE $path .= '&blockId=' . $blockIdOrPps; } - return fopen($path, 'r'); + return fopen($path, 'rb'); } /** @@ -502,7 +502,7 @@ class OLE } // factor used for separating numbers into 4 bytes parts - $factor = pow(2, 32); + $factor = 2 ** 32; // days from 1-1-1601 until the beggining of UNIX era $days = 134774; diff --git a/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php b/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php index e6ba7242..ecaa97ed 100644 --- a/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php +++ b/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php @@ -101,7 +101,7 @@ class ChainedBlockStream /** * Implements support for fclose(). */ - public function stream_close() // @codingStandardsIgnoreLine + public function stream_close(): void // @codingStandardsIgnoreLine { $this->ole = null; unset($GLOBALS['_OLE_INSTANCES']); @@ -179,7 +179,7 @@ class ChainedBlockStream { return [ 'size' => strlen($this->data), - ]; + ]; } // Methods used by stream_wrapper_register() that are not implemented: diff --git a/src/PhpSpreadsheet/Shared/OLE/PPS/File.php b/src/PhpSpreadsheet/Shared/OLE/PPS/File.php index 68f50a5c..b7425af4 100644 --- a/src/PhpSpreadsheet/Shared/OLE/PPS/File.php +++ b/src/PhpSpreadsheet/Shared/OLE/PPS/File.php @@ -59,7 +59,7 @@ class File extends PPS * * @param string $data The data to append */ - public function append($data) + public function append($data): void { $this->_data .= $data; } diff --git a/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php b/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php index 472483eb..0d70df6d 100644 --- a/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php +++ b/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php @@ -73,14 +73,12 @@ class Root extends PPS $this->fileHandle = $fileHandle; // Initial Setting for saving - $this->bigBlockSize = pow( - 2, + $this->bigBlockSize = 2 ** ( (isset($this->bigBlockSize)) ? self::adjust2($this->bigBlockSize) : 9 - ); - $this->smallBlockSize = pow( - 2, + ); + $this->smallBlockSize = 2 ** ( (isset($this->smallBlockSize)) ? self::adjust2($this->smallBlockSize) : 6 - ); + ); // Make an array of PPS's (for Save) $aList = []; @@ -122,7 +120,7 @@ class Root extends PPS $raList[$i]->Size = $raList[$i]->getDataLen(); if ($raList[$i]->Size < OLE::OLE_DATA_SIZE_SMALL) { $iSBcnt += floor($raList[$i]->Size / $this->smallBlockSize) - + (($raList[$i]->Size % $this->smallBlockSize) ? 1 : 0); + + (($raList[$i]->Size % $this->smallBlockSize) ? 1 : 0); } else { $iBBcnt += (floor($raList[$i]->Size / $this->bigBlockSize) + (($raList[$i]->Size % $this->bigBlockSize) ? 1 : 0)); @@ -133,7 +131,7 @@ class Root extends PPS $iSlCnt = floor($this->bigBlockSize / OLE::OLE_LONG_INT_SIZE); $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt) ? 1 : 0); $iBBcnt += (floor($iSmallLen / $this->bigBlockSize) + - (($iSmallLen % $this->bigBlockSize) ? 1 : 0)); + (($iSmallLen % $this->bigBlockSize) ? 1 : 0)); $iCnt = count($raList); $iBdCnt = $this->bigBlockSize / OLE::OLE_PPS_SIZE; $iPPScnt = (floor($iCnt / $iBdCnt) + (($iCnt % $iBdCnt) ? 1 : 0)); @@ -146,9 +144,9 @@ class Root extends PPS * * @param int $i2 The argument * - * @see save() - * * @return float + * + * @see save() */ private static function adjust2($i2) { @@ -164,7 +162,7 @@ class Root extends PPS * @param int $iBBcnt * @param int $iPPScnt */ - public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt) + public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt): void { $FILE = $this->fileHandle; @@ -243,7 +241,7 @@ class Root extends PPS * @param int $iStBlk * @param array &$raList Reference to array of PPS's */ - public function _saveBigData($iStBlk, &$raList) + public function _saveBigData($iStBlk, &$raList): void { $FILE = $this->fileHandle; @@ -261,8 +259,8 @@ class Root extends PPS // Set For PPS $raList[$i]->startBlock = $iStBlk; $iStBlk += - (floor($raList[$i]->Size / $this->bigBlockSize) + - (($raList[$i]->Size % $this->bigBlockSize) ? 1 : 0)); + (floor($raList[$i]->Size / $this->bigBlockSize) + + (($raList[$i]->Size % $this->bigBlockSize) ? 1 : 0)); } } } @@ -290,7 +288,7 @@ class Root extends PPS } if ($raList[$i]->Size < OLE::OLE_DATA_SIZE_SMALL) { $iSmbCnt = floor($raList[$i]->Size / $this->smallBlockSize) - + (($raList[$i]->Size % $this->smallBlockSize) ? 1 : 0); + + (($raList[$i]->Size % $this->smallBlockSize) ? 1 : 0); // Add to SBD $jB = $iSmbCnt - 1; for ($j = 0; $j < $jB; ++$j) { @@ -325,7 +323,7 @@ class Root extends PPS * * @param array $raList Reference to an array with all PPS's */ - public function _savePps(&$raList) + public function _savePps(&$raList): void { // Save each PPS WK $iC = count($raList); @@ -347,7 +345,7 @@ class Root extends PPS * @param int $iBsize * @param int $iPpsCnt */ - public function _saveBbd($iSbdSize, $iBsize, $iPpsCnt) + public function _saveBbd($iSbdSize, $iBsize, $iPpsCnt): void { $FILE = $this->fileHandle; // Calculate Basic Setting diff --git a/src/PhpSpreadsheet/Shared/OLERead.php b/src/PhpSpreadsheet/Shared/OLERead.php index 3526c7e6..b6d5422c 100644 --- a/src/PhpSpreadsheet/Shared/OLERead.php +++ b/src/PhpSpreadsheet/Shared/OLERead.php @@ -95,7 +95,7 @@ class OLERead * * @param $pFilename string Filename */ - public function read($pFilename) + public function read($pFilename): void { File::assertFile($pFilename); @@ -258,7 +258,7 @@ class OLERead /** * Read entries in the directory stream. */ - private function readPropertySets() + private function readPropertySets(): void { $offset = 0; diff --git a/src/PhpSpreadsheet/Shared/StringHelper.php b/src/PhpSpreadsheet/Shared/StringHelper.php index d949203b..9ae32413 100644 --- a/src/PhpSpreadsheet/Shared/StringHelper.php +++ b/src/PhpSpreadsheet/Shared/StringHelper.php @@ -63,7 +63,7 @@ class StringHelper /** * Build control characters array. */ - private static function buildControlCharacters() + private static function buildControlCharacters(): void { for ($i = 0; $i <= 31; ++$i) { if ($i != 9 && $i != 10 && $i != 13) { @@ -77,7 +77,7 @@ class StringHelper /** * Build SYLK characters array. */ - private static function buildSYLKCharacters() + private static function buildSYLKCharacters(): void { self::$SYLKCharacters = [ "\x1B 0" => chr(0), @@ -272,7 +272,7 @@ class StringHelper return self::$isIconvEnabled; } - private static function buildCharacterSets() + private static function buildCharacterSets(): void { if (empty(self::$controlCharacters)) { self::buildControlCharacters(); @@ -603,7 +603,7 @@ class StringHelper * * @param string $pValue Character for decimal separator */ - public static function setDecimalSeparator($pValue) + public static function setDecimalSeparator($pValue): void { self::$decimalSeparator = $pValue; } @@ -636,7 +636,7 @@ class StringHelper * * @param string $pValue Character for thousands separator */ - public static function setThousandsSeparator($pValue) + public static function setThousandsSeparator($pValue): void { self::$thousandsSeparator = $pValue; } @@ -674,7 +674,7 @@ class StringHelper * * @param string $pValue Character for currency code */ - public static function setCurrencyCode($pValue) + public static function setCurrencyCode($pValue): void { self::$currencyCode = $pValue; } diff --git a/src/PhpSpreadsheet/Shared/Trend/BestFit.php b/src/PhpSpreadsheet/Shared/Trend/BestFit.php index d8e63d5e..c9499722 100644 --- a/src/PhpSpreadsheet/Shared/Trend/BestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/BestFit.php @@ -341,7 +341,7 @@ class BestFit return $this->yBestFitValues; } - protected function calculateGoodnessOfFit($sumX, $sumY, $sumX2, $sumY2, $sumXY, $meanX, $meanY, $const) + protected function calculateGoodnessOfFit($sumX, $sumY, $sumX2, $sumY2, $sumXY, $meanX, $meanY, $const): void { $SSres = $SScov = $SScor = $SStot = $SSsex = 0.0; foreach ($this->xValues as $xKey => $xValue) { @@ -377,7 +377,7 @@ class BestFit $this->SSRegression = $this->goodnessOfFit * $SStot; $this->covariance = $SScov / $this->valueCount; - $this->correlation = ($this->valueCount * $sumXY - $sumX * $sumY) / sqrt(($this->valueCount * $sumX2 - pow($sumX, 2)) * ($this->valueCount * $sumY2 - pow($sumY, 2))); + $this->correlation = ($this->valueCount * $sumXY - $sumX * $sumY) / sqrt(($this->valueCount * $sumX2 - $sumX ** 2) * ($this->valueCount * $sumY2 - $sumY ** 2)); $this->slopeSE = $this->stdevOfResiduals / sqrt($SSsex); $this->intersectSE = $this->stdevOfResiduals * sqrt(1 / ($this->valueCount - ($sumX * $sumX) / $sumX2)); if ($this->SSResiduals != 0.0) { @@ -400,7 +400,7 @@ class BestFit * @param float[] $xValues * @param bool $const */ - protected function leastSquareFit(array $yValues, array $xValues, $const) + protected function leastSquareFit(array $yValues, array $xValues, $const): void { // calculate sums $x_sum = array_sum($xValues); diff --git a/src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php b/src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php index 5b57f4b7..82866dee 100644 --- a/src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php @@ -21,7 +21,7 @@ class ExponentialBestFit extends BestFit */ public function getValueOfYForX($xValue) { - return $this->getIntersect() * pow($this->getSlope(), ($xValue - $this->xOffset)); + return $this->getIntersect() * $this->getSlope() ** ($xValue - $this->xOffset); } /** @@ -90,7 +90,7 @@ class ExponentialBestFit extends BestFit * @param float[] $xValues The set of X-values for this regression * @param bool $const */ - private function exponentialRegression($yValues, $xValues, $const) + private function exponentialRegression($yValues, $xValues, $const): void { foreach ($yValues as &$value) { if ($value < 0.0) { diff --git a/src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php b/src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php index 217f0964..26a562c5 100644 --- a/src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php @@ -58,7 +58,7 @@ class LinearBestFit extends BestFit * @param float[] $xValues The set of X-values for this regression * @param bool $const */ - private function linearRegression($yValues, $xValues, $const) + private function linearRegression($yValues, $xValues, $const): void { $this->leastSquareFit($yValues, $xValues, $const); } diff --git a/src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php b/src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php index 96ca2ed8..c469067d 100644 --- a/src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php @@ -58,7 +58,7 @@ class LogarithmicBestFit extends BestFit * @param float[] $xValues The set of X-values for this regression * @param bool $const */ - private function logarithmicRegression($yValues, $xValues, $const) + private function logarithmicRegression($yValues, $xValues, $const): void { foreach ($xValues as &$value) { if ($value < 0.0) { diff --git a/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php b/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php index a1510491..d959eddb 100644 --- a/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php @@ -44,7 +44,7 @@ class PolynomialBestFit extends BestFit $slope = $this->getSlope(); foreach ($slope as $key => $value) { if ($value != 0.0) { - $retVal += $value * pow($xValue, $key + 1); + $retVal += $value * $xValue ** ($key + 1); } } @@ -121,7 +121,7 @@ class PolynomialBestFit extends BestFit * @param float[] $yValues The set of Y-values for this regression * @param float[] $xValues The set of X-values for this regression */ - private function polynomialRegression($order, $yValues, $xValues) + private function polynomialRegression($order, $yValues, $xValues): void { // calculate sums $x_sum = array_sum($xValues); @@ -144,7 +144,7 @@ class PolynomialBestFit extends BestFit $B = []; for ($i = 0; $i < $this->valueCount; ++$i) { for ($j = 0; $j <= $order; ++$j) { - $A[$i][$j] = pow($xValues[$i], $j); + $A[$i][$j] = $xValues[$i] ** $j; } } for ($i = 0; $i < $this->valueCount; ++$i) { @@ -157,7 +157,7 @@ class PolynomialBestFit extends BestFit $coefficients = []; for ($i = 0; $i < $C->getRowDimension(); ++$i) { $r = $C->get($i, 0); - if (abs($r) <= pow(10, -9)) { + if (abs($r) <= 10 ** (-9)) { $r = 0; } $coefficients[] = $r; diff --git a/src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php b/src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php index 4eefec82..c53eab63 100644 --- a/src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php @@ -21,7 +21,7 @@ class PowerBestFit extends BestFit */ public function getValueOfYForX($xValue) { - return $this->getIntersect() * pow(($xValue - $this->xOffset), $this->getSlope()); + return $this->getIntersect() * ($xValue - $this->xOffset) ** $this->getSlope(); } /** @@ -33,7 +33,7 @@ class PowerBestFit extends BestFit */ public function getValueOfXForY($yValue) { - return pow((($yValue + $this->yOffset) / $this->getIntersect()), (1 / $this->getSlope())); + return (($yValue + $this->yOffset) / $this->getIntersect()) ** (1 / $this->getSlope()); } /** @@ -74,7 +74,7 @@ class PowerBestFit extends BestFit * @param float[] $xValues The set of X-values for this regression * @param bool $const */ - private function powerRegression($yValues, $xValues, $const) + private function powerRegression($yValues, $xValues, $const): void { foreach ($xValues as &$value) { if ($value < 0.0) { diff --git a/src/PhpSpreadsheet/Shared/Xls.php b/src/PhpSpreadsheet/Shared/Xls.php index b8ce5e2d..c9eaf378 100644 --- a/src/PhpSpreadsheet/Shared/Xls.php +++ b/src/PhpSpreadsheet/Shared/Xls.php @@ -25,7 +25,7 @@ class Xls $columnDimensions = $sheet->getColumnDimensions(); // first find the true column width in pixels (uncollapsed and unhidden) - if (isset($columnDimensions[$col]) and $columnDimensions[$col]->getWidth() != -1) { + if (isset($columnDimensions[$col]) && $columnDimensions[$col]->getWidth() != -1) { // then we have column dimension with explicit width $columnDimension = $columnDimensions[$col]; $width = $columnDimension->getWidth(); @@ -41,7 +41,7 @@ class Xls } // now find the effective column width in pixels - if (isset($columnDimensions[$col]) and !$columnDimensions[$col]->getVisible()) { + if (isset($columnDimensions[$col]) && !$columnDimensions[$col]->getVisible()) { $effectivePixelWidth = 0; } else { $effectivePixelWidth = $pixelWidth; @@ -68,7 +68,7 @@ class Xls $rowDimensions = $sheet->getRowDimensions(); // first find the true row height in pixels (uncollapsed and unhidden) - if (isset($rowDimensions[$row]) and $rowDimensions[$row]->getRowHeight() != -1) { + if (isset($rowDimensions[$row]) && $rowDimensions[$row]->getRowHeight() != -1) { // then we have a row dimension $rowDimension = $rowDimensions[$row]; $rowHeight = $rowDimension->getRowHeight(); @@ -85,7 +85,7 @@ class Xls } // now find the effective row height in pixels - if (isset($rowDimensions[$row]) and !$rowDimensions[$row]->getVisible()) { + if (isset($rowDimensions[$row]) && !$rowDimensions[$row]->getVisible()) { $effectivePixelRowHeight = 0; } else { $effectivePixelRowHeight = $pixelRowHeight; @@ -98,7 +98,6 @@ class Xls * Get the horizontal distance in pixels between two anchors * The distanceX is found as sum of all the spanning columns widths minus correction for the two offsets. * - * @param Worksheet $sheet * @param string $startColumn * @param int $startOffsetX Offset within start cell measured in 1/1024 of the cell width * @param string $endColumn @@ -130,7 +129,6 @@ class Xls * Get the vertical distance in pixels between two anchors * The distanceY is found as sum of all the spanning rows minus two offsets. * - * @param Worksheet $sheet * @param int $startRow (1-based) * @param int $startOffsetY Offset within start cell measured in 1/256 of the cell height * @param int $endRow (1-based) diff --git a/src/PhpSpreadsheet/Spreadsheet.php b/src/PhpSpreadsheet/Spreadsheet.php index 6023c616..322d5f7c 100644 --- a/src/PhpSpreadsheet/Spreadsheet.php +++ b/src/PhpSpreadsheet/Spreadsheet.php @@ -210,7 +210,7 @@ class Spreadsheet * * @param bool $hasMacros true|false */ - public function setHasMacros($hasMacros) + public function setHasMacros($hasMacros): void { $this->hasMacros = (bool) $hasMacros; } @@ -220,7 +220,7 @@ class Spreadsheet * * @param string $macroCode string|null */ - public function setMacrosCode($macroCode) + public function setMacrosCode($macroCode): void { $this->macrosCode = $macroCode; $this->setHasMacros($macroCode !== null); @@ -241,7 +241,7 @@ class Spreadsheet * * @param null|string $certificate */ - public function setMacrosCertificate($certificate) + public function setMacrosCertificate($certificate): void { $this->macrosCertificate = $certificate; } @@ -269,7 +269,7 @@ class Spreadsheet /** * Remove all macros, certificate from spreadsheet. */ - public function discardMacros() + public function discardMacros(): void { $this->hasMacros = false; $this->macrosCode = null; @@ -282,7 +282,7 @@ class Spreadsheet * @param null|mixed $target * @param null|mixed $xmlData */ - public function setRibbonXMLData($target, $xmlData) + public function setRibbonXMLData($target, $xmlData): void { if ($target !== null && $xmlData !== null) { $this->ribbonXMLData = ['target' => $target, 'data' => $xmlData]; @@ -327,7 +327,7 @@ class Spreadsheet * @param null|mixed $BinObjectsNames * @param null|mixed $BinObjectsData */ - public function setRibbonBinObjects($BinObjectsNames, $BinObjectsData) + public function setRibbonBinObjects($BinObjectsNames, $BinObjectsData): void { if ($BinObjectsNames !== null && $BinObjectsData !== null) { $this->ribbonBinObjects = ['names' => $BinObjectsNames, 'data' => $BinObjectsData]; @@ -354,10 +354,8 @@ class Spreadsheet * It has to be minimized when the library start to support currently unparsed data. * * @internal - * - * @param array $unparsedLoadedData */ - public function setUnparsedLoadedData(array $unparsedLoadedData) + public function setUnparsedLoadedData(array $unparsedLoadedData): void { $this->unparsedLoadedData = $unparsedLoadedData; } @@ -507,7 +505,7 @@ class Spreadsheet * Disconnect all worksheets from this PhpSpreadsheet workbook object, * typically so that the PhpSpreadsheet object can be unset. */ - public function disconnectWorksheets() + public function disconnectWorksheets(): void { $worksheet = null; foreach ($this->workSheetCollection as $k => &$worksheet) { @@ -540,10 +538,8 @@ class Spreadsheet /** * Set properties. - * - * @param Document\Properties $pValue */ - public function setProperties(Document\Properties $pValue) + public function setProperties(Document\Properties $pValue): void { $this->properties = $pValue; } @@ -560,10 +556,8 @@ class Spreadsheet /** * Set security. - * - * @param Document\Security $pValue */ - public function setSecurity(Document\Security $pValue) + public function setSecurity(Document\Security $pValue): void { $this->security = $pValue; } @@ -608,7 +602,6 @@ class Spreadsheet /** * Add sheet. * - * @param Worksheet $pSheet * @param null|int $iSheetIndex Index where sheet should go (0,1,..., or null for last) * * @return Worksheet @@ -653,7 +646,7 @@ class Spreadsheet * * @param int $pIndex Active sheet index */ - public function removeSheetByIndex($pIndex) + public function removeSheetByIndex($pIndex): void { $numSheets = count($this->workSheetCollection); if ($pIndex > $numSheets - 1) { @@ -722,8 +715,6 @@ class Spreadsheet /** * Get index for sheet. * - * @param Worksheet $pSheet - * * @return int index */ public function getIndex(Worksheet $pSheet) @@ -885,8 +876,6 @@ class Spreadsheet /** * Add named range. * - * @param NamedRange $namedRange - * * @return bool */ public function addNamedRange(NamedRange $namedRange) @@ -910,7 +899,7 @@ class Spreadsheet * * @return null|NamedRange */ - public function getNamedRange($namedRange, Worksheet $pSheet = null) + public function getNamedRange($namedRange, ?Worksheet $pSheet = null) { $returnValue = null; @@ -937,7 +926,7 @@ class Spreadsheet * * @return $this */ - public function removeNamedRange($namedRange, Worksheet $pSheet = null) + public function removeNamedRange($namedRange, ?Worksheet $pSheet = null) { if ($pSheet === null) { if (isset($this->namedRanges[$namedRange])) { @@ -1060,10 +1049,8 @@ class Spreadsheet /** * Add a cellXf to the workbook. - * - * @param Style $style */ - public function addCellXf(Style $style) + public function addCellXf(Style $style): void { $this->cellXfCollection[] = $style; $style->setIndex(count($this->cellXfCollection) - 1); @@ -1074,7 +1061,7 @@ class Spreadsheet * * @param int $pIndex Index to cellXf */ - public function removeCellXfByIndex($pIndex) + public function removeCellXfByIndex($pIndex): void { if ($pIndex > count($this->cellXfCollection) - 1) { throw new Exception('CellXf index is out of bounds.'); @@ -1151,10 +1138,8 @@ class Spreadsheet /** * Add a cellStyleXf to the workbook. - * - * @param Style $pStyle */ - public function addCellStyleXf(Style $pStyle) + public function addCellStyleXf(Style $pStyle): void { $this->cellStyleXfCollection[] = $pStyle; $pStyle->setIndex(count($this->cellStyleXfCollection) - 1); @@ -1165,7 +1150,7 @@ class Spreadsheet * * @param int $pIndex Index to cellXf */ - public function removeCellStyleXfByIndex($pIndex) + public function removeCellStyleXfByIndex($pIndex): void { if ($pIndex > count($this->cellStyleXfCollection) - 1) { throw new Exception('CellStyleXf index is out of bounds.'); @@ -1177,7 +1162,7 @@ class Spreadsheet * Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells * and columns in the workbook. */ - public function garbageCollect() + public function garbageCollect(): void { // how many references are there to each cellXf ? $countReferencesCellXf = []; @@ -1278,7 +1263,7 @@ class Spreadsheet * * @param bool $showHorizontalScroll True if horizonal scroll bar is visible */ - public function setShowHorizontalScroll($showHorizontalScroll) + public function setShowHorizontalScroll($showHorizontalScroll): void { $this->showHorizontalScroll = (bool) $showHorizontalScroll; } @@ -1298,7 +1283,7 @@ class Spreadsheet * * @param bool $showVerticalScroll True if vertical scroll bar is visible */ - public function setShowVerticalScroll($showVerticalScroll) + public function setShowVerticalScroll($showVerticalScroll): void { $this->showVerticalScroll = (bool) $showVerticalScroll; } @@ -1318,7 +1303,7 @@ class Spreadsheet * * @param bool $showSheetTabs True if sheet tabs are visible */ - public function setShowSheetTabs($showSheetTabs) + public function setShowSheetTabs($showSheetTabs): void { $this->showSheetTabs = (bool) $showSheetTabs; } @@ -1338,7 +1323,7 @@ class Spreadsheet * * @param bool $minimized true if workbook window is minimized */ - public function setMinimized($minimized) + public function setMinimized($minimized): void { $this->minimized = (bool) $minimized; } @@ -1360,7 +1345,7 @@ class Spreadsheet * * @param bool $autoFilterDateGrouping true if workbook window is minimized */ - public function setAutoFilterDateGrouping($autoFilterDateGrouping) + public function setAutoFilterDateGrouping($autoFilterDateGrouping): void { $this->autoFilterDateGrouping = (bool) $autoFilterDateGrouping; } @@ -1380,7 +1365,7 @@ class Spreadsheet * * @param int $firstSheetIndex First sheet in book view */ - public function setFirstSheetIndex($firstSheetIndex) + public function setFirstSheetIndex($firstSheetIndex): void { if ($firstSheetIndex >= 0) { $this->firstSheetIndex = (int) $firstSheetIndex; @@ -1417,7 +1402,7 @@ class Spreadsheet * * @param string $visibility visibility status of the workbook */ - public function setVisibility($visibility) + public function setVisibility($visibility): void { if ($visibility === null) { $visibility = self::VISIBILITY_VISIBLE; @@ -1447,7 +1432,7 @@ class Spreadsheet * * @param int $tabRatio Ratio between the tabs bar and the horizontal scroll bar */ - public function setTabRatio($tabRatio) + public function setTabRatio($tabRatio): void { if ($tabRatio >= 0 || $tabRatio <= 1000) { $this->tabRatio = (int) $tabRatio; diff --git a/src/PhpSpreadsheet/Style/Border.php b/src/PhpSpreadsheet/Style/Border.php index 2e076a92..78ad8b26 100644 --- a/src/PhpSpreadsheet/Style/Border.php +++ b/src/PhpSpreadsheet/Style/Border.php @@ -194,8 +194,6 @@ class Border extends Supervisor /** * Set Border Color. * - * @param Color $pValue - * * @return $this */ public function setColor(Color $pValue) diff --git a/src/PhpSpreadsheet/Style/Conditional.php b/src/PhpSpreadsheet/Style/Conditional.php index 2b096a34..35ec479b 100644 --- a/src/PhpSpreadsheet/Style/Conditional.php +++ b/src/PhpSpreadsheet/Style/Conditional.php @@ -234,7 +234,7 @@ class Conditional implements IComparable * * @return $this */ - public function setStyle(Style $pValue = null) + public function setStyle(?Style $pValue = null) { $this->style = $pValue; diff --git a/src/PhpSpreadsheet/Style/Fill.php b/src/PhpSpreadsheet/Style/Fill.php index 789a9801..c6baeed0 100644 --- a/src/PhpSpreadsheet/Style/Fill.php +++ b/src/PhpSpreadsheet/Style/Fill.php @@ -244,8 +244,6 @@ class Fill extends Supervisor /** * Set Start Color. * - * @param Color $pValue - * * @return $this */ public function setStartColor(Color $pValue) @@ -276,8 +274,6 @@ class Fill extends Supervisor /** * Set End Color. * - * @param Color $pValue - * * @return $this */ public function setEndColor(Color $pValue) diff --git a/src/PhpSpreadsheet/Style/Font.php b/src/PhpSpreadsheet/Style/Font.php index 5ab58dca..eee7df04 100644 --- a/src/PhpSpreadsheet/Style/Font.php +++ b/src/PhpSpreadsheet/Style/Font.php @@ -504,8 +504,6 @@ class Font extends Supervisor /** * Set Color. * - * @param Color $pValue - * * @return $this */ public function setColor(Color $pValue) diff --git a/src/PhpSpreadsheet/Style/NumberFormat.php b/src/PhpSpreadsheet/Style/NumberFormat.php index 1f4a6c0c..259acabf 100644 --- a/src/PhpSpreadsheet/Style/NumberFormat.php +++ b/src/PhpSpreadsheet/Style/NumberFormat.php @@ -228,7 +228,7 @@ class NumberFormat extends Supervisor /** * Fill built-in format codes. */ - private static function fillBuiltInFormatCodes() + private static function fillBuiltInFormatCodes(): void { // [MS-OI29500: Microsoft Office Implementation Information for ISO/IEC-29500 Standard Compliance] // 18.8.30. numFmt (Number Format) @@ -395,43 +395,43 @@ class NumberFormat extends Supervisor * @var array */ private static $dateFormatReplacements = [ - // first remove escapes related to non-format characters - '\\' => '', - // 12-hour suffix - 'am/pm' => 'A', - // 4-digit year - 'e' => 'Y', - 'yyyy' => 'Y', - // 2-digit year - 'yy' => 'y', - // first letter of month - no php equivalent - 'mmmmm' => 'M', - // full month name - 'mmmm' => 'F', - // short month name - 'mmm' => 'M', - // mm is minutes if time, but can also be month w/leading zero - // so we try to identify times be the inclusion of a : separator in the mask - // It isn't perfect, but the best way I know how - ':mm' => ':i', - 'mm:' => 'i:', - // month leading zero - 'mm' => 'm', - // month no leading zero - 'm' => 'n', - // full day of week name - 'dddd' => 'l', - // short day of week name - 'ddd' => 'D', - // days leading zero - 'dd' => 'd', - // days no leading zero - 'd' => 'j', - // seconds - 'ss' => 's', - // fractional seconds - no php equivalent - '.s' => '', - ]; + // first remove escapes related to non-format characters + '\\' => '', + // 12-hour suffix + 'am/pm' => 'A', + // 4-digit year + 'e' => 'Y', + 'yyyy' => 'Y', + // 2-digit year + 'yy' => 'y', + // first letter of month - no php equivalent + 'mmmmm' => 'M', + // full month name + 'mmmm' => 'F', + // short month name + 'mmm' => 'M', + // mm is minutes if time, but can also be month w/leading zero + // so we try to identify times be the inclusion of a : separator in the mask + // It isn't perfect, but the best way I know how + ':mm' => ':i', + 'mm:' => 'i:', + // month leading zero + 'mm' => 'm', + // month no leading zero + 'm' => 'n', + // full day of week name + 'dddd' => 'l', + // short day of week name + 'ddd' => 'D', + // days leading zero + 'dd' => 'd', + // days no leading zero + 'd' => 'j', + // seconds + 'ss' => 's', + // fractional seconds - no php equivalent + '.s' => '', + ]; /** * Search/replace values to convert Excel date/time format masks hours to PHP format masks (24 hr clock). @@ -463,7 +463,7 @@ class NumberFormat extends Supervisor return '\\' . implode('\\', str_split($matches[1])); } - private static function formatAsDate(&$value, &$format) + private static function formatAsDate(&$value, &$format): void { // strip off first part containing e.g. [$-F800] or [$USD-409] // general syntax: [$-] @@ -505,7 +505,7 @@ class NumberFormat extends Supervisor $value = $dateObj->format($format); } - private static function formatAsPercentage(&$value, &$format) + private static function formatAsPercentage(&$value, &$format): void { if ($format === self::FORMAT_PERCENTAGE) { $value = round((100 * $value), 0) . '%'; @@ -523,14 +523,14 @@ class NumberFormat extends Supervisor } } - private static function formatAsFraction(&$value, &$format) + private static function formatAsFraction(&$value, &$format): void { $sign = ($value < 0) ? '-' : ''; $integerPart = floor(abs($value)); $decimalPart = trim(fmod(abs($value), 1), '0.'); $decimalLength = strlen($decimalPart); - $decimalDivisor = pow(10, $decimalLength); + $decimalDivisor = 10 ** $decimalLength; $GCD = MathTrig::GCD($decimalPart, $decimalDivisor); @@ -686,7 +686,7 @@ class NumberFormat extends Supervisor $scale = 1; // same as no scale $matches = []; if (preg_match('/(#|0)(,+)/', $format, $matches)) { - $scale = pow(1000, strlen($matches[2])); + $scale = 1000 ** strlen($matches[2]); // strip the commas $format = preg_replace('/0,+/', '0', $format); diff --git a/src/PhpSpreadsheet/Style/Style.php b/src/PhpSpreadsheet/Style/Style.php index a37d99b5..533a7c38 100644 --- a/src/PhpSpreadsheet/Style/Style.php +++ b/src/PhpSpreadsheet/Style/Style.php @@ -483,8 +483,6 @@ class Style extends Supervisor /** * Set font. * - * @param Font $font - * * @return $this */ public function setFont(Font $font) @@ -634,7 +632,7 @@ class Style extends Supervisor * * @param int $pValue */ - public function setIndex($pValue) + public function setIndex($pValue): void { $this->index = $pValue; } diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter.php b/src/PhpSpreadsheet/Worksheet/AutoFilter.php index e6cd40e3..c085b596 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter.php @@ -38,7 +38,7 @@ class AutoFilter * @param string $pRange Cell range (i.e. A1:E10) * @param Worksheet $pSheet */ - public function __construct($pRange = '', Worksheet $pSheet = null) + public function __construct($pRange = '', ?Worksheet $pSheet = null) { $this->range = $pRange; $this->workSheet = $pSheet; @@ -61,7 +61,7 @@ class AutoFilter * * @return $this */ - public function setParent(Worksheet $pSheet = null) + public function setParent(?Worksheet $pSheet = null) { $this->workSheet = $pSheet; diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php index a36740a3..09584a7a 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php @@ -94,7 +94,7 @@ class Column * @param string $pColumn Column (e.g. A) * @param AutoFilter $pParent Autofilter for this column */ - public function __construct($pColumn, AutoFilter $pParent = null) + public function __construct($pColumn, ?AutoFilter $pParent = null) { $this->columnIndex = $pColumn; $this->parent = $pParent; @@ -147,7 +147,7 @@ class Column * * @return $this */ - public function setParent(AutoFilter $pParent = null) + public function setParent(?AutoFilter $pParent = null) { $this->parent = $pParent; @@ -308,8 +308,6 @@ class Column /** * Add a new AutoFilter Column Rule to the ruleset. * - * @param Column\Rule $pRule - * * @return $this */ public function addRule(Column\Rule $pRule) diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php index 28286cee..c0a15a7c 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php @@ -240,7 +240,7 @@ class Rule * * @param Column $pParent */ - public function __construct(Column $pParent = null) + public function __construct(?Column $pParent = null) { $this->parent = $pParent; } @@ -416,7 +416,7 @@ class Rule * * @return $this */ - public function setParent(Column $pParent = null) + public function setParent(?Column $pParent = null) { $this->parent = $pParent; diff --git a/src/PhpSpreadsheet/Worksheet/BaseDrawing.php b/src/PhpSpreadsheet/Worksheet/BaseDrawing.php index bcea3435..1b145a81 100644 --- a/src/PhpSpreadsheet/Worksheet/BaseDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/BaseDrawing.php @@ -205,7 +205,7 @@ class BaseDrawing implements IComparable * * @return $this */ - public function setWorksheet(Worksheet $pValue = null, $pOverrideOld = false) + public function setWorksheet(?Worksheet $pValue = null, $pOverrideOld = false) { if ($this->worksheet === null) { // Add drawing to \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet @@ -471,7 +471,7 @@ class BaseDrawing implements IComparable * * @return $this */ - public function setShadow(Drawing\Shadow $pValue = null) + public function setShadow(?Drawing\Shadow $pValue = null) { $this->shadow = $pValue; @@ -517,10 +517,7 @@ class BaseDrawing implements IComparable } } - /** - * @param null|Hyperlink $pHyperlink - */ - public function setHyperlink(Hyperlink $pHyperlink = null) + public function setHyperlink(?Hyperlink $pHyperlink = null): void { $this->hyperlink = $pHyperlink; } diff --git a/src/PhpSpreadsheet/Worksheet/CellIterator.php b/src/PhpSpreadsheet/Worksheet/CellIterator.php index 472609a3..45f76cab 100644 --- a/src/PhpSpreadsheet/Worksheet/CellIterator.php +++ b/src/PhpSpreadsheet/Worksheet/CellIterator.php @@ -2,7 +2,9 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; -abstract class CellIterator implements \Iterator +use Iterator; + +abstract class CellIterator implements Iterator { /** * Worksheet to iterate. @@ -23,7 +25,7 @@ abstract class CellIterator implements \Iterator */ public function __destruct() { - unset($this->worksheet); + $this->worksheet = null; } /** @@ -46,7 +48,7 @@ abstract class CellIterator implements \Iterator * * @param bool $value */ - public function setIterateOnlyExistingCells($value) + public function setIterateOnlyExistingCells($value): void { $this->onlyExistingCells = (bool) $value; diff --git a/src/PhpSpreadsheet/Worksheet/Column.php b/src/PhpSpreadsheet/Worksheet/Column.php index 098967f7..410e8073 100644 --- a/src/PhpSpreadsheet/Worksheet/Column.php +++ b/src/PhpSpreadsheet/Worksheet/Column.php @@ -24,7 +24,7 @@ class Column * @param Worksheet $parent * @param string $columnIndex */ - public function __construct(Worksheet $parent = null, $columnIndex = 'A') + public function __construct(?Worksheet $parent = null, $columnIndex = 'A') { // Set parent and column index $this->parent = $parent; @@ -36,7 +36,7 @@ class Column */ public function __destruct() { - unset($this->parent); + $this->parent = null; } /** diff --git a/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php b/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php index 184f4888..ec16fbe5 100644 --- a/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php +++ b/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php @@ -43,7 +43,7 @@ class ColumnCellIterator extends CellIterator * @param int $startRow The row number at which to start iterating * @param int $endRow Optionally, the row number at which to stop iterating */ - public function __construct(Worksheet $subject = null, $columnIndex = 'A', $startRow = 1, $endRow = null) + public function __construct(?Worksheet $subject = null, $columnIndex = 'A', $startRow = 1, $endRow = null) { // Set subject $this->worksheet = $subject; @@ -105,7 +105,7 @@ class ColumnCellIterator extends CellIterator /** * Rewind the iterator to the starting row. */ - public function rewind() + public function rewind(): void { $this->currentRow = $this->startRow; } @@ -133,7 +133,7 @@ class ColumnCellIterator extends CellIterator /** * Set the iterator to its next value. */ - public function next() + public function next(): void { do { ++$this->currentRow; @@ -145,7 +145,7 @@ class ColumnCellIterator extends CellIterator /** * Set the iterator to its previous value. */ - public function prev() + public function prev(): void { do { --$this->currentRow; @@ -167,7 +167,7 @@ class ColumnCellIterator extends CellIterator /** * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary. */ - protected function adjustForExistingOnlyRange() + protected function adjustForExistingOnlyRange(): void { if ($this->onlyExistingCells) { while ((!$this->worksheet->cellExistsByColumnAndRow($this->columnIndex, $this->startRow)) && diff --git a/src/PhpSpreadsheet/Worksheet/ColumnIterator.php b/src/PhpSpreadsheet/Worksheet/ColumnIterator.php index 0aff4859..d0bb20cc 100644 --- a/src/PhpSpreadsheet/Worksheet/ColumnIterator.php +++ b/src/PhpSpreadsheet/Worksheet/ColumnIterator.php @@ -2,11 +2,12 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; +use Iterator; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Exception; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; -class ColumnIterator implements \Iterator +class ColumnIterator implements Iterator { /** * Worksheet to iterate. @@ -56,7 +57,7 @@ class ColumnIterator implements \Iterator */ public function __destruct() { - unset($this->worksheet); + $this->worksheet = null; } /** @@ -118,7 +119,7 @@ class ColumnIterator implements \Iterator /** * Rewind the iterator to the starting column. */ - public function rewind() + public function rewind(): void { $this->currentColumnIndex = $this->startColumnIndex; } @@ -146,7 +147,7 @@ class ColumnIterator implements \Iterator /** * Set the iterator to its next value. */ - public function next() + public function next(): void { ++$this->currentColumnIndex; } @@ -154,7 +155,7 @@ class ColumnIterator implements \Iterator /** * Set the iterator to its previous value. */ - public function prev() + public function prev(): void { --$this->currentColumnIndex; } diff --git a/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php b/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php index c7594dae..01ffed94 100644 --- a/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php +++ b/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php @@ -222,7 +222,7 @@ class Shadow implements IComparable * * @return $this */ - public function setColor(Color $pValue = null) + public function setColor(?Color $pValue = null) { $this->color = $pValue; diff --git a/src/PhpSpreadsheet/Worksheet/HeaderFooter.php b/src/PhpSpreadsheet/Worksheet/HeaderFooter.php index be19abbd..cc37e7f5 100644 --- a/src/PhpSpreadsheet/Worksheet/HeaderFooter.php +++ b/src/PhpSpreadsheet/Worksheet/HeaderFooter.php @@ -400,7 +400,6 @@ class HeaderFooter /** * Add header/footer image. * - * @param HeaderFooterDrawing $image * @param string $location * * @return $this diff --git a/src/PhpSpreadsheet/Worksheet/Iterator.php b/src/PhpSpreadsheet/Worksheet/Iterator.php index d8797a34..6cfed37a 100644 --- a/src/PhpSpreadsheet/Worksheet/Iterator.php +++ b/src/PhpSpreadsheet/Worksheet/Iterator.php @@ -22,8 +22,6 @@ class Iterator implements \Iterator /** * Create a new worksheet iterator. - * - * @param Spreadsheet $subject */ public function __construct(Spreadsheet $subject) { @@ -36,13 +34,13 @@ class Iterator implements \Iterator */ public function __destruct() { - unset($this->subject); + $this->subject = null; } /** * Rewind iterator. */ - public function rewind() + public function rewind(): void { $this->position = 0; } @@ -70,7 +68,7 @@ class Iterator implements \Iterator /** * Next value. */ - public function next() + public function next(): void { ++$this->position; } diff --git a/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php b/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php index f0935585..22e09099 100644 --- a/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php @@ -53,7 +53,7 @@ class MemoryDrawing extends BaseDrawing $this->imageResource = null; $this->renderingFunction = self::RENDERING_DEFAULT; $this->mimeType = self::MIMETYPE_DEFAULT; - $this->uniqueName = md5(rand(0, 9999) . time() . rand(0, 9999)); + $this->uniqueName = md5(mt_rand(0, 9999) . time() . mt_rand(0, 9999)); // Initialize parent parent::__construct(); diff --git a/src/PhpSpreadsheet/Worksheet/Row.php b/src/PhpSpreadsheet/Worksheet/Row.php index 2a379d2c..4f48a346 100644 --- a/src/PhpSpreadsheet/Worksheet/Row.php +++ b/src/PhpSpreadsheet/Worksheet/Row.php @@ -24,7 +24,7 @@ class Row * @param Worksheet $worksheet * @param int $rowIndex */ - public function __construct(Worksheet $worksheet = null, $rowIndex = 1) + public function __construct(?Worksheet $worksheet = null, $rowIndex = 1) { // Set parent and row index $this->worksheet = $worksheet; @@ -36,7 +36,7 @@ class Row */ public function __destruct() { - unset($this->worksheet); + $this->worksheet = null; } /** diff --git a/src/PhpSpreadsheet/Worksheet/RowCellIterator.php b/src/PhpSpreadsheet/Worksheet/RowCellIterator.php index 09a5b0a1..f5576dc7 100644 --- a/src/PhpSpreadsheet/Worksheet/RowCellIterator.php +++ b/src/PhpSpreadsheet/Worksheet/RowCellIterator.php @@ -43,7 +43,7 @@ class RowCellIterator extends CellIterator * @param string $startColumn The column address at which to start iterating * @param string $endColumn Optionally, the column address at which to stop iterating */ - public function __construct(Worksheet $worksheet = null, $rowIndex = 1, $startColumn = 'A', $endColumn = null) + public function __construct(?Worksheet $worksheet = null, $rowIndex = 1, $startColumn = 'A', $endColumn = null) { // Set subject and row index $this->worksheet = $worksheet; @@ -107,7 +107,7 @@ class RowCellIterator extends CellIterator /** * Rewind the iterator to the starting column. */ - public function rewind() + public function rewind(): void { $this->currentColumnIndex = $this->startColumnIndex; } @@ -135,7 +135,7 @@ class RowCellIterator extends CellIterator /** * Set the iterator to its next value. */ - public function next() + public function next(): void { do { ++$this->currentColumnIndex; @@ -145,7 +145,7 @@ class RowCellIterator extends CellIterator /** * Set the iterator to its previous value. */ - public function prev() + public function prev(): void { do { --$this->currentColumnIndex; @@ -175,7 +175,7 @@ class RowCellIterator extends CellIterator /** * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary. */ - protected function adjustForExistingOnlyRange() + protected function adjustForExistingOnlyRange(): void { if ($this->onlyExistingCells) { while ((!$this->worksheet->cellExistsByColumnAndRow($this->startColumnIndex, $this->rowIndex)) && ($this->startColumnIndex <= $this->endColumnIndex)) { diff --git a/src/PhpSpreadsheet/Worksheet/RowIterator.php b/src/PhpSpreadsheet/Worksheet/RowIterator.php index 62cede7b..42542533 100644 --- a/src/PhpSpreadsheet/Worksheet/RowIterator.php +++ b/src/PhpSpreadsheet/Worksheet/RowIterator.php @@ -2,9 +2,10 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; +use Iterator; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; -class RowIterator implements \Iterator +class RowIterator implements Iterator { /** * Worksheet to iterate. @@ -54,7 +55,7 @@ class RowIterator implements \Iterator */ public function __destruct() { - unset($this->subject); + $this->subject = null; } /** @@ -113,7 +114,7 @@ class RowIterator implements \Iterator /** * Rewind the iterator to the starting row. */ - public function rewind() + public function rewind(): void { $this->position = $this->startRow; } @@ -141,7 +142,7 @@ class RowIterator implements \Iterator /** * Set the iterator to its next value. */ - public function next() + public function next(): void { ++$this->position; } @@ -149,7 +150,7 @@ class RowIterator implements \Iterator /** * Set the iterator to its previous value. */ - public function prev() + public function prev(): void { --$this->position; } diff --git a/src/PhpSpreadsheet/Worksheet/SheetView.php b/src/PhpSpreadsheet/Worksheet/SheetView.php index e19ff808..2f7d3812 100644 --- a/src/PhpSpreadsheet/Worksheet/SheetView.php +++ b/src/PhpSpreadsheet/Worksheet/SheetView.php @@ -126,7 +126,7 @@ class SheetView * * @param bool $pValue */ - public function setShowZeros($pValue) + public function setShowZeros($pValue): void { $this->showZeros = $pValue; } diff --git a/src/PhpSpreadsheet/Worksheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet/Worksheet.php index e8a61b78..1ed77e05 100644 --- a/src/PhpSpreadsheet/Worksheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -344,7 +344,7 @@ class Worksheet implements IComparable * @param Spreadsheet $parent * @param string $pTitle */ - public function __construct(Spreadsheet $parent = null, $pTitle = 'Worksheet') + public function __construct(?Spreadsheet $parent = null, $pTitle = 'Worksheet') { // Set parent and title $this->parent = $parent; @@ -363,9 +363,9 @@ class Worksheet implements IComparable // Set sheet view $this->sheetView = new SheetView(); // Drawing collection - $this->drawingCollection = new \ArrayObject(); + $this->drawingCollection = new ArrayObject(); // Chart collection - $this->chartCollection = new \ArrayObject(); + $this->chartCollection = new ArrayObject(); // Protection $this->protection = new Protection(); // Default row dimension @@ -379,7 +379,7 @@ class Worksheet implements IComparable * Disconnect all cells from this Worksheet object, * typically so that the worksheet object can be unset. */ - public function disconnectCells() + public function disconnectCells(): void { if ($this->cellCollection !== null) { $this->cellCollection->unsetWorksheetCells(); @@ -552,7 +552,6 @@ class Worksheet implements IComparable /** * Add chart. * - * @param Chart $pChart * @param null|int $iChartIndex Index where chart should go (0,1,..., or null for last) * * @return Chart @@ -791,8 +790,6 @@ class Worksheet implements IComparable /** * Re-bind parent. * - * @param Spreadsheet $parent - * * @return $this */ public function rebindParent(Spreadsheet $parent) @@ -931,8 +928,6 @@ class Worksheet implements IComparable /** * Set page setup. * - * @param PageSetup $pValue - * * @return $this */ public function setPageSetup(PageSetup $pValue) @@ -955,8 +950,6 @@ class Worksheet implements IComparable /** * Set page margins. * - * @param PageMargins $pValue - * * @return $this */ public function setPageMargins(PageMargins $pValue) @@ -979,8 +972,6 @@ class Worksheet implements IComparable /** * Set page header/footer. * - * @param HeaderFooter $pValue - * * @return $this */ public function setHeaderFooter(HeaderFooter $pValue) @@ -1003,8 +994,6 @@ class Worksheet implements IComparable /** * Set sheet view. * - * @param SheetView $pValue - * * @return $this */ public function setSheetView(SheetView $pValue) @@ -1027,8 +1016,6 @@ class Worksheet implements IComparable /** * Set Protection. * - * @param Protection $pValue - * * @return $this */ public function setProtection(Protection $pValue) @@ -1771,8 +1758,6 @@ class Worksheet implements IComparable * Set merge cells array for the entire sheet. Use instead mergeCells() to merge * a single cell range. * - * @param array $pValue - * * @return $this */ public function setMergeCells(array $pValue) @@ -2733,11 +2718,10 @@ class Worksheet implements IComparable * Set hyperlink. * * @param string $pCellCoordinate Cell coordinate to insert hyperlink, eg: 'A1' - * @param null|Hyperlink $pHyperlink * * @return $this */ - public function setHyperlink($pCellCoordinate, Hyperlink $pHyperlink = null) + public function setHyperlink($pCellCoordinate, ?Hyperlink $pHyperlink = null) { if ($pHyperlink === null) { unset($this->hyperlinkCollection[$pCellCoordinate]); @@ -2794,11 +2778,10 @@ class Worksheet implements IComparable * Set data validation. * * @param string $pCellCoordinate Cell coordinate to insert data validation, eg: 'A1' - * @param null|DataValidation $pDataValidation * * @return $this */ - public function setDataValidation($pCellCoordinate, DataValidation $pDataValidation = null) + public function setDataValidation($pCellCoordinate, ?DataValidation $pDataValidation = null) { if ($pDataValidation === null) { unset($this->dataValidationCollection[$pCellCoordinate]); @@ -2889,7 +2872,7 @@ class Worksheet implements IComparable public function resetTabColor() { $this->tabColor = null; - unset($this->tabColor); + $this->tabColor = null; return $this; } diff --git a/src/PhpSpreadsheet/Writer/Csv.php b/src/PhpSpreadsheet/Writer/Csv.php index 4344a5bd..414bdf90 100644 --- a/src/PhpSpreadsheet/Writer/Csv.php +++ b/src/PhpSpreadsheet/Writer/Csv.php @@ -79,7 +79,7 @@ class Csv extends BaseWriter * * @param resource|string $pFilename */ - public function save($pFilename) + public function save($pFilename): void { // Fetch sheet $sheet = $this->spreadsheet->getSheet($this->sheetIndex); @@ -302,7 +302,7 @@ class Csv extends BaseWriter * @param resource $pFileHandle PHP filehandle * @param array $pValues Array containing values in a row */ - private function writeLine($pFileHandle, array $pValues) + private function writeLine($pFileHandle, array $pValues): void { // No leading delimiter $writeDelimiter = false; diff --git a/src/PhpSpreadsheet/Writer/Html.php b/src/PhpSpreadsheet/Writer/Html.php index bb509806..65b04c7d 100644 --- a/src/PhpSpreadsheet/Writer/Html.php +++ b/src/PhpSpreadsheet/Writer/Html.php @@ -133,8 +133,6 @@ class Html extends BaseWriter /** * Create a new HTML. - * - * @param Spreadsheet $spreadsheet */ public function __construct(Spreadsheet $spreadsheet) { @@ -147,7 +145,7 @@ class Html extends BaseWriter * * @param resource|string $pFilename */ - public function save($pFilename) + public function save($pFilename): void { // Open file $this->openFileHandle($pFilename); @@ -204,7 +202,7 @@ class Html extends BaseWriter Alignment::VERTICAL_TOP => 'top', Alignment::VERTICAL_CENTER => 'middle', Alignment::VERTICAL_JUSTIFY => 'middle', - ]; + ]; /** * Map VAlign. @@ -224,7 +222,7 @@ class Html extends BaseWriter Alignment::HORIZONTAL_CENTER => 'center', Alignment::HORIZONTAL_CENTER_CONTINUOUS => 'center', Alignment::HORIZONTAL_JUSTIFY => 'justify', - ]; + ]; /** * Map HAlign. @@ -251,7 +249,7 @@ class Html extends BaseWriter Border::BORDER_MEDIUMDASHDOTDOT => '2px dotted', Border::BORDER_SLANTDASHDOT => '2px dashed', Border::BORDER_THICK => '3px solid', - ]; + ]; /** * Map border style. @@ -805,7 +803,7 @@ class Html extends BaseWriter return $html; } - private function buildCssRowHeights(Worksheet $sheet, array &$css, int $sheetIndex) + private function buildCssRowHeights(Worksheet $sheet, array &$css, int $sheetIndex): void { // Calculate row heights foreach ($sheet->getRowDimensions() as $rowDimension) { @@ -825,7 +823,7 @@ class Html extends BaseWriter } } - private function buildCssPerSheet(Worksheet $sheet, array &$css) + private function buildCssPerSheet(Worksheet $sheet, array &$css): void { // Calculate hash code $sheetIndex = $sheet->getParent()->getIndex($sheet); @@ -975,8 +973,6 @@ class Html extends BaseWriter /** * Create CSS style. * - * @param Style $pStyle - * * @return array */ private function createCSSStyle(Style $pStyle) @@ -1018,8 +1014,6 @@ class Html extends BaseWriter /** * Create CSS style (\PhpOffice\PhpSpreadsheet\Style\Font). * - * @param Font $pStyle - * * @return array */ private function createCSSStyleFont(Font $pStyle) @@ -1138,7 +1132,7 @@ class Html extends BaseWriter return $html; } - private function generateTableTag($pSheet, $id, &$html, $sheetIndex) + private function generateTableTag($pSheet, $id, &$html, $sheetIndex): void { if (!$this->useInlineCss) { $gridlines = $pSheet->getShowGridlines() ? ' gridlines' : ''; @@ -1266,7 +1260,7 @@ class Html extends BaseWriter return [$cell, $cssClass, $coordinate]; } - private function generateRowCellDataValueRich($cell, &$cellData) + private function generateRowCellDataValueRich($cell, &$cellData): void { // Loop through rich text elements $elements = $cell->getValue()->getRichTextElements(); @@ -1299,7 +1293,7 @@ class Html extends BaseWriter } } - private function generateRowCellDataValue($pSheet, $cell, &$cellData) + private function generateRowCellDataValue($pSheet, $cell, &$cellData): void { if ($cell->getValue() instanceof RichText) { $this->generateRowCellDataValueRich($cell, $cellData); @@ -1386,7 +1380,7 @@ class Html extends BaseWriter return $html; } - private function generateRowWriteCell(&$html, $pSheet, $coordinate, $cellType, $cellData, $colSpan, $rowSpan, $cssClass, $colNum, $sheetIndex, $pRow) + private function generateRowWriteCell(&$html, $pSheet, $coordinate, $cellType, $cellData, $colSpan, $rowSpan, $cssClass, $colNum, $sheetIndex, $pRow): void { // Image? $htmlx = $this->writeImageInCell($pSheet, $coordinate); @@ -1519,8 +1513,6 @@ class Html extends BaseWriter /** * Takes array where of CSS properties / values and converts to CSS string. * - * @param array $pValue - * * @return string */ private function assembleCSS(array $pValue = []) @@ -1672,7 +1664,7 @@ class Html extends BaseWriter /** * Calculate information about HTML colspan and rowspan which is not always the same as Excel's. */ - private function calculateSpans() + private function calculateSpans(): void { if ($this->spansAreCalculated) { return; @@ -1735,7 +1727,7 @@ class Html extends BaseWriter $this->spansAreCalculated = true; } - private function calculateSpansOmitRows($sheet, $sheetIndex, $candidateSpannedRow) + private function calculateSpansOmitRows($sheet, $sheetIndex, $candidateSpannedRow): void { // Identify which rows should be omitted in HTML. These are the rows where all the cells // participate in a merge and the where base cells are somewhere above. @@ -1772,7 +1764,6 @@ class Html extends BaseWriter * * @see https://github.com/LibreOffice/core/blob/9fc9bf3240f8c62ad7859947ab8a033ac1fe93fa/sc/source/filter/html/htmlexp.cxx#L1073-L1092 * - * @param Worksheet $pSheet * @param string $coordinate * * @return string diff --git a/src/PhpSpreadsheet/Writer/IWriter.php b/src/PhpSpreadsheet/Writer/IWriter.php index 27329537..5129d655 100644 --- a/src/PhpSpreadsheet/Writer/IWriter.php +++ b/src/PhpSpreadsheet/Writer/IWriter.php @@ -8,8 +8,6 @@ interface IWriter { /** * IWriter constructor. - * - * @param Spreadsheet $spreadsheet */ public function __construct(Spreadsheet $spreadsheet); diff --git a/src/PhpSpreadsheet/Writer/Ods.php b/src/PhpSpreadsheet/Writer/Ods.php index e3a0ca98..36f3e9ca 100644 --- a/src/PhpSpreadsheet/Writer/Ods.php +++ b/src/PhpSpreadsheet/Writer/Ods.php @@ -34,8 +34,6 @@ class Ods extends BaseWriter /** * Create a new Ods. - * - * @param Spreadsheet $spreadsheet */ public function __construct(Spreadsheet $spreadsheet) { @@ -77,7 +75,7 @@ class Ods extends BaseWriter * * @param resource|string $pFilename */ - public function save($pFilename) + public function save($pFilename): void { if (!$this->spreadSheet) { throw new WriterException('PhpSpreadsheet object unassigned.'); diff --git a/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php b/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php index 2f543be5..880a8554 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php +++ b/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php @@ -13,7 +13,7 @@ use PhpOffice\PhpSpreadsheet\Shared\XMLWriter; */ class Comment { - public static function write(XMLWriter $objWriter, Cell $cell) + public static function write(XMLWriter $objWriter, Cell $cell): void { $comments = $cell->getWorksheet()->getComments(); if (!isset($comments[$cell->getCoordinate()])) { diff --git a/src/PhpSpreadsheet/Writer/Ods/Content.php b/src/PhpSpreadsheet/Writer/Ods/Content.php index cbf303bd..cb6c6628 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Content.php +++ b/src/PhpSpreadsheet/Writer/Ods/Content.php @@ -106,13 +106,10 @@ class Content extends WriterPart /** * Write sheets. - * - * @param XMLWriter $objWriter */ - private function writeSheets(XMLWriter $objWriter) + private function writeSheets(XMLWriter $objWriter): void { - $spreadsheet = $this->getParentWriter()->getSpreadsheet(); // @var $spreadsheet Spreadsheet - + $spreadsheet = $this->getParentWriter()->getSpreadsheet(); /** @var Spreadsheet $spreadsheet */ $sheetCount = $spreadsheet->getSheetCount(); for ($i = 0; $i < $sheetCount; ++$i) { $objWriter->startElement('table:table'); @@ -128,11 +125,8 @@ class Content extends WriterPart /** * Write rows of the specified sheet. - * - * @param XMLWriter $objWriter - * @param Worksheet $sheet */ - private function writeRows(XMLWriter $objWriter, Worksheet $sheet) + private function writeRows(XMLWriter $objWriter, Worksheet $sheet): void { $numberRowsRepeated = self::NUMBER_ROWS_REPEATED_MAX; $span_row = 0; @@ -164,11 +158,8 @@ class Content extends WriterPart /** * Write cells of the specified row. - * - * @param XMLWriter $objWriter - * @param Row $row */ - private function writeCells(XMLWriter $objWriter, Row $row) + private function writeCells(XMLWriter $objWriter, Row $row): void { $numberColsRepeated = self::NUMBER_COLS_REPEATED_MAX; $prevColumn = -1; @@ -254,11 +245,10 @@ class Content extends WriterPart /** * Write span. * - * @param XMLWriter $objWriter * @param int $curColumn * @param int $prevColumn */ - private function writeCellSpan(XMLWriter $objWriter, $curColumn, $prevColumn) + private function writeCellSpan(XMLWriter $objWriter, $curColumn, $prevColumn): void { $diff = $curColumn - $prevColumn - 1; if (1 === $diff) { @@ -272,11 +262,8 @@ class Content extends WriterPart /** * Write XF cell styles. - * - * @param XMLWriter $writer - * @param Spreadsheet $spreadsheet */ - private function writeXfStyles(XMLWriter $writer, Spreadsheet $spreadsheet) + private function writeXfStyles(XMLWriter $writer, Spreadsheet $spreadsheet): void { foreach ($spreadsheet->getCellXfCollection() as $style) { $writer->startElement('style:style'); @@ -366,11 +353,8 @@ class Content extends WriterPart /** * Write attributes for merged cell. - * - * @param XMLWriter $objWriter - * @param Cell $cell */ - private function writeCellMerge(XMLWriter $objWriter, Cell $cell) + private function writeCellMerge(XMLWriter $objWriter, Cell $cell): void { if (!$cell->isMergeRangeValueCell()) { return; diff --git a/src/PhpSpreadsheet/Writer/Ods/Meta.php b/src/PhpSpreadsheet/Writer/Ods/Meta.php index eb2ebf9e..365221f7 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Meta.php +++ b/src/PhpSpreadsheet/Writer/Ods/Meta.php @@ -14,7 +14,7 @@ class Meta extends WriterPart * * @return string XML Output */ - public function write(Spreadsheet $spreadsheet = null) + public function write(?Spreadsheet $spreadsheet = null) { if (!$spreadsheet) { $spreadsheet = $this->getParentWriter()->getSpreadsheet(); diff --git a/src/PhpSpreadsheet/Writer/Ods/Mimetype.php b/src/PhpSpreadsheet/Writer/Ods/Mimetype.php index d0fed2b3..4aac3685 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Mimetype.php +++ b/src/PhpSpreadsheet/Writer/Ods/Mimetype.php @@ -13,7 +13,7 @@ class Mimetype extends WriterPart * * @return string XML Output */ - public function write(Spreadsheet $spreadsheet = null) + public function write(?Spreadsheet $spreadsheet = null) { return 'application/vnd.oasis.opendocument.spreadsheet'; } diff --git a/src/PhpSpreadsheet/Writer/Ods/Settings.php b/src/PhpSpreadsheet/Writer/Ods/Settings.php index 11d13341..d458e8c2 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Settings.php +++ b/src/PhpSpreadsheet/Writer/Ods/Settings.php @@ -14,7 +14,7 @@ class Settings extends WriterPart * * @return string XML Output */ - public function write(Spreadsheet $spreadsheet = null) + public function write(?Spreadsheet $spreadsheet = null) { $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { diff --git a/src/PhpSpreadsheet/Writer/Ods/Styles.php b/src/PhpSpreadsheet/Writer/Ods/Styles.php index cd71566f..7ba7eba7 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Styles.php +++ b/src/PhpSpreadsheet/Writer/Ods/Styles.php @@ -14,7 +14,7 @@ class Styles extends WriterPart * * @return string XML Output */ - public function write(Spreadsheet $spreadsheet = null) + public function write(?Spreadsheet $spreadsheet = null) { $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { diff --git a/src/PhpSpreadsheet/Writer/Ods/Thumbnails.php b/src/PhpSpreadsheet/Writer/Ods/Thumbnails.php index a29a14ad..dfab0654 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Thumbnails.php +++ b/src/PhpSpreadsheet/Writer/Ods/Thumbnails.php @@ -13,7 +13,7 @@ class Thumbnails extends WriterPart * * @return string XML Output */ - public function writeThumbnail(Spreadsheet $spreadsheet = null) + public function writeThumbnail(?Spreadsheet $spreadsheet = null) { return ''; } diff --git a/src/PhpSpreadsheet/Writer/Ods/WriterPart.php b/src/PhpSpreadsheet/Writer/Ods/WriterPart.php index 3e2f9684..1982c450 100644 --- a/src/PhpSpreadsheet/Writer/Ods/WriterPart.php +++ b/src/PhpSpreadsheet/Writer/Ods/WriterPart.php @@ -25,8 +25,6 @@ abstract class WriterPart /** * Set parent Ods writer. - * - * @param Ods $writer */ public function __construct(Ods $writer) { diff --git a/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php b/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php index 3ecaff68..9ae2ccee 100644 --- a/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php +++ b/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php @@ -22,7 +22,7 @@ class Dompdf extends Pdf * * @param string $pFilename Name of the file to save as */ - public function save($pFilename) + public function save($pFilename): void { $fileHandle = parent::prepareForSave($pFilename); diff --git a/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php b/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php index 44241575..75e0010d 100644 --- a/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php +++ b/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php @@ -24,7 +24,7 @@ class Mpdf extends Pdf * * @param string $pFilename Name of the file to save as */ - public function save($pFilename) + public function save($pFilename): void { $fileHandle = parent::prepareForSave($pFilename); diff --git a/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php b/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php index 3dc172a2..7530b1ef 100644 --- a/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php +++ b/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php @@ -38,7 +38,7 @@ class Tcpdf extends Pdf * * @param string $pFilename Name of the file to save as */ - public function save($pFilename) + public function save($pFilename): void { $fileHandle = parent::prepareForSave($pFilename); diff --git a/src/PhpSpreadsheet/Writer/Xls.php b/src/PhpSpreadsheet/Writer/Xls.php index 06611789..cf87d5be 100644 --- a/src/PhpSpreadsheet/Writer/Xls.php +++ b/src/PhpSpreadsheet/Writer/Xls.php @@ -117,7 +117,7 @@ class Xls extends BaseWriter * * @param resource|string $pFilename */ - public function save($pFilename) + public function save($pFilename): void { // garbage collect $this->spreadsheet->garbageCollect(); @@ -230,7 +230,7 @@ class Xls extends BaseWriter /** * Build the Worksheet Escher objects. */ - private function buildWorksheetEschers() + private function buildWorksheetEschers(): void { // 1-based index to BstoreContainer $blipIndex = 0; @@ -392,7 +392,7 @@ class Xls extends BaseWriter /** * Build the Escher object corresponding to the MSODRAWINGGROUP record. */ - private function buildWorkbookEscher() + private function buildWorkbookEscher(): void { $escher = null; @@ -716,7 +716,7 @@ class Xls extends BaseWriter } elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length // Null-terminated string $dataProp['data']['data'] .= chr(0); - $dataProp['data']['length'] += 1; + ++$dataProp['data']['length']; // Complete the string with null string for being a %4 $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4) == 4 ? 0 : (4 - $dataProp['data']['length'] % 4)); $dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT); @@ -912,7 +912,7 @@ class Xls extends BaseWriter } elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length // Null-terminated string $dataProp['data']['data'] .= chr(0); - $dataProp['data']['length'] += 1; + ++$dataProp['data']['length']; // Complete the string with null string for being a %4 $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4) == 4 ? 0 : (4 - $dataProp['data']['length'] % 4)); $dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT); diff --git a/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php b/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php index 3b2eb9af..84e27d0d 100644 --- a/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php +++ b/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php @@ -109,7 +109,7 @@ class BIFFwriter * * @param string $data binary data to append */ - protected function append($data) + protected function append($data): void { if (strlen($data) - 4 > $this->limit) { $data = $this->addContinue($data); @@ -142,7 +142,7 @@ class BIFFwriter * @param int $type type of BIFF file to write: 0x0005 Workbook, * 0x0010 Worksheet */ - protected function storeBof($type) + protected function storeBof($type): void { $record = 0x0809; // Record identifier (BIFF5-BIFF8) $length = 0x0010; @@ -163,7 +163,7 @@ class BIFFwriter /** * Writes Excel EOF record to indicate the end of a BIFF stream. */ - protected function storeEof() + protected function storeEof(): void { $record = 0x000A; // Record identifier $length = 0x0000; // Number of bytes to follow diff --git a/src/PhpSpreadsheet/Writer/Xls/Font.php b/src/PhpSpreadsheet/Writer/Xls/Font.php index df37dcb5..9cb31ead 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Font.php +++ b/src/PhpSpreadsheet/Writer/Xls/Font.php @@ -22,8 +22,6 @@ class Font /** * Constructor. - * - * @param \PhpOffice\PhpSpreadsheet\Style\Font $font */ public function __construct(\PhpOffice\PhpSpreadsheet\Style\Font $font) { @@ -36,7 +34,7 @@ class Font * * @param int $colorIndex */ - public function setColorIndex($colorIndex) + public function setColorIndex($colorIndex): void { $this->colorIndex = $colorIndex; } diff --git a/src/PhpSpreadsheet/Writer/Xls/Parser.php b/src/PhpSpreadsheet/Writer/Xls/Parser.php index 59820628..5e3316ab 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Parser.php +++ b/src/PhpSpreadsheet/Writer/Xls/Parser.php @@ -516,7 +516,7 @@ class Parser } elseif (isset($this->ptg[$token])) { return pack('C', $this->ptg[$token]); // match error codes - } elseif (preg_match('/^#[A-Z0\\/]{3,5}[!?]{1}$/', $token) or $token == '#N/A') { + } elseif (preg_match('/^#[A-Z0\\/]{3,5}[!?]{1}$/', $token) || $token == '#N/A') { return $this->convertError($token); // commented so argument number can be processed correctly. See toReversePolish(). /*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/", $token)) @@ -542,7 +542,7 @@ class Parser private function convertNumber($num) { // Integer in the range 0..2**16-1 - if ((preg_match('/^\\d+$/', $num)) and ($num <= 65535)) { + if ((preg_match('/^\\d+$/', $num)) && ($num <= 65535)) { return pack('Cv', $this->ptg['ptgInt'], $num); } @@ -828,7 +828,7 @@ class Parser * @param string $name The name of the worksheet being added * @param int $index The index of the worksheet being added */ - public function setExtSheet($name, $index) + public function setExtSheet($name, $index): void { $this->externalSheets[$name] = $index; } @@ -885,7 +885,7 @@ class Parser $col2 = 65535; // FIXME: maximum possible value for Excel 5 (change this!!!) // FIXME: this changes for BIFF8 - if (($row1 >= 65536) or ($row2 >= 65536)) { + if (($row1 >= 65536) || ($row2 >= 65536)) { throw new WriterException("Row in: $range greater than 65536 "); } @@ -924,7 +924,7 @@ class Parser $col = 0; $col_ref_length = strlen($col_ref); for ($i = 0; $i < $col_ref_length; ++$i) { - $col += (ord($col_ref[$i]) - 64) * pow(26, $expn); + $col += (ord($col_ref[$i]) - 64) * 26 ** $expn; --$expn; } @@ -1018,7 +1018,7 @@ class Parser break; case '<': // it's a LE or a NE token - if (($this->lookAhead === '=') or ($this->lookAhead === '>')) { + if (($this->lookAhead === '=') || ($this->lookAhead === '>')) { break; } @@ -1027,33 +1027,33 @@ class Parser break; default: // if it's a reference A1 or $A$1 or $A1 or A$1 - if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?\d+$/', $token) and !preg_match('/\d/', $this->lookAhead) and ($this->lookAhead !== ':') and ($this->lookAhead !== '.') and ($this->lookAhead !== '!')) { + if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?\d+$/', $token) && !preg_match('/\d/', $this->lookAhead) && ($this->lookAhead !== ':') && ($this->lookAhead !== '.') && ($this->lookAhead !== '!')) { return $token; - } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?[A-Ia-i]?[A-Za-z]\$?\\d+$/u', $token) and !preg_match('/\d/', $this->lookAhead) and ($this->lookAhead !== ':') and ($this->lookAhead !== '.')) { + } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?[A-Ia-i]?[A-Za-z]\$?\\d+$/u', $token) && !preg_match('/\d/', $this->lookAhead) && ($this->lookAhead !== ':') && ($this->lookAhead !== '.')) { // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1) return $token; - } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?[A-Ia-i]?[A-Za-z]\\$?\\d+$/u", $token) and !preg_match('/\d/', $this->lookAhead) and ($this->lookAhead !== ':') and ($this->lookAhead !== '.')) { + } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?[A-Ia-i]?[A-Za-z]\\$?\\d+$/u", $token) && !preg_match('/\d/', $this->lookAhead) && ($this->lookAhead !== ':') && ($this->lookAhead !== '.')) { // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1) return $token; } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+:(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+$/', $token) && !preg_match('/\d/', $this->lookAhead)) { // if it's a range A1:A2 or $A$1:$A$2 return $token; - } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?([A-Ia-i]?[A-Za-z])?\$?\\d+:\$?([A-Ia-i]?[A-Za-z])?\$?\\d+$/u', $token) and !preg_match('/\d/', $this->lookAhead)) { + } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?([A-Ia-i]?[A-Za-z])?\$?\\d+:\$?([A-Ia-i]?[A-Za-z])?\$?\\d+$/u', $token) && !preg_match('/\d/', $this->lookAhead)) { // If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2 return $token; - } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?([A-Ia-i]?[A-Za-z])?\\$?\\d+:\\$?([A-Ia-i]?[A-Za-z])?\\$?\\d+$/u", $token) and !preg_match('/\d/', $this->lookAhead)) { + } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?([A-Ia-i]?[A-Za-z])?\\$?\\d+:\\$?([A-Ia-i]?[A-Za-z])?\\$?\\d+$/u", $token) && !preg_match('/\d/', $this->lookAhead)) { // If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2 return $token; - } elseif (is_numeric($token) and (!is_numeric($token . $this->lookAhead) or ($this->lookAhead == '')) and ($this->lookAhead !== '!') and ($this->lookAhead !== ':')) { + } elseif (is_numeric($token) && (!is_numeric($token . $this->lookAhead) || ($this->lookAhead == '')) && ($this->lookAhead !== '!') && ($this->lookAhead !== ':')) { // If it's a number (check that it's not a sheet name or range) return $token; - } elseif (preg_match('/"([^"]|""){0,255}"/', $token) and $this->lookAhead !== '"' and (substr_count($token, '"') % 2 == 0)) { + } elseif (preg_match('/"([^"]|""){0,255}"/', $token) && $this->lookAhead !== '"' && (substr_count($token, '"') % 2 == 0)) { // If it's a string (of maximum 255 characters) return $token; - } elseif (preg_match('/^#[A-Z0\\/]{3,5}[!?]{1}$/', $token) or $token === '#N/A') { + } elseif (preg_match('/^#[A-Z0\\/]{3,5}[!?]{1}$/', $token) || $token === '#N/A') { // If it's an error code return $token; - } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\\.]+$/i", $token) and ($this->lookAhead === '(')) { + } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\\.]+$/i", $token) && ($this->lookAhead === '(')) { // if it's a function call return $token; } elseif (substr($token, -1) === ')') { @@ -1151,7 +1151,7 @@ class Parser return $result; // If it's an error code - } elseif (preg_match('/^#[A-Z0\\/]{3,5}[!?]{1}$/', $this->currentToken) or $this->currentToken == '#N/A') { + } elseif (preg_match('/^#[A-Z0\\/]{3,5}[!?]{1}$/', $this->currentToken) || $this->currentToken == '#N/A') { $result = $this->createTree($this->currentToken, 'ptgErr', ''); $this->advance(); @@ -1172,8 +1172,8 @@ class Parser return $this->createTree('ptgUplus', $result2, ''); } $result = $this->term(); - while (($this->currentToken == '+') or - ($this->currentToken == '-') or + while (($this->currentToken == '+') || + ($this->currentToken == '-') || ($this->currentToken == '^')) { if ($this->currentToken == '+') { $this->advance(); @@ -1215,7 +1215,7 @@ class Parser private function term() { $result = $this->fact(); - while (($this->currentToken == '*') or + while (($this->currentToken == '*') || ($this->currentToken == '/')) { if ($this->currentToken == '*') { $this->advance(); @@ -1270,7 +1270,7 @@ class Parser $this->advance(); return $result; - } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+:(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+$/', $this->currentToken) or + } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+:(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+$/', $this->currentToken) || preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+$/', $this->currentToken)) { // if it's a range A1:B2 or $A$1:$B$2 // must be an error? @@ -1344,7 +1344,7 @@ class Parser } $args = $this->functions[$function][1]; // If fixed number of args eg. TIME($i, $j, $k). Check that the number of args is valid. - if (($args >= 0) and ($args != $num_args)) { + if (($args >= 0) && ($args != $num_args)) { throw new WriterException("Incorrect number of arguments in function $function() "); } @@ -1417,10 +1417,10 @@ class Parser $polish .= $converted_tree; } // if it's a function convert it here (so we can set it's arguments) - if (preg_match("/^[A-Z0-9\xc0-\xdc\\.]+$/", $tree['value']) and - !preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/', $tree['value']) and - !preg_match('/^[A-Ia-i]?[A-Za-z](\\d+)\\.\\.[A-Ia-i]?[A-Za-z](\\d+)$/', $tree['value']) and - !is_numeric($tree['value']) and + if (preg_match("/^[A-Z0-9\xc0-\xdc\\.]+$/", $tree['value']) && + !preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/', $tree['value']) && + !preg_match('/^[A-Ia-i]?[A-Za-z](\\d+)\\.\\.[A-Ia-i]?[A-Za-z](\\d+)$/', $tree['value']) && + !is_numeric($tree['value']) && !isset($this->ptg[$tree['value']])) { // left subtree for a function is always an array. if ($tree['left'] != '') { diff --git a/src/PhpSpreadsheet/Writer/Xls/Workbook.php b/src/PhpSpreadsheet/Writer/Xls/Workbook.php index 41c8e64e..d5f61bf2 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Workbook.php +++ b/src/PhpSpreadsheet/Writer/Xls/Workbook.php @@ -222,7 +222,6 @@ class Workbook extends BIFFwriter /** * Add a new XF writer. * - * @param Style $style * @param bool $isStyleXf Is it a style XF? * * @return int Index to XF record @@ -273,8 +272,6 @@ class Workbook extends BIFFwriter /** * Add a font to added fonts. * - * @param \PhpOffice\PhpSpreadsheet\Style\Font $font - * * @return int Index to FONT record */ public function addFont(\PhpOffice\PhpSpreadsheet\Style\Font $font) @@ -343,7 +340,7 @@ class Workbook extends BIFFwriter /** * Sets the colour palette to the Excel 97+ default. */ - private function setPaletteXl97() + private function setPaletteXl97(): void { $this->palette = [ 0x08 => [0x00, 0x00, 0x00, 0x00], @@ -465,7 +462,7 @@ class Workbook extends BIFFwriter /** * Calculate offsets for Worksheet BOF records. */ - private function calcSheetOffsets() + private function calcSheetOffsets(): void { $boundsheet_length = 10; // fixed length for a BOUNDSHEET record @@ -489,7 +486,7 @@ class Workbook extends BIFFwriter /** * Store the Excel FONT records. */ - private function writeAllFonts() + private function writeAllFonts(): void { foreach ($this->fontWriters as $fontWriter) { $this->append($fontWriter->writeFont()); @@ -499,7 +496,7 @@ class Workbook extends BIFFwriter /** * Store user defined numerical formats i.e. FORMAT records. */ - private function writeAllNumberFormats() + private function writeAllNumberFormats(): void { foreach ($this->numberFormats as $numberFormatIndex => $numberFormat) { $this->writeNumberFormat($numberFormat->getFormatCode(), $numberFormatIndex); @@ -509,7 +506,7 @@ class Workbook extends BIFFwriter /** * Write all XF records. */ - private function writeAllXfs() + private function writeAllXfs(): void { foreach ($this->xfWriters as $xfWriter) { $this->append($xfWriter->writeXf()); @@ -519,7 +516,7 @@ class Workbook extends BIFFwriter /** * Write all STYLE records. */ - private function writeAllStyles() + private function writeAllStyles(): void { $this->writeStyle(); } @@ -554,7 +551,7 @@ class Workbook extends BIFFwriter $formulaData = $this->parser->toReversePolish(); // make sure tRef3d is of type tRef3dR (0x3A) - if (isset($formulaData[0]) and ($formulaData[0] == "\x7A" or $formulaData[0] == "\x5A")) { + if (isset($formulaData[0]) && ($formulaData[0] == "\x7A" || $formulaData[0] == "\x5A")) { $formulaData = "\x3A" . substr($formulaData, 1); } @@ -754,7 +751,7 @@ class Workbook extends BIFFwriter /** * Stores the CODEPAGE biff record. */ - private function writeCodepage() + private function writeCodepage(): void { $record = 0x0042; // Record identifier $length = 0x0002; // Number of bytes to follow @@ -769,7 +766,7 @@ class Workbook extends BIFFwriter /** * Write Excel BIFF WINDOW1 record. */ - private function writeWindow1() + private function writeWindow1(): void { $record = 0x003D; // Record identifier $length = 0x0012; // Number of bytes to follow @@ -801,7 +798,7 @@ class Workbook extends BIFFwriter * @param Worksheet $sheet Worksheet name * @param int $offset Location of worksheet BOF */ - private function writeBoundSheet($sheet, $offset) + private function writeBoundSheet($sheet, $offset): void { $sheetname = $sheet->getTitle(); $record = 0x0085; // Record identifier @@ -876,7 +873,7 @@ class Workbook extends BIFFwriter /** * Write Excel BIFF STYLE records. */ - private function writeStyle() + private function writeStyle(): void { $record = 0x0293; // Record identifier $length = 0x0004; // Bytes to follow @@ -896,7 +893,7 @@ class Workbook extends BIFFwriter * @param string $format Custom format string * @param int $ifmt Format index code */ - private function writeNumberFormat($format, $ifmt) + private function writeNumberFormat($format, $ifmt): void { $record = 0x041E; // Record identifier @@ -911,7 +908,7 @@ class Workbook extends BIFFwriter /** * Write DATEMODE record to indicate the date system in use (1904 or 1900). */ - private function writeDateMode() + private function writeDateMode(): void { $record = 0x0022; // Record identifier $length = 0x0002; // Bytes to follow @@ -963,7 +960,7 @@ class Workbook extends BIFFwriter /** * Stores the PALETTE biff record. */ - private function writePalette() + private function writePalette(): void { $aref = $this->palette; @@ -1143,7 +1140,7 @@ class Workbook extends BIFFwriter * * @param \PhpOffice\PhpSpreadsheet\Shared\Escher $pValue */ - public function setEscher(\PhpOffice\PhpSpreadsheet\Shared\Escher $pValue = null) + public function setEscher(?\PhpOffice\PhpSpreadsheet\Shared\Escher $pValue = null): void { $this->escher = $pValue; } diff --git a/src/PhpSpreadsheet/Writer/Xls/Worksheet.php b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php index 5a6fa61a..f6b3e297 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php @@ -277,7 +277,7 @@ class Worksheet extends BIFFwriter * * @see \PhpOffice\PhpSpreadsheet\Writer\Xls\Workbook::storeWorkbook() */ - public function close() + public function close(): void { $phpSheet = $this->phpSheet; @@ -603,7 +603,7 @@ class Worksheet extends BIFFwriter // Return data stored in memory if (isset($this->_data)) { $tmp = $this->_data; - unset($this->_data); + $this->_data = null; return $tmp; } @@ -616,7 +616,7 @@ class Worksheet extends BIFFwriter * * @param int $print Whether to print the headers or not. Defaults to 1 (print). */ - public function printRowColHeaders($print = 1) + public function printRowColHeaders($print = 1): void { $this->printHeaders = $print; } @@ -630,7 +630,7 @@ class Worksheet extends BIFFwriter * @param bool $symbols_right * @param bool $auto_style */ - public function setOutline($visible = true, $symbols_below = true, $symbols_right = true, $auto_style = false) + public function setOutline($visible = true, $symbols_below = true, $symbols_right = true, $auto_style = false): void { $this->outlineOn = $visible; $this->outlineBelow = $symbols_below; @@ -683,7 +683,7 @@ class Worksheet extends BIFFwriter * @param string $str The string * @param int $xfIndex Index to XF record */ - private function writeString($row, $col, $str, $xfIndex) + private function writeString($row, $col, $str, $xfIndex): void { $this->writeLabelSst($row, $col, $str, $xfIndex); } @@ -698,7 +698,7 @@ class Worksheet extends BIFFwriter * @param int $xfIndex The XF format index for the cell * @param array $arrcRun Index to Font record and characters beginning */ - private function writeRichTextString($row, $col, $str, $xfIndex, $arrcRun) + private function writeRichTextString($row, $col, $str, $xfIndex, $arrcRun): void { $record = 0x00FD; // Record identifier $length = 0x000A; // Bytes to follow @@ -725,7 +725,7 @@ class Worksheet extends BIFFwriter * @param string $str The string to write * @param mixed $xfIndex The XF format index for the cell */ - private function writeLabelSst($row, $col, $str, $xfIndex) + private function writeLabelSst($row, $col, $str, $xfIndex): void { $record = 0x00FD; // Record identifier $length = 0x000A; // Bytes to follow @@ -901,7 +901,7 @@ class Worksheet extends BIFFwriter * * @param string $stringValue */ - private function writeStringRecord($stringValue) + private function writeStringRecord($stringValue): void { $record = 0x0207; // Record identifier $data = StringHelper::UTF8toBIFF8UnicodeLong($stringValue); @@ -1176,7 +1176,7 @@ class Worksheet extends BIFFwriter * @param bool $hidden The optional hidden attribute * @param int $level The optional outline level for row, in range [0,7] */ - private function writeRow($row, $height, $xfIndex, $hidden = false, $level = 0) + private function writeRow($row, $height, $xfIndex, $hidden = false, $level = 0): void { $record = 0x0208; // Record identifier $length = 0x0010; // Number of bytes to follow @@ -1225,7 +1225,7 @@ class Worksheet extends BIFFwriter /** * Writes Excel DIMENSIONS to define the area in which there is data. */ - private function writeDimensions() + private function writeDimensions(): void { $record = 0x0200; // Record identifier @@ -1239,7 +1239,7 @@ class Worksheet extends BIFFwriter /** * Write BIFF record Window2. */ - private function writeWindow2() + private function writeWindow2(): void { $record = 0x023E; // Record identifier $length = 0x0012; @@ -1291,7 +1291,7 @@ class Worksheet extends BIFFwriter /** * Write BIFF record DEFAULTROWHEIGHT. */ - private function writeDefaultRowHeight() + private function writeDefaultRowHeight(): void { $defaultRowHeight = $this->phpSheet->getDefaultRowDimension()->getRowHeight(); @@ -1313,7 +1313,7 @@ class Worksheet extends BIFFwriter /** * Write BIFF record DEFCOLWIDTH if COLINFO records are in use. */ - private function writeDefcol() + private function writeDefcol(): void { $defaultColWidth = 8; @@ -1339,7 +1339,7 @@ class Worksheet extends BIFFwriter * 4 => Option flags. * 5 => Optional outline level */ - private function writeColinfo($col_array) + private function writeColinfo($col_array): void { if (isset($col_array[0])) { $colFirst = $col_array[0]; @@ -1386,7 +1386,7 @@ class Worksheet extends BIFFwriter /** * Write BIFF record SELECTION. */ - private function writeSelection() + private function writeSelection(): void { // look up the selected cell range $selectedCells = Coordinate::splitRange($this->phpSheet->getSelectedCells()); @@ -1446,7 +1446,7 @@ class Worksheet extends BIFFwriter /** * Store the MERGEDCELLS records for all ranges of merged cells. */ - private function writeMergedCells() + private function writeMergedCells(): void { $mergeCells = $this->phpSheet->getMergeCells(); $countMergeCells = count($mergeCells); @@ -1484,7 +1484,7 @@ class Worksheet extends BIFFwriter $recordData .= pack('vvvv', $firstRow - 1, $lastRow - 1, Coordinate::columnIndexFromString($firstColumn) - 1, Coordinate::columnIndexFromString($lastColumn) - 1); // flush record if we have reached limit for number of merged cells, or reached final merged cell - if ($j == $maxCountMergeCellsPerRecord or $i == $countMergeCells) { + if ($j == $maxCountMergeCellsPerRecord || $i == $countMergeCells) { $recordData = pack('v', $j) . $recordData; $length = strlen($recordData); $header = pack('vv', $record, $length); @@ -1500,7 +1500,7 @@ class Worksheet extends BIFFwriter /** * Write SHEETLAYOUT record. */ - private function writeSheetLayout() + private function writeSheetLayout(): void { if (!$this->phpSheet->isTabColorSet()) { return; @@ -1527,7 +1527,7 @@ class Worksheet extends BIFFwriter /** * Write SHEETPROTECTION. */ - private function writeSheetProtection() + private function writeSheetProtection(): void { // record identifier $record = 0x0867; @@ -1574,7 +1574,7 @@ class Worksheet extends BIFFwriter * Openoffice.org's Documentaion of the Microsoft Excel File Format uses term RANGEPROTECTION for these records * Microsoft Office Excel 97-2007 Binary File Format Specification uses term FEAT for these records */ - private function writeRangeProtection() + private function writeRangeProtection(): void { foreach ($this->phpSheet->getProtectedCells() as $range => $password) { // number of ranges, e.g. 'A1:B3 C20:D25' @@ -1622,7 +1622,7 @@ class Worksheet extends BIFFwriter * Frozen panes are specified in terms of an integer number of rows and columns. * Thawed panes are specified in terms of Excel's units for rows and columns. */ - private function writePanes() + private function writePanes(): void { $panes = []; if ($this->phpSheet->getFreezePane()) { @@ -1706,7 +1706,7 @@ class Worksheet extends BIFFwriter /** * Store the page setup SETUP BIFF record. */ - private function writeSetup() + private function writeSetup(): void { $record = 0x00A1; // Record identifier $length = 0x0022; // Number of bytes to follow @@ -1767,7 +1767,7 @@ class Worksheet extends BIFFwriter /** * Store the header caption BIFF record. */ - private function writeHeader() + private function writeHeader(): void { $record = 0x0014; // Record identifier @@ -1791,7 +1791,7 @@ class Worksheet extends BIFFwriter /** * Store the footer caption BIFF record. */ - private function writeFooter() + private function writeFooter(): void { $record = 0x0015; // Record identifier @@ -1815,7 +1815,7 @@ class Worksheet extends BIFFwriter /** * Store the horizontal centering HCENTER BIFF record. */ - private function writeHcenter() + private function writeHcenter(): void { $record = 0x0083; // Record identifier $length = 0x0002; // Bytes to follow @@ -1831,7 +1831,7 @@ class Worksheet extends BIFFwriter /** * Store the vertical centering VCENTER BIFF record. */ - private function writeVcenter() + private function writeVcenter(): void { $record = 0x0084; // Record identifier $length = 0x0002; // Bytes to follow @@ -1846,7 +1846,7 @@ class Worksheet extends BIFFwriter /** * Store the LEFTMARGIN BIFF record. */ - private function writeMarginLeft() + private function writeMarginLeft(): void { $record = 0x0026; // Record identifier $length = 0x0008; // Bytes to follow @@ -1865,7 +1865,7 @@ class Worksheet extends BIFFwriter /** * Store the RIGHTMARGIN BIFF record. */ - private function writeMarginRight() + private function writeMarginRight(): void { $record = 0x0027; // Record identifier $length = 0x0008; // Bytes to follow @@ -1884,7 +1884,7 @@ class Worksheet extends BIFFwriter /** * Store the TOPMARGIN BIFF record. */ - private function writeMarginTop() + private function writeMarginTop(): void { $record = 0x0028; // Record identifier $length = 0x0008; // Bytes to follow @@ -1903,7 +1903,7 @@ class Worksheet extends BIFFwriter /** * Store the BOTTOMMARGIN BIFF record. */ - private function writeMarginBottom() + private function writeMarginBottom(): void { $record = 0x0029; // Record identifier $length = 0x0008; // Bytes to follow @@ -1922,7 +1922,7 @@ class Worksheet extends BIFFwriter /** * Write the PRINTHEADERS BIFF record. */ - private function writePrintHeaders() + private function writePrintHeaders(): void { $record = 0x002a; // Record identifier $length = 0x0002; // Bytes to follow @@ -1938,7 +1938,7 @@ class Worksheet extends BIFFwriter * Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the * GRIDSET record. */ - private function writePrintGridlines() + private function writePrintGridlines(): void { $record = 0x002b; // Record identifier $length = 0x0002; // Bytes to follow @@ -1954,7 +1954,7 @@ class Worksheet extends BIFFwriter * Write the GRIDSET BIFF record. Must be used in conjunction with the * PRINTGRIDLINES record. */ - private function writeGridset() + private function writeGridset(): void { $record = 0x0082; // Record identifier $length = 0x0002; // Bytes to follow @@ -1969,7 +1969,7 @@ class Worksheet extends BIFFwriter /** * Write the AUTOFILTERINFO BIFF record. This is used to configure the number of autofilter select used in the sheet. */ - private function writeAutoFilterInfo() + private function writeAutoFilterInfo(): void { $record = 0x009D; // Record identifier $length = 0x0002; // Bytes to follow @@ -1989,7 +1989,7 @@ class Worksheet extends BIFFwriter * * @see writeWsbool() */ - private function writeGuts() + private function writeGuts(): void { $record = 0x0080; // Record identifier $length = 0x0008; // Bytes to follow @@ -2033,7 +2033,7 @@ class Worksheet extends BIFFwriter * Write the WSBOOL BIFF record, mainly for fit-to-page. Used in conjunction * with the SETUP record. */ - private function writeWsbool() + private function writeWsbool(): void { $record = 0x0081; // Record identifier $length = 0x0002; // Bytes to follow @@ -2068,7 +2068,7 @@ class Worksheet extends BIFFwriter /** * Write the HORIZONTALPAGEBREAKS and VERTICALPAGEBREAKS BIFF records. */ - private function writeBreaks() + private function writeBreaks(): void { // initialize $vbreaks = []; @@ -2151,7 +2151,7 @@ class Worksheet extends BIFFwriter /** * Set the Biff PROTECT record to indicate that the worksheet is protected. */ - private function writeProtect() + private function writeProtect(): void { // Exit unless sheet protection has been specified if (!$this->phpSheet->getProtection()->getSheet()) { @@ -2172,7 +2172,7 @@ class Worksheet extends BIFFwriter /** * Write SCENPROTECT. */ - private function writeScenProtect() + private function writeScenProtect(): void { // Exit if sheet protection is not active if (!$this->phpSheet->getProtection()->getSheet()) { @@ -2196,7 +2196,7 @@ class Worksheet extends BIFFwriter /** * Write OBJECTPROTECT. */ - private function writeObjectProtect() + private function writeObjectProtect(): void { // Exit if sheet protection is not active if (!$this->phpSheet->getProtection()->getSheet()) { @@ -2220,7 +2220,7 @@ class Worksheet extends BIFFwriter /** * Write the worksheet PASSWORD record. */ - private function writePassword() + private function writePassword(): void { // Exit unless sheet protection and password have been specified if (!$this->phpSheet->getProtection()->getSheet() || !$this->phpSheet->getProtection()->getPassword()) { @@ -2249,7 +2249,7 @@ class Worksheet extends BIFFwriter * @param float $scale_x The horizontal scale * @param float $scale_y The vertical scale */ - public function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1) + public function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1): void { $bitmap_array = (is_resource($bitmap) ? $this->processBitmapGd($bitmap) : $this->processBitmap($bitmap)); [$width, $height, $size, $data] = $bitmap_array; @@ -2322,7 +2322,7 @@ class Worksheet extends BIFFwriter * @param int $width Width of image frame * @param int $height Height of image frame */ - public function positionImage($col_start, $row_start, $x1, $y1, $width, $height) + public function positionImage($col_start, $row_start, $x1, $y1, $width, $height): void { // Initialise end cell to the same as the start cell $col_end = $col_start; // Col containing lower right corner of object @@ -2389,7 +2389,7 @@ class Worksheet extends BIFFwriter * @param int $rwB Row containing bottom right corner of object * @param int $dyB Distance from bottom of cell */ - private function writeObjPicture($colL, $dxL, $rwT, $dyT, $colR, $dxR, $rwB, $dyB) + private function writeObjPicture($colL, $dxL, $rwT, $dyT, $colR, $dxR, $rwB, $dyB): void { $record = 0x005d; // Record identifier $length = 0x003c; // Bytes to follow @@ -2573,7 +2573,7 @@ class Worksheet extends BIFFwriter * Store the window zoom factor. This should be a reduced fraction but for * simplicity we will store all fractions with a numerator of 100. */ - private function writeZoom() + private function writeZoom(): void { // If scale is 100 we don't need to write a record if ($this->phpSheet->getSheetView()->getZoomScale() == 100) { @@ -2603,7 +2603,7 @@ class Worksheet extends BIFFwriter * * @param \PhpOffice\PhpSpreadsheet\Shared\Escher $pValue */ - public function setEscher(\PhpOffice\PhpSpreadsheet\Shared\Escher $pValue = null) + public function setEscher(?\PhpOffice\PhpSpreadsheet\Shared\Escher $pValue = null): void { $this->escher = $pValue; } @@ -2611,7 +2611,7 @@ class Worksheet extends BIFFwriter /** * Write MSODRAWING record. */ - private function writeMsoDrawing() + private function writeMsoDrawing(): void { // write the Escher stream if necessary if (isset($this->escher)) { @@ -2696,7 +2696,7 @@ class Worksheet extends BIFFwriter /** * Store the DATAVALIDATIONS and DATAVALIDATION records. */ - private function writeDataValidity() + private function writeDataValidity(): void { // Datavalidation collection $dataValidationCollection = $this->phpSheet->getDataValidationCollection(); @@ -2938,7 +2938,7 @@ class Worksheet extends BIFFwriter /** * Write PLV Record. */ - private function writePageLayoutView() + private function writePageLayoutView(): void { $record = 0x088B; // Record identifier $length = 0x0010; // Bytes to follow @@ -2968,10 +2968,8 @@ class Worksheet extends BIFFwriter /** * Write CFRule Record. - * - * @param Conditional $conditional */ - private function writeCFRule(Conditional $conditional) + private function writeCFRule(Conditional $conditional): void { $record = 0x01B1; // Record identifier @@ -3769,10 +3767,12 @@ class Worksheet extends BIFFwriter break; } - //@todo writeCFRule() => $blockLineStyle => Index Color for left line - //@todo writeCFRule() => $blockLineStyle => Index Color for right line - //@todo writeCFRule() => $blockLineStyle => Top-left to bottom-right on/off - //@todo writeCFRule() => $blockLineStyle => Bottom-left to top-right on/off + /** + *@todo writeCFRule() => $blockLineStyle => Index Color for left line + *@todo writeCFRule() => $blockLineStyle => Index Color for right line + *@todo writeCFRule() => $blockLineStyle => Top-left to bottom-right on/off + *@todo writeCFRule() => $blockLineStyle => Bottom-left to top-right on/off + */ $blockColor = 0; //@todo writeCFRule() => $blockColor => Index Color for top line //@todo writeCFRule() => $blockColor => Index Color for bottom line @@ -4434,7 +4434,7 @@ class Worksheet extends BIFFwriter /** * Write CFHeader record. */ - private function writeCFHeader() + private function writeCFHeader(): void { $record = 0x01B0; // Record identifier $length = 0x0016; // Bytes to follow diff --git a/src/PhpSpreadsheet/Writer/Xls/Xf.php b/src/PhpSpreadsheet/Writer/Xls/Xf.php index 238fb34c..3e8169b3 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Xf.php +++ b/src/PhpSpreadsheet/Writer/Xls/Xf.php @@ -248,7 +248,7 @@ class Xf * * @param bool $value */ - public function setIsStyleXf($value) + public function setIsStyleXf($value): void { $this->isStyleXf = $value; } @@ -258,7 +258,7 @@ class Xf * * @param int $colorIndex Color index */ - public function setBottomColor($colorIndex) + public function setBottomColor($colorIndex): void { $this->bottomBorderColor = $colorIndex; } @@ -268,7 +268,7 @@ class Xf * * @param int $colorIndex Color index */ - public function setTopColor($colorIndex) + public function setTopColor($colorIndex): void { $this->topBorderColor = $colorIndex; } @@ -278,7 +278,7 @@ class Xf * * @param int $colorIndex Color index */ - public function setLeftColor($colorIndex) + public function setLeftColor($colorIndex): void { $this->leftBorderColor = $colorIndex; } @@ -288,7 +288,7 @@ class Xf * * @param int $colorIndex Color index */ - public function setRightColor($colorIndex) + public function setRightColor($colorIndex): void { $this->rightBorderColor = $colorIndex; } @@ -298,7 +298,7 @@ class Xf * * @param int $colorIndex Color index */ - public function setDiagColor($colorIndex) + public function setDiagColor($colorIndex): void { $this->_diag_color = $colorIndex; } @@ -308,7 +308,7 @@ class Xf * * @param int $colorIndex Color index */ - public function setFgColor($colorIndex) + public function setFgColor($colorIndex): void { $this->foregroundColor = $colorIndex; } @@ -318,7 +318,7 @@ class Xf * * @param int $colorIndex Color index */ - public function setBgColor($colorIndex) + public function setBgColor($colorIndex): void { $this->backgroundColor = $colorIndex; } @@ -329,7 +329,7 @@ class Xf * * @param int $numberFormatIndex Index to format record */ - public function setNumberFormatIndex($numberFormatIndex) + public function setNumberFormatIndex($numberFormatIndex): void { $this->numberFormatIndex = $numberFormatIndex; } @@ -339,7 +339,7 @@ class Xf * * @param int $value Font index, note that value 4 does not exist */ - public function setFontIndex($value) + public function setFontIndex($value): void { $this->fontIndex = $value; } diff --git a/src/PhpSpreadsheet/Writer/Xlsx.php b/src/PhpSpreadsheet/Writer/Xlsx.php index 4d4d79d6..bfcde049 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx.php +++ b/src/PhpSpreadsheet/Writer/Xlsx.php @@ -109,8 +109,6 @@ class Xlsx extends BaseWriter /** * Create a new Xlsx Writer. - * - * @param Spreadsheet $spreadsheet */ public function __construct(Spreadsheet $spreadsheet) { @@ -171,7 +169,7 @@ class Xlsx extends BaseWriter * * @param resource|string $pFilename */ - public function save($pFilename) + public function save($pFilename): void { if ($this->spreadSheet !== null) { // garbage collect diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Chart.php b/src/PhpSpreadsheet/Writer/Xlsx/Chart.php index aeb7a76b..583b262c 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Chart.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Chart.php @@ -26,7 +26,6 @@ class Chart extends WriterPart /** * Write charts to XML format. * - * @param \PhpOffice\PhpSpreadsheet\Chart\Chart $pChart * @param mixed $calculateCellValues * * @return string XML Output @@ -108,7 +107,7 @@ class Chart extends WriterPart * @param XMLWriter $objWriter XML Writer * @param Title $title */ - private function writeTitle(XMLWriter $objWriter, Title $title = null) + private function writeTitle(XMLWriter $objWriter, ?Title $title = null): void { if ($title === null) { return; @@ -151,7 +150,7 @@ class Chart extends WriterPart * @param XMLWriter $objWriter XML Writer * @param Legend $legend */ - private function writeLegend(XMLWriter $objWriter, Legend $legend = null) + private function writeLegend(XMLWriter $objWriter, ?Legend $legend = null): void { if ($legend === null) { return; @@ -198,16 +197,12 @@ class Chart extends WriterPart * Write Chart Plot Area. * * @param XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pSheet - * @param PlotArea $plotArea * @param Title $xAxisLabel * @param Title $yAxisLabel * @param Axis $xAxis * @param Axis $yAxis - * @param null|GridLines $majorGridlines - * @param null|GridLines $minorGridlines */ - private function writePlotArea(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pSheet, PlotArea $plotArea, Title $xAxisLabel = null, Title $yAxisLabel = null, Axis $xAxis = null, Axis $yAxis = null, GridLines $majorGridlines = null, GridLines $minorGridlines = null) + private function writePlotArea(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pSheet, PlotArea $plotArea, ?Title $xAxisLabel = null, ?Title $yAxisLabel = null, ?Axis $xAxis = null, ?Axis $yAxis = null, ?GridLines $majorGridlines = null, ?GridLines $minorGridlines = null): void { if ($plotArea === null) { return; @@ -336,7 +331,7 @@ class Chart extends WriterPart * @param XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Chart\Layout $chartLayout Chart layout */ - private function writeDataLabels(XMLWriter $objWriter, Layout $chartLayout = null) + private function writeDataLabels(XMLWriter $objWriter, ?Layout $chartLayout = null): void { $objWriter->startElement('c:dLbls'); @@ -386,9 +381,8 @@ class Chart extends WriterPart * @param string $id1 * @param string $id2 * @param bool $isMultiLevelSeries - * @param Axis $yAxis */ - private function writeCategoryAxis($objWriter, $xAxisLabel, $id1, $id2, $isMultiLevelSeries, Axis $yAxis) + private function writeCategoryAxis($objWriter, $xAxisLabel, $id1, $id2, $isMultiLevelSeries, Axis $yAxis): void { $objWriter->startElement('c:catAx'); @@ -505,11 +499,8 @@ class Chart extends WriterPart * @param string $id1 * @param string $id2 * @param bool $isMultiLevelSeries - * @param Axis $xAxis - * @param GridLines $majorGridlines - * @param GridLines $minorGridlines */ - private function writeValueAxis($objWriter, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, Axis $xAxis, GridLines $majorGridlines, GridLines $minorGridlines) + private function writeValueAxis($objWriter, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, Axis $xAxis, GridLines $majorGridlines, GridLines $minorGridlines): void { $objWriter->startElement('c:valAx'); @@ -1051,7 +1042,7 @@ class Chart extends WriterPart * @param bool &$valIsMultiLevelSeries Is value set a multi-series set * @param string &$plotGroupingType Type of grouping for multi-series values */ - private function writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType) + private function writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType): void { if ($plotGroup === null) { return; @@ -1235,7 +1226,7 @@ class Chart extends WriterPart * @param DataSeriesValues $plotSeriesLabel * @param XMLWriter $objWriter XML Writer */ - private function writePlotSeriesLabel($plotSeriesLabel, $objWriter) + private function writePlotSeriesLabel($plotSeriesLabel, $objWriter): void { if ($plotSeriesLabel === null) { return; @@ -1270,7 +1261,7 @@ class Chart extends WriterPart * @param string $groupType Type of plot for dataseries * @param string $dataType Datatype of series values */ - private function writePlotSeriesValues($plotSeriesValues, XMLWriter $objWriter, $groupType, $dataType = 'str') + private function writePlotSeriesValues($plotSeriesValues, XMLWriter $objWriter, $groupType, $dataType = 'str'): void { if ($plotSeriesValues === null) { return; @@ -1360,7 +1351,7 @@ class Chart extends WriterPart * @param DataSeriesValues $plotSeriesValues * @param XMLWriter $objWriter XML Writer */ - private function writeBubbles($plotSeriesValues, $objWriter) + private function writeBubbles($plotSeriesValues, $objWriter): void { if ($plotSeriesValues === null) { return; @@ -1405,7 +1396,7 @@ class Chart extends WriterPart * @param XMLWriter $objWriter XML Writer * @param Layout $layout */ - private function writeLayout(XMLWriter $objWriter, Layout $layout = null) + private function writeLayout(XMLWriter $objWriter, ?Layout $layout = null): void { $objWriter->startElement('c:layout'); @@ -1472,7 +1463,7 @@ class Chart extends WriterPart * * @param XMLWriter $objWriter XML Writer */ - private function writeAlternateContent($objWriter) + private function writeAlternateContent($objWriter): void { $objWriter->startElement('mc:AlternateContent'); $objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006'); @@ -1500,7 +1491,7 @@ class Chart extends WriterPart * * @param XMLWriter $objWriter XML Writer */ - private function writePrintSettings($objWriter) + private function writePrintSettings($objWriter): void { $objWriter->startElement('c:printSettings'); diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Comments.php b/src/PhpSpreadsheet/Writer/Xlsx/Comments.php index ee34e318..73c4308b 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Comments.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Comments.php @@ -11,8 +11,6 @@ class Comments extends WriterPart /** * Write comments to XML format. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet - * * @return string XML Output */ public function writeComments(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet) @@ -72,7 +70,7 @@ class Comments extends WriterPart * @param Comment $pComment Comment * @param array $pAuthors Array of authors */ - private function writeComment(XMLWriter $objWriter, $pCellReference, Comment $pComment, array $pAuthors) + private function writeComment(XMLWriter $objWriter, $pCellReference, Comment $pComment, array $pAuthors): void { // comment $objWriter->startElement('comment'); @@ -90,8 +88,6 @@ class Comments extends WriterPart /** * Write VML comments to XML format. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet - * * @return string XML Output */ public function writeVMLComments(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet) @@ -166,7 +162,7 @@ class Comments extends WriterPart * @param string $pCellReference Cell reference, eg: 'A1' * @param Comment $pComment Comment */ - private function writeVMLComment(XMLWriter $objWriter, $pCellReference, Comment $pComment) + private function writeVMLComment(XMLWriter $objWriter, $pCellReference, Comment $pComment): void { // Metadata [$column, $row] = Coordinate::coordinateFromString($pCellReference); diff --git a/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php b/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php index 421f1e73..2cff1a8f 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php @@ -13,7 +13,6 @@ class ContentTypes extends WriterPart /** * Write content types to XML format. * - * @param Spreadsheet $spreadsheet * @param bool $includeCharts Flag indicating if we should include drawing details for charts * * @return string XML Output @@ -206,7 +205,7 @@ class ContentTypes extends WriterPart * @param string $pPartname Part name * @param string $pContentType Content type */ - private function writeDefaultContentType(XMLWriter $objWriter, $pPartname, $pContentType) + private function writeDefaultContentType(XMLWriter $objWriter, $pPartname, $pContentType): void { if ($pPartname != '' && $pContentType != '') { // Write content type @@ -226,7 +225,7 @@ class ContentTypes extends WriterPart * @param string $pPartname Part name * @param string $pContentType Content type */ - private function writeOverrideContentType(XMLWriter $objWriter, $pPartname, $pContentType) + private function writeOverrideContentType(XMLWriter $objWriter, $pPartname, $pContentType): void { if ($pPartname != '' && $pContentType != '') { // Write content type diff --git a/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php b/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php index 289d08c7..bcbc2379 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php @@ -10,8 +10,6 @@ class DocProps extends WriterPart /** * Write docProps/app.xml to XML format. * - * @param Spreadsheet $spreadsheet - * * @return string XML Output */ public function writeDocPropsApp(Spreadsheet $spreadsheet) @@ -107,8 +105,6 @@ class DocProps extends WriterPart /** * Write docProps/core.xml to XML format. * - * @param Spreadsheet $spreadsheet - * * @return string XML Output */ public function writeDocPropsCore(Spreadsheet $spreadsheet) @@ -174,8 +170,6 @@ class DocProps extends WriterPart /** * Write docProps/custom.xml to XML format. * - * @param Spreadsheet $spreadsheet - * * @return string XML Output */ public function writeDocPropsCustom(Spreadsheet $spreadsheet) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php b/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php index 4c5a413e..1713b982 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php @@ -14,7 +14,6 @@ class Drawing extends WriterPart /** * Write drawings to XML format. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet * @param bool $includeCharts Flag indicating if we should include drawing details for charts * * @return string XML Output @@ -80,10 +79,9 @@ class Drawing extends WriterPart * Write drawings to XML format. * * @param XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpSpreadsheet\Chart\Chart $pChart * @param int $pRelationId */ - public function writeChart(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Chart\Chart $pChart, $pRelationId = -1) + public function writeChart(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Chart\Chart $pChart, $pRelationId = -1): void { $tl = $pChart->getTopLeftPosition(); $tl['colRow'] = Coordinate::coordinateFromString($tl['cell']); @@ -151,11 +149,10 @@ class Drawing extends WriterPart * Write drawings to XML format. * * @param XMLWriter $objWriter XML Writer - * @param BaseDrawing $pDrawing * @param int $pRelationId * @param null|int $hlinkClickId */ - public function writeDrawing(XMLWriter $objWriter, BaseDrawing $pDrawing, $pRelationId = -1, $hlinkClickId = null) + public function writeDrawing(XMLWriter $objWriter, BaseDrawing $pDrawing, $pRelationId = -1, $hlinkClickId = null): void { if ($pRelationId >= 0) { // xdr:oneCellAnchor @@ -283,8 +280,6 @@ class Drawing extends WriterPart /** * Write VML header/footer images to XML format. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet - * * @return string XML Output */ public function writeVMLHeaderFooterImages(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet) @@ -434,7 +429,7 @@ class Drawing extends WriterPart * @param string $pReference Reference * @param HeaderFooterDrawing $pImage Image */ - private function writeVMLHeaderFooterImage(XMLWriter $objWriter, $pReference, HeaderFooterDrawing $pImage) + private function writeVMLHeaderFooterImage(XMLWriter $objWriter, $pReference, HeaderFooterDrawing $pImage): void { // Calculate object id preg_match('{(\d+)}', md5($pReference), $m); @@ -471,8 +466,6 @@ class Drawing extends WriterPart /** * Get an array of all drawings. * - * @param Spreadsheet $spreadsheet - * * @return \PhpOffice\PhpSpreadsheet\Worksheet\Drawing[] All drawings in PhpSpreadsheet */ public function allDrawings(Spreadsheet $spreadsheet) @@ -496,10 +489,9 @@ class Drawing extends WriterPart } /** - * @param XMLWriter $objWriter * @param null|int $hlinkClickId */ - private function writeHyperLinkDrawing(XMLWriter $objWriter, $hlinkClickId) + private function writeHyperLinkDrawing(XMLWriter $objWriter, $hlinkClickId): void { if ($hlinkClickId === null) { return; diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Rels.php b/src/PhpSpreadsheet/Writer/Xlsx/Rels.php index 6dc41502..c2876065 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Rels.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Rels.php @@ -12,8 +12,6 @@ class Rels extends WriterPart /** * Write relationships to XML format. * - * @param Spreadsheet $spreadsheet - * * @return string XML Output */ public function writeRelationships(Spreadsheet $spreadsheet) @@ -85,8 +83,6 @@ class Rels extends WriterPart /** * Write workbook relationships to XML format. * - * @param Spreadsheet $spreadsheet - * * @return string XML Output */ public function writeWorkbookRelationships(Spreadsheet $spreadsheet) @@ -164,7 +160,6 @@ class Rels extends WriterPart * rId1 - Drawings * rId_hyperlink_x - Hyperlinks * - * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet * @param int $pWorksheetId * @param bool $includeCharts Flag indicating if we should write charts * @@ -271,7 +266,7 @@ class Rels extends WriterPart return $objWriter->getData(); } - private function writeUnparsedRelationship(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet, XMLWriter $objWriter, $relationship, $type) + private function writeUnparsedRelationship(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet, XMLWriter $objWriter, $relationship, $type): void { $unparsedLoadedData = $pWorksheet->getParent()->getUnparsedLoadedData(); if (!isset($unparsedLoadedData['sheets'][$pWorksheet->getCodeName()][$relationship])) { @@ -291,7 +286,6 @@ class Rels extends WriterPart /** * Write drawing relationships to XML format. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet * @param int &$chartRef Chart ID * @param bool $includeCharts Flag indicating if we should write charts * @@ -360,8 +354,6 @@ class Rels extends WriterPart /** * Write header/footer drawing relationships to XML format. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet - * * @return string XML Output */ public function writeHeaderFooterDrawingRelationships(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet) @@ -406,7 +398,7 @@ class Rels extends WriterPart * @param string $pTarget Relationship target * @param string $pTargetMode Relationship target mode */ - private function writeRelationship(XMLWriter $objWriter, $pId, $pType, $pTarget, $pTargetMode = '') + private function writeRelationship(XMLWriter $objWriter, $pId, $pType, $pTarget, $pTargetMode = ''): void { if ($pType != '' && $pTarget != '') { // Write relationship diff --git a/src/PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php b/src/PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php index 531111ab..8005207c 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php @@ -10,8 +10,6 @@ class RelsRibbon extends WriterPart /** * Write relationships for additional objects of custom UI (ribbon). * - * @param Spreadsheet $spreadsheet - * * @return string XML Output */ public function writeRibbonRelationships(Spreadsheet $spreadsheet) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/RelsVBA.php b/src/PhpSpreadsheet/Writer/Xlsx/RelsVBA.php index fb508c6b..55bcd360 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/RelsVBA.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/RelsVBA.php @@ -10,8 +10,6 @@ class RelsVBA extends WriterPart /** * Write relationships for a signed VBA Project. * - * @param Spreadsheet $spreadsheet - * * @return string XML Output */ public function writeVBARelationships(Spreadsheet $spreadsheet) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php b/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php index 8e18e6f8..872d0343 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php @@ -112,7 +112,7 @@ class StringTable extends WriterPart * @param RichText $pRichText Rich text * @param string $prefix Optional Namespace prefix */ - public function writeRichText(XMLWriter $objWriter, RichText $pRichText, $prefix = null) + public function writeRichText(XMLWriter $objWriter, RichText $pRichText, $prefix = null): void { if ($prefix !== null) { $prefix .= ':'; @@ -195,7 +195,7 @@ class StringTable extends WriterPart * @param RichText|string $pRichText text string or Rich text * @param string $prefix Optional Namespace prefix */ - public function writeRichTextForCharts(XMLWriter $objWriter, $pRichText = null, $prefix = null) + public function writeRichTextForCharts(XMLWriter $objWriter, $pRichText = null, $prefix = null): void { if (!$pRichText instanceof RichText) { $textRun = $pRichText; diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Style.php b/src/PhpSpreadsheet/Writer/Xlsx/Style.php index 54ec664f..74300a9c 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Style.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Style.php @@ -18,8 +18,6 @@ class Style extends WriterPart /** * Write styles to XML format. * - * @param Spreadsheet $spreadsheet - * * @return string XML Output */ public function writeStyles(Spreadsheet $spreadsheet) @@ -151,7 +149,7 @@ class Style extends WriterPart * @param XMLWriter $objWriter XML Writer * @param Fill $pFill Fill style */ - private function writeFill(XMLWriter $objWriter, Fill $pFill) + private function writeFill(XMLWriter $objWriter, Fill $pFill): void { // Check if this is a pattern type or gradient type if ($pFill->getFillType() === Fill::FILL_GRADIENT_LINEAR || @@ -170,7 +168,7 @@ class Style extends WriterPart * @param XMLWriter $objWriter XML Writer * @param Fill $pFill Fill style */ - private function writeGradientFill(XMLWriter $objWriter, Fill $pFill) + private function writeGradientFill(XMLWriter $objWriter, Fill $pFill): void { // fill $objWriter->startElement('fill'); @@ -213,7 +211,7 @@ class Style extends WriterPart * @param XMLWriter $objWriter XML Writer * @param Fill $pFill Fill style */ - private function writePatternFill(XMLWriter $objWriter, Fill $pFill) + private function writePatternFill(XMLWriter $objWriter, Fill $pFill): void { // fill $objWriter->startElement('fill'); @@ -250,7 +248,7 @@ class Style extends WriterPart * @param XMLWriter $objWriter XML Writer * @param Font $pFont Font style */ - private function writeFont(XMLWriter $objWriter, Font $pFont) + private function writeFont(XMLWriter $objWriter, Font $pFont): void { // font $objWriter->startElement('font'); @@ -329,7 +327,7 @@ class Style extends WriterPart * @param XMLWriter $objWriter XML Writer * @param Borders $pBorders Borders style */ - private function writeBorder(XMLWriter $objWriter, Borders $pBorders) + private function writeBorder(XMLWriter $objWriter, Borders $pBorders): void { // Write border $objWriter->startElement('border'); @@ -368,7 +366,7 @@ class Style extends WriterPart * @param \PhpOffice\PhpSpreadsheet\Style\Style $pStyle Style * @param Spreadsheet $spreadsheet Workbook */ - private function writeCellStyleXf(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Style $pStyle, Spreadsheet $spreadsheet) + private function writeCellStyleXf(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Style $pStyle, Spreadsheet $spreadsheet): void { // xf $objWriter->startElement('xf'); @@ -442,7 +440,7 @@ class Style extends WriterPart * @param XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Style\Style $pStyle Style */ - private function writeCellStyleDxf(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Style $pStyle) + private function writeCellStyleDxf(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Style $pStyle): void { // dxf $objWriter->startElement('dxf'); @@ -506,7 +504,7 @@ class Style extends WriterPart * @param string $pName Element name * @param Border $pBorder Border style */ - private function writeBorderPr(XMLWriter $objWriter, $pName, Border $pBorder) + private function writeBorderPr(XMLWriter $objWriter, $pName, Border $pBorder): void { // Write BorderPr if ($pBorder->getBorderStyle() != Border::BORDER_NONE) { @@ -529,7 +527,7 @@ class Style extends WriterPart * @param NumberFormat $pNumberFormat Number Format * @param int $pId Number Format identifier */ - private function writeNumFmt(XMLWriter $objWriter, NumberFormat $pNumberFormat, $pId = 0) + private function writeNumFmt(XMLWriter $objWriter, NumberFormat $pNumberFormat, $pId = 0): void { // Translate formatcode $formatCode = $pNumberFormat->getFormatCode(); @@ -546,8 +544,6 @@ class Style extends WriterPart /** * Get an array of all styles. * - * @param Spreadsheet $spreadsheet - * * @return \PhpOffice\PhpSpreadsheet\Style\Style[] All styles in PhpSpreadsheet */ public function allStyles(Spreadsheet $spreadsheet) @@ -558,8 +554,6 @@ class Style extends WriterPart /** * Get an array of all conditional styles. * - * @param Spreadsheet $spreadsheet - * * @return Conditional[] All conditional styles in PhpSpreadsheet */ public function allConditionalStyles(Spreadsheet $spreadsheet) @@ -582,8 +576,6 @@ class Style extends WriterPart /** * Get an array of all fills. * - * @param Spreadsheet $spreadsheet - * * @return Fill[] All fills in PhpSpreadsheet */ public function allFills(Spreadsheet $spreadsheet) @@ -614,8 +606,6 @@ class Style extends WriterPart /** * Get an array of all fonts. * - * @param Spreadsheet $spreadsheet - * * @return Font[] All fonts in PhpSpreadsheet */ public function allFonts(Spreadsheet $spreadsheet) @@ -637,8 +627,6 @@ class Style extends WriterPart /** * Get an array of all borders. * - * @param Spreadsheet $spreadsheet - * * @return Borders[] All borders in PhpSpreadsheet */ public function allBorders(Spreadsheet $spreadsheet) @@ -660,8 +648,6 @@ class Style extends WriterPart /** * Get an array of all number formats. * - * @param Spreadsheet $spreadsheet - * * @return NumberFormat[] All number formats in PhpSpreadsheet */ public function allNumberFormats(Spreadsheet $spreadsheet) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Theme.php b/src/PhpSpreadsheet/Writer/Xlsx/Theme.php index c6090395..5119117a 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Theme.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Theme.php @@ -109,8 +109,6 @@ class Theme extends WriterPart /** * Write theme to XML format. * - * @param Spreadsheet $spreadsheet - * * @return string XML Output */ public function writeTheme(Spreadsheet $spreadsheet) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php b/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php index a56c5b72..88befd02 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php @@ -15,7 +15,6 @@ class Workbook extends WriterPart /** * Write workbook to XML format. * - * @param Spreadsheet $spreadsheet * @param bool $recalcRequired Indicate whether formulas should be recalculated before writing * * @return string XML Output @@ -72,7 +71,7 @@ class Workbook extends WriterPart * * @param XMLWriter $objWriter XML Writer */ - private function writeFileVersion(XMLWriter $objWriter) + private function writeFileVersion(XMLWriter $objWriter): void { $objWriter->startElement('fileVersion'); $objWriter->writeAttribute('appName', 'xl'); @@ -87,7 +86,7 @@ class Workbook extends WriterPart * * @param XMLWriter $objWriter XML Writer */ - private function writeWorkbookPr(XMLWriter $objWriter) + private function writeWorkbookPr(XMLWriter $objWriter): void { $objWriter->startElement('workbookPr'); @@ -104,9 +103,8 @@ class Workbook extends WriterPart * Write BookViews. * * @param XMLWriter $objWriter XML Writer - * @param Spreadsheet $spreadsheet */ - private function writeBookViews(XMLWriter $objWriter, Spreadsheet $spreadsheet) + private function writeBookViews(XMLWriter $objWriter, Spreadsheet $spreadsheet): void { // bookViews $objWriter->startElement('bookViews'); @@ -133,9 +131,8 @@ class Workbook extends WriterPart * Write WorkbookProtection. * * @param XMLWriter $objWriter XML Writer - * @param Spreadsheet $spreadsheet */ - private function writeWorkbookProtection(XMLWriter $objWriter, Spreadsheet $spreadsheet) + private function writeWorkbookProtection(XMLWriter $objWriter, Spreadsheet $spreadsheet): void { if ($spreadsheet->getSecurity()->isSecurityEnabled()) { $objWriter->startElement('workbookProtection'); @@ -161,7 +158,7 @@ class Workbook extends WriterPart * @param XMLWriter $objWriter XML Writer * @param bool $recalcRequired Indicate whether formulas should be recalculated before writing */ - private function writeCalcPr(XMLWriter $objWriter, $recalcRequired = true) + private function writeCalcPr(XMLWriter $objWriter, $recalcRequired = true): void { $objWriter->startElement('calcPr'); @@ -182,9 +179,8 @@ class Workbook extends WriterPart * Write sheets. * * @param XMLWriter $objWriter XML Writer - * @param Spreadsheet $spreadsheet */ - private function writeSheets(XMLWriter $objWriter, Spreadsheet $spreadsheet) + private function writeSheets(XMLWriter $objWriter, Spreadsheet $spreadsheet): void { // Write sheets $objWriter->startElement('sheets'); @@ -212,7 +208,7 @@ class Workbook extends WriterPart * @param int $pRelId Relationship ID * @param string $sheetState Sheet state (visible, hidden, veryHidden) */ - private function writeSheet(XMLWriter $objWriter, $pSheetname, $pSheetId = 1, $pRelId = 1, $sheetState = 'visible') + private function writeSheet(XMLWriter $objWriter, $pSheetname, $pSheetId = 1, $pRelId = 1, $sheetState = 'visible'): void { if ($pSheetname != '') { // Write sheet @@ -233,9 +229,8 @@ class Workbook extends WriterPart * Write Defined Names. * * @param XMLWriter $objWriter XML Writer - * @param Spreadsheet $spreadsheet */ - private function writeDefinedNames(XMLWriter $objWriter, Spreadsheet $spreadsheet) + private function writeDefinedNames(XMLWriter $objWriter, Spreadsheet $spreadsheet): void { // Write defined names $objWriter->startElement('definedNames'); @@ -266,9 +261,8 @@ class Workbook extends WriterPart * Write named ranges. * * @param XMLWriter $objWriter XML Writer - * @param Spreadsheet $spreadsheet */ - private function writeNamedRanges(XMLWriter $objWriter, Spreadsheet $spreadsheet) + private function writeNamedRanges(XMLWriter $objWriter, Spreadsheet $spreadsheet): void { // Loop named ranges $namedRanges = $spreadsheet->getNamedRanges(); @@ -281,9 +275,8 @@ class Workbook extends WriterPart * Write Defined Name for named range. * * @param XMLWriter $objWriter XML Writer - * @param NamedRange $pNamedRange */ - private function writeDefinedNameForNamedRange(XMLWriter $objWriter, NamedRange $pNamedRange) + private function writeDefinedNameForNamedRange(XMLWriter $objWriter, NamedRange $pNamedRange): void { // definedName for named range $objWriter->startElement('definedName'); @@ -312,10 +305,9 @@ class Workbook extends WriterPart * Write Defined Name for autoFilter. * * @param XMLWriter $objWriter XML Writer - * @param Worksheet $pSheet * @param int $pSheetId */ - private function writeDefinedNameForAutofilter(XMLWriter $objWriter, Worksheet $pSheet, $pSheetId = 0) + private function writeDefinedNameForAutofilter(XMLWriter $objWriter, Worksheet $pSheet, $pSheetId = 0): void { // definedName for autoFilter $autoFilterRange = $pSheet->getAutoFilter()->getRange(); @@ -345,10 +337,9 @@ class Workbook extends WriterPart * Write Defined Name for PrintTitles. * * @param XMLWriter $objWriter XML Writer - * @param Worksheet $pSheet * @param int $pSheetId */ - private function writeDefinedNameForPrintTitles(XMLWriter $objWriter, Worksheet $pSheet, $pSheetId = 0) + private function writeDefinedNameForPrintTitles(XMLWriter $objWriter, Worksheet $pSheet, $pSheetId = 0): void { // definedName for PrintTitles if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) { @@ -387,10 +378,9 @@ class Workbook extends WriterPart * Write Defined Name for PrintTitles. * * @param XMLWriter $objWriter XML Writer - * @param Worksheet $pSheet * @param int $pSheetId */ - private function writeDefinedNameForPrintArea(XMLWriter $objWriter, Worksheet $pSheet, $pSheetId = 0) + private function writeDefinedNameForPrintArea(XMLWriter $objWriter, Worksheet $pSheet, $pSheetId = 0): void { // definedName for PrintArea if ($pSheet->getPageSetup()->isPrintAreaSet()) { diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php b/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php index febee54d..25b09d19 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php @@ -23,7 +23,6 @@ class Worksheet extends WriterPart /** * Write worksheet to XML format. * - * @param PhpspreadsheetWorksheet $pSheet * @param string[] $pStringTable * @param bool $includeCharts Flag indicating if we should write charts * @@ -132,7 +131,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeSheetPr(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeSheetPr(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // sheetPr $objWriter->startElement('sheetPr'); @@ -178,7 +177,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeDimension(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeDimension(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // dimension $objWriter->startElement('dimension'); @@ -192,7 +191,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeSheetViews(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeSheetViews(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // sheetViews $objWriter->startElement('sheetViews'); @@ -306,7 +305,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeSheetFormatPr(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeSheetFormatPr(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // sheetFormatPr $objWriter->startElement('sheetFormatPr'); @@ -357,7 +356,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeCols(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeCols(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // cols if (count($pSheet->getColumnDimensions()) > 0) { @@ -421,7 +420,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeSheetProtection(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeSheetProtection(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // sheetProtection $objWriter->startElement('sheetProtection'); @@ -504,7 +503,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeConditionalFormatting(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeConditionalFormatting(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // Conditional id $id = 1; @@ -557,7 +556,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeDataValidations(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeDataValidations(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // Datavalidation collection $dataValidationCollection = $pSheet->getDataValidationCollection(); @@ -623,7 +622,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeHyperlinks(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeHyperlinks(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // Hyperlink collection $hyperlinkCollection = $pSheet->getHyperlinkCollection(); @@ -664,7 +663,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeProtectedRanges(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeProtectedRanges(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { if (count($pSheet->getProtectedCells()) > 0) { // protectedRanges @@ -692,7 +691,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeMergeCells(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeMergeCells(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { if (count($pSheet->getMergeCells()) > 0) { // mergeCells @@ -716,7 +715,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writePrintOptions(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writePrintOptions(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // printOptions $objWriter->startElement('printOptions'); @@ -741,7 +740,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writePageMargins(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writePageMargins(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // pageMargins $objWriter->startElement('pageMargins'); @@ -760,7 +759,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeAutoFilter(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeAutoFilter(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { $autoFilterRange = $pSheet->getAutoFilter()->getRange(); if (!empty($autoFilterRange)) { @@ -850,7 +849,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writePageSetup(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writePageSetup(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // pageSetup $objWriter->startElement('pageSetup'); @@ -889,7 +888,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeHeaderFooter(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeHeaderFooter(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // headerFooter $objWriter->startElement('headerFooter'); @@ -913,7 +912,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeBreaks(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeBreaks(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // Get row and column breaks $aRowBreaks = []; @@ -970,7 +969,7 @@ class Worksheet extends WriterPart * @param PhpspreadsheetWorksheet $pSheet Worksheet * @param string[] $pStringTable String table */ - private function writeSheetData(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet, array $pStringTable) + private function writeSheetData(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet, array $pStringTable): void { // Flipped stringtable, for faster index searching $aFlippedStringTable = $this->getParentWriter()->getWriterPart('stringtable')->flipStringTable($pStringTable); @@ -1049,8 +1048,6 @@ class Worksheet extends WriterPart } /** - * @param XMLWriter $objWriter - * @param string $mappedType * @param RichText|string $cellValue */ private function writeCellInlineStr(XMLWriter $objWriter, string $mappedType, $cellValue): void @@ -1066,8 +1063,6 @@ class Worksheet extends WriterPart } /** - * @param XMLWriter $objWriter - * @param string $mappedType * @param RichText|string $cellValue * @param string[] $pFlippedStringTable */ @@ -1082,7 +1077,6 @@ class Worksheet extends WriterPart } /** - * @param XMLWriter $objWriter * @param float|int $cellValue */ private function writeCellNumeric(XMLWriter $objWriter, $cellValue): void @@ -1156,7 +1150,7 @@ class Worksheet extends WriterPart * @param string $pCellAddress Cell Address * @param string[] $pFlippedStringTable String table (flipped), for faster index searching */ - private function writeCell(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet, string $pCellAddress, array $pFlippedStringTable) + private function writeCell(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet, string $pCellAddress, array $pFlippedStringTable): void { // Cell $pCell = $pSheet->getCell($pCellAddress); @@ -1210,7 +1204,7 @@ class Worksheet extends WriterPart * @param PhpspreadsheetWorksheet $pSheet Worksheet * @param bool $includeCharts Flag indicating if we should include drawing details for charts */ - private function writeDrawings(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet, $includeCharts = false) + private function writeDrawings(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet, $includeCharts = false): void { $unparsedLoadedData = $pSheet->getParent()->getUnparsedLoadedData(); $hasUnparsedDrawing = isset($unparsedLoadedData['sheets'][$pSheet->getCodeName()]['drawingOriginalIds']); @@ -1239,7 +1233,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeLegacyDrawing(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeLegacyDrawing(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // If sheet contains comments, add the relationships if (count($pSheet->getComments()) > 0) { @@ -1255,7 +1249,7 @@ class Worksheet extends WriterPart * @param XMLWriter $objWriter XML Writer * @param PhpspreadsheetWorksheet $pSheet Worksheet */ - private function writeLegacyDrawingHF(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeLegacyDrawingHF(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { // If sheet contains images, add the relationships if (count($pSheet->getHeaderFooter()->getImages()) > 0) { @@ -1265,7 +1259,7 @@ class Worksheet extends WriterPart } } - private function writeAlternateContent(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + private function writeAlternateContent(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet): void { if (empty($pSheet->getParent()->getUnparsedLoadedData()['sheets'][$pSheet->getCodeName()]['AlternateContents'])) { return; diff --git a/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php b/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php index 7119512c..a9137dfc 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php @@ -25,8 +25,6 @@ abstract class WriterPart /** * Set parent Xlsx object. - * - * @param Xlsx $pWriter */ public function __construct(Xlsx $pWriter) { diff --git a/tests/PhpSpreadsheetTests/Calculation/CalculationTest.php b/tests/PhpSpreadsheetTests/Calculation/CalculationTest.php index a923fa19..80431c4d 100644 --- a/tests/PhpSpreadsheetTests/Calculation/CalculationTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/CalculationTest.php @@ -27,7 +27,7 @@ class CalculationTest extends TestCase * @param mixed $expectedResultExcel * @param mixed $expectedResultOpenOffice */ - public function testBinaryComparisonOperation($formula, $expectedResultExcel, $expectedResultOpenOffice) + public function testBinaryComparisonOperation($formula, $expectedResultExcel, $expectedResultOpenOffice): void { Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); $resultExcel = Calculation::getInstance()->_calculateFormulaValue($formula); @@ -50,7 +50,7 @@ class CalculationTest extends TestCase * @param array|string $functionCall * @param string $argumentCount */ - public function testGetFunctions($category, $functionCall, $argumentCount) + public function testGetFunctions($category, $functionCall, $argumentCount): void { self::assertIsCallable($functionCall); } @@ -60,7 +60,7 @@ class CalculationTest extends TestCase return Calculation::getInstance()->getFunctions(); } - public function testIsImplemented() + public function testIsImplemented(): void { $calculation = Calculation::getInstance(); self::assertFalse($calculation->isImplemented('non-existing-function')); @@ -74,7 +74,7 @@ class CalculationTest extends TestCase * * @param string $locale */ - public function testCanLoadAllSupportedLocales($locale) + public function testCanLoadAllSupportedLocales($locale): void { $calculation = Calculation::getInstance(); self::assertTrue($calculation->setLocale($locale)); @@ -104,7 +104,7 @@ class CalculationTest extends TestCase ]; } - public function testDoesHandleXlfnFunctions() + public function testDoesHandleXlfnFunctions(): void { $calculation = Calculation::getInstance(); @@ -119,7 +119,7 @@ class CalculationTest extends TestCase self::assertEquals('Function', $function['type']); } - public function testFormulaWithOptionalArgumentsAndRequiredCellReferenceShouldPassNullForMissingArguments() + public function testFormulaWithOptionalArgumentsAndRequiredCellReferenceShouldPassNullForMissingArguments(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -141,7 +141,7 @@ class CalculationTest extends TestCase self::assertEquals(5, $cell->getCalculatedValue(), 'missing arguments should be filled with null'); } - public function testCellSetAsQuotedText() + public function testCellSetAsQuotedText(): void { $spreadsheet = new Spreadsheet(); $workSheet = $spreadsheet->getActiveSheet(); @@ -153,7 +153,7 @@ class CalculationTest extends TestCase self::assertEquals("=cmd|'/C calc'!A0", $cell->getCalculatedValue()); } - public function testCellWithDdeExpresion() + public function testCellWithDdeExpresion(): void { $spreadsheet = new Spreadsheet(); $workSheet = $spreadsheet->getActiveSheet(); @@ -164,7 +164,7 @@ class CalculationTest extends TestCase self::assertEquals("=cmd|'/C calc'!A0", $cell->getCalculatedValue()); } - public function testCellWithFormulaTwoIndirect() + public function testCellWithFormulaTwoIndirect(): void { $spreadsheet = new Spreadsheet(); $workSheet = $spreadsheet->getActiveSheet(); @@ -180,7 +180,7 @@ class CalculationTest extends TestCase self::assertEquals('9', $cell3->getCalculatedValue()); } - public function testBranchPruningFormulaParsingSimpleCase() + public function testBranchPruningFormulaParsingSimpleCase(): void { $calculation = Calculation::getInstance(); $calculation->flushInstance(); // resets the ids @@ -204,11 +204,11 @@ class CalculationTest extends TestCase $foundConditionalOnB1 = $foundConditionalOnB1 || ($isB1Reference && $correctOnlyIf); } - $this->assertTrue($foundEqualAssociatedToStoreKey); - $this->assertTrue($foundConditionalOnB1); + self::assertTrue($foundEqualAssociatedToStoreKey); + self::assertTrue($foundConditionalOnB1); } - public function testBranchPruningFormulaParsingMultipleIfsCase() + public function testBranchPruningFormulaParsingMultipleIfsCase(): void { $calculation = Calculation::getInstance(); $calculation->flushInstance(); // resets the ids @@ -235,11 +235,11 @@ class CalculationTest extends TestCase $correctOnlyIf = ($token['onlyIf'] ?? '') == 'storeKey-1'; $productFunctionCorrectlyTagged = $productFunctionCorrectlyTagged || ($isFunction && $isProductFunction && $correctOnlyIf); } - $this->assertFalse($plusGotTagged, 'chaining IF( should not affect the external operators'); - $this->assertTrue($productFunctionCorrectlyTagged, 'function nested inside if should be tagged to be processed only if parent branching requires it'); + self::assertFalse($plusGotTagged, 'chaining IF( should not affect the external operators'); + self::assertTrue($productFunctionCorrectlyTagged, 'function nested inside if should be tagged to be processed only if parent branching requires it'); } - public function testBranchPruningFormulaParingNestedIfCase() + public function testBranchPruningFormulaParingNestedIfCase(): void { $calculation = Calculation::getInstance(); $calculation->flushInstance(); // resets the ids @@ -266,12 +266,12 @@ class CalculationTest extends TestCase $productFunctionCorrectlyTagged = $productFunctionCorrectlyTagged || ($isProductFunction && $isOnlyIfNotDepth1 && !$isStoreKeyDepth1 && !$isOnlyIfNotDepth0); $findOneOperandCountTagged = $findOneOperandCountTagged || ($isIfOperand && $isOnlyIfNotDepth0); } - $this->assertTrue($plusCorrectlyTagged); - $this->assertTrue($productFunctionCorrectlyTagged); - $this->assertTrue($notFunctionCorrectlyTagged); + self::assertTrue($plusCorrectlyTagged); + self::assertTrue($productFunctionCorrectlyTagged); + self::assertTrue($notFunctionCorrectlyTagged); } - public function testBranchPruningFormulaParsingNoArgumentFunctionCase() + public function testBranchPruningFormulaParsingNoArgumentFunctionCase(): void { $calculation = Calculation::getInstance(); $calculation->flushInstance(); // resets the ids @@ -283,7 +283,7 @@ class CalculationTest extends TestCase self::assertTrue(true); } - public function testBranchPruningFormulaParsingInequalitiesConditionsCase() + public function testBranchPruningFormulaParsingInequalitiesConditionsCase(): void { $calculation = Calculation::getInstance(); $calculation->flushInstance(); // resets the ids @@ -298,7 +298,7 @@ class CalculationTest extends TestCase $properlyTaggedPlus = $properlyTaggedPlus || ($isPlus && $hasOnlyIf); } - $this->assertTrue($properlyTaggedPlus); + self::assertTrue($properlyTaggedPlus); } /** @@ -320,7 +320,7 @@ class CalculationTest extends TestCase $cellCoordinates, $shouldBeSetInCacheCells = [], $shouldNotBeSetInCacheCells = [] - ) { + ): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -330,24 +330,24 @@ class CalculationTest extends TestCase $cell->setValue($formula); $calculated = $cell->getCalculatedValue(); - $this->assertEquals($expectedResult, $calculated); + self::assertEquals($expectedResult, $calculated); // this mostly to ensure that at least some cells are cached foreach ($shouldBeSetInCacheCells as $setCell) { unset($inCache); $calculation->getValueFromCache('Worksheet!' . $setCell, $inCache); - $this->assertNotEmpty($inCache); + self::assertNotEmpty($inCache); } foreach ($shouldNotBeSetInCacheCells as $notSetCell) { unset($inCache); $calculation->getValueFromCache('Worksheet!' . $notSetCell, $inCache); - $this->assertEmpty($inCache); + self::assertEmpty($inCache); } $calculation->disableBranchPruning(); $calculated = $cell->getCalculatedValue(); - $this->assertEquals($expectedResult, $calculated); + self::assertEquals($expectedResult, $calculated); } public function dataProviderBranchPruningFullExecution() diff --git a/tests/PhpSpreadsheetTests/Calculation/DefinedNameConfusedForCellTest.php b/tests/PhpSpreadsheetTests/Calculation/DefinedNameConfusedForCellTest.php index 54333afa..12d73356 100644 --- a/tests/PhpSpreadsheetTests/Calculation/DefinedNameConfusedForCellTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/DefinedNameConfusedForCellTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase; class DefinedNameConfusedForCellTest extends TestCase { - public function testDefinedName() + public function testDefinedName(): void { $obj = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); $sheet0 = $obj->setActiveSheetIndex(0); diff --git a/tests/PhpSpreadsheetTests/Calculation/FinancialTest.php b/tests/PhpSpreadsheetTests/Calculation/FinancialTest.php index 5c3928eb..e80ef35b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/FinancialTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/FinancialTest.php @@ -18,7 +18,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testAMORDEGRC($expectedResult, ...$args) + public function testAMORDEGRC($expectedResult, ...$args): void { $result = Financial::AMORDEGRC(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -34,7 +34,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testAMORLINC($expectedResult, ...$args) + public function testAMORLINC($expectedResult, ...$args): void { $result = Financial::AMORLINC(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -50,7 +50,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testCOUPDAYBS($expectedResult, ...$args) + public function testCOUPDAYBS($expectedResult, ...$args): void { $result = Financial::COUPDAYBS(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -66,7 +66,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testCOUPDAYS($expectedResult, ...$args) + public function testCOUPDAYS($expectedResult, ...$args): void { $result = Financial::COUPDAYS(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -82,7 +82,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testCOUPDAYSNC($expectedResult, ...$args) + public function testCOUPDAYSNC($expectedResult, ...$args): void { $result = Financial::COUPDAYSNC(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -98,7 +98,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testCOUPNCD($expectedResult, ...$args) + public function testCOUPNCD($expectedResult, ...$args): void { $result = Financial::COUPNCD(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -114,7 +114,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testCOUPNUM($expectedResult, ...$args) + public function testCOUPNUM($expectedResult, ...$args): void { $result = Financial::COUPNUM(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -130,7 +130,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testCOUPPCD($expectedResult, ...$args) + public function testCOUPPCD($expectedResult, ...$args): void { $result = Financial::COUPPCD(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -146,7 +146,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testCUMIPMT($expectedResult, ...$args) + public function testCUMIPMT($expectedResult, ...$args): void { $result = Financial::CUMIPMT(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -162,7 +162,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testCUMPRINC($expectedResult, ...$args) + public function testCUMPRINC($expectedResult, ...$args): void { $result = Financial::CUMPRINC(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -178,7 +178,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testDB($expectedResult, ...$args) + public function testDB($expectedResult, ...$args): void { $result = Financial::DB(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -194,7 +194,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testDDB($expectedResult, ...$args) + public function testDDB($expectedResult, ...$args): void { $result = Financial::DDB(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -210,7 +210,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testDISC($expectedResult, ...$args) + public function testDISC($expectedResult, ...$args): void { $result = Financial::DISC(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -226,7 +226,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testDOLLARDE($expectedResult, ...$args) + public function testDOLLARDE($expectedResult, ...$args): void { $result = Financial::DOLLARDE(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -242,7 +242,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testDOLLARFR($expectedResult, ...$args) + public function testDOLLARFR($expectedResult, ...$args): void { $result = Financial::DOLLARFR(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -258,7 +258,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testEFFECT($expectedResult, ...$args) + public function testEFFECT($expectedResult, ...$args): void { $result = Financial::EFFECT(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -274,7 +274,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testFV($expectedResult, ...$args) + public function testFV($expectedResult, ...$args): void { $result = Financial::FV(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -290,7 +290,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testFVSCHEDULE($expectedResult, ...$args) + public function testFVSCHEDULE($expectedResult, ...$args): void { $result = Financial::FVSCHEDULE(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -306,7 +306,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testINTRATE($expectedResult, ...$args) + public function testINTRATE($expectedResult, ...$args): void { $result = Financial::INTRATE(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -322,7 +322,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testIPMT($expectedResult, ...$args) + public function testIPMT($expectedResult, ...$args): void { $result = Financial::IPMT(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -338,7 +338,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testIRR($expectedResult, ...$args) + public function testIRR($expectedResult, ...$args): void { $result = Financial::IRR(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -354,7 +354,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testISPMT($expectedResult, ...$args) + public function testISPMT($expectedResult, ...$args): void { $result = Financial::ISPMT(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -370,7 +370,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testMIRR($expectedResult, ...$args) + public function testMIRR($expectedResult, ...$args): void { $result = Financial::MIRR(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -386,7 +386,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testNOMINAL($expectedResult, ...$args) + public function testNOMINAL($expectedResult, ...$args): void { $result = Financial::NOMINAL(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -402,7 +402,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testNPER($expectedResult, ...$args) + public function testNPER($expectedResult, ...$args): void { $result = Financial::NPER(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -418,7 +418,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testNPV($expectedResult, ...$args) + public function testNPV($expectedResult, ...$args): void { $result = Financial::NPV(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -434,7 +434,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testPRICE($expectedResult, ...$args) + public function testPRICE($expectedResult, ...$args): void { $result = Financial::PRICE(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-7); @@ -450,7 +450,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testPRICE3($expectedResult, ...$args) + public function testPRICE3($expectedResult, ...$args): void { // These results (PRICE function with basis codes 2 and 3) // agree with published algorithm, LibreOffice, and Gnumeric. @@ -469,7 +469,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testPRICEDISC($expectedResult, array $args) + public function testPRICEDISC($expectedResult, array $args): void { $result = Financial::PRICEDISC(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -485,7 +485,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testPV($expectedResult, array $args) + public function testPV($expectedResult, array $args): void { $result = Financial::PV(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -501,7 +501,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testRATE($expectedResult, ...$args) + public function testRATE($expectedResult, ...$args): void { $result = Financial::RATE(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -518,7 +518,7 @@ class FinancialTest extends TestCase * @param mixed $expectedResult * @param mixed $message */ - public function testXIRR($expectedResult, $message, ...$args) + public function testXIRR($expectedResult, $message, ...$args): void { $result = Financial::XIRR(...$args); if (is_numeric($result) && is_numeric($expectedResult)) { @@ -543,7 +543,7 @@ class FinancialTest extends TestCase * @param mixed $expectedResult * @param mixed $message */ - public function testXNPV($expectedResult, $message, ...$args) + public function testXNPV($expectedResult, $message, ...$args): void { $result = Financial::XNPV(...$args); if (is_numeric($result) && is_numeric($expectedResult)) { @@ -567,7 +567,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testPDURATION($expectedResult, array $args) + public function testPDURATION($expectedResult, array $args): void { $result = Financial::PDURATION(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -583,7 +583,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testRRI($expectedResult, array $args) + public function testRRI($expectedResult, array $args): void { $result = Financial::RRI(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -599,7 +599,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testSLN($expectedResult, array $args) + public function testSLN($expectedResult, array $args): void { $result = Financial::SLN(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -615,7 +615,7 @@ class FinancialTest extends TestCase * * @param mixed $expectedResult */ - public function testSYD($expectedResult, array $args) + public function testSYD($expectedResult, array $args): void { $result = Financial::SYD(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); diff --git a/tests/PhpSpreadsheetTests/Calculation/FormulaAsStringTest.php b/tests/PhpSpreadsheetTests/Calculation/FormulaAsStringTest.php index abf7589a..2cbdc960 100644 --- a/tests/PhpSpreadsheetTests/Calculation/FormulaAsStringTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/FormulaAsStringTest.php @@ -13,7 +13,7 @@ class FormulaAsStringTest extends TestCase * @param mixed $expectedResult * @param string $formula */ - public function testFunctionsAsString($expectedResult, $formula) + public function testFunctionsAsString($expectedResult, $formula): void { $spreadsheet = new Spreadsheet(); $workSheet = $spreadsheet->getActiveSheet(); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateDifTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateDifTest.php index 35fbe05b..db8e29a1 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateDifTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateDifTest.php @@ -24,10 +24,10 @@ class DateDifTest extends TestCase * @param $endDate * @param $unit */ - public function testDATEDIF($expectedResult, $startDate, $endDate, $unit) + public function testDATEDIF($expectedResult, $startDate, $endDate, $unit): void { $result = DateTime::DATEDIF($startDate, $endDate, $unit); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerDATEDIF() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateTest.php index c354f851..48f7cfd7 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateTest.php @@ -24,10 +24,10 @@ class DateTest extends TestCase * @param $month * @param $day */ - public function testDATE($expectedResult, $year, $month, $day) + public function testDATE($expectedResult, $year, $month, $day): void { $result = DateTime::DATE($year, $month, $day); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerDATE() @@ -35,41 +35,41 @@ class DateTest extends TestCase return require 'tests/data/Calculation/DateTime/DATE.php'; } - public function testDATEtoUnixTimestamp() + public function testDATEtoUnixTimestamp(): void { Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP); $result = DateTime::DATE(2012, 1, 31); - $this->assertEquals(1327968000, $result); - $this->assertEqualsWithDelta(1327968000, $result, 1E-8); + self::assertEquals(1327968000, $result); + self::assertEqualsWithDelta(1327968000, $result, 1E-8); } - public function testDATEtoDateTimeObject() + public function testDATEtoDateTimeObject(): void { Functions::setReturnDateType(Functions::RETURNDATE_PHP_DATETIME_OBJECT); $result = DateTime::DATE(2012, 1, 31); // Must return an object... - $this->assertIsObject($result); + self::assertIsObject($result); // ... of the correct type - $this->assertTrue(is_a($result, 'DateTimeInterface')); + self::assertTrue(is_a($result, 'DateTimeInterface')); // ... with the correct value - $this->assertEquals($result->format('d-M-Y'), '31-Jan-2012'); + self::assertEquals($result->format('d-M-Y'), '31-Jan-2012'); } - public function testDATEwith1904Calendar() + public function testDATEwith1904Calendar(): void { Date::setExcelCalendar(Date::CALENDAR_MAC_1904); $result = DateTime::DATE(1918, 11, 11); - $this->assertEquals($result, 5428); + self::assertEquals($result, 5428); } - public function testDATEwith1904CalendarError() + public function testDATEwith1904CalendarError(): void { Date::setExcelCalendar(Date::CALENDAR_MAC_1904); $result = DateTime::DATE(1901, 1, 31); - $this->assertEquals($result, '#NUM!'); + self::assertEquals($result, '#NUM!'); } } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateValueTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateValueTest.php index 20541801..51e4f7c0 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateValueTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateValueTest.php @@ -23,10 +23,10 @@ class DateValueTest extends TestCase * @param mixed $expectedResult * @param $dateValue */ - public function testDATEVALUE($expectedResult, $dateValue) + public function testDATEVALUE($expectedResult, $dateValue): void { $result = DateTime::DATEVALUE($dateValue); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerDATEVALUE() @@ -34,25 +34,25 @@ class DateValueTest extends TestCase return require 'tests/data/Calculation/DateTime/DATEVALUE.php'; } - public function testDATEVALUEtoUnixTimestamp() + public function testDATEVALUEtoUnixTimestamp(): void { Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP); $result = DateTime::DATEVALUE('2012-1-31'); - $this->assertEquals(1327968000, $result); - $this->assertEqualsWithDelta(1327968000, $result, 1E-8); + self::assertEquals(1327968000, $result); + self::assertEqualsWithDelta(1327968000, $result, 1E-8); } - public function testDATEVALUEtoDateTimeObject() + public function testDATEVALUEtoDateTimeObject(): void { Functions::setReturnDateType(Functions::RETURNDATE_PHP_DATETIME_OBJECT); $result = DateTime::DATEVALUE('2012-1-31'); // Must return an object... - $this->assertIsObject($result); + self::assertIsObject($result); // ... of the correct type - $this->assertTrue(is_a($result, DateTimeInterface::class)); + self::assertTrue(is_a($result, DateTimeInterface::class)); // ... with the correct value - $this->assertEquals($result->format('d-M-Y'), '31-Jan-2012'); + self::assertEquals($result->format('d-M-Y'), '31-Jan-2012'); } } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DayTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DayTest.php index 77c29939..8f4639eb 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DayTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DayTest.php @@ -23,15 +23,15 @@ class DayTest extends TestCase * @param mixed $expectedResultOpenOffice * @param $dateTimeValue */ - public function testDAY($expectedResultExcel, $expectedResultOpenOffice, $dateTimeValue) + public function testDAY($expectedResultExcel, $expectedResultOpenOffice, $dateTimeValue): void { $resultExcel = DateTime::DAYOFMONTH($dateTimeValue); - $this->assertEqualsWithDelta($expectedResultExcel, $resultExcel, 1E-8); + self::assertEqualsWithDelta($expectedResultExcel, $resultExcel, 1E-8); Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE); $resultOpenOffice = DateTime::DAYOFMONTH($dateTimeValue); - $this->assertEqualsWithDelta($expectedResultOpenOffice, $resultOpenOffice, 1E-8); + self::assertEqualsWithDelta($expectedResultOpenOffice, $resultOpenOffice, 1E-8); } public function providerDAY() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/Days360Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/Days360Test.php index 40e86f31..47449e0d 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/Days360Test.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/Days360Test.php @@ -24,10 +24,10 @@ class Days360Test extends TestCase * @param $endDate * @param $method */ - public function testDAYS360($expectedResult, $startDate, $endDate, $method) + public function testDAYS360($expectedResult, $startDate, $endDate, $method): void { $result = DateTime::DAYS360($startDate, $endDate, $method); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerDAYS360() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DaysTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DaysTest.php index 3c043950..fe31dfcc 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DaysTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DaysTest.php @@ -23,10 +23,10 @@ class DaysTest extends TestCase * @param $endDate * @param $startDate */ - public function testDAYS($expectedResult, $endDate, $startDate) + public function testDAYS($expectedResult, $endDate, $startDate): void { $result = DateTime::DAYS($endDate, $startDate); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerDAYS() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EDateTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EDateTest.php index f931543e..a887ba5b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EDateTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EDateTest.php @@ -23,10 +23,10 @@ class EDateTest extends TestCase * @param $dateValue * @param $adjustmentMonths */ - public function testEDATE($expectedResult, $dateValue, $adjustmentMonths) + public function testEDATE($expectedResult, $dateValue, $adjustmentMonths): void { $result = DateTime::EDATE($dateValue, $adjustmentMonths); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerEDATE() @@ -34,25 +34,25 @@ class EDateTest extends TestCase return require 'tests/data/Calculation/DateTime/EDATE.php'; } - public function testEDATEtoUnixTimestamp() + public function testEDATEtoUnixTimestamp(): void { Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP); $result = DateTime::EDATE('2012-1-26', -1); - $this->assertEquals(1324857600, $result); - $this->assertEqualsWithDelta(1324857600, $result, 1E-8); + self::assertEquals(1324857600, $result); + self::assertEqualsWithDelta(1324857600, $result, 1E-8); } - public function testEDATEtoDateTimeObject() + public function testEDATEtoDateTimeObject(): void { Functions::setReturnDateType(Functions::RETURNDATE_PHP_DATETIME_OBJECT); $result = DateTime::EDATE('2012-1-26', -1); // Must return an object... - $this->assertIsObject($result); + self::assertIsObject($result); // ... of the correct type - $this->assertTrue(is_a($result, 'DateTimeInterface')); + self::assertTrue(is_a($result, 'DateTimeInterface')); // ... with the correct value - $this->assertEquals($result->format('d-M-Y'), '26-Dec-2011'); + self::assertEquals($result->format('d-M-Y'), '26-Dec-2011'); } } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EoMonthTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EoMonthTest.php index 7c8352fe..f9c54039 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EoMonthTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EoMonthTest.php @@ -23,10 +23,10 @@ class EoMonthTest extends TestCase * @param $dateValue * @param $adjustmentMonths */ - public function testEOMONTH($expectedResult, $dateValue, $adjustmentMonths) + public function testEOMONTH($expectedResult, $dateValue, $adjustmentMonths): void { $result = DateTime::EOMONTH($dateValue, $adjustmentMonths); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerEOMONTH() @@ -34,25 +34,25 @@ class EoMonthTest extends TestCase return require 'tests/data/Calculation/DateTime/EOMONTH.php'; } - public function testEOMONTHtoUnixTimestamp() + public function testEOMONTHtoUnixTimestamp(): void { Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP); $result = DateTime::EOMONTH('2012-1-26', -1); - $this->assertEquals(1325289600, $result); - $this->assertEqualsWithDelta(1325289600, $result, 1E-8); + self::assertEquals(1325289600, $result); + self::assertEqualsWithDelta(1325289600, $result, 1E-8); } - public function testEOMONTHtoDateTimeObject() + public function testEOMONTHtoDateTimeObject(): void { Functions::setReturnDateType(Functions::RETURNDATE_PHP_DATETIME_OBJECT); $result = DateTime::EOMONTH('2012-1-26', -1); // Must return an object... - $this->assertIsObject($result); + self::assertIsObject($result); // ... of the correct type - $this->assertTrue(is_a($result, 'DateTimeInterface')); + self::assertTrue(is_a($result, 'DateTimeInterface')); // ... with the correct value - $this->assertEquals($result->format('d-M-Y'), '31-Dec-2011'); + self::assertEquals($result->format('d-M-Y'), '31-Dec-2011'); } } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/HourTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/HourTest.php index 5110f93c..2d0cd5d1 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/HourTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/HourTest.php @@ -22,10 +22,10 @@ class HourTest extends TestCase * @param mixed $expectedResult * @param $dateTimeValue */ - public function testHOUR($expectedResult, $dateTimeValue) + public function testHOUR($expectedResult, $dateTimeValue): void { $result = DateTime::HOUROFDAY($dateTimeValue); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerHOUR() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/IsoWeekNumTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/IsoWeekNumTest.php index 608a1bf8..1ef0080a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/IsoWeekNumTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/IsoWeekNumTest.php @@ -22,10 +22,10 @@ class IsoWeekNumTest extends TestCase * @param mixed $expectedResult * @param mixed $dateValue */ - public function testISOWEEKNUM($expectedResult, $dateValue) + public function testISOWEEKNUM($expectedResult, $dateValue): void { $result = DateTime::ISOWEEKNUM($dateValue); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerISOWEEKNUM() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MinuteTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MinuteTest.php index 36e248be..8472c6de 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MinuteTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MinuteTest.php @@ -22,10 +22,10 @@ class MinuteTest extends TestCase * @param mixed $expectedResult * @param $dateTimeValue */ - public function testMINUTE($expectedResult, $dateTimeValue) + public function testMINUTE($expectedResult, $dateTimeValue): void { $result = DateTime::MINUTE($dateTimeValue); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerMINUTE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MonthTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MonthTest.php index 8f938c83..62513702 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MonthTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MonthTest.php @@ -22,10 +22,10 @@ class MonthTest extends TestCase * @param mixed $expectedResult * @param $dateTimeValue */ - public function testMONTH($expectedResult, $dateTimeValue) + public function testMONTH($expectedResult, $dateTimeValue): void { $result = DateTime::MONTHOFYEAR($dateTimeValue); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerMONTH() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/NetworkDaysTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/NetworkDaysTest.php index 4fa86be8..e366c44e 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/NetworkDaysTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/NetworkDaysTest.php @@ -21,10 +21,10 @@ class NetworkDaysTest extends TestCase * * @param mixed $expectedResult */ - public function testNETWORKDAYS($expectedResult, ...$args) + public function testNETWORKDAYS($expectedResult, ...$args): void { $result = DateTime::NETWORKDAYS(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerNETWORKDAYS() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/SecondTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/SecondTest.php index e1032b94..bc2b0752 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/SecondTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/SecondTest.php @@ -22,10 +22,10 @@ class SecondTest extends TestCase * @param mixed $expectedResult * @param $dateTimeValue */ - public function testSECOND($expectedResult, $dateTimeValue) + public function testSECOND($expectedResult, $dateTimeValue): void { $result = DateTime::SECOND($dateTimeValue); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerSECOND() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeTest.php index 1cd0c89b..344061d4 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeTest.php @@ -21,10 +21,10 @@ class TimeTest extends TestCase * * @param mixed $expectedResult */ - public function testTIME($expectedResult, ...$args) + public function testTIME($expectedResult, ...$args): void { $result = DateTime::TIME(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerTIME() @@ -32,24 +32,24 @@ class TimeTest extends TestCase return require 'tests/data/Calculation/DateTime/TIME.php'; } - public function testTIMEtoUnixTimestamp() + public function testTIMEtoUnixTimestamp(): void { Functions::setReturnDateType(Functions::RETURNDATE_PHP_NUMERIC); $result = DateTime::TIME(7, 30, 20); - $this->assertEqualsWithDelta(27020, $result, 1E-8); + self::assertEqualsWithDelta(27020, $result, 1E-8); } - public function testTIMEtoDateTimeObject() + public function testTIMEtoDateTimeObject(): void { Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); $result = DateTime::TIME(7, 30, 20); // Must return an object... - $this->assertIsObject($result); + self::assertIsObject($result); // ... of the correct type - $this->assertTrue(is_a($result, 'DateTimeInterface')); + self::assertTrue(is_a($result, 'DateTimeInterface')); // ... with the correct value - $this->assertEquals($result->format('H:i:s'), '07:30:20'); + self::assertEquals($result->format('H:i:s'), '07:30:20'); } } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeValueTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeValueTest.php index ed025cff..04b8c058 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeValueTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeValueTest.php @@ -22,10 +22,10 @@ class TimeValueTest extends TestCase * @param mixed $expectedResult * @param $timeValue */ - public function testTIMEVALUE($expectedResult, $timeValue) + public function testTIMEVALUE($expectedResult, $timeValue): void { $result = DateTime::TIMEVALUE($timeValue); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerTIMEVALUE() @@ -33,25 +33,25 @@ class TimeValueTest extends TestCase return require 'tests/data/Calculation/DateTime/TIMEVALUE.php'; } - public function testTIMEVALUEtoUnixTimestamp() + public function testTIMEVALUEtoUnixTimestamp(): void { Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP); $result = DateTime::TIMEVALUE('7:30:20'); - $this->assertEquals(23420, $result); - $this->assertEqualsWithDelta(23420, $result, 1E-8); + self::assertEquals(23420, $result); + self::assertEqualsWithDelta(23420, $result, 1E-8); } - public function testTIMEVALUEtoDateTimeObject() + public function testTIMEVALUEtoDateTimeObject(): void { Functions::setReturnDateType(Functions::RETURNDATE_PHP_DATETIME_OBJECT); $result = DateTime::TIMEVALUE('7:30:20'); // Must return an object... - $this->assertIsObject($result); + self::assertIsObject($result); // ... of the correct type - $this->assertTrue(is_a($result, 'DateTimeInterface')); + self::assertTrue(is_a($result, 'DateTimeInterface')); // ... with the correct value - $this->assertEquals($result->format('H:i:s'), '07:30:20'); + self::assertEquals($result->format('H:i:s'), '07:30:20'); } } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekDayTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekDayTest.php index fe81c1a4..c5b89e01 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekDayTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekDayTest.php @@ -21,10 +21,10 @@ class WeekDayTest extends TestCase * * @param mixed $expectedResult */ - public function testWEEKDAY($expectedResult, ...$args) + public function testWEEKDAY($expectedResult, ...$args): void { $result = DateTime::WEEKDAY(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerWEEKDAY() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekNumTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekNumTest.php index 96c2077b..9d8e1eb2 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekNumTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekNumTest.php @@ -21,10 +21,10 @@ class WeekNumTest extends TestCase * * @param mixed $expectedResult */ - public function testWEEKNUM($expectedResult, ...$args) + public function testWEEKNUM($expectedResult, ...$args): void { $result = DateTime::WEEKNUM(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerWEEKNUM() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WorkDayTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WorkDayTest.php index bc6fd6cc..4784e463 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WorkDayTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WorkDayTest.php @@ -21,10 +21,10 @@ class WorkDayTest extends TestCase * * @param mixed $expectedResult */ - public function testWORKDAY($expectedResult, ...$args) + public function testWORKDAY($expectedResult, ...$args): void { $result = DateTime::WORKDAY(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerWORKDAY() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearFracTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearFracTest.php index 37364030..05f11310 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearFracTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearFracTest.php @@ -21,10 +21,10 @@ class YearFracTest extends TestCase * * @param mixed $expectedResult */ - public function testYEARFRAC($expectedResult, ...$args) + public function testYEARFRAC($expectedResult, ...$args): void { $result = DateTime::YEARFRAC(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerYEARFRAC() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearTest.php index 26e416ec..bbdaf92a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearTest.php @@ -22,10 +22,10 @@ class YearTest extends TestCase * @param mixed $expectedResult * @param $dateTimeValue */ - public function testYEAR($expectedResult, $dateTimeValue) + public function testYEAR($expectedResult, $dateTimeValue): void { $result = DateTime::YEAR($dateTimeValue); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerYEAR() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselITest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselITest.php index d7b23909..8fff98af 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselITest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselITest.php @@ -20,10 +20,10 @@ class BesselITest extends TestCase * * @param mixed $expectedResult */ - public function testBESSELI($expectedResult, ...$args) + public function testBESSELI($expectedResult, ...$args): void { $result = Engineering::BESSELI(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, self::BESSEL_PRECISION); + self::assertEqualsWithDelta($expectedResult, $result, self::BESSEL_PRECISION); } public function providerBESSELI() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselJTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselJTest.php index 5e4d2f3b..d10f028f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselJTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselJTest.php @@ -20,10 +20,10 @@ class BesselJTest extends TestCase * * @param mixed $expectedResult */ - public function testBESSELJ($expectedResult, ...$args) + public function testBESSELJ($expectedResult, ...$args): void { $result = Engineering::BESSELJ(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, self::BESSEL_PRECISION); + self::assertEqualsWithDelta($expectedResult, $result, self::BESSEL_PRECISION); } public function providerBESSEJ() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselKTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselKTest.php index 6a048f37..27123a26 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselKTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselKTest.php @@ -20,10 +20,10 @@ class BesselKTest extends TestCase * * @param mixed $expectedResult */ - public function testBESSELK($expectedResult, ...$args) + public function testBESSELK($expectedResult, ...$args): void { $result = Engineering::BESSELK(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, self::BESSEL_PRECISION); + self::assertEqualsWithDelta($expectedResult, $result, self::BESSEL_PRECISION); } public function providerBESSELK() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselYTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselYTest.php index 98c238e2..ab55f0ac 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselYTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselYTest.php @@ -20,10 +20,10 @@ class BesselYTest extends TestCase * * @param mixed $expectedResult */ - public function testBESSELY($expectedResult, ...$args) + public function testBESSELY($expectedResult, ...$args): void { $result = Engineering::BESSELY(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, self::BESSEL_PRECISION); + self::assertEqualsWithDelta($expectedResult, $result, self::BESSEL_PRECISION); } public function providerBESSELY() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2DecTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2DecTest.php index 341493ea..faba3de8 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2DecTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2DecTest.php @@ -18,10 +18,10 @@ class Bin2DecTest extends TestCase * * @param mixed $expectedResult */ - public function testBIN2DEC($expectedResult, ...$args) + public function testBIN2DEC($expectedResult, ...$args): void { $result = Engineering::BINTODEC(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerBIN2DEC() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2HexTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2HexTest.php index 63945fd1..2a16d5ac 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2HexTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2HexTest.php @@ -18,10 +18,10 @@ class Bin2HexTest extends TestCase * * @param mixed $expectedResult */ - public function testBIN2HEX($expectedResult, ...$args) + public function testBIN2HEX($expectedResult, ...$args): void { $result = Engineering::BINTOHEX(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerBIN2HEX() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2OctTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2OctTest.php index 2aeeb1bc..78db6a6e 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2OctTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2OctTest.php @@ -18,10 +18,10 @@ class Bin2OctTest extends TestCase * * @param mixed $expectedResult */ - public function testBIN2OCT($expectedResult, ...$args) + public function testBIN2OCT($expectedResult, ...$args): void { $result = Engineering::BINTOOCT(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerBIN2OCT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitAndTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitAndTest.php index 483bf099..e73efccc 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitAndTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitAndTest.php @@ -19,10 +19,10 @@ class BitAndTest extends TestCase * @param mixed $expectedResult * @param mixed[] $args */ - public function testBITAND($expectedResult, array $args) + public function testBITAND($expectedResult, array $args): void { $result = Engineering::BITAND(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerBITAND() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitLShiftTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitLShiftTest.php index bf280f16..61aa89b4 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitLShiftTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitLShiftTest.php @@ -19,10 +19,10 @@ class BitLShiftTest extends TestCase * @param mixed $expectedResult * @param mixed[] $args */ - public function testBITLSHIFT($expectedResult, array $args) + public function testBITLSHIFT($expectedResult, array $args): void { $result = Engineering::BITLSHIFT(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerBITLSHIFT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitOrTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitOrTest.php index 6e455431..857c7466 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitOrTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitOrTest.php @@ -19,10 +19,10 @@ class BitOrTest extends TestCase * @param mixed $expectedResult * @param mixed[] $args */ - public function testBITOR($expectedResult, array $args) + public function testBITOR($expectedResult, array $args): void { $result = Engineering::BITOR(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerBITOR() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitRShiftTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitRShiftTest.php index 26bece53..26b13d07 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitRShiftTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitRShiftTest.php @@ -19,10 +19,10 @@ class BitRShiftTest extends TestCase * @param mixed $expectedResult * @param mixed[] $args */ - public function testBITRSHIFT($expectedResult, array $args) + public function testBITRSHIFT($expectedResult, array $args): void { $result = Engineering::BITRSHIFT(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerBITRSHIFT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitXorTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitXorTest.php index 51401f63..4415f6da 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitXorTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitXorTest.php @@ -19,10 +19,10 @@ class BitXorTest extends TestCase * @param mixed $expectedResult * @param mixed[] $args */ - public function testBITXOR($expectedResult, array $args) + public function testBITXOR($expectedResult, array $args): void { $result = Engineering::BITXOR(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerBITXOR() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ComplexTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ComplexTest.php index 5bb7fbcd..4b857e2d 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ComplexTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ComplexTest.php @@ -18,10 +18,10 @@ class ComplexTest extends TestCase * * @param mixed $expectedResult */ - public function testCOMPLEX($expectedResult, ...$args) + public function testCOMPLEX($expectedResult, ...$args): void { $result = Engineering::COMPLEX(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerCOMPLEX() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php index 3d6a0777..7a18067f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php @@ -13,28 +13,28 @@ class ConvertUoMTest extends TestCase Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); } - public function testGetConversionGroups() + public function testGetConversionGroups(): void { $result = Engineering::getConversionGroups(); - $this->assertIsArray($result); + self::assertIsArray($result); } - public function testGetConversionGroupUnits() + public function testGetConversionGroupUnits(): void { $result = Engineering::getConversionGroupUnits(); - $this->assertIsArray($result); + self::assertIsArray($result); } - public function testGetConversionGroupUnitDetails() + public function testGetConversionGroupUnitDetails(): void { $result = Engineering::getConversionGroupUnitDetails(); - $this->assertIsArray($result); + self::assertIsArray($result); } - public function testGetConversionMultipliers() + public function testGetConversionMultipliers(): void { $result = Engineering::getConversionMultipliers(); - $this->assertIsArray($result); + self::assertIsArray($result); } /** @@ -42,10 +42,10 @@ class ConvertUoMTest extends TestCase * * @param mixed $expectedResult */ - public function testCONVERTUOM($expectedResult, ...$args) + public function testCONVERTUOM($expectedResult, ...$args): void { $result = Engineering::CONVERTUOM(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerCONVERTUOM() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2BinTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2BinTest.php index 740fe3c9..3626ac6b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2BinTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2BinTest.php @@ -18,10 +18,10 @@ class Dec2BinTest extends TestCase * * @param mixed $expectedResult */ - public function testDEC2BIN($expectedResult, ...$args) + public function testDEC2BIN($expectedResult, ...$args): void { $result = Engineering::DECTOBIN(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerDEC2BIN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2HexTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2HexTest.php index c7aae441..d191f620 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2HexTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2HexTest.php @@ -18,10 +18,10 @@ class Dec2HexTest extends TestCase * * @param mixed $expectedResult */ - public function testDEC2HEX($expectedResult, ...$args) + public function testDEC2HEX($expectedResult, ...$args): void { $result = Engineering::DECTOHEX(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerDEC2HEX() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2OctTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2OctTest.php index 68456d1a..61eb3dbb 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2OctTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2OctTest.php @@ -18,10 +18,10 @@ class Dec2OctTest extends TestCase * * @param mixed $expectedResult */ - public function testDEC2OCT($expectedResult, ...$args) + public function testDEC2OCT($expectedResult, ...$args): void { $result = Engineering::DECTOOCT(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerDEC2OCT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/DeltaTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/DeltaTest.php index fc2df95b..a93d2ea6 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/DeltaTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/DeltaTest.php @@ -18,10 +18,10 @@ class DeltaTest extends TestCase * * @param mixed $expectedResult */ - public function testDELTA($expectedResult, ...$args) + public function testDELTA($expectedResult, ...$args): void { $result = Engineering::DELTA(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerDELTA() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfCTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfCTest.php index 5409db5f..09bf448e 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfCTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfCTest.php @@ -20,11 +20,11 @@ class ErfCTest extends TestCase * * @param mixed $expectedResult */ - public function testERFC($expectedResult, ...$args) + public function testERFC($expectedResult, ...$args): void { $result = Engineering::ERFC(...$args); - $this->assertEquals($expectedResult, $result); - $this->assertEqualsWithDelta($expectedResult, $result, self::ERF_PRECISION); + self::assertEquals($expectedResult, $result); + self::assertEqualsWithDelta($expectedResult, $result, self::ERF_PRECISION); } public function providerERFC() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfPreciseTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfPreciseTest.php index 857e41c1..eb26ae98 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfPreciseTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfPreciseTest.php @@ -20,11 +20,11 @@ class ErfPreciseTest extends TestCase * * @param mixed $expectedResult */ - public function testERFPRECISE($expectedResult, ...$args) + public function testERFPRECISE($expectedResult, ...$args): void { $result = Engineering::ERFPRECISE(...$args); - $this->assertEquals($expectedResult, $result); - $this->assertEqualsWithDelta($expectedResult, $result, self::ERF_PRECISION); + self::assertEquals($expectedResult, $result); + self::assertEqualsWithDelta($expectedResult, $result, self::ERF_PRECISION); } public function providerERFPRECISE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfTest.php index d148501b..8201edbc 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfTest.php @@ -20,11 +20,11 @@ class ErfTest extends TestCase * * @param mixed $expectedResult */ - public function testERF($expectedResult, ...$args) + public function testERF($expectedResult, ...$args): void { $result = Engineering::ERF(...$args); - $this->assertEquals($expectedResult, $result); - $this->assertEqualsWithDelta($expectedResult, $result, self::ERF_PRECISION); + self::assertEquals($expectedResult, $result); + self::assertEqualsWithDelta($expectedResult, $result, self::ERF_PRECISION); } public function providerERF() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/GeStepTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/GeStepTest.php index 24ba1a0f..370c1a82 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/GeStepTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/GeStepTest.php @@ -18,10 +18,10 @@ class GeStepTest extends TestCase * * @param mixed $expectedResult */ - public function testGESTEP($expectedResult, ...$args) + public function testGESTEP($expectedResult, ...$args): void { $result = Engineering::GESTEP(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerGESTEP() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2BinTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2BinTest.php index 83fcb1e7..44d8908d 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2BinTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2BinTest.php @@ -18,10 +18,10 @@ class Hex2BinTest extends TestCase * * @param mixed $expectedResult */ - public function testHEX2BIN($expectedResult, ...$args) + public function testHEX2BIN($expectedResult, ...$args): void { $result = Engineering::HEXTOBIN(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerHEX2BIN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2DecTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2DecTest.php index 5765494e..b388b2b7 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2DecTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2DecTest.php @@ -18,10 +18,10 @@ class Hex2DecTest extends TestCase * * @param mixed $expectedResult */ - public function testHEX2DEC($expectedResult, ...$args) + public function testHEX2DEC($expectedResult, ...$args): void { $result = Engineering::HEXTODEC(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerHEX2DEC() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2OctTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2OctTest.php index 25ba6300..bc0a5cb7 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2OctTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2OctTest.php @@ -18,10 +18,10 @@ class Hex2OctTest extends TestCase * * @param mixed $expectedResult */ - public function testHEX2OCT($expectedResult, ...$args) + public function testHEX2OCT($expectedResult, ...$args): void { $result = Engineering::HEXTOOCT(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerHEX2OCT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImAbsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImAbsTest.php index c812fdfa..1f1ee9dd 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImAbsTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImAbsTest.php @@ -21,10 +21,10 @@ class ImAbsTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMABS($expectedResult, $value) + public function testIMABS($expectedResult, $value): void { $result = Engineering::IMABS($value); - $this->assertEqualsWithDelta($expectedResult, $result, self::COMPLEX_PRECISION); + self::assertEqualsWithDelta($expectedResult, $result, self::COMPLEX_PRECISION); } public function providerIMABS() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImArgumentTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImArgumentTest.php index 60883e14..6f1a6485 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImArgumentTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImArgumentTest.php @@ -21,10 +21,10 @@ class ImArgumentTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMARGUMENT($expectedResult, $value) + public function testIMARGUMENT($expectedResult, $value): void { $result = Engineering::IMARGUMENT($value); - $this->assertEqualsWithDelta($expectedResult, $result, self::COMPLEX_PRECISION); + self::assertEqualsWithDelta($expectedResult, $result, self::COMPLEX_PRECISION); } public function providerIMARGUMENT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImConjugateTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImConjugateTest.php index 81323a53..bc3a3918 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImConjugateTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImConjugateTest.php @@ -33,10 +33,10 @@ class ImConjugateTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMCONJUGATE($expectedResult, $value) + public function testIMCONJUGATE($expectedResult, $value): void { $result = Engineering::IMCONJUGATE($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCosTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCosTest.php index c1c610fb..693f0bab 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCosTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCosTest.php @@ -33,10 +33,10 @@ class ImCosTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMCOS($expectedResult, $value) + public function testIMCOS($expectedResult, $value): void { $result = Engineering::IMCOS($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCoshTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCoshTest.php index 7dacb7cd..ae035fef 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCoshTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCoshTest.php @@ -33,10 +33,10 @@ class ImCoshTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMCOSH($expectedResult, $value) + public function testIMCOSH($expectedResult, $value): void { $result = Engineering::IMCOSH($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCotTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCotTest.php index 512d96f9..8b888b3f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCotTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCotTest.php @@ -33,10 +33,10 @@ class ImCotTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMCOT($expectedResult, $value) + public function testIMCOT($expectedResult, $value): void { $result = Engineering::IMCOT($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php index 5fb3f49d..5a08c0b6 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php @@ -33,10 +33,10 @@ class ImCscTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMCSC($expectedResult, $value) + public function testIMCSC($expectedResult, $value): void { $result = Engineering::IMCSC($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCschTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCschTest.php index 9b1934bb..a95a4eaf 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCschTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCschTest.php @@ -33,10 +33,10 @@ class ImCschTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMCSCH($expectedResult, $value) + public function testIMCSCH($expectedResult, $value): void { $result = Engineering::IMCSCH($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImDivTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImDivTest.php index 7809ab06..2bc91619 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImDivTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImDivTest.php @@ -32,10 +32,10 @@ class ImDivTest extends TestCase * * @param mixed $expectedResult */ - public function testIMDIV($expectedResult, ...$args) + public function testIMDIV($expectedResult, ...$args): void { $result = Engineering::IMDIV(...$args); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImExpTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImExpTest.php index 3af044d7..7debbc9c 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImExpTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImExpTest.php @@ -33,10 +33,10 @@ class ImExpTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMEXP($expectedResult, $value) + public function testIMEXP($expectedResult, $value): void { $result = Engineering::IMEXP($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLnTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLnTest.php index bb09860a..3e270975 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLnTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLnTest.php @@ -33,10 +33,10 @@ class ImLnTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMLN($expectedResult, $value) + public function testIMLN($expectedResult, $value): void { $result = Engineering::IMLN($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog10Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog10Test.php index 4831387d..2a4db7fb 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog10Test.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog10Test.php @@ -33,10 +33,10 @@ class ImLog10Test extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMLOG10($expectedResult, $value) + public function testIMLOG10($expectedResult, $value): void { $result = Engineering::IMLOG10($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog2Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog2Test.php index b6f25123..53b302dd 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog2Test.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog2Test.php @@ -33,10 +33,10 @@ class ImLog2Test extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMLOG2($expectedResult, $value) + public function testIMLOG2($expectedResult, $value): void { $result = Engineering::IMLOG2($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImPowerTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImPowerTest.php index c198ffb9..41e52878 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImPowerTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImPowerTest.php @@ -32,10 +32,10 @@ class ImPowerTest extends TestCase * * @param mixed $expectedResult */ - public function testIMPOWER($expectedResult, ...$args) + public function testIMPOWER($expectedResult, ...$args): void { $result = Engineering::IMPOWER(...$args); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImProductTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImProductTest.php index 2fd383c4..43495739 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImProductTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImProductTest.php @@ -32,10 +32,10 @@ class ImProductTest extends TestCase * * @param mixed $expectedResult */ - public function testIMPRODUCT($expectedResult, ...$args) + public function testIMPRODUCT($expectedResult, ...$args): void { $result = Engineering::IMPRODUCT(...$args); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImRealTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImRealTest.php index bd4baf9f..08d2feb1 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImRealTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImRealTest.php @@ -21,10 +21,10 @@ class ImRealTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMREAL($expectedResult, $value) + public function testIMREAL($expectedResult, $value): void { $result = Engineering::IMREAL($value); - $this->assertEqualsWithDelta($expectedResult, $result, self::COMPLEX_PRECISION); + self::assertEqualsWithDelta($expectedResult, $result, self::COMPLEX_PRECISION); } public function providerIMREAL() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSecTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSecTest.php index 4de6fcff..e785d3ac 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSecTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSecTest.php @@ -33,10 +33,10 @@ class ImSecTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMSEC($expectedResult, $value) + public function testIMSEC($expectedResult, $value): void { $result = Engineering::IMSEC($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSechTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSechTest.php index 11aa8e28..22cb6fae 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSechTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSechTest.php @@ -33,10 +33,10 @@ class ImSechTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMSECH($expectedResult, $value) + public function testIMSECH($expectedResult, $value): void { $result = Engineering::IMSECH($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinTest.php index f3c6afe9..dd797a35 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinTest.php @@ -33,10 +33,10 @@ class ImSinTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMSIN($expectedResult, $value) + public function testIMSIN($expectedResult, $value): void { $result = Engineering::IMSIN($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinhTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinhTest.php index 7478c15c..4174d1c0 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinhTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinhTest.php @@ -33,10 +33,10 @@ class ImSinhTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMSINH($expectedResult, $value) + public function testIMSINH($expectedResult, $value): void { $result = Engineering::IMSINH($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSqrtTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSqrtTest.php index f9a15195..091b11c5 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSqrtTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSqrtTest.php @@ -33,10 +33,10 @@ class ImSqrtTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMSQRT($expectedResult, $value) + public function testIMSQRT($expectedResult, $value): void { $result = Engineering::IMSQRT($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSubTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSubTest.php index 2ddc3f57..79286120 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSubTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSubTest.php @@ -32,10 +32,10 @@ class ImSubTest extends TestCase * * @param mixed $expectedResult */ - public function testIMSUB($expectedResult, ...$args) + public function testIMSUB($expectedResult, ...$args): void { $result = Engineering::IMSUB(...$args); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSumTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSumTest.php index 23f716ca..8abc3638 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSumTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSumTest.php @@ -32,10 +32,10 @@ class ImSumTest extends TestCase * * @param mixed $expectedResult */ - public function testIMSUM($expectedResult, ...$args) + public function testIMSUM($expectedResult, ...$args): void { $result = Engineering::IMSUM(...$args); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImTanTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImTanTest.php index d9f39ad5..57b23815 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImTanTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImTanTest.php @@ -33,10 +33,10 @@ class ImTanTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMTAN($expectedResult, $value) + public function testIMTAN($expectedResult, $value): void { $result = Engineering::IMTAN($value); - $this->assertTrue( + self::assertTrue( $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), $this->complexAssert->getErrorMessage() ); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImaginaryTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImaginaryTest.php index 4d2e6781..6ad72287 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImaginaryTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImaginaryTest.php @@ -21,10 +21,10 @@ class ImaginaryTest extends TestCase * @param mixed $expectedResult * @param mixed $value */ - public function testIMAGINARY($expectedResult, $value) + public function testIMAGINARY($expectedResult, $value): void { $result = Engineering::IMAGINARY($value); - $this->assertEqualsWithDelta($expectedResult, $result, self::COMPLEX_PRECISION); + self::assertEqualsWithDelta($expectedResult, $result, self::COMPLEX_PRECISION); } public function providerIMAGINARY() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2BinTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2BinTest.php index 217494fa..e56c8652 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2BinTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2BinTest.php @@ -18,10 +18,10 @@ class Oct2BinTest extends TestCase * * @param mixed $expectedResult */ - public function testOCT2BIN($expectedResult, ...$args) + public function testOCT2BIN($expectedResult, ...$args): void { $result = Engineering::OCTTOBIN(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerOCT2BIN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2DecTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2DecTest.php index c959236c..87e213ef 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2DecTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2DecTest.php @@ -18,10 +18,10 @@ class Oct2DecTest extends TestCase * * @param mixed $expectedResult */ - public function testOCT2DEC($expectedResult, ...$args) + public function testOCT2DEC($expectedResult, ...$args): void { $result = Engineering::OCTTODEC(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerOCT2DEC() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2HexTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2HexTest.php index 1d14bd78..e2d75a78 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2HexTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2HexTest.php @@ -18,10 +18,10 @@ class Oct2HexTest extends TestCase * * @param mixed $expectedResult */ - public function testOCT2HEX($expectedResult, ...$args) + public function testOCT2HEX($expectedResult, ...$args): void { $result = Engineering::OCTTOHEX(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerOCT2HEX() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ParseComplexTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ParseComplexTest.php index bc1437a3..1022052e 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ParseComplexTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ParseComplexTest.php @@ -13,16 +13,16 @@ class ParseComplexTest extends TestCase Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); } - public function testParseComplex() + public function testParseComplex(): void { [$real, $imaginary, $suffix] = [1.23e-4, 5.67e+8, 'j']; $result = Engineering::parseComplex('1.23e-4+5.67e+8j'); - $this->assertArrayHasKey('real', $result); - $this->assertEquals($real, $result['real']); - $this->assertArrayHasKey('imaginary', $result); - $this->assertEquals($imaginary, $result['imaginary']); - $this->assertArrayHasKey('suffix', $result); - $this->assertEquals($suffix, $result['suffix']); + self::assertArrayHasKey('real', $result); + self::assertEquals($real, $result['real']); + self::assertArrayHasKey('imaginary', $result); + self::assertEquals($imaginary, $result['imaginary']); + self::assertArrayHasKey('suffix', $result); + self::assertEquals($suffix, $result['suffix']); } } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Financial/AccrintMTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Financial/AccrintMTest.php index 33921bb3..597db5c2 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Financial/AccrintMTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Financial/AccrintMTest.php @@ -18,7 +18,7 @@ class AccrintMTest extends TestCase * * @param mixed $expectedResult */ - public function testACCRINTM($expectedResult, ...$args) + public function testACCRINTM($expectedResult, ...$args): void { $result = Financial::ACCRINTM(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Financial/AccrintTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Financial/AccrintTest.php index 21aadd0a..edb79230 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Financial/AccrintTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Financial/AccrintTest.php @@ -18,10 +18,10 @@ class AccrintTest extends TestCase * * @param mixed $expectedResult */ - public function testACCRINT($expectedResult, ...$args) + public function testACCRINT($expectedResult, ...$args): void { $result = Financial::ACCRINT(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerACCRINT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/AndTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/AndTest.php index c1334988..d315e82a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/AndTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/AndTest.php @@ -18,10 +18,10 @@ class AndTest extends TestCase * * @param mixed $expectedResult */ - public function testAND($expectedResult, ...$args) + public function testAND($expectedResult, ...$args): void { $result = Logical::logicalAnd(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerAND() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/FalseTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/FalseTest.php index c546554e..1fa78af0 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/FalseTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/FalseTest.php @@ -13,9 +13,9 @@ class FalseTest extends TestCase Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); } - public function testFALSE() + public function testFALSE(): void { $result = Logical::FALSE(); - $this->assertFalse($result); + self::assertFalse($result); } } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/IfErrorTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/IfErrorTest.php index 1e9ef8bc..c1602eda 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/IfErrorTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/IfErrorTest.php @@ -20,10 +20,10 @@ class IfErrorTest extends TestCase * @param $value * @param $return */ - public function testIFERROR($expectedResult, $value, $return) + public function testIFERROR($expectedResult, $value, $return): void { $result = Logical::IFERROR($value, $return); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerIFERROR() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/IfNaTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/IfNaTest.php index e151cd75..2976761a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/IfNaTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/IfNaTest.php @@ -20,10 +20,10 @@ class IfNaTest extends TestCase * @param $value * @param $return */ - public function testIFNA($expectedResult, $value, $return) + public function testIFNA($expectedResult, $value, $return): void { $result = Logical::IFNA($value, $return); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerIFNA() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/IfTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/IfTest.php index f289995a..571a80e3 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/IfTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/IfTest.php @@ -18,10 +18,10 @@ class IfTest extends TestCase * * @param mixed $expectedResult */ - public function testIF($expectedResult, ...$args) + public function testIF($expectedResult, ...$args): void { $result = Logical::statementIf(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerIF() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/NotTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/NotTest.php index abc0e5bc..4b7c70be 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/NotTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/NotTest.php @@ -18,10 +18,10 @@ class NotTest extends TestCase * * @param mixed $expectedResult */ - public function testNOT($expectedResult, ...$args) + public function testNOT($expectedResult, ...$args): void { $result = Logical::NOT(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerNOT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/OrTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/OrTest.php index 46046b7c..021cc97b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/OrTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/OrTest.php @@ -18,10 +18,10 @@ class OrTest extends TestCase * * @param mixed $expectedResult */ - public function testOR($expectedResult, ...$args) + public function testOR($expectedResult, ...$args): void { $result = Logical::logicalOr(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerOR() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/SwitchTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/SwitchTest.php index 2781334d..eacad823 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/SwitchTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/SwitchTest.php @@ -18,10 +18,10 @@ class SwitchTest extends TestCase * * @param mixed $expectedResult */ - public function testSWITCH($expectedResult, ...$args) + public function testSWITCH($expectedResult, ...$args): void { $result = Logical::statementSwitch(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerSwitch() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/TrueTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/TrueTest.php index 77166db0..21e65b76 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/TrueTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/TrueTest.php @@ -13,9 +13,9 @@ class TrueTest extends TestCase Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); } - public function testTRUE() + public function testTRUE(): void { $result = Logical::TRUE(); - $this->assertTrue($result); + self::assertTrue($result); } } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/XorTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/XorTest.php index 8f7a921b..8ca05f84 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/XorTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Logical/XorTest.php @@ -18,10 +18,10 @@ class XorTest extends TestCase * * @param mixed $expectedResult */ - public function testXOR($expectedResult, ...$args) + public function testXOR($expectedResult, ...$args): void { $result = Logical::logicalXor(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerXOR() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ChooseTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ChooseTest.php index 00e2c61c..01ba6f75 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ChooseTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ChooseTest.php @@ -18,10 +18,10 @@ class ChooseTest extends TestCase * * @param mixed $expectedResult */ - public function testCHOOSE($expectedResult, ...$args) + public function testCHOOSE($expectedResult, ...$args): void { $result = LookupRef::CHOOSE(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerCHOOSE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ColumnsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ColumnsTest.php index 61c0f8b4..a7908241 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ColumnsTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ColumnsTest.php @@ -18,10 +18,10 @@ class ColumnsTest extends TestCase * * @param mixed $expectedResult */ - public function testCOLUMNS($expectedResult, ...$args) + public function testCOLUMNS($expectedResult, ...$args): void { $result = LookupRef::COLUMNS(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerCOLUMNS() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/HLookupTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/HLookupTest.php index d317089d..767b6de8 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/HLookupTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/HLookupTest.php @@ -18,10 +18,10 @@ class HLookupTest extends TestCase * * @param mixed $expectedResult */ - public function testHLOOKUP($expectedResult, ...$args) + public function testHLOOKUP($expectedResult, ...$args): void { $result = LookupRef::HLOOKUP(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerHLOOKUP() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/IndexTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/IndexTest.php index 241d86f7..8ff66931 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/IndexTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/IndexTest.php @@ -18,10 +18,10 @@ class IndexTest extends TestCase * * @param mixed $expectedResult */ - public function testINDEX($expectedResult, ...$args) + public function testINDEX($expectedResult, ...$args): void { $result = LookupRef::INDEX(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerINDEX() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/LookupTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/LookupTest.php index 6e1fb73a..d1b36e4a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/LookupTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/LookupTest.php @@ -18,10 +18,10 @@ class LookupTest extends TestCase * * @param mixed $expectedResult */ - public function testLOOKUP($expectedResult, ...$args) + public function testLOOKUP($expectedResult, ...$args): void { $result = LookupRef::LOOKUP(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerLOOKUP() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/MatchTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/MatchTest.php index 2bf322fc..e020d3ba 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/MatchTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/MatchTest.php @@ -18,10 +18,10 @@ class MatchTest extends TestCase * * @param mixed $expectedResult */ - public function testMATCH($expectedResult, ...$args) + public function testMATCH($expectedResult, ...$args): void { $result = LookupRef::MATCH(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerMATCH() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/RowsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/RowsTest.php index 41b0bd2b..62a06626 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/RowsTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/RowsTest.php @@ -18,10 +18,10 @@ class RowsTest extends TestCase * * @param mixed $expectedResult */ - public function testROWS($expectedResult, ...$args) + public function testROWS($expectedResult, ...$args): void { $result = LookupRef::ROWS(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerROWS() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/VLookupTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/VLookupTest.php index bffecb8e..badf8f68 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/VLookupTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/VLookupTest.php @@ -18,10 +18,10 @@ class VLookupTest extends TestCase * * @param mixed $expectedResult */ - public function testVLOOKUP($expectedResult, ...$args) + public function testVLOOKUP($expectedResult, ...$args): void { $result = LookupRef::VLOOKUP(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerVLOOKUP() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcotTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcotTest.php index 2a3cd654..d81c3b9d 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcotTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcotTest.php @@ -19,10 +19,10 @@ class AcotTest extends TestCase * @param mixed $expectedResult * @param mixed $number */ - public function testACOT($expectedResult, $number) + public function testACOT($expectedResult, $number): void { $result = MathTrig::ACOT($number); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerACOT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcothTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcothTest.php index 9661b676..0a3864cc 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcothTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcothTest.php @@ -19,10 +19,10 @@ class AcothTest extends TestCase * @param mixed $expectedResult * @param mixed $number */ - public function testACOTH($expectedResult, $number) + public function testACOTH($expectedResult, $number): void { $result = MathTrig::ACOTH($number); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerACOTH() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ArabicTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ArabicTest.php index 0371e0a7..7b3a5e15 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ArabicTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ArabicTest.php @@ -19,10 +19,10 @@ class ArabicTest extends TestCase * @param mixed $expectedResult * @param string $romanNumeral */ - public function testARABIC($expectedResult, $romanNumeral) + public function testARABIC($expectedResult, $romanNumeral): void { $result = MathTrig::ARABIC($romanNumeral); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerARABIC() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/Atan2Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/Atan2Test.php index c6281fc2..4edec4cb 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/Atan2Test.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/Atan2Test.php @@ -20,10 +20,10 @@ class Atan2Test extends TestCase * @param mixed $x * @param mixed $y */ - public function testATAN2($expectedResult, $x, $y) + public function testATAN2($expectedResult, $x, $y): void { $result = MathTrig::ATAN2($x, $y); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerATAN2() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/BaseTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/BaseTest.php index fdca1f49..72b52559 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/BaseTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/BaseTest.php @@ -18,10 +18,10 @@ class BaseTest extends TestCase * * @param mixed $expectedResult */ - public function testBASE($expectedResult, ...$args) + public function testBASE($expectedResult, ...$args): void { $result = MathTrig::BASE(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerBASE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CeilingTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CeilingTest.php index c987cc2e..b60d7c30 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CeilingTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CeilingTest.php @@ -18,10 +18,10 @@ class CeilingTest extends TestCase * * @param mixed $expectedResult */ - public function testCEILING($expectedResult, ...$args) + public function testCEILING($expectedResult, ...$args): void { $result = MathTrig::CEILING(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCEILING() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CombinTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CombinTest.php index 8c982b6b..d9156339 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CombinTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CombinTest.php @@ -18,10 +18,10 @@ class CombinTest extends TestCase * * @param mixed $expectedResult */ - public function testCOMBIN($expectedResult, ...$args) + public function testCOMBIN($expectedResult, ...$args): void { $result = MathTrig::COMBIN(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCOMBIN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CotTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CotTest.php index f864d226..3fee6901 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CotTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CotTest.php @@ -19,10 +19,10 @@ class CotTest extends TestCase * @param mixed $expectedResult * @param mixed $angle */ - public function testCOT($expectedResult, $angle) + public function testCOT($expectedResult, $angle): void { $result = MathTrig::COT($angle); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCOT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CothTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CothTest.php index 9243c095..e3db23d5 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CothTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CothTest.php @@ -19,10 +19,10 @@ class CothTest extends TestCase * @param mixed $expectedResult * @param mixed $angle */ - public function testCOTH($expectedResult, $angle) + public function testCOTH($expectedResult, $angle): void { $result = MathTrig::COTH($angle); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCOTH() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CscTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CscTest.php index 24abad4e..675ebf57 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CscTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CscTest.php @@ -19,10 +19,10 @@ class CscTest extends TestCase * @param mixed $expectedResult * @param mixed $angle */ - public function testCSC($expectedResult, $angle) + public function testCSC($expectedResult, $angle): void { $result = MathTrig::CSC($angle); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCSC() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CschTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CschTest.php index 393c0883..c630be2f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CschTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CschTest.php @@ -19,10 +19,10 @@ class CschTest extends TestCase * @param mixed $expectedResult * @param mixed $angle */ - public function testCSCH($expectedResult, $angle) + public function testCSCH($expectedResult, $angle): void { $result = MathTrig::CSCH($angle); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCSCH() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/EvenTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/EvenTest.php index b81b119f..96c0b046 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/EvenTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/EvenTest.php @@ -19,10 +19,10 @@ class EvenTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testEVEN($expectedResult, $value) + public function testEVEN($expectedResult, $value): void { $result = MathTrig::EVEN($value); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerEVEN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactDoubleTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactDoubleTest.php index c3118942..f0b6b146 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactDoubleTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactDoubleTest.php @@ -19,10 +19,10 @@ class FactDoubleTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testFACTDOUBLE($expectedResult, $value) + public function testFACTDOUBLE($expectedResult, $value): void { $result = MathTrig::FACTDOUBLE($value); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerFACTDOUBLE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactTest.php index b765d412..f6092896 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactTest.php @@ -19,10 +19,10 @@ class FactTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testFACT($expectedResult, $value) + public function testFACT($expectedResult, $value): void { $result = MathTrig::FACT($value); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerFACT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorMathTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorMathTest.php index c5b797f1..d7d51b59 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorMathTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorMathTest.php @@ -18,10 +18,10 @@ class FloorMathTest extends TestCase * * @param mixed $expectedResult */ - public function testFLOORMATH($expectedResult, ...$args) + public function testFLOORMATH($expectedResult, ...$args): void { $result = MathTrig::FLOORMATH(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerFLOORMATH() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorPreciseTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorPreciseTest.php index 399f05d2..ae5a3199 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorPreciseTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorPreciseTest.php @@ -18,10 +18,10 @@ class FloorPreciseTest extends TestCase * * @param mixed $expectedResult */ - public function testFLOOR($expectedResult, ...$args) + public function testFLOOR($expectedResult, ...$args): void { $result = MathTrig::FLOORPRECISE(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerFLOORPRECISE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorTest.php index fac02f16..e66d97ae 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorTest.php @@ -18,10 +18,10 @@ class FloorTest extends TestCase * * @param mixed $expectedResult */ - public function testFLOOR($expectedResult, ...$args) + public function testFLOOR($expectedResult, ...$args): void { $result = MathTrig::FLOOR(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerFLOOR() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/GcdTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/GcdTest.php index 825a9d05..ce1aec3f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/GcdTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/GcdTest.php @@ -18,10 +18,10 @@ class GcdTest extends TestCase * * @param mixed $expectedResult */ - public function testGCD($expectedResult, ...$args) + public function testGCD($expectedResult, ...$args): void { $result = MathTrig::GCD(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerGCD() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/IntTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/IntTest.php index 3a9b1e5b..f400a7fe 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/IntTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/IntTest.php @@ -19,10 +19,10 @@ class IntTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testINT($expectedResult, $value) + public function testINT($expectedResult, $value): void { $result = MathTrig::INT($value); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerINT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LcmTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LcmTest.php index 58ea6a6b..57b4a67f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LcmTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LcmTest.php @@ -18,10 +18,10 @@ class LcmTest extends TestCase * * @param mixed $expectedResult */ - public function testLCM($expectedResult, ...$args) + public function testLCM($expectedResult, ...$args): void { $result = MathTrig::LCM(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerLCM() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LogTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LogTest.php index 82c63f99..184d83e6 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LogTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LogTest.php @@ -18,10 +18,10 @@ class LogTest extends TestCase * * @param mixed $expectedResult */ - public function testLOG($expectedResult, ...$args) + public function testLOG($expectedResult, ...$args): void { $result = MathTrig::logBase(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerLOG() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MInverseTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MInverseTest.php index 3d784a87..a500c3f6 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MInverseTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MInverseTest.php @@ -18,10 +18,10 @@ class MInverseTest extends TestCase * * @param mixed $expectedResult */ - public function testMINVERSE($expectedResult, ...$args) + public function testMINVERSE($expectedResult, ...$args): void { $result = MathTrig::MINVERSE(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerMINVERSE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MMultTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MMultTest.php index 16a52e75..66fa80db 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MMultTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MMultTest.php @@ -18,10 +18,10 @@ class MMultTest extends TestCase * * @param mixed $expectedResult */ - public function testMMULT($expectedResult, ...$args) + public function testMMULT($expectedResult, ...$args): void { $result = MathTrig::MMULT(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerMMULT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MRoundTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MRoundTest.php index 73568747..32c9c355 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MRoundTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MRoundTest.php @@ -18,10 +18,10 @@ class MRoundTest extends TestCase * * @param mixed $expectedResult */ - public function testMROUND($expectedResult, ...$args) + public function testMROUND($expectedResult, ...$args): void { $result = MathTrig::MROUND(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerMROUND() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MdeTermTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MdeTermTest.php index 672d5dec..995ea2f3 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MdeTermTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MdeTermTest.php @@ -18,10 +18,10 @@ class MdeTermTest extends TestCase * * @param mixed $expectedResult */ - public function testMDETERM($expectedResult, ...$args) + public function testMDETERM($expectedResult, ...$args): void { $result = MathTrig::MDETERM(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerMDETERM() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ModTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ModTest.php index ae863792..930708f5 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ModTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ModTest.php @@ -18,10 +18,10 @@ class ModTest extends TestCase * * @param mixed $expectedResult */ - public function testMOD($expectedResult, ...$args) + public function testMOD($expectedResult, ...$args): void { $result = MathTrig::MOD(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerMOD() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MultinomialTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MultinomialTest.php index dd2faf2c..93735ba9 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MultinomialTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MultinomialTest.php @@ -18,10 +18,10 @@ class MultinomialTest extends TestCase * * @param mixed $expectedResult */ - public function testMULTINOMIAL($expectedResult, ...$args) + public function testMULTINOMIAL($expectedResult, ...$args): void { $result = MathTrig::MULTINOMIAL(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerMULTINOMIAL() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/OddTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/OddTest.php index 7a9d367c..6c5758c6 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/OddTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/OddTest.php @@ -19,10 +19,10 @@ class OddTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testODD($expectedResult, $value) + public function testODD($expectedResult, $value): void { $result = MathTrig::ODD($value); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerODD() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/PowerTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/PowerTest.php index 05edecf9..6749b14a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/PowerTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/PowerTest.php @@ -18,10 +18,10 @@ class PowerTest extends TestCase * * @param mixed $expectedResult */ - public function testPOWER($expectedResult, ...$args) + public function testPOWER($expectedResult, ...$args): void { $result = MathTrig::POWER(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerPOWER() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ProductTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ProductTest.php index 3e185bd7..251b783b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ProductTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ProductTest.php @@ -18,10 +18,10 @@ class ProductTest extends TestCase * * @param mixed $expectedResult */ - public function testPRODUCT($expectedResult, ...$args) + public function testPRODUCT($expectedResult, ...$args): void { $result = MathTrig::PRODUCT(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerPRODUCT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/QuotientTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/QuotientTest.php index 96e0b84a..4232729a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/QuotientTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/QuotientTest.php @@ -18,10 +18,10 @@ class QuotientTest extends TestCase * * @param mixed $expectedResult */ - public function testQUOTIENT($expectedResult, ...$args) + public function testQUOTIENT($expectedResult, ...$args): void { $result = MathTrig::QUOTIENT(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerQUOTIENT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RomanTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RomanTest.php index a1363714..c74daa32 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RomanTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RomanTest.php @@ -18,10 +18,10 @@ class RomanTest extends TestCase * * @param mixed $expectedResult */ - public function testROMAN($expectedResult, ...$args) + public function testROMAN($expectedResult, ...$args): void { $result = MathTrig::ROMAN(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerROMAN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundDownTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundDownTest.php index 17b6780b..2fc211f3 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundDownTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundDownTest.php @@ -18,10 +18,10 @@ class RoundDownTest extends TestCase * * @param mixed $expectedResult */ - public function testROUNDDOWN($expectedResult, ...$args) + public function testROUNDDOWN($expectedResult, ...$args): void { $result = MathTrig::ROUNDDOWN(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerROUNDDOWN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundUpTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundUpTest.php index 6d1c57ba..825fe419 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundUpTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundUpTest.php @@ -18,10 +18,10 @@ class RoundUpTest extends TestCase * * @param mixed $expectedResult */ - public function testROUNDUP($expectedResult, ...$args) + public function testROUNDUP($expectedResult, ...$args): void { $result = MathTrig::ROUNDUP(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerROUNDUP() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SecTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SecTest.php index 8dad0b9d..ad4b196c 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SecTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SecTest.php @@ -19,10 +19,10 @@ class SecTest extends TestCase * @param mixed $expectedResult * @param mixed $angle */ - public function testSEC($expectedResult, $angle) + public function testSEC($expectedResult, $angle): void { $result = MathTrig::SEC($angle); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSEC() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SechTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SechTest.php index f98b673e..b9488bda 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SechTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SechTest.php @@ -19,10 +19,10 @@ class SechTest extends TestCase * @param mixed $expectedResult * @param mixed $angle */ - public function testSECH($expectedResult, $angle) + public function testSECH($expectedResult, $angle): void { $result = MathTrig::SECH($angle); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSECH() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SeriesSumTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SeriesSumTest.php index 4f8d4db1..689336a3 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SeriesSumTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SeriesSumTest.php @@ -18,10 +18,10 @@ class SeriesSumTest extends TestCase * * @param mixed $expectedResult */ - public function testSERIESSUM($expectedResult, ...$args) + public function testSERIESSUM($expectedResult, ...$args): void { $result = MathTrig::SERIESSUM(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSERIESSUM() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SignTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SignTest.php index d7b6bacb..68f5acb9 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SignTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SignTest.php @@ -19,10 +19,10 @@ class SignTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testSIGN($expectedResult, $value) + public function testSIGN($expectedResult, $value): void { $result = MathTrig::SIGN($value); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSIGN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SqrtPiTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SqrtPiTest.php index 38528548..bb4bba4b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SqrtPiTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SqrtPiTest.php @@ -19,10 +19,10 @@ class SqrtPiTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testSQRTPI($expectedResult, $value) + public function testSQRTPI($expectedResult, $value): void { $result = MathTrig::SQRTPI($value); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSQRTPI() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php index 38434278..14865673 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php @@ -22,7 +22,7 @@ class SubTotalTest extends TestCase * * @param mixed $expectedResult */ - public function testSUBTOTAL($expectedResult, ...$args) + public function testSUBTOTAL($expectedResult, ...$args): void { $cell = $this->getMockBuilder(Cell::class) ->setMethods(['getValue', 'isFormula']) @@ -49,7 +49,7 @@ class SubTotalTest extends TestCase array_push($args, $cellReference); $result = MathTrig::SUBTOTAL(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSUBTOTAL() @@ -70,7 +70,7 @@ class SubTotalTest extends TestCase * * @param mixed $expectedResult */ - public function testHiddenSUBTOTAL($expectedResult, ...$args) + public function testHiddenSUBTOTAL($expectedResult, ...$args): void { $visibilityGenerator = $this->rowVisibility(); @@ -79,12 +79,12 @@ class SubTotalTest extends TestCase ->disableOriginalConstructor() ->getMock(); $rowDimension->method('getVisible') - ->will($this->returnCallback(function () use ($visibilityGenerator) { + ->willReturnCallback(function () use ($visibilityGenerator) { $result = $visibilityGenerator->current(); $visibilityGenerator->next(); return $result; - })); + }); $columnDimension = $this->getMockBuilder(ColumnDimension::class) ->setMethods(['getVisible']) ->disableOriginalConstructor() @@ -120,7 +120,7 @@ class SubTotalTest extends TestCase array_push($args, $cellReference); $result = MathTrig::SUBTOTAL(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerHiddenSUBTOTAL() @@ -147,7 +147,7 @@ class SubTotalTest extends TestCase * * @param mixed $expectedResult */ - public function testNestedSUBTOTAL($expectedResult, ...$args) + public function testNestedSUBTOTAL($expectedResult, ...$args): void { $cellValueGenerator = $this->cellValues(Functions::flattenArray(array_slice($args, 1))); $cellIsFormulaGenerator = $this->cellIsFormula(Functions::flattenArray(array_slice($args, 1))); @@ -157,19 +157,19 @@ class SubTotalTest extends TestCase ->disableOriginalConstructor() ->getMock(); $cell->method('getValue') - ->will($this->returnCallback(function () use ($cellValueGenerator) { + ->willReturnCallback(function () use ($cellValueGenerator) { $result = $cellValueGenerator->current(); $cellValueGenerator->next(); return $result; - })); + }); $cell->method('isFormula') - ->will($this->returnCallback(function () use ($cellIsFormulaGenerator) { + ->willReturnCallback(function () use ($cellIsFormulaGenerator) { $result = $cellIsFormulaGenerator->current(); $cellIsFormulaGenerator->next(); return $result; - })); + }); $worksheet = $this->getMockBuilder(Worksheet::class) ->setMethods(['cellExists', 'getCell']) ->disableOriginalConstructor() @@ -188,7 +188,7 @@ class SubTotalTest extends TestCase array_push($args, $cellReference); $result = MathTrig::SUBTOTAL(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerNestedSUBTOTAL() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfTest.php index 639e8bdd..f7ff928f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfTest.php @@ -18,10 +18,10 @@ class SumIfTest extends TestCase * * @param mixed $expectedResult */ - public function testSUMIF($expectedResult, ...$args) + public function testSUMIF($expectedResult, ...$args): void { $result = MathTrig::SUMIF(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSUMIF() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfsTest.php index dab255c2..b7be17c9 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfsTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfsTest.php @@ -18,10 +18,10 @@ class SumIfsTest extends TestCase * * @param mixed $expectedResult */ - public function testSUMIFS($expectedResult, ...$args) + public function testSUMIFS($expectedResult, ...$args): void { $result = MathTrig::SUMIFS(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSUMIFS() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumProductTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumProductTest.php index 6b94dafa..b34036e5 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumProductTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumProductTest.php @@ -18,10 +18,10 @@ class SumProductTest extends TestCase * * @param mixed $expectedResult */ - public function testSUMPRODUCT($expectedResult, ...$args) + public function testSUMPRODUCT($expectedResult, ...$args): void { $result = MathTrig::SUMPRODUCT(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSUMPRODUCT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumSqTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumSqTest.php index bcb00acc..f1165e7b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumSqTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumSqTest.php @@ -18,10 +18,10 @@ class SumSqTest extends TestCase * * @param mixed $expectedResult */ - public function testSUMSQ($expectedResult, ...$args) + public function testSUMSQ($expectedResult, ...$args): void { $result = MathTrig::SUMSQ(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSUMSQ() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2MY2Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2MY2Test.php index 1bfe5923..3bf2785b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2MY2Test.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2MY2Test.php @@ -18,10 +18,10 @@ class SumX2MY2Test extends TestCase * * @param mixed $expectedResult */ - public function testSUMX2MY2($expectedResult, ...$args) + public function testSUMX2MY2($expectedResult, ...$args): void { $result = MathTrig::SUMX2MY2(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSUMX2MY2() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2PY2Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2PY2Test.php index c53630de..a370d79b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2PY2Test.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2PY2Test.php @@ -18,10 +18,10 @@ class SumX2PY2Test extends TestCase * * @param mixed $expectedResult */ - public function testSUMX2PY2($expectedResult, ...$args) + public function testSUMX2PY2($expectedResult, ...$args): void { $result = MathTrig::SUMX2PY2(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSUMX2PY2() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumXMY2Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumXMY2Test.php index bb4dc527..1f64523b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumXMY2Test.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumXMY2Test.php @@ -18,10 +18,10 @@ class SumXMY2Test extends TestCase * * @param mixed $expectedResult */ - public function testSUMXMY2($expectedResult, ...$args) + public function testSUMXMY2($expectedResult, ...$args): void { $result = MathTrig::SUMXMY2(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSUMXMY2() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/TruncTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/TruncTest.php index 244889dc..5fc248cc 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/TruncTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/TruncTest.php @@ -18,10 +18,10 @@ class TruncTest extends TestCase * * @param mixed $expectedResult */ - public function testTRUNC($expectedResult, ...$args) + public function testTRUNC($expectedResult, ...$args): void { $result = MathTrig::TRUNC(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerTRUNC() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AveDevTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AveDevTest.php index a61730ad..571c06c3 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AveDevTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AveDevTest.php @@ -18,10 +18,10 @@ class AveDevTest extends TestCase * * @param mixed $expectedResult */ - public function testAVEDEV($expectedResult, ...$args) + public function testAVEDEV($expectedResult, ...$args): void { $result = Statistical::AVEDEV(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerAVEDEV() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageATest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageATest.php index 6c5f4093..1af96dfc 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageATest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageATest.php @@ -18,10 +18,10 @@ class AverageATest extends TestCase * * @param mixed $expectedResult */ - public function testAVERAGEA($expectedResult, ...$args) + public function testAVERAGEA($expectedResult, ...$args): void { $result = Statistical::AVERAGEA(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerAVERAGEA() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageIfTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageIfTest.php index f1b4081a..69dcfb87 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageIfTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageIfTest.php @@ -18,10 +18,10 @@ class AverageIfTest extends TestCase * * @param mixed $expectedResult */ - public function testAVERAGEIF($expectedResult, ...$args) + public function testAVERAGEIF($expectedResult, ...$args): void { $result = Statistical::AVERAGEIF(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerAVERAGEIF() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageTest.php index 3d03524e..c67452ab 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageTest.php @@ -18,10 +18,10 @@ class AverageTest extends TestCase * * @param mixed $expectedResult */ - public function testAVERAGE($expectedResult, ...$args) + public function testAVERAGE($expectedResult, ...$args): void { $result = Statistical::AVERAGE(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerAVERAGE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaDistTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaDistTest.php index 1cd9280d..a85781e5 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaDistTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaDistTest.php @@ -18,10 +18,10 @@ class BetaDistTest extends TestCase * * @param mixed $expectedResult */ - public function testBETADIST($expectedResult, ...$args) + public function testBETADIST($expectedResult, ...$args): void { $result = Statistical::BETADIST(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerBETADIST() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaInvTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaInvTest.php index 10c47c76..24ddd3fc 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaInvTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaInvTest.php @@ -18,10 +18,10 @@ class BetaInvTest extends TestCase * * @param mixed $expectedResult */ - public function testBETAINV($expectedResult, ...$args) + public function testBETAINV($expectedResult, ...$args): void { $result = Statistical::BETAINV(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerBETAINV() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BinomDistTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BinomDistTest.php index e4891546..8b3e6856 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BinomDistTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BinomDistTest.php @@ -18,10 +18,10 @@ class BinomDistTest extends TestCase * * @param mixed $expectedResult */ - public function testBINOMDIST($expectedResult, ...$args) + public function testBINOMDIST($expectedResult, ...$args): void { $result = Statistical::BINOMDIST(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerBINOMDIST() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiDistTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiDistTest.php index d00d5fb0..9dc7326c 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiDistTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiDistTest.php @@ -18,10 +18,10 @@ class ChiDistTest extends TestCase * * @param mixed $expectedResult */ - public function testCHIDIST($expectedResult, ...$args) + public function testCHIDIST($expectedResult, ...$args): void { $result = Statistical::CHIDIST(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCHIDIST() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiInvTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiInvTest.php index e2b93e95..72680914 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiInvTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiInvTest.php @@ -18,10 +18,10 @@ class ChiInvTest extends TestCase * * @param mixed $expectedResult */ - public function testCHIINV($expectedResult, ...$args) + public function testCHIINV($expectedResult, ...$args): void { $result = Statistical::CHIINV(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCHIINV() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ConfidenceTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ConfidenceTest.php index 9a131ed0..d4bc586f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ConfidenceTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ConfidenceTest.php @@ -18,10 +18,10 @@ class ConfidenceTest extends TestCase * * @param mixed $expectedResult */ - public function testCONFIDENCE($expectedResult, ...$args) + public function testCONFIDENCE($expectedResult, ...$args): void { $result = Statistical::CONFIDENCE(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCONFIDENCE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CorrelTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CorrelTest.php index f2bba8d7..52f773bc 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CorrelTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CorrelTest.php @@ -18,10 +18,10 @@ class CorrelTest extends TestCase * * @param mixed $expectedResult */ - public function testCORREL($expectedResult, array $xargs, array $yargs) + public function testCORREL($expectedResult, array $xargs, array $yargs): void { $result = Statistical::CORREL($xargs, $yargs); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCORREL() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountATest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountATest.php index 15f9c4bf..2df0ebd1 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountATest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountATest.php @@ -18,10 +18,10 @@ class CountATest extends TestCase * * @param mixed $expectedResult */ - public function testCOUNTA($expectedResult, ...$args) + public function testCOUNTA($expectedResult, ...$args): void { $result = Statistical::COUNTA(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCOUNTA() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountBlankTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountBlankTest.php index 8e61bb47..b0c6698b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountBlankTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountBlankTest.php @@ -18,10 +18,10 @@ class CountBlankTest extends TestCase * * @param mixed $expectedResult */ - public function testCOUNTBLANK($expectedResult, ...$args) + public function testCOUNTBLANK($expectedResult, ...$args): void { $result = Statistical::COUNTBLANK(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCOUNTBLANK() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfTest.php index 7f1dd221..fed32e5c 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfTest.php @@ -18,10 +18,10 @@ class CountIfTest extends TestCase * * @param mixed $expectedResult */ - public function testCOUNTIF($expectedResult, ...$args) + public function testCOUNTIF($expectedResult, ...$args): void { $result = Statistical::COUNTIF(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCOUNTIF() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfsTest.php index 301c3f4c..1eeb4f67 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfsTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfsTest.php @@ -18,10 +18,10 @@ class CountIfsTest extends TestCase * * @param mixed $expectedResult */ - public function testCOUNTIFS($expectedResult, ...$args) + public function testCOUNTIFS($expectedResult, ...$args): void { $result = Statistical::COUNTIFS(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCOUNTIFS() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountTest.php index 1bfac28e..26e621ec 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountTest.php @@ -18,10 +18,10 @@ class CountTest extends TestCase * * @param mixed $expectedResult */ - public function testBasicCOUNT($expectedResult, ...$args) + public function testBasicCOUNT($expectedResult, ...$args): void { $result = Statistical::COUNT(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerBasicCOUNT() @@ -34,10 +34,10 @@ class CountTest extends TestCase * * @param mixed $expectedResult */ - public function testExcelCOUNT($expectedResult, ...$args) + public function testExcelCOUNT($expectedResult, ...$args): void { $result = Statistical::COUNT(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerExcelCOUNT() @@ -50,12 +50,12 @@ class CountTest extends TestCase * * @param mixed $expectedResult */ - public function testOpenOfficeCOUNT($expectedResult, ...$args) + public function testOpenOfficeCOUNT($expectedResult, ...$args): void { Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE); $result = Statistical::COUNT(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerOpenOfficeCOUNT() @@ -68,12 +68,12 @@ class CountTest extends TestCase * * @param mixed $expectedResult */ - public function testGnumericCOUNT($expectedResult, ...$args) + public function testGnumericCOUNT($expectedResult, ...$args): void { Functions::setCompatibilityMode(Functions::COMPATIBILITY_GNUMERIC); $result = Statistical::COUNT(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerGnumericCOUNT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CovarTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CovarTest.php index c34e36d2..5b73d1d9 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CovarTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CovarTest.php @@ -18,10 +18,10 @@ class CovarTest extends TestCase * * @param mixed $expectedResult */ - public function testCOVAR($expectedResult, ...$args) + public function testCOVAR($expectedResult, ...$args): void { $result = Statistical::COVAR(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerCOVAR() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ExponDistTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ExponDistTest.php index cf3e8849..0296ab7b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ExponDistTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ExponDistTest.php @@ -18,10 +18,10 @@ class ExponDistTest extends TestCase * * @param mixed $expectedResult */ - public function testEXPONDIST($expectedResult, ...$args) + public function testEXPONDIST($expectedResult, ...$args): void { $result = Statistical::EXPONDIST(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerEXPONDIST() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/FisherInvTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/FisherInvTest.php index f8eb7554..efd212c8 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/FisherInvTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/FisherInvTest.php @@ -19,10 +19,10 @@ class FisherInvTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testFISHERINV($expectedResult, $value) + public function testFISHERINV($expectedResult, $value): void { $result = Statistical::FISHERINV($value); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerFISHERINV() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/FisherTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/FisherTest.php index 5f9733ab..788ffc6a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/FisherTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/FisherTest.php @@ -19,10 +19,10 @@ class FisherTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testFISHER($expectedResult, $value) + public function testFISHER($expectedResult, $value): void { $result = Statistical::FISHER($value); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerFISHER() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ForecastTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ForecastTest.php index 4de64500..6ecbb9c8 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ForecastTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ForecastTest.php @@ -18,10 +18,10 @@ class ForecastTest extends TestCase * * @param mixed $expectedResult */ - public function testFORECAST($expectedResult, ...$args) + public function testFORECAST($expectedResult, ...$args): void { $result = Statistical::FORECAST(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerFORECAST() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaDistTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaDistTest.php index 41806e56..6765d340 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaDistTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaDistTest.php @@ -18,10 +18,10 @@ class GammaDistTest extends TestCase * * @param mixed $expectedResult */ - public function testGAMMADIST($expectedResult, ...$args) + public function testGAMMADIST($expectedResult, ...$args): void { $result = Statistical::GAMMADIST(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerGAMMADIST() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaInvTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaInvTest.php index ad72277a..3e9e41cb 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaInvTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaInvTest.php @@ -18,10 +18,10 @@ class GammaInvTest extends TestCase * * @param mixed $expectedResult */ - public function testGAMMAINV($expectedResult, ...$args) + public function testGAMMAINV($expectedResult, ...$args): void { $result = Statistical::GAMMAINV(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerGAMMAINV() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaLnTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaLnTest.php index 2fde78aa..d0ae623f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaLnTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaLnTest.php @@ -19,10 +19,10 @@ class GammaLnTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testGAMMALN($expectedResult, $value) + public function testGAMMALN($expectedResult, $value): void { $result = Statistical::GAMMALN($value); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerGAMMALN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GeoMeanTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GeoMeanTest.php index 6f8f6053..99f125d1 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GeoMeanTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GeoMeanTest.php @@ -18,10 +18,10 @@ class GeoMeanTest extends TestCase * * @param mixed $expectedResult */ - public function testGEOMEAN($expectedResult, ...$args) + public function testGEOMEAN($expectedResult, ...$args): void { $result = Statistical::GEOMEAN(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerGEOMEAN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/HarMeanTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/HarMeanTest.php index 38ad95db..5ddf58a8 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/HarMeanTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/HarMeanTest.php @@ -18,10 +18,10 @@ class HarMeanTest extends TestCase * * @param mixed $expectedResult */ - public function testHARMEAN($expectedResult, ...$args) + public function testHARMEAN($expectedResult, ...$args): void { $result = Statistical::HARMEAN(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerHARMEAN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/InterceptTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/InterceptTest.php index e3f9383c..51245861 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/InterceptTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/InterceptTest.php @@ -18,10 +18,10 @@ class InterceptTest extends TestCase * * @param mixed $expectedResult */ - public function testINTERCEPT($expectedResult, array $xargs, array $yargs) + public function testINTERCEPT($expectedResult, array $xargs, array $yargs): void { $result = Statistical::INTERCEPT($xargs, $yargs); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerINTERCEPT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MaxIfsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MaxIfsTest.php index c8d3d02c..a031203a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MaxIfsTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MaxIfsTest.php @@ -18,10 +18,10 @@ class MaxIfsTest extends TestCase * * @param mixed $expectedResult */ - public function testMAXIFS($expectedResult, ...$args) + public function testMAXIFS($expectedResult, ...$args): void { $result = Statistical::MAXIFS(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerMAXIFS() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MedianTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MedianTest.php index 571fca23..c29d65e5 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MedianTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MedianTest.php @@ -18,10 +18,10 @@ class MedianTest extends TestCase * * @param mixed $expectedResult */ - public function testMEDIAN($expectedResult, ...$args) + public function testMEDIAN($expectedResult, ...$args): void { $result = Statistical::MEDIAN(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerMEDIAN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MinIfsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MinIfsTest.php index b8c1e291..f1740110 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MinIfsTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MinIfsTest.php @@ -18,10 +18,10 @@ class MinIfsTest extends TestCase * * @param mixed $expectedResult */ - public function testMINIFS($expectedResult, ...$args) + public function testMINIFS($expectedResult, ...$args): void { $result = Statistical::MINIFS(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerMINIFS() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ModeTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ModeTest.php index d3eb6f32..9f811287 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ModeTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ModeTest.php @@ -11,7 +11,6 @@ class ModeTest extends TestCase * @dataProvider providerMODE * * @param mixed $expectedResult - * @param string $str */ public function testMODE($expectedResult, string $str): void { diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/PermutTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/PermutTest.php index 7e7ae7a7..98e39978 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/PermutTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/PermutTest.php @@ -18,10 +18,10 @@ class PermutTest extends TestCase * * @param mixed $expectedResult */ - public function testPERMUT($expectedResult, ...$args) + public function testPERMUT($expectedResult, ...$args): void { $result = Statistical::PERMUT(...$args); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerPERMUT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/RsqTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/RsqTest.php index a0959eac..423cc3ae 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/RsqTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/RsqTest.php @@ -18,10 +18,10 @@ class RsqTest extends TestCase * * @param mixed $expectedResult */ - public function testRSQ($expectedResult, array $xargs, array $yargs) + public function testRSQ($expectedResult, array $xargs, array $yargs): void { $result = Statistical::RSQ($xargs, $yargs); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerRSQ() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SlopeTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SlopeTest.php index fe28f5eb..467bff1e 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SlopeTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SlopeTest.php @@ -18,10 +18,10 @@ class SlopeTest extends TestCase * * @param mixed $expectedResult */ - public function testSLOPE($expectedResult, array $xargs, array $yargs) + public function testSLOPE($expectedResult, array $xargs, array $yargs): void { $result = Statistical::SLOPE($xargs, $yargs); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSLOPE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SteyxTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SteyxTest.php index 5ab6b662..ab109345 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SteyxTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SteyxTest.php @@ -18,10 +18,10 @@ class SteyxTest extends TestCase * * @param mixed $expectedResult */ - public function testSTEYX($expectedResult, array $xargs, array $yargs) + public function testSTEYX($expectedResult, array $xargs, array $yargs): void { $result = Statistical::STEYX($xargs, $yargs); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-12); + self::assertEqualsWithDelta($expectedResult, $result, 1E-12); } public function providerSTEYX() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/CharTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/CharTest.php index 86483180..70ea7526 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/CharTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/CharTest.php @@ -31,10 +31,10 @@ class CharTest extends TestCase * @param mixed $expectedResult * @param $character */ - public function testCHAR($expectedResult, $character) + public function testCHAR($expectedResult, $character): void { $result = TextData::CHARACTER($character); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerCHAR() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/CleanTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/CleanTest.php index 63042fa5..6aedb599 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/CleanTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/CleanTest.php @@ -31,10 +31,10 @@ class CleanTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testCLEAN($expectedResult, $value) + public function testCLEAN($expectedResult, $value): void { $result = TextData::TRIMNONPRINTABLE($value); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerCLEAN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/CodeTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/CodeTest.php index b39b66bf..ec9f26d6 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/CodeTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/CodeTest.php @@ -31,10 +31,10 @@ class CodeTest extends TestCase * @param mixed $expectedResult * @param $character */ - public function testCODE($expectedResult, $character) + public function testCODE($expectedResult, $character): void { $result = TextData::ASCIICODE($character); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerCODE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ConcatenateTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ConcatenateTest.php index 6d32298e..18a2d684 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ConcatenateTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ConcatenateTest.php @@ -30,10 +30,10 @@ class ConcatenateTest extends TestCase * * @param mixed $expectedResult */ - public function testCONCATENATE($expectedResult, ...$args) + public function testCONCATENATE($expectedResult, ...$args): void { $result = TextData::CONCATENATE(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerCONCATENATE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/DollarTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/DollarTest.php index 3f0ae34f..4a0f6013 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/DollarTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/DollarTest.php @@ -30,10 +30,10 @@ class DollarTest extends TestCase * * @param mixed $expectedResult */ - public function testDOLLAR($expectedResult, ...$args) + public function testDOLLAR($expectedResult, ...$args): void { $result = TextData::DOLLAR(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerDOLLAR() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ExactTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ExactTest.php index ad44c03f..09d45a32 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ExactTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ExactTest.php @@ -31,14 +31,14 @@ class ExactTest extends TestCase * @param mixed $expectedResult * @param array $args */ - public function testEXACT($expectedResult, ...$args) + public function testEXACT($expectedResult, ...$args): void { StringHelper::setDecimalSeparator('.'); StringHelper::setThousandsSeparator(' '); StringHelper::setCurrencyCode('$'); $result = TextData::EXACT(...$args); - $this->assertSame($expectedResult, $result); + self::assertSame($expectedResult, $result); } /** diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/FindTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/FindTest.php index c20d7df3..38203a33 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/FindTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/FindTest.php @@ -30,10 +30,10 @@ class FindTest extends TestCase * * @param mixed $expectedResult */ - public function testFIND($expectedResult, ...$args) + public function testFIND($expectedResult, ...$args): void { $result = TextData::SEARCHSENSITIVE(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerFIND() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/FixedTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/FixedTest.php index 010278fc..53e6a513 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/FixedTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/FixedTest.php @@ -30,10 +30,10 @@ class FixedTest extends TestCase * * @param mixed $expectedResult */ - public function testFIXED($expectedResult, ...$args) + public function testFIXED($expectedResult, ...$args): void { $result = TextData::FIXEDFORMAT(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerFIXED() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/LeftTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/LeftTest.php index d1eba19e..9a033ae7 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/LeftTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/LeftTest.php @@ -30,10 +30,10 @@ class LeftTest extends TestCase * * @param mixed $expectedResult */ - public function testLEFT($expectedResult, ...$args) + public function testLEFT($expectedResult, ...$args): void { $result = TextData::LEFT(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerLEFT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/LenTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/LenTest.php index 8e711fa9..af784163 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/LenTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/LenTest.php @@ -31,10 +31,10 @@ class LenTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testLEN($expectedResult, $value) + public function testLEN($expectedResult, $value): void { $result = TextData::STRINGLENGTH($value); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerLEN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/LowerTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/LowerTest.php index e329dda3..6ad522d8 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/LowerTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/LowerTest.php @@ -31,10 +31,10 @@ class LowerTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testLOWER($expectedResult, $value) + public function testLOWER($expectedResult, $value): void { $result = TextData::LOWERCASE($value); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerLOWER() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/MidTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/MidTest.php index 5bcc43fc..df02575f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/MidTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/MidTest.php @@ -30,10 +30,10 @@ class MidTest extends TestCase * * @param mixed $expectedResult */ - public function testMID($expectedResult, ...$args) + public function testMID($expectedResult, ...$args): void { $result = TextData::MID(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerMID() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/NumberValueTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/NumberValueTest.php index 45e3c6be..006e4ce1 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/NumberValueTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/NumberValueTest.php @@ -29,12 +29,11 @@ class NumberValueTest extends TestCase * @dataProvider providerNUMBERVALUE * * @param mixed $expectedResult - * @param array $args */ - public function testNUMBERVALUE($expectedResult, array $args) + public function testNUMBERVALUE($expectedResult, array $args): void { $result = TextData::NUMBERVALUE(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerNUMBERVALUE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ProperTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ProperTest.php index 13efbd9a..d799b395 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ProperTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ProperTest.php @@ -31,10 +31,10 @@ class ProperTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testPROPER($expectedResult, $value) + public function testPROPER($expectedResult, $value): void { $result = TextData::PROPERCASE($value); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerPROPER() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ReplaceTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ReplaceTest.php index f319b16e..ff3d58bb 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ReplaceTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ReplaceTest.php @@ -30,10 +30,10 @@ class ReplaceTest extends TestCase * * @param mixed $expectedResult */ - public function testREPLACE($expectedResult, ...$args) + public function testREPLACE($expectedResult, ...$args): void { $result = TextData::REPLACE(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerREPLACE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/RightTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/RightTest.php index 216050c3..a89ea6ed 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/RightTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/RightTest.php @@ -30,10 +30,10 @@ class RightTest extends TestCase * * @param mixed $expectedResult */ - public function testRIGHT($expectedResult, ...$args) + public function testRIGHT($expectedResult, ...$args): void { $result = TextData::RIGHT(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerRIGHT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/SearchTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/SearchTest.php index ab3fcb11..919ec0fb 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/SearchTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/SearchTest.php @@ -30,10 +30,10 @@ class SearchTest extends TestCase * * @param mixed $expectedResult */ - public function testSEARCH($expectedResult, ...$args) + public function testSEARCH($expectedResult, ...$args): void { $result = TextData::SEARCHINSENSITIVE(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerSEARCH() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/SubstituteTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/SubstituteTest.php index 89a89ba3..d1884fd8 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/SubstituteTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/SubstituteTest.php @@ -30,10 +30,10 @@ class SubstituteTest extends TestCase * * @param mixed $expectedResult */ - public function testSUBSTITUTE($expectedResult, ...$args) + public function testSUBSTITUTE($expectedResult, ...$args): void { $result = TextData::SUBSTITUTE(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerSUBSTITUTE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TTest.php index 56b00838..1ce989b4 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TTest.php @@ -31,10 +31,10 @@ class TTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testT($expectedResult, $value) + public function testT($expectedResult, $value): void { $result = TextData::RETURNSTRING($value); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TextJoinTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TextJoinTest.php index ec04ce13..7eec585c 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TextJoinTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TextJoinTest.php @@ -29,12 +29,11 @@ class TextJoinTest extends TestCase * @dataProvider providerTEXTJOIN * * @param mixed $expectedResult - * @param array $args */ - public function testTEXTJOIN($expectedResult, array $args) + public function testTEXTJOIN($expectedResult, array $args): void { $result = TextData::TEXTJOIN(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerTEXTJOIN() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TextTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TextTest.php index f7638e4c..eab517cc 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TextTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TextTest.php @@ -30,7 +30,7 @@ class TextTest extends TestCase * * @param mixed $expectedResult */ - public function testTEXT($expectedResult, ...$args) + public function testTEXT($expectedResult, ...$args): void { // Enforce decimal and thousands separator values to UK/US, and currency code to USD StringHelper::setDecimalSeparator('.'); @@ -38,7 +38,7 @@ class TextTest extends TestCase StringHelper::setCurrencyCode('$'); $result = TextData::TEXTFORMAT(...$args); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerTEXT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TrimTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TrimTest.php index d5907803..24ede75f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TrimTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/TrimTest.php @@ -31,10 +31,10 @@ class TrimTest extends TestCase * @param mixed $expectedResult * @param $character */ - public function testTRIM($expectedResult, $character) + public function testTRIM($expectedResult, $character): void { $result = TextData::TRIMSPACES($character); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerTRIM() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/UpperTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/UpperTest.php index a69d8279..1600f37c 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/UpperTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/UpperTest.php @@ -31,10 +31,10 @@ class UpperTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testUPPER($expectedResult, $value) + public function testUPPER($expectedResult, $value): void { $result = TextData::UPPERCASE($value); - $this->assertEquals($expectedResult, $result); + self::assertEquals($expectedResult, $result); } public function providerUPPER() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ValueTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ValueTest.php index b2e31ba3..a5083b22 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ValueTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ValueTest.php @@ -31,14 +31,14 @@ class ValueTest extends TestCase * @param mixed $expectedResult * @param $value */ - public function testVALUE($expectedResult, $value) + public function testVALUE($expectedResult, $value): void { StringHelper::setDecimalSeparator('.'); StringHelper::setThousandsSeparator(' '); StringHelper::setCurrencyCode('$'); $result = TextData::VALUE($value); - $this->assertEqualsWithDelta($expectedResult, $result, 1E-8); + self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerVALUE() diff --git a/tests/PhpSpreadsheetTests/Calculation/FunctionsTest.php b/tests/PhpSpreadsheetTests/Calculation/FunctionsTest.php index 94788c2d..4412215a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/FunctionsTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/FunctionsTest.php @@ -22,85 +22,85 @@ class FunctionsTest extends TestCase Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); } - public function testCompatibilityMode() + public function testCompatibilityMode(): void { $result = Functions::setCompatibilityMode(Functions::COMPATIBILITY_GNUMERIC); // Test for a true response for success - $this->assertTrue($result); + self::assertTrue($result); // Test that mode has been changed - $this->assertEquals(Functions::COMPATIBILITY_GNUMERIC, Functions::getCompatibilityMode()); + self::assertEquals(Functions::COMPATIBILITY_GNUMERIC, Functions::getCompatibilityMode()); } - public function testInvalidCompatibilityMode() + public function testInvalidCompatibilityMode(): void { $result = Functions::setCompatibilityMode('INVALIDMODE'); // Test for a false response for failure - $this->assertFalse($result); + self::assertFalse($result); // Test that mode has not been changed - $this->assertEquals(Functions::COMPATIBILITY_EXCEL, Functions::getCompatibilityMode()); + self::assertEquals(Functions::COMPATIBILITY_EXCEL, Functions::getCompatibilityMode()); } - public function testReturnDateType() + public function testReturnDateType(): void { $result = Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); // Test for a true response for success - $this->assertTrue($result); + self::assertTrue($result); // Test that mode has been changed - $this->assertEquals(Functions::RETURNDATE_PHP_OBJECT, Functions::getReturnDateType()); + self::assertEquals(Functions::RETURNDATE_PHP_OBJECT, Functions::getReturnDateType()); } - public function testInvalidReturnDateType() + public function testInvalidReturnDateType(): void { $result = Functions::setReturnDateType('INVALIDTYPE'); // Test for a false response for failure - $this->assertFalse($result); + self::assertFalse($result); // Test that mode has not been changed - $this->assertEquals(Functions::RETURNDATE_EXCEL, Functions::getReturnDateType()); + self::assertEquals(Functions::RETURNDATE_EXCEL, Functions::getReturnDateType()); } - public function testDUMMY() + public function testDUMMY(): void { $result = Functions::DUMMY(); self::assertEquals('#Not Yet Implemented', $result); } - public function testDIV0() + public function testDIV0(): void { $result = Functions::DIV0(); self::assertEquals('#DIV/0!', $result); } - public function testNA() + public function testNA(): void { $result = Functions::NA(); self::assertEquals('#N/A', $result); } - public function testNAN() + public function testNAN(): void { $result = Functions::NAN(); self::assertEquals('#NUM!', $result); } - public function testNAME() + public function testNAME(): void { $result = Functions::NAME(); self::assertEquals('#NAME?', $result); } - public function testREF() + public function testREF(): void { $result = Functions::REF(); self::assertEquals('#REF!', $result); } - public function testNULL() + public function testNULL(): void { $result = Functions::null(); self::assertEquals('#NULL!', $result); } - public function testVALUE() + public function testVALUE(): void { $result = Functions::VALUE(); self::assertEquals('#VALUE!', $result); @@ -111,7 +111,7 @@ class FunctionsTest extends TestCase * * @param mixed $expectedResult */ - public function testIsBlank($expectedResult, ...$args) + public function testIsBlank($expectedResult, ...$args): void { $result = Functions::isBlank(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -127,7 +127,7 @@ class FunctionsTest extends TestCase * * @param mixed $expectedResult */ - public function testIsErr($expectedResult, ...$args) + public function testIsErr($expectedResult, ...$args): void { $result = Functions::isErr(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -143,7 +143,7 @@ class FunctionsTest extends TestCase * * @param mixed $expectedResult */ - public function testIsError($expectedResult, ...$args) + public function testIsError($expectedResult, ...$args): void { $result = Functions::isError(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -159,7 +159,7 @@ class FunctionsTest extends TestCase * * @param mixed $expectedResult */ - public function testErrorType($expectedResult, ...$args) + public function testErrorType($expectedResult, ...$args): void { $result = Functions::errorType(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -175,7 +175,7 @@ class FunctionsTest extends TestCase * * @param mixed $expectedResult */ - public function testIsLogical($expectedResult, ...$args) + public function testIsLogical($expectedResult, ...$args): void { $result = Functions::isLogical(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -191,7 +191,7 @@ class FunctionsTest extends TestCase * * @param mixed $expectedResult */ - public function testIsNa($expectedResult, ...$args) + public function testIsNa($expectedResult, ...$args): void { $result = Functions::isNa(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -207,7 +207,7 @@ class FunctionsTest extends TestCase * * @param mixed $expectedResult */ - public function testIsNumber($expectedResult, ...$args) + public function testIsNumber($expectedResult, ...$args): void { $result = Functions::isNumber(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -223,7 +223,7 @@ class FunctionsTest extends TestCase * * @param mixed $expectedResult */ - public function testIsText($expectedResult, ...$args) + public function testIsText($expectedResult, ...$args): void { $result = Functions::isText(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -239,7 +239,7 @@ class FunctionsTest extends TestCase * * @param mixed $expectedResult */ - public function testIsNonText($expectedResult, ...$args) + public function testIsNonText($expectedResult, ...$args): void { $result = Functions::isNonText(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -255,7 +255,7 @@ class FunctionsTest extends TestCase * * @param mixed $expectedResult */ - public function testIsEven($expectedResult, ...$args) + public function testIsEven($expectedResult, ...$args): void { $result = Functions::isEven(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -271,7 +271,7 @@ class FunctionsTest extends TestCase * * @param mixed $expectedResult */ - public function testIsOdd($expectedResult, ...$args) + public function testIsOdd($expectedResult, ...$args): void { $result = Functions::isOdd(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -287,7 +287,7 @@ class FunctionsTest extends TestCase * * @param mixed $expectedResult */ - public function testTYPE($expectedResult, ...$args) + public function testTYPE($expectedResult, ...$args): void { $result = Functions::TYPE(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -303,7 +303,7 @@ class FunctionsTest extends TestCase * * @param mixed $expectedResult */ - public function testN($expectedResult, ...$args) + public function testN($expectedResult, ...$args): void { $result = Functions::n(...$args); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); @@ -321,7 +321,7 @@ class FunctionsTest extends TestCase * @param mixed $reference Reference to the cell we wish to test * @param mixed $value Value of the cell we wish to test */ - public function testIsFormula($expectedResult, $reference, $value = 'undefined') + public function testIsFormula($expectedResult, $reference, $value = 'undefined'): void { $ourCell = null; if ($value !== 'undefined') { @@ -329,33 +329,33 @@ class FunctionsTest extends TestCase ->disableOriginalConstructor() ->getMock(); $remoteCell->method('isFormula') - ->will($this->returnValue(substr($value, 0, 1) == '=')); + ->willReturn(substr($value, 0, 1) == '='); $remoteSheet = $this->getMockBuilder(Worksheet::class) ->disableOriginalConstructor() ->getMock(); $remoteSheet->method('getCell') - ->will($this->returnValue($remoteCell)); + ->willReturn($remoteCell); $workbook = $this->getMockBuilder(Spreadsheet::class) ->disableOriginalConstructor() ->getMock(); $workbook->method('getSheetByName') - ->will($this->returnValue($remoteSheet)); + ->willReturn($remoteSheet); $sheet = $this->getMockBuilder(Worksheet::class) ->disableOriginalConstructor() ->getMock(); $sheet->method('getCell') - ->will($this->returnValue($remoteCell)); + ->willReturn($remoteCell); $sheet->method('getParent') - ->will($this->returnValue($workbook)); + ->willReturn($workbook); $ourCell = $this->getMockBuilder(Cell::class) ->disableOriginalConstructor() ->getMock(); $ourCell->method('getWorksheet') - ->will($this->returnValue($sheet)); + ->willReturn($sheet); } $result = Functions::isFormula($reference, $ourCell); @@ -372,7 +372,7 @@ class FunctionsTest extends TestCase * * @param mixed $expectedResult */ - public function testIfCondition($expectedResult, ...$args) + public function testIfCondition($expectedResult, ...$args): void { $result = Functions::ifCondition(...$args); self::assertEquals($expectedResult, $result); diff --git a/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php b/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php index dff80fad..04dc0a32 100644 --- a/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php @@ -26,7 +26,7 @@ class LookupRefTest extends TestCase * @param mixed $reference Reference to the cell we wish to test * @param mixed $value Value of the cell we wish to test */ - public function testFormulaText($expectedResult, $reference, $value = 'undefined') + public function testFormulaText($expectedResult, $reference, $value = 'undefined'): void { $ourCell = null; if ($value !== 'undefined') { @@ -34,35 +34,35 @@ class LookupRefTest extends TestCase ->disableOriginalConstructor() ->getMock(); $remoteCell->method('isFormula') - ->will($this->returnValue(substr($value, 0, 1) == '=')); + ->willReturn(substr($value, 0, 1) == '='); $remoteCell->method('getValue') - ->will($this->returnValue($value)); + ->willReturn($value); $remoteSheet = $this->getMockBuilder(Worksheet::class) ->disableOriginalConstructor() ->getMock(); $remoteSheet->method('getCell') - ->will($this->returnValue($remoteCell)); + ->willReturn($remoteCell); $workbook = $this->getMockBuilder(Spreadsheet::class) ->disableOriginalConstructor() ->getMock(); $workbook->method('getSheetByName') - ->will($this->returnValue($remoteSheet)); + ->willReturn($remoteSheet); $sheet = $this->getMockBuilder(Worksheet::class) ->disableOriginalConstructor() ->getMock(); $sheet->method('getCell') - ->will($this->returnValue($remoteCell)); + ->willReturn($remoteCell); $sheet->method('getParent') - ->will($this->returnValue($workbook)); + ->willReturn($workbook); $ourCell = $this->getMockBuilder(Cell::class) ->disableOriginalConstructor() ->getMock(); $ourCell->method('getWorksheet') - ->will($this->returnValue($sheet)); + ->willReturn($sheet); } $result = LookupRef::FORMULATEXT($reference, $ourCell); diff --git a/tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php b/tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php index fe770731..936092d4 100644 --- a/tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php +++ b/tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php @@ -40,7 +40,7 @@ class AdvancedValueBinderTest extends TestCase * @param mixed $decimalSeparator * @param mixed $currencyCode */ - public function testCurrency($value, $valueBinded, $format, $thousandsSeparator, $decimalSeparator, $currencyCode) + public function testCurrency($value, $valueBinded, $format, $thousandsSeparator, $decimalSeparator, $currencyCode): void { $sheet = $this->getMockBuilder(Worksheet::class) ->setMethods(['getStyle', 'getNumberFormat', 'setFormatCode', 'getCellCollection']) @@ -48,23 +48,23 @@ class AdvancedValueBinderTest extends TestCase $cellCollection = $this->getMockBuilder(Cells::class) ->disableOriginalConstructor() ->getMock(); - $cellCollection->expects($this->any()) + $cellCollection->expects(self::any()) ->method('getParent') - ->will($this->returnValue($sheet)); + ->willReturn($sheet); - $sheet->expects($this->once()) + $sheet->expects(self::once()) ->method('getStyle') - ->will($this->returnSelf()); - $sheet->expects($this->once()) + ->willReturnSelf(); + $sheet->expects(self::once()) ->method('getNumberFormat') - ->will($this->returnSelf()); - $sheet->expects($this->once()) + ->willReturnSelf(); + $sheet->expects(self::once()) ->method('setFormatCode') ->with($format) - ->will($this->returnSelf()); - $sheet->expects($this->any()) + ->willReturnSelf(); + $sheet->expects(self::any()) ->method('getCellCollection') - ->will($this->returnValue($cellCollection)); + ->willReturn($cellCollection); StringHelper::setCurrencyCode($currencyCode); StringHelper::setDecimalSeparator($decimalSeparator); diff --git a/tests/PhpSpreadsheetTests/Cell/CellTest.php b/tests/PhpSpreadsheetTests/Cell/CellTest.php index 15e1d384..8c95e864 100644 --- a/tests/PhpSpreadsheetTests/Cell/CellTest.php +++ b/tests/PhpSpreadsheetTests/Cell/CellTest.php @@ -13,9 +13,8 @@ class CellTest extends TestCase * * @param mixed $expected * @param mixed $value - * @param string $dataType */ - public function testSetValueExplicit($expected, $value, string $dataType) + public function testSetValueExplicit($expected, $value, string $dataType): void { $spreadsheet = new Spreadsheet(); $cell = $spreadsheet->getActiveSheet()->getCell('A1'); @@ -32,11 +31,9 @@ class CellTest extends TestCase /** * @dataProvider providerSetValueExplicitException * - * @param mixed $expected * @param mixed $value - * @param string $dataType */ - public function testSetValueExplicitException($value, string $dataType) + public function testSetValueExplicitException($value, string $dataType): void { $this->expectException(Exception::class); diff --git a/tests/PhpSpreadsheetTests/Cell/CoordinateTest.php b/tests/PhpSpreadsheetTests/Cell/CoordinateTest.php index 7a12ceb7..37579e80 100644 --- a/tests/PhpSpreadsheetTests/Cell/CoordinateTest.php +++ b/tests/PhpSpreadsheetTests/Cell/CoordinateTest.php @@ -5,6 +5,7 @@ namespace PhpOffice\PhpSpreadsheetTests\Cell; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Exception; use PHPUnit\Framework\TestCase; +use TypeError; class CoordinateTest extends TestCase { @@ -14,7 +15,7 @@ class CoordinateTest extends TestCase * @param mixed $expectedResult * @param mixed $string */ - public function testColumnIndexFromString($expectedResult, $string) + public function testColumnIndexFromString($expectedResult, $string): void { $columnIndex = Coordinate::columnIndexFromString($string); self::assertEquals($expectedResult, $columnIndex); @@ -28,7 +29,7 @@ class CoordinateTest extends TestCase return require 'tests/data/ColumnString.php'; } - public function testColumnIndexFromStringTooLong() + public function testColumnIndexFromStringTooLong(): void { $cellAddress = 'ABCD'; @@ -40,10 +41,10 @@ class CoordinateTest extends TestCase return; } - $this->fail('An expected exception has not been raised.'); + self::fail('An expected exception has not been raised.'); } - public function testColumnIndexFromStringTooShort() + public function testColumnIndexFromStringTooShort(): void { $cellAddress = ''; @@ -55,7 +56,7 @@ class CoordinateTest extends TestCase return; } - $this->fail('An expected exception has not been raised.'); + self::fail('An expected exception has not been raised.'); } /** @@ -64,7 +65,7 @@ class CoordinateTest extends TestCase * @param mixed $expectedResult * @param int $columnIndex */ - public function testStringFromColumnIndex($expectedResult, $columnIndex) + public function testStringFromColumnIndex($expectedResult, $columnIndex): void { $string = Coordinate::stringFromColumnIndex($columnIndex); self::assertEquals($expectedResult, $string); @@ -83,7 +84,7 @@ class CoordinateTest extends TestCase * * @param mixed $expectedResult */ - public function testCoordinateFromString($expectedResult, ...$args) + public function testCoordinateFromString($expectedResult, ...$args): void { $result = Coordinate::coordinateFromString(...$args); self::assertEquals($expectedResult, $result); @@ -94,7 +95,7 @@ class CoordinateTest extends TestCase return require 'tests/data/CellCoordinates.php'; } - public function testCoordinateFromStringWithRangeAddress() + public function testCoordinateFromStringWithRangeAddress(): void { $cellAddress = 'A1:AI2012'; @@ -106,10 +107,10 @@ class CoordinateTest extends TestCase return; } - $this->fail('An expected exception has not been raised.'); + self::fail('An expected exception has not been raised.'); } - public function testCoordinateFromStringWithEmptyAddress() + public function testCoordinateFromStringWithEmptyAddress(): void { $cellAddress = ''; @@ -121,10 +122,10 @@ class CoordinateTest extends TestCase return; } - $this->fail('An expected exception has not been raised.'); + self::fail('An expected exception has not been raised.'); } - public function testCoordinateFromStringWithInvalidAddress() + public function testCoordinateFromStringWithInvalidAddress(): void { $cellAddress = 'AI'; @@ -136,7 +137,7 @@ class CoordinateTest extends TestCase return; } - $this->fail('An expected exception has not been raised.'); + self::fail('An expected exception has not been raised.'); } /** @@ -144,7 +145,7 @@ class CoordinateTest extends TestCase * * @param mixed $expectedResult */ - public function testAbsoluteCoordinateFromString($expectedResult, ...$args) + public function testAbsoluteCoordinateFromString($expectedResult, ...$args): void { $result = Coordinate::absoluteCoordinate(...$args); self::assertEquals($expectedResult, $result); @@ -155,7 +156,7 @@ class CoordinateTest extends TestCase return require 'tests/data/CellAbsoluteCoordinate.php'; } - public function testAbsoluteCoordinateFromStringWithRangeAddress() + public function testAbsoluteCoordinateFromStringWithRangeAddress(): void { $cellAddress = 'A1:AI2012'; @@ -167,7 +168,7 @@ class CoordinateTest extends TestCase return; } - $this->fail('An expected exception has not been raised.'); + self::fail('An expected exception has not been raised.'); } /** @@ -175,7 +176,7 @@ class CoordinateTest extends TestCase * * @param mixed $expectedResult */ - public function testAbsoluteReferenceFromString($expectedResult, ...$args) + public function testAbsoluteReferenceFromString($expectedResult, ...$args): void { $result = Coordinate::absoluteReference(...$args); self::assertEquals($expectedResult, $result); @@ -186,7 +187,7 @@ class CoordinateTest extends TestCase return require 'tests/data/CellAbsoluteReference.php'; } - public function testAbsoluteReferenceFromStringWithRangeAddress() + public function testAbsoluteReferenceFromStringWithRangeAddress(): void { $cellAddress = 'A1:AI2012'; @@ -198,7 +199,7 @@ class CoordinateTest extends TestCase return; } - $this->fail('An expected exception has not been raised.'); + self::fail('An expected exception has not been raised.'); } /** @@ -206,7 +207,7 @@ class CoordinateTest extends TestCase * * @param mixed $expectedResult */ - public function testSplitRange($expectedResult, ...$args) + public function testSplitRange($expectedResult, ...$args): void { $result = Coordinate::splitRange(...$args); foreach ($result as $key => $split) { @@ -228,7 +229,7 @@ class CoordinateTest extends TestCase * * @param mixed $expectedResult */ - public function testBuildRange($expectedResult, ...$args) + public function testBuildRange($expectedResult, ...$args): void { $result = Coordinate::buildRange(...$args); self::assertEquals($expectedResult, $result); @@ -239,9 +240,9 @@ class CoordinateTest extends TestCase return require 'tests/data/CellBuildRange.php'; } - public function testBuildRangeInvalid() + public function testBuildRangeInvalid(): void { - $this->expectException(\TypeError::class); + $this->expectException(TypeError::class); $cellRange = ''; Coordinate::buildRange($cellRange); @@ -252,7 +253,7 @@ class CoordinateTest extends TestCase * * @param mixed $expectedResult */ - public function testRangeBoundaries($expectedResult, ...$args) + public function testRangeBoundaries($expectedResult, ...$args): void { $result = Coordinate::rangeBoundaries(...$args); self::assertEquals($expectedResult, $result); @@ -268,7 +269,7 @@ class CoordinateTest extends TestCase * * @param mixed $expectedResult */ - public function testRangeDimension($expectedResult, ...$args) + public function testRangeDimension($expectedResult, ...$args): void { $result = Coordinate::rangeDimension(...$args); self::assertEquals($expectedResult, $result); @@ -284,7 +285,7 @@ class CoordinateTest extends TestCase * * @param mixed $expectedResult */ - public function testGetRangeBoundaries($expectedResult, ...$args) + public function testGetRangeBoundaries($expectedResult, ...$args): void { $result = Coordinate::getRangeBoundaries(...$args); self::assertEquals($expectedResult, $result); @@ -300,7 +301,7 @@ class CoordinateTest extends TestCase * * @param mixed $expectedResult */ - public function testExtractAllCellReferencesInRange($expectedResult, ...$args) + public function testExtractAllCellReferencesInRange($expectedResult, ...$args): void { $result = Coordinate::extractAllCellReferencesInRange(...$args); self::assertEquals($expectedResult, $result); @@ -316,7 +317,7 @@ class CoordinateTest extends TestCase * * @param string $range */ - public function testExtractAllCellReferencesInRangeInvalidRange($range) + public function testExtractAllCellReferencesInRangeInvalidRange($range): void { $this->expectException(Exception::class); $this->expectExceptionMessage('Invalid range: "' . $range . '"'); @@ -334,7 +335,7 @@ class CoordinateTest extends TestCase * * @param mixed $expectedResult */ - public function testMergeRangesInCollection($expectedResult, ...$args) + public function testMergeRangesInCollection($expectedResult, ...$args): void { $result = Coordinate::mergeRangesInCollection(...$args); self::assertEquals($expectedResult, $result); @@ -350,7 +351,7 @@ class CoordinateTest extends TestCase * * @param mixed $expectedResult */ - public function testCoordinateIsRange($expectedResult, ...$args) + public function testCoordinateIsRange($expectedResult, ...$args): void { $result = Coordinate::coordinateIsRange(...$args); self::assertEquals($expectedResult, $result); diff --git a/tests/PhpSpreadsheetTests/Cell/DataTypeTest.php b/tests/PhpSpreadsheetTests/Cell/DataTypeTest.php index 8acba297..95454c16 100644 --- a/tests/PhpSpreadsheetTests/Cell/DataTypeTest.php +++ b/tests/PhpSpreadsheetTests/Cell/DataTypeTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; class DataTypeTest extends TestCase { - public function testGetErrorCodes() + public function testGetErrorCodes(): void { $result = DataType::getErrorCodes(); self::assertIsArray($result); @@ -16,7 +16,7 @@ class DataTypeTest extends TestCase self::assertArrayHasKey('#NULL!', $result); } - public function testCheckString() + public function testCheckString(): void { $richText = new RichText(); $result1 = DataType::checkString($richText); diff --git a/tests/PhpSpreadsheetTests/Cell/DataValidationTest.php b/tests/PhpSpreadsheetTests/Cell/DataValidationTest.php index c41c0335..62be68dd 100644 --- a/tests/PhpSpreadsheetTests/Cell/DataValidationTest.php +++ b/tests/PhpSpreadsheetTests/Cell/DataValidationTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase; class DataValidationTest extends TestCase { - public function testNoValidation() + public function testNoValidation(): void { $dataValidation = new DataValidation(); self::assertSame('090624f04837265d79323c4a1b7e89d1', $dataValidation->getHashCode()); diff --git a/tests/PhpSpreadsheetTests/Cell/DataValidatorTest.php b/tests/PhpSpreadsheetTests/Cell/DataValidatorTest.php index 9d4db699..bae315af 100644 --- a/tests/PhpSpreadsheetTests/Cell/DataValidatorTest.php +++ b/tests/PhpSpreadsheetTests/Cell/DataValidatorTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; class DataValidatorTest extends TestCase { - public function testNoValidation() + public function testNoValidation(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -17,7 +17,7 @@ class DataValidatorTest extends TestCase self::assertTrue($testCell->hasValidValue(), 'a cell without any validation data is always valid'); } - public function testUnsupportedType() + public function testUnsupportedType(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -30,7 +30,7 @@ class DataValidatorTest extends TestCase self::assertFalse($testCell->hasValidValue(), 'cannot assert that value is valid when the validation type is not supported'); } - public function testList() + public function testList(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); diff --git a/tests/PhpSpreadsheetTests/Cell/DefaultValueBinderTest.php b/tests/PhpSpreadsheetTests/Cell/DefaultValueBinderTest.php index d22e03cb..90dabce3 100644 --- a/tests/PhpSpreadsheetTests/Cell/DefaultValueBinderTest.php +++ b/tests/PhpSpreadsheetTests/Cell/DefaultValueBinderTest.php @@ -21,9 +21,9 @@ class DefaultValueBinderTest extends TestCase ->getMock(); // Configure the stub. - $cellStub->expects($this->any()) + $cellStub->expects(self::any()) ->method('setValueExplicit') - ->will($this->returnValue(true)); + ->willReturn(true); return $cellStub; } @@ -33,7 +33,7 @@ class DefaultValueBinderTest extends TestCase * * @param mixed $value */ - public function testBindValue($value) + public function testBindValue($value): void { $cellStub = $this->createCellStub(); $binder = new DefaultValueBinder(); @@ -65,7 +65,7 @@ class DefaultValueBinderTest extends TestCase * * @param mixed $expectedResult */ - public function testDataTypeForValue($expectedResult, ...$args) + public function testDataTypeForValue($expectedResult, ...$args): void { $result = DefaultValueBinder::dataTypeForValue(...$args); self::assertEquals($expectedResult, $result); @@ -76,7 +76,7 @@ class DefaultValueBinderTest extends TestCase return require 'tests/data/Cell/DefaultValueBinder.php'; } - public function testDataTypeForRichTextObject() + public function testDataTypeForRichTextObject(): void { $objRichText = new RichText(); $objRichText->createText('Hello World'); @@ -86,7 +86,7 @@ class DefaultValueBinderTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testCanOverrideStaticMethodWithoutOverridingBindValue() + public function testCanOverrideStaticMethodWithoutOverridingBindValue(): void { $cellStub = $this->createCellStub(); $binder = new ValueBinderWithOverriddenDataTypeForValue(); diff --git a/tests/PhpSpreadsheetTests/Cell/HyperlinkTest.php b/tests/PhpSpreadsheetTests/Cell/HyperlinkTest.php index b1337a0b..9c09aa75 100644 --- a/tests/PhpSpreadsheetTests/Cell/HyperlinkTest.php +++ b/tests/PhpSpreadsheetTests/Cell/HyperlinkTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase; class HyperlinkTest extends TestCase { - public function testGetUrl() + public function testGetUrl(): void { $urlValue = 'https://www.example.com'; @@ -17,7 +17,7 @@ class HyperlinkTest extends TestCase self::assertEquals($urlValue, $result); } - public function testSetUrl() + public function testSetUrl(): void { $initialUrlValue = 'https://www.example.com'; $newUrlValue = 'http://github.com/PHPOffice/PhpSpreadsheet'; @@ -30,7 +30,7 @@ class HyperlinkTest extends TestCase self::assertEquals($newUrlValue, $result); } - public function testGetTooltip() + public function testGetTooltip(): void { $tooltipValue = 'PhpSpreadsheet Web Site'; @@ -40,7 +40,7 @@ class HyperlinkTest extends TestCase self::assertEquals($tooltipValue, $result); } - public function testSetTooltip() + public function testSetTooltip(): void { $initialTooltipValue = 'PhpSpreadsheet Web Site'; $newTooltipValue = 'PhpSpreadsheet Repository on Github'; @@ -53,7 +53,7 @@ class HyperlinkTest extends TestCase self::assertEquals($newTooltipValue, $result); } - public function testIsInternal() + public function testIsInternal(): void { $initialUrlValue = 'https://www.example.com'; $newUrlValue = 'sheet://Worksheet1!A1'; @@ -67,7 +67,7 @@ class HyperlinkTest extends TestCase self::assertTrue($result); } - public function testGetHashCode() + public function testGetHashCode(): void { $urlValue = 'https://www.example.com'; $tooltipValue = 'PhpSpreadsheet Web Site'; diff --git a/tests/PhpSpreadsheetTests/Chart/DataSeriesValuesTest.php b/tests/PhpSpreadsheetTests/Chart/DataSeriesValuesTest.php index 6641cc6b..c34ca697 100644 --- a/tests/PhpSpreadsheetTests/Chart/DataSeriesValuesTest.php +++ b/tests/PhpSpreadsheetTests/Chart/DataSeriesValuesTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; class DataSeriesValuesTest extends TestCase { - public function testSetDataType() + public function testSetDataType(): void { $dataTypeValues = [ 'Number', @@ -23,7 +23,7 @@ class DataSeriesValuesTest extends TestCase } } - public function testSetInvalidDataTypeThrowsException() + public function testSetInvalidDataTypeThrowsException(): void { $testInstance = new DataSeriesValues(); @@ -34,10 +34,10 @@ class DataSeriesValuesTest extends TestCase return; } - $this->fail('An expected exception has not been raised.'); + self::fail('An expected exception has not been raised.'); } - public function testGetDataType() + public function testGetDataType(): void { $dataTypeValue = 'String'; @@ -48,7 +48,7 @@ class DataSeriesValuesTest extends TestCase self::assertEquals($dataTypeValue, $result); } - public function testGetLineWidth() + public function testGetLineWidth(): void { $testInstance = new DataSeriesValues(); self::assertEquals(12700, $testInstance->getLineWidth(), 'should have default'); @@ -60,7 +60,7 @@ class DataSeriesValuesTest extends TestCase self::assertEquals(12700, $testInstance->getLineWidth(), 'should enforce minimum width'); } - public function testFillColorCorrectInput() + public function testFillColorCorrectInput(): void { $testInstance = new DataSeriesValues(); @@ -68,7 +68,7 @@ class DataSeriesValuesTest extends TestCase self::assertEquals($testInstance, $testInstance->setFillColor(['00abb8', 'b8292f'])); } - public function testFillColorInvalidInput() + public function testFillColorInvalidInput(): void { $testInstance = new DataSeriesValues(); $this->expectException(\Exception::class); @@ -77,7 +77,7 @@ class DataSeriesValuesTest extends TestCase $testInstance->setFillColor('WRONG COLOR'); } - public function testFillColorInvalidInputInArray() + public function testFillColorInvalidInputInArray(): void { $testInstance = new DataSeriesValues(); $this->expectException(\Exception::class); diff --git a/tests/PhpSpreadsheetTests/Chart/LayoutTest.php b/tests/PhpSpreadsheetTests/Chart/LayoutTest.php index 9ae80460..8e927985 100644 --- a/tests/PhpSpreadsheetTests/Chart/LayoutTest.php +++ b/tests/PhpSpreadsheetTests/Chart/LayoutTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase; class LayoutTest extends TestCase { - public function testSetLayoutTarget() + public function testSetLayoutTarget(): void { $LayoutTargetValue = 'String'; @@ -17,7 +17,7 @@ class LayoutTest extends TestCase self::assertInstanceOf(Layout::class, $result); } - public function testGetLayoutTarget() + public function testGetLayoutTarget(): void { $LayoutTargetValue = 'String'; diff --git a/tests/PhpSpreadsheetTests/Chart/LegendTest.php b/tests/PhpSpreadsheetTests/Chart/LegendTest.php index e21baaf5..30715365 100644 --- a/tests/PhpSpreadsheetTests/Chart/LegendTest.php +++ b/tests/PhpSpreadsheetTests/Chart/LegendTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase; class LegendTest extends TestCase { - public function testSetPosition() + public function testSetPosition(): void { $positionValues = [ Legend::POSITION_RIGHT, @@ -25,7 +25,7 @@ class LegendTest extends TestCase } } - public function testSetInvalidPositionReturnsFalse() + public function testSetInvalidPositionReturnsFalse(): void { $testInstance = new Legend(); @@ -36,7 +36,7 @@ class LegendTest extends TestCase self::assertEquals(Legend::POSITION_RIGHT, $result); } - public function testGetPosition() + public function testGetPosition(): void { $PositionValue = Legend::POSITION_BOTTOM; @@ -47,7 +47,7 @@ class LegendTest extends TestCase self::assertEquals($PositionValue, $result); } - public function testSetPositionXL() + public function testSetPositionXL(): void { $positionValues = [ Legend::XL_LEGEND_POSITION_BOTTOM, @@ -66,7 +66,7 @@ class LegendTest extends TestCase } } - public function testSetInvalidXLPositionReturnsFalse() + public function testSetInvalidXLPositionReturnsFalse(): void { $testInstance = new Legend(); @@ -77,7 +77,7 @@ class LegendTest extends TestCase self::assertEquals(Legend::XL_LEGEND_POSITION_RIGHT, $result); } - public function testGetPositionXL() + public function testGetPositionXL(): void { $PositionValue = Legend::XL_LEGEND_POSITION_CORNER; @@ -88,7 +88,7 @@ class LegendTest extends TestCase self::assertEquals($PositionValue, $result); } - public function testSetOverlay() + public function testSetOverlay(): void { $overlayValues = [ true, @@ -103,7 +103,7 @@ class LegendTest extends TestCase } } - public function testSetInvalidOverlayReturnsFalse() + public function testSetInvalidOverlayReturnsFalse(): void { $testInstance = new Legend(); @@ -114,7 +114,7 @@ class LegendTest extends TestCase self::assertFalse($result); } - public function testGetOverlay() + public function testGetOverlay(): void { $OverlayValue = true; diff --git a/tests/PhpSpreadsheetTests/Collection/CellsTest.php b/tests/PhpSpreadsheetTests/Collection/CellsTest.php index e1dcfc8f..539d0232 100644 --- a/tests/PhpSpreadsheetTests/Collection/CellsTest.php +++ b/tests/PhpSpreadsheetTests/Collection/CellsTest.php @@ -11,7 +11,7 @@ use PHPUnit\Framework\TestCase; class CellsTest extends TestCase { - public function testCollectionCell() + public function testCollectionCell(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -63,7 +63,7 @@ class CellsTest extends TestCase self::assertEquals(['A1', 'C3'], $collection->getCoordinates(), 'cell list should contains the cell'); } - public function testCacheLastCell() + public function testCacheLastCell(): void { $workbook = new Spreadsheet(); $cells = ['A1', 'A2']; @@ -73,7 +73,7 @@ class CellsTest extends TestCase self::assertEquals($cells, $sheet->getCoordinates(), 'list should include last added cell'); } - public function testCanGetCellAfterAnotherIsDeleted() + public function testCanGetCellAfterAnotherIsDeleted(): void { $workbook = new Spreadsheet(); $sheet = $workbook->getActiveSheet(); @@ -85,7 +85,7 @@ class CellsTest extends TestCase self::assertNotNull($collection->get('A2'), 'should be able to get back the cell even when another cell was deleted while this one was the current one'); } - public function testThrowsWhenCellCannotBeRetrievedFromCache() + public function testThrowsWhenCellCannotBeRetrievedFromCache(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); @@ -100,7 +100,7 @@ class CellsTest extends TestCase $collection->get('A2'); } - public function testThrowsWhenCellCannotBeStoredInCache() + public function testThrowsWhenCellCannotBeStoredInCache(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); @@ -115,20 +115,20 @@ class CellsTest extends TestCase $collection->add('A2', $cell); } - public function testGetHighestColumn() + public function testGetHighestColumn(): void { $workbook = new Spreadsheet(); $sheet = $workbook->getActiveSheet(); $collection = $sheet->getCellCollection(); // check for empty sheet - $this->assertEquals('A', $collection->getHighestColumn()); - $this->assertEquals('A', $collection->getHighestColumn(1)); + self::assertEquals('A', $collection->getHighestColumn()); + self::assertEquals('A', $collection->getHighestColumn(1)); // set a value and check again $sheet->getCell('C4')->setValue(1); - $this->assertEquals('C', $collection->getHighestColumn()); - $this->assertEquals('A', $collection->getHighestColumn(1)); - $this->assertEquals('C', $collection->getHighestColumn(4)); + self::assertEquals('C', $collection->getHighestColumn()); + self::assertEquals('A', $collection->getHighestColumn(1)); + self::assertEquals('C', $collection->getHighestColumn(4)); } } diff --git a/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php b/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php index d039dab0..4d1025d2 100644 --- a/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php +++ b/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php @@ -27,7 +27,7 @@ class ComplexAssert if (abs($actual) > 10 && abs($expected) > 10) { $variance = floor(log10(abs($expected))); - $adjustedDelta *= pow(10, $variance); + $adjustedDelta *= 10 ** $variance; } return $adjustedDelta > 1.0 ? 1.0 : $adjustedDelta; diff --git a/tests/PhpSpreadsheetTests/DocumentGeneratorTest.php b/tests/PhpSpreadsheetTests/DocumentGeneratorTest.php index 214fe593..ac9af838 100644 --- a/tests/PhpSpreadsheetTests/DocumentGeneratorTest.php +++ b/tests/PhpSpreadsheetTests/DocumentGeneratorTest.php @@ -12,9 +12,6 @@ class DocumentGeneratorTest extends TestCase { /** * @dataProvider providerGenerateFunctionListByName - * - * @param array $phpSpreadsheetFunctions - * @param string $expected */ public function testGenerateFunctionListByName(array $phpSpreadsheetFunctions, string $expected): void { @@ -23,9 +20,6 @@ class DocumentGeneratorTest extends TestCase /** * @dataProvider providerGenerateFunctionListByCategory - * - * @param array $phpSpreadsheetFunctions - * @param string $expected */ public function testGenerateFunctionListByCategory(array $phpSpreadsheetFunctions, string $expected): void { diff --git a/tests/PhpSpreadsheetTests/Functional/AbstractFunctional.php b/tests/PhpSpreadsheetTests/Functional/AbstractFunctional.php index da9f76e0..f242c698 100644 --- a/tests/PhpSpreadsheetTests/Functional/AbstractFunctional.php +++ b/tests/PhpSpreadsheetTests/Functional/AbstractFunctional.php @@ -15,13 +15,11 @@ abstract class AbstractFunctional extends TestCase /** * Write spreadsheet to disk, reload and return it. * - * @param Spreadsheet $spreadsheet * @param string $format - * @param null|callable $readerCustomizer * * @return Spreadsheet */ - protected function writeAndReload(Spreadsheet $spreadsheet, $format, callable $readerCustomizer = null) + protected function writeAndReload(Spreadsheet $spreadsheet, $format, ?callable $readerCustomizer = null) { $filename = tempnam(File::sysGetTempDir(), 'phpspreadsheet-test'); $writer = IOFactory::createWriter($spreadsheet, $format); diff --git a/tests/PhpSpreadsheetTests/Functional/ActiveSheetTest.php b/tests/PhpSpreadsheetTests/Functional/ActiveSheetTest.php index 9274e9c4..56682b34 100644 --- a/tests/PhpSpreadsheetTests/Functional/ActiveSheetTest.php +++ b/tests/PhpSpreadsheetTests/Functional/ActiveSheetTest.php @@ -20,7 +20,7 @@ class ActiveSheetTest extends AbstractFunctional * * @param string $format */ - public function testActiveSheet($format) + public function testActiveSheet($format): void { $spreadsheet = new Spreadsheet(); diff --git a/tests/PhpSpreadsheetTests/Functional/ColumnWidthTest.php b/tests/PhpSpreadsheetTests/Functional/ColumnWidthTest.php index 6d4fc2ca..5cd0aec7 100644 --- a/tests/PhpSpreadsheetTests/Functional/ColumnWidthTest.php +++ b/tests/PhpSpreadsheetTests/Functional/ColumnWidthTest.php @@ -18,7 +18,7 @@ class ColumnWidthTest extends AbstractFunctional * * @param $format */ - public function testReadColumnWidth($format) + public function testReadColumnWidth($format): void { // create new sheet with column width $spreadsheet = new Spreadsheet(); @@ -31,7 +31,7 @@ class ColumnWidthTest extends AbstractFunctional $this->assertColumn($reloadedSpreadsheet); } - private function assertColumn(Spreadsheet $spreadsheet) + private function assertColumn(Spreadsheet $spreadsheet): void { $sheet = $spreadsheet->getActiveSheet(); $columnDimensions = $sheet->getColumnDimensions(); diff --git a/tests/PhpSpreadsheetTests/Functional/CommentsTest.php b/tests/PhpSpreadsheetTests/Functional/CommentsTest.php index a394c967..6f1c5340 100644 --- a/tests/PhpSpreadsheetTests/Functional/CommentsTest.php +++ b/tests/PhpSpreadsheetTests/Functional/CommentsTest.php @@ -23,7 +23,7 @@ class CommentsTest extends AbstractFunctional * * @param $format */ - public function testComments($format) + public function testComments($format): void { $spreadsheet = new Spreadsheet(); diff --git a/tests/PhpSpreadsheetTests/Functional/ConditionalStopIfTrueTest.php b/tests/PhpSpreadsheetTests/Functional/ConditionalStopIfTrueTest.php index 3aa3f949..3183450f 100644 --- a/tests/PhpSpreadsheetTests/Functional/ConditionalStopIfTrueTest.php +++ b/tests/PhpSpreadsheetTests/Functional/ConditionalStopIfTrueTest.php @@ -21,7 +21,7 @@ class ConditionalStopIfTrueTest extends AbstractFunctional * * @param string $format */ - public function testConditionalStopIfTrue($format) + public function testConditionalStopIfTrue($format): void { $pCoordinate = 'A1:A3'; diff --git a/tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php b/tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php index 99333150..7a8e2cda 100644 --- a/tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php +++ b/tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php @@ -8,7 +8,7 @@ use PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing; class DrawingImageHyperlinkTest extends AbstractFunctional { - public function testDrawingImageHyperlinkTest() + public function testDrawingImageHyperlinkTest(): void { $baseUrl = 'https://github.com/PHPOffice/PhpSpreadsheet'; $spreadsheet = new Spreadsheet(); diff --git a/tests/PhpSpreadsheetTests/Functional/EnclosureTest.php b/tests/PhpSpreadsheetTests/Functional/EnclosureTest.php index 3a5f9616..1f1cb7eb 100644 --- a/tests/PhpSpreadsheetTests/Functional/EnclosureTest.php +++ b/tests/PhpSpreadsheetTests/Functional/EnclosureTest.php @@ -22,7 +22,7 @@ class EnclosureTest extends AbstractFunctional * * @param string $format */ - public function testEnclosure($format) + public function testEnclosure($format): void { $value = ''; diff --git a/tests/PhpSpreadsheetTests/Functional/FreezePaneTest.php b/tests/PhpSpreadsheetTests/Functional/FreezePaneTest.php index 38709716..4e725d03 100644 --- a/tests/PhpSpreadsheetTests/Functional/FreezePaneTest.php +++ b/tests/PhpSpreadsheetTests/Functional/FreezePaneTest.php @@ -19,7 +19,7 @@ class FreezePaneTest extends AbstractFunctional * * @param string $format */ - public function testFreezePane($format) + public function testFreezePane($format): void { $cellSplit = 'B4'; $topLeftCell = 'E7'; @@ -43,7 +43,7 @@ class FreezePaneTest extends AbstractFunctional * * @param string $format */ - public function testFreezePaneWithInvalidSelectedCells($format) + public function testFreezePaneWithInvalidSelectedCells($format): void { $cellSplit = 'A7'; $topLeftCell = 'A24'; @@ -71,7 +71,7 @@ class FreezePaneTest extends AbstractFunctional * * @param string $format */ - public function testFreezePaneUserSelectedCell($format) + public function testFreezePaneUserSelectedCell($format): void { $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); @@ -100,7 +100,7 @@ class FreezePaneTest extends AbstractFunctional * * @param string $format */ - public function testNoFreezePaneUserSelectedCell($format) + public function testNoFreezePaneUserSelectedCell($format): void { $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); diff --git a/tests/PhpSpreadsheetTests/Functional/MergedCellsTest.php b/tests/PhpSpreadsheetTests/Functional/MergedCellsTest.php index 7a601949..39865817 100644 --- a/tests/PhpSpreadsheetTests/Functional/MergedCellsTest.php +++ b/tests/PhpSpreadsheetTests/Functional/MergedCellsTest.php @@ -21,7 +21,7 @@ class MergedCellsTest extends AbstractFunctional * * @param string $format */ - public function testMergedCells($format) + public function testMergedCells($format): void { $spreadsheet = new Spreadsheet(); $spreadsheet->setActiveSheetIndex(0); diff --git a/tests/PhpSpreadsheetTests/Functional/PrintAreaTest.php b/tests/PhpSpreadsheetTests/Functional/PrintAreaTest.php index 7c3a9112..a335fd2f 100644 --- a/tests/PhpSpreadsheetTests/Functional/PrintAreaTest.php +++ b/tests/PhpSpreadsheetTests/Functional/PrintAreaTest.php @@ -20,7 +20,7 @@ class PrintAreaTest extends AbstractFunctional * * @param string $format */ - public function testPageSetup($format) + public function testPageSetup($format): void { // Create new workbook with 3 sheets and different print areas $spreadsheet = new Spreadsheet(); @@ -35,7 +35,7 @@ class PrintAreaTest extends AbstractFunctional $worksheet4 = $spreadsheet->createSheet()->setTitle('Sheet 4'); $worksheet4->getPageSetup()->setPrintArea('A4:B4,D1:E4'); - $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, $format, function (BaseReader $reader) { + $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, $format, function (BaseReader $reader): void { $reader->setLoadSheetsOnly(['Sheet 1', 'Sheet 3', 'Sheet 4']); }); diff --git a/tests/PhpSpreadsheetTests/Functional/ReadBlankCellsTest.php b/tests/PhpSpreadsheetTests/Functional/ReadBlankCellsTest.php index 02c752ac..9dac3437 100644 --- a/tests/PhpSpreadsheetTests/Functional/ReadBlankCellsTest.php +++ b/tests/PhpSpreadsheetTests/Functional/ReadBlankCellsTest.php @@ -22,10 +22,9 @@ class ReadBlankCellsTest extends AbstractFunctional * * @dataProvider providerSheetFormat * - * @param array $arrayData * @param mixed $format */ - public function testXlsxLoadWithNoBlankCells($format) + public function testXlsxLoadWithNoBlankCells($format): void { $spreadsheet = new Spreadsheet(); $spreadsheet->getActiveSheet()->getCell('B2')->setValue(''); @@ -33,15 +32,15 @@ class ReadBlankCellsTest extends AbstractFunctional $spreadsheet->getActiveSheet()->getCell('C3')->setValue('C3'); $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, $format); - $this->assertTrue($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('B2')); - $this->assertFalse($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('C2')); - $this->assertTrue($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('C3')); + self::assertTrue($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('B2')); + self::assertFalse($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('C2')); + self::assertTrue($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('C3')); - $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, $format, function ($reader) { + $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, $format, function ($reader): void { $reader->setReadEmptyCells(false); }); - $this->assertFalse($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('B2')); - $this->assertFalse($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('C2')); - $this->assertTrue($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('C3')); + self::assertFalse($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('B2')); + self::assertFalse($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('C2')); + self::assertTrue($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('C3')); } } diff --git a/tests/PhpSpreadsheetTests/Functional/ReadFilterTest.php b/tests/PhpSpreadsheetTests/Functional/ReadFilterTest.php index 288fc57e..efca228c 100644 --- a/tests/PhpSpreadsheetTests/Functional/ReadFilterTest.php +++ b/tests/PhpSpreadsheetTests/Functional/ReadFilterTest.php @@ -34,10 +34,9 @@ class ReadFilterTest extends AbstractFunctional * * @dataProvider providerCellsValues * - * @param array $arrayData * @param mixed $format */ - public function testXlsxLoadWithoutReadFilter($format, array $arrayData) + public function testXlsxLoadWithoutReadFilter($format, array $arrayData): void { $spreadsheet = new Spreadsheet(); @@ -62,19 +61,18 @@ class ReadFilterTest extends AbstractFunctional * * @dataProvider providerCellsValues * - * @param array $arrayData * @param mixed $format */ - public function testXlsxLoadWithReadFilter($format, array $arrayData) + public function testXlsxLoadWithReadFilter($format, array $arrayData): void { $spreadsheet = new Spreadsheet(); $spreadsheet->getActiveSheet()->fromArray($arrayData, null, 'A1'); - $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, $format, function ($reader) { + $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, $format, function ($reader): void { // Create a stub for the readFilter class. $readFilterStub = $this->createMock(IReadFilter::class); $readFilterStub->method('readCell') - ->will($this->returnCallback([$this, 'readFilterReadCell'])); + ->willReturnCallback([$this, 'readFilterReadCell']); // apply filter $reader->setReadFilter($readFilterStub); }); diff --git a/tests/PhpSpreadsheetTests/Functional/SelectedCellsTest.php b/tests/PhpSpreadsheetTests/Functional/SelectedCellsTest.php index 03d4be9f..625f2428 100644 --- a/tests/PhpSpreadsheetTests/Functional/SelectedCellsTest.php +++ b/tests/PhpSpreadsheetTests/Functional/SelectedCellsTest.php @@ -20,7 +20,7 @@ class SelectedCellsTest extends AbstractFunctional * * @param string $format */ - public function testSelectedCells($format) + public function testSelectedCells($format): void { $spreadsheet = new Spreadsheet(); diff --git a/tests/PhpSpreadsheetTests/Functional/StreamTest.php b/tests/PhpSpreadsheetTests/Functional/StreamTest.php index 20e588bb..dcca6b8a 100644 --- a/tests/PhpSpreadsheetTests/Functional/StreamTest.php +++ b/tests/PhpSpreadsheetTests/Functional/StreamTest.php @@ -24,8 +24,6 @@ class StreamTest extends TestCase /** * @dataProvider providerFormats - * - * @param string $format */ public function testAllWritersCanWriteToStream(string $format): void { diff --git a/tests/PhpSpreadsheetTests/Functional/TypeAttributePreservationTest.php b/tests/PhpSpreadsheetTests/Functional/TypeAttributePreservationTest.php index cca3777a..e6d6377b 100644 --- a/tests/PhpSpreadsheetTests/Functional/TypeAttributePreservationTest.php +++ b/tests/PhpSpreadsheetTests/Functional/TypeAttributePreservationTest.php @@ -27,9 +27,8 @@ class TypeAttributePreservationTest extends AbstractFunctional * @dataProvider providerFormulae * * @param string $format - * @param array $values */ - public function testFormulae($format, array $values) + public function testFormulae($format, array $values): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); diff --git a/tests/PhpSpreadsheetTests/Functional/WorkbookViewAttributesTest.php b/tests/PhpSpreadsheetTests/Functional/WorkbookViewAttributesTest.php index cce2a95b..f97ad9cf 100644 --- a/tests/PhpSpreadsheetTests/Functional/WorkbookViewAttributesTest.php +++ b/tests/PhpSpreadsheetTests/Functional/WorkbookViewAttributesTest.php @@ -24,7 +24,7 @@ class WorkbookViewAttributesTest extends AbstractFunctional * * @param string $format */ - public function testPreserveWorkbookViewAttributes($format) + public function testPreserveWorkbookViewAttributes($format): void { // Create a dummy workbook with two worksheets $workbook = new Spreadsheet(); @@ -36,14 +36,14 @@ class WorkbookViewAttributesTest extends AbstractFunctional $worksheet2->setCellValue('A1', 2); // Check that the bookview attributes return default values - $this->assertTrue($workbook->getShowHorizontalScroll()); - $this->assertTrue($workbook->getShowVerticalScroll()); - $this->assertTrue($workbook->getShowSheetTabs()); - $this->assertTrue($workbook->getAutoFilterDateGrouping()); - $this->assertFalse($workbook->getMinimized()); - $this->assertSame(0, $workbook->getFirstSheetIndex()); - $this->assertSame(600, $workbook->getTabRatio()); - $this->assertSame(Spreadsheet::VISIBILITY_VISIBLE, $workbook->getVisibility()); + self::assertTrue($workbook->getShowHorizontalScroll()); + self::assertTrue($workbook->getShowVerticalScroll()); + self::assertTrue($workbook->getShowSheetTabs()); + self::assertTrue($workbook->getAutoFilterDateGrouping()); + self::assertFalse($workbook->getMinimized()); + self::assertSame(0, $workbook->getFirstSheetIndex()); + self::assertSame(600, $workbook->getTabRatio()); + self::assertSame(Spreadsheet::VISIBILITY_VISIBLE, $workbook->getVisibility()); // Set the bookview attributes to non-default values $workbook->setShowHorizontalScroll(false); @@ -56,25 +56,25 @@ class WorkbookViewAttributesTest extends AbstractFunctional $workbook->setVisibility(Spreadsheet::VISIBILITY_HIDDEN); // Check that bookview attributes were set properly - $this->assertFalse($workbook->getShowHorizontalScroll()); - $this->assertFalse($workbook->getShowVerticalScroll()); - $this->assertFalse($workbook->getShowSheetTabs()); - $this->assertFalse($workbook->getAutoFilterDateGrouping()); - $this->assertTrue($workbook->getMinimized()); - $this->assertSame(1, $workbook->getFirstSheetIndex()); - $this->assertSame(700, $workbook->getTabRatio()); - $this->assertSame(Spreadsheet::VISIBILITY_HIDDEN, $workbook->getVisibility()); + self::assertFalse($workbook->getShowHorizontalScroll()); + self::assertFalse($workbook->getShowVerticalScroll()); + self::assertFalse($workbook->getShowSheetTabs()); + self::assertFalse($workbook->getAutoFilterDateGrouping()); + self::assertTrue($workbook->getMinimized()); + self::assertSame(1, $workbook->getFirstSheetIndex()); + self::assertSame(700, $workbook->getTabRatio()); + self::assertSame(Spreadsheet::VISIBILITY_HIDDEN, $workbook->getVisibility()); $workbook2 = $this->writeAndReload($workbook, $format); // Check that the read spreadsheet has the right bookview attributes - $this->assertFalse($workbook2->getShowHorizontalScroll()); - $this->assertFalse($workbook2->getShowVerticalScroll()); - $this->assertFalse($workbook2->getShowSheetTabs()); - $this->assertFalse($workbook2->getAutoFilterDateGrouping()); - $this->assertTrue($workbook2->getMinimized()); - $this->assertSame(1, $workbook2->getFirstSheetIndex()); - $this->assertSame(700, $workbook2->getTabRatio()); - $this->assertSame(Spreadsheet::VISIBILITY_HIDDEN, $workbook2->getVisibility()); + self::assertFalse($workbook2->getShowHorizontalScroll()); + self::assertFalse($workbook2->getShowVerticalScroll()); + self::assertFalse($workbook2->getShowSheetTabs()); + self::assertFalse($workbook2->getAutoFilterDateGrouping()); + self::assertTrue($workbook2->getMinimized()); + self::assertSame(1, $workbook2->getFirstSheetIndex()); + self::assertSame(700, $workbook2->getTabRatio()); + self::assertSame(Spreadsheet::VISIBILITY_HIDDEN, $workbook2->getVisibility()); } } diff --git a/tests/PhpSpreadsheetTests/Helper/HtmlTest.php b/tests/PhpSpreadsheetTests/Helper/HtmlTest.php index b15a7285..d47c2f64 100644 --- a/tests/PhpSpreadsheetTests/Helper/HtmlTest.php +++ b/tests/PhpSpreadsheetTests/Helper/HtmlTest.php @@ -13,7 +13,7 @@ class HtmlTest extends TestCase * @param mixed $expected * @param mixed $input */ - public function testUtf8EncodingSupport($expected, $input) + public function testUtf8EncodingSupport($expected, $input): void { $html = new Html(); $actual = $html->toRichTextObject($input); diff --git a/tests/PhpSpreadsheetTests/Helper/SampleTest.php b/tests/PhpSpreadsheetTests/Helper/SampleTest.php index 6bd9c422..eb729dc9 100644 --- a/tests/PhpSpreadsheetTests/Helper/SampleTest.php +++ b/tests/PhpSpreadsheetTests/Helper/SampleTest.php @@ -14,10 +14,10 @@ class SampleTest extends TestCase * * @param mixed $sample */ - public function testSample($sample) + public function testSample($sample): void { // Suppress output to console - $this->setOutputCallback(function () { + $this->setOutputCallback(function (): void { }); require $sample; diff --git a/tests/PhpSpreadsheetTests/IOFactoryTest.php b/tests/PhpSpreadsheetTests/IOFactoryTest.php index 5084354f..983ba35e 100644 --- a/tests/PhpSpreadsheetTests/IOFactoryTest.php +++ b/tests/PhpSpreadsheetTests/IOFactoryTest.php @@ -2,6 +2,7 @@ namespace PhpOffice\PhpSpreadsheetTests; +use InvalidArgumentException; use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\Reader; use PhpOffice\PhpSpreadsheet\Spreadsheet; @@ -16,7 +17,7 @@ class IOFactoryTest extends TestCase * @param string $name * @param string $expected */ - public function testCreateWriter($name, $expected) + public function testCreateWriter($name, $expected): void { $spreadsheet = new Spreadsheet(); $actual = IOFactory::createWriter($spreadsheet, $name); @@ -37,7 +38,7 @@ class IOFactoryTest extends TestCase ]; } - public function testRegisterWriter() + public function testRegisterWriter(): void { IOFactory::registerWriter('Pdf', Writer\Pdf\Mpdf::class); $spreadsheet = new Spreadsheet(); @@ -51,7 +52,7 @@ class IOFactoryTest extends TestCase * @param string $name * @param string $expected */ - public function testCreateReader($name, $expected) + public function testCreateReader($name, $expected): void { $actual = IOFactory::createReader($name); self::assertInstanceOf($expected, $actual); @@ -71,7 +72,7 @@ class IOFactoryTest extends TestCase ]; } - public function testRegisterReader() + public function testRegisterReader(): void { IOFactory::registerReader('Custom', Reader\Html::class); $actual = IOFactory::createReader('Custom'); @@ -85,7 +86,7 @@ class IOFactoryTest extends TestCase * @param string $expectedName * @param string $expectedClass */ - public function testIdentify($file, $expectedName, $expectedClass) + public function testIdentify($file, $expectedName, $expectedClass): void { $actual = IOFactory::identify($file); self::assertSame($expectedName, $actual); @@ -98,7 +99,7 @@ class IOFactoryTest extends TestCase * @param string $expectedName * @param string $expectedClass */ - public function testCreateReaderForFile($file, $expectedName, $expectedClass) + public function testCreateReaderForFile($file, $expectedName, $expectedClass): void { $actual = IOFactory::createReaderForFile($file); self::assertInstanceOf($expectedClass, $actual); @@ -111,7 +112,7 @@ class IOFactoryTest extends TestCase * @param string $expectedName * @param string $expectedClass */ - public function testLoad($file, $expectedName, $expectedClass) + public function testLoad($file, $expectedName, $expectedClass): void { $actual = IOFactory::load($file); self::assertInstanceOf(Spreadsheet::class, $actual); @@ -130,28 +131,28 @@ class IOFactoryTest extends TestCase ]; } - public function testIdentifyNonExistingFileThrowException() + public function testIdentifyNonExistingFileThrowException(): void { - $this->expectException(\InvalidArgumentException::class); + $this->expectException(InvalidArgumentException::class); IOFactory::identify('/non/existing/file'); } - public function testIdentifyExistingDirectoryThrowExceptions() + public function testIdentifyExistingDirectoryThrowExceptions(): void { - $this->expectException(\InvalidArgumentException::class); + $this->expectException(InvalidArgumentException::class); IOFactory::identify('.'); } - public function testRegisterInvalidWriter() + public function testRegisterInvalidWriter(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Writer\Exception::class); IOFactory::registerWriter('foo', 'bar'); } - public function testRegisterInvalidReader() + public function testRegisterInvalidReader(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Reader\Exception::class); diff --git a/tests/PhpSpreadsheetTests/Reader/CondNumFmtTest.php b/tests/PhpSpreadsheetTests/Reader/CondNumFmtTest.php index 1743c433..c7474c6a 100644 --- a/tests/PhpSpreadsheetTests/Reader/CondNumFmtTest.php +++ b/tests/PhpSpreadsheetTests/Reader/CondNumFmtTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; class CondNumFmtTest extends TestCase { - public function testLoadCondNumFmt() + public function testLoadCondNumFmt(): void { $filename = 'tests/data/Reader/XLSX/condfmtnum.xlsx'; $reader = new Xlsx(); diff --git a/tests/PhpSpreadsheetTests/Reader/CsvContiguousFilter.php b/tests/PhpSpreadsheetTests/Reader/CsvContiguousFilter.php index 95f7e787..9bc16ae0 100644 --- a/tests/PhpSpreadsheetTests/Reader/CsvContiguousFilter.php +++ b/tests/PhpSpreadsheetTests/Reader/CsvContiguousFilter.php @@ -19,13 +19,13 @@ class CsvContiguousFilter implements IReadFilter * @param mixed $startRow * @param mixed $chunkSize */ - public function setRows($startRow, $chunkSize) + public function setRows($startRow, $chunkSize): void { $this->startRow = $startRow; $this->endRow = $startRow + $chunkSize; } - public function setFilterType($type) + public function setFilterType($type): void { $this->filterType = $type; } diff --git a/tests/PhpSpreadsheetTests/Reader/CsvContiguousTest.php b/tests/PhpSpreadsheetTests/Reader/CsvContiguousTest.php index 4920c001..3a417791 100644 --- a/tests/PhpSpreadsheetTests/Reader/CsvContiguousTest.php +++ b/tests/PhpSpreadsheetTests/Reader/CsvContiguousTest.php @@ -10,7 +10,7 @@ class CsvContiguousTest extends TestCase { private $inputFileName = 'samples/Reader/sampleData/example2.csv'; - public function testContiguous() + public function testContiguous(): void { // Create a new Reader of the type defined in $inputFileType $reader = new Csv(); @@ -54,7 +54,7 @@ class CsvContiguousTest extends TestCase self::assertEquals(-20.1, $sheet->getCell('C6')->getValue()); } - public function testContiguous2() + public function testContiguous2(): void { // Create a new Reader of the type defined in $inputFileType $reader = new Csv(); diff --git a/tests/PhpSpreadsheetTests/Reader/CsvTest.php b/tests/PhpSpreadsheetTests/Reader/CsvTest.php index 3b6c61b8..cb2b6196 100644 --- a/tests/PhpSpreadsheetTests/Reader/CsvTest.php +++ b/tests/PhpSpreadsheetTests/Reader/CsvTest.php @@ -16,7 +16,7 @@ class CsvTest extends TestCase * @param string $cell * @param float|int|string $expectedValue */ - public function testDelimiterDetection($filename, $expectedDelimiter, $cell, $expectedValue) + public function testDelimiterDetection($filename, $expectedDelimiter, $cell, $expectedValue): void { $reader = new Csv(); self::assertNull($reader->getDelimiter()); @@ -95,7 +95,7 @@ class CsvTest extends TestCase * @param bool $expected * @param string $filename */ - public function testCanLoad($expected, $filename) + public function testCanLoad($expected, $filename): void { $reader = new Csv(); self::assertSame($expected, $reader->canRead($filename)); @@ -117,7 +117,7 @@ class CsvTest extends TestCase ]; } - public function testEscapeCharacters() + public function testEscapeCharacters(): void { $reader = (new Csv())->setEscapeCharacter('"'); $worksheet = $reader->load('tests/data/Reader/CSV/backslash.csv') @@ -128,8 +128,8 @@ class CsvTest extends TestCase ['field 3\\', 'field 4'], ]; - $this->assertSame('"', $reader->getEscapeCharacter()); - $this->assertSame($expected, $worksheet->toArray()); + self::assertSame('"', $reader->getEscapeCharacter()); + self::assertSame($expected, $worksheet->toArray()); } /** @@ -138,7 +138,7 @@ class CsvTest extends TestCase * @param string $filename * @param string $encoding */ - public function testEncodings($filename, $encoding) + public function testEncodings($filename, $encoding): void { $reader = new Csv(); $reader->setInputEncoding($encoding); @@ -147,7 +147,7 @@ class CsvTest extends TestCase self::assertEquals('Å', $sheet->getCell('A1')->getValue()); } - public function testInvalidWorkSheetInfo() + public function testInvalidWorkSheetInfo(): void { $this->expectException(ReaderException::class); $reader = new Csv(); @@ -160,7 +160,7 @@ class CsvTest extends TestCase * @param string $filename * @param string $encoding */ - public function testWorkSheetInfo($filename, $encoding) + public function testWorkSheetInfo($filename, $encoding): void { $reader = new Csv(); $reader->setInputEncoding($encoding); @@ -185,7 +185,7 @@ class CsvTest extends TestCase ]; } - public function testUtf16LineBreak() + public function testUtf16LineBreak(): void { $reader = new Csv(); $reader->setInputEncoding('UTF-16BE'); @@ -200,7 +200,7 @@ EOF; self::assertEquals($expected, $sheet->getCell('B3')->getValue()); } - public function testSeparatorLine() + public function testSeparatorLine(): void { $reader = new Csv(); $reader->setSheetIndex(3); @@ -215,7 +215,7 @@ EOF; self::assertEquals(3, $sheet->getCell('B2')->getValue()); } - public function testDefaultSettings() + public function testDefaultSettings(): void { $reader = new Csv(); self::assertEquals('UTF-8', $reader->getInputEncoding()); @@ -226,7 +226,7 @@ EOF; self::assertEquals('"', $reader->getEnclosure()); } - public function testReadEmptyFileName() + public function testReadEmptyFileName(): void { $this->expectException(ReaderException::class); $reader = new Csv(); @@ -234,7 +234,7 @@ EOF; $reader->load($filename); } - public function testReadNonexistentFileName() + public function testReadNonexistentFileName(): void { $this->expectException(ReaderException::class); $reader = new Csv(); diff --git a/tests/PhpSpreadsheetTests/Reader/HtmlTest.php b/tests/PhpSpreadsheetTests/Reader/HtmlTest.php index 14cccb6b..b0994a33 100644 --- a/tests/PhpSpreadsheetTests/Reader/HtmlTest.php +++ b/tests/PhpSpreadsheetTests/Reader/HtmlTest.php @@ -11,7 +11,7 @@ use PHPUnit\Framework\TestCase; class HtmlTest extends TestCase { - public function testCsvWithAngleBracket() + public function testCsvWithAngleBracket(): void { $filename = 'tests/data/Reader/HTML/csv_with_angle_bracket.csv'; $reader = new Html(); @@ -36,7 +36,7 @@ class HtmlTest extends TestCase * @param bool $expected * @param string $content */ - public function testCanReadVerySmallFile($expected, $content) + public function testCanReadVerySmallFile($expected, $content): void { $filename = $this->createHtml($content); $reader = new Html(); @@ -47,7 +47,7 @@ class HtmlTest extends TestCase unlink($filename); } - public function testBackgroundColorInRanding() + public function testBackgroundColorInRanding(): void { $html = ' @@ -64,7 +64,7 @@ class HtmlTest extends TestCase unlink($filename); } - public function testCanApplyInlineBordersStyles() + public function testCanApplyInlineBordersStyles(): void { $html = '
@@ -110,7 +110,7 @@ class HtmlTest extends TestCase unlink($filename); } - public function testCanApplyInlineFontStyles() + public function testCanApplyInlineFontStyles(): void { $html = '
@@ -147,7 +147,7 @@ class HtmlTest extends TestCase unlink($filename); } - public function testCanApplyInlineWidth() + public function testCanApplyInlineWidth(): void { $html = '
@@ -168,7 +168,7 @@ class HtmlTest extends TestCase unlink($filename); } - public function testCanApplyInlineHeight() + public function testCanApplyInlineHeight(): void { $html = '
@@ -191,7 +191,7 @@ class HtmlTest extends TestCase unlink($filename); } - public function testCanApplyAlignment() + public function testCanApplyAlignment(): void { $html = '
@@ -228,7 +228,7 @@ class HtmlTest extends TestCase unlink($filename); } - public function testCanApplyInlineDataFormat() + public function testCanApplyInlineDataFormat(): void { $html = '
@@ -245,7 +245,7 @@ class HtmlTest extends TestCase unlink($filename); } - public function testCanInsertImage() + public function testCanInsertImage(): void { $imagePath = realpath(__DIR__ . '/../../data/Reader/HTML/image.jpg'); @@ -266,7 +266,7 @@ class HtmlTest extends TestCase unlink($filename); } - public function testCanApplyCellWrapping() + public function testCanApplyCellWrapping(): void { $html = '
@@ -289,17 +289,17 @@ class HtmlTest extends TestCase $cellStyle = $firstSheet->getStyle('A2'); self::assertTrue($cellStyle->getAlignment()->getWrapText()); $cellValue = $firstSheet->getCell('A2')->getValue(); - $this->assertStringContainsString("\n", $cellValue); + self::assertStringContainsString("\n", $cellValue); $cellStyle = $firstSheet->getStyle('A3'); self::assertTrue($cellStyle->getAlignment()->getWrapText()); $cellValue = $firstSheet->getCell('A3')->getValue(); - $this->assertStringContainsString("\n", $cellValue); + self::assertStringContainsString("\n", $cellValue); unlink($filename); } - public function testCanLoadFromString() + public function testCanLoadFromString(): void { $html = '
@@ -321,15 +321,15 @@ class HtmlTest extends TestCase $cellStyle = $firstSheet->getStyle('A2'); self::assertTrue($cellStyle->getAlignment()->getWrapText()); $cellValue = $firstSheet->getCell('A2')->getValue(); - $this->assertStringContainsString("\n", $cellValue); + self::assertStringContainsString("\n", $cellValue); $cellStyle = $firstSheet->getStyle('A3'); self::assertTrue($cellStyle->getAlignment()->getWrapText()); $cellValue = $firstSheet->getCell('A3')->getValue(); - $this->assertStringContainsString("\n", $cellValue); + self::assertStringContainsString("\n", $cellValue); } - public function testCanLoadFromStringIntoExistingSpreadsheet() + public function testCanLoadFromStringIntoExistingSpreadsheet(): void { $html = '
@@ -352,12 +352,12 @@ class HtmlTest extends TestCase $cellStyle = $firstSheet->getStyle('A2'); self::assertTrue($cellStyle->getAlignment()->getWrapText()); $cellValue = $firstSheet->getCell('A2')->getValue(); - $this->assertStringContainsString("\n", $cellValue); + self::assertStringContainsString("\n", $cellValue); $cellStyle = $firstSheet->getStyle('A3'); self::assertTrue($cellStyle->getAlignment()->getWrapText()); $cellValue = $firstSheet->getCell('A3')->getValue(); - $this->assertStringContainsString("\n", $cellValue); + self::assertStringContainsString("\n", $cellValue); $reader->setSheetIndex(1); $html = '
@@ -394,7 +394,7 @@ class HtmlTest extends TestCase return (new Html())->load($filename); } - public function testRowspanInRendering() + public function testRowspanInRendering(): void { $filename = 'tests/data/Reader/HTML/rowspan.html'; $reader = new Html(); @@ -404,7 +404,7 @@ class HtmlTest extends TestCase self::assertSame(['A2:C2' => 'A2:C2'], $actual); } - public function testTextIndentUseRowspan() + public function testTextIndentUseRowspan(): void { $html = '
diff --git a/tests/PhpSpreadsheetTests/Reader/OdsTest.php b/tests/PhpSpreadsheetTests/Reader/OdsTest.php index 82813b74..6b111497 100644 --- a/tests/PhpSpreadsheetTests/Reader/OdsTest.php +++ b/tests/PhpSpreadsheetTests/Reader/OdsTest.php @@ -56,7 +56,7 @@ class OdsTest extends TestCase return $this->spreadsheetData; } - public function testReadFileProperties() + public function testReadFileProperties(): void { $filename = 'tests/data/Reader/Ods/data.ods'; @@ -71,7 +71,7 @@ class OdsTest extends TestCase ], $reader->listWorksheetNames($filename)); } - public function testLoadWorksheets() + public function testLoadWorksheets(): void { $spreadsheet = $this->loadDataFile(); @@ -86,7 +86,7 @@ class OdsTest extends TestCase self::assertInstanceOf('PhpOffice\PhpSpreadsheet\Worksheet\Worksheet', $secondSheet); } - public function testReadValueAndComments() + public function testReadValueAndComments(): void { $spreadsheet = $this->loadOdsTestFile(); @@ -151,7 +151,7 @@ class OdsTest extends TestCase self::assertEquals(20, $firstSheet->getCell('A5')->getValue()); } - public function testReadColors() + public function testReadColors(): void { $spreadsheet = $this->loadOdsTestFile(); $firstSheet = $spreadsheet->getSheet(0); @@ -165,7 +165,7 @@ class OdsTest extends TestCase self::assertEquals('FF000000', $style->getFill()->getEndColor()->getARGB()); } - public function testReadRichText() + public function testReadRichText(): void { $spreadsheet = $this->loadOdsTestFile(); $firstSheet = $spreadsheet->getSheet(0); @@ -177,7 +177,7 @@ class OdsTest extends TestCase ); } - public function testReadCellsWithRepeatedSpaces() + public function testReadCellsWithRepeatedSpaces(): void { $spreadsheet = $this->loadDataFile(); $firstSheet = $spreadsheet->getSheet(0); @@ -188,7 +188,7 @@ class OdsTest extends TestCase self::assertEquals("test with new \nLines", $firstSheet->getCell('A11')->getValue()); } - public function testReadHyperlinks() + public function testReadHyperlinks(): void { $spreadsheet = $this->loadOdsTestFile(); $firstSheet = $spreadsheet->getSheet(0); @@ -202,9 +202,9 @@ class OdsTest extends TestCase // Below some test for features not implemented yet - public function testReadBoldItalicUnderline() + public function testReadBoldItalicUnderline(): void { - $this->markTestIncomplete('Features not implemented yet'); + self::markTestIncomplete('Features not implemented yet'); $spreadsheet = $this->loadOdsTestFile(); $firstSheet = $spreadsheet->getSheet(0); @@ -224,7 +224,7 @@ class OdsTest extends TestCase self::assertTrue($style->getFont()->getItalic()); } - public function testLoadOdsWorkbookProperties() + public function testLoadOdsWorkbookProperties(): void { $customPropertySet = [ 'Owner' => ['type' => Properties::PROPERTY_TYPE_STRING, 'value' => 'PHPOffice'], diff --git a/tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php b/tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php index 4bf46429..8f42af10 100644 --- a/tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php +++ b/tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php @@ -6,6 +6,7 @@ use PhpOffice\PhpSpreadsheet\Reader\Security\XmlScanner; use PhpOffice\PhpSpreadsheet\Reader\Xls; use PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PHPUnit\Framework\TestCase; +use XMLReader; class XmlScannerTest extends TestCase { @@ -21,7 +22,7 @@ class XmlScannerTest extends TestCase * @param mixed $expectedResult * @param $libxmlDisableEntityLoader */ - public function testValidXML($filename, $expectedResult, $libxmlDisableEntityLoader) + public function testValidXML($filename, $expectedResult, $libxmlDisableEntityLoader): void { $oldDisableEntityLoaderState = libxml_disable_entity_loader($libxmlDisableEntityLoader); @@ -51,7 +52,7 @@ class XmlScannerTest extends TestCase * @param mixed $filename * @param $libxmlDisableEntityLoader */ - public function testInvalidXML($filename, $libxmlDisableEntityLoader) + public function testInvalidXML($filename, $libxmlDisableEntityLoader): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Reader\Exception::class); @@ -76,7 +77,7 @@ class XmlScannerTest extends TestCase return $tests; } - public function testGetSecurityScannerForXmlBasedReader() + public function testGetSecurityScannerForXmlBasedReader(): void { $fileReader = new Xlsx(); $scanner = $fileReader->getSecurityScanner(); @@ -84,15 +85,15 @@ class XmlScannerTest extends TestCase // Must return an object... self::assertIsObject($scanner); // ... of the correct type - $this->assertInstanceOf(XmlScanner::class, $scanner); + self::assertInstanceOf(XmlScanner::class, $scanner); } - public function testGetSecurityScannerForNonXmlBasedReader() + public function testGetSecurityScannerForNonXmlBasedReader(): void { $fileReader = new Xls(); $scanner = $fileReader->getSecurityScanner(); // Must return a null... - $this->assertNull($scanner); + self::assertNull($scanner); } /** @@ -101,14 +102,14 @@ class XmlScannerTest extends TestCase * @param mixed $filename * @param mixed $expectedResult */ - public function testSecurityScanWithCallback($filename, $expectedResult) + public function testSecurityScanWithCallback($filename, $expectedResult): void { $fileReader = new Xlsx(); $scanner = $fileReader->getSecurityScanner(); $scanner->setAdditionalCallback('strrev'); $xml = $scanner->scanFile($filename); - $this->assertEquals(strrev($expectedResult), $xml); + self::assertEquals(strrev($expectedResult), $xml); } public function providerValidXMLForCallback() @@ -121,20 +122,20 @@ class XmlScannerTest extends TestCase return $tests; } - public function testLibxmlDisableEntityLoaderIsRestoredWithoutShutdown() + public function testLibxmlDisableEntityLoaderIsRestoredWithoutShutdown(): void { $reader = new Xlsx(); unset($reader); - $reader = new \XMLReader(); + $reader = new XMLReader(); $opened = $reader->open('tests/data/Reader/Xml/SecurityScannerWithCallbackExample.xml'); - $this->assertTrue($opened); + self::assertTrue($opened); } - public function testEncodingAllowsMixedCase() + public function testEncodingAllowsMixedCase(): void { $scanner = new XmlScanner(); $output = $scanner->scan($input = 'bar'); - $this->assertSame($input, $output); + self::assertSame($input, $output); } } diff --git a/tests/PhpSpreadsheetTests/Reader/XlsTest.php b/tests/PhpSpreadsheetTests/Reader/XlsTest.php index dd6344b4..77ad91fa 100644 --- a/tests/PhpSpreadsheetTests/Reader/XlsTest.php +++ b/tests/PhpSpreadsheetTests/Reader/XlsTest.php @@ -10,7 +10,7 @@ class XlsTest extends TestCase /** * Test load Xls file. */ - public function testLoadXlsSample() + public function testLoadXlsSample(): void { $filename = 'tests/data/Reader/XLS/sample.xls'; $reader = new Xls(); diff --git a/tests/PhpSpreadsheetTests/Reader/Xlsx/AutoFilterTest.php b/tests/PhpSpreadsheetTests/Reader/Xlsx/AutoFilterTest.php index 90ea17aa..63da2d05 100644 --- a/tests/PhpSpreadsheetTests/Reader/Xlsx/AutoFilterTest.php +++ b/tests/PhpSpreadsheetTests/Reader/Xlsx/AutoFilterTest.php @@ -6,6 +6,7 @@ use PhpOffice\PhpSpreadsheet\Reader\Xlsx\AutoFilter; use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter as WorksheetAutoFilter; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PHPUnit\Framework\TestCase; +use SimpleXMLElement; class AutoFilterTest extends TestCase { @@ -18,7 +19,7 @@ class AutoFilterTest extends TestCase private function getXMLInstance($ref) { - return new \SimpleXMLElement( + return new SimpleXMLElement( '' . '' . '' . @@ -50,15 +51,15 @@ class AutoFilterTest extends TestCase * @param int $expectedReadAutoFilterCalled * @param string $expectedRef */ - public function testLoad($ref, $expectedReadAutoFilterCalled, $expectedRef) + public function testLoad($ref, $expectedReadAutoFilterCalled, $expectedRef): void { $worksheetAutoFilter = $this->getAutoFilterInstance(); - $worksheetAutoFilter->expects($this->exactly($expectedReadAutoFilterCalled ? 1 : 0)) + $worksheetAutoFilter->expects(self::exactly($expectedReadAutoFilterCalled ? 1 : 0)) ->method('setRange') ->with($expectedRef); $worksheet = $this->getWorksheetInstance(); - $worksheet->expects($this->exactly($expectedReadAutoFilterCalled ? 1 : 0)) + $worksheet->expects(self::exactly($expectedReadAutoFilterCalled ? 1 : 0)) ->method('getAutoFilter') ->willReturn($worksheetAutoFilter); diff --git a/tests/PhpSpreadsheetTests/Reader/Xlsx2Test.php b/tests/PhpSpreadsheetTests/Reader/Xlsx2Test.php index b77796c6..4d0b6a8a 100644 --- a/tests/PhpSpreadsheetTests/Reader/Xlsx2Test.php +++ b/tests/PhpSpreadsheetTests/Reader/Xlsx2Test.php @@ -19,7 +19,7 @@ class Xlsx2Test extends TestCase } } - public function testLoadXlsxConditionalFormatting2() + public function testLoadXlsxConditionalFormatting2(): void { // Make sure Conditionals are read correctly from existing file $filename = 'tests/data/Reader/XLSX/conditionalFormatting2Test.xlsx'; @@ -53,7 +53,7 @@ class Xlsx2Test extends TestCase self::assertEquals('5', $conditions[0]); } - public function testReloadXlsxConditionalFormatting2() + public function testReloadXlsxConditionalFormatting2(): void { // Make sure conditionals from existing file are maintained across save $filename = 'tests/data/Reader/XLSX/conditionalFormatting2Test.xlsx'; @@ -91,7 +91,7 @@ class Xlsx2Test extends TestCase self::assertEquals('5', $conditions[0]); } - public function testNewXlsxConditionalFormatting2() + public function testNewXlsxConditionalFormatting2(): void { // Make sure blanks/non-blanks added by PhpSpreadsheet are handled correctly $outfile = tempnam(File::sysGetTempDir(), 'phpspreadsheet-test'); diff --git a/tests/PhpSpreadsheetTests/Reader/XlsxTest.php b/tests/PhpSpreadsheetTests/Reader/XlsxTest.php index efa7af72..9e0b5f66 100644 --- a/tests/PhpSpreadsheetTests/Reader/XlsxTest.php +++ b/tests/PhpSpreadsheetTests/Reader/XlsxTest.php @@ -14,7 +14,7 @@ use PHPUnit\Framework\TestCase; class XlsxTest extends TestCase { - public function testLoadXlsxWorkbookProperties() + public function testLoadXlsxWorkbookProperties(): void { $customPropertySet = [ 'Publisher' => ['type' => Properties::PROPERTY_TYPE_STRING, 'value' => 'PHPOffice Suite'], @@ -30,32 +30,32 @@ class XlsxTest extends TestCase $properties = $spreadsheet->getProperties(); // Core Properties - $this->assertSame('Mark Baker', $properties->getCreator()); - $this->assertSame('Unit Testing', $properties->getTitle()); - $this->assertSame('Property Test', $properties->getSubject()); + self::assertSame('Mark Baker', $properties->getCreator()); + self::assertSame('Unit Testing', $properties->getTitle()); + self::assertSame('Property Test', $properties->getSubject()); // Extended Properties - $this->assertSame('PHPOffice', $properties->getCompany()); - $this->assertSame('The Big Boss', $properties->getManager()); + self::assertSame('PHPOffice', $properties->getCompany()); + self::assertSame('The Big Boss', $properties->getManager()); // Custom Properties $customProperties = $properties->getCustomProperties(); self::assertIsArray($customProperties); $customProperties = array_flip($customProperties); - $this->assertArrayHasKey('Publisher', $customProperties); + self::assertArrayHasKey('Publisher', $customProperties); foreach ($customPropertySet as $propertyName => $testData) { - $this->assertTrue($properties->isCustomPropertySet($propertyName)); - $this->assertSame($testData['type'], $properties->getCustomPropertyType($propertyName)); + self::assertTrue($properties->isCustomPropertySet($propertyName)); + self::assertSame($testData['type'], $properties->getCustomPropertyType($propertyName)); if ($properties->getCustomPropertyType($propertyName) == Properties::PROPERTY_TYPE_DATE) { - $this->assertSame($testData['value'], date('Y-m-d', $properties->getCustomPropertyValue($propertyName))); + self::assertSame($testData['value'], date('Y-m-d', $properties->getCustomPropertyValue($propertyName))); } else { - $this->assertSame($testData['value'], $properties->getCustomPropertyValue($propertyName)); + self::assertSame($testData['value'], $properties->getCustomPropertyValue($propertyName)); } } } - public function testLoadXlsxRowColumnAttributes() + public function testLoadXlsxRowColumnAttributes(): void { $filename = 'tests/data/Reader/XLSX/rowColumnAttributeTest.xlsx'; $reader = new Xlsx(); @@ -63,23 +63,23 @@ class XlsxTest extends TestCase $worksheet = $spreadsheet->getActiveSheet(); for ($row = 1; $row <= 4; ++$row) { - $this->assertEquals($row * 5 + 10, floor($worksheet->getRowDimension($row)->getRowHeight())); + self::assertEquals($row * 5 + 10, floor($worksheet->getRowDimension($row)->getRowHeight())); } - $this->assertFalse($worksheet->getRowDimension(5)->getVisible()); + self::assertFalse($worksheet->getRowDimension(5)->getVisible()); for ($column = 1; $column <= 4; ++$column) { $columnAddress = Coordinate::stringFromColumnIndex($column); - $this->assertEquals( + self::assertEquals( $column * 2 + 2, floor($worksheet->getColumnDimension($columnAddress)->getWidth()) ); } - $this->assertFalse($worksheet->getColumnDimension('E')->getVisible()); + self::assertFalse($worksheet->getColumnDimension('E')->getVisible()); } - public function testLoadXlsxWithStyles() + public function testLoadXlsxWithStyles(): void { $expectedColours = [ 1 => ['A' => 'C00000', 'C' => 'FF0000', 'E' => 'FFC000'], @@ -95,7 +95,7 @@ class XlsxTest extends TestCase $worksheet = $spreadsheet->getActiveSheet(); for ($row = 1; $row <= 8; $row += 2) { for ($column = 'A'; $column !== 'G'; ++$column, ++$column) { - $this->assertEquals( + self::assertEquals( $expectedColours[$row][$column], $worksheet->getStyle($column . $row)->getFill()->getStartColor()->getRGB() ); @@ -103,7 +103,7 @@ class XlsxTest extends TestCase } } - public function testLoadXlsxAutofilter() + public function testLoadXlsxAutofilter(): void { $filename = 'tests/data/Reader/XLSX/autofilterTest.xlsx'; $reader = new Xlsx(); @@ -112,15 +112,15 @@ class XlsxTest extends TestCase $worksheet = $spreadsheet->getActiveSheet(); $autofilter = $worksheet->getAutoFilter(); - $this->assertInstanceOf(AutoFilter::class, $autofilter); - $this->assertEquals('A1:D57', $autofilter->getRange()); - $this->assertEquals( + self::assertInstanceOf(AutoFilter::class, $autofilter); + self::assertEquals('A1:D57', $autofilter->getRange()); + self::assertEquals( AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER, $autofilter->getColumn('A')->getFilterType() ); } - public function testLoadXlsxPageSetup() + public function testLoadXlsxPageSetup(): void { $filename = 'tests/data/Reader/XLSX/pageSetupTest.xlsx'; $reader = new Xlsx(); @@ -130,16 +130,16 @@ class XlsxTest extends TestCase $pageMargins = $worksheet->getPageMargins(); // Convert from inches to cm for testing - $this->assertEquals(2.5, $pageMargins->getTop() * 2.54); - $this->assertEquals(3.3, $pageMargins->getLeft() * 2.54); - $this->assertEquals(3.3, $pageMargins->getRight() * 2.54); - $this->assertEquals(1.3, $pageMargins->getHeader() * 2.54); + self::assertEquals(2.5, $pageMargins->getTop() * 2.54); + self::assertEquals(3.3, $pageMargins->getLeft() * 2.54); + self::assertEquals(3.3, $pageMargins->getRight() * 2.54); + self::assertEquals(1.3, $pageMargins->getHeader() * 2.54); - $this->assertEquals(PageSetup::PAPERSIZE_A4, $worksheet->getPageSetup()->getPaperSize()); - $this->assertEquals(['A10', 'A20', 'A30', 'A40', 'A50'], array_keys($worksheet->getBreaks())); + self::assertEquals(PageSetup::PAPERSIZE_A4, $worksheet->getPageSetup()->getPaperSize()); + self::assertEquals(['A10', 'A20', 'A30', 'A40', 'A50'], array_keys($worksheet->getBreaks())); } - public function testLoadXlsxConditionalFormatting() + public function testLoadXlsxConditionalFormatting(): void { $filename = 'tests/data/Reader/XLSX/conditionalFormattingTest.xlsx'; $reader = new Xlsx(); @@ -149,16 +149,16 @@ class XlsxTest extends TestCase $conditionalStyle = $worksheet->getCell('B2')->getStyle()->getConditionalStyles(); - $this->assertNotEmpty($conditionalStyle); + self::assertNotEmpty($conditionalStyle); $conditionalRule = $conditionalStyle[0]; - $this->assertNotEmpty($conditionalRule->getConditions()); - $this->assertEquals(Conditional::CONDITION_CELLIS, $conditionalRule->getConditionType()); - $this->assertEquals(Conditional::OPERATOR_BETWEEN, $conditionalRule->getOperatorType()); - $this->assertEquals(['200', '400'], $conditionalRule->getConditions()); - $this->assertInstanceOf(Style::class, $conditionalRule->getStyle()); + self::assertNotEmpty($conditionalRule->getConditions()); + self::assertEquals(Conditional::CONDITION_CELLIS, $conditionalRule->getConditionType()); + self::assertEquals(Conditional::OPERATOR_BETWEEN, $conditionalRule->getOperatorType()); + self::assertEquals(['200', '400'], $conditionalRule->getConditions()); + self::assertInstanceOf(Style::class, $conditionalRule->getStyle()); } - public function testLoadXlsxDataValidation() + public function testLoadXlsxDataValidation(): void { $filename = 'tests/data/Reader/XLSX/dataValidationTest.xlsx'; $reader = new Xlsx(); @@ -166,7 +166,7 @@ class XlsxTest extends TestCase $worksheet = $spreadsheet->getActiveSheet(); - $this->assertTrue($worksheet->getCell('B3')->hasDataValidation()); + self::assertTrue($worksheet->getCell('B3')->hasDataValidation()); } /** @@ -174,7 +174,7 @@ class XlsxTest extends TestCase * * @doesNotPerformAssertions */ - public function testLoadXlsxWithoutCellReference() + public function testLoadXlsxWithoutCellReference(): void { $filename = 'tests/data/Reader/XLSX/without_cell_reference.xlsx'; $reader = new Xlsx(); @@ -184,7 +184,7 @@ class XlsxTest extends TestCase /** * Test load Xlsx file and use a read filter. */ - public function testLoadWithReadFilter() + public function testLoadWithReadFilter(): void { $filename = 'tests/data/Reader/XLSX/without_cell_reference.xlsx'; $reader = new Xlsx(); @@ -193,7 +193,7 @@ class XlsxTest extends TestCase $ref = [1.0, null, 3.0, null, 5.0, null, 7.0, null, 9.0, null]; for ($i = 0; $i < 10; ++$i) { - $this->assertEquals($ref, \array_slice($data[$i], 0, 10, true)); + self::assertEquals($ref, \array_slice($data[$i], 0, 10, true)); } } @@ -202,7 +202,7 @@ class XlsxTest extends TestCase * * @doesNotPerformAssertions */ - public function testLoadXlsxWithDoubleAttrDrawing() + public function testLoadXlsxWithDoubleAttrDrawing(): void { $filename = 'tests/data/Reader/XLSX/double_attr_drawing.xlsx'; $reader = new Xlsx(); @@ -213,7 +213,7 @@ class XlsxTest extends TestCase * Test correct save and load xlsx files with empty drawings. * Such files can be generated by Google Sheets. */ - public function testLoadSaveWithEmptyDrawings() + public function testLoadSaveWithEmptyDrawings(): void { $filename = 'tests/data/Reader/XLSX/empty_drawing.xlsx'; $reader = new Xlsx(); @@ -223,7 +223,7 @@ class XlsxTest extends TestCase $writer->save($resultFilename); $excel = $reader->load($resultFilename); // Fake assert. The only thing we need is to ensure the file is loaded without exception - $this->assertNotNull($excel); + self::assertNotNull($excel); } /** @@ -233,10 +233,10 @@ class XlsxTest extends TestCase * @param $string * @dataProvider providerStripsWhiteSpaceFromStyleString */ - public function testStripsWhiteSpaceFromStyleString($string) + public function testStripsWhiteSpaceFromStyleString($string): void { $string = Xlsx::stripWhiteSpaceFromStyleString($string); - $this->assertEquals(preg_match('/\s/', $string), 0); + self::assertEquals(preg_match('/\s/', $string), 0); } public function providerStripsWhiteSpaceFromStyleString() diff --git a/tests/PhpSpreadsheetTests/Reader/XmlTest.php b/tests/PhpSpreadsheetTests/Reader/XmlTest.php index 116ec03e..a8de8774 100644 --- a/tests/PhpSpreadsheetTests/Reader/XmlTest.php +++ b/tests/PhpSpreadsheetTests/Reader/XmlTest.php @@ -13,7 +13,7 @@ class XmlTest extends TestCase * * @param $filename */ - public function testInvalidSimpleXML($filename) + public function testInvalidSimpleXML($filename): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Reader\Exception::class); @@ -34,7 +34,7 @@ class XmlTest extends TestCase /** * Check if it can read XML Hyperlink correctly. */ - public function testReadHyperlinks() + public function testReadHyperlinks(): void { $reader = new Xml(); $spreadsheet = $reader->load('samples/templates/Excel2003XMLTest.xml'); @@ -47,7 +47,7 @@ class XmlTest extends TestCase self::assertEquals('https://phpspreadsheet.readthedocs.io', $hyperlink->getHyperlink()->getUrl()); } - public function testReadWithoutStyle() + public function testReadWithoutStyle(): void { $reader = new Xml(); $spreadsheet = $reader->load('tests/data/Reader/Xml/WithoutStyle.xml'); diff --git a/tests/PhpSpreadsheetTests/ReferenceHelperTest.php b/tests/PhpSpreadsheetTests/ReferenceHelperTest.php index 6de3d792..374b63c9 100644 --- a/tests/PhpSpreadsheetTests/ReferenceHelperTest.php +++ b/tests/PhpSpreadsheetTests/ReferenceHelperTest.php @@ -11,7 +11,7 @@ class ReferenceHelperTest extends TestCase { } - public function testColumnSort() + public function testColumnSort(): void { $columnBase = $columnExpectedResult = [ 'A', 'B', 'Z', @@ -32,7 +32,7 @@ class ReferenceHelperTest extends TestCase } } - public function testColumnReverseSort() + public function testColumnReverseSort(): void { $columnBase = $columnExpectedResult = [ 'A', 'B', 'Z', @@ -54,7 +54,7 @@ class ReferenceHelperTest extends TestCase } } - public function testCellSort() + public function testCellSort(): void { $cellBase = $columnExpectedResult = [ 'A1', 'B1', 'AZB1', @@ -75,7 +75,7 @@ class ReferenceHelperTest extends TestCase } } - public function testCellReverseSort() + public function testCellReverseSort(): void { $cellBase = $columnExpectedResult = [ 'BBA544', 'ABB289', 'ABA121', diff --git a/tests/PhpSpreadsheetTests/SettingsTest.php b/tests/PhpSpreadsheetTests/SettingsTest.php index 1a1d24e7..4dff2d25 100644 --- a/tests/PhpSpreadsheetTests/SettingsTest.php +++ b/tests/PhpSpreadsheetTests/SettingsTest.php @@ -23,14 +23,14 @@ class SettingsTest extends TestCase libxml_disable_entity_loader($this->prevValue); } - public function testGetXMLSettings() + public function testGetXMLSettings(): void { $result = Settings::getLibXmlLoaderOptions(); self::assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR) & $result)); self::assertFalse(libxml_disable_entity_loader()); } - public function testSetXMLSettings() + public function testSetXMLSettings(): void { Settings::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID); $result = Settings::getLibXmlLoaderOptions(); diff --git a/tests/PhpSpreadsheetTests/Shared/CodePageTest.php b/tests/PhpSpreadsheetTests/Shared/CodePageTest.php index e3638687..b86f9015 100644 --- a/tests/PhpSpreadsheetTests/Shared/CodePageTest.php +++ b/tests/PhpSpreadsheetTests/Shared/CodePageTest.php @@ -13,7 +13,7 @@ class CodePageTest extends TestCase * * @param mixed $expectedResult */ - public function testCodePageNumberToName($expectedResult, ...$args) + public function testCodePageNumberToName($expectedResult, ...$args): void { $result = CodePage::numberToName(...$args); self::assertEquals($expectedResult, $result); @@ -24,7 +24,7 @@ class CodePageTest extends TestCase return require 'tests/data/Shared/CodePage.php'; } - public function testNumberToNameWithInvalidCodePage() + public function testNumberToNameWithInvalidCodePage(): void { $invalidCodePage = 12345; @@ -35,10 +35,10 @@ class CodePageTest extends TestCase return; } - $this->fail('An expected exception has not been raised.'); + self::fail('An expected exception has not been raised.'); } - public function testNumberToNameWithUnsupportedCodePage() + public function testNumberToNameWithUnsupportedCodePage(): void { $unsupportedCodePage = 720; @@ -49,6 +49,6 @@ class CodePageTest extends TestCase return; } - $this->fail('An expected exception has not been raised.'); + self::fail('An expected exception has not been raised.'); } } diff --git a/tests/PhpSpreadsheetTests/Shared/DateTest.php b/tests/PhpSpreadsheetTests/Shared/DateTest.php index 14930677..23b31076 100644 --- a/tests/PhpSpreadsheetTests/Shared/DateTest.php +++ b/tests/PhpSpreadsheetTests/Shared/DateTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase; class DateTest extends TestCase { - public function testSetExcelCalendar() + public function testSetExcelCalendar(): void { $calendarValues = [ Date::CALENDAR_MAC_1904, @@ -20,7 +20,7 @@ class DateTest extends TestCase } } - public function testSetExcelCalendarWithInvalidValue() + public function testSetExcelCalendarWithInvalidValue(): void { $unsupportedCalendar = '2012'; $result = Date::setExcelCalendar($unsupportedCalendar); @@ -32,7 +32,7 @@ class DateTest extends TestCase * * @param mixed $expectedResult */ - public function testDateTimeExcelToTimestamp1900($expectedResult, ...$args) + public function testDateTimeExcelToTimestamp1900($expectedResult, ...$args): void { Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900); @@ -50,7 +50,7 @@ class DateTest extends TestCase * * @param mixed $expectedResult */ - public function testDateTimeTimestampToExcel1900($expectedResult, ...$args) + public function testDateTimeTimestampToExcel1900($expectedResult, ...$args): void { Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900); @@ -68,7 +68,7 @@ class DateTest extends TestCase * * @param mixed $expectedResult */ - public function testDateTimeDateTimeToExcel($expectedResult, ...$args) + public function testDateTimeDateTimeToExcel($expectedResult, ...$args): void { Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900); @@ -86,7 +86,7 @@ class DateTest extends TestCase * * @param mixed $expectedResult */ - public function testDateTimeFormattedPHPToExcel1900($expectedResult, ...$args) + public function testDateTimeFormattedPHPToExcel1900($expectedResult, ...$args): void { Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900); @@ -104,7 +104,7 @@ class DateTest extends TestCase * * @param mixed $expectedResult */ - public function testDateTimeExcelToTimestamp1904($expectedResult, ...$args) + public function testDateTimeExcelToTimestamp1904($expectedResult, ...$args): void { Date::setExcelCalendar(Date::CALENDAR_MAC_1904); @@ -122,7 +122,7 @@ class DateTest extends TestCase * * @param mixed $expectedResult */ - public function testDateTimeTimestampToExcel1904($expectedResult, ...$args) + public function testDateTimeTimestampToExcel1904($expectedResult, ...$args): void { Date::setExcelCalendar(Date::CALENDAR_MAC_1904); @@ -140,7 +140,7 @@ class DateTest extends TestCase * * @param mixed $expectedResult */ - public function testIsDateTimeFormatCode($expectedResult, ...$args) + public function testIsDateTimeFormatCode($expectedResult, ...$args): void { $result = Date::isDateTimeFormatCode(...$args); self::assertEquals($expectedResult, $result); @@ -156,7 +156,7 @@ class DateTest extends TestCase * * @param mixed $expectedResult */ - public function testDateTimeExcelToTimestamp1900Timezone($expectedResult, ...$args) + public function testDateTimeExcelToTimestamp1900Timezone($expectedResult, ...$args): void { Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900); diff --git a/tests/PhpSpreadsheetTests/Shared/FileTest.php b/tests/PhpSpreadsheetTests/Shared/FileTest.php index 91c68bfc..6b9500f6 100644 --- a/tests/PhpSpreadsheetTests/Shared/FileTest.php +++ b/tests/PhpSpreadsheetTests/Shared/FileTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase; class FileTest extends TestCase { - public function testGetUseUploadTempDirectory() + public function testGetUseUploadTempDirectory(): void { $expectedResult = false; @@ -15,7 +15,7 @@ class FileTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testSetUseUploadTempDirectory() + public function testSetUseUploadTempDirectory(): void { $useUploadTempDirectoryValues = [ true, diff --git a/tests/PhpSpreadsheetTests/Shared/FontTest.php b/tests/PhpSpreadsheetTests/Shared/FontTest.php index 03ff2c4e..5eb70852 100644 --- a/tests/PhpSpreadsheetTests/Shared/FontTest.php +++ b/tests/PhpSpreadsheetTests/Shared/FontTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase; class FontTest extends TestCase { - public function testGetAutoSizeMethod() + public function testGetAutoSizeMethod(): void { $expectedResult = Font::AUTOSIZE_METHOD_APPROX; @@ -15,7 +15,7 @@ class FontTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testSetAutoSizeMethod() + public function testSetAutoSizeMethod(): void { $autosizeMethodValues = [ Font::AUTOSIZE_METHOD_EXACT, @@ -28,7 +28,7 @@ class FontTest extends TestCase } } - public function testSetAutoSizeMethodWithInvalidValue() + public function testSetAutoSizeMethodWithInvalidValue(): void { $unsupportedAutosizeMethod = 'guess'; @@ -41,7 +41,7 @@ class FontTest extends TestCase * * @param mixed $expectedResult */ - public function testFontSizeToPixels($expectedResult, ...$args) + public function testFontSizeToPixels($expectedResult, ...$args): void { $result = Font::fontSizeToPixels(...$args); self::assertEquals($expectedResult, $result); @@ -57,7 +57,7 @@ class FontTest extends TestCase * * @param mixed $expectedResult */ - public function testInchSizeToPixels($expectedResult, ...$args) + public function testInchSizeToPixels($expectedResult, ...$args): void { $result = Font::inchSizeToPixels(...$args); self::assertEquals($expectedResult, $result); @@ -73,7 +73,7 @@ class FontTest extends TestCase * * @param mixed $expectedResult */ - public function testCentimeterSizeToPixels($expectedResult, ...$args) + public function testCentimeterSizeToPixels($expectedResult, ...$args): void { $result = Font::centimeterSizeToPixels(...$args); self::assertEquals($expectedResult, $result); diff --git a/tests/PhpSpreadsheetTests/Shared/OLEReadTest.php b/tests/PhpSpreadsheetTests/Shared/OLEReadTest.php index 6135232c..7fe485c9 100644 --- a/tests/PhpSpreadsheetTests/Shared/OLEReadTest.php +++ b/tests/PhpSpreadsheetTests/Shared/OLEReadTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase; class OLEReadTest extends TestCase { - public function testReadOleStreams() + public function testReadOleStreams(): void { $dataDir = 'tests/data/Shared/OLERead/'; $ole = new OLERead(); diff --git a/tests/PhpSpreadsheetTests/Shared/PasswordHasherTest.php b/tests/PhpSpreadsheetTests/Shared/PasswordHasherTest.php index e92e0886..0d286725 100644 --- a/tests/PhpSpreadsheetTests/Shared/PasswordHasherTest.php +++ b/tests/PhpSpreadsheetTests/Shared/PasswordHasherTest.php @@ -12,7 +12,7 @@ class PasswordHasherTest extends TestCase * * @param mixed $expectedResult */ - public function testHashPassword($expectedResult, ...$args) + public function testHashPassword($expectedResult, ...$args): void { $result = PasswordHasher::hashPassword(...$args); self::assertEquals($expectedResult, $result); diff --git a/tests/PhpSpreadsheetTests/Shared/StringHelperTest.php b/tests/PhpSpreadsheetTests/Shared/StringHelperTest.php index fd1ec153..b11bf764 100644 --- a/tests/PhpSpreadsheetTests/Shared/StringHelperTest.php +++ b/tests/PhpSpreadsheetTests/Shared/StringHelperTest.php @@ -15,13 +15,13 @@ class StringHelperTest extends TestCase StringHelper::setCurrencyCode(null); } - public function testGetIsIconvEnabled() + public function testGetIsIconvEnabled(): void { $result = StringHelper::getIsIconvEnabled(); self::assertTrue($result); } - public function testGetDecimalSeparator() + public function testGetDecimalSeparator(): void { $localeconv = localeconv(); @@ -30,7 +30,7 @@ class StringHelperTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testSetDecimalSeparator() + public function testSetDecimalSeparator(): void { $expectedResult = ','; StringHelper::setDecimalSeparator($expectedResult); @@ -39,7 +39,7 @@ class StringHelperTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testGetThousandsSeparator() + public function testGetThousandsSeparator(): void { $localeconv = localeconv(); @@ -48,7 +48,7 @@ class StringHelperTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testSetThousandsSeparator() + public function testSetThousandsSeparator(): void { $expectedResult = ' '; StringHelper::setThousandsSeparator($expectedResult); @@ -57,7 +57,7 @@ class StringHelperTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testGetCurrencyCode() + public function testGetCurrencyCode(): void { $localeconv = localeconv(); $expectedResult = (!empty($localeconv['currency_symbol']) ? $localeconv['currency_symbol'] : (!empty($localeconv['int_curr_symbol']) ? $localeconv['int_curr_symbol'] : '$')); @@ -65,7 +65,7 @@ class StringHelperTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testSetCurrencyCode() + public function testSetCurrencyCode(): void { $expectedResult = '£'; StringHelper::setCurrencyCode($expectedResult); @@ -74,7 +74,7 @@ class StringHelperTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testControlCharacterPHP2OOXML() + public function testControlCharacterPHP2OOXML(): void { $expectedResult = 'foo_x000B_bar'; $result = StringHelper::controlCharacterPHP2OOXML('foo' . chr(11) . 'bar'); @@ -82,7 +82,7 @@ class StringHelperTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testControlCharacterOOXML2PHP() + public function testControlCharacterOOXML2PHP(): void { $expectedResult = 'foo' . chr(11) . 'bar'; $result = StringHelper::controlCharacterOOXML2PHP('foo_x000B_bar'); @@ -90,7 +90,7 @@ class StringHelperTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testSYLKtoUTF8() + public function testSYLKtoUTF8(): void { $expectedResult = 'foo' . chr(11) . 'bar'; $result = StringHelper::SYLKtoUTF8("foo\x1B ;bar"); diff --git a/tests/PhpSpreadsheetTests/Shared/TimeZoneTest.php b/tests/PhpSpreadsheetTests/Shared/TimeZoneTest.php index def37fa8..f6e2f5d5 100644 --- a/tests/PhpSpreadsheetTests/Shared/TimeZoneTest.php +++ b/tests/PhpSpreadsheetTests/Shared/TimeZoneTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase; class TimeZoneTest extends TestCase { - public function testSetTimezone() + public function testSetTimezone(): void { $timezoneValues = [ 'Europe/Prague', @@ -23,7 +23,7 @@ class TimeZoneTest extends TestCase } } - public function testSetTimezoneWithInvalidValue() + public function testSetTimezoneWithInvalidValue(): void { $unsupportedTimezone = 'Etc/GMT+10'; $result = TimeZone::setTimezone($unsupportedTimezone); diff --git a/tests/PhpSpreadsheetTests/SpreadsheetTest.php b/tests/PhpSpreadsheetTests/SpreadsheetTest.php index 498ce27b..05fbe1b5 100644 --- a/tests/PhpSpreadsheetTests/SpreadsheetTest.php +++ b/tests/PhpSpreadsheetTests/SpreadsheetTest.php @@ -49,8 +49,8 @@ class SpreadsheetTest extends TestCase * * @dataProvider dataProviderForSheetNames */ - public function testGetSheetByName($index, $sheetName) + public function testGetSheetByName($index, $sheetName): void { - $this->assertEquals($this->object->getSheet($index), $this->object->getSheetByName($sheetName)); + self::assertEquals($this->object->getSheet($index), $this->object->getSheetByName($sheetName)); } } diff --git a/tests/PhpSpreadsheetTests/Style/BorderRangeTest.php b/tests/PhpSpreadsheetTests/Style/BorderRangeTest.php index 115e830d..aec5520d 100644 --- a/tests/PhpSpreadsheetTests/Style/BorderRangeTest.php +++ b/tests/PhpSpreadsheetTests/Style/BorderRangeTest.php @@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase; class BorderRangeTest extends TestCase { - public function testBorderRangeInAction() + public function testBorderRangeInAction(): void { // testcase for the initial bug problem: setting border+color fails // set red borders aroundlA1:B3 square. Verify that the borders set are actually correct @@ -62,7 +62,7 @@ class BorderRangeTest extends TestCase } } - public function testBorderRangeDirectly() + public function testBorderRangeDirectly(): void { // testcase for the underlying problem directly $spreadsheet = new Spreadsheet(); diff --git a/tests/PhpSpreadsheetTests/Style/BorderTest.php b/tests/PhpSpreadsheetTests/Style/BorderTest.php index 7efe935a..f1f1bf56 100644 --- a/tests/PhpSpreadsheetTests/Style/BorderTest.php +++ b/tests/PhpSpreadsheetTests/Style/BorderTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; class BorderTest extends TestCase { - public function testCase() + public function testCase(): void { $spreadsheet = new Spreadsheet(); $borders = $spreadsheet->getActiveSheet()->getStyle('A1')->getBorders(); diff --git a/tests/PhpSpreadsheetTests/Style/ColorTest.php b/tests/PhpSpreadsheetTests/Style/ColorTest.php index 5bd2f208..9b524e93 100644 --- a/tests/PhpSpreadsheetTests/Style/ColorTest.php +++ b/tests/PhpSpreadsheetTests/Style/ColorTest.php @@ -12,7 +12,7 @@ class ColorTest extends TestCase * * @param mixed $expectedResult */ - public function testGetRed($expectedResult, ...$args) + public function testGetRed($expectedResult, ...$args): void { $result = Color::getRed(...$args); self::assertEquals($expectedResult, $result); @@ -28,7 +28,7 @@ class ColorTest extends TestCase * * @param mixed $expectedResult */ - public function testGetGreen($expectedResult, ...$args) + public function testGetGreen($expectedResult, ...$args): void { $result = Color::getGreen(...$args); self::assertEquals($expectedResult, $result); @@ -44,7 +44,7 @@ class ColorTest extends TestCase * * @param mixed $expectedResult */ - public function testGetBlue($expectedResult, ...$args) + public function testGetBlue($expectedResult, ...$args): void { $result = Color::getBlue(...$args); self::assertEquals($expectedResult, $result); @@ -60,7 +60,7 @@ class ColorTest extends TestCase * * @param mixed $expectedResult */ - public function testChangeBrightness($expectedResult, ...$args) + public function testChangeBrightness($expectedResult, ...$args): void { $result = Color::changeBrightness(...$args); self::assertEquals($expectedResult, $result); diff --git a/tests/PhpSpreadsheetTests/Style/NumberFormatTest.php b/tests/PhpSpreadsheetTests/Style/NumberFormatTest.php index ba44b6af..e995eded 100644 --- a/tests/PhpSpreadsheetTests/Style/NumberFormatTest.php +++ b/tests/PhpSpreadsheetTests/Style/NumberFormatTest.php @@ -19,7 +19,7 @@ class NumberFormatTest extends TestCase * * @param mixed $expectedResult */ - public function testFormatValueWithMask($expectedResult, ...$args) + public function testFormatValueWithMask($expectedResult, ...$args): void { $result = NumberFormat::toFormattedString(...$args); self::assertEquals($expectedResult, $result); @@ -35,7 +35,7 @@ class NumberFormatTest extends TestCase * * @param mixed $expectedResult */ - public function testFormatValueWithMaskDate($expectedResult, ...$args) + public function testFormatValueWithMaskDate($expectedResult, ...$args): void { $result = NumberFormat::toFormattedString(...$args); self::assertEquals($expectedResult, $result); @@ -46,7 +46,7 @@ class NumberFormatTest extends TestCase return require 'tests/data/Style/NumberFormatDates.php'; } - public function testCurrencyCode() + public function testCurrencyCode(): void { // "Currency symbol" replaces $ in some cases, not in others $cur = StringHelper::getCurrencyCode(); diff --git a/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/Column/RuleTest.php b/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/Column/RuleTest.php index 4a0e5c2c..156a95de 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/Column/RuleTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/Column/RuleTest.php @@ -22,13 +22,13 @@ class RuleTest extends TestCase ); } - public function testGetRuleType() + public function testGetRuleType(): void { $result = $this->testAutoFilterRuleObject->getRuleType(); self::assertEquals(Column\Rule::AUTOFILTER_RULETYPE_FILTER, $result); } - public function testSetRuleType() + public function testSetRuleType(): void { $expectedResult = Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP; @@ -40,7 +40,7 @@ class RuleTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testSetValue() + public function testSetValue(): void { $expectedResult = 100; @@ -52,13 +52,13 @@ class RuleTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testGetOperator() + public function testGetOperator(): void { $result = $this->testAutoFilterRuleObject->getOperator(); self::assertEquals(Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, $result); } - public function testSetOperator() + public function testSetOperator(): void { $expectedResult = Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN; @@ -70,7 +70,7 @@ class RuleTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testSetGrouping() + public function testSetGrouping(): void { $expectedResult = Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH; @@ -82,20 +82,20 @@ class RuleTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testGetParent() + public function testGetParent(): void { $result = $this->testAutoFilterRuleObject->getParent(); self::assertInstanceOf(Column::class, $result); } - public function testSetParent() + public function testSetParent(): void { // Setters return the instance to implement the fluent interface $result = $this->testAutoFilterRuleObject->setParent($this->mockAutoFilterColumnObject); self::assertInstanceOf(Column\Rule::class, $result); } - public function testClone() + public function testClone(): void { $result = clone $this->testAutoFilterRuleObject; self::assertInstanceOf(Column\Rule::class, $result); diff --git a/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php b/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php index fd462b43..ef67b05d 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php @@ -19,20 +19,20 @@ class ColumnTest extends TestCase ->disableOriginalConstructor() ->getMock(); - $this->mockAutoFilterObject->expects($this->any()) + $this->mockAutoFilterObject->expects(self::any()) ->method('testColumnInRange') - ->will($this->returnValue(3)); + ->willReturn(3); $this->testAutoFilterColumnObject = new AutoFilter\Column($this->testInitialColumn, $this->mockAutoFilterObject); } - public function testGetColumnIndex() + public function testGetColumnIndex(): void { $result = $this->testAutoFilterColumnObject->getColumnIndex(); self::assertEquals($this->testInitialColumn, $result); } - public function testSetColumnIndex() + public function testSetColumnIndex(): void { $expectedResult = 'L'; @@ -44,26 +44,26 @@ class ColumnTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testGetParent() + public function testGetParent(): void { $result = $this->testAutoFilterColumnObject->getParent(); self::assertInstanceOf(AutoFilter::class, $result); } - public function testSetParent() + public function testSetParent(): void { // Setters return the instance to implement the fluent interface $result = $this->testAutoFilterColumnObject->setParent($this->mockAutoFilterObject); self::assertInstanceOf(AutoFilter\Column::class, $result); } - public function testGetFilterType() + public function testGetFilterType(): void { $result = $this->testAutoFilterColumnObject->getFilterType(); self::assertEquals(AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER, $result); } - public function testSetFilterType() + public function testSetFilterType(): void { $result = $this->testAutoFilterColumnObject->setFilterType(AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER); self::assertInstanceOf(AutoFilter\Column::class, $result); @@ -72,7 +72,7 @@ class ColumnTest extends TestCase self::assertEquals(AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, $result); } - public function testSetInvalidFilterTypeThrowsException() + public function testSetInvalidFilterTypeThrowsException(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); @@ -81,13 +81,13 @@ class ColumnTest extends TestCase $this->testAutoFilterColumnObject->setFilterType($expectedResult); } - public function testGetJoin() + public function testGetJoin(): void { $result = $this->testAutoFilterColumnObject->getJoin(); self::assertEquals(AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_OR, $result); } - public function testSetJoin() + public function testSetJoin(): void { $result = $this->testAutoFilterColumnObject->setJoin(AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND); self::assertInstanceOf(AutoFilter\Column::class, $result); @@ -96,7 +96,7 @@ class ColumnTest extends TestCase self::assertEquals(AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND, $result); } - public function testSetInvalidJoinThrowsException() + public function testSetInvalidJoinThrowsException(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); @@ -105,7 +105,7 @@ class ColumnTest extends TestCase $this->testAutoFilterColumnObject->setJoin($expectedResult); } - public function testSetAttributes() + public function testSetAttributes(): void { $attributeSet = [ 'val' => 100, @@ -117,7 +117,7 @@ class ColumnTest extends TestCase self::assertInstanceOf(AutoFilter\Column::class, $result); } - public function testGetAttributes() + public function testGetAttributes(): void { $attributeSet = [ 'val' => 100, @@ -131,7 +131,7 @@ class ColumnTest extends TestCase self::assertCount(count($attributeSet), $result); } - public function testSetAttribute() + public function testSetAttribute(): void { $attributeSet = [ 'val' => 100, @@ -145,7 +145,7 @@ class ColumnTest extends TestCase } } - public function testGetAttribute() + public function testGetAttribute(): void { $attributeSet = [ 'val' => 100, @@ -162,7 +162,7 @@ class ColumnTest extends TestCase self::assertNull($result); } - public function testClone() + public function testClone(): void { $originalRule = $this->testAutoFilterColumnObject->createRule(); $result = clone $this->testAutoFilterColumnObject; diff --git a/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php b/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php index c2c7f6fc..17b4c022 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php @@ -29,14 +29,14 @@ class AutoFilterTest extends TestCase $this->cellCollection = $this->getMockBuilder(Cells::class) ->disableOriginalConstructor() ->getMock(); - $this->mockWorksheetObject->expects($this->any()) + $this->mockWorksheetObject->expects(self::any()) ->method('getCellCollection') - ->will($this->returnValue($this->cellCollection)); + ->willReturn($this->cellCollection); $this->testAutoFilterObject = new AutoFilter($this->testInitialRange, $this->mockWorksheetObject); } - public function testToString() + public function testToString(): void { $expectedResult = $this->testInitialRange; @@ -45,20 +45,20 @@ class AutoFilterTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testGetParent() + public function testGetParent(): void { $result = $this->testAutoFilterObject->getParent(); self::assertInstanceOf(Worksheet::class, $result); } - public function testSetParent() + public function testSetParent(): void { // Setters return the instance to implement the fluent interface $result = $this->testAutoFilterObject->setParent($this->mockWorksheetObject); self::assertInstanceOf(AutoFilter::class, $result); } - public function testGetRange() + public function testGetRange(): void { $expectedResult = $this->testInitialRange; @@ -67,7 +67,7 @@ class AutoFilterTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testSetRange() + public function testSetRange(): void { $ranges = [ 'G1:J512' => 'Worksheet1!G1:J512', @@ -85,7 +85,7 @@ class AutoFilterTest extends TestCase } } - public function testClearRange() + public function testClearRange(): void { $expectedResult = ''; @@ -98,7 +98,7 @@ class AutoFilterTest extends TestCase self::assertEquals($expectedResult, $result); } - public function testSetRangeInvalidRange() + public function testSetRangeInvalidRange(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); @@ -107,7 +107,7 @@ class AutoFilterTest extends TestCase $this->testAutoFilterObject->setRange($expectedResult); } - public function testGetColumnsEmpty() + public function testGetColumnsEmpty(): void { // There should be no columns yet defined $result = $this->testAutoFilterObject->getColumns(); @@ -115,7 +115,7 @@ class AutoFilterTest extends TestCase self::assertCount(0, $result); } - public function testGetColumnOffset() + public function testGetColumnOffset(): void { $columnIndexes = [ 'H' => 0, @@ -131,7 +131,7 @@ class AutoFilterTest extends TestCase } } - public function testGetInvalidColumnOffset() + public function testGetInvalidColumnOffset(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); @@ -140,7 +140,7 @@ class AutoFilterTest extends TestCase $this->testAutoFilterObject->getColumnOffset($invalidColumn); } - public function testSetColumnWithString() + public function testSetColumnWithString(): void { $expectedResult = 'L'; @@ -157,7 +157,7 @@ class AutoFilterTest extends TestCase self::assertInstanceOf(Column::class, $result[$expectedResult]); } - public function testSetInvalidColumnWithString() + public function testSetInvalidColumnWithString(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); @@ -166,7 +166,7 @@ class AutoFilterTest extends TestCase $this->testAutoFilterObject->setColumn($invalidColumn); } - public function testSetColumnWithColumnObject() + public function testSetColumnWithColumnObject(): void { $expectedResult = 'M'; $columnObject = new AutoFilter\Column($expectedResult); @@ -184,7 +184,7 @@ class AutoFilterTest extends TestCase self::assertInstanceOf(Column::class, $result[$expectedResult]); } - public function testSetInvalidColumnWithObject() + public function testSetInvalidColumnWithObject(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); @@ -192,7 +192,7 @@ class AutoFilterTest extends TestCase $this->testAutoFilterObject->setColumn($invalidColumn); } - public function testSetColumnWithInvalidDataType() + public function testSetColumnWithInvalidDataType(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); @@ -200,7 +200,7 @@ class AutoFilterTest extends TestCase $this->testAutoFilterObject->setColumn($invalidColumn); } - public function testGetColumns() + public function testGetColumns(): void { $columnIndexes = ['L', 'M']; @@ -219,7 +219,7 @@ class AutoFilterTest extends TestCase } } - public function testGetColumn() + public function testGetColumn(): void { $columnIndexes = ['L', 'M']; @@ -235,7 +235,7 @@ class AutoFilterTest extends TestCase } } - public function testGetColumnByOffset() + public function testGetColumnByOffset(): void { $columnIndexes = [ 0 => 'H', @@ -252,7 +252,7 @@ class AutoFilterTest extends TestCase } } - public function testGetColumnIfNotSet() + public function testGetColumnIfNotSet(): void { // If we request a specific column by its column ID, we should // get a \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter\Column object returned @@ -260,7 +260,7 @@ class AutoFilterTest extends TestCase self::assertInstanceOf(Column::class, $result); } - public function testGetColumnWithoutRangeSet() + public function testGetColumnWithoutRangeSet(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); @@ -269,7 +269,7 @@ class AutoFilterTest extends TestCase $this->testAutoFilterObject->getColumn('A'); } - public function testClearRangeWithExistingColumns() + public function testClearRangeWithExistingColumns(): void { $expectedResult = ''; @@ -292,7 +292,7 @@ class AutoFilterTest extends TestCase self::assertCount(0, $result); } - public function testSetRangeWithExistingColumns() + public function testSetRangeWithExistingColumns(): void { $expectedResult = 'G1:J512'; @@ -322,7 +322,7 @@ class AutoFilterTest extends TestCase self::assertCount(count($columnIndexes1), $result); } - public function testClone() + public function testClone(): void { $columnIndexes = ['L', 'M']; diff --git a/tests/PhpSpreadsheetTests/Worksheet/ColumnCellIteratorTest.php b/tests/PhpSpreadsheetTests/Worksheet/ColumnCellIteratorTest.php index 5d4706dc..2083f347 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/ColumnCellIteratorTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/ColumnCellIteratorTest.php @@ -23,15 +23,15 @@ class ColumnCellIteratorTest extends TestCase ->disableOriginalConstructor() ->getMock(); - $this->mockWorksheet->expects($this->any()) + $this->mockWorksheet->expects(self::any()) ->method('getHighestRow') - ->will($this->returnValue(5)); - $this->mockWorksheet->expects($this->any()) + ->willReturn(5); + $this->mockWorksheet->expects(self::any()) ->method('getCellByColumnAndRow') - ->will($this->returnValue($this->mockCell)); + ->willReturn($this->mockCell); } - public function testIteratorFullRange() + public function testIteratorFullRange(): void { $iterator = new ColumnCellIterator($this->mockWorksheet, 'A'); $ColumnCellIndexResult = 1; @@ -43,7 +43,7 @@ class ColumnCellIteratorTest extends TestCase } } - public function testIteratorStartEndRange() + public function testIteratorStartEndRange(): void { $iterator = new ColumnCellIterator($this->mockWorksheet, 'A', 2, 4); $ColumnCellIndexResult = 2; @@ -55,7 +55,7 @@ class ColumnCellIteratorTest extends TestCase } } - public function testIteratorSeekAndPrev() + public function testIteratorSeekAndPrev(): void { $iterator = new ColumnCellIterator($this->mockWorksheet, 'A', 2, 4); $columnIndexResult = 4; @@ -68,7 +68,7 @@ class ColumnCellIteratorTest extends TestCase } } - public function testSeekOutOfRange() + public function testSeekOutOfRange(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); @@ -76,7 +76,7 @@ class ColumnCellIteratorTest extends TestCase $iterator->seek(1); } - public function testPrevOutOfRange() + public function testPrevOutOfRange(): void { $iterator = new ColumnCellIterator($this->mockWorksheet, 'A', 2, 4); $iterator->prev(); diff --git a/tests/PhpSpreadsheetTests/Worksheet/ColumnDimensionTest.php b/tests/PhpSpreadsheetTests/Worksheet/ColumnDimensionTest.php index 1f31fdb9..b10875c2 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/ColumnDimensionTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/ColumnDimensionTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase; class ColumnDimensionTest extends TestCase { - public function testInstantiateColumnDimensionDefault() + public function testInstantiateColumnDimensionDefault(): void { $expected = 'A'; $columnDimension = new ColumnDimension(); @@ -16,7 +16,7 @@ class ColumnDimensionTest extends TestCase self::assertEquals($expected, $result); } - public function testGetAndSetColumnIndex() + public function testGetAndSetColumnIndex(): void { $expected = 'B'; $columnDimension = new ColumnDimension(); @@ -25,7 +25,7 @@ class ColumnDimensionTest extends TestCase self::assertSame($expected, $result); } - public function testGetAndSetWidth() + public function testGetAndSetWidth(): void { $expected = 1.2; $columnDimension = new ColumnDimension(); @@ -34,7 +34,7 @@ class ColumnDimensionTest extends TestCase self::assertSame($expected, $result); } - public function testGetAndSetAutoSize() + public function testGetAndSetAutoSize(): void { $expected = true; $columnDimension = new ColumnDimension(); diff --git a/tests/PhpSpreadsheetTests/Worksheet/ColumnIteratorTest.php b/tests/PhpSpreadsheetTests/Worksheet/ColumnIteratorTest.php index eb0b1e0f..de985cee 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/ColumnIteratorTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/ColumnIteratorTest.php @@ -23,12 +23,12 @@ class ColumnIteratorTest extends TestCase ->disableOriginalConstructor() ->getMock(); - $this->mockWorksheet->expects($this->any()) + $this->mockWorksheet->expects(self::any()) ->method('getHighestColumn') - ->will($this->returnValue('E')); + ->willReturn('E'); } - public function testIteratorFullRange() + public function testIteratorFullRange(): void { $iterator = new ColumnIterator($this->mockWorksheet); $columnIndexResult = 'A'; @@ -40,7 +40,7 @@ class ColumnIteratorTest extends TestCase } } - public function testIteratorStartEndRange() + public function testIteratorStartEndRange(): void { $iterator = new ColumnIterator($this->mockWorksheet, 'B', 'D'); $columnIndexResult = 'B'; @@ -52,7 +52,7 @@ class ColumnIteratorTest extends TestCase } } - public function testIteratorSeekAndPrev() + public function testIteratorSeekAndPrev(): void { $ranges = range('A', 'E'); $iterator = new ColumnIterator($this->mockWorksheet, 'B', 'D'); @@ -67,7 +67,7 @@ class ColumnIteratorTest extends TestCase } } - public function testSeekOutOfRange() + public function testSeekOutOfRange(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); @@ -75,7 +75,7 @@ class ColumnIteratorTest extends TestCase $iterator->seek('A'); } - public function testPrevOutOfRange() + public function testPrevOutOfRange(): void { $iterator = new ColumnIterator($this->mockWorksheet, 'B', 'D'); $iterator->prev(); diff --git a/tests/PhpSpreadsheetTests/Worksheet/ColumnTest.php b/tests/PhpSpreadsheetTests/Worksheet/ColumnTest.php index d8c5c997..0abff0ec 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/ColumnTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/ColumnTest.php @@ -18,12 +18,12 @@ class ColumnTest extends TestCase $this->mockWorksheet = $this->getMockBuilder(Worksheet::class) ->disableOriginalConstructor() ->getMock(); - $this->mockWorksheet->expects($this->any()) + $this->mockWorksheet->expects(self::any()) ->method('getHighestRow') - ->will($this->returnValue(5)); + ->willReturn(5); } - public function testInstantiateColumnDefault() + public function testInstantiateColumnDefault(): void { $column = new Column($this->mockWorksheet); self::assertInstanceOf(Column::class, $column); @@ -31,7 +31,7 @@ class ColumnTest extends TestCase self::assertEquals('A', $columnIndex); } - public function testInstantiateColumnSpecified() + public function testInstantiateColumnSpecified(): void { $column = new Column($this->mockWorksheet, 'E'); self::assertInstanceOf(Column::class, $column); @@ -39,7 +39,7 @@ class ColumnTest extends TestCase self::assertEquals('E', $columnIndex); } - public function testGetCellIterator() + public function testGetCellIterator(): void { $column = new Column($this->mockWorksheet); $cellIterator = $column->getCellIterator(); diff --git a/tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php b/tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php index 32bd97f3..f126a529 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; class DrawingTest extends TestCase { - public function testCloningWorksheetWithImages() + public function testCloningWorksheetWithImages(): void { $spreadsheet = new Spreadsheet(); $aSheet = $spreadsheet->getActiveSheet(); diff --git a/tests/PhpSpreadsheetTests/Worksheet/IteratorTest.php b/tests/PhpSpreadsheetTests/Worksheet/IteratorTest.php index 80a2d783..b2a06343 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/IteratorTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/IteratorTest.php @@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase; class IteratorTest extends TestCase { - public function testIteratorFullRange() + public function testIteratorFullRange(): void { $spreadsheet = new Spreadsheet(); $spreadsheet->createSheet(); diff --git a/tests/PhpSpreadsheetTests/Worksheet/RowCellIteratorTest.php b/tests/PhpSpreadsheetTests/Worksheet/RowCellIteratorTest.php index 786a0d1a..bc2c16dc 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/RowCellIteratorTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/RowCellIteratorTest.php @@ -23,15 +23,15 @@ class RowCellIteratorTest extends TestCase ->disableOriginalConstructor() ->getMock(); - $this->mockWorksheet->expects($this->any()) + $this->mockWorksheet->expects(self::any()) ->method('getHighestColumn') - ->will($this->returnValue('E')); - $this->mockWorksheet->expects($this->any()) + ->willReturn('E'); + $this->mockWorksheet->expects(self::any()) ->method('getCellByColumnAndRow') - ->will($this->returnValue($this->mockCell)); + ->willReturn($this->mockCell); } - public function testIteratorFullRange() + public function testIteratorFullRange(): void { $iterator = new RowCellIterator($this->mockWorksheet); $RowCellIndexResult = 'A'; @@ -43,7 +43,7 @@ class RowCellIteratorTest extends TestCase } } - public function testIteratorStartEndRange() + public function testIteratorStartEndRange(): void { $iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); $RowCellIndexResult = 'B'; @@ -55,7 +55,7 @@ class RowCellIteratorTest extends TestCase } } - public function testIteratorSeekAndPrev() + public function testIteratorSeekAndPrev(): void { $ranges = range('A', 'E'); $iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); @@ -70,7 +70,7 @@ class RowCellIteratorTest extends TestCase } } - public function testSeekOutOfRange() + public function testSeekOutOfRange(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); @@ -78,7 +78,7 @@ class RowCellIteratorTest extends TestCase $iterator->seek(1); } - public function testPrevOutOfRange() + public function testPrevOutOfRange(): void { $iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); $iterator->prev(); diff --git a/tests/PhpSpreadsheetTests/Worksheet/RowIteratorTest.php b/tests/PhpSpreadsheetTests/Worksheet/RowIteratorTest.php index ea2fe351..919da9ef 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/RowIteratorTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/RowIteratorTest.php @@ -23,12 +23,12 @@ class RowIteratorTest extends TestCase ->disableOriginalConstructor() ->getMock(); - $this->mockWorksheet->expects($this->any()) + $this->mockWorksheet->expects(self::any()) ->method('getHighestRow') - ->will($this->returnValue(5)); + ->willReturn(5); } - public function testIteratorFullRange() + public function testIteratorFullRange(): void { $iterator = new RowIterator($this->mockWorksheet); $rowIndexResult = 1; @@ -40,7 +40,7 @@ class RowIteratorTest extends TestCase } } - public function testIteratorStartEndRange() + public function testIteratorStartEndRange(): void { $iterator = new RowIterator($this->mockWorksheet, 2, 4); $rowIndexResult = 2; @@ -52,7 +52,7 @@ class RowIteratorTest extends TestCase } } - public function testIteratorSeekAndPrev() + public function testIteratorSeekAndPrev(): void { $iterator = new RowIterator($this->mockWorksheet, 2, 4); $columnIndexResult = 4; @@ -65,7 +65,7 @@ class RowIteratorTest extends TestCase } } - public function testSeekOutOfRange() + public function testSeekOutOfRange(): void { $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); @@ -73,7 +73,7 @@ class RowIteratorTest extends TestCase $iterator->seek(1); } - public function testPrevOutOfRange() + public function testPrevOutOfRange(): void { $iterator = new RowIterator($this->mockWorksheet, 2, 4); $iterator->prev(); diff --git a/tests/PhpSpreadsheetTests/Worksheet/RowTest.php b/tests/PhpSpreadsheetTests/Worksheet/RowTest.php index ee2dcffb..93ff589c 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/RowTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/RowTest.php @@ -18,12 +18,12 @@ class RowTest extends TestCase $this->mockWorksheet = $this->getMockBuilder(Worksheet::class) ->disableOriginalConstructor() ->getMock(); - $this->mockWorksheet->expects($this->any()) + $this->mockWorksheet->expects(self::any()) ->method('getHighestColumn') - ->will($this->returnValue('E')); + ->willReturn('E'); } - public function testInstantiateRowDefault() + public function testInstantiateRowDefault(): void { $row = new Row($this->mockWorksheet); self::assertInstanceOf(Row::class, $row); @@ -31,7 +31,7 @@ class RowTest extends TestCase self::assertEquals(1, $rowIndex); } - public function testInstantiateRowSpecified() + public function testInstantiateRowSpecified(): void { $row = new Row($this->mockWorksheet, 5); self::assertInstanceOf(Row::class, $row); @@ -39,7 +39,7 @@ class RowTest extends TestCase self::assertEquals(5, $rowIndex); } - public function testGetCellIterator() + public function testGetCellIterator(): void { $row = new Row($this->mockWorksheet); $cellIterator = $row->getCellIterator(); diff --git a/tests/PhpSpreadsheetTests/Worksheet/WorksheetTest.php b/tests/PhpSpreadsheetTests/Worksheet/WorksheetTest.php index d1e19df4..46c848ba 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/WorksheetTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/WorksheetTest.php @@ -2,13 +2,14 @@ namespace PhpOffice\PhpSpreadsheetTests\Worksheet; +use Exception; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PHPUnit\Framework\TestCase; class WorksheetTest extends TestCase { - public function testSetTitle() + public function testSetTitle(): void { $testTitle = str_repeat('a', 31); @@ -30,7 +31,7 @@ class WorksheetTest extends TestCase * @param string $expectMessage * @dataProvider setTitleInvalidProvider */ - public function testSetTitleInvalid($title, $expectMessage) + public function testSetTitleInvalid($title, $expectMessage): void { // First, test setting title with validation disabled -- should be successful $worksheet = new Worksheet(); @@ -38,12 +39,12 @@ class WorksheetTest extends TestCase // Next, test again with validation enabled -- this time we should fail $worksheet = new Worksheet(); - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionMessage($expectMessage); $worksheet->setTitle($title); } - public function testSetTitleDuplicate() + public function testSetTitleDuplicate(): void { // Create a Spreadsheet with three Worksheets (the first is created automatically) $spreadsheet = new Spreadsheet(); @@ -66,7 +67,7 @@ class WorksheetTest extends TestCase self::assertSame('Test Title', $sheet->getTitle()); } - public function testSetCodeName() + public function testSetCodeName(): void { $testCodeName = str_repeat('a', 31); @@ -88,7 +89,7 @@ class WorksheetTest extends TestCase * @param string $expectMessage * @dataProvider setCodeNameInvalidProvider */ - public function testSetCodeNameInvalid($codeName, $expectMessage) + public function testSetCodeNameInvalid($codeName, $expectMessage): void { // First, test setting code name with validation disabled -- should be successful $worksheet = new Worksheet(); @@ -96,12 +97,12 @@ class WorksheetTest extends TestCase // Next, test again with validation enabled -- this time we should fail $worksheet = new Worksheet(); - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionMessage($expectMessage); $worksheet->setCodeName($codeName); } - public function testSetCodeNameDuplicate() + public function testSetCodeNameDuplicate(): void { // Create a Spreadsheet with three Worksheets (the first is created automatically) $spreadsheet = new Spreadsheet(); @@ -124,7 +125,7 @@ class WorksheetTest extends TestCase self::assertSame('Test Code Name', $sheet->getCodeName()); } - public function testFreezePaneSelectedCell() + public function testFreezePaneSelectedCell(): void { $worksheet = new Worksheet(); $worksheet->freezePane('B2'); @@ -152,7 +153,7 @@ class WorksheetTest extends TestCase * @param string $expectCell2 * @dataProvider extractSheetTitleProvider */ - public function testExtractSheetTitle($range, $expectTitle, $expectCell, $expectCell2) + public function testExtractSheetTitle($range, $expectTitle, $expectCell, $expectCell2): void { // only cell reference self::assertSame($expectCell, Worksheet::extractSheetTitle($range)); @@ -166,18 +167,18 @@ class WorksheetTest extends TestCase * Fix https://github.com/PHPOffice/PhpSpreadsheet/issues/868 when cells are not removed correctly * on row deletion. */ - public function testRemoveCellsCorrectlyWhenRemovingRow() + public function testRemoveCellsCorrectlyWhenRemovingRow(): void { $workbook = new Spreadsheet(); $worksheet = $workbook->getActiveSheet(); $worksheet->getCell('A2')->setValue('A2'); $worksheet->getCell('C1')->setValue('C1'); $worksheet->removeRow(1); - $this->assertEquals( + self::assertEquals( 'A2', $worksheet->getCell('A1')->getValue() ); - $this->assertNull( + self::assertNull( $worksheet->getCell('C1')->getValue() ); } @@ -262,7 +263,7 @@ class WorksheetTest extends TestCase int $columnsToBeRemoved, array $expectedData, string $expectedHighestColumn - ) { + ): void { $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $worksheet->fromArray($initialData); @@ -394,7 +395,7 @@ class WorksheetTest extends TestCase int $rowsQtyToRemove, array $expectedData, int $expectedHighestRow - ) { + ): void { $workbook = new Spreadsheet(); $worksheet = $workbook->getActiveSheet(); $worksheet->fromArray($initialData); diff --git a/tests/PhpSpreadsheetTests/Writer/Csv/CsvWriteTest.php b/tests/PhpSpreadsheetTests/Writer/Csv/CsvWriteTest.php index f55781da..7252ecf9 100644 --- a/tests/PhpSpreadsheetTests/Writer/Csv/CsvWriteTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Csv/CsvWriteTest.php @@ -11,7 +11,7 @@ use PhpOffice\PhpSpreadsheetTests\Functional; class CsvWriteTest extends Functional\AbstractFunctional { - public function testNotFirstSheet() + public function testNotFirstSheet(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -33,7 +33,7 @@ class CsvWriteTest extends Functional\AbstractFunctional self::assertEquals(0, $newspreadsheet->getActiveSheetIndex()); } - public function testWriteEmptyFileName() + public function testWriteEmptyFileName(): void { $this->expectException(WriterException::class); $spreadsheet = new Spreadsheet(); @@ -42,7 +42,7 @@ class CsvWriteTest extends Functional\AbstractFunctional $writer->save($filename); } - public function testDefaultSettings() + public function testDefaultSettings(): void { $spreadsheet = new Spreadsheet(); $writer = new CsvWriter($spreadsheet); diff --git a/tests/PhpSpreadsheetTests/Writer/Html/AllOrOneSheetTest.php b/tests/PhpSpreadsheetTests/Writer/Html/AllOrOneSheetTest.php index 03fe741f..31ed438e 100644 --- a/tests/PhpSpreadsheetTests/Writer/Html/AllOrOneSheetTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Html/AllOrOneSheetTest.php @@ -2,6 +2,7 @@ namespace PhpOffice\PhpSpreadsheetTests\Writer\Html; +use DOMDocument; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Html; use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf; @@ -10,7 +11,7 @@ use PhpOffice\PhpSpreadsheetTests\Functional; class AllOrOneSheetTest extends Functional\AbstractFunctional { - public function testWriteAllSheets() + public function testWriteAllSheets(): void { $spreadsheet = new Spreadsheet(); $sheet1 = $spreadsheet->getActiveSheet(); @@ -23,7 +24,7 @@ class AllOrOneSheetTest extends Functional\AbstractFunctional $writer->writeAllSheets(); self::assertTrue($writer->getGenerateSheetNavigationBlock()); $html = $writer->generateHTMLAll(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('ul'); // sheet navigation @@ -41,7 +42,7 @@ class AllOrOneSheetTest extends Functional\AbstractFunctional $this->writeAndReload($spreadsheet, 'Html'); } - public function testWriteAllSheetsNoNav() + public function testWriteAllSheetsNoNav(): void { $spreadsheet = new Spreadsheet(); $sheet1 = $spreadsheet->getActiveSheet(); @@ -53,7 +54,7 @@ class AllOrOneSheetTest extends Functional\AbstractFunctional $writer->writeAllSheets(); $writer->setGenerateSheetNavigationBlock(false); $html = $writer->generateHTMLAll(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('ul'); // sheet navigation @@ -71,7 +72,7 @@ class AllOrOneSheetTest extends Functional\AbstractFunctional $this->writeAndReload($spreadsheet, 'Html'); } - public function testWriteAllSheetsPdf() + public function testWriteAllSheetsPdf(): void { $spreadsheet = new Spreadsheet(); $sheet1 = $spreadsheet->getActiveSheet(); @@ -82,7 +83,7 @@ class AllOrOneSheetTest extends Functional\AbstractFunctional $writer = new Mpdf($spreadsheet); $writer->writeAllSheets(); $html = $writer->generateHTMLAll(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('ul'); // sheet navigation @@ -99,7 +100,7 @@ class AllOrOneSheetTest extends Functional\AbstractFunctional self::assertEquals('sheet1 gridlines', $tbl->item(0)->getAttribute('class')); } - public function testWriteOneSheet() + public function testWriteOneSheet(): void { $spreadsheet = new Spreadsheet(); $sheet1 = $spreadsheet->getActiveSheet(); @@ -110,7 +111,7 @@ class AllOrOneSheetTest extends Functional\AbstractFunctional $writer = new Html($spreadsheet); $writer->setSheetIndex(1); $html = $writer->generateHTMLAll(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('ul'); // sheet navigation @@ -124,7 +125,7 @@ class AllOrOneSheetTest extends Functional\AbstractFunctional $this->writeAndReload($spreadsheet, 'Html'); } - public function testPageBreak() + public function testPageBreak(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -141,7 +142,7 @@ class AllOrOneSheetTest extends Functional\AbstractFunctional $writer->writeAllSheets(); $html = $writer->generateHTMLAll(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('div'); @@ -163,7 +164,7 @@ class AllOrOneSheetTest extends Functional\AbstractFunctional $this->writeAndReload($spreadsheet, 'Html'); } - public function testTcpdfPageBreak() + public function testTcpdfPageBreak(): void { $spreadsheet = new Spreadsheet(); $sheet1 = $spreadsheet->getActiveSheet(); @@ -177,7 +178,7 @@ class AllOrOneSheetTest extends Functional\AbstractFunctional $writer = new Tcpdf($spreadsheet); $writer->writeAllSheets(); $html = $writer->generateHtmlAll(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('div'); diff --git a/tests/PhpSpreadsheetTests/Writer/Html/GridlinesTest.php b/tests/PhpSpreadsheetTests/Writer/Html/GridlinesTest.php index 2bbe3541..2fa41953 100644 --- a/tests/PhpSpreadsheetTests/Writer/Html/GridlinesTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Html/GridlinesTest.php @@ -2,6 +2,7 @@ namespace PhpOffice\PhpSpreadsheetTests\Writer\Html; +use DOMDocument; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Style\Color; use PhpOffice\PhpSpreadsheet\Writer\Html; @@ -9,7 +10,7 @@ use PhpOffice\PhpSpreadsheetTests\Functional; class GridlinesTest extends Functional\AbstractFunctional { - public function testGridlines() + public function testGridlines(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -29,7 +30,7 @@ class GridlinesTest extends Functional\AbstractFunctional $writer->writeAllSheets(); $html = $writer->generateHTMLAll(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('div'); @@ -51,7 +52,7 @@ class GridlinesTest extends Functional\AbstractFunctional $this->writeAndReload($spreadsheet, 'Html'); } - public function testGridlinesInline() + public function testGridlinesInline(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -72,7 +73,7 @@ class GridlinesTest extends Functional\AbstractFunctional $writer->setUseInlineCss(true); $html = $writer->generateHTMLAll(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('div'); @@ -94,7 +95,7 @@ class GridlinesTest extends Functional\AbstractFunctional $this->writeAndReload($spreadsheet, 'Html'); } - public function testRichText() + public function testRichText(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -130,7 +131,7 @@ class GridlinesTest extends Functional\AbstractFunctional $writer = new Html($spreadsheet); $html = $writer->generateHTMLAll(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('div'); diff --git a/tests/PhpSpreadsheetTests/Writer/Html/HtmlCommentsTest.php b/tests/PhpSpreadsheetTests/Writer/Html/HtmlCommentsTest.php index 637c6514..0d43d7eb 100644 --- a/tests/PhpSpreadsheetTests/Writer/Html/HtmlCommentsTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Html/HtmlCommentsTest.php @@ -46,7 +46,7 @@ class HtmlCommentsTest extends Functional\AbstractFunctional * * @param mixed $richText */ - public function testComments($richText) + public function testComments($richText): void { $this->spreadsheet = new Spreadsheet(); diff --git a/tests/PhpSpreadsheetTests/Writer/Html/HtmlNumberFormatTest.php b/tests/PhpSpreadsheetTests/Writer/Html/HtmlNumberFormatTest.php index 96652d6d..9d306fa0 100644 --- a/tests/PhpSpreadsheetTests/Writer/Html/HtmlNumberFormatTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Html/HtmlNumberFormatTest.php @@ -2,6 +2,7 @@ namespace PhpOffice\PhpSpreadsheetTests\Writer\Html; +use DOMDocument; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Html; @@ -27,7 +28,7 @@ class HtmlNumberFormatTest extends Functional\AbstractFunctional StringHelper::setThousandsSeparator($this->thosep); } - public function testColorNumberFormat() + public function testColorNumberFormat(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -40,7 +41,7 @@ class HtmlNumberFormatTest extends Functional\AbstractFunctional $writer = new Html($spreadsheet); $html = $writer->generateHTMLAll(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('div'); @@ -81,7 +82,7 @@ class HtmlNumberFormatTest extends Functional\AbstractFunctional $this->writeAndReload($spreadsheet, 'Html'); } - public function testColorNumberFormatComplex() + public function testColorNumberFormatComplex(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -94,7 +95,7 @@ class HtmlNumberFormatTest extends Functional\AbstractFunctional $writer = new Html($spreadsheet); $html = $writer->generateHTMLAll(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('div'); @@ -142,7 +143,7 @@ class HtmlNumberFormatTest extends Functional\AbstractFunctional * @param mixed $val * @param mixed $fmt */ - public function testFormatValueWithMask($expectedResult, $val, $fmt) + public function testFormatValueWithMask($expectedResult, $val, $fmt): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -150,7 +151,7 @@ class HtmlNumberFormatTest extends Functional\AbstractFunctional $writer = new Html($spreadsheet); $html = $writer->generateHTMLAll(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('div'); @@ -178,7 +179,7 @@ class HtmlNumberFormatTest extends Functional\AbstractFunctional * @param mixed $val * @param mixed $fmt */ - public function testFormatValueWithMaskDate($expectedResult, $val, $fmt) + public function testFormatValueWithMaskDate($expectedResult, $val, $fmt): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -186,7 +187,7 @@ class HtmlNumberFormatTest extends Functional\AbstractFunctional $writer = new Html($spreadsheet); $html = $writer->generateHTMLAll(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('div'); diff --git a/tests/PhpSpreadsheetTests/Writer/Html/ImagesRootTest.php b/tests/PhpSpreadsheetTests/Writer/Html/ImagesRootTest.php index f7716e33..5c887d53 100644 --- a/tests/PhpSpreadsheetTests/Writer/Html/ImagesRootTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Html/ImagesRootTest.php @@ -2,13 +2,14 @@ namespace PhpOffice\PhpSpreadsheetTests\Writer\Html; +use DOMDocument; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Html; use PhpOffice\PhpSpreadsheetTests\Functional; class ImagesRootTest extends Functional\AbstractFunctional { - public function testImagesRoot() + public function testImagesRoot(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -34,7 +35,7 @@ class ImagesRootTest extends Functional\AbstractFunctional $writer->setImagesRoot($root); $html = $writer->generateHTMLAll(); chdir($curdir); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('div'); diff --git a/tests/PhpSpreadsheetTests/Writer/Html/InvalidFileNameTest.php b/tests/PhpSpreadsheetTests/Writer/Html/InvalidFileNameTest.php index f536d2bd..7baa2338 100644 --- a/tests/PhpSpreadsheetTests/Writer/Html/InvalidFileNameTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Html/InvalidFileNameTest.php @@ -12,7 +12,7 @@ use PhpOffice\PhpSpreadsheetTests\Functional; class InvalidFileNameTest extends Functional\AbstractFunctional { - public function testEmptyFileName() + public function testEmptyFileName(): void { $this->expectException(WriterException::class); $spreadsheet = new Spreadsheet(); @@ -21,7 +21,7 @@ class InvalidFileNameTest extends Functional\AbstractFunctional $writer->save(''); } - public function testEmptyFileNamePdf() + public function testEmptyFileNamePdf(): void { $this->expectException(WriterException::class); $spreadsheet = new Spreadsheet(); @@ -30,7 +30,7 @@ class InvalidFileNameTest extends Functional\AbstractFunctional $writer->save(''); } - public function testEmptyTempdirNamePdf() + public function testEmptyTempdirNamePdf(): void { $this->expectException(WriterException::class); $spreadsheet = new Spreadsheet(); @@ -44,7 +44,7 @@ class InvalidFileNameTest extends Functional\AbstractFunctional $writer->setTempDir(''); } - public function testWinFileNames() + public function testWinFileNames(): void { self::assertEquals('file:///C:/temp/filename.xlsx', Html::winFileToUrl('C:\\temp\filename.xlsx')); self::assertEquals('/tmp/filename.xlsx', Html::winFileToUrl('/tmp/filename.xlsx')); diff --git a/tests/PhpSpreadsheetTests/Writer/Html/RepeatedRowsTest.php b/tests/PhpSpreadsheetTests/Writer/Html/RepeatedRowsTest.php index e38e4b8e..2a0f60c1 100644 --- a/tests/PhpSpreadsheetTests/Writer/Html/RepeatedRowsTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Html/RepeatedRowsTest.php @@ -2,13 +2,14 @@ namespace PhpOffice\PhpSpreadsheetTests\Writer\Html; +use DOMDocument; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Html; use PhpOffice\PhpSpreadsheetTests\Functional; class RepeatedRowsTest extends Functional\AbstractFunctional { - public function testWriteRepeats() + public function testWriteRepeats(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -21,7 +22,7 @@ class RepeatedRowsTest extends Functional\AbstractFunctional $writer = new Html($spreadsheet); $html = $writer->generateHTMLall(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('div'); @@ -39,7 +40,7 @@ class RepeatedRowsTest extends Functional\AbstractFunctional $this->writeAndReload($spreadsheet, 'Html'); } - public function testWriteNoRepeats() + public function testWriteNoRepeats(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -52,7 +53,7 @@ class RepeatedRowsTest extends Functional\AbstractFunctional $writer = new Html($spreadsheet); $html = $writer->generateHTMLall(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('div'); @@ -69,7 +70,7 @@ class RepeatedRowsTest extends Functional\AbstractFunctional $this->writeAndReload($spreadsheet, 'Html'); } - public function testWriteRepeatsInline() + public function testWriteRepeatsInline(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -84,7 +85,7 @@ class RepeatedRowsTest extends Functional\AbstractFunctional self::assertFalse($writer->getUseInlineCss()); $writer->setUseInlineCss(true); $html = $writer->generateHTMLall(); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadHTML($html); $body = $dom->getElementsByTagName('body')[0]; $divs = $body->getElementsByTagName('div'); diff --git a/tests/PhpSpreadsheetTests/Writer/Html/VisibilityTest.php b/tests/PhpSpreadsheetTests/Writer/Html/VisibilityTest.php index 63cdefb7..c5d4da68 100644 --- a/tests/PhpSpreadsheetTests/Writer/Html/VisibilityTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Html/VisibilityTest.php @@ -9,7 +9,7 @@ use PhpOffice\PhpSpreadsheetTests\Functional; class VisibilityTest extends Functional\AbstractFunctional { - public function testVisibility1() + public function testVisibility1(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -39,7 +39,7 @@ class VisibilityTest extends Functional\AbstractFunctional $this->writeAndReload($spreadsheet, 'Html'); } - public function testVisibility2() + public function testVisibility2(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); @@ -72,7 +72,7 @@ class VisibilityTest extends Functional\AbstractFunctional $this->writeAndReload($spreadsheet, 'Html'); } - public function testDefaultRowHeight() + public function testDefaultRowHeight(): void { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); diff --git a/tests/PhpSpreadsheetTests/Writer/Ods/ContentTest.php b/tests/PhpSpreadsheetTests/Writer/Ods/ContentTest.php index 5641d330..4086914d 100644 --- a/tests/PhpSpreadsheetTests/Writer/Ods/ContentTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Ods/ContentTest.php @@ -37,7 +37,7 @@ class ContentTest extends TestCase Functions::setCompatibilityMode($this->compatibilityMode); } - public function testWriteEmptySpreadsheet() + public function testWriteEmptySpreadsheet(): void { $content = new Content(new Ods(new Spreadsheet())); $xml = $content->write(); @@ -45,7 +45,7 @@ class ContentTest extends TestCase self::assertXmlStringEqualsXmlFile($this->samplesPath . '/content-empty.xml', $xml); } - public function testWriteSpreadsheet() + public function testWriteSpreadsheet(): void { $workbook = new Spreadsheet(); diff --git a/tests/PhpSpreadsheetTests/Writer/Xls/FormulaErrTest.php b/tests/PhpSpreadsheetTests/Writer/Xls/FormulaErrTest.php index affb917f..61c70cb6 100644 --- a/tests/PhpSpreadsheetTests/Writer/Xls/FormulaErrTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Xls/FormulaErrTest.php @@ -17,7 +17,7 @@ class FormulaErrTest extends TestCase } } - public function testFormulaError() + public function testFormulaError(): void { $obj = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); $sheet0 = $obj->setActiveSheetIndex(0); diff --git a/tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php b/tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php index d2080265..7a83b697 100644 --- a/tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php @@ -6,6 +6,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xls\Parser; use PhpOffice\PhpSpreadsheet\Writer\Xls\Workbook; use PHPUnit\Framework\TestCase; +use ReflectionClass; class WorkbookTest extends TestCase { @@ -28,13 +29,10 @@ class WorkbookTest extends TestCase /** * @dataProvider providerAddColor - * - * @param array $testColors - * @param array $expectedResult */ - public function testAddColor(array $testColors, array $expectedResult) + public function testAddColor(array $testColors, array $expectedResult): void { - $workbookReflection = new \ReflectionClass(Workbook::class); + $workbookReflection = new ReflectionClass(Workbook::class); $methodAddColor = $workbookReflection->getMethod('addColor'); $propertyPalette = $workbookReflection->getProperty('palette'); $methodAddColor->setAccessible(true); @@ -53,7 +51,7 @@ class WorkbookTest extends TestCase { $this->setUp(); - $workbookReflection = new \ReflectionClass(Workbook::class); + $workbookReflection = new ReflectionClass(Workbook::class); $propertyPalette = $workbookReflection->getProperty('palette'); $propertyPalette->setAccessible(true); diff --git a/tests/PhpSpreadsheetTests/Writer/Xlsx/FloatsRetainedTest.php b/tests/PhpSpreadsheetTests/Writer/Xlsx/FloatsRetainedTest.php index 521cc47f..aad074de 100644 --- a/tests/PhpSpreadsheetTests/Writer/Xlsx/FloatsRetainedTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Xlsx/FloatsRetainedTest.php @@ -16,7 +16,7 @@ class FloatsRetainedTest extends TestCase * * @param float|int $value */ - public function testIntyFloatsRetainedByWriter($value) + public function testIntyFloatsRetainedByWriter($value): void { $outputFilename = tempnam(File::sysGetTempDir(), 'phpspreadsheet-test'); Settings::setLibXmlLoaderOptions(null); @@ -29,7 +29,7 @@ class FloatsRetainedTest extends TestCase $reader = new Reader(); $sheet = $reader->load($outputFilename); - $this->assertSame($value, $sheet->getActiveSheet()->getCell('A1')->getValue()); + self::assertSame($value, $sheet->getActiveSheet()->getCell('A1')->getValue()); } public function providerIntyFloatsRetainedByWriter() diff --git a/tests/PhpSpreadsheetTests/Writer/Xlsx/LocaleFloatsTest.php b/tests/PhpSpreadsheetTests/Writer/Xlsx/LocaleFloatsTest.php index f3f0eda2..81d4a777 100644 --- a/tests/PhpSpreadsheetTests/Writer/Xlsx/LocaleFloatsTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Xlsx/LocaleFloatsTest.php @@ -30,10 +30,10 @@ class LocaleFloatsTest extends TestCase } } - public function testLocaleFloatsCorrectlyConvertedByWriter() + public function testLocaleFloatsCorrectlyConvertedByWriter(): void { if (!$this->localeAdjusted) { - $this->markTestSkipped('Unable to set locale for testing.'); + self::markTestSkipped('Unable to set locale for testing.'); } $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); @@ -52,8 +52,8 @@ class LocaleFloatsTest extends TestCase ob_start(); var_dump($result); preg_match('/(?:double|float)\(([^\)]+)\)/mui', ob_get_clean(), $matches); - $this->assertArrayHasKey(1, $matches); + self::assertArrayHasKey(1, $matches); $actual = $matches[1]; - $this->assertEquals('1,1', $actual); + self::assertEquals('1,1', $actual); } } diff --git a/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php b/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php index a826dfaa..4ea6f955 100644 --- a/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php @@ -13,7 +13,7 @@ class UnparsedDataTest extends TestCase /** * Test load and save Xlsx file with unparsed data (form elements, protected sheets, alternate contents, printer settings,..). */ - public function testLoadSaveXlsxWithUnparsedData() + public function testLoadSaveXlsxWithUnparsedData(): void { $sampleFilename = 'tests/data/Writer/XLSX/form_pass_print.xlsm'; $resultFilename = tempnam(File::sysGetTempDir(), 'phpspreadsheet-test'); @@ -45,59 +45,59 @@ class UnparsedDataTest extends TestCase unlink($resultFilename); // [Content_Types].xml - $this->assertStringContainsString('application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings', $resultContentTypesRaw, 'Content type for printerSettings not found!'); - $this->assertStringContainsString('application/vnd.ms-office.vbaProject', $resultContentTypesRaw, 'Content type for VbaProject not found!'); - $this->assertStringContainsString('application/vnd.ms-excel.controlproperties+xml', $resultContentTypesRaw, 'Content type for ctrlProp not found!'); + self::assertStringContainsString('application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings', $resultContentTypesRaw, 'Content type for printerSettings not found!'); + self::assertStringContainsString('application/vnd.ms-office.vbaProject', $resultContentTypesRaw, 'Content type for VbaProject not found!'); + self::assertStringContainsString('application/vnd.ms-excel.controlproperties+xml', $resultContentTypesRaw, 'Content type for ctrlProp not found!'); // xl/ctrlProps/ctrlProp1.xml - $this->assertNotEmpty($resultControlPropRaw, 'ctrlProp not found!'); + self::assertNotEmpty($resultControlPropRaw, 'ctrlProp not found!'); // xl/drawings/drawing1.xml - $this->assertStringContainsString('assertNotEmpty($resultVmlDrawingRaw, 'vmlDrawing not found!'); + self::assertNotEmpty($resultVmlDrawingRaw, 'vmlDrawing not found!'); // xl/printerSettings/printerSettings1.bin - $this->assertNotEmpty($resultPrinterSettingsRaw, 'printerSettings.bin not found!'); + self::assertNotEmpty($resultPrinterSettingsRaw, 'printerSettings.bin not found!'); // xl/vbaProject.bin - $this->assertNotEmpty($resultVbaProjectRaw, 'vbaProject.bin not found!'); + self::assertNotEmpty($resultVbaProjectRaw, 'vbaProject.bin not found!'); // xl/workbook.xml $xmlWorkbook = simplexml_load_string($resultWorkbookRaw, 'SimpleXMLElement', Settings::getLibXmlLoaderOptions()); if (!$xmlWorkbook->workbookProtection) { - $this->fail('workbook.xml/workbookProtection not found!'); + self::fail('workbook.xml/workbookProtection not found!'); } else { - $this->assertEquals($xmlWorkbook->workbookProtection['workbookPassword'], 'CBEB', 'workbook.xml/workbookProtection[workbookPassword] is wrong!'); - $this->assertEquals($xmlWorkbook->workbookProtection['lockStructure'], 'true', 'workbook.xml/workbookProtection[lockStructure] is wrong!'); + self::assertEquals($xmlWorkbook->workbookProtection['workbookPassword'], 'CBEB', 'workbook.xml/workbookProtection[workbookPassword] is wrong!'); + self::assertEquals($xmlWorkbook->workbookProtection['lockStructure'], 'true', 'workbook.xml/workbookProtection[lockStructure] is wrong!'); - $this->assertEquals($xmlWorkbook->sheets->sheet[0]['state'], '', 'workbook.xml/sheets/sheet[0][state] is wrong!'); - $this->assertEquals($xmlWorkbook->sheets->sheet[1]['state'], 'hidden', 'workbook.xml/sheets/sheet[1][state] is wrong!'); + self::assertEquals($xmlWorkbook->sheets->sheet[0]['state'], '', 'workbook.xml/sheets/sheet[0][state] is wrong!'); + self::assertEquals($xmlWorkbook->sheets->sheet[1]['state'], 'hidden', 'workbook.xml/sheets/sheet[1][state] is wrong!'); } unset($xmlWorkbook); // xl/worksheets/_rels/sheet1.xml.rels - $this->assertStringContainsString('http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings', $resultSheet1RelsRaw, 'Sheet relation with printerSettings not found!'); - $this->assertStringContainsString('http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing', $resultSheet1RelsRaw, 'Sheet relation with vmlDrawing not found!'); - $this->assertStringContainsString('http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp', $resultSheet1RelsRaw, 'Sheet relation with ctrlProp not found!'); + self::assertStringContainsString('http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings', $resultSheet1RelsRaw, 'Sheet relation with printerSettings not found!'); + self::assertStringContainsString('http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing', $resultSheet1RelsRaw, 'Sheet relation with vmlDrawing not found!'); + self::assertStringContainsString('http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp', $resultSheet1RelsRaw, 'Sheet relation with ctrlProp not found!'); // xl/worksheets/sheet1.xml - $this->assertStringContainsString('pageSetup->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'); - $this->assertTrue(isset($pageSetupAttributes->id), 'sheet1.xml/pageSetup[r:id] not found!'); + self::assertTrue(isset($pageSetupAttributes->id), 'sheet1.xml/pageSetup[r:id] not found!'); if (!$xmlWorksheet->sheetProtection) { - $this->fail('sheet1.xml/sheetProtection not found!'); + self::fail('sheet1.xml/sheetProtection not found!'); } else { - $this->assertEquals($xmlWorksheet->sheetProtection['password'], 'CBEB', 'sheet1.xml/sheetProtection[password] is wrong!'); - $this->assertEquals($xmlWorksheet->sheetProtection['sheet'], 'true', 'sheet1.xml/sheetProtection[sheet] is wrong!'); - $this->assertEquals($xmlWorksheet->sheetProtection['objects'], 'true', 'sheet1.xml/sheetProtection[objects] is wrong!'); - $this->assertEquals($xmlWorksheet->sheetProtection['scenarios'], 'true', 'sheet1.xml/sheetProtection[scenarios] is wrong!'); + self::assertEquals($xmlWorksheet->sheetProtection['password'], 'CBEB', 'sheet1.xml/sheetProtection[password] is wrong!'); + self::assertEquals($xmlWorksheet->sheetProtection['sheet'], 'true', 'sheet1.xml/sheetProtection[sheet] is wrong!'); + self::assertEquals($xmlWorksheet->sheetProtection['objects'], 'true', 'sheet1.xml/sheetProtection[objects] is wrong!'); + self::assertEquals($xmlWorksheet->sheetProtection['scenarios'], 'true', 'sheet1.xml/sheetProtection[scenarios] is wrong!'); } unset($xmlWorksheet); // xl/worksheets/sheet2.xml - $this->assertNotEmpty($resultSheet2Raw, 'sheet2.xml not found!'); + self::assertNotEmpty($resultSheet2Raw, 'sheet2.xml not found!'); } } diff --git a/tests/data/Calculation/Calculation.php b/tests/data/Calculation/Calculation.php index 73dc6dad..2f9e0a0c 100644 --- a/tests/data/Calculation/Calculation.php +++ b/tests/data/Calculation/Calculation.php @@ -56,12 +56,12 @@ function calculationTestDataGenerator() $set8 = [4, $dataArray5, $formula3, 'E5', ['A3'], ['B3']]; $dataArray6 = [ - ['=IF(22,"a","b")'] + ['=IF(22,"a","b")'], ]; $set9 = ['a', $dataArray6, '=A1', 'A2']; return [ - $set0, $set1, $set2, $set3, $set4, $set5, $set6, $set7, $set8, $set9 + $set0, $set1, $set2, $set3, $set4, $set5, $set6, $set7, $set8, $set9, ]; } diff --git a/tests/data/Calculation/DateTime/DATE.php b/tests/data/Calculation/DateTime/DATE.php index a7b3e7cc..9acc6716 100644 --- a/tests/data/Calculation/DateTime/DATE.php +++ b/tests/data/Calculation/DateTime/DATE.php @@ -315,5 +315,5 @@ return [ [ '#VALUE!', 2010, 3, 'GHI', - ] + ], ]; diff --git a/tests/data/Calculation/Financial/XIRR.php b/tests/data/Calculation/Financial/XIRR.php index 62b9b668..3414d132 100644 --- a/tests/data/Calculation/Financial/XIRR.php +++ b/tests/data/Calculation/Financial/XIRR.php @@ -8,84 +8,84 @@ return [ 'If values and dates contain a different number of values, returns the #NUM! error value', [4000, -46000], ['2015-01-04'], - 0.1 + 0.1, ], [ '#NUM!', 'Expects at least one positive cash flow and one negative cash flow; otherwise returns the #NUM! error value', [-4000, -46000], ['2015-01-04', '2019-06-27'], - 0.1 + 0.1, ], [ '#NUM!', 'Expects at least one positive cash flow and one negative cash flow; otherwise returns the #NUM! error value', [4000, 46000], ['2015-01-04', '2019-06-27'], - 0.1 + 0.1, ], [ '#VALUE!', 'If any number in dates is not a valid date, returns the #VALUE! error value', [4000, -46000], ['2015-01-04', '2019X06-27'], - 0.1 + 0.1, ], [ '#VALUE!', 'If any entry in values is not numeric, returns the #VALUE! error value', ['y', -46000], ['2015-01-04', '2019-06-27'], - 0.1 + 0.1, ], [ '#NUM!', 'If values is not an array, returns the #NUM! error value', -46000, ['2015-01-04', '2019-06-27'], - 0.1 + 0.1, ], [ '#NUM!', 'If dates is not an array but values is, returns the #NUM! error value', [4000, -46000], '2015-01-04', - 0.1 + 0.1, ], [ '#N/A', 'If neither dates nor values is an array, returns the #N/A error value', 4000, '2015-01-04', - 0.1 + 0.1, ], [ 0.137963527441025, 'Dates can be in any order after all', [1893.67, 139947.43, 52573.25, 48849.74, 26369.16, -273029.18], ['2019-06-27', '2019-06-20', '2019-06-21', '2019-06-24', '2019-06-27', '2019-07-27'], - 0.1 + 0.1, ], [ 0.77868869226873, 'XIRR calculation #0 is incorrect', [4000, -46000], ['2015-04-01', '2019-06-27'], - 0.1 + 0.1, ], [ 0.137963527441025, 'XIRR calculation #1 is incorrect', [139947.43, 1893.67, 52573.25, 48849.74, 26369.16, -273029.18], ['2019-06-20', '2019-06-27', '2019-06-21', '2019-06-24', '2019-06-27', '2019-07-27'], - 0.1 + 0.1, ], [ 0.09999999, 'XIRR calculation #2 is incorrect', [100.0, -110.0], ['2019-06-12', '2020-06-11'], - 0.1 + 0.1, ], [ 3235.159644, @@ -116,7 +116,7 @@ return [ 'Substitute for guess=0', [139947.43, 1893.67, 52573.25, 48849.74, 26369.16, -273029.18], ['2019-06-20', '2019-06-27', '2019-06-21', '2019-06-24', '2019-06-27', '2019-07-27'], - 0.00000 + 0.00000, ], [ '#NUM!', diff --git a/tests/data/Calculation/Financial/XNPV.php b/tests/data/Calculation/Financial/XNPV.php index a49c6218..4eca0a01 100644 --- a/tests/data/Calculation/Financial/XNPV.php +++ b/tests/data/Calculation/Financial/XNPV.php @@ -42,7 +42,7 @@ return [ '#VALUE!', 'If any value is non-numeric, return VALUE', 0.10, - [-1000.0, 1000.1, "x"], + [-1000.0, 1000.1, 'x'], ['2018-06-30', '2018-07-30', '2018-08-30'], ], [ diff --git a/tests/data/Calculation/Logical/SWITCH.php b/tests/data/Calculation/Logical/SWITCH.php index d062b7fe..df3d6051 100644 --- a/tests/data/Calculation/Logical/SWITCH.php +++ b/tests/data/Calculation/Logical/SWITCH.php @@ -3,44 +3,44 @@ return [ // Must be C [ - "C", - "A", - "A", - "C", - "B", - "D", - "??" + 'C', + 'A', + 'A', + 'C', + 'B', + 'D', + '??', ], // Must be Female [ - "Female", + 'Female', 2, - "1", - "Male", - "2", - "Female" + '1', + 'Male', + '2', + 'Female', ], // Must be X using default [ - "X", - "U", - "ABC", - "Y", - "DEF", - "Z", - "X" + 'X', + 'U', + 'ABC', + 'Y', + 'DEF', + 'Z', + 'X', ], // Must be N/A default value not defined [ - "#N/A", - "U", - "ABC", - "Y", - "DEF", - "Z" + '#N/A', + 'U', + 'ABC', + 'Y', + 'DEF', + 'Z', ], // Must be value - no parameter [ - "#VALUE!" + '#VALUE!', ], ]; diff --git a/tests/data/Calculation/LookupRef/CHOOSE.php b/tests/data/Calculation/LookupRef/CHOOSE.php index 020ef498..06371c79 100644 --- a/tests/data/Calculation/LookupRef/CHOOSE.php +++ b/tests/data/Calculation/LookupRef/CHOOSE.php @@ -2,27 +2,27 @@ return [ [ - "brown", - 4, "red", "blue", "green", "brown", + 'brown', + 4, 'red', 'blue', 'green', 'brown', ], [ - "blue", - 2, "red", "blue", "green", "brown", + 'blue', + 2, 'red', 'blue', 'green', 'brown', ], [ - "green", - 3, "red", "blue", "green", "brown", + 'green', + 3, 'red', 'blue', 'green', 'brown', ], [ - "red", - 1, "red", "blue", "green", "brown", + 'red', + 1, 'red', 'blue', 'green', 'brown', ], [ - "#VALUE!", - 5, "red", "blue", "green", "brown", + '#VALUE!', + 5, 'red', 'blue', 'green', 'brown', ], [ - "#VALUE!", - 0, "red", "blue", "green", "brown", + '#VALUE!', + 0, 'red', 'blue', 'green', 'brown', ], ]; diff --git a/tests/data/Calculation/LookupRef/HLOOKUP.php b/tests/data/Calculation/LookupRef/HLOOKUP.php index 6a87a5a1..644ddeba 100644 --- a/tests/data/Calculation/LookupRef/HLOOKUP.php +++ b/tests/data/Calculation/LookupRef/HLOOKUP.php @@ -280,19 +280,19 @@ return [ 'x', [ ['Selection column', '0', '0', '0', '0', 'x', 'x', 'x', 'x', 'x'], - ['Value to retrieve', 1, 2, 3, 4, 5, 6, 7, 8, 9] + ['Value to retrieve', 1, 2, 3, 4, 5, 6, 7, 8, 9], ], 2, - false + false, ], [ 2, 'B', [ ['Selection column', 'C', 'B', 'A'], - ['Value to retrieve', 3, 2, 1] + ['Value to retrieve', 3, 2, 1], ], 2, - false + false, ], ]; diff --git a/tests/data/Calculation/LookupRef/LOOKUP.php b/tests/data/Calculation/LookupRef/LOOKUP.php index a39f5e9a..ab322d57 100644 --- a/tests/data/Calculation/LookupRef/LOOKUP.php +++ b/tests/data/Calculation/LookupRef/LOOKUP.php @@ -1,4 +1,5 @@ null, '0.7.A' => 6.7, '0.8.A' => 'STRING', - '0.9.A' => '' + '0.9.A' => '', ], ], [ diff --git a/tests/data/Calculation/Statistical/AVERAGE.php b/tests/data/Calculation/Statistical/AVERAGE.php index c5666172..d435e89b 100644 --- a/tests/data/Calculation/Statistical/AVERAGE.php +++ b/tests/data/Calculation/Statistical/AVERAGE.php @@ -38,7 +38,7 @@ return [ '0.6.A' => null, '0.7.A' => 6.7, '0.8.A' => 'STRING', - '0.9.A' => '' + '0.9.A' => '', ], ], [ diff --git a/tests/data/Calculation/Statistical/AVERAGEIF.php b/tests/data/Calculation/Statistical/AVERAGEIF.php index bd976471..422a2771 100644 --- a/tests/data/Calculation/Statistical/AVERAGEIF.php +++ b/tests/data/Calculation/Statistical/AVERAGEIF.php @@ -4,22 +4,22 @@ return [ [ 14000, [7000, 14000, 21000, 28000], - "<23000", + '<23000', ], [ 150000, [100000, 200000, 300000, 400000], - "<250000", + '<250000', ], [ '#DIV/0!', [100000, 200000, 300000, 400000], - "<95000", + '<95000', ], [ 24500, [100000, 200000, 300000, 400000], - ">250000", + '>250000', [7000, 14000, 21000, 28000], ], [ @@ -37,17 +37,17 @@ return [ [ 7.8, [2012, 2012, 2013, 2011, 2011, 2010], - ">=2012", + '>=2012', [6, 10.4, 7, 12, 8, 15], ], [ 2011.2, [2012, 2012, 2013, 2011, 2011, 2010], - "<2013", + '<2013', ], [ 14000, [7000, 14000, 'Hello World', 21000, 28000], - "<23000", + '<23000', ], ]; diff --git a/tests/data/Calculation/Statistical/BasicCOUNT.php b/tests/data/Calculation/Statistical/BasicCOUNT.php index 8c0dc1c3..4e1d31b0 100644 --- a/tests/data/Calculation/Statistical/BasicCOUNT.php +++ b/tests/data/Calculation/Statistical/BasicCOUNT.php @@ -21,7 +21,7 @@ return [ '', 4.8, 'Not a numeric', - 6 + 6, ], ], ]; diff --git a/tests/data/Calculation/Statistical/COUNTA.php b/tests/data/Calculation/Statistical/COUNTA.php index 579af954..0e0ffb15 100644 --- a/tests/data/Calculation/Statistical/COUNTA.php +++ b/tests/data/Calculation/Statistical/COUNTA.php @@ -24,7 +24,7 @@ return [ '0.11.A' => '', '0.12.A' => 4.8, '0.13.A' => 'Not a numeric', - '0.14.A' => 6 + '0.14.A' => 6, ], ], [ @@ -45,7 +45,7 @@ return [ '', 4.8, 'Not a numeric', - 6 + 6, ], ], ]; diff --git a/tests/data/Calculation/Statistical/FISHER.php b/tests/data/Calculation/Statistical/FISHER.php index 95882458..fc35acba 100644 --- a/tests/data/Calculation/Statistical/FISHER.php +++ b/tests/data/Calculation/Statistical/FISHER.php @@ -12,5 +12,5 @@ return [ [ 1.098612288668, 0.8, - ] + ], ]; diff --git a/tests/data/Calculation/Statistical/SLOPE.php b/tests/data/Calculation/Statistical/SLOPE.php index d0b7dbeb..a635c0d0 100644 --- a/tests/data/Calculation/Statistical/SLOPE.php +++ b/tests/data/Calculation/Statistical/SLOPE.php @@ -42,7 +42,7 @@ return [ 5, 4, 4, - ] + ], ], [ 0.305555555556, @@ -63,6 +63,6 @@ return [ 5, 4, 4, - ] + ], ], ];