From c60d906a3919eda733e97a13249e643e947f75e3 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Sun, 25 May 2025 13:42:30 -0500 Subject: [PATCH 1/3] chore(deps-dev): remove ramsey/composer-repl --- composer.json | 4 +- composer.lock | 1004 +------------------------------------------------ 2 files changed, 2 insertions(+), 1006 deletions(-) diff --git a/composer.json b/composer.json index e3ee1a7..83a0020 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,6 @@ "phpstan/phpstan-mockery": "^1.1", "phpstan/phpstan-phpunit": "^1.1", "phpunit/phpunit": "^8.5 || ^9", - "ramsey/composer-repl": "^1.4", "slevomat/coding-standard": "^8.4", "squizlabs/php_codesniffer": "^3.5", "vimeo/psalm": "^4.9" @@ -68,8 +67,7 @@ "captainhook/plugin-composer": true, "ergebnis/composer-normalize": true, "phpstan/extension-installer": true, - "dealerdirect/phpcodesniffer-composer-installer": true, - "ramsey/composer-repl": true + "dealerdirect/phpcodesniffer-composer-installer": true }, "sort-packages": true }, diff --git a/composer.lock b/composer.lock index 683cb58..ed60ee5 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": "f21ec729c0d999cd566bb64ce37f675b", + "content-hash": "023f5fd1392acd8688a8372107dc5c99", "packages": [ { "name": "brick/math", @@ -530,336 +530,6 @@ }, "time": "2022-01-28T04:35:22+00:00" }, - { - "name": "composer/ca-bundle", - "version": "1.3.3", - "source": { - "type": "git", - "url": "https://github.com/composer/ca-bundle.git", - "reference": "30897edbfb15e784fe55587b4f73ceefd3c4d98c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/30897edbfb15e784fe55587b4f73ceefd3c4d98c", - "reference": "30897edbfb15e784fe55587b4f73ceefd3c4d98c", - "shasum": "" - }, - "require": { - "ext-openssl": "*", - "ext-pcre": "*", - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^0.12.55", - "psr/log": "^1.0", - "symfony/phpunit-bridge": "^4.2 || ^5", - "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\CaBundle\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", - "keywords": [ - "cabundle", - "cacert", - "certificate", - "ssl", - "tls" - ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.3.3" - }, - "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-07-20T07:14:26+00:00" - }, - { - "name": "composer/class-map-generator", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/composer/class-map-generator.git", - "reference": "1e1cb2b791facb2dfe32932a7718cf2571187513" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/class-map-generator/zipball/1e1cb2b791facb2dfe32932a7718cf2571187513", - "reference": "1e1cb2b791facb2dfe32932a7718cf2571187513", - "shasum": "" - }, - "require": { - "composer/pcre": "^2 || ^3", - "php": "^7.2 || ^8.0", - "symfony/finder": "^4.4 || ^5.3 || ^6" - }, - "require-dev": { - "phpstan/phpstan": "^1.6", - "phpstan/phpstan-deprecation-rules": "^1", - "phpstan/phpstan-phpunit": "^1", - "phpstan/phpstan-strict-rules": "^1.1", - "symfony/filesystem": "^5.4 || ^6", - "symfony/phpunit-bridge": "^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\ClassMapGenerator\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "https://seld.be" - } - ], - "description": "Utilities to scan PHP code and generate class maps.", - "keywords": [ - "classmap" - ], - "support": { - "issues": "https://github.com/composer/class-map-generator/issues", - "source": "https://github.com/composer/class-map-generator/tree/1.0.0" - }, - "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-06-19T11:31:27+00:00" - }, - { - "name": "composer/composer", - "version": "2.4.1", - "source": { - "type": "git", - "url": "https://github.com/composer/composer.git", - "reference": "777d542e3af65f8e7a66a4d98ce7a697da339414" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/777d542e3af65f8e7a66a4d98ce7a697da339414", - "reference": "777d542e3af65f8e7a66a4d98ce7a697da339414", - "shasum": "" - }, - "require": { - "composer/ca-bundle": "^1.0", - "composer/class-map-generator": "^1.0", - "composer/metadata-minifier": "^1.0", - "composer/pcre": "^2 || ^3", - "composer/semver": "^3.0", - "composer/spdx-licenses": "^1.5.7", - "composer/xdebug-handler": "^2.0.2 || ^3.0.3", - "justinrainbow/json-schema": "^5.2.11", - "php": "^7.2.5 || ^8.0", - "psr/log": "^1.0 || ^2.0 || ^3.0", - "react/promise": "^2.8", - "seld/jsonlint": "^1.4", - "seld/phar-utils": "^1.2", - "seld/signal-handler": "^2.0", - "symfony/console": "^5.4.11 || ^6.0.11", - "symfony/filesystem": "^5.4 || ^6.0", - "symfony/finder": "^5.4 || ^6.0", - "symfony/polyfill-php73": "^1.24", - "symfony/polyfill-php80": "^1.24", - "symfony/process": "^5.4 || ^6.0" - }, - "require-dev": { - "phpstan/phpstan": "^1.4.1", - "phpstan/phpstan-deprecation-rules": "^1", - "phpstan/phpstan-phpunit": "^1.0", - "phpstan/phpstan-strict-rules": "^1", - "phpstan/phpstan-symfony": "^1.1", - "symfony/phpunit-bridge": "^6.0" - }, - "suggest": { - "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", - "ext-zip": "Enabling the zip extension allows you to unzip archives", - "ext-zlib": "Allow gzip compression of HTTP requests" - }, - "bin": [ - "bin/composer" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "phpstan": { - "includes": [ - "phpstan/rules.neon" - ] - } - }, - "autoload": { - "psr-4": { - "Composer\\": "src/Composer" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "https://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "https://seld.be" - } - ], - "description": "Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.", - "homepage": "https://getcomposer.org/", - "keywords": [ - "autoload", - "dependency", - "package" - ], - "support": { - "irc": "ircs://irc.libera.chat:6697/composer", - "issues": "https://github.com/composer/composer/issues", - "source": "https://github.com/composer/composer/tree/2.4.1" - }, - "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-08-20T09:44:50+00:00" - }, - { - "name": "composer/metadata-minifier", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/composer/metadata-minifier.git", - "reference": "c549d23829536f0d0e984aaabbf02af91f443207" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/metadata-minifier/zipball/c549d23829536f0d0e984aaabbf02af91f443207", - "reference": "c549d23829536f0d0e984aaabbf02af91f443207", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "composer/composer": "^2", - "phpstan/phpstan": "^0.12.55", - "symfony/phpunit-bridge": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\MetadataMinifier\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Small utility library that handles metadata minification and expansion.", - "keywords": [ - "composer", - "compression" - ], - "support": { - "issues": "https://github.com/composer/metadata-minifier/issues", - "source": "https://github.com/composer/metadata-minifier/tree/1.0.0" - }, - "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": "2021-04-07T13:37:33+00:00" - }, { "name": "composer/package-versions-deprecated", "version": "1.11.99.5", @@ -1085,86 +755,6 @@ ], "time": "2022-04-01T19:23:25+00:00" }, - { - "name": "composer/spdx-licenses", - "version": "1.5.7", - "source": { - "type": "git", - "url": "https://github.com/composer/spdx-licenses.git", - "reference": "c848241796da2abf65837d51dce1fae55a960149" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/c848241796da2abf65837d51dce1fae55a960149", - "reference": "c848241796da2abf65837d51dce1fae55a960149", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^0.12.55", - "symfony/phpunit-bridge": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Spdx\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "SPDX licenses list and validation library.", - "keywords": [ - "license", - "spdx", - "validator" - ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/spdx-licenses/issues", - "source": "https://github.com/composer/spdx-licenses/tree/1.5.7" - }, - "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-05-23T07:37:50+00:00" - }, { "name": "composer/xdebug-handler", "version": "3.0.3", @@ -4189,322 +3779,6 @@ }, "time": "2021-07-14T16:46:02+00:00" }, - { - "name": "psy/psysh", - "version": "v0.11.8", - "source": { - "type": "git", - "url": "https://github.com/bobthecow/psysh.git", - "reference": "f455acf3645262ae389b10e9beba0c358aa6994e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/f455acf3645262ae389b10e9beba0c358aa6994e", - "reference": "f455acf3645262ae389b10e9beba0c358aa6994e", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-tokenizer": "*", - "nikic/php-parser": "^4.0 || ^3.1", - "php": "^8.0 || ^7.0.8", - "symfony/console": "^6.0 || ^5.0 || ^4.0 || ^3.4", - "symfony/var-dumper": "^6.0 || ^5.0 || ^4.0 || ^3.4" - }, - "conflict": { - "symfony/console": "4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.2" - }, - "suggest": { - "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", - "ext-pdo-sqlite": "The doc command requires SQLite to work.", - "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", - "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history." - }, - "bin": [ - "bin/psysh" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "0.11.x-dev" - } - }, - "autoload": { - "files": [ - "src/functions.php" - ], - "psr-4": { - "Psy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Justin Hileman", - "email": "justin@justinhileman.info", - "homepage": "http://justinhileman.com" - } - ], - "description": "An interactive shell for modern PHP.", - "homepage": "http://psysh.org", - "keywords": [ - "REPL", - "console", - "interactive", - "shell" - ], - "support": { - "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.11.8" - }, - "time": "2022-07-28T14:25:11+00:00" - }, - { - "name": "ramsey/composer-repl", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/ramsey/composer-repl.git", - "reference": "24553610c07df626c7dfd44ef328b7ae3349366f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ramsey/composer-repl/zipball/24553610c07df626c7dfd44ef328b7ae3349366f", - "reference": "24553610c07df626c7dfd44ef328b7ae3349366f", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^2", - "php": "^7.4 || ^8", - "ramsey/composer-repl-lib": "^1.1" - }, - "require-dev": { - "captainhook/captainhook": "^5.10", - "captainhook/plugin-composer": "^5.3", - "ergebnis/composer-normalize": "^2.25", - "roave/security-advisories": "dev-latest" - }, - "type": "composer-plugin", - "extra": { - "branch-alias": { - "dev-main": "1.x-dev" - }, - "captainhook": { - "force-install": true - }, - "class": "Ramsey\\Dev\\Repl\\Composer\\ReplPlugin", - "ramsey/conventional-commits": { - "configFile": "conventional-commits.json" - }, - "ramsey/devtools": { - "command-prefix": "dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" - } - ], - "description": "A REPL for PHP built into Composer.", - "keywords": [ - "REPL", - "psysh", - "shell" - ], - "support": { - "issues": "https://github.com/ramsey/composer-repl/issues", - "source": "https://github.com/ramsey/composer-repl/tree/1.4.1" - }, - "funding": [ - { - "url": "https://github.com/ramsey", - "type": "github" - } - ], - "time": "2022-04-17T02:07:54+00:00" - }, - { - "name": "ramsey/composer-repl-lib", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/ramsey/composer-repl-lib.git", - "reference": "53f7666f1f4b49711741ad22b633671a312a6fdc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ramsey/composer-repl-lib/zipball/53f7666f1f4b49711741ad22b633671a312a6fdc", - "reference": "53f7666f1f4b49711741ad22b633671a312a6fdc", - "shasum": "" - }, - "require": { - "composer/composer": "^2.1.9", - "php": "^7.4 || ^8", - "phpunit/phpunit": "^6 || ^7 || ^8 || ^9", - "psy/psysh": "^0.11.0", - "symfony/console": "^4.4.30 || ^5.3.7 || ^6", - "symfony/process": "^4.4.30 || ^5.3.7 || ^6" - }, - "require-dev": { - "captainhook/captainhook": "^5.10", - "captainhook/plugin-composer": "^5.3", - "ergebnis/composer-normalize": "^2.25", - "hamcrest/hamcrest-php": "^2.0", - "mockery/mockery": "^1.5", - "php-parallel-lint/php-console-highlighter": "^1.0", - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.5", - "phpstan/phpstan-mockery": "^1.0", - "phpstan/phpstan-phpunit": "^1.1", - "psalm/plugin-mockery": "^0.9.1", - "psalm/plugin-phpunit": "^0.16.1", - "ramsey/coding-standard": "^2.0.3", - "roave/security-advisories": "dev-latest", - "vimeo/psalm": "^4.22" - }, - "bin": [ - "bin/repl" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.x-dev" - }, - "captainhook": { - "force-install": true - }, - "ramsey/composer-repl": { - "includes": [ - "repl.php" - ] - }, - "ramsey/conventional-commits": { - "configFile": "conventional-commits.json" - } - }, - "autoload": { - "psr-4": { - "Ramsey\\Dev\\Repl\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" - } - ], - "description": "The library behind ramsey/composer-repl, allowing for extension of the ramsey/composer-repl Composer plugin and non-plugin use of the repl command.", - "keywords": [ - "REPL", - "psysh", - "shell" - ], - "support": { - "issues": "https://github.com/ramsey/composer-repl-lib/issues", - "source": "https://github.com/ramsey/composer-repl-lib/tree/1.1.0" - }, - "funding": [ - { - "url": "https://github.com/ramsey", - "type": "github" - } - ], - "time": "2022-04-17T01:54:57+00:00" - }, - { - "name": "react/promise", - "version": "v2.9.0", - "source": { - "type": "git", - "url": "https://github.com/reactphp/promise.git", - "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/234f8fd1023c9158e2314fa9d7d0e6a83db42910", - "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" - }, - "type": "library", - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "React\\Promise\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com", - "homepage": "https://sorgalla.com/" - }, - { - "name": "Christian Lück", - "email": "christian@clue.engineering", - "homepage": "https://clue.engineering/" - }, - { - "name": "Cees-Jan Kiewiet", - "email": "reactphp@ceesjankiewiet.nl", - "homepage": "https://wyrihaximus.net/" - }, - { - "name": "Chris Boden", - "email": "cboden@gmail.com", - "homepage": "https://cboden.dev/" - } - ], - "description": "A lightweight implementation of CommonJS Promises/A for PHP", - "keywords": [ - "promise", - "promises" - ], - "support": { - "issues": "https://github.com/reactphp/promise/issues", - "source": "https://github.com/reactphp/promise/tree/v2.9.0" - }, - "funding": [ - { - "url": "https://github.com/WyriHaximus", - "type": "github" - }, - { - "url": "https://github.com/clue", - "type": "github" - } - ], - "time": "2022-02-11T10:27:51+00:00" - }, { "name": "sebastian/cli-parser", "version": "1.0.1", @@ -5708,115 +4982,6 @@ ], "time": "2022-04-01T13:37:23+00:00" }, - { - "name": "seld/phar-utils", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "ea2f4014f163c1be4c601b9b7bd6af81ba8d701c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/ea2f4014f163c1be4c601b9b7bd6af81ba8d701c", - "reference": "ea2f4014f163c1be4c601b9b7bd6af81ba8d701c", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Seld\\PharUtils\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "PHAR file format utilities, for when PHP phars you up", - "keywords": [ - "phar" - ], - "support": { - "issues": "https://github.com/Seldaek/phar-utils/issues", - "source": "https://github.com/Seldaek/phar-utils/tree/1.2.1" - }, - "time": "2022-08-31T10:31:18+00:00" - }, - { - "name": "seld/signal-handler", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/signal-handler.git", - "reference": "f69d119511dc0360440cdbdaa71829c149b7be75" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/signal-handler/zipball/f69d119511dc0360440cdbdaa71829c149b7be75", - "reference": "f69d119511dc0360440cdbdaa71829c149b7be75", - "shasum": "" - }, - "require": { - "php": ">=7.2.0" - }, - "require-dev": { - "phpstan/phpstan": "^1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1", - "phpstan/phpstan-strict-rules": "^1.3", - "phpunit/phpunit": "^7.5.20 || ^8.5.23", - "psr/log": "^1 || ^2 || ^3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Seld\\Signal\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Simple unix signal handler that silently fails where signals are not supported for easy cross-platform development", - "keywords": [ - "posix", - "sigint", - "signal", - "sigterm", - "unix" - ], - "support": { - "issues": "https://github.com/Seldaek/signal-handler/issues", - "source": "https://github.com/Seldaek/signal-handler/tree/2.0.1" - }, - "time": "2022-07-20T18:31:45+00:00" - }, { "name": "slevomat/coding-standard", "version": "8.4.0", @@ -6617,85 +5782,6 @@ ], "time": "2022-05-24T11:49:31+00:00" }, - { - "name": "symfony/polyfill-php73", - "version": "v1.26.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.26-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.26.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-05-24T11:49:31+00:00" - }, { "name": "symfony/polyfill-php80", "version": "v1.26.0", @@ -7007,94 +6093,6 @@ ], "time": "2022-08-12T18:05:20+00:00" }, - { - "name": "symfony/var-dumper", - "version": "v6.0.11", - "source": { - "type": "git", - "url": "https://github.com/symfony/var-dumper.git", - "reference": "2672bdc01c1971e3d8879ce153ec4c3621be5f07" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/2672bdc01c1971e3d8879ce153ec4c3621be5f07", - "reference": "2672bdc01c1971e3d8879ce153ec4c3621be5f07", - "shasum": "" - }, - "require": { - "php": ">=8.0.2", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.3", - "symfony/console": "<5.4" - }, - "require-dev": { - "ext-iconv": "*", - "symfony/console": "^5.4|^6.0", - "symfony/process": "^5.4|^6.0", - "symfony/uid": "^5.4|^6.0", - "twig/twig": "^2.13|^3.0.4" - }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, - "bin": [ - "Resources/bin/var-dump-server" - ], - "type": "library", - "autoload": { - "files": [ - "Resources/functions/dump.php" - ], - "psr-4": { - "Symfony\\Component\\VarDumper\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides mechanisms for walking through any arbitrary PHP variable", - "homepage": "https://symfony.com", - "keywords": [ - "debug", - "dump" - ], - "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.0.11" - }, - "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-07-20T13:45:53+00:00" - }, { "name": "theseer/tokenizer", "version": "1.2.1", From 691c2c816ea574eab667268eca85a1d9046ea599 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Sun, 25 May 2025 14:53:53 -0500 Subject: [PATCH 2/3] chore(deps-dev): remove Psalm --- .gitattributes | 2 - .github/workflows/continuous-integration.yml | 3 - CONTRIBUTING.md | 5 +- README.md | 1 - composer.json | 10 +- composer.lock | 1051 +---------------- psalm-baseline.xml | 175 --- psalm.xml | 22 - src/BinaryUtils.php | 4 - src/Builder/BuilderCollection.php | 10 +- src/Builder/DefaultUuidBuilder.php | 2 +- src/Builder/DegradedUuidBuilder.php | 4 +- src/Builder/FallbackBuilder.php | 4 +- src/Builder/UuidBuilderInterface.php | 4 +- src/Codec/CodecInterface.php | 10 +- src/Codec/GuidStringCodec.php | 2 +- src/Codec/OrderedTimeCodec.php | 9 +- src/Codec/StringCodec.php | 6 +- src/Codec/TimestampFirstCombCodec.php | 10 +- src/Codec/TimestampLastCombCodec.php | 2 +- src/Converter/Number/BigNumberConverter.php | 10 +- .../Number/DegradedNumberConverter.php | 2 +- .../Number/GenericNumberConverter.php | 16 +- src/Converter/NumberConverterInterface.php | 18 +- src/Converter/Time/BigNumberTimeConverter.php | 2 +- src/Converter/Time/DegradedTimeConverter.php | 2 +- src/Converter/Time/GenericTimeConverter.php | 2 +- src/Converter/Time/PhpTimeConverter.php | 3 +- src/Converter/Time/UnixTimeConverter.php | 2 +- src/Converter/TimeConverterInterface.php | 6 +- src/DegradedUuid.php | 2 +- src/DeprecatedUuidInterface.php | 2 +- src/DeprecatedUuidMethodsTrait.php | 2 +- src/FeatureSet.php | 1 - src/Fields/FieldsInterface.php | 4 +- src/Fields/SerializableFieldsTrait.php | 6 +- src/Generator/DefaultNameGenerator.php | 1 - src/Generator/NameGeneratorInterface.php | 2 - src/Generator/PeclUuidNameGenerator.php | 1 - src/Guid/Fields.php | 2 +- src/Guid/Guid.php | 2 +- src/Guid/GuidBuilder.php | 4 +- src/Lazy/LazyUuidFromString.php | 186 +-- src/Math/BrickMathCalculator.php | 2 +- src/Math/CalculatorInterface.php | 2 +- src/Nonstandard/Fields.php | 2 +- src/Nonstandard/Uuid.php | 2 +- src/Nonstandard/UuidBuilder.php | 4 +- src/Nonstandard/UuidV6.php | 2 +- .../Dce/SystemDceSecurityProvider.php | 5 +- src/Provider/Node/NodeProviderCollection.php | 3 - src/Provider/Node/SystemNodeProvider.php | 10 +- src/Rfc4122/Fields.php | 4 +- src/Rfc4122/FieldsInterface.php | 2 +- src/Rfc4122/MaxTrait.php | 2 +- src/Rfc4122/MaxUuid.php | 2 +- src/Rfc4122/NilTrait.php | 2 +- src/Rfc4122/NilUuid.php | 2 +- src/Rfc4122/TimeTrait.php | 2 +- src/Rfc4122/UuidBuilder.php | 4 +- src/Rfc4122/UuidInterface.php | 2 +- src/Rfc4122/UuidV1.php | 2 +- src/Rfc4122/UuidV2.php | 2 +- src/Rfc4122/UuidV3.php | 4 +- src/Rfc4122/UuidV4.php | 2 +- src/Rfc4122/UuidV5.php | 4 +- src/Rfc4122/UuidV6.php | 2 +- src/Rfc4122/UuidV7.php | 2 +- src/Rfc4122/UuidV8.php | 2 +- src/Rfc4122/Validator.php | 6 +- src/Rfc4122/VariantTrait.php | 2 +- src/Rfc4122/VersionTrait.php | 2 +- src/Type/Decimal.php | 6 +- src/Type/Hexadecimal.php | 4 +- src/Type/Integer.php | 11 +- src/Type/NumberInterface.php | 2 +- src/Type/Time.php | 4 +- src/Type/TypeInterface.php | 2 +- src/Uuid.php | 62 +- src/UuidFactory.php | 25 - src/UuidFactoryInterface.php | 16 +- src/UuidInterface.php | 8 +- src/Validator/GenericValidator.php | 6 +- src/Validator/ValidatorInterface.php | 6 +- src/functions.php | 6 - tests/benchmark/UuidSerializationBench.php | 6 +- tests/benchmark/UuidStringConversionBench.php | 15 +- tests/static-analysis/UuidIsImmutable.php | 9 - tests/static-analysis/UuidIsNeverEmpty.php | 4 +- tests/static-analysis/stubs.php | 4 - 90 files changed, 153 insertions(+), 1741 deletions(-) delete mode 100644 psalm-baseline.xml delete mode 100644 psalm.xml diff --git a/.gitattributes b/.gitattributes index baa3232..455e1e0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -19,8 +19,6 @@ /phpstan-tests.neon export-ignore /phpstan.neon.dist export-ignore /phpunit.xml.dist export-ignore -/psalm-baseline.xml export-ignore -/psalm.xml export-ignore /resources/ export-ignore /SECURITY.md export-ignore /tests/ export-ignore diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e0d28d5..7c6e099 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -63,9 +63,6 @@ jobs: - name: "Statically analyze code (PHPStan)" run: "composer phpstan -- --ansi" - - name: "Statically analyze code (Psalm)" - run: "composer psalm -- --shepherd" - benchmark: name: "Benchmark" needs: ["coding-standards", "static-analysis"] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 75d91f5..8535a9e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -129,9 +129,8 @@ composer phpcbf ### Static Analysis -This project uses a combination of [PHPStan](https://github.com/phpstan/phpstan) -and [Psalm](https://github.com/vimeo/psalm) to provide static analysis of PHP -code. +This project uses [PHPStan](https://github.com/phpstan/phpstan) to provide +static analysis of PHP code. CaptainHook will run static analysis checks before committing. diff --git a/README.md b/README.md index 0db8149..eab624d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ Read License Build Status Codecov Code Coverage - Psalm Type Coverage

ramsey/uuid is a PHP library for generating and working with universally unique diff --git a/composer.json b/composer.json index 83a0020..9f2cd4f 100644 --- a/composer.json +++ b/composer.json @@ -32,8 +32,7 @@ "phpstan/phpstan-phpunit": "^1.1", "phpunit/phpunit": "^8.5 || ^9", "slevomat/coding-standard": "^8.4", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.9" + "squizlabs/php_codesniffer": "^3.5" }, "replace": { "rhumsaa/uuid": "self.version" @@ -77,10 +76,7 @@ } }, "scripts": { - "analyze": [ - "@phpstan", - "@psalm" - ], + "analyze": "@phpstan", "build:clean": "git clean -fX build/", "lint": "parallel-lint src tests", "lint:paths": "parallel-lint", @@ -93,13 +89,11 @@ ], "phpunit": "phpunit --verbose --colors=always", "phpunit-coverage": "phpunit --verbose --colors=always --coverage-html build/coverage", - "psalm": "psalm --show-info=false --config=psalm.xml", "test": [ "@lint", "@phpbench", "@phpcs", "@phpstan", - "@psalm", "@phpunit" ] } diff --git a/composer.lock b/composer.lock index ed60ee5..371a2bb 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": "023f5fd1392acd8688a8372107dc5c99", + "content-hash": "8a871cc8547137334b735ea98dd9cc28", "packages": [ { "name": "brick/math", @@ -226,172 +226,6 @@ } ], "packages-dev": [ - { - "name": "amphp/amp", - "version": "v2.6.2", - "source": { - "type": "git", - "url": "https://github.com/amphp/amp.git", - "reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/9d5100cebffa729aaffecd3ad25dc5aeea4f13bb", - "reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1", - "ext-json": "*", - "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^7 | ^8 | ^9", - "psalm/phar": "^3.11@dev", - "react/promise": "^2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "files": [ - "lib/functions.php", - "lib/Internal/functions.php" - ], - "psr-4": { - "Amp\\": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Lowrey", - "email": "rdlowrey@php.net" - }, - { - "name": "Aaron Piotrowski", - "email": "aaron@trowski.com" - }, - { - "name": "Bob Weinand", - "email": "bobwei9@hotmail.com" - }, - { - "name": "Niklas Keller", - "email": "me@kelunik.com" - } - ], - "description": "A non-blocking concurrency framework for PHP applications.", - "homepage": "https://amphp.org/amp", - "keywords": [ - "async", - "asynchronous", - "awaitable", - "concurrency", - "event", - "event-loop", - "future", - "non-blocking", - "promise" - ], - "support": { - "irc": "irc://irc.freenode.org/amphp", - "issues": "https://github.com/amphp/amp/issues", - "source": "https://github.com/amphp/amp/tree/v2.6.2" - }, - "funding": [ - { - "url": "https://github.com/amphp", - "type": "github" - } - ], - "time": "2022-02-20T17:52:18+00:00" - }, - { - "name": "amphp/byte-stream", - "version": "v1.8.1", - "source": { - "type": "git", - "url": "https://github.com/amphp/byte-stream.git", - "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/amphp/byte-stream/zipball/acbd8002b3536485c997c4e019206b3f10ca15bd", - "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd", - "shasum": "" - }, - "require": { - "amphp/amp": "^2", - "php": ">=7.1" - }, - "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1.4", - "friendsofphp/php-cs-fixer": "^2.3", - "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^6 || ^7 || ^8", - "psalm/phar": "^3.11.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "files": [ - "lib/functions.php" - ], - "psr-4": { - "Amp\\ByteStream\\": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Aaron Piotrowski", - "email": "aaron@trowski.com" - }, - { - "name": "Niklas Keller", - "email": "me@kelunik.com" - } - ], - "description": "A stream abstraction to make working with non-blocking I/O simple.", - "homepage": "http://amphp.org/byte-stream", - "keywords": [ - "amp", - "amphp", - "async", - "io", - "non-blocking", - "stream" - ], - "support": { - "irc": "irc://irc.freenode.org/amphp", - "issues": "https://github.com/amphp/byte-stream/issues", - "source": "https://github.com/amphp/byte-stream/tree/v1.8.1" - }, - "funding": [ - { - "url": "https://github.com/amphp", - "type": "github" - } - ], - "time": "2021-03-30T17:13:30+00:00" - }, { "name": "captainhook/captainhook", "version": "5.10.11", @@ -530,297 +364,6 @@ }, "time": "2022-01-28T04:35:22+00:00" }, - { - "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.0", - "source": { - "type": "git", - "url": "https://github.com/composer/pcre.git", - "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/e300eb6c535192decd27a85bc72a9290f0d6b3bd", - "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd", - "shasum": "" - }, - "require": { - "php": "^7.4 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^1.3", - "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Pcre\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "PCRE wrapping library that offers type-safe preg_* replacements.", - "keywords": [ - "PCRE", - "preg", - "regex", - "regular expression" - ], - "support": { - "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.0.0" - }, - "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-02-25T20:21:48+00:00" - }, - { - "name": "composer/semver", - "version": "3.3.2", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", - "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^1.4", - "symfony/phpunit-bridge": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Semver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.3.2" - }, - "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-04-01T19:23:25+00:00" - }, - { - "name": "composer/xdebug-handler", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "ced299686f41dce890debac69273b47ffe98a40c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", - "reference": "ced299686f41dce890debac69273b47ffe98a40c", - "shasum": "" - }, - "require": { - "composer/pcre": "^1 || ^2 || ^3", - "php": "^7.2.5 || ^8.0", - "psr/log": "^1 || ^2 || ^3" - }, - "require-dev": { - "phpstan/phpstan": "^1.0", - "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^6.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Composer\\XdebugHandler\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" - } - ], - "description": "Restarts a process without Xdebug.", - "keywords": [ - "Xdebug", - "performance" - ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" - }, - "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-02-25T21:32:43+00:00" - }, { "name": "dealerdirect/phpcodesniffer-composer-installer", "version": "v0.7.2", @@ -896,43 +439,6 @@ }, "time": "2022-02-04T12:51:07+00:00" }, - { - "name": "dnoegel/php-xdg-base-dir", - "version": "v0.1.1", - "source": { - "type": "git", - "url": "https://github.com/dnoegel/php-xdg-base-dir.git", - "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", - "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~7.0|~6.0|~5.0|~4.8.35" - }, - "type": "library", - "autoload": { - "psr-4": { - "XdgBaseDir\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "implementation of xdg base directory specification for php", - "support": { - "issues": "https://github.com/dnoegel/php-xdg-base-dir/issues", - "source": "https://github.com/dnoegel/php-xdg-base-dir/tree/v0.1.1" - }, - "time": "2019-12-04T15:06:13+00:00" - }, { "name": "doctrine/annotations", "version": "1.13.3", @@ -1420,107 +926,6 @@ ], "time": "2021-12-13T16:54:56+00:00" }, - { - "name": "felixfbecker/advanced-json-rpc", - "version": "v3.2.1", - "source": { - "type": "git", - "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", - "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/b5f37dbff9a8ad360ca341f3240dc1c168b45447", - "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447", - "shasum": "" - }, - "require": { - "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "php": "^7.1 || ^8.0", - "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0" - }, - "require-dev": { - "phpunit/phpunit": "^7.0 || ^8.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "AdvancedJsonRpc\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Felix Becker", - "email": "felix.b@outlook.com" - } - ], - "description": "A more advanced JSONRPC implementation", - "support": { - "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues", - "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.1" - }, - "time": "2021-06-11T22:34:44+00:00" - }, - { - "name": "felixfbecker/language-server-protocol", - "version": "v1.5.2", - "source": { - "type": "git", - "url": "https://github.com/felixfbecker/php-language-server-protocol.git", - "reference": "6e82196ffd7c62f7794d778ca52b69feec9f2842" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/6e82196ffd7c62f7794d778ca52b69feec9f2842", - "reference": "6e82196ffd7c62f7794d778ca52b69feec9f2842", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpstan/phpstan": "*", - "squizlabs/php_codesniffer": "^3.1", - "vimeo/psalm": "^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "LanguageServerProtocol\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Felix Becker", - "email": "felix.b@outlook.com" - } - ], - "description": "PHP classes for the Language Server Protocol", - "keywords": [ - "language", - "microsoft", - "php", - "server" - ], - "support": { - "issues": "https://github.com/felixfbecker/php-language-server-protocol/issues", - "source": "https://github.com/felixfbecker/php-language-server-protocol/tree/v1.5.2" - }, - "time": "2022-03-02T22:36:06+00:00" - }, { "name": "hamcrest/hamcrest-php", "version": "v2.0.1", @@ -1883,57 +1288,6 @@ ], "time": "2022-03-03T13:19:32+00:00" }, - { - "name": "netresearch/jsonmapper", - "version": "v4.0.0", - "source": { - "type": "git", - "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", - "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "~7.5 || ~8.0 || ~9.0", - "squizlabs/php_codesniffer": "~3.5" - }, - "type": "library", - "autoload": { - "psr-0": { - "JsonMapper": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "OSL-3.0" - ], - "authors": [ - { - "name": "Christian Weiske", - "email": "cweiske@cweiske.de", - "homepage": "http://github.com/cweiske/jsonmapper/", - "role": "Developer" - } - ], - "description": "Map nested JSON structures onto PHP classes", - "support": { - "email": "cweiske@cweiske.de", - "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/v4.0.0" - }, - "time": "2020-12-01T19:48:11+00:00" - }, { "name": "nikic/php-parser", "version": "v4.15.1", @@ -1990,59 +1344,6 @@ }, "time": "2022-09-04T07:30:47+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": "paragonie/random-lib", "version": "v2.0.1", @@ -2800,166 +2101,6 @@ ], "time": "2022-07-19T19:52:39+00:00" }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" - }, - "time": "2021-10-19T17:43:47+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "77a32518733312af16a44300404e945338981de3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", - "reference": "77a32518733312af16a44300404e945338981de3", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "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.1" - }, - "time": "2022-03-15T21:29:03+00:00" - }, { "name": "phpstan/extension-installer", "version": "1.1.0", @@ -5782,89 +4923,6 @@ ], "time": "2022-05-24T11:49:31+00:00" }, - { - "name": "symfony/polyfill-php80", - "version": "v1.26.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.26-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.26.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-05-10T07:21:04+00:00" - }, { "name": "symfony/process", "version": "v6.0.11", @@ -6143,113 +5201,6 @@ ], "time": "2021-07-28T10:34:58+00:00" }, - { - "name": "vimeo/psalm", - "version": "4.27.0", - "source": { - "type": "git", - "url": "https://github.com/vimeo/psalm.git", - "reference": "faf106e717c37b8c81721845dba9de3d8deed8ff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/faf106e717c37b8c81721845dba9de3d8deed8ff", - "reference": "faf106e717c37b8c81721845dba9de3d8deed8ff", - "shasum": "" - }, - "require": { - "amphp/amp": "^2.4.2", - "amphp/byte-stream": "^1.5", - "composer/package-versions-deprecated": "^1.8.0", - "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^1.1 || ^2.0 || ^3.0", - "dnoegel/php-xdg-base-dir": "^0.1.1", - "ext-ctype": "*", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-simplexml": "*", - "ext-tokenizer": "*", - "felixfbecker/advanced-json-rpc": "^3.0.3", - "felixfbecker/language-server-protocol": "^1.5", - "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" - }, - "provide": { - "psalm/psalm": "self.version" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.2", - "brianium/paratest": "^4.0||^6.0", - "ext-curl": "*", - "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", - "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" - }, - "suggest": { - "ext-curl": "In order to send data to shepherd", - "ext-igbinary": "^2.0.5 is required, used to serialize caching data" - }, - "bin": [ - "psalm", - "psalm-language-server", - "psalm-plugin", - "psalm-refactor", - "psalter" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "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/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Matthew Brown" - } - ], - "description": "A static analysis tool for finding errors in PHP applications", - "keywords": [ - "code", - "inspection", - "php" - ], - "support": { - "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.27.0" - }, - "time": "2022-08-31T13:47:09+00:00" - }, { "name": "webmozart/assert", "version": "1.11.0", diff --git a/psalm-baseline.xml b/psalm-baseline.xml deleted file mode 100644 index a571c8e..0000000 --- a/psalm-baseline.xml +++ /dev/null @@ -1,175 +0,0 @@ - - - - - DegradedUuid - new DegradedTimeConverter() - - - $this - $this - - - - - - $this - - - - - $this - $this - - - - - BigNumberConverter - - - - - $this - $this - - - - - BigNumberTimeConverter - - - - - $calculator - $dceSecurityGenerator - $numberConverter - $timeConverter - $timeGenerator - - - - - uuid_generate_md5 - uuid_generate_sha1 - uuid_parse - - - - - $this - $this - $this - - - - - $this - $this - $this - - - - - shell_exec('id -g') - shell_exec('id -u') - shell_exec('net user %username% | findstr /b /i "Local Group Memberships"') - shell_exec('whoami /user /fo csv /nh') - shell_exec('wmic group get name,sid | findstr /b /i ' . escapeshellarg($firstGroup)) - - - - - $macs - - - $macs[] - - - - - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - - - - - NonstandardUuidV6 - - - - - unserialize - - - - - unserialize - - - - - __construct - - - - - DeprecatedUuidMethodsTrait - - - getFactory - getFactory - getFactory - getFactory - getFactory - getFactory - - - unserialize - - - - - $this->codec - $this->codec - $this->codec - $this->isDefaultFeatureSet - $this->nameGenerator - $this->numberConverter - $this->uuidBuilder - - - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - $this - - - diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index 04cb32c..0000000 --- a/psalm.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/BinaryUtils.php b/src/BinaryUtils.php index fb8ba9a..5502cf8 100644 --- a/src/BinaryUtils.php +++ b/src/BinaryUtils.php @@ -28,8 +28,6 @@ class BinaryUtils * variant is applied * * @return int The 16-bit clock sequence multiplexed with the UUID variant - * - * @psalm-pure */ public static function applyVariant(int $clockSeq): int { @@ -50,8 +48,6 @@ class BinaryUtils * * @return int The 16-bit time_hi field of the timestamp multiplexed with * the UUID version number - * - * @psalm-pure */ public static function applyVersion(int $timeHi, int $version): int { diff --git a/src/Builder/BuilderCollection.php b/src/Builder/BuilderCollection.php index 9df3110..b0765c0 100644 --- a/src/Builder/BuilderCollection.php +++ b/src/Builder/BuilderCollection.php @@ -27,7 +27,7 @@ use Traversable; /** * A collection of UuidBuilderInterface objects * - * @deprecated this class has been deprecated, and will be removed in 5.0.0. The use-case for this class comes from + * @deprecated this class has been deprecated and will be removed in 5.0.0. The use-case for this class comes from * a pre-`phpstan/phpstan` and pre-`vimeo/psalm` ecosystem, in which type safety had to be mostly enforced * at runtime: that is no longer necessary, now that you can safely verify your code to be correct, and use * more generic types like `iterable` instead. @@ -41,11 +41,6 @@ class BuilderCollection extends AbstractCollection return UuidBuilderInterface::class; } - /** - * @psalm-mutation-free - * @psalm-suppress ImpureMethodCall - * @psalm-suppress InvalidTemplateParam - */ public function getIterator(): Traversable { return parent::getIterator(); @@ -56,9 +51,6 @@ class BuilderCollection extends AbstractCollection * * @param string $serialized The serialized PHP string to unserialize into * a UuidInterface instance - * - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - * @psalm-suppress RedundantConditionGivenDocblockType */ public function unserialize($serialized): void { diff --git a/src/Builder/DefaultUuidBuilder.php b/src/Builder/DefaultUuidBuilder.php index 7c4a6f8..dcac0fb 100644 --- a/src/Builder/DefaultUuidBuilder.php +++ b/src/Builder/DefaultUuidBuilder.php @@ -19,7 +19,7 @@ use Ramsey\Uuid\Rfc4122\UuidBuilder as Rfc4122UuidBuilder; /** * @deprecated Transition to {@see Rfc4122UuidBuilder}. * - * @psalm-immutable + * @immutable */ class DefaultUuidBuilder extends Rfc4122UuidBuilder { diff --git a/src/Builder/DegradedUuidBuilder.php b/src/Builder/DegradedUuidBuilder.php index 20b3842..41523cf 100644 --- a/src/Builder/DegradedUuidBuilder.php +++ b/src/Builder/DegradedUuidBuilder.php @@ -26,7 +26,7 @@ use Ramsey\Uuid\UuidInterface; * @deprecated DegradedUuid instances are no longer necessary to support 32-bit * systems. Transition to {@see DefaultUuidBuilder}. * - * @psalm-immutable + * @immutable */ class DegradedUuidBuilder implements UuidBuilderInterface { @@ -52,8 +52,6 @@ class DegradedUuidBuilder implements UuidBuilderInterface * @param string $bytes The byte string from which to construct a UUID * * @return DegradedUuid The DegradedUuidBuild returns an instance of Ramsey\Uuid\DegradedUuid - * - * @psalm-pure */ public function build(CodecInterface $codec, string $bytes): UuidInterface { diff --git a/src/Builder/FallbackBuilder.php b/src/Builder/FallbackBuilder.php index ba5f31f..aa58ae6 100644 --- a/src/Builder/FallbackBuilder.php +++ b/src/Builder/FallbackBuilder.php @@ -23,7 +23,7 @@ use Ramsey\Uuid\UuidInterface; * FallbackBuilder builds a UUID by stepping through a list of UUID builders * until a UUID can be constructed without exceptions * - * @psalm-immutable + * @immutable */ class FallbackBuilder implements UuidBuilderInterface { @@ -42,8 +42,6 @@ class FallbackBuilder implements UuidBuilderInterface * @param string $bytes The byte string from which to construct a UUID * * @return UuidInterface an instance of a UUID object - * - * @psalm-pure */ public function build(CodecInterface $codec, string $bytes): UuidInterface { diff --git a/src/Builder/UuidBuilderInterface.php b/src/Builder/UuidBuilderInterface.php index 8e58b2b..74196e2 100644 --- a/src/Builder/UuidBuilderInterface.php +++ b/src/Builder/UuidBuilderInterface.php @@ -20,7 +20,7 @@ use Ramsey\Uuid\UuidInterface; /** * A UUID builder builds instances of UuidInterface * - * @psalm-immutable + * @immutable */ interface UuidBuilderInterface { @@ -32,8 +32,6 @@ interface UuidBuilderInterface * * @return UuidInterface Implementations may choose to return more specific * instances of UUIDs that implement UuidInterface - * - * @psalm-pure */ public function build(CodecInterface $codec, string $bytes): UuidInterface; } diff --git a/src/Codec/CodecInterface.php b/src/Codec/CodecInterface.php index 85f8a7e..82814cc 100644 --- a/src/Codec/CodecInterface.php +++ b/src/Codec/CodecInterface.php @@ -19,7 +19,7 @@ use Ramsey\Uuid\UuidInterface; /** * A codec encodes and decodes a UUID according to defined rules * - * @psalm-immutable + * @immutable */ interface CodecInterface { @@ -29,9 +29,7 @@ interface CodecInterface * @param UuidInterface $uuid The UUID for which to create a hexadecimal * string representation * - * @return string Hexadecimal string representation of a UUID - * - * @psalm-return non-empty-string + * @return non-empty-string Hexadecimal string representation of a UUID */ public function encode(UuidInterface $uuid): string; @@ -41,9 +39,7 @@ interface CodecInterface * @param UuidInterface $uuid The UUID for which to create a binary string * representation * - * @return string Binary string representation of a UUID - * - * @psalm-return non-empty-string + * @return non-empty-string Binary string representation of a UUID */ public function encodeBinary(UuidInterface $uuid): string; diff --git a/src/Codec/GuidStringCodec.php b/src/Codec/GuidStringCodec.php index 04872e0..05b55be 100644 --- a/src/Codec/GuidStringCodec.php +++ b/src/Codec/GuidStringCodec.php @@ -26,7 +26,7 @@ use function substr; * * @see Guid * - * @psalm-immutable + * @immutable */ class GuidStringCodec extends StringCodec { diff --git a/src/Codec/OrderedTimeCodec.php b/src/Codec/OrderedTimeCodec.php index 0798ebc..3c06804 100644 --- a/src/Codec/OrderedTimeCodec.php +++ b/src/Codec/OrderedTimeCodec.php @@ -41,7 +41,7 @@ use function substr; * * @link https://www.percona.com/blog/2014/12/19/store-uuid-optimized-way/ Storing UUID Values in MySQL * - * @psalm-immutable + * @immutable */ class OrderedTimeCodec extends StringCodec { @@ -49,10 +49,7 @@ class OrderedTimeCodec extends StringCodec * Returns a binary string representation of a UUID, with the timestamp * fields rearranged for optimized storage * - * @inheritDoc - * @psalm-return non-empty-string - * @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty - * @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty + * @return non-empty-string */ public function encodeBinary(UuidInterface $uuid): string { @@ -67,7 +64,7 @@ class OrderedTimeCodec extends StringCodec $bytes = $uuid->getFields()->getBytes(); - /** @phpstan-ignore-next-line PHPStan complains that this is not a non-empty-string. */ + /** @var non-empty-string */ return $bytes[6] . $bytes[7] . $bytes[4] . $bytes[5] . $bytes[0] . $bytes[1] . $bytes[2] . $bytes[3] diff --git a/src/Codec/StringCodec.php b/src/Codec/StringCodec.php index 95f38d2..1785787 100644 --- a/src/Codec/StringCodec.php +++ b/src/Codec/StringCodec.php @@ -33,7 +33,7 @@ use function substr; * * @link http://tools.ietf.org/html/rfc4122 * - * @psalm-immutable + * @immutable */ class StringCodec implements CodecInterface { @@ -62,9 +62,7 @@ class StringCodec implements CodecInterface } /** - * @psalm-return non-empty-string - * @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty - * @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty + * @return non-empty-string */ public function encodeBinary(UuidInterface $uuid): string { diff --git a/src/Codec/TimestampFirstCombCodec.php b/src/Codec/TimestampFirstCombCodec.php index 0e0042d..3722738 100644 --- a/src/Codec/TimestampFirstCombCodec.php +++ b/src/Codec/TimestampFirstCombCodec.php @@ -46,14 +46,12 @@ use function substr_replace; * * @link https://www.informit.com/articles/printerfriendly/25862 The Cost of GUIDs as Primary Keys * - * @psalm-immutable + * @immutable */ class TimestampFirstCombCodec extends StringCodec { /** - * @psalm-return non-empty-string - * @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty - * @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty + * @return non-empty-string */ public function encode(UuidInterface $uuid): string { @@ -70,9 +68,7 @@ class TimestampFirstCombCodec extends StringCodec } /** - * @psalm-return non-empty-string - * @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty - * @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty + * @return non-empty-string */ public function encodeBinary(UuidInterface $uuid): string { diff --git a/src/Codec/TimestampLastCombCodec.php b/src/Codec/TimestampLastCombCodec.php index 4856dea..ffc8674 100644 --- a/src/Codec/TimestampLastCombCodec.php +++ b/src/Codec/TimestampLastCombCodec.php @@ -44,7 +44,7 @@ namespace Ramsey\Uuid\Codec; * * @link https://www.informit.com/articles/printerfriendly/25862 The Cost of GUIDs as Primary Keys * - * @psalm-immutable + * @immutable */ class TimestampLastCombCodec extends StringCodec { diff --git a/src/Converter/Number/BigNumberConverter.php b/src/Converter/Number/BigNumberConverter.php index 99b88b3..6952cda 100644 --- a/src/Converter/Number/BigNumberConverter.php +++ b/src/Converter/Number/BigNumberConverter.php @@ -23,7 +23,7 @@ use Ramsey\Uuid\Math\BrickMathCalculator; * * @deprecated Transition to {@see GenericNumberConverter}. * - * @psalm-immutable + * @immutable */ class BigNumberConverter implements NumberConverterInterface { @@ -34,19 +34,11 @@ class BigNumberConverter implements NumberConverterInterface $this->converter = new GenericNumberConverter(new BrickMathCalculator()); } - /** - * @inheritDoc - * @psalm-pure - */ public function fromHex(string $hex): string { return $this->converter->fromHex($hex); } - /** - * @inheritDoc - * @psalm-pure - */ public function toHex(string $number): string { return $this->converter->toHex($number); diff --git a/src/Converter/Number/DegradedNumberConverter.php b/src/Converter/Number/DegradedNumberConverter.php index c9cfa68..4dbb38a 100644 --- a/src/Converter/Number/DegradedNumberConverter.php +++ b/src/Converter/Number/DegradedNumberConverter.php @@ -18,7 +18,7 @@ namespace Ramsey\Uuid\Converter\Number; * @deprecated DegradedNumberConverter is no longer necessary for converting * numbers on 32-bit systems. Transition to {@see GenericNumberConverter}. * - * @psalm-immutable + * @immutable */ class DegradedNumberConverter extends BigNumberConverter { diff --git a/src/Converter/Number/GenericNumberConverter.php b/src/Converter/Number/GenericNumberConverter.php index 043c3c4..933c146 100644 --- a/src/Converter/Number/GenericNumberConverter.php +++ b/src/Converter/Number/GenericNumberConverter.php @@ -22,7 +22,7 @@ use Ramsey\Uuid\Type\Integer as IntegerObject; * GenericNumberConverter uses the provided calculator to convert decimal * numbers to and from hexadecimal values * - * @psalm-immutable + * @immutable */ class GenericNumberConverter implements NumberConverterInterface { @@ -30,25 +30,11 @@ class GenericNumberConverter implements NumberConverterInterface { } - /** - * @inheritDoc - * @psalm-pure - * @psalm-return numeric-string - * @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty - * @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty - */ public function fromHex(string $hex): string { return $this->calculator->fromBase($hex, 16)->toString(); } - /** - * @inheritDoc - * @psalm-pure - * @psalm-return non-empty-string - * @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty - * @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty - */ public function toHex(string $number): string { /** @phpstan-ignore-next-line PHPStan complains that this is not a non-empty-string. */ diff --git a/src/Converter/NumberConverterInterface.php b/src/Converter/NumberConverterInterface.php index b33ec31..4487182 100644 --- a/src/Converter/NumberConverterInterface.php +++ b/src/Converter/NumberConverterInterface.php @@ -18,24 +18,20 @@ namespace Ramsey\Uuid\Converter; * A number converter converts UUIDs from hexadecimal characters into * representations of integers and vice versa * - * @psalm-immutable + * @immutable */ interface NumberConverterInterface { /** - * Converts a hexadecimal number into an string integer representation of + * Converts a hexadecimal number into a string integer representation of * the number * * The integer representation returned is a string representation of the - * integer, to accommodate unsigned integers greater than PHP_INT_MAX. + * integer to accommodate unsigned integers greater than PHP_INT_MAX. * * @param string $hex The hexadecimal string representation to convert * - * @return string String representation of an integer - * - * @psalm-return numeric-string - * - * @psalm-pure + * @return numeric-string String representation of an integer */ public function fromHex(string $hex): string; @@ -47,11 +43,7 @@ interface NumberConverterInterface * must be a numeric string to accommodate unsigned integers greater * than PHP_INT_MAX. * - * @return string Hexadecimal string - * - * @psalm-return non-empty-string - * - * @psalm-pure + * @return non-empty-string Hexadecimal string */ public function toHex(string $number): string; } diff --git a/src/Converter/Time/BigNumberTimeConverter.php b/src/Converter/Time/BigNumberTimeConverter.php index b6bca9e..3986b9c 100644 --- a/src/Converter/Time/BigNumberTimeConverter.php +++ b/src/Converter/Time/BigNumberTimeConverter.php @@ -25,7 +25,7 @@ use Ramsey\Uuid\Type\Time; * * @deprecated Transition to {@see GenericTimeConverter}. * - * @psalm-immutable + * @immutable */ class BigNumberTimeConverter implements TimeConverterInterface { diff --git a/src/Converter/Time/DegradedTimeConverter.php b/src/Converter/Time/DegradedTimeConverter.php index cdc2875..bcf967b 100644 --- a/src/Converter/Time/DegradedTimeConverter.php +++ b/src/Converter/Time/DegradedTimeConverter.php @@ -18,7 +18,7 @@ namespace Ramsey\Uuid\Converter\Time; * @deprecated DegradedTimeConverter is no longer necessary for converting * time on 32-bit systems. Transition to {@see GenericTimeConverter}. * - * @psalm-immutable + * @immutable */ class DegradedTimeConverter extends BigNumberTimeConverter { diff --git a/src/Converter/Time/GenericTimeConverter.php b/src/Converter/Time/GenericTimeConverter.php index f6b60ab..68024c4 100644 --- a/src/Converter/Time/GenericTimeConverter.php +++ b/src/Converter/Time/GenericTimeConverter.php @@ -30,7 +30,7 @@ use const STR_PAD_LEFT; * GenericTimeConverter uses the provided calculator to calculate and convert * time values * - * @psalm-immutable + * @immutable */ class GenericTimeConverter implements TimeConverterInterface { diff --git a/src/Converter/Time/PhpTimeConverter.php b/src/Converter/Time/PhpTimeConverter.php index 66009f1..326f2c3 100644 --- a/src/Converter/Time/PhpTimeConverter.php +++ b/src/Converter/Time/PhpTimeConverter.php @@ -38,7 +38,7 @@ use const STR_PAD_RIGHT; * available to the PHP programming language to provide facilities for * converting parts of time into representations that may be used in UUIDs * - * @psalm-immutable + * @immutable */ class PhpTimeConverter implements TimeConverterInterface { @@ -92,7 +92,6 @@ class PhpTimeConverter implements TimeConverterInterface // Check to see whether we've overflowed the max/min integer size. // If so, we will default to a different time converter. - /** @psalm-suppress RedundantCondition */ if (!is_int($uuidTime)) { return $this->fallbackConverter->calculateTime( $seconds->toString(), diff --git a/src/Converter/Time/UnixTimeConverter.php b/src/Converter/Time/UnixTimeConverter.php index 4d6d0a8..1cd2e26 100644 --- a/src/Converter/Time/UnixTimeConverter.php +++ b/src/Converter/Time/UnixTimeConverter.php @@ -30,7 +30,7 @@ use const STR_PAD_LEFT; * UnixTimeConverter converts Unix Epoch timestamps to/from hexadecimal values * consisting of milliseconds elapsed since the Unix Epoch * - * @psalm-immutable + * @immutable */ class UnixTimeConverter implements TimeConverterInterface { diff --git a/src/Converter/TimeConverterInterface.php b/src/Converter/TimeConverterInterface.php index 1e84807..19ba8c7 100644 --- a/src/Converter/TimeConverterInterface.php +++ b/src/Converter/TimeConverterInterface.php @@ -21,7 +21,7 @@ use Ramsey\Uuid\Type\Time; * A time converter converts timestamps into representations that may be used * in UUIDs * - * @psalm-immutable + * @immutable */ interface TimeConverterInterface { @@ -38,8 +38,6 @@ interface TimeConverterInterface * associated with the time to calculate * * @return Hexadecimal The full UUID timestamp as a Hexadecimal value - * - * @psalm-pure */ public function calculateTime(string $seconds, string $microseconds): Hexadecimal; @@ -51,8 +49,6 @@ interface TimeConverterInterface * since UTC 00:00:00.00, 15 October 1582. * * @return Time An instance of {@see Time} - * - * @psalm-pure */ public function convertTime(Hexadecimal $uuidTimestamp): Time; } diff --git a/src/DegradedUuid.php b/src/DegradedUuid.php index 9166042..f38e391 100644 --- a/src/DegradedUuid.php +++ b/src/DegradedUuid.php @@ -18,7 +18,7 @@ namespace Ramsey\Uuid; * @deprecated DegradedUuid is no longer necessary to represent UUIDs on 32-bit * systems. Transition typehints to {@see UuidInterface}. * - * @psalm-immutable + * @immutable */ class DegradedUuid extends Uuid { diff --git a/src/DeprecatedUuidInterface.php b/src/DeprecatedUuidInterface.php index ac01a79..c7639cd 100644 --- a/src/DeprecatedUuidInterface.php +++ b/src/DeprecatedUuidInterface.php @@ -20,7 +20,7 @@ use Ramsey\Uuid\Converter\NumberConverterInterface; /** * This interface encapsulates deprecated methods for ramsey/uuid * - * @psalm-immutable + * @immutable */ interface DeprecatedUuidInterface { diff --git a/src/DeprecatedUuidMethodsTrait.php b/src/DeprecatedUuidMethodsTrait.php index d3fbb0c..a3c624e 100644 --- a/src/DeprecatedUuidMethodsTrait.php +++ b/src/DeprecatedUuidMethodsTrait.php @@ -32,7 +32,7 @@ use const STR_PAD_LEFT; * * @deprecated This trait and its methods will be removed in ramsey/uuid 5.0.0. * - * @psalm-immutable + * @immutable */ trait DeprecatedUuidMethodsTrait { diff --git a/src/FeatureSet.php b/src/FeatureSet.php index b9af869..8ed764b 100644 --- a/src/FeatureSet.php +++ b/src/FeatureSet.php @@ -212,7 +212,6 @@ class FeatureSet $this->numberConverter = $this->buildNumberConverter($calculator); $this->timeConverter = $this->buildTimeConverter($calculator); - /** @psalm-suppress RedundantPropertyInitializationCheck */ if (isset($this->timeProvider)) { $this->timeGenerator = $this->buildTimeGenerator($this->timeProvider); } diff --git a/src/Fields/FieldsInterface.php b/src/Fields/FieldsInterface.php index f1b7a29..4c0289c 100644 --- a/src/Fields/FieldsInterface.php +++ b/src/Fields/FieldsInterface.php @@ -17,11 +17,11 @@ namespace Ramsey\Uuid\Fields; use Serializable; /** - * UUIDs are comprised of unsigned integers, the bytes of which are separated + * UUIDs consist of unsigned integers, the bytes of which are separated * into fields and arranged in a particular layout defined by the specification * for the variant * - * @psalm-immutable + * @immutable */ interface FieldsInterface extends Serializable { diff --git a/src/Fields/SerializableFieldsTrait.php b/src/Fields/SerializableFieldsTrait.php index 3d36b6f..2310f7d 100644 --- a/src/Fields/SerializableFieldsTrait.php +++ b/src/Fields/SerializableFieldsTrait.php @@ -23,7 +23,7 @@ use function strlen; /** * Provides common serialization functionality to fields * - * @psalm-immutable + * @immutable */ trait SerializableFieldsTrait { @@ -57,8 +57,6 @@ trait SerializableFieldsTrait * Constructs the object from a serialized string representation * * @param string $data The serialized string representation of the object - * - * @psalm-suppress UnusedMethodCall */ public function unserialize(string $data): void { @@ -71,8 +69,6 @@ trait SerializableFieldsTrait /** * @param array{bytes?: string} $data - * - * @psalm-suppress UnusedMethodCall */ public function __unserialize(array $data): void { diff --git a/src/Generator/DefaultNameGenerator.php b/src/Generator/DefaultNameGenerator.php index 7303e9f..88fe41f 100644 --- a/src/Generator/DefaultNameGenerator.php +++ b/src/Generator/DefaultNameGenerator.php @@ -26,7 +26,6 @@ use function hash; */ class DefaultNameGenerator implements NameGeneratorInterface { - /** @psalm-pure */ public function generate(UuidInterface $ns, string $name, string $hashAlgorithm): string { try { diff --git a/src/Generator/NameGeneratorInterface.php b/src/Generator/NameGeneratorInterface.php index cc43dd0..e064952 100644 --- a/src/Generator/NameGeneratorInterface.php +++ b/src/Generator/NameGeneratorInterface.php @@ -31,8 +31,6 @@ interface NameGeneratorInterface * @param string $hashAlgorithm The hashing algorithm to use * * @return string A binary string - * - * @psalm-pure */ public function generate(UuidInterface $ns, string $name, string $hashAlgorithm): string; } diff --git a/src/Generator/PeclUuidNameGenerator.php b/src/Generator/PeclUuidNameGenerator.php index 6a6d1ae..6cabbf8 100644 --- a/src/Generator/PeclUuidNameGenerator.php +++ b/src/Generator/PeclUuidNameGenerator.php @@ -30,7 +30,6 @@ use function uuid_parse; */ class PeclUuidNameGenerator implements NameGeneratorInterface { - /** @psalm-pure */ public function generate(UuidInterface $ns, string $name, string $hashAlgorithm): string { $uuid = match ($hashAlgorithm) { diff --git a/src/Guid/Fields.php b/src/Guid/Fields.php index 0fc5d1c..3afb0d8 100644 --- a/src/Guid/Fields.php +++ b/src/Guid/Fields.php @@ -41,7 +41,7 @@ use const STR_PAD_LEFT; * * @see Guid * - * @psalm-immutable + * @immutable */ final class Fields implements FieldsInterface { diff --git a/src/Guid/Guid.php b/src/Guid/Guid.php index b3ed096..0af0210 100644 --- a/src/Guid/Guid.php +++ b/src/Guid/Guid.php @@ -46,7 +46,7 @@ use Ramsey\Uuid\Uuid; * @link https://docs.microsoft.com/en-us/dotnet/api/system.guid .NET Guid Struct * @link https://docs.microsoft.com/en-us/dotnet/api/system.guid.tobytearray .NET Guid.ToByteArray Method * - * @psalm-immutable + * @immutable */ final class Guid extends Uuid { diff --git a/src/Guid/GuidBuilder.php b/src/Guid/GuidBuilder.php index c036bb2..b979197 100644 --- a/src/Guid/GuidBuilder.php +++ b/src/Guid/GuidBuilder.php @@ -27,7 +27,7 @@ use Throwable; * * @see Guid * - * @psalm-immutable + * @immutable */ class GuidBuilder implements UuidBuilderInterface { @@ -50,8 +50,6 @@ class GuidBuilder implements UuidBuilderInterface * @param string $bytes The byte string from which to construct a UUID * * @return Guid The GuidBuilder returns an instance of Ramsey\Uuid\Guid\Guid - * - * @psalm-pure */ public function build(CodecInterface $codec, string $bytes): UuidInterface { diff --git a/src/Lazy/LazyUuidFromString.php b/src/Lazy/LazyUuidFromString.php index c0b47bb..87583e9 100644 --- a/src/Lazy/LazyUuidFromString.php +++ b/src/Lazy/LazyUuidFromString.php @@ -41,16 +41,13 @@ use function substr; * @internal this type is used internally for performance reasons, and is not supposed to be directly referenced * in consumer libraries. * - * @psalm-immutable + * @immutable * * Note: the {@see FieldsInterface} does not declare methods that deprecated API * relies upon: the API has been ported from the {@see \Ramsey\Uuid\Uuid} definition, * and is deprecated anyway. * Note: the deprecated API from {@see \Ramsey\Uuid\Uuid} is in use here (on purpose): it will be removed * once the deprecated API is gone from this class too. - * - * @psalm-suppress UndefinedInterfaceMethod - * @psalm-suppress DeprecatedMethod */ final class LazyUuidFromString implements UuidInterface { @@ -59,13 +56,12 @@ final class LazyUuidFromString implements UuidInterface private ?UuidInterface $unwrapped = null; /** - * @psalm-param non-empty-string $uuid + * @param non-empty-string $uuid */ public function __construct(private string $uuid) { } - /** @psalm-pure */ public static function fromBytes(string $bytes): self { $base16Uuid = bin2hex($bytes); @@ -89,9 +85,7 @@ final class LazyUuidFromString implements UuidInterface } /** - * @return array{string: string} - * - * @psalm-return array{string: non-empty-string} + * @return array{string: non-empty-string} */ public function __serialize(): array { @@ -101,9 +95,7 @@ final class LazyUuidFromString implements UuidInterface /** * {@inheritDoc} * - * @param string $data - * - * @psalm-param non-empty-string $data + * @param non-empty-string $data */ public function unserialize(string $data): void { @@ -111,10 +103,7 @@ final class LazyUuidFromString implements UuidInterface } /** - * @param array{string?: string} $data - * - * @psalm-param array{string?: non-empty-string} $data - * @psalm-suppress UnusedMethodCall + * @param array{string?: non-empty-string} $data */ public function __unserialize(array $data): void { @@ -127,7 +116,6 @@ final class LazyUuidFromString implements UuidInterface $this->unserialize($data['string']); } - /** @psalm-suppress DeprecatedMethod */ public function getNumberConverter(): NumberConverterInterface { return ($this->unwrapped ?? $this->unwrap()) @@ -135,9 +123,7 @@ final class LazyUuidFromString implements UuidInterface } /** - * {@inheritDoc} - * - * @psalm-suppress DeprecatedMethod + * @inheritDoc */ public function getFieldsHex(): array { @@ -145,98 +131,84 @@ final class LazyUuidFromString implements UuidInterface ->getFieldsHex(); } - /** @psalm-suppress DeprecatedMethod */ public function getClockSeqHiAndReservedHex(): string { return ($this->unwrapped ?? $this->unwrap()) ->getClockSeqHiAndReservedHex(); } - /** @psalm-suppress DeprecatedMethod */ public function getClockSeqLowHex(): string { return ($this->unwrapped ?? $this->unwrap()) ->getClockSeqLowHex(); } - /** @psalm-suppress DeprecatedMethod */ public function getClockSequenceHex(): string { return ($this->unwrapped ?? $this->unwrap()) ->getClockSequenceHex(); } - /** @psalm-suppress DeprecatedMethod */ public function getDateTime(): DateTimeInterface { return ($this->unwrapped ?? $this->unwrap()) ->getDateTime(); } - /** @psalm-suppress DeprecatedMethod */ public function getLeastSignificantBitsHex(): string { return ($this->unwrapped ?? $this->unwrap()) ->getLeastSignificantBitsHex(); } - /** @psalm-suppress DeprecatedMethod */ public function getMostSignificantBitsHex(): string { return ($this->unwrapped ?? $this->unwrap()) ->getMostSignificantBitsHex(); } - /** @psalm-suppress DeprecatedMethod */ public function getNodeHex(): string { return ($this->unwrapped ?? $this->unwrap()) ->getNodeHex(); } - /** @psalm-suppress DeprecatedMethod */ public function getTimeHiAndVersionHex(): string { return ($this->unwrapped ?? $this->unwrap()) ->getTimeHiAndVersionHex(); } - /** @psalm-suppress DeprecatedMethod */ public function getTimeLowHex(): string { return ($this->unwrapped ?? $this->unwrap()) ->getTimeLowHex(); } - /** @psalm-suppress DeprecatedMethod */ public function getTimeMidHex(): string { return ($this->unwrapped ?? $this->unwrap()) ->getTimeMidHex(); } - /** @psalm-suppress DeprecatedMethod */ public function getTimestampHex(): string { return ($this->unwrapped ?? $this->unwrap()) ->getTimestampHex(); } - /** @psalm-suppress DeprecatedMethod */ public function getUrn(): string { return ($this->unwrapped ?? $this->unwrap()) ->getUrn(); } - /** @psalm-suppress DeprecatedMethod */ public function getVariant(): ?int { return ($this->unwrapped ?? $this->unwrap()) ->getVariant(); } - /** @psalm-suppress DeprecatedMethod */ public function getVersion(): ?int { return ($this->unwrapped ?? $this->unwrap()) @@ -258,16 +230,9 @@ final class LazyUuidFromString implements UuidInterface return $this->uuid === $other->toString(); } - /** - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificReturnType - * @psalm-suppress LessSpecificReturnStatement we know that {@see self::$uuid} is a non-empty string, so - * we know that {@see hex2bin} will retrieve a non-empty string too. - */ public function getBytes(): string { - /** @phpstan-ignore-next-line PHPStan complains that this is not a non-empty-string. */ + /** @var non-empty-string */ return (string) hex2bin(str_replace('-', '', $this->uuid)); } @@ -310,22 +275,15 @@ final class LazyUuidFromString implements UuidInterface * instance, you may call {@see Rfc4122FieldsInterface::getClockSeqHiAndReserved()} * and use the arbitrary-precision math library of your choice to * convert it to a string integer. - * - * @psalm-suppress UndefinedInterfaceMethod - * @psalm-suppress DeprecatedMethod - * @psalm-suppress MixedArgument - * @psalm-suppress MixedMethodCall */ public function getClockSeqHiAndReserved(): string { $instance = ($this->unwrapped ?? $this->unwrap()); - return $instance->getNumberConverter() - ->fromHex( - $instance->getFields() - ->getClockSeqHiAndReserved() - ->toString() - ); + $fields = $instance->getFields(); + assert($fields instanceof \Ramsey\Uuid\Rfc4122\FieldsInterface); + + return $instance->getNumberConverter()->fromHex($fields->getClockSeqHiAndReserved()->toString()); } /** @@ -334,22 +292,15 @@ final class LazyUuidFromString implements UuidInterface * instance, you may call {@see Rfc4122FieldsInterface::getClockSeqLow()} * and use the arbitrary-precision math library of your choice to * convert it to a string integer. - * - * @psalm-suppress UndefinedInterfaceMethod - * @psalm-suppress DeprecatedMethod - * @psalm-suppress MixedArgument - * @psalm-suppress MixedMethodCall */ public function getClockSeqLow(): string { $instance = ($this->unwrapped ?? $this->unwrap()); - return $instance->getNumberConverter() - ->fromHex( - $instance->getFields() - ->getClockSeqLow() - ->toString() - ); + $fields = $instance->getFields(); + assert($fields instanceof \Ramsey\Uuid\Rfc4122\FieldsInterface); + + return $instance->getNumberConverter()->fromHex($fields->getClockSeqLow()->toString()); } /** @@ -358,33 +309,21 @@ final class LazyUuidFromString implements UuidInterface * instance, you may call {@see Rfc4122FieldsInterface::getClockSeq()} * and use the arbitrary-precision math library of your choice to * convert it to a string integer. - * - * @psalm-suppress UndefinedInterfaceMethod - * @psalm-suppress DeprecatedMethod - * @psalm-suppress MixedArgument - * @psalm-suppress MixedMethodCall */ public function getClockSequence(): string { $instance = ($this->unwrapped ?? $this->unwrap()); - return $instance->getNumberConverter() - ->fromHex( - $instance->getFields() - ->getClockSeq() - ->toString() - ); + $fields = $instance->getFields(); + assert($fields instanceof \Ramsey\Uuid\Rfc4122\FieldsInterface); + + return $instance->getNumberConverter()->fromHex($fields->getClockSeq()->toString()); } /** * @deprecated This method will be removed in 5.0.0. There is no direct * alternative, but the same information may be obtained by splitting * in half the value returned by {@see UuidInterface::getHex()}. - * - * @psalm-suppress UndefinedInterfaceMethod - * @psalm-suppress DeprecatedMethod - * @psalm-suppress MixedArgument - * @psalm-suppress MixedMethodCall */ public function getLeastSignificantBits(): string { @@ -398,11 +337,6 @@ final class LazyUuidFromString implements UuidInterface * @deprecated This method will be removed in 5.0.0. There is no direct * alternative, but the same information may be obtained by splitting * in half the value returned by {@see UuidInterface::getHex()}. - * - * @psalm-suppress UndefinedInterfaceMethod - * @psalm-suppress DeprecatedMethod - * @psalm-suppress MixedArgument - * @psalm-suppress MixedMethodCall */ public function getMostSignificantBits(): string { @@ -418,22 +352,15 @@ final class LazyUuidFromString implements UuidInterface * instance, you may call {@see Rfc4122FieldsInterface::getNode()} * and use the arbitrary-precision math library of your choice to * convert it to a string integer. - * - * @psalm-suppress UndefinedInterfaceMethod - * @psalm-suppress DeprecatedMethod - * @psalm-suppress MixedArgument - * @psalm-suppress MixedMethodCall */ public function getNode(): string { $instance = ($this->unwrapped ?? $this->unwrap()); - return $instance->getNumberConverter() - ->fromHex( - $instance->getFields() - ->getNode() - ->toString() - ); + $fields = $instance->getFields(); + assert($fields instanceof \Ramsey\Uuid\Rfc4122\FieldsInterface); + + return $instance->getNumberConverter()->fromHex($fields->getNode()->toString()); } /** @@ -442,22 +369,15 @@ final class LazyUuidFromString implements UuidInterface * instance, you may call {@see Rfc4122FieldsInterface::getTimeHiAndVersion()} * and use the arbitrary-precision math library of your choice to * convert it to a string integer. - * - * @psalm-suppress UndefinedInterfaceMethod - * @psalm-suppress DeprecatedMethod - * @psalm-suppress MixedArgument - * @psalm-suppress MixedMethodCall */ public function getTimeHiAndVersion(): string { $instance = ($this->unwrapped ?? $this->unwrap()); - return $instance->getNumberConverter() - ->fromHex( - $instance->getFields() - ->getTimeHiAndVersion() - ->toString() - ); + $fields = $instance->getFields(); + assert($fields instanceof \Ramsey\Uuid\Rfc4122\FieldsInterface); + + return $instance->getNumberConverter()->fromHex($fields->getTimeHiAndVersion()->toString()); } /** @@ -466,22 +386,15 @@ final class LazyUuidFromString implements UuidInterface * instance, you may call {@see Rfc4122FieldsInterface::getTimeLow()} * and use the arbitrary-precision math library of your choice to * convert it to a string integer. - * - * @psalm-suppress UndefinedInterfaceMethod - * @psalm-suppress DeprecatedMethod - * @psalm-suppress MixedArgument - * @psalm-suppress MixedMethodCall */ public function getTimeLow(): string { $instance = ($this->unwrapped ?? $this->unwrap()); - return $instance->getNumberConverter() - ->fromHex( - $instance->getFields() - ->getTimeLow() - ->toString() - ); + $fields = $instance->getFields(); + assert($fields instanceof \Ramsey\Uuid\Rfc4122\FieldsInterface); + + return $instance->getNumberConverter()->fromHex($fields->getTimeLow()->toString()); } /** @@ -490,22 +403,15 @@ final class LazyUuidFromString implements UuidInterface * instance, you may call {@see Rfc4122FieldsInterface::getTimeMid()} * and use the arbitrary-precision math library of your choice to * convert it to a string integer. - * - * @psalm-suppress UndefinedInterfaceMethod - * @psalm-suppress DeprecatedMethod - * @psalm-suppress MixedArgument - * @psalm-suppress MixedMethodCall */ public function getTimeMid(): string { $instance = ($this->unwrapped ?? $this->unwrap()); - return $instance->getNumberConverter() - ->fromHex( - $instance->getFields() - ->getTimeMid() - ->toString() - ); + $fields = $instance->getFields(); + assert($fields instanceof \Ramsey\Uuid\Rfc4122\FieldsInterface); + + return $instance->getNumberConverter()->fromHex($fields->getTimeMid()->toString()); } /** @@ -514,23 +420,19 @@ final class LazyUuidFromString implements UuidInterface * instance, you may call {@see Rfc4122FieldsInterface::getTimestamp()} * and use the arbitrary-precision math library of your choice to * convert it to a string integer. - * - * @psalm-suppress UndefinedInterfaceMethod - * @psalm-suppress DeprecatedMethod - * @psalm-suppress MixedArgument - * @psalm-suppress MixedMethodCall */ public function getTimestamp(): string { $instance = ($this->unwrapped ?? $this->unwrap()); + $fields = $instance->getFields(); + assert($fields instanceof \Ramsey\Uuid\Rfc4122\FieldsInterface); if ($fields->getVersion() !== 1) { throw new UnsupportedOperationException('Not a time-based UUID'); } - return $instance->getNumberConverter() - ->fromHex($fields->getTimestamp()->toString()); + return $instance->getNumberConverter()->fromHex($fields->getTimestamp()->toString()); } public function toUuidV1(): UuidV1 @@ -555,18 +457,8 @@ final class LazyUuidFromString implements UuidInterface return $instance; } - /** - * @psalm-suppress ImpureMethodCall the retrieval of the factory is a clear violation of purity here: this is a - * known pitfall of the design of this library, where a value object contains - * a mutable reference to a factory. We use a fixed factory here, so the violation - * will not have real-world effects, as this object is only instantiated with the - * default factory settings/features. - * @psalm-suppress InaccessibleProperty property {@see $unwrapped} is used as a cache: we don't expose it to the - * outside world, so we should be fine here. - */ private function unwrap(): UuidInterface { - return $this->unwrapped = (new UuidFactory()) - ->fromString($this->uuid); + return $this->unwrapped = (new UuidFactory())->fromString($this->uuid); } } diff --git a/src/Math/BrickMathCalculator.php b/src/Math/BrickMathCalculator.php index f065acd..b3ffdaa 100644 --- a/src/Math/BrickMathCalculator.php +++ b/src/Math/BrickMathCalculator.php @@ -27,7 +27,7 @@ use Ramsey\Uuid\Type\NumberInterface; /** * A calculator using the brick/math library for arbitrary-precision arithmetic * - * @psalm-immutable + * @immutable */ final class BrickMathCalculator implements CalculatorInterface { diff --git a/src/Math/CalculatorInterface.php b/src/Math/CalculatorInterface.php index f03645d..75ca006 100644 --- a/src/Math/CalculatorInterface.php +++ b/src/Math/CalculatorInterface.php @@ -21,7 +21,7 @@ use Ramsey\Uuid\Type\NumberInterface; /** * A calculator performs arithmetic operations on numbers * - * @psalm-immutable + * @immutable */ interface CalculatorInterface { diff --git a/src/Nonstandard/Fields.php b/src/Nonstandard/Fields.php index 5dfe610..2a8a3d3 100644 --- a/src/Nonstandard/Fields.php +++ b/src/Nonstandard/Fields.php @@ -40,7 +40,7 @@ use const STR_PAD_LEFT; * Internally, this class represents the fields together as a 16-byte binary * string. * - * @psalm-immutable + * @immutable */ final class Fields implements FieldsInterface { diff --git a/src/Nonstandard/Uuid.php b/src/Nonstandard/Uuid.php index 715f825..5810b5f 100644 --- a/src/Nonstandard/Uuid.php +++ b/src/Nonstandard/Uuid.php @@ -22,7 +22,7 @@ use Ramsey\Uuid\Uuid as BaseUuid; /** * Nonstandard\Uuid is a UUID that doesn't conform to RFC 4122 * - * @psalm-immutable + * @immutable */ final class Uuid extends BaseUuid { diff --git a/src/Nonstandard/UuidBuilder.php b/src/Nonstandard/UuidBuilder.php index 82efd40..f431c71 100644 --- a/src/Nonstandard/UuidBuilder.php +++ b/src/Nonstandard/UuidBuilder.php @@ -25,7 +25,7 @@ use Throwable; /** * Nonstandard\UuidBuilder builds instances of Nonstandard\Uuid * - * @psalm-immutable + * @immutable */ class UuidBuilder implements UuidBuilderInterface { @@ -49,8 +49,6 @@ class UuidBuilder implements UuidBuilderInterface * * @return Uuid The Nonstandard\UuidBuilder returns an instance of * Nonstandard\Uuid - * - * @psalm-pure */ public function build(CodecInterface $codec, string $bytes): UuidInterface { diff --git a/src/Nonstandard/UuidV6.php b/src/Nonstandard/UuidV6.php index 7497dd1..49efbf4 100644 --- a/src/Nonstandard/UuidV6.php +++ b/src/Nonstandard/UuidV6.php @@ -34,7 +34,7 @@ use Ramsey\Uuid\Uuid as BaseUuid; * @link https://github.com/uuid6/uuid6-ietf-draft UUID version 6 IETF draft * @link http://gh.peabody.io/uuidv6/ "Version 6" UUIDs * - * @psalm-immutable + * @immutable */ class UuidV6 extends BaseUuid implements UuidInterface { diff --git a/src/Provider/Dce/SystemDceSecurityProvider.php b/src/Provider/Dce/SystemDceSecurityProvider.php index d5b6cf0..e37f205 100644 --- a/src/Provider/Dce/SystemDceSecurityProvider.php +++ b/src/Provider/Dce/SystemDceSecurityProvider.php @@ -141,10 +141,7 @@ class SystemDceSecurityProvider implements DceSecurityProviderInterface */ private function getOs(): string { - /** - * @psalm-suppress UnnecessaryVarAnnotation - * @var string $phpOs - */ + /** @var string $phpOs */ $phpOs = constant('PHP_OS'); return strtoupper(substr($phpOs, 0, 3)); diff --git a/src/Provider/Node/NodeProviderCollection.php b/src/Provider/Node/NodeProviderCollection.php index 1b979fa..5a7bab4 100644 --- a/src/Provider/Node/NodeProviderCollection.php +++ b/src/Provider/Node/NodeProviderCollection.php @@ -40,9 +40,6 @@ class NodeProviderCollection extends AbstractCollection * * @param string $serialized The serialized PHP string to unserialize into * a UuidInterface instance - * - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - * @psalm-suppress RedundantConditionGivenDocblockType */ public function unserialize($serialized): void { diff --git a/src/Provider/Node/SystemNodeProvider.php b/src/Provider/Node/SystemNodeProvider.php index a03c93b..27f7a68 100644 --- a/src/Provider/Node/SystemNodeProvider.php +++ b/src/Provider/Node/SystemNodeProvider.php @@ -104,10 +104,7 @@ class SystemNodeProvider implements NodeProviderInterface return ''; } - /** - * @psalm-suppress UnnecessaryVarAnnotation - * @var string $phpOs - */ + /** @var string $phpOs */ $phpOs = constant('PHP_OS'); ob_start(); @@ -151,10 +148,7 @@ class SystemNodeProvider implements NodeProviderInterface { $mac = ''; - /** - * @psalm-suppress UnnecessaryVarAnnotation - * @var string $phpOs - */ + /** @var string $phpOs */ $phpOs = constant('PHP_OS'); if (strtoupper($phpOs) === 'LINUX') { diff --git a/src/Rfc4122/Fields.php b/src/Rfc4122/Fields.php index 9acf810..345efb0 100644 --- a/src/Rfc4122/Fields.php +++ b/src/Rfc4122/Fields.php @@ -31,12 +31,12 @@ use function unpack; use const STR_PAD_LEFT; /** - * RFC 4122 variant UUIDs are comprised of a set of named fields + * RFC 4122 variant UUIDs consist of a set of named fields * * Internally, this class represents the fields together as a 16-byte binary * string. * - * @psalm-immutable + * @immutable */ final class Fields implements FieldsInterface { diff --git a/src/Rfc4122/FieldsInterface.php b/src/Rfc4122/FieldsInterface.php index 2241cf5..e96f0af 100644 --- a/src/Rfc4122/FieldsInterface.php +++ b/src/Rfc4122/FieldsInterface.php @@ -35,7 +35,7 @@ use Ramsey\Uuid\Type\Hexadecimal; * * @link http://tools.ietf.org/html/rfc4122#section-4.1 RFC 4122, § 4.1: Format * - * @psalm-immutable + * @immutable */ interface FieldsInterface extends BaseFieldsInterface { diff --git a/src/Rfc4122/MaxTrait.php b/src/Rfc4122/MaxTrait.php index dedb727..9bdbb10 100644 --- a/src/Rfc4122/MaxTrait.php +++ b/src/Rfc4122/MaxTrait.php @@ -22,7 +22,7 @@ namespace Ramsey\Uuid\Rfc4122; * * @link https://datatracker.ietf.org/doc/html/draft-ietf-uuidrev-rfc4122bis-00#section-5.10 Max UUID * - * @psalm-immutable + * @immutable */ trait MaxTrait { diff --git a/src/Rfc4122/MaxUuid.php b/src/Rfc4122/MaxUuid.php index e5ffa72..7143885 100644 --- a/src/Rfc4122/MaxUuid.php +++ b/src/Rfc4122/MaxUuid.php @@ -20,7 +20,7 @@ use Ramsey\Uuid\Uuid; * The max UUID is special form of UUID that is specified to have all 128 bits * set to one * - * @psalm-immutable + * @immutable */ final class MaxUuid extends Uuid implements UuidInterface { diff --git a/src/Rfc4122/NilTrait.php b/src/Rfc4122/NilTrait.php index 9a9774d..8bbe13e 100644 --- a/src/Rfc4122/NilTrait.php +++ b/src/Rfc4122/NilTrait.php @@ -22,7 +22,7 @@ namespace Ramsey\Uuid\Rfc4122; * * @link https://tools.ietf.org/html/rfc4122#section-4.1.7 RFC 4122, § 4.1.7: Nil UUID * - * @psalm-immutable + * @immutable */ trait NilTrait { diff --git a/src/Rfc4122/NilUuid.php b/src/Rfc4122/NilUuid.php index c49b994..831378e 100644 --- a/src/Rfc4122/NilUuid.php +++ b/src/Rfc4122/NilUuid.php @@ -20,7 +20,7 @@ use Ramsey\Uuid\Uuid; * The nil UUID is special form of UUID that is specified to have all 128 bits * set to zero * - * @psalm-immutable + * @immutable */ final class NilUuid extends Uuid implements UuidInterface { diff --git a/src/Rfc4122/TimeTrait.php b/src/Rfc4122/TimeTrait.php index 5d939fa..8d9ab27 100644 --- a/src/Rfc4122/TimeTrait.php +++ b/src/Rfc4122/TimeTrait.php @@ -26,7 +26,7 @@ use const STR_PAD_LEFT; /** * Provides common functionality for getting the time from a time-based UUID * - * @psalm-immutable + * @immutable */ trait TimeTrait { diff --git a/src/Rfc4122/UuidBuilder.php b/src/Rfc4122/UuidBuilder.php index 2c2677d..10489d4 100644 --- a/src/Rfc4122/UuidBuilder.php +++ b/src/Rfc4122/UuidBuilder.php @@ -30,7 +30,7 @@ use Throwable; /** * UuidBuilder builds instances of RFC 4122 UUIDs * - * @psalm-immutable + * @immutable */ class UuidBuilder implements UuidBuilderInterface { @@ -63,8 +63,6 @@ class UuidBuilder implements UuidBuilderInterface * @param string $bytes The byte string from which to construct a UUID * * @return Rfc4122UuidInterface UuidBuilder returns instances of Rfc4122UuidInterface - * - * @psalm-pure */ public function build(CodecInterface $codec, string $bytes): UuidInterface { diff --git a/src/Rfc4122/UuidInterface.php b/src/Rfc4122/UuidInterface.php index e80f33b..e046dff 100644 --- a/src/Rfc4122/UuidInterface.php +++ b/src/Rfc4122/UuidInterface.php @@ -22,7 +22,7 @@ use Ramsey\Uuid\UuidInterface as BaseUuidInterface; * * @link https://tools.ietf.org/html/rfc4122 RFC 4122 * - * @psalm-immutable + * @immutable */ interface UuidInterface extends BaseUuidInterface { diff --git a/src/Rfc4122/UuidV1.php b/src/Rfc4122/UuidV1.php index 515c038..85816f1 100644 --- a/src/Rfc4122/UuidV1.php +++ b/src/Rfc4122/UuidV1.php @@ -25,7 +25,7 @@ use Ramsey\Uuid\Uuid; * Gregorian time, or version 1, UUIDs include timestamp, clock sequence, and node * values that are combined into a 128-bit unsigned integer * - * @psalm-immutable + * @immutable */ final class UuidV1 extends Uuid implements UuidInterface { diff --git a/src/Rfc4122/UuidV2.php b/src/Rfc4122/UuidV2.php index c8ccbe4..218bb42 100644 --- a/src/Rfc4122/UuidV2.php +++ b/src/Rfc4122/UuidV2.php @@ -48,7 +48,7 @@ use function hexdec; * @link https://pubs.opengroup.org/onlinepubs/9629399/apdxa.htm DCE 1.1: RPC, Appendix A * @link https://github.com/google/uuid Go package for UUIDs (includes DCE implementation) * - * @psalm-immutable + * @immutable */ final class UuidV2 extends Uuid implements UuidInterface { diff --git a/src/Rfc4122/UuidV3.php b/src/Rfc4122/UuidV3.php index deaa54e..63aa9c5 100644 --- a/src/Rfc4122/UuidV3.php +++ b/src/Rfc4122/UuidV3.php @@ -22,10 +22,10 @@ use Ramsey\Uuid\Rfc4122\FieldsInterface as Rfc4122FieldsInterface; use Ramsey\Uuid\Uuid; /** - * Version 3 UUIDs are named-based, using combination of a namespace and name + * Version 3 UUIDs are named-based, using a combination of a namespace and name * that are hashed into a 128-bit unsigned integer using MD5 * - * @psalm-immutable + * @immutable */ final class UuidV3 extends Uuid implements UuidInterface { diff --git a/src/Rfc4122/UuidV4.php b/src/Rfc4122/UuidV4.php index 2e57246..3a2eb81 100644 --- a/src/Rfc4122/UuidV4.php +++ b/src/Rfc4122/UuidV4.php @@ -25,7 +25,7 @@ use Ramsey\Uuid\Uuid; * Random, or version 4, UUIDs are randomly or pseudo-randomly generated 128-bit * integers * - * @psalm-immutable + * @immutable */ final class UuidV4 extends Uuid implements UuidInterface { diff --git a/src/Rfc4122/UuidV5.php b/src/Rfc4122/UuidV5.php index 2ef6ab3..28ff460 100644 --- a/src/Rfc4122/UuidV5.php +++ b/src/Rfc4122/UuidV5.php @@ -22,10 +22,10 @@ use Ramsey\Uuid\Rfc4122\FieldsInterface as Rfc4122FieldsInterface; use Ramsey\Uuid\Uuid; /** - * Version 5 UUIDs are named-based, using combination of a namespace and name + * Version 5 UUIDs are named-based, using a combination of a namespace and name * that are hashed into a 128-bit unsigned integer using SHA1 * - * @psalm-immutable + * @immutable */ final class UuidV5 extends Uuid implements UuidInterface { diff --git a/src/Rfc4122/UuidV6.php b/src/Rfc4122/UuidV6.php index 7e37433..c243f23 100644 --- a/src/Rfc4122/UuidV6.php +++ b/src/Rfc4122/UuidV6.php @@ -22,7 +22,7 @@ use Ramsey\Uuid\Nonstandard\UuidV6 as NonstandardUuidV6; * * @link https://datatracker.ietf.org/doc/html/draft-ietf-uuidrev-rfc4122bis-00#section-5.6 UUID Version 6 * - * @psalm-immutable + * @immutable */ final class UuidV6 extends NonstandardUuidV6 implements UuidInterface { diff --git a/src/Rfc4122/UuidV7.php b/src/Rfc4122/UuidV7.php index 5b524c4..03e9d4b 100644 --- a/src/Rfc4122/UuidV7.php +++ b/src/Rfc4122/UuidV7.php @@ -27,7 +27,7 @@ use Ramsey\Uuid\Uuid; * * @link https://datatracker.ietf.org/doc/html/draft-ietf-uuidrev-rfc4122bis-00#section-5.7 UUID Version 7 * - * @psalm-immutable + * @immutable */ final class UuidV7 extends Uuid implements UuidInterface { diff --git a/src/Rfc4122/UuidV8.php b/src/Rfc4122/UuidV8.php index 78b0290..3607279 100644 --- a/src/Rfc4122/UuidV8.php +++ b/src/Rfc4122/UuidV8.php @@ -32,7 +32,7 @@ use Ramsey\Uuid\Uuid; * * @link https://datatracker.ietf.org/doc/html/draft-ietf-uuidrev-rfc4122bis-00#section-5.8 UUID Version 8 * - * @psalm-immutable + * @immutable */ final class UuidV8 extends Uuid implements UuidInterface { diff --git a/src/Rfc4122/Validator.php b/src/Rfc4122/Validator.php index e82a11e..96d0abc 100644 --- a/src/Rfc4122/Validator.php +++ b/src/Rfc4122/Validator.php @@ -23,7 +23,7 @@ use function str_replace; /** * Rfc4122\Validator validates strings as UUIDs of the RFC 4122 variant * - * @psalm-immutable + * @immutable */ final class Validator implements ValidatorInterface { @@ -31,9 +31,7 @@ final class Validator implements ValidatorInterface . '[1-8][0-9A-Fa-f]{3}-[ABab89][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}\z'; /** - * @psalm-return non-empty-string - * @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty - * @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty + * @return non-empty-string */ public function getPattern(): string { diff --git a/src/Rfc4122/VariantTrait.php b/src/Rfc4122/VariantTrait.php index 1041de5..910cf4d 100644 --- a/src/Rfc4122/VariantTrait.php +++ b/src/Rfc4122/VariantTrait.php @@ -29,7 +29,7 @@ use const STR_PAD_LEFT; /** * Provides common functionality for handling the variant, as defined by RFC 4122 * - * @psalm-immutable + * @immutable */ trait VariantTrait { diff --git a/src/Rfc4122/VersionTrait.php b/src/Rfc4122/VersionTrait.php index 0195e46..2e2fc07 100644 --- a/src/Rfc4122/VersionTrait.php +++ b/src/Rfc4122/VersionTrait.php @@ -19,7 +19,7 @@ use Ramsey\Uuid\Uuid; /** * Provides common functionality for handling the version, as defined by RFC 4122 * - * @psalm-immutable + * @immutable */ trait VersionTrait { diff --git a/src/Type/Decimal.php b/src/Type/Decimal.php index acc5e75..dd8d2ce 100644 --- a/src/Type/Decimal.php +++ b/src/Type/Decimal.php @@ -31,7 +31,7 @@ use function str_starts_with; * To support values as true decimals and not as floats or doubles, we store the * decimals as strings. * - * @psalm-immutable + * @immutable */ final class Decimal implements NumberInterface { @@ -103,8 +103,6 @@ final class Decimal implements NumberInterface * Constructs the object from a serialized string representation * * @param string $data The serialized string representation of the object - * - * @psalm-suppress UnusedMethodCall */ public function unserialize(string $data): void { @@ -113,8 +111,6 @@ final class Decimal implements NumberInterface /** * @param array{string?: string} $data - * - * @psalm-suppress UnusedMethodCall */ public function __unserialize(array $data): void { diff --git a/src/Type/Hexadecimal.php b/src/Type/Hexadecimal.php index bf71ec4..132b4e0 100644 --- a/src/Type/Hexadecimal.php +++ b/src/Type/Hexadecimal.php @@ -28,7 +28,7 @@ use function substr; * returned from ramsey/uuid methods as strings are truly hexadecimal and not some * other kind of string. * - * @psalm-immutable + * @immutable */ final class Hexadecimal implements TypeInterface { @@ -74,8 +74,6 @@ final class Hexadecimal implements TypeInterface * Constructs the object from a serialized string representation * * @param string $data The serialized string representation of the object - * - * @psalm-suppress UnusedMethodCall */ public function unserialize(string $data): void { diff --git a/src/Type/Integer.php b/src/Type/Integer.php index 50dac99..4851b56 100644 --- a/src/Type/Integer.php +++ b/src/Type/Integer.php @@ -33,12 +33,12 @@ use function substr; * To support large integers beyond PHP_INT_MAX and PHP_INT_MIN on both 64-bit * and 32-bit systems, we store the integers as strings. * - * @psalm-immutable + * @immutable */ final class Integer implements NumberInterface { /** - * @psalm-var numeric-string + * @var numeric-string */ private string $value; @@ -55,7 +55,7 @@ final class Integer implements NumberInterface } /** - * @psalm-return numeric-string + * @return numeric-string */ public function toString(): string { @@ -63,7 +63,7 @@ final class Integer implements NumberInterface } /** - * @psalm-return numeric-string + * @return numeric-string */ public function __toString(): string { @@ -92,8 +92,6 @@ final class Integer implements NumberInterface * Constructs the object from a serialized string representation * * @param string $data The serialized string representation of the object - * - * @psalm-suppress UnusedMethodCall */ public function unserialize(string $data): void { @@ -147,7 +145,6 @@ final class Integer implements NumberInterface if ($sign === '-' && $value !== '0') { $value = $sign . $value; - /** @psalm-suppress InaccessibleProperty */ $this->isNegative = true; } diff --git a/src/Type/NumberInterface.php b/src/Type/NumberInterface.php index bf4ae9d..d85e103 100644 --- a/src/Type/NumberInterface.php +++ b/src/Type/NumberInterface.php @@ -17,7 +17,7 @@ namespace Ramsey\Uuid\Type; /** * NumberInterface ensures consistency in numeric values returned by ramsey/uuid * - * @psalm-immutable + * @immutable */ interface NumberInterface extends TypeInterface { diff --git a/src/Type/Time.php b/src/Type/Time.php index 0cedb44..e6f6caa 100644 --- a/src/Type/Time.php +++ b/src/Type/Time.php @@ -29,7 +29,7 @@ use function sprintf; * by ramsey/uuid are truly timestamp integers and not some other kind of string * or integer. * - * @psalm-immutable + * @immutable */ final class Time implements TypeInterface { @@ -95,8 +95,6 @@ final class Time implements TypeInterface * Constructs the object from a serialized string representation * * @param string $data The serialized string representation of the object - * - * @psalm-suppress UnusedMethodCall */ public function unserialize(string $data): void { diff --git a/src/Type/TypeInterface.php b/src/Type/TypeInterface.php index da2d8b2..d9a31e4 100644 --- a/src/Type/TypeInterface.php +++ b/src/Type/TypeInterface.php @@ -20,7 +20,7 @@ use Serializable; /** * TypeInterface ensures consistency in typed values returned by ramsey/uuid * - * @psalm-immutable + * @immutable */ interface TypeInterface extends JsonSerializable, Serializable { diff --git a/src/Uuid.php b/src/Uuid.php index cce9943..e4af9f4 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -42,14 +42,14 @@ use function substr; /** * Uuid provides constants and static methods for working with and generating UUIDs * - * @psalm-immutable + * @immutable */ class Uuid implements UuidInterface { use DeprecatedUuidMethodsTrait; /** - * When this namespace is specified, the name string is a fully-qualified + * When this namespace is specified, the name string is a fully qualified * domain name * * @link http://tools.ietf.org/html/rfc4122#appendix-C RFC 4122, Appendix C: Some Name Space IDs @@ -274,7 +274,7 @@ class Uuid implements UuidInterface } /** - * @psalm-return non-empty-string + * @return non-empty-string */ public function __toString(): string { @@ -366,7 +366,7 @@ class Uuid implements UuidInterface } /** - * @psalm-return non-empty-string + * @return non-empty-string */ public function getBytes(): string { @@ -394,7 +394,7 @@ class Uuid implements UuidInterface } /** - * @psalm-return non-empty-string + * @return non-empty-string */ public function toString(): string { @@ -438,13 +438,6 @@ class Uuid implements UuidInterface * string representation * * @throws InvalidArgumentException - * - * @psalm-pure note: changing the internal factory is an edge case not covered by purity invariants, - * but under constant factory setups, this method operates in functionally pure manners - * @psalm-suppress ImpureStaticProperty we know that the factory being replaced can lead to massive - * havoc across all consumers: that should never happen, and - * is generally to be discouraged. Until the factory is kept - * un-replaced, this method is effectively pure. */ public static function fromBytes(string $bytes): UuidInterface { @@ -477,13 +470,6 @@ class Uuid implements UuidInterface * string representation * * @throws InvalidArgumentException - * - * @psalm-pure note: changing the internal factory is an edge case not covered by purity invariants, - * but under constant factory setups, this method operates in functionally pure manners - * @psalm-suppress ImpureStaticProperty we know that the factory being replaced can lead to massive - * havoc across all consumers: that should never happen, and - * is generally to be discouraged. Until the factory is kept - * un-replaced, this method is effectively pure. */ public static function fromString(string $uuid): UuidInterface { @@ -524,24 +510,16 @@ class Uuid implements UuidInterface * @param Hexadecimal $hex Hexadecimal object representing a hexadecimal number * * @return UuidInterface A UuidInterface instance created from the Hexadecimal - * object representing a hexadecimal number + * object representing a hexadecimal number * * @throws InvalidArgumentException - * - * @psalm-pure note: changing the internal factory is an edge case not covered by purity invariants, - * but under constant factory setups, this method operates in functionally pure manners - * @psalm-suppress MixedInferredReturnType,MixedReturnStatement */ public static function fromHexadecimal(Hexadecimal $hex): UuidInterface { $factory = self::getFactory(); if (method_exists($factory, 'fromHexadecimal')) { - /** - * @phpstan-ignore-next-line - * @psalm-suppress UndefinedInterfaceMethod - */ - return self::getFactory()->fromHexadecimal($hex); + return $factory->fromHexadecimal($hex); } throw new BadMethodCallException('The method fromHexadecimal() does not exist on the provided factory'); @@ -556,13 +534,9 @@ class Uuid implements UuidInterface * representation of a 128-bit integer * * @throws InvalidArgumentException - * - * @psalm-pure note: changing the internal factory is an edge case not covered by purity invariants, - * but under constant factory setups, this method operates in functionally pure manners */ public static function fromInteger(string $integer): UuidInterface { - /** @psalm-suppress ImpureMethodCall */ return self::getFactory()->fromInteger($integer); } @@ -572,15 +546,9 @@ class Uuid implements UuidInterface * @param string $uuid A string to validate as a UUID * * @return bool True if the string is a valid UUID, false otherwise - * - * @psalm-pure note: changing the internal factory is an edge case not covered by purity invariants, - * but under constant factory setups, this method operates in functionally pure manners - * - * @psalm-assert-if-true =non-empty-string $uuid */ public static function isValid(string $uuid): bool { - /** @psalm-suppress ImpureMethodCall */ return self::getFactory()->getValidator()->validate($uuid); } @@ -641,14 +609,6 @@ class Uuid implements UuidInterface * * @return UuidInterface A UuidInterface instance that represents a * version 3 UUID - * - * @psalm-suppress ImpureMethodCall we know that the factory being replaced can lead to massive - * havoc across all consumers: that should never happen, and - * is generally to be discouraged. Until the factory is kept - * un-replaced, this method is effectively pure. - * - * @psalm-pure note: changing the internal factory is an edge case not covered by purity invariants, - * but under constant factory setups, this method operates in functionally pure manners */ public static function uuid3($ns, string $name): UuidInterface { @@ -675,14 +635,6 @@ class Uuid implements UuidInterface * * @return UuidInterface A UuidInterface instance that represents a * version 5 UUID - * - * @psalm-pure note: changing the internal factory is an edge case not covered by purity invariants, - * but under constant factory setups, this method operates in functionally pure manners - * - * @psalm-suppress ImpureMethodCall we know that the factory being replaced can lead to massive - * havoc across all consumers: that should never happen, and - * is generally to be discouraged. Until the factory is kept - * un-replaced, this method is effectively pure. */ public static function uuid5($ns, string $name): UuidInterface { diff --git a/src/UuidFactory.php b/src/UuidFactory.php index 1b06ea6..27912bf 100644 --- a/src/UuidFactory.php +++ b/src/UuidFactory.php @@ -240,9 +240,6 @@ class UuidFactory implements UuidFactoryInterface $this->uuidBuilder = $builder; } - /** - * @psalm-mutation-free - */ public function getValidator(): ValidatorInterface { return $this->validator; @@ -261,17 +258,11 @@ class UuidFactory implements UuidFactoryInterface $this->validator = $validator; } - /** - * @psalm-pure - */ public function fromBytes(string $bytes): UuidInterface { return $this->codec->decodeBytes($bytes); } - /** - * @psalm-pure - */ public function fromString(string $uuid): UuidInterface { $uuid = strtolower($uuid); @@ -279,9 +270,6 @@ class UuidFactory implements UuidFactoryInterface return $this->codec->decode($uuid); } - /** - * @psalm-pure - */ public function fromInteger(string $integer): UuidInterface { $hex = $this->numberConverter->toHex($integer); @@ -312,9 +300,6 @@ class UuidFactory implements UuidFactoryInterface return $this->uuidFromBytesAndVersion($bytes, Uuid::UUID_TYPE_TIME); } - /** - * @psalm-pure - */ public function fromHexadecimal(Hexadecimal $hex): UuidInterface { return $this->codec->decode($hex->__toString()); @@ -348,7 +333,6 @@ class UuidFactory implements UuidFactoryInterface /** * @inheritDoc - * @psalm-pure */ public function uuid3($ns, string $name): UuidInterface { @@ -364,7 +348,6 @@ class UuidFactory implements UuidFactoryInterface /** * @inheritDoc - * @psalm-pure */ public function uuid5($ns, string $name): UuidInterface { @@ -439,12 +422,9 @@ class UuidFactory implements UuidFactoryInterface * * @return UuidInterface An instance of UuidInterface, created from the * provided bytes - * - * @psalm-pure */ public function uuid(string $bytes): UuidInterface { - /** @psalm-suppress ImpurePropertyFetch */ return $this->uuidBuilder->build($this->codec, $bytes); } @@ -459,8 +439,6 @@ class UuidFactory implements UuidFactoryInterface * * @return UuidInterface An instance of UuidInterface, created by hashing * together the provided namespace and name - * - * @psalm-pure */ private function uuidFromNsAndName( UuidInterface | string $ns, @@ -485,8 +463,6 @@ class UuidFactory implements UuidFactoryInterface * * @return UuidInterface An instance of UuidInterface, created from the * byte string and version - * - * @psalm-pure */ private function uuidFromBytesAndVersion(string $bytes, int $version): UuidInterface { @@ -507,7 +483,6 @@ class UuidFactory implements UuidFactoryInterface return LazyUuidFromString::fromBytes($bytes); } - /** @psalm-suppress ImpureVariable */ return $this->uuid($bytes); } } diff --git a/src/UuidFactoryInterface.php b/src/UuidFactoryInterface.php index d99fc9d..b555f77 100644 --- a/src/UuidFactoryInterface.php +++ b/src/UuidFactoryInterface.php @@ -20,7 +20,7 @@ use Ramsey\Uuid\Type\Integer as IntegerObject; use Ramsey\Uuid\Validator\ValidatorInterface; /** - * UuidFactoryInterface defines common functionality all `UuidFactory` instances + * UuidFactoryInterface defines the common functionality all `UuidFactory` instances * must implement */ interface UuidFactoryInterface @@ -32,8 +32,6 @@ interface UuidFactoryInterface * * @return UuidInterface A UuidInterface instance created from a binary * string representation - * - * @psalm-pure */ public function fromBytes(string $bytes): UuidInterface; @@ -63,8 +61,6 @@ interface UuidFactoryInterface * * @return UuidInterface A UuidInterface instance created from the string * representation of a 128-bit integer - * - * @psalm-pure */ public function fromInteger(string $integer): UuidInterface; @@ -75,15 +71,11 @@ interface UuidFactoryInterface * * @return UuidInterface A UuidInterface instance created from a hexadecimal * string representation - * - * @psalm-pure */ public function fromString(string $uuid): UuidInterface; /** - * Returns the validator to use for the factory - * - * @psalm-mutation-free + * Returns the validator used by the factory */ public function getValidator(): ValidatorInterface; @@ -138,8 +130,6 @@ interface UuidFactoryInterface * * @return UuidInterface A UuidInterface instance that represents a * version 3 UUID - * - * @psalm-pure */ public function uuid3($ns, string $name): UuidInterface; @@ -160,8 +150,6 @@ interface UuidFactoryInterface * * @return UuidInterface A UuidInterface instance that represents a * version 5 UUID - * - * @psalm-pure */ public function uuid5($ns, string $name): UuidInterface; diff --git a/src/UuidInterface.php b/src/UuidInterface.php index cac9457..33afbab 100644 --- a/src/UuidInterface.php +++ b/src/UuidInterface.php @@ -25,7 +25,7 @@ use Stringable; * A UUID is a universally unique identifier adhering to an agreed-upon * representation format and standard for generation * - * @psalm-immutable + * @immutable */ interface UuidInterface extends DeprecatedUuidInterface, @@ -66,7 +66,7 @@ interface UuidInterface extends /** * Returns the binary string representation of the UUID * - * @psalm-return non-empty-string + * @return non-empty-string */ public function getBytes(): string; @@ -96,14 +96,14 @@ interface UuidInterface extends /** * Returns the string standard representation of the UUID * - * @psalm-return non-empty-string + * @return non-empty-string */ public function toString(): string; /** * Casts the UUID to the string standard representation * - * @psalm-return non-empty-string + * @return non-empty-string */ public function __toString(): string; } diff --git a/src/Validator/GenericValidator.php b/src/Validator/GenericValidator.php index fd60955..36fb56e 100644 --- a/src/Validator/GenericValidator.php +++ b/src/Validator/GenericValidator.php @@ -22,7 +22,7 @@ use function str_replace; /** * GenericValidator validates strings as UUIDs of any variant * - * @psalm-immutable + * @immutable */ final class GenericValidator implements ValidatorInterface { @@ -32,9 +32,7 @@ final class GenericValidator implements ValidatorInterface private const VALID_PATTERN = '\A[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\z'; /** - * @psalm-return non-empty-string - * @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty - * @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty + * @return non-empty-string */ public function getPattern(): string { diff --git a/src/Validator/ValidatorInterface.php b/src/Validator/ValidatorInterface.php index 3d4bd6f..f125513 100644 --- a/src/Validator/ValidatorInterface.php +++ b/src/Validator/ValidatorInterface.php @@ -17,16 +17,14 @@ namespace Ramsey\Uuid\Validator; /** * A validator validates a string as a proper UUID * - * @psalm-immutable + * @immutable */ interface ValidatorInterface { /** * Returns the regular expression pattern used by this validator * - * @return string The regular expression pattern this validator uses - * - * @psalm-return non-empty-string + * @return non-empty-string The regular expression pattern this validator uses */ public function getPattern(): string; diff --git a/src/functions.php b/src/functions.php index 1b3ce00..a7a236c 100644 --- a/src/functions.php +++ b/src/functions.php @@ -71,9 +71,6 @@ function v2( * @param string|UuidInterface $ns The namespace (must be a valid UUID) * * @return non-empty-string Version 3 UUID as a string - * - * @psalm-pure note: changing the internal factory is an edge case not covered by purity invariants, - * but under constant factory setups, this method operates in functionally pure manners */ function v3($ns, string $name): string { @@ -97,9 +94,6 @@ function v4(): string * @param string|UuidInterface $ns The namespace (must be a valid UUID) * * @return non-empty-string Version 5 UUID as a string - * - * @psalm-pure note: changing the internal factory is an edge case not covered by purity invariants, - * but under constant factory setups, this method operates in functionally pure manners */ function v5($ns, string $name): string { diff --git a/tests/benchmark/UuidSerializationBench.php b/tests/benchmark/UuidSerializationBench.php index ea02bbd..a137280 100644 --- a/tests/benchmark/UuidSerializationBench.php +++ b/tests/benchmark/UuidSerializationBench.php @@ -133,8 +133,7 @@ final class UuidSerializationBench /** @var UuidInterface */ private $uuid; /** - * @var UuidInterface[] - * @psalm-var non-empty-list + * @var non-empty-list */ private $promiscuousUuids; /** @var string */ @@ -144,8 +143,7 @@ final class UuidSerializationBench /** @var string */ private $serializedUuid; /** - * @var string[] - * @psalm-var non-empty-list + * @var non-empty-list */ private $serializedPromiscuousUuids; diff --git a/tests/benchmark/UuidStringConversionBench.php b/tests/benchmark/UuidStringConversionBench.php index 303b5ae..d7c098c 100644 --- a/tests/benchmark/UuidStringConversionBench.php +++ b/tests/benchmark/UuidStringConversionBench.php @@ -132,28 +132,23 @@ final class UuidStringConversionBench /** @var UuidInterface */ private $uuid; /** - * @var UuidInterface[] - * @psalm-var non-empty-list + * @var non-empty-list */ private $promiscuousUuids; /** - * @var string - * @psalm-var non-empty-string + * @var non-empty-string */ private $tinyUuidBytes; /** - * @var string - * @psalm-var non-empty-string + * @var non-empty-string */ private $hugeUuidBytes; /** - * @var string - * @psalm-var non-empty-string + * @var non-empty-string */ private $uuidBytes; /** - * @var string[] - * @psalm-var non-empty-list + * @var non-empty-list */ private $promiscuousUuidsBytes; diff --git a/tests/static-analysis/UuidIsImmutable.php b/tests/static-analysis/UuidIsImmutable.php index 6c17348..e6fa5ac 100644 --- a/tests/static-analysis/UuidIsImmutable.php +++ b/tests/static-analysis/UuidIsImmutable.php @@ -29,13 +29,11 @@ use Ramsey\Uuid\UuidInterface; */ final class UuidIsImmutable { - /** @psalm-pure */ public static function pureCompareTo(UuidInterface $a, UuidInterface $b): int { return $a->compareTo($b); } - /** @psalm-pure */ public static function pureEquals(UuidInterface $a, ?object $b): bool { return $a->equals($b); @@ -43,9 +41,6 @@ final class UuidIsImmutable /** * @return mixed[] - * - * @psalm-pure - * @psalm-suppress DeprecatedMethod */ public static function pureGetters(UuidInterface $a): array { @@ -76,8 +71,6 @@ final class UuidIsImmutable /** * @return UuidInterface[]|bool[] - * - * @psalm-pure */ public static function pureStaticUuidApi(): array { @@ -90,7 +83,6 @@ final class UuidIsImmutable ]; } - /** @psalm-pure */ public static function uuid3IsPure(): UuidInterface { return Uuid::uuid3( @@ -99,7 +91,6 @@ final class UuidIsImmutable ); } - /** @psalm-pure */ public static function uuid5IsPure(): UuidInterface { return Uuid::uuid5( diff --git a/tests/static-analysis/UuidIsNeverEmpty.php b/tests/static-analysis/UuidIsNeverEmpty.php index 0ff395f..2fbc1b5 100644 --- a/tests/static-analysis/UuidIsNeverEmpty.php +++ b/tests/static-analysis/UuidIsNeverEmpty.php @@ -22,13 +22,13 @@ use Ramsey\Uuid\UuidInterface; */ final class UuidIsNeverEmpty { - /** @psalm-return non-empty-string */ + /** @return non-empty-string */ public function bytesAreNeverEmpty(UuidInterface $uuid): string { return $uuid->getBytes(); } - /** @psalm-return non-empty-string */ + /** @return non-empty-string */ public function stringIsNeverEmpty(UuidInterface $uuid): string { return $uuid->toString(); diff --git a/tests/static-analysis/stubs.php b/tests/static-analysis/stubs.php index a8e9047..dda2e45 100644 --- a/tests/static-analysis/stubs.php +++ b/tests/static-analysis/stubs.php @@ -16,18 +16,14 @@ if (!defined('UUID_TYPE_RANDOM')) { define('UUID_TYPE_RANDOM', 4); } if (!function_exists('uuid_create')) { - /** @psalm-suppress all */ function uuid_create(int $uuid_type=UUID_TYPE_DEFAULT): string {} // @phpstan-ignore-line } if (!function_exists('uuid_generate_md5')) { - /** @psalm-suppress all */ function uuid_generate_md5(string $uuid_ns, string $name): string {} // @phpstan-ignore-line } if (!function_exists('uuid_generate_sha1')) { - /** @psalm-suppress all */ function uuid_generate_sha1(string $uuid_ns, string $name): string {} // @phpstan-ignore-line } if (!function_exists('uuid_parse')) { - /** @psalm-suppress all */ function uuid_parse(string $uuid): string {} // @phpstan-ignore-line } From 76cbc566e2394c9836dc832a64e96fc2ec938baf Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Sun, 25 May 2025 16:52:53 -0500 Subject: [PATCH 3/3] chore(deps-dev): upgrade PHPStan --- composer.json | 13 +- composer.lock | 98 +++--- phpstan-tests.neon | 32 -- phpstan.neon.dist | 23 +- src/Builder/BuilderCollection.php | 1 + src/Codec/OrderedTimeCodec.php | 1 - src/Converter/Time/PhpTimeConverter.php | 1 + src/FeatureSet.php | 2 + src/Generator/CombGenerator.php | 2 + src/Generator/DefaultNameGenerator.php | 17 +- src/Generator/PeclUuidNameGenerator.php | 2 +- src/Generator/PeclUuidRandomGenerator.php | 2 +- src/Generator/PeclUuidTimeGenerator.php | 2 +- src/Guid/Fields.php | 18 +- src/Lazy/LazyUuidFromString.php | 4 +- .../Dce/SystemDceSecurityProvider.php | 4 - src/Provider/Node/NodeProviderCollection.php | 1 + src/Provider/Node/SystemNodeProvider.php | 10 +- src/Type/Decimal.php | 4 +- src/Type/Integer.php | 4 + src/Uuid.php | 18 +- src/UuidFactory.php | 8 +- tests/BinaryUtilsTest.php | 4 +- tests/Builder/FallbackBuilderTest.php | 39 ++- .../Time/BigNumberTimeConverterTest.php | 1 - .../Time/GenericTimeConverterTest.php | 11 +- tests/Converter/Time/PhpTimeConverterTest.php | 11 +- tests/DeprecatedUuidMethodsTraitTest.php | 2 - tests/FeatureSetTest.php | 1 + tests/Generator/DefaultNameGeneratorTest.php | 4 +- tests/Generator/PeclUuidNameGeneratorTest.php | 9 +- tests/Generator/RandomBytesGeneratorTest.php | 7 +- tests/Generator/RandomLibAdapterTest.php | 4 +- tests/Generator/TimeGeneratorFactoryTest.php | 1 + tests/Guid/FieldsTest.php | 21 +- tests/Math/BrickMathCalculatorTest.php | 3 - tests/Nonstandard/FieldsTest.php | 13 +- tests/Nonstandard/UuidV6Test.php | 6 +- .../Dce/SystemDceSecurityProviderTest.php | 20 +- .../Node/FallbackNodeProviderTest.php | 1 - .../Provider/Node/StaticNodeProviderTest.php | 4 +- .../Provider/Node/SystemNodeProviderTest.php | 307 +++++++++--------- .../Provider/Time/SystemTimeProviderTest.php | 1 + tests/Rfc4122/FieldsTest.php | 21 +- tests/Rfc4122/UuidBuilderTest.php | 3 +- tests/Rfc4122/UuidV1Test.php | 5 +- tests/Rfc4122/UuidV2Test.php | 14 +- tests/Rfc4122/UuidV3Test.php | 2 +- tests/Rfc4122/UuidV4Test.php | 2 +- tests/Rfc4122/UuidV5Test.php | 2 +- tests/Rfc4122/UuidV6Test.php | 7 +- tests/Rfc4122/ValidatorTest.php | 2 +- tests/Rfc4122/VariantTraitTest.php | 4 +- tests/TestCase.php | 2 +- tests/UuidFactoryTest.php | 2 +- tests/UuidTest.php | 64 ++-- tests/Validator/GenericValidatorTest.php | 2 +- 57 files changed, 447 insertions(+), 422 deletions(-) delete mode 100644 phpstan-tests.neon diff --git a/composer.json b/composer.json index 9f2cd4f..a208b01 100644 --- a/composer.json +++ b/composer.json @@ -26,10 +26,10 @@ "php-mock/php-mock-mockery": "^1.3", "php-parallel-lint/php-parallel-lint": "^1.4.0", "phpbench/phpbench": "^1.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-mockery": "^1.1", - "phpstan/phpstan-phpunit": "^1.1", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-mockery": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", "phpunit/phpunit": "^8.5 || ^9", "slevomat/coding-standard": "^8.4", "squizlabs/php_codesniffer": "^3.5" @@ -83,10 +83,7 @@ "phpbench": "phpbench run", "phpcbf": "phpcbf -vpw --cache=build/cache/phpcs.cache", "phpcs": "phpcs --cache=build/cache/phpcs.cache", - "phpstan": [ - "phpstan analyse --no-progress --memory-limit=1G", - "phpstan analyse -c phpstan-tests.neon --no-progress --memory-limit=1G" - ], + "phpstan": "phpstan analyse --memory-limit=1G", "phpunit": "phpunit --verbose --colors=always", "phpunit-coverage": "phpunit --verbose --colors=always --coverage-html build/coverage", "test": [ diff --git a/composer.lock b/composer.lock index 371a2bb..2261ea9 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": "8a871cc8547137334b735ea98dd9cc28", + "content-hash": "cbda15fd74ceae31bed05f16b0493a76", "packages": [ { "name": "brick/math", @@ -2103,28 +2103,27 @@ }, { "name": "phpstan/extension-installer", - "version": "1.1.0", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/phpstan/extension-installer.git", - "reference": "66c7adc9dfa38b6b5838a9fb728b68a7d8348051" + "reference": "85e90b3942d06b2326fba0403ec24fe912372936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/66c7adc9dfa38b6b5838a9fb728b68a7d8348051", - "reference": "66c7adc9dfa38b6b5838a9fb728b68a7d8348051", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936", + "reference": "85e90b3942d06b2326fba0403ec24fe912372936", "shasum": "" }, "require": { - "composer-plugin-api": "^1.1 || ^2.0", - "php": "^7.1 || ^8.0", - "phpstan/phpstan": ">=0.11.6" + "composer-plugin-api": "^2.0", + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.9.0 || ^2.0" }, "require-dev": { - "composer/composer": "^1.8", - "phing/phing": "^2.16.3", + "composer/composer": "^2.0", "php-parallel-lint/php-parallel-lint": "^1.2.0", - "phpstan/phpstan-strict-rules": "^0.11 || ^0.12" + "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" }, "type": "composer-plugin", "extra": { @@ -2140,11 +2139,15 @@ "MIT" ], "description": "Composer plugin for automatic installation of PHPStan extensions", + "keywords": [ + "dev", + "static analysis" + ], "support": { "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.1.0" + "source": "https://github.com/phpstan/extension-installer/tree/1.4.3" }, - "time": "2020-12-13T13:06:13+00:00" + "time": "2024-09-04T20:21:43+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -2193,20 +2196,20 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.5", + "version": "2.1.17", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "f6598a5ff12ca4499a836815e08b4d77a2ddeb20" + "reference": "89b5ef665716fa2a52ecd2633f21007a6a349053" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f6598a5ff12ca4499a836815e08b4d77a2ddeb20", - "reference": "f6598a5ff12ca4499a836815e08b4d77a2ddeb20", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/89b5ef665716fa2a52ecd2633f21007a6a349053", + "reference": "89b5ef665716fa2a52ecd2633f21007a6a349053", "shasum": "" }, "require": { - "php": "^7.2|^8.0" + "php": "^7.4|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -2231,8 +2234,11 @@ "static analysis" ], "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.5" + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" }, "funding": [ { @@ -2242,39 +2248,34 @@ { "url": "https://github.com/phpstan", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" } ], - "time": "2022-09-07T16:05:32+00:00" + "time": "2025-05-21T20:55:28+00:00" }, { "name": "phpstan/phpstan-mockery", - "version": "1.1.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-mockery.git", - "reference": "245b17ccd00f04be3c6b9fc6645f63793b37b2ea" + "reference": "89a949d0ac64298e88b7c7fa00caee565c198394" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-mockery/zipball/245b17ccd00f04be3c6b9fc6645f63793b37b2ea", - "reference": "245b17ccd00f04be3c6b9fc6645f63793b37b2ea", + "url": "https://api.github.com/repos/phpstan/phpstan-mockery/zipball/89a949d0ac64298e88b7c7fa00caee565c198394", + "reference": "89a949d0ac64298e88b7c7fa00caee565c198394", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.5.0" + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0" }, "require-dev": { - "mockery/mockery": "^1.2.4", - "nikic/php-parser": "^4.13.0", + "mockery/mockery": "^1.6.11", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-phpunit": "^1.0", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5" + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6" }, "type": "phpstan-extension", "extra": { @@ -2296,36 +2297,37 @@ "description": "PHPStan Mockery extension", "support": { "issues": "https://github.com/phpstan/phpstan-mockery/issues", - "source": "https://github.com/phpstan/phpstan-mockery/tree/1.1.0" + "source": "https://github.com/phpstan/phpstan-mockery/tree/2.0.0" }, - "time": "2022-05-09T13:12:35+00:00" + "time": "2024-10-14T03:18:12+00:00" }, { "name": "phpstan/phpstan-phpunit", - "version": "1.1.1", + "version": "2.0.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "4a3c437c09075736285d1cabb5c75bf27ed0bc84" + "reference": "6b92469f8a7995e626da3aa487099617b8dfa260" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/4a3c437c09075736285d1cabb5c75bf27ed0bc84", - "reference": "4a3c437c09075736285d1cabb5c75bf27ed0bc84", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/6b92469f8a7995e626da3aa487099617b8dfa260", + "reference": "6b92469f8a7995e626da3aa487099617b8dfa260", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.5.0" + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0.4" }, "conflict": { "phpunit/phpunit": "<7.0" }, "require-dev": { - "nikic/php-parser": "^4.13.0", + "nikic/php-parser": "^5", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5" + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6" }, "type": "phpstan-extension", "extra": { @@ -2348,9 +2350,9 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.1.1" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.6" }, - "time": "2022-04-20T15:24:25+00:00" + "time": "2025-03-26T12:47:06+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/phpstan-tests.neon b/phpstan-tests.neon deleted file mode 100644 index 03e164e..0000000 --- a/phpstan-tests.neon +++ /dev/null @@ -1,32 +0,0 @@ -parameters: - tmpDir: ./build/cache/phpstan - level: max - paths: - - ./tests - bootstrapFiles: - - ./tests/static-analysis/stubs.php - checkMissingIterableValueType: false - reportUnmatchedIgnoredErrors: false - excludePaths: - analyse: - - ./tests/ExpectedBehaviorTest.php - - ./tests/static-analysis/stubs.php - ignoreErrors: - - - message: "#^Call to static method Ramsey\\\\Uuid\\\\.+ on a separate line has no effect\\.$#" - paths: - - ./tests/*Test.php - - ./tests/benchmark/*Bench.php - - - message: "#^Call to method Ramsey\\\\Uuid\\\\.+ on a separate line has no effect\\.$#" - paths: - - ./tests/Builder/*Test.php - - ./tests/Converter/*Test.php - - ./tests/Generator/*Test.php - - ./tests/Guid/*Test.php - - ./tests/Nonstandard/*Test.php - - ./tests/Rfc4122/*Test.php - - - message: "#^Method Ramsey\\\\Uuid\\\\.+ should return non-empty-string but returns string\\.$#" - paths: - - ./tests/static-analysis/ValidUuidIsNonEmpty.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 46766b1..4afc863 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,24 +1,13 @@ parameters: tmpDir: ./build/cache/phpstan level: max + treatPhpDocTypesAsCertain: false paths: - ./src - checkMissingIterableValueType: false + - ./tests bootstrapFiles: - ./tests/static-analysis/stubs.php - ignoreErrors: - - - message: '#^Comparison operation ">" between 6 and 0 is always true\.$#' - count: 1 - path: ./src/Generator/CombGenerator.php - - - # Legacy methods of `Ramsey\Uuid` use interface methods that are NOT defined on `FieldsInterface` - message: '#^Call to an undefined method Ramsey\\Uuid\\Fields\\FieldsInterface::get.*$#' - count: 9 - path: ./src/Lazy/LazyUuidFromString.php - - - message: '#^Constructor of class Ramsey\\Uuid\\FeatureSet has an unused parameter \$forceNoBigNumber\.#' - count: 1 - path: ./src/FeatureSet.php - - - '#^Method Ramsey\\Uuid\\Generator\\Pecl[A-Za-z]+Generator::generate\(\) should return string but returns string\|false\.$#' + excludePaths: + analyse: + - ./tests/ExpectedBehaviorTest.php + - ./tests/static-analysis/stubs.php diff --git a/src/Builder/BuilderCollection.php b/src/Builder/BuilderCollection.php index b0765c0..8521df8 100644 --- a/src/Builder/BuilderCollection.php +++ b/src/Builder/BuilderCollection.php @@ -70,6 +70,7 @@ class BuilderCollection extends AbstractCollection $this->data = array_filter( $data, function ($unserialized): bool { + /** @phpstan-ignore instanceof.alwaysTrue */ return $unserialized instanceof UuidBuilderInterface; } ); diff --git a/src/Codec/OrderedTimeCodec.php b/src/Codec/OrderedTimeCodec.php index 3c06804..8cb55e0 100644 --- a/src/Codec/OrderedTimeCodec.php +++ b/src/Codec/OrderedTimeCodec.php @@ -64,7 +64,6 @@ class OrderedTimeCodec extends StringCodec $bytes = $uuid->getFields()->getBytes(); - /** @var non-empty-string */ return $bytes[6] . $bytes[7] . $bytes[4] . $bytes[5] . $bytes[0] . $bytes[1] . $bytes[2] . $bytes[3] diff --git a/src/Converter/Time/PhpTimeConverter.php b/src/Converter/Time/PhpTimeConverter.php index 326f2c3..c630fac 100644 --- a/src/Converter/Time/PhpTimeConverter.php +++ b/src/Converter/Time/PhpTimeConverter.php @@ -92,6 +92,7 @@ class PhpTimeConverter implements TimeConverterInterface // Check to see whether we've overflowed the max/min integer size. // If so, we will default to a different time converter. + // @phpstan-ignore function.alreadyNarrowedType (the integer value might have overflowed) if (!is_int($uuidTime)) { return $this->fallbackConverter->calculateTime( $seconds->toString(), diff --git a/src/FeatureSet.php b/src/FeatureSet.php index 8ed764b..ddaaada 100644 --- a/src/FeatureSet.php +++ b/src/FeatureSet.php @@ -85,6 +85,8 @@ class FeatureSet * system node ID (primarily for testing purposes) * @param bool $enablePecl True to enable the use of the PeclUuidTimeGenerator * to generate version 1 UUIDs + * + * @phpstan-ignore constructor.unusedParameter ($forceNoBigNumber is deprecated) */ public function __construct( bool $useGuids = false, diff --git a/src/Generator/CombGenerator.php b/src/Generator/CombGenerator.php index 0e88706..e80e50b 100644 --- a/src/Generator/CombGenerator.php +++ b/src/Generator/CombGenerator.php @@ -82,6 +82,8 @@ class CombGenerator implements RandomGeneratorInterface } $hash = ''; + + /** @phpstan-ignore greater.alwaysTrue (TIMESTAMP_BYTES constant could change in child classes) */ if (self::TIMESTAMP_BYTES > 0 && $length > self::TIMESTAMP_BYTES) { $hash = $this->generator->generate($length - self::TIMESTAMP_BYTES); } diff --git a/src/Generator/DefaultNameGenerator.php b/src/Generator/DefaultNameGenerator.php index 88fe41f..9d8b7fb 100644 --- a/src/Generator/DefaultNameGenerator.php +++ b/src/Generator/DefaultNameGenerator.php @@ -29,19 +29,12 @@ class DefaultNameGenerator implements NameGeneratorInterface public function generate(UuidInterface $ns, string $name, string $hashAlgorithm): string { try { - /** @var string|bool $bytes */ - $bytes = @hash($hashAlgorithm, $ns->getBytes() . $name, true); + return hash($hashAlgorithm, $ns->getBytes() . $name, true); } catch (ValueError $e) { - $bytes = false; // keep same behavior than PHP 7 + throw new NameException( + message: sprintf('Unable to hash namespace and name with algorithm \'%s\'', $hashAlgorithm), + previous: $e, + ); } - - if ($bytes === false) { - throw new NameException(sprintf( - 'Unable to hash namespace and name with algorithm \'%s\'', - $hashAlgorithm - )); - } - - return (string) $bytes; } } diff --git a/src/Generator/PeclUuidNameGenerator.php b/src/Generator/PeclUuidNameGenerator.php index 6cabbf8..532eb46 100644 --- a/src/Generator/PeclUuidNameGenerator.php +++ b/src/Generator/PeclUuidNameGenerator.php @@ -43,6 +43,6 @@ class PeclUuidNameGenerator implements NameGeneratorInterface ), }; - return uuid_parse($uuid); + return (string) uuid_parse($uuid); } } diff --git a/src/Generator/PeclUuidRandomGenerator.php b/src/Generator/PeclUuidRandomGenerator.php index 07c47d2..6ad45ac 100644 --- a/src/Generator/PeclUuidRandomGenerator.php +++ b/src/Generator/PeclUuidRandomGenerator.php @@ -30,6 +30,6 @@ class PeclUuidRandomGenerator implements RandomGeneratorInterface { $uuid = uuid_create(UUID_TYPE_RANDOM); - return uuid_parse($uuid); + return (string) uuid_parse($uuid); } } diff --git a/src/Generator/PeclUuidTimeGenerator.php b/src/Generator/PeclUuidTimeGenerator.php index e01f44e..5f3bbcd 100644 --- a/src/Generator/PeclUuidTimeGenerator.php +++ b/src/Generator/PeclUuidTimeGenerator.php @@ -34,6 +34,6 @@ class PeclUuidTimeGenerator implements TimeGeneratorInterface { $uuid = uuid_create(UUID_TYPE_TIME); - return uuid_parse($uuid); + return (string) uuid_parse($uuid); } } diff --git a/src/Guid/Fields.php b/src/Guid/Fields.php index 3afb0d8..11786f5 100644 --- a/src/Guid/Fields.php +++ b/src/Guid/Fields.php @@ -37,7 +37,7 @@ use function unpack; use const STR_PAD_LEFT; /** - * GUIDs are comprised of a set of named fields, according to RFC 4122 + * GUIDs consist of a set of named fields, according to RFC 4122 * * @see Guid * @@ -89,7 +89,7 @@ final class Fields implements FieldsInterface public function getTimeLow(): Hexadecimal { // Swap the bytes from little endian to network byte order. - /** @var array $hex */ + /** @var string[] $hex */ $hex = unpack( 'H*', pack( @@ -99,13 +99,13 @@ final class Fields implements FieldsInterface ) ); - return new Hexadecimal((string) ($hex[1] ?? '')); + return new Hexadecimal($hex[1] ?? ''); } public function getTimeMid(): Hexadecimal { // Swap the bytes from little endian to network byte order. - /** @var array $hex */ + /** @var string[] $hex */ $hex = unpack( 'H*', pack( @@ -114,13 +114,13 @@ final class Fields implements FieldsInterface ) ); - return new Hexadecimal((string) ($hex[1] ?? '')); + return new Hexadecimal($hex[1] ?? ''); } public function getTimeHiAndVersion(): Hexadecimal { // Swap the bytes from little endian to network byte order. - /** @var array $hex */ + /** @var string[] $hex */ $hex = unpack( 'H*', pack( @@ -129,7 +129,7 @@ final class Fields implements FieldsInterface ) ); - return new Hexadecimal((string) ($hex[1] ?? '')); + return new Hexadecimal($hex[1] ?? ''); } public function getTimestamp(): Hexadecimal @@ -176,10 +176,10 @@ final class Fields implements FieldsInterface return null; } - /** @var array $parts */ + /** @var int[] $parts */ $parts = unpack('n*', $this->bytes); - return ((int) $parts[4] >> 4) & 0x00f; + return ($parts[4] >> 4) & 0x00f; } private function isCorrectVariant(): bool diff --git a/src/Lazy/LazyUuidFromString.php b/src/Lazy/LazyUuidFromString.php index 87583e9..6f02743 100644 --- a/src/Lazy/LazyUuidFromString.php +++ b/src/Lazy/LazyUuidFromString.php @@ -38,11 +38,9 @@ use function substr; * conversion. This object optimizes instantiation, serialization and string conversion time, at the cost of * increased overhead for more advanced UUID operations. * - * @internal this type is used internally for performance reasons, and is not supposed to be directly referenced + * @internal this type is used internally for performance reasons and is not supposed to be directly referenced * in consumer libraries. * - * @immutable - * * Note: the {@see FieldsInterface} does not declare methods that deprecated API * relies upon: the API has been ported from the {@see \Ramsey\Uuid\Uuid} definition, * and is deprecated anyway. diff --git a/src/Provider/Dce/SystemDceSecurityProvider.php b/src/Provider/Dce/SystemDceSecurityProvider.php index e37f205..f3cef41 100644 --- a/src/Provider/Dce/SystemDceSecurityProvider.php +++ b/src/Provider/Dce/SystemDceSecurityProvider.php @@ -199,9 +199,7 @@ class SystemDceSecurityProvider implements DceSecurityProviderInterface return ''; } - /** @var string[] $userGroups */ $userGroups = preg_split('/\s{2,}/', (string) $response, -1, PREG_SPLIT_NO_EMPTY); - $firstGroup = trim($userGroups[1] ?? '', "* \t\n\r\0\x0B"); if ($firstGroup === '') { @@ -214,9 +212,7 @@ class SystemDceSecurityProvider implements DceSecurityProviderInterface return ''; } - /** @var string[] $userGroup */ $userGroup = preg_split('/\s{2,}/', (string) $response, -1, PREG_SPLIT_NO_EMPTY); - $sid = $userGroup[1] ?? ''; if (($lastHyphen = strrpos($sid, '-')) === false) { diff --git a/src/Provider/Node/NodeProviderCollection.php b/src/Provider/Node/NodeProviderCollection.php index 5a7bab4..d9028db 100644 --- a/src/Provider/Node/NodeProviderCollection.php +++ b/src/Provider/Node/NodeProviderCollection.php @@ -56,6 +56,7 @@ class NodeProviderCollection extends AbstractCollection $this->data = array_filter( $data, function ($unserialized): bool { + /** @phpstan-ignore-next-line */ return $unserialized instanceof NodeProviderInterface; } ); diff --git a/src/Provider/Node/SystemNodeProvider.php b/src/Provider/Node/SystemNodeProvider.php index 27f7a68..c05d79a 100644 --- a/src/Provider/Node/SystemNodeProvider.php +++ b/src/Provider/Node/SystemNodeProvider.php @@ -72,10 +72,11 @@ class SystemNodeProvider implements NodeProviderInterface */ protected function getNodeFromSystem(): string { + /** @var string | null $node */ static $node = null; if ($node !== null) { - return (string) $node; + return $node; } // First, try a Linux-specific approach. @@ -173,9 +174,10 @@ class SystemNodeProvider implements NodeProviderInterface $macs = array_map($trim, $macs); // Remove invalid entries. - $macs = array_filter($macs, function (string $address) { - return $address !== '00:00:00:00:00:00' - && preg_match(self::SYSFS_PATTERN, $address); + $macs = array_filter($macs, function (mixed $address): bool { + assert(is_string($address)); + + return $address !== '00:00:00:00:00:00' && preg_match(self::SYSFS_PATTERN, $address); }); /** @var string|bool $mac */ diff --git a/src/Type/Decimal.php b/src/Type/Decimal.php index dd8d2ce..6a7b07c 100644 --- a/src/Type/Decimal.php +++ b/src/Type/Decimal.php @@ -36,7 +36,7 @@ use function str_starts_with; final class Decimal implements NumberInterface { private string $value; - private bool $isNegative = false; + private bool $isNegative; public function __construct(float | int | string | self $value) { @@ -61,6 +61,8 @@ final class Decimal implements NumberInterface if (str_starts_with($value, '-')) { $this->isNegative = true; + } else { + $this->isNegative = false; } $this->value = $value; diff --git a/src/Type/Integer.php b/src/Type/Integer.php index 4851b56..c7240fc 100644 --- a/src/Type/Integer.php +++ b/src/Type/Integer.php @@ -42,6 +42,9 @@ final class Integer implements NumberInterface */ private string $value; + /** + * @phpstan-ignore property.readOnlyByPhpDocDefaultValue + */ private bool $isNegative = false; public function __construct(float | int | string | self $value) @@ -145,6 +148,7 @@ final class Integer implements NumberInterface if ($sign === '-' && $value !== '0') { $value = $sign . $value; + /** @phpstan-ignore property.readOnlyByPhpDocAssignNotInConstructor */ $this->isNegative = true; } diff --git a/src/Uuid.php b/src/Uuid.php index e4af9f4..82c37d6 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -223,12 +223,16 @@ class Uuid implements UuidInterface self::DCE_DOMAIN_ORG => 'org', ]; + /** + * @phpstan-ignore property.readOnlyByPhpDocDefaultValue + */ private static ?UuidFactoryInterface $factory = null; /** * @var bool flag to detect if the UUID factory was replaced internally, * which disables all optimizations for the default/happy path internal * scenarios + * @phpstan-ignore property.readOnlyByPhpDocDefaultValue */ private static bool $factoryReplaced = false; @@ -321,9 +325,16 @@ class Uuid implements UuidInterface $uuid = self::getFactory()->fromString($data); } + /** @phpstan-ignore property.readOnlyByPhpDocAssignNotInConstructor */ $this->codec = $uuid->codec; + + /** @phpstan-ignore property.readOnlyByPhpDocAssignNotInConstructor */ $this->numberConverter = $uuid->numberConverter; + + /** @phpstan-ignore property.readOnlyByPhpDocAssignNotInConstructor */ $this->fields = $uuid->fields; + + /** @phpstan-ignore property.readOnlyByPhpDocAssignNotInConstructor */ $this->timeConverter = $uuid->timeConverter; } @@ -519,7 +530,10 @@ class Uuid implements UuidInterface $factory = self::getFactory(); if (method_exists($factory, 'fromHexadecimal')) { - return $factory->fromHexadecimal($hex); + $uuid = $factory->fromHexadecimal($hex); + assert($uuid instanceof UuidInterface); + + return $uuid; } throw new BadMethodCallException('The method fromHexadecimal() does not exist on the provided factory'); @@ -546,6 +560,8 @@ class Uuid implements UuidInterface * @param string $uuid A string to validate as a UUID * * @return bool True if the string is a valid UUID, false otherwise + * + * @phpstan-assert-if-true =non-empty-string $uuid */ public static function isValid(string $uuid): bool { diff --git a/src/UuidFactory.php b/src/UuidFactory.php index 27912bf..94fc1b5 100644 --- a/src/UuidFactory.php +++ b/src/UuidFactory.php @@ -466,14 +466,14 @@ class UuidFactory implements UuidFactoryInterface */ private function uuidFromBytesAndVersion(string $bytes, int $version): UuidInterface { - /** @var array $unpackedTime */ + /** @var int[] $unpackedTime */ $unpackedTime = unpack('n*', substr($bytes, 6, 2)); - $timeHi = (int) $unpackedTime[1]; + $timeHi = $unpackedTime[1]; $timeHiAndVersion = pack('n*', BinaryUtils::applyVersion($timeHi, $version)); - /** @var array $unpackedClockSeq */ + /** @var int[] $unpackedClockSeq */ $unpackedClockSeq = unpack('n*', substr($bytes, 8, 2)); - $clockSeqHi = (int) $unpackedClockSeq[1]; + $clockSeqHi = $unpackedClockSeq[1]; $clockSeqHiAndReserved = pack('n*', BinaryUtils::applyVariant($clockSeqHi)); $bytes = substr_replace($bytes, $timeHiAndVersion, 6, 2); diff --git a/tests/BinaryUtilsTest.php b/tests/BinaryUtilsTest.php index 0497bfd..23a3456 100644 --- a/tests/BinaryUtilsTest.php +++ b/tests/BinaryUtilsTest.php @@ -29,7 +29,7 @@ class BinaryUtilsTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideVersionTestValues(): array { @@ -128,7 +128,7 @@ class BinaryUtilsTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideVariantTestValues(): array { diff --git a/tests/Builder/FallbackBuilderTest.php b/tests/Builder/FallbackBuilderTest.php index a601ee6..68d790f 100644 --- a/tests/Builder/FallbackBuilderTest.php +++ b/tests/Builder/FallbackBuilderTest.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Builder; -use DateTimeInterface; use Mockery; use Ramsey\Uuid\Builder\FallbackBuilder; use Ramsey\Uuid\Builder\UuidBuilderInterface; @@ -101,7 +100,7 @@ class FallbackBuilderTest extends TestCase $uuid = $builder->build($codec, $bytes); if (($uuid instanceof UuidV1) || ($uuid instanceof UuidV2) || ($uuid instanceof UuidV6)) { - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); + $this->assertNotEmpty($uuid->getDateTime()->format('r')); } } catch (UnableToBuildUuidException $exception) { switch ($exception->getMessage()) { @@ -118,78 +117,78 @@ class FallbackBuilderTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideBytes(): array { return [ [ // GUID bytes - 'bytes' => hex2bin('b08c6fff7dc5e1110b210800200c9a66'), + 'bytes' => (string) hex2bin('b08c6fff7dc5e1110b210800200c9a66'), ], [ // GUID bytes - 'bytes' => hex2bin('b08c6fff7dc5e1111b210800200c9a66'), + 'bytes' => (string) hex2bin('b08c6fff7dc5e1111b210800200c9a66'), ], [ // GUID bytes - 'bytes' => hex2bin('b08c6fff7dc5e1112b210800200c9a66'), + 'bytes' => (string) hex2bin('b08c6fff7dc5e1112b210800200c9a66'), ], [ // GUID bytes - 'bytes' => hex2bin('b08c6fff7dc5e1113b210800200c9a66'), + 'bytes' => (string) hex2bin('b08c6fff7dc5e1113b210800200c9a66'), ], [ // GUID bytes - 'bytes' => hex2bin('b08c6fff7dc5e1114b210800200c9a66'), + 'bytes' => (string) hex2bin('b08c6fff7dc5e1114b210800200c9a66'), ], [ // GUID bytes - 'bytes' => hex2bin('b08c6fff7dc5e1115b210800200c9a66'), + 'bytes' => (string) hex2bin('b08c6fff7dc5e1115b210800200c9a66'), ], [ // GUID bytes - 'bytes' => hex2bin('b08c6fff7dc5e1116b210800200c9a66'), + 'bytes' => (string) hex2bin('b08c6fff7dc5e1116b210800200c9a66'), ], [ // GUID bytes - 'bytes' => hex2bin('b08c6fff7dc5e1117b210800200c9a66'), + 'bytes' => (string) hex2bin('b08c6fff7dc5e1117b210800200c9a66'), ], [ // GUID bytes - 'bytes' => hex2bin('b08c6fff7dc5e111eb210800200c9a66'), + 'bytes' => (string) hex2bin('b08c6fff7dc5e111eb210800200c9a66'), ], [ // GUID bytes - 'bytes' => hex2bin('b08c6fff7dc5e111fb210800200c9a66'), + 'bytes' => (string) hex2bin('b08c6fff7dc5e111fb210800200c9a66'), ], [ // Version 1 bytes - 'bytes' => hex2bin('ff6f8cb0c57d11e19b210800200c9a66'), + 'bytes' => (string) hex2bin('ff6f8cb0c57d11e19b210800200c9a66'), ], [ // Version 2 bytes - 'bytes' => hex2bin('000001f55cde21ea84000242ac130003'), + 'bytes' => (string) hex2bin('000001f55cde21ea84000242ac130003'), ], [ // Version 3 bytes - 'bytes' => hex2bin('ff6f8cb0c57d31e1bb210800200c9a66'), + 'bytes' => (string) hex2bin('ff6f8cb0c57d31e1bb210800200c9a66'), ], [ // Version 4 bytes - 'bytes' => hex2bin('ff6f8cb0c57d41e1ab210800200c9a66'), + 'bytes' => (string) hex2bin('ff6f8cb0c57d41e1ab210800200c9a66'), ], [ // Version 5 bytes - 'bytes' => hex2bin('ff6f8cb0c57d51e18b210800200c9a66'), + 'bytes' => (string) hex2bin('ff6f8cb0c57d51e18b210800200c9a66'), ], [ // Version 6 bytes - 'bytes' => hex2bin('ff6f8cb0c57d61e18b210800200c9a66'), + 'bytes' => (string) hex2bin('ff6f8cb0c57d61e18b210800200c9a66'), ], [ // NIL bytes - 'bytes' => hex2bin('00000000000000000000000000000000'), + 'bytes' => (string) hex2bin('00000000000000000000000000000000'), ], ]; } diff --git a/tests/Converter/Time/BigNumberTimeConverterTest.php b/tests/Converter/Time/BigNumberTimeConverterTest.php index 0552a08..f5acc98 100644 --- a/tests/Converter/Time/BigNumberTimeConverterTest.php +++ b/tests/Converter/Time/BigNumberTimeConverterTest.php @@ -35,7 +35,6 @@ class BigNumberTimeConverterTest extends TestCase $converter = new BigNumberTimeConverter(); $returned = $converter->calculateTime((string) $seconds, (string) $microseconds); - $this->assertInstanceOf(Hexadecimal::class, $returned); $this->assertSame($expected, $returned->toString()); } diff --git a/tests/Converter/Time/GenericTimeConverterTest.php b/tests/Converter/Time/GenericTimeConverterTest.php index aba4106..748d602 100644 --- a/tests/Converter/Time/GenericTimeConverterTest.php +++ b/tests/Converter/Time/GenericTimeConverterTest.php @@ -12,6 +12,10 @@ use Ramsey\Uuid\Type\Hexadecimal; class GenericTimeConverterTest extends TestCase { /** + * @param numeric-string $seconds + * @param numeric-string $microseconds + * @param non-empty-string $expected + * * @dataProvider provideCalculateTime */ public function testCalculateTime(string $seconds, string $microseconds, string $expected): void @@ -25,7 +29,7 @@ class GenericTimeConverterTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideCalculateTime(): array { @@ -80,6 +84,9 @@ class GenericTimeConverterTest extends TestCase } /** + * @param numeric-string $unixTimestamp + * @param numeric-string $microseconds + * * @dataProvider provideConvertTime */ public function testConvertTime(Hexadecimal $uuidTimestamp, string $unixTimestamp, string $microseconds): void @@ -94,7 +101,7 @@ class GenericTimeConverterTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideConvertTime(): array { diff --git a/tests/Converter/Time/PhpTimeConverterTest.php b/tests/Converter/Time/PhpTimeConverterTest.php index f3209b0..2036fdd 100644 --- a/tests/Converter/Time/PhpTimeConverterTest.php +++ b/tests/Converter/Time/PhpTimeConverterTest.php @@ -70,6 +70,9 @@ class PhpTimeConverterTest extends TestCase } /** + * @param numeric-string $unixTimestamp + * @param numeric-string $microseconds + * * @dataProvider provideConvertTime */ public function testConvertTime(Hexadecimal $uuidTimestamp, string $unixTimestamp, string $microseconds): void @@ -85,7 +88,7 @@ class PhpTimeConverterTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideConvertTime(): array { @@ -134,6 +137,10 @@ class PhpTimeConverterTest extends TestCase } /** + * @param non-empty-string $seconds + * @param non-empty-string $microseconds + * @param non-empty-string $expected + * * @dataProvider provideCalculateTime */ public function testCalculateTime(string $seconds, string $microseconds, string $expected): void @@ -148,7 +155,7 @@ class PhpTimeConverterTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideCalculateTime(): array { diff --git a/tests/DeprecatedUuidMethodsTraitTest.php b/tests/DeprecatedUuidMethodsTraitTest.php index aefb46d..a21f209 100644 --- a/tests/DeprecatedUuidMethodsTraitTest.php +++ b/tests/DeprecatedUuidMethodsTraitTest.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test; -use DateTimeInterface; use Mockery; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; @@ -31,7 +30,6 @@ class DeprecatedUuidMethodsTraitTest extends TestCase $uuid = new Uuid($fields, $numberConverter, $codec, $timeConverter); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('2012-07-04T02:14:34+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('1341368074.491000', $uuid->getDateTime()->format('U.u')); } diff --git a/tests/FeatureSetTest.php b/tests/FeatureSetTest.php index 62b8269..7b26461 100644 --- a/tests/FeatureSetTest.php +++ b/tests/FeatureSetTest.php @@ -46,6 +46,7 @@ class FeatureSetTest extends TestCase { $featureSet = new FeatureSet(); + /** @phpstan-ignore method.alreadyNarrowedType */ $this->assertInstanceOf(TimeConverterInterface::class, $featureSet->getTimeConverter()); } diff --git a/tests/Generator/DefaultNameGeneratorTest.php b/tests/Generator/DefaultNameGeneratorTest.php index 5c15421..9bfb556 100644 --- a/tests/Generator/DefaultNameGeneratorTest.php +++ b/tests/Generator/DefaultNameGeneratorTest.php @@ -15,6 +15,8 @@ class DefaultNameGeneratorTest extends TestCase { /** * @param non-empty-string $ns + * @param non-empty-string $name + * @param non-empty-string $algorithm * * @dataProvider provideNamesForHashingTest */ @@ -29,7 +31,7 @@ class DefaultNameGeneratorTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideNamesForHashingTest(): array { diff --git a/tests/Generator/PeclUuidNameGeneratorTest.php b/tests/Generator/PeclUuidNameGeneratorTest.php index 6501b24..0bd91d3 100644 --- a/tests/Generator/PeclUuidNameGeneratorTest.php +++ b/tests/Generator/PeclUuidNameGeneratorTest.php @@ -32,14 +32,14 @@ class PeclUuidNameGeneratorTest extends TestCase // Need to add the version and variant, since ext-uuid already includes // these in the values returned. - /** @var array $unpackedTime */ + /** @var int[] $unpackedTime */ $unpackedTime = unpack('n*', substr($expectedBytes, 6, 2)); - $timeHi = (int) $unpackedTime[1]; + $timeHi = $unpackedTime[1]; $timeHiAndVersion = pack('n*', BinaryUtils::applyVersion($timeHi, $version)); - /** @var array $unpackedClockSeq */ + /** @var int[] $unpackedClockSeq */ $unpackedClockSeq = unpack('n*', substr($expectedBytes, 8, 2)); - $clockSeqHi = (int) $unpackedClockSeq[1]; + $clockSeqHi = $unpackedClockSeq[1]; $clockSeqHiAndReserved = pack('n*', BinaryUtils::applyVariant($clockSeqHi)); $expectedBytes = substr_replace($expectedBytes, $timeHiAndVersion, 6, 2); @@ -99,7 +99,6 @@ class PeclUuidNameGeneratorTest extends TestCase 'Unable to hash namespace and name with algorithm \'aBadAlgorithm\'' ); - /** @phpstan-ignore-next-line */ $generator->generate($namespace, 'a test name', 'aBadAlgorithm'); } } diff --git a/tests/Generator/RandomBytesGeneratorTest.php b/tests/Generator/RandomBytesGeneratorTest.php index d3e5c0c..db60539 100644 --- a/tests/Generator/RandomBytesGeneratorTest.php +++ b/tests/Generator/RandomBytesGeneratorTest.php @@ -15,7 +15,7 @@ use function hex2bin; class RandomBytesGeneratorTest extends TestCase { /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function lengthAndHexDataProvider(): array { @@ -27,7 +27,8 @@ class RandomBytesGeneratorTest extends TestCase } /** - * @param int<1, max> $length + * @param positive-int $length + * @param non-empty-string $hex * * @throws Exception * @@ -53,7 +54,7 @@ class RandomBytesGeneratorTest extends TestCase * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testGenerateThrowsExceptionWhenExceptionThrownByRandombytes(): void + public function testGenerateThrowsExceptionWhenExceptionThrownByRandomBytes(): void { PHPMockery::mock('Ramsey\Uuid\Generator', 'random_bytes') ->once() diff --git a/tests/Generator/RandomLibAdapterTest.php b/tests/Generator/RandomLibAdapterTest.php index eec2176..5e83c76 100644 --- a/tests/Generator/RandomLibAdapterTest.php +++ b/tests/Generator/RandomLibAdapterTest.php @@ -26,6 +26,7 @@ class RandomLibAdapterTest extends TestCase ->disableOriginalConstructor() ->getMock(); + /** @phpstan-ignore method.alreadyNarrowedType */ $this->assertInstanceOf(RandomLibAdapter::class, new RandomLibAdapter($generator)); } @@ -33,7 +34,7 @@ class RandomLibAdapterTest extends TestCase * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testAdapterWithoutGeneratorGreatesGenerator(): void + public function testAdapterWithoutGeneratorCreatesGenerator(): void { $generator = Mockery::mock(Generator::class); @@ -41,6 +42,7 @@ class RandomLibAdapterTest extends TestCase $factory = Mockery::mock('overload:' . RandomLibFactory::class); $factory->expects()->getHighStrengthGenerator()->andReturns($generator); + /** @phpstan-ignore method.alreadyNarrowedType */ $this->assertInstanceOf(RandomLibAdapter::class, new RandomLibAdapter()); } diff --git a/tests/Generator/TimeGeneratorFactoryTest.php b/tests/Generator/TimeGeneratorFactoryTest.php index dcf1a34..fb456b4 100644 --- a/tests/Generator/TimeGeneratorFactoryTest.php +++ b/tests/Generator/TimeGeneratorFactoryTest.php @@ -28,6 +28,7 @@ class TimeGeneratorFactoryTest extends TestCase $factory = new TimeGeneratorFactory($nodeProvider, $timeConverter, $timeProvider); $generator = $factory->getGenerator(); + /** @phpstan-ignore method.alreadyNarrowedType */ $this->assertInstanceOf(TimeGeneratorInterface::class, $generator); } } diff --git a/tests/Guid/FieldsTest.php b/tests/Guid/FieldsTest.php index f3bd810..0b281d2 100644 --- a/tests/Guid/FieldsTest.php +++ b/tests/Guid/FieldsTest.php @@ -26,6 +26,8 @@ class FieldsTest extends TestCase } /** + * @param non-empty-string $guid + * * @dataProvider nonRfc4122GuidVariantProvider */ public function testConstructorThrowsExceptionIfNotRfc4122Variant(string $guid): void @@ -44,7 +46,7 @@ class FieldsTest extends TestCase /** * These values are already in GUID byte order, for easy testing. * - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function nonRfc4122GuidVariantProvider(): array { @@ -65,6 +67,8 @@ class FieldsTest extends TestCase } /** + * @param non-empty-string $guid + * * @dataProvider invalidVersionProvider */ public function testConstructorThrowsExceptionIfInvalidVersion(string $guid): void @@ -80,7 +84,7 @@ class FieldsTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function invalidVersionProvider(): array { @@ -100,12 +104,17 @@ class FieldsTest extends TestCase } /** - * @param string|int $expectedValue + * @param non-empty-string $bytes + * @param non-empty-string $methodName + * @param non-empty-string | bool | int | null $expectedValue * * @dataProvider fieldGetterMethodProvider */ - public function testFieldGetterMethods(string $bytes, string $methodName, $expectedValue): void - { + public function testFieldGetterMethods( + string $bytes, + string $methodName, + bool | int | string | null $expectedValue, + ): void { $bytes = (string) hex2bin($bytes); $fields = new Fields($bytes); @@ -119,7 +128,7 @@ class FieldsTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function fieldGetterMethodProvider(): array { diff --git a/tests/Math/BrickMathCalculatorTest.php b/tests/Math/BrickMathCalculatorTest.php index 57989cd..8cb5d90 100644 --- a/tests/Math/BrickMathCalculatorTest.php +++ b/tests/Math/BrickMathCalculatorTest.php @@ -8,7 +8,6 @@ use Ramsey\Uuid\Exception\InvalidArgumentException; use Ramsey\Uuid\Math\BrickMathCalculator; use Ramsey\Uuid\Math\RoundingMode; use Ramsey\Uuid\Test\TestCase; -use Ramsey\Uuid\Type\Hexadecimal; use Ramsey\Uuid\Type\Integer as IntegerObject; class BrickMathCalculatorTest extends TestCase @@ -71,7 +70,6 @@ class BrickMathCalculatorTest extends TestCase $result = $calculator->fromBase('ffffffffffffffffffff', 16); - $this->assertInstanceOf(IntegerObject::class, $result); $this->assertSame('1208925819614629174706175', $result->toString()); } @@ -90,7 +88,6 @@ class BrickMathCalculatorTest extends TestCase $result = $calculator->toHexadecimal($intValue); - $this->assertInstanceOf(Hexadecimal::class, $result); $this->assertSame('ffffffffffffffffffff', $result->toString()); } diff --git a/tests/Nonstandard/FieldsTest.php b/tests/Nonstandard/FieldsTest.php index b0be7ad..dafb2d4 100644 --- a/tests/Nonstandard/FieldsTest.php +++ b/tests/Nonstandard/FieldsTest.php @@ -28,12 +28,17 @@ class FieldsTest extends TestCase } /** - * @param string|int $expectedValue + * @param non-empty-string $uuid + * @param non-empty-string $methodName + * @param non-empty-string | int | bool | null $expectedValue * * @dataProvider fieldGetterMethodProvider */ - public function testFieldGetterMethods(string $uuid, string $methodName, $expectedValue): void - { + public function testFieldGetterMethods( + string $uuid, + string $methodName, + bool | int | string | null $expectedValue, + ): void { $bytes = (string) hex2bin(str_replace('-', '', $uuid)); $fields = new Fields($bytes); @@ -47,7 +52,7 @@ class FieldsTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function fieldGetterMethodProvider(): array { diff --git a/tests/Nonstandard/UuidV6Test.php b/tests/Nonstandard/UuidV6Test.php index e5c71b4..e8ab0ab 100644 --- a/tests/Nonstandard/UuidV6Test.php +++ b/tests/Nonstandard/UuidV6Test.php @@ -44,7 +44,7 @@ class UuidV6Test extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideTestVersions(): array { @@ -78,7 +78,7 @@ class UuidV6Test extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideUuidV6WithOddMicroseconds(): array { @@ -146,7 +146,7 @@ class UuidV6Test extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideUuidV1UuidV6Equivalents(): array { diff --git a/tests/Provider/Dce/SystemDceSecurityProviderTest.php b/tests/Provider/Dce/SystemDceSecurityProviderTest.php index f65f398..6ad0e88 100644 --- a/tests/Provider/Dce/SystemDceSecurityProviderTest.php +++ b/tests/Provider/Dce/SystemDceSecurityProviderTest.php @@ -8,7 +8,6 @@ use Mockery; use Ramsey\Uuid\Exception\DceSecurityException; use Ramsey\Uuid\Provider\Dce\SystemDceSecurityProvider; use Ramsey\Uuid\Test\TestCase; -use Ramsey\Uuid\Type\Integer as IntegerObject; use phpmock\mockery\PHPMockery; use function array_merge; @@ -147,13 +146,12 @@ class SystemDceSecurityProviderTest extends TestCase $uid = $provider->getUid(); - $this->assertInstanceOf(IntegerObject::class, $uid); $this->assertSame($expectedId, $uid->toString()); $this->assertSame($uid, $provider->getUid()); } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideWindowsGoodWhoAmIValues(): array { @@ -199,7 +197,6 @@ class SystemDceSecurityProviderTest extends TestCase $uid = $provider->getUid(); - $this->assertInstanceOf(IntegerObject::class, $uid); $this->assertSame($id, $uid->toString()); $this->assertSame($uid, $provider->getUid()); } @@ -298,7 +295,6 @@ class SystemDceSecurityProviderTest extends TestCase $gid = $provider->getGid(); - $this->assertInstanceOf(IntegerObject::class, $gid); $this->assertSame($id, $gid->toString()); $this->assertSame($gid, $provider->getGid()); } @@ -419,13 +415,17 @@ class SystemDceSecurityProviderTest extends TestCase $gid = $provider->getGid(); - $this->assertInstanceOf(IntegerObject::class, $gid); $this->assertSame($expectedId, $gid->toString()); $this->assertSame($gid, $provider->getGid()); } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideWindowsGoodNetUserAndWmicGroupValues(): array { @@ -458,7 +458,7 @@ class SystemDceSecurityProviderTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function providePosixTestValues(): array { @@ -474,7 +474,7 @@ class SystemDceSecurityProviderTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideWindowsBadValues(): array { @@ -490,7 +490,7 @@ class SystemDceSecurityProviderTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideWindowsBadGroupValues(): array { diff --git a/tests/Provider/Node/FallbackNodeProviderTest.php b/tests/Provider/Node/FallbackNodeProviderTest.php index 30c678f..f42180d 100644 --- a/tests/Provider/Node/FallbackNodeProviderTest.php +++ b/tests/Provider/Node/FallbackNodeProviderTest.php @@ -81,7 +81,6 @@ class FallbackNodeProviderTest extends TestCase foreach ($unserializedNodeProviderCollection as $nodeProvider) { $this->assertInstanceOf(NodeProviderInterface::class, $nodeProvider); - $this->assertInstanceOf(Hexadecimal::class, $nodeProvider->getNode()); } } } diff --git a/tests/Provider/Node/StaticNodeProviderTest.php b/tests/Provider/Node/StaticNodeProviderTest.php index e8665ca..5a6c47a 100644 --- a/tests/Provider/Node/StaticNodeProviderTest.php +++ b/tests/Provider/Node/StaticNodeProviderTest.php @@ -12,6 +12,8 @@ use Ramsey\Uuid\Type\Hexadecimal; class StaticNodeProviderTest extends TestCase { /** + * @param non-empty-string $expectedNode + * * @dataProvider provideNodeForTest */ public function testStaticNode(Hexadecimal $node, string $expectedNode): void @@ -22,7 +24,7 @@ class StaticNodeProviderTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideNodeForTest(): array { diff --git a/tests/Provider/Node/SystemNodeProviderTest.php b/tests/Provider/Node/SystemNodeProviderTest.php index a0b292e..f1daddf 100644 --- a/tests/Provider/Node/SystemNodeProviderTest.php +++ b/tests/Provider/Node/SystemNodeProviderTest.php @@ -401,6 +401,7 @@ class SystemNodeProviderTest extends TestCase /* Arrange */ $this->arrangeMockFunctions( function () { + /** @var non-empty-list $macs */ static $macs = ["00:00:00:00:00:00\n", "01:02:03:04:05:06\n"]; return array_shift($macs); @@ -654,11 +655,11 @@ class SystemNodeProviderTest extends TestCase self::MOCK_IS_READABLE => $isReadableAssert, ]; - array_walk($mockFunctionAsserts, function ($asserts, $key): void { + array_walk($mockFunctionAsserts, function (mixed $asserts, string $key): void { if ($asserts === null) { // Assert the function was never invoked. $this->assertEmpty($this->functionProxies[$key]->getInvocations()); - } elseif (is_array($asserts)) { + } elseif (is_array($asserts)) { /** @phpstan-ignore function.alreadyNarrowedType */ // Assert there was at least one invocation for this function. $this->assertNotEmpty($this->functionProxies[$key]->getInvocations()); @@ -686,7 +687,7 @@ class SystemNodeProviderTest extends TestCase /** * Provides the command that should be executed per supported OS * - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideCommandPerOs(): array { @@ -703,7 +704,7 @@ class SystemNodeProviderTest extends TestCase /** * Values that are NOT parsed to a mac address by the class under test * - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideInvalidNetStatOutput(): array { @@ -729,7 +730,7 @@ class SystemNodeProviderTest extends TestCase /** * Provides notations that the class under test should NOT attempt to strip * - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideInvalidNotationalFormats(): array { @@ -749,7 +750,7 @@ class SystemNodeProviderTest extends TestCase /** * Provides mac addresses that the class under test should strip notational format from * - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideNotationalFormats(): array { @@ -762,168 +763,172 @@ class SystemNodeProviderTest extends TestCase /** * Values that are parsed to a mac address by the class under test * - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideValidNetStatOutput(): array { return [ /* Full output of related command */ - 'Full output - Linux' => [<<<'TXT' - Kernel Interface table - docker0 Link encap:Ethernet HWaddr 01:23:45:67:89:ab - inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0 - UP BROADCAST MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) + 'Full output - Linux' => [ + <<<'TXT' + Kernel Interface table + docker0 Link encap:Ethernet HWaddr 01:23:45:67:89:ab + inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0 + UP BROADCAST MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) - enp3s0 Link encap:Ethernet HWaddr fe:dc:ba:98:76:54 - inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0 - inet6 addr: ffee::ddcc:bbaa:9988:7766/64 Scope:Link - UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 - RX packets:943077 errors:0 dropped:0 overruns:0 frame:0 - TX packets:2168039 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:1000 - RX bytes:748596414 (748.5 MB) TX bytes:2930448282 (2.9 GB) + enp3s0 Link encap:Ethernet HWaddr fe:dc:ba:98:76:54 + inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0 + inet6 addr: ffee::ddcc:bbaa:9988:7766/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:943077 errors:0 dropped:0 overruns:0 frame:0 + TX packets:2168039 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:748596414 (748.5 MB) TX bytes:2930448282 (2.9 GB) - lo Link encap:Local Loopback - inet addr:127.0.0.1 Mask:255.0.0.0 - inet6 addr: ::1/128 Scope:Host - UP LOOPBACK RUNNING MTU:65536 Metric:1 - RX packets:8302 errors:0 dropped:0 overruns:0 frame:0 - TX packets:8302 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:1000 - RX bytes:1094983 (1.0 MB) TX bytes:1094983 (1.0 MB) -TXT - , '0123456789ab', + lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:65536 Metric:1 + RX packets:8302 errors:0 dropped:0 overruns:0 frame:0 + TX packets:8302 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:1094983 (1.0 MB) TX bytes:1094983 (1.0 MB) + TXT, + '0123456789ab', ], - 'Full output - MacOS' => [<<<'TXT' - lo0: flags=8049 mtu 16384 - options=1203 - inet 127.0.0.1 netmask 0xff000000 - inet6 ::1 prefixlen 128 - inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 - nd6 options=201 - gif0: flags=8010 mtu 1280 - stf0: flags=0<> mtu 1280 - EHC29: flags=0<> mtu 0 - XHC20: flags=0<> mtu 0 - EHC26: flags=0<> mtu 0 - aa0: flags=8863 mtu 1500 - options=10b - ether 00:00:00:00:00:00 - status: active - en0: flags=8863 mtu 1500 - options=10b - ether 10:dd:b1:b4:e4:8e - inet6 fe80::c70:76f5:aa1:5db1%en0 prefixlen 64 secured scopeid 0x7 - inet 10.53.8.112 netmask 0xfffffc00 broadcast 10.53.11.255 - nd6 options=201 - media: autoselect (1000baseT ) - status: active - en1: flags=8863 mtu 1500 - ether ec:35:86:38:c8:c2 - inet6 fe80::aa:d44f:5f5f:7fd4%en1 prefixlen 64 secured scopeid 0x8 - inet 10.53.17.196 netmask 0xfffffc00 broadcast 10.53.19.255 - nd6 options=201 - media: autoselect - status: active - p2p0: flags=8843 mtu 2304 - ether 0e:35:86:38:c8:c2 - media: autoselect - status: inactive - awdl0: flags=8943 mtu 1484 - ether ea:ab:ae:25:f5:d0 - inet6 fe80::e8ab:aeff:fe25:f5d0%awdl0 prefixlen 64 scopeid 0xa - nd6 options=201 - media: autoselect - status: active - en2: flags=8963 mtu 1500 - options=60 - ether 32:00:18:9b:dc:60 - media: autoselect - status: inactive - en3: flags=8963 mtu 1500 - options=60 - ether 32:00:18:9b:dc:61 - media: autoselect - status: inactive - bridge0: flags=8822 mtu 1500 - options=63 - ether 32:00:18:9b:dc:60 - Configuration: - id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0 - maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200 - root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0 - ipfilter disabled flags 0x2 - member: en2 flags=3 - ifmaxaddr 0 port 11 priority 0 path cost 0 - member: en3 flags=3 - ifmaxaddr 0 port 12 priority 0 path cost 0 - media: - status: inactive - utun0: flags=8051 mtu 2000 - options=6403 - inet6 fe80::57c6:d692:9d41:d28f%utun0 prefixlen 64 scopeid 0xe - nd6 options=201 -TXT - , '10ddb1b4e48e', + 'Full output - MacOS' => [ + <<<'TXT' + lo0: flags=8049 mtu 16384 + options=1203 + inet 127.0.0.1 netmask 0xff000000 + inet6 ::1 prefixlen 128 + inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 + nd6 options=201 + gif0: flags=8010 mtu 1280 + stf0: flags=0<> mtu 1280 + EHC29: flags=0<> mtu 0 + XHC20: flags=0<> mtu 0 + EHC26: flags=0<> mtu 0 + aa0: flags=8863 mtu 1500 + options=10b + ether 00:00:00:00:00:00 + status: active + en0: flags=8863 mtu 1500 + options=10b + ether 10:dd:b1:b4:e4:8e + inet6 fe80::c70:76f5:aa1:5db1%en0 prefixlen 64 secured scopeid 0x7 + inet 10.53.8.112 netmask 0xfffffc00 broadcast 10.53.11.255 + nd6 options=201 + media: autoselect (1000baseT ) + status: active + en1: flags=8863 mtu 1500 + ether ec:35:86:38:c8:c2 + inet6 fe80::aa:d44f:5f5f:7fd4%en1 prefixlen 64 secured scopeid 0x8 + inet 10.53.17.196 netmask 0xfffffc00 broadcast 10.53.19.255 + nd6 options=201 + media: autoselect + status: active + p2p0: flags=8843 mtu 2304 + ether 0e:35:86:38:c8:c2 + media: autoselect + status: inactive + awdl0: flags=8943 mtu 1484 + ether ea:ab:ae:25:f5:d0 + inet6 fe80::e8ab:aeff:fe25:f5d0%awdl0 prefixlen 64 scopeid 0xa + nd6 options=201 + media: autoselect + status: active + en2: flags=8963 mtu 1500 + options=60 + ether 32:00:18:9b:dc:60 + media: autoselect + status: inactive + en3: flags=8963 mtu 1500 + options=60 + ether 32:00:18:9b:dc:61 + media: autoselect + status: inactive + bridge0: flags=8822 mtu 1500 + options=63 + ether 32:00:18:9b:dc:60 + Configuration: + id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0 + maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200 + root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0 + ipfilter disabled flags 0x2 + member: en2 flags=3 + ifmaxaddr 0 port 11 priority 0 path cost 0 + member: en3 flags=3 + ifmaxaddr 0 port 12 priority 0 path cost 0 + media: + status: inactive + utun0: flags=8051 mtu 2000 + options=6403 + inet6 fe80::57c6:d692:9d41:d28f%utun0 prefixlen 64 scopeid 0xe + nd6 options=201 + TXT, + '10ddb1b4e48e', ], - 'Full output - Window' => [<<<'TXT' - Windows IP Configuration + 'Full output - Window' => [ + <<<'TXT' + Windows IP Configuration - Host Name . . . . . . . . . . . . : MSEDGEWIN10 - Primary Dns Suffix . . . . . . . : - Node Type . . . . . . . . . . . . : Hybrid - IP Routing Enabled. . . . . . . . : No - WINS Proxy Enabled. . . . . . . . : No - DNS Suffix Search List. . . . . . : network.lan + Host Name . . . . . . . . . . . . : MSEDGEWIN10 + Primary Dns Suffix . . . . . . . : + Node Type . . . . . . . . . . . . : Hybrid + IP Routing Enabled. . . . . . . . : No + WINS Proxy Enabled. . . . . . . . : No + DNS Suffix Search List. . . . . . : network.lan - Some kind of adapter: + Some kind of adapter: - Connection-specific DNS Suffix . : network.foo - Description . . . . . . . . . . . : Some Adapter - Physical Address. . . . . . . . . : 00-00-00-00-00-00 + Connection-specific DNS Suffix . : network.foo + Description . . . . . . . . . . . : Some Adapter + Physical Address. . . . . . . . . : 00-00-00-00-00-00 - Ethernet adapter Ethernet: + Ethernet adapter Ethernet: - Connection-specific DNS Suffix . : network.lan - Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Desktop Adapter - Physical Address. . . . . . . . . : 08-00-27-B8-42-C6 - DHCP Enabled. . . . . . . . . . . : Yes - Autoconfiguration Enabled . . . . : Yes - Link-local IPv6 Address . . . . . : fe80::606a:ae33:7ce1:b5e9%3(Preferred) - IPv4 Address. . . . . . . . . . . : 10.0.2.15(Preferred) - Subnet Mask . . . . . . . . . . . : 255.255.255.0 - Lease Obtained. . . . . . . . . . : Tuesday, January 30, 2018 11:25:31 PM - Lease Expires . . . . . . . . . . : Wednesday, January 31, 2018 11:25:27 PM - Default Gateway . . . . . . . . . : 10.0.2.2 - DHCP Server . . . . . . . . . . . : 10.0.2.2 - DHCPv6 IAID . . . . . . . . . . . : 34078759 - DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-21-40-72-3F-08-00-27-B8-42-C6 - DNS Servers . . . . . . . . . . . : 10.0.2.3 - NetBIOS over Tcpip. . . . . . . . : Enabled + Connection-specific DNS Suffix . : network.lan + Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Desktop Adapter + Physical Address. . . . . . . . . : 08-00-27-B8-42-C6 + DHCP Enabled. . . . . . . . . . . : Yes + Autoconfiguration Enabled . . . . : Yes + Link-local IPv6 Address . . . . . : fe80::606a:ae33:7ce1:b5e9%3(Preferred) + IPv4 Address. . . . . . . . . . . : 10.0.2.15(Preferred) + Subnet Mask . . . . . . . . . . . : 255.255.255.0 + Lease Obtained. . . . . . . . . . : Tuesday, January 30, 2018 11:25:31 PM + Lease Expires . . . . . . . . . . : Wednesday, January 31, 2018 11:25:27 PM + Default Gateway . . . . . . . . . : 10.0.2.2 + DHCP Server . . . . . . . . . . . : 10.0.2.2 + DHCPv6 IAID . . . . . . . . . . . : 34078759 + DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-21-40-72-3F-08-00-27-B8-42-C6 + DNS Servers . . . . . . . . . . . : 10.0.2.3 + NetBIOS over Tcpip. . . . . . . . : Enabled - Tunnel adapter isatap.network.lan: + Tunnel adapter isatap.network.lan: - Media State . . . . . . . . . . . : Media disconnected - Connection-specific DNS Suffix . : network.lan - Description . . . . . . . . . . . : Microsoft ISATAP Adapter - Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0 - DHCP Enabled. . . . . . . . . . . : No - Autoconfiguration Enabled . . . . : Yes -TXT - , '080027b842c6', + Media State . . . . . . . . . . . : Media disconnected + Connection-specific DNS Suffix . : network.lan + Description . . . . . . . . . . . : Microsoft ISATAP Adapter + Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0 + DHCP Enabled. . . . . . . . . . . : No + Autoconfiguration Enabled . . . . : Yes + TXT, + '080027b842c6', ], - 'Full output - FreeBSD' => [<<<'TXT' - Name Mtu Network Address Ipkts Ierrs Idrop Opkts Oerrs Coll - aa0 0 00:00:00:00:00:00 0 0 0 0 0 0 - em0 1500 08:00:27:71:a1:00 65514 0 0 42918 0 0 - em1 1500 08:00:27:d0:60:a0 1199 0 0 535 0 0 - lo0 16384 lo0 4 0 0 4 0 0 -TXT - , '08002771a100', + 'Full output - FreeBSD' => [ + <<<'TXT' + Name Mtu Network Address Ipkts Ierrs Idrop Opkts Oerrs Coll + aa0 0 00:00:00:00:00:00 0 0 0 0 0 0 + em0 1500 08:00:27:71:a1:00 65514 0 0 42918 0 0 + em1 1500 08:00:27:d0:60:a0 1199 0 0 535 0 0 + lo0 16384 lo0 4 0 0 4 0 0 + TXT, + '08002771a100', ], /* The single line that is relevant */ diff --git a/tests/Provider/Time/SystemTimeProviderTest.php b/tests/Provider/Time/SystemTimeProviderTest.php index 4655aea..243af52 100644 --- a/tests/Provider/Time/SystemTimeProviderTest.php +++ b/tests/Provider/Time/SystemTimeProviderTest.php @@ -15,6 +15,7 @@ class SystemTimeProviderTest extends TestCase $provider = new SystemTimeProvider(); $time = $provider->getTime(); + /** @phpstan-ignore method.alreadyNarrowedType */ $this->assertInstanceOf(Time::class, $time); } } diff --git a/tests/Rfc4122/FieldsTest.php b/tests/Rfc4122/FieldsTest.php index 125575c..8a1267e 100644 --- a/tests/Rfc4122/FieldsTest.php +++ b/tests/Rfc4122/FieldsTest.php @@ -27,6 +27,8 @@ class FieldsTest extends TestCase } /** + * @param non-empty-string $uuid + * * @dataProvider nonRfc4122VariantProvider */ public function testConstructorThrowsExceptionIfNotRfc4122Variant(string $uuid): void @@ -42,7 +44,7 @@ class FieldsTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function nonRfc4122VariantProvider(): array { @@ -63,6 +65,8 @@ class FieldsTest extends TestCase } /** + * @param non-empty-string $uuid + * * @dataProvider invalidVersionProvider */ public function testConstructorThrowsExceptionIfInvalidVersion(string $uuid): void @@ -78,7 +82,7 @@ class FieldsTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function invalidVersionProvider(): array { @@ -95,12 +99,17 @@ class FieldsTest extends TestCase } /** - * @param string|int $expectedValue + * @param non-empty-string $uuid + * @param non-empty-string $methodName + * @param non-empty-string | int | bool | null $expectedValue * * @dataProvider fieldGetterMethodProvider */ - public function testFieldGetterMethods(string $uuid, string $methodName, $expectedValue): void - { + public function testFieldGetterMethods( + string $uuid, + string $methodName, + bool | int | string | null $expectedValue, + ): void { $bytes = (string) hex2bin(str_replace('-', '', $uuid)); $fields = new Fields($bytes); @@ -114,7 +123,7 @@ class FieldsTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function fieldGetterMethodProvider(): array { diff --git a/tests/Rfc4122/UuidBuilderTest.php b/tests/Rfc4122/UuidBuilderTest.php index 710ab73..9e53487 100644 --- a/tests/Rfc4122/UuidBuilderTest.php +++ b/tests/Rfc4122/UuidBuilderTest.php @@ -32,6 +32,7 @@ use function str_replace; class UuidBuilderTest extends TestCase { /** + * @param non-empty-string $uuid * @param class-string $expectedClass * * @dataProvider provideBuildTestValues @@ -56,7 +57,7 @@ class UuidBuilderTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideBuildTestValues(): array { diff --git a/tests/Rfc4122/UuidV1Test.php b/tests/Rfc4122/UuidV1Test.php index 41f5bb0..3e712c6 100644 --- a/tests/Rfc4122/UuidV1Test.php +++ b/tests/Rfc4122/UuidV1Test.php @@ -43,7 +43,7 @@ class UuidV1Test extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideTestVersions(): array { @@ -62,6 +62,7 @@ class UuidV1Test extends TestCase /** * @param non-empty-string $uuid + * @param numeric-string $expected * * @dataProvider provideUuidV1WithOddMicroseconds */ @@ -77,7 +78,7 @@ class UuidV1Test extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideUuidV1WithOddMicroseconds(): array { diff --git a/tests/Rfc4122/UuidV2Test.php b/tests/Rfc4122/UuidV2Test.php index 086e5dd..d6fa38c 100644 --- a/tests/Rfc4122/UuidV2Test.php +++ b/tests/Rfc4122/UuidV2Test.php @@ -54,7 +54,7 @@ class UuidV2Test extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideTestVersions(): array { @@ -114,7 +114,17 @@ class UuidV2Test extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * phpcs:ignore SlevomatCodingStandard.TypeHints.LongTypeHints.UsedLongTypeHint + * @return array */ public function provideLocalDomainAndIdentifierForTests(): array { diff --git a/tests/Rfc4122/UuidV3Test.php b/tests/Rfc4122/UuidV3Test.php index b9110ef..a6545ac 100644 --- a/tests/Rfc4122/UuidV3Test.php +++ b/tests/Rfc4122/UuidV3Test.php @@ -38,7 +38,7 @@ class UuidV3Test extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideTestVersions(): array { diff --git a/tests/Rfc4122/UuidV4Test.php b/tests/Rfc4122/UuidV4Test.php index f595346..2aed9d1 100644 --- a/tests/Rfc4122/UuidV4Test.php +++ b/tests/Rfc4122/UuidV4Test.php @@ -38,7 +38,7 @@ class UuidV4Test extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideTestVersions(): array { diff --git a/tests/Rfc4122/UuidV5Test.php b/tests/Rfc4122/UuidV5Test.php index a1270f2..265c533 100644 --- a/tests/Rfc4122/UuidV5Test.php +++ b/tests/Rfc4122/UuidV5Test.php @@ -38,7 +38,7 @@ class UuidV5Test extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideTestVersions(): array { diff --git a/tests/Rfc4122/UuidV6Test.php b/tests/Rfc4122/UuidV6Test.php index e9f74d6..079cac1 100644 --- a/tests/Rfc4122/UuidV6Test.php +++ b/tests/Rfc4122/UuidV6Test.php @@ -44,7 +44,7 @@ class UuidV6Test extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideTestVersions(): array { @@ -63,6 +63,7 @@ class UuidV6Test extends TestCase /** * @param non-empty-string $uuid + * @param non-empty-string $expected * * @dataProvider provideUuidV6WithOddMicroseconds */ @@ -78,7 +79,7 @@ class UuidV6Test extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideUuidV6WithOddMicroseconds(): array { @@ -146,7 +147,7 @@ class UuidV6Test extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideUuidV1UuidV6Equivalents(): array { diff --git a/tests/Rfc4122/ValidatorTest.php b/tests/Rfc4122/ValidatorTest.php index b3b2e8a..86f2d72 100644 --- a/tests/Rfc4122/ValidatorTest.php +++ b/tests/Rfc4122/ValidatorTest.php @@ -43,7 +43,7 @@ class ValidatorTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideValuesForValidation(): array { diff --git a/tests/Rfc4122/VariantTraitTest.php b/tests/Rfc4122/VariantTraitTest.php index 8883624..9f98610 100644 --- a/tests/Rfc4122/VariantTraitTest.php +++ b/tests/Rfc4122/VariantTraitTest.php @@ -34,7 +34,7 @@ class VariantTraitTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function invalidBytesProvider(): array { @@ -62,7 +62,7 @@ class VariantTraitTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function uuidVariantProvider(): array { diff --git a/tests/TestCase.php b/tests/TestCase.php index ed22f93..455a4a1 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -21,7 +21,7 @@ class TestCase extends PhpUnitTestCase public static function isLittleEndianSystem(): bool { - /** @var array $unpacked */ + /** @var int[] $unpacked */ $unpacked = unpack('v', pack('S', 0x00FF)); return current($unpacked) === 0x00FF; diff --git a/tests/UuidFactoryTest.php b/tests/UuidFactoryTest.php index 19ec914..c9ee5f1 100644 --- a/tests/UuidFactoryTest.php +++ b/tests/UuidFactoryTest.php @@ -158,7 +158,7 @@ class UuidFactoryTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideDateTime(): array { diff --git a/tests/UuidTest.php b/tests/UuidTest.php index feea5a0..cf17384 100644 --- a/tests/UuidTest.php +++ b/tests/UuidTest.php @@ -257,19 +257,16 @@ class UuidTest extends TestCase { // Check a recent date $uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66'); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('2012-07-04T02:14:34+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('1341368074.491000', $uuid->getDateTime()->format('U.u')); // Check an old date $uuid = Uuid::fromString('0901e600-0154-1000-9b21-0800200c9a66'); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('1582-10-16T16:34:04+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('-12219146756.000000', $uuid->getDateTime()->format('U.u')); // Check a future date $uuid = Uuid::fromString('ff9785f6-ffff-1fff-9669-00007ffffffe'); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('5236-03-31T21:20:59+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('103072857659.999999', $uuid->getDateTime()->format('U.u')); @@ -277,19 +274,16 @@ class UuidTest extends TestCase // See inline comments in // {@see \Ramsey\Uuid\Test\Converter\Time\GenericTimeConverterTest::provideCalculateTime()} $uuid = Uuid::fromString('fffffffa-ffff-1fff-8b1e-acde48001122'); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('5236-03-31T21:21:00+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('103072857660.684697', $uuid->getDateTime()->format('U.u')); // Check the oldest date $uuid = Uuid::fromString('00000000-0000-1000-9669-00007ffffffe'); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('1582-10-15T00:00:00+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('-12219292800.000000', $uuid->getDateTime()->format('U.u')); // The Unix epoch $uuid = Uuid::fromString('13814000-1dd2-11b2-9669-00007ffffffe'); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('1970-01-01T00:00:00+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('0.000000', $uuid->getDateTime()->format('U.u')); } @@ -298,19 +292,16 @@ class UuidTest extends TestCase { // Check a recent date $uuid = Uuid::fromString('1e1c57df-f6f8-6cb0-9b21-0800200c9a66'); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('2012-07-04T02:14:34+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('1341368074.491000', $uuid->getDateTime()->format('U.u')); // Check an old date $uuid = Uuid::fromString('00001540-901e-6600-9b21-0800200c9a66'); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('1582-10-16T16:34:04+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('-12219146756.000000', $uuid->getDateTime()->format('U.u')); // Check a future date $uuid = Uuid::fromString('ffffffff-f978-65f6-9669-00007ffffffe'); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('5236-03-31T21:20:59+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('103072857659.999999', $uuid->getDateTime()->format('U.u')); @@ -318,19 +309,16 @@ class UuidTest extends TestCase // See inline comments in // {@see \Ramsey\Uuid\Test\Converter\Time\GenericTimeConverterTest::provideCalculateTime()} $uuid = Uuid::fromString('ffffffff-ffff-6ffa-8b1e-acde48001122'); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('5236-03-31T21:21:00+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('103072857660.684697', $uuid->getDateTime()->format('U.u')); // Check the oldest date $uuid = Uuid::fromString('00000000-0000-6000-9669-00007ffffffe'); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('1582-10-15T00:00:00+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('-12219292800.000000', $uuid->getDateTime()->format('U.u')); // The Unix epoch $uuid = Uuid::fromString('1b21dd21-3814-6000-9669-00007ffffffe'); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('1970-01-01T00:00:00+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('0.000000', $uuid->getDateTime()->format('U.u')); } @@ -516,7 +504,7 @@ class UuidTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideVariousVariantUuids(): array { @@ -594,7 +582,6 @@ class UuidTest extends TestCase public function testUuid1(): void { $uuid = Uuid::uuid1(); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame(2, $uuid->getVariant()); $this->assertSame(1, $uuid->getVersion()); } @@ -688,7 +675,6 @@ class UuidTest extends TestCase Uuid::setFactory(new UuidFactory(new FeatureSet(false, false, false, true))); $uuid = Uuid::uuid1(); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame(2, $uuid->getVariant()); $this->assertSame(1, $uuid->getVersion()); } @@ -696,7 +682,6 @@ class UuidTest extends TestCase public function testUuid1WithUserGeneratedRandomNode(): void { $uuid = Uuid::uuid1(new Hexadecimal((string) (new RandomNodeProvider())->getNode())); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame(2, $uuid->getVariant()); $this->assertSame(1, $uuid->getVersion()); } @@ -704,7 +689,6 @@ class UuidTest extends TestCase public function testUuid6(): void { $uuid = Uuid::uuid6(); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame(2, $uuid->getVariant()); $this->assertSame(6, $uuid->getVersion()); } @@ -712,7 +696,6 @@ class UuidTest extends TestCase public function testUuid6WithNodeAndClockSequence(): void { $uuid = Uuid::uuid6(new Hexadecimal('0800200c9a66'), 0x1669); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame(2, $uuid->getVariant()); $this->assertSame(6, $uuid->getVersion()); $this->assertSame('1669', $uuid->getClockSequenceHex()); @@ -724,7 +707,6 @@ class UuidTest extends TestCase { $uuid = Uuid::uuid6(new Hexadecimal('7160355e')); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame(2, $uuid->getVariant()); $this->assertSame(6, $uuid->getVersion()); $this->assertSame('00007160355e', $uuid->getNodeHex()); @@ -734,7 +716,6 @@ class UuidTest extends TestCase { $uuid = Uuid::uuid6(new Hexadecimal('71B0aD5e')); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame(2, $uuid->getVariant()); $this->assertSame(6, $uuid->getVersion()); $this->assertSame('000071b0ad5e', $uuid->getNodeHex()); @@ -761,7 +742,6 @@ class UuidTest extends TestCase Uuid::setFactory(new UuidFactory(new FeatureSet(false, false, false, true))); $uuid = Uuid::uuid6(); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame(2, $uuid->getVariant()); $this->assertSame(6, $uuid->getVersion()); } @@ -769,7 +749,6 @@ class UuidTest extends TestCase public function testUuid6WithUserGeneratedRandomNode(): void { $uuid = Uuid::uuid6(new Hexadecimal((string) (new RandomNodeProvider())->getNode())); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame(2, $uuid->getVariant()); $this->assertSame(6, $uuid->getVersion()); } @@ -777,7 +756,6 @@ class UuidTest extends TestCase public function testUuid7(): void { $uuid = Uuid::uuid7(); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame(2, $uuid->getVariant()); $this->assertSame(7, $uuid->getVersion()); } @@ -800,7 +778,6 @@ class UuidTest extends TestCase $dateTime = new DateTimeImmutable('@281474976710.655'); $uuid = Uuid::uuid7($dateTime); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame(2, $uuid->getVariant()); $this->assertSame(7, $uuid->getVersion()); $this->assertSame( @@ -833,7 +810,6 @@ class UuidTest extends TestCase $dateTime = new DateTimeImmutable('1979-01-01 00:00:00.000000'); $uuid = Uuid::uuid7($dateTime); - $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame(2, $uuid->getVariant()); $this->assertSame(7, $uuid->getVersion()); $this->assertSame( @@ -896,6 +872,7 @@ class UuidTest extends TestCase * * @param non-empty-string $uuid * @param non-empty-string $ns + * @param non-empty-string $name * * @dataProvider provideUuid3WithKnownUuids */ @@ -911,7 +888,7 @@ class UuidTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideUuid3WithKnownUuids(): array { @@ -954,7 +931,7 @@ class UuidTest extends TestCase $mock = $this->getMockBuilder(RandomGeneratorInterface::class)->getMock(); $mock->expects($this->any()) ->method('generate') - ->willReturnCallback(function ($length) { + ->willReturnCallback(function (int $length) { // Makes first fields of UUIDs equal return hex2bin(str_pad('', $length * 2, '0')); }); @@ -984,7 +961,7 @@ class UuidTest extends TestCase $mock = $this->getMockBuilder(RandomGeneratorInterface::class)->getMock(); $mock->expects($this->any()) ->method('generate') - ->willReturnCallback(function ($length) { + ->willReturnCallback(function (int $length) { // Makes first fields of UUIDs equal return hex2bin(str_pad('', $length * 2, '0')); }); @@ -1032,6 +1009,7 @@ class UuidTest extends TestCase * * @param non-empty-string $uuid * @param non-empty-string $ns + * @param non-empty-string $name * * @dataProvider provideUuid5WithKnownUuids */ @@ -1047,7 +1025,7 @@ class UuidTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideUuid5WithKnownUuids(): array { @@ -1365,8 +1343,12 @@ class UuidTest extends TestCase * @param non-empty-string $string * @param non-empty-string $curly * @param non-empty-string $hex + * @param non-empty-string $bytes + * @param non-empty-string $int * @param string[] $fields * @param non-empty-string $urn + * @param non-empty-string $time + * @param non-empty-string $clockSeq * * @dataProvider providePythonTests */ @@ -1419,7 +1401,19 @@ class UuidTest extends TestCase * Taken from the Python UUID tests in * http://hg.python.org/cpython/file/2f4c4db9aee5/Lib/test/test_uuid.py * - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array, + * urn: non-empty-string, + * time: non-empty-string, + * clock_seq: non-empty-string, + * variant: int, + * version: int | null, + * }> */ public function providePythonTests(): array { @@ -1886,7 +1880,7 @@ class UuidTest extends TestCase } /** - * @param mixed[] $args + * @param array $args * * @dataProvider provideStaticMethods */ @@ -1898,7 +1892,7 @@ class UuidTest extends TestCase } /** - * @param mixed[] $args + * @param array $args * * @dataProvider provideStaticMethods */ @@ -1906,6 +1900,7 @@ class UuidTest extends TestCase string $staticMethod, array $args = [] ): void { + /** @var UuidInterface $generated */ $generated = Uuid::$staticMethod(...$args); self::assertSame( @@ -1915,7 +1910,7 @@ class UuidTest extends TestCase } /** - * @param mixed[] $args + * @param array $args * * @dataProvider provideStaticMethods */ @@ -1923,6 +1918,7 @@ class UuidTest extends TestCase string $staticMethod, array $args = [] ): void { + /** @var UuidInterface $generated */ $generated = Uuid::$staticMethod(...$args); self::assertSame( @@ -1932,7 +1928,7 @@ class UuidTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array}> */ public function provideStaticMethods(): array { diff --git a/tests/Validator/GenericValidatorTest.php b/tests/Validator/GenericValidatorTest.php index 4a41330..609ea8c 100644 --- a/tests/Validator/GenericValidatorTest.php +++ b/tests/Validator/GenericValidatorTest.php @@ -34,7 +34,7 @@ class GenericValidatorTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function provideValuesForValidation(): array {