Update to PHP-CS-Fixer 2.10

This commit is contained in:
Adrien Crivelli 2018-01-28 15:59:38 +09:00
parent 015c83ccf4
commit c96e2dae02
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
92 changed files with 1159 additions and 1112 deletions

View File

@ -12,17 +12,19 @@ return PhpCsFixer\Config::create()
->setRules([
'align_multiline_comment' => 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' => true,
'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
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => true,
'declare_strict_types' => false, // Too early to adopt strict types
@ -34,6 +36,10 @@ return PhpCsFixer\Config::create()
'elseif' => true,
'encoding' => true,
'ereg_to_preg' => 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_internal_class' => true,
'full_opening_tag' => true,
'function_declaration' => true,
'function_to_constant' => true,
@ -43,6 +49,7 @@ return PhpCsFixer\Config::create()
'header_comment' => false, // We don't use common header in all our files
'heredoc_to_nowdoc' => false, // Not sure about this one
'include' => true,
'increment_style' => true,
'indentation_type' => true,
'is_null' => ['use_yoda_style' => false],
'linebreak_after_opening_tag' => true,
@ -54,8 +61,10 @@ return PhpCsFixer\Config::create()
'magic_constant_casing' => true,
'mb_str_functions' => false, // No, too dangerous to change that
'method_argument_space' => true,
'method_chaining_indentation' => true,
'method_separation' => true,
'modernize_types_casting' => true,
'multiline_comment_opening_closing' => true,
'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
'new_with_braces' => true,
@ -68,7 +77,7 @@ return PhpCsFixer\Config::create()
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'useTrait', 'curly_brace_block', 'parenthesis_brace_block', 'square_brace_block'],
'no_extra_blank_lines' => true,
'no_homoglyph_names' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
@ -127,11 +136,15 @@ return PhpCsFixer\Config::create()
'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,
'pre_increment' => true,
'protected_to_private' => true,
'psr0' => true,
'psr4' => true,
@ -151,6 +164,7 @@ return PhpCsFixer\Config::create()
'single_quote' => true,
'space_after_semicolon' => 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
'switch_case_semicolon_to_colon' => true,

View File

@ -54,8 +54,8 @@
"phpunit/phpunit": "^5.7",
"dompdf/dompdf": "^0.8.0",
"mpdf/mpdf": "^7.0.0",
"friendsofphp/php-cs-fixer": "^2.7",
"jpgraph/jpgraph": "^4.0"
"jpgraph/jpgraph": "^4.0",
"friendsofphp/php-cs-fixer": "@stable"
},
"suggest": {
"ext-gd": "Required for exact column width autocalculation",

322
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "804bbe054403d6532308f8a65f19adc2",
"content-hash": "e61a906bd83393400add286703f10557",
"packages": [
{
"name": "psr/simple-cache",
@ -120,30 +120,30 @@
},
{
"name": "doctrine/annotations",
"version": "v1.4.0",
"version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "54cacc9b81758b14e3ce750f205a393d52339e97"
"reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97",
"reference": "54cacc9b81758b14e3ce750f205a393d52339e97",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5",
"reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5",
"shasum": ""
},
"require": {
"doctrine/lexer": "1.*",
"php": "^5.6 || ^7.0"
"php": "^7.1"
},
"require-dev": {
"doctrine/cache": "1.*",
"phpunit/phpunit": "^5.7"
"phpunit/phpunit": "^6.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
"dev-master": "1.6.x-dev"
}
},
"autoload": {
@ -184,7 +184,7 @@
"docblock",
"parser"
],
"time": "2017-02-24T16:22:25+00:00"
"time": "2017-12-06T07:11:42+00:00"
},
{
"name": "doctrine/instantiator",
@ -358,16 +358,16 @@
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v2.7.0",
"version": "v2.10.0",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
"reference": "e4e93a120117e879cfc1f231fbf29274707cd834"
"reference": "513a3765b56dd029175f9f32995566657ee89dda"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/e4e93a120117e879cfc1f231fbf29274707cd834",
"reference": "e4e93a120117e879cfc1f231fbf29274707cd834",
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/513a3765b56dd029175f9f32995566657ee89dda",
"reference": "513a3765b56dd029175f9f32995566657ee89dda",
"shasum": ""
},
"require": {
@ -375,29 +375,32 @@
"doctrine/annotations": "^1.2",
"ext-json": "*",
"ext-tokenizer": "*",
"gecko-packages/gecko-php-unit": "^2.0",
"gecko-packages/gecko-php-unit": "^2.0 || ^3.0",
"php": "^5.6 || >=7.0 <7.3",
"php-cs-fixer/diff": "^1.0",
"symfony/console": "^3.2",
"symfony/event-dispatcher": "^3.0",
"symfony/filesystem": "^3.0",
"symfony/finder": "^3.0",
"symfony/options-resolver": "^3.0",
"php-cs-fixer/diff": "^1.2",
"symfony/console": "^3.2 || ^4.0",
"symfony/event-dispatcher": "^3.0 || ^4.0",
"symfony/filesystem": "^3.0 || ^4.0",
"symfony/finder": "^3.0 || ^4.0",
"symfony/options-resolver": "^3.0 || ^4.0",
"symfony/polyfill-php70": "^1.0",
"symfony/polyfill-php72": "^1.4",
"symfony/process": "^3.0",
"symfony/stopwatch": "^3.0"
"symfony/process": "^3.0 || ^4.0",
"symfony/stopwatch": "^3.0 || ^4.0"
},
"conflict": {
"hhvm": "*"
},
"require-dev": {
"johnkary/phpunit-speedtrap": "^1.1",
"johnkary/phpunit-speedtrap": "^1.1 || ^2.0@dev",
"justinrainbow/json-schema": "^5.0",
"keradus/cli-executor": "^1.0",
"mikey179/vfsstream": "^1.6",
"php-coveralls/php-coveralls": "^2.0",
"php-cs-fixer/accessible-object": "^1.0",
"phpunit/phpunit": "^4.8.35 || ^5.4.3",
"satooshi/php-coveralls": "^1.0",
"symfony/phpunit-bridge": "^3.2.2"
"phpunit/phpunit": "^5.7.23 || ^6.4.3",
"phpunitgoodpractices/traits": "^1.0",
"symfony/phpunit-bridge": "^3.2.2 || ^4.0"
},
"suggest": {
"ext-mbstring": "For handling non-UTF8 characters in cache signature.",
@ -409,7 +412,7 @@
"type": "application",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "2.10-dev"
}
},
"autoload": {
@ -417,11 +420,12 @@
"PhpCsFixer\\": "src/"
},
"classmap": [
"tests/Test/Assert/AssertTokensTrait.php",
"tests/Test/AbstractFixerTestCase.php",
"tests/Test/AbstractIntegrationTestCase.php",
"tests/Test/Assert/AssertTokensTrait.php",
"tests/Test/IntegrationCase.php",
"tests/Test/IntegrationCaseFactory.php"
"tests/Test/IntegrationCaseFactory.php",
"tests/TestCase.php"
]
},
"notification-url": "https://packagist.org/downloads/",
@ -439,27 +443,27 @@
}
],
"description": "A tool to automatically fix PHP code style",
"time": "2017-09-29T15:19:05+00:00"
"time": "2018-01-10T17:16:15+00:00"
},
{
"name": "gecko-packages/gecko-php-unit",
"version": "v2.2",
"version": "v3.0",
"source": {
"type": "git",
"url": "https://github.com/GeckoPackages/GeckoPHPUnit.git",
"reference": "ab525fac9a9ffea219687f261b02008b18ebf2d1"
"reference": "6a866551dffc2154c1b091bae3a7877d39c25ca3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GeckoPackages/GeckoPHPUnit/zipball/ab525fac9a9ffea219687f261b02008b18ebf2d1",
"reference": "ab525fac9a9ffea219687f261b02008b18ebf2d1",
"url": "https://api.github.com/repos/GeckoPackages/GeckoPHPUnit/zipball/6a866551dffc2154c1b091bae3a7877d39c25ca3",
"reference": "6a866551dffc2154c1b091bae3a7877d39c25ca3",
"shasum": ""
},
"require": {
"php": "^5.3.6 || ^7.0"
"php": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.4.3"
"phpunit/phpunit": "^6.0"
},
"suggest": {
"ext-dom": "When testing with xml.",
@ -467,6 +471,11 @@
"phpunit/phpunit": "This is an extension for it so make sure you have it some way."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"GeckoPackages\\PHPUnit\\": "src/PHPUnit"
@ -483,7 +492,7 @@
"filesystem",
"phpunit"
],
"time": "2017-08-23T07:39:54+00:00"
"time": "2017-08-23T07:46:41+00:00"
},
{
"name": "ircmaxell/password-compat",
@ -800,23 +809,24 @@
},
{
"name": "php-cs-fixer/diff",
"version": "v1.1.0",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/diff.git",
"reference": "d068edadcb8f7bc2ea3d3769cdbaf609026ec4f4"
"reference": "f0ef6133d674137e902fdf8a6f2e8e97e14a087b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/d068edadcb8f7bc2ea3d3769cdbaf609026ec4f4",
"reference": "d068edadcb8f7bc2ea3d3769cdbaf609026ec4f4",
"url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/f0ef6133d674137e902fdf8a6f2e8e97e14a087b",
"reference": "f0ef6133d674137e902fdf8a6f2e8e97e14a087b",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.4.3"
"phpunit/phpunit": "^4.8.35 || ^5.4.3",
"symfony/process": "^3.3"
},
"type": "library",
"autoload": {
@ -825,9 +835,6 @@
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Kore Nordmann",
@ -836,6 +843,9 @@
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "SpacePossum"
}
],
"description": "sebastian/diff v2 backport support for PHP5.6",
@ -843,7 +853,7 @@
"keywords": [
"diff"
],
"time": "2017-09-23T16:02:08+00:00"
"time": "2017-10-19T09:58:18+00:00"
},
{
"name": "phpdocumentor/reflection-common",
@ -2174,44 +2184,44 @@
},
{
"name": "symfony/console",
"version": "v3.3.9",
"version": "v4.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf"
"reference": "fe0e69d7162cba0885791cf7eea5f0d7bc0f897e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf",
"reference": "a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf",
"url": "https://api.github.com/repos/symfony/console/zipball/fe0e69d7162cba0885791cf7eea5f0d7bc0f897e",
"reference": "fe0e69d7162cba0885791cf7eea5f0d7bc0f897e",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8",
"symfony/debug": "~2.8|~3.0",
"php": "^7.1.3",
"symfony/polyfill-mbstring": "~1.0"
},
"conflict": {
"symfony/dependency-injection": "<3.3"
"symfony/dependency-injection": "<3.4",
"symfony/process": "<3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~3.3",
"symfony/dependency-injection": "~3.3",
"symfony/event-dispatcher": "~2.8|~3.0",
"symfony/filesystem": "~2.8|~3.0",
"symfony/process": "~2.8|~3.0"
"symfony/config": "~3.4|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/event-dispatcher": "~3.4|~4.0",
"symfony/lock": "~3.4|~4.0",
"symfony/process": "~3.4|~4.0"
},
"suggest": {
"psr/log": "For using the console logger",
"symfony/event-dispatcher": "",
"symfony/filesystem": "",
"symfony/lock": "",
"symfony/process": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
"dev-master": "4.0-dev"
}
},
"autoload": {
@ -2238,90 +2248,34 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2017-09-06T16:40:18+00:00"
},
{
"name": "symfony/debug",
"version": "v3.3.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "8beb24eec70b345c313640962df933499373a944"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/8beb24eec70b345c313640962df933499373a944",
"reference": "8beb24eec70b345c313640962df933499373a944",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8",
"psr/log": "~1.0"
},
"conflict": {
"symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
},
"require-dev": {
"symfony/http-kernel": "~2.8|~3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Debug\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2017-09-01T13:23:39+00:00"
"time": "2018-01-03T07:38:00+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v3.3.9",
"version": "v4.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "54ca9520a00386f83bca145819ad3b619aaa2485"
"reference": "74d33aac36208c4d6757807d9f598f0133a3a4eb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/54ca9520a00386f83bca145819ad3b619aaa2485",
"reference": "54ca9520a00386f83bca145819ad3b619aaa2485",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/74d33aac36208c4d6757807d9f598f0133a3a4eb",
"reference": "74d33aac36208c4d6757807d9f598f0133a3a4eb",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
"php": "^7.1.3"
},
"conflict": {
"symfony/dependency-injection": "<3.3"
"symfony/dependency-injection": "<3.4"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~2.8|~3.0",
"symfony/dependency-injection": "~3.3",
"symfony/expression-language": "~2.8|~3.0",
"symfony/stopwatch": "~2.8|~3.0"
"symfony/config": "~3.4|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/expression-language": "~3.4|~4.0",
"symfony/stopwatch": "~3.4|~4.0"
},
"suggest": {
"symfony/dependency-injection": "",
@ -2330,7 +2284,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
"dev-master": "4.0-dev"
}
},
"autoload": {
@ -2357,29 +2311,29 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2018-01-03T07:38:00+00:00"
},
{
"name": "symfony/filesystem",
"version": "v3.3.9",
"version": "v4.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "b32a0e5f928d0fa3d1dd03c78d020777e50c10cb"
"reference": "760e47a4ee64b4c48f4b30017011e09d4c0f05ed"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/b32a0e5f928d0fa3d1dd03c78d020777e50c10cb",
"reference": "b32a0e5f928d0fa3d1dd03c78d020777e50c10cb",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/760e47a4ee64b4c48f4b30017011e09d4c0f05ed",
"reference": "760e47a4ee64b4c48f4b30017011e09d4c0f05ed",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
"php": "^7.1.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
"dev-master": "4.0-dev"
}
},
"autoload": {
@ -2406,29 +2360,29 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2018-01-03T07:38:00+00:00"
},
{
"name": "symfony/finder",
"version": "v3.3.9",
"version": "v4.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "b2260dbc80f3c4198f903215f91a1ac7fe9fe09e"
"reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/b2260dbc80f3c4198f903215f91a1ac7fe9fe09e",
"reference": "b2260dbc80f3c4198f903215f91a1ac7fe9fe09e",
"url": "https://api.github.com/repos/symfony/finder/zipball/8b08180f2b7ccb41062366b9ad91fbc4f1af8601",
"reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
"php": "^7.1.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
"dev-master": "4.0-dev"
}
},
"autoload": {
@ -2455,29 +2409,29 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2018-01-03T07:38:00+00:00"
},
{
"name": "symfony/options-resolver",
"version": "v3.3.9",
"version": "v4.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
"reference": "ee4e22978fe885b54ee5da8c7964f0a5301abfb6"
"reference": "30d9240b30696a69e893534c9fc4a5c72ab6689b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/ee4e22978fe885b54ee5da8c7964f0a5301abfb6",
"reference": "ee4e22978fe885b54ee5da8c7964f0a5301abfb6",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/30d9240b30696a69e893534c9fc4a5c72ab6689b",
"reference": "30d9240b30696a69e893534c9fc4a5c72ab6689b",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
"php": "^7.1.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
"dev-master": "4.0-dev"
}
},
"autoload": {
@ -2509,20 +2463,20 @@
"configuration",
"options"
],
"time": "2017-07-29T21:54:42+00:00"
"time": "2018-01-03T07:38:00+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.5.0",
"version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803"
"reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803",
"reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
"reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
"shasum": ""
},
"require": {
@ -2534,7 +2488,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.5-dev"
"dev-master": "1.6-dev"
}
},
"autoload": {
@ -2568,7 +2522,7 @@
"portable",
"shim"
],
"time": "2017-06-14T15:44:48+00:00"
"time": "2017-10-11T12:05:26+00:00"
},
{
"name": "symfony/polyfill-php54",
@ -2686,16 +2640,16 @@
},
{
"name": "symfony/polyfill-php70",
"version": "v1.5.0",
"version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php70.git",
"reference": "b6482e68974486984f59449ecea1fbbb22ff840f"
"reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/b6482e68974486984f59449ecea1fbbb22ff840f",
"reference": "b6482e68974486984f59449ecea1fbbb22ff840f",
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff",
"reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff",
"shasum": ""
},
"require": {
@ -2705,7 +2659,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.5-dev"
"dev-master": "1.6-dev"
}
},
"autoload": {
@ -2741,20 +2695,20 @@
"portable",
"shim"
],
"time": "2017-06-14T15:44:48+00:00"
"time": "2017-10-11T12:05:26+00:00"
},
{
"name": "symfony/polyfill-php72",
"version": "v1.5.0",
"version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "8abc9097f5001d310f0edba727469c988acc6ea7"
"reference": "6de4f4884b97abbbed9f0a84a95ff2ff77254254"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/8abc9097f5001d310f0edba727469c988acc6ea7",
"reference": "8abc9097f5001d310f0edba727469c988acc6ea7",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/6de4f4884b97abbbed9f0a84a95ff2ff77254254",
"reference": "6de4f4884b97abbbed9f0a84a95ff2ff77254254",
"shasum": ""
},
"require": {
@ -2763,7 +2717,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.5-dev"
"dev-master": "1.6-dev"
}
},
"autoload": {
@ -2796,7 +2750,7 @@
"portable",
"shim"
],
"time": "2017-07-11T13:25:55+00:00"
"time": "2017-10-11T12:05:26+00:00"
},
{
"name": "symfony/polyfill-xml",
@ -2858,25 +2812,25 @@
},
{
"name": "symfony/process",
"version": "v3.3.9",
"version": "v4.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0"
"reference": "2145b3e8137e463b1051b79440a59b38220944f0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0",
"reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0",
"url": "https://api.github.com/repos/symfony/process/zipball/2145b3e8137e463b1051b79440a59b38220944f0",
"reference": "2145b3e8137e463b1051b79440a59b38220944f0",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
"php": "^7.1.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
"dev-master": "4.0-dev"
}
},
"autoload": {
@ -2903,29 +2857,29 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2018-01-03T07:38:00+00:00"
},
{
"name": "symfony/stopwatch",
"version": "v3.3.9",
"version": "v4.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
"reference": "9a5610a8d6a50985a7be485c0ba745c22607beeb"
"reference": "d52321f0e2b596bd03b5d1dd6eebe71caa925704"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/9a5610a8d6a50985a7be485c0ba745c22607beeb",
"reference": "9a5610a8d6a50985a7be485c0ba745c22607beeb",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/d52321f0e2b596bd03b5d1dd6eebe71caa925704",
"reference": "d52321f0e2b596bd03b5d1dd6eebe71caa925704",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
"php": "^7.1.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
"dev-master": "4.0-dev"
}
},
"autoload": {
@ -2952,7 +2906,7 @@
],
"description": "Symfony Stopwatch Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2018-01-03T07:38:00+00:00"
},
{
"name": "symfony/yaml",
@ -3125,7 +3079,9 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {
"friendsofphp/php-cs-fixer": 0
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {

View File

@ -14,7 +14,9 @@ $sheetname = 'Data Sheet #3';
class MyReadFilter implements IReadFilter
{
private $startRow = 0;
private $endRow = 0;
private $columns = [];
public function __construct($startRow, $endRow, $columns)

View File

@ -14,6 +14,7 @@ $inputFileName = __DIR__ . '/sampleData/example2.xls';
class ChunkReadFilter implements IReadFilter
{
private $startRow = 0;
private $endRow = 0;
/**

View File

@ -14,6 +14,7 @@ $inputFileName = __DIR__ . '/sampleData/example2.xls';
class ChunkReadFilter implements IReadFilter
{
private $startRow = 0;
private $endRow = 0;
/**

View File

@ -15,6 +15,7 @@ $inputFileName = __DIR__ . '/sampleData/example2.csv';
class ChunkReadFilter implements IReadFilter
{
private $startRow = 0;
private $endRow = 0;
/**

View File

@ -171,6 +171,7 @@ class Calculation
* @var string
*/
private static $localeArgumentSeparator = ',';
private static $localeFunctions = [];
/**
@ -2355,6 +2356,7 @@ class Calculation
}
private static $functionReplaceFromExcel = null;
private static $functionReplaceToLocale = null;
public function _translateFormulaToLocale($formula)
@ -2383,6 +2385,7 @@ class Calculation
}
private static $functionReplaceFromLocale = null;
private static $functionReplaceToExcel = null;
public function _translateFormulaToEnglish($formula)

View File

@ -1843,7 +1843,7 @@ class Financial
* If you omit guess, it is assumed to be 10 percent.
*
* @return float
**/
*/
public static function RATE($nper, $pmt, $pv, $fv = 0.0, $type = 0, $guess = 0.1)
{
$nper = (int) Functions::flattenSingleValue($nper);

View File

@ -224,7 +224,7 @@ class FormulaParser
// scientific notation check
if (strpos(self::OPERATORS_SN, $this->formula[$index]) !== false) {
if (strlen($value) > 1) {
if (preg_match("/^[1-9]{1}(\.\d+)?E{1}$/", $this->formula[$index]) != 0) {
if (preg_match('/^[1-9]{1}(\\.\\d+)?E{1}$/', $this->formula[$index]) != 0) {
$value .= $this->formula[$index];
++$index;

View File

@ -73,7 +73,9 @@ class Statistical
// Function cache for logBeta function
private static $logBetaCacheP = 0.0;
private static $logBetaCacheQ = 0.0;
private static $logBetaCacheResult = 0.0;
/**
@ -207,6 +209,7 @@ class Statistical
// Function cache for logGamma
private static $logGammaCacheResult = 0.0;
private static $logGammaCacheX = 0.0;
private static function logGamma($x)
@ -431,14 +434,14 @@ class Statistical
return exp(0 - $tmp + log(self::SQRT2PI * $summer / $x));
}
/***************************************************************************
/*
* inverse_ncdf.php
* -------------------
* begin : Friday, January 16, 2004
* copyright : (C) 2004 Michael Nickerson
* email : nickersonm@yahoo.com
*
***************************************************************************/
*/
private static function inverseNcdf($p)
{
// Inverse ncdf approximation by Peter J. Acklam, implementation adapted to

View File

@ -234,6 +234,7 @@ class Cell
break;
default:
throw new Exception('Invalid datatype: ' . $pDataType);
break;
}
@ -587,7 +588,7 @@ class Cell
*
* @return int Result of comparison (always -1 or 1, never zero!)
*/
public static function compareCells(Cell $a, Cell $b)
public static function compareCells(self $a, self $b)
{
if ($a->getRow() < $b->getRow()) {
return -1;

View File

@ -30,7 +30,7 @@ abstract class Coordinate
*/
public static function coordinateFromString($pCoordinateString)
{
if (preg_match("/^([$]?[A-Z]{1,3})([$]?\d{1,7})$/", $pCoordinateString, $matches)) {
if (preg_match('/^([$]?[A-Z]{1,3})([$]?\\d{1,7})$/', $pCoordinateString, $matches)) {
return [$matches[1], $matches[2]];
} elseif (self::coordinateIsRange($pCoordinateString)) {
throw new Exception('Cell coordinate string can not be a range of cells');

View File

@ -503,9 +503,11 @@ class Properties
switch ($propertyType) {
case 'empty': // Empty
return '';
break;
case 'null': // Null
return null;
break;
case 'i1': // 1-Byte Signed Integer
case 'i2': // 2-Byte Signed Integer
@ -513,6 +515,7 @@ class Properties
case 'i8': // 8-Byte Signed Integer
case 'int': // Integer
return (int) $propertyValue;
break;
case 'ui1': // 1-Byte Unsigned Integer
case 'ui2': // 2-Byte Unsigned Integer
@ -520,23 +523,28 @@ class Properties
case 'ui8': // 8-Byte Unsigned Integer
case 'uint': // Unsigned Integer
return abs((int) $propertyValue);
break;
case 'r4': // 4-Byte Real Number
case 'r8': // 8-Byte Real Number
case 'decimal': // Decimal
return (float) $propertyValue;
break;
case 'lpstr': // LPSTR
case 'lpwstr': // LPWSTR
case 'bstr': // Basic String
return $propertyValue;
break;
case 'date': // Date and Time
case 'filetime': // File Time
return strtotime($propertyValue);
break;
case 'bool': // Boolean
return ($propertyValue == 'true') ? true : false;
break;
case 'cy': // Currency
case 'error': // Error Status Code
@ -552,6 +560,7 @@ class Properties
case 'clsid': // Class ID
case 'cf': // Clipboard Data
return $propertyValue;
break;
}
@ -572,11 +581,13 @@ class Properties
case 'ui8': // 8-Byte Unsigned Integer
case 'uint': // Unsigned Integer
return self::PROPERTY_TYPE_INTEGER;
break;
case 'r4': // 4-Byte Real Number
case 'r8': // 8-Byte Real Number
case 'decimal': // Decimal
return self::PROPERTY_TYPE_FLOAT;
break;
case 'empty': // Empty
case 'null': // Null
@ -584,13 +595,16 @@ class Properties
case 'lpwstr': // LPWSTR
case 'bstr': // Basic String
return self::PROPERTY_TYPE_STRING;
break;
case 'date': // Date and Time
case 'filetime': // File Time
return self::PROPERTY_TYPE_DATE;
break;
case 'bool': // Boolean
return self::PROPERTY_TYPE_BOOLEAN;
break;
case 'cy': // Currency
case 'error': // Error Status Code
@ -606,6 +620,7 @@ class Properties
case 'clsid': // Class ID
case 'cf': // Clipboard Data
return self::PROPERTY_TYPE_UNKNOWN;
break;
}

View File

@ -533,14 +533,21 @@ class Html
];
protected $face;
protected $size;
protected $color;
protected $bold = false;
protected $italic = false;
protected $underline = false;
protected $superscript = false;
protected $subscript = false;
protected $strikethrough = false;
protected $startTagCallbacks = [

View File

@ -219,7 +219,9 @@ class Html extends BaseReader
// Data Array used for testing only, should write to Spreadsheet object on completion of tests
protected $dataArray = [];
protected $tableLevel = 0;
protected $nestedColumn = ['A'];
protected function setTableStartColumn($column)

View File

@ -2963,7 +2963,7 @@ class Xls extends BaseReader
*
* -- "OpenOffice.org's Documentation of the Microsoft
* Excel File Format"
**/
*/
private function readSst()
{
// offset within (spliced) record data
@ -5035,6 +5035,7 @@ class Xls extends BaseReader
case 0x28:
// TODO: Investigate structure for .xls SHEETLAYOUT record as saved by MS Office Excel 2007
return;
break;
}
}
@ -5726,6 +5727,7 @@ class Xls extends BaseReader
break;
default:
throw new Exception('Unrecognized space type in tAttrSpace token');
break;
}
// offset: 3; size: 1; number of inserted spaces/carriage returns
@ -5736,6 +5738,7 @@ class Xls extends BaseReader
break;
default:
throw new Exception('Unrecognized attribute flag in tAttr token');
break;
}
@ -6586,6 +6589,7 @@ class Xls extends BaseReader
break;
default:
throw new Exception('Unrecognized function in formula');
break;
}
$data = ['function' => $function, 'args' => $args];
@ -6955,6 +6959,7 @@ class Xls extends BaseReader
break;
default:
throw new Exception('Unrecognized function in formula');
break;
}
$data = ['function' => $function, 'args' => $args];
@ -7088,6 +7093,7 @@ class Xls extends BaseReader
// Unknown cases // don't know how to deal with
default:
throw new Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula');
break;
}
@ -7501,10 +7507,12 @@ class Xls extends BaseReader
}
return $sheetRange;
break;
default:
// TODO: external sheet support
throw new Exception('Xls reader only supports internal sheets in formulas');
break;
}
}

View File

@ -6,8 +6,11 @@ class MD5
{
// Context
private $a;
private $b;
private $c;
private $d;
/**

View File

@ -6,7 +6,9 @@ class RC4
{
// Context
protected $s = [];
protected $i = 0;
protected $j = 0;
/**

View File

@ -509,6 +509,7 @@ class Font
break;
default:
throw new PhpSpreadsheetException('Unknown font name "' . $name . '". Cannot map to TrueType font file');
break;
}

View File

@ -37,6 +37,7 @@ class EigenvalueDecomposition
* @var array
*/
private $d = [];
private $e = [];
/**
@ -66,6 +67,7 @@ class EigenvalueDecomposition
* @var float
*/
private $cdivr;
private $cdivi;
/**

View File

@ -101,6 +101,7 @@ class Matrix
break;
default:
throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
}
} else {
@ -192,6 +193,7 @@ class Matrix
}
return $R;
break;
//A($i0...$iF; $j0...$jF)
case 'integer,integer,integer,integer':
@ -214,6 +216,7 @@ class Matrix
}
return $R;
break;
//$R = array of row indices; $C = array of column indices
case 'array,array':
@ -236,6 +239,7 @@ class Matrix
}
return $R;
break;
//A($i0...$iF); $CL = array of column indices
case 'integer,integer,array':
@ -258,6 +262,7 @@ class Matrix
}
return $R;
break;
//$RL = array of row indices
case 'array,integer,integer':
@ -280,9 +285,11 @@ class Matrix
}
return $R;
break;
default:
throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
}
} else {
@ -494,6 +501,7 @@ class Matrix
break;
default:
throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
}
$this->checkMatrixDimensions($M);
@ -538,6 +546,7 @@ class Matrix
break;
default:
throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
}
$this->checkMatrixDimensions($M);
@ -596,6 +605,7 @@ class Matrix
break;
default:
throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
}
$this->checkMatrixDimensions($M);
@ -640,6 +650,7 @@ class Matrix
break;
default:
throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
}
$this->checkMatrixDimensions($M);
@ -699,6 +710,7 @@ class Matrix
break;
default:
throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
}
$this->checkMatrixDimensions($M);
@ -744,6 +756,7 @@ class Matrix
break;
default:
throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
}
$this->checkMatrixDimensions($M);
@ -803,6 +816,7 @@ class Matrix
break;
default:
throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
}
$this->checkMatrixDimensions($M);
@ -867,6 +881,7 @@ class Matrix
break;
default:
throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
}
$this->checkMatrixDimensions($M);
@ -912,6 +927,7 @@ class Matrix
break;
default:
throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
}
$this->checkMatrixDimensions($M);
@ -957,6 +973,7 @@ class Matrix
break;
default:
throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
}
$this->checkMatrixDimensions($M);
@ -1095,6 +1112,7 @@ class Matrix
break;
default:
throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
}
$this->checkMatrixDimensions($M);
@ -1153,6 +1171,7 @@ class Matrix
break;
default:
throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
}
$this->checkMatrixDimensions($M);

View File

@ -35,7 +35,9 @@ class OLERead
const SIZE_POS = 0x78;
public $wrkbook;
public $summaryInformation;
public $documentSummaryInformation;
/**

View File

@ -8,49 +8,49 @@ class BestFit
* Indicator flag for a calculation error.
*
* @var bool
**/
*/
protected $error = false;
/**
* Algorithm type to use for best-fit.
*
* @var string
**/
*/
protected $bestFitType = 'undetermined';
/**
* Number of entries in the sets of x- and y-value arrays.
*
* @var int
**/
*/
protected $valueCount = 0;
/**
* X-value dataseries of values.
*
* @var float[]
**/
*/
protected $xValues = [];
/**
* Y-value dataseries of values.
*
* @var float[]
**/
*/
protected $yValues = [];
/**
* Flag indicating whether values should be adjusted to Y=0.
*
* @var bool
**/
*/
protected $adjustToZero = false;
/**
* Y-value series of best-fit values.
*
* @var float[]
**/
*/
protected $yBestFitValues = [];
protected $goodnessOfFit = 1;

View File

@ -9,7 +9,7 @@ class ExponentialBestFit extends BestFit
* (Name of this Trend class).
*
* @var string
**/
*/
protected $bestFitType = 'exponential';
/**
@ -18,7 +18,7 @@ class ExponentialBestFit extends BestFit
* @param float $xValue X-Value
*
* @return float Y-Value
**/
*/
public function getValueOfYForX($xValue)
{
return $this->getIntersect() * pow($this->getSlope(), ($xValue - $this->xOffset));
@ -30,7 +30,7 @@ class ExponentialBestFit extends BestFit
* @param float $yValue Y-Value
*
* @return float X-Value
**/
*/
public function getValueOfXForY($yValue)
{
return log(($yValue + $this->yOffset) / $this->getIntersect()) / log($this->getSlope());
@ -42,7 +42,7 @@ class ExponentialBestFit extends BestFit
* @param int $dp Number of places of decimal precision to display
*
* @return string
**/
*/
public function getEquation($dp = 0)
{
$slope = $this->getSlope($dp);
@ -57,7 +57,7 @@ class ExponentialBestFit extends BestFit
* @param int $dp Number of places of decimal precision to display
*
* @return float
**/
*/
public function getSlope($dp = 0)
{
if ($dp != 0) {
@ -73,7 +73,7 @@ class ExponentialBestFit extends BestFit
* @param int $dp Number of places of decimal precision to display
*
* @return float
**/
*/
public function getIntersect($dp = 0)
{
if ($dp != 0) {

View File

@ -9,7 +9,7 @@ class LinearBestFit extends BestFit
* (Name of this Trend class).
*
* @var string
**/
*/
protected $bestFitType = 'linear';
/**
@ -18,7 +18,7 @@ class LinearBestFit extends BestFit
* @param float $xValue X-Value
*
* @return float Y-Value
**/
*/
public function getValueOfYForX($xValue)
{
return $this->getIntersect() + $this->getSlope() * $xValue;
@ -30,7 +30,7 @@ class LinearBestFit extends BestFit
* @param float $yValue Y-Value
*
* @return float X-Value
**/
*/
public function getValueOfXForY($yValue)
{
return ($yValue - $this->getIntersect()) / $this->getSlope();
@ -42,7 +42,7 @@ class LinearBestFit extends BestFit
* @param int $dp Number of places of decimal precision to display
*
* @return string
**/
*/
public function getEquation($dp = 0)
{
$slope = $this->getSlope($dp);

View File

@ -9,7 +9,7 @@ class LogarithmicBestFit extends BestFit
* (Name of this Trend class).
*
* @var string
**/
*/
protected $bestFitType = 'logarithmic';
/**
@ -18,7 +18,7 @@ class LogarithmicBestFit extends BestFit
* @param float $xValue X-Value
*
* @return float Y-Value
**/
*/
public function getValueOfYForX($xValue)
{
return $this->getIntersect() + $this->getSlope() * log($xValue - $this->xOffset);
@ -30,7 +30,7 @@ class LogarithmicBestFit extends BestFit
* @param float $yValue Y-Value
*
* @return float X-Value
**/
*/
public function getValueOfXForY($yValue)
{
return exp(($yValue - $this->getIntersect()) / $this->getSlope());
@ -42,7 +42,7 @@ class LogarithmicBestFit extends BestFit
* @param int $dp Number of places of decimal precision to display
*
* @return string
**/
*/
public function getEquation($dp = 0)
{
$slope = $this->getSlope($dp);

View File

@ -11,21 +11,21 @@ class PolynomialBestFit extends BestFit
* (Name of this Trend class).
*
* @var string
**/
*/
protected $bestFitType = 'polynomial';
/**
* Polynomial order.
*
* @var int
**/
*/
protected $order = 0;
/**
* Return the order of this polynomial.
*
* @return int
**/
*/
public function getOrder()
{
return $this->order;
@ -37,7 +37,7 @@ class PolynomialBestFit extends BestFit
* @param float $xValue X-Value
*
* @return float Y-Value
**/
*/
public function getValueOfYForX($xValue)
{
$retVal = $this->getIntersect();
@ -57,7 +57,7 @@ class PolynomialBestFit extends BestFit
* @param float $yValue Y-Value
*
* @return float X-Value
**/
*/
public function getValueOfXForY($yValue)
{
return ($yValue - $this->getIntersect()) / $this->getSlope();
@ -69,7 +69,7 @@ class PolynomialBestFit extends BestFit
* @param int $dp Number of places of decimal precision to display
*
* @return string
**/
*/
public function getEquation($dp = 0)
{
$slope = $this->getSlope($dp);
@ -94,7 +94,7 @@ class PolynomialBestFit extends BestFit
* @param int $dp Number of places of decimal precision to display
*
* @return string
**/
*/
public function getSlope($dp = 0)
{
if ($dp != 0) {

View File

@ -9,7 +9,7 @@ class PowerBestFit extends BestFit
* (Name of this Trend class).
*
* @var string
**/
*/
protected $bestFitType = 'power';
/**
@ -18,7 +18,7 @@ class PowerBestFit extends BestFit
* @param float $xValue X-Value
*
* @return float Y-Value
**/
*/
public function getValueOfYForX($xValue)
{
return $this->getIntersect() * pow(($xValue - $this->xOffset), $this->getSlope());
@ -30,7 +30,7 @@ class PowerBestFit extends BestFit
* @param float $yValue Y-Value
*
* @return float X-Value
**/
*/
public function getValueOfXForY($yValue)
{
return pow((($yValue + $this->yOffset) / $this->getIntersect()), (1 / $this->getSlope()));
@ -42,7 +42,7 @@ class PowerBestFit extends BestFit
* @param int $dp Number of places of decimal precision to display
*
* @return string
**/
*/
public function getEquation($dp = 0)
{
$slope = $this->getSlope($dp);
@ -57,7 +57,7 @@ class PowerBestFit extends BestFit
* @param int $dp Number of places of decimal precision to display
*
* @return float
**/
*/
public function getIntersect($dp = 0)
{
if ($dp != 0) {

View File

@ -20,7 +20,7 @@ class Trend
* Names of the best-fit Trend analysis methods.
*
* @var string[]
**/
*/
private static $trendTypes = [
self::TREND_LINEAR,
self::TREND_LOGARITHMIC,
@ -32,7 +32,7 @@ class Trend
* Names of the best-fit Trend polynomial orders.
*
* @var string[]
**/
*/
private static $trendTypePolynomialOrders = [
self::TREND_POLYNOMIAL_2,
self::TREND_POLYNOMIAL_3,
@ -45,7 +45,7 @@ class Trend
* Cached results for each method when trying to identify which provides the best fit.
*
* @var bestFit[]
**/
*/
private static $trendCache = [];
public static function calculate($trendType = self::TREND_BEST_FIT, $yValues = [], $xValues = [], $const = true)

View File

@ -92,6 +92,7 @@ class Spreadsheet
* @var string
*/
private $macrosCode;
/**
* macrosCertificate : if macros are signed, contains binary data vbaProjectSignature.bin file, null if not signed.
*
@ -281,6 +282,7 @@ class Spreadsheet
switch ($what) {
case 'all':
return $this->ribbonBinObjects;
break;
case 'names':
case 'data':

View File

@ -82,6 +82,7 @@ class Border extends Supervisor
case 'outline':
case 'vertical':
throw new PhpSpreadsheetException('Cannot get shared component for a pseudo-border.');
break;
case 'bottom':
return $this->parent->getSharedComponent()->getBottom();

View File

@ -415,6 +415,7 @@ class NumberFormat extends Supervisor
// fractional seconds - no php equivalent
'.s' => '',
];
/**
* Search/replace values to convert Excel date/time format masks hours to PHP format masks (24 hr clock).
*
@ -424,6 +425,7 @@ class NumberFormat extends Supervisor
'hh' => 'H',
'h' => 'G',
];
/**
* Search/replace values to convert Excel date/time format masks hours to PHP format masks (12 hr clock).
*
@ -687,9 +689,9 @@ class NumberFormat extends Supervisor
// Strip #
$format = preg_replace('/\\#/', '0', $format);
$n = "/\[[^\]]+\]/";
$n = '/\\[[^\\]]+\\]/';
$m = preg_replace($n, '', $format);
$number_regex = "/(0+)(\.?)(0*)/";
$number_regex = '/(0+)(\\.?)(0*)/';
if (preg_match($number_regex, $m, $matches)) {
$left = $matches[1];
$dec = $matches[2];

View File

@ -469,6 +469,7 @@ class AutoFilter
* @var array
*/
private static $fromReplace = ['\*', '\?', '~~', '~.*', '~.?'];
private static $toReplace = ['.*', '.', '~', '\*', '\?'];
/**

View File

@ -223,7 +223,7 @@ class BaseDrawing implements IComparable
// Set new \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet
$this->setWorksheet($pValue);
} else {
throw new PhpSpreadsheetException("A Worksheet has already been assigned. Drawings can only exist on one \PhpOffice\PhpSpreadsheet\Worksheet.");
throw new PhpSpreadsheetException('A Worksheet has already been assigned. Drawings can only exist on one \\PhpOffice\\PhpSpreadsheet\\Worksheet.');
}
}

View File

@ -201,6 +201,7 @@ class Content extends WriterPart
break;
case DataType::TYPE_ERROR:
throw new Exception('Writing of error not implemented yet.');
break;
case DataType::TYPE_FORMULA:
$formulaValue = $cell->getValue();
@ -223,6 +224,7 @@ class Content extends WriterPart
break;
case DataType::TYPE_INLINE:
throw new Exception('Writing of inline not implemented yet.');
break;
case DataType::TYPE_NUMERIC:
$objWriter->writeAttribute('office:value-type', 'float');

View File

@ -497,25 +497,25 @@ class Parser
} elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/', $token)) {
return $this->convertRef2d($token);
// match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1
} elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
} elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?[A-Ia-i]?[A-Za-z]\$?(\\d+)$/u', $token)) {
return $this->convertRef3d($token);
// match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\\d+)$/u", $token)) {
return $this->convertRef3d($token);
// match ranges like A1:B2 or $A$1:$B$2
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)\:(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)$/', $token)) {
return $this->convertRange2d($token);
// match external ranges like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
} 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)) {
} 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)) {
return $this->convertRange3d($token);
// match external ranges like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
} 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)) {
} 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)) {
return $this->convertRange3d($token);
// operators (including parentheses)
} 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) or $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))
@ -541,7 +541,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)) and ($num <= 65535)) {
return pack('Cv', $this->ptg['ptgInt'], $num);
}
@ -652,7 +652,7 @@ class Parser
list($cell1, $cell2) = explode(':', $range);
// Convert the cell references
if (preg_match("/^(\\$)?[A-Ia-i]?[A-Za-z](\\$)?(\d+)$/", $cell1)) {
if (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\\d+)$/', $cell1)) {
list($row1, $col1) = $this->cellToPackedRowcol($cell1);
list($row2, $col2) = $this->cellToPackedRowcol($cell2);
} else { // It's a rows range (like 26:27)
@ -1005,6 +1005,7 @@ class Parser
case '&':
case '%':
return $token;
break;
case '>':
if ($this->lookAhead == '=') { // it's a GE token
@ -1012,6 +1013,7 @@ class Parser
}
return $token;
break;
case '<':
// it's a LE or a NE token
@ -1020,24 +1022,25 @@ class Parser
}
return $token;
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 != '!')) {
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) and !preg_match('/\d/', $this->lookAhead) and ($this->lookAhead != ':') and ($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) and !preg_match('/\d/', $this->lookAhead) and ($this->lookAhead != ':') and ($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) and !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) and !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 != ':')) {
@ -1046,10 +1049,10 @@ class Parser
} elseif (preg_match('/"([^"]|""){0,255}"/', $token) and $this->lookAhead != '"' and (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) or $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) and ($this->lookAhead == '(')) {
// if it's a function call
return $token;
} elseif (substr($token, -1) == ')') {
@ -1148,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) or $this->currentToken == '#N/A') {
$result = $this->createTree($this->currentToken, 'ptgErr', '');
$this->advance();
@ -1259,13 +1262,13 @@ class Parser
$this->advance();
return $result;
} elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?\d+$/u", $this->currentToken)) {
} elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?[A-Ia-i]?[A-Za-z]\$?\\d+$/u', $this->currentToken)) {
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
$result = $this->createTree($this->currentToken, '', '');
$this->advance();
return $result;
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?\d+$/u", $this->currentToken)) {
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?[A-Ia-i]?[A-Za-z]\\$?\\d+$/u", $this->currentToken)) {
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
$result = $this->createTree($this->currentToken, '', '');
$this->advance();
@ -1279,14 +1282,14 @@ class Parser
$this->advance();
return $result;
} 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", $this->currentToken)) {
} 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', $this->currentToken)) {
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
// must be an error?
$result = $this->createTree($this->currentToken, '', '');
$this->advance();
return $result;
} 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", $this->currentToken)) {
} 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", $this->currentToken)) {
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
// must be an error?
$result = $this->createTree($this->currentToken, '', '');
@ -1304,7 +1307,7 @@ class Parser
$this->advance();
return $result;
} elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->currentToken)) {
} elseif (preg_match("/^[A-Z0-9\xc0-\xdc\\.]+$/i", $this->currentToken)) {
// if it's a function call
$result = $this->func();
@ -1420,9 +1423,9 @@ 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
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
!preg_match('/^[A-Ia-i]?[A-Za-z](\\d+)\\.\\.[A-Ia-i]?[A-Za-z](\\d+)$/', $tree['value']) and
!is_numeric($tree['value']) and
!isset($this->ptg[$tree['value']])) {
// left subtree for a function is always an array.

View File

@ -1074,7 +1074,7 @@ class Worksheet extends BIFFwriter
// parameters accordingly.
// Split the dir name and sheet name (if it exists)
$dir_long = $url;
if (preg_match("/\#/", $url)) {
if (preg_match('/\\#/', $url)) {
$link_type |= 0x08;
}
@ -1082,11 +1082,11 @@ class Worksheet extends BIFFwriter
$link_type = pack('V', $link_type);
// Calculate the up-level dir count e.g.. (..\..\..\ == 3)
$up_count = preg_match_all("/\.\.\\\/", $dir_long, $useless);
$up_count = preg_match_all("/\\.\\.\\\/", $dir_long, $useless);
$up_count = pack('v', $up_count);
// Store the short dos dir name (null terminated)
$dir_short = preg_replace("/\.\.\\\/", '', $dir_long) . "\0";
$dir_short = preg_replace("/\\.\\.\\\/", '', $dir_long) . "\0";
// Store the long dir name as a wchar string (non-null terminated)
$dir_long = $dir_long . "\0";

View File

@ -239,11 +239,10 @@ class CoordinateTest extends TestCase
return require 'data/CellBuildRange.php';
}
/**
* @expectedException \TypeError
*/
public function testBuildRangeInvalid()
{
$this->expectException(\TypeError::class);
if (PHP_MAJOR_VERSION < 7) {
$this->markTestSkipped('Cannot catch type hinting error with PHP 5.6');
}

View File

@ -85,11 +85,10 @@ 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');
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testThrowsWhenCellCannotBeRetrievedFromCache()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$collection = $this->getMockBuilder(Cells::class)
->setConstructorArgs([new Worksheet(), new Memory()])
->setMethods(['has'])
@ -101,11 +100,10 @@ class CellsTest extends TestCase
$collection->get('A2');
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testThrowsWhenCellCannotBeStoredInCache()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$cache = $this->createMock(Memory::class);
$cell = $this->createMock(Cell::class);
$cache->method('set')

View File

@ -7,7 +7,9 @@ use PhpOffice\PhpSpreadsheet\Exception;
class Complex
{
private $realPart = 0;
private $imaginaryPart = 0;
private $suffix;
public static function _parseComplex($complexNumber)

View File

@ -117,35 +117,31 @@ class IOFactoryTest extends TestCase
];
}
/**
* @expectedException \InvalidArgumentException
*/
public function testIdentifyNonExistingFileThrowException()
{
$this->expectException(\InvalidArgumentException::class);
IOFactory::identify('/non/existing/file');
}
/**
* @expectedException \InvalidArgumentException
*/
public function testIdentifyExistingDirectoryThrowExceptions()
{
$this->expectException(\InvalidArgumentException::class);
IOFactory::identify('.');
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
public function testRegisterInvalidWriter()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Writer\Exception::class);
IOFactory::registerWriter('foo', 'bar');
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Reader\Exception
*/
public function testRegisterInvalidReader()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Reader\Exception::class);
IOFactory::registerReader('foo', 'bar');
}
}

View File

@ -11,12 +11,13 @@ class XmlTest extends TestCase
{
/**
* @dataProvider providerInvalidXML
* @expectedException \PhpOffice\PhpSpreadsheet\Reader\Exception
*
* @param mixed $filename
*/
public function testInvalidXML($filename)
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Reader\Exception::class);
$reader = $this->getMockForAbstractClass(BaseReader::class);
$expectedResult = 'FAILURE: Should throw an Exception rather than return a value';
$result = $reader->securityScanFile($filename);
@ -35,12 +36,13 @@ class XmlTest extends TestCase
/**
* @dataProvider providerInvalidSimpleXML
* @expectedException \PhpOffice\PhpSpreadsheet\Reader\Exception
*
* @param $filename
*/
public function testInvalidSimpleXML($filename)
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Reader\Exception::class);
$xmlReader = new Xml();
$xmlReader->trySimpleXMLLoadString($filename);
}

View File

@ -8,6 +8,7 @@ use PHPUnit\Framework\TestCase;
class RuleTest extends TestCase
{
private $testAutoFilterRuleObject;
private $mockAutoFilterColumnObject;
public function setUp()

View File

@ -8,7 +8,9 @@ use PHPUnit\Framework\TestCase;
class ColumnTest extends TestCase
{
private $testInitialColumn = 'H';
private $testAutoFilterColumnObject;
private $mockAutoFilterObject;
public function setUp()
@ -70,11 +72,10 @@ class ColumnTest extends TestCase
self::assertEquals(AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, $result);
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testSetInvalidFilterTypeThrowsException()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$expectedResult = 'Unfiltered';
$this->testAutoFilterColumnObject->setFilterType($expectedResult);
@ -95,11 +96,10 @@ class ColumnTest extends TestCase
self::assertEquals(AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND, $result);
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testSetInvalidJoinThrowsException()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$expectedResult = 'Neither';
$this->testAutoFilterColumnObject->setJoin($expectedResult);

View File

@ -11,11 +11,14 @@ use PHPUnit\Framework\TestCase;
class AutoFilterTest extends TestCase
{
private $testInitialRange = 'H2:O256';
/**
* @var AutoFilter
*/
private $testAutoFilterObject;
private $mockWorksheetObject;
private $cellCollection;
public function setUp()
@ -95,11 +98,10 @@ class AutoFilterTest extends TestCase
self::assertEquals($expectedResult, $result);
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testSetRangeInvalidRange()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$expectedResult = 'A1';
$this->testAutoFilterObject->setRange($expectedResult);
@ -129,11 +131,10 @@ class AutoFilterTest extends TestCase
}
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testGetInvalidColumnOffset()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$invalidColumn = 'G';
$this->testAutoFilterObject->getColumnOffset($invalidColumn);
@ -156,11 +157,10 @@ class AutoFilterTest extends TestCase
self::assertInstanceOf(Column::class, $result[$expectedResult]);
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testSetInvalidColumnWithString()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$invalidColumn = 'A';
$this->testAutoFilterObject->setColumn($invalidColumn);
@ -184,20 +184,18 @@ class AutoFilterTest extends TestCase
self::assertInstanceOf(Column::class, $result[$expectedResult]);
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testSetInvalidColumnWithObject()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$invalidColumn = 'E';
$this->testAutoFilterObject->setColumn($invalidColumn);
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testSetColumnWithInvalidDataType()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$invalidColumn = 123.456;
$this->testAutoFilterObject->setColumn($invalidColumn);
}
@ -262,11 +260,10 @@ class AutoFilterTest extends TestCase
self::assertInstanceOf(Column::class, $result);
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testGetColumnWithoutRangeSet()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
// Clear the range
$this->testAutoFilterObject->setRange('');
$this->testAutoFilterObject->getColumn('A');

View File

@ -10,6 +10,7 @@ use PHPUnit\Framework\TestCase;
class ColumnCellIteratorTest extends TestCase
{
public $mockWorksheet;
public $mockCell;
public function setUp()
@ -67,20 +68,18 @@ class ColumnCellIteratorTest extends TestCase
}
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testSeekOutOfRange()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$iterator = new ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
$iterator->seek(1);
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testPrevOutOfRange()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$iterator = new ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
$iterator->prev();
}

View File

@ -10,6 +10,7 @@ use PHPUnit\Framework\TestCase;
class ColumnIteratorTest extends TestCase
{
public $mockWorksheet;
public $mockColumn;
public function setUp()
@ -66,20 +67,18 @@ class ColumnIteratorTest extends TestCase
}
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testSeekOutOfRange()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$iterator = new ColumnIterator($this->mockWorksheet, 'B', 'D');
$iterator->seek('A');
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testPrevOutOfRange()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$iterator = new ColumnIterator($this->mockWorksheet, 'B', 'D');
$iterator->prev();
}

View File

@ -10,6 +10,7 @@ use PHPUnit\Framework\TestCase;
class ColumnTest extends TestCase
{
public $mockWorksheet;
public $mockColumn;
public function setUp()

View File

@ -10,6 +10,7 @@ use PHPUnit\Framework\TestCase;
class RowCellIteratorTest extends TestCase
{
public $mockWorksheet;
public $mockCell;
public function setUp()
@ -69,20 +70,18 @@ class RowCellIteratorTest extends TestCase
}
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testSeekOutOfRange()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
$iterator->seek(1);
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testPrevOutOfRange()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
$iterator->prev();
}

View File

@ -10,6 +10,7 @@ use PHPUnit\Framework\TestCase;
class RowIteratorTest extends TestCase
{
public $mockWorksheet;
public $mockRow;
public function setUp()
@ -64,20 +65,18 @@ class RowIteratorTest extends TestCase
}
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testSeekOutOfRange()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$iterator = new RowIterator($this->mockWorksheet, 2, 4);
$iterator->seek(1);
}
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testPrevOutOfRange()
{
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$iterator = new RowIterator($this->mockWorksheet, 2, 4);
$iterator->prev();
}

View File

@ -10,6 +10,7 @@ use PHPUnit\Framework\TestCase;
class RowTest extends TestCase
{
public $mockWorksheet;
public $mockRow;
public function setUp()