diff --git a/CHANGELOG.md b/CHANGELOG.md index a98d418..9b07194 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,14 @@ # Change log -## [Unreleased] +### [Unreleased] + +### [2.20.9] - 2024-03-20 - Updated CI actions. - Completed tests. - Added new tests. +- Updated psalm configuration and annotations. +- Removed `$trim` parameter for `createExpression` function. ### [2.20.8] - 2024-01-09 @@ -123,6 +127,7 @@ as possible. See [Security Advisory: ZF2014-01](https://framework.zend.com/secur - Initial release [Unreleased]: https://github.com/laurentmuller/HighchartsBundle/compare/1.7...HEAD +[2.20.9]: https://github.com/laurentmuller/HighchartsBundle/compare/2.20.8...2.20.9 [2.20.8]: https://github.com/laurentmuller/HighchartsBundle/compare/2.20.7...2.20.8 [2.20.7]: https://github.com/laurentmuller/HighchartsBundle/compare/2.20.6...2.20.7 [2.20.6]: https://github.com/laurentmuller/HighchartsBundle/compare/2.20.5...2.20.6 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 16202ea..ae27cb4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,7 @@ One may ask you to [squash your commits](http://gitready.com/advanced/2009/02/10 too. This is used to "clean" your Pull Request before merging it (we don't want commits such as `fix tests`, `fix 2`, `fix 3`, etc.). -Also, while creating your Pull Request on GitHub, you MUST write a description +Also, while creating your Pull Request on GitHub, you MUST write a description, which gives the context and/or explains why you are creating it. Thank you! diff --git a/composer.lock b/composer.lock index 64f1b19..2e03771 100644 --- a/composer.lock +++ b/composer.lock @@ -815,16 +815,16 @@ }, { "name": "symfony/http-kernel", - "version": "v7.0.4", + "version": "v7.0.5", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "065e2234d907c0fc4fc942bf223f7cfc016d0ac7" + "reference": "37c24ca28f65e3121a68f3dd4daeb36fb1fa2a72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/065e2234d907c0fc4fc942bf223f7cfc016d0ac7", - "reference": "065e2234d907c0fc4fc942bf223f7cfc016d0ac7", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/37c24ca28f65e3121a68f3dd4daeb36fb1fa2a72", + "reference": "37c24ca28f65e3121a68f3dd4daeb36fb1fa2a72", "shasum": "" }, "require": { @@ -907,7 +907,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v7.0.4" + "source": "https://github.com/symfony/http-kernel/tree/v7.0.5" }, "funding": [ { @@ -923,7 +923,7 @@ "type": "tidelift" } ], - "time": "2024-02-27T06:35:35+00:00" + "time": "2024-03-04T21:05:24+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1866,16 +1866,16 @@ }, { "name": "composer/pcre", - "version": "3.1.1", + "version": "3.1.3", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9" + "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9", - "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "url": "https://api.github.com/repos/composer/pcre/zipball/5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", + "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", "shasum": "" }, "require": { @@ -1917,7 +1917,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.1" + "source": "https://github.com/composer/pcre/tree/3.1.3" }, "funding": [ { @@ -1933,7 +1933,7 @@ "type": "tidelift" } ], - "time": "2023-10-11T07:11:09+00:00" + "time": "2024-03-19T10:26:25+00:00" }, { "name": "composer/semver", @@ -2330,16 +2330,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.51.0", + "version": "v3.52.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "127fa74f010da99053e3f5b62672615b72dd6efd" + "reference": "6e77207f0d851862ceeb6da63e6e22c01b1587bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/127fa74f010da99053e3f5b62672615b72dd6efd", - "reference": "127fa74f010da99053e3f5b62672615b72dd6efd", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/6e77207f0d851862ceeb6da63e6e22c01b1587bc", + "reference": "6e77207f0d851862ceeb6da63e6e22c01b1587bc", "shasum": "" }, "require": { @@ -2410,7 +2410,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.51.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.52.1" }, "funding": [ { @@ -2418,7 +2418,7 @@ "type": "github" } ], - "time": "2024-02-28T19:50:06+00:00" + "time": "2024-03-19T21:02:43+00:00" }, { "name": "myclabs/deep-copy", @@ -2532,21 +2532,21 @@ }, { "name": "nikic/php-parser", - "version": "v4.18.0", + "version": "v4.19.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999" + "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999", - "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4e1b88d21c69391150ace211e9eaf05810858d0b", + "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.1" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", @@ -2582,9 +2582,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.19.1" }, - "time": "2023-12-10T21:03:43+00:00" + "time": "2024-03-17T08:10:35+00:00" }, { "name": "orklah/psalm-insane-comparison", @@ -3126,16 +3126,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.59", + "version": "1.10.63", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e607609388d3a6d418a50a49f7940e8086798281" + "reference": "ad12836d9ca227301f5fb9960979574ed8628339" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e607609388d3a6d418a50a49f7940e8086798281", - "reference": "e607609388d3a6d418a50a49f7940e8086798281", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ad12836d9ca227301f5fb9960979574ed8628339", + "reference": "ad12836d9ca227301f5fb9960979574ed8628339", "shasum": "" }, "require": { @@ -3184,7 +3184,7 @@ "type": "tidelift" } ], - "time": "2024-02-20T13:59:13+00:00" + "time": "2024-03-18T16:53:53+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -3337,16 +3337,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.12", + "version": "10.1.14", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "842f72662d6b9edda84c4b6f13885fd9cd53dc63" + "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/842f72662d6b9edda84c4b6f13885fd9cd53dc63", - "reference": "842f72662d6b9edda84c4b6f13885fd9cd53dc63", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", + "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", "shasum": "" }, "require": { @@ -3403,7 +3403,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.12" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.14" }, "funding": [ { @@ -3411,7 +3411,7 @@ "type": "github" } ], - "time": "2024-03-02T07:22:05+00:00" + "time": "2024-03-12T15:33:41+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3658,16 +3658,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.11", + "version": "10.5.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "0d968f6323deb3dbfeba5bfd4929b9415eb7a9a4" + "reference": "20a63fc1c6db29b15da3bd02d4b6cf59900088a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0d968f6323deb3dbfeba5bfd4929b9415eb7a9a4", - "reference": "0d968f6323deb3dbfeba5bfd4929b9415eb7a9a4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/20a63fc1c6db29b15da3bd02d4b6cf59900088a7", + "reference": "20a63fc1c6db29b15da3bd02d4b6cf59900088a7", "shasum": "" }, "require": { @@ -3739,7 +3739,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.11" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.13" }, "funding": [ { @@ -3755,7 +3755,7 @@ "type": "tidelift" } ], - "time": "2024-02-25T14:05:00+00:00" + "time": "2024-03-12T15:37:41+00:00" }, { "name": "psalm/plugin-phpunit", @@ -5956,16 +5956,16 @@ }, { "name": "symfony/routing", - "version": "v7.0.3", + "version": "v7.0.5", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "858b26756ffc35a11238b269b484ee3a393a74d3" + "reference": "ba6bf07d43289c6a4b4591ddb75bc3bc5f069c19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/858b26756ffc35a11238b269b484ee3a393a74d3", - "reference": "858b26756ffc35a11238b269b484ee3a393a74d3", + "url": "https://api.github.com/repos/symfony/routing/zipball/ba6bf07d43289c6a4b4591ddb75bc3bc5f069c19", + "reference": "ba6bf07d43289c6a4b4591ddb75bc3bc5f069c19", "shasum": "" }, "require": { @@ -6017,7 +6017,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v7.0.3" + "source": "https://github.com/symfony/routing/tree/v7.0.5" }, "funding": [ { @@ -6033,7 +6033,7 @@ "type": "tidelift" } ], - "time": "2024-01-30T13:55:15+00:00" + "time": "2024-02-27T12:34:35+00:00" }, { "name": "symfony/stopwatch", @@ -6235,16 +6235,16 @@ }, { "name": "vimeo/psalm", - "version": "5.22.2", + "version": "5.23.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "d768d914152dbbf3486c36398802f74e80cfde48" + "reference": "8471a896ccea3526b26d082f4461eeea467f10a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/d768d914152dbbf3486c36398802f74e80cfde48", - "reference": "d768d914152dbbf3486c36398802f74e80cfde48", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/8471a896ccea3526b26d082f4461eeea467f10a4", + "reference": "8471a896ccea3526b26d082f4461eeea467f10a4", "shasum": "" }, "require": { @@ -6341,7 +6341,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2024-02-22T23:39:07+00:00" + "time": "2024-03-11T20:33:46+00:00" }, { "name": "webmozart/assert", diff --git a/psalm.xml b/psalm.xml index 246285d..5c4c4e7 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,30 +1,18 @@ - + - - + + - + - - - - - - - - - - diff --git a/rector.php b/rector.php index 9f90c0b..c01a646 100644 --- a/rector.php +++ b/rector.php @@ -19,26 +19,18 @@ use Rector\Symfony\Set\SymfonySetList; use Rector\Symfony\Set\TwigSetList; -return static function (RectorConfig $rectorConfig): void { - // bootstrap files - $rectorConfig->bootstrapFiles([__DIR__ . '/vendor/autoload.php']); - - // paths - $rectorConfig->paths([ +return RectorConfig::configure() + ->withBootstrapFiles([ + __DIR__ . '/vendor/autoload.php', + ])->withPaths([ __DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/rector.php', - ]); - - // rules to skip - $rectorConfig->skip([ + ])->withSkip([ AddSeeTestAnnotationRector::class, PreferPHPUnitThisCallRector::class, DisallowedEmptyRuleFixerRector::class, - ]); - - // rules to apply - $rectorConfig->sets([ + ])->withSets([ // global SetList::PHP_82, SetList::CODE_QUALITY, @@ -55,4 +47,3 @@ TwigSetList::TWIG_240, TwigSetList::TWIG_UNDERSCORE_TO_NAMESPACE, ]); -}; diff --git a/resources/doc/cookbook.md b/resources/doc/cookbook.md index f51a3e5..41fa2f0 100644 --- a/resources/doc/cookbook.md +++ b/resources/doc/cookbook.md @@ -2,7 +2,8 @@ ## Pie chart with legend -This is a simple recipe to re-create the pie-chart demo with legend at [highcharts.com/demo/pie-legend](https://www.highcharts.com/demo/pie-legend) +This is a simple recipe to re-create the pie-chart demo with legend at +[highcharts.com/demo/pie-legend](https://www.highcharts.com/demo/pie-legend) ```php $chart = new Highchart(); @@ -31,7 +32,8 @@ $chart->series([ ## Pie chart with Drilldown -This is a simple recipe to re-create a chart like the drilldown pie-chart demo at [highcharts.com/demo/pie-drilldown](https://www.highcharts.com/demo/pie-drilldown) +This is a simple recipe to re-create a chart like the drilldown pie-chart demo +at [highcharts.com/demo/pie-drilldown](https://www.highcharts.com/demo/pie-drilldown) ```php $chart = new Highchart(); @@ -104,7 +106,8 @@ $chart->drilldown->series($drilldown); ## Multi-axes plot -This is a simple recipe for creating a plot with multiple y-axes, like the [highcharts demo](https://www.highcharts.com/demo/combo-multi-axes) +This is a simple recipe for creating a plot with multiple y-axes, like the +[highcharts demo](https://www.highcharts.com/demo/combo-multi-axes) ```php $series = [ diff --git a/resources/doc/installation.md b/resources/doc/installation.md index 6bd98f9..5d5e127 100644 --- a/resources/doc/installation.md +++ b/resources/doc/installation.md @@ -6,9 +6,10 @@ composer require laurentmuller/highcharts-bundle ``` - [Install Composer](https://getcomposer.org/download/) if you don't have it already present on your system. Depending - on how you install, you may end up with a `composer.phar` file in your directory. In that case, no worries! Your - command line in that case is: + [Install Composer](https://getcomposer.org/download/) if you don't have it + already present on your system. Depending on how you install, you may end up + with a `composer.phar` file in your directory. In that case, no worries! + Your command line in that case is: ```console php composer.phar require laurentmuller/highcharts-bundle diff --git a/resources/doc/usage.md b/resources/doc/usage.md index e305462..8e49f76 100644 --- a/resources/doc/usage.md +++ b/resources/doc/usage.md @@ -44,8 +44,9 @@ In your template ... ## Use highcharts with mootools -If you'd like to use mootools instead of jquery to render your charts, just load the mootools adapter use the second -argument of the twig extension like this +If you'd like to use mootools instead of jquery to render your charts, just +load the mootools adapter use the second argument of the twig extension like +this ```html @@ -62,8 +63,9 @@ argument of the twig extension like this ## Use highcharts without a jquery or mootools wrapper -It is also possible to render your highcharts code without a jquery or mootools wrapper. This is useful when you want -control how and when the chart is loaded or when integrating with existing code. +It is also possible to render your highcharts code without a jquery or mootools +wrapper. This is useful when you want control how and when the chart is loaded +or when integrating with existing code. ```html @@ -80,7 +82,8 @@ control how and when the chart is loaded or when integrating with existing code. ## Use a Javascript anonymous function -There are several use case where you need to define a js function, let's see how to use one for a tooltip formatter +There are several use case where you need to define a js function, let's see +how to use one for a tooltip formatter ```php // ... diff --git a/src/Highcharts/AbstractChart.php b/src/Highcharts/AbstractChart.php index ead9456..01bd6d5 100644 --- a/src/Highcharts/AbstractChart.php +++ b/src/Highcharts/AbstractChart.php @@ -17,6 +17,8 @@ /** * Abstract chart. + * + * @psalm-suppress PropertyNotSetInConstructor */ abstract class AbstractChart implements ChartInterface { @@ -84,15 +86,13 @@ public function __call(string $name, mixed $value): static * Create an expression. * * @param string $expression the expression to represent - * @param bool $trim true to trim whitespaces and new lines * * @psalm-api */ - public static function createExpression(string $expression, bool $trim = true): Expr + public static function createExpression(string $expression): Expr { - if ($trim) { - $expression = (string) \preg_replace('/\s+/', ' ', \trim($expression)); - } + // remove consecutive spaces + $expression = (string) \preg_replace('/\s+/', ' ', \trim($expression)); return new Expr($expression); } diff --git a/src/Highcharts/Highchart.php b/src/Highcharts/Highchart.php index 14fe3bc..4ff04e0 100644 --- a/src/Highcharts/Highchart.php +++ b/src/Highcharts/Highchart.php @@ -16,6 +16,8 @@ * Highchart chart. * * See documentation at https://www.highcharts.com/products/highcharts/. + * + * @psalm-suppress PropertyNotSetInConstructor */ class Highchart extends AbstractChart { diff --git a/src/Highcharts/Highstock.php b/src/Highcharts/Highstock.php index a38c973..79498a1 100644 --- a/src/Highcharts/Highstock.php +++ b/src/Highcharts/Highstock.php @@ -16,6 +16,8 @@ * Highstock chart. * * See documentation at https://www.highcharts.com/products/stock/. + * + * @psalm-suppress PropertyNotSetInConstructor */ class Highstock extends AbstractChart { diff --git a/tests/AbstractChartTestCase.php b/tests/AbstractChartTestCase.php index 8021609..79dbe59 100644 --- a/tests/AbstractChartTestCase.php +++ b/tests/AbstractChartTestCase.php @@ -15,7 +15,7 @@ use HighchartsBundle\Highcharts\ChartInterface; use PHPUnit\Framework\TestCase; -class AbstractChartTestCase extends TestCase +abstract class AbstractChartTestCase extends TestCase { /** * @psalm-param ChartInterface::ENGINE_* $engine diff --git a/tests/Highstock/RangeSelectorTest.php b/tests/Highstock/RangeSelectorTest.php index 07f920e..11285d4 100644 --- a/tests/Highstock/RangeSelectorTest.php +++ b/tests/Highstock/RangeSelectorTest.php @@ -31,8 +31,8 @@ public function testButtons(): void { $buttons = [[ 'type' => 'month', - 'count' => 3, - 'text' => '3m', + 'count' => 3, + 'text' => '3m', ]]; self::assertNotNull($this->chart); self::assertNotNull($this->range);