diff --git a/.editorconfig b/.editorconfig index f329996b..ea598e18 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,13 +17,11 @@ block_comment_end = */ [{*.yml,*.yaml}] indent_size = 2 +[*.neon] +indent_style = tab + [*.md] trim_trailing_whitespace = false [Makefile] indent_style = tab - -# Generated file -[infection.txt] -indent_size = unset -trim_trailing_whitespace = unset diff --git a/.gitattributes b/.gitattributes index 9110ea10..55d158dc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10,6 +10,7 @@ /infection.json.dist export-ignore /Makefile export-ignore /phpstan.neon export-ignore +/phpstan-baseline.neon export-ignore /phpunit.xml.dist export-ignore /rector.php export-ignore /infection.txt export-ignore diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 322fb4a9..7cf6a96a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,19 +1,19 @@ version: 2 updates: - - package-ecosystem: composer - directory: "/" - schedule: - interval: "weekly" - day: "friday" - versioning-strategy: auto - open-pull-requests-limit: 20 - allow: - - dependency-type: all - labels: ["Dependencies"] + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "weekly" + day: "friday" + versioning-strategy: "widen" + open-pull-requests-limit: 20 + allow: + - dependency-type: all + labels: [ "dependencies" ] - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "monthly" - open-pull-requests-limit: 20 - labels: ["Dependencies"] + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 20 + labels: [ "dependencies" ] diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 00000000..ece783e6 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,76 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "*.*.x" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "4.6.x", "4.7.x" ] + schedule: + - cron: '37 10 * * 4' + +jobs: + analyze: + name: Analyze + runs-on: ${{ 'ubuntu-latest' }} + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Use only 'java' to analyze code written in Java, Kotlin or both + # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 00000000..4e751977 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,20 @@ +# Dependency Review Action +# +# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging. +# +# Source repository: https://github.com/actions/dependency-review-action +# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement +name: 'Dependency Review' +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: 'Checkout Repository' + uses: actions/checkout@v4 + - name: 'Dependency Review' + uses: actions/dependency-review-action@v3 diff --git a/.github/workflows/integrate.yml b/.github/workflows/integrate.yml index 89acd1ab..1f10ac15 100644 --- a/.github/workflows/integrate.yml +++ b/.github/workflows/integrate.yml @@ -31,7 +31,7 @@ jobs: - name: "Set up PHP" uses: "shivammathur/setup-php@v2" with: - php-version: "8.1" + php-version: "8.3" - name: "Checkout code" uses: "actions/checkout@v3" @@ -55,6 +55,8 @@ jobs: - "ubuntu-latest" php-version: - "8.1" + - "8.2" + - "8.3" dependencies: - "lowest" - "highest" @@ -77,7 +79,7 @@ jobs: composer-options: "--optimize-autoloader" - name: "Execute tests (PHP)" - run: "make ci-cc" + run: "make ci-test" # - name: Send coverage to Coveralls # if: "matrix.php-version == '8.1' && matrix.dependencies == 'highest'" @@ -97,7 +99,7 @@ jobs: - name: "Set up PHP" uses: "shivammathur/setup-php@v2" with: - php-version: "8.1" + php-version: "8.3" extensions: "json, mbstring, openssl, sqlite3, curl, uuid" - name: "Checkout code" @@ -125,7 +127,7 @@ jobs: - name: "Set up PHP" uses: "shivammathur/setup-php@v2" with: - php-version: "8.1" + php-version: "8.3" extensions: "json, mbstring, openssl, sqlite3, curl, uuid" - name: "Checkout code" @@ -153,7 +155,7 @@ jobs: - name: "Set up PHP" uses: "shivammathur/setup-php@v2" with: - php-version: "8.1" + php-version: "8.3" extensions: "json, mbstring, openssl, sqlite3, curl, uuid" - name: "Checkout code" @@ -181,7 +183,7 @@ jobs: - name: "Set up PHP" uses: "shivammathur/setup-php@v2" with: - php-version: "8.1" + php-version: "8.3" extensions: "json, mbstring, openssl, sqlite3, curl, uuid" coverage: "xdebug" diff --git a/.github/workflows/lock-closed-issues.yml b/.github/workflows/lock-closed-issues.yml new file mode 100644 index 00000000..c2b017b9 --- /dev/null +++ b/.github/workflows/lock-closed-issues.yml @@ -0,0 +1,23 @@ +name: 'Lock Issues' + +on: + schedule: + - cron: '0 0 * * *' + +jobs: + lock: + runs-on: ubuntu-latest + steps: + - uses: dessant/lock-threads@v5 + with: + github-token: ${{ github.token }} + issue-inactive-days: '31' + exclude-issue-created-before: '' + exclude-any-issue-labels: '' + add-issue-labels: '' + issue-comment: > + This thread has been automatically locked since there has not been + any recent activity after it was closed. Please open a new issue for + related bugs. + issue-lock-reason: 'resolved' + process-only: 'issues' diff --git a/.github/workflows/merge-me.yml b/.github/workflows/merge-me.yml deleted file mode 100644 index fe24cff2..00000000 --- a/.github/workflows/merge-me.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Merge me! - -on: - check_suite: - types: - - completed - -jobs: - merge-me: - name: Merge me! - runs-on: ubuntu-latest - steps: - - name: Merge me! - uses: ridedott/merge-me-action@v2 - with: - # Depending on branch protection rules, a manually populated - # `GITHUB_TOKEN_WORKAROUND` environment variable with permissions to - # push to a protected branch must be used. This variable can have an - # arbitrary name, as an example, this repository uses - # `GITHUB_TOKEN_DOTTBOTT`. - # - # When using a custom token, it is recommended to leave the following - # comment for other developers to be aware of the reasoning behind it: - # - # This must be used as GitHub Actions token does not support - # pushing to protected branches. - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MERGE_METHOD: MERGE diff --git a/.github/workflows/release-on-milestone-closed.yml b/.github/workflows/release-on-milestone-closed.yml index 11146542..b9986a89 100644 --- a/.github/workflows/release-on-milestone-closed.yml +++ b/.github/workflows/release-on-milestone-closed.yml @@ -9,12 +9,12 @@ on: jobs: release: - name: "GIT tag, release & create merge-up PR" + name: "Release" runs-on: ubuntu-latest steps: - name: "Checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: "Release" uses: "laminas/automatic-releases@1.24.0" @@ -27,6 +27,16 @@ jobs: "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} + merge-up: + name: "Create Merge-Up Pull Request" + runs-on: ubuntu-latest + if: ${{ always() }} + needs: "release" + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + - name: "Create Merge-Up Pull Request" uses: "laminas/automatic-releases@1.24.0" with: @@ -38,6 +48,16 @@ jobs: "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} + switch: + name: "Create and/or Switch to new Release Branch" + runs-on: ubuntu-latest + if: ${{ always() }} + needs: "merge-up" + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + - name: "Create and/or Switch to new Release Branch" uses: "laminas/automatic-releases@1.24.0" with: @@ -49,6 +69,18 @@ jobs: "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} + bump: + name: "Bump Changelog Version On Originating Release Branch" + runs-on: ubuntu-latest + if: ${{ always() }} + needs: "switch" + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + with: + fetch-depth: 0 + - name: "Bump Changelog Version On Originating Release Branch" uses: "laminas/automatic-releases@1.24.0" with: @@ -60,6 +92,16 @@ jobs: "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} + milestones: + name: "Create new milestones" + runs-on: ubuntu-latest + if: ${{ always() }} + needs: "bump" + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + - name: "Create new milestones" uses: "laminas/automatic-releases@1.24.0" with: diff --git a/Makefile b/Makefile index 48362176..a44b0f45 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,15 @@ +.PHONY: mu +mu: vendor ## Mutation tests + vendor/bin/infection -v -s --threads=$$(nproc) --min-msi=45 --min-covered-msi=60 + .PHONY: tests tests: vendor ## Run all tests - vendor/bin/phpunit --color + bin/phpunit --color yarn test .PHONY: cc cc: vendor ## Show test coverage rates (HTML) - vendor/bin/phpunit --coverage-html ./build + XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html ./build .PHONY: cs cs: vendor ## Fix all files using defined ECS rules @@ -13,26 +17,32 @@ cs: vendor ## Fix all files using defined ECS rules .PHONY: st st: vendor ## Run static analyse - vendor/bin/phpstan analyse + XDEBUG_MODE=off vendor/bin/phpstan analyse + ################################################ -ci-mu: vendor ## Mutation tests (for Github only) - vendor/bin/infection --logger-github -s --threads=$$(nproc) --min-msi=80 --min-covered-msi=80 +.PHONY: ci-mu +ci-mu: vendor ## Mutation tests (for CI/CD only) + vendor/bin/infection --logger-github -s --threads=$$(nproc) --min-msi=45 --min-covered-msi=60 + +.PHONY: ci-test +ci-test: vendor ## Show test coverage rates (for CI/CD only) + XDEBUG_MODE=off vendor/bin/phpunit .PHONY: ci-cc ci-cc: vendor ## Show test coverage rates (for CI/CD only) - vendor/bin/phpunit --coverage-text + XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text .PHONY: ci-cs ci-cs: vendor ## Check all files using defined ECS rules (for CI/CD only) - vendor/bin/ecs check + XDEBUG_MODE=off vendor/bin/ecs check ################################################ .PHONY: rector rector: vendor ## Check all files using Rector - vendor/bin/rector process --ansi --dry-run --xdebug + XDEBUG_MODE=off vendor/bin/rector process --ansi --dry-run --xdebug vendor: composer.json composer validate diff --git a/composer.json b/composer.json index d05d1f73..1f5f3192 100644 --- a/composer.json +++ b/composer.json @@ -51,26 +51,27 @@ "require": { "php": ">=8.1", "ext-mbstring": "*", - "brick/math": "^0.10 || ^0.11" + "brick/math": "^0.10|^0.11|^0.12" }, "require-dev": { "ext-gmp": "*", "ext-openssl": "*", "ekino/phpstan-banned-code": "^1.0", - "infection/infection": "^0.26", + "infection/infection": "^0.27", "php-parallel-lint/php-parallel-lint": "^1.3", + "phpstan/extension-installer": "^1.3", "phpstan/phpstan": "^1.8", "phpstan/phpstan-beberlei-assert": "^1.0", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.1", "phpstan/phpstan-strict-rules": "^1.3", - "rector/rector": "^0.15", + "rector/rector": "^0.19", "roave/security-advisories": "dev-latest", - "symfony/phpunit-bridge": "^6.1", - "symfony/var-dumper": "^6.1", - "symplify/easy-coding-standard": "^11.1", - "thecodingmachine/phpstan-safe-rule": "^1.2", - "phpunit/phpunit": "^10.0" + "symfony/phpunit-bridge": "^6.4|^7.0", + "symfony/string": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0", + "symplify/easy-coding-standard": "^12.0", + "phpunit/phpunit": "^10.1" }, "suggest": { "ext-openssl": "For OpenSSL based cyphering", @@ -89,7 +90,8 @@ }, "config": { "allow-plugins": { - "infection/extension-installer": true + "infection/extension-installer": true, + "phpstan/extension-installer": true } } } diff --git a/ecs.php b/ecs.php index e34a2a00..5dc33aa2 100644 --- a/ecs.php +++ b/ecs.php @@ -30,9 +30,8 @@ use Symplify\EasyCodingStandard\Config\ECSConfig; use Symplify\EasyCodingStandard\ValueObject\Set\SetList; -$header = ''; - -return static function (ECSConfig $config) use ($header): void { +return static function (ECSConfig $config): void { + $header = ''; $config->import(SetList::PSR_12); $config->import(SetList::CLEAN_CODE); $config->import(SetList::DOCTRINE_ANNOTATIONS); @@ -88,12 +87,8 @@ 'import_functions' => true, ]); - $config->services() - ->remove(PhpUnitTestClassRequiresCoversFixer::class); + $config->skip([PhpUnitTestClassRequiresCoversFixer::class]); $config->parallel(); - $config->paths([ - __DIR__ . '/src', - __DIR__ . '/tests', - ]); + $config->paths([__DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/ecs.php', __DIR__ . '/rector.php']); }; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 00000000..2aed0f87 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,836 @@ +parameters: + ignoreErrors: + - + message: "#^Method SpomkyLabs\\\\Pki\\\\ASN1\\\\Element\\:\\:expectTagged\\(\\) should return SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\TaggedType but returns \\$this\\(SpomkyLabs\\\\Pki\\\\ASN1\\\\Element\\)\\.$#" + count: 1 + path: src/ASN1/Element.php + + - + message: "#^Call to an undefined method SpomkyLabs\\\\Pki\\\\ASN1\\\\Element\\:\\:string\\(\\)\\.$#" + count: 1 + path: src/ASN1/Type/Constructed/ConstructedString.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Constructed\\\\Set\\:\\:decodeFromDER\\(\\) should return SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Constructed\\\\Set but returns SpomkyLabs\\\\Pki\\\\ASN1\\\\Feature\\\\ElementBase\\.$#" + count: 1 + path: src/ASN1/Type/Constructed/Set.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\PrimitiveString\\:\\:decodeFromDER\\(\\) should return static\\(SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\PrimitiveString\\) but returns SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\PrimitiveString\\.$#" + count: 1 + path: src/ASN1/Type/PrimitiveString.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Structure implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/ASN1/Type/Structure.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Structure\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/ASN1/Type/Structure.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Structure\\:\\:getTagged\\(\\) should return SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\TaggedType but returns SpomkyLabs\\\\Pki\\\\ASN1\\\\Element\\.$#" + count: 1 + path: src/ASN1/Type/Structure.php + + - + message: "#^Offset int might not exist on array\\\\|null\\.$#" + count: 1 + path: src/ASN1/Type/Structure.php + + - + message: "#^Parameter \\#2 \\$key_algo of method SpomkyLabs\\\\Pki\\\\CryptoBridge\\\\Crypto\\\\OpenSSLCrypto\\:\\:_checkSignatureAlgoAndKey\\(\\) expects SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\AlgorithmIdentifier, SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Feature\\\\AlgorithmIdentifierType given\\.$#" + count: 2 + path: src/CryptoBridge/Crypto/OpenSSLCrypto.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\CryptoEncoding\\\\PEMBundle implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/CryptoEncoding/PEMBundle.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\CryptoEncoding\\\\PEMBundle\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/CryptoEncoding/PEMBundle.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Asymmetric\\\\ECPublicKeyAlgorithmIdentifier\\:\\:paramsASN1\\(\\) never returns null so it can be removed from the return type\\.$#" + count: 1 + path: src/CryptoTypes/AlgorithmIdentifier/Asymmetric/ECPublicKeyAlgorithmIdentifier.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Asymmetric\\\\RSAEncryptionAlgorithmIdentifier\\:\\:paramsASN1\\(\\) never returns null so it can be removed from the return type\\.$#" + count: 1 + path: src/CryptoTypes/AlgorithmIdentifier/Asymmetric/RSAEncryptionAlgorithmIdentifier.php + + - + message: "#^Parameter \\#2 \\$initializationVector of method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Cipher\\\\CipherAlgorithmIdentifier\\:\\:__construct\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/AlgorithmIdentifier/Cipher/AES192CBCAlgorithmIdentifier.php + + - + message: "#^Parameter \\#2 \\$initializationVector of method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Cipher\\\\CipherAlgorithmIdentifier\\:\\:__construct\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/AlgorithmIdentifier/Cipher/AES256CBCAlgorithmIdentifier.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Cipher\\\\DESCBCAlgorithmIdentifier\\:\\:paramsASN1\\(\\) never returns null so it can be removed from the return type\\.$#" + count: 1 + path: src/CryptoTypes/AlgorithmIdentifier/Cipher/DESCBCAlgorithmIdentifier.php + + - + message: "#^Parameter \\#1 \\$iv of method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Cipher\\\\CipherAlgorithmIdentifier\\:\\:_checkIVSize\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/AlgorithmIdentifier/Cipher/DESCBCAlgorithmIdentifier.php + + - + message: "#^Parameter \\#2 \\$initializationVector of method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Cipher\\\\CipherAlgorithmIdentifier\\:\\:__construct\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/AlgorithmIdentifier/Cipher/DESCBCAlgorithmIdentifier.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Cipher\\\\DESEDE3CBCAlgorithmIdentifier\\:\\:paramsASN1\\(\\) never returns null so it can be removed from the return type\\.$#" + count: 1 + path: src/CryptoTypes/AlgorithmIdentifier/Cipher/DESEDE3CBCAlgorithmIdentifier.php + + - + message: "#^Parameter \\#1 \\$iv of method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Cipher\\\\CipherAlgorithmIdentifier\\:\\:_checkIVSize\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/AlgorithmIdentifier/Cipher/DESEDE3CBCAlgorithmIdentifier.php + + - + message: "#^Parameter \\#2 \\$initializationVector of method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Cipher\\\\CipherAlgorithmIdentifier\\:\\:__construct\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/AlgorithmIdentifier/Cipher/DESEDE3CBCAlgorithmIdentifier.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Cipher\\\\RC2CBCAlgorithmIdentifier\\:\\:paramsASN1\\(\\) never returns null so it can be removed from the return type\\.$#" + count: 1 + path: src/CryptoTypes/AlgorithmIdentifier/Cipher/RC2CBCAlgorithmIdentifier.php + + - + message: "#^Parameter \\#1 \\$iv of method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Cipher\\\\CipherAlgorithmIdentifier\\:\\:_checkIVSize\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/AlgorithmIdentifier/Cipher/RC2CBCAlgorithmIdentifier.php + + - + message: "#^Parameter \\#2 \\$initializationVector of method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Cipher\\\\CipherAlgorithmIdentifier\\:\\:__construct\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/AlgorithmIdentifier/Cipher/RC2CBCAlgorithmIdentifier.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Hash\\\\RFC4231HMACAlgorithmIdentifier\\:\\:paramsASN1\\(\\) should return SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Primitive\\\\NullType\\|null but returns SpomkyLabs\\\\Pki\\\\ASN1\\\\Element\\|null\\.$#" + count: 1 + path: src/CryptoTypes/AlgorithmIdentifier/Hash/RFC4231HMACAlgorithmIdentifier.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\EC\\\\ECPrivateKey\\:\\:namedCurve\\(\\) should return string but returns string\\|null\\.$#" + count: 1 + path: src/CryptoTypes/Asymmetric/EC/ECPrivateKey.php + + - + message: "#^Parameter \\#1 \\$ecPoint of static method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\EC\\\\ECPublicKey\\:\\:create\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/Asymmetric/EC/ECPrivateKey.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\EC\\\\ECPublicKey\\:\\:namedCurve\\(\\) should return string but returns string\\|null\\.$#" + count: 1 + path: src/CryptoTypes/Asymmetric/EC/ECPublicKey.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\OneAsymmetricKey\\:\\:attributes\\(\\) should return SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\Attribute\\\\OneAsymmetricKeyAttributes but returns SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\Attribute\\\\OneAsymmetricKeyAttributes\\|null\\.$#" + count: 1 + path: src/CryptoTypes/Asymmetric/OneAsymmetricKey.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\OneAsymmetricKey\\:\\:fromASN1\\(\\) should return static\\(SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\OneAsymmetricKey\\) but returns SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\OneAsymmetricKey\\.$#" + count: 1 + path: src/CryptoTypes/Asymmetric/OneAsymmetricKey.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\OneAsymmetricKey\\:\\:fromPrivateKey\\(\\) should return static\\(SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\OneAsymmetricKey\\) but returns SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\OneAsymmetricKey\\.$#" + count: 1 + path: src/CryptoTypes/Asymmetric/OneAsymmetricKey.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\OneAsymmetricKey\\:\\:publicKeyData\\(\\) should return SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Primitive\\\\BitString but returns SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Primitive\\\\BitString\\|null\\.$#" + count: 1 + path: src/CryptoTypes/Asymmetric/OneAsymmetricKey.php + + - + message: "#^Parameter \\#2 \\$publicKey of static method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\PublicKeyInfo\\:\\:create\\(\\) expects SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Primitive\\\\BitString, SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Primitive\\\\BitString\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/Asymmetric/OneAsymmetricKey.php + + - + message: "#^Parameter \\#1 \\$publicKey of static method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\RFC8410\\\\Curve25519\\\\Ed25519PublicKey\\:\\:create\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/Asymmetric/RFC8410/Curve25519/Ed25519PrivateKey.php + + - + message: "#^Parameter \\#1 \\$publicKey of static method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\RFC8410\\\\Curve25519\\\\X25519PublicKey\\:\\:create\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/Asymmetric/RFC8410/Curve25519/X25519PrivateKey.php + + - + message: "#^Parameter \\#1 \\$publicKey of static method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\RFC8410\\\\Curve448\\\\Ed448PublicKey\\:\\:create\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/Asymmetric/RFC8410/Curve448/Ed448PrivateKey.php + + - + message: "#^Parameter \\#1 \\$publicKey of static method SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\RFC8410\\\\Curve448\\\\X448PublicKey\\:\\:create\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/Asymmetric/RFC8410/Curve448/X448PrivateKey.php + + - + message: "#^Parameter \\#1 \\$string of static method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Primitive\\\\BitString\\:\\:create\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/CryptoTypes/Signature/RSASignature.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\Attribute implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X501/ASN1/Attribute.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\Attribute\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X501/ASN1/Attribute.php + + - + message: "#^PHPDoc tag @var with type SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\AttributeValue\\\\AttributeValue is not subtype of native type class\\-string\\\\.$#" + count: 1 + path: src/X501/ASN1/Attribute.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\Collection\\\\AttributeCollection implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X501/ASN1/Collection/AttributeCollection.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\Collection\\\\AttributeCollection\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X501/ASN1/Collection/AttributeCollection.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\Name implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X501/ASN1/Name.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\Name\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X501/ASN1/Name.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\RDN implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X501/ASN1/RDN.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\RDN\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X501/ASN1/RDN.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X501\\\\DN\\\\DNParser\\:\\:_parseAttrHexValue\\(\\) should return string but returns string\\|false\\.$#" + count: 1 + path: src/X501/DN/DNParser.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X501\\\\DN\\\\DNParser\\:\\:_parseAttrTypeAndValue\\(\\) should return array\\ but returns array\\\\.$#" + count: 1 + path: src/X501/DN/DNParser.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X501\\\\DN\\\\DNParser\\:\\:_parseName\\(\\) should return array\\\\> but returns array\\\\>\\>\\.$#" + count: 1 + path: src/X501/DN/DNParser.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X501\\\\DN\\\\DNParser\\:\\:_regexMatch\\(\\) should return string\\|null but returns string\\|false\\.$#" + count: 1 + path: src/X501/DN/DNParser.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X501\\\\DN\\\\DNParser\\:\\:escapeString\\(\\) should return string but returns string\\|null\\.$#" + count: 1 + path: src/X501/DN/DNParser.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X501\\\\MatchingRule\\\\BinaryMatch\\:\\:compare\\(\\) never returns null so it can be removed from the return type\\.$#" + count: 1 + path: src/X501/MatchingRule/BinaryMatch.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X501\\\\StringPrep\\\\NormalizeStep\\:\\:apply\\(\\) should return string but returns string\\|false\\.$#" + count: 1 + path: src/X501/StringPrep/NormalizeStep.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\AttCertValidityPeriod\\:\\:roundDownFractionalSeconds\\(\\) should return DateTimeImmutable but returns DateTimeImmutable\\|false\\.$#" + count: 1 + path: src/X509/AttributeCertificate/AttCertValidityPeriod.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attribute\\\\IetfAttrSyntax implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/AttributeCertificate/Attribute/IetfAttrSyntax.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attribute\\\\IetfAttrSyntax\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/AttributeCertificate/Attribute/IetfAttrSyntax.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attribute\\\\IetfAttrSyntax\\:\\:policyAuthority\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\GeneralNames but returns SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\GeneralNames\\|null\\.$#" + count: 1 + path: src/X509/AttributeCertificate/Attribute/IetfAttrSyntax.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attribute\\\\RoleAttributeValue\\:\\:roleAuthority\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\GeneralNames but returns SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\GeneralNames\\|null\\.$#" + count: 1 + path: src/X509/AttributeCertificate/Attribute/RoleAttributeValue.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attribute\\\\SvceAuthInfo\\:\\:authInfo\\(\\) should return string but returns string\\|null\\.$#" + count: 1 + path: src/X509/AttributeCertificate/Attribute/SvceAuthInfo.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\AttributeCertificateInfo\\:\\:issuerUniqueID\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\UniqueIdentifier but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\UniqueIdentifier\\|null\\.$#" + count: 1 + path: src/X509/AttributeCertificate/AttributeCertificateInfo.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\AttributeCertificateInfo\\:\\:serialNumber\\(\\) should return string but returns string\\|null\\.$#" + count: 1 + path: src/X509/AttributeCertificate/AttributeCertificateInfo.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\AttributeCertificateInfo\\:\\:signature\\(\\) should return SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Feature\\\\SignatureAlgorithmIdentifier but returns SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Feature\\\\SignatureAlgorithmIdentifier\\|null\\.$#" + count: 1 + path: src/X509/AttributeCertificate/AttributeCertificateInfo.php + + - + message: "#^Parameter \\#4 \\$attributes of static method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\AttributeCertificateInfo\\:\\:create\\(\\) expects SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attributes, SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\Collection\\\\SequenceOfAttributes given\\.$#" + count: 1 + path: src/X509/AttributeCertificate/AttributeCertificateInfo.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attributes\\:\\:accessIdentity\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attribute\\\\AccessIdentityAttributeValue but returns SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\AttributeValue\\\\AttributeValue\\.$#" + count: 1 + path: src/X509/AttributeCertificate/Attributes.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attributes\\:\\:authenticationInformation\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attribute\\\\AuthenticationInfoAttributeValue but returns SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\AttributeValue\\\\AttributeValue\\.$#" + count: 1 + path: src/X509/AttributeCertificate/Attributes.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attributes\\:\\:chargingIdentity\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attribute\\\\ChargingIdentityAttributeValue but returns SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\AttributeValue\\\\AttributeValue\\.$#" + count: 1 + path: src/X509/AttributeCertificate/Attributes.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attributes\\:\\:group\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attribute\\\\GroupAttributeValue but returns SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\AttributeValue\\\\AttributeValue\\.$#" + count: 1 + path: src/X509/AttributeCertificate/Attributes.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attributes\\:\\:role\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attribute\\\\RoleAttributeValue but returns SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\AttributeValue\\\\AttributeValue\\.$#" + count: 1 + path: src/X509/AttributeCertificate/Attributes.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Attributes\\:\\:roles\\(\\) should return array\\ but returns array\\\\.$#" + count: 1 + path: src/X509/AttributeCertificate/Attributes.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Holder\\:\\:baseCertificateID\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\IssuerSerial but returns SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\IssuerSerial\\|null\\.$#" + count: 1 + path: src/X509/AttributeCertificate/Holder.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Holder\\:\\:entityName\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\GeneralNames but returns SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\GeneralNames\\|null\\.$#" + count: 1 + path: src/X509/AttributeCertificate/Holder.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\Holder\\:\\:objectDigestInfo\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\ObjectDigestInfo but returns SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\ObjectDigestInfo\\|null\\.$#" + count: 1 + path: src/X509/AttributeCertificate/Holder.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\IssuerSerial\\:\\:issuerUID\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\UniqueIdentifier but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\UniqueIdentifier\\|null\\.$#" + count: 1 + path: src/X509/AttributeCertificate/IssuerSerial.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\AttributeCertificate\\\\V2Form\\:\\:issuerName\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\GeneralNames but returns SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\GeneralNames\\|null\\.$#" + count: 1 + path: src/X509/AttributeCertificate/V2Form.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\CertificateBundle implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/CertificateBundle.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\CertificateBundle\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/CertificateBundle.php + + - + message: "#^Parameter \\#1 \\$pem of static method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Certificate\\:\\:fromPEM\\(\\) expects SpomkyLabs\\\\Pki\\\\CryptoEncoding\\\\PEM, mixed given\\.$#" + count: 1 + path: src/X509/Certificate/CertificateBundle.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\CertificateChain implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/CertificateChain.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\CertificateChain\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/CertificateChain.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\AAControlsExtension\\:\\:excludedAttrs\\(\\) should return array\\ but returns array\\\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/AAControlsExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\AAControlsExtension\\:\\:pathLen\\(\\) should return int but returns int\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/AAControlsExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\AAControlsExtension\\:\\:permittedAttrs\\(\\) should return array\\ but returns array\\\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/AAControlsExtension.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\AuthorityInformationAccessExtension implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/AuthorityInformationAccessExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\AuthorityInformationAccessExtension\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/AuthorityInformationAccessExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\AuthorityKeyIdentifierExtension\\:\\:issuer\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\GeneralNames but returns SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\GeneralNames\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/AuthorityKeyIdentifierExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\AuthorityKeyIdentifierExtension\\:\\:keyIdentifier\\(\\) should return string but returns string\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/AuthorityKeyIdentifierExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\AuthorityKeyIdentifierExtension\\:\\:serial\\(\\) should return string but returns string\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/AuthorityKeyIdentifierExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\BasicConstraintsExtension\\:\\:pathLen\\(\\) should return int but returns int\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/BasicConstraintsExtension.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CRLDistributionPointsExtension implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/CRLDistributionPointsExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CRLDistributionPointsExtension\\:\\:fromDER\\(\\) should return static\\(SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CRLDistributionPointsExtension\\) but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CRLDistributionPointsExtension\\.$#" + count: 1 + path: src/X509/Certificate/Extension/CRLDistributionPointsExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CRLDistributionPointsExtension\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/CRLDistributionPointsExtension.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePoliciesExtension implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/CertificatePoliciesExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePoliciesExtension\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/CertificatePoliciesExtension.php + + - + message: "#^Parameter \\#1 \\.\\.\\.\\$elements of static method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Constructed\\\\Sequence\\:\\:create\\(\\) expects SpomkyLabs\\\\Pki\\\\ASN1\\\\Element, SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\StringType given\\.$#" + count: 1 + path: src/X509/Certificate/Extension/CertificatePolicy/NoticeReference.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePolicy\\\\PolicyInformation implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/CertificatePolicy/PolicyInformation.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePolicy\\\\PolicyInformation\\:\\:CPSQualifier\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePolicy\\\\CPSQualifier but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePolicy\\\\PolicyQualifierInfo\\.$#" + count: 1 + path: src/X509/Certificate/Extension/CertificatePolicy/PolicyInformation.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePolicy\\\\PolicyInformation\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/CertificatePolicy/PolicyInformation.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePolicy\\\\PolicyInformation\\:\\:userNoticeQualifier\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePolicy\\\\UserNoticeQualifier but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePolicy\\\\PolicyQualifierInfo\\.$#" + count: 1 + path: src/X509/Certificate/Extension/CertificatePolicy/PolicyInformation.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePolicy\\\\UserNoticeQualifier\\:\\:explicitText\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePolicy\\\\DisplayText but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePolicy\\\\DisplayText\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/CertificatePolicy/UserNoticeQualifier.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePolicy\\\\UserNoticeQualifier\\:\\:noticeRef\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePolicy\\\\NoticeReference but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePolicy\\\\NoticeReference\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/CertificatePolicy/UserNoticeQualifier.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\DistributionPoint\\\\DistributionPoint\\:\\:crlIssuer\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\GeneralNames but returns SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\GeneralNames\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/DistributionPoint/DistributionPoint.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\DistributionPoint\\\\DistributionPoint\\:\\:distributionPointName\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\DistributionPoint\\\\DistributionPointName but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\DistributionPoint\\\\DistributionPointName\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/DistributionPoint/DistributionPoint.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\DistributionPoint\\\\DistributionPoint\\:\\:reasons\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\DistributionPoint\\\\ReasonFlags but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\DistributionPoint\\\\ReasonFlags\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/DistributionPoint/DistributionPoint.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\ExtendedKeyUsageExtension implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/ExtendedKeyUsageExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\ExtendedKeyUsageExtension\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/ExtendedKeyUsageExtension.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\NameConstraints\\\\GeneralSubtrees implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/NameConstraints/GeneralSubtrees.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\NameConstraints\\\\GeneralSubtrees\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/NameConstraints/GeneralSubtrees.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\NameConstraintsExtension\\:\\:excludedSubtrees\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\NameConstraints\\\\GeneralSubtrees but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\NameConstraints\\\\GeneralSubtrees\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/NameConstraintsExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\NameConstraintsExtension\\:\\:permittedSubtrees\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\NameConstraints\\\\GeneralSubtrees but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\NameConstraints\\\\GeneralSubtrees\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/NameConstraintsExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\PolicyConstraintsExtension\\:\\:inhibitPolicyMapping\\(\\) should return int but returns int\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/PolicyConstraintsExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\PolicyConstraintsExtension\\:\\:requireExplicitPolicy\\(\\) should return int but returns int\\|null\\.$#" + count: 1 + path: src/X509/Certificate/Extension/PolicyConstraintsExtension.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\PolicyMappingsExtension implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/PolicyMappingsExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\PolicyMappingsExtension\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/PolicyMappingsExtension.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\SubjectDirectoryAttributesExtension implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/SubjectDirectoryAttributesExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\SubjectDirectoryAttributesExtension\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/SubjectDirectoryAttributesExtension.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\SubjectInformationAccessExtension implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/SubjectInformationAccessExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\SubjectInformationAccessExtension\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/SubjectInformationAccessExtension.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Target\\\\Targets implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/Target/Targets.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Target\\\\Targets\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/Target/Targets.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\TargetInformationExtension implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/TargetInformationExtension.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\TargetInformationExtension\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extension/TargetInformationExtension.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extensions implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/Certificate/Extensions.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extensions\\:\\:authorityKeyIdentifier\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\AuthorityKeyIdentifierExtension but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Extension\\.$#" + count: 1 + path: src/X509/Certificate/Extensions.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extensions\\:\\:basicConstraints\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\BasicConstraintsExtension but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Extension\\.$#" + count: 1 + path: src/X509/Certificate/Extensions.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extensions\\:\\:certificatePolicies\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CertificatePoliciesExtension but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Extension\\.$#" + count: 1 + path: src/X509/Certificate/Extensions.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extensions\\:\\:crlDistributionPoints\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\CRLDistributionPointsExtension but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Extension\\.$#" + count: 1 + path: src/X509/Certificate/Extensions.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extensions\\:\\:extendedKeyUsage\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\ExtendedKeyUsageExtension but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Extension\\.$#" + count: 1 + path: src/X509/Certificate/Extensions.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extensions\\:\\:inhibitAnyPolicy\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\InhibitAnyPolicyExtension but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Extension\\.$#" + count: 1 + path: src/X509/Certificate/Extensions.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extensions\\:\\:issuerAlternativeName\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\IssuerAlternativeNameExtension but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Extension\\.$#" + count: 1 + path: src/X509/Certificate/Extensions.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extensions\\:\\:keyUsage\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\KeyUsageExtension but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Extension\\.$#" + count: 1 + path: src/X509/Certificate/Extensions.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extensions\\:\\:nameConstraints\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\NameConstraintsExtension but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Extension\\.$#" + count: 1 + path: src/X509/Certificate/Extensions.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extensions\\:\\:policyConstraints\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\PolicyConstraintsExtension but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Extension\\.$#" + count: 1 + path: src/X509/Certificate/Extensions.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extensions\\:\\:policyMappings\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\PolicyMappingsExtension but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Extension\\.$#" + count: 1 + path: src/X509/Certificate/Extensions.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extensions\\:\\:subjectAlternativeName\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\SubjectAlternativeNameExtension but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Extension\\.$#" + count: 1 + path: src/X509/Certificate/Extensions.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extensions\\:\\:subjectKeyIdentifier\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\SubjectKeyIdentifierExtension but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Extension\\\\Extension\\.$#" + count: 1 + path: src/X509/Certificate/Extensions.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\TBSCertificate\\:\\:issuerUniqueID\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\UniqueIdentifier but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\UniqueIdentifier\\|null\\.$#" + count: 1 + path: src/X509/Certificate/TBSCertificate.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\TBSCertificate\\:\\:serialNumber\\(\\) should return string but returns string\\|null\\.$#" + count: 1 + path: src/X509/Certificate/TBSCertificate.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\TBSCertificate\\:\\:signature\\(\\) should return SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Feature\\\\SignatureAlgorithmIdentifier but returns SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Feature\\\\SignatureAlgorithmIdentifier\\|null\\.$#" + count: 1 + path: src/X509/Certificate/TBSCertificate.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\TBSCertificate\\:\\:subjectUniqueID\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\UniqueIdentifier but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\UniqueIdentifier\\|null\\.$#" + count: 1 + path: src/X509/Certificate/TBSCertificate.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\TBSCertificate\\:\\:version\\(\\) should return int but returns int\\|null\\.$#" + count: 1 + path: src/X509/Certificate/TBSCertificate.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Time\\:\\:roundDownFractionalSeconds\\(\\) should return DateTimeImmutable but returns DateTimeImmutable\\|false\\.$#" + count: 1 + path: src/X509/Certificate/Time.php + + - + message: "#^Parameter \\#1 \\.\\.\\.\\$elements of static method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Constructed\\\\Sequence\\:\\:create\\(\\) expects SpomkyLabs\\\\Pki\\\\ASN1\\\\Element, SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\TimeType given\\.$#" + count: 1 + path: src/X509/Certificate/Validity.php + + - + message: "#^Parameter \\#2 \\.\\.\\.\\$elements of static method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Constructed\\\\Sequence\\:\\:create\\(\\) expects SpomkyLabs\\\\Pki\\\\ASN1\\\\Element, SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\TimeType given\\.$#" + count: 1 + path: src/X509/Certificate/Validity.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\CertificationPath implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/CertificationPath/CertificationPath.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\CertificationPath\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/CertificationPath/CertificationPath.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\PathValidation\\\\PathValidationConfig\\:\\:trustAnchor\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Certificate but returns SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Certificate\\|null\\.$#" + count: 1 + path: src/X509/CertificationPath/PathValidation/PathValidationConfig.php + + - + message: "#^Parameter \\#2 \\$trust_anchor of static method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\PathValidation\\\\ValidatorState\\:\\:initialize\\(\\) expects SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Certificate, SpomkyLabs\\\\Pki\\\\X509\\\\Certificate\\\\Certificate\\|null given\\.$#" + count: 1 + path: src/X509/CertificationPath/PathValidation/PathValidator.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\PathValidation\\\\ValidatorState\\:\\:explicitPolicy\\(\\) should return int but returns int\\|null\\.$#" + count: 1 + path: src/X509/CertificationPath/PathValidation/ValidatorState.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\PathValidation\\\\ValidatorState\\:\\:index\\(\\) should return int but returns int\\|null\\.$#" + count: 1 + path: src/X509/CertificationPath/PathValidation/ValidatorState.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\PathValidation\\\\ValidatorState\\:\\:inhibitAnyPolicy\\(\\) should return int but returns int\\|null\\.$#" + count: 1 + path: src/X509/CertificationPath/PathValidation/ValidatorState.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\PathValidation\\\\ValidatorState\\:\\:maxPathLength\\(\\) should return int but returns int\\|null\\.$#" + count: 1 + path: src/X509/CertificationPath/PathValidation/ValidatorState.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\PathValidation\\\\ValidatorState\\:\\:pathLength\\(\\) should return int but returns int\\|null\\.$#" + count: 1 + path: src/X509/CertificationPath/PathValidation/ValidatorState.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\PathValidation\\\\ValidatorState\\:\\:policyMapping\\(\\) should return int but returns int\\|null\\.$#" + count: 1 + path: src/X509/CertificationPath/PathValidation/ValidatorState.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\PathValidation\\\\ValidatorState\\:\\:validPolicyTree\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\Policy\\\\PolicyTree but returns SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\Policy\\\\PolicyTree\\|null\\.$#" + count: 1 + path: src/X509/CertificationPath/PathValidation/ValidatorState.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\PathValidation\\\\ValidatorState\\:\\:workingIssuerName\\(\\) should return SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\Name but returns SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\Name\\|null\\.$#" + count: 1 + path: src/X509/CertificationPath/PathValidation/ValidatorState.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\PathValidation\\\\ValidatorState\\:\\:workingPublicKey\\(\\) should return SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\PublicKeyInfo but returns SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\PublicKeyInfo\\|null\\.$#" + count: 1 + path: src/X509/CertificationPath/PathValidation/ValidatorState.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\PathValidation\\\\ValidatorState\\:\\:workingPublicKeyAlgorithm\\(\\) should return SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Feature\\\\AlgorithmIdentifierType but returns SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Feature\\\\AlgorithmIdentifierType\\|null\\.$#" + count: 1 + path: src/X509/CertificationPath/PathValidation/ValidatorState.php + + - + message: "#^Parameter \\#3 \\$publicKeyInfo of static method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\PathValidation\\\\PathValidationResult\\:\\:create\\(\\) expects SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\PublicKeyInfo, SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\Asymmetric\\\\PublicKeyInfo\\|null given\\.$#" + count: 1 + path: src/X509/CertificationPath/PathValidation/ValidatorState.php + + - + message: "#^Parameter \\#4 \\$publicKeyAlgo of static method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\PathValidation\\\\PathValidationResult\\:\\:create\\(\\) expects SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Feature\\\\AlgorithmIdentifierType, SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Feature\\\\AlgorithmIdentifierType\\|null given\\.$#" + count: 1 + path: src/X509/CertificationPath/PathValidation/ValidatorState.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\Policy\\\\PolicyNode implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/CertificationPath/Policy/PolicyNode.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationPath\\\\Policy\\\\PolicyNode\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/CertificationPath/Policy/PolicyNode.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationRequest\\\\Attributes\\:\\:extensionRequest\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\CertificationRequest\\\\Attribute\\\\ExtensionRequestValue but returns SpomkyLabs\\\\Pki\\\\X501\\\\ASN1\\\\AttributeValue\\\\AttributeValue\\.$#" + count: 1 + path: src/X509/CertificationRequest/Attributes.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\CertificationRequest\\\\CertificationRequestInfo\\:\\:attributes\\(\\) should return SpomkyLabs\\\\Pki\\\\X509\\\\CertificationRequest\\\\Attributes but returns SpomkyLabs\\\\Pki\\\\X509\\\\CertificationRequest\\\\Attributes\\|null\\.$#" + count: 1 + path: src/X509/CertificationRequest/CertificationRequestInfo.php + + - + message: "#^Class SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\GeneralNames implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/GeneralName/GeneralNames.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\GeneralNames\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + count: 1 + path: src/X509/GeneralName/GeneralNames.php + + - + message: "#^Method SpomkyLabs\\\\Pki\\\\X509\\\\GeneralName\\\\IPAddress\\:\\:mask\\(\\) should return string but returns string\\|null\\.$#" + count: 1 + path: src/X509/GeneralName/IPAddress.php diff --git a/phpstan.neon b/phpstan.neon index 14ebfff0..fc6c9080 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,39 +1,11 @@ parameters: - level: max - paths: - - src - ignoreErrors: - - '#(Property|Method) SpomkyLabs\\.* should return .* but returns .*\.#' - - '#(Parameter) .* of (class|method|static method) SpomkyLabs\\.* (constructor )?expects .*, .* given\.#' - - - message: '#Instanceof between string and SpomkyLabs\\Pki\\ASN1\\Element will always evaluate to false\.#' - path: src/X501/ASN1/Name.php - count: 1 - - - message: '#Call to an undefined method SpomkyLabs\\Pki\\ASN1\\Element\:\:string\(\)\.#' - path: src/ASN1/Type/Constructed/ConstructedString.php - count: 1 - - - message: '#Parameter \#3 \$subject of function (preg_replace|preg_replace_callback) expects array\|string, string\|null given\.#' - path: src/X501/DN/DNParser.php - count: 3 - - - message: '#Parameter \#3 \$subject of function (preg_replace|preg_replace_callback) expects array\|string, string\|null given\.#' - path: src/X501/StringPrep/InsignificantNonSubstringSpaceStep.php - count: 2 - - - message: '#Offset int might not exist on array\\|null\.#' - path: src/ASN1/Type/Structure.php - count: 1 - checkMissingIterableValueType: true - checkGenericClassInNonGenericObjectType: false - checkUninitializedProperties: true - treatPhpDocTypesAsCertain: false + level: max + paths: + - src + checkMissingIterableValueType: true + checkGenericClassInNonGenericObjectType: true + checkUninitializedProperties: true + treatPhpDocTypesAsCertain: false includes: - - vendor/phpstan/phpstan/conf/bleedingEdge.neon - - vendor/phpstan/phpstan-beberlei-assert/extension.neon - - vendor/phpstan/phpstan-deprecation-rules/rules.neon - - vendor/phpstan/phpstan-phpunit/rules.neon - - vendor/phpstan/phpstan-phpunit/extension.neon - - vendor/phpstan/phpstan-strict-rules/rules.neon - - vendor/ekino/phpstan-banned-code/extension.neon + - vendor/phpstan/phpstan/conf/bleedingEdge.neon + - phpstan-baseline.neon diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0e3fd8bd..94dbce33 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,15 +1,14 @@ - - - src - - + tests/ASN1 @@ -30,6 +29,11 @@ tests/X509 + + + src/ + + diff --git a/rector.php b/rector.php index 15ea4774..47dcae8b 100644 --- a/rector.php +++ b/rector.php @@ -3,32 +3,30 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Core\ValueObject\PhpVersion; -use Rector\Doctrine\Set\DoctrineSetList; -use Rector\PHPUnit\Set\PHPUnitLevelSetList; +use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; +use Rector\PHPUnit\CodeQuality\Rector\ClassMethod\DataProviderArrayItemsNewLinedRector; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\LevelSetList; use Rector\Set\ValueObject\SetList; -use Rector\Symfony\Set\SymfonyLevelSetList; use Rector\Symfony\Set\SymfonySetList; +use Rector\Symfony\Symfony42\Rector\New_\StringToArrayArgumentProcessRector; +use Rector\ValueObject\PhpVersion; return static function (RectorConfig $config): void { $config->import(SetList::DEAD_CODE); $config->import(LevelSetList::UP_TO_PHP_81); - $config->import(SymfonyLevelSetList::UP_TO_SYMFONY_61); - $config->import(SymfonySetList::SYMFONY_CODE_QUALITY); + $config->import(SymfonySetList::SYMFONY_50_TYPES); $config->import(SymfonySetList::SYMFONY_52_VALIDATOR_ATTRIBUTES); + $config->import(SymfonySetList::SYMFONY_CODE_QUALITY); $config->import(SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION); $config->import(SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES); - $config->import(DoctrineSetList::DOCTRINE_CODE_QUALITY); - $config->import(DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES); - $config->import(PHPUnitSetList::PHPUNIT_EXCEPTION); - $config->import(PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD); - $config->import(PHPUnitLevelSetList::UP_TO_PHPUNIT_100); - $config->import(PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER); - $config->paths([ - __DIR__ . '/src', - __DIR__ . '/tests', + $config->import(PHPUnitSetList::PHPUNIT_CODE_QUALITY); + $config->import(PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES); + $config->paths([__DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/ecs.php', __DIR__ . '/rector.php']); + $config->skip([ + DataProviderArrayItemsNewLinedRector::class, + PreferPHPUnitThisCallRector::class, + StringToArrayArgumentProcessRector::class => [__DIR__ . '/tests'], ]); $config->phpVersion(PhpVersion::PHP_81); $config->parallel(); diff --git a/src/ASN1/Component/Identifier.php b/src/ASN1/Component/Identifier.php index 8646e176..c2f15492 100644 --- a/src/ASN1/Component/Identifier.php +++ b/src/ASN1/Component/Identifier.php @@ -4,16 +4,17 @@ namespace SpomkyLabs\Pki\ASN1\Component; -use function array_key_exists; use Brick\Math\BigInteger; -use function mb_strlen; -use function ord; use SpomkyLabs\Pki\ASN1\Exception\DecodeException; use SpomkyLabs\Pki\ASN1\Feature\Encodable; use SpomkyLabs\Pki\ASN1\Util\BigInt; +use function array_key_exists; +use function mb_strlen; +use function ord; /** * Class to represent BER/DER identifier octets. + * @see \SpomkyLabs\Pki\Test\ASN1\Component\IdentifierTest */ final class Identifier implements Encodable { diff --git a/src/ASN1/Component/Length.php b/src/ASN1/Component/Length.php index 47b73e6e..feb5ab31 100644 --- a/src/ASN1/Component/Length.php +++ b/src/ASN1/Component/Length.php @@ -5,14 +5,14 @@ namespace SpomkyLabs\Pki\ASN1\Component; use Brick\Math\BigInteger; -use function count; use DomainException; use LogicException; -use function mb_strlen; -use function ord; use SpomkyLabs\Pki\ASN1\Exception\DecodeException; use SpomkyLabs\Pki\ASN1\Feature\Encodable; use SpomkyLabs\Pki\ASN1\Util\BigInt; +use function count; +use function mb_strlen; +use function ord; /** * Class to represent BER/DER length octets. diff --git a/src/ASN1/DERData.php b/src/ASN1/DERData.php index 6d4355df..52708189 100644 --- a/src/ASN1/DERData.php +++ b/src/ASN1/DERData.php @@ -5,15 +5,16 @@ namespace SpomkyLabs\Pki\ASN1; use BadMethodCallException; -use function mb_strlen; use SpomkyLabs\Pki\ASN1\Component\Identifier; use SpomkyLabs\Pki\ASN1\Component\Length; use SpomkyLabs\Pki\ASN1\Feature\ElementBase; +use function mb_strlen; /** * Container for raw DER encoded data. * * May be inserted into structure without decoding first. + * @see \SpomkyLabs\Pki\Test\ASN1\DERDataTest */ final class DERData extends Element { diff --git a/src/ASN1/Element.php b/src/ASN1/Element.php index 6b6d776b..3d05aaa8 100644 --- a/src/ASN1/Element.php +++ b/src/ASN1/Element.php @@ -4,8 +4,6 @@ namespace SpomkyLabs\Pki\ASN1; -use function array_key_exists; -use function mb_strlen; use SpomkyLabs\Pki\ASN1\Component\Identifier; use SpomkyLabs\Pki\ASN1\Component\Length; use SpomkyLabs\Pki\ASN1\Feature\ElementBase; @@ -46,9 +44,12 @@ use SpomkyLabs\Pki\ASN1\Type\TimeType; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; use UnexpectedValueException; +use function array_key_exists; +use function mb_strlen; /** * Base class for all ASN.1 type elements. + * @see \SpomkyLabs\Pki\Test\ASN1\ElementTest */ abstract class Element implements ElementBase { diff --git a/src/ASN1/Type/Constructed/ConstructedString.php b/src/ASN1/Type/Constructed/ConstructedString.php index 0ed66412..f03cac79 100644 --- a/src/ASN1/Type/Constructed/ConstructedString.php +++ b/src/ASN1/Type/Constructed/ConstructedString.php @@ -4,7 +4,6 @@ namespace SpomkyLabs\Pki\ASN1\Type\Constructed; -use function count; use LogicException; use SpomkyLabs\Pki\ASN1\Component\Identifier; use SpomkyLabs\Pki\ASN1\Component\Length; @@ -13,6 +12,7 @@ use SpomkyLabs\Pki\ASN1\Type\StringType; use SpomkyLabs\Pki\ASN1\Type\Structure; use Stringable; +use function count; /** * Implements constructed type of simple strings. diff --git a/src/ASN1/Type/Primitive/BMPString.php b/src/ASN1/Type/Primitive/BMPString.php index 79dcb41a..2c2dccdc 100644 --- a/src/ASN1/Type/Primitive/BMPString.php +++ b/src/ASN1/Type/Primitive/BMPString.php @@ -4,9 +4,9 @@ namespace SpomkyLabs\Pki\ASN1\Type\Primitive; -use function mb_strlen; use SpomkyLabs\Pki\ASN1\Type\PrimitiveString; use SpomkyLabs\Pki\ASN1\Type\UniversalClass; +use function mb_strlen; /** * Implements *BMPString* type. diff --git a/src/ASN1/Type/Primitive/BitString.php b/src/ASN1/Type/Primitive/BitString.php index 1ef5073a..62a65d89 100644 --- a/src/ASN1/Type/Primitive/BitString.php +++ b/src/ASN1/Type/Primitive/BitString.php @@ -5,9 +5,6 @@ namespace SpomkyLabs\Pki\ASN1\Type\Primitive; use Brick\Math\BigInteger; -use function chr; -use function mb_strlen; -use function ord; use OutOfBoundsException; use SpomkyLabs\Pki\ASN1\Component\Identifier; use SpomkyLabs\Pki\ASN1\Component\Length; @@ -16,6 +13,9 @@ use SpomkyLabs\Pki\ASN1\Type\BaseString; use SpomkyLabs\Pki\ASN1\Type\PrimitiveType; use SpomkyLabs\Pki\ASN1\Type\UniversalClass; +use function chr; +use function mb_strlen; +use function ord; /** * Implements *BIT STRING* type. diff --git a/src/ASN1/Type/Primitive/Boolean.php b/src/ASN1/Type/Primitive/Boolean.php index 16a6b255..aa2e9b47 100644 --- a/src/ASN1/Type/Primitive/Boolean.php +++ b/src/ASN1/Type/Primitive/Boolean.php @@ -4,8 +4,6 @@ namespace SpomkyLabs\Pki\ASN1\Type\Primitive; -use function chr; -use function ord; use SpomkyLabs\Pki\ASN1\Component\Identifier; use SpomkyLabs\Pki\ASN1\Component\Length; use SpomkyLabs\Pki\ASN1\Element; @@ -13,6 +11,8 @@ use SpomkyLabs\Pki\ASN1\Feature\ElementBase; use SpomkyLabs\Pki\ASN1\Type\PrimitiveType; use SpomkyLabs\Pki\ASN1\Type\UniversalClass; +use function chr; +use function ord; /** * Implements *BOOLEAN* type. diff --git a/src/ASN1/Type/Primitive/GeneralizedTime.php b/src/ASN1/Type/Primitive/GeneralizedTime.php index a5fd4aec..62de771d 100644 --- a/src/ASN1/Type/Primitive/GeneralizedTime.php +++ b/src/ASN1/Type/Primitive/GeneralizedTime.php @@ -6,8 +6,6 @@ use DateTimeImmutable; use DateTimeZone; -use function intval; -use function mb_strlen; use SpomkyLabs\Pki\ASN1\Component\Identifier; use SpomkyLabs\Pki\ASN1\Component\Length; use SpomkyLabs\Pki\ASN1\Exception\DecodeException; @@ -17,6 +15,8 @@ use SpomkyLabs\Pki\ASN1\Type\UniversalClass; use Throwable; use UnexpectedValueException; +use function intval; +use function mb_strlen; /** * Implements *GeneralizedTime* type. diff --git a/src/ASN1/Type/Primitive/Integer.php b/src/ASN1/Type/Primitive/Integer.php index c2f58b3c..a95616e4 100644 --- a/src/ASN1/Type/Primitive/Integer.php +++ b/src/ASN1/Type/Primitive/Integer.php @@ -5,11 +5,7 @@ namespace SpomkyLabs\Pki\ASN1\Type\Primitive; use Brick\Math\BigInteger; -use function gettype; use InvalidArgumentException; -use function is_int; -use function is_scalar; -use function is_string; use SpomkyLabs\Pki\ASN1\Component\Identifier; use SpomkyLabs\Pki\ASN1\Component\Length; use SpomkyLabs\Pki\ASN1\Element; @@ -17,6 +13,10 @@ use SpomkyLabs\Pki\ASN1\Type\PrimitiveType; use SpomkyLabs\Pki\ASN1\Type\UniversalClass; use SpomkyLabs\Pki\ASN1\Util\BigInt; +use function gettype; +use function is_int; +use function is_scalar; +use function is_string; /** * Implements *INTEGER* type. diff --git a/src/ASN1/Type/Primitive/Number.php b/src/ASN1/Type/Primitive/Number.php index d526d28e..bbf5ed2d 100644 --- a/src/ASN1/Type/Primitive/Number.php +++ b/src/ASN1/Type/Primitive/Number.php @@ -5,15 +5,15 @@ namespace SpomkyLabs\Pki\ASN1\Type\Primitive; use Brick\Math\BigInteger; -use function gettype; use InvalidArgumentException; -use function is_int; -use function is_scalar; -use function is_string; use SpomkyLabs\Pki\ASN1\Element; use SpomkyLabs\Pki\ASN1\Type\PrimitiveType; use SpomkyLabs\Pki\ASN1\Type\UniversalClass; use SpomkyLabs\Pki\ASN1\Util\BigInt; +use function gettype; +use function is_int; +use function is_scalar; +use function is_string; use function strval; abstract class Number extends Element diff --git a/src/ASN1/Type/Primitive/ObjectIdentifier.php b/src/ASN1/Type/Primitive/ObjectIdentifier.php index 93360449..207842a6 100644 --- a/src/ASN1/Type/Primitive/ObjectIdentifier.php +++ b/src/ASN1/Type/Primitive/ObjectIdentifier.php @@ -5,11 +5,6 @@ namespace SpomkyLabs\Pki\ASN1\Type\Primitive; use Brick\Math\BigInteger; -use function chr; -use function count; -use function is_int; -use function mb_strlen; -use function ord; use RuntimeException; use SpomkyLabs\Pki\ASN1\Component\Identifier; use SpomkyLabs\Pki\ASN1\Component\Length; @@ -20,6 +15,11 @@ use SpomkyLabs\Pki\ASN1\Type\UniversalClass; use Throwable; use UnexpectedValueException; +use function chr; +use function count; +use function is_int; +use function mb_strlen; +use function ord; /** * Implements *OBJECT IDENTIFIER* type. diff --git a/src/ASN1/Type/Primitive/Real.php b/src/ASN1/Type/Primitive/Real.php index 28d08421..725692aa 100644 --- a/src/ASN1/Type/Primitive/Real.php +++ b/src/ASN1/Type/Primitive/Real.php @@ -5,13 +5,7 @@ namespace SpomkyLabs\Pki\ASN1\Type\Primitive; use Brick\Math\BigInteger; -use function chr; -use function count; -use function in_array; -use const INF; use LogicException; -use function mb_strlen; -use function ord; use RangeException; use SpomkyLabs\Pki\ASN1\Component\Identifier; use SpomkyLabs\Pki\ASN1\Component\Length; @@ -23,6 +17,12 @@ use SpomkyLabs\Pki\ASN1\Util\BigInt; use Stringable; use UnexpectedValueException; +use function chr; +use function count; +use function in_array; +use function mb_strlen; +use function ord; +use const INF; /** * Implements *REAL* type. diff --git a/src/ASN1/Type/Primitive/RelativeOID.php b/src/ASN1/Type/Primitive/RelativeOID.php index 25ed21fc..f09ac6b8 100644 --- a/src/ASN1/Type/Primitive/RelativeOID.php +++ b/src/ASN1/Type/Primitive/RelativeOID.php @@ -5,9 +5,6 @@ namespace SpomkyLabs\Pki\ASN1\Type\Primitive; use Brick\Math\BigInteger; -use function chr; -use function is_int; -use function ord; use RuntimeException; use SpomkyLabs\Pki\ASN1\Component\Identifier; use SpomkyLabs\Pki\ASN1\Component\Length; @@ -18,6 +15,9 @@ use SpomkyLabs\Pki\ASN1\Type\UniversalClass; use Throwable; use UnexpectedValueException; +use function chr; +use function is_int; +use function ord; /** * Implements *RELATIVE-OID* type. diff --git a/src/ASN1/Type/Primitive/UniversalString.php b/src/ASN1/Type/Primitive/UniversalString.php index 6e74ac5b..6b6a72f3 100644 --- a/src/ASN1/Type/Primitive/UniversalString.php +++ b/src/ASN1/Type/Primitive/UniversalString.php @@ -4,9 +4,9 @@ namespace SpomkyLabs\Pki\ASN1\Type\Primitive; -use function mb_strlen; use SpomkyLabs\Pki\ASN1\Type\PrimitiveString; use SpomkyLabs\Pki\ASN1\Type\UniversalClass; +use function mb_strlen; /** * Implements *UniversalString* type. diff --git a/src/ASN1/Type/Structure.php b/src/ASN1/Type/Structure.php index e44a11b1..e7d5bf37 100644 --- a/src/ASN1/Type/Structure.php +++ b/src/ASN1/Type/Structure.php @@ -7,7 +7,6 @@ namespace SpomkyLabs\Pki\ASN1\Type; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use LogicException; @@ -17,6 +16,7 @@ use SpomkyLabs\Pki\ASN1\Element; use SpomkyLabs\Pki\ASN1\Exception\DecodeException; use SpomkyLabs\Pki\ASN1\Feature\ElementBase; +use function count; /** * Base class for the constructed types. diff --git a/src/ASN1/Type/UnspecifiedType.php b/src/ASN1/Type/UnspecifiedType.php index 1c0e9570..9d7aa18d 100644 --- a/src/ASN1/Type/UnspecifiedType.php +++ b/src/ASN1/Type/UnspecifiedType.php @@ -42,6 +42,7 @@ * Decorator class to wrap an element without already knowing the specific underlying type. * * Provides accessor methods to test the underlying type and return a type hinted instance of the concrete element. + * @see \SpomkyLabs\Pki\Test\ASN1\Type\UnspecifiedTypeTest */ final class UnspecifiedType implements ElementBase { diff --git a/src/ASN1/Util/BigInt.php b/src/ASN1/Util/BigInt.php index 0e35ad11..5657085a 100644 --- a/src/ASN1/Util/BigInt.php +++ b/src/ASN1/Util/BigInt.php @@ -6,12 +6,13 @@ use Brick\Math\BigInteger; use InvalidArgumentException; -use function mb_strlen; use Stringable; use Throwable; +use function mb_strlen; /** * Class to wrap an integer of arbirtary length. + * @see \SpomkyLabs\Pki\Test\ASN1\Util\BigIntTest */ final class BigInt implements Stringable { diff --git a/src/ASN1/Util/Flags.php b/src/ASN1/Util/Flags.php index 3da1d3de..cc8cbace 100644 --- a/src/ASN1/Util/Flags.php +++ b/src/ASN1/Util/Flags.php @@ -4,17 +4,18 @@ namespace SpomkyLabs\Pki\ASN1\Util; -use function assert; use Brick\Math\BigInteger; -use function count; -use function is_array; -use function ord; use OutOfBoundsException; use RuntimeException; use SpomkyLabs\Pki\ASN1\Type\Primitive\BitString; +use function assert; +use function count; +use function is_array; +use function ord; /** * Class to handle a bit string as a field of flags. + * @see \SpomkyLabs\Pki\Test\ASN1\Util\FlagsTest */ final class Flags { diff --git a/src/CryptoBridge/Crypto.php b/src/CryptoBridge/Crypto.php index 368c0a28..c70e898e 100644 --- a/src/CryptoBridge/Crypto.php +++ b/src/CryptoBridge/Crypto.php @@ -4,7 +4,6 @@ namespace SpomkyLabs\Pki\CryptoBridge; -use function defined; use RuntimeException; use SpomkyLabs\Pki\CryptoBridge\Crypto\OpenSSLCrypto; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Cipher\CipherAlgorithmIdentifier; @@ -12,6 +11,7 @@ use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PublicKeyInfo; use SpomkyLabs\Pki\CryptoTypes\Signature\Signature; +use function defined; /** * Base class for crypto engine implementations. diff --git a/src/CryptoBridge/Crypto/OpenSSLCrypto.php b/src/CryptoBridge/Crypto/OpenSSLCrypto.php index 8726b7ad..fe47b8f6 100644 --- a/src/CryptoBridge/Crypto/OpenSSLCrypto.php +++ b/src/CryptoBridge/Crypto/OpenSSLCrypto.php @@ -4,17 +4,6 @@ namespace SpomkyLabs\Pki\CryptoBridge\Crypto; -use function array_key_exists; -use function mb_strlen; -use const OPENSSL_ALGO_MD4; -use const OPENSSL_ALGO_MD5; -use const OPENSSL_ALGO_SHA1; -use const OPENSSL_ALGO_SHA224; -use const OPENSSL_ALGO_SHA256; -use const OPENSSL_ALGO_SHA384; -use const OPENSSL_ALGO_SHA512; -use const OPENSSL_RAW_DATA; -use const OPENSSL_ZERO_PADDING; use RuntimeException; use SpomkyLabs\Pki\CryptoBridge\Crypto; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\AlgorithmIdentifier; @@ -26,6 +15,17 @@ use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PublicKeyInfo; use SpomkyLabs\Pki\CryptoTypes\Signature\Signature; use UnexpectedValueException; +use function array_key_exists; +use function mb_strlen; +use const OPENSSL_ALGO_MD4; +use const OPENSSL_ALGO_MD5; +use const OPENSSL_ALGO_SHA1; +use const OPENSSL_ALGO_SHA224; +use const OPENSSL_ALGO_SHA256; +use const OPENSSL_ALGO_SHA384; +use const OPENSSL_ALGO_SHA512; +use const OPENSSL_RAW_DATA; +use const OPENSSL_ZERO_PADDING; /** * Crypto engine using OpenSSL extension. diff --git a/src/CryptoEncoding/PEM.php b/src/CryptoEncoding/PEM.php index f052afc6..3618a01c 100644 --- a/src/CryptoEncoding/PEM.php +++ b/src/CryptoEncoding/PEM.php @@ -4,10 +4,10 @@ namespace SpomkyLabs\Pki\CryptoEncoding; -use function is_string; use RuntimeException; use Stringable; use UnexpectedValueException; +use function is_string; /** * Implements PEM file encoding and decoding. diff --git a/src/CryptoEncoding/PEMBundle.php b/src/CryptoEncoding/PEMBundle.php index 707bf6da..3411004a 100644 --- a/src/CryptoEncoding/PEMBundle.php +++ b/src/CryptoEncoding/PEMBundle.php @@ -5,15 +5,15 @@ namespace SpomkyLabs\Pki\CryptoEncoding; use ArrayIterator; -use function count; use Countable; -use function is_string; use IteratorAggregate; use LogicException; -use const PREG_SET_ORDER; use RuntimeException; use Stringable; use UnexpectedValueException; +use function count; +use function is_string; +use const PREG_SET_ORDER; /** * Container for multiple PEM objects. diff --git a/src/CryptoTypes/AlgorithmIdentifier/AlgorithmIdentifierFactory.php b/src/CryptoTypes/AlgorithmIdentifier/AlgorithmIdentifierFactory.php index 73cae4a5..175b2664 100644 --- a/src/CryptoTypes/AlgorithmIdentifier/AlgorithmIdentifierFactory.php +++ b/src/CryptoTypes/AlgorithmIdentifier/AlgorithmIdentifierFactory.php @@ -4,7 +4,6 @@ namespace SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier; -use function array_key_exists; use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Asymmetric\ECPublicKeyAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Asymmetric\Ed25519AlgorithmIdentifier; @@ -42,6 +41,7 @@ use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA256WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA384WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA512WithRSAEncryptionAlgorithmIdentifier; +use function array_key_exists; /** * Factory class to parse AlgorithmIdentifier ASN.1 types to specific algorithm identifier objects. diff --git a/src/CryptoTypes/AlgorithmIdentifier/Cipher/CipherAlgorithmIdentifier.php b/src/CryptoTypes/AlgorithmIdentifier/Cipher/CipherAlgorithmIdentifier.php index 42cebdbd..feb4cc58 100644 --- a/src/CryptoTypes/AlgorithmIdentifier/Cipher/CipherAlgorithmIdentifier.php +++ b/src/CryptoTypes/AlgorithmIdentifier/Cipher/CipherAlgorithmIdentifier.php @@ -4,9 +4,9 @@ namespace SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Cipher; -use function mb_strlen; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\SpecificAlgorithmIdentifier; use UnexpectedValueException; +use function mb_strlen; /** * Base class for cipher algorithm identifiers. diff --git a/src/CryptoTypes/Asymmetric/EC/ECConversion.php b/src/CryptoTypes/Asymmetric/EC/ECConversion.php index 136f6e82..05cd130b 100644 --- a/src/CryptoTypes/Asymmetric/EC/ECConversion.php +++ b/src/CryptoTypes/Asymmetric/EC/ECConversion.php @@ -5,12 +5,12 @@ namespace SpomkyLabs\Pki\CryptoTypes\Asymmetric\EC; use Brick\Math\BigInteger; -use function mb_strlen; use RangeException; use RuntimeException; use SpomkyLabs\Pki\ASN1\Type\Primitive\BitString; use SpomkyLabs\Pki\ASN1\Type\Primitive\Integer; use SpomkyLabs\Pki\ASN1\Type\Primitive\OctetString; +use function mb_strlen; /** * Implements data type conversions from SEC 1: Elliptic Curve Cryptography. diff --git a/src/CryptoTypes/Asymmetric/EC/ECPublicKey.php b/src/CryptoTypes/Asymmetric/EC/ECPublicKey.php index 00c9e52f..5ff88773 100644 --- a/src/CryptoTypes/Asymmetric/EC/ECPublicKey.php +++ b/src/CryptoTypes/Asymmetric/EC/ECPublicKey.php @@ -4,12 +4,8 @@ namespace SpomkyLabs\Pki\CryptoTypes\Asymmetric\EC; -use function array_key_exists; -use function in_array; use InvalidArgumentException; use LogicException; -use function mb_strlen; -use function ord; use RuntimeException; use SpomkyLabs\Pki\ASN1\Type\Primitive\BitString; use SpomkyLabs\Pki\ASN1\Type\Primitive\Integer; @@ -21,6 +17,10 @@ use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PublicKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PublicKeyInfo; use UnexpectedValueException; +use function array_key_exists; +use function in_array; +use function mb_strlen; +use function ord; /** * Implements elliptic curve public key type as specified by RFC 5480. diff --git a/src/CryptoTypes/Asymmetric/OneAsymmetricKey.php b/src/CryptoTypes/Asymmetric/OneAsymmetricKey.php index ab976536..0ead2180 100644 --- a/src/CryptoTypes/Asymmetric/OneAsymmetricKey.php +++ b/src/CryptoTypes/Asymmetric/OneAsymmetricKey.php @@ -4,7 +4,6 @@ namespace SpomkyLabs\Pki\CryptoTypes\Asymmetric; -use function in_array; use LogicException; use RuntimeException; use SpomkyLabs\Pki\ASN1\Element; @@ -26,6 +25,7 @@ use SpomkyLabs\Pki\CryptoTypes\Asymmetric\RFC8410\Curve448\X448PrivateKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\RSA\RSAPrivateKey; use UnexpectedValueException; +use function in_array; /** * Implements PKCS #8 PrivateKeyInfo / OneAsymmetricKey ASN.1 type. diff --git a/src/CryptoTypes/Asymmetric/PublicKeyInfo.php b/src/CryptoTypes/Asymmetric/PublicKeyInfo.php index 9e199628..ce92b2ed 100644 --- a/src/CryptoTypes/Asymmetric/PublicKeyInfo.php +++ b/src/CryptoTypes/Asymmetric/PublicKeyInfo.php @@ -4,8 +4,6 @@ namespace SpomkyLabs\Pki\CryptoTypes\Asymmetric; -use function chr; -use function ord; use RuntimeException; use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence; use SpomkyLabs\Pki\ASN1\Type\Primitive\BitString; @@ -21,6 +19,8 @@ use SpomkyLabs\Pki\CryptoTypes\Asymmetric\RFC8410\Curve448\X448PublicKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\RSA\RSAPublicKey; use UnexpectedValueException; +use function chr; +use function ord; /** * Implements X.509 SubjectPublicKeyInfo ASN.1 type. diff --git a/src/CryptoTypes/Asymmetric/RFC8410/Curve25519/Curve25519PrivateKey.php b/src/CryptoTypes/Asymmetric/RFC8410/Curve25519/Curve25519PrivateKey.php index 9859eab5..606f6120 100644 --- a/src/CryptoTypes/Asymmetric/RFC8410/Curve25519/Curve25519PrivateKey.php +++ b/src/CryptoTypes/Asymmetric/RFC8410/Curve25519/Curve25519PrivateKey.php @@ -4,9 +4,9 @@ namespace SpomkyLabs\Pki\CryptoTypes\Asymmetric\RFC8410\Curve25519; -use function mb_strlen; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\RFC8410\RFC8410PrivateKey; use UnexpectedValueException; +use function mb_strlen; /** * Implements an intermediary object to store a private key using Curve25519. diff --git a/src/CryptoTypes/Asymmetric/RFC8410/Curve25519/Curve25519PublicKey.php b/src/CryptoTypes/Asymmetric/RFC8410/Curve25519/Curve25519PublicKey.php index c4de027e..beec2092 100644 --- a/src/CryptoTypes/Asymmetric/RFC8410/Curve25519/Curve25519PublicKey.php +++ b/src/CryptoTypes/Asymmetric/RFC8410/Curve25519/Curve25519PublicKey.php @@ -4,9 +4,9 @@ namespace SpomkyLabs\Pki\CryptoTypes\Asymmetric\RFC8410\Curve25519; -use function mb_strlen; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\RFC8410\RFC8410PublicKey; use UnexpectedValueException; +use function mb_strlen; /** * Implements an intermediary object to store a public key using Curve25519. diff --git a/src/CryptoTypes/Asymmetric/RFC8410/Curve448/Ed448PrivateKey.php b/src/CryptoTypes/Asymmetric/RFC8410/Curve448/Ed448PrivateKey.php index 9675d8aa..acdfddd8 100644 --- a/src/CryptoTypes/Asymmetric/RFC8410/Curve448/Ed448PrivateKey.php +++ b/src/CryptoTypes/Asymmetric/RFC8410/Curve448/Ed448PrivateKey.php @@ -5,13 +5,13 @@ namespace SpomkyLabs\Pki\CryptoTypes\Asymmetric\RFC8410\Curve448; use LogicException; -use function mb_strlen; use SpomkyLabs\Pki\ASN1\Type\Primitive\OctetString; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Asymmetric\Ed448AlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Feature\AlgorithmIdentifierType; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PublicKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\RFC8410\RFC8410PrivateKey; use UnexpectedValueException; +use function mb_strlen; /** * Implements an intermediary class to store Ed448 private key. diff --git a/src/CryptoTypes/Asymmetric/RFC8410/Curve448/Ed448PublicKey.php b/src/CryptoTypes/Asymmetric/RFC8410/Curve448/Ed448PublicKey.php index f8d1c2c8..d106c4f2 100644 --- a/src/CryptoTypes/Asymmetric/RFC8410/Curve448/Ed448PublicKey.php +++ b/src/CryptoTypes/Asymmetric/RFC8410/Curve448/Ed448PublicKey.php @@ -4,11 +4,11 @@ namespace SpomkyLabs\Pki\CryptoTypes\Asymmetric\RFC8410\Curve448; -use function mb_strlen; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Asymmetric\Ed448AlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Feature\AlgorithmIdentifierType; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\RFC8410\RFC8410PublicKey; use UnexpectedValueException; +use function mb_strlen; /** * Implements an intermediary class to store Ed448 public key. diff --git a/src/CryptoTypes/Asymmetric/RFC8410/Curve448/X448PrivateKey.php b/src/CryptoTypes/Asymmetric/RFC8410/Curve448/X448PrivateKey.php index 4cd12d3a..06d263b1 100644 --- a/src/CryptoTypes/Asymmetric/RFC8410/Curve448/X448PrivateKey.php +++ b/src/CryptoTypes/Asymmetric/RFC8410/Curve448/X448PrivateKey.php @@ -5,13 +5,13 @@ namespace SpomkyLabs\Pki\CryptoTypes\Asymmetric\RFC8410\Curve448; use LogicException; -use function mb_strlen; use SpomkyLabs\Pki\ASN1\Type\Primitive\OctetString; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Asymmetric\X448AlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Feature\AlgorithmIdentifierType; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PublicKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\RFC8410\RFC8410PrivateKey; use UnexpectedValueException; +use function mb_strlen; /** * Implements an intermediary class to store X448 private key. diff --git a/src/CryptoTypes/Asymmetric/RFC8410/Curve448/X448PublicKey.php b/src/CryptoTypes/Asymmetric/RFC8410/Curve448/X448PublicKey.php index 3eab381a..6d668075 100644 --- a/src/CryptoTypes/Asymmetric/RFC8410/Curve448/X448PublicKey.php +++ b/src/CryptoTypes/Asymmetric/RFC8410/Curve448/X448PublicKey.php @@ -4,11 +4,11 @@ namespace SpomkyLabs\Pki\CryptoTypes\Asymmetric\RFC8410\Curve448; -use function mb_strlen; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Asymmetric\X448AlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Feature\AlgorithmIdentifierType; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\RFC8410\RFC8410PublicKey; use UnexpectedValueException; +use function mb_strlen; /** * Implements an intermediary class to store X448 public key. diff --git a/src/CryptoTypes/Signature/Ed25519Signature.php b/src/CryptoTypes/Signature/Ed25519Signature.php index 3cbec3bf..3a477668 100644 --- a/src/CryptoTypes/Signature/Ed25519Signature.php +++ b/src/CryptoTypes/Signature/Ed25519Signature.php @@ -5,8 +5,8 @@ namespace SpomkyLabs\Pki\CryptoTypes\Signature; use InvalidArgumentException; -use function mb_strlen; use SpomkyLabs\Pki\ASN1\Type\Primitive\BitString; +use function mb_strlen; /** * Implements Ed25519 signature value. diff --git a/src/CryptoTypes/Signature/Ed448Signature.php b/src/CryptoTypes/Signature/Ed448Signature.php index 7e78eeb3..26324910 100644 --- a/src/CryptoTypes/Signature/Ed448Signature.php +++ b/src/CryptoTypes/Signature/Ed448Signature.php @@ -5,8 +5,8 @@ namespace SpomkyLabs\Pki\CryptoTypes\Signature; use InvalidArgumentException; -use function mb_strlen; use SpomkyLabs\Pki\ASN1\Type\Primitive\BitString; +use function mb_strlen; /** * Implements Ed448 signature value. diff --git a/src/X501/ASN1/Attribute.php b/src/X501/ASN1/Attribute.php index 1185f720..093d43b1 100644 --- a/src/X501/ASN1/Attribute.php +++ b/src/X501/ASN1/Attribute.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X501\ASN1; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use LogicException; @@ -13,6 +12,7 @@ use SpomkyLabs\Pki\ASN1\Type\Constructed\Set; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; use SpomkyLabs\Pki\X501\ASN1\AttributeValue\AttributeValue; +use function count; /** * Implements *Attribute* ASN.1 type. diff --git a/src/X501/ASN1/AttributeType.php b/src/X501/ASN1/AttributeType.php index 2cb3f514..adde4278 100644 --- a/src/X501/ASN1/AttributeType.php +++ b/src/X501/ASN1/AttributeType.php @@ -4,13 +4,13 @@ namespace SpomkyLabs\Pki\X501\ASN1; -use function array_key_exists; use OutOfBoundsException; use SpomkyLabs\Pki\ASN1\Element; use SpomkyLabs\Pki\ASN1\Type\Primitive\ObjectIdentifier; use SpomkyLabs\Pki\ASN1\Type\Primitive\PrintableString; use SpomkyLabs\Pki\ASN1\Type\Primitive\UTF8String; use SpomkyLabs\Pki\ASN1\Type\StringType; +use function array_key_exists; /** * Implements *AttributeType* ASN.1 type. diff --git a/src/X501/ASN1/AttributeValue/AttributeValue.php b/src/X501/ASN1/AttributeValue/AttributeValue.php index c3167ebb..9032fae8 100644 --- a/src/X501/ASN1/AttributeValue/AttributeValue.php +++ b/src/X501/ASN1/AttributeValue/AttributeValue.php @@ -4,7 +4,6 @@ namespace SpomkyLabs\Pki\X501\ASN1\AttributeValue; -use function array_key_exists; use SpomkyLabs\Pki\ASN1\Element; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; use SpomkyLabs\Pki\X501\ASN1\Attribute; @@ -12,6 +11,7 @@ use SpomkyLabs\Pki\X501\ASN1\AttributeTypeAndValue; use SpomkyLabs\Pki\X501\MatchingRule\MatchingRule; use Stringable; +use function array_key_exists; /** * Base class for attribute values. diff --git a/src/X501/ASN1/AttributeValue/Feature/DirectoryString.php b/src/X501/ASN1/AttributeValue/Feature/DirectoryString.php index 74530f17..d07891b1 100644 --- a/src/X501/ASN1/AttributeValue/Feature/DirectoryString.php +++ b/src/X501/ASN1/AttributeValue/Feature/DirectoryString.php @@ -4,7 +4,6 @@ namespace SpomkyLabs\Pki\X501\ASN1\AttributeValue\Feature; -use function array_key_exists; use SpomkyLabs\Pki\ASN1\Element; use SpomkyLabs\Pki\ASN1\Type\Primitive\BMPString; use SpomkyLabs\Pki\ASN1\Type\Primitive\PrintableString; @@ -18,6 +17,7 @@ use SpomkyLabs\Pki\X501\MatchingRule\MatchingRule; use SpomkyLabs\Pki\X501\StringPrep\TranscodeStep; use UnexpectedValueException; +use function array_key_exists; /** * Base class for attribute values having *(Unbounded)DirectoryString* as a syntax. diff --git a/src/X501/ASN1/Collection/AttributeCollection.php b/src/X501/ASN1/Collection/AttributeCollection.php index 575dc250..998767bb 100644 --- a/src/X501/ASN1/Collection/AttributeCollection.php +++ b/src/X501/ASN1/Collection/AttributeCollection.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X501\ASN1\Collection; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use SpomkyLabs\Pki\ASN1\Type\Structure; @@ -13,6 +12,7 @@ use SpomkyLabs\Pki\X501\ASN1\Attribute; use SpomkyLabs\Pki\X501\ASN1\AttributeType; use UnexpectedValueException; +use function count; /** * Base class for X.501 attribute containers. diff --git a/src/X501/ASN1/Name.php b/src/X501/ASN1/Name.php index 4b588354..b9163bfa 100644 --- a/src/X501/ASN1/Name.php +++ b/src/X501/ASN1/Name.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X501\ASN1; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use RangeException; @@ -15,6 +14,7 @@ use SpomkyLabs\Pki\X501\ASN1\AttributeValue\AttributeValue; use SpomkyLabs\Pki\X501\DN\DNParser; use Stringable; +use function count; /** * Implements *Name* ASN.1 type. diff --git a/src/X501/ASN1/RDN.php b/src/X501/ASN1/RDN.php index ec159b35..51ea3303 100644 --- a/src/X501/ASN1/RDN.php +++ b/src/X501/ASN1/RDN.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X501\ASN1; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use SpomkyLabs\Pki\ASN1\Type\Constructed\Set; @@ -13,6 +12,7 @@ use SpomkyLabs\Pki\X501\ASN1\AttributeValue\AttributeValue; use Stringable; use UnexpectedValueException; +use function count; /** * Implements *RelativeDistinguishedName* ASN.1 type. diff --git a/src/X501/DN/DNParser.php b/src/X501/DN/DNParser.php index 340b72ec..1e464125 100644 --- a/src/X501/DN/DNParser.php +++ b/src/X501/DN/DNParser.php @@ -4,11 +4,11 @@ namespace SpomkyLabs\Pki\X501\DN; -use function mb_strlen; use SpomkyLabs\Pki\ASN1\Element; use SpomkyLabs\Pki\ASN1\Exception\DecodeException; use SpomkyLabs\Pki\ASN1\Feature\ElementBase; use UnexpectedValueException; +use function mb_strlen; /** * Distinguished Name parsing conforming to RFC 2253 and RFC 1779. @@ -60,9 +60,9 @@ public static function escapeString(string $str): string // one of the characters ",", "+", """, "\", "<", ">" or ";" $str = preg_replace('/([,\+"\\\<\>;])/u', '\\\\$1', $str); // a space character occurring at the end of the string - $str = preg_replace('/( )$/u', '\\\\$1', $str); + $str = preg_replace('/( )$/u', '\\\\$1', (string) $str); // a space or "#" character occurring at the beginning of the string - $str = preg_replace('/^([ #])/u', '\\\\$1', $str); + $str = preg_replace('/^([ #])/u', '\\\\$1', (string) $str); // implementation specific special characters $str = preg_replace_callback( '/([\pC])/u', @@ -70,7 +70,7 @@ function ($m) { $octets = mb_str_split(bin2hex($m[1]), 2, '8bit'); return implode('', array_map(static fn ($octet) => '\\' . mb_strtoupper($octet, '8bit'), $octets)); }, - $str + (string) $str ); return $str; } diff --git a/src/X501/StringPrep/InsignificantNonSubstringSpaceStep.php b/src/X501/StringPrep/InsignificantNonSubstringSpaceStep.php index 54494202..b3ff319e 100644 --- a/src/X501/StringPrep/InsignificantNonSubstringSpaceStep.php +++ b/src/X501/StringPrep/InsignificantNonSubstringSpaceStep.php @@ -24,9 +24,9 @@ public function apply(string $string): string } // trim leading and trailing spaces $string = preg_replace('/^\p{Zs}+/u', '', $string); - $string = preg_replace('/\p{Zs}+$/u', '', $string); + $string = preg_replace('/\p{Zs}+$/u', '', (string) $string); // convert inner space sequences to two U+0020 characters - $string = preg_replace('/\p{Zs}+/u', ' ', $string); + $string = preg_replace('/\p{Zs}+/u', ' ', (string) $string); return " {$string} "; } } diff --git a/src/X501/StringPrep/TranscodeStep.php b/src/X501/StringPrep/TranscodeStep.php index 58f94d3c..ff58611b 100644 --- a/src/X501/StringPrep/TranscodeStep.php +++ b/src/X501/StringPrep/TranscodeStep.php @@ -4,10 +4,10 @@ namespace SpomkyLabs\Pki\X501\StringPrep; -use function in_array; use LogicException; use SpomkyLabs\Pki\ASN1\Element; use SpomkyLabs\Pki\ASN1\Type\Primitive\T61String; +use function in_array; /** * Implements 'Transcode' step of the Internationalized String Preparation as specified by RFC 4518. diff --git a/src/X509/AttributeCertificate/Attribute/IetfAttrSyntax.php b/src/X509/AttributeCertificate/Attribute/IetfAttrSyntax.php index 5fcabe1c..559fed4c 100644 --- a/src/X509/AttributeCertificate/Attribute/IetfAttrSyntax.php +++ b/src/X509/AttributeCertificate/Attribute/IetfAttrSyntax.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X509\AttributeCertificate\Attribute; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use LogicException; @@ -17,6 +16,7 @@ use SpomkyLabs\Pki\X501\MatchingRule\BinaryMatch; use SpomkyLabs\Pki\X501\MatchingRule\MatchingRule; use SpomkyLabs\Pki\X509\GeneralName\GeneralNames; +use function count; /** * Base class implementing *IetfAttrSyntax* ASN.1 type used by attribute certificate attribute values. diff --git a/src/X509/AttributeCertificate/AttributeCertificateInfo.php b/src/X509/AttributeCertificate/AttributeCertificateInfo.php index e49046ba..d17f1980 100644 --- a/src/X509/AttributeCertificate/AttributeCertificateInfo.php +++ b/src/X509/AttributeCertificate/AttributeCertificateInfo.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X509\AttributeCertificate; use Brick\Math\BigInteger; -use function count; use LogicException; use SpomkyLabs\Pki\ASN1\Element; use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence; @@ -17,8 +16,9 @@ use SpomkyLabs\Pki\X509\Certificate\Extension\Extension; use SpomkyLabs\Pki\X509\Certificate\Extensions; use SpomkyLabs\Pki\X509\Certificate\UniqueIdentifier; -use function strval; use UnexpectedValueException; +use function count; +use function strval; /** * Implements *AttributeCertificateInfo* ASN.1 type. diff --git a/src/X509/AttributeCertificate/Validation/ACValidator.php b/src/X509/AttributeCertificate/Validation/ACValidator.php index cdd8adf2..934427ce 100644 --- a/src/X509/AttributeCertificate/Validation/ACValidator.php +++ b/src/X509/AttributeCertificate/Validation/ACValidator.php @@ -4,7 +4,6 @@ namespace SpomkyLabs\Pki\X509\AttributeCertificate\Validation; -use function count; use SpomkyLabs\Pki\CryptoBridge\Crypto; use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificate; use SpomkyLabs\Pki\X509\AttributeCertificate\Validation\Exception\ACValidationException; @@ -14,6 +13,7 @@ use SpomkyLabs\Pki\X509\Certificate\Extension\TargetInformationExtension; use SpomkyLabs\Pki\X509\CertificationPath\Exception\PathValidationException; use SpomkyLabs\Pki\X509\CertificationPath\PathValidation\PathValidationConfig; +use function count; /** * Implements attribute certificate validation conforming to RFC 5755. diff --git a/src/X509/Certificate/CertificateBundle.php b/src/X509/Certificate/CertificateBundle.php index 3f1a535b..9429cdc5 100644 --- a/src/X509/Certificate/CertificateBundle.php +++ b/src/X509/Certificate/CertificateBundle.php @@ -5,11 +5,11 @@ namespace SpomkyLabs\Pki\X509\Certificate; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoEncoding\PEMBundle; +use function count; /** * Implements a list of certificates. diff --git a/src/X509/Certificate/CertificateChain.php b/src/X509/Certificate/CertificateChain.php index 4ad1704e..d4ef84ce 100644 --- a/src/X509/Certificate/CertificateChain.php +++ b/src/X509/Certificate/CertificateChain.php @@ -5,13 +5,13 @@ namespace SpomkyLabs\Pki\X509\Certificate; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use LogicException; use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoEncoding\PEMBundle; use SpomkyLabs\Pki\X509\CertificationPath\CertificationPath; +use function count; /** * Ordered list of certificates from the end-entity to the trust anchor. diff --git a/src/X509/Certificate/Extension/AuthorityInformationAccessExtension.php b/src/X509/Certificate/Extension/AuthorityInformationAccessExtension.php index 7219b228..3fbcd886 100644 --- a/src/X509/Certificate/Extension/AuthorityInformationAccessExtension.php +++ b/src/X509/Certificate/Extension/AuthorityInformationAccessExtension.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X509\Certificate\Extension; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use SpomkyLabs\Pki\ASN1\Element; @@ -13,6 +12,7 @@ use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; use SpomkyLabs\Pki\X509\Certificate\Extension\AccessDescription\AccessDescription; use SpomkyLabs\Pki\X509\Certificate\Extension\AccessDescription\AuthorityAccessDescription; +use function count; /** * Implements 'Authority Information Access' extension. diff --git a/src/X509/Certificate/Extension/CRLDistributionPointsExtension.php b/src/X509/Certificate/Extension/CRLDistributionPointsExtension.php index 7e50d504..77aee6dd 100644 --- a/src/X509/Certificate/Extension/CRLDistributionPointsExtension.php +++ b/src/X509/Certificate/Extension/CRLDistributionPointsExtension.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X509\Certificate\Extension; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use LogicException; @@ -14,6 +13,7 @@ use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; use SpomkyLabs\Pki\X509\Certificate\Extension\DistributionPoint\DistributionPoint; use UnexpectedValueException; +use function count; /** * Implements 'CRL Distribution Points' certificate extension. diff --git a/src/X509/Certificate/Extension/CertificatePoliciesExtension.php b/src/X509/Certificate/Extension/CertificatePoliciesExtension.php index e834d8c7..9112bc8e 100644 --- a/src/X509/Certificate/Extension/CertificatePoliciesExtension.php +++ b/src/X509/Certificate/Extension/CertificatePoliciesExtension.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X509\Certificate\Extension; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use LogicException; @@ -14,6 +13,7 @@ use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; use UnexpectedValueException; +use function count; /** * Implements 'Certificate Policies' certificate extension. diff --git a/src/X509/Certificate/Extension/CertificatePolicy/PolicyInformation.php b/src/X509/Certificate/Extension/CertificatePolicy/PolicyInformation.php index 7d505687..0ca3d55a 100644 --- a/src/X509/Certificate/Extension/CertificatePolicy/PolicyInformation.php +++ b/src/X509/Certificate/Extension/CertificatePolicy/PolicyInformation.php @@ -5,13 +5,13 @@ namespace SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use LogicException; use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence; use SpomkyLabs\Pki\ASN1\Type\Primitive\ObjectIdentifier; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; +use function count; /** * Implements *PolicyInformation* ASN.1 type used by 'Certificate Policies' certificate extension. diff --git a/src/X509/Certificate/Extension/ExtendedKeyUsageExtension.php b/src/X509/Certificate/Extension/ExtendedKeyUsageExtension.php index bfa39b55..f77cd069 100644 --- a/src/X509/Certificate/Extension/ExtendedKeyUsageExtension.php +++ b/src/X509/Certificate/Extension/ExtendedKeyUsageExtension.php @@ -5,14 +5,14 @@ namespace SpomkyLabs\Pki\X509\Certificate\Extension; use ArrayIterator; -use function count; use Countable; -use function in_array; use IteratorAggregate; use SpomkyLabs\Pki\ASN1\Element; use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence; use SpomkyLabs\Pki\ASN1\Type\Primitive\ObjectIdentifier; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; +use function count; +use function in_array; /** * Implements 'Extended Key Usage' certificate extension. diff --git a/src/X509/Certificate/Extension/Extension.php b/src/X509/Certificate/Extension/Extension.php index a6ad47dc..da4a80c0 100644 --- a/src/X509/Certificate/Extension/Extension.php +++ b/src/X509/Certificate/Extension/Extension.php @@ -4,13 +4,13 @@ namespace SpomkyLabs\Pki\X509\Certificate\Extension; -use function array_key_exists; use SpomkyLabs\Pki\ASN1\Element; use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence; use SpomkyLabs\Pki\ASN1\Type\Primitive\Boolean; use SpomkyLabs\Pki\ASN1\Type\Primitive\ObjectIdentifier; use SpomkyLabs\Pki\ASN1\Type\Primitive\OctetString; use Stringable; +use function array_key_exists; /** * Base class for certificate extensions. diff --git a/src/X509/Certificate/Extension/NameConstraints/GeneralSubtree.php b/src/X509/Certificate/Extension/NameConstraints/GeneralSubtree.php index bc55ca40..e0117a48 100644 --- a/src/X509/Certificate/Extension/NameConstraints/GeneralSubtree.php +++ b/src/X509/Certificate/Extension/NameConstraints/GeneralSubtree.php @@ -4,12 +4,12 @@ namespace SpomkyLabs\Pki\X509\Certificate\Extension\NameConstraints; -use function count; use SpomkyLabs\Pki\ASN1\Element; use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence; use SpomkyLabs\Pki\ASN1\Type\Primitive\Integer; use SpomkyLabs\Pki\ASN1\Type\Tagged\ImplicitlyTaggedType; use SpomkyLabs\Pki\X509\GeneralName\GeneralName; +use function count; /** * Implements *GeneralSubtree* ASN.1 type used by 'Name Constraints' certificate extension. diff --git a/src/X509/Certificate/Extension/NameConstraints/GeneralSubtrees.php b/src/X509/Certificate/Extension/NameConstraints/GeneralSubtrees.php index f4f5b63d..a26908b4 100644 --- a/src/X509/Certificate/Extension/NameConstraints/GeneralSubtrees.php +++ b/src/X509/Certificate/Extension/NameConstraints/GeneralSubtrees.php @@ -5,13 +5,13 @@ namespace SpomkyLabs\Pki\X509\Certificate\Extension\NameConstraints; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use LogicException; use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; use UnexpectedValueException; +use function count; /** * Implements *GeneralSubtrees* ASN.1 type used by 'Name Constraints' certificate extension. diff --git a/src/X509/Certificate/Extension/PolicyMappingsExtension.php b/src/X509/Certificate/Extension/PolicyMappingsExtension.php index d2ba7720..ec142aa9 100644 --- a/src/X509/Certificate/Extension/PolicyMappingsExtension.php +++ b/src/X509/Certificate/Extension/PolicyMappingsExtension.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X509\Certificate\Extension; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use LogicException; @@ -15,6 +14,7 @@ use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; use SpomkyLabs\Pki\X509\Certificate\Extension\PolicyMappings\PolicyMapping; use UnexpectedValueException; +use function count; /** * Implements 'Policy Mappings' certificate extension. diff --git a/src/X509/Certificate/Extension/SubjectDirectoryAttributesExtension.php b/src/X509/Certificate/Extension/SubjectDirectoryAttributesExtension.php index 2e2c787a..51f8f405 100644 --- a/src/X509/Certificate/Extension/SubjectDirectoryAttributesExtension.php +++ b/src/X509/Certificate/Extension/SubjectDirectoryAttributesExtension.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X509\Certificate\Extension; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use LogicException; @@ -14,6 +13,7 @@ use SpomkyLabs\Pki\X501\ASN1\Attribute; use SpomkyLabs\Pki\X501\ASN1\Collection\SequenceOfAttributes; use UnexpectedValueException; +use function count; /** * Implements 'Subject Directory Attributes' certificate extension. diff --git a/src/X509/Certificate/Extension/SubjectInformationAccessExtension.php b/src/X509/Certificate/Extension/SubjectInformationAccessExtension.php index 7ea45ec5..a000bef3 100644 --- a/src/X509/Certificate/Extension/SubjectInformationAccessExtension.php +++ b/src/X509/Certificate/Extension/SubjectInformationAccessExtension.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X509\Certificate\Extension; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use SpomkyLabs\Pki\ASN1\Element; @@ -13,6 +12,7 @@ use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; use SpomkyLabs\Pki\X509\Certificate\Extension\AccessDescription\AccessDescription; use SpomkyLabs\Pki\X509\Certificate\Extension\AccessDescription\SubjectAccessDescription; +use function count; /** * Implements 'Subject Information Access' extension. diff --git a/src/X509/Certificate/Extension/Target/Targets.php b/src/X509/Certificate/Extension/Target/Targets.php index b1d24ae9..4961bb0b 100644 --- a/src/X509/Certificate/Extension/Target/Targets.php +++ b/src/X509/Certificate/Extension/Target/Targets.php @@ -5,11 +5,11 @@ namespace SpomkyLabs\Pki\X509\Certificate\Extension\Target; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; +use function count; /** * Implements *Targets* ASN.1 type as a *SEQUENCE OF Target*. diff --git a/src/X509/Certificate/Extension/TargetInformationExtension.php b/src/X509/Certificate/Extension/TargetInformationExtension.php index 8e1208e9..41f72be0 100644 --- a/src/X509/Certificate/Extension/TargetInformationExtension.php +++ b/src/X509/Certificate/Extension/TargetInformationExtension.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X509\Certificate\Extension; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use SpomkyLabs\Pki\ASN1\Element; @@ -13,6 +12,7 @@ use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; use SpomkyLabs\Pki\X509\Certificate\Extension\Target\Target; use SpomkyLabs\Pki\X509\Certificate\Extension\Target\Targets; +use function count; /** * Implements 'AC Targeting' certificate extension. diff --git a/src/X509/Certificate/Extensions.php b/src/X509/Certificate/Extensions.php index 9e558670..692380ae 100644 --- a/src/X509/Certificate/Extensions.php +++ b/src/X509/Certificate/Extensions.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X509\Certificate; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use LogicException; @@ -26,6 +25,7 @@ use SpomkyLabs\Pki\X509\Certificate\Extension\SubjectAlternativeNameExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\SubjectKeyIdentifierExtension; use Traversable; +use function count; /** * Implements *Extensions* ASN.1 type. diff --git a/src/X509/Certificate/TBSCertificate.php b/src/X509/Certificate/TBSCertificate.php index 67fc2b1f..c917e369 100644 --- a/src/X509/Certificate/TBSCertificate.php +++ b/src/X509/Certificate/TBSCertificate.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X509\Certificate; use Brick\Math\BigInteger; -use function count; use LogicException; use SpomkyLabs\Pki\ASN1\Element; use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence; @@ -22,8 +21,9 @@ use SpomkyLabs\Pki\X509\Certificate\Extension\Extension; use SpomkyLabs\Pki\X509\Certificate\Extension\SubjectKeyIdentifierExtension; use SpomkyLabs\Pki\X509\CertificationRequest\CertificationRequest; -use function strval; use UnexpectedValueException; +use function count; +use function strval; /** * Implements *TBSCertificate* ASN.1 type. diff --git a/src/X509/CertificationPath/CertificationPath.php b/src/X509/CertificationPath/CertificationPath.php index 6bc9d515..098af86b 100644 --- a/src/X509/CertificationPath/CertificationPath.php +++ b/src/X509/CertificationPath/CertificationPath.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X509\CertificationPath; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use LogicException; @@ -17,6 +16,7 @@ use SpomkyLabs\Pki\X509\CertificationPath\PathValidation\PathValidationConfig; use SpomkyLabs\Pki\X509\CertificationPath\PathValidation\PathValidationResult; use SpomkyLabs\Pki\X509\CertificationPath\PathValidation\PathValidator; +use function count; /** * Implements certification path structure. diff --git a/src/X509/CertificationPath/PathBuilding/CertificationPathBuilder.php b/src/X509/CertificationPath/PathBuilding/CertificationPathBuilder.php index ac6ed1b0..b802cc90 100644 --- a/src/X509/CertificationPath/PathBuilding/CertificationPathBuilder.php +++ b/src/X509/CertificationPath/PathBuilding/CertificationPathBuilder.php @@ -4,11 +4,11 @@ namespace SpomkyLabs\Pki\X509\CertificationPath\PathBuilding; -use function count; use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\CertificateBundle; use SpomkyLabs\Pki\X509\CertificationPath\CertificationPath; use SpomkyLabs\Pki\X509\CertificationPath\Exception\PathBuildingException; +use function count; /** * Class for resolving certification paths. diff --git a/src/X509/CertificationPath/PathValidation/PathValidationResult.php b/src/X509/CertificationPath/PathValidation/PathValidationResult.php index 292174ca..b80e89f5 100644 --- a/src/X509/CertificationPath/PathValidation/PathValidationResult.php +++ b/src/X509/CertificationPath/PathValidation/PathValidationResult.php @@ -4,13 +4,13 @@ namespace SpomkyLabs\Pki\X509\CertificationPath\PathValidation; -use function count; use SpomkyLabs\Pki\ASN1\Element; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Feature\AlgorithmIdentifierType; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PublicKeyInfo; use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; use SpomkyLabs\Pki\X509\CertificationPath\Policy\PolicyTree; +use function count; /** * Result of the path validation process. diff --git a/src/X509/CertificationPath/PathValidation/PathValidator.php b/src/X509/CertificationPath/PathValidation/PathValidator.php index ba67af4c..8a64596c 100644 --- a/src/X509/CertificationPath/PathValidation/PathValidator.php +++ b/src/X509/CertificationPath/PathValidation/PathValidator.php @@ -4,8 +4,6 @@ namespace SpomkyLabs\Pki\X509\CertificationPath\PathValidation; -use function count; -use function in_array; use LogicException; use RuntimeException; use SpomkyLabs\Pki\CryptoBridge\Crypto; @@ -13,6 +11,8 @@ use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; use SpomkyLabs\Pki\X509\Certificate\TBSCertificate; use SpomkyLabs\Pki\X509\CertificationPath\Exception\PathValidationException; +use function count; +use function in_array; /** * Implements certification path validation. diff --git a/src/X509/CertificationPath/Policy/PolicyNode.php b/src/X509/CertificationPath/Policy/PolicyNode.php index ede2a995..f355276b 100644 --- a/src/X509/CertificationPath/Policy/PolicyNode.php +++ b/src/X509/CertificationPath/Policy/PolicyNode.php @@ -5,12 +5,12 @@ namespace SpomkyLabs\Pki\X509\CertificationPath\Policy; use ArrayIterator; -use function count; use Countable; -use function in_array; use IteratorAggregate; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyQualifierInfo; +use function count; +use function in_array; /** * Policy node class for certification path validation. diff --git a/src/X509/CertificationPath/Policy/PolicyTree.php b/src/X509/CertificationPath/Policy/PolicyTree.php index 5f70e740..56ee3550 100644 --- a/src/X509/CertificationPath/Policy/PolicyTree.php +++ b/src/X509/CertificationPath/Policy/PolicyTree.php @@ -4,12 +4,12 @@ namespace SpomkyLabs\Pki\X509\CertificationPath\Policy; -use function count; -use function in_array; use LogicException; use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; use SpomkyLabs\Pki\X509\CertificationPath\PathValidation\ValidatorState; +use function count; +use function in_array; final class PolicyTree { diff --git a/src/X509/GeneralName/GeneralNames.php b/src/X509/GeneralName/GeneralNames.php index c139e01f..1854f3d7 100644 --- a/src/X509/GeneralName/GeneralNames.php +++ b/src/X509/GeneralName/GeneralNames.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\X509\GeneralName; use ArrayIterator; -use function count; use Countable; use IteratorAggregate; use LogicException; @@ -14,6 +13,7 @@ use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; use SpomkyLabs\Pki\X501\ASN1\Name; use UnexpectedValueException; +use function count; /** * Implements *GeneralNames* ASN.1 type. diff --git a/src/X509/GeneralName/IPAddress.php b/src/X509/GeneralName/IPAddress.php index ba55f527..38d44b5f 100644 --- a/src/X509/GeneralName/IPAddress.php +++ b/src/X509/GeneralName/IPAddress.php @@ -5,12 +5,12 @@ namespace SpomkyLabs\Pki\X509\GeneralName; use LogicException; -use function mb_strlen; use SpomkyLabs\Pki\ASN1\Type\Primitive\OctetString; use SpomkyLabs\Pki\ASN1\Type\Tagged\ImplicitlyTaggedType; use SpomkyLabs\Pki\ASN1\Type\TaggedType; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; use UnexpectedValueException; +use function mb_strlen; /** * Implements *iPAddress* CHOICE type of *GeneralName*. diff --git a/src/X509/GeneralName/IPv4Address.php b/src/X509/GeneralName/IPv4Address.php index 459a9e4f..a5563b8e 100644 --- a/src/X509/GeneralName/IPv4Address.php +++ b/src/X509/GeneralName/IPv4Address.php @@ -4,9 +4,9 @@ namespace SpomkyLabs\Pki\X509\GeneralName; +use UnexpectedValueException; use function array_slice; use function count; -use UnexpectedValueException; final class IPv4Address extends IPAddress { diff --git a/src/X509/GeneralName/IPv6Address.php b/src/X509/GeneralName/IPv6Address.php index a7362bfc..a79983a7 100644 --- a/src/X509/GeneralName/IPv6Address.php +++ b/src/X509/GeneralName/IPv6Address.php @@ -4,9 +4,9 @@ namespace SpomkyLabs\Pki\X509\GeneralName; +use UnexpectedValueException; use function array_slice; use function count; -use UnexpectedValueException; final class IPv6Address extends IPAddress { diff --git a/tests/ASN1/Component/IdentifierDecodeTest.php b/tests/ASN1/Component/IdentifierDecodeTest.php index c1f5d93c..568db7ca 100644 --- a/tests/ASN1/Component/IdentifierDecodeTest.php +++ b/tests/ASN1/Component/IdentifierDecodeTest.php @@ -6,11 +6,11 @@ use Brick\Math\BigInteger; use Brick\Math\Exception\IntegerOverflowException; -use function chr; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use SpomkyLabs\Pki\ASN1\Component\Identifier; use SpomkyLabs\Pki\ASN1\Exception\DecodeException; +use function chr; /** * @internal @@ -56,7 +56,7 @@ public function private() public function pC() { $identifier = Identifier::fromDER(chr(0b00000000)); - static::assertEquals(Identifier::PRIMITIVE, $identifier->pc()); + static::assertSame(Identifier::PRIMITIVE, $identifier->pc()); } #[Test] @@ -77,28 +77,28 @@ public function constructed() public function tag() { $identifier = Identifier::fromDER(chr(0b00001111)); - static::assertEquals(0b1111, $identifier->tag()); + static::assertSame((string) 0b1111, $identifier->tag()); } #[Test] public function intTag() { $identifier = Identifier::fromDER(chr(0b00001111)); - static::assertEquals(0b1111, $identifier->intTag()); + static::assertSame(0b1111, $identifier->intTag()); } #[Test] public function longTag() { $identifier = Identifier::fromDER(chr(0b00011111) . "\x7f"); - static::assertEquals(0x7f, $identifier->tag()); + static::assertSame((string) 0x7f, $identifier->tag()); } #[Test] public function longTag2() { $identifier = Identifier::fromDER(chr(0b00011111) . "\xff\x7f"); - static::assertEquals((0x7f << 7) + 0x7f, $identifier->tag()); + static::assertSame((string) ((0x7f << 7) + 0x7f), $identifier->tag()); } #[Test] @@ -107,7 +107,7 @@ public function hugeTag() $der = "\x1f" . str_repeat("\xff", 100) . "\x7f"; $identifier = Identifier::fromDER($der); $num = BigInteger::fromBase(str_repeat('1111111', 100) . '1111111', 2); - static::assertEquals($num->toBase(10), $identifier->tag()); + static::assertSame($num->toBase(10), $identifier->tag()); } #[Test] diff --git a/tests/ASN1/Component/IdentifierEncodeTest.php b/tests/ASN1/Component/IdentifierEncodeTest.php index 6b0f9775..266fd69f 100644 --- a/tests/ASN1/Component/IdentifierEncodeTest.php +++ b/tests/ASN1/Component/IdentifierEncodeTest.php @@ -5,11 +5,11 @@ namespace SpomkyLabs\Pki\Test\ASN1\Component; use Brick\Math\BigInteger; -use function chr; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use SpomkyLabs\Pki\ASN1\Component\Identifier; use SpomkyLabs\Pki\ASN1\Element; +use function chr; /** * @internal @@ -20,14 +20,14 @@ final class IdentifierEncodeTest extends TestCase public function universal() { $identifier = Identifier::create(Identifier::CLASS_UNIVERSAL, Identifier::PRIMITIVE, Element::TYPE_BOOLEAN); - static::assertEquals(chr(0b00000001), $identifier->toDER()); + static::assertSame(chr(0b00000001), $identifier->toDER()); } #[Test] public function application() { $identifier = Identifier::create(Identifier::CLASS_APPLICATION, Identifier::PRIMITIVE, Element::TYPE_BOOLEAN); - static::assertEquals(chr(0b01000001), $identifier->toDER()); + static::assertSame(chr(0b01000001), $identifier->toDER()); } #[Test] @@ -38,28 +38,28 @@ public function contextSpecific() Identifier::PRIMITIVE, Element::TYPE_BOOLEAN ); - static::assertEquals(chr(0b10000001), $identifier->toDER()); + static::assertSame(chr(0b10000001), $identifier->toDER()); } #[Test] public function private() { $identifier = Identifier::create(Identifier::CLASS_PRIVATE, Identifier::PRIMITIVE, Element::TYPE_BOOLEAN); - static::assertEquals(chr(0b11000001), $identifier->toDER()); + static::assertSame(chr(0b11000001), $identifier->toDER()); } #[Test] public function constructed() { $identifier = Identifier::create(Identifier::CLASS_UNIVERSAL, Identifier::CONSTRUCTED, Element::TYPE_SEQUENCE); - static::assertEquals(chr(0b00110000), $identifier->toDER()); + static::assertSame(chr(0b00110000), $identifier->toDER()); } #[Test] public function longTag() { $identifier = Identifier::create(Identifier::CLASS_APPLICATION, Identifier::CONSTRUCTED, (0x7f << 7) + 0x7f); - static::assertEquals(chr(0b01111111) . "\xff\x7f", $identifier->toDER()); + static::assertSame(chr(0b01111111) . "\xff\x7f", $identifier->toDER()); } #[Test] @@ -67,6 +67,6 @@ public function hugeTag() { $num = BigInteger::fromBase(str_repeat('1111111', 100) . '1111111', 2); $identifier = Identifier::create(Identifier::CLASS_APPLICATION, Identifier::CONSTRUCTED, $num); - static::assertEquals(chr(0b01111111) . str_repeat("\xff", 100) . "\x7f", $identifier->toDER()); + static::assertSame(chr(0b01111111) . str_repeat("\xff", 100) . "\x7f", $identifier->toDER()); } } diff --git a/tests/ASN1/Component/IdentifierTest.php b/tests/ASN1/Component/IdentifierTest.php index e7ca5ef6..a7179b47 100644 --- a/tests/ASN1/Component/IdentifierTest.php +++ b/tests/ASN1/Component/IdentifierTest.php @@ -17,13 +17,13 @@ final class IdentifierTest extends TestCase public function classToName() { $name = Identifier::classToName(Identifier::CLASS_UNIVERSAL); - static::assertEquals('UNIVERSAL', $name); + static::assertSame('UNIVERSAL', $name); } #[Test] public function unknownClassToName() { $name = Identifier::classToName(0xff); - static::assertEquals('CLASS 255', $name); + static::assertSame('CLASS 255', $name); } } diff --git a/tests/ASN1/Component/LengthDecodeTest.php b/tests/ASN1/Component/LengthDecodeTest.php index d2373d51..9ed93ccf 100644 --- a/tests/ASN1/Component/LengthDecodeTest.php +++ b/tests/ASN1/Component/LengthDecodeTest.php @@ -66,23 +66,23 @@ public function hugeLengthHasNoIntval() public function shortForm() { $length = Length::fromDER("\x7f"); - static::assertEquals(0x7f, $length->length()); - static::assertEquals(0x7f, $length->intLength()); + static::assertSame((string) 0x7f, $length->length()); + static::assertSame(0x7f, $length->intLength()); } #[Test] public function longForm() { $length = Length::fromDER("\x81\xff"); - static::assertEquals(0xff, $length->length()); + static::assertSame((string) 0xff, $length->length()); } #[Test] public function longForm2() { $length = Length::fromDER("\x82\xca\xfe"); - static::assertEquals(0xcafe, $length->length()); - static::assertEquals(0xcafe, $length->intLength()); + static::assertSame((string) 0xcafe, $length->length()); + static::assertSame(0xcafe, $length->intLength()); } /** @@ -113,7 +113,7 @@ public function hugeLength() $der = "\xfe" . str_repeat("\xff", 126); $length = Length::fromDER($der); $num = BigInteger::fromBase(str_repeat('ff', 126), 16); - static::assertEquals($length->length(), $num->toBase(10)); + static::assertSame($length->length(), $num->toBase(10)); } #[Test] diff --git a/tests/ASN1/Component/LengthEncodeTest.php b/tests/ASN1/Component/LengthEncodeTest.php index 8df9aded..bb0d3b75 100644 --- a/tests/ASN1/Component/LengthEncodeTest.php +++ b/tests/ASN1/Component/LengthEncodeTest.php @@ -19,35 +19,35 @@ final class LengthEncodeTest extends TestCase public function definite() { $length = Length::create(0, false); - static::assertEquals("\x0", $length->toDER()); + static::assertSame("\x0", $length->toDER()); } #[Test] public function indefinite() { $length = Length::create(0, true); - static::assertEquals("\x80", $length->toDER()); + static::assertSame("\x80", $length->toDER()); } #[Test] public function short() { $length = Length::create(0x7f); - static::assertEquals("\x7f", $length->toDER()); + static::assertSame("\x7f", $length->toDER()); } #[Test] public function long() { $length = Length::create(0xff); - static::assertEquals("\x81\xff", $length->toDER()); + static::assertSame("\x81\xff", $length->toDER()); } #[Test] public function long2() { $length = Length::create(0xcafe); - static::assertEquals("\x82\xca\xfe", $length->toDER()); + static::assertSame("\x82\xca\xfe", $length->toDER()); } #[Test] diff --git a/tests/ASN1/DERDataTest.php b/tests/ASN1/DERDataTest.php index 2dca8706..d66e7cb3 100644 --- a/tests/ASN1/DERDataTest.php +++ b/tests/ASN1/DERDataTest.php @@ -24,7 +24,7 @@ final class DERDataTest extends TestCase public function create() { $el = DERData::create("\x5\x0"); - static::assertEquals(Element::TYPE_NULL, $el->tag()); + static::assertSame(Element::TYPE_NULL, $el->tag()); return $el; } @@ -32,7 +32,7 @@ public function create() #[Depends('create')] public function class(DERData $el) { - static::assertEquals(Identifier::CLASS_UNIVERSAL, $el->typeClass()); + static::assertSame(Identifier::CLASS_UNIVERSAL, $el->typeClass()); } #[Test] @@ -46,7 +46,7 @@ public function constructed(DERData $el) #[Depends('create')] public function encode(DERData $el) { - static::assertEquals("\x5\x0", $el->toDER()); + static::assertSame("\x5\x0", $el->toDER()); } #[Test] @@ -54,7 +54,7 @@ public function encodeIntoSequence() { $el = DERData::create("\x5\x0"); $seq = Sequence::create($el); - static::assertEquals("\x30\x2\x5\x0", $seq->toDER()); + static::assertSame("\x30\x2\x5\x0", $seq->toDER()); } #[Test] @@ -62,7 +62,7 @@ public function encodeIntoSequenceWithOther() { $el = DERData::create("\x5\x0"); $seq = Sequence::create($el, Boolean::create(true)); - static::assertEquals("\x30\x5\x5\x0\x1\x1\xff", $seq->toDER()); + static::assertSame("\x30\x5\x5\x0\x1\x1\xff", $seq->toDER()); } #[Test] @@ -73,7 +73,7 @@ public function encodedContentEmpty() $mtd = $cls->getMethod('encodedAsDER'); $mtd->setAccessible(true); $content = $mtd->invoke($el); - static::assertEquals('', $content); + static::assertSame('', $content); } #[Test] @@ -84,6 +84,6 @@ public function encodedContentValue() $mtd = $cls->getMethod('encodedAsDER'); $mtd->setAccessible(true); $content = $mtd->invoke($el); - static::assertEquals('test', $content); + static::assertSame('test', $content); } } diff --git a/tests/ASN1/ElementTest.php b/tests/ASN1/ElementTest.php index 37376190..db27577a 100644 --- a/tests/ASN1/ElementTest.php +++ b/tests/ASN1/ElementTest.php @@ -19,7 +19,7 @@ final class ElementTest extends TestCase #[Test] public function unknownTagToName(): void { - static::assertEquals('TAG 100', Element::tagToName(100)); + static::assertSame('TAG 100', Element::tagToName(100)); } #[Test] diff --git a/tests/ASN1/Tagging/ApplicationTypeTest.php b/tests/ASN1/Tagging/ApplicationTypeTest.php index c2e91897..b2fa0f85 100644 --- a/tests/ASN1/Tagging/ApplicationTypeTest.php +++ b/tests/ASN1/Tagging/ApplicationTypeTest.php @@ -34,7 +34,7 @@ public function implicitType() public function createImplicit() { $el = ImplicitlyTaggedType::create(1, Integer::create(42), Identifier::CLASS_APPLICATION); - static::assertEquals("\x41\x01\x2a", $el->toDER()); + static::assertSame("\x41\x01\x2a", $el->toDER()); } #[Test] @@ -53,7 +53,7 @@ public function unwrapImplicit(ApplicationType $el) #[Depends('unwrapImplicit')] public function implicitValue(Integer $el) { - static::assertEquals(42, $el->intNumber()); + static::assertSame(42, $el->intNumber()); } #[Test] @@ -69,7 +69,7 @@ public function explicitType() public function createExplicit() { $el = ExplicitlyTaggedType::create(1, Integer::create(42), Identifier::CLASS_APPLICATION); - static::assertEquals("\x61\x03\x02\x01\x2a", $el->toDER()); + static::assertSame("\x61\x03\x02\x01\x2a", $el->toDER()); } #[Test] @@ -89,7 +89,7 @@ public function unwrapExplicit(ApplicationType $el) #[Depends('unwrapExplicit')] public function explicitValue(Integer $el) { - static::assertEquals(42, $el->intNumber()); + static::assertSame(42, $el->intNumber()); } #[Test] @@ -97,7 +97,7 @@ public function explicitValue(Integer $el) public function recodeExplicit(ApplicationType $el) { $der = $el->toDER(); - static::assertEquals("\x61\x03\x02\x01\x2a", $der); + static::assertSame("\x61\x03\x02\x01\x2a", $der); } #[Test] diff --git a/tests/ASN1/Tagging/DERTaggedTypeTest.php b/tests/ASN1/Tagging/DERTaggedTypeTest.php index 7ffd50aa..61f166c4 100644 --- a/tests/ASN1/Tagging/DERTaggedTypeTest.php +++ b/tests/ASN1/Tagging/DERTaggedTypeTest.php @@ -30,7 +30,7 @@ public function create() public function encode(DERTaggedType $el) { $der = $el->toDER(); - static::assertEquals("\xa0\x2\x5\x0", $der); + static::assertSame("\xa0\x2\x5\x0", $der); } #[Test] diff --git a/tests/ASN1/Tagging/ExplicitlyTaggedDecodeTest.php b/tests/ASN1/Tagging/ExplicitlyTaggedDecodeTest.php index c96d9ff2..54a39861 100644 --- a/tests/ASN1/Tagging/ExplicitlyTaggedDecodeTest.php +++ b/tests/ASN1/Tagging/ExplicitlyTaggedDecodeTest.php @@ -27,14 +27,14 @@ public function type() public function tag() { $el = TaggedType::fromDER("\xa1\x2\x5\x0"); - static::assertEquals(1, $el->tag()); + static::assertSame(1, $el->tag()); } #[Test] public function typeClass() { $el = TaggedType::fromDER("\xa0\x2\x5\x0"); - static::assertEquals(Identifier::CLASS_CONTEXT_SPECIFIC, $el->typeClass()); + static::assertSame(Identifier::CLASS_CONTEXT_SPECIFIC, $el->typeClass()); } #[Test] @@ -48,15 +48,15 @@ public function constructed() public function innerType() { $el = TaggedType::fromDER("\xa0\x2\x5\x0"); - static::assertEquals(Element::TYPE_NULL, $el->explicit()->tag()); + static::assertSame(Element::TYPE_NULL, $el->explicit()->tag()); } #[Test] public function nestedTagging() { $el = TaggedType::fromDER("\xa1\x4\xa2\x2\x5\x0"); - static::assertEquals(1, $el->tag()); - static::assertEquals(2, $el->explicit()->tag()); - static::assertEquals(Element::TYPE_NULL, $el->explicit()->asTagged()->explicit()->tag()); + static::assertSame(1, $el->tag()); + static::assertSame(2, $el->explicit()->tag()); + static::assertSame(Element::TYPE_NULL, $el->explicit()->asTagged()->explicit()->tag()); } } diff --git a/tests/ASN1/Tagging/ExplicitlyTaggedEncodeTest.php b/tests/ASN1/Tagging/ExplicitlyTaggedEncodeTest.php index 8327fa7d..fa422552 100644 --- a/tests/ASN1/Tagging/ExplicitlyTaggedEncodeTest.php +++ b/tests/ASN1/Tagging/ExplicitlyTaggedEncodeTest.php @@ -19,21 +19,21 @@ final class ExplicitlyTaggedEncodeTest extends TestCase public function null() { $el = ExplicitlyTaggedType::create(0, NullType::create()); - static::assertEquals("\xa0\x2\x5\x0", $el->toDER()); + static::assertSame("\xa0\x2\x5\x0", $el->toDER()); } #[Test] public function nested() { $el = ExplicitlyTaggedType::create(1, ExplicitlyTaggedType::create(2, NullType::create())); - static::assertEquals("\xa1\x4\xa2\x2\x5\x0", $el->toDER()); + static::assertSame("\xa1\x4\xa2\x2\x5\x0", $el->toDER()); } #[Test] public function longTag() { $el = ExplicitlyTaggedType::create(255, NullType::create()); - static::assertEquals("\xbf\x81\x7f\x2\x5\x0", $el->toDER()); + static::assertSame("\xbf\x81\x7f\x2\x5\x0", $el->toDER()); } #[Test] diff --git a/tests/ASN1/Tagging/ExplicitlyTaggedTypeTest.php b/tests/ASN1/Tagging/ExplicitlyTaggedTypeTest.php index 637454f4..e1b193df 100644 --- a/tests/ASN1/Tagging/ExplicitlyTaggedTypeTest.php +++ b/tests/ASN1/Tagging/ExplicitlyTaggedTypeTest.php @@ -31,7 +31,7 @@ public function create() #[Depends('create')] public function getExplicit(ExplicitTagging $el) { - static::assertEquals(Element::TYPE_NULL, $el->explicit()->tag()); + static::assertSame(Element::TYPE_NULL, $el->explicit()->tag()); } #[Test] diff --git a/tests/ASN1/Tagging/ImplicitlyTaggedDecodeTest.php b/tests/ASN1/Tagging/ImplicitlyTaggedDecodeTest.php index e7759607..2304f0ad 100644 --- a/tests/ASN1/Tagging/ImplicitlyTaggedDecodeTest.php +++ b/tests/ASN1/Tagging/ImplicitlyTaggedDecodeTest.php @@ -28,28 +28,28 @@ public function type() public function tag() { $el = TaggedType::fromDER("\x81\x0"); - static::assertEquals(1, $el->tag()); + static::assertSame(1, $el->tag()); } #[Test] public function typeClass() { $el = TaggedType::fromDER("\x80\x0"); - static::assertEquals(Identifier::CLASS_CONTEXT_SPECIFIC, $el->typeClass()); + static::assertSame(Identifier::CLASS_CONTEXT_SPECIFIC, $el->typeClass()); } #[Test] public function innerType() { $el = TaggedType::fromDER("\x80\x0"); - static::assertEquals(Element::TYPE_NULL, $el->implicit(Element::TYPE_NULL)->tag()); + static::assertSame(Element::TYPE_NULL, $el->implicit(Element::TYPE_NULL)->tag()); } #[Test] public function innerClass() { $el = TaggedType::fromDER("\x80\x0"); - static::assertEquals(Identifier::CLASS_UNIVERSAL, $el->implicit(Element::TYPE_NULL)->typeClass()); + static::assertSame(Identifier::CLASS_UNIVERSAL, $el->implicit(Element::TYPE_NULL)->typeClass()); } #[Test] @@ -81,12 +81,12 @@ public function innerConstructedFail() public function nested() { $el = TaggedType::fromDER("\xa1\x2\x82\x0"); - static::assertEquals(1, $el->tag()); + static::assertSame(1, $el->tag()); $el = $el->implicit(Element::TYPE_SEQUENCE)->asSequence(); - static::assertEquals(2, $el->at(0)->tag()); + static::assertSame(2, $el->at(0)->tag()); $el = $el->at(0) ->asTagged() ->implicit(Element::TYPE_NULL); - static::assertEquals(Element::TYPE_NULL, $el->tag()); + static::assertSame(Element::TYPE_NULL, $el->tag()); } } diff --git a/tests/ASN1/Tagging/ImplicitlyTaggedEncodeTest.php b/tests/ASN1/Tagging/ImplicitlyTaggedEncodeTest.php index abe2607d..b663285a 100644 --- a/tests/ASN1/Tagging/ImplicitlyTaggedEncodeTest.php +++ b/tests/ASN1/Tagging/ImplicitlyTaggedEncodeTest.php @@ -20,14 +20,14 @@ final class ImplicitlyTaggedEncodeTest extends TestCase public function null() { $el = ImplicitlyTaggedType::create(0, NullType::create()); - static::assertEquals("\x80\x0", $el->toDER()); + static::assertSame("\x80\x0", $el->toDER()); } #[Test] public function longTag() { $el = ImplicitlyTaggedType::create(255, NullType::create()); - static::assertEquals("\x9f\x81\x7f\x0", $el->toDER()); + static::assertSame("\x9f\x81\x7f\x0", $el->toDER()); } #[Test] diff --git a/tests/ASN1/Tagging/ImplicitlyTaggedTypeTest.php b/tests/ASN1/Tagging/ImplicitlyTaggedTypeTest.php index b1aa436d..89c9547e 100644 --- a/tests/ASN1/Tagging/ImplicitlyTaggedTypeTest.php +++ b/tests/ASN1/Tagging/ImplicitlyTaggedTypeTest.php @@ -32,7 +32,7 @@ public function create() #[Depends('create')] public function getImplicit(ImplicitTagging $el) { - static::assertEquals(Element::TYPE_NULL, $el->implicit(Element::TYPE_NULL)->tag()); + static::assertSame(Element::TYPE_NULL, $el->implicit(Element::TYPE_NULL)->tag()); } #[Test] diff --git a/tests/ASN1/Tagging/PrivateTypeTest.php b/tests/ASN1/Tagging/PrivateTypeTest.php index 8098e154..d7246ab5 100644 --- a/tests/ASN1/Tagging/PrivateTypeTest.php +++ b/tests/ASN1/Tagging/PrivateTypeTest.php @@ -34,7 +34,7 @@ public function implicitType() public function createImplicit() { $el = ImplicitlyTaggedType::create(1, Integer::create(42), Identifier::CLASS_PRIVATE); - static::assertEquals("\xc1\x01\x2a", $el->toDER()); + static::assertSame("\xc1\x01\x2a", $el->toDER()); } #[Test] @@ -53,7 +53,7 @@ public function unwrapImplicit(PrivateType $el) #[Depends('unwrapImplicit')] public function implicitValue(Integer $el) { - static::assertEquals(42, $el->intNumber()); + static::assertSame(42, $el->intNumber()); } #[Test] @@ -69,7 +69,7 @@ public function explicitType() public function createExplicit() { $el = ExplicitlyTaggedType::create(1, Integer::create(42), Identifier::CLASS_PRIVATE); - static::assertEquals("\xe1\x03\x02\x01\x2a", $el->toDER()); + static::assertSame("\xe1\x03\x02\x01\x2a", $el->toDER()); } #[Test] @@ -89,7 +89,7 @@ public function unwrapExplicit(PrivateType $el) #[Depends('unwrapExplicit')] public function explicitValue(Integer $el) { - static::assertEquals(42, $el->intNumber()); + static::assertSame(42, $el->intNumber()); } #[Test] @@ -97,7 +97,7 @@ public function explicitValue(Integer $el) public function recodeExplicit(PrivateType $el) { $der = $el->toDER(); - static::assertEquals("\xe1\x03\x02\x01\x2a", $der); + static::assertSame("\xe1\x03\x02\x01\x2a", $der); } #[Test] diff --git a/tests/ASN1/Type/Constructed/Sequence/DecodeTest.php b/tests/ASN1/Type/Constructed/Sequence/DecodeTest.php index 931c189b..17002e17 100644 --- a/tests/ASN1/Type/Constructed/Sequence/DecodeTest.php +++ b/tests/ASN1/Type/Constructed/Sequence/DecodeTest.php @@ -40,6 +40,6 @@ public function nested() { $el = Sequence::fromDER("\x30\x2\x30\x0"); static::assertCount(1, $el); - static::assertEquals(Element::TYPE_SEQUENCE, $el->at(0)->tag()); + static::assertSame(Element::TYPE_SEQUENCE, $el->at(0)->tag()); } } diff --git a/tests/ASN1/Type/Constructed/Sequence/EncodeTest.php b/tests/ASN1/Type/Constructed/Sequence/EncodeTest.php index 89dca9bf..1a14f5eb 100644 --- a/tests/ASN1/Type/Constructed/Sequence/EncodeTest.php +++ b/tests/ASN1/Type/Constructed/Sequence/EncodeTest.php @@ -18,27 +18,27 @@ final class EncodeTest extends TestCase public function encode() { $el = Sequence::create(); - static::assertEquals("\x30\x0", $el->toDER()); + static::assertSame("\x30\x0", $el->toDER()); } #[Test] public function single() { $el = Sequence::create(NullType::create()); - static::assertEquals("\x30\x2\x5\x0", $el->toDER()); + static::assertSame("\x30\x2\x5\x0", $el->toDER()); } #[Test] public function three() { $el = Sequence::create(NullType::create(), NullType::create(), NullType::create()); - static::assertEquals("\x30\x6" . str_repeat("\x5\x0", 3), $el->toDER()); + static::assertSame("\x30\x6" . str_repeat("\x5\x0", 3), $el->toDER()); } #[Test] public function nested() { $el = Sequence::create(Sequence::create(NullType::create())); - static::assertEquals("\x30\x4\x30\x2\x5\x0", $el->toDER()); + static::assertSame("\x30\x4\x30\x2\x5\x0", $el->toDER()); } } diff --git a/tests/ASN1/Type/Constructed/Sequence/SequenceTest.php b/tests/ASN1/Type/Constructed/Sequence/SequenceTest.php index 29d2551e..f8b8daa3 100644 --- a/tests/ASN1/Type/Constructed/Sequence/SequenceTest.php +++ b/tests/ASN1/Type/Constructed/Sequence/SequenceTest.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\Test\ASN1\Type\Constructed\Sequence; use OutOfBoundsException; -use PHPUnit\Framework\Attributes\Depends; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use SpomkyLabs\Pki\ASN1\Element; @@ -22,110 +21,45 @@ final class SequenceTest extends TestCase { #[Test] - public function create() + public function create(): void { $seq = Sequence::create(NullType::create(), Boolean::create(true)); static::assertInstanceOf(Structure::class, $seq); - return $seq; - } - - #[Test] - #[Depends('create')] - public function tag(Element $el) - { - static::assertEquals(Element::TYPE_SEQUENCE, $el->tag()); - } - - #[Test] - #[Depends('create')] - public function encode(Element $el): string - { - $der = $el->toDER(); - static::assertIsString($der); - return $der; - } - - #[Test] - #[Depends('encode')] - public function decode(string $data): Sequence - { - $el = Sequence::fromDER($data); - static::assertInstanceOf(Sequence::class, $el); - return $el; - } - - #[Test] - #[Depends('create')] - #[Depends('decode')] - public function recoded(Element $ref, Element $el) - { - static::assertEquals($ref, $el); - } - - #[Test] - #[Depends('create')] - public function elements(Sequence $seq) - { - $elements = $seq->elements(); - static::assertContainsOnlyInstancesOf(UnspecifiedType::class, $elements); - } - - #[Test] - #[Depends('create')] - public function countMethod(Sequence $seq) - { + static::assertSame(Element::TYPE_SEQUENCE, $seq->tag()); + static::assertContainsOnlyInstancesOf(UnspecifiedType::class, $seq->elements()); static::assertCount(2, $seq); - } - - #[Test] - #[Depends('create')] - public function iterator(Sequence $seq) - { $elements = []; foreach ($seq as $el) { $elements[] = $el; } static::assertCount(2, $elements); static::assertContainsOnlyInstancesOf(UnspecifiedType::class, $elements); - } - - #[Test] - #[Depends('create')] - public function atMethod(Sequence $seq): void - { $el = $seq->at(0) ->asNull(); static::assertInstanceOf(NullType::class, $el); } #[Test] - #[Depends('create')] - public function atExpected(Sequence $seq) + public function encode(): void { - $el = $seq->at(0) - ->asNull(); - static::assertInstanceOf(NullType::class, $el); + $seq = Sequence::create(NullType::create(), Boolean::create(true)); + $data = $seq->toDER(); + $el = Sequence::fromDER($data); + static::assertInstanceOf(Sequence::class, $el); + static::assertEquals($seq, $el); } #[Test] - #[Depends('create')] - public function atOOB(Sequence $seq) + public function atOOB(): void { + $seq = Sequence::create(NullType::create(), Boolean::create(true)); $this->expectException(OutOfBoundsException::class); $this->expectExceptionMessage('Structure doesn\'t have an element at index 2'); $seq->at(2); } #[Test] - #[Depends('create')] - public function wrapped(Element $el) - { - $wrap = UnspecifiedType::create($el); - static::assertInstanceOf(Sequence::class, $wrap->asSequence()); - } - - #[Test] - public function wrappedFail() + public function wrappedFail(): void { $wrap = UnspecifiedType::create(NullType::create()); $this->expectException(UnexpectedValueException::class); diff --git a/tests/ASN1/Type/Constructed/Set/EncodeTest.php b/tests/ASN1/Type/Constructed/Set/EncodeTest.php index 16f079d2..9782e0f8 100644 --- a/tests/ASN1/Type/Constructed/Set/EncodeTest.php +++ b/tests/ASN1/Type/Constructed/Set/EncodeTest.php @@ -21,7 +21,7 @@ final class EncodeTest extends TestCase public function encode() { $el = Set::create(); - static::assertEquals("\x31\x0", $el->toDER()); + static::assertSame("\x31\x0", $el->toDER()); } #[Test] @@ -32,7 +32,7 @@ public function setSort() ImplicitlyTaggedType::create(2, NullType::create()), ImplicitlyTaggedType::create(0, NullType::create()) ); - static::assertEquals("\x31\x6\x80\x0\x81\x0\x82\x0", $set->sortedSet()->toDER()); + static::assertSame("\x31\x6\x80\x0\x81\x0\x82\x0", $set->sortedSet()->toDER()); } #[Test] @@ -43,13 +43,13 @@ public function setSortClasses() ImplicitlyTaggedType::create(6, NullType::create()), NullType::create() ); - static::assertEquals("\x31\x8\x05\x0\xa5\x2\x05\x0\x86\x0", $set->sortedSet()->toDER()); + static::assertSame("\x31\x8\x05\x0\xa5\x2\x05\x0\x86\x0", $set->sortedSet()->toDER()); } #[Test] public function setOfSort() { $set = Set::create(PrintableString::create('B'), PrintableString::create('C'), PrintableString::create('A')); - static::assertEquals("\x31\x9" . "\x13\x01A" . "\x13\x01B" . "\x13\x01C", $set->sortedSetOf()->toDER()); + static::assertSame("\x31\x9" . "\x13\x01A" . "\x13\x01B" . "\x13\x01C", $set->sortedSetOf()->toDER()); } } diff --git a/tests/ASN1/Type/Constructed/Set/SetTest.php b/tests/ASN1/Type/Constructed/Set/SetTest.php index df375a81..6046a337 100644 --- a/tests/ASN1/Type/Constructed/Set/SetTest.php +++ b/tests/ASN1/Type/Constructed/Set/SetTest.php @@ -32,7 +32,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_SET, $el->tag()); + static::assertSame(Element::TYPE_SET, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Constructed/String/ConstructedStringTest.php b/tests/ASN1/Type/Constructed/String/ConstructedStringTest.php index 9e0d7ae7..d9e165a0 100644 --- a/tests/ASN1/Type/Constructed/String/ConstructedStringTest.php +++ b/tests/ASN1/Type/Constructed/String/ConstructedStringTest.php @@ -31,8 +31,8 @@ use SpomkyLabs\Pki\ASN1\Type\Primitive\VisibleString; use SpomkyLabs\Pki\ASN1\Type\StringType; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; -use function strval; use UnexpectedValueException; +use function strval; /** * @internal @@ -55,7 +55,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_OCTET_STRING, $el->tag()); + static::assertSame(Element::TYPE_OCTET_STRING, $el->tag()); } #[Test] @@ -88,15 +88,15 @@ public function recoded(Element $ref, Element $el) #[Depends('create')] public function strings(ConstructedString $cs) { - static::assertEquals(['Hello', 'World'], $cs->strings()); + static::assertSame(['Hello', 'World'], $cs->strings()); } #[Test] #[Depends('create')] public function stringable(ConstructedString $cs) { - static::assertEquals('HelloWorld', $cs->string()); - static::assertEquals('HelloWorld', strval($cs)); + static::assertSame('HelloWorld', $cs->string()); + static::assertSame('HelloWorld', strval($cs)); } #[Test] @@ -135,7 +135,7 @@ public function createFromElements() #[Depends('createFromElements')] public function fromElementsTag(ConstructedString $cs) { - static::assertEquals(Element::TYPE_OCTET_STRING, $cs->tag()); + static::assertSame(Element::TYPE_OCTET_STRING, $cs->tag()); } #[Test] @@ -164,7 +164,7 @@ public function stringTypeAndConcatenate(StringType $el) $ut = ConstructedString::fromDER($der)->asUnspecified(); $s = $ut->asString(); static::assertInstanceOf(StringType::class, $s); - static::assertEquals("{$str}{$str}", $s->string()); + static::assertSame("{$str}{$str}", $s->string()); } public static function provideStringType(): iterable diff --git a/tests/ASN1/Type/Constructed/StructureTest.php b/tests/ASN1/Type/Constructed/StructureTest.php index 87f900be..040d4fe3 100644 --- a/tests/ASN1/Type/Constructed/StructureTest.php +++ b/tests/ASN1/Type/Constructed/StructureTest.php @@ -4,6 +4,7 @@ namespace SpomkyLabs\Pki\Test\ASN1\Type\Constructed; +use Iterator; use OutOfBoundsException; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; @@ -29,9 +30,12 @@ public function has(int $idx, bool $result) static::assertEquals($seq->has($idx), $result); } - public static function hasProvider(): array + public static function hasProvider(): Iterator { - return [[0, true], [1, true], [2, true], [3, false]]; + yield [0, true]; + yield [1, true]; + yield [2, true]; + yield [3, false]; } #[Test] @@ -42,14 +46,12 @@ public function hasType(int $idx, int $type, bool $result) static::assertEquals($seq->has($idx, $type), $result); } - public static function hasTypeProvider(): array + public static function hasTypeProvider(): Iterator { - return [ - [0, Element::TYPE_NULL, true], - [0, Element::TYPE_INTEGER, false], - [1, Element::TYPE_BOOLEAN, true], - [2, Element::TYPE_NULL, false], - ]; + yield [0, Element::TYPE_NULL, true]; + yield [0, Element::TYPE_INTEGER, false]; + yield [1, Element::TYPE_BOOLEAN, true]; + yield [2, Element::TYPE_NULL, false]; } #[Test] @@ -59,7 +61,7 @@ public function explode() $der = $el->toDER(); $parts = Structure::explodeDER($der); $null = "\x5\x0"; - static::assertEquals([$null, $null, $null], $parts); + static::assertSame([$null, $null, $null], $parts); } #[Test] diff --git a/tests/ASN1/Type/Primitive/BitString/BitStringTest.php b/tests/ASN1/Type/Primitive/BitString/BitStringTest.php index 9c94ba20..3ac08eed 100644 --- a/tests/ASN1/Type/Primitive/BitString/BitStringTest.php +++ b/tests/ASN1/Type/Primitive/BitString/BitStringTest.php @@ -4,6 +4,7 @@ namespace SpomkyLabs\Pki\Test\ASN1\Type\Primitive\BitString; +use Iterator; use OutOfBoundsException; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Depends; @@ -13,8 +14,8 @@ use SpomkyLabs\Pki\ASN1\Type\Primitive\BitString; use SpomkyLabs\Pki\ASN1\Type\Primitive\NullType; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; -use function strval; use UnexpectedValueException; +use function strval; /** * @internal @@ -33,7 +34,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_BIT_STRING, $el->tag()); + static::assertSame(Element::TYPE_BIT_STRING, $el->tag()); } #[Test] @@ -67,12 +68,15 @@ public function recoded(Element $ref, Element $el) public function range8(int $start, int $length, string $result) { $bs = BitString::create("\xff"); - static::assertEquals($result, $bs->range($start, $length)); + static::assertSame($result, $bs->range($start, $length)); } - public static function ffProvider(): array + public static function ffProvider(): Iterator { - return [[0, 8, strval(0xff)], [1, 2, strval(0x03)], [6, 2, strval(0x03)], [2, 4, strval(0x0f)]]; + yield [0, 8, strval(0xff)]; + yield [1, 2, strval(0x03)]; + yield [6, 2, strval(0x03)]; + yield [2, 4, strval(0x0f)]; } #[Test] @@ -80,19 +84,21 @@ public static function ffProvider(): array public function range16(int $start, int $length, string $result) { $bs = BitString::create("\xff\xff"); - static::assertEquals($result, $bs->range($start, $length)); + static::assertSame($result, $bs->range($start, $length)); } - public static function ffffProvider(): array + public static function ffffProvider(): Iterator { - return [[0, 8, strval(0xff)], [6, 4, strval(0x0f)], [12, 4, strval(0x0f)]]; + yield [0, 8, strval(0xff)]; + yield [6, 4, strval(0x0f)]; + yield [12, 4, strval(0x0f)]; } #[Test] public function emptyRange() { $bs = BitString::create("\0"); - static::assertEquals(0, $bs->range(0, 0)); + static::assertSame('0', $bs->range(0, 0)); } #[Test] diff --git a/tests/ASN1/Type/Primitive/BitString/DecodeTest.php b/tests/ASN1/Type/Primitive/BitString/DecodeTest.php index 6ac712e2..d415c596 100644 --- a/tests/ASN1/Type/Primitive/BitString/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/BitString/DecodeTest.php @@ -26,14 +26,14 @@ public function type() public function unusedBits() { $el = BitString::fromDER("\x3\x3\x4\xff\xf0"); - static::assertEquals(4, $el->unusedBits()); + static::assertSame(4, $el->unusedBits()); } #[Test] public function numBits() { $el = BitString::fromDER("\x3\x3\x4\xff\xf0"); - static::assertEquals(12, $el->numBits()); + static::assertSame(12, $el->numBits()); } /** diff --git a/tests/ASN1/Type/Primitive/BitString/EncodeTest.php b/tests/ASN1/Type/Primitive/BitString/EncodeTest.php index dbd8d2e5..cf01bd20 100644 --- a/tests/ASN1/Type/Primitive/BitString/EncodeTest.php +++ b/tests/ASN1/Type/Primitive/BitString/EncodeTest.php @@ -4,6 +4,7 @@ namespace SpomkyLabs\Pki\Test\ASN1\Type\Primitive\BitString; +use Iterator; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; @@ -19,26 +20,24 @@ final class EncodeTest extends TestCase public function withoutTrailingZeroes(string $bits, string $expected) { $bs = BitString::create($bits); - static::assertEquals($expected, $bs->withoutTrailingZeroes()->toDER()); + static::assertSame($expected, $bs->withoutTrailingZeroes()->toDER()); } - public static function withoutTrailingZeroesProvider(): array + public static function withoutTrailingZeroesProvider(): Iterator { - return [ - ['', "\x3\x1\x0"], - ["\x00", "\x3\x1\x0"], - ["\x80", "\x3\x2\x7\x80"], - ["\xf0", "\x3\x2\x4\xf0"], - ["\xfe", "\x3\x2\x1\xfe"], - ["\xff", "\x3\x2\x0\xff"], - ["\xff\xff\xf0", "\x3\x4\x4\xff\xff\xf0"], - ["\xff\xf0\x00", "\x3\x3\x4\xff\xf0"], - ["\xf0\x00\x00", "\x3\x2\x4\xf0"], - ["\x00\x00\x00", "\x3\x1\x0"], - ["\x00\x00\x02", "\x3\x4\x1\x0\x0\x02"], - ["\x00\x02\x00", "\x3\x3\x1\x0\x02"], - ["\x00\x01\x00", "\x3\x3\x0\x0\x01"], - ["\x00\x80\x00", "\x3\x3\x7\x0\x80"], - ]; + yield ['', "\x3\x1\x0"]; + yield ["\x00", "\x3\x1\x0"]; + yield ["\x80", "\x3\x2\x7\x80"]; + yield ["\xf0", "\x3\x2\x4\xf0"]; + yield ["\xfe", "\x3\x2\x1\xfe"]; + yield ["\xff", "\x3\x2\x0\xff"]; + yield ["\xff\xff\xf0", "\x3\x4\x4\xff\xff\xf0"]; + yield ["\xff\xf0\x00", "\x3\x3\x4\xff\xf0"]; + yield ["\xf0\x00\x00", "\x3\x2\x4\xf0"]; + yield ["\x00\x00\x00", "\x3\x1\x0"]; + yield ["\x00\x00\x02", "\x3\x4\x1\x0\x0\x02"]; + yield ["\x00\x02\x00", "\x3\x3\x1\x0\x02"]; + yield ["\x00\x01\x00", "\x3\x3\x0\x0\x01"]; + yield ["\x00\x80\x00", "\x3\x3\x7\x0\x80"]; } } diff --git a/tests/ASN1/Type/Primitive/BmpString/BMPStringTest.php b/tests/ASN1/Type/Primitive/BmpString/BMPStringTest.php index 32ab6aac..dc1d947b 100644 --- a/tests/ASN1/Type/Primitive/BmpString/BMPStringTest.php +++ b/tests/ASN1/Type/Primitive/BmpString/BMPStringTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_BMP_STRING, $el->tag()); + static::assertSame(Element::TYPE_BMP_STRING, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/BmpString/DecodeTest.php b/tests/ASN1/Type/Primitive/BmpString/DecodeTest.php index 48ce2896..f9279530 100644 --- a/tests/ASN1/Type/Primitive/BmpString/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/BmpString/DecodeTest.php @@ -26,7 +26,7 @@ public function value() { $str = "\0H\0e\0l\0l\0o\0 \0W\0o\0r\0l\0d\0!"; $el = BMPString::fromDER("\x1e\x18{$str}"); - static::assertEquals($str, $el->string()); + static::assertSame($str, $el->string()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/Boolean/BooleanTest.php b/tests/ASN1/Type/Primitive/Boolean/BooleanTest.php index 4fe49846..9680787a 100644 --- a/tests/ASN1/Type/Primitive/Boolean/BooleanTest.php +++ b/tests/ASN1/Type/Primitive/Boolean/BooleanTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_BOOLEAN, $el->tag()); + static::assertSame(Element::TYPE_BOOLEAN, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/Boolean/EncodeTest.php b/tests/ASN1/Type/Primitive/Boolean/EncodeTest.php index cfd0e516..f45099b9 100644 --- a/tests/ASN1/Type/Primitive/Boolean/EncodeTest.php +++ b/tests/ASN1/Type/Primitive/Boolean/EncodeTest.php @@ -17,13 +17,13 @@ final class EncodeTest extends TestCase public function true() { $el = Boolean::create(true); - static::assertEquals("\x1\x1\xff", $el->toDER()); + static::assertSame("\x1\x1\xff", $el->toDER()); } #[Test] public function false() { $el = Boolean::create(false); - static::assertEquals("\x1\x1\x00", $el->toDER()); + static::assertSame("\x1\x1\x00", $el->toDER()); } } diff --git a/tests/ASN1/Type/Primitive/CharacterString/CharacterStringTest.php b/tests/ASN1/Type/Primitive/CharacterString/CharacterStringTest.php index f93b2789..528a0959 100644 --- a/tests/ASN1/Type/Primitive/CharacterString/CharacterStringTest.php +++ b/tests/ASN1/Type/Primitive/CharacterString/CharacterStringTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_CHARACTER_STRING, $el->tag()); + static::assertSame(Element::TYPE_CHARACTER_STRING, $el->tag()); } /** diff --git a/tests/ASN1/Type/Primitive/CharacterString/DecodeTest.php b/tests/ASN1/Type/Primitive/CharacterString/DecodeTest.php index 7dfe1f19..e45cb7ab 100644 --- a/tests/ASN1/Type/Primitive/CharacterString/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/CharacterString/DecodeTest.php @@ -25,6 +25,6 @@ public function value() { $str = 'Hello World!'; $el = CharacterString::fromDER("\x1d\x0c{$str}"); - static::assertEquals($str, $el->string()); + static::assertSame($str, $el->string()); } } diff --git a/tests/ASN1/Type/Primitive/Enumerated/DecodeTest.php b/tests/ASN1/Type/Primitive/Enumerated/DecodeTest.php index 67afb9f6..519d417f 100644 --- a/tests/ASN1/Type/Primitive/Enumerated/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/Enumerated/DecodeTest.php @@ -24,6 +24,6 @@ public function type() public function value() { $el = Enumerated::fromDER("\x0a\x1\x1"); - static::assertEquals(1, $el->number()); + static::assertSame('1', $el->number()); } } diff --git a/tests/ASN1/Type/Primitive/Enumerated/EncodeTest.php b/tests/ASN1/Type/Primitive/Enumerated/EncodeTest.php index d417974c..15a3aaa7 100644 --- a/tests/ASN1/Type/Primitive/Enumerated/EncodeTest.php +++ b/tests/ASN1/Type/Primitive/Enumerated/EncodeTest.php @@ -17,6 +17,6 @@ final class EncodeTest extends TestCase public function encode() { $el = Enumerated::create(1); - static::assertEquals("\x0a\x1\x1", $el->toDER()); + static::assertSame("\x0a\x1\x1", $el->toDER()); } } diff --git a/tests/ASN1/Type/Primitive/Enumerated/EnumeratedTest.php b/tests/ASN1/Type/Primitive/Enumerated/EnumeratedTest.php index 3cd2fa33..7f44fb8b 100644 --- a/tests/ASN1/Type/Primitive/Enumerated/EnumeratedTest.php +++ b/tests/ASN1/Type/Primitive/Enumerated/EnumeratedTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_ENUMERATED, $el->tag()); + static::assertSame(Element::TYPE_ENUMERATED, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/Eoc/EOCTest.php b/tests/ASN1/Type/Primitive/Eoc/EOCTest.php index 4dedc1d5..0ce3f2a1 100644 --- a/tests/ASN1/Type/Primitive/Eoc/EOCTest.php +++ b/tests/ASN1/Type/Primitive/Eoc/EOCTest.php @@ -27,7 +27,7 @@ public function create(): Element #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_EOC, $el->tag()); + static::assertSame(Element::TYPE_EOC, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/Eoc/EncodeTest.php b/tests/ASN1/Type/Primitive/Eoc/EncodeTest.php index 9016d5d5..2336d413 100644 --- a/tests/ASN1/Type/Primitive/Eoc/EncodeTest.php +++ b/tests/ASN1/Type/Primitive/Eoc/EncodeTest.php @@ -17,6 +17,6 @@ final class EncodeTest extends TestCase public function encode() { $el = EOC::create(); - static::assertEquals("\0\0", $el->toDER()); + static::assertSame("\0\0", $el->toDER()); } } diff --git a/tests/ASN1/Type/Primitive/GeneralString/DecodeTest.php b/tests/ASN1/Type/Primitive/GeneralString/DecodeTest.php index e3e96eb4..695c5117 100644 --- a/tests/ASN1/Type/Primitive/GeneralString/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/GeneralString/DecodeTest.php @@ -25,6 +25,6 @@ public function value() { $str = 'Hello World!'; $el = GeneralString::fromDER("\x1b\x0c{$str}"); - static::assertEquals($str, $el->string()); + static::assertSame($str, $el->string()); } } diff --git a/tests/ASN1/Type/Primitive/GeneralString/GeneralStringTest.php b/tests/ASN1/Type/Primitive/GeneralString/GeneralStringTest.php index 8d940759..ceb8268f 100644 --- a/tests/ASN1/Type/Primitive/GeneralString/GeneralStringTest.php +++ b/tests/ASN1/Type/Primitive/GeneralString/GeneralStringTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_GENERAL_STRING, $el->tag()); + static::assertSame(Element::TYPE_GENERAL_STRING, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/GeneralizedTime/DecodeTest.php b/tests/ASN1/Type/Primitive/GeneralizedTime/DecodeTest.php index d67692fc..e2007c4e 100644 --- a/tests/ASN1/Type/Primitive/GeneralizedTime/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/GeneralizedTime/DecodeTest.php @@ -28,7 +28,7 @@ public function value() { $date = strtotime('Mon Jan 2 15:04:05 MST 2006'); $el = GeneralizedTime::fromDER("\x18\x0f" . '20060102220405Z'); - static::assertEquals($date, $el->dateTime()->getTimestamp()); + static::assertSame($date, $el->dateTime()->getTimestamp()); } #[Test] @@ -37,7 +37,7 @@ public function fractions() $ts = strtotime('Mon Jan 2 15:04:05 MST 2006'); $dt = DateTimeImmutable::createFromFormat('U.u', "{$ts}.99999", new DateTimeZone('UTC')); $el = GeneralizedTime::fromDER("\x18\x15" . '20060102220405.99999Z'); - static::assertEquals($dt->format('c u'), $el->dateTime()->format('c u')); + static::assertSame($dt->format('c u'), $el->dateTime()->format('c u')); } #[Test] @@ -46,7 +46,7 @@ public function noFractions() $dt = new DateTimeImmutable('Mon Jan 2 15:04:05 MST 2006'); $dt = $dt->setTimezone(new DateTimeZone('UTC')); $el = GeneralizedTime::fromDER("\x18\x0f" . '20060102220405Z'); - static::assertEquals($dt->format('c u'), $el->dateTime()->format('c u')); + static::assertSame($dt->format('c u'), $el->dateTime()->format('c u')); } #[Test] diff --git a/tests/ASN1/Type/Primitive/GeneralizedTime/EncodeTest.php b/tests/ASN1/Type/Primitive/GeneralizedTime/EncodeTest.php index 3c7245e1..f808bfca 100644 --- a/tests/ASN1/Type/Primitive/GeneralizedTime/EncodeTest.php +++ b/tests/ASN1/Type/Primitive/GeneralizedTime/EncodeTest.php @@ -19,7 +19,7 @@ final class EncodeTest extends TestCase public function encode() { $el = GeneralizedTime::create(new DateTimeImmutable('Mon Jan 2 15:04:05 MST 2006')); - static::assertEquals("\x18\x0f" . '20060102220405Z', $el->toDER()); + static::assertSame("\x18\x0f" . '20060102220405Z', $el->toDER()); } #[Test] @@ -28,7 +28,7 @@ public function fractions() $ts = strtotime('Mon Jan 2 15:04:05 MST 2006'); $dt = DateTimeImmutable::createFromFormat('U.u', "{$ts}.5", new DateTimeZone('UTC')); $el = GeneralizedTime::create($dt); - static::assertEquals("\x18\x11" . '20060102220405.5Z', $el->toDER()); + static::assertSame("\x18\x11" . '20060102220405.5Z', $el->toDER()); } #[Test] @@ -37,7 +37,7 @@ public function multipleFractions() $ts = strtotime('Mon Jan 2 15:04:05 MST 2006'); $dt = DateTimeImmutable::createFromFormat('U.u', "{$ts}.99999", new DateTimeZone('UTC')); $el = GeneralizedTime::create($dt); - static::assertEquals("\x18\x15" . '20060102220405.99999Z', $el->toDER()); + static::assertSame("\x18\x15" . '20060102220405.99999Z', $el->toDER()); } #[Test] @@ -46,7 +46,7 @@ public function smallFractions() $ts = strtotime('Mon Jan 2 15:04:05 MST 2006'); $dt = DateTimeImmutable::createFromFormat('U.u', "{$ts}.000001", new DateTimeZone('UTC')); $el = GeneralizedTime::create($dt); - static::assertEquals("\x18\x16" . '20060102220405.000001Z', $el->toDER()); + static::assertSame("\x18\x16" . '20060102220405.000001Z', $el->toDER()); } #[Test] @@ -55,7 +55,7 @@ public function multipleZeroFractions() $ts = strtotime('Mon Jan 2 15:04:05 MST 2006'); $dt = DateTimeImmutable::createFromFormat('U.u', "{$ts}.000000", new DateTimeZone('UTC')); $el = GeneralizedTime::create($dt); - static::assertEquals("\x18\x0f" . '20060102220405Z', $el->toDER()); + static::assertSame("\x18\x0f" . '20060102220405Z', $el->toDER()); } #[Test] @@ -64,6 +64,6 @@ public function trailingFractions() $ts = strtotime('Mon Jan 2 15:04:05 MST 2006'); $dt = DateTimeImmutable::createFromFormat('U.u', "{$ts}.100000", new DateTimeZone('UTC')); $el = GeneralizedTime::create($dt); - static::assertEquals("\x18\x11" . '20060102220405.1Z', $el->toDER()); + static::assertSame("\x18\x11" . '20060102220405.1Z', $el->toDER()); } } diff --git a/tests/ASN1/Type/Primitive/GeneralizedTime/GeneralizedTimeTest.php b/tests/ASN1/Type/Primitive/GeneralizedTime/GeneralizedTimeTest.php index a841857e..f8b19076 100644 --- a/tests/ASN1/Type/Primitive/GeneralizedTime/GeneralizedTimeTest.php +++ b/tests/ASN1/Type/Primitive/GeneralizedTime/GeneralizedTimeTest.php @@ -14,8 +14,8 @@ use SpomkyLabs\Pki\ASN1\Type\Primitive\NullType; use SpomkyLabs\Pki\ASN1\Type\TimeType; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; -use function strval; use UnexpectedValueException; +use function strval; /** * @internal @@ -34,7 +34,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_GENERALIZED_TIME, $el->tag()); + static::assertSame(Element::TYPE_GENERALIZED_TIME, $el->tag()); } #[Test] @@ -60,7 +60,7 @@ public function decode(string $data): GeneralizedTime #[Depends('decode')] public function recoded(TimeType $ref, TimeType $el) { - static::assertEquals($ref->dateTime()->getTimestamp(), $el->dateTime()->getTimestamp()); + static::assertSame($ref->dateTime()->getTimestamp(), $el->dateTime()->getTimestamp()); } #[Test] @@ -92,8 +92,8 @@ public function clone(Element $el) #[Depends('create')] public function stringable(TimeType $time) { - static::assertEquals('20060102220405Z', $time->string()); - static::assertEquals('20060102220405Z', strval($time)); + static::assertSame('20060102220405Z', $time->string()); + static::assertSame('20060102220405Z', strval($time)); } /** @@ -108,6 +108,6 @@ public function leadingFractionZeroes() $str = $el->string(); $der = $el->toDER(); $el = GeneralizedTime::fromDER($der); - static::assertEquals($str, $el->string()); + static::assertSame($str, $el->string()); } } diff --git a/tests/ASN1/Type/Primitive/GraphicString/DecodeTest.php b/tests/ASN1/Type/Primitive/GraphicString/DecodeTest.php index 86c232b8..c1436672 100644 --- a/tests/ASN1/Type/Primitive/GraphicString/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/GraphicString/DecodeTest.php @@ -25,6 +25,6 @@ public function value() { $str = 'Hello World!'; $el = GraphicString::fromDER("\x19\x0c{$str}"); - static::assertEquals($str, $el->string()); + static::assertSame($str, $el->string()); } } diff --git a/tests/ASN1/Type/Primitive/GraphicString/GraphicStringTest.php b/tests/ASN1/Type/Primitive/GraphicString/GraphicStringTest.php index 6a38a154..00b1a291 100644 --- a/tests/ASN1/Type/Primitive/GraphicString/GraphicStringTest.php +++ b/tests/ASN1/Type/Primitive/GraphicString/GraphicStringTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_GRAPHIC_STRING, $el->tag()); + static::assertSame(Element::TYPE_GRAPHIC_STRING, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/IA5String/DecodeTest.php b/tests/ASN1/Type/Primitive/IA5String/DecodeTest.php index efaf4d72..0666c30c 100644 --- a/tests/ASN1/Type/Primitive/IA5String/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/IA5String/DecodeTest.php @@ -26,7 +26,7 @@ public function value() { $str = 'Hello World!'; $el = IA5String::fromDER("\x16\x0c{$str}"); - static::assertEquals($str, $el->string()); + static::assertSame($str, $el->string()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/IA5String/IA5StringTest.php b/tests/ASN1/Type/Primitive/IA5String/IA5StringTest.php index 3a706d8d..7b6eb249 100644 --- a/tests/ASN1/Type/Primitive/IA5String/IA5StringTest.php +++ b/tests/ASN1/Type/Primitive/IA5String/IA5StringTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_IA5_STRING, $el->tag()); + static::assertSame(Element::TYPE_IA5_STRING, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/Integer/DecodeTest.php b/tests/ASN1/Type/Primitive/Integer/DecodeTest.php index 0c06b66c..016de324 100644 --- a/tests/ASN1/Type/Primitive/Integer/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/Integer/DecodeTest.php @@ -5,11 +5,11 @@ namespace SpomkyLabs\Pki\Test\ASN1\Type\Primitive\Integer; use Brick\Math\BigInteger; -use function chr; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use SpomkyLabs\Pki\ASN1\Exception\DecodeException; use SpomkyLabs\Pki\ASN1\Type\Primitive\Integer; +use function chr; /** * @internal @@ -27,147 +27,147 @@ public function type() public function zero() { $der = "\x2\x1\x0"; - static::assertEquals(0, Integer::fromDER($der)->number()); + static::assertSame((string) 0, Integer::fromDER($der)->number()); } #[Test] public function positive127() { $der = "\x2\x1\x7f"; - static::assertEquals(127, Integer::fromDER($der)->number()); + static::assertSame((string) 127, Integer::fromDER($der)->number()); } #[Test] public function positive128() { $der = "\x2\x2\x0\x80"; - static::assertEquals(128, Integer::fromDER($der)->number()); + static::assertSame((string) 128, Integer::fromDER($der)->number()); } #[Test] public function positive255() { $der = "\x2\x2\x0\xff"; - static::assertEquals(255, Integer::fromDER($der)->number()); + static::assertSame((string) 255, Integer::fromDER($der)->number()); } #[Test] public function positive256() { $der = "\x2\x2\x01\x00"; - static::assertEquals(256, Integer::fromDER($der)->number()); + static::assertSame((string) 256, Integer::fromDER($der)->number()); } #[Test] public function positive32767() { $der = "\x2\x2\x7f\xff"; - static::assertEquals(32767, Integer::fromDER($der)->number()); + static::assertSame((string) 32767, Integer::fromDER($der)->number()); } #[Test] public function positive32768() { $der = "\x2\x3\x0\x80\x00"; - static::assertEquals(32768, Integer::fromDER($der)->number()); + static::assertSame((string) 32768, Integer::fromDER($der)->number()); } #[Test] public function negative1() { $der = "\x2\x1" . chr(0b11111111); - static::assertEquals(-1, Integer::fromDER($der)->number()); + static::assertSame((string) -1, Integer::fromDER($der)->number()); } #[Test] public function negative2() { $der = "\x2\x1" . chr(0b11111110); - static::assertEquals(-2, Integer::fromDER($der)->number()); + static::assertSame((string) -2, Integer::fromDER($der)->number()); } #[Test] public function negative127() { $der = "\x2\x1" . chr(0b10000001); - static::assertEquals(-127, Integer::fromDER($der)->number()); + static::assertSame((string) -127, Integer::fromDER($der)->number()); } #[Test] public function negative128() { $der = "\x2\x1" . chr(0b10000000); - static::assertEquals(-128, Integer::fromDER($der)->number()); + static::assertSame((string) -128, Integer::fromDER($der)->number()); } #[Test] public function negative129() { $der = "\x2\x2" . chr(0b11111111) . chr(0b01111111); - static::assertEquals(-129, Integer::fromDER($der)->number()); + static::assertSame((string) -129, Integer::fromDER($der)->number()); } #[Test] public function negative255() { $der = "\x2\x2" . chr(0b11111111) . chr(0b00000001); - static::assertEquals(-255, Integer::fromDER($der)->number()); + static::assertSame((string) -255, Integer::fromDER($der)->number()); } #[Test] public function negative256() { $der = "\x2\x2" . chr(0b11111111) . chr(0b00000000); - static::assertEquals(-256, Integer::fromDER($der)->number()); + static::assertSame((string) -256, Integer::fromDER($der)->number()); } #[Test] public function negative257() { $der = "\x2\x2" . chr(0b11111110) . chr(0b11111111); - static::assertEquals(-257, Integer::fromDER($der)->number()); + static::assertSame((string) -257, Integer::fromDER($der)->number()); } #[Test] public function negative32767() { $der = "\x2\x2" . chr(0b10000000) . chr(0b00000001); - static::assertEquals(-32767, Integer::fromDER($der)->number()); + static::assertSame((string) -32767, Integer::fromDER($der)->number()); } #[Test] public function negative32768() { $der = "\x2\x2" . chr(0b10000000) . chr(0b00000000); - static::assertEquals(-32768, Integer::fromDER($der)->number()); + static::assertSame((string) -32768, Integer::fromDER($der)->number()); } #[Test] public function negative32769() { $der = "\x2\x3" . chr(0b11111111) . chr(0b01111111) . chr(0b11111111); - static::assertEquals(-32769, Integer::fromDER($der)->number()); + static::assertSame((string) -32769, Integer::fromDER($der)->number()); } #[Test] public function negative65535() { $der = "\x2\x3" . chr(0b11111111) . chr(0b00000000) . chr(0b00000001); - static::assertEquals(-65535, Integer::fromDER($der)->number()); + static::assertSame((string) -65535, Integer::fromDER($der)->number()); } #[Test] public function negative65536() { $der = "\x2\x3" . chr(0b11111111) . chr(0b00000000) . chr(0b00000000); - static::assertEquals(-65536, Integer::fromDER($der)->number()); + static::assertSame((string) -65536, Integer::fromDER($der)->number()); } #[Test] public function negative65537() { $der = "\x2\x3" . chr(0b11111110) . chr(0b11111111) . chr(0b11111111); - static::assertEquals(-65537, Integer::fromDER($der)->number()); + static::assertSame((string) -65537, Integer::fromDER($der)->number()); } #[Test] @@ -184,7 +184,7 @@ public function hugePositive() { $der = "\x2\x82\xff\xff\x7f" . str_repeat("\xff", 0xfffe); $num = BigInteger::fromBase('7f' . str_repeat('ff', 0xfffe), 16); - static::assertEquals($num->toBase(10), Integer::fromDER($der)->number()); + static::assertSame($num->toBase(10), Integer::fromDER($der)->number()); } #[Test] @@ -192,6 +192,6 @@ public function hugeNegative() { $der = "\x2\x82\xff\xff\x80" . str_repeat("\x00", 0xfffe); $num = BigInteger::of(0)->minus(BigInteger::fromBase('80' . str_repeat('00', 0xfffe), 16)); - static::assertEquals($num->toBase(10), Integer::fromDER($der)->number()); + static::assertSame($num->toBase(10), Integer::fromDER($der)->number()); } } diff --git a/tests/ASN1/Type/Primitive/Integer/EncodeTest.php b/tests/ASN1/Type/Primitive/Integer/EncodeTest.php index e0eeec46..6bc1edb9 100644 --- a/tests/ASN1/Type/Primitive/Integer/EncodeTest.php +++ b/tests/ASN1/Type/Primitive/Integer/EncodeTest.php @@ -5,11 +5,11 @@ namespace SpomkyLabs\Pki\Test\ASN1\Type\Primitive\Integer; use Brick\Math\BigInteger; -use function chr; use InvalidArgumentException; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use SpomkyLabs\Pki\ASN1\Type\Primitive\Integer; +use function chr; /** * @internal @@ -20,14 +20,14 @@ final class EncodeTest extends TestCase public function zero() { $int = Integer::create(0); - static::assertEquals("\x2\x1\x0", $int->toDER()); + static::assertSame("\x2\x1\x0", $int->toDER()); } #[Test] public function negativeZero() { $int = Integer::create('-0'); - static::assertEquals("\x2\x1\x0", $int->toDER()); + static::assertSame("\x2\x1\x0", $int->toDER()); } #[Test] @@ -50,42 +50,42 @@ public function empty() public function positive127() { $int = Integer::create(127); - static::assertEquals("\x2\x1\x7f", $int->toDER()); + static::assertSame("\x2\x1\x7f", $int->toDER()); } #[Test] public function positive128() { $int = Integer::create(128); - static::assertEquals("\x2\x2\x0\x80", $int->toDER()); + static::assertSame("\x2\x2\x0\x80", $int->toDER()); } #[Test] public function positive255() { $int = Integer::create(255); - static::assertEquals("\x2\x2\x0\xff", $int->toDER()); + static::assertSame("\x2\x2\x0\xff", $int->toDER()); } #[Test] public function positive256() { $int = Integer::create(256); - static::assertEquals("\x2\x2\x01\x00", $int->toDER()); + static::assertSame("\x2\x2\x01\x00", $int->toDER()); } #[Test] public function positive32767() { $int = Integer::create(32767); - static::assertEquals("\x2\x2\x7f\xff", $int->toDER()); + static::assertSame("\x2\x2\x7f\xff", $int->toDER()); } #[Test] public function positive32768() { $int = Integer::create(32768); - static::assertEquals("\x2\x3\x0\x80\x00", $int->toDER()); + static::assertSame("\x2\x3\x0\x80\x00", $int->toDER()); } #[Test] @@ -93,7 +93,7 @@ public function negative1() { $int = Integer::create(-1); $der = "\x2\x1" . chr(0b11111111); - static::assertEquals($der, $int->toDER()); + static::assertSame($der, $int->toDER()); } #[Test] @@ -101,7 +101,7 @@ public function negative2() { $int = Integer::create(-2); $der = "\x2\x1" . chr(0b11111110); - static::assertEquals($der, $int->toDER()); + static::assertSame($der, $int->toDER()); } #[Test] @@ -109,7 +109,7 @@ public function negative127() { $int = Integer::create(-127); $der = "\x2\x1" . chr(0b10000001); - static::assertEquals($der, $int->toDER()); + static::assertSame($der, $int->toDER()); } #[Test] @@ -117,7 +117,7 @@ public function negative128() { $int = Integer::create(-128); $der = "\x2\x1" . chr(0b10000000); - static::assertEquals($der, $int->toDER()); + static::assertSame($der, $int->toDER()); } #[Test] @@ -125,7 +125,7 @@ public function negative129() { $int = Integer::create(-129); $der = "\x2\x2" . chr(0b11111111) . chr(0b01111111); - static::assertEquals($der, $int->toDER()); + static::assertSame($der, $int->toDER()); } #[Test] @@ -133,7 +133,7 @@ public function negative255() { $int = Integer::create(-255); $der = "\x2\x2" . chr(0b11111111) . chr(0b00000001); - static::assertEquals($der, $int->toDER()); + static::assertSame($der, $int->toDER()); } #[Test] @@ -141,7 +141,7 @@ public function negative256() { $int = Integer::create(-256); $der = "\x2\x2" . chr(0b11111111) . chr(0b00000000); - static::assertEquals($der, $int->toDER()); + static::assertSame($der, $int->toDER()); } #[Test] @@ -149,7 +149,7 @@ public function negative257() { $int = Integer::create(-257); $der = "\x2\x2" . chr(0b11111110) . chr(0b11111111); - static::assertEquals($der, $int->toDER()); + static::assertSame($der, $int->toDER()); } #[Test] @@ -157,7 +157,7 @@ public function negative32767() { $int = Integer::create(-32767); $der = "\x2\x2" . chr(0b10000000) . chr(0b00000001); - static::assertEquals($der, $int->toDER()); + static::assertSame($der, $int->toDER()); } #[Test] @@ -165,7 +165,7 @@ public function negative32768() { $int = Integer::create(-32768); $der = "\x2\x2" . chr(0b10000000) . chr(0b00000000); - static::assertEquals($der, $int->toDER()); + static::assertSame($der, $int->toDER()); } #[Test] @@ -173,7 +173,7 @@ public function negative32769() { $int = Integer::create(-32769); $der = "\x2\x3" . chr(0b11111111) . chr(0b01111111) . chr(0b11111111); - static::assertEquals($der, $int->toDER()); + static::assertSame($der, $int->toDER()); } #[Test] @@ -181,7 +181,7 @@ public function negative65535() { $int = Integer::create(-65535); $der = "\x2\x3" . chr(0b11111111) . chr(0b00000000) . chr(0b00000001); - static::assertEquals($der, $int->toDER()); + static::assertSame($der, $int->toDER()); } #[Test] @@ -189,7 +189,7 @@ public function negative65536() { $int = Integer::create(-65536); $der = "\x2\x3" . chr(0b11111111) . chr(0b00000000) . chr(0b00000000); - static::assertEquals($der, $int->toDER()); + static::assertSame($der, $int->toDER()); } #[Test] @@ -197,7 +197,7 @@ public function negative65537() { $int = Integer::create(-65537); $der = "\x2\x3" . chr(0b11111110) . chr(0b11111111) . chr(0b11111111); - static::assertEquals($der, $int->toDER()); + static::assertSame($der, $int->toDER()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/Integer/IntegerTest.php b/tests/ASN1/Type/Primitive/Integer/IntegerTest.php index b7a00490..4e116c15 100644 --- a/tests/ASN1/Type/Primitive/Integer/IntegerTest.php +++ b/tests/ASN1/Type/Primitive/Integer/IntegerTest.php @@ -6,8 +6,6 @@ use Brick\Math\BigInteger; use Brick\Math\Exception\IntegerOverflowException; -use const PHP_INT_MAX; -use PHPUnit\Framework\Attributes\Depends; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use SpomkyLabs\Pki\ASN1\Element; @@ -15,6 +13,7 @@ use SpomkyLabs\Pki\ASN1\Type\Primitive\NullType; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; use UnexpectedValueException; +use const PHP_INT_MAX; /** * @internal @@ -22,52 +21,25 @@ final class IntegerTest extends TestCase { #[Test] - public function create(): Integer + public function create(): void { $el = Integer::create(1); static::assertInstanceOf(Integer::class, $el); - return $el; - } - - #[Test] - #[Depends('create')] - public function tag(Element $el) - { - static::assertEquals(Element::TYPE_INTEGER, $el->tag()); - } + static::assertSame(Element::TYPE_INTEGER, $el->tag()); - #[Test] - #[Depends('create')] - public function encode(Element $el): string - { - $der = $el->toDER(); - static::assertIsString($der); - return $der; - } - - #[Test] - #[Depends('encode')] - public function decode(string $data): Integer - { - $el = Integer::fromDER($data); - static::assertInstanceOf(Integer::class, $el); - return $el; - } - - #[Test] - #[Depends('create')] - #[Depends('decode')] - public function recoded(Element $ref, Element $el) - { - static::assertEquals($ref, $el); + $wrap = UnspecifiedType::create($el); + static::assertInstanceOf(Integer::class, $wrap->asInteger()); + static::assertSame(1, $el->intNumber()); } #[Test] - #[Depends('create')] - public function wrapped(Element $el) + public function decode(): void { - $wrap = UnspecifiedType::create($el); - static::assertInstanceOf(Integer::class, $wrap->asInteger()); + $el = Integer::create(1); + $data = $el->toDER(); + $decoded = Integer::fromDER($data); + static::assertInstanceOf(Integer::class, $decoded); + static::assertEquals($el, $decoded); } #[Test] @@ -79,16 +51,6 @@ public function wrappedFail() $wrap->asInteger(); } - /** - * @param Element $el - */ - #[Test] - #[Depends('create')] - public function intNumber(Integer $el) - { - static::assertEquals(1, $el->intNumber()); - } - #[Test] public function intNumberOverflow() { diff --git a/tests/ASN1/Type/Primitive/Null/EncodeTest.php b/tests/ASN1/Type/Primitive/Null/EncodeTest.php index a450dc76..b3f594ce 100644 --- a/tests/ASN1/Type/Primitive/Null/EncodeTest.php +++ b/tests/ASN1/Type/Primitive/Null/EncodeTest.php @@ -17,6 +17,6 @@ final class EncodeTest extends TestCase public function encode() { $el = NullType::create(); - static::assertEquals("\x5\x0", $el->toDER()); + static::assertSame("\x5\x0", $el->toDER()); } } diff --git a/tests/ASN1/Type/Primitive/Null/NullTest.php b/tests/ASN1/Type/Primitive/Null/NullTest.php index 91881687..38e5ebac 100644 --- a/tests/ASN1/Type/Primitive/Null/NullTest.php +++ b/tests/ASN1/Type/Primitive/Null/NullTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_NULL, $el->tag()); + static::assertSame(Element::TYPE_NULL, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/NumericString/DecodeTest.php b/tests/ASN1/Type/Primitive/NumericString/DecodeTest.php index 82471dbb..e19e8c77 100644 --- a/tests/ASN1/Type/Primitive/NumericString/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/NumericString/DecodeTest.php @@ -26,7 +26,7 @@ public function value() { $str = '123 456 789 0'; $el = NumericString::fromDER("\x12\x0d{$str}"); - static::assertEquals($str, $el->string()); + static::assertSame($str, $el->string()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/NumericString/NumericStringTest.php b/tests/ASN1/Type/Primitive/NumericString/NumericStringTest.php index c6f7e27e..655ea395 100644 --- a/tests/ASN1/Type/Primitive/NumericString/NumericStringTest.php +++ b/tests/ASN1/Type/Primitive/NumericString/NumericStringTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_NUMERIC_STRING, $el->tag()); + static::assertSame(Element::TYPE_NUMERIC_STRING, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/ObjectDescriptor/ObjectDescriptorTest.php b/tests/ASN1/Type/Primitive/ObjectDescriptor/ObjectDescriptorTest.php index 8d0db4e9..91c44ac2 100644 --- a/tests/ASN1/Type/Primitive/ObjectDescriptor/ObjectDescriptorTest.php +++ b/tests/ASN1/Type/Primitive/ObjectDescriptor/ObjectDescriptorTest.php @@ -32,7 +32,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_OBJECT_DESCRIPTOR, $el->tag()); + static::assertSame(Element::TYPE_OBJECT_DESCRIPTOR, $el->tag()); } #[Test] @@ -68,7 +68,7 @@ public function recoded(Element $ref, Element $el) #[Depends('create')] public function descriptor(ObjectDescriptor $desc) { - static::assertEquals(self::DESCRIPTOR, $desc->descriptor()); + static::assertSame(self::DESCRIPTOR, $desc->descriptor()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/OctetString/DecodeTest.php b/tests/ASN1/Type/Primitive/OctetString/DecodeTest.php index 9340a12e..716392f5 100644 --- a/tests/ASN1/Type/Primitive/OctetString/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/OctetString/DecodeTest.php @@ -24,13 +24,13 @@ public function type() public function helloWorld() { $el = OctetString::fromDER("\x4\x0cHello World!"); - static::assertEquals('Hello World!', $el->string()); + static::assertSame('Hello World!', $el->string()); } #[Test] public function nullString() { $el = OctetString::fromDER("\x4\x3\x0\x0\x0"); - static::assertEquals("\0\0\0", $el->string()); + static::assertSame("\0\0\0", $el->string()); } } diff --git a/tests/ASN1/Type/Primitive/OctetString/OctetStringTest.php b/tests/ASN1/Type/Primitive/OctetString/OctetStringTest.php index 0482d2fe..3df495ba 100644 --- a/tests/ASN1/Type/Primitive/OctetString/OctetStringTest.php +++ b/tests/ASN1/Type/Primitive/OctetString/OctetStringTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_OCTET_STRING, $el->tag()); + static::assertSame(Element::TYPE_OCTET_STRING, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/Oid/DecodeTest.php b/tests/ASN1/Type/Primitive/Oid/DecodeTest.php index 5104bacc..af5206dc 100644 --- a/tests/ASN1/Type/Primitive/Oid/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/Oid/DecodeTest.php @@ -25,49 +25,49 @@ public function type() public function decode() { $el = ObjectIdentifier::fromDER("\x06\x06\x2a\x86\x48\x86\xf7\x0d"); - static::assertEquals('1.2.840.113549', $el->oid()); + static::assertSame('1.2.840.113549', $el->oid()); } #[Test] public function firstZero() { $el = ObjectIdentifier::fromDER("\x6\x1\x0"); - static::assertEquals('0.0', $el->oid()); + static::assertSame('0.0', $el->oid()); } #[Test] public function first39() { $el = ObjectIdentifier::fromDER("\x6\x1\x27"); - static::assertEquals('0.39', $el->oid()); + static::assertSame('0.39', $el->oid()); } #[Test] public function first40() { $el = ObjectIdentifier::fromDER("\x6\x1\x28"); - static::assertEquals('1.0', $el->oid()); + static::assertSame('1.0', $el->oid()); } #[Test] public function first41() { $el = ObjectIdentifier::fromDER("\x6\x1\x29"); - static::assertEquals('1.1', $el->oid()); + static::assertSame('1.1', $el->oid()); } #[Test] public function first79() { $el = ObjectIdentifier::fromDER("\x6\x1\x4f"); - static::assertEquals('1.39', $el->oid()); + static::assertSame('1.39', $el->oid()); } #[Test] public function first80() { $el = ObjectIdentifier::fromDER("\x6\x1\x50"); - static::assertEquals('2.0', $el->oid()); + static::assertSame('2.0', $el->oid()); } #[Test] @@ -75,7 +75,7 @@ public function firstHuge() { // 0x1fffff $el = ObjectIdentifier::fromDER("\x6\x3\xff\xff\x7f"); - static::assertEquals('2.2097071', $el->oid()); + static::assertSame('2.2097071', $el->oid()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/Oid/EncodeTest.php b/tests/ASN1/Type/Primitive/Oid/EncodeTest.php index efe73797..87f5d57a 100644 --- a/tests/ASN1/Type/Primitive/Oid/EncodeTest.php +++ b/tests/ASN1/Type/Primitive/Oid/EncodeTest.php @@ -17,13 +17,13 @@ final class EncodeTest extends TestCase public function empty() { $oid = ObjectIdentifier::create(''); - static::assertEquals("\x6\0", $oid->toDER()); + static::assertSame("\x6\0", $oid->toDER()); } #[Test] public function encodeLong() { $oid = ObjectIdentifier::create('1.2.840.113549'); - static::assertEquals("\x06\x06\x2a\x86\x48\x86\xf7\x0d", $oid->toDER()); + static::assertSame("\x06\x06\x2a\x86\x48\x86\xf7\x0d", $oid->toDER()); } } diff --git a/tests/ASN1/Type/Primitive/Oid/ObjectIdentifierTest.php b/tests/ASN1/Type/Primitive/Oid/ObjectIdentifierTest.php index 23e9bb12..f2097830 100644 --- a/tests/ASN1/Type/Primitive/Oid/ObjectIdentifierTest.php +++ b/tests/ASN1/Type/Primitive/Oid/ObjectIdentifierTest.php @@ -31,7 +31,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_OBJECT_IDENTIFIER, $el->tag()); + static::assertSame(Element::TYPE_OBJECT_IDENTIFIER, $el->tag()); } #[Test] @@ -126,7 +126,7 @@ public function oID($oid) { $x = ObjectIdentifier::create($oid); $der = $x->toDER(); - static::assertEquals($oid, UnspecifiedType::fromDER($der)->asObjectIdentifier()->oid()); + static::assertSame($oid, UnspecifiedType::fromDER($der)->asObjectIdentifier()->oid()); } /** diff --git a/tests/ASN1/Type/Primitive/PrintableString/DecodeTest.php b/tests/ASN1/Type/Primitive/PrintableString/DecodeTest.php index 28878acc..6ac206ed 100644 --- a/tests/ASN1/Type/Primitive/PrintableString/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/PrintableString/DecodeTest.php @@ -26,7 +26,7 @@ public function value() { $str = 'Hello World.'; $el = PrintableString::fromDER("\x13\x0c{$str}"); - static::assertEquals($str, $el->string()); + static::assertSame($str, $el->string()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/PrintableString/PrintableStringTest.php b/tests/ASN1/Type/Primitive/PrintableString/PrintableStringTest.php index ce6a4eab..a938f342 100644 --- a/tests/ASN1/Type/Primitive/PrintableString/PrintableStringTest.php +++ b/tests/ASN1/Type/Primitive/PrintableString/PrintableStringTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_PRINTABLE_STRING, $el->tag()); + static::assertSame(Element::TYPE_PRINTABLE_STRING, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/Real/DecodeTest.php b/tests/ASN1/Type/Primitive/Real/DecodeTest.php index f4ff2f80..10ece03f 100644 --- a/tests/ASN1/Type/Primitive/Real/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/Real/DecodeTest.php @@ -74,6 +74,6 @@ public function specialEncodingInvalid() public function longExponent() { $real = Real::fromDER(hex2bin('090783044000000001')); - static::assertEquals('1073741824', $real->exponent()->base10()); + static::assertSame('1073741824', $real->exponent()->base10()); } } diff --git a/tests/ASN1/Type/Primitive/Real/EncodeTest.php b/tests/ASN1/Type/Primitive/Real/EncodeTest.php index fbf4c742..e5ed4e92 100644 --- a/tests/ASN1/Type/Primitive/Real/EncodeTest.php +++ b/tests/ASN1/Type/Primitive/Real/EncodeTest.php @@ -37,7 +37,7 @@ public function mantissaNormalization() { $real = Real::create(8, 0, 2); static::assertEquals(hex2bin('0903800301'), $real->toDER()); - static::assertEquals(8.0, Real::fromDER($real->toDER())->floatVal()); + static::assertSame(8.0, Real::fromDER($real->toDER())->floatVal()); } #[Test] @@ -45,7 +45,7 @@ public function mantissaNormalizationBase8() { $real = (Real::create(8, 3, 2))->withStrictDER(false); static::assertEquals(hex2bin('0903900201'), $real->toDER()); - static::assertEquals(64.0, Real::fromDER($real->toDER())->floatVal()); + static::assertSame(64.0, Real::fromDER($real->toDER())->floatVal()); } #[Test] @@ -53,7 +53,7 @@ public function mantissaNormalizationBase16() { $real = (Real::create(16, 4, 2))->withStrictDER(false); static::assertEquals(hex2bin('0903A00201'), $real->toDER()); - static::assertEquals(256.0, Real::fromDER($real->toDER())->floatVal()); + static::assertSame(256.0, Real::fromDER($real->toDER())->floatVal()); } #[Test] @@ -61,7 +61,7 @@ public function scaleFactor() { $real = (Real::create(128, 4, 2))->withStrictDER(false); static::assertEquals(hex2bin('0903AC0201'), $real->toDER()); - static::assertEquals(2048.0, Real::fromDER($real->toDER())->floatVal()); + static::assertSame(2048.0, Real::fromDER($real->toDER())->floatVal()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/Real/RealTest.php b/tests/ASN1/Type/Primitive/Real/RealTest.php index 56163fa8..b88a2a3f 100644 --- a/tests/ASN1/Type/Primitive/Real/RealTest.php +++ b/tests/ASN1/Type/Primitive/Real/RealTest.php @@ -4,11 +4,6 @@ namespace SpomkyLabs\Pki\Test\ASN1\Type\Primitive\Real; -use const INF; -use const M_PI; -use const NAN; -use const PHP_FLOAT_MAX; -use const PHP_FLOAT_MIN; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Depends; use PHPUnit\Framework\Attributes\Test; @@ -18,6 +13,11 @@ use SpomkyLabs\Pki\ASN1\Type\Primitive\Real; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; use UnexpectedValueException; +use const INF; +use const M_PI; +use const NAN; +use const PHP_FLOAT_MAX; +use const PHP_FLOAT_MIN; /** * @internal @@ -36,7 +36,7 @@ public function create(): Real #[Depends('create')] public function tag(Real $el) { - static::assertEquals(Element::TYPE_REAL, $el->tag()); + static::assertSame(Element::TYPE_REAL, $el->tag()); } #[Test] @@ -62,7 +62,7 @@ public function decode(string $data): Real #[Depends('decode')] public function recoded(Real $ref, Real $el) { - static::assertEquals($ref->nr3Val(), $el->nr3Val()); + static::assertSame($ref->nr3Val(), $el->nr3Val()); } #[Test] @@ -93,21 +93,21 @@ public function string(Real $el) #[Depends('create')] public function mantissa(Real $el) { - static::assertEquals(314, $el->mantissa()->toInt()); + static::assertSame(314, $el->mantissa()->toInt()); } #[Test] #[Depends('create')] public function exponent(Real $el) { - static::assertEquals(-2, $el->exponent()->toInt()); + static::assertSame(-2, $el->exponent()->toInt()); } #[Test] #[Depends('create')] public function base(Real $el) { - static::assertEquals(10, $el->base()); + static::assertSame(10, $el->base()); } #[Test] @@ -116,7 +116,7 @@ public function fromFloat(float $number) { $real = Real::fromFloat($number); $recoded = Real::fromDER($real->toDER()); - static::assertEquals($number, $recoded->floatVal()); + static::assertSame($number, $recoded->floatVal()); } #[Test] @@ -125,7 +125,7 @@ public function fromFloatNonStrict(float $number) { $real = Real::fromFloat($number)->withStrictDER(false); $recoded = Real::fromDER($real->toDER()); - static::assertEquals($number, $recoded->floatVal()); + static::assertSame($number, $recoded->floatVal()); } public static function provideFromFloat(): iterable @@ -172,49 +172,49 @@ public function fromPartsInvalidBase() public function fromNR3() { $real = Real::fromString('-123,456E-3'); - static::assertEquals(-0.123456, $real->floatVal()); + static::assertSame(-0.123456, $real->floatVal()); } #[Test] public function fromNR3Zero() { $real = Real::fromString('0,0E1'); - static::assertEquals(0.0, $real->floatVal()); + static::assertSame(0.0, $real->floatVal()); } #[Test] public function fromNR2() { $real = Real::fromString('-123,456'); - static::assertEquals(-123.456, $real->floatVal()); + static::assertSame(-123.456, $real->floatVal()); } #[Test] public function fromNR2Zero() { $real = Real::fromString('0,0'); - static::assertEquals(0.0, $real->floatVal()); + static::assertSame(0.0, $real->floatVal()); } #[Test] public function fromNR1() { $real = Real::fromString('-123'); - static::assertEquals(-123, $real->floatVal()); + static::assertEqualsWithDelta(-123, $real->floatVal(), 0.0001); } #[Test] public function fromNR1Zero() { $real = Real::fromString('0'); - static::assertEquals(0.0, $real->floatVal()); + static::assertSame(0.0, $real->floatVal()); } #[Test] public function parseNormalize() { $real = Real::fromString('100'); - static::assertEquals(2, $real->exponent()->toInt()); + static::assertSame(2, $real->exponent()->toInt()); } #[Test] @@ -229,20 +229,20 @@ public function parseFail() public function base2ToNR3() { $real = Real::fromFloat(-123.456); - static::assertEquals('-123456.E-3', $real->nr3Val()); + static::assertSame('-123456.E-3', $real->nr3Val()); } #[Test] public function nr3ShiftZeroes() { $real = Real::create(100, 0, 10); - static::assertEquals('1.E2', $real->nr3Val()); + static::assertSame('1.E2', $real->nr3Val()); } #[Test] public function nr3ZeroExponent() { $real = Real::create(1, 0, 10); - static::assertEquals('1.E+0', $real->nr3Val()); + static::assertSame('1.E+0', $real->nr3Val()); } } diff --git a/tests/ASN1/Type/Primitive/RelativeOid/DecodeTest.php b/tests/ASN1/Type/Primitive/RelativeOid/DecodeTest.php index 9068a851..4b1e416f 100644 --- a/tests/ASN1/Type/Primitive/RelativeOid/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/RelativeOid/DecodeTest.php @@ -17,6 +17,6 @@ final class DecodeTest extends TestCase public function decode() { $el = RelativeOID::fromDER("\x0d\x07\x01\02\x86\x48\x86\xf7\x0d"); - static::assertEquals('1.2.840.113549', $el->oid()); + static::assertSame('1.2.840.113549', $el->oid()); } } diff --git a/tests/ASN1/Type/Primitive/RelativeOid/EncodeTest.php b/tests/ASN1/Type/Primitive/RelativeOid/EncodeTest.php index 8c7ebbd2..e8444bec 100644 --- a/tests/ASN1/Type/Primitive/RelativeOid/EncodeTest.php +++ b/tests/ASN1/Type/Primitive/RelativeOid/EncodeTest.php @@ -17,13 +17,13 @@ final class EncodeTest extends TestCase public function zero() { $oid = RelativeOID::create('0'); - static::assertEquals("\x0d\1\0", $oid->toDER()); + static::assertSame("\x0d\1\0", $oid->toDER()); } #[Test] public function encodeLong() { $oid = RelativeOID::create('1.2.840.113549'); - static::assertEquals("\x0d\x07\x01\02\x86\x48\x86\xf7\x0d", $oid->toDER()); + static::assertSame("\x0d\x07\x01\02\x86\x48\x86\xf7\x0d", $oid->toDER()); } } diff --git a/tests/ASN1/Type/Primitive/RelativeOid/RelativeOIDTest.php b/tests/ASN1/Type/Primitive/RelativeOid/RelativeOIDTest.php index 5b20ae67..9baf5ba0 100644 --- a/tests/ASN1/Type/Primitive/RelativeOid/RelativeOIDTest.php +++ b/tests/ASN1/Type/Primitive/RelativeOid/RelativeOIDTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_RELATIVE_OID, $el->tag()); + static::assertSame(Element::TYPE_RELATIVE_OID, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/T61String/DecodeTest.php b/tests/ASN1/Type/Primitive/T61String/DecodeTest.php index 42c1c0f4..a1c729d7 100644 --- a/tests/ASN1/Type/Primitive/T61String/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/T61String/DecodeTest.php @@ -25,6 +25,6 @@ public function value() { $str = 'Hello World!'; $el = T61String::fromDER("\x14\x0c{$str}"); - static::assertEquals($str, $el->string()); + static::assertSame($str, $el->string()); } } diff --git a/tests/ASN1/Type/Primitive/T61String/T61StringTest.php b/tests/ASN1/Type/Primitive/T61String/T61StringTest.php index e8974e3c..ebaa5c49 100644 --- a/tests/ASN1/Type/Primitive/T61String/T61StringTest.php +++ b/tests/ASN1/Type/Primitive/T61String/T61StringTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_T61_STRING, $el->tag()); + static::assertSame(Element::TYPE_T61_STRING, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/UniversalString/DecodeTest.php b/tests/ASN1/Type/Primitive/UniversalString/DecodeTest.php index c7fc6d03..8d6ec419 100644 --- a/tests/ASN1/Type/Primitive/UniversalString/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/UniversalString/DecodeTest.php @@ -26,7 +26,7 @@ public function value() { $str = "\0\0\0H\0\0\0e\0\0\0l\0\0\0l\0\0\0o"; $el = UniversalString::fromDER("\x1c\x14{$str}"); - static::assertEquals($str, $el->string()); + static::assertSame($str, $el->string()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/UniversalString/UniversalStringTest.php b/tests/ASN1/Type/Primitive/UniversalString/UniversalStringTest.php index c5ed6c00..1faf1555 100644 --- a/tests/ASN1/Type/Primitive/UniversalString/UniversalStringTest.php +++ b/tests/ASN1/Type/Primitive/UniversalString/UniversalStringTest.php @@ -31,7 +31,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_UNIVERSAL_STRING, $el->tag()); + static::assertSame(Element::TYPE_UNIVERSAL_STRING, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/UtcTime/DecodeTest.php b/tests/ASN1/Type/Primitive/UtcTime/DecodeTest.php index 50437156..d93e3d6c 100644 --- a/tests/ASN1/Type/Primitive/UtcTime/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/UtcTime/DecodeTest.php @@ -26,7 +26,7 @@ public function value() { $date = strtotime('Mon Jan 2 15:04:05 MST 2006'); $el = UTCTime::fromDER("\x17\x0d" . '060102220405Z'); - static::assertEquals($date, $el->dateTime()->getTimestamp()); + static::assertSame($date, $el->dateTime()->getTimestamp()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/UtcTime/EncodeTest.php b/tests/ASN1/Type/Primitive/UtcTime/EncodeTest.php index 1547c421..a0ce9ea1 100644 --- a/tests/ASN1/Type/Primitive/UtcTime/EncodeTest.php +++ b/tests/ASN1/Type/Primitive/UtcTime/EncodeTest.php @@ -18,6 +18,6 @@ final class EncodeTest extends TestCase public function encode() { $el = UTCTime::create(new DateTimeImmutable('Mon Jan 2 15:04:05 MST 2006')); - static::assertEquals("\x17\x0d" . '060102220405Z', $el->toDER()); + static::assertSame("\x17\x0d" . '060102220405Z', $el->toDER()); } } diff --git a/tests/ASN1/Type/Primitive/UtcTime/UTCTimeTest.php b/tests/ASN1/Type/Primitive/UtcTime/UTCTimeTest.php index 7a6a7fba..7312278c 100644 --- a/tests/ASN1/Type/Primitive/UtcTime/UTCTimeTest.php +++ b/tests/ASN1/Type/Primitive/UtcTime/UTCTimeTest.php @@ -12,8 +12,8 @@ use SpomkyLabs\Pki\ASN1\Type\Primitive\UTCTime; use SpomkyLabs\Pki\ASN1\Type\TimeType; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; -use function strval; use UnexpectedValueException; +use function strval; /** * @internal @@ -32,7 +32,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_UTC_TIME, $el->tag()); + static::assertSame(Element::TYPE_UTC_TIME, $el->tag()); } #[Test] @@ -58,7 +58,7 @@ public function decode(string $data): UTCTime #[Depends('decode')] public function recoded(TimeType $ref, TimeType $el) { - static::assertEquals($ref->dateTime()->getTimestamp(), $el->dateTime()->getTimestamp()); + static::assertSame($ref->dateTime()->getTimestamp(), $el->dateTime()->getTimestamp()); } #[Test] @@ -82,7 +82,7 @@ public function wrappedFail() #[Depends('create')] public function stringable(TimeType $time) { - static::assertEquals('060102220405Z', $time->string()); - static::assertEquals('060102220405Z', strval($time)); + static::assertSame('060102220405Z', $time->string()); + static::assertSame('060102220405Z', strval($time)); } } diff --git a/tests/ASN1/Type/Primitive/Utf8String/DecodeTest.php b/tests/ASN1/Type/Primitive/Utf8String/DecodeTest.php index fc705262..6fc097ca 100644 --- a/tests/ASN1/Type/Primitive/Utf8String/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/Utf8String/DecodeTest.php @@ -26,7 +26,7 @@ public function value() { $str = '⠠⠓⠑⠇⠇⠕ â  â ē⠕⠗⠇⠙!'; $el = UTF8String::fromDER("\x0c\x26{$str}"); - static::assertEquals($str, $el->string()); + static::assertSame($str, $el->string()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/Utf8String/UTF8StringTest.php b/tests/ASN1/Type/Primitive/Utf8String/UTF8StringTest.php index ad6305da..d647c8d8 100644 --- a/tests/ASN1/Type/Primitive/Utf8String/UTF8StringTest.php +++ b/tests/ASN1/Type/Primitive/Utf8String/UTF8StringTest.php @@ -31,7 +31,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_UTF8_STRING, $el->tag()); + static::assertSame(Element::TYPE_UTF8_STRING, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/VideotexString/DecodeTest.php b/tests/ASN1/Type/Primitive/VideotexString/DecodeTest.php index d626dd45..b85ab7e8 100644 --- a/tests/ASN1/Type/Primitive/VideotexString/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/VideotexString/DecodeTest.php @@ -25,6 +25,6 @@ public function value() { $str = 'Hello World!'; $el = VideotexString::fromDER("\x15\x0c{$str}"); - static::assertEquals($str, $el->string()); + static::assertSame($str, $el->string()); } } diff --git a/tests/ASN1/Type/Primitive/VideotexString/VideotexStringTest.php b/tests/ASN1/Type/Primitive/VideotexString/VideotexStringTest.php index bd6aaa86..1bce12f5 100644 --- a/tests/ASN1/Type/Primitive/VideotexString/VideotexStringTest.php +++ b/tests/ASN1/Type/Primitive/VideotexString/VideotexStringTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_VIDEOTEX_STRING, $el->tag()); + static::assertSame(Element::TYPE_VIDEOTEX_STRING, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/VisibleString/DecodeTest.php b/tests/ASN1/Type/Primitive/VisibleString/DecodeTest.php index c4aa8880..0248784f 100644 --- a/tests/ASN1/Type/Primitive/VisibleString/DecodeTest.php +++ b/tests/ASN1/Type/Primitive/VisibleString/DecodeTest.php @@ -26,7 +26,7 @@ public function value() { $str = 'Hello World!'; $el = VisibleString::fromDER("\x1a\x0c{$str}"); - static::assertEquals($str, $el->string()); + static::assertSame($str, $el->string()); } #[Test] diff --git a/tests/ASN1/Type/Primitive/VisibleString/VisibleStringTest.php b/tests/ASN1/Type/Primitive/VisibleString/VisibleStringTest.php index a79c7cbd..7da01e0e 100644 --- a/tests/ASN1/Type/Primitive/VisibleString/VisibleStringTest.php +++ b/tests/ASN1/Type/Primitive/VisibleString/VisibleStringTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function tag(Element $el) { - static::assertEquals(Element::TYPE_VISIBLE_STRING, $el->tag()); + static::assertSame(Element::TYPE_VISIBLE_STRING, $el->tag()); } #[Test] diff --git a/tests/ASN1/Type/StringTypeDecodeTest.php b/tests/ASN1/Type/StringTypeDecodeTest.php index 154abdbc..503243ba 100644 --- a/tests/ASN1/Type/StringTypeDecodeTest.php +++ b/tests/ASN1/Type/StringTypeDecodeTest.php @@ -30,7 +30,7 @@ public function type() public function value() { $el = BaseString::fromDER("\x13\x0bHello World"); - static::assertEquals('Hello World', $el->string()); + static::assertSame('Hello World', $el->string()); } #[Test] diff --git a/tests/ASN1/Type/StringTypeTest.php b/tests/ASN1/Type/StringTypeTest.php index ee1df852..3d89ba9c 100644 --- a/tests/ASN1/Type/StringTypeTest.php +++ b/tests/ASN1/Type/StringTypeTest.php @@ -27,6 +27,6 @@ public function wrapped() public function stringable() { $s = OctetString::create('test'); - static::assertEquals('test', strval($s)); + static::assertSame('test', strval($s)); } } diff --git a/tests/ASN1/Type/TimeTypeDecodeTest.php b/tests/ASN1/Type/TimeTypeDecodeTest.php index 0599786a..c2359386 100644 --- a/tests/ASN1/Type/TimeTypeDecodeTest.php +++ b/tests/ASN1/Type/TimeTypeDecodeTest.php @@ -29,7 +29,7 @@ public function value() { $date = strtotime('Mon Jan 2 15:04:05 MST 2006'); $el = BaseTime::fromDER("\x17\x0d" . '060102220405Z'); - static::assertEquals($date, $el->dateTime()->getTimestamp()); + static::assertSame($date, $el->dateTime()->getTimestamp()); } #[Test] diff --git a/tests/ASN1/Type/UnspecifiedTypeTest.php b/tests/ASN1/Type/UnspecifiedTypeTest.php index 04df8985..cd5485dc 100644 --- a/tests/ASN1/Type/UnspecifiedTypeTest.php +++ b/tests/ASN1/Type/UnspecifiedTypeTest.php @@ -100,7 +100,7 @@ public function toDER() { $el = NullType::create(); $wrap = UnspecifiedType::create($el); - static::assertEquals($el->toDER(), $wrap->toDER()); + static::assertSame($el->toDER(), $wrap->toDER()); } #[Test] @@ -108,7 +108,7 @@ public function typeClass() { $el = NullType::create(); $wrap = UnspecifiedType::create($el); - static::assertEquals($el->typeClass(), $wrap->typeClass()); + static::assertSame($el->typeClass(), $wrap->typeClass()); } #[Test] @@ -124,7 +124,7 @@ public function tag() { $el = NullType::create(); $wrap = UnspecifiedType::create($el); - static::assertEquals($el->tag(), $wrap->tag()); + static::assertSame($el->tag(), $wrap->tag()); } #[Test] diff --git a/tests/ASN1/Util/BigIntTest.php b/tests/ASN1/Util/BigIntTest.php index db6c926e..69e730db 100644 --- a/tests/ASN1/Util/BigIntTest.php +++ b/tests/ASN1/Util/BigIntTest.php @@ -7,12 +7,12 @@ use Brick\Math\BigInteger; use Brick\Math\Exception\IntegerOverflowException; use InvalidArgumentException; -use const PHP_INT_MAX; -use const PHP_INT_MIN; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use SpomkyLabs\Pki\ASN1\Util\BigInt; use function strval; +use const PHP_INT_MAX; +use const PHP_INT_MIN; /** * @internal @@ -75,7 +75,7 @@ public function invalidNumber() public function fromUnsignedOctets() { $int = BigInt::fromUnsignedOctets(hex2bin('ff')); - static::assertEquals(255, $int->toInt()); + static::assertSame(255, $int->toInt()); } #[Test] @@ -90,7 +90,7 @@ public function fromUnsignedOctetsEmpty() public function fromSignedOctets() { $int = BigInt::fromSignedOctets(hex2bin('80')); - static::assertEquals(-128, $int->toInt()); + static::assertSame(-128, $int->toInt()); } #[Test] diff --git a/tests/ASN1/Util/FlagsTest.php b/tests/ASN1/Util/FlagsTest.php index 7f12b541..000359c7 100644 --- a/tests/ASN1/Util/FlagsTest.php +++ b/tests/ASN1/Util/FlagsTest.php @@ -5,6 +5,7 @@ namespace SpomkyLabs\Pki\Test\ASN1\Util; use Brick\Math\BigInteger; +use Iterator; use OutOfBoundsException; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; @@ -22,29 +23,27 @@ final class FlagsTest extends TestCase public function flags(BigInteger|int|string $num, int $width, string $result) { $flags = Flags::create($num, $width); - static::assertEquals($result, $flags->string()); - } - - public static function flagsProvider(): array - { - return [ - [1, 0, ''], - [1, 1, "\x80"], - [1, 4, "\x10"], - [1, 6, "\x04"], - [1, 8, "\x01"], - [1, 12, "\x00\x10"], - [1, 16, "\x00\x01"], - [0, 8, "\x00"], - [0, 9, "\x00\x00"], - [0xff, 8, "\xff"], - [0xff, 4, "\xf0"], - [0xff, 1, "\x80"], - [0xffff, 1, "\x80"], - [0xffffff, 12, "\xff\xf0"], - [1, 128, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01"], - [BigInteger::fromBase('80000000000000000000000000000000', 16), 128, "\x80\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"], - ]; + static::assertSame($result, $flags->string()); + } + + public static function flagsProvider(): Iterator + { + yield [1, 0, '']; + yield [1, 1, "\x80"]; + yield [1, 4, "\x10"]; + yield [1, 6, "\x04"]; + yield [1, 8, "\x01"]; + yield [1, 12, "\x00\x10"]; + yield [1, 16, "\x00\x01"]; + yield [0, 8, "\x00"]; + yield [0, 9, "\x00\x00"]; + yield [0xff, 8, "\xff"]; + yield [0xff, 4, "\xf0"]; + yield [0xff, 1, "\x80"]; + yield [0xffff, 1, "\x80"]; + yield [0xffffff, 12, "\xff\xf0"]; + yield [1, 128, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01"]; + yield [BigInteger::fromBase('80000000000000000000000000000000', 16), 128, "\x80\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"]; } #[Test] @@ -55,19 +54,17 @@ public function setBit(int $num, int $width, int $idx) static::assertTrue($flags->test($idx)); } - public static function setBitProvider(): array + public static function setBitProvider(): Iterator { - return [ - [1, 1, 0], - [1, 4, 3], - [1, 8, 7], - [1, 16, 15], - [1, 128, 127], - [0x08, 4, 0], - [0x80, 8, 0], - [0x8000, 16, 0], - [0x80, 16, 8], - ]; + yield [1, 1, 0]; + yield [1, 4, 3]; + yield [1, 8, 7]; + yield [1, 16, 15]; + yield [1, 128, 127]; + yield [0x08, 4, 0]; + yield [0x80, 8, 0]; + yield [0x8000, 16, 0]; + yield [0x80, 16, 8]; } #[Test] @@ -78,9 +75,13 @@ public function unsetBit(int $num, int $width, int $idx) static::assertFalse($flags->test($idx)); } - public static function unsetBitProvider(): array + public static function unsetBitProvider(): Iterator { - return [[0x7f, 8, 0], [0xfe, 8, 7], [0xff7f, 8, 0], [0xff7f, 12, 4], [0xff7f, 16, 8]]; + yield [0x7f, 8, 0]; + yield [0xfe, 8, 7]; + yield [0xff7f, 8, 0]; + yield [0xff7f, 12, 4]; + yield [0xff7f, 16, 8]; } /** @@ -92,23 +93,21 @@ public function toBitString(int $num, int $width, $result, int $unused_bits) { $flags = Flags::create($num, $width); $bs = $flags->bitString(); - static::assertEquals($result, $bs->string()); - static::assertEquals($unused_bits, $bs->unusedBits()); - } - - public static function toBitStringProvider(): array - { - return [ - [0, 0, '', 0], - [1, 1, "\x80", 7], - [1, 4, "\x10", 4], - [1, 8, "\x01", 0], - [1, 12, "\x0\x10", 4], - [1, 16, "\x0\x01", 0], - [0, 16, "\x0\x0", 0], - [0x800, 12, "\x80\x0", 4], - [0x8000, 16, "\x80\x0", 0], - ]; + static::assertSame($result, $bs->string()); + static::assertSame($unused_bits, $bs->unusedBits()); + } + + public static function toBitStringProvider(): Iterator + { + yield [0, 0, '', 0]; + yield [1, 1, "\x80", 7]; + yield [1, 4, "\x10", 4]; + yield [1, 8, "\x01", 0]; + yield [1, 12, "\x0\x10", 4]; + yield [1, 16, "\x0\x01", 0]; + yield [0, 16, "\x0\x0", 0]; + yield [0x800, 12, "\x80\x0", 4]; + yield [0x8000, 16, "\x80\x0", 0]; } #[Test] @@ -116,20 +115,18 @@ public static function toBitStringProvider(): array public function fromBitString(string $str, int $unused_bits, int $width, string $result) { $flags = Flags::fromBitString(BitString::create($str, $unused_bits), $width); - static::assertEquals($result, $flags->string()); + static::assertSame($result, $flags->string()); } - public static function fromBitStringProvider(): array + public static function fromBitStringProvider(): Iterator { - return [ - ["\xff", 0, 8, "\xff"], - ["\xff", 0, 4, "\xf0"], - ['', 0, 8, "\x00"], - ["\xff\xff", 4, 16, "\xff\xf0"], - ["\xff\x80", 7, 16, "\xff\x80"], - ["\x00\x10", 4, 12, "\x00\x10"], - ["\x00\x10", 4, 24, "\x00\x10\x00"], - ]; + yield ["\xff", 0, 8, "\xff"]; + yield ["\xff", 0, 4, "\xf0"]; + yield ['', 0, 8, "\x00"]; + yield ["\xff\xff", 4, 16, "\xff\xf0"]; + yield ["\xff\x80", 7, 16, "\xff\x80"]; + yield ["\x00\x10", 4, 12, "\x00\x10"]; + yield ["\x00\x10", 4, 24, "\x00\x10\x00"]; } /** @@ -143,26 +140,24 @@ public function number(BigInteger|int|string $num, int $width, $result) static::assertEquals($result, $flags->number()); } - public static function numberProvider(): array - { - return [ - [0xff, 8, 255], - [0xff, 4, 15], - [0xff, 2, 3], - [0xff, 1, 1], - [0, 8, 0], - [1, 1, 1], - [1, 4, 1], - [1, 8, 1], - [1, 12, 1], - [1, 16, 1], - [0x80, 24, 0x80], - [0x8000, 16, 0x8000], - [ - BigInteger::fromBase('080000000000000000000000000000000', 16), - 128, - '170141183460469231731687303715884105728', - ], + public static function numberProvider(): Iterator + { + yield [0xff, 8, 255]; + yield [0xff, 4, 15]; + yield [0xff, 2, 3]; + yield [0xff, 1, 1]; + yield [0, 8, 0]; + yield [1, 1, 1]; + yield [1, 4, 1]; + yield [1, 8, 1]; + yield [1, 12, 1]; + yield [1, 16, 1]; + yield [0x80, 24, 0x80]; + yield [0x8000, 16, 0x8000]; + yield [ + BigInteger::fromBase('080000000000000000000000000000000', 16), + 128, + '170141183460469231731687303715884105728', ]; } @@ -179,9 +174,9 @@ public function bitStringToNumber($str, int $unused_bits, int $width, $number) static::assertEquals($number, $flags->number()); } - public static function bitStringToNumberProvider(): array + public static function bitStringToNumberProvider(): Iterator { - return [["\x20", 5, 9, 64]]; + yield ["\x20", 5, 9, 64]; } #[Test] diff --git a/tests/CryptoBridge/Unit/Crypto/OpenSSLCryptoTest.php b/tests/CryptoBridge/Unit/Crypto/OpenSSLCryptoTest.php index 7bb1f2ec..9f73b77d 100644 --- a/tests/CryptoBridge/Unit/Crypto/OpenSSLCryptoTest.php +++ b/tests/CryptoBridge/Unit/Crypto/OpenSSLCryptoTest.php @@ -146,9 +146,9 @@ public function verifyInvalidKeyType(): void public function encryptAndDecrypt($data, CipherAlgorithmIdentifier $algo, $key): void { $ciphertext = self::$_crypto->encrypt($data, $key, $algo); - static::assertNotEquals($data, $ciphertext); + static::assertNotSame($data, $ciphertext); $plaintext = self::$_crypto->decrypt($ciphertext, $key, $algo); - static::assertEquals($data, $plaintext); + static::assertSame($data, $plaintext); } public static function provideEncryptAndDecrypt(): iterable diff --git a/tests/CryptoEncoding/Unit/PEMBundleTest.php b/tests/CryptoEncoding/Unit/PEMBundleTest.php index 2ca8a9f3..2b936b30 100644 --- a/tests/CryptoEncoding/Unit/PEMBundleTest.php +++ b/tests/CryptoEncoding/Unit/PEMBundleTest.php @@ -11,8 +11,8 @@ use RuntimeException; use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoEncoding\PEMBundle; -use function strval; use UnexpectedValueException; +use function strval; /** * @internal diff --git a/tests/CryptoEncoding/Unit/PEMTest.php b/tests/CryptoEncoding/Unit/PEMTest.php index 7fe1d676..29699c5b 100644 --- a/tests/CryptoEncoding/Unit/PEMTest.php +++ b/tests/CryptoEncoding/Unit/PEMTest.php @@ -9,8 +9,8 @@ use PHPUnit\Framework\TestCase; use RuntimeException; use SpomkyLabs\Pki\CryptoEncoding\PEM; -use function strval; use UnexpectedValueException; +use function strval; /** * @internal @@ -37,7 +37,7 @@ public function fromFile(): PEM #[Depends('fromFile')] public function type(PEM $pem) { - static::assertEquals(PEM::TYPE_PUBLIC_KEY, $pem->type()); + static::assertSame(PEM::TYPE_PUBLIC_KEY, $pem->type()); } #[Test] @@ -50,7 +50,7 @@ public function data() {$encoded} -----END TEST----- CODE_SAMPLE; - static::assertEquals($data, PEM::fromString($str)->data()); + static::assertSame($data, PEM::fromString($str)->data()); } #[Test] diff --git a/tests/CryptoTypes/Unit/AlgoId/Asymmetric/ECPKAITest.php b/tests/CryptoTypes/Unit/AlgoId/Asymmetric/ECPKAITest.php index 57bec385..c996022a 100644 --- a/tests/CryptoTypes/Unit/AlgoId/Asymmetric/ECPKAITest.php +++ b/tests/CryptoTypes/Unit/AlgoId/Asymmetric/ECPKAITest.php @@ -53,7 +53,7 @@ public function decodeNoParamsFail(Sequence $seq) #[Depends('decode')] public function namedCurve(ECPublicKeyAlgorithmIdentifier $ai) { - static::assertEquals(self::OID, $ai->namedCurve()); + static::assertSame(self::OID, $ai->namedCurve()); } #[Test] diff --git a/tests/CryptoTypes/Unit/AlgoId/Cipher/AES128CBCAITest.php b/tests/CryptoTypes/Unit/AlgoId/Cipher/AES128CBCAITest.php index 7e8145f2..2a4b2e12 100644 --- a/tests/CryptoTypes/Unit/AlgoId/Cipher/AES128CBCAITest.php +++ b/tests/CryptoTypes/Unit/AlgoId/Cipher/AES128CBCAITest.php @@ -44,7 +44,7 @@ public function decode(Sequence $seq) #[Depends('decode')] public function iV(AES128CBCAlgorithmIdentifier $ai) { - static::assertEquals(self::IV, $ai->initializationVector()); + static::assertSame(self::IV, $ai->initializationVector()); } #[Test] @@ -60,14 +60,14 @@ public function decodeNoParamsFail(Sequence $seq) #[Depends('decode')] public function blockSize(AES128CBCAlgorithmIdentifier $ai) { - static::assertEquals(16, $ai->blockSize()); + static::assertSame(16, $ai->blockSize()); } #[Test] #[Depends('decode')] public function keySize(AES128CBCAlgorithmIdentifier $ai) { - static::assertEquals(16, $ai->keySize()); + static::assertSame(16, $ai->keySize()); } #[Test] diff --git a/tests/CryptoTypes/Unit/AlgoId/Cipher/AES192CBCAITest.php b/tests/CryptoTypes/Unit/AlgoId/Cipher/AES192CBCAITest.php index b2739c09..731f148b 100644 --- a/tests/CryptoTypes/Unit/AlgoId/Cipher/AES192CBCAITest.php +++ b/tests/CryptoTypes/Unit/AlgoId/Cipher/AES192CBCAITest.php @@ -44,7 +44,7 @@ public function decode(Sequence $seq) #[Depends('decode')] public function iV(AES192CBCAlgorithmIdentifier $ai) { - static::assertEquals(self::IV, $ai->initializationVector()); + static::assertSame(self::IV, $ai->initializationVector()); } #[Test] @@ -60,14 +60,14 @@ public function decodeNoParamsFail(Sequence $seq) #[Depends('decode')] public function blockSize(AES192CBCAlgorithmIdentifier $ai) { - static::assertEquals(16, $ai->blockSize()); + static::assertSame(16, $ai->blockSize()); } #[Test] #[Depends('decode')] public function keySize(AES192CBCAlgorithmIdentifier $ai) { - static::assertEquals(24, $ai->keySize()); + static::assertSame(24, $ai->keySize()); } #[Test] diff --git a/tests/CryptoTypes/Unit/AlgoId/Cipher/AES256CBCAITest.php b/tests/CryptoTypes/Unit/AlgoId/Cipher/AES256CBCAITest.php index f03b9163..b0be3c6a 100644 --- a/tests/CryptoTypes/Unit/AlgoId/Cipher/AES256CBCAITest.php +++ b/tests/CryptoTypes/Unit/AlgoId/Cipher/AES256CBCAITest.php @@ -44,7 +44,7 @@ public function decode(Sequence $seq) #[Depends('decode')] public function iV(AES256CBCAlgorithmIdentifier $ai) { - static::assertEquals(self::IV, $ai->initializationVector()); + static::assertSame(self::IV, $ai->initializationVector()); } #[Test] @@ -60,14 +60,14 @@ public function decodeNoParamsFail(Sequence $seq) #[Depends('decode')] public function blockSize(AES256CBCAlgorithmIdentifier $ai) { - static::assertEquals(16, $ai->blockSize()); + static::assertSame(16, $ai->blockSize()); } #[Test] #[Depends('decode')] public function keySize(AES256CBCAlgorithmIdentifier $ai) { - static::assertEquals(32, $ai->keySize()); + static::assertSame(32, $ai->keySize()); } #[Test] diff --git a/tests/CryptoTypes/Unit/AlgoId/Cipher/DESCBCAITest.php b/tests/CryptoTypes/Unit/AlgoId/Cipher/DESCBCAITest.php index 2c4c2bd2..d781f78b 100644 --- a/tests/CryptoTypes/Unit/AlgoId/Cipher/DESCBCAITest.php +++ b/tests/CryptoTypes/Unit/AlgoId/Cipher/DESCBCAITest.php @@ -44,7 +44,7 @@ public function decode(Sequence $seq) #[Depends('decode')] public function iV(DESCBCAlgorithmIdentifier $ai) { - static::assertEquals(self::IV, $ai->initializationVector()); + static::assertSame(self::IV, $ai->initializationVector()); } #[Test] @@ -68,14 +68,14 @@ public function decodeNoParamsFail(Sequence $seq) #[Depends('decode')] public function blockSize(DESCBCAlgorithmIdentifier $ai) { - static::assertEquals(8, $ai->blockSize()); + static::assertSame(8, $ai->blockSize()); } #[Test] #[Depends('decode')] public function keySize(DESCBCAlgorithmIdentifier $ai) { - static::assertEquals(8, $ai->keySize()); + static::assertSame(8, $ai->keySize()); } #[Test] diff --git a/tests/CryptoTypes/Unit/AlgoId/Cipher/DESEDE3CBCAITest.php b/tests/CryptoTypes/Unit/AlgoId/Cipher/DESEDE3CBCAITest.php index b89bc20f..45ba432c 100644 --- a/tests/CryptoTypes/Unit/AlgoId/Cipher/DESEDE3CBCAITest.php +++ b/tests/CryptoTypes/Unit/AlgoId/Cipher/DESEDE3CBCAITest.php @@ -44,7 +44,7 @@ public function decode(Sequence $seq) #[Depends('decode')] public function iV(DESEDE3CBCAlgorithmIdentifier $ai) { - static::assertEquals(self::IV, $ai->initializationVector()); + static::assertSame(self::IV, $ai->initializationVector()); } #[Test] @@ -60,14 +60,14 @@ public function decodeNoParamsFail(Sequence $seq) #[Depends('decode')] public function blockSize(DESEDE3CBCAlgorithmIdentifier $ai) { - static::assertEquals(8, $ai->blockSize()); + static::assertSame(8, $ai->blockSize()); } #[Test] #[Depends('decode')] public function keySize(DESEDE3CBCAlgorithmIdentifier $ai) { - static::assertEquals(24, $ai->keySize()); + static::assertSame(24, $ai->keySize()); } #[Test] diff --git a/tests/CryptoTypes/Unit/AlgoId/Cipher/RC2CBCAITest.php b/tests/CryptoTypes/Unit/AlgoId/Cipher/RC2CBCAITest.php index cbe9f3c1..42d85024 100644 --- a/tests/CryptoTypes/Unit/AlgoId/Cipher/RC2CBCAITest.php +++ b/tests/CryptoTypes/Unit/AlgoId/Cipher/RC2CBCAITest.php @@ -57,14 +57,14 @@ public function decodeRFC2268OnlyIV() #[Depends('decode')] public function effectiveKeyBits(RC2CBCAlgorithmIdentifier $ai) { - static::assertEquals(64, $ai->effectiveKeyBits()); + static::assertSame(64, $ai->effectiveKeyBits()); } #[Test] #[Depends('decode')] public function iV(RC2CBCAlgorithmIdentifier $ai) { - static::assertEquals(self::IV, $ai->initializationVector()); + static::assertSame(self::IV, $ai->initializationVector()); } #[Test] @@ -80,14 +80,14 @@ public function decodeNoParamsFail(Sequence $seq) #[Depends('decode')] public function blockSize(RC2CBCAlgorithmIdentifier $ai) { - static::assertEquals(8, $ai->blockSize()); + static::assertSame(8, $ai->blockSize()); } #[Test] #[Depends('decode')] public function keySize(RC2CBCAlgorithmIdentifier $ai) { - static::assertEquals(8, $ai->keySize()); + static::assertSame(8, $ai->keySize()); } #[Test] diff --git a/tests/CryptoTypes/Unit/AlgoId/GenericAlgorithmIdentifierTest.php b/tests/CryptoTypes/Unit/AlgoId/GenericAlgorithmIdentifierTest.php index 299316ba..7279ba72 100644 --- a/tests/CryptoTypes/Unit/AlgoId/GenericAlgorithmIdentifierTest.php +++ b/tests/CryptoTypes/Unit/AlgoId/GenericAlgorithmIdentifierTest.php @@ -29,7 +29,7 @@ public function create(): GenericAlgorithmIdentifier #[Depends('create')] public function verifyName(GenericAlgorithmIdentifier $ai = null): void { - static::assertEquals('1.3.6.1.3', $ai->name()); + static::assertSame('1.3.6.1.3', $ai->name()); } #[Test] diff --git a/tests/CryptoTypes/Unit/EC/ECPrivateKeyTest.php b/tests/CryptoTypes/Unit/EC/ECPrivateKeyTest.php index 61fac298..71ad8800 100644 --- a/tests/CryptoTypes/Unit/EC/ECPrivateKeyTest.php +++ b/tests/CryptoTypes/Unit/EC/ECPrivateKeyTest.php @@ -78,7 +78,7 @@ public function privateKeyOctets(ECPrivateKey $pk): void #[Depends('fromPKIPEM')] public function hasNamedCurveFromPKI(ECPrivateKey $pk): void { - static::assertEquals(ECPublicKeyAlgorithmIdentifier::CURVE_PRIME256V1, $pk->namedCurve()); + static::assertSame(ECPublicKeyAlgorithmIdentifier::CURVE_PRIME256V1, $pk->namedCurve()); } #[Test] diff --git a/tests/CryptoTypes/Unit/EC/ECPublicKeyTest.php b/tests/CryptoTypes/Unit/EC/ECPublicKeyTest.php index d97bc39b..ec689688 100644 --- a/tests/CryptoTypes/Unit/EC/ECPublicKeyTest.php +++ b/tests/CryptoTypes/Unit/EC/ECPublicKeyTest.php @@ -106,7 +106,7 @@ public function hasNamedCurve(ECPublicKey $pk) #[Depends('fromPEM')] public function namedCurve(ECPublicKey $pk) { - static::assertEquals(ECPublicKeyAlgorithmIdentifier::CURVE_PRIME256V1, $pk->namedCurve()); + static::assertSame(ECPublicKeyAlgorithmIdentifier::CURVE_PRIME256V1, $pk->namedCurve()); } #[Test] diff --git a/tests/CryptoTypes/Unit/EC/I2OSTest.php b/tests/CryptoTypes/Unit/EC/I2OSTest.php index 2426c824..a32e8239 100644 --- a/tests/CryptoTypes/Unit/EC/I2OSTest.php +++ b/tests/CryptoTypes/Unit/EC/I2OSTest.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\Test\CryptoTypes\Unit\EC; use Iterator; -use function mb_strlen; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; @@ -13,6 +12,7 @@ use SpomkyLabs\Pki\ASN1\Type\Primitive\Integer; use SpomkyLabs\Pki\ASN1\Type\Primitive\OctetString; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\EC\ECConversion; +use function mb_strlen; /** * @internal @@ -37,14 +37,14 @@ public function integerType() public function length() { $os = ECConversion::integerToOctetString(Integer::create(256), 2); - static::assertEquals(2, mb_strlen($os->string(), '8bit')); + static::assertSame(2, mb_strlen($os->string(), '8bit')); } #[Test] public function pad() { $os = ECConversion::integerToOctetString(Integer::create(256), 3); - static::assertEquals(3, mb_strlen($os->string(), '8bit')); + static::assertSame(3, mb_strlen($os->string(), '8bit')); } #[Test] @@ -61,7 +61,7 @@ public function convert(Integer $num, $mlen, OctetString $os) $tmp = ECConversion::integerToOctetString($num, $mlen); static::assertEquals($os, $tmp); $result = ECConversion::octetStringToInteger($tmp); - static::assertEquals($num->number(), $result->number()); + static::assertSame($num->number(), $result->number()); } public static function provideConvert(): Iterator @@ -78,13 +78,13 @@ public static function provideConvert(): Iterator public function numberToOctets() { $octets = ECConversion::numberToOctets(0x42); - static::assertEquals("\x42", $octets); + static::assertSame("\x42", $octets); } #[Test] public function octetsToNumber() { $number = ECConversion::octetsToNumber("\x42"); - static::assertEquals(0x42, $number); + static::assertSame((string) 0x42, $number); } } diff --git a/tests/CryptoTypes/Unit/PrivateKeyInfoTest.php b/tests/CryptoTypes/Unit/PrivateKeyInfoTest.php index d73d1d05..73b6c464 100644 --- a/tests/CryptoTypes/Unit/PrivateKeyInfoTest.php +++ b/tests/CryptoTypes/Unit/PrivateKeyInfoTest.php @@ -56,7 +56,7 @@ public function algoObj(PrivateKeyInfo $pki) #[Depends('algoObj')] public function algoOID(AlgorithmIdentifier $algo) { - static::assertEquals(AlgorithmIdentifier::OID_RSA_ENCRYPTION, $algo->oid()); + static::assertSame(AlgorithmIdentifier::OID_RSA_ENCRYPTION, $algo->oid()); } #[Test] @@ -99,7 +99,7 @@ public function getECPrivateKey(PrivateKeyInfo $pki) #[Depends('getECPrivateKey')] public function eCPrivateKeyHasNamedCurve(ECPrivateKey $pk) { - static::assertEquals(ECPublicKeyAlgorithmIdentifier::CURVE_PRIME256V1, $pk->namedCurve()); + static::assertSame(ECPublicKeyAlgorithmIdentifier::CURVE_PRIME256V1, $pk->namedCurve()); } #[Test] @@ -165,7 +165,7 @@ public function fromECPrivateKey() #[Depends('decodeRSA')] public function version(PrivateKeyInfo $pki) { - static::assertEquals(PrivateKeyInfo::VERSION_1, $pki->version()); + static::assertSame(PrivateKeyInfo::VERSION_1, $pki->version()); } #[Test] @@ -233,7 +233,7 @@ public function attributes(PEM $pem) ->firstOf(AttributeType::OID_COMMON_NAME) ->first() ->stringValue(); - static::assertEquals('John Doe', $value); + static::assertSame('John Doe', $value); } #[Test] diff --git a/tests/CryptoTypes/Unit/PrivateKeyTest.php b/tests/CryptoTypes/Unit/PrivateKeyTest.php index d59892b5..c6c25c38 100644 --- a/tests/CryptoTypes/Unit/PrivateKeyTest.php +++ b/tests/CryptoTypes/Unit/PrivateKeyTest.php @@ -51,7 +51,7 @@ public function fromECPEM() #[Depends('fromECPEM')] public function eCPEMHasNamedCurve(ECPrivateKey $pk) { - static::assertEquals(ECPublicKeyAlgorithmIdentifier::CURVE_PRIME256V1, $pk->namedCurve()); + static::assertSame(ECPublicKeyAlgorithmIdentifier::CURVE_PRIME256V1, $pk->namedCurve()); } /** @@ -70,7 +70,7 @@ public function fromECPKIPEM() #[Depends('fromECPKIPEM')] public function eCPKIPEMHasNamedCurve(ECPrivateKey $pk) { - static::assertEquals(ECPublicKeyAlgorithmIdentifier::CURVE_PRIME256V1, $pk->namedCurve()); + static::assertSame(ECPublicKeyAlgorithmIdentifier::CURVE_PRIME256V1, $pk->namedCurve()); } #[Test] diff --git a/tests/CryptoTypes/Unit/PublicKeyInfoTest.php b/tests/CryptoTypes/Unit/PublicKeyInfoTest.php index 2e106961..6000c243 100644 --- a/tests/CryptoTypes/Unit/PublicKeyInfoTest.php +++ b/tests/CryptoTypes/Unit/PublicKeyInfoTest.php @@ -5,7 +5,6 @@ namespace SpomkyLabs\Pki\Test\CryptoTypes\Unit; use BadMethodCallException; -use function mb_strlen; use PHPUnit\Framework\Attributes\Depends; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; @@ -22,6 +21,7 @@ use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PublicKeyInfo; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\RSA\RSAPublicKey; use UnexpectedValueException; +use function mb_strlen; /** * @internal @@ -54,7 +54,7 @@ public function algoObj(PublicKeyInfo $pki) #[Depends('algoObj')] public function algoOID(AlgorithmIdentifier $algo) { - static::assertEquals(AlgorithmIdentifier::OID_RSA_ENCRYPTION, $algo->oid()); + static::assertSame(AlgorithmIdentifier::OID_RSA_ENCRYPTION, $algo->oid()); } #[Test] @@ -127,7 +127,7 @@ public function decodeFromRSAPublicKey() public function keyIdentifier(PublicKeyInfo $pki) { $id = $pki->keyIdentifier(); - static::assertEquals(160, mb_strlen($id, '8bit') * 8); + static::assertSame(160, mb_strlen($id, '8bit') * 8); } #[Test] @@ -135,7 +135,7 @@ public function keyIdentifier(PublicKeyInfo $pki) public function keyIdentifier64(PublicKeyInfo $pki) { $id = $pki->keyIdentifier64(); - static::assertEquals(64, mb_strlen($id, '8bit') * 8); + static::assertSame(64, mb_strlen($id, '8bit') * 8); } #[Test] diff --git a/tests/CryptoTypes/Unit/RFC8410/Curve25519Test.php b/tests/CryptoTypes/Unit/RFC8410/Curve25519Test.php index 5a7f61a0..6381b789 100644 --- a/tests/CryptoTypes/Unit/RFC8410/Curve25519Test.php +++ b/tests/CryptoTypes/Unit/RFC8410/Curve25519Test.php @@ -39,7 +39,7 @@ public function decodeEd25519WithPub(): Ed25519PrivateKey public function recodeEd25519WithPub(Ed25519PrivateKey $pk) { $pem = PEM::fromFile(TEST_ASSETS_DIR . '/rfc8410/ed25519_private_public_key.pem'); - static::assertEquals($pem->data(), $pk->toPEM()->data()); + static::assertSame($pem->data(), $pk->toPEM()->data()); } #[Test] @@ -57,7 +57,7 @@ public function decodeEd25519(): Ed25519PrivateKey public function recodeEd25519(Ed25519PrivateKey $pk) { $pem = PEM::fromFile(TEST_ASSETS_DIR . '/rfc8410/ed25519_private_key.pem'); - static::assertEquals($pem->data(), $pk->toPEM()->data()); + static::assertSame($pem->data(), $pk->toPEM()->data()); } #[Test] @@ -69,7 +69,7 @@ public function ed25519PrivateKeyData(Ed25519PrivateKey $pk) D4 EE 72 DB F9 13 58 4A D5 B6 D8 F1 F7 69 F8 AD 3A FE 7C 28 CB F1 D4 FB E0 97 A8 8F 44 75 58 42 CODE_SAMPLE; - $data = hex2bin(preg_replace('/[^\w]+/', '', $data)); + $data = hex2bin((string) preg_replace('/[^\w]+/', '', $data)); static::assertEquals($data, $pk->privateKeyData()); } @@ -163,7 +163,7 @@ public function decodeEd25519Pub(): Ed25519PublicKey public function recodeEd25519Pub(Ed25519PublicKey $pub) { $pem = PEM::fromFile(TEST_ASSETS_DIR . '/rfc8410/ed25519_public_key.pem'); - static::assertEquals($pem->data(), $pub->publicKeyInfo()->toPEM()->data()); + static::assertSame($pem->data(), $pub->publicKeyInfo()->toPEM()->data()); } #[Test] @@ -197,7 +197,7 @@ public function decodeX25519(): X25519PrivateKey public function recodeX25519(X25519PrivateKey $pk) { $pem = PEM::fromFile(TEST_ASSETS_DIR . '/rfc8410/x25519_private_key.pem'); - static::assertEquals($pem->data(), $pk->toPEM()->data()); + static::assertSame($pem->data(), $pk->toPEM()->data()); } #[Test] @@ -214,7 +214,7 @@ public function decodeX25519Pub(): X25519PublicKey public function recodeX25519Pub(X25519PublicKey $pub) { $pem = PEM::fromFile(TEST_ASSETS_DIR . '/rfc8410/x25519_public_key.pem'); - static::assertEquals($pem->data(), $pub->publicKeyInfo()->toPEM()->data()); + static::assertSame($pem->data(), $pub->publicKeyInfo()->toPEM()->data()); } #[Test] diff --git a/tests/CryptoTypes/Unit/RFC8410/Curve448Test.php b/tests/CryptoTypes/Unit/RFC8410/Curve448Test.php index 461a7719..dc0ba6c5 100644 --- a/tests/CryptoTypes/Unit/RFC8410/Curve448Test.php +++ b/tests/CryptoTypes/Unit/RFC8410/Curve448Test.php @@ -37,7 +37,7 @@ public function decodeEd448(): Ed448PrivateKey public function recodeEd448(Ed448PrivateKey $pk) { $pem = PEM::fromFile(TEST_ASSETS_DIR . '/rfc8410/ed448_private_key.pem'); - static::assertEquals($pem->data(), $pk->toPEM()->data()); + static::assertSame($pem->data(), $pk->toPEM()->data()); } #[Test] @@ -54,7 +54,7 @@ public function decodeEd448Pub(): Ed448PublicKey public function recodeEd448Pub(Ed448PublicKey $pub) { $pem = PEM::fromFile(TEST_ASSETS_DIR . '/rfc8410/ed448_public_key.pem'); - static::assertEquals($pem->data(), $pub->publicKeyInfo()->toPEM()->data()); + static::assertSame($pem->data(), $pub->publicKeyInfo()->toPEM()->data()); } #[Test] @@ -112,7 +112,7 @@ public function decodeX448(): X448PrivateKey public function recodeX448(X448PrivateKey $pk) { $pem = PEM::fromFile(TEST_ASSETS_DIR . '/rfc8410/x448_private_key.pem'); - static::assertEquals($pem->data(), $pk->toPEM()->data()); + static::assertSame($pem->data(), $pk->toPEM()->data()); } #[Test] @@ -129,7 +129,7 @@ public function decodeX448Pub(): X448PublicKey public function recodeX448Pub(X448PublicKey $pub) { $pem = PEM::fromFile(TEST_ASSETS_DIR . '/rfc8410/x448_public_key.pem'); - static::assertEquals($pem->data(), $pub->publicKeyInfo()->toPEM()->data()); + static::assertSame($pem->data(), $pub->publicKeyInfo()->toPEM()->data()); } #[Test] diff --git a/tests/CryptoTypes/Unit/Signature/ECSignatureTest.php b/tests/CryptoTypes/Unit/Signature/ECSignatureTest.php index 30a0748c..f965c6d1 100644 --- a/tests/CryptoTypes/Unit/Signature/ECSignatureTest.php +++ b/tests/CryptoTypes/Unit/Signature/ECSignatureTest.php @@ -65,14 +65,14 @@ public function recoded(ECSignature $ref, ECSignature $sig): void #[Depends('create')] public function rValue(ECSignature $sig): void { - static::assertEquals('123456789', $sig->r()); + static::assertSame('123456789', $sig->r()); } #[Test] #[Depends('create')] public function sValue(ECSignature $sig): void { - static::assertEquals('987654321', $sig->s()); + static::assertSame('987654321', $sig->s()); } #[Test] diff --git a/tests/X501/Integration/Attribute/AttributeCollectionCastTest.php b/tests/X501/Integration/Attribute/AttributeCollectionCastTest.php index 8ca6fe78..21e3dbba 100644 --- a/tests/X501/Integration/Attribute/AttributeCollectionCastTest.php +++ b/tests/X501/Integration/Attribute/AttributeCollectionCastTest.php @@ -29,6 +29,6 @@ public function cast() $value = $out->firstOf('1.3.6.1.3') ->first(); static::assertInstanceOf(AttributeCollectionCastTestAttrValue::class, $value); - static::assertEquals('test', $value->stringValue()); + static::assertSame('test', $value->stringValue()); } } diff --git a/tests/X501/Integration/Name/NameCompareTest.php b/tests/X501/Integration/Name/NameCompareTest.php index c698d740..cedb8d01 100644 --- a/tests/X501/Integration/Name/NameCompareTest.php +++ b/tests/X501/Integration/Name/NameCompareTest.php @@ -39,9 +39,9 @@ public function compareNames($dn1, $dn2, $expected) public function toStringMethod($dn1, $dn2, $expected) { $n1 = Name::fromString($dn1); - static::assertEquals($dn1, $n1->toString()); + static::assertSame($dn1, $n1->toString()); $n2 = Name::fromString($dn2); - static::assertEquals($dn2, $n2->toString()); + static::assertSame($dn2, $n2->toString()); } public static function provideCompareNames(): Iterator diff --git a/tests/X501/Unit/ASN1/AttributeTest.php b/tests/X501/Unit/ASN1/AttributeTest.php index 0146b9a8..00b879ce 100644 --- a/tests/X501/Unit/ASN1/AttributeTest.php +++ b/tests/X501/Unit/ASN1/AttributeTest.php @@ -69,7 +69,7 @@ public function type(Attribute $attr): void #[Depends('create')] public function first(Attribute $attr): void { - static::assertEquals('one', $attr->first()->rfc2253String()); + static::assertSame('one', $attr->first()->rfc2253String()); } #[Test] diff --git a/tests/X501/Unit/ASN1/AttributeTypeAndValueTest.php b/tests/X501/Unit/ASN1/AttributeTypeAndValueTest.php index 418a97f9..1e1aacc5 100644 --- a/tests/X501/Unit/ASN1/AttributeTypeAndValueTest.php +++ b/tests/X501/Unit/ASN1/AttributeTypeAndValueTest.php @@ -59,14 +59,14 @@ public function recoded(AttributeTypeAndValue $ref, AttributeTypeAndValue $new) #[Depends('create')] public function value(AttributeTypeAndValue $atv) { - static::assertEquals('one', $atv->value()->rfc2253String()); + static::assertSame('one', $atv->value()->rfc2253String()); } #[Test] #[Depends('create')] public function string(AttributeTypeAndValue $atv) { - static::assertEquals('name=one', $atv->toString()); + static::assertSame('name=one', $atv->toString()); } #[Test] diff --git a/tests/X501/Unit/ASN1/AttributeTypeTest.php b/tests/X501/Unit/ASN1/AttributeTypeTest.php index 8880af36..c8cf2f3b 100644 --- a/tests/X501/Unit/ASN1/AttributeTypeTest.php +++ b/tests/X501/Unit/ASN1/AttributeTypeTest.php @@ -58,14 +58,14 @@ public function recoded(AttributeType $ref, AttributeType $new) #[Depends('create')] public function oID(AttributeType $type) { - static::assertEquals(AttributeType::OID_NAME, $type->oid()); + static::assertSame(AttributeType::OID_NAME, $type->oid()); } #[Test] #[Depends('create')] public function verifyName(AttributeType $type = null) { - static::assertEquals('name', $type->typeName()); + static::assertSame('name', $type->typeName()); } #[Test] diff --git a/tests/X501/Unit/ASN1/Collection/AttributeCollectionTest.php b/tests/X501/Unit/ASN1/Collection/AttributeCollectionTest.php index 996acb21..ffe4b8cd 100644 --- a/tests/X501/Unit/ASN1/Collection/AttributeCollectionTest.php +++ b/tests/X501/Unit/ASN1/Collection/AttributeCollectionTest.php @@ -50,7 +50,7 @@ public function hasNot(AttributeCollection $c) #[Depends('create')] public function firstOf(AttributeCollection $c) { - static::assertEquals('n1', $c->firstOf('name')->first()->stringValue()); + static::assertSame('n1', $c->firstOf('name')->first()->stringValue()); } #[Test] @@ -67,14 +67,14 @@ public function firstOfFails(AttributeCollection $c) public function allOf(AttributeCollection $c) { $vals = array_map(fn (Attribute $attr) => $attr->first()->stringValue(), $c->allOf('name')); - static::assertEquals(['n1', 'n2'], $vals); + static::assertSame(['n1', 'n2'], $vals); } #[Test] #[Depends('create')] public function allOfNone(AttributeCollection $c) { - static::assertEquals([], $c->allOf('commonName')); + static::assertSame([], $c->allOf('commonName')); } #[Test] @@ -82,7 +82,7 @@ public function allOfNone(AttributeCollection $c) public function all(AttributeCollection $c) { $vals = array_map(fn (Attribute $attr) => $attr->first()->stringValue(), $c->all()); - static::assertEquals(['n1', 'n2', 'd'], $vals); + static::assertSame(['n1', 'n2', 'd'], $vals); } #[Test] @@ -91,7 +91,7 @@ public function withAdditional(AttributeCollection $c) { $c = $c->withAdditional(Attribute::fromAttributeValues(CommonNameValue::create('cn'))); $vals = array_map(fn (Attribute $attr) => $attr->first()->stringValue(), $c->all()); - static::assertEquals(['n1', 'n2', 'd', 'cn'], $vals); + static::assertSame(['n1', 'n2', 'd', 'cn'], $vals); } #[Test] @@ -100,7 +100,7 @@ public function withUnique(AttributeCollection $c) { $c = $c->withUnique(Attribute::fromAttributeValues(NameValue::create('uniq'))); $vals = array_map(fn (Attribute $attr) => $attr->first()->stringValue(), $c->all()); - static::assertEquals(['d', 'uniq'], $vals); + static::assertSame(['d', 'uniq'], $vals); } #[Test] @@ -118,6 +118,6 @@ public function iterator(AttributeCollection $c) foreach ($c as $attr) { $vals[] = $attr->first()->stringValue(); } - static::assertEquals(['n1', 'n2', 'd'], $vals); + static::assertSame(['n1', 'n2', 'd'], $vals); } } diff --git a/tests/X501/Unit/ASN1/Collection/SetOfAttributesTest.php b/tests/X501/Unit/ASN1/Collection/SetOfAttributesTest.php index 77ace66b..6e0cad8e 100644 --- a/tests/X501/Unit/ASN1/Collection/SetOfAttributesTest.php +++ b/tests/X501/Unit/ASN1/Collection/SetOfAttributesTest.php @@ -49,6 +49,6 @@ public function decode(Set $set) public function recoded(SetOfAttributes $original, SetOfAttributes $recoded) { // compare DER encodings because SET OF sorts the elements - static::assertEquals($original->toASN1()->toDER(), $recoded->toASN1()->toDER()); + static::assertSame($original->toASN1()->toDER(), $recoded->toASN1()->toDER()); } } diff --git a/tests/X501/Unit/ASN1/NameTest.php b/tests/X501/Unit/ASN1/NameTest.php index 6f6a258f..812bbf7e 100644 --- a/tests/X501/Unit/ASN1/NameTest.php +++ b/tests/X501/Unit/ASN1/NameTest.php @@ -67,7 +67,7 @@ public function all(Name $name) #[Depends('create')] public function firstValueOf(Name $name) { - static::assertEquals('two', $name->firstValueOf('name')->stringValue()); + static::assertSame('two', $name->firstValueOf('name')->stringValue()); } #[Test] @@ -98,14 +98,14 @@ public function countMethod(Name $name) #[Depends('create')] public function countOfType(Name $name) { - static::assertEquals(2, $name->countOfType('name')); + static::assertSame(2, $name->countOfType('name')); } #[Test] #[Depends('create')] public function countOfTypeNone(Name $name) { - static::assertEquals(0, $name->countOfType('cn')); + static::assertSame(0, $name->countOfType('cn')); } #[Test] @@ -123,7 +123,7 @@ public function iterable(Name $name) #[Depends('create')] public function string(Name $name) { - static::assertEquals('name=one,name=two', $name->toString()); + static::assertSame('name=one,name=two', $name->toString()); } #[Test] diff --git a/tests/X501/Unit/ASN1/RDNTest.php b/tests/X501/Unit/ASN1/RDNTest.php index cfe068e3..f5d94554 100644 --- a/tests/X501/Unit/ASN1/RDNTest.php +++ b/tests/X501/Unit/ASN1/RDNTest.php @@ -11,8 +11,8 @@ use SpomkyLabs\Pki\X501\ASN1\AttributeTypeAndValue; use SpomkyLabs\Pki\X501\ASN1\AttributeValue\NameValue; use SpomkyLabs\Pki\X501\ASN1\RDN; -use function strval; use UnexpectedValueException; +use function strval; /** * @internal @@ -107,7 +107,7 @@ public function iterable(RDN $rdn) #[Depends('create')] public function string(RDN $rdn) { - static::assertEquals('name=one+name=two', $rdn->toString()); + static::assertSame('name=one+name=two', $rdn->toString()); } #[Test] diff --git a/tests/X501/Unit/ASN1/Value/DirectoryStringTest.php b/tests/X501/Unit/ASN1/Value/DirectoryStringTest.php index fbe47237..61676d2b 100644 --- a/tests/X501/Unit/ASN1/Value/DirectoryStringTest.php +++ b/tests/X501/Unit/ASN1/Value/DirectoryStringTest.php @@ -39,6 +39,6 @@ public function toASN1InvalidType() public function teletexValue() { $value = CommonNameValue::create('name', Element::TYPE_T61_STRING); - static::assertEquals('#1404' . bin2hex('name'), $value->rfc2253String()); + static::assertSame('#1404' . bin2hex('name'), $value->rfc2253String()); } } diff --git a/tests/X501/Unit/ASN1/Value/UnknownAttributeValueTest.php b/tests/X501/Unit/ASN1/Value/UnknownAttributeValueTest.php index 27fdfb8e..87b6d0f1 100644 --- a/tests/X501/Unit/ASN1/Value/UnknownAttributeValueTest.php +++ b/tests/X501/Unit/ASN1/Value/UnknownAttributeValueTest.php @@ -32,7 +32,7 @@ public function create() #[Depends('create')] public function oID(AttributeValue $val) { - static::assertEquals(self::OID, $val->oid()); + static::assertSame(self::OID, $val->oid()); } #[Test] @@ -46,7 +46,7 @@ public function aNS1(AttributeValue $val) #[Depends('create')] public function string(AttributeValue $val) { - static::assertEquals('Test', $val->rfc2253String()); + static::assertSame('Test', $val->rfc2253String()); } #[Test] diff --git a/tests/X501/Unit/DN/DNParserTest.php b/tests/X501/Unit/DN/DNParserTest.php index 5f1d044c..375df709 100644 --- a/tests/X501/Unit/DN/DNParserTest.php +++ b/tests/X501/Unit/DN/DNParserTest.php @@ -167,7 +167,7 @@ public static function provideParseString(): Iterator public function escapeString($str, $expected) { $escaped = DNParser::escapeString($str); - static::assertEquals($expected, $escaped); + static::assertSame($expected, $escaped); } public static function provideEscapeString(): Iterator diff --git a/tests/X501/Unit/StringPrep/CheckBidiStepTest.php b/tests/X501/Unit/StringPrep/CheckBidiStepTest.php index 2dddd31f..fb79d3cc 100644 --- a/tests/X501/Unit/StringPrep/CheckBidiStepTest.php +++ b/tests/X501/Unit/StringPrep/CheckBidiStepTest.php @@ -18,6 +18,6 @@ public function apply() { $str = 'Test'; $step = new CheckBidiStep(); - static::assertEquals($str, $step->apply($str)); + static::assertSame($str, $step->apply($str)); } } diff --git a/tests/X501/Unit/StringPrep/InsignificantSpaceStepTest.php b/tests/X501/Unit/StringPrep/InsignificantSpaceStepTest.php index a2fc03ac..1e8747ad 100644 --- a/tests/X501/Unit/StringPrep/InsignificantSpaceStepTest.php +++ b/tests/X501/Unit/StringPrep/InsignificantSpaceStepTest.php @@ -23,7 +23,7 @@ final class InsignificantSpaceStepTest extends TestCase public function applyNonSubstring($string, $expected) { $step = new InsignificantNonSubstringSpaceStep(); - static::assertEquals($expected, $step->apply($string)); + static::assertSame($expected, $step->apply($string)); } public static function provideApplyNonSubstring(): iterable diff --git a/tests/X501/Unit/StringPrep/MapStepTest.php b/tests/X501/Unit/StringPrep/MapStepTest.php index a3ad6f04..eeea3213 100644 --- a/tests/X501/Unit/StringPrep/MapStepTest.php +++ b/tests/X501/Unit/StringPrep/MapStepTest.php @@ -19,7 +19,7 @@ final class MapStepTest extends TestCase public function applyCaseFold(string $string, string $expected): void { $step = MapStep::create(true); - static::assertEquals($expected, $step->apply($string)); + static::assertSame($expected, $step->apply($string)); } public static function provideApplyCaseFold(): iterable diff --git a/tests/X501/Unit/StringPrep/ProhibitStepTest.php b/tests/X501/Unit/StringPrep/ProhibitStepTest.php index ff1c268b..59451b73 100644 --- a/tests/X501/Unit/StringPrep/ProhibitStepTest.php +++ b/tests/X501/Unit/StringPrep/ProhibitStepTest.php @@ -18,6 +18,6 @@ public function apply() { $str = 'Test'; $step = new ProhibitStep(); - static::assertEquals($str, $step->apply($str)); + static::assertSame($str, $step->apply($str)); } } diff --git a/tests/X501/Unit/StringPrep/StringPreparerTest.php b/tests/X501/Unit/StringPrep/StringPreparerTest.php index 261bbc06..b24cb5ff 100644 --- a/tests/X501/Unit/StringPrep/StringPreparerTest.php +++ b/tests/X501/Unit/StringPrep/StringPreparerTest.php @@ -37,6 +37,6 @@ public function withCaseFolding(StringPreparer $preparer) public function prepare(StringPreparer $preparer) { $str = $preparer->prepare('TEST'); - static::assertEquals(' test ', $str); + static::assertSame(' test ', $str); } } diff --git a/tests/X509/Integration/Ac/IssuerSerialTest.php b/tests/X509/Integration/Ac/IssuerSerialTest.php index 4ef89f4a..7663c5e7 100644 --- a/tests/X509/Integration/Ac/IssuerSerialTest.php +++ b/tests/X509/Integration/Ac/IssuerSerialTest.php @@ -60,7 +60,7 @@ public function issuer(IssuerSerial $is) #[Depends('fromCertificate')] public function serial(IssuerSerial $is) { - static::assertEquals(self::$_cert->tbsCertificate()->serialNumber(), $is->serial()); + static::assertSame(self::$_cert->tbsCertificate()->serialNumber(), $is->serial()); } #[Test] diff --git a/tests/X509/Integration/AcmeAc/DecodeTest.php b/tests/X509/Integration/AcmeAc/DecodeTest.php index 8c8fc11a..c5f7766b 100644 --- a/tests/X509/Integration/AcmeAc/DecodeTest.php +++ b/tests/X509/Integration/AcmeAc/DecodeTest.php @@ -29,7 +29,7 @@ final class DecodeTest extends TestCase public function pEM() { $pem = PEM::fromFile(TEST_ASSETS_DIR . '/ac/acme-ac.pem'); - static::assertEquals(PEM::TYPE_ATTRIBUTE_CERTIFICATE, $pem->type()); + static::assertSame(PEM::TYPE_ATTRIBUTE_CERTIFICATE, $pem->type()); return $pem; } diff --git a/tests/X509/Integration/AcmeCert/DecodeTest.php b/tests/X509/Integration/AcmeCert/DecodeTest.php index 853ae27a..ae960f92 100644 --- a/tests/X509/Integration/AcmeCert/DecodeTest.php +++ b/tests/X509/Integration/AcmeCert/DecodeTest.php @@ -67,7 +67,7 @@ public function signatureAlgorithm(Certificate $cert) #[Depends('signatureAlgorithm')] public function signatureAlgorithmValue(AlgorithmIdentifier $algo) { - static::assertEquals(AlgorithmIdentifier::OID_SHA1_WITH_RSA_ENCRYPTION, $algo->oid()); + static::assertSame(AlgorithmIdentifier::OID_SHA1_WITH_RSA_ENCRYPTION, $algo->oid()); } /** @@ -94,21 +94,21 @@ public function signatureValue(Signature $sig) #[Depends('tBSCertificate')] public function version(TBSCertificate $tbsCert) { - static::assertEquals(TBSCertificate::VERSION_3, $tbsCert->version()); + static::assertSame(TBSCertificate::VERSION_3, $tbsCert->version()); } #[Test] #[Depends('tBSCertificate')] public function serial(TBSCertificate $tbsCert) { - static::assertEquals(42, $tbsCert->serialNumber()); + static::assertSame('42', $tbsCert->serialNumber()); } #[Test] #[Depends('tBSCertificate')] public function signatureAlgo(TBSCertificate $tbsCert) { - static::assertEquals(AlgorithmIdentifier::OID_SHA1_WITH_RSA_ENCRYPTION, $tbsCert->signature()->oid()); + static::assertSame(AlgorithmIdentifier::OID_SHA1_WITH_RSA_ENCRYPTION, $tbsCert->signature()->oid()); } /** @@ -127,7 +127,7 @@ public function issuer(TBSCertificate $tbsCert) #[Depends('issuer')] public function issuerDN(Name $name) { - static::assertEquals('o=ACME Ltd.,c=FI,cn=ACME Intermediate CA', $name->toString()); + static::assertSame('o=ACME Ltd.,c=FI,cn=ACME Intermediate CA', $name->toString()); } /** @@ -150,7 +150,7 @@ public function notBefore(Validity $validity) ->dateTime() ->setTimezone(new DateTimeZone('GMT')) ->format('M j H:i:s Y T'); - static::assertEquals('Jan 1 12:00:00 2016 GMT', $str); + static::assertSame('Jan 1 12:00:00 2016 GMT', $str); } #[Test] @@ -161,7 +161,7 @@ public function notAfter(Validity $validity) ->dateTime() ->setTimezone(new DateTimeZone('GMT')) ->format('M j H:i:s Y T'); - static::assertEquals('Jan 2 15:04:05 2026 GMT', $str); + static::assertSame('Jan 2 15:04:05 2026 GMT', $str); } /** @@ -180,7 +180,7 @@ public function subject(TBSCertificate $tbsCert) #[Depends('subject')] public function subjectDN(Name $name) { - static::assertEquals('o=ACME Ltd.,c=FI,cn=example.com', $name->toString()); + static::assertSame('o=ACME Ltd.,c=FI,cn=example.com', $name->toString()); } /** @@ -199,7 +199,7 @@ public function subjectPublicKeyInfo(TBSCertificate $tbsCert) #[Depends('subjectPublicKeyInfo')] public function publicKeyAlgo(PublicKeyInfo $pki) { - static::assertEquals(AlgorithmIdentifier::OID_RSA_ENCRYPTION, $pki->algorithmIdentifier()->oid()); + static::assertSame(AlgorithmIdentifier::OID_RSA_ENCRYPTION, $pki->algorithmIdentifier()->oid()); } #[Test] diff --git a/tests/X509/Integration/AcmeCert/Extension/AuthorityKeyIdentifierTest.php b/tests/X509/Integration/AcmeCert/Extension/AuthorityKeyIdentifierTest.php index d919f94a..ebee0ec2 100644 --- a/tests/X509/Integration/AcmeCert/Extension/AuthorityKeyIdentifierTest.php +++ b/tests/X509/Integration/AcmeCert/Extension/AuthorityKeyIdentifierTest.php @@ -35,7 +35,7 @@ public function authorityKeyIdentifierKey(AuthorityKeyIdentifierExtension $aki) $keyid = RSAPrivateKey::fromPEM($pem)->publicKey() ->publicKeyInfo() ->keyIdentifier(); - static::assertEquals($keyid, $aki->keyIdentifier()); + static::assertSame($keyid, $aki->keyIdentifier()); } #[Test] @@ -46,7 +46,7 @@ public function authorityKeyIdentifierIssuer(AuthorityKeyIdentifierExtension $ak ->firstOf(GeneralName::TAG_DIRECTORY_NAME) ->dn() ->toString(); - static::assertEquals('o=ACME Ltd.,c=FI,cn=ACME Root CA', $issuer_dn); - static::assertEquals(1, $aki->serial()); + static::assertSame('o=ACME Ltd.,c=FI,cn=ACME Root CA', $issuer_dn); + static::assertSame('1', $aki->serial()); } } diff --git a/tests/X509/Integration/AcmeCert/Extension/BasicConstraintsTest.php b/tests/X509/Integration/AcmeCert/Extension/BasicConstraintsTest.php index 832918aa..5b7e01c4 100644 --- a/tests/X509/Integration/AcmeCert/Extension/BasicConstraintsTest.php +++ b/tests/X509/Integration/AcmeCert/Extension/BasicConstraintsTest.php @@ -35,6 +35,6 @@ public function basicConstraintsCA(BasicConstraintsExtension $bc) #[Depends('basicConstraintsExtension')] public function basicConstraintsPathLen(BasicConstraintsExtension $bc) { - static::assertEquals(3, $bc->pathLen()); + static::assertSame(3, $bc->pathLen()); } } diff --git a/tests/X509/Integration/AcmeCert/Extension/CRLDistributionPointsTest.php b/tests/X509/Integration/AcmeCert/Extension/CRLDistributionPointsTest.php index 56e7faa5..ad17a755 100644 --- a/tests/X509/Integration/AcmeCert/Extension/CRLDistributionPointsTest.php +++ b/tests/X509/Integration/AcmeCert/Extension/CRLDistributionPointsTest.php @@ -51,7 +51,7 @@ public function distributionPoint(CRLDistributionPointsExtension $ext) public function fullName(DistributionPoint $dp) { $name = $dp->distributionPointName(); - static::assertEquals(DistributionPointName::TAG_FULL_NAME, $name->tag()); + static::assertSame(DistributionPointName::TAG_FULL_NAME, $name->tag()); return $name; } @@ -62,7 +62,7 @@ public function uRI(FullName $name) $uri = $name->names() ->firstOf(GeneralName::TAG_URI) ->uri(); - static::assertEquals('http://example.com/myca.crl', $uri); + static::assertSame('http://example.com/myca.crl', $uri); } /** @@ -108,6 +108,6 @@ public function issuer(DistributionPoint $dp) public function issuerDirName(GeneralNames $gn) { $dn = $gn->firstOf(GeneralName::TAG_DIRECTORY_NAME)->dn(); - static::assertEquals('cn=ACME,o=ACME Ltd.', $dn->toString()); + static::assertSame('cn=ACME,o=ACME Ltd.', $dn->toString()); } } diff --git a/tests/X509/Integration/AcmeCert/Extension/CertificatePoliciesTest.php b/tests/X509/Integration/AcmeCert/Extension/CertificatePoliciesTest.php index 52f94ba9..2817d25b 100644 --- a/tests/X509/Integration/AcmeCert/Extension/CertificatePoliciesTest.php +++ b/tests/X509/Integration/AcmeCert/Extension/CertificatePoliciesTest.php @@ -58,7 +58,7 @@ public function policyCPSQualifier(PolicyInformation $pi) #[Depends('policyCPSQualifier')] public function policyCPSQualifierURI(CPSQualifier $cps) { - static::assertEquals('http://example.com/cps.html', $cps->uri()); + static::assertSame('http://example.com/cps.html', $cps->uri()); } /** @@ -77,7 +77,7 @@ public function policyUserNoticeQualifier(PolicyInformation $pi) #[Depends('policyUserNoticeQualifier')] public function policyUserNoticeQualifierText(UserNoticeQualifier $un) { - static::assertEquals('All your base are belong to us!', $un->explicitText()->string()); + static::assertSame('All your base are belong to us!', $un->explicitText()->string()); } /** @@ -96,13 +96,13 @@ public function policyUserNoticeQualifierRef(UserNoticeQualifier $un) #[Depends('policyUserNoticeQualifierRef')] public function policyUserNoticeQualifierOrganization(NoticeReference $ref) { - static::assertEquals('Toaplan Co., Ltd.', $ref->organization()->string()); + static::assertSame('Toaplan Co., Ltd.', $ref->organization()->string()); } #[Test] #[Depends('policyUserNoticeQualifierRef')] public function policyUserNoticeQualifierNumbers(NoticeReference $ref) { - static::assertEquals([1, 2], $ref->numbers()); + static::assertSame([1, 2], $ref->numbers()); } } diff --git a/tests/X509/Integration/AcmeCert/Extension/FreshestCRLTest.php b/tests/X509/Integration/AcmeCert/Extension/FreshestCRLTest.php index 624af352..cff1dc64 100644 --- a/tests/X509/Integration/AcmeCert/Extension/FreshestCRLTest.php +++ b/tests/X509/Integration/AcmeCert/Extension/FreshestCRLTest.php @@ -51,7 +51,7 @@ public function distributionPoint(FreshestCRLExtension $ext) public function relativeName(DistributionPoint $dp) { $name = $dp->distributionPointName(); - static::assertEquals(DistributionPointName::TAG_RDN, $name->tag()); + static::assertSame(DistributionPointName::TAG_RDN, $name->tag()); return $name; } @@ -59,7 +59,7 @@ public function relativeName(DistributionPoint $dp) #[Depends('relativeName')] public function rDN(RelativeName $name) { - static::assertEquals('cn=Delta Distribution Point', $name->rdn()->toString()); + static::assertSame('cn=Delta Distribution Point', $name->rdn()->toString()); } /** @@ -105,6 +105,6 @@ public function issuer(DistributionPoint $dp) public function issuerDirName(GeneralNames $gn) { $dn = $gn->firstOf(GeneralName::TAG_DIRECTORY_NAME)->dn(); - static::assertEquals('cn=ACME,o=ACME Ltd.', $dn->toString()); + static::assertSame('cn=ACME,o=ACME Ltd.', $dn->toString()); } } diff --git a/tests/X509/Integration/AcmeCert/Extension/InhibitAnyPolicyTest.php b/tests/X509/Integration/AcmeCert/Extension/InhibitAnyPolicyTest.php index b10882ab..d0ca6e23 100644 --- a/tests/X509/Integration/AcmeCert/Extension/InhibitAnyPolicyTest.php +++ b/tests/X509/Integration/AcmeCert/Extension/InhibitAnyPolicyTest.php @@ -29,6 +29,6 @@ public function inhibitAnyPolicyExtension() #[Depends('inhibitAnyPolicyExtension')] public function skipCerts(InhibitAnyPolicyExtension $ext) { - static::assertEquals(2, $ext->skipCerts()); + static::assertSame(2, $ext->skipCerts()); } } diff --git a/tests/X509/Integration/AcmeCert/Extension/IssuerAlternativeNameTest.php b/tests/X509/Integration/AcmeCert/Extension/IssuerAlternativeNameTest.php index 537ceb1e..e45a890b 100644 --- a/tests/X509/Integration/AcmeCert/Extension/IssuerAlternativeNameTest.php +++ b/tests/X509/Integration/AcmeCert/Extension/IssuerAlternativeNameTest.php @@ -34,6 +34,6 @@ public function iANDirectoryName(IssuerAlternativeNameExtension $ian) ->firstOf(GeneralName::TAG_DIRECTORY_NAME) ->dn() ->toString(); - static::assertEquals('o=ACME Alternative Ltd.,c=FI,cn=ACME Wheel Intermediate', $dn); + static::assertSame('o=ACME Alternative Ltd.,c=FI,cn=ACME Wheel Intermediate', $dn); } } diff --git a/tests/X509/Integration/AcmeCert/Extension/NameConstraintsTest.php b/tests/X509/Integration/AcmeCert/Extension/NameConstraintsTest.php index 94c6dde4..9ef03171 100644 --- a/tests/X509/Integration/AcmeCert/Extension/NameConstraintsTest.php +++ b/tests/X509/Integration/AcmeCert/Extension/NameConstraintsTest.php @@ -42,6 +42,6 @@ public function nameConstraintPermittedSubtrees(NameConstraintsExtension $nc) #[Depends('nameConstraintPermittedSubtrees')] public function nameConstraintPermittedDomain(GeneralSubtrees $gs) { - static::assertEquals('.example.com', $gs->all()[0]->base()->name()); + static::assertSame('.example.com', $gs->all()[0]->base()->name()); } } diff --git a/tests/X509/Integration/AcmeCert/Extension/PolicyConstraintsTest.php b/tests/X509/Integration/AcmeCert/Extension/PolicyConstraintsTest.php index 0d051a7d..4aa68ed2 100644 --- a/tests/X509/Integration/AcmeCert/Extension/PolicyConstraintsTest.php +++ b/tests/X509/Integration/AcmeCert/Extension/PolicyConstraintsTest.php @@ -29,13 +29,13 @@ public function policyConstraintsExtension() #[Depends('policyConstraintsExtension')] public function requireExplicitPolicy(PolicyConstraintsExtension $pc) { - static::assertEquals(3, $pc->requireExplicitPolicy()); + static::assertSame(3, $pc->requireExplicitPolicy()); } #[Test] #[Depends('policyConstraintsExtension')] public function inhibitPolicyMapping(PolicyConstraintsExtension $pc) { - static::assertEquals(1, $pc->inhibitPolicyMapping()); + static::assertSame(1, $pc->inhibitPolicyMapping()); } } diff --git a/tests/X509/Integration/AcmeCert/Extension/SubjectAlternativeNameTest.php b/tests/X509/Integration/AcmeCert/Extension/SubjectAlternativeNameTest.php index 935e5ed2..b5ac69d4 100644 --- a/tests/X509/Integration/AcmeCert/Extension/SubjectAlternativeNameTest.php +++ b/tests/X509/Integration/AcmeCert/Extension/SubjectAlternativeNameTest.php @@ -33,7 +33,7 @@ public function sANEmail(SubjectAlternativeNameExtension $san) $email = $san->names() ->firstOf(GeneralName::TAG_RFC822_NAME) ->email(); - static::assertEquals('foo@example.com', $email); + static::assertSame('foo@example.com', $email); } #[Test] @@ -43,7 +43,7 @@ public function sANURI(SubjectAlternativeNameExtension $san) $uri = $san->names() ->firstOf(GeneralName::TAG_URI) ->uri(); - static::assertEquals('urn:foo:bar', $uri); + static::assertSame('urn:foo:bar', $uri); } #[Test] @@ -53,7 +53,7 @@ public function sANDNS(SubjectAlternativeNameExtension $san) $name = $san->names() ->firstOf(GeneralName::TAG_DNS_NAME) ->name(); - static::assertEquals('alt.example.com', $name); + static::assertSame('alt.example.com', $name); } #[Test] @@ -63,7 +63,7 @@ public function sANRegisteredID(SubjectAlternativeNameExtension $san) $oid = $san->names() ->firstOf(GeneralName::TAG_REGISTERED_ID) ->oid(); - static::assertEquals('1.3.6.1.4.1.45710.2.1', $oid); + static::assertSame('1.3.6.1.4.1.45710.2.1', $oid); } #[Test] @@ -84,6 +84,6 @@ public function sANDirectoryName(SubjectAlternativeNameExtension $san) ->firstOf(GeneralName::TAG_DIRECTORY_NAME) ->dn() ->toString(); - static::assertEquals('o=ACME Alternative Ltd.,c=FI,cn=alt.example.com', $dn); + static::assertSame('o=ACME Alternative Ltd.,c=FI,cn=alt.example.com', $dn); } } diff --git a/tests/X509/Integration/AcmeCert/Extension/SubjectDirectoryAttributesTest.php b/tests/X509/Integration/AcmeCert/Extension/SubjectDirectoryAttributesTest.php index dc6e1895..8b8e2fff 100644 --- a/tests/X509/Integration/AcmeCert/Extension/SubjectDirectoryAttributesTest.php +++ b/tests/X509/Integration/AcmeCert/Extension/SubjectDirectoryAttributesTest.php @@ -33,6 +33,6 @@ public function sDADescription(SubjectDirectoryAttributesExtension $sda) $desc = $sda->firstOf(AttributeType::OID_DESCRIPTION) ->first() ->stringValue(); - static::assertEquals('A Company Manufacturing Everything', $desc); + static::assertSame('A Company Manufacturing Everything', $desc); } } diff --git a/tests/X509/Integration/AcmeCert/Extension/SubjectKeyIdentifierTest.php b/tests/X509/Integration/AcmeCert/Extension/SubjectKeyIdentifierTest.php index 82fbc0f6..8599552f 100644 --- a/tests/X509/Integration/AcmeCert/Extension/SubjectKeyIdentifierTest.php +++ b/tests/X509/Integration/AcmeCert/Extension/SubjectKeyIdentifierTest.php @@ -35,6 +35,6 @@ public function subjectKeyIdentifierKey(SubjectKeyIdentifierExtension $ski) $keyid = RSAPrivateKey::fromPEM($pem)->publicKey() ->publicKeyInfo() ->keyIdentifier(); - static::assertEquals($keyid, $ski->keyIdentifier()); + static::assertSame($keyid, $ski->keyIdentifier()); } } diff --git a/tests/X509/Integration/AcmeCsr/DecodeTest.php b/tests/X509/Integration/AcmeCsr/DecodeTest.php index 9171acbe..5da15d7b 100644 --- a/tests/X509/Integration/AcmeCsr/DecodeTest.php +++ b/tests/X509/Integration/AcmeCsr/DecodeTest.php @@ -67,7 +67,7 @@ public function signatureAlgorithm(CertificationRequest $cr) #[Depends('signatureAlgorithm')] public function algoType(AlgorithmIdentifier $algo) { - static::assertEquals(AlgorithmIdentifier::OID_SHA1_WITH_RSA_ENCRYPTION, $algo->oid()); + static::assertSame(AlgorithmIdentifier::OID_SHA1_WITH_RSA_ENCRYPTION, $algo->oid()); } /** @@ -94,7 +94,7 @@ public function signatureValue(Signature $signature) #[Depends('certificationRequestInfo')] public function version(CertificationRequestInfo $cri) { - static::assertEquals(CertificationRequestInfo::VERSION_1, $cri->version()); + static::assertSame(CertificationRequestInfo::VERSION_1, $cri->version()); } /** @@ -113,7 +113,7 @@ public function subject(CertificationRequestInfo $cri) #[Depends('subject')] public function subjectDN(Name $name) { - static::assertEquals('o=ACME Ltd.,c=FI,cn=example.com', $name->toString()); + static::assertSame('o=ACME Ltd.,c=FI,cn=example.com', $name->toString()); } /** @@ -132,7 +132,7 @@ public function subjectPKInfo(CertificationRequestInfo $cri) #[Depends('subjectPKInfo')] public function publicKeyAlgo(PublicKeyInfo $info) { - static::assertEquals(AlgorithmIdentifier::OID_RSA_ENCRYPTION, $info->algorithmIdentifier()->oid()); + static::assertSame(AlgorithmIdentifier::OID_RSA_ENCRYPTION, $info->algorithmIdentifier()->oid()); } #[Test] diff --git a/tests/X509/Integration/PathValidation/PolicyIntersectionAnyPolicyTest.php b/tests/X509/Integration/PathValidation/PolicyIntersectionAnyPolicyTest.php index c92c8e49..ae279946 100644 --- a/tests/X509/Integration/PathValidation/PolicyIntersectionAnyPolicyTest.php +++ b/tests/X509/Integration/PathValidation/PolicyIntersectionAnyPolicyTest.php @@ -89,6 +89,6 @@ public function validate() $config = PathValidationConfig::create(new DateTimeImmutable(), 3); $config = $config->withPolicySet('1.3.6.1.3'); $result = $path->validate($config); - static::assertEquals('1.3.6.1.3', $result->policies()[0]->oid()); + static::assertSame('1.3.6.1.3', $result->policies()[0]->oid()); } } diff --git a/tests/X509/Integration/PathValidation/PolicyIntersectionSingleExplicitTest.php b/tests/X509/Integration/PathValidation/PolicyIntersectionSingleExplicitTest.php index 486959ed..9ec55fbb 100644 --- a/tests/X509/Integration/PathValidation/PolicyIntersectionSingleExplicitTest.php +++ b/tests/X509/Integration/PathValidation/PolicyIntersectionSingleExplicitTest.php @@ -113,6 +113,6 @@ public function validate() $config = PathValidationConfig::create(new DateTimeImmutable(), 3); $config = $config->withPolicySet('1.3.6.1.3'); $result = $path->validate($config); - static::assertEquals('1.3.6.1.3', $result->policies()[0]->oid()); + static::assertSame('1.3.6.1.3', $result->policies()[0]->oid()); } } diff --git a/tests/X509/Integration/PathValidation/PolicyIntersectionTest.php b/tests/X509/Integration/PathValidation/PolicyIntersectionTest.php index bb90f1b4..8c043b78 100644 --- a/tests/X509/Integration/PathValidation/PolicyIntersectionTest.php +++ b/tests/X509/Integration/PathValidation/PolicyIntersectionTest.php @@ -116,6 +116,6 @@ public function validate() $config = PathValidationConfig::create(new DateTimeImmutable(), 3); $config = $config->withPolicySet('1.3.6.1.3'); $result = $path->validate($config); - static::assertEquals('Test', $result->policies()[0]->userNoticeQualifier()->explicitText()->string()); + static::assertSame('Test', $result->policies()[0]->userNoticeQualifier()->explicitText()->string()); } } diff --git a/tests/X509/Integration/PathValidation/PolicyMappingMapAnyTest.php b/tests/X509/Integration/PathValidation/PolicyMappingMapAnyTest.php index 4b6cf6dc..e0e7c7ca 100644 --- a/tests/X509/Integration/PathValidation/PolicyMappingMapAnyTest.php +++ b/tests/X509/Integration/PathValidation/PolicyMappingMapAnyTest.php @@ -94,7 +94,7 @@ public function validate() $config = PathValidationConfig::create(new DateTimeImmutable(), 3); $config = $config->withExplicitPolicy(true); $result = $path->validate($config); - static::assertEquals('1.3.6.1.3.2', $result->policies()[0]->oid()); + static::assertSame('1.3.6.1.3.2', $result->policies()[0]->oid()); } #[Test] diff --git a/tests/X509/Unit/Ac/AttCertValidityPeriodTest.php b/tests/X509/Unit/Ac/AttCertValidityPeriodTest.php index b04a059b..38c84dfa 100644 --- a/tests/X509/Unit/Ac/AttCertValidityPeriodTest.php +++ b/tests/X509/Unit/Ac/AttCertValidityPeriodTest.php @@ -65,8 +65,8 @@ public function decode($data): AttCertValidityPeriod #[Depends('decode')] public function recoded(AttCertValidityPeriod $ref, AttCertValidityPeriod $new) { - static::assertEquals($ref->notBeforeTime()->getTimestamp(), $new->notBeforeTime()->getTimestamp()); - static::assertEquals($ref->notAfterTime()->getTimestamp(), $new->notAfterTime()->getTimestamp()); + static::assertSame($ref->notBeforeTime()->getTimestamp(), $new->notBeforeTime()->getTimestamp()); + static::assertSame($ref->notAfterTime()->getTimestamp(), $new->notAfterTime()->getTimestamp()); } #[Test] diff --git a/tests/X509/Unit/Ac/Attribute/AccessIdentityTest.php b/tests/X509/Unit/Ac/Attribute/AccessIdentityTest.php index b285de15..ef27f0ea 100644 --- a/tests/X509/Unit/Ac/Attribute/AccessIdentityTest.php +++ b/tests/X509/Unit/Ac/Attribute/AccessIdentityTest.php @@ -66,21 +66,21 @@ public function recoded(AttributeValue $ref, AttributeValue $new) #[Depends('create')] public function oID(AttributeValue $value) { - static::assertEquals(AccessIdentityAttributeValue::OID, $value->oid()); + static::assertSame(AccessIdentityAttributeValue::OID, $value->oid()); } #[Test] #[Depends('create')] public function service(AccessIdentityAttributeValue $value) { - static::assertEquals(self::SERVICE_URI, $value->service()); + static::assertSame(self::SERVICE_URI, $value->service()->string()); } #[Test] #[Depends('create')] public function ident(AccessIdentityAttributeValue $value) { - static::assertEquals(self::IDENT_URI, $value->ident()); + static::assertSame(self::IDENT_URI, $value->ident()->string()); } #[Test] diff --git a/tests/X509/Unit/Ac/Attribute/AuthenticationInfoTest.php b/tests/X509/Unit/Ac/Attribute/AuthenticationInfoTest.php index 1bc7b041..67933299 100644 --- a/tests/X509/Unit/Ac/Attribute/AuthenticationInfoTest.php +++ b/tests/X509/Unit/Ac/Attribute/AuthenticationInfoTest.php @@ -69,28 +69,28 @@ public function recoded(AttributeValue $ref, AttributeValue $new) #[Depends('create')] public function oID(AttributeValue $value) { - static::assertEquals(AuthenticationInfoAttributeValue::OID, $value->oid()); + static::assertSame(AuthenticationInfoAttributeValue::OID, $value->oid()); } #[Test] #[Depends('create')] public function service(AuthenticationInfoAttributeValue $value) { - static::assertEquals(self::SERVICE_URI, $value->service()); + static::assertSame(self::SERVICE_URI, $value->service()->string()); } #[Test] #[Depends('create')] public function ident(AuthenticationInfoAttributeValue $value) { - static::assertEquals(self::IDENT_URI, $value->ident()); + static::assertSame(self::IDENT_URI, $value->ident()->string()); } #[Test] #[Depends('create')] public function authInfo(AuthenticationInfoAttributeValue $value) { - static::assertEquals(self::AUTH_INFO, $value->authInfo()); + static::assertSame(self::AUTH_INFO, $value->authInfo()); } #[Test] diff --git a/tests/X509/Unit/Ac/Attribute/ChargingIdentityTest.php b/tests/X509/Unit/Ac/Attribute/ChargingIdentityTest.php index da6cbca9..d91b22af 100644 --- a/tests/X509/Unit/Ac/Attribute/ChargingIdentityTest.php +++ b/tests/X509/Unit/Ac/Attribute/ChargingIdentityTest.php @@ -74,14 +74,14 @@ public function recoded(AttributeValue $ref, AttributeValue $new) #[Depends('create')] public function oID(AttributeValue $value) { - static::assertEquals(ChargingIdentityAttributeValue::OID, $value->oid()); + static::assertSame(ChargingIdentityAttributeValue::OID, $value->oid()); } #[Test] #[Depends('create')] public function authority(ChargingIdentityAttributeValue $value) { - static::assertEquals(self::AUTHORITY_DN, $value->policyAuthority()->firstDN()); + static::assertSame(self::AUTHORITY_DN, $value->policyAuthority()->firstDN()->toString()); } #[Test] @@ -107,21 +107,21 @@ public function iterator(ChargingIdentityAttributeValue $value) #[Depends('create')] public function octetStringValue(ChargingIdentityAttributeValue $value) { - static::assertEquals(self::OCTETS_VAL, $value->values()[0]); + static::assertSame(self::OCTETS_VAL, (string) ($value->values()[0])); } #[Test] #[Depends('create')] public function oIDValue(ChargingIdentityAttributeValue $value) { - static::assertEquals(self::OID_VAL, $value->values()[1]); + static::assertSame(self::OID_VAL, (string) ($value->values()[1])); } #[Test] #[Depends('create')] public function uTF8Value(ChargingIdentityAttributeValue $value) { - static::assertEquals(self::UTF8_VAL, $value->values()[2]); + static::assertSame(self::UTF8_VAL, (string) ($value->values()[2])); } #[Test] diff --git a/tests/X509/Unit/Ac/Attribute/GroupTest.php b/tests/X509/Unit/Ac/Attribute/GroupTest.php index 06274438..34fe48f2 100644 --- a/tests/X509/Unit/Ac/Attribute/GroupTest.php +++ b/tests/X509/Unit/Ac/Attribute/GroupTest.php @@ -66,14 +66,14 @@ public function recoded(AttributeValue $ref, AttributeValue $new) #[Depends('create')] public function oID(AttributeValue $value) { - static::assertEquals(GroupAttributeValue::OID, $value->oid()); + static::assertSame(GroupAttributeValue::OID, $value->oid()); } #[Test] #[Depends('create')] public function authority(GroupAttributeValue $value) { - static::assertEquals(self::AUTHORITY_DN, $value->policyAuthority()->firstDN()); + static::assertSame(self::AUTHORITY_DN, $value->policyAuthority()->firstDN()->toString()); } #[Test] @@ -87,7 +87,7 @@ public function countMethod(GroupAttributeValue $value) #[Depends('create')] public function groupName(GroupAttributeValue $value) { - static::assertEquals(self::GROUP_NAME, $value->first()); + static::assertSame(self::GROUP_NAME, (string) $value->first()); } #[Test] diff --git a/tests/X509/Unit/Ac/Attribute/IetfAttrValueTest.php b/tests/X509/Unit/Ac/Attribute/IetfAttrValueTest.php index 830eeff5..9a08d8ca 100644 --- a/tests/X509/Unit/Ac/Attribute/IetfAttrValueTest.php +++ b/tests/X509/Unit/Ac/Attribute/IetfAttrValueTest.php @@ -46,7 +46,7 @@ public function createOctetString() #[Depends('createOctetString')] public function octetStringType(IetfAttrValue $val) { - static::assertEquals(Element::TYPE_OCTET_STRING, $val->type()); + static::assertSame(Element::TYPE_OCTET_STRING, $val->type()); } #[Test] @@ -60,7 +60,7 @@ public function isOctetString(IetfAttrValue $val) #[Depends('createOctetString')] public function value(IetfAttrValue $val) { - static::assertEquals('test', $val->value()); + static::assertSame('test', $val->value()); } #[Test] @@ -75,7 +75,7 @@ public function createUTF8String() #[Depends('createUTF8String')] public function uTF8StringType(IetfAttrValue $val) { - static::assertEquals(Element::TYPE_UTF8_STRING, $val->type()); + static::assertSame(Element::TYPE_UTF8_STRING, $val->type()); } #[Test] @@ -97,7 +97,7 @@ public function createOID() #[Depends('createOID')] public function oIDType(IetfAttrValue $val) { - static::assertEquals(Element::TYPE_OBJECT_IDENTIFIER, $val->type()); + static::assertSame(Element::TYPE_OBJECT_IDENTIFIER, $val->type()); } #[Test] diff --git a/tests/X509/Unit/Ac/Attribute/RoleTest.php b/tests/X509/Unit/Ac/Attribute/RoleTest.php index 1c26982a..47cd152f 100644 --- a/tests/X509/Unit/Ac/Attribute/RoleTest.php +++ b/tests/X509/Unit/Ac/Attribute/RoleTest.php @@ -72,7 +72,7 @@ public function recoded(AttributeValue $ref, AttributeValue $new) #[Depends('create')] public function oID(AttributeValue $value) { - static::assertEquals(AttributeType::OID_ROLE, $value->oid()); + static::assertSame(AttributeType::OID_ROLE, $value->oid()); } #[Test] @@ -89,14 +89,14 @@ public function fromString() #[Depends('create')] public function roleName(RoleAttributeValue $value) { - static::assertEquals(self::ROLE_URI, $value->roleName()); + static::assertSame(self::ROLE_URI, $value->roleName()->string()); } #[Test] #[Depends('create')] public function roleAuthority(RoleAttributeValue $value) { - static::assertEquals(self::AUTHORITY_DN, $value->roleAuthority()->firstDN()); + static::assertSame(self::AUTHORITY_DN, $value->roleAuthority()->firstDN()->toString()); } #[Test] diff --git a/tests/X509/Unit/Ac/AttributeCertificateInfoTest.php b/tests/X509/Unit/Ac/AttributeCertificateInfoTest.php index 2787b549..830d4cfa 100644 --- a/tests/X509/Unit/Ac/AttributeCertificateInfoTest.php +++ b/tests/X509/Unit/Ac/AttributeCertificateInfoTest.php @@ -6,7 +6,6 @@ use Brick\Math\BigInteger; use LogicException; -use function mb_strlen; use PHPUnit\Framework\Attributes\Depends; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; @@ -34,6 +33,7 @@ use SpomkyLabs\Pki\X509\GeneralName\GeneralNames; use SpomkyLabs\Pki\X509\GeneralName\UniformResourceIdentifier; use UnexpectedValueException; +use function mb_strlen; /** * @internal @@ -131,7 +131,7 @@ public function recoded(AttributeCertificateInfo $ref, AttributeCertificateInfo #[Depends('createWithAll')] public function version(AttributeCertificateInfo $aci) { - static::assertEquals(AttributeCertificateInfo::VERSION_2, $aci->version()); + static::assertSame(AttributeCertificateInfo::VERSION_2, $aci->version()); } #[Test] @@ -159,7 +159,7 @@ public function signature(AttributeCertificateInfo $aci) #[Depends('createWithAll')] public function serialNumber(AttributeCertificateInfo $aci) { - static::assertEquals(1, $aci->serialNumber()); + static::assertSame('1', $aci->serialNumber()); } #[Test] @@ -180,7 +180,7 @@ public function attributes(AttributeCertificateInfo $aci) #[Depends('createWithAll')] public function issuerUniqueID(AttributeCertificateInfo $aci) { - static::assertEquals('uid', $aci->issuerUniqueID()->string()); + static::assertSame('uid', $aci->issuerUniqueID()->string()); } #[Test] @@ -228,7 +228,7 @@ public function withRandomSerial(AttributeCertificateInfo $aci) { $aci = $aci->withRandomSerialNumber(16); $bin = BigInteger::of($aci->serialNumber())->toBytes(); - static::assertEquals(16, mb_strlen($bin, '8bit')); + static::assertSame(16, mb_strlen($bin, '8bit')); } #[Test] diff --git a/tests/X509/Unit/Ac/AttributeCertificateTest.php b/tests/X509/Unit/Ac/AttributeCertificateTest.php index e558f1fd..51f19bcd 100644 --- a/tests/X509/Unit/Ac/AttributeCertificateTest.php +++ b/tests/X509/Unit/Ac/AttributeCertificateTest.php @@ -29,8 +29,8 @@ use SpomkyLabs\Pki\X509\GeneralName\DirectoryName; use SpomkyLabs\Pki\X509\GeneralName\GeneralNames; use SpomkyLabs\Pki\X509\GeneralName\UniformResourceIdentifier; -use function strval; use UnexpectedValueException; +use function strval; /** * @internal diff --git a/tests/X509/Unit/Ac/AttributesTest.php b/tests/X509/Unit/Ac/AttributesTest.php index cbcb0e81..a19433d2 100644 --- a/tests/X509/Unit/Ac/AttributesTest.php +++ b/tests/X509/Unit/Ac/AttributesTest.php @@ -126,7 +126,7 @@ public function withUniqueReplace(Attributes $attribs): void ); static::assertInstanceOf(Attributes::class, $attribs); static::assertCount(3, $attribs); - static::assertEquals('uri:new', $attribs->firstOf(AttributeType::OID_ROLE)->first()->roleName()); + static::assertSame('uri:new', (string) $attribs->firstOf(AttributeType::OID_ROLE)->first()->roleName()); } #[Test] diff --git a/tests/X509/Unit/Ac/IssuerSerialTest.php b/tests/X509/Unit/Ac/IssuerSerialTest.php index fe47532f..3d1f6863 100644 --- a/tests/X509/Unit/Ac/IssuerSerialTest.php +++ b/tests/X509/Unit/Ac/IssuerSerialTest.php @@ -84,7 +84,7 @@ public function issuer(IssuerSerial $is) #[Depends('create')] public function serial(IssuerSerial $is) { - static::assertEquals(1, $is->serial()); + static::assertSame('1', $is->serial()); } #[Test] diff --git a/tests/X509/Unit/Ac/V2FormTest.php b/tests/X509/Unit/Ac/V2FormTest.php index f9fdcc3b..edfafade 100644 --- a/tests/X509/Unit/Ac/V2FormTest.php +++ b/tests/X509/Unit/Ac/V2FormTest.php @@ -93,7 +93,7 @@ public function noIssuerNameFail() #[Depends('create')] public function verifyName(V2Form $issuer = null) { - static::assertEquals('cn=Test', $issuer->name()); + static::assertSame('cn=Test', $issuer->name()->toString()); } #[Test] diff --git a/tests/X509/Unit/Certificate/CertificateChainTest.php b/tests/X509/Unit/Certificate/CertificateChainTest.php index 9d09dd19..97547497 100644 --- a/tests/X509/Unit/Certificate/CertificateChainTest.php +++ b/tests/X509/Unit/Certificate/CertificateChainTest.php @@ -129,7 +129,7 @@ public function toPEMString(CertificateChain $chain) { $expected = sprintf("%s\n%s\n%s", self::$_pems[0], self::$_pems[1], self::$_pems[2]); $str = $chain->toPEMString(); - static::assertEquals($expected, $str); + static::assertSame($expected, $str); return $str; } diff --git a/tests/X509/Unit/Certificate/CertificateTest.php b/tests/X509/Unit/Certificate/CertificateTest.php index 278dd618..a1ecfb73 100644 --- a/tests/X509/Unit/Certificate/CertificateTest.php +++ b/tests/X509/Unit/Certificate/CertificateTest.php @@ -20,8 +20,8 @@ use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\TBSCertificate; use SpomkyLabs\Pki\X509\Certificate\Validity; -use function strval; use UnexpectedValueException; +use function strval; /** * @internal @@ -122,7 +122,7 @@ public function toPEM(Certificate $cert) #[Depends('toPEM')] public function pEMType(PEM $pem) { - static::assertEquals(PEM::TYPE_CERTIFICATE, $pem->type()); + static::assertSame(PEM::TYPE_CERTIFICATE, $pem->type()); } #[Test] diff --git a/tests/X509/Unit/Certificate/CertificateVersionTest.php b/tests/X509/Unit/Certificate/CertificateVersionTest.php index 71c6d052..88c34861 100644 --- a/tests/X509/Unit/Certificate/CertificateVersionTest.php +++ b/tests/X509/Unit/Certificate/CertificateVersionTest.php @@ -46,7 +46,7 @@ public static function tearDownAfterClass(): void public function version1() { $cert = self::$_tbsCert->sign(SHA1WithRSAEncryptionAlgorithmIdentifier::create(), self::$_privateKeyInfo); - static::assertEquals($cert->tbsCertificate()->version(), TBSCertificate::VERSION_1); + static::assertSame($cert->tbsCertificate()->version(), TBSCertificate::VERSION_1); } #[Test] @@ -54,7 +54,7 @@ public function version2SubjectUID() { $tbsCert = self::$_tbsCert->withSubjectUniqueID(UniqueIdentifier::fromString('subject')); $cert = $tbsCert->sign(SHA1WithRSAEncryptionAlgorithmIdentifier::create(), self::$_privateKeyInfo); - static::assertEquals($cert->tbsCertificate()->version(), TBSCertificate::VERSION_2); + static::assertSame($cert->tbsCertificate()->version(), TBSCertificate::VERSION_2); } #[Test] @@ -62,7 +62,7 @@ public function version2IssuerUID() { $tbsCert = self::$_tbsCert->withIssuerUniqueID(UniqueIdentifier::fromString('issuer')); $cert = $tbsCert->sign(SHA1WithRSAEncryptionAlgorithmIdentifier::create(), self::$_privateKeyInfo); - static::assertEquals($cert->tbsCertificate()->version(), TBSCertificate::VERSION_2); + static::assertSame($cert->tbsCertificate()->version(), TBSCertificate::VERSION_2); } #[Test] @@ -72,7 +72,7 @@ public function version2BothUID() UniqueIdentifier::fromString('subject') )->withIssuerUniqueID(UniqueIdentifier::fromString('issuer')); $cert = $tbsCert->sign(SHA1WithRSAEncryptionAlgorithmIdentifier::create(), self::$_privateKeyInfo); - static::assertEquals($cert->tbsCertificate()->version(), TBSCertificate::VERSION_2); + static::assertSame($cert->tbsCertificate()->version(), TBSCertificate::VERSION_2); } #[Test] @@ -82,6 +82,6 @@ public function version3() Extensions::create(KeyUsageExtension::create(true, KeyUsageExtension::DIGITAL_SIGNATURE)) ); $cert = $tbsCert->sign(SHA1WithRSAEncryptionAlgorithmIdentifier::create(), self::$_privateKeyInfo); - static::assertEquals($cert->tbsCertificate()->version(), TBSCertificate::VERSION_3); + static::assertSame($cert->tbsCertificate()->version(), TBSCertificate::VERSION_3); } } diff --git a/tests/X509/Unit/Certificate/Extension/AAControlsTest.php b/tests/X509/Unit/Certificate/Extension/AAControlsTest.php index 41307ebf..c80a6535 100644 --- a/tests/X509/Unit/Certificate/Extension/AAControlsTest.php +++ b/tests/X509/Unit/Certificate/Extension/AAControlsTest.php @@ -29,7 +29,7 @@ public function create() #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_AA_CONTROLS, $ext->oid()); + static::assertSame(Extension::OID_AA_CONTROLS, $ext->oid()); } #[Test] @@ -72,21 +72,21 @@ public function recoded(Extension $ref, Extension $new) #[Depends('create')] public function pathLen(AAControlsExtension $ext) { - static::assertEquals(3, $ext->pathLen()); + static::assertSame(3, $ext->pathLen()); } #[Test] #[Depends('decode')] public function permitted(AAControlsExtension $ext) { - static::assertEquals(['1.2.3.4'], $ext->permittedAttrs()); + static::assertSame(['1.2.3.4'], $ext->permittedAttrs()); } #[Test] #[Depends('decode')] public function excluded(AAControlsExtension $ext) { - static::assertEquals(['1.2.3.5', '1.2.3.6'], $ext->excludedAttrs()); + static::assertSame(['1.2.3.5', '1.2.3.6'], $ext->excludedAttrs()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/AccessDescription/AuthorityAccessDescriptionTest.php b/tests/X509/Unit/Certificate/Extension/AccessDescription/AuthorityAccessDescriptionTest.php index 64b0bf17..00d2084a 100644 --- a/tests/X509/Unit/Certificate/Extension/AccessDescription/AuthorityAccessDescriptionTest.php +++ b/tests/X509/Unit/Certificate/Extension/AccessDescription/AuthorityAccessDescriptionTest.php @@ -76,13 +76,13 @@ public function isNotCAIssuers(AuthorityAccessDescription $desc) #[Depends('create')] public function accessMethod(AuthorityAccessDescription $desc) { - static::assertEquals(AuthorityAccessDescription::OID_METHOD_OSCP, $desc->accessMethod()); + static::assertSame(AuthorityAccessDescription::OID_METHOD_OSCP, $desc->accessMethod()); } #[Test] #[Depends('create')] public function location(AuthorityAccessDescription $desc) { - static::assertEquals(self::URI, $desc->accessLocation()->string()); + static::assertSame(self::URI, $desc->accessLocation()->string()); } } diff --git a/tests/X509/Unit/Certificate/Extension/AccessDescription/SubjectAccessDescriptionTest.php b/tests/X509/Unit/Certificate/Extension/AccessDescription/SubjectAccessDescriptionTest.php index 6a5ef347..1e870f88 100644 --- a/tests/X509/Unit/Certificate/Extension/AccessDescription/SubjectAccessDescriptionTest.php +++ b/tests/X509/Unit/Certificate/Extension/AccessDescription/SubjectAccessDescriptionTest.php @@ -76,13 +76,13 @@ public function isNotTimeStamping(SubjectAccessDescription $desc) #[Depends('create')] public function accessMethod(SubjectAccessDescription $desc) { - static::assertEquals(SubjectAccessDescription::OID_METHOD_CA_REPOSITORY, $desc->accessMethod()); + static::assertSame(SubjectAccessDescription::OID_METHOD_CA_REPOSITORY, $desc->accessMethod()); } #[Test] #[Depends('create')] public function location(SubjectAccessDescription $desc) { - static::assertEquals(self::URI, $desc->accessLocation()->string()); + static::assertSame(self::URI, $desc->accessLocation()->string()); } } diff --git a/tests/X509/Unit/Certificate/Extension/AuthorityInformationAccessTest.php b/tests/X509/Unit/Certificate/Extension/AuthorityInformationAccessTest.php index 501bfc30..d6b178c0 100644 --- a/tests/X509/Unit/Certificate/Extension/AuthorityInformationAccessTest.php +++ b/tests/X509/Unit/Certificate/Extension/AuthorityInformationAccessTest.php @@ -40,7 +40,7 @@ public function create() #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_AUTHORITY_INFORMATION_ACCESS, $ext->oid()); + static::assertSame(Extension::OID_AUTHORITY_INFORMATION_ACCESS, $ext->oid()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/AuthorityKeyIdentifierTest.php b/tests/X509/Unit/Certificate/Extension/AuthorityKeyIdentifierTest.php index fc1123a4..cedecdd3 100644 --- a/tests/X509/Unit/Certificate/Extension/AuthorityKeyIdentifierTest.php +++ b/tests/X509/Unit/Certificate/Extension/AuthorityKeyIdentifierTest.php @@ -64,7 +64,7 @@ public function fromPKI(): void #[Depends('create')] public function oID(Extension $ext): void { - static::assertEquals(Extension::OID_AUTHORITY_KEY_IDENTIFIER, $ext->oid()); + static::assertSame(Extension::OID_AUTHORITY_KEY_IDENTIFIER, $ext->oid()); } #[Test] @@ -107,7 +107,7 @@ public function recoded(Extension $ref, Extension $new): void #[Depends('create')] public function keyIdentifier(AuthorityKeyIdentifierExtension $ext): void { - static::assertEquals(self::KEY_ID, $ext->keyIdentifier()); + static::assertSame(self::KEY_ID, $ext->keyIdentifier()); } #[Test] @@ -121,7 +121,7 @@ public function issuer(AuthorityKeyIdentifierExtension $ext): void #[Depends('create')] public function serial(AuthorityKeyIdentifierExtension $ext): void { - static::assertEquals(self::SERIAL, $ext->serial()); + static::assertSame(self::SERIAL, $ext->serial()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/BasicConstraintsTest.php b/tests/X509/Unit/Certificate/Extension/BasicConstraintsTest.php index ecdc580c..fd0b54b8 100644 --- a/tests/X509/Unit/Certificate/Extension/BasicConstraintsTest.php +++ b/tests/X509/Unit/Certificate/Extension/BasicConstraintsTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_BASIC_CONSTRAINTS, $ext->oid()); + static::assertSame(Extension::OID_BASIC_CONSTRAINTS, $ext->oid()); } #[Test] @@ -80,7 +80,7 @@ public function cA(BasicConstraintsExtension $ext) #[Depends('create')] public function pathLen(BasicConstraintsExtension $ext) { - static::assertEquals(3, $ext->pathLen()); + static::assertSame(3, $ext->pathLen()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/CRLDistributionPointTest.php b/tests/X509/Unit/Certificate/Extension/CRLDistributionPointTest.php index 4214e69d..cd12c089 100644 --- a/tests/X509/Unit/Certificate/Extension/CRLDistributionPointTest.php +++ b/tests/X509/Unit/Certificate/Extension/CRLDistributionPointTest.php @@ -55,7 +55,7 @@ public function create(DistributionPoint $dp) #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_CRL_DISTRIBUTION_POINTS, $ext->oid()); + static::assertSame(Extension::OID_CRL_DISTRIBUTION_POINTS, $ext->oid()); } #[Test] @@ -129,7 +129,7 @@ public function dPName(DistributionPoint $dp) $uri = $dp->fullName() ->names() ->firstURI(); - static::assertEquals(self::DP_URI, $uri); + static::assertSame(self::DP_URI, $uri); } #[Test] @@ -143,7 +143,7 @@ public function dPReasons(DistributionPoint $dp) #[Depends('distributionPoint')] public function dPIssuer(DistributionPoint $dp) { - static::assertEquals(self::ISSUER_DN, $dp->crlIssuer()->firstDN()); + static::assertSame(self::ISSUER_DN, $dp->crlIssuer()->firstDN()->toString()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/CertPolicy/CPSQualifierTest.php b/tests/X509/Unit/Certificate/Extension/CertPolicy/CPSQualifierTest.php index a79e8686..6d710c82 100644 --- a/tests/X509/Unit/Certificate/Extension/CertPolicy/CPSQualifierTest.php +++ b/tests/X509/Unit/Certificate/Extension/CertPolicy/CPSQualifierTest.php @@ -58,13 +58,13 @@ public function recoded(CPSQualifier $ref, CPSQualifier $new) #[Depends('create')] public function uRI(CPSQualifier $qual) { - static::assertEquals(self::URI, $qual->uri()); + static::assertSame(self::URI, $qual->uri()); } #[Test] #[Depends('create')] public function oID(CPSQualifier $qual) { - static::assertEquals(CPSQualifier::OID_CPS, $qual->oid()); + static::assertSame(CPSQualifier::OID_CPS, $qual->oid()); } } diff --git a/tests/X509/Unit/Certificate/Extension/CertPolicy/DisplayTextTest.php b/tests/X509/Unit/Certificate/Extension/CertPolicy/DisplayTextTest.php index 5351fc13..47686f97 100644 --- a/tests/X509/Unit/Certificate/Extension/CertPolicy/DisplayTextTest.php +++ b/tests/X509/Unit/Certificate/Extension/CertPolicy/DisplayTextTest.php @@ -15,8 +15,8 @@ use SpomkyLabs\Pki\ASN1\Type\Primitive\VisibleString; use SpomkyLabs\Pki\ASN1\Type\StringType; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\DisplayText; -use function strval; use UnexpectedValueException; +use function strval; /** * @internal @@ -64,7 +64,7 @@ public function recoded(DisplayText $ref, DisplayText $new) #[Depends('create')] public function string(DisplayText $dt) { - static::assertEquals('test', $dt->string()); + static::assertSame('test', $dt->string()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/CertPolicy/NoticeReferenceTest.php b/tests/X509/Unit/Certificate/Extension/CertPolicy/NoticeReferenceTest.php index 9550f31b..ce756b2d 100644 --- a/tests/X509/Unit/Certificate/Extension/CertPolicy/NoticeReferenceTest.php +++ b/tests/X509/Unit/Certificate/Extension/CertPolicy/NoticeReferenceTest.php @@ -57,13 +57,13 @@ public function recoded(NoticeReference $ref, NoticeReference $new) #[Depends('create')] public function organization(NoticeReference $ref) { - static::assertEquals('org', $ref->organization()->string()); + static::assertSame('org', $ref->organization()->string()); } #[Test] #[Depends('create')] public function numbers(NoticeReference $ref) { - static::assertEquals([1, 2, 3], $ref->numbers()); + static::assertSame([1, 2, 3], $ref->numbers()); } } diff --git a/tests/X509/Unit/Certificate/Extension/CertPolicy/PolicyInformationTest.php b/tests/X509/Unit/Certificate/Extension/CertPolicy/PolicyInformationTest.php index 3dd7bd0d..c791762c 100644 --- a/tests/X509/Unit/Certificate/Extension/CertPolicy/PolicyInformationTest.php +++ b/tests/X509/Unit/Certificate/Extension/CertPolicy/PolicyInformationTest.php @@ -63,7 +63,7 @@ public function recodedWithCPS(PolicyInformation $ref, PolicyInformation $new) #[Depends('createWithCPS')] public function oID(PolicyInformation $pi) { - static::assertEquals(self::OID, $pi->oid()); + static::assertSame(self::OID, $pi->oid()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/CertificatePoliciesTest.php b/tests/X509/Unit/Certificate/Extension/CertificatePoliciesTest.php index a396d29e..fb1d4eea 100644 --- a/tests/X509/Unit/Certificate/Extension/CertificatePoliciesTest.php +++ b/tests/X509/Unit/Certificate/Extension/CertificatePoliciesTest.php @@ -77,7 +77,7 @@ public function create(PolicyInformation $info) #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_CERTIFICATE_POLICIES, $ext->oid()); + static::assertSame(Extension::OID_CERTIFICATE_POLICIES, $ext->oid()); } #[Test] @@ -199,7 +199,7 @@ public function cPS(PolicyInformation $info) #[Depends('cPS')] public function cPSURI(CPSQualifier $cps) { - static::assertEquals(self::CPS_URI, $cps->uri()); + static::assertSame(self::CPS_URI, $cps->uri()); } #[Test] @@ -215,7 +215,7 @@ public function userNotice(PolicyInformation $info) #[Depends('userNotice')] public function userNoticeExplicit(UserNoticeQualifier $notice) { - static::assertEquals(self::NOTICE_TXT, $notice->explicitText()); + static::assertSame(self::NOTICE_TXT, $notice->explicitText()->string()); } #[Test] @@ -231,14 +231,14 @@ public function userNoticeRef(UserNoticeQualifier $notice) #[Depends('userNoticeRef')] public function refOrg(NoticeReference $ref) { - static::assertEquals(self::REF_ORG, $ref->organization()); + static::assertSame(self::REF_ORG, $ref->organization()->string()); } #[Test] #[Depends('userNoticeRef')] public function refNumbers(NoticeReference $ref) { - static::assertEquals([1, 2, 3], $ref->numbers()); + static::assertSame([1, 2, 3], $ref->numbers()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/ExtendedKeyUsageTest.php b/tests/X509/Unit/Certificate/Extension/ExtendedKeyUsageTest.php index a0cb6e20..adc97d22 100644 --- a/tests/X509/Unit/Certificate/Extension/ExtendedKeyUsageTest.php +++ b/tests/X509/Unit/Certificate/Extension/ExtendedKeyUsageTest.php @@ -33,7 +33,7 @@ public function create() #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_EXT_KEY_USAGE, $ext->oid()); + static::assertSame(Extension::OID_EXT_KEY_USAGE, $ext->oid()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/ExtensionTest.php b/tests/X509/Unit/Certificate/Extension/ExtensionTest.php index 6c3bb0a8..bb4e3c36 100644 --- a/tests/X509/Unit/Certificate/Extension/ExtensionTest.php +++ b/tests/X509/Unit/Certificate/Extension/ExtensionTest.php @@ -19,20 +19,20 @@ final class ExtensionTest extends TestCase public function extensionName() { $ext = BasicConstraintsExtension::create(true, true); - static::assertEquals('basicConstraints', $ext->extensionName()); + static::assertSame('basicConstraints', $ext->extensionName()); } #[Test] public function unknownExtensionName() { $ext = UnknownExtension::create('1.3.6.1.3', false, NullType::create()); - static::assertEquals('1.3.6.1.3', $ext->extensionName()); + static::assertSame('1.3.6.1.3', $ext->extensionName()); } #[Test] public function toStringMethod() { $ext = BasicConstraintsExtension::create(true, true); - static::assertEquals('basicConstraints', $ext); + static::assertSame('basicConstraints', (string) $ext); } } diff --git a/tests/X509/Unit/Certificate/Extension/FreshestCRLTest.php b/tests/X509/Unit/Certificate/Extension/FreshestCRLTest.php index 05e6f02f..fe651d3f 100644 --- a/tests/X509/Unit/Certificate/Extension/FreshestCRLTest.php +++ b/tests/X509/Unit/Certificate/Extension/FreshestCRLTest.php @@ -49,7 +49,7 @@ public function create() #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_FRESHEST_CRL, $ext->oid()); + static::assertSame(Extension::OID_FRESHEST_CRL, $ext->oid()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/InhibitAnyPolicyTest.php b/tests/X509/Unit/Certificate/Extension/InhibitAnyPolicyTest.php index 1e6bb190..c4c9287c 100644 --- a/tests/X509/Unit/Certificate/Extension/InhibitAnyPolicyTest.php +++ b/tests/X509/Unit/Certificate/Extension/InhibitAnyPolicyTest.php @@ -29,7 +29,7 @@ public function create() #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_INHIBIT_ANY_POLICY, $ext->oid()); + static::assertSame(Extension::OID_INHIBIT_ANY_POLICY, $ext->oid()); } #[Test] @@ -72,7 +72,7 @@ public function recoded(Extension $ref, Extension $new) #[Depends('create')] public function skipCerts(InhibitAnyPolicyExtension $ext) { - static::assertEquals(3, $ext->skipCerts()); + static::assertSame(3, $ext->skipCerts()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/IssuerAlternativeNameTest.php b/tests/X509/Unit/Certificate/Extension/IssuerAlternativeNameTest.php index 45e99392..7cd70fb1 100644 --- a/tests/X509/Unit/Certificate/Extension/IssuerAlternativeNameTest.php +++ b/tests/X509/Unit/Certificate/Extension/IssuerAlternativeNameTest.php @@ -36,7 +36,7 @@ public function create() #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_ISSUER_ALT_NAME, $ext->oid()); + static::assertSame(Extension::OID_ISSUER_ALT_NAME, $ext->oid()); } #[Test] @@ -79,7 +79,7 @@ public function recoded(Extension $ref, Extension $new) #[Depends('create')] public function verifyName(IssuerAlternativeNameExtension $ext = null) { - static::assertEquals(self::DN, $ext->names()->firstDN()); + static::assertSame(self::DN, $ext->names()->firstDN()->toString()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/KeyUsageTest.php b/tests/X509/Unit/Certificate/Extension/KeyUsageTest.php index c7367c53..5f6d6393 100644 --- a/tests/X509/Unit/Certificate/Extension/KeyUsageTest.php +++ b/tests/X509/Unit/Certificate/Extension/KeyUsageTest.php @@ -33,7 +33,7 @@ public function create() #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_KEY_USAGE, $ext->oid()); + static::assertSame(Extension::OID_KEY_USAGE, $ext->oid()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/NameConstraintsTest.php b/tests/X509/Unit/Certificate/Extension/NameConstraintsTest.php index 1c131b42..6f47a995 100644 --- a/tests/X509/Unit/Certificate/Extension/NameConstraintsTest.php +++ b/tests/X509/Unit/Certificate/Extension/NameConstraintsTest.php @@ -63,7 +63,7 @@ public function create(GeneralSubtrees $permitted, GeneralSubtrees $excluded) #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_NAME_CONSTRAINTS, $ext->oid()); + static::assertSame(Extension::OID_NAME_CONSTRAINTS, $ext->oid()); } #[Test] @@ -143,21 +143,21 @@ public function iterator(GeneralSubtrees $subtrees) #[Depends('permitted')] public function permittedURI(GeneralSubtrees $subtrees) { - static::assertEquals(self::PERMITTED_URI, $subtrees->all()[0]->base()->string()); + static::assertSame(self::PERMITTED_URI, $subtrees->all()[0]->base()->string()); } #[Test] #[Depends('permitted')] public function permittedDN(GeneralSubtrees $subtrees) { - static::assertEquals(self::PERMITTED_DN, $subtrees->all()[1]->base()->string()); + static::assertSame(self::PERMITTED_DN, $subtrees->all()[1]->base()->string()); } #[Test] #[Depends('excluded')] public function excludedURI(GeneralSubtrees $subtrees) { - static::assertEquals(self::EXCLUDED_URI, $subtrees->all()[0]->base()->string()); + static::assertSame(self::EXCLUDED_URI, $subtrees->all()[0]->base()->string()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/NoRevocationAvailableTest.php b/tests/X509/Unit/Certificate/Extension/NoRevocationAvailableTest.php index dcd8c229..07ee266f 100644 --- a/tests/X509/Unit/Certificate/Extension/NoRevocationAvailableTest.php +++ b/tests/X509/Unit/Certificate/Extension/NoRevocationAvailableTest.php @@ -28,7 +28,7 @@ public function create() #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_NO_REV_AVAIL, $ext->oid()); + static::assertSame(Extension::OID_NO_REV_AVAIL, $ext->oid()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/PolicyConstraintsTest.php b/tests/X509/Unit/Certificate/Extension/PolicyConstraintsTest.php index 61b72540..7670f816 100644 --- a/tests/X509/Unit/Certificate/Extension/PolicyConstraintsTest.php +++ b/tests/X509/Unit/Certificate/Extension/PolicyConstraintsTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_POLICY_CONSTRAINTS, $ext->oid()); + static::assertSame(Extension::OID_POLICY_CONSTRAINTS, $ext->oid()); } #[Test] @@ -73,14 +73,14 @@ public function recoded(Extension $ref, Extension $new) #[Depends('create')] public function requireExplicit(PolicyConstraintsExtension $ext) { - static::assertEquals(2, $ext->requireExplicitPolicy()); + static::assertSame(2, $ext->requireExplicitPolicy()); } #[Test] #[Depends('create')] public function inhibitMapping(PolicyConstraintsExtension $ext) { - static::assertEquals(3, $ext->inhibitPolicyMapping()); + static::assertSame(3, $ext->inhibitPolicyMapping()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/PolicyMapping/PolicyMappingTest.php b/tests/X509/Unit/Certificate/Extension/PolicyMapping/PolicyMappingTest.php index 3091c473..b946b1c8 100644 --- a/tests/X509/Unit/Certificate/Extension/PolicyMapping/PolicyMappingTest.php +++ b/tests/X509/Unit/Certificate/Extension/PolicyMapping/PolicyMappingTest.php @@ -60,13 +60,13 @@ public function recoded(PolicyMapping $ref, PolicyMapping $new) #[Depends('create')] public function issuerDomainPolicy(PolicyMapping $mapping) { - static::assertEquals(self::ISSUER_POLICY, $mapping->issuerDomainPolicy()); + static::assertSame(self::ISSUER_POLICY, $mapping->issuerDomainPolicy()); } #[Test] #[Depends('create')] public function subjectDomainPolicy(PolicyMapping $mapping) { - static::assertEquals(self::SUBJECT_POLICY, $mapping->subjectDomainPolicy()); + static::assertSame(self::SUBJECT_POLICY, $mapping->subjectDomainPolicy()); } } diff --git a/tests/X509/Unit/Certificate/Extension/PolicyMappingsTest.php b/tests/X509/Unit/Certificate/Extension/PolicyMappingsTest.php index 34733c72..af1b930a 100644 --- a/tests/X509/Unit/Certificate/Extension/PolicyMappingsTest.php +++ b/tests/X509/Unit/Certificate/Extension/PolicyMappingsTest.php @@ -50,7 +50,7 @@ public function create(array $mappings) #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_POLICY_MAPPINGS, $ext->oid()); + static::assertSame(Extension::OID_POLICY_MAPPINGS, $ext->oid()); } #[Test] @@ -135,14 +135,14 @@ public function mapping(PolicyMappingsExtension $ext) #[Depends('mapping')] public function issuerPolicy(PolicyMapping $mapping) { - static::assertEquals(self::ISSUER_POLICY_OID, $mapping->issuerDomainPolicy()); + static::assertSame(self::ISSUER_POLICY_OID, $mapping->issuerDomainPolicy()); } #[Test] #[Depends('mapping')] public function subjectPolicy(PolicyMapping $mapping) { - static::assertEquals(self::SUBJECT_POLICY_OID, $mapping->subjectDomainPolicy()); + static::assertSame(self::SUBJECT_POLICY_OID, $mapping->subjectDomainPolicy()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/SubjectAlternativeNameTest.php b/tests/X509/Unit/Certificate/Extension/SubjectAlternativeNameTest.php index ba6fbc38..d31c798a 100644 --- a/tests/X509/Unit/Certificate/Extension/SubjectAlternativeNameTest.php +++ b/tests/X509/Unit/Certificate/Extension/SubjectAlternativeNameTest.php @@ -36,7 +36,7 @@ public function create() #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_SUBJECT_ALT_NAME, $ext->oid()); + static::assertSame(Extension::OID_SUBJECT_ALT_NAME, $ext->oid()); } #[Test] @@ -79,7 +79,7 @@ public function recoded(Extension $ref, Extension $new) #[Depends('create')] public function verifyName(SubjectAlternativeNameExtension $ext = null) { - static::assertEquals(self::DN, $ext->names()->firstDN()); + static::assertSame(self::DN, $ext->names()->firstDN()->toString()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/SubjectDirectoryAttributesTest.php b/tests/X509/Unit/Certificate/Extension/SubjectDirectoryAttributesTest.php index 16f0e637..00353c75 100644 --- a/tests/X509/Unit/Certificate/Extension/SubjectDirectoryAttributesTest.php +++ b/tests/X509/Unit/Certificate/Extension/SubjectDirectoryAttributesTest.php @@ -42,7 +42,7 @@ public function create() #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_SUBJECT_DIRECTORY_ATTRIBUTES, $ext->oid()); + static::assertSame(Extension::OID_SUBJECT_DIRECTORY_ATTRIBUTES, $ext->oid()); } #[Test] @@ -85,14 +85,14 @@ public function recoded(Extension $ref, Extension $new) #[Depends('create')] public function cN(SubjectDirectoryAttributesExtension $ext) { - static::assertEquals(self::CN, $ext->firstOf(AttributeType::OID_COMMON_NAME)->first()->stringValue()); + static::assertSame(self::CN, $ext->firstOf(AttributeType::OID_COMMON_NAME)->first()->stringValue()); } #[Test] #[Depends('create')] public function desc(SubjectDirectoryAttributesExtension $ext) { - static::assertEquals(self::DESC, $ext->firstOf(AttributeType::OID_DESCRIPTION)->first()->stringValue()); + static::assertSame(self::DESC, $ext->firstOf(AttributeType::OID_DESCRIPTION)->first()->stringValue()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/SubjectInformationAccessTest.php b/tests/X509/Unit/Certificate/Extension/SubjectInformationAccessTest.php index 616bc2f2..2209b781 100644 --- a/tests/X509/Unit/Certificate/Extension/SubjectInformationAccessTest.php +++ b/tests/X509/Unit/Certificate/Extension/SubjectInformationAccessTest.php @@ -40,7 +40,7 @@ public function create() #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_SUBJECT_INFORMATION_ACCESS, $ext->oid()); + static::assertSame(Extension::OID_SUBJECT_INFORMATION_ACCESS, $ext->oid()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/SubjectKeyIdentifierTest.php b/tests/X509/Unit/Certificate/Extension/SubjectKeyIdentifierTest.php index 5c86dad2..c48fa30f 100644 --- a/tests/X509/Unit/Certificate/Extension/SubjectKeyIdentifierTest.php +++ b/tests/X509/Unit/Certificate/Extension/SubjectKeyIdentifierTest.php @@ -31,7 +31,7 @@ public function create() #[Depends('create')] public function oID(Extension $ext) { - static::assertEquals(Extension::OID_SUBJECT_KEY_IDENTIFIER, $ext->oid()); + static::assertSame(Extension::OID_SUBJECT_KEY_IDENTIFIER, $ext->oid()); } #[Test] @@ -74,7 +74,7 @@ public function recoded(Extension $ref, Extension $new) #[Depends('create')] public function keyIdentifier(SubjectKeyIdentifierExtension $ext) { - static::assertEquals(self::KEY_ID, $ext->keyIdentifier()); + static::assertSame(self::KEY_ID, $ext->keyIdentifier()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/Target/TargetGroupTest.php b/tests/X509/Unit/Certificate/Extension/Target/TargetGroupTest.php index 136a0b78..973588e6 100644 --- a/tests/X509/Unit/Certificate/Extension/Target/TargetGroupTest.php +++ b/tests/X509/Unit/Certificate/Extension/Target/TargetGroupTest.php @@ -62,7 +62,7 @@ public function recoded(Target $ref, Target $new) #[Depends('create')] public function type(Target $target) { - static::assertEquals(Target::TYPE_GROUP, $target->type()); + static::assertSame(Target::TYPE_GROUP, $target->type()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/Target/TargetNameTest.php b/tests/X509/Unit/Certificate/Extension/Target/TargetNameTest.php index 9f444479..9a26b6c8 100644 --- a/tests/X509/Unit/Certificate/Extension/Target/TargetNameTest.php +++ b/tests/X509/Unit/Certificate/Extension/Target/TargetNameTest.php @@ -62,7 +62,7 @@ public function recoded(Target $ref, Target $new) #[Depends('create')] public function type(Target $target) { - static::assertEquals(Target::TYPE_NAME, $target->type()); + static::assertSame(Target::TYPE_NAME, $target->type()); } #[Test] diff --git a/tests/X509/Unit/Certificate/Extension/TargetInformationTest.php b/tests/X509/Unit/Certificate/Extension/TargetInformationTest.php index 20cc0d8f..75b1132b 100644 --- a/tests/X509/Unit/Certificate/Extension/TargetInformationTest.php +++ b/tests/X509/Unit/Certificate/Extension/TargetInformationTest.php @@ -27,54 +27,35 @@ final class TargetInformationTest extends TestCase final public const GROUP_DOMAIN = '.example.com'; #[Test] - public function createTargets() - { - $targets = Targets::create( - TargetName::create(DirectoryName::fromDNString(self::NAME_DN)), - TargetGroup::create(DNSName::create(self::GROUP_DOMAIN)) - ); - static::assertInstanceOf(Targets::class, $targets); - return $targets; - } - - #[Test] - #[Depends('createTargets')] - public function create(Targets $targets) - { - $ext = TargetInformationExtension::create(true, $targets); - static::assertInstanceOf(TargetInformationExtension::class, $ext); - return $ext; - } - - #[Test] - #[Depends('create')] - public function oID(Extension $ext) - { - static::assertEquals(Extension::OID_TARGET_INFORMATION, $ext->oid()); - } - - #[Test] - #[Depends('create')] - public function critical(Extension $ext) + public function oID(): void { + $ext = self::createExtension(); + static::assertSame(Extension::OID_TARGET_INFORMATION, $ext->oid()); static::assertTrue($ext->isCritical()); + static::assertCount(2, $ext); + $values = []; + foreach ($ext as $target) { + $values[] = $target; + } + static::assertCount(2, $values); + static::assertContainsOnlyInstancesOf(Target::class, $values); + static::assertSame(self::NAME_DN, $ext->names()[0]->string()); + static::assertSame(self::GROUP_DOMAIN, $ext->groups()[0]->string()); + static::assertInstanceOf(TargetInformationExtension::class, clone $ext); } #[Test] - #[Depends('create')] - public function encode(Extension $ext) + public function encode(): string { + $ext = self::createExtension(); $seq = $ext->toASN1(); static::assertInstanceOf(Sequence::class, $seq); return $seq->toDER(); } - /** - * @param string $der - */ #[Test] #[Depends('encode')] - public function decode($der) + public function decode(string $der): TargetInformationExtension { $ext = TargetInformationExtension::fromASN1(Sequence::fromDER($der)); static::assertInstanceOf(TargetInformationExtension::class, $ext); @@ -82,60 +63,27 @@ public function decode($der) } #[Test] - #[Depends('create')] #[Depends('decode')] - public function recoded(Extension $ref, Extension $new) - { - static::assertEquals($ref, $new); - } - - #[Test] - #[Depends('create')] - public function countMethod(TargetInformationExtension $ext) + public function recoded(Extension $new): void { - static::assertCount(2, $ext); + $ext = self::createExtension(); + static::assertEquals($ext, $new); } #[Test] - #[Depends('create')] - public function iterator(TargetInformationExtension $ext) + public function fromTargets(): void { - $values = []; - foreach ($ext as $target) { - $values[] = $target; - } - static::assertCount(2, $values); - static::assertContainsOnlyInstancesOf(Target::class, $values); - } - - #[Test] - #[Depends('create')] - public function verifyName(TargetInformationExtension $ext = null) - { - static::assertEquals(self::NAME_DN, $ext->names()[0]->string()); - } - - #[Test] - #[Depends('create')] - public function group(TargetInformationExtension $ext) - { - static::assertEquals(self::GROUP_DOMAIN, $ext->groups()[0]->string()); + $ext = TargetInformationExtension::fromTargets(TargetName::create(DirectoryName::fromDNString(self::NAME_DN))); + static::assertInstanceOf(TargetInformationExtension::class, $ext); } - /** - * Cover __clone method. - */ - #[Test] - #[Depends('create')] - public function clone(TargetInformationExtension $ext) + private static function createExtension(): TargetInformationExtension { - static::assertInstanceOf(TargetInformationExtension::class, clone $ext); - } + $targets = Targets::create( + TargetName::create(DirectoryName::fromDNString(self::NAME_DN)), + TargetGroup::create(DNSName::create(self::GROUP_DOMAIN)) + ); - #[Test] - public function fromTargets() - { - $ext = TargetInformationExtension::fromTargets(TargetName::create(DirectoryName::fromDNString(self::NAME_DN))); - static::assertInstanceOf(TargetInformationExtension::class, $ext); + return TargetInformationExtension::create(true, $targets); } } diff --git a/tests/X509/Unit/Certificate/Extension/UnknownExtensionTest.php b/tests/X509/Unit/Certificate/Extension/UnknownExtensionTest.php index aebef3e7..40a5b575 100644 --- a/tests/X509/Unit/Certificate/Extension/UnknownExtensionTest.php +++ b/tests/X509/Unit/Certificate/Extension/UnknownExtensionTest.php @@ -33,7 +33,7 @@ public function createWithDER() public function extensionValueDER(UnknownExtension $ext) { $expect = (NullType::create())->toDER(); - static::assertEquals($expect, $ext->extensionValue()); + static::assertSame($expect, $ext->extensionValue()); } /** @@ -51,7 +51,7 @@ public function createFromString() #[Depends('createFromString')] public function extensionValueRaw(UnknownExtension $ext) { - static::assertEquals('DATA', $ext->extensionValue()); + static::assertSame('DATA', $ext->extensionValue()); } #[Test] diff --git a/tests/X509/Unit/Certificate/TBSCertificateTest.php b/tests/X509/Unit/Certificate/TBSCertificateTest.php index c5b507cb..389d7a53 100644 --- a/tests/X509/Unit/Certificate/TBSCertificateTest.php +++ b/tests/X509/Unit/Certificate/TBSCertificateTest.php @@ -6,7 +6,6 @@ use Brick\Math\BigInteger; use LogicException; -use function mb_strlen; use PHPUnit\Framework\Attributes\Depends; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; @@ -26,6 +25,7 @@ use SpomkyLabs\Pki\X509\Certificate\UniqueIdentifier; use SpomkyLabs\Pki\X509\Certificate\Validity; use UnexpectedValueException; +use function mb_strlen; /** * @internal @@ -121,14 +121,14 @@ public function recoded(TBSCertificate $ref, TBSCertificate $new) #[Depends('createWithAll')] public function version(TBSCertificate $tc) { - static::assertEquals(TBSCertificate::VERSION_3, $tc->version()); + static::assertSame(TBSCertificate::VERSION_3, $tc->version()); } #[Test] #[Depends('createWithAll')] public function serialNumber(TBSCertificate $tc) { - static::assertEquals(1, $tc->serialNumber()); + static::assertSame('1', $tc->serialNumber()); } #[Test] @@ -170,14 +170,14 @@ public function subjectPKI(TBSCertificate $tc) #[Depends('createWithAll')] public function issuerUniqueID(TBSCertificate $tc) { - static::assertEquals('issuer', $tc->issuerUniqueID()->string()); + static::assertSame('issuer', $tc->issuerUniqueID()->string()); } #[Test] #[Depends('createWithAll')] public function subjectUniqueID(TBSCertificate $tc) { - static::assertEquals('subject', $tc->subjectUniqueID()->string()); + static::assertSame('subject', $tc->subjectUniqueID()->string()); } #[Test] @@ -209,7 +209,7 @@ public function withRandomSerialNumber(TBSCertificate $tc) { $tc = $tc->withRandomSerialNumber(16); $bin = BigInteger::of($tc->serialNumber())->toBytes(); - static::assertEquals(16, mb_strlen($bin, '8bit')); + static::assertSame(16, mb_strlen($bin, '8bit')); } #[Test] diff --git a/tests/X509/Unit/Certificate/UniqueIdentifierTest.php b/tests/X509/Unit/Certificate/UniqueIdentifierTest.php index d9960c60..67df147d 100644 --- a/tests/X509/Unit/Certificate/UniqueIdentifierTest.php +++ b/tests/X509/Unit/Certificate/UniqueIdentifierTest.php @@ -58,7 +58,7 @@ public function recoded(UniqueIdentifier $ref, UniqueIdentifier $new) #[Depends('create')] public function string(UniqueIdentifier $id) { - static::assertEquals(self::UID, $id->string()); + static::assertSame(self::UID, $id->string()); } #[Test] diff --git a/tests/X509/Unit/CertificationPath/CertificationPathTest.php b/tests/X509/Unit/CertificationPath/CertificationPathTest.php index 4bbc8ef7..e05e08dd 100644 --- a/tests/X509/Unit/CertificationPath/CertificationPathTest.php +++ b/tests/X509/Unit/CertificationPath/CertificationPathTest.php @@ -4,7 +4,6 @@ namespace SpomkyLabs\Pki\Test\X509\Unit\CertificationPath; -use function array_slice; use LogicException; use PHPUnit\Framework\Attributes\Depends; use PHPUnit\Framework\Attributes\Test; @@ -16,6 +15,7 @@ use SpomkyLabs\Pki\X509\CertificationPath\CertificationPath; use SpomkyLabs\Pki\X509\CertificationPath\PathValidation\PathValidationConfig; use SpomkyLabs\Pki\X509\CertificationPath\PathValidation\PathValidationResult; +use function array_slice; /** * @internal diff --git a/tests/X509/Unit/CertificationPath/Policy/PolicyTreeTest.php b/tests/X509/Unit/CertificationPath/Policy/PolicyTreeTest.php index a170d9f8..b354cae7 100644 --- a/tests/X509/Unit/CertificationPath/Policy/PolicyTreeTest.php +++ b/tests/X509/Unit/CertificationPath/Policy/PolicyTreeTest.php @@ -58,6 +58,6 @@ public function pruneNoRoot() $prop->setValue($tree, null); $mtd = $obj->getMethod('pruneTree'); $mtd->setAccessible(true); - static::assertEquals(0, $mtd->invoke($tree, 0)); + static::assertSame(0, $mtd->invoke($tree, 0)); } } diff --git a/tests/X509/Unit/CertificationPath/Validation/PathValidationConfigTest.php b/tests/X509/Unit/CertificationPath/Validation/PathValidationConfigTest.php index a5943cbb..a1e86ef1 100644 --- a/tests/X509/Unit/CertificationPath/Validation/PathValidationConfigTest.php +++ b/tests/X509/Unit/CertificationPath/Validation/PathValidationConfigTest.php @@ -30,7 +30,7 @@ public function create() #[Depends('create')] public function maxLength(PathValidationConfig $config) { - static::assertEquals(3, $config->maxLength()); + static::assertSame(3, $config->maxLength()); } #[Test] diff --git a/tests/X509/Unit/Csr/Attribute/ExtensionRequestTest.php b/tests/X509/Unit/Csr/Attribute/ExtensionRequestTest.php index adc7d5a5..972c4be1 100644 --- a/tests/X509/Unit/Csr/Attribute/ExtensionRequestTest.php +++ b/tests/X509/Unit/Csr/Attribute/ExtensionRequestTest.php @@ -60,7 +60,7 @@ public function recoded(AttributeValue $ref, AttributeValue $new) #[Depends('create')] public function oID(AttributeValue $value) { - static::assertEquals(ExtensionRequestValue::OID, $value->oid()); + static::assertSame(ExtensionRequestValue::OID, $value->oid()); } #[Test] diff --git a/tests/X509/Unit/Csr/CertificationRequestInfoTest.php b/tests/X509/Unit/Csr/CertificationRequestInfoTest.php index 45af9de9..95125e83 100644 --- a/tests/X509/Unit/Csr/CertificationRequestInfoTest.php +++ b/tests/X509/Unit/Csr/CertificationRequestInfoTest.php @@ -101,7 +101,7 @@ public function recoded(CertificationRequestInfo $ref, CertificationRequestInfo #[Depends('create')] public function version(CertificationRequestInfo $cri) { - static::assertEquals(CertificationRequestInfo::VERSION_1, $cri->version()); + static::assertSame(CertificationRequestInfo::VERSION_1, $cri->version()); } #[Test] @@ -171,7 +171,7 @@ public function sAN(Attributes $attribs) ->names() ->firstDN() ->toString(); - static::assertEquals(self::SAN_DN, $dn); + static::assertSame(self::SAN_DN, $dn); } #[Test] diff --git a/tests/X509/Unit/Csr/CertificationRequestTest.php b/tests/X509/Unit/Csr/CertificationRequestTest.php index f1dd0549..56e79d85 100644 --- a/tests/X509/Unit/Csr/CertificationRequestTest.php +++ b/tests/X509/Unit/Csr/CertificationRequestTest.php @@ -18,8 +18,8 @@ use SpomkyLabs\Pki\X501\ASN1\Name; use SpomkyLabs\Pki\X509\CertificationRequest\CertificationRequest; use SpomkyLabs\Pki\X509\CertificationRequest\CertificationRequestInfo; -use function strval; use UnexpectedValueException; +use function strval; /** * @internal @@ -144,7 +144,7 @@ public function toStringMethod(CertificationRequest $cr) #[Depends('toPEM')] public function pEMType(PEM $pem) { - static::assertEquals(PEM::TYPE_CERTIFICATE_REQUEST, $pem->type()); + static::assertSame(PEM::TYPE_CERTIFICATE_REQUEST, $pem->type()); } #[Test] diff --git a/tests/X509/Unit/GeneralName/DNSNameTest.php b/tests/X509/Unit/GeneralName/DNSNameTest.php index 88c16077..9fe9d39d 100644 --- a/tests/X509/Unit/GeneralName/DNSNameTest.php +++ b/tests/X509/Unit/GeneralName/DNSNameTest.php @@ -43,7 +43,7 @@ public function encode(DNSName $name) public function choiceTag($der) { $el = TaggedType::fromDER($der); - static::assertEquals(GeneralName::TAG_DNS_NAME, $el->tag()); + static::assertSame(GeneralName::TAG_DNS_NAME, $el->tag()); } /** @@ -70,6 +70,6 @@ public function recoded(DNSName $ref, DNSName $new) #[Depends('create')] public function dNS(DNSName $name) { - static::assertEquals('test.example.com', $name->name()); + static::assertSame('test.example.com', $name->name()); } } diff --git a/tests/X509/Unit/GeneralName/DirectoryNameTest.php b/tests/X509/Unit/GeneralName/DirectoryNameTest.php index d1086283..5a7f7cbb 100644 --- a/tests/X509/Unit/GeneralName/DirectoryNameTest.php +++ b/tests/X509/Unit/GeneralName/DirectoryNameTest.php @@ -41,7 +41,7 @@ public function encode(DirectoryName $name): string public function choiceTag(string $der) { $el = TaggedType::fromDER($der); - static::assertEquals(GeneralName::TAG_DIRECTORY_NAME, $el->tag()); + static::assertSame(GeneralName::TAG_DIRECTORY_NAME, $el->tag()); } /** @@ -68,7 +68,7 @@ public function recoded(DirectoryName $ref, DirectoryName $new) #[Depends('create')] public function string(DirectoryName $name) { - static::assertEquals('cn=Test', $name->string()); + static::assertSame('cn=Test', $name->string()); } #[Test] diff --git a/tests/X509/Unit/GeneralName/EDIPartyNameTest.php b/tests/X509/Unit/GeneralName/EDIPartyNameTest.php index 1f451a8f..b7346fe3 100644 --- a/tests/X509/Unit/GeneralName/EDIPartyNameTest.php +++ b/tests/X509/Unit/GeneralName/EDIPartyNameTest.php @@ -47,7 +47,7 @@ public function encode(EDIPartyName $name) public function choiceTag($der) { $el = TaggedType::fromDER($der); - static::assertEquals(GeneralName::TAG_EDI_PARTY_NAME, $el->tag()); + static::assertSame(GeneralName::TAG_EDI_PARTY_NAME, $el->tag()); } /** diff --git a/tests/X509/Unit/GeneralName/IPv4AddressNameTest.php b/tests/X509/Unit/GeneralName/IPv4AddressNameTest.php index e6a5dde2..36dba924 100644 --- a/tests/X509/Unit/GeneralName/IPv4AddressNameTest.php +++ b/tests/X509/Unit/GeneralName/IPv4AddressNameTest.php @@ -50,7 +50,7 @@ public function encode(IPAddress $ip) public function choiceTag($der) { $el = TaggedType::fromDER($der); - static::assertEquals(GeneralName::TAG_IP_ADDRESS, $el->tag()); + static::assertSame(GeneralName::TAG_IP_ADDRESS, $el->tag()); } /** @@ -77,7 +77,7 @@ public function recoded(IPAddress $ref, IPAddress $new) #[Depends('create')] public function address(IPAddress $ip) { - static::assertEquals(self::ADDR, $ip->address()); + static::assertSame(self::ADDR, $ip->address()); } #[Test] @@ -121,14 +121,14 @@ public function recodedWithMask(IPAddress $ref, IPAddress $new) #[Depends('createWithMask')] public function mask(IPAddress $ip) { - static::assertEquals(self::MASK, $ip->mask()); + static::assertSame(self::MASK, $ip->mask()); } #[Test] #[Depends('createWithMask')] public function string(IPAddress $ip) { - static::assertEquals(self::ADDR . '/' . self::MASK, $ip->string()); + static::assertSame(self::ADDR . '/' . self::MASK, $ip->string()); } #[Test] diff --git a/tests/X509/Unit/GeneralName/IPv6AddressNameTest.php b/tests/X509/Unit/GeneralName/IPv6AddressNameTest.php index 20073e64..751d5891 100644 --- a/tests/X509/Unit/GeneralName/IPv6AddressNameTest.php +++ b/tests/X509/Unit/GeneralName/IPv6AddressNameTest.php @@ -50,7 +50,7 @@ public function encode(IPAddress $ip) public function choiceTag($der) { $el = TaggedType::fromDER($der); - static::assertEquals(GeneralName::TAG_IP_ADDRESS, $el->tag()); + static::assertSame(GeneralName::TAG_IP_ADDRESS, $el->tag()); } /** @@ -77,7 +77,7 @@ public function recoded(IPAddress $ref, IPAddress $new) #[Depends('create')] public function iPv6(IPAddress $ip) { - static::assertEquals(self::ADDR, $ip->address()); + static::assertSame(self::ADDR, $ip->address()); } #[Test] @@ -121,7 +121,7 @@ public function recodedWithMask(IPAddress $ref, IPAddress $new) #[Depends('createWithMask')] public function mask(IPAddress $ip) { - static::assertEquals(self::MASK, $ip->mask()); + static::assertSame(self::MASK, $ip->mask()); } #[Test] diff --git a/tests/X509/Unit/GeneralName/OtherNameTest.php b/tests/X509/Unit/GeneralName/OtherNameTest.php index 842cf4a0..2ac4f627 100644 --- a/tests/X509/Unit/GeneralName/OtherNameTest.php +++ b/tests/X509/Unit/GeneralName/OtherNameTest.php @@ -44,7 +44,7 @@ public function encode(OtherName $name) public function choiceTag($der) { $el = TaggedType::fromDER($der); - static::assertEquals(GeneralName::TAG_OTHER_NAME, $el->tag()); + static::assertSame(GeneralName::TAG_OTHER_NAME, $el->tag()); } /** @@ -78,7 +78,7 @@ public function string(OtherName $name) #[Depends('create')] public function oID(OtherName $name) { - static::assertEquals('1.3.6.1.3.1', $name->type()); + static::assertSame('1.3.6.1.3.1', $name->type()); } #[Test] diff --git a/tests/X509/Unit/GeneralName/RFC822NameTest.php b/tests/X509/Unit/GeneralName/RFC822NameTest.php index 87159c21..629be9ba 100644 --- a/tests/X509/Unit/GeneralName/RFC822NameTest.php +++ b/tests/X509/Unit/GeneralName/RFC822NameTest.php @@ -43,7 +43,7 @@ public function encode(RFC822Name $name) public function choiceTag($der) { $el = TaggedType::fromDER($der); - static::assertEquals(GeneralName::TAG_RFC822_NAME, $el->tag()); + static::assertSame(GeneralName::TAG_RFC822_NAME, $el->tag()); } /** @@ -77,6 +77,6 @@ public function string(RFC822Name $name) #[Depends('create')] public function email(RFC822Name $name) { - static::assertEquals('test@example.com', $name->email()); + static::assertSame('test@example.com', $name->email()); } } diff --git a/tests/X509/Unit/GeneralName/RegisteredIDNameTest.php b/tests/X509/Unit/GeneralName/RegisteredIDNameTest.php index 520cc377..336b704b 100644 --- a/tests/X509/Unit/GeneralName/RegisteredIDNameTest.php +++ b/tests/X509/Unit/GeneralName/RegisteredIDNameTest.php @@ -43,7 +43,7 @@ public function encode(RegisteredID $rid): string public function choiceTag($der): void { $el = TaggedType::fromDER($der); - static::assertEquals(GeneralName::TAG_REGISTERED_ID, $el->tag()); + static::assertSame(GeneralName::TAG_REGISTERED_ID, $el->tag()); } /** @@ -77,6 +77,6 @@ public function string(RegisteredID $rid): void #[Depends('create')] public function oID(RegisteredID $rid): void { - static::assertEquals('1.3.6.1.3.1', $rid->oid()); + static::assertSame('1.3.6.1.3.1', $rid->oid()); } } diff --git a/tests/X509/Unit/GeneralName/URINameTest.php b/tests/X509/Unit/GeneralName/URINameTest.php index 81724fc5..ac050d28 100644 --- a/tests/X509/Unit/GeneralName/URINameTest.php +++ b/tests/X509/Unit/GeneralName/URINameTest.php @@ -45,7 +45,7 @@ public function encode(UniformResourceIdentifier $uri) public function choiceTag($der) { $el = TaggedType::fromDER($der); - static::assertEquals(GeneralName::TAG_URI, $el->tag()); + static::assertSame(GeneralName::TAG_URI, $el->tag()); } /** @@ -72,13 +72,13 @@ public function recoded(UniformResourceIdentifier $ref, UniformResourceIdentifie #[Depends('create')] public function string(UniformResourceIdentifier $uri) { - static::assertEquals(self::URI, $uri->string()); + static::assertSame(self::URI, $uri->string()); } #[Test] #[Depends('create')] public function uRI(UniformResourceIdentifier $uri) { - static::assertEquals(self::URI, $uri->uri()); + static::assertSame(self::URI, $uri->uri()); } } diff --git a/tests/X509/Unit/GeneralName/X400AddressTest.php b/tests/X509/Unit/GeneralName/X400AddressTest.php index 8c0c5dde..43f908ee 100644 --- a/tests/X509/Unit/GeneralName/X400AddressTest.php +++ b/tests/X509/Unit/GeneralName/X400AddressTest.php @@ -42,7 +42,7 @@ public function encode(X400Address $name): string public function choiceTag(string $der): void { $el = TaggedType::fromDER($der); - static::assertEquals(GeneralName::TAG_X400_ADDRESS, $el->tag()); + static::assertSame(GeneralName::TAG_X400_ADDRESS, $el->tag()); } #[Test]