From b5e120f03f0af257ec1fd225502a71d2cc338270 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Wed, 11 Dec 2024 14:20:30 -0600 Subject: [PATCH 01/19] refactor: use v3.0.0 of neoncitylights/media-type (wip) --- .github/dependabot.yml | 6 - CHANGELOG.md | 3 + composer.json | 2 +- composer.lock | 297 ++++++++++++++++++++++-------------- src/DataUrlParser.php | 36 ++++- tests/DataUrlParserTest.php | 85 ----------- tests/DataUrlTest.php | 5 +- 7 files changed, 220 insertions(+), 214 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 tests/DataUrlParserTest.php diff --git a/.github/dependabot.yml b/.github/dependabot.yml index bd149a3..c724c18 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,9 +11,6 @@ updates: interval: "weekly" commit-message: prefix: "chore(deps/composer):" - labels: - - "t-dependencies" - - "pkg-composer" groups: mediawiki: patterns: @@ -33,7 +30,4 @@ updates: interval: "weekly" commit-message: prefix: "chore(deps/actions):" - labels: - - "t-dependencies" - - "pkg-gh-actions" open-pull-requests-limit: 4 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1512c42 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +# Changelog + +## Unreleased diff --git a/composer.json b/composer.json index b27aa64..71ac994 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ } }, "require": { - "neoncitylights/media-type": "^1.0", + "neoncitylights/media-type": "^3.0.0", "php": ">= 8.1" }, "require-dev": { diff --git a/composer.lock b/composer.lock index a0e098f..d918fbc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,28 +4,33 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "18d31557766dee77a8393592798a0a16", + "content-hash": "dcec526db95ae5957268be93553fa2cc", "packages": [ { "name": "neoncitylights/media-type", - "version": "v1.0.0", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/neoncitylights/php-media-type.git", - "reference": "ee955fc1e9ec956e94089cabf2fb913b801f9641" + "reference": "94e102d5a996d4ac9f8f7cf84da5cd3b65040cda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/neoncitylights/php-media-type/zipball/ee955fc1e9ec956e94089cabf2fb913b801f9641", - "reference": "ee955fc1e9ec956e94089cabf2fb913b801f9641", + "url": "https://api.github.com/repos/neoncitylights/php-media-type/zipball/94e102d5a996d4ac9f8f7cf84da5cd3b65040cda", + "reference": "94e102d5a996d4ac9f8f7cf84da5cd3b65040cda", "shasum": "" }, + "require": { + "ext-intl": "*", + "php": ">=8.2", + "wikimedia/assert": "^0.5.1" + }, "require-dev": { - "mediawiki/mediawiki-codesniffer": "32.0.0", - "mediawiki/minus-x": "1.1.0", - "php-parallel-lint/php-console-highlighter": "0.5.0", - "php-parallel-lint/php-parallel-lint": "1.2.0", - "phpunit/phpunit": "^9.4" + "mediawiki/mediawiki-codesniffer": "43.0.0", + "mediawiki/minus-x": "1.1.1", + "php-parallel-lint/php-console-highlighter": "1.0.0", + "php-parallel-lint/php-parallel-lint": "1.4.0", + "phpunit/phpunit": "11.0.8" }, "type": "library", "autoload": { @@ -42,12 +47,76 @@ "name": "Samantha Nguyen" } ], - "description": "Allows working with INAN media types as entities in PHP", + "description": "Allows working with IANA media types as entities in PHP", "support": { "issues": "https://github.com/neoncitylights/php-media-type/issues", - "source": "https://github.com/neoncitylights/php-media-type/tree/v1.0.0" + "source": "https://github.com/neoncitylights/php-media-type/tree/v3.0.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/neoncitylights", + "type": "github" + } + ], + "time": "2024-04-04T01:23:27+00:00" + }, + { + "name": "wikimedia/assert", + "version": "v0.5.1", + "source": { + "type": "git", + "url": "https://github.com/wikimedia/Assert.git", + "reference": "27c983fddac1197dc37f6a7cec00fc02861529cd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wikimedia/Assert/zipball/27c983fddac1197dc37f6a7cec00fc02861529cd", + "reference": "27c983fddac1197dc37f6a7cec00fc02861529cd", + "shasum": "" + }, + "require": { + "php": ">=7.2.9" + }, + "require-dev": { + "mediawiki/mediawiki-codesniffer": "38.0.0", + "mediawiki/minus-x": "1.1.1", + "ockcyp/covers-validator": "1.3.3", + "php-parallel-lint/php-console-highlighter": "0.5.0", + "php-parallel-lint/php-parallel-lint": "1.3.1", + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Wikimedia\\Assert\\": "src/" + } }, - "time": "2020-10-28T19:03:15+00:00" + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Kinzler" + }, + { + "name": "Thiemo Kreuz" + } + ], + "description": "Provides runtime assertions", + "homepage": "https://github.com/wikimedia/Assert", + "keywords": [ + "assert", + "assertions", + "php", + "postcondition", + "precondition", + "qa" + ], + "support": { + "source": "https://github.com/wikimedia/Assert/tree/v0.5.1" + }, + "time": "2021-12-21T11:46:59+00:00" } ], "packages-dev": [ @@ -465,16 +534,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", "shasum": "" }, "require": { @@ -482,11 +551,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -512,7 +582,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" }, "funding": [ { @@ -520,20 +590,20 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2024-11-08T17:47:46+00:00" }, { "name": "nikic/php-parser", - "version": "v5.0.2", + "version": "v5.3.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", "shasum": "" }, "require": { @@ -544,7 +614,7 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -576,9 +646,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" }, - "time": "2024-03-05T20:51:40+00:00" + "time": "2024-10-08T18:51:32+00:00" }, { "name": "ockcyp/covers-validator", @@ -1083,35 +1153,35 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.31", + "version": "9.2.32", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.18 || ^5.0", + "nikic/php-parser": "^4.19.1 || ^5.1.0", "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-text-template": "^2.0.4", + "sebastian/code-unit-reverse-lookup": "^2.0.3", + "sebastian/complexity": "^2.0.3", + "sebastian/environment": "^5.1.5", + "sebastian/lines-of-code": "^1.0.4", + "sebastian/version": "^3.0.2", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.6" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -1120,7 +1190,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "9.2.x-dev" } }, "autoload": { @@ -1149,7 +1219,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/9.2.31" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" }, "funding": [ { @@ -1157,7 +1227,7 @@ "type": "github" } ], - "time": "2024-03-02T06:37:42+00:00" + "time": "2024-08-22T04:23:01+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2601,16 +2671,16 @@ }, { "name": "symfony/console", - "version": "v6.4.7", + "version": "v6.4.15", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f" + "reference": "f1fc6f47283e27336e7cebb9e8946c8de7bff9bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", - "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", + "url": "https://api.github.com/repos/symfony/console/zipball/f1fc6f47283e27336e7cebb9e8946c8de7bff9bd", + "reference": "f1fc6f47283e27336e7cebb9e8946c8de7bff9bd", "shasum": "" }, "require": { @@ -2675,7 +2745,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.7" + "source": "https://github.com/symfony/console/tree/v6.4.15" }, "funding": [ { @@ -2691,20 +2761,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-11-06T14:19:14+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.5.0", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", "shasum": "" }, "require": { @@ -2742,7 +2812,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1" }, "funding": [ { @@ -2758,24 +2828,24 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.29.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-ctype": "*" @@ -2786,8 +2856,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -2821,7 +2891,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" }, "funding": [ { @@ -2837,24 +2907,24 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.29.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" @@ -2862,8 +2932,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -2899,7 +2969,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" }, "funding": [ { @@ -2915,24 +2985,24 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.29.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" + "reference": "3833d7255cc303546435cb650316bff708a1c75c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" @@ -2940,8 +3010,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -2980,7 +3050,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" }, "funding": [ { @@ -2996,24 +3066,24 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.29.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -3024,8 +3094,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3060,7 +3130,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" }, "funding": [ { @@ -3076,7 +3146,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php80", @@ -3098,8 +3168,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3160,16 +3230,16 @@ }, { "name": "symfony/service-contracts", - "version": "v3.5.0", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f" + "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", - "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e53260aabf78fb3d63f8d79d69ece59f80d5eda0", + "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0", "shasum": "" }, "require": { @@ -3223,7 +3293,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.5.1" }, "funding": [ { @@ -3239,24 +3309,24 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/string", - "version": "v6.4.7", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69" + "reference": "446e0d146f991dde3e73f45f2c97a9faad773c82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ffeb9591c61f65a68d47f77d12b83fa530227a69", - "reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69", + "url": "https://api.github.com/repos/symfony/string/zipball/446e0d146f991dde3e73f45f2c97a9faad773c82", + "reference": "446e0d146f991dde3e73f45f2c97a9faad773c82", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", @@ -3266,11 +3336,12 @@ "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/error-handler": "^5.4|^6.0|^7.0", - "symfony/http-client": "^5.4|^6.0|^7.0", - "symfony/intl": "^6.2|^7.0", + "symfony/emoji": "^7.1", + "symfony/error-handler": "^6.4|^7.0", + "symfony/http-client": "^6.4|^7.0", + "symfony/intl": "^6.4|^7.0", "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^5.4|^6.0|^7.0" + "symfony/var-exporter": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -3309,7 +3380,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.7" + "source": "https://github.com/symfony/string/tree/v7.2.0" }, "funding": [ { @@ -3325,7 +3396,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-11-13T13:31:26+00:00" }, { "name": "theseer/tokenizer", @@ -3380,12 +3451,12 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">= 8.1" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/src/DataUrlParser.php b/src/DataUrlParser.php index 99422d5..dc5b1a2 100644 --- a/src/DataUrlParser.php +++ b/src/DataUrlParser.php @@ -3,6 +3,8 @@ namespace Neoncitylights\DataUrl; use Neoncitylights\MediaType\MediaType; +use Neoncitylights\MediaType\MediaTypeParser; +use Neoncitylights\MediaType\MediaTypeParserException; use function is_int; use function strlen; use function strrpos; @@ -21,12 +23,32 @@ * @license MIT */ class DataUrlParser { + private MediaTypeParser $mediaTypeParser; + + public function __construct( ?MediaTypeParser $mediaTypeParser ) { + $this->mediaTypeParser = $mediaTypeParser ?? new MediaTypeParser(); + } + + public function parseOrNull( string $dataUrl ): DataUrl|null { + try { + return $this->parseOrThrow( $dataUrl ); + } catch ( InvalidDataUrlSyntaxException | MediaTypeParserException $e ) { + return null; + } + } + /** - * @param string $dataUrl - * @return DataUrl - * @throws InvalidDataUrlSyntaxException + * @throws InvalidDataUrlSyntaxException|MediaTypeParserException + * @deprecated Call parseOrThrow() instead. */ public function parse( string $dataUrl ): DataUrl { + return $this->parseOrThrow( $dataUrl ); + } + + /** + * @throws InvalidDataUrlSyntaxException|MediaTypeParserException + */ + public function parseOrThrow( string $dataUrl ): DataUrl { $trimmedDataUrl = trim( $dataUrl ); if ( empty( $trimmedDataUrl ) ) { @@ -62,8 +84,7 @@ public function parse( string $dataUrl ): DataUrl { } /** - * @param string $content - * @return MediaType + * @throws MediaTypeParserException */ private function parseMediaTypeAndBase64( string $content ): MediaType { $base64ExtIndex = strrpos( $content, Token::Base64Ext->value ); @@ -76,14 +97,13 @@ private function parseMediaTypeAndBase64( string $content ): MediaType { } /** - * @param string $mediaTypeString - * @return MediaType + * @throws MediaTypeParserException */ private function getMediaType( string $mediaTypeString ): MediaType { if ( empty( $mediaTypeString ) ) { return new MediaType( 'text', 'plain', [ 'charset' => 'US-ASCII', ] ); } - return MediaType::newFromString( $mediaTypeString ); + return $this->mediaTypeParser->parse( $mediaTypeString ); } } diff --git a/tests/DataUrlParserTest.php b/tests/DataUrlParserTest.php deleted file mode 100644 index b35b854..0000000 --- a/tests/DataUrlParserTest.php +++ /dev/null @@ -1,85 +0,0 @@ -assertEqualsCanonicalizing( - $expectedDataUrlObject, - $parser->parse( $validDataUrl ) - ); - } - - /** - * @covers ::parse - * @covers \Neoncitylights\DataUrl\InvalidDataUrlSyntaxException - * @dataProvider provideInvalidDataUrls - */ - public function testParseInvalidDataUrls( $invalidDataUrl ) { - $this->expectException( InvalidDataUrlSyntaxException::class ); - - $parser = new DataUrlParser(); - $parser->parse( $invalidDataUrl ); - } - - public function provideValidTextBasedDataUrls() { - yield [ - new DataUrl( - new MediaType( 'text', 'plain', [ 'charset' => 'US-ASCII' ] ), - '' - ), - 'data:,', - ]; - yield [ - new DataUrl( - new MediaType( 'text', 'plain', [ 'charset' => 'US-ASCII' ] ), - '' - ), - " \n\r\t\0\x0Bdata:, \n\r\t\0\x0B", - ]; - yield [ - new DataUrl( - new MediaType( 'text', 'plain', [] ), - 'SGVsbG8sIFdvcmxkIQ==' - ), - "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", - ]; - yield [ - new DataUrl( - new MediaType( - 'text', 'plain', - [ 'charset' => 'UTF-8' ] - ), - 'VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' - ), - 'data:text/plain;charset=UTF-8;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' - ]; - } - - public function provideInvalidDataUrls() { - yield [ '' ]; - yield [ ' \n\r\t\0\x0B' ]; - yield [ 'foo' ]; - yield [ 'data:test' ]; - } -} diff --git a/tests/DataUrlTest.php b/tests/DataUrlTest.php index 0036659..8fc4645 100644 --- a/tests/DataUrlTest.php +++ b/tests/DataUrlTest.php @@ -5,6 +5,7 @@ use Neoncitylights\DataUrl\DataUrl; use Neoncitylights\DataUrl\DataUrlParser; use Neoncitylights\MediaType\MediaType; +use Neoncitylights\MediaType\MediaTypeParser; use PHPUnit\Framework\TestCase; /** @@ -17,7 +18,9 @@ class DataUrlTest extends TestCase { private static $dataUrlParser; public static function setUpBeforeClass(): void { - self::$dataUrlParser = new DataUrlParser(); + self::$dataUrlParser = new DataUrlParser( + new MediaTypeParser() + ); } public static function tearDownAfterClass(): void { From 0affd7f76967961457fd4544b51417cb690c1ade Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Wed, 11 Dec 2024 14:23:04 -0600 Subject: [PATCH 02/19] bump minimum version to 8.2, also run against 8.3 + 8.4 neoncitylights/media-types requires php 8.2 --- .github/workflows/php.yml | 5 +++-- composer.json | 2 +- composer.lock | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index bce68b1..523ed65 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -12,9 +12,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: - - '8.1' + php: - '8.2' + - '8.3' + - '8.4' steps: - name: Checkout repository diff --git a/composer.json b/composer.json index 71ac994..023a66d 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ }, "require": { "neoncitylights/media-type": "^3.0.0", - "php": ">= 8.1" + "php": ">= 8.2" }, "require-dev": { "mediawiki/mediawiki-codesniffer": "45.0.0", diff --git a/composer.lock b/composer.lock index d918fbc..a6d53bf 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": "dcec526db95ae5957268be93553fa2cc", + "content-hash": "39fed06242dc6ffd5ef7f33848e221a0", "packages": [ { "name": "neoncitylights/media-type", @@ -3455,7 +3455,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">= 8.1" + "php": ">= 8.2" }, "platform-dev": {}, "plugin-api-version": "2.6.0" From f139dba62fcb499ba853a546a6af224839409594 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Wed, 11 Dec 2024 14:38:14 -0600 Subject: [PATCH 03/19] include min version in readme install section --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f4c69ce..875e0f5 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ A small PHP library for dealing with data URLs, which contain a media type and a This library fully conforms to RFC 2397[^rfc-2397]. ## Install +This requires a minimum PHP version of v8.2. + ``` composer require neoncitylights/data-url ``` From 53793dfc18b5ffa10c8db716ae0720f7ae861863 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Wed, 11 Dec 2024 14:44:14 -0600 Subject: [PATCH 04/19] bring back test --- tests/DataUrlParserTest.php | 90 +++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 tests/DataUrlParserTest.php diff --git a/tests/DataUrlParserTest.php b/tests/DataUrlParserTest.php new file mode 100644 index 0000000..a7c3ce5 --- /dev/null +++ b/tests/DataUrlParserTest.php @@ -0,0 +1,90 @@ +assertEqualsCanonicalizing( + $expectedDataUrlObject, + $parser->parse( $validDataUrl ) + ); + } + + /** + * @covers ::parse + * @covers \Neoncitylights\DataUrl\InvalidDataUrlSyntaxException + * @dataProvider provideInvalidDataUrls + */ + public function testParseInvalidDataUrls( $invalidDataUrl ) { + $this->expectException( InvalidDataUrlSyntaxException::class ); + + $parser = new DataUrlParser( + new MediaTypeParser() + ); + $parser->parse( $invalidDataUrl ); + } + + public function provideValidTextBasedDataUrls() { + yield [ + new DataUrl( + new MediaType( 'text', 'plain', [ 'charset' => 'US-ASCII' ] ), + '' + ), + 'data:,', + ]; + yield [ + new DataUrl( + new MediaType( 'text', 'plain', [ 'charset' => 'US-ASCII' ] ), + '' + ), + " \n\r\t\0\x0Bdata:, \n\r\t\0\x0B", + ]; + yield [ + new DataUrl( + new MediaType( 'text', 'plain', [] ), + 'SGVsbG8sIFdvcmxkIQ==' + ), + "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", + ]; + yield [ + new DataUrl( + new MediaType( + 'text', 'plain', + [ 'charset' => 'UTF-8' ] + ), + 'VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' + ), + 'data:text/plain;charset=UTF-8;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' + ]; + } + + public function provideInvalidDataUrls() { + yield [ '' ]; + yield [ ' \n\r\t\0\x0B' ]; + yield [ 'foo' ]; + yield [ 'data:test' ]; + } +} From 19192bb621b3dfb2831e18b20d6fb362fa0c3dd6 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Wed, 11 Dec 2024 15:22:58 -0600 Subject: [PATCH 05/19] update test --- tests/DataUrlParserTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/DataUrlParserTest.php b/tests/DataUrlParserTest.php index a7c3ce5..abd382b 100644 --- a/tests/DataUrlParserTest.php +++ b/tests/DataUrlParserTest.php @@ -17,7 +17,7 @@ */ class DataUrlParserTest extends TestCase { /** - * @covers ::parse + * @covers ::parseOrThrow * @covers ::parseMediaTypeAndBase64 * @covers ::getMediaType * @dataProvider provideValidTextBasedDataUrls @@ -29,12 +29,12 @@ public function testParseValidDataUrls( $expectedDataUrlObject, $validDataUrl ) $this->assertEqualsCanonicalizing( $expectedDataUrlObject, - $parser->parse( $validDataUrl ) + $parser->parseOrThrow( $validDataUrl ) ); } /** - * @covers ::parse + * @covers ::parseOrThrow * @covers \Neoncitylights\DataUrl\InvalidDataUrlSyntaxException * @dataProvider provideInvalidDataUrls */ @@ -44,7 +44,7 @@ public function testParseInvalidDataUrls( $invalidDataUrl ) { $parser = new DataUrlParser( new MediaTypeParser() ); - $parser->parse( $invalidDataUrl ); + $parser->parseOrThrow( $invalidDataUrl ); } public function provideValidTextBasedDataUrls() { From 0a5340c18280b792fc24088745223a0d02cfa7b7 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Thu, 12 Dec 2024 09:45:25 -0600 Subject: [PATCH 06/19] update example in readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 875e0f5..7685a40 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,9 @@ composer require neoncitylights/data-url parse( 'data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' ); print( $dataUrl->getMediaType()->getEssence() ); From 6212d6a62c3678b0483a6e1ab6fc344a7fa8077a Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Thu, 12 Dec 2024 09:47:57 -0600 Subject: [PATCH 07/19] readme docs --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7685a40..d6c6a52 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A small PHP library for dealing with data URLs, which contain a media type and an encoded base64 string. -This library fully conforms to RFC 2397[^rfc-2397]. +This library fully conforms to [RFC 2397](https://datatracker.ietf.org/doc/html/rfc2397). ## Install This requires a minimum PHP version of v8.2. @@ -36,6 +36,10 @@ print( $dataUrl->getDecodedValue() ); ``` ## License -DataUrl is licensed under the [MIT license](/LICENSE). +This software is licensed under the MIT license ([`LICENSE`](./LICENSE) or +). -[^rfc-2397]: Masinter, L., & X. (1998, August). The "data" URL scheme. Retrieved October 30, 2020, from +### Contribution +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in the work by you, as defined in the MIT license, shall be +licensed as above, without any additional terms or conditions. From 574d46b58f9907ba946c603b2b441ed15c6d4ac4 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Thu, 12 Dec 2024 10:11:46 -0600 Subject: [PATCH 08/19] changelog! --- CHANGELOG.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1512c42..1a48831 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,28 @@ # Changelog -## Unreleased +## v3.0.0 (Unreleased) + +### Deprecated +- This library's minimum PHP version was bumped from v8.1 to v8.2 (`neoncitylights/media-type` requires PHP v8.2). +- Calling `DataUrlParser->parse()` is now deprecated. Instead, call `DataUrlParser->parseOrThrow()`. This method been renamed to be more explicit in side effects (throwing an exception). +- Creating a new `DataUrlParser` instance without any arguments is now deprecated. Instead, pass in an instance of `Neoncitylights\MediaType\MediaTypeParser` as an argument, like so: + ```php + use Neoncitylights\DataUrl\DataUrlParser; + use Neoncitylights\MediaType\MediaTypeParser; + + $dataUrlParser = new DataUrlParser( new MediaTypeParser() ); + ``` + +### Features +- `DataUrlParser` has a new instance method, `parseOrNull()`, which either returns `DataUrl` or `null`. This method is an alternative to `parseOrThrow()`. + +### Internal changes +- The library's CI now also runs builds against PHP v8.3 and PHP v8.4 (not just PHP v8.2). + +## v2.0.0 (2020-11-12) +This release included a small unit test for retrieving a media type parameter value. + +**Note**: This version did not include any major breaking changes; the version was mistakenly bumped from v1.0.0 to v2.0.0, instead of to v1.0.1. + +## v1.0.0 (2020-) +Initial release of the library. From 2e88c8b03c34f64989e44f49aa744c1760ddc6e0 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Thu, 12 Dec 2024 11:41:33 -0600 Subject: [PATCH 09/19] migrate to PHPUnit 11.5 --- .gitignore | 5 + CHANGELOG.md | 5 + composer.json | 4 +- composer.lock | 756 +++++++++----------- phpunit.xml.dist | 21 +- tests/DataUrlParserTest.php | 121 ++-- tests/DataUrlTest.php | 317 ++++---- tests/InvalidDataUrlSyntaxExceptionTest.php | 11 +- 8 files changed, 574 insertions(+), 666 deletions(-) diff --git a/.gitignore b/.gitignore index e559039..fd2ccb5 100644 --- a/.gitignore +++ b/.gitignore @@ -15,9 +15,14 @@ phpunit.xml .phpunit.cache .phpunit.result.cache + # phpDocumentor .phpdoc phpdoc.xml # code coverage coverage +coverage.* + +# PHPActor LSP +.phpactor.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a48831..8f7a55f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,11 @@ ### Internal changes - The library's CI now also runs builds against PHP v8.3 and PHP v8.4 (not just PHP v8.2). +- `mediawiki/mediawiki-sniffer` was bumped from v33.0.0 to v45.0.0. +- `mediawiki/minus-x` was bumped from v1.1.0 to v1.1.3. +- `php-parallel-lint/php-console-highlighter` was bumped from v0.5.0 to v1.0.0. +- `php-parallel-lint/php-parallel-lint` was bumped from v1.2.0 to v1.4.0. +- `phpunit/phpunit` was bumped from v9.4 to v9.6.19. ## v2.0.0 (2020-11-12) This release included a small unit test for retrieving a media type parameter value. diff --git a/composer.json b/composer.json index 023a66d..3c4e49b 100644 --- a/composer.json +++ b/composer.json @@ -35,10 +35,9 @@ "require-dev": { "mediawiki/mediawiki-codesniffer": "45.0.0", "mediawiki/minus-x": "1.1.3", - "ockcyp/covers-validator": "1.6.0", "php-parallel-lint/php-console-highlighter": "1.0.0", "php-parallel-lint/php-parallel-lint": "1.4.0", - "phpunit/phpunit": "9.6.19" + "phpunit/phpunit": "11.5.1" }, "scripts": { "lint": "parallel-lint . --exclude vendor --exclude node_modules", @@ -49,7 +48,6 @@ "test": [ "@lint", "@phpcs", - "covers-validator", "@test:phpunit-clover", "minus-x check ." ], diff --git a/composer.lock b/composer.lock index a6d53bf..6151020 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": "39fed06242dc6ffd5ef7f33848e221a0", + "content-hash": "41c33646d1de36e30bb8f218e4767fa4", "packages": [ { "name": "neoncitylights/media-type", @@ -359,76 +359,6 @@ }, "time": "2023-01-05T11:28:13+00:00" }, - { - "name": "doctrine/instantiator", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "shasum": "" - }, - "require": { - "php": "^8.1" - }, - "require-dev": { - "doctrine/coding-standard": "^11", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.9.4", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^5.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.0.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2022-12-30T00:23:10+00:00" - }, { "name": "mediawiki/mediawiki-codesniffer", "version": "v45.0.0", @@ -650,61 +580,6 @@ }, "time": "2024-10-08T18:51:32+00:00" }, - { - "name": "ockcyp/covers-validator", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/oradwell/covers-validator.git", - "reference": "71f5dee61cd520366b62460bbdf1d655e8186c05" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/oradwell/covers-validator/zipball/71f5dee61cd520366b62460bbdf1d655e8186c05", - "reference": "71f5dee61cd520366b62460bbdf1d655e8186c05", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0", - "phpunit/phpunit": ">=7.0,<10.0", - "symfony/console": ">=2.7,<7.0" - }, - "bin": [ - "covers-validator" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "OckCyp\\CoversValidator\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Oliver Radwell", - "email": "oliver.radwell@gmail.com" - } - ], - "description": "Validates @covers tags in PHPUnit tests", - "keywords": [ - "coverage", - "phpunit", - "testing" - ], - "support": { - "issues": "https://github.com/oradwell/covers-validator/issues", - "source": "https://github.com/oradwell/covers-validator/tree/v1.6.0" - }, - "time": "2022-10-04T20:00:21+00:00" - }, { "name": "phar-io/manifest", "version": "2.0.4", @@ -1153,35 +1028,35 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.32", + "version": "11.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" + "reference": "418c59fd080954f8c4aa5631d9502ecda2387118" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/418c59fd080954f8c4aa5631d9502ecda2387118", + "reference": "418c59fd080954f8c4aa5631d9502ecda2387118", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.19.1 || ^5.1.0", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-text-template": "^2.0.4", - "sebastian/code-unit-reverse-lookup": "^2.0.3", - "sebastian/complexity": "^2.0.3", - "sebastian/environment": "^5.1.5", - "sebastian/lines-of-code": "^1.0.4", - "sebastian/version": "^3.0.2", + "nikic/php-parser": "^5.3.1", + "php": ">=8.2", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-text-template": "^4.0.1", + "sebastian/code-unit-reverse-lookup": "^4.0.1", + "sebastian/complexity": "^4.0.1", + "sebastian/environment": "^7.2.0", + "sebastian/lines-of-code": "^3.0.1", + "sebastian/version": "^5.0.2", "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^11.5.0" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -1190,7 +1065,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "9.2.x-dev" + "dev-main": "11.0.x-dev" } }, "autoload": { @@ -1219,7 +1094,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/9.2.32" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.8" }, "funding": [ { @@ -1227,32 +1102,32 @@ "type": "github" } ], - "time": "2024-08-22T04:23:01+00:00" + "time": "2024-12-11T12:34:27+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6", + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1279,7 +1154,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0" }, "funding": [ { @@ -1287,28 +1163,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2024-08-27T05:02:59+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-pcntl": "*" @@ -1316,7 +1192,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1342,7 +1218,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" }, "funding": [ { @@ -1350,32 +1227,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2024-07-03T05:07:44+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1401,7 +1278,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" }, "funding": [ { @@ -1409,32 +1287,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2024-07-03T05:08:43+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "7.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1460,7 +1338,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" }, "funding": [ { @@ -1468,54 +1347,52 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2024-07-03T05:09:35+00:00" }, { "name": "phpunit/phpunit", - "version": "9.6.19", + "version": "11.5.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" + "reference": "2b94d4f2450b9869fa64a46fd8a6a41997aef56a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", - "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2b94d4f2450b9869fa64a46fd8a6a41997aef56a", + "reference": "2b94d4f2450b9869fa64a46fd8a6a41997aef56a", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.28", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", - "sebastian/version": "^3.0.2" + "myclabs/deep-copy": "^1.12.1", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=8.2", + "phpunit/php-code-coverage": "^11.0.7", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-invoker": "^5.0.1", + "phpunit/php-text-template": "^4.0.1", + "phpunit/php-timer": "^7.0.1", + "sebastian/cli-parser": "^3.0.2", + "sebastian/code-unit": "^3.0.1", + "sebastian/comparator": "^6.2.1", + "sebastian/diff": "^6.0.2", + "sebastian/environment": "^7.2.0", + "sebastian/exporter": "^6.3.0", + "sebastian/global-state": "^7.0.2", + "sebastian/object-enumerator": "^6.0.1", + "sebastian/type": "^5.1.0", + "sebastian/version": "^5.0.2", + "staabm/side-effects-detector": "^1.0.5" }, "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -1523,7 +1400,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.6-dev" + "dev-main": "11.5-dev" } }, "autoload": { @@ -1555,7 +1432,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.1" }, "funding": [ { @@ -1571,7 +1448,7 @@ "type": "tidelift" } ], - "time": "2024-04-05T04:35:58+00:00" + "time": "2024-12-11T10:52:48+00:00" }, { "name": "psr/container", @@ -1628,28 +1505,28 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.2", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1672,7 +1549,8 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" }, "funding": [ { @@ -1680,32 +1558,32 @@ "type": "github" } ], - "time": "2024-03-02T06:27:43+00:00" + "time": "2024-07-03T04:41:36+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", + "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1728,7 +1606,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "security": "https://github.com/sebastianbergmann/code-unit/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.2" }, "funding": [ { @@ -1736,32 +1615,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2024-12-12T09:59:06+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "183a9b2632194febd219bb9246eee421dad8d45e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", + "reference": "183a9b2632194febd219bb9246eee421dad8d45e", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1783,7 +1662,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" }, "funding": [ { @@ -1791,34 +1671,36 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2024-07-03T04:45:54+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "6.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/43d129d6a0f81c78bee378b46688293eb7ea3739", + "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/diff": "^6.0", + "sebastian/exporter": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.2-dev" } }, "autoload": { @@ -1857,7 +1739,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/6.2.1" }, "funding": [ { @@ -1865,33 +1748,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2024-10-31T05:30:08+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.3", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1914,7 +1797,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" }, "funding": [ { @@ -1922,33 +1806,33 @@ "type": "github" } ], - "time": "2023-12-22T06:19:30+00:00" + "time": "2024-07-03T04:49:50+00:00" }, { "name": "sebastian/diff", - "version": "4.0.6", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^11.0", "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1980,7 +1864,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" }, "funding": [ { @@ -1988,27 +1873,27 @@ "type": "github" } ], - "time": "2024-03-02T06:30:58+00:00" + "time": "2024-07-03T04:53:05+00:00" }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "7.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", + "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-posix": "*" @@ -2016,7 +1901,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "7.2-dev" } }, "autoload": { @@ -2035,7 +1920,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -2043,7 +1928,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/7.2.0" }, "funding": [ { @@ -2051,34 +1937,34 @@ "type": "github" } ], - "time": "2023-02-03T06:03:51+00:00" + "time": "2024-07-03T04:54:44+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.6", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" + "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/3473f61172093b2da7de1fb5782e1f24cc036dc3", + "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.1-dev" } }, "autoload": { @@ -2120,7 +2006,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/6.3.0" }, "funding": [ { @@ -2128,38 +2015,35 @@ "type": "github" } ], - "time": "2024-03-02T06:33:00+00:00" + "time": "2024-12-05T09:17:50+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.7", + "version": "7.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + "reference": "3be331570a721f9a4b5917f4209773de17f747d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", + "reference": "3be331570a721f9a4b5917f4209773de17f747d7", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -2178,13 +2062,14 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" }, "funding": [ { @@ -2192,33 +2077,33 @@ "type": "github" } ], - "time": "2024-03-02T06:35:11+00:00" + "time": "2024-07-03T04:57:36+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.4", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2241,7 +2126,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" }, "funding": [ { @@ -2249,34 +2135,34 @@ "type": "github" } ], - "time": "2023-12-22T06:20:34+00:00" + "time": "2024-07-03T04:58:38+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "f5b498e631a74204185071eb41f33f38d64608aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", + "reference": "f5b498e631a74204185071eb41f33f38d64608aa", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -2298,7 +2184,8 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" }, "funding": [ { @@ -2306,32 +2193,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2024-07-03T05:00:13+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -2353,7 +2240,8 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" }, "funding": [ { @@ -2361,32 +2249,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2024-07-03T05:01:32+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/694d156164372abbd149a4b85ccda2e4670c0e16", + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -2416,61 +2304,8 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.2" }, "funding": [ { @@ -2478,32 +2313,32 @@ "type": "github" } ], - "time": "2024-03-14T16:00:52+00:00" + "time": "2024-07-03T05:10:34+00:00" }, { "name": "sebastian/type", - "version": "3.2.1", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/461b9c5da241511a2a0e8f240814fb23ce5c0aac", + "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -2526,7 +2361,8 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/5.1.0" }, "funding": [ { @@ -2534,29 +2370,29 @@ "type": "github" } ], - "time": "2023-02-03T06:13:03+00:00" + "time": "2024-09-17T13:12:04+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -2579,7 +2415,8 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" }, "funding": [ { @@ -2587,7 +2424,7 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2024-10-09T05:16:32+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -2669,49 +2506,100 @@ ], "time": "2024-09-18T10:38:58+00:00" }, + { + "name": "staabm/side-effects-detector", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/staabm/side-effects-detector.git", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.6", + "phpunit/phpunit": "^9.6.21", + "symfony/var-dumper": "^5.4.43", + "tomasvotruba/type-coverage": "1.0.0", + "tomasvotruba/unused-public": "1.0.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A static analysis tool to detect side effects in PHP code", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/staabm/side-effects-detector/issues", + "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5" + }, + "funding": [ + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2024-10-20T05:08:20+00:00" + }, { "name": "symfony/console", - "version": "v6.4.15", + "version": "v7.2.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f1fc6f47283e27336e7cebb9e8946c8de7bff9bd" + "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f1fc6f47283e27336e7cebb9e8946c8de7bff9bd", - "reference": "f1fc6f47283e27336e7cebb9e8946c8de7bff9bd", + "url": "https://api.github.com/repos/symfony/console/zipball/fefcc18c0f5d0efe3ab3152f15857298868dc2c3", + "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.2", "symfony/polyfill-mbstring": "~1.0", "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^5.4|^6.0|^7.0" + "symfony/string": "^6.4|^7.0" }, "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/dotenv": "<5.4", - "symfony/event-dispatcher": "<5.4", - "symfony/lock": "<5.4", - "symfony/process": "<5.4" + "symfony/dependency-injection": "<6.4", + "symfony/dotenv": "<6.4", + "symfony/event-dispatcher": "<6.4", + "symfony/lock": "<6.4", + "symfony/process": "<6.4" }, "provide": { "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", "symfony/http-foundation": "^6.4|^7.0", "symfony/http-kernel": "^6.4|^7.0", - "symfony/lock": "^5.4|^6.0|^7.0", - "symfony/messenger": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.0|^7.0", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/var-dumper": "^5.4|^6.0|^7.0" + "symfony/lock": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/stopwatch": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -2745,7 +2633,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.15" + "source": "https://github.com/symfony/console/tree/v7.2.1" }, "funding": [ { @@ -2761,7 +2649,7 @@ "type": "tidelift" } ], - "time": "2024-11-06T14:19:14+00:00" + "time": "2024-12-11T03:49:26+00:00" }, { "name": "symfony/deprecation-contracts", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 27efd39..9707688 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,23 +1,18 @@ + stopOnFailure="false"> @@ -26,11 +21,9 @@ ./tests - + - ./src + ./src - + diff --git a/tests/DataUrlParserTest.php b/tests/DataUrlParserTest.php index abd382b..af07879 100644 --- a/tests/DataUrlParserTest.php +++ b/tests/DataUrlParserTest.php @@ -7,84 +7,85 @@ use Neoncitylights\DataUrl\InvalidDataUrlSyntaxException; use Neoncitylights\MediaType\MediaType; use Neoncitylights\MediaType\MediaTypeParser; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\CoversMethod; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\UsesClass; use PHPUnit\Framework\TestCase; -/** - * @coversDefaultClass \Neoncitylights\DataUrl\DataUrlParser - * @uses \Neoncitylights\DataUrl\DataUrl - * @uses \Neoncitylights\DataUrl\InvalidDataUrlSyntaxException - * @uses \Neoncitylights\MediaType\MediaType - */ +#[CoversClass( DataUrlParser::class )] +#[UsesClass( DataUrl::class )] +#[UsesClass( InvalidDataUrlSyntaxException::class )] +#[UsesClass( MediaType::class )] +#[UsesClass( MediaTypeParser::class )] class DataUrlParserTest extends TestCase { - /** - * @covers ::parseOrThrow - * @covers ::parseMediaTypeAndBase64 - * @covers ::getMediaType - * @dataProvider provideValidTextBasedDataUrls - */ - public function testParseValidDataUrls( $expectedDataUrlObject, $validDataUrl ) { - $parser = new DataUrlParser( - new MediaTypeParser() - ); + #[DataProvider( "provideValidTextBasedDataUrls" )] + public function testParseValidDataUrls( DataUrl $expectedDataUrlObject, string $validDataUrl ): void { + $parser = new DataUrlParser( new MediaTypeParser() ); $this->assertEqualsCanonicalizing( $expectedDataUrlObject, $parser->parseOrThrow( $validDataUrl ) ); } - /** - * @covers ::parseOrThrow - * @covers \Neoncitylights\DataUrl\InvalidDataUrlSyntaxException - * @dataProvider provideInvalidDataUrls - */ - public function testParseInvalidDataUrls( $invalidDataUrl ) { + // #[CoversMethod( DataUrlParser::class, "parseOrThrow" )] + #[DataProvider( "provideInvalidDataUrls" )] + public function testParseInvalidDataUrls( string $invalidDataUrl ): void { $this->expectException( InvalidDataUrlSyntaxException::class ); - $parser = new DataUrlParser( - new MediaTypeParser() - ); + $parser = new DataUrlParser( new MediaTypeParser() ); $parser->parseOrThrow( $invalidDataUrl ); } - public function provideValidTextBasedDataUrls() { - yield [ - new DataUrl( - new MediaType( 'text', 'plain', [ 'charset' => 'US-ASCII' ] ), - '' - ), - 'data:,', - ]; - yield [ - new DataUrl( - new MediaType( 'text', 'plain', [ 'charset' => 'US-ASCII' ] ), - '' - ), - " \n\r\t\0\x0Bdata:, \n\r\t\0\x0B", - ]; - yield [ - new DataUrl( - new MediaType( 'text', 'plain', [] ), - 'SGVsbG8sIFdvcmxkIQ==' - ), - "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", - ]; - yield [ - new DataUrl( - new MediaType( - 'text', 'plain', - [ 'charset' => 'UTF-8' ] + /** + * @return array + */ + public static function provideValidTextBasedDataUrls(): array { + return [ + [ + new DataUrl( + new MediaType( 'text', 'plain', [ 'charset' => 'US-ASCII' ] ), + '' + ), + 'data:,', + ], + [ + new DataUrl( + new MediaType( 'text', 'plain', [ 'charset' => 'US-ASCII' ] ), + '' + ), + " \n\r\t\0\x0Bdata:, \n\r\t\0\x0B", + ], + [ + new DataUrl( + new MediaType( 'text', 'plain', [] ), + 'SGVsbG8sIFdvcmxkIQ==' ), - 'VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' - ), - 'data:text/plain;charset=UTF-8;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' + "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", + ], + [ + new DataUrl( + new MediaType( + 'text', 'plain', + [ 'charset' => 'UTF-8' ] + ), + 'VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' + ), + 'data:text/plain;charset=UTF-8;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' + ] ]; } - public function provideInvalidDataUrls() { - yield [ '' ]; - yield [ ' \n\r\t\0\x0B' ]; - yield [ 'foo' ]; - yield [ 'data:test' ]; + /** + * @return array{string} + */ + public static function provideInvalidDataUrls(): array { + return [ + [ '' ], + [ ' \n\r\t\0\x0B' ], + [ 'foo' ], + [ 'data:test' ], + ]; } } diff --git a/tests/DataUrlTest.php b/tests/DataUrlTest.php index 8fc4645..8e04cf1 100644 --- a/tests/DataUrlTest.php +++ b/tests/DataUrlTest.php @@ -6,14 +6,18 @@ use Neoncitylights\DataUrl\DataUrlParser; use Neoncitylights\MediaType\MediaType; use Neoncitylights\MediaType\MediaTypeParser; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\CoversMethod; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\UsesClass; use PHPUnit\Framework\TestCase; -/** - * @coversDefaultClass \Neoncitylights\DataUrl\DataUrl - * @uses \Neoncitylights\DataUrl\DataUrlParser - * @uses \Neoncitylights\MediaType\MediaType - */ +#[CoversClass( DataUrl::class )] +#[UsesClass( DataUrlParser::class )] +#[UsesClass( MediaType::class )] +#[UsesClass( MediaTypeParser::class )] class DataUrlTest extends TestCase { + /** @var DataUrlParser|null */ private static $dataUrlParser; @@ -27,10 +31,8 @@ public static function tearDownAfterClass(): void { self::$dataUrlParser = null; } - /** - * @covers ::__construct - */ - public function testConstructor() { + // #[CoversMethod( DataUrl::class, "__construct" )] + public function testConstructor(): void { $this->assertInstanceOf( DataUrl::class, new DataUrl( @@ -40,60 +42,50 @@ public function testConstructor() { ); } - /** - * @covers ::getMediaType - * @covers ::__construct - * @dataProvider provideValidDataUrls - */ - public function testGetMediaType( $validDataUrl ) { + // #[CoversMethod( DataUrl::class, "getMediaType" )] + // #[CoversMethod( DataUrl::class, "__construct" )] + #[DataProvider( "provideValidDataUrls" )] + public function testGetMediaType( string $validDataUrl ): void { $this->assertInstanceOf( MediaType::class, self::$dataUrlParser->parse( $validDataUrl )->getMediaType() ); } - /** - * @covers ::__construct - * @covers ::getMediaType - * @dataProvider provideMediaTypeEssences - */ - public function testGetMediaTypeEssence( $expectedMediaTypeEssence, $validDataUrl ) { + // #[CoversMethod( DataUrl::class, "getMediaType" )] + // #[CoversMethod( DataUrl::class, "__construct" )] + #[DataProvider( "provideMediaTypeEssences" )] + public function testGetMediaTypeEssence( string $expectedMediaTypeEssence, string $validDataUrl ): void { $this->assertEquals( $expectedMediaTypeEssence, self::$dataUrlParser->parse( $validDataUrl )->getMediaType()->getEssence() ); } - /** - * @covers ::getMediaType - * @covers ::__construct - * @dataProvider provideMediaTypeParameters - */ - public function testGetMediaTypeParameterValue( $expectedParameter, $expectedParameterValue, $validDataUrl ) { + // #[CoversMethod( DataUrl::class, "getMediaType" )] + // #[CoversMethod( DataUrl::class, "__construct" )] + #[DataProvider( "provideMediaTypeParameters" )] + public function testGetMediaTypeParameterValue( string $expectedParameter, string $expectedParameterValue, string $validDataUrl ): void { $this->assertEquals( $expectedParameterValue, self::$dataUrlParser->parse( $validDataUrl )->getMediaType()->getParameterValue( $expectedParameter ) ); } - /** - * @covers ::getData - * @covers ::__construct - * @dataProvider provideData - */ - public function testGetData( $expectedData, $validDataUrl ) { + // #[CoversMethod( DataUrl::class, "getData" )] + // #[CoversMethod( DataUrl::class, "__construct" )] + #[DataProvider( "provideData" )] + public function testGetData( string $expectedData, string $validDataUrl ): void { $this->assertEquals( $expectedData, self::$dataUrlParser->parse( $validDataUrl )->getData() ); } - /** - * @covers ::getDecodedValue - * @covers ::__construct - * @dataProvider provideDecodedValues - */ - public function testGetDecodedValue( $expectedDecodedValue, $validDataUrl ) { + // #[CoversMethod( DataUrl::class, "getDecodedValue" )] + // #[CoversMethod( DataUrl::class, "__construct" )] + #[DataProvider( "provideDecodedValues" )] + public function testGetDecodedValue( string $expectedDecodedValue, string $validDataUrl ): void { $this->assertEquals( $expectedDecodedValue, self::$dataUrlParser->parse( $validDataUrl )->getDecodedValue() @@ -106,137 +98,164 @@ public function testGetDecodedValue( $expectedDecodedValue, $validDataUrl ) { ); } - /** - * @covers ::__toString - * @covers ::__construct - * @dataProvider provideStrings - * @uses \Neoncitylights\DataUrl\DataUrlParser - */ - public function testToString( $expectedDataUrl, $actualValidDataUrl ) { + // #[CoversMethod( DataUrl::class, "__construct" )] + // #[CoversMethod( DataUrl::class, "__toString" )] + #[DataProvider( "provideStrings" )] + public function testToString( string $expectedDataUrl, string $actualValidDataUrl ): void { $this->assertEquals( $expectedDataUrl, (string)self::$dataUrlParser->parse( $actualValidDataUrl ) ); } - public function provideValidDataUrls() { - yield 'text/plain example #1: hello world: data url' => [ - "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", - ]; - yield 'text/plain example #2: pangram #1: data url' => [ - "data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==", - ]; - yield 'text/plain example #2: pangram #2: data url' => [ - "data:text/plain;base64,VGhpcyBQYW5ncmFtIGNvbnRhaW5zIGZvdXIgYSdzLCBvbmUgYiwgdHdvIGMncywgb25lIGQsIHRoaXJ0eSBlJ3MsIHNpeCBmJ3MsIGZpdmUgZydzLCBzZXZlbiBoJ3MsIGVsZXZlbiBpJ3MsIG9uZSBqLCBvbmUgaywgdHdvIGwncywgdHdvIG0ncywgZWlnaHRlZW4gbidzLCBmaWZ0ZWVuIG8ncywgdHdvIHAncywgb25lIHEsIGZpdmUgcidzLCB0d2VudHktc2V2ZW4gcydzLCBlaWdodGVlbiB0J3MsIHR3byB1J3MsIHNldmVuIHYncywgZWlnaHQgdydzLCB0d28geCdzLCB0aHJlZSB5J3MsICYgb25lIHou", - ]; - yield 'text/html example #1: hello world: data url' => [ - "data:text/html;base64,PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg==", - ]; - yield 'text/html example #2: paragraph element: data url' => [ - "data:text/html;base64,PHA+VGhpcyBpcyBhIHBhcmFncmFwaCBlbGVtZW50LjwvcD4=", - ]; - yield 'text/html example #2: paragraph element with whitespace: data url' => [ - "data:text/html;base64,PHA+ClRoaXMgaXMgYSBwYXJhZ3JhcGggZWxlbWVudC4KPC9wPg==", + /** + * @return array> + */ + public static function provideValidDataUrls(): array { + return [ + 'text/plain example #1: hello world: data url' => [ + "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", + ], + 'text/plain example #2: pangram #1: data url' => [ + "data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==", + ], + 'text/plain example #2: pangram #2: data url' => [ + "data:text/plain;base64,VGhpcyBQYW5ncmFtIGNvbnRhaW5zIGZvdXIgYSdzLCBvbmUgYiwgdHdvIGMncywgb25lIGQsIHRoaXJ0eSBlJ3MsIHNpeCBmJ3MsIGZpdmUgZydzLCBzZXZlbiBoJ3MsIGVsZXZlbiBpJ3MsIG9uZSBqLCBvbmUgaywgdHdvIGwncywgdHdvIG0ncywgZWlnaHRlZW4gbidzLCBmaWZ0ZWVuIG8ncywgdHdvIHAncywgb25lIHEsIGZpdmUgcidzLCB0d2VudHktc2V2ZW4gcydzLCBlaWdodGVlbiB0J3MsIHR3byB1J3MsIHNldmVuIHYncywgZWlnaHQgdydzLCB0d28geCdzLCB0aHJlZSB5J3MsICYgb25lIHou", + ], + 'text/html example #1: hello world: data url' => [ + "data:text/html;base64,PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg==", + ], + 'text/html example #2: paragraph element: data url' => [ + "data:text/html;base64,PHA+VGhpcyBpcyBhIHBhcmFncmFwaCBlbGVtZW50LjwvcD4=", + ], + 'text/html example #2: paragraph element with whitespace: data url' => [ + "data:text/html;base64,PHA+ClRoaXMgaXMgYSBwYXJhZ3JhcGggZWxlbWVudC4KPC9wPg==", + ], ]; } - public function provideMediaTypeEssences() { - yield [ - 'text/plain', - 'data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==', - ]; - yield [ - 'text/html', - 'data:text/html;base64,PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg==', + /** + * @return array> + */ + public static function provideMediaTypeEssences(): array { + return [ + [ + 'text/plain', + 'data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==', + ], + [ + 'text/html', + 'data:text/html;base64,PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg==', + ], ]; } - public function provideMediaTypeParameters() { - yield [ - 'charset', - 'UTF-8', - 'data:text/plain;charset=UTF-8;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' + /** + * @return array> + */ + public static function provideMediaTypeParameters(): array { + return [ + [ + 'charset', + 'UTF-8', + 'data:text/plain;charset=UTF-8;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' + ], ]; } - public function provideData() { - yield 'text/plain example #1: hello world: data' => [ - "SGVsbG8sIFdvcmxkIQ==", - "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", - ]; - yield 'text/plain example #2: pangram #1: data' => [ - "VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==", - "data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==", - ]; - yield 'text/plain example #3: pangram #2: data' => [ - "VGhpcyBQYW5ncmFtIGNvbnRhaW5zIGZvdXIgYSdzLCBvbmUgYiwgdHdvIGMncywgb25lIGQsIHRoaXJ0eSBlJ3MsIHNpeCBmJ3MsIGZpdmUgZydzLCBzZXZlbiBoJ3MsIGVsZXZlbiBpJ3MsIG9uZSBqLCBvbmUgaywgdHdvIGwncywgdHdvIG0ncywgZWlnaHRlZW4gbidzLCBmaWZ0ZWVuIG8ncywgdHdvIHAncywgb25lIHEsIGZpdmUgcidzLCB0d2VudHktc2V2ZW4gcydzLCBlaWdodGVlbiB0J3MsIHR3byB1J3MsIHNldmVuIHYncywgZWlnaHQgdydzLCB0d28geCdzLCB0aHJlZSB5J3MsICYgb25lIHou", - "data:text/plain;base64,VGhpcyBQYW5ncmFtIGNvbnRhaW5zIGZvdXIgYSdzLCBvbmUgYiwgdHdvIGMncywgb25lIGQsIHRoaXJ0eSBlJ3MsIHNpeCBmJ3MsIGZpdmUgZydzLCBzZXZlbiBoJ3MsIGVsZXZlbiBpJ3MsIG9uZSBqLCBvbmUgaywgdHdvIGwncywgdHdvIG0ncywgZWlnaHRlZW4gbidzLCBmaWZ0ZWVuIG8ncywgdHdvIHAncywgb25lIHEsIGZpdmUgcidzLCB0d2VudHktc2V2ZW4gcydzLCBlaWdodGVlbiB0J3MsIHR3byB1J3MsIHNldmVuIHYncywgZWlnaHQgdydzLCB0d28geCdzLCB0aHJlZSB5J3MsICYgb25lIHou", - ]; - yield 'text/html example #1: hello world: data' => [ - "PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg==", - "data:text/html;base64,PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg==" - ]; - yield 'text/html example #2: paragraph element: data' => [ - "PHA+VGhpcyBpcyBhIHBhcmFncmFwaCBlbGVtZW50LjwvcD4=", - "data:text/html;base64,PHA+VGhpcyBpcyBhIHBhcmFncmFwaCBlbGVtZW50LjwvcD4=" - ]; - yield 'text/html example #2: paragraph element with whitespace: data' => [ - "PHA+ClRoaXMgaXMgYSBwYXJhZ3JhcGggZWxlbWVudC4KPC9wPg==", - "data:text/html;base64,PHA+ClRoaXMgaXMgYSBwYXJhZ3JhcGggZWxlbWVudC4KPC9wPg==" + /** + * @return array> + */ + public static function provideData(): array { + return [ + 'text/plain example #1: hello world: data' => [ + "SGVsbG8sIFdvcmxkIQ==", + "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", + ], + 'text/plain example #2: pangram #1: data' => [ + "VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==", + "data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==", + ], + 'text/plain example #3: pangram #2: data' => [ + "VGhpcyBQYW5ncmFtIGNvbnRhaW5zIGZvdXIgYSdzLCBvbmUgYiwgdHdvIGMncywgb25lIGQsIHRoaXJ0eSBlJ3MsIHNpeCBmJ3MsIGZpdmUgZydzLCBzZXZlbiBoJ3MsIGVsZXZlbiBpJ3MsIG9uZSBqLCBvbmUgaywgdHdvIGwncywgdHdvIG0ncywgZWlnaHRlZW4gbidzLCBmaWZ0ZWVuIG8ncywgdHdvIHAncywgb25lIHEsIGZpdmUgcidzLCB0d2VudHktc2V2ZW4gcydzLCBlaWdodGVlbiB0J3MsIHR3byB1J3MsIHNldmVuIHYncywgZWlnaHQgdydzLCB0d28geCdzLCB0aHJlZSB5J3MsICYgb25lIHou", + "data:text/plain;base64,VGhpcyBQYW5ncmFtIGNvbnRhaW5zIGZvdXIgYSdzLCBvbmUgYiwgdHdvIGMncywgb25lIGQsIHRoaXJ0eSBlJ3MsIHNpeCBmJ3MsIGZpdmUgZydzLCBzZXZlbiBoJ3MsIGVsZXZlbiBpJ3MsIG9uZSBqLCBvbmUgaywgdHdvIGwncywgdHdvIG0ncywgZWlnaHRlZW4gbidzLCBmaWZ0ZWVuIG8ncywgdHdvIHAncywgb25lIHEsIGZpdmUgcidzLCB0d2VudHktc2V2ZW4gcydzLCBlaWdodGVlbiB0J3MsIHR3byB1J3MsIHNldmVuIHYncywgZWlnaHQgdydzLCB0d28geCdzLCB0aHJlZSB5J3MsICYgb25lIHou", + ], + 'text/html example #1: hello world: data' => [ + "PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg==", + "data:text/html;base64,PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg==" + ], + 'text/html example #2: paragraph element: data' => [ + "PHA+VGhpcyBpcyBhIHBhcmFncmFwaCBlbGVtZW50LjwvcD4=", + "data:text/html;base64,PHA+VGhpcyBpcyBhIHBhcmFncmFwaCBlbGVtZW50LjwvcD4=" + ], + 'text/html example #2: paragraph element with whitespace: data' => [ + "PHA+ClRoaXMgaXMgYSBwYXJhZ3JhcGggZWxlbWVudC4KPC9wPg==", + "data:text/html;base64,PHA+ClRoaXMgaXMgYSBwYXJhZ3JhcGggZWxlbWVudC4KPC9wPg==" + ], ]; } - public function provideDecodedValues() { - yield 'text/plain example #1: hello world: decoded value' => [ - "Hello, World!", - "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", - ]; - yield 'text/plain example #2: pangram #1: decoded value' => [ - "The five boxing wizards jump quickly.", - "data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==", - ]; - yield 'text/plain example #3: pangram #2: decoded value' => [ - "This Pangram contains four a's, one b, two c's, one d, thirty e's, six f's, five g's, seven h's, eleven i's, one j, one k, two l's, two m's, eighteen n's, fifteen o's, two p's, one q, five r's, twenty-seven s's, eighteen t's, two u's, seven v's, eight w's, two x's, three y's, & one z.", - "data:text/plain;base64,VGhpcyBQYW5ncmFtIGNvbnRhaW5zIGZvdXIgYSdzLCBvbmUgYiwgdHdvIGMncywgb25lIGQsIHRoaXJ0eSBlJ3MsIHNpeCBmJ3MsIGZpdmUgZydzLCBzZXZlbiBoJ3MsIGVsZXZlbiBpJ3MsIG9uZSBqLCBvbmUgaywgdHdvIGwncywgdHdvIG0ncywgZWlnaHRlZW4gbidzLCBmaWZ0ZWVuIG8ncywgdHdvIHAncywgb25lIHEsIGZpdmUgcidzLCB0d2VudHktc2V2ZW4gcydzLCBlaWdodGVlbiB0J3MsIHR3byB1J3MsIHNldmVuIHYncywgZWlnaHQgdydzLCB0d28geCdzLCB0aHJlZSB5J3MsICYgb25lIHou", - ]; - yield 'text/html example #1: hello world: decoded value' => [ - "

Hello, World!

", - "data:text/html;base64,PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg==" - ]; - yield 'text/html example #2: paragraph element: decoded value' => [ - "

This is a paragraph element.

", - "data:text/html;base64,PHA+VGhpcyBpcyBhIHBhcmFncmFwaCBlbGVtZW50LjwvcD4=" - ]; - yield 'text/html example #2: paragraph element with whitespace: decoded value' => [ - "

\nThis is a paragraph element.\n

", - "data:text/html;base64,PHA+ClRoaXMgaXMgYSBwYXJhZ3JhcGggZWxlbWVudC4KPC9wPg==" + /** + * @return array> + */ + public static function provideDecodedValues(): array { + return [ + 'text/plain example #1: hello world: decoded value' => [ + "Hello, World!", + "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", + ], + 'text/plain example #2: pangram #1: decoded value' => [ + "The five boxing wizards jump quickly.", + "data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==", + ], + 'text/plain example #3: pangram #2: decoded value' => [ + "This Pangram contains four a's, one b, two c's, one d, thirty e's, six f's, five g's, seven h's, eleven i's, one j, one k, two l's, two m's, eighteen n's, fifteen o's, two p's, one q, five r's, twenty-seven s's, eighteen t's, two u's, seven v's, eight w's, two x's, three y's, & one z.", + "data:text/plain;base64,VGhpcyBQYW5ncmFtIGNvbnRhaW5zIGZvdXIgYSdzLCBvbmUgYiwgdHdvIGMncywgb25lIGQsIHRoaXJ0eSBlJ3MsIHNpeCBmJ3MsIGZpdmUgZydzLCBzZXZlbiBoJ3MsIGVsZXZlbiBpJ3MsIG9uZSBqLCBvbmUgaywgdHdvIGwncywgdHdvIG0ncywgZWlnaHRlZW4gbidzLCBmaWZ0ZWVuIG8ncywgdHdvIHAncywgb25lIHEsIGZpdmUgcidzLCB0d2VudHktc2V2ZW4gcydzLCBlaWdodGVlbiB0J3MsIHR3byB1J3MsIHNldmVuIHYncywgZWlnaHQgdydzLCB0d28geCdzLCB0aHJlZSB5J3MsICYgb25lIHou", + ], + 'text/html example #1: hello world: decoded value' => [ + "

Hello, World!

", + "data:text/html;base64,PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg==" + ], + 'text/html example #2: paragraph element: decoded value' => [ + "

This is a paragraph element.

", + "data:text/html;base64,PHA+VGhpcyBpcyBhIHBhcmFncmFwaCBlbGVtZW50LjwvcD4=" + ], + 'text/html example #2: paragraph element with whitespace: decoded value' => [ + "

\nThis is a paragraph element.\n

", + "data:text/html;base64,PHA+ClRoaXMgaXMgYSBwYXJhZ3JhcGggZWxlbWVudC4KPC9wPg==" + ], ]; } - public function provideStrings() { - yield 'text/plain example #1: hello world' => [ - "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", - "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", - ]; - yield 'text/plain example #2: pangram #1' => [ - "data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==", - "data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==", - ]; - yield 'text/plain example #2: pangram #2' => [ - "data:text/plain;base64,VGhpcyBQYW5ncmFtIGNvbnRhaW5zIGZvdXIgYSdzLCBvbmUgYiwgdHdvIGMncywgb25lIGQsIHRoaXJ0eSBlJ3MsIHNpeCBmJ3MsIGZpdmUgZydzLCBzZXZlbiBoJ3MsIGVsZXZlbiBpJ3MsIG9uZSBqLCBvbmUgaywgdHdvIGwncywgdHdvIG0ncywgZWlnaHRlZW4gbidzLCBmaWZ0ZWVuIG8ncywgdHdvIHAncywgb25lIHEsIGZpdmUgcidzLCB0d2VudHktc2V2ZW4gcydzLCBlaWdodGVlbiB0J3MsIHR3byB1J3MsIHNldmVuIHYncywgZWlnaHQgdydzLCB0d28geCdzLCB0aHJlZSB5J3MsICYgb25lIHou", - "data:text/plain;base64,VGhpcyBQYW5ncmFtIGNvbnRhaW5zIGZvdXIgYSdzLCBvbmUgYiwgdHdvIGMncywgb25lIGQsIHRoaXJ0eSBlJ3MsIHNpeCBmJ3MsIGZpdmUgZydzLCBzZXZlbiBoJ3MsIGVsZXZlbiBpJ3MsIG9uZSBqLCBvbmUgaywgdHdvIGwncywgdHdvIG0ncywgZWlnaHRlZW4gbidzLCBmaWZ0ZWVuIG8ncywgdHdvIHAncywgb25lIHEsIGZpdmUgcidzLCB0d2VudHktc2V2ZW4gcydzLCBlaWdodGVlbiB0J3MsIHR3byB1J3MsIHNldmVuIHYncywgZWlnaHQgdydzLCB0d28geCdzLCB0aHJlZSB5J3MsICYgb25lIHou", - ]; - yield 'text/html example #1: hello world' => [ - "data:text/html;base64,PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg==", - "data:text/html;base64,PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg==", - ]; - yield 'text/html example #2: paragraph element' => [ - "data:text/html;base64,PHA+VGhpcyBpcyBhIHBhcmFncmFwaCBlbGVtZW50LjwvcD4=", - "data:text/html;base64,PHA+VGhpcyBpcyBhIHBhcmFncmFwaCBlbGVtZW50LjwvcD4=", - ]; - yield 'text/html example #2: paragraph element with whitespace' => [ - "data:text/html;base64,PHA+ClRoaXMgaXMgYSBwYXJhZ3JhcGggZWxlbWVudC4KPC9wPg==", - "data:text/html;base64,PHA+ClRoaXMgaXMgYSBwYXJhZ3JhcGggZWxlbWVudC4KPC9wPg==", + /** + * @return array> + */ + public static function provideStrings(): array { + return [ + 'text/plain example #1: hello world' => [ + "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", + "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", + ], + 'text/plain example #2: pangram #1' => [ + "data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==", + "data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==", + ], + 'text/plain example #2: pangram #2' => [ + "data:text/plain;base64,VGhpcyBQYW5ncmFtIGNvbnRhaW5zIGZvdXIgYSdzLCBvbmUgYiwgdHdvIGMncywgb25lIGQsIHRoaXJ0eSBlJ3MsIHNpeCBmJ3MsIGZpdmUgZydzLCBzZXZlbiBoJ3MsIGVsZXZlbiBpJ3MsIG9uZSBqLCBvbmUgaywgdHdvIGwncywgdHdvIG0ncywgZWlnaHRlZW4gbidzLCBmaWZ0ZWVuIG8ncywgdHdvIHAncywgb25lIHEsIGZpdmUgcidzLCB0d2VudHktc2V2ZW4gcydzLCBlaWdodGVlbiB0J3MsIHR3byB1J3MsIHNldmVuIHYncywgZWlnaHQgdydzLCB0d28geCdzLCB0aHJlZSB5J3MsICYgb25lIHou", + "data:text/plain;base64,VGhpcyBQYW5ncmFtIGNvbnRhaW5zIGZvdXIgYSdzLCBvbmUgYiwgdHdvIGMncywgb25lIGQsIHRoaXJ0eSBlJ3MsIHNpeCBmJ3MsIGZpdmUgZydzLCBzZXZlbiBoJ3MsIGVsZXZlbiBpJ3MsIG9uZSBqLCBvbmUgaywgdHdvIGwncywgdHdvIG0ncywgZWlnaHRlZW4gbidzLCBmaWZ0ZWVuIG8ncywgdHdvIHAncywgb25lIHEsIGZpdmUgcidzLCB0d2VudHktc2V2ZW4gcydzLCBlaWdodGVlbiB0J3MsIHR3byB1J3MsIHNldmVuIHYncywgZWlnaHQgdydzLCB0d28geCdzLCB0aHJlZSB5J3MsICYgb25lIHou", + ], + 'text/html example #1: hello world' => [ + "data:text/html;base64,PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg==", + "data:text/html;base64,PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg==", + ], + 'text/html example #2: paragraph element' => [ + "data:text/html;base64,PHA+VGhpcyBpcyBhIHBhcmFncmFwaCBlbGVtZW50LjwvcD4=", + "data:text/html;base64,PHA+VGhpcyBpcyBhIHBhcmFncmFwaCBlbGVtZW50LjwvcD4=", + ], + 'text/html example #2: paragraph element with whitespace' => [ + "data:text/html;base64,PHA+ClRoaXMgaXMgYSBwYXJhZ3JhcGggZWxlbWVudC4KPC9wPg==", + "data:text/html;base64,PHA+ClRoaXMgaXMgYSBwYXJhZ3JhcGggZWxlbWVudC4KPC9wPg==", + ] ]; } } diff --git a/tests/InvalidDataUrlSyntaxExceptionTest.php b/tests/InvalidDataUrlSyntaxExceptionTest.php index 281ce24..8c4fed5 100644 --- a/tests/InvalidDataUrlSyntaxExceptionTest.php +++ b/tests/InvalidDataUrlSyntaxExceptionTest.php @@ -3,15 +3,14 @@ namespace Neoncitylights\DataUrl\Tests; use Neoncitylights\DataUrl\InvalidDataUrlSyntaxException; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\CoversMethod; use PHPUnit\Framework\TestCase; -/** - * @coversDefaultClass \Neoncitylights\DataUrl\InvalidDataUrlSyntaxException - */ +#[CoversClass( InvalidDataUrlSyntaxException::class )] class InvalidDataUrlSyntaxExceptionTest extends TestCase { - /** - * @covers ::__construct - */ + + // #[CoversMethod( InvalidDataUrlSyntaxException::class, "__construct" )] public function testConstructor(): void { $this->expectException( InvalidDataUrlSyntaxException::class ); throw new InvalidDataUrlSyntaxException( From 57d18823be5bf8f8d38d4675a33eb17815668780 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Thu, 12 Dec 2024 12:13:45 -0600 Subject: [PATCH 10/19] remove instances of the CoversMethod attribute --- tests/DataUrlParserTest.php | 2 -- tests/DataUrlTest.php | 14 -------------- tests/InvalidDataUrlSyntaxExceptionTest.php | 2 -- 3 files changed, 18 deletions(-) diff --git a/tests/DataUrlParserTest.php b/tests/DataUrlParserTest.php index af07879..bb133a0 100644 --- a/tests/DataUrlParserTest.php +++ b/tests/DataUrlParserTest.php @@ -8,7 +8,6 @@ use Neoncitylights\MediaType\MediaType; use Neoncitylights\MediaType\MediaTypeParser; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\CoversMethod; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\UsesClass; use PHPUnit\Framework\TestCase; @@ -29,7 +28,6 @@ public function testParseValidDataUrls( DataUrl $expectedDataUrlObject, string $ ); } - // #[CoversMethod( DataUrlParser::class, "parseOrThrow" )] #[DataProvider( "provideInvalidDataUrls" )] public function testParseInvalidDataUrls( string $invalidDataUrl ): void { $this->expectException( InvalidDataUrlSyntaxException::class ); diff --git a/tests/DataUrlTest.php b/tests/DataUrlTest.php index 8e04cf1..3d18c15 100644 --- a/tests/DataUrlTest.php +++ b/tests/DataUrlTest.php @@ -7,7 +7,6 @@ use Neoncitylights\MediaType\MediaType; use Neoncitylights\MediaType\MediaTypeParser; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\CoversMethod; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\UsesClass; use PHPUnit\Framework\TestCase; @@ -31,7 +30,6 @@ public static function tearDownAfterClass(): void { self::$dataUrlParser = null; } - // #[CoversMethod( DataUrl::class, "__construct" )] public function testConstructor(): void { $this->assertInstanceOf( DataUrl::class, @@ -42,8 +40,6 @@ public function testConstructor(): void { ); } - // #[CoversMethod( DataUrl::class, "getMediaType" )] - // #[CoversMethod( DataUrl::class, "__construct" )] #[DataProvider( "provideValidDataUrls" )] public function testGetMediaType( string $validDataUrl ): void { $this->assertInstanceOf( @@ -52,8 +48,6 @@ public function testGetMediaType( string $validDataUrl ): void { ); } - // #[CoversMethod( DataUrl::class, "getMediaType" )] - // #[CoversMethod( DataUrl::class, "__construct" )] #[DataProvider( "provideMediaTypeEssences" )] public function testGetMediaTypeEssence( string $expectedMediaTypeEssence, string $validDataUrl ): void { $this->assertEquals( @@ -62,8 +56,6 @@ public function testGetMediaTypeEssence( string $expectedMediaTypeEssence, strin ); } - // #[CoversMethod( DataUrl::class, "getMediaType" )] - // #[CoversMethod( DataUrl::class, "__construct" )] #[DataProvider( "provideMediaTypeParameters" )] public function testGetMediaTypeParameterValue( string $expectedParameter, string $expectedParameterValue, string $validDataUrl ): void { $this->assertEquals( @@ -72,8 +64,6 @@ public function testGetMediaTypeParameterValue( string $expectedParameter, strin ); } - // #[CoversMethod( DataUrl::class, "getData" )] - // #[CoversMethod( DataUrl::class, "__construct" )] #[DataProvider( "provideData" )] public function testGetData( string $expectedData, string $validDataUrl ): void { $this->assertEquals( @@ -82,8 +72,6 @@ public function testGetData( string $expectedData, string $validDataUrl ): void ); } - // #[CoversMethod( DataUrl::class, "getDecodedValue" )] - // #[CoversMethod( DataUrl::class, "__construct" )] #[DataProvider( "provideDecodedValues" )] public function testGetDecodedValue( string $expectedDecodedValue, string $validDataUrl ): void { $this->assertEquals( @@ -98,8 +86,6 @@ public function testGetDecodedValue( string $expectedDecodedValue, string $valid ); } - // #[CoversMethod( DataUrl::class, "__construct" )] - // #[CoversMethod( DataUrl::class, "__toString" )] #[DataProvider( "provideStrings" )] public function testToString( string $expectedDataUrl, string $actualValidDataUrl ): void { $this->assertEquals( diff --git a/tests/InvalidDataUrlSyntaxExceptionTest.php b/tests/InvalidDataUrlSyntaxExceptionTest.php index 8c4fed5..864d862 100644 --- a/tests/InvalidDataUrlSyntaxExceptionTest.php +++ b/tests/InvalidDataUrlSyntaxExceptionTest.php @@ -4,13 +4,11 @@ use Neoncitylights\DataUrl\InvalidDataUrlSyntaxException; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\CoversMethod; use PHPUnit\Framework\TestCase; #[CoversClass( InvalidDataUrlSyntaxException::class )] class InvalidDataUrlSyntaxExceptionTest extends TestCase { - // #[CoversMethod( InvalidDataUrlSyntaxException::class, "__construct" )] public function testConstructor(): void { $this->expectException( InvalidDataUrlSyntaxException::class ); throw new InvalidDataUrlSyntaxException( From 57b7f8d234bf89f3ae05a1e2059672821e22ab67 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Thu, 12 Dec 2024 12:17:12 -0600 Subject: [PATCH 11/19] fix changelog re:phpunit --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f7a55f..bb99d86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ - `mediawiki/minus-x` was bumped from v1.1.0 to v1.1.3. - `php-parallel-lint/php-console-highlighter` was bumped from v0.5.0 to v1.0.0. - `php-parallel-lint/php-parallel-lint` was bumped from v1.2.0 to v1.4.0. -- `phpunit/phpunit` was bumped from v9.4 to v9.6.19. +- `phpunit/phpunit` was bumped from v9.4 to v11.5.1. ## v2.0.0 (2020-11-12) This release included a small unit test for retrieving a media type parameter value. From 15cfe2fb5aa5a97095ec406e229949faebdd360b Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Thu, 12 Dec 2024 12:36:45 -0600 Subject: [PATCH 12/19] Update phpunit.xml.dist --- phpunit.xml.dist | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 9707688..71853fb 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,12 +1,11 @@ Date: Thu, 12 Dec 2024 12:45:25 -0600 Subject: [PATCH 13/19] update commit message prefixes for dependabot --- .github/dependabot.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c724c18..ca89930 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,7 +10,7 @@ updates: schedule: interval: "weekly" commit-message: - prefix: "chore(deps/composer):" + prefix: "deps(composer):" groups: mediawiki: patterns: @@ -29,5 +29,5 @@ updates: schedule: interval: "weekly" commit-message: - prefix: "chore(deps/actions):" + prefix: "deps(actions):" open-pull-requests-limit: 4 From 409669e55e461ea6c813e46612fa993c70390402 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Thu, 12 Dec 2024 16:20:07 -0600 Subject: [PATCH 14/19] rename exception, update changelog + readme --- CHANGELOG.md | 6 +++++- README.md | 2 +- src/DataUrlParser.php | 8 ++++---- ...Exception.php => DataUrlParserException.php} | 2 +- tests/DataUrlParserExceptionTest.php | 17 +++++++++++++++++ tests/InvalidDataUrlSyntaxExceptionTest.php | 17 ----------------- 6 files changed, 28 insertions(+), 24 deletions(-) rename src/{InvalidDataUrlSyntaxException.php => DataUrlParserException.php} (84%) create mode 100644 tests/DataUrlParserExceptionTest.php delete mode 100644 tests/InvalidDataUrlSyntaxExceptionTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index bb99d86..fa13379 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,12 @@ ## v3.0.0 (Unreleased) -### Deprecated +### Breaking changes - This library's minimum PHP version was bumped from v8.1 to v8.2 (`neoncitylights/media-type` requires PHP v8.2). +- `InvalidDataUrlSyntaxException` was renamed to `DataUrlParserException`. +- `DataUrlParser->parse()` can now also throw `MediaTypeParserException` if the media type cannot be parsed. + +### Deprecated - Calling `DataUrlParser->parse()` is now deprecated. Instead, call `DataUrlParser->parseOrThrow()`. This method been renamed to be more explicit in side effects (throwing an exception). - Creating a new `DataUrlParser` instance without any arguments is now deprecated. Instead, pass in an instance of `Neoncitylights\MediaType\MediaTypeParser` as an argument, like so: ```php diff --git a/README.md b/README.md index d6c6a52..28289fd 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ use Neoncitylights\DataUrl\DataUrlParser; use Neoncitylights\MediaType\MediaTypeParser; $dataUrlParser = new DataUrlParser( new MediaTypeParser() ); -$dataUrl = $dataUrlParser->parse( 'data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' ); +$dataUrl = $dataUrlParser->parseOrNull( 'data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' ); print( $dataUrl->getMediaType()->getEssence() ); // 'text/plain' diff --git a/src/DataUrlParser.php b/src/DataUrlParser.php index dc5b1a2..47c8cd6 100644 --- a/src/DataUrlParser.php +++ b/src/DataUrlParser.php @@ -32,7 +32,7 @@ public function __construct( ?MediaTypeParser $mediaTypeParser ) { public function parseOrNull( string $dataUrl ): DataUrl|null { try { return $this->parseOrThrow( $dataUrl ); - } catch ( InvalidDataUrlSyntaxException | MediaTypeParserException $e ) { + } catch ( DataUrlParserException | MediaTypeParserException $e ) { return null; } } @@ -52,14 +52,14 @@ public function parseOrThrow( string $dataUrl ): DataUrl { $trimmedDataUrl = trim( $dataUrl ); if ( empty( $trimmedDataUrl ) ) { - throw new InvalidDataUrlSyntaxException( + throw new DataUrlParserException( "A valid data URL must not be an empty string.", $dataUrl ); } if ( strpos( $trimmedDataUrl, Token::UriScheme->value ) === false ) { - throw new InvalidDataUrlSyntaxException( + throw new DataUrlParserException( "A valid data URL requires including a \"data:\" scheme.", $dataUrl ); @@ -68,7 +68,7 @@ public function parseOrThrow( string $dataUrl ): DataUrl { $urlPath = substr( $trimmedDataUrl, strlen( Token::UriScheme->value ) ); $lastCommaIndex = strrpos( $urlPath, Token::Comma->value ); if ( $lastCommaIndex === false ) { - throw new InvalidDataUrlSyntaxException( + throw new DataUrlParserException( "A valid data URL requires including a comma character.", $dataUrl ); diff --git a/src/InvalidDataUrlSyntaxException.php b/src/DataUrlParserException.php similarity index 84% rename from src/InvalidDataUrlSyntaxException.php rename to src/DataUrlParserException.php index 5c28a1a..f1c4873 100644 --- a/src/InvalidDataUrlSyntaxException.php +++ b/src/DataUrlParserException.php @@ -7,7 +7,7 @@ /** * @license MIT */ -class InvalidDataUrlSyntaxException extends InvalidArgumentException { +class DataUrlParserException extends InvalidArgumentException { /** * @param string $errorMessage * @param string $invalidDataUrl diff --git a/tests/DataUrlParserExceptionTest.php b/tests/DataUrlParserExceptionTest.php new file mode 100644 index 0000000..9324d8a --- /dev/null +++ b/tests/DataUrlParserExceptionTest.php @@ -0,0 +1,17 @@ +expectException( DataUrlParserException::class ); + throw new DataUrlParserException( + 'A valid data URL must not be an empty string.', ''); + } +} diff --git a/tests/InvalidDataUrlSyntaxExceptionTest.php b/tests/InvalidDataUrlSyntaxExceptionTest.php deleted file mode 100644 index 864d862..0000000 --- a/tests/InvalidDataUrlSyntaxExceptionTest.php +++ /dev/null @@ -1,17 +0,0 @@ -expectException( InvalidDataUrlSyntaxException::class ); - throw new InvalidDataUrlSyntaxException( - 'A valid data URL must not be an empty string.', ''); - } -} From f2b4de6ca215c9e83cf3f610ae3ce04f9699acf2 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Thu, 12 Dec 2024 16:22:04 -0600 Subject: [PATCH 15/19] fix tests too --- tests/DataUrlParserTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/DataUrlParserTest.php b/tests/DataUrlParserTest.php index bb133a0..f170ad3 100644 --- a/tests/DataUrlParserTest.php +++ b/tests/DataUrlParserTest.php @@ -4,7 +4,7 @@ use Neoncitylights\DataUrl\DataUrl; use Neoncitylights\DataUrl\DataUrlParser; -use Neoncitylights\DataUrl\InvalidDataUrlSyntaxException; +use Neoncitylights\DataUrl\DataUrlParserException; use Neoncitylights\MediaType\MediaType; use Neoncitylights\MediaType\MediaTypeParser; use PHPUnit\Framework\Attributes\CoversClass; @@ -14,7 +14,7 @@ #[CoversClass( DataUrlParser::class )] #[UsesClass( DataUrl::class )] -#[UsesClass( InvalidDataUrlSyntaxException::class )] +#[UsesClass( DataUrlParserException::class )] #[UsesClass( MediaType::class )] #[UsesClass( MediaTypeParser::class )] class DataUrlParserTest extends TestCase { @@ -30,7 +30,7 @@ public function testParseValidDataUrls( DataUrl $expectedDataUrlObject, string $ #[DataProvider( "provideInvalidDataUrls" )] public function testParseInvalidDataUrls( string $invalidDataUrl ): void { - $this->expectException( InvalidDataUrlSyntaxException::class ); + $this->expectException( DataUrlParserException::class ); $parser = new DataUrlParser( new MediaTypeParser() ); $parser->parseOrThrow( $invalidDataUrl ); From dc344ccfb984e07c03676f566e8bb27cbed7b5b4 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Thu, 12 Dec 2024 21:23:23 -0600 Subject: [PATCH 16/19] some more cleanup - removed repetitive doc comments for types - add types for MediaType's properties - add test for DataUrlParser->parseOrNull() - ignore code coverage for DataUrlParser->parse(), which does nothing but call parseOrThrow() - make link to RFC 2397 in code consistent with README.md - cleanup badges in README.md - bring back code coverage uploads to Codecov in CI --- .github/workflows/php.yml | 6 ++++++ CHANGELOG.md | 3 ++- README.md | 17 +++++++++++++---- src/DataUrl.php | 19 ++----------------- src/DataUrlParser.php | 5 ++--- src/DataUrlParserException.php | 4 ---- tests/DataUrlParserTest.php | 10 ++++++++-- 7 files changed, 33 insertions(+), 31 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 523ed65..9d2ff32 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -39,3 +39,9 @@ jobs: run: composer install --prefer-dist --no-progress - name: Run test suite run: composer test + - name: Upload code coverage + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + files: coverage.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index fa13379..43bf80a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ ### Breaking changes - This library's minimum PHP version was bumped from v8.1 to v8.2 (`neoncitylights/media-type` requires PHP v8.2). - `InvalidDataUrlSyntaxException` was renamed to `DataUrlParserException`. -- `DataUrlParser->parse()` can now also throw `MediaTypeParserException` if the media type cannot be parsed. +- `DataUrlParser->parse()`/`parseOrThrow()` can now also throw `MediaTypeParserException` if the media type cannot be parsed. ### Deprecated - Calling `DataUrlParser->parse()` is now deprecated. Instead, call `DataUrlParser->parseOrThrow()`. This method been renamed to be more explicit in side effects (throwing an exception). @@ -21,6 +21,7 @@ - `DataUrlParser` has a new instance method, `parseOrNull()`, which either returns `DataUrl` or `null`. This method is an alternative to `parseOrThrow()`. ### Internal changes +- The private properties of `MediaType` are now strongly type-hinted. Note that these were already technically typehinted since they were private, and the constructor signature was already typehinted. - The library's CI now also runs builds against PHP v8.3 and PHP v8.4 (not just PHP v8.2). - `mediawiki/mediawiki-sniffer` was bumped from v33.0.0 to v45.0.0. - `mediawiki/minus-x` was bumped from v1.1.0 to v1.1.3. diff --git a/README.md b/README.md index 28289fd..8efa810 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,17 @@ # DataUrl -![Packagist Version](https://img.shields.io/packagist/v/neoncitylights/data-url) -![GitHub](https://img.shields.io/github/license/neoncitylights/php-data-url) -[![PHP Composer](https://github.com/neoncitylights/php-data-url/actions/workflows/php.yml/badge.svg)](https://github.com/neoncitylights/php-data-url/actions/workflows/php.yml) -[![codecov](https://codecov.io/gh/neoncitylights/php-data-url/branch/main/graph/badge.svg?token=IdWjeqFQcS)](https://codecov.io/gh/neoncitylights/php-data-url) +[![Packagist][packagist-badge]][packagist-url] +[![License][license-badge]][license-url] +[![CI][ci-badge]][ci-url] +[![Codecov][codecov-badge]][codecov-url] + +[packagist-badge]: https://img.shields.io/packagist/v/neoncitylights/data-url?style=flat-square +[packagist-url]: https://packagist.org/packages/neoncitylights/data-url +[license-badge]: https://img.shields.io/badge/License-MIT-blue?style=flat-square +[license-url]: #license +[ci-badge]: https://img.shields.io/github/actions/workflow/status/neoncitylights/php-data-url/.github/workflows/php.yml?style=flat-square +[ci-url]: https://github.com/neoncitylights/php-data-url/actions/workflows/php.yml +[codecov-badge]: https://img.shields.io/codecov/c/github/neoncitylights/php-data-url?style=flat-square +[codecov-url]: https://app.codecov.io/gh/neoncitylights/php-data-url A small PHP library for dealing with data URLs, which contain a media type and an encoded base64 string. diff --git a/src/DataUrl.php b/src/DataUrl.php index 8651bb8..31bbcd9 100644 --- a/src/DataUrl.php +++ b/src/DataUrl.php @@ -11,16 +11,9 @@ * @license MIT */ class DataUrl { - /** @var MediaType */ - private $mediaType; + private MediaType $mediaType; + private string $data; - /** @var string */ - private $data; - - /** - * @param MediaType $mediaType - * @param string $data - */ public function __construct( MediaType $mediaType, string $data ) { $this->mediaType = $mediaType; $this->data = $data; @@ -28,8 +21,6 @@ public function __construct( MediaType $mediaType, string $data ) { /** * Gets the media type of the encoded base64 string. - * - * @return MediaType */ public function getMediaType(): MediaType { return $this->mediaType; @@ -37,8 +28,6 @@ public function getMediaType(): MediaType { /** * Gets the original, encoded base64 string. - * - * @return string */ public function getData(): string { return $this->data; @@ -46,8 +35,6 @@ public function getData(): string { /** * Gets a decoded value of the base64 string. - * - * @return string */ public function getDecodedValue(): string { return base64_decode( $this->data ); @@ -55,8 +42,6 @@ public function getDecodedValue(): string { /** * Returns a data URL compliant with RFC 2397. - * - * @return string */ public function __toString(): string { return sprintf( diff --git a/src/DataUrlParser.php b/src/DataUrlParser.php index 47c8cd6..e5d12ad 100644 --- a/src/DataUrlParser.php +++ b/src/DataUrlParser.php @@ -16,10 +16,8 @@ * which defines the data URL scheme. * - If no media type is provided, the default media type is assumed to be * `text/plain;charset=US-ASCII` - * - If a user passes an invalid data URL, the parser will throw an - * `InvalidDataUrlSyntaxException` * - * @see https://tools.ietf.org/html/rfc2397 + * @see [IETF RFC 2397](https://datatracker.ietf.org/doc/html/rfc2397) * @license MIT */ class DataUrlParser { @@ -40,6 +38,7 @@ public function parseOrNull( string $dataUrl ): DataUrl|null { /** * @throws InvalidDataUrlSyntaxException|MediaTypeParserException * @deprecated Call parseOrThrow() instead. + * @codeCoverageIgnore */ public function parse( string $dataUrl ): DataUrl { return $this->parseOrThrow( $dataUrl ); diff --git a/src/DataUrlParserException.php b/src/DataUrlParserException.php index f1c4873..8de045e 100644 --- a/src/DataUrlParserException.php +++ b/src/DataUrlParserException.php @@ -8,10 +8,6 @@ * @license MIT */ class DataUrlParserException extends InvalidArgumentException { - /** - * @param string $errorMessage - * @param string $invalidDataUrl - */ public function __construct( string $errorMessage, string $invalidDataUrl ) { parent::__construct( "{$errorMessage} " . diff --git a/tests/DataUrlParserTest.php b/tests/DataUrlParserTest.php index f170ad3..8e61738 100644 --- a/tests/DataUrlParserTest.php +++ b/tests/DataUrlParserTest.php @@ -19,8 +19,14 @@ #[UsesClass( MediaTypeParser::class )] class DataUrlParserTest extends TestCase { + #[DataProvider( "provideInvalidDataUrls" )] + public function testParseOrNull( string $invalidDataUrl ): void { + $parser = new DataUrlParser( new MediaTypeParser() ); + $this->assertNull($parser->parseOrNull($invalidDataUrl)); + } + #[DataProvider( "provideValidTextBasedDataUrls" )] - public function testParseValidDataUrls( DataUrl $expectedDataUrlObject, string $validDataUrl ): void { + public function testParseOrThrowValidDataUrls( DataUrl $expectedDataUrlObject, string $validDataUrl ): void { $parser = new DataUrlParser( new MediaTypeParser() ); $this->assertEqualsCanonicalizing( $expectedDataUrlObject, @@ -29,7 +35,7 @@ public function testParseValidDataUrls( DataUrl $expectedDataUrlObject, string $ } #[DataProvider( "provideInvalidDataUrls" )] - public function testParseInvalidDataUrls( string $invalidDataUrl ): void { + public function testParseOrThrowInvalidDataUrls( string $invalidDataUrl ): void { $this->expectException( DataUrlParserException::class ); $parser = new DataUrlParser( new MediaTypeParser() ); From ff6491d67692840ef5e79babb740b45d5e83b2a0 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Thu, 12 Dec 2024 22:09:30 -0600 Subject: [PATCH 17/19] update some config files, and finally release it --- CHANGELOG.md | 2 +- phpdoc.dist.xml | 5 ++--- psalm.xml | 14 -------------- 3 files changed, 3 insertions(+), 18 deletions(-) delete mode 100644 psalm.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 43bf80a..3c342b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## v3.0.0 (Unreleased) +## v3.0.0 (2024-12-12) ### Breaking changes - This library's minimum PHP version was bumped from v8.1 to v8.2 (`neoncitylights/media-type` requires PHP v8.2). diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml index 6360e59..bb43e4f 100644 --- a/phpdoc.dist.xml +++ b/phpdoc.dist.xml @@ -3,21 +3,20 @@ configVersion="3" xmlns="https://www.phpdoc.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - neoncitylights/php-data-url + neoncitylights/data-url docs/build docs/cache - neoncitylights/php-data-url + neoncitylights/data-url src php diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index cc1c8d1..0000000 --- a/psalm.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - From 66068b6a9c3c1af47bdbac151db88d2b3aee7f1c Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Thu, 12 Dec 2024 22:39:08 -0600 Subject: [PATCH 18/19] some last touchups (again) --- .github/dependabot.yml | 2 +- .gitignore | 1 - composer.json | 5 +++-- composer.lock | 20 ++++++++++---------- src/DataUrlParser.php | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ca89930..94a4db8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -29,5 +29,5 @@ updates: schedule: interval: "weekly" commit-message: - prefix: "deps(actions):" + prefix: "deps(gha):" open-pull-requests-limit: 4 diff --git a/.gitignore b/.gitignore index fd2ccb5..b5f71ec 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ phpunit.xml .phpunit.cache .phpunit.result.cache - # phpDocumentor .phpdoc phpdoc.xml diff --git a/composer.json b/composer.json index 3c4e49b..e9b2549 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,8 @@ "name": "neoncitylights/data-url", "authors": [ { - "name": "Samantha Nguyen" + "name": "Samantha Nguyen", + "email": "contact@samanthanguyen.me" } ], "license": "MIT", @@ -29,7 +30,7 @@ } }, "require": { - "neoncitylights/media-type": "^3.0.0", + "neoncitylights/media-type": "^3.1.0", "php": ">= 8.2" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 6151020..3913ca3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "41c33646d1de36e30bb8f218e4767fa4", + "content-hash": "99d267a781948907cb2c3589c126e019", "packages": [ { "name": "neoncitylights/media-type", - "version": "v3.0.0", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/neoncitylights/php-media-type.git", - "reference": "94e102d5a996d4ac9f8f7cf84da5cd3b65040cda" + "reference": "da82ad779e80f22ca2ef4889083dbde138b0d21a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/neoncitylights/php-media-type/zipball/94e102d5a996d4ac9f8f7cf84da5cd3b65040cda", - "reference": "94e102d5a996d4ac9f8f7cf84da5cd3b65040cda", + "url": "https://api.github.com/repos/neoncitylights/php-media-type/zipball/da82ad779e80f22ca2ef4889083dbde138b0d21a", + "reference": "da82ad779e80f22ca2ef4889083dbde138b0d21a", "shasum": "" }, "require": { @@ -26,11 +26,11 @@ "wikimedia/assert": "^0.5.1" }, "require-dev": { - "mediawiki/mediawiki-codesniffer": "43.0.0", - "mediawiki/minus-x": "1.1.1", + "mediawiki/mediawiki-codesniffer": "45.0.0", + "mediawiki/minus-x": "1.1.3", "php-parallel-lint/php-console-highlighter": "1.0.0", "php-parallel-lint/php-parallel-lint": "1.4.0", - "phpunit/phpunit": "11.0.8" + "phpunit/phpunit": "11.5.1" }, "type": "library", "autoload": { @@ -50,7 +50,7 @@ "description": "Allows working with IANA media types as entities in PHP", "support": { "issues": "https://github.com/neoncitylights/php-media-type/issues", - "source": "https://github.com/neoncitylights/php-media-type/tree/v3.0.0" + "source": "https://github.com/neoncitylights/php-media-type/tree/v3.1.0" }, "funding": [ { @@ -58,7 +58,7 @@ "type": "github" } ], - "time": "2024-04-04T01:23:27+00:00" + "time": "2024-12-13T04:36:53+00:00" }, { "name": "wikimedia/assert", diff --git a/src/DataUrlParser.php b/src/DataUrlParser.php index e5d12ad..89d66cc 100644 --- a/src/DataUrlParser.php +++ b/src/DataUrlParser.php @@ -103,6 +103,6 @@ private function getMediaType( string $mediaTypeString ): MediaType { return new MediaType( 'text', 'plain', [ 'charset' => 'US-ASCII', ] ); } - return $this->mediaTypeParser->parse( $mediaTypeString ); + return $this->mediaTypeParser->parseOrThrow( $mediaTypeString ); } } From aa72cdbcef671d1b07de101b9156b4ef9eefad87 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Thu, 12 Dec 2024 22:40:50 -0600 Subject: [PATCH 19/19] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c342b7..769f893 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## v3.0.0 (2024-12-12) +This change bumps `neoncitylights/media-type` from v1.0.0 to v3.1.0 with some other changes listed below to accomodate the dependency bump, and minor cleanup. ### Breaking changes - This library's minimum PHP version was bumped from v8.1 to v8.2 (`neoncitylights/media-type` requires PHP v8.2).