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([ ->setRules([
'align_multiline_comment' => true, 'align_multiline_comment' => true,
'array_syntax' => ['syntax' => 'short'], 'array_syntax' => ['syntax' => 'short'],
'backtick_to_shell_exec' => true,
'binary_operator_spaces' => true, 'binary_operator_spaces' => true,
'blank_line_after_namespace' => true, 'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true, 'blank_line_after_opening_tag' => true,
'blank_line_before_return' => true,
'blank_line_before_statement' => true, 'blank_line_before_statement' => true,
'braces' => true, 'braces' => true,
'cast_spaces' => true, 'cast_spaces' => true,
'class_attributes_separation' => ['elements' => ['method', 'property']], // const are often grouped with other related const
'class_definition' => true, 'class_definition' => true,
'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE 'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE
'combine_consecutive_issets' => true, 'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true, 'combine_consecutive_unsets' => true,
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'], 'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => true, 'declare_equal_normalize' => true,
'declare_strict_types' => false, // Too early to adopt strict types 'declare_strict_types' => false, // Too early to adopt strict types
@ -34,6 +36,10 @@ return PhpCsFixer\Config::create()
'elseif' => true, 'elseif' => true,
'encoding' => true, 'encoding' => true,
'ereg_to_preg' => 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, 'full_opening_tag' => true,
'function_declaration' => true, 'function_declaration' => true,
'function_to_constant' => 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 'header_comment' => false, // We don't use common header in all our files
'heredoc_to_nowdoc' => false, // Not sure about this one 'heredoc_to_nowdoc' => false, // Not sure about this one
'include' => true, 'include' => true,
'increment_style' => true,
'indentation_type' => true, 'indentation_type' => true,
'is_null' => ['use_yoda_style' => false], 'is_null' => ['use_yoda_style' => false],
'linebreak_after_opening_tag' => true, 'linebreak_after_opening_tag' => true,
@ -54,8 +61,10 @@ return PhpCsFixer\Config::create()
'magic_constant_casing' => true, 'magic_constant_casing' => true,
'mb_str_functions' => false, // No, too dangerous to change that 'mb_str_functions' => false, // No, too dangerous to change that
'method_argument_space' => true, 'method_argument_space' => true,
'method_chaining_indentation' => true,
'method_separation' => true, 'method_separation' => true,
'modernize_types_casting' => true, 'modernize_types_casting' => true,
'multiline_comment_opening_closing' => true,
'native_function_casing' => 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 '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, 'new_with_braces' => true,
@ -68,7 +77,7 @@ return PhpCsFixer\Config::create()
'no_empty_comment' => true, 'no_empty_comment' => true,
'no_empty_phpdoc' => true, 'no_empty_phpdoc' => true,
'no_empty_statement' => 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_homoglyph_names' => true,
'no_leading_import_slash' => true, 'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true, 'no_leading_namespace_whitespace' => true,
@ -127,11 +136,15 @@ return PhpCsFixer\Config::create()
'phpdoc_var_without_name' => true, 'phpdoc_var_without_name' => true,
'php_unit_construct' => true, 'php_unit_construct' => true,
'php_unit_dedicate_assert' => true, 'php_unit_dedicate_assert' => true,
'php_unit_expectation' => true,
'php_unit_fqcn_annotation' => 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_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 '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' => false,
'pre_increment' => true,
'protected_to_private' => true, 'protected_to_private' => true,
'psr0' => true, 'psr0' => true,
'psr4' => true, 'psr4' => true,
@ -151,6 +164,7 @@ return PhpCsFixer\Config::create()
'single_quote' => true, 'single_quote' => true,
'space_after_semicolon' => true, 'space_after_semicolon' => true,
'standardize_not_equals' => 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_comparison' => false, // No, too dangerous to change that
'strict_param' => false, // No, too dangerous to change that 'strict_param' => false, // No, too dangerous to change that
'switch_case_semicolon_to_colon' => true, 'switch_case_semicolon_to_colon' => true,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -224,7 +224,7 @@ class FormulaParser
// scientific notation check // scientific notation check
if (strpos(self::OPERATORS_SN, $this->formula[$index]) !== false) { if (strpos(self::OPERATORS_SN, $this->formula[$index]) !== false) {
if (strlen($value) > 1) { 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]; $value .= $this->formula[$index];
++$index; ++$index;

View File

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

View File

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

View File

@ -30,7 +30,7 @@ abstract class Coordinate
*/ */
public static function coordinateFromString($pCoordinateString) 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]]; return [$matches[1], $matches[2]];
} elseif (self::coordinateIsRange($pCoordinateString)) { } elseif (self::coordinateIsRange($pCoordinateString)) {
throw new Exception('Cell coordinate string can not be a range of cells'); throw new Exception('Cell coordinate string can not be a range of cells');

View File

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

View File

@ -533,14 +533,21 @@ class Html
]; ];
protected $face; protected $face;
protected $size; protected $size;
protected $color; protected $color;
protected $bold = false; protected $bold = false;
protected $italic = false; protected $italic = false;
protected $underline = false; protected $underline = false;
protected $superscript = false; protected $superscript = false;
protected $subscript = false; protected $subscript = false;
protected $strikethrough = false; protected $strikethrough = false;
protected $startTagCallbacks = [ 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 // Data Array used for testing only, should write to Spreadsheet object on completion of tests
protected $dataArray = []; protected $dataArray = [];
protected $tableLevel = 0; protected $tableLevel = 0;
protected $nestedColumn = ['A']; protected $nestedColumn = ['A'];
protected function setTableStartColumn($column) protected function setTableStartColumn($column)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -223,7 +223,7 @@ class BaseDrawing implements IComparable
// Set new \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet // Set new \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet
$this->setWorksheet($pValue); $this->setWorksheet($pValue);
} else { } 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; break;
case DataType::TYPE_ERROR: case DataType::TYPE_ERROR:
throw new Exception('Writing of error not implemented yet.'); throw new Exception('Writing of error not implemented yet.');
break; break;
case DataType::TYPE_FORMULA: case DataType::TYPE_FORMULA:
$formulaValue = $cell->getValue(); $formulaValue = $cell->getValue();
@ -223,6 +224,7 @@ class Content extends WriterPart
break; break;
case DataType::TYPE_INLINE: case DataType::TYPE_INLINE:
throw new Exception('Writing of inline not implemented yet.'); throw new Exception('Writing of inline not implemented yet.');
break; break;
case DataType::TYPE_NUMERIC: case DataType::TYPE_NUMERIC:
$objWriter->writeAttribute('office:value-type', 'float'); $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)) { } elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/', $token)) {
return $this->convertRef2d($token); return $this->convertRef2d($token);
// match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1 // 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); return $this->convertRef3d($token);
// match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1 // 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); return $this->convertRef3d($token);
// match ranges like A1:B2 or $A$1:$B$2 // 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)) { } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)\:(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)$/', $token)) {
return $this->convertRange2d($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 // 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); 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 // 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); return $this->convertRange3d($token);
// operators (including parentheses) // operators (including parentheses)
} elseif (isset($this->ptg[$token])) { } elseif (isset($this->ptg[$token])) {
return pack('C', $this->ptg[$token]); return pack('C', $this->ptg[$token]);
// match error codes // 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); return $this->convertError($token);
// commented so argument number can be processed correctly. See toReversePolish(). // commented so argument number can be processed correctly. See toReversePolish().
/*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/", $token)) /*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/", $token))
@ -541,7 +541,7 @@ class Parser
private function convertNumber($num) private function convertNumber($num)
{ {
// Integer in the range 0..2**16-1 // 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); return pack('Cv', $this->ptg['ptgInt'], $num);
} }
@ -652,7 +652,7 @@ class Parser
list($cell1, $cell2) = explode(':', $range); list($cell1, $cell2) = explode(':', $range);
// Convert the cell references // 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($row1, $col1) = $this->cellToPackedRowcol($cell1);
list($row2, $col2) = $this->cellToPackedRowcol($cell2); list($row2, $col2) = $this->cellToPackedRowcol($cell2);
} else { // It's a rows range (like 26:27) } else { // It's a rows range (like 26:27)
@ -1005,6 +1005,7 @@ class Parser
case '&': case '&':
case '%': case '%':
return $token; return $token;
break; break;
case '>': case '>':
if ($this->lookAhead == '=') { // it's a GE token if ($this->lookAhead == '=') { // it's a GE token
@ -1012,6 +1013,7 @@ class Parser
} }
return $token; return $token;
break; break;
case '<': case '<':
// it's a LE or a NE token // it's a LE or a NE token
@ -1020,24 +1022,25 @@ class Parser
} }
return $token; return $token;
break; break;
default: default:
// if it's a reference A1 or $A$1 or $A1 or A$1 // 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) and !preg_match('/\d/', $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.') and ($this->lookAhead != '!')) {
return $token; 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) // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
return $token; 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) // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
return $token; 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)) { } 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 // if it's a range A1:A2 or $A$1:$A$2
return $token; 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 // 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; 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 // 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; 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) 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)) { } elseif (preg_match('/"([^"]|""){0,255}"/', $token) and $this->lookAhead != '"' and (substr_count($token, '"') % 2 == 0)) {
// If it's a string (of maximum 255 characters) // If it's a string (of maximum 255 characters)
return $token; 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 // If it's an error code
return $token; 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 // if it's a function call
return $token; return $token;
} elseif (substr($token, -1) == ')') { } elseif (substr($token, -1) == ')') {
@ -1148,7 +1151,7 @@ class Parser
return $result; return $result;
// If it's an error code // 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', ''); $result = $this->createTree($this->currentToken, 'ptgErr', '');
$this->advance(); $this->advance();
@ -1259,13 +1262,13 @@ class Parser
$this->advance(); $this->advance();
return $result; 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) // 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, '', ''); $result = $this->createTree($this->currentToken, '', '');
$this->advance(); $this->advance();
return $result; 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) // 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, '', ''); $result = $this->createTree($this->currentToken, '', '');
$this->advance(); $this->advance();
@ -1279,14 +1282,14 @@ class Parser
$this->advance(); $this->advance();
return $result; 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) // 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? // must be an error?
$result = $this->createTree($this->currentToken, '', ''); $result = $this->createTree($this->currentToken, '', '');
$this->advance(); $this->advance();
return $result; 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) // 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? // must be an error?
$result = $this->createTree($this->currentToken, '', ''); $result = $this->createTree($this->currentToken, '', '');
@ -1304,7 +1307,7 @@ class Parser
$this->advance(); $this->advance();
return $result; 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 // if it's a function call
$result = $this->func(); $result = $this->func();
@ -1420,9 +1423,9 @@ class Parser
$polish .= $converted_tree; $polish .= $converted_tree;
} }
// if it's a function convert it here (so we can set it's arguments) // 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+)$/', $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 !is_numeric($tree['value']) and
!isset($this->ptg[$tree['value']])) { !isset($this->ptg[$tree['value']])) {
// left subtree for a function is always an array. // left subtree for a function is always an array.

View File

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

View File

@ -239,11 +239,10 @@ class CoordinateTest extends TestCase
return require 'data/CellBuildRange.php'; return require 'data/CellBuildRange.php';
} }
/**
* @expectedException \TypeError
*/
public function testBuildRangeInvalid() public function testBuildRangeInvalid()
{ {
$this->expectException(\TypeError::class);
if (PHP_MAJOR_VERSION < 7) { if (PHP_MAJOR_VERSION < 7) {
$this->markTestSkipped('Cannot catch type hinting error with PHP 5.6'); $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'); 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() public function testThrowsWhenCellCannotBeRetrievedFromCache()
{ {
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$collection = $this->getMockBuilder(Cells::class) $collection = $this->getMockBuilder(Cells::class)
->setConstructorArgs([new Worksheet(), new Memory()]) ->setConstructorArgs([new Worksheet(), new Memory()])
->setMethods(['has']) ->setMethods(['has'])
@ -101,11 +100,10 @@ class CellsTest extends TestCase
$collection->get('A2'); $collection->get('A2');
} }
/**
* @expectedException \PhpOffice\PhpSpreadsheet\Exception
*/
public function testThrowsWhenCellCannotBeStoredInCache() public function testThrowsWhenCellCannotBeStoredInCache()
{ {
$this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class);
$cache = $this->createMock(Memory::class); $cache = $this->createMock(Memory::class);
$cell = $this->createMock(Cell::class); $cell = $this->createMock(Cell::class);
$cache->method('set') $cache->method('set')

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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