diff --git a/.php_cs.dist b/.php_cs.dist index 59a7eea8..6c6d0e3f 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -10,38 +10,48 @@ return PhpCsFixer\Config::create() ->setRiskyAllowed(true) ->setFinder($finder) ->setRules([ + 'align_multiline_comment' => true, 'array_syntax' => ['syntax' => 'short'], 'binary_operator_spaces' => true, 'blank_line_after_namespace' => true, 'blank_line_after_opening_tag' => true, 'blank_line_before_return' => true, + 'blank_line_before_statement' => true, 'braces' => true, 'cast_spaces' => true, 'class_definition' => true, 'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE + 'combine_consecutive_issets' => true, 'combine_consecutive_unsets' => true, 'concat_space' => ['spacing' => 'one'], 'declare_equal_normalize' => true, 'declare_strict_types' => false, // Too early to adopt strict types 'dir_constant' => true, + 'doctrine_annotation_array_assignment' => true, + 'doctrine_annotation_braces' => true, + 'doctrine_annotation_indentation' => true, + 'doctrine_annotation_spaces' => true, 'elseif' => true, 'encoding' => true, 'ereg_to_preg' => true, 'full_opening_tag' => true, 'function_declaration' => true, + 'function_to_constant' => true, 'function_typehint_space' => true, 'general_phpdoc_annotation_remove' => false, // No use for that 'hash_to_slash_comment' => true, 'header_comment' => false, // We don't use common header in all our files 'heredoc_to_nowdoc' => false, // Not sure about this one - 'is_null' => false, // Risky 'include' => true, 'indentation_type' => true, - 'line_ending' => true, + 'is_null' => ['use_yoda_style' => false], 'linebreak_after_opening_tag' => true, + 'line_ending' => true, + 'list_syntax' => ['syntax' => 'short'], 'lowercase_cast' => true, 'lowercase_constants' => true, 'lowercase_keywords' => true, + 'magic_constant_casing' => true, 'mb_str_functions' => false, // No, too dangerous to change that 'method_argument_space' => true, 'method_separation' => true, @@ -53,44 +63,47 @@ return PhpCsFixer\Config::create() 'no_blank_lines_after_class_opening' => true, 'no_blank_lines_after_phpdoc' => true, 'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace + 'no_break_comment' => true, 'no_closing_tag' => true, 'no_empty_comment' => true, 'no_empty_phpdoc' => true, 'no_empty_statement' => true, 'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'useTrait', 'curly_brace_block', 'parenthesis_brace_block', 'square_brace_block'], + 'no_homoglyph_names' => true, 'no_leading_import_slash' => true, 'no_leading_namespace_whitespace' => true, 'no_mixed_echo_print' => true, 'no_multiline_whitespace_around_double_arrow' => true, 'no_multiline_whitespace_before_semicolons' => true, + 'non_printable_character' => true, + 'no_null_property_initialization' => true, 'no_php4_constructor' => true, + 'normalize_index_brace' => true, 'no_short_bool_cast' => true, 'no_short_echo_tag' => true, 'no_singleline_whitespace_before_semicolons' => true, 'no_spaces_after_function_name' => true, 'no_spaces_around_offset' => true, 'no_spaces_inside_parenthesis' => true, + 'no_superfluous_elseif' => false, // Might be risky on a huge code base + 'not_operator_with_space' => false, // No we prefer to keep '!' without spaces + 'not_operator_with_successor_space' => false, // idem 'no_trailing_comma_in_list_call' => true, 'no_trailing_comma_in_singleline_array' => true, - 'no_trailing_whitespace' => true, 'no_trailing_whitespace_in_comment' => true, + 'no_trailing_whitespace' => true, 'no_unneeded_control_parentheses' => true, + 'no_unneeded_curly_braces' => true, + 'no_unneeded_final_method' => true, 'no_unreachable_default_argument_value' => true, 'no_unused_imports' => true, 'no_useless_else' => true, 'no_useless_return' => true, 'no_whitespace_before_comma_in_array' => true, 'no_whitespace_in_blank_line' => true, - 'normalize_index_brace' => true, - 'not_operator_with_space' => false, // No we prefer to keep '!' without spaces - 'not_operator_with_successor_space' => false, // idem 'object_operator_without_whitespace' => true, 'ordered_class_elements' => false, // We prefer to keep some freedom 'ordered_imports' => true, - 'php_unit_construct' => true, - 'php_unit_dedicate_assert' => true, - 'php_unit_fqcn_annotation' => true, - 'php_unit_strict' => false, // We sometime actually need assertEquals 'phpdoc_add_missing_param_annotation' => true, 'phpdoc_align' => false, // Waste of time 'phpdoc_annotation_without_dot' => true, @@ -109,8 +122,14 @@ return PhpCsFixer\Config::create() 'phpdoc_summary' => true, 'phpdoc_to_comment' => true, 'phpdoc_trim' => true, + 'phpdoc_types_order' => true, 'phpdoc_types' => true, 'phpdoc_var_without_name' => true, + 'php_unit_construct' => true, + 'php_unit_dedicate_assert' => true, + 'php_unit_fqcn_annotation' => true, + 'php_unit_strict' => false, // We sometime actually need assertEquals + 'php_unit_test_class_requires_covers' => false, // We don't care as much as we should about coverage 'pow_to_exponentiation' => false, 'pre_increment' => true, 'protected_to_private' => true, @@ -128,6 +147,7 @@ return PhpCsFixer\Config::create() 'single_class_element_per_statement' => true, 'single_import_per_statement' => true, 'single_line_after_imports' => true, + 'single_line_comment_style' => true, 'single_quote' => true, 'space_after_semicolon' => true, 'standardize_not_equals' => true, @@ -141,5 +161,7 @@ return PhpCsFixer\Config::create() 'trim_array_spaces' => true, 'unary_operator_spaces' => true, 'visibility_required' => true, + 'void_return' => false, // Cannot use that with PHP 5.6 'whitespace_after_comma_in_array' => true, + 'yoda_style' => false, ]); diff --git a/composer.lock b/composer.lock index 92d9bea9..0a1f0b77 100644 --- a/composer.lock +++ b/composer.lock @@ -56,6 +56,136 @@ } ], "packages-dev": [ + { + "name": "composer/semver", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2016-08-30T16:08:34+00:00" + }, + { + "name": "doctrine/annotations", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "5beebb01b025c94e93686b7a0ed3edae81fe3e7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/5beebb01b025c94e93686b7a0ed3edae81fe3e7f", + "reference": "5beebb01b025c94e93686b7a0ed3edae81fe3e7f", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": "^7.1" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2017-07-22T10:58:02+00:00" + }, { "name": "doctrine/instantiator", "version": "1.0.5", @@ -110,6 +240,60 @@ ], "time": "2015-06-14T21:17:01+00:00" }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09T13:34:57+00:00" + }, { "name": "dompdf/dompdf", "version": "v0.8.0", @@ -174,53 +358,71 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.1.2", + "version": "v2.7.0", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "c7de769d7b44f2c9de68e1f678b65efd8126f60b" + "reference": "e4e93a120117e879cfc1f231fbf29274707cd834" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c7de769d7b44f2c9de68e1f678b65efd8126f60b", - "reference": "c7de769d7b44f2c9de68e1f678b65efd8126f60b", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/e4e93a120117e879cfc1f231fbf29274707cd834", + "reference": "e4e93a120117e879cfc1f231fbf29274707cd834", "shasum": "" }, "require": { + "composer/semver": "^1.4", + "doctrine/annotations": "^1.2", + "ext-json": "*", "ext-tokenizer": "*", - "php": "^5.3.6 || >=7.0 <7.2", - "sebastian/diff": "^1.1", - "symfony/console": "^2.3 || ^3.0", - "symfony/event-dispatcher": "^2.1 || ^3.0", - "symfony/filesystem": "^2.4 || ^3.0", - "symfony/finder": "^2.2 || ^3.0", - "symfony/polyfill-php54": "^1.0", - "symfony/polyfill-php55": "^1.3", - "symfony/polyfill-xml": "^1.3", - "symfony/process": "^2.3 || ^3.0", - "symfony/stopwatch": "^2.5 || ^3.0" + "gecko-packages/gecko-php-unit": "^2.0", + "php": "^5.6 || >=7.0 <7.3", + "php-cs-fixer/diff": "^1.0", + "symfony/console": "^3.2", + "symfony/event-dispatcher": "^3.0", + "symfony/filesystem": "^3.0", + "symfony/finder": "^3.0", + "symfony/options-resolver": "^3.0", + "symfony/polyfill-php70": "^1.0", + "symfony/polyfill-php72": "^1.4", + "symfony/process": "^3.0", + "symfony/stopwatch": "^3.0" }, "conflict": { - "hhvm": "<3.9" + "hhvm": "*" }, "require-dev": { - "gecko-packages/gecko-php-unit": "^2.0", + "johnkary/phpunit-speedtrap": "^1.1", "justinrainbow/json-schema": "^5.0", - "phpunit/phpunit": "^4.5 || ^5.0", + "php-cs-fixer/accessible-object": "^1.0", + "phpunit/phpunit": "^4.8.35 || ^5.4.3", "satooshi/php-coveralls": "^1.0", - "symfony/phpunit-bridge": "^3.2" + "symfony/phpunit-bridge": "^3.2.2" }, "suggest": { - "ext-xml": "For better performance." + "ext-mbstring": "For handling non-UTF8 characters in cache signature.", + "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." }, "bin": [ "php-cs-fixer" ], "type": "application", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, "autoload": { "psr-4": { "PhpCsFixer\\": "src/" - } + }, + "classmap": [ + "tests/Test/Assert/AssertTokensTrait.php", + "tests/Test/AbstractFixerTestCase.php", + "tests/Test/AbstractIntegrationTestCase.php", + "tests/Test/IntegrationCase.php", + "tests/Test/IntegrationCaseFactory.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -237,7 +439,51 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2017-03-15T17:13:07+00:00" + "time": "2017-09-29T15:19:05+00:00" + }, + { + "name": "gecko-packages/gecko-php-unit", + "version": "v2.2", + "source": { + "type": "git", + "url": "https://github.com/GeckoPackages/GeckoPHPUnit.git", + "reference": "ab525fac9a9ffea219687f261b02008b18ebf2d1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GeckoPackages/GeckoPHPUnit/zipball/ab525fac9a9ffea219687f261b02008b18ebf2d1", + "reference": "ab525fac9a9ffea219687f261b02008b18ebf2d1", + "shasum": "" + }, + "require": { + "php": "^5.3.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.4.3" + }, + "suggest": { + "ext-dom": "When testing with xml.", + "ext-libxml": "When testing with xml.", + "phpunit/phpunit": "This is an extension for it so make sure you have it some way." + }, + "type": "library", + "autoload": { + "psr-4": { + "GeckoPackages\\PHPUnit\\": "src/PHPUnit" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Additional PHPUnit asserts and constraints.", + "homepage": "https://github.com/GeckoPackages", + "keywords": [ + "extension", + "filesystem", + "phpunit" + ], + "time": "2017-08-23T07:39:54+00:00" }, { "name": "ircmaxell/password-compat", @@ -515,6 +761,53 @@ "homepage": "https://github.com/PhenX/php-svg-lib", "time": "2016-12-13T20:25:45+00:00" }, + { + "name": "php-cs-fixer/diff", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/diff.git", + "reference": "d068edadcb8f7bc2ea3d3769cdbaf609026ec4f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/d068edadcb8f7bc2ea3d3769cdbaf609026ec4f4", + "reference": "d068edadcb8f7bc2ea3d3769cdbaf609026ec4f4", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.4.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "sebastian/diff v2 backport support for PHP5.6", + "homepage": "https://github.com/PHP-CS-Fixer", + "keywords": [ + "diff" + ], + "time": "2017-09-23T16:02:08+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "1.0", @@ -2120,6 +2413,60 @@ "homepage": "https://symfony.com", "time": "2017-02-21T09:12:04+00:00" }, + { + "name": "symfony/options-resolver", + "version": "v3.3.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "ee4e22978fe885b54ee5da8c7964f0a5301abfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/ee4e22978fe885b54ee5da8c7964f0a5301abfb6", + "reference": "ee4e22978fe885b54ee5da8c7964f0a5301abfb6", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "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 OptionsResolver Component", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "time": "2017-07-29T21:54:42+00:00" + }, { "name": "symfony/polyfill-mbstring", "version": "v1.3.0", @@ -2293,6 +2640,120 @@ ], "time": "2016-11-14T01:06:16+00:00" }, + { + "name": "symfony/polyfill-php70", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "b6482e68974486984f59449ecea1fbbb22ff840f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/b6482e68974486984f59449ecea1fbbb22ff840f", + "reference": "b6482e68974486984f59449ecea1fbbb22ff840f", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2017-06-14T15:44:48+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "8abc9097f5001d310f0edba727469c988acc6ea7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/8abc9097f5001d310f0edba727469c988acc6ea7", + "reference": "8abc9097f5001d310f0edba727469c988acc6ea7", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2017-07-11T13:25:55+00:00" + }, { "name": "symfony/polyfill-xml", "version": "v1.3.0", diff --git a/samples/Basic/13_Calculation.php b/samples/Basic/13_Calculation.php index 4bbc296d..e06477d3 100644 --- a/samples/Basic/13_Calculation.php +++ b/samples/Basic/13_Calculation.php @@ -157,7 +157,7 @@ $spreadsheet->getActiveSheet()->setCellValue('E23', 'Mode of both ranges:') $helper->log('Calculated data'); for ($col = 'B'; $col != 'G'; ++$col) { for ($row = 14; $row <= 41; ++$row) { - if ((!is_null($formula = $spreadsheet->getActiveSheet()->getCell($col . $row)->getValue())) && + if ((($formula = $spreadsheet->getActiveSheet()->getCell($col . $row)->getValue()) !== null) && ($formula[0] == '=')) { $helper->log('Value of ' . $col . $row . ' [' . $formula . ']: ' . $spreadsheet->getActiveSheet()->getCell($col . $row)->getCalculatedValue()); } diff --git a/samples/Basic/13_CalculationCyclicFormulae.php b/samples/Basic/13_CalculationCyclicFormulae.php index 006151bb..6366bcd5 100644 --- a/samples/Basic/13_CalculationCyclicFormulae.php +++ b/samples/Basic/13_CalculationCyclicFormulae.php @@ -22,7 +22,7 @@ Calculation::getInstance($spreadsheet)->cyclicFormulaCount = 100; $helper->log('Calculated data'); for ($row = 1; $row <= 2; ++$row) { for ($col = 'A'; $col != 'C'; ++$col) { - if ((!is_null($formula = $spreadsheet->getActiveSheet()->getCell($col . $row)->getValue())) && + if ((($formula = $spreadsheet->getActiveSheet()->getCell($col . $row)->getValue()) !== null) && ($formula[0] == '=')) { $helper->log('Value of ' . $col . $row . ' [' . $formula . ']: ' . $spreadsheet->getActiveSheet()->getCell($col . $row)->getCalculatedValue()); } diff --git a/samples/Basic/26_Utf8.php b/samples/Basic/26_Utf8.php index 02b60801..89be2c94 100644 --- a/samples/Basic/26_Utf8.php +++ b/samples/Basic/26_Utf8.php @@ -16,7 +16,7 @@ $helper->log('Load Xlsx template file'); $reader = IOFactory::createReader('Xlsx'); $spreadsheet = $reader->load(__DIR__ . '/../templates/26template.xlsx'); -/* at this point, we could do some manipulations with the template, but we skip this step */ +// at this point, we could do some manipulations with the template, but we skip this step $helper->write($spreadsheet, __FILE__, ['Xlsx', 'Xls', 'Html']); // Export to PDF (.pdf) diff --git a/samples/Basic/28_Iterator.php b/samples/Basic/28_Iterator.php index 64981c5c..4aec7a92 100644 --- a/samples/Basic/28_Iterator.php +++ b/samples/Basic/28_Iterator.php @@ -26,7 +26,7 @@ foreach ($spreadsheet->getWorksheetIterator() as $worksheet) { $cellIterator = $row->getCellIterator(); $cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set foreach ($cellIterator as $cell) { - if (!is_null($cell)) { + if ($cell !== null) { $helper->log(' Cell - ' . $cell->getCoordinate() . ' - ' . $cell->getCalculatedValue()); } } diff --git a/samples/Basic/45_Quadratic_equation_solver.php b/samples/Basic/45_Quadratic_equation_solver.php index 11edb856..68efa824 100644 --- a/samples/Basic/45_Quadratic_equation_solver.php +++ b/samples/Basic/45_Quadratic_equation_solver.php @@ -26,7 +26,7 @@ if (isset($_POST['submit'])) { if ($_POST['A'] == 0) { $helper->log('The equation is not quadratic'); } else { - /* Calculate and Display the results * */ + // Calculate and Display the results $helper->log('
Roots:
'); $discriminantFormula = '=POWER(' . $_POST['B'] . ',2) - (4 * ' . $_POST['A'] . ' * ' . $_POST['C'] . ')'; diff --git a/samples/Chart/32_Chart_read_write.php b/samples/Chart/32_Chart_read_write.php index 38169720..ba711c06 100644 --- a/samples/Chart/32_Chart_read_write.php +++ b/samples/Chart/32_Chart_read_write.php @@ -20,6 +20,7 @@ foreach ($inputFileNames as $inputFileName) { if (!file_exists($inputFileName)) { $helper->log('File ' . $inputFileNameShort . ' does not exist'); + continue; } $reader = IOFactory::createReader($inputFileType); @@ -40,7 +41,7 @@ foreach ($inputFileNames as $inputFileName) { natsort($chartNames); foreach ($chartNames as $i => $chartName) { $chart = $worksheet->getChartByName($chartName); - if (!is_null($chart->getTitle())) { + if ($chart->getTitle() !== null) { $caption = '"' . implode(' ', $chart->getTitle()->getCaption()) . '"'; } else { $caption = 'Untitled'; diff --git a/samples/Chart/32_Chart_read_write_HTML.php b/samples/Chart/32_Chart_read_write_HTML.php index df859058..fb2ead68 100644 --- a/samples/Chart/32_Chart_read_write_HTML.php +++ b/samples/Chart/32_Chart_read_write_HTML.php @@ -33,6 +33,7 @@ foreach ($inputFileNames as $inputFileName) { if (!file_exists($inputFileName)) { $helper->log('File ' . $inputFileNameShort . ' does not exist'); + continue; } @@ -54,7 +55,7 @@ foreach ($inputFileNames as $inputFileName) { natsort($chartNames); foreach ($chartNames as $i => $chartName) { $chart = $worksheet->getChartByName($chartName); - if (!is_null($chart->getTitle())) { + if ($chart->getTitle() !== null) { $caption = '"' . implode(' ', $chart->getTitle()->getCaption()) . '"'; } else { $caption = 'Untitled'; diff --git a/samples/Chart/32_Chart_read_write_PDF.php b/samples/Chart/32_Chart_read_write_PDF.php index 446c67ac..c18ab872 100644 --- a/samples/Chart/32_Chart_read_write_PDF.php +++ b/samples/Chart/32_Chart_read_write_PDF.php @@ -41,6 +41,7 @@ foreach ($inputFileNames as $inputFileName) { if (!file_exists($inputFileName)) { $helper->log('File ' . $inputFileNameShort . ' does not exist'); + continue; } @@ -62,7 +63,7 @@ foreach ($inputFileNames as $inputFileName) { natsort($chartNames); foreach ($chartNames as $i => $chartName) { $chart = $worksheet->getChartByName($chartName); - if (!is_null($chart->getTitle())) { + if ($chart->getTitle() !== null) { $caption = '"' . implode(' ', $chart->getTitle()->getCaption()) . '"'; } else { $caption = 'Untitled'; diff --git a/samples/Chart/35_Chart_render.php b/samples/Chart/35_Chart_render.php index 672e8554..4671f21b 100644 --- a/samples/Chart/35_Chart_render.php +++ b/samples/Chart/35_Chart_render.php @@ -33,6 +33,7 @@ foreach ($inputFileNames as $inputFileName) { if (!file_exists($inputFileName)) { $helper->log('File ' . $inputFileNameShort . ' does not exist'); + continue; } @@ -54,7 +55,7 @@ foreach ($inputFileNames as $inputFileName) { natsort($chartNames); foreach ($chartNames as $i => $chartName) { $chart = $worksheet->getChartByName($chartName); - if (!is_null($chart->getTitle())) { + if ($chart->getTitle() !== null) { $caption = '"' . implode(' ', $chart->getTitle()->getCaption()) . '"'; } else { $caption = 'Untitled'; @@ -65,6 +66,7 @@ foreach ($inputFileNames as $inputFileName) { if (file_exists($jpegFile)) { unlink($jpegFile); } + try { $chart->render($jpegFile); } catch (Exception $e) { diff --git a/samples/Header.php b/samples/Header.php index 0b5a4608..bb14f520 100644 --- a/samples/Header.php +++ b/samples/Header.php @@ -49,7 +49,6 @@ if ($helper->isCli()) { } ?>