From f619bacdb4406f20421e0375813107ac66f1f3f2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 11 May 2023 15:04:36 +0000 Subject: [PATCH 1/3] Update dependency vimeo/psalm to v5 --- composer.json | 2 +- composer.lock | 583 +++++++++++++++++++++++--------------------------- 2 files changed, 269 insertions(+), 316 deletions(-) diff --git a/composer.json b/composer.json index bdd9e775..0feb3a09 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "require-dev": { "ext-posix": "*", "phpunit/phpunit": "9.6.8", - "vimeo/psalm": "4.30.0", + "vimeo/psalm": "5.11.0", "squizlabs/php_codesniffer": "3.7.2", "mockery/mockery": "1.5.1", "psalm/plugin-mockery": "0.11.0", diff --git a/composer.lock b/composer.lock index 5a202ba0..374a06eb 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": "8249ba71807a01abc9b95eee1e52f69e", + "content-hash": "12ef711d4486f63e86d90b758bfcc988", "packages": [ { "name": "amphp/amp", @@ -1787,91 +1787,18 @@ } ], "packages-dev": [ - { - "name": "composer/package-versions-deprecated", - "version": "1.11.99.5", - "source": { - "type": "git", - "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d", - "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1.0 || ^2.0", - "php": "^7 || ^8" - }, - "replace": { - "ocramius/package-versions": "1.11.99" - }, - "require-dev": { - "composer/composer": "^1.9.3 || ^2.0@dev", - "ext-zip": "^1.13", - "phpunit/phpunit": "^6.5 || ^7" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "support": { - "issues": "https://github.com/composer/package-versions-deprecated/issues", - "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.5" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2022-01-17T14:14:24+00:00" - }, { "name": "composer/pcre", - "version": "3.0.2", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "4482b6409ca6bfc2af043a5711cd21ac3e7a8dfb" + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/4482b6409ca6bfc2af043a5711cd21ac3e7a8dfb", - "reference": "4482b6409ca6bfc2af043a5711cd21ac3e7a8dfb", + "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", "shasum": "" }, "require": { @@ -1913,7 +1840,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.0.2" + "source": "https://github.com/composer/pcre/tree/3.1.0" }, "funding": [ { @@ -1929,7 +1856,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T20:24:16+00:00" + "time": "2022-11-17T09:50:14+00:00" }, { "name": "composer/semver", @@ -2115,6 +2042,49 @@ }, "time": "2019-12-04T15:06:13+00:00" }, + { + "name": "doctrine/deprecations", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" + }, + "time": "2022-05-02T15:47:09+00:00" + }, { "name": "doctrine/instantiator", "version": "2.0.0", @@ -2286,6 +2256,67 @@ }, "time": "2022-03-02T22:36:06+00:00" }, + { + "name": "fidry/cpu-core-counter", + "version": "0.5.1", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/b58e5a3933e541dc286cc91fc4f3898bbc6f1623", + "reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "fidry/makefile": "^0.2.0", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^1.9.2", + "phpstan/phpstan-deprecation-rules": "^1.0.0", + "phpstan/phpstan-phpunit": "^1.2.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpunit/phpunit": "^9.5.26 || ^8.5.31", + "theofidry/php-cs-fixer-config": "^1.0", + "webmozarts/strict-phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Tiny utility to get the number of CPU cores.", + "keywords": [ + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/0.5.1" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2022-12-24T12:35:10+00:00" + }, { "name": "guzzlehttp/guzzle", "version": "7.5.1", @@ -2846,16 +2877,16 @@ }, { "name": "netresearch/jsonmapper", - "version": "v4.0.0", + "version": "v4.2.0", "source": { "type": "git", "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d" + "reference": "f60565f8c0566a31acf06884cdaa591867ecc956" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", - "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/f60565f8c0566a31acf06884cdaa591867ecc956", + "reference": "f60565f8c0566a31acf06884cdaa591867ecc956", "shasum": "" }, "require": { @@ -2891,9 +2922,9 @@ "support": { "email": "cweiske@cweiske.de", "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/v4.0.0" + "source": "https://github.com/cweiske/jsonmapper/tree/v4.2.0" }, - "time": "2020-12-01T19:48:11+00:00" + "time": "2023-04-09T17:37:40+00:00" }, { "name": "nikic/php-parser", @@ -2951,59 +2982,6 @@ }, "time": "2023-03-05T19:49:14+00:00" }, - { - "name": "openlss/lib-array2xml", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/nullivex/lib-array2xml.git", - "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nullivex/lib-array2xml/zipball/a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", - "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "autoload": { - "psr-0": { - "LSS": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Bryan Tong", - "email": "bryan@nullivex.com", - "homepage": "https://www.nullivex.com" - }, - { - "name": "Tony Butler", - "email": "spudz76@gmail.com", - "homepage": "https://www.nullivex.com" - } - ], - "description": "Array2XML conversion library credit to lalit.org", - "homepage": "https://www.nullivex.com", - "keywords": [ - "array", - "array conversion", - "xml", - "xml conversion" - ], - "support": { - "issues": "https://github.com/nullivex/lib-array2xml/issues", - "source": "https://github.com/nullivex/lib-array2xml/tree/master" - }, - "time": "2019-03-29T20:06:56+00:00" - }, { "name": "phar-io/manifest", "version": "2.0.3", @@ -3310,24 +3288,27 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.2", + "version": "1.7.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d" + "reference": "dfc078e8af9c99210337325ff5aa152872c98714" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/dfc078e8af9c99210337325ff5aa152872c98714", + "reference": "dfc078e8af9c99210337325ff5aa152872c98714", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.0", "php": "^7.4 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" }, "require-dev": { "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.1", @@ -3359,9 +3340,54 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.1" }, - "time": "2022-10-14T12:47:21+00:00" + "time": "2023-03-27T19:02:04+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.20.4", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", + "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.20.4" + }, + "time": "2023-05-02T09:19:37+00:00" }, { "name": "phpunit/php-code-coverage", @@ -5006,6 +5032,69 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "spatie/array-to-xml", + "version": "3.1.6", + "source": { + "type": "git", + "url": "https://github.com/spatie/array-to-xml.git", + "reference": "e210b98957987c755372465be105d32113f339a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/e210b98957987c755372465be105d32113f339a4", + "reference": "e210b98957987c755372465be105d32113f339a4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "php": "^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.2", + "pestphp/pest": "^1.21", + "spatie/pest-plugin-snapshots": "^1.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\ArrayToXml\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://freek.dev", + "role": "Developer" + } + ], + "description": "Convert an array to xml", + "homepage": "https://github.com/spatie/array-to-xml", + "keywords": [ + "array", + "convert", + "xml" + ], + "support": { + "source": "https://github.com/spatie/array-to-xml/tree/3.1.6" + }, + "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + }, + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2023-05-11T14:04:07+00:00" + }, { "name": "squizlabs/php_codesniffer", "version": "3.7.2", @@ -5203,89 +5292,6 @@ ], "time": "2023-04-18T13:46:08+00:00" }, - { - "name": "symfony/polyfill-php80", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-03T14:55:06+00:00" - }, { "name": "symfony/stopwatch", "version": "v6.2.7", @@ -5474,24 +5480,24 @@ }, { "name": "vimeo/psalm", - "version": "4.30.0", + "version": "5.11.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69" + "reference": "c9b192ab8400fdaf04b2b13d110575adc879aa90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/d0bc6e25d89f649e4f36a534f330f8bb4643dd69", - "reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/c9b192ab8400fdaf04b2b13d110575adc879aa90", + "reference": "c9b192ab8400fdaf04b2b13d110575adc879aa90", "shasum": "" }, "require": { "amphp/amp": "^2.4.2", "amphp/byte-stream": "^1.5", - "composer/package-versions-deprecated": "^1.8.0", + "composer-runtime-api": "^2", "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^1.1 || ^2.0 || ^3.0", + "composer/xdebug-handler": "^2.0 || ^3.0", "dnoegel/php-xdg-base-dir": "^0.1.1", "ext-ctype": "*", "ext-dom": "*", @@ -5500,35 +5506,35 @@ "ext-mbstring": "*", "ext-simplexml": "*", "ext-tokenizer": "*", - "felixfbecker/advanced-json-rpc": "^3.0.3", - "felixfbecker/language-server-protocol": "^1.5", + "felixfbecker/advanced-json-rpc": "^3.1", + "felixfbecker/language-server-protocol": "^1.5.2", + "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "nikic/php-parser": "^4.13", - "openlss/lib-array2xml": "^1.0", - "php": "^7.1|^8", - "sebastian/diff": "^3.0 || ^4.0", - "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0 || ^6.0", - "symfony/polyfill-php80": "^1.25", - "webmozart/path-util": "^2.3" + "nikic/php-parser": "^4.14", + "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0", + "sebastian/diff": "^4.0 || ^5.0", + "spatie/array-to-xml": "^2.17.0 || ^3.0", + "symfony/console": "^4.1.6 || ^5.0 || ^6.0", + "symfony/filesystem": "^5.4 || ^6.0" }, "provide": { "psalm/psalm": "self.version" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.2", - "brianium/paratest": "^4.0||^6.0", + "amphp/phpunit-util": "^2.0", + "bamarni/composer-bin-plugin": "^1.4", + "brianium/paratest": "^6.9", "ext-curl": "*", + "mockery/mockery": "^1.5", + "nunomaduro/mock-final-classes": "^1.1", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpdocumentor/reflection-docblock": "^5", - "phpmyadmin/sql-parser": "5.1.0||dev-master", - "phpspec/prophecy": ">=1.9.0", - "phpstan/phpdoc-parser": "1.2.* || 1.6.4", - "phpunit/phpunit": "^9.0", - "psalm/plugin-phpunit": "^0.16", - "slevomat/coding-standard": "^7.0", - "squizlabs/php_codesniffer": "^3.5", - "symfony/process": "^4.3 || ^5.0 || ^6.0", - "weirdan/prophecy-shim": "^1.0 || ^2.0" + "phpstan/phpdoc-parser": "^1.6", + "phpunit/phpunit": "^9.6", + "psalm/plugin-mockery": "^1.1", + "psalm/plugin-phpunit": "^0.18", + "slevomat/coding-standard": "^8.4", + "squizlabs/php_codesniffer": "^3.6", + "symfony/process": "^4.4 || ^5.0 || ^6.0" }, "suggest": { "ext-curl": "In order to send data to shepherd", @@ -5544,17 +5550,14 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev", + "dev-master": "5.x-dev", + "dev-4.x": "4.x-dev", "dev-3.x": "3.x-dev", "dev-2.x": "2.x-dev", "dev-1.x": "1.x-dev" } }, "autoload": { - "files": [ - "src/functions.php", - "src/spl_object_id.php" - ], "psr-4": { "Psalm\\": "src/Psalm/" } @@ -5572,64 +5575,14 @@ "keywords": [ "code", "inspection", - "php" + "php", + "static analysis" ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.30.0" - }, - "time": "2022-11-06T20:37:08+00:00" - }, - { - "name": "webmozart/path-util", - "version": "2.3.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/path-util.git", - "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725", - "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "webmozart/assert": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\PathUtil\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", - "support": { - "issues": "https://github.com/webmozart/path-util/issues", - "source": "https://github.com/webmozart/path-util/tree/2.3.0" + "source": "https://github.com/vimeo/psalm/tree/5.11.0" }, - "abandoned": "symfony/filesystem", - "time": "2015-12-17T08:42:14+00:00" + "time": "2023-05-04T21:35:44+00:00" } ], "aliases": [], From 5def4ef1b732fae098fcc4eae9743582d7f7277c Mon Sep 17 00:00:00 2001 From: sji Date: Fri, 12 May 2023 01:07:15 +0900 Subject: [PATCH 2/3] update psalm to 5 --- composer.json | 1 - composer.lock | 65 +- psalm.xml | 6 +- src/Command/CommandEnumerator.php | 2 +- src/Lib/Amphp/Context.php | 5 +- src/Lib/ByteStream/CDataByteReader.php | 5 +- src/Lib/FFI/CastedTypeProvider.php | 3 - src/Lib/Integer/UInt64.php | 2 +- src/Lib/Libc/Sys/Ptrace/PtraceRequest.php | 54 +- src/Lib/Libc/Sys/Ptrace/PtraceX64.php | 2 +- src/Lib/PhpInternals/Opcodes/OpcodeV72.php | 1 - src/Lib/PhpInternals/ZendTypeReader.php | 1 + src/Lib/Process/Exec/TraceeExecutor.php | 4 +- src/Lib/Process/Pointer/Pointer.php | 1 + .../ProcFileSystem/CommandLineEnumerator.php | 3 +- .../ProcFileSystem/ThreadEnumerator.php | 4 +- .../Process/ProcessStopper/ProcessStopper.php | 4 +- .../RegisterReader/X64RegisterReader.php | 6 +- tools/stubs/ffi/ffi.php | 717 ++++++++++++++++++ tools/stubs/ffi/scalar.php | 10 + 20 files changed, 781 insertions(+), 115 deletions(-) create mode 100644 tools/stubs/ffi/ffi.php diff --git a/composer.json b/composer.json index 0feb3a09..960d1bdf 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,6 @@ "hassankhan/config": "3.1.0", "sj-i/php-cast": "1.0.0", "monolog/monolog": "3.3.1", - "myclabs/php-enum": "1.8.4", "webmozart/assert": "1.11.0" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 374a06eb..f3bcee1c 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": "12ef711d4486f63e86d90b758bfcc988", + "content-hash": "ca812c6bc5164aa29b0eadf0929efe0a", "packages": [ { "name": "amphp/amp", @@ -722,69 +722,6 @@ ], "time": "2023-02-06T13:46:10+00:00" }, - { - "name": "myclabs/php-enum", - "version": "1.8.4", - "source": { - "type": "git", - "url": "https://github.com/myclabs/php-enum.git", - "reference": "a867478eae49c9f59ece437ae7f9506bfaa27483" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/php-enum/zipball/a867478eae49c9f59ece437ae7f9506bfaa27483", - "reference": "a867478eae49c9f59ece437ae7f9506bfaa27483", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": "^7.3 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.5", - "squizlabs/php_codesniffer": "1.*", - "vimeo/psalm": "^4.6.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "MyCLabs\\Enum\\": "src/" - }, - "classmap": [ - "stubs/Stringable.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP Enum contributors", - "homepage": "https://github.com/myclabs/php-enum/graphs/contributors" - } - ], - "description": "PHP Enum implementation", - "homepage": "http://github.com/myclabs/php-enum", - "keywords": [ - "enum" - ], - "support": { - "issues": "https://github.com/myclabs/php-enum/issues", - "source": "https://github.com/myclabs/php-enum/tree/1.8.4" - }, - "funding": [ - { - "url": "https://github.com/mnapoli", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum", - "type": "tidelift" - } - ], - "time": "2022-08-04T09:53:51+00:00" - }, { "name": "php-di/invoker", "version": "2.3.3", diff --git a/psalm.xml b/psalm.xml index 08fd33fe..cb89f1c4 100644 --- a/psalm.xml +++ b/psalm.xml @@ -2,6 +2,10 @@ - + diff --git a/src/Command/CommandEnumerator.php b/src/Command/CommandEnumerator.php index cefb09db..99f303ab 100644 --- a/src/Command/CommandEnumerator.php +++ b/src/Command/CommandEnumerator.php @@ -27,7 +27,7 @@ public function __construct( } /** @return \Generator> */ - public function getIterator() + public function getIterator(): \Generator { /** @var SplFileInfo $command_file_info */ foreach ($this->command_files_iterator as $command_file_info) { diff --git a/src/Lib/Amphp/Context.php b/src/Lib/Amphp/Context.php index 8fc7df76..43e15846 100644 --- a/src/Lib/Amphp/Context.php +++ b/src/Lib/Amphp/Context.php @@ -16,7 +16,10 @@ use Amp\Parallel\Context\Context as AmphpContext; use Amp\Promise; -/** @template-covariant T of MessageProtocolInterface */ +/** + * @template-covariant T of MessageProtocolInterface + * @implements ContextInterface + */ final class Context implements ContextInterface { /** @param T $protocol_interface */ diff --git a/src/Lib/ByteStream/CDataByteReader.php b/src/Lib/ByteStream/CDataByteReader.php index 1daf2fb8..e38d8a81 100644 --- a/src/Lib/ByteStream/CDataByteReader.php +++ b/src/Lib/ByteStream/CDataByteReader.php @@ -40,6 +40,7 @@ public function offsetExists($offset): bool public function offsetGet($offset): int { + /** @var int */ return $this->source[$offset]; } @@ -47,7 +48,9 @@ public function createSliceAsString(int $offset, int $size): string { $result = ''; for ($i = $offset, $last_offset = $offset + $size; $i < $last_offset; $i++) { - $result .= chr($this->source[$i]); + $value = $this->source[$i]; + assert(is_int($value)); + $result .= chr($value); } return $result; } diff --git a/src/Lib/FFI/CastedTypeProvider.php b/src/Lib/FFI/CastedTypeProvider.php index b27e824c..474dad29 100644 --- a/src/Lib/FFI/CastedTypeProvider.php +++ b/src/Lib/FFI/CastedTypeProvider.php @@ -16,9 +16,6 @@ use FFI\CData; use Reli\Lib\PhpInternals\CastedCData; -/** - * @template T - */ interface CastedTypeProvider { /** @return CastedCData */ diff --git a/src/Lib/Integer/UInt64.php b/src/Lib/Integer/UInt64.php index 6b0def25..b1eb75d1 100644 --- a/src/Lib/Integer/UInt64.php +++ b/src/Lib/Integer/UInt64.php @@ -21,7 +21,7 @@ public function __construct( ) { } - public function __toString() + public function __toString(): string { $hi_hex = str_pad(base_convert((string)$this->hi, 10, 16), 8, '0', STR_PAD_LEFT); $lo_hex = str_pad(base_convert((string)$this->lo, 10, 16), 8, '0', STR_PAD_LEFT); diff --git a/src/Lib/Libc/Sys/Ptrace/PtraceRequest.php b/src/Lib/Libc/Sys/Ptrace/PtraceRequest.php index ecf3cb94..e22f0101 100644 --- a/src/Lib/Libc/Sys/Ptrace/PtraceRequest.php +++ b/src/Lib/Libc/Sys/Ptrace/PtraceRequest.php @@ -13,35 +13,29 @@ namespace Reli\Lib\Libc\Sys\Ptrace; -use MyCLabs\Enum\Enum; - -/** - * @extends Enum - * @psalm-immutable - */ -final class PtraceRequest extends Enum +enum PtraceRequest: int { - public const PTRACE_PTRACEME = 0; - public const PTRACE_PEEKTEXT = 1; - public const PTRACE_PEEKDATA = 2; - public const PTRACE_PEEKUSER = 3; - public const PTRACE_POKETEXT = 4; - public const PTRACE_POKEDATA = 5; - public const PTRACE_POKEUSER = 6; - public const PTRACE_CONT = 7; - public const PTRACE_KILL = 8; - public const PTRACE_SINGLESTEP = 9; - public const PTRACE_GETREGS = 12; - public const PTRACE_SETREGS = 13; - public const PTRACE_GETFPREGS = 14; - public const PTRACE_SETFPREGS = 15; - public const PTRACE_ATTACH = 16; - public const PTRACE_DETACH = 17; - public const PTRACE_GETFPXREGS = 18; - public const PTRACE_SETFPXREGS = 19; - public const PTRACE_SYSCALL = 24; - public const PTRACE_SETOPTIONS = 0x4200; - public const PTRACE_GETEVENTMSG = 0x4201; - public const PTRACE_GETSIGINFO = 0x4202; - public const PTRACE_SETSIGINFO = 0x4203; + case PTRACE_PTRACEME = 0; + case PTRACE_PEEKTEXT = 1; + case PTRACE_PEEKDATA = 2; + case PTRACE_PEEKUSER = 3; + case PTRACE_POKETEXT = 4; + case PTRACE_POKEDATA = 5; + case PTRACE_POKEUSER = 6; + case PTRACE_CONT = 7; + case PTRACE_KILL = 8; + case PTRACE_SINGLESTEP = 9; + case PTRACE_GETREGS = 12; + case PTRACE_SETREGS = 13; + case PTRACE_GETFPREGS = 14; + case PTRACE_SETFPREGS = 15; + case PTRACE_ATTACH = 16; + case PTRACE_DETACH = 17; + case PTRACE_GETFPXREGS = 18; + case PTRACE_SETFPXREGS = 19; + case PTRACE_SYSCALL = 24; + case PTRACE_SETOPTIONS = 0x4200; + case PTRACE_GETEVENTMSG = 0x4201; + case PTRACE_GETSIGINFO = 0x4202; + case PTRACE_SETSIGINFO = 0x4203; } diff --git a/src/Lib/Libc/Sys/Ptrace/PtraceX64.php b/src/Lib/Libc/Sys/Ptrace/PtraceX64.php index f04f8289..b9c4e720 100644 --- a/src/Lib/Libc/Sys/Ptrace/PtraceX64.php +++ b/src/Lib/Libc/Sys/Ptrace/PtraceX64.php @@ -117,7 +117,7 @@ public function ptrace( /** @var int */ return $this->ffi->ptrace( - $request->getValue(), + $request->value, $pid, $addr_pointer, $data_pointer, diff --git a/src/Lib/PhpInternals/Opcodes/OpcodeV72.php b/src/Lib/PhpInternals/Opcodes/OpcodeV72.php index 5938177a..ea42f747 100644 --- a/src/Lib/PhpInternals/Opcodes/OpcodeV72.php +++ b/src/Lib/PhpInternals/Opcodes/OpcodeV72.php @@ -412,7 +412,6 @@ final class OpcodeV72 implements Opcode self::ZEND_ISSET_ISEMPTY_CV, ]; - /** @var int[] */ private const OPCODE_NAMES = [ 'ZEND_NOP', 'ZEND_ADD', diff --git a/src/Lib/PhpInternals/ZendTypeReader.php b/src/Lib/PhpInternals/ZendTypeReader.php index 4a1cde63..57eb1f3b 100644 --- a/src/Lib/PhpInternals/ZendTypeReader.php +++ b/src/Lib/PhpInternals/ZendTypeReader.php @@ -143,6 +143,7 @@ public function getOffsetAndSizeOfMember(string $type, string $member): array /** @var FFI\CInteger $dummy_base_addr */ $dummy_base_addr = \FFI::cast('long', FFI::addr($dummy)); $addr = $member_addr - $dummy_base_addr->cdata; + assert(is_int($addr)); /** @psalm-suppress MixedArgument */ $sizeof = \FFI::sizeof($dummy->$member); $this->offset_cache[$type][$member] = [ diff --git a/src/Lib/Process/Exec/TraceeExecutor.php b/src/Lib/Process/Exec/TraceeExecutor.php index 710ebd6e..6dcf2c65 100644 --- a/src/Lib/Process/Exec/TraceeExecutor.php +++ b/src/Lib/Process/Exec/TraceeExecutor.php @@ -37,7 +37,7 @@ public function execute(string $command, array $argv): int $pid = $this->pcntl->fork(); if ($pid === 0) { $this->ptrace->ptrace( - PtraceRequest::PTRACE_PTRACEME(), + PtraceRequest::PTRACE_PTRACEME, 0, null, null @@ -66,7 +66,7 @@ public function execute(string $command, array $argv): int } $this->ptrace->ptrace( - PtraceRequest::PTRACE_DETACH(), + PtraceRequest::PTRACE_DETACH, $pid, 0, 0 diff --git a/src/Lib/Process/Pointer/Pointer.php b/src/Lib/Process/Pointer/Pointer.php index 5df3ac75..26ebe573 100644 --- a/src/Lib/Process/Pointer/Pointer.php +++ b/src/Lib/Process/Pointer/Pointer.php @@ -70,6 +70,7 @@ public static function fromCData( ): self { /** @var CInteger $addr */ $addr = \FFI::cast('long', $c_pointer); + /** @psalm-trace $addr */ /** * @psalm-suppress InaccessibleMethod * @var CData $element diff --git a/src/Lib/Process/ProcFileSystem/CommandLineEnumerator.php b/src/Lib/Process/ProcFileSystem/CommandLineEnumerator.php index 65baa672..324f7481 100644 --- a/src/Lib/Process/ProcFileSystem/CommandLineEnumerator.php +++ b/src/Lib/Process/ProcFileSystem/CommandLineEnumerator.php @@ -16,6 +16,7 @@ use IteratorAggregate; use Reli\Lib\File\FileReaderInterface; +/** @implements IteratorAggregate */ final class CommandLineEnumerator implements IteratorAggregate { public function __construct( @@ -24,7 +25,7 @@ public function __construct( } /** @return \Generator */ - public function getIterator() + public function getIterator(): \Generator { /** * @var string $full_path diff --git a/src/Lib/Process/ProcFileSystem/ThreadEnumerator.php b/src/Lib/Process/ProcFileSystem/ThreadEnumerator.php index c0c603c7..d7b5ce6c 100644 --- a/src/Lib/Process/ProcFileSystem/ThreadEnumerator.php +++ b/src/Lib/Process/ProcFileSystem/ThreadEnumerator.php @@ -15,8 +15,8 @@ final class ThreadEnumerator { - /** @return \Generator */ - public function getThreadIds(int $pid) + /** @return \Generator */ + public function getThreadIds(int $pid): \Generator { /** * @var string $full_path diff --git a/src/Lib/Process/ProcessStopper/ProcessStopper.php b/src/Lib/Process/ProcessStopper/ProcessStopper.php index 3ab4f172..30ebd475 100644 --- a/src/Lib/Process/ProcessStopper/ProcessStopper.php +++ b/src/Lib/Process/ProcessStopper/ProcessStopper.php @@ -30,7 +30,7 @@ public function stop(int $pid): bool { /** @var \FFI\Libc\ptrace_ffi $this->ffi */ $attach = $this->ptrace->ptrace( - PtraceRequest::PTRACE_ATTACH(), + PtraceRequest::PTRACE_ATTACH, $pid, null, null @@ -50,7 +50,7 @@ public function resume(int $pid): void { /** @var \FFI\Libc\ptrace_ffi $this->ffi */ $detach = $this->ptrace->ptrace( - PtraceRequest::PTRACE_DETACH(), + PtraceRequest::PTRACE_DETACH, $pid, null, null diff --git a/src/Lib/Process/RegisterReader/X64RegisterReader.php b/src/Lib/Process/RegisterReader/X64RegisterReader.php index ca8e2a98..a2d7e570 100644 --- a/src/Lib/Process/RegisterReader/X64RegisterReader.php +++ b/src/Lib/Process/RegisterReader/X64RegisterReader.php @@ -149,7 +149,7 @@ public function attachAndReadOne(int $pid, int $register): int $target_offset->cdata = $register; $attach = $this->ptrace->ptrace( - PtraceRequest::PTRACE_ATTACH(), + PtraceRequest::PTRACE_ATTACH, $pid, null, null @@ -163,7 +163,7 @@ public function attachAndReadOne(int $pid, int $register): int pcntl_waitpid($pid, $status, \WUNTRACED); $fs = $this->ptrace->ptrace( - PtraceRequest::PTRACE_PEEKUSER(), + PtraceRequest::PTRACE_PEEKUSER, $pid, \FFI::cast('void *', $target_offset), null @@ -176,7 +176,7 @@ public function attachAndReadOne(int $pid, int $register): int } $detach = $this->ptrace->ptrace( - PtraceRequest::PTRACE_DETACH(), + PtraceRequest::PTRACE_DETACH, $pid, null, null diff --git a/tools/stubs/ffi/ffi.php b/tools/stubs/ffi/ffi.php new file mode 100644 index 00000000..dba0713d --- /dev/null +++ b/tools/stubs/ffi/ffi.php @@ -0,0 +1,717 @@ +Instead of embedding of a long C definition into PHP string, + * and creating FFI through FFI::cdef(), it's possible to separate + * it into a C header file. Note, that C preprocessor directives + * (e.g. #define or #ifdef) are not supported. And only a couple of + * special macros may be used especially for FFI.

+ * + * + * #define FFI_LIB "libc.so.6" + * + * int printf(const char *format, ...); + * + * + * Here, FFI_LIB specifies, that the given library should be loaded. + * + * + * $ffi = FFI::load(__DIR__ . "/printf.h"); + * $ffi->printf("Hello world!\n"); + * + * + * @param string $filename + * @return FFI|null + */ + public static function load(string $filename): ?FFI {} + + /** + * FFI definition parsing and shared library loading may take + * significant time. It's not useful to do it on each HTTP request in + * WEB environment. However, it's possible to pre-load FFI definitions + * and libraries at php startup, and instantiate FFI objects when + * necessary. Header files may be extended with FFI_SCOPE define + * (default pre-loading scope is "C"). This name is going to be + * used as FFI::scope() argument. It's possible to pre-load few + * files into a single scope. + * + * + * #define FFI_LIB "libc.so.6" + * #define FFI_SCOPE "libc" + * + * int printf(const char *format, ...); + * + * + * These files are loaded through the same FFI::load() load function, + * executed from file loaded by opcache.preload php.ini directive. + * + * + * ffi.preload=/etc/php/ffi/printf.h + * + * + * Finally, FFI::scope() instantiate an FFI object, that implements + * all C definition from the given scope. + * + * + * $ffi = FFI::scope("libc"); + * $ffi->printf("Hello world!\n"); + * + * + * @param string $name + * @return FFI + */ + public static function scope(string $name): FFI {} + + /** + * Method that creates an arbitrary C structure. + * + * @param string|CType $type + * @param bool $owned + * @param bool $persistent + * @return CData|null + * @throws ParserException + */ + public static function new($type, bool $owned = true, bool $persistent = false): ?CData {} + + /** + * Manually removes previously created "not-owned" data structure. + * + * @param CData $ptr + * @return void + */ + public static function free(CData $ptr): void {} + + /** + * Casts given $pointer to another C type, specified by C declaration + * string or FFI\CType object. + * + * This function may be called statically and use only predefined + * types, or as a method of previously created FFI object. In last + * case the first argument may reuse all type and tag names + * defined in FFI::cdef(). + * + * @param CType|string $type + * @param CData|int|float|bool|null $ptr + * @return CData|null + */ + public static function cast($type, $ptr): ?CData {} + + /** + * This function creates and returns a FFI\CType object, representng + * type of the given C type declaration string. + * + * FFI::type() may be called statically and use only predefined types, + * or as a method of previously created FFI object. In last case the + * first argument may reuse all type and tag names defined in + * FFI::cdef(). + * + * @param string $type + * @return CType|null + */ + public static function type(string $type): ?CType {} + + /** + * This function returns the FFI\CType object, representing the type of + * the given FFI\CData object. + * + * @param CData $ptr + * @return CType + */ + public static function typeof(CData $ptr): CType {} + + /** + * Constructs a new C array type with elements of $type and + * dimensions specified by $dimensions. + * + * @param CType $type + * @param int[] $dimensions + * @return CType + */ + public static function arrayType(CType $type, array $dimensions): CType {} + + /** + * Returns C pointer to the given C data structure. The pointer is + * not "owned" and won't be free. Anyway, this is a potentially + * unsafe operation, because the life-time of the returned pointer + * may be longer than life-time of the source object, and this may + * cause dangling pointer dereference (like in regular C). + * + * @param CData $ptr + * @return CData + */ + public static function addr(CData $ptr): CData {} + + /** + * Returns size of C data type of the given FFI\CData or FFI\CType. + * + * @param CData|CType $ptr + * @return int + */ + public static function sizeof($ptr): int {} + + /** + * Returns size of C data type of the given FFI\CData or FFI\CType. + * + * @param CData|CType $ptr + * @return int + */ + public static function alignof($ptr): int {} + + /** + * Copies $size bytes from memory area $source to memory area $target. + * $source may be any native data structure (FFI\CData) or PHP string. + * + * @param CData $to + * @param CData|string $from + * @param int $size + */ + public static function memcpy(CData $to, $from, int $size): void {} + + /** + * Compares $size bytes from memory area $ptr1 and $ptr2. + * + * @param CData|string $ptr1 + * @param CData|string $ptr2 + * @param int $size + * @return int + */ + public static function memcmp($ptr1, $ptr2, int $size): int {} + + /** + * Fills the $size bytes of the memory area pointed to by $target with + * the constant byte $byte. + * + * @param CData $ptr + * @param int $value + * @param int $size + */ + public static function memset(CData $ptr, int $value, int $size): void {} + + /** + * Creates a PHP string from $size bytes of memory area pointed by + * $source. If size is omitted, $source must be zero terminated + * array of C chars. + * + * @param CData $ptr + * @param int|null $size + * @return string + */ + public static function string(CData $ptr, ?int $size = null): string {} + + /** + * Checks whether the FFI\CData is a null pointer. + * + * @param CData $ptr + * @return bool + */ + public static function isNull(CData $ptr): bool {} + } +} + +namespace FFI { + /** + * General FFI exception. + * + * @since 7.4 + */ + class Exception extends \Error {} + + /** + * An exception that occurs when parsing invalid header files. + * + * @since 7.4 + */ + class ParserException extends Exception {} + + /** + * Proxy object that provides access to compiled structures. + * + * In the case that CData is a wrapper over a scalar, it contains an + * additional "cdata" property. + * + * In the case that the CData is a wrapper over an arbitrary C structure, + * then it allows reading and writing to the fields defined by + * this structure. + * + * @method mixed __get(string $name) + * @method mixed __set(string $name, mixed $value) + * + * In the case that CData is a wrapper over an array, it is an + * implementation of the {@see \Traversable}, {@see \Countable}, + * and {@see \ArrayAccess} + * + * @mixin \Traversable + * @mixin \Countable + * @mixin \ArrayAccess + * + * In the case when CData is a wrapper over a function pointer, it can + * be called. + * + * @method mixed __invoke(mixed ...$args) + * + * @template TCData of int|float|bool|null|string|CData + * + * @since 7.4 + */ + class CData + { + /** + * Note that this method does not physically exist and is only required + * for correct type inference. + * + * @param int $offset + * @return bool + */ + private function offsetExists(int $offset) {} + + /** + * Note that this method does not physically exist and is only required + * for correct type inference. + * + * @param int $offset + * @return CData|int|float|bool|null|string + */ + private function offsetGet(int $offset) {} + + /** + * Note that this method does not physically exist and is only required + * for correct type inference. + * + * @param int $offset + * @param CData|int|float|bool|null|string $value + */ + private function offsetSet(int $offset, $value) {} + + /** + * Note that this method does not physically exist and is only required + * for correct type inference. + * + * @param int $offset + */ + private function offsetUnset(int $offset) {} + + /** + * Note that this method does not physically exist and is only required + * for correct type inference. + * + * @return int + */ + private function count(): int {} + } + + /** + * Class containing C type information. + * + * @since 7.4 + */ + class CType + { + /** + * @since 8.1 + */ + public const TYPE_VOID = 0; + + /** + * @since 8.1 + */ + public const TYPE_FLOAT = 1; + + /** + * @since 8.1 + */ + public const TYPE_DOUBLE = 2; + + /** + * Please note that this constant may NOT EXIST if there is + * no long double support on the current platform. + * + * @since 8.1 + */ + public const TYPE_LONGDOUBLE = 3; + + /** + * @since 8.1 + */ + public const TYPE_UINT8 = 4; + + /** + * @since 8.1 + */ + public const TYPE_SINT8 = 5; + + /** + * @since 8.1 + */ + public const TYPE_UINT16 = 6; + + /** + * @since 8.1 + */ + public const TYPE_SINT16 = 7; + + /** + * @since 8.1 + */ + public const TYPE_UINT32 = 8; + + /** + * @since 8.1 + */ + public const TYPE_SINT32 = 9; + + /** + * @since 8.1 + */ + public const TYPE_UINT64 = 10; + + /** + * @since 8.1 + */ + public const TYPE_SINT64 = 11; + + /** + * @since 8.1 + */ + public const TYPE_ENUM = 12; + + /** + * @since 8.1 + */ + public const TYPE_BOOL = 13; + + /** + * @since 8.1 + */ + public const TYPE_CHAR = 14; + + /** + * @since 8.1 + */ + public const TYPE_POINTER = 15; + + /** + * @since 8.1 + */ + public const TYPE_FUNC = 16; + + /** + * @since 8.1 + */ + public const TYPE_ARRAY = 17; + + /** + * @since 8.1 + */ + public const TYPE_STRUCT = 18; + + /** + * @since 8.1 + */ + public const ATTR_CONST = 1; + + /** + * @since 8.1 + */ + public const ATTR_INCOMPLETE_TAG = 2; + + /** + * @since 8.1 + */ + public const ATTR_VARIADIC = 4; + + /** + * @since 8.1 + */ + public const ATTR_INCOMPLETE_ARRAY = 8; + + /** + * @since 8.1 + */ + public const ATTR_VLA = 16; + + /** + * @since 8.1 + */ + public const ATTR_UNION = 32; + + /** + * @since 8.1 + */ + public const ATTR_PACKED = 64; + + /** + * @since 8.1 + */ + public const ATTR_MS_STRUCT = 128; + + /** + * @since 8.1 + */ + public const ATTR_GCC_STRUCT = 256; + + /** + * @since 8.1 + */ + public const ABI_DEFAULT = 0; + + /** + * @since 8.1 + */ + public const ABI_CDECL = 1; + + /** + * @since 8.1 + */ + public const ABI_FASTCALL = 2; + + /** + * @since 8.1 + */ + public const ABI_THISCALL = 3; + + /** + * @since 8.1 + */ + public const ABI_STDCALL = 4; + + /** + * @since 8.1 + */ + public const ABI_PASCAL = 5; + + /** + * @since 8.1 + */ + public const ABI_REGISTER = 6; + + /** + * @since 8.1 + */ + public const ABI_MS = 7; + + /** + * @since 8.1 + */ + public const ABI_SYSV = 8; + + /** + * @since 8.1 + */ + public const ABI_VECTORCALL = 9; + + /** + * Returns the name of the type. + * + * @since 8.0 + * @return string + */ + public function getName(): string {} + + /** + * Returns the identifier of the root type. + * + * Value may be one of: + * - {@see CType::TYPE_VOID} + * - {@see CType::TYPE_FLOAT} + * - {@see CType::TYPE_DOUBLE} + * - {@see CType::TYPE_LONGDOUBLE} + * - {@see CType::TYPE_UINT8} + * - {@see CType::TYPE_SINT8} + * - {@see CType::TYPE_UINT16} + * - {@see CType::TYPE_SINT16} + * - {@see CType::TYPE_UINT32} + * - {@see CType::TYPE_SINT32} + * - {@see CType::TYPE_UINT64} + * - {@see CType::TYPE_SINT64} + * - {@see CType::TYPE_ENUM} + * - {@see CType::TYPE_BOOL} + * - {@see CType::TYPE_CHAR} + * - {@see CType::TYPE_POINTER} + * - {@see CType::TYPE_FUNC} + * - {@see CType::TYPE_ARRAY} + * - {@see CType::TYPE_STRUCT} + * + * @since 8.1 + * @return int + */ + public function getKind(): int {} + + /** + * Returns the size of the type in bytes. + * + * @since 8.1 + * @return int + */ + public function getSize(): int {} + + /** + * Returns the alignment of the type in bytes. + * + * @since 8.1 + * @return int + */ + public function getAlignment(): int {} + + /** + * Returns the bit-mask of type attributes. + * + * @since 8.1 + * @return int + */ + public function getAttributes(): int {} + + /** + * Returns the identifier of the enum value type. + * + * Value may be one of: + * - {@see CType::TYPE_UINT32} + * - {@see CType::TYPE_UINT64} + * + * @since 8.1 + * @return int + * @throws Exception In the case that the type is not an enumeration. + */ + public function getEnumKind(): int {} + + /** + * Returns the type of array elements. + * + * @since 8.1 + * @return CType + * @throws Exception In the case that the type is not an array. + */ + public function getArrayElementType(): CType {} + + /** + * Returns the size of an array. + * + * @since 8.1 + * @return int + * @throws Exception In the case that the type is not an array. + */ + public function getArrayLength(): int {} + + /** + * Returns the original type of the pointer. + * + * @since 8.1 + * @return CType + * @throws Exception In the case that the type is not a pointer. + */ + public function getPointerType(): CType {} + + /** + * Returns the field string names of a structure or union. + * + * @since 8.1 + * @return array + * @throws Exception In the case that the type is not a struct or union. + */ + public function getStructFieldNames(): array {} + + /** + * Returns the offset of the structure by the name of this field. In + * the case that the type is a union, then for each field of this type + * the offset will be equal to 0. + * + * @since 8.1 + * @param string $name + * @return int + * @throws Exception In the case that the type is not a struct or union. + */ + public function getStructFieldOffset(string $name): int {} + + /** + * Returns the field type of a structure or union. + * + * @since 8.1 + * @param string $name + * @return CType + * @throws Exception In the case that the type is not a struct or union. + */ + public function getStructFieldType(string $name): CType {} + + /** + * Returns the application binary interface (ABI) identifier with which + * you can call the function. + * + * Value may be one of: + * - {@see CType::ABI_DEFAULT} + * - {@see CType::ABI_CDECL} + * - {@see CType::ABI_FASTCALL} + * - {@see CType::ABI_THISCALL} + * - {@see CType::ABI_STDCALL} + * - {@see CType::ABI_PASCAL} + * - {@see CType::ABI_REGISTER} + * - {@see CType::ABI_MS} + * - {@see CType::ABI_SYSV} + * - {@see CType::ABI_VECTORCALL} + * + * @since 8.1 + * @return int + * @throws Exception In the case that the type is not a function. + */ + public function getFuncABI(): int {} + + /** + * Returns the return type of the function. + * + * @since 8.1 + * @return CType + * @throws Exception In the case that the type is not a function. + */ + public function getFuncReturnType(): CType {} + + /** + * Returns the number of arguments to the function. + * + * @since 8.1 + * @return int + * @throws Exception In the case that the type is not a function. + */ + public function getFuncParameterCount(): int {} + + /** + * Returns the type of the function argument by its numeric index. + * + * @since 8.1 + * @param int $index + * @return CType + * @throws Exception In the case that the type is not a function. + */ + public function getFuncParameterType(int $index): CType {} + } +} diff --git a/tools/stubs/ffi/scalar.php b/tools/stubs/ffi/scalar.php index 137d2a1b..cf9df6ec 100644 --- a/tools/stubs/ffi/scalar.php +++ b/tools/stubs/ffi/scalar.php @@ -11,11 +11,20 @@ namespace FFI; +/** @template T */ +class CData +{ + /** @var T */ + public $cdata; +} + +/** @extends CData */ class CInteger extends CData { public int $cdata; } +/** @extends CData */ class CPointer extends CData { public int $cdata; @@ -26,6 +35,7 @@ class CPointer extends CData * * @template T * @template-implements \ArrayAccess + * @extends CData */ class CArray extends CData implements \ArrayAccess, \Countable { From 4a08caa700fbba0aa2a8cbef4878e5b99a7ce655 Mon Sep 17 00:00:00 2001 From: sji Date: Fri, 12 May 2023 01:09:36 +0900 Subject: [PATCH 3/3] delete unused psalm configuration entry --- psalm.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/psalm.xml b/psalm.xml index cb89f1c4..06d1abef 100644 --- a/psalm.xml +++ b/psalm.xml @@ -19,11 +19,6 @@ - - - - -