From e8b9c81b79e3004ac7550332fd563492fa48b44e Mon Sep 17 00:00:00 2001 From: Alessandro Chitolina Date: Tue, 30 Mar 2021 20:19:35 +0200 Subject: [PATCH] catch errors and undefined interfaces while traversing composer class map --- composer.lock | 161 ++++++++++-------- .../NonExistentImplementation.php | 7 + lib/Finder/FinderInterface.php | 4 +- lib/Iterator/ComposerIterator.php | 6 +- lib/Iterator/FilteredComposerIterator.php | 13 +- lib/Iterator/Psr0Iterator.php | 2 +- lib/Iterator/Psr4Iterator.php | 2 +- 7 files changed, 115 insertions(+), 80 deletions(-) create mode 100644 data/Psr4WithClassMap/NonExistentImplementation.php diff --git a/composer.lock b/composer.lock index b86b0f5..f8581a3 100644 --- a/composer.lock +++ b/composer.lock @@ -667,16 +667,16 @@ }, { "name": "phar-io/version", - "version": "3.0.4", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "e4782611070e50613683d2b9a57730e9a3ba5451" + "reference": "bae7c545bef187884426f042434e561ab1ddb182" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451", - "reference": "e4782611070e50613683d2b9a57730e9a3ba5451", + "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", + "reference": "bae7c545bef187884426f042434e561ab1ddb182", "shasum": "" }, "require": { @@ -712,9 +712,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.0.4" + "source": "https://github.com/phar-io/version/tree/3.1.0" }, - "time": "2020-12-13T23:18:30+00:00" + "time": "2021-02-23T14:00:09+00:00" }, { "name": "phpdocumentor/reflection", @@ -932,16 +932,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.12.2", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "245710e971a030f42e08f4912863805570f23d39" + "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", - "reference": "245710e971a030f42e08f4912863805570f23d39", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", + "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", "shasum": "" }, "require": { @@ -993,9 +993,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.12.2" + "source": "https://github.com/phpspec/prophecy/tree/1.13.0" }, - "time": "2020-12-19T10:15:11+00:00" + "time": "2021-03-17T13:42:18+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -1052,16 +1052,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.78", + "version": "0.12.82", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "eecce8d2ee3cac6769f37b4cb1998b2715f82984" + "reference": "3920f0fb0aff39263d3a4cb0bca120a67a1a6a11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/eecce8d2ee3cac6769f37b4cb1998b2715f82984", - "reference": "eecce8d2ee3cac6769f37b4cb1998b2715f82984", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3920f0fb0aff39263d3a4cb0bca120a67a1a6a11", + "reference": "3920f0fb0aff39263d3a4cb0bca120a67a1a6a11", "shasum": "" }, "require": { @@ -1092,7 +1092,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.78" + "source": "https://github.com/phpstan/phpstan/tree/0.12.82" }, "funding": [ { @@ -1108,20 +1108,20 @@ "type": "tidelift" } ], - "time": "2021-02-20T13:24:36+00:00" + "time": "2021-03-19T06:08:17+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.5", + "version": "9.2.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1" + "reference": "f6293e1b30a2354e8428e004689671b83871edde" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f3e026641cc91909d421802dd3ac7827ebfd97e1", - "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f6293e1b30a2354e8428e004689671b83871edde", + "reference": "f6293e1b30a2354e8428e004689671b83871edde", "shasum": "" }, "require": { @@ -1177,7 +1177,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.5" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.6" }, "funding": [ { @@ -1185,7 +1185,7 @@ "type": "github" } ], - "time": "2020-11-28T06:44:49+00:00" + "time": "2021-03-28T07:26:59+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1430,16 +1430,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.2", + "version": "9.5.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4" + "reference": "c73c6737305e779771147af66c96ca6a7ed8a741" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f661659747f2f87f9e72095bb207bceb0f151cb4", - "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c73c6737305e779771147af66c96ca6a7ed8a741", + "reference": "c73c6737305e779771147af66c96ca6a7ed8a741", "shasum": "" }, "require": { @@ -1517,7 +1517,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.2" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.4" }, "funding": [ { @@ -1529,7 +1529,7 @@ "type": "github" } ], - "time": "2021-02-02T14:45:58+00:00" + "time": "2021-03-23T07:16:29+00:00" }, { "name": "psr/log", @@ -1587,12 +1587,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "640ff0b5dcacc0958534c8c0255b90697f3eb2a8" + "reference": "0a55b3eacf6b4a0fdc6ec9d01e00285ca9942b2b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/640ff0b5dcacc0958534c8c0255b90697f3eb2a8", - "reference": "640ff0b5dcacc0958534c8c0255b90697f3eb2a8", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/0a55b3eacf6b4a0fdc6ec9d01e00285ca9942b2b", + "reference": "0a55b3eacf6b4a0fdc6ec9d01e00285ca9942b2b", "shasum": "" }, "conflict": { @@ -1651,16 +1651,19 @@ "ezsystems/ezplatform": ">=1.7,<1.7.9.1|>=1.13,<1.13.5.1|>=2.5,<2.5.4", "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6", "ezsystems/ezplatform-admin-ui-assets": ">=4,<4.2.1|>=5,<5.0.1|>=5.1,<5.1.1", - "ezsystems/ezplatform-kernel": ">=1,<1.0.2.1", + "ezsystems/ezplatform-kernel": "<=1.2.5|>=1.3,<=1.3.1", + "ezsystems/ezplatform-rest": ">=1.2,<=1.2.2|>=1.3,<=1.3.1", "ezsystems/ezplatform-user": ">=1,<1.0.1", - "ezsystems/ezpublish-kernel": ">=5.3,<5.3.12.1|>=5.4,<5.4.14.2|>=6,<6.7.9.1|>=6.8,<6.13.6.3|>=7,<7.2.4.1|>=7.3,<7.3.2.1|>=7.5,<7.5.7.1", + "ezsystems/ezpublish-kernel": "<=6.13.8.1|>=7,<=7.5.15.1", "ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.6|>=5.4,<5.4.14.2|>=2011,<2017.12.7.3|>=2018.6,<2018.6.1.4|>=2018.9,<2018.9.1.3|>=2019.3,<2019.3.5.1", "ezsystems/platform-ui-assets-bundle": ">=4.2,<4.2.3", "ezsystems/repository-forms": ">=2.3,<2.3.2.1", "ezyang/htmlpurifier": "<4.1.1", + "facade/ignition": "<1.16.14|>=2,<2.4.2|>=2.5,<2.5.2", "firebase/php-jwt": "<2", "flarum/sticky": ">=0.1-beta.14,<=0.1-beta.15", "flarum/tags": "<=0.1-beta.13", + "fluidtypo3/vhs": "<5.1.1", "fooman/tcpdf": "<6.2.22", "fossar/tcpdf-parser": "<6.2.22", "friendsofsymfony/oauth2-php": "<1.3", @@ -1680,8 +1683,10 @@ "illuminate/database": "<6.20.14|>=7,<7.30.4|>=8,<8.24", "illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15", "illuminate/view": ">=7,<7.1.2", + "impresscms/impresscms": "<=1.4.2", "ivankristianto/phpwhois": "<=4.3", "james-heinrich/getid3": "<1.9.9", + "joomla/archive": "<1.1.10", "joomla/session": "<1.3.1", "jsmitty12/phpwhois": "<5.1", "kazist/phpwhois": "<=4.2.6", @@ -1702,12 +1707,13 @@ "mediawiki/core": ">=1.27,<1.27.6|>=1.29,<1.29.3|>=1.30,<1.30.2|>=1.31,<1.31.9|>=1.32,<1.32.6|>=1.32.99,<1.33.3|>=1.33.99,<1.34.3|>=1.34.99,<1.35", "mittwald/typo3_forum": "<1.2.1", "monolog/monolog": ">=1.8,<1.12", + "moodle/moodle": "<3.5.17|>=3.7,<3.7.9|>=3.8,<3.8.8|>=3.9,<3.9.5|>=3.10,<3.10.2", "namshi/jose": "<2.2", "nette/application": ">=2,<2.0.19|>=2.1,<2.1.13|>=2.2,<2.2.10|>=2.3,<2.3.14|>=2.4,<2.4.16|>=3,<3.0.6", "nette/nette": ">=2,<2.0.19|>=2.1,<2.1.13", "nystudio107/craft-seomatic": "<3.3", "nzo/url-encryptor-bundle": ">=4,<4.3.2|>=5,<5.0.1", - "october/backend": ">=1.0.319,<1.0.470", + "october/backend": "<1.1.2", "october/cms": "= 1.0.469|>=1.0.319,<1.0.469", "october/october": ">=1.0.319,<1.0.466", "october/rain": "<1.0.472|>=1.1,<1.1.2", @@ -1734,8 +1740,9 @@ "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3", "phpwhois/phpwhois": "<=4.2.5", "phpxmlrpc/extras": "<0.6.1", - "pimcore/pimcore": "<6.3", + "pimcore/pimcore": "<6.8.8", "pocketmine/pocketmine-mp": "<3.15.4", + "pressbooks/pressbooks": "<5.18", "prestashop/autoupgrade": ">=4,<4.10.1", "prestashop/contactform": ">1.0.1,<4.3", "prestashop/gamification": "<2.3.2", @@ -1754,7 +1761,7 @@ "sensiolabs/connect": "<4.2.3", "serluck/phpwhois": "<=4.2.6", "shopware/core": "<=6.3.4", - "shopware/platform": "<=6.3.5", + "shopware/platform": "<=6.3.5.1", "shopware/shopware": "<5.6.9", "silverstripe/admin": ">=1.0.3,<1.0.4|>=1.1,<1.1.1", "silverstripe/assets": ">=1,<1.4.7|>=1.5,<1.5.2", @@ -1774,7 +1781,7 @@ "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", "simplito/elliptic-php": "<1.0.6", "slim/slim": "<2.6", - "smarty/smarty": "<3.1.33", + "smarty/smarty": "<3.1.39", "socalnick/scn-social-auth": "<1.15.2", "socialiteproviders/steam": "<1.1", "spoonity/tcpdf": "<6.2.22", @@ -1790,6 +1797,7 @@ "sylius/resource-bundle": "<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4", "sylius/sylius": "<1.6.9|>=1.7,<1.7.9|>=1.8,<1.8.3", "symbiote/silverstripe-multivaluefield": ">=3,<3.0.99", + "symbiote/silverstripe-queuedjobs": ">=3,<3.0.2|>=3.1,<3.1.4|>=4,<4.0.7|>=4.1,<4.1.2|>=4.2,<4.2.4|>=4.3,<4.3.3|>=4.4,<4.4.3|>=4.5,<4.5.1|>=4.6,<4.6.4", "symbiote/silverstripe-versionedfiles": "<=2.0.3", "symfony/cache": ">=3.1,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8", "symfony/dependency-injection": ">=2,<2.0.17|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", @@ -1826,8 +1834,10 @@ "titon/framework": ">=0,<9.9.99", "truckersmp/phpwhois": "<=4.3.1", "twig/twig": "<1.38|>=2,<2.7", - "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.38|>=9,<9.5.23|>=10,<10.4.10", - "typo3/cms-core": ">=8,<8.7.38|>=9,<9.5.23|>=10,<10.4.10", + "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.38|>=9,<9.5.25|>=10,<10.4.14|>=11,<11.1.1", + "typo3/cms-backend": ">=7,<=7.6.50|>=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", + "typo3/cms-core": ">=6.2,<=6.2.56|>=7,<=7.6.50|>=8,<=8.7.39|>=9,<9.5.25|>=10,<10.4.14|>=11,<11.1.1", + "typo3/cms-form": ">=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5", "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4", "typo3/phar-stream-wrapper": ">=1,<2.1.1|>=3,<3.1.1", @@ -1906,7 +1916,7 @@ "type": "tidelift" } ], - "time": "2021-02-18T21:02:27+00:00" + "time": "2021-03-29T21:01:39+00:00" }, { "name": "sebastian/cli-parser", @@ -2939,12 +2949,12 @@ "source": { "type": "git", "url": "https://github.com/solid-o/php-coding-standards.git", - "reference": "4db3c52e899ce3fcdb2e004104fdb11c1f050fc0" + "reference": "4cd8285207c334d404a36fb1d58f81457adb7f37" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/solid-o/php-coding-standards/zipball/4db3c52e899ce3fcdb2e004104fdb11c1f050fc0", - "reference": "4db3c52e899ce3fcdb2e004104fdb11c1f050fc0", + "url": "https://api.github.com/repos/solid-o/php-coding-standards/zipball/4cd8285207c334d404a36fb1d58f81457adb7f37", + "reference": "4cd8285207c334d404a36fb1d58f81457adb7f37", "shasum": "" }, "require": { @@ -2980,7 +2990,7 @@ "issues": "https://github.com/solid-o/php-coding-standards/issues", "source": "https://github.com/solid-o/php-coding-standards/tree/master" }, - "time": "2020-10-25T13:17:15+00:00" + "time": "2021-03-18T09:42:35+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -3040,16 +3050,16 @@ }, { "name": "symfony/debug", - "version": "v4.4.19", + "version": "v4.4.20", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "af4987aa4a5630e9615be9d9c3ed1b0f24ca449c" + "reference": "157bbec4fd773bae53c5483c50951a5530a2cc16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/af4987aa4a5630e9615be9d9c3ed1b0f24ca449c", - "reference": "af4987aa4a5630e9615be9d9c3ed1b0f24ca449c", + "url": "https://api.github.com/repos/symfony/debug/zipball/157bbec4fd773bae53c5483c50951a5530a2cc16", + "reference": "157bbec4fd773bae53c5483c50951a5530a2cc16", "shasum": "" }, "require": { @@ -3089,7 +3099,7 @@ "description": "Provides tools to ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/debug/tree/v4.4.19" + "source": "https://github.com/symfony/debug/tree/v4.4.20" }, "funding": [ { @@ -3105,20 +3115,20 @@ "type": "tidelift" } ], - "time": "2021-01-27T09:09:26+00:00" + "time": "2021-01-28T16:54:48+00:00" }, { "name": "symfony/error-handler", - "version": "v5.2.3", + "version": "v5.2.6", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "48f18b3609e120ea66d59142c23dc53e9562c26d" + "reference": "bdb7fb4188da7f4211e4b88350ba0dfdad002b03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/48f18b3609e120ea66d59142c23dc53e9562c26d", - "reference": "48f18b3609e120ea66d59142c23dc53e9562c26d", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/bdb7fb4188da7f4211e4b88350ba0dfdad002b03", + "reference": "bdb7fb4188da7f4211e4b88350ba0dfdad002b03", "shasum": "" }, "require": { @@ -3158,7 +3168,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v5.2.3" + "source": "https://github.com/symfony/error-handler/tree/v5.2.6" }, "funding": [ { @@ -3174,7 +3184,7 @@ "type": "tidelift" } ], - "time": "2021-01-28T22:06:19+00:00" + "time": "2021-03-16T09:07:47+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3420,16 +3430,16 @@ }, { "name": "symfony/var-dumper", - "version": "v5.2.3", + "version": "v5.2.6", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "72ca213014a92223a5d18651ce79ef441c12b694" + "reference": "89412a68ea2e675b4e44f260a5666729f77f668e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/72ca213014a92223a5d18651ce79ef441c12b694", - "reference": "72ca213014a92223a5d18651ce79ef441c12b694", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/89412a68ea2e675b4e44f260a5666729f77f668e", + "reference": "89412a68ea2e675b4e44f260a5666729f77f668e", "shasum": "" }, "require": { @@ -3488,7 +3498,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.2.3" + "source": "https://github.com/symfony/var-dumper/tree/v5.2.6" }, "funding": [ { @@ -3504,7 +3514,7 @@ "type": "tidelift" } ], - "time": "2021-01-27T10:15:41+00:00" + "time": "2021-03-28T09:42:18+00:00" }, { "name": "thecodingmachine/phpstan-safe-rule", @@ -3670,30 +3680,35 @@ }, { "name": "webmozart/assert", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", + "php": "^7.2 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" + "vimeo/psalm": "<4.6.1 || 4.6.2" }, "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "phpunit/phpunit": "^8.5.13" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -3717,9 +3732,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.9.1" + "source": "https://github.com/webmozarts/assert/tree/1.10.0" }, - "time": "2020-07-08T17:02:28+00:00" + "time": "2021-03-09T10:59:23+00:00" } ], "aliases": [], diff --git a/data/Psr4WithClassMap/NonExistentImplementation.php b/data/Psr4WithClassMap/NonExistentImplementation.php new file mode 100644 index 0000000..0dbe0a7 --- /dev/null +++ b/data/Psr4WithClassMap/NonExistentImplementation.php @@ -0,0 +1,7 @@ +classLoader->getClassMap() as $class => $file) { ErrorHandler::register(); try { - yield $class => new ReflectionClass($class); + $reflectionClass = new ReflectionClass($class); } catch (Throwable $e) { /** @phpstan-ignore-line */ - // @ignoreException + continue; } finally { ErrorHandler::unregister(); } + + yield $class => $reflectionClass; } } diff --git a/lib/Iterator/FilteredComposerIterator.php b/lib/Iterator/FilteredComposerIterator.php index a99d0a9..1837dab 100644 --- a/lib/Iterator/FilteredComposerIterator.php +++ b/lib/Iterator/FilteredComposerIterator.php @@ -7,7 +7,9 @@ use Composer\Autoload\ClassLoader; use Generator; use Kcs\ClassFinder\PathNormalizer; +use Kcs\ClassFinder\Util\ErrorHandler; use ReflectionClass; +use Throwable; use function array_map; use function array_unique; @@ -82,7 +84,16 @@ private function searchInClassMap(): Generator continue; } - yield $class => new ReflectionClass($class); + ErrorHandler::register(); + try { + $reflectionClass = new ReflectionClass($class); + } catch (Throwable $e) { /** @phpstan-ignore-line */ + continue; + } finally { + ErrorHandler::unregister(); + } + + yield $class => $reflectionClass; } } diff --git a/lib/Iterator/Psr0Iterator.php b/lib/Iterator/Psr0Iterator.php index 0462cf3..53569a4 100644 --- a/lib/Iterator/Psr0Iterator.php +++ b/lib/Iterator/Psr0Iterator.php @@ -52,7 +52,7 @@ public function __construct(string $namespace, string $path, int $flags = 0, arr protected function getGenerator(): Generator { $pattern = defined('HHVM_VERSION') ? '/\\.(php|hh)$/i' : '/\\.php$/i'; - $include = Closure::bind(static function (string $path) { + $include = Closure::bind(static function (string $path): void { include_once $path; }, null, null); diff --git a/lib/Iterator/Psr4Iterator.php b/lib/Iterator/Psr4Iterator.php index e3183f4..f76c818 100644 --- a/lib/Iterator/Psr4Iterator.php +++ b/lib/Iterator/Psr4Iterator.php @@ -52,7 +52,7 @@ public function __construct(string $namespace, string $path, int $flags = 0, arr protected function getGenerator(): Generator { $pattern = defined('HHVM_VERSION') ? '/\\.(php|hh)$/i' : '/\\.php$/i'; - $include = Closure::bind(static function (string $path) { + $include = Closure::bind(static function (string $path): void { include_once $path; }, null, null);