diff --git a/composer.json b/composer.json index 2e96cec0..114ed3cc 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,8 @@ "roave/security-advisories" : "dev-latest", "jbzoo/toolbox-dev" : "^7.1.0", "jbzoo/codestyle" : "^7.1.2", - "fakerphp/faker" : "^1.23.1" + "fakerphp/faker" : "^1.23.1", + "phpstan/phpstan" : "1.11.1" }, "bin" : ["csv-blueprint"], diff --git a/composer.lock b/composer.lock index e85859ac..267725da 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "53b2958351d14f8ce7be516a93984768", + "content-hash": "9f6c7988f78a15db708f9b4a0f0608c6", "packages": [ { "name": "bluepsyduck/symfony-process-manager", @@ -669,40 +669,39 @@ }, { "name": "league/csv", - "version": "9.15.0", + "version": "9.16.0", "source": { "type": "git", "url": "https://github.com/thephpleague/csv.git", - "reference": "fa7e2441c0bc9b2360f4314fd6c954f7ff40d435" + "reference": "998280c6c34bd67d8125fdc8b45bae28d761b440" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/csv/zipball/fa7e2441c0bc9b2360f4314fd6c954f7ff40d435", - "reference": "fa7e2441c0bc9b2360f4314fd6c954f7ff40d435", + "url": "https://api.github.com/repos/thephpleague/csv/zipball/998280c6c34bd67d8125fdc8b45bae28d761b440", + "reference": "998280c6c34bd67d8125fdc8b45bae28d761b440", "shasum": "" }, "require": { "ext-filter": "*", - "ext-json": "*", - "ext-mbstring": "*", "php": "^8.1.2" }, "require-dev": { - "doctrine/collections": "^2.1.4", + "doctrine/collections": "^2.2.2", "ext-dom": "*", "ext-xdebug": "*", - "friendsofphp/php-cs-fixer": "^v3.22.0", + "friendsofphp/php-cs-fixer": "^3.57.1", "phpbench/phpbench": "^1.2.15", - "phpstan/phpstan": "^1.10.57", - "phpstan/phpstan-deprecation-rules": "^1.1.4", - "phpstan/phpstan-phpunit": "^1.3.15", - "phpstan/phpstan-strict-rules": "^1.5.2", - "phpunit/phpunit": "^10.5.9", - "symfony/var-dumper": "^6.4.2" + "phpstan/phpstan": "^1.11.1", + "phpstan/phpstan-deprecation-rules": "^1.2.0", + "phpstan/phpstan-phpunit": "^1.4.0", + "phpstan/phpstan-strict-rules": "^1.6.0", + "phpunit/phpunit": "^10.5.16 || ^11.1.3", + "symfony/var-dumper": "^6.4.6 || ^7.0.7" }, "suggest": { "ext-dom": "Required to use the XMLConverter and the HTMLConverter classes", - "ext-iconv": "Needed to ease transcoding CSV using iconv stream filters" + "ext-iconv": "Needed to ease transcoding CSV using iconv stream filters", + "ext-mbstring": "Needed to ease transcoding CSV using mb stream filters" }, "type": "library", "extra": { @@ -754,7 +753,7 @@ "type": "github" } ], - "time": "2024-02-20T20:00:00+00:00" + "time": "2024-05-24T11:04:54+00:00" }, { "name": "markrogoyski/math-php", @@ -2953,16 +2952,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.57.1", + "version": "v3.57.2", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "3f7efe667a8c9818aacceee478add7c0fc24cb21" + "reference": "22f7f3145606df92b02fb1bd22c30abfce956d3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/3f7efe667a8c9818aacceee478add7c0fc24cb21", - "reference": "3f7efe667a8c9818aacceee478add7c0fc24cb21", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/22f7f3145606df92b02fb1bd22c30abfce956d3c", + "reference": "22f7f3145606df92b02fb1bd22c30abfce956d3c", "shasum": "" }, "require": { @@ -3041,7 +3040,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.57.1" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.57.2" }, "funding": [ { @@ -3049,7 +3048,7 @@ "type": "github" } ], - "time": "2024-05-15T22:01:07+00:00" + "time": "2024-05-20T20:41:57+00:00" }, { "name": "guzzlehttp/guzzle", @@ -4434,16 +4433,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.4.0", + "version": "5.4.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a" + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/298d2febfe79d03fe714eb871d5538da55205b1a", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", "shasum": "" }, "require": { @@ -4492,9 +4491,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" }, - "time": "2024-04-09T21:13:58+00:00" + "time": "2024-05-21T05:55:05+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -5283,23 +5282,24 @@ }, { "name": "povils/phpmnd", - "version": "v3.4.1", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/povils/phpmnd.git", - "reference": "1f3eb869e3a2c4fddbe0995fddd97b75caa2c203" + "reference": "dce72f751b49d778cba525c423069919c0f10b33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/povils/phpmnd/zipball/1f3eb869e3a2c4fddbe0995fddd97b75caa2c203", - "reference": "1f3eb869e3a2c4fddbe0995fddd97b75caa2c203", + "url": "https://api.github.com/repos/povils/phpmnd/zipball/dce72f751b49d778cba525c423069919c0f10b33", + "reference": "dce72f751b49d778cba525c423069919c0f10b33", "shasum": "" }, "require": { + "composer-runtime-api": "^2.0", "nikic/php-parser": "^4.18 || ^5.0", "php": "^7.4 || ^8.0", "php-parallel-lint/php-console-highlighter": "^1.0", - "phpunit/php-timer": "^2.0||^3.0||^4.0||^5.0||^6.0", + "phpunit/php-timer": "^2.0 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", "symfony/console": "^4.4 || ^5.0 || ^6.0 || ^7.0", "symfony/finder": "^4.4 || ^5.0 || ^6.0 || ^7.0" }, @@ -5329,9 +5329,9 @@ "description": "A tool to detect Magic numbers in codebase", "support": { "issues": "https://github.com/povils/phpmnd/issues", - "source": "https://github.com/povils/phpmnd/tree/v3.4.1" + "source": "https://github.com/povils/phpmnd/tree/v3.5.0" }, - "time": "2024-03-02T17:53:44+00:00" + "time": "2024-05-22T08:10:02+00:00" }, { "name": "psr/event-dispatcher", @@ -5888,16 +5888,16 @@ }, { "name": "react/promise", - "version": "v3.1.0", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/reactphp/promise.git", - "reference": "e563d55d1641de1dea9f5e84f3cccc66d2bfe02c" + "reference": "8a164643313c71354582dc850b42b33fa12a4b63" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/e563d55d1641de1dea9f5e84f3cccc66d2bfe02c", - "reference": "e563d55d1641de1dea9f5e84f3cccc66d2bfe02c", + "url": "https://api.github.com/repos/reactphp/promise/zipball/8a164643313c71354582dc850b42b33fa12a4b63", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63", "shasum": "" }, "require": { @@ -5949,7 +5949,7 @@ ], "support": { "issues": "https://github.com/reactphp/promise/issues", - "source": "https://github.com/reactphp/promise/tree/v3.1.0" + "source": "https://github.com/reactphp/promise/tree/v3.2.0" }, "funding": [ { @@ -5957,7 +5957,7 @@ "type": "open_collective" } ], - "time": "2023-11-16T16:21:57+00:00" + "time": "2024-05-24T10:39:05+00:00" }, { "name": "react/socket", @@ -6123,12 +6123,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "4a1ce99ead02e286f024fc7d032c7233ac01091b" + "reference": "0ec6bad5f4523eda2514e89d5ea48cde6ebe7f99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/4a1ce99ead02e286f024fc7d032c7233ac01091b", - "reference": "4a1ce99ead02e286f024fc7d032c7233ac01091b", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/0ec6bad5f4523eda2514e89d5ea48cde6ebe7f99", + "reference": "0ec6bad5f4523eda2514e89d5ea48cde6ebe7f99", "shasum": "" }, "conflict": { @@ -6696,7 +6696,7 @@ "sylius/grid-bundle": "<1.10.1", "sylius/paypal-plugin": ">=1,<1.2.4|>=1.3,<1.3.1", "sylius/resource-bundle": ">=1,<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4", - "sylius/sylius": "<1.12.16|>=1.13.0.0-alpha1,<1.13.1", + "sylius/sylius": "<1.9.10|>=1.10,<1.10.11|>=1.11,<1.11.2|>=1.12.0.0-alpha1,<1.12.16|>=1.13.0.0-alpha1,<1.13.1", "symbiote/silverstripe-multivaluefield": ">=3,<3.0.99", "symbiote/silverstripe-queuedjobs": ">=3,<3.0.2|>=3.1,<3.1.4|>=4,<4.0.7|>=4.1,<4.1.2|>=4.2,<4.2.4|>=4.3,<4.3.3|>=4.4,<4.4.3|>=4.5,<4.5.1|>=4.6,<4.6.4", "symbiote/silverstripe-seed": "<6.0.3", @@ -6785,12 +6785,14 @@ "uvdesk/core-framework": "<=1.1.1", "vanilla/safecurl": "<0.9.2", "verbb/comments": "<1.5.5", + "verbb/formie": "<2.1.6", "verbb/image-resizer": "<2.0.9", "verbb/knock-knock": "<1.2.8", "verot/class.upload.php": "<=2.1.6", "villagedefrance/opencart-overclocked": "<=1.11.1", "vova07/yii2-fileapi-widget": "<0.1.9", "vrana/adminer": "<4.8.1", + "vufind/vufind": ">=2,<9.1.1", "waldhacker/hcaptcha": "<2.1.2", "wallabag/tcpdf": "<6.2.22", "wallabag/wallabag": "<2.6.7", @@ -6816,7 +6818,7 @@ "wpanel/wpanel4-cms": "<=4.3.1", "wpcloud/wp-stateless": "<3.2", "wpglobus/wpglobus": "<=1.9.6", - "wwbn/avideo": "<=12.4", + "wwbn/avideo": "<14.3", "xataface/xataface": "<3", "xpressengine/xpressengine": "<3.0.15", "yab/quarx": "<2.4.5", @@ -6911,7 +6913,7 @@ "type": "tidelift" } ], - "time": "2024-05-18T00:15:00+00:00" + "time": "2024-05-23T15:04:32+00:00" }, { "name": "sabre/event", @@ -8012,16 +8014,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.9.2", + "version": "3.10.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8f90f7a53ce271935282967f53d0894f8f1ff877", + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877", "shasum": "" }, "require": { @@ -8088,7 +8090,7 @@ "type": "open_collective" } ], - "time": "2024-04-23T20:25:34+00:00" + "time": "2024-05-22T21:24:41+00:00" }, { "name": "symfony/config", diff --git a/phpstan.neon b/phpstan.neon index 24cda513..5e1516a5 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -16,5 +16,6 @@ includes: parameters: level: max checkExplicitMixed: false - checkMissingIterableValueType: false reportUnmatchedIgnoredErrors: false + ignoreErrors: + - identifier: missingType.iterableValue diff --git a/src/Csv/CsvFile.php b/src/Csv/CsvFile.php index 94f9ec1c..8705ff8e 100644 --- a/src/Csv/CsvFile.php +++ b/src/Csv/CsvFile.php @@ -28,7 +28,10 @@ final class CsvFile { private string $csvFilename; + + /** @phpstan-ignore-next-line */ private LeagueReader $reader; + private Schema $schema; private bool $isEmpty; private ?array $header = null; @@ -99,7 +102,7 @@ public function getRecords(?int $offset = null): \Iterator * @param int $limit the maximum number of records to retrieve in the chunk * @return TabularDataReader the TabularDataReader object containing the records */ - public function getRecordsChunk(int $offset = 0, int $limit = -1): TabularDataReader + public function getRecordsChunk(int $offset = 0, int $limit = -1): TabularDataReader // @phpstan-ignore-line { return Statement::create(null, $offset, $limit)->process($this->reader, []); // No headers is required! } @@ -192,7 +195,7 @@ public function getColumnsMappedByHeaderNamesOnly(?ErrorSuite $errors = null): a return \array_map(static fn (Column $column) => $column->getName(), $this->getColumnsMappedByHeader($errors)); } - private function prepareReader(): LeagueReader + private function prepareReader(): LeagueReader // @phpstan-ignore-line { $reader = LeagueReader::createFromPath($this->csvFilename) ->setDelimiter($this->schema->getCsvDelimiter())