From 2e03a3c57cdb34de21cc53f35bb50951bb7d3b08 Mon Sep 17 00:00:00 2001 From: balexey88 Date: Thu, 9 Oct 2025 16:10:55 +0300 Subject: [PATCH 1/2] Release 4.2.1 --- changelog.txt | 7 + changes.md | 7 + composer.json | 2 +- composer.lock | 143 ++- lib/Google/CHANGELOG.md | 14 + lib/Google/CODE_OF_CONDUCT.md | 43 - lib/Google/UPGRADING.md | 377 ------ lib/Google/composer.json | 3 +- lib/Google/composer.lock | 1099 +++++++++++------ lib/Google/phpstan.neon.dist | 5 - .../src/AuthHandler/Guzzle6AuthHandler.php | 18 +- lib/Google/src/Client.php | 12 +- lib/Google/src/Task/Composer.php | 54 +- lib/Google/vendor/autoload.php | 2 +- lib/Google/vendor/brick/math/CHANGELOG.md | 68 + lib/Google/vendor/brick/math/composer.json | 13 +- lib/Google/vendor/brick/math/phpstan.neon | 14 + .../vendor/brick/math/src/BigDecimal.php | 240 ++-- .../vendor/brick/math/src/BigInteger.php | 256 ++-- .../vendor/brick/math/src/BigNumber.php | 350 +++--- .../vendor/brick/math/src/BigRational.php | 120 +- .../src/Exception/DivisionByZeroException.php | 8 +- .../Exception/IntegerOverflowException.php | 4 +- .../math/src/Exception/MathException.php | 2 +- .../src/Exception/NegativeNumberException.php | 2 +- .../src/Exception/NumberFormatException.php | 17 +- .../Exception/RoundingNecessaryException.php | 4 +- .../brick/math/src/Internal/Calculator.php | 163 ++- .../Internal/Calculator/BcMathCalculator.php | 24 +- .../src/Internal/Calculator/GmpCalculator.php | 26 +- .../Internal/Calculator/NativeCalculator.php | 92 +- .../math/src/Internal/CalculatorRegistry.php | 73 ++ .../vendor/brick/math/src/RoundingMode.php | 31 +- .../vendor/composer/autoload_classmap.php | 2 - lib/Google/vendor/composer/autoload_files.php | 1 - lib/Google/vendor/composer/autoload_psr4.php | 1 - lib/Google/vendor/composer/autoload_real.php | 10 +- .../vendor/composer/autoload_static.php | 19 +- lib/Google/vendor/composer/installed.json | 428 +++---- lib/Google/vendor/composer/installed.php | 123 +- lib/Google/vendor/composer/platform_check.php | 4 +- .../google/apiclient-services/composer.json | 2 +- .../google/apiclient-services/src/Storage.php | 12 + .../src/Storage/BucketEncryption.php | 48 + ...omerManagedEncryptionEnforcementConfig.php | 62 + ...merSuppliedEncryptionEnforcementConfig.php | 62 + ...ogleManagedEncryptionEnforcementConfig.php | 62 + .../src/Storage/BucketIpFilter.php | 36 + .../src/Storage/Buckets.php | 20 +- .../src/Storage/BulkRestoreObjectsRequest.php | 36 + .../Storage/ObjectCustomContextPayload.php | 80 ++ .../src/Storage/Resource/Buckets.php | 2 + .../src/Storage/Resource/Folders.php | 2 +- .../src/Storage/Resource/Objects.php | 4 + .../src/Storage/StorageObject.php | 16 + .../src/Storage/StorageObjectContexts.php | 42 + lib/Google/vendor/google/auth/VERSION | 2 +- lib/Google/vendor/google/auth/composer.json | 2 +- .../vendor/google/auth/src/AccessToken.php | 8 +- .../src/ApplicationDefaultCredentials.php | 107 +- .../src/CredentialSource/AwsNativeSource.php | 10 +- .../src/CredentialSource/ExecutableSource.php | 8 +- .../auth/src/CredentialSource/FileSource.php | 14 +- .../auth/src/CredentialSource/UrlSource.php | 16 +- .../Credentials/AppIdentityCredentials.php | 12 +- .../ExternalAccountCredentials.php | 18 +- .../auth/src/Credentials/GCECredentials.php | 38 +- .../auth/src/Credentials/IAMCredentials.php | 4 +- .../ImpersonatedServiceAccountCredentials.php | 111 +- .../src/Credentials/InsecureCredentials.php | 4 +- .../Credentials/ServiceAccountCredentials.php | 64 +- .../ServiceAccountJwtAccessCredentials.php | 16 +- .../Credentials/UserRefreshCredentials.php | 44 +- .../google/auth/src/CredentialsLoader.php | 9 +- ...ternalAccountCredentialSourceInterface.php | 4 +- .../google/auth/src/FetchAuthTokenCache.php | 24 +- .../auth/src/FetchAuthTokenInterface.php | 4 +- .../vendor/google/auth/src/GCECache.php | 8 +- .../auth/src/HttpHandler/HttpClientCache.php | 2 +- .../src/HttpHandler/HttpHandlerFactory.php | 4 +- lib/Google/vendor/google/auth/src/Iam.php | 53 +- .../src/Middleware/AuthTokenMiddleware.php | 11 +- .../Middleware/ProxyAuthTokenMiddleware.php | 8 +- .../ScopedAccessTokenMiddleware.php | 8 +- lib/Google/vendor/google/auth/src/OAuth2.php | 28 +- .../auth/src/ProjectIdProviderInterface.php | 4 +- .../google/auth/src/SignBlobInterface.php | 4 +- .../auth/src/UpdateMetadataInterface.php | 4 +- .../google/auth/src/UpdateMetadataTrait.php | 4 +- .../vendor/google/cloud-storage/VERSION | 2 +- .../vendor/google/cloud-storage/composer.json | 2 +- .../google/cloud-storage/src/Bucket.php | 102 +- .../cloud-storage/src/Connection/Rest.php | 57 +- .../src/Connection/RetryTrait.php | 4 +- .../cloud-storage/src/SigningHelper.php | 4 + .../cloud-storage/src/StorageClient.php | 69 +- .../cloud-storage/src/StorageObject.php | 148 ++- .../vendor/google/common-protos/VERSION | 2 +- .../vendor/google/common-protos/composer.json | 6 +- lib/Google/vendor/google/longrunning/VERSION | 2 +- .../vendor/google/longrunning/composer.json | 4 +- .../LongRunning/Client/OperationsClient.php | 36 +- .../vendor/google/protobuf/composer.json | 5 +- .../src/GPBMetadata/Google/Protobuf/Api.php | 2 +- .../protobuf/src/Google/Protobuf/Api.php | 38 + .../protobuf/src/Google/Protobuf/Enum.php | 4 + .../src/Google/Protobuf/EnumValue.php | 4 + .../protobuf/src/Google/Protobuf/Field.php | 4 + .../Google/Protobuf/Internal/FieldOptions.php | 21 +- .../Protobuf/Internal/GPBDecodeException.php | 2 +- .../protobuf/src/Google/Protobuf/Method.php | 74 +- .../protobuf/src/Google/Protobuf/Option.php | 3 + .../protobuf/src/Google/Protobuf/Type.php | 4 + lib/Google/vendor/grpc/grpc/composer.json | 2 +- .../vendor/grpc/grpc/src/lib/BaseStub.php | 2 +- .../grpc/grpc/src/lib/ServerCallWriter.php | 2 +- .../vendor/grpc/grpc/src/lib/Status.php | 4 +- .../vendor/grpc/grpc/src/lib/UnaryCall.php | 4 +- .../vendor/guzzlehttp/guzzle/CHANGELOG.md | 11 + .../vendor/guzzlehttp/guzzle/composer.json | 4 +- .../guzzle/src/Handler/CurlFactory.php | 9 +- .../guzzle/src/Handler/CurlMultiHandler.php | 5 +- .../guzzle/src/Handler/StreamHandler.php | 9 +- .../guzzlehttp/guzzle/src/Middleware.php | 4 +- .../vendor/guzzlehttp/promises/CHANGELOG.md | 7 + .../vendor/guzzlehttp/promises/README.md | 2 +- .../vendor/guzzlehttp/promises/composer.json | 2 +- .../vendor/guzzlehttp/psr7/CHANGELOG.md | 10 + lib/Google/vendor/guzzlehttp/psr7/README.md | 2 +- .../vendor/guzzlehttp/psr7/composer.json | 2 +- .../guzzlehttp/psr7/src/MessageTrait.php | 4 - .../vendor/guzzlehttp/psr7/src/Utils.php | 4 +- .../constant_time_encoding/composer.json | 15 +- .../constant_time_encoding/src/Base32.php | 75 +- .../constant_time_encoding/src/Base32Hex.php | 11 +- .../constant_time_encoding/src/Base64.php | 98 +- .../src/Base64DotSlash.php | 4 + .../src/Base64DotSlashOrdered.php | 4 + .../src/Base64UrlSafe.php | 4 + .../constant_time_encoding/src/Binary.php | 22 +- .../src/EncoderInterface.php | 13 +- .../constant_time_encoding/src/Encoding.php | 45 +- .../constant_time_encoding/src/Hex.php | 51 +- .../constant_time_encoding/src/RFC4648.php | 22 +- .../vendor/phpseclib/phpseclib/README.md | 12 +- .../phpseclib/Common/Functions/Strings.php | 4 +- .../phpseclib/phpseclib/Crypt/Blowfish.php | 14 +- .../Crypt/Common/Formats/Keys/JWK.php | 8 + .../Crypt/Common/Formats/Keys/PKCS8.php | 22 +- .../Crypt/Common/Formats/Keys/PuTTY.php | 12 +- .../phpseclib/Crypt/Common/StreamCipher.php | 2 +- .../phpseclib/phpseclib/Crypt/DES.php | 26 +- .../Crypt/DSA/Formats/Keys/PuTTY.php | 5 +- .../phpseclib/Crypt/DSA/PrivateKey.php | 4 +- .../phpseclib/Crypt/DSA/PublicKey.php | 3 +- .../Crypt/EC/BaseCurves/Montgomery.php | 4 +- .../phpseclib/Crypt/EC/BaseCurves/Prime.php | 4 +- .../Crypt/EC/BaseCurves/TwistedEdwards.php | 2 +- .../phpseclib/Crypt/EC/Formats/Keys/XML.php | 7 +- .../phpseclib/Crypt/EC/PrivateKey.php | 5 +- .../phpseclib/Crypt/EC/PublicKey.php | 3 +- .../phpseclib/phpseclib/Crypt/Hash.php | 91 ++ .../phpseclib/Crypt/PublicKeyLoader.php | 1 + .../phpseclib/phpseclib/Crypt/RC2.php | 26 +- .../phpseclib/phpseclib/Crypt/RC4.php | 10 +- .../phpseclib/phpseclib/Crypt/RSA.php | 7 +- .../Crypt/RSA/Formats/Keys/MSBLOB.php | 22 +- .../Crypt/RSA/Formats/Keys/PKCS1.php | 27 + .../Crypt/RSA/Formats/Keys/PuTTY.php | 5 +- .../phpseclib/phpseclib/Crypt/Rijndael.php | 4 +- .../phpseclib/phpseclib/Crypt/TripleDES.php | 38 +- .../phpseclib/phpseclib/Crypt/Twofish.php | 8 +- .../phpseclib/phpseclib/File/ASN1.php | 25 +- .../phpseclib/phpseclib/File/X509.php | 6 +- .../phpseclib/phpseclib/Math/BigInteger.php | 56 +- .../Math/BigInteger/Engines/BCMath.php | 29 +- .../Math/BigInteger/Engines/BCMath/Base.php | 4 +- .../BigInteger/Engines/BCMath/BuiltIn.php | 2 +- .../Engines/BCMath/Reductions/Barrett.php | 38 +- .../Engines/BCMath/Reductions/EvalBarrett.php | 18 +- .../Math/BigInteger/Engines/Engine.php | 64 +- .../phpseclib/Math/BigInteger/Engines/GMP.php | 5 +- .../phpseclib/Math/BigInteger/Engines/PHP.php | 3 + .../Engines/PHP/Reductions/Barrett.php | 4 +- .../phpseclib/Math/PrimeField/Integer.php | 60 +- .../phpseclib/phpseclib/Net/SFTP.php | 103 +- .../phpseclib/phpseclib/Net/SFTP/Stream.php | 10 +- .../phpseclib/phpseclib/Net/SSH2.php | 122 +- .../psr/cache/src/CacheItemInterface.php | 12 +- .../psr/cache/src/CacheItemPoolInterface.php | 22 +- lib/Google/vendor/ramsey/collection/README.md | 11 - .../vendor/ramsey/collection/composer.json | 52 +- .../collection/conventional-commits.json | 22 - .../ramsey/collection/src/AbstractArray.php | 57 +- .../collection/src/AbstractCollection.php | 242 ++-- .../ramsey/collection/src/AbstractSet.php | 19 +- .../ramsey/collection/src/ArrayInterface.php | 4 +- .../ramsey/collection/src/Collection.php | 21 +- .../collection/src/CollectionInterface.php | 111 +- .../collection/src/DoubleEndedQueue.php | 127 +- .../src/DoubleEndedQueueInterface.php | 36 +- ...rException.php => CollectionException.php} | 7 +- .../Exception/CollectionMismatchException.php | 2 +- .../Exception/InvalidArgumentException.php | 4 +- ...eption.php => InvalidPropertyOrMethod.php} | 6 +- .../src/Exception/NoSuchElementException.php | 2 +- .../src/Exception/OutOfBoundsException.php | 4 +- .../UnsupportedOperationException.php | 2 +- .../ramsey/collection/src/Map/AbstractMap.php | 108 +- .../collection/src/Map/AbstractTypedMap.php | 17 +- .../src/Map/AssociativeArrayMap.php | 3 +- .../collection/src/Map/MapInterface.php | 57 +- .../collection/src/Map/NamedParameterMap.php | 21 +- .../ramsey/collection/src/Map/TypedMap.php | 36 +- .../collection/src/Map/TypedMapInterface.php | 3 +- .../vendor/ramsey/collection/src/Queue.php | 97 +- .../ramsey/collection/src/QueueInterface.php | 18 +- .../vendor/ramsey/collection/src/Set.php | 16 +- .../vendor/ramsey/collection/src/Sort.php | 31 + .../ramsey/collection/src/Tool/TypeTrait.php | 49 +- .../src/Tool/ValueExtractorTrait.php | 77 +- .../src/Tool/ValueToStringTrait.php | 18 +- lib/Google/vendor/ramsey/uuid/composer.json | 2 +- .../uuid/src/Generator/UnixTimeGenerator.php | 8 +- .../uuid/src/Math/BrickMathCalculator.php | 19 +- .../rize/uri-template/.php-cs-fixer.dist.php | 19 + lib/Google/vendor/rize/uri-template/README.md | 10 +- .../vendor/rize/uri-template/composer.json | 11 +- .../vendor/rize/uri-template/phpstan.neon | 5 + .../vendor/rize/uri-template/phpunit.xml | 22 + .../uri-template/src/Rize/UriTemplate.php | 69 +- .../src/Rize/UriTemplate/Node/Abstraction.php | 44 +- .../src/Rize/UriTemplate/Node/Expression.php | 97 +- .../src/Rize/UriTemplate/Node/Literal.php | 10 +- .../src/Rize/UriTemplate/Node/Variable.php | 26 +- .../Rize/UriTemplate/Operator/Abstraction.php | 345 +++--- .../src/Rize/UriTemplate/Operator/Named.php | 109 +- .../src/Rize/UriTemplate/Operator/UnNamed.php | 24 +- .../src/Rize/UriTemplate/Parser.php | 73 +- .../src/Rize/UriTemplate/UriTemplate.php | 6 +- .../tests/Rize/Uri/Node/ParserTest.php | 93 ++ .../tests/Rize/UriTemplateTest.php | 253 ++++ .../uri-template/tests/fixtures/README.md | 90 ++ .../tests/fixtures/extended-tests.json | 118 ++ .../uri-template/tests/fixtures/json2xml.xslt | 201 +++ .../tests/fixtures/negative-tests.json | 57 + .../fixtures/spec-examples-by-section.json | 439 +++++++ .../tests/fixtures/spec-examples.json | 218 ++++ .../tests/fixtures/transform-json-tests.xslt | 51 + .../symfony/deprecation-contracts/.gitignore | 3 - .../symfony/deprecation-contracts/LICENSE | 2 +- .../symfony/deprecation-contracts/README.md | 2 +- .../deprecation-contracts/composer.json | 4 +- .../vendor/symfony/polyfill-php81/LICENSE | 19 - .../vendor/symfony/polyfill-php81/Php81.php | 37 - .../vendor/symfony/polyfill-php81/README.md | 18 - .../Resources/stubs/CURLStringFile.php | 51 - .../Resources/stubs/ReturnTypeWillChange.php | 20 - .../symfony/polyfill-php81/bootstrap.php | 28 - .../symfony/polyfill-php81/composer.json | 33 - lib/classes/class-bootstrap.php | 2 +- lib/classes/class-settings.php | 32 +- readme.md | 2 +- readme.txt | 15 +- vendor/composer/installed.json | 16 +- vendor/composer/installed.php | 16 +- vendor/composer/platform_check.php | 4 +- vendor/udx/lib-ud-api-client/changes.md | 4 + vendor/udx/lib-ud-api-client/gruntfile.js | 2 +- .../lib/classes/class-admin.php | 40 +- .../lib/classes/class-bootstrap.php | 2 +- vendor/udx/lib-ud-api-client/package.json | 2 +- .../meta-box/css/select-advanced.css | 2 - vendor/wpmetabox/meta-box/inc/field.php | 2 +- .../meta-box/inc/fields/file-upload.php | 8 - .../meta-box/inc/fields/image-advanced.php | 8 - .../meta-box/inc/fields/image-upload.php | 8 - vendor/wpmetabox/meta-box/inc/fields/map.php | 14 +- .../wpmetabox/meta-box/inc/fields/media.php | 11 - .../wpmetabox/meta-box/inc/fields/oembed.php | 2 +- vendor/wpmetabox/meta-box/inc/fields/osm.php | 14 +- .../wpmetabox/meta-box/inc/fields/video.php | 8 - vendor/wpmetabox/meta-box/inc/loader.php | 2 +- vendor/wpmetabox/meta-box/inc/meta-box.php | 7 + .../meta-box/inc/templates/audio.php | 42 - .../meta-box/inc/templates/image-advanced.php | 29 - .../meta-box/inc/templates/media.php | 55 - .../meta-box/inc/templates/upload.php | 9 - .../meta-box/inc/templates/video.php | 37 - vendor/wpmetabox/meta-box/js/file-upload.js | 12 +- .../wpmetabox/meta-box/js/image-advanced.js | 32 +- vendor/wpmetabox/meta-box/js/image-upload.js | 4 + vendor/wpmetabox/meta-box/js/map-frontend.js | 2 +- vendor/wpmetabox/meta-box/js/map.js | 2 +- vendor/wpmetabox/meta-box/js/media.js | 96 +- vendor/wpmetabox/meta-box/js/osm-frontend.js | 2 +- vendor/wpmetabox/meta-box/js/osm.js | 4 +- .../wpmetabox/meta-box/js/select-advanced.js | 2 +- vendor/wpmetabox/meta-box/js/video.js | 40 +- vendor/wpmetabox/meta-box/meta-box.php | 2 +- vendor/wpmetabox/meta-box/readme.txt | 23 +- .../meta-box/src/Dashboard/content.php | 6 +- .../meta-box/vendor/composer/installed.json | 8 +- .../meta-box/vendor/composer/installed.php | 14 +- .../vendor/wpmetabox/support/Data.php | 19 +- wp-stateless-media.php | 2 +- 306 files changed, 7400 insertions(+), 4216 deletions(-) delete mode 100644 lib/Google/CODE_OF_CONDUCT.md delete mode 100644 lib/Google/UPGRADING.md delete mode 100644 lib/Google/phpstan.neon.dist create mode 100644 lib/Google/vendor/brick/math/phpstan.neon create mode 100644 lib/Google/vendor/brick/math/src/Internal/CalculatorRegistry.php create mode 100644 lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerManagedEncryptionEnforcementConfig.php create mode 100644 lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig.php create mode 100644 lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionGoogleManagedEncryptionEnforcementConfig.php create mode 100644 lib/Google/vendor/google/apiclient-services/src/Storage/ObjectCustomContextPayload.php create mode 100644 lib/Google/vendor/google/apiclient-services/src/Storage/StorageObjectContexts.php delete mode 100644 lib/Google/vendor/ramsey/collection/conventional-commits.json rename lib/Google/vendor/ramsey/collection/src/Exception/{InvalidSortOrderException.php => CollectionException.php} (70%) rename lib/Google/vendor/ramsey/collection/src/Exception/{ValueExtractionException.php => InvalidPropertyOrMethod.php} (62%) create mode 100644 lib/Google/vendor/ramsey/collection/src/Sort.php create mode 100644 lib/Google/vendor/rize/uri-template/.php-cs-fixer.dist.php create mode 100644 lib/Google/vendor/rize/uri-template/phpstan.neon create mode 100644 lib/Google/vendor/rize/uri-template/phpunit.xml create mode 100644 lib/Google/vendor/rize/uri-template/tests/Rize/Uri/Node/ParserTest.php create mode 100644 lib/Google/vendor/rize/uri-template/tests/Rize/UriTemplateTest.php create mode 100644 lib/Google/vendor/rize/uri-template/tests/fixtures/README.md create mode 100644 lib/Google/vendor/rize/uri-template/tests/fixtures/extended-tests.json create mode 100644 lib/Google/vendor/rize/uri-template/tests/fixtures/json2xml.xslt create mode 100644 lib/Google/vendor/rize/uri-template/tests/fixtures/negative-tests.json create mode 100644 lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples-by-section.json create mode 100644 lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples.json create mode 100644 lib/Google/vendor/rize/uri-template/tests/fixtures/transform-json-tests.xslt delete mode 100644 lib/Google/vendor/symfony/deprecation-contracts/.gitignore delete mode 100644 lib/Google/vendor/symfony/polyfill-php81/LICENSE delete mode 100644 lib/Google/vendor/symfony/polyfill-php81/Php81.php delete mode 100644 lib/Google/vendor/symfony/polyfill-php81/README.md delete mode 100644 lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php delete mode 100644 lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php delete mode 100644 lib/Google/vendor/symfony/polyfill-php81/bootstrap.php delete mode 100644 lib/Google/vendor/symfony/polyfill-php81/composer.json delete mode 100644 vendor/wpmetabox/meta-box/inc/templates/audio.php delete mode 100644 vendor/wpmetabox/meta-box/inc/templates/image-advanced.php delete mode 100644 vendor/wpmetabox/meta-box/inc/templates/media.php delete mode 100644 vendor/wpmetabox/meta-box/inc/templates/upload.php delete mode 100644 vendor/wpmetabox/meta-box/inc/templates/video.php diff --git a/changelog.txt b/changelog.txt index 6907e2082..0594344ae 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,11 @@ == Changelog == += 4.2.1 = +* **WP-Stateless 4.2.1 requires PHP 8.1 or higher, in accordance with the requirements of the official Google API PHP Client Library.** +* ENHANCEMENT - Updated Client library for Google APIs from 2.18.3 to 2.18.4. +* ENHANCEMENT - updated `wpmetabox/meta-box` library from 5.10.11 to 5.10.15. +* FIX - correctly loads text domain to prevent PHP notices. +* FIX - `udx/lib-ud-api-client` package correctly loads text domain to prevent PHP notices. + = 4.2.0 = * ENHANCEMENT - Updated Client library for Google APIs from 2.18.2 to 2.18.3. * ENHANCEMENT - updated `firebase/php-jwt` library from 6.10.2 to 6.11.1. diff --git a/changes.md b/changes.md index 715fb611f..c4a47c6ae 100644 --- a/changes.md +++ b/changes.md @@ -1,3 +1,10 @@ +#### 4.2.1 +* **WP-Stateless 4.2.1 requires PHP 8.1 or higher, in accordance with the requirements of the official Google API PHP Client Library.** +* ENHANCEMENT - Updated Client library for Google APIs from 2.18.3 to 2.18.4. +* ENHANCEMENT - updated `wpmetabox/meta-box` library from 5.10.11 to 5.10.15. +* FIX - correctly loads text domain to prevent PHP notices. +* FIX - `udx/lib-ud-api-client` package correctly loads text domain to prevent PHP notices. + #### 4.2.0 * ENHANCEMENT - Updated Client library for Google APIs from 2.18.2 to 2.18.3. * ENHANCEMENT - updated `firebase/php-jwt` library from 6.10.2 to 6.11.1. diff --git a/composer.json b/composer.json index 721af8298..2550671cc 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ } ], "require": { - "php": ">=5.6.20", + "php": "^8.1", "composer/installers": "~2.3", "ccampbell/chromephp": "^4.1", "firebase/php-jwt": "^6.1.2", diff --git a/composer.lock b/composer.lock index e58ec2b09..db02424b2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "13cd83cdebf4ee828cde231007ebdc17", + "content-hash": "55c60770c8e78c149499c574151711ae", "packages": [ { "name": "ccampbell/chromephp", @@ -264,15 +264,15 @@ }, { "name": "udx/lib-ud-api-client", - "version": "1.2.4", + "version": "1.2.5", "source": { "type": "git", "url": "git@github.com:udx/lib-ud-api-client", - "reference": "1.2.4" + "reference": "1.2.5" }, "dist": { "type": "zip", - "url": "https://github.com/udx/lib-ud-api-client/archive/1.2.4.zip" + "url": "https://github.com/udx/lib-ud-api-client/archive/1.2.5.zip" }, "require": { "php": ">=5.3" @@ -340,15 +340,15 @@ }, { "name": "wpackagist-plugin/meta-box", - "version": "5.10.11", + "version": "5.10.15", "source": { "type": "svn", "url": "https://plugins.svn.wordpress.org/meta-box/", - "reference": "tags/5.10.11" + "reference": "tags/5.10.15" }, "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/plugin/meta-box.5.10.11.zip" + "url": "https://downloads.wordpress.org/plugin/meta-box.5.10.15.zip" }, "require": { "composer/installers": "^1.0 || ^2.0" @@ -770,20 +770,20 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.0.2", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "type": "library", "extra": { @@ -792,7 +792,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.6-dev" } }, "autoload": { @@ -817,7 +817,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" }, "funding": [ { @@ -833,7 +833,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/finder", @@ -900,7 +900,7 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.32.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -959,7 +959,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.33.0" }, "funding": [ { @@ -970,6 +970,10 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -979,16 +983,16 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.32.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" + "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", - "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70", + "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70", "shasum": "" }, "require": { @@ -1037,7 +1041,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.33.0" }, "funding": [ { @@ -1048,16 +1052,20 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2025-06-27T09:58:17+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.32.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -1118,7 +1126,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.33.0" }, "funding": [ { @@ -1129,6 +1137,10 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -1138,7 +1150,7 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.32.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", @@ -1199,7 +1211,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0" }, "funding": [ { @@ -1210,6 +1222,10 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -1219,7 +1235,7 @@ }, { "name": "symfony/polyfill-php73", - "version": "v1.32.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", @@ -1275,7 +1291,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.33.0" }, "funding": [ { @@ -1286,6 +1302,10 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -1295,7 +1315,7 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.32.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", @@ -1355,7 +1375,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.33.0" }, "funding": [ { @@ -1366,6 +1386,10 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -1375,28 +1399,26 @@ }, { "name": "symfony/service-contracts", - "version": "v3.0.2", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66" + "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d78d39c1599bd1188b8e26bb341da52c3c6d8a66", - "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f021b05a130d35510bd6b25fe9053c2a8a15d5d4", + "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4", "shasum": "" }, "require": { - "php": ">=8.0.2", - "psr/container": "^2.0" + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" }, "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "type": "library", "extra": { "thanks": { @@ -1404,13 +1426,16 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.6-dev" } }, "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1437,7 +1462,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.0.2" + "source": "https://github.com/symfony/service-contracts/tree/v3.6.0" }, "funding": [ { @@ -1453,37 +1478,37 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:58+00:00" + "time": "2025-04-25T09:37:31+00:00" }, { "name": "symfony/string", - "version": "v6.0.19", + "version": "v6.4.26", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a" + "reference": "5621f039a71a11c87c106c1c598bdcd04a19aeea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/d9e72497367c23e08bf94176d2be45b00a9d232a", - "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a", + "url": "https://api.github.com/repos/symfony/string/zipball/5621f039a71a11c87c106c1c598bdcd04a19aeea", + "reference": "5621f039a71a11c87c106c1c598bdcd04a19aeea", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/error-handler": "^5.4|^6.0", - "symfony/http-client": "^5.4|^6.0", - "symfony/translation-contracts": "^2.0|^3.0", - "symfony/var-exporter": "^5.4|^6.0" + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/intl": "^6.2|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -1522,7 +1547,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.0.19" + "source": "https://github.com/symfony/string/tree/v6.4.26" }, "funding": [ { @@ -1533,12 +1558,16 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2023-01-01T08:36:10+00:00" + "time": "2025-09-11T14:32:46+00:00" } ], "aliases": [], @@ -1547,7 +1576,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.6.20" + "php": "^8.1" }, "platform-dev": [], "plugin-api-version": "2.6.0" diff --git a/lib/Google/CHANGELOG.md b/lib/Google/CHANGELOG.md index 00f046fb5..a0418c111 100644 --- a/lib/Google/CHANGELOG.md +++ b/lib/Google/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [2.18.4](https://github.com/googleapis/google-api-php-client/compare/v2.18.3...v2.18.4) (2025-09-29) + + +### Bug Fixes + +* Ensure credentials can be of type FetchAuthTokenInterface ([#2684](https://github.com/googleapis/google-api-php-client/issues/2684)) ([ed70802](https://github.com/googleapis/google-api-php-client/commit/ed70802cc4886ef1f513a2c0b56a8a972db5e7ab)) + +## [2.18.3](https://github.com/googleapis/google-api-php-client/compare/v2.18.2...v2.18.3) (2025-04-08) + + +### Bug Fixes + +* Convert Finder lazy iterator to array before deletion ([#2663](https://github.com/googleapis/google-api-php-client/issues/2663)) ([c699405](https://github.com/googleapis/google-api-php-client/commit/c6994051af1568359c97d267d9ef34ccbda31387)) + ## [2.18.2](https://github.com/googleapis/google-api-php-client/compare/v2.18.1...v2.18.2) (2024-12-16) diff --git a/lib/Google/CODE_OF_CONDUCT.md b/lib/Google/CODE_OF_CONDUCT.md deleted file mode 100644 index 46b2a08ea..000000000 --- a/lib/Google/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,43 +0,0 @@ -# Contributor Code of Conduct - -As contributors and maintainers of this project, -and in the interest of fostering an open and welcoming community, -we pledge to respect all people who contribute through reporting issues, -posting feature requests, updating documentation, -submitting pull requests or patches, and other activities. - -We are committed to making participation in this project -a harassment-free experience for everyone, -regardless of level of experience, gender, gender identity and expression, -sexual orientation, disability, personal appearance, -body size, race, ethnicity, age, religion, or nationality. - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery -* Personal attacks -* Trolling or insulting/derogatory comments -* Public or private harassment -* Publishing other's private information, -such as physical or electronic -addresses, without explicit permission -* Other unethical or unprofessional conduct. - -Project maintainers have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct. -By adopting this Code of Conduct, -project maintainers commit themselves to fairly and consistently -applying these principles to every aspect of managing this project. -Project maintainers who do not follow or enforce the Code of Conduct -may be permanently removed from the project team. - -This code of conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. - -Instances of abusive, harassing, or otherwise unacceptable behavior -may be reported by opening an issue -or contacting one or more of the project maintainers. - -This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, -available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) diff --git a/lib/Google/UPGRADING.md b/lib/Google/UPGRADING.md deleted file mode 100644 index ef939e943..000000000 --- a/lib/Google/UPGRADING.md +++ /dev/null @@ -1,377 +0,0 @@ -Google API Client Upgrade Guide -=============================== - -2.x to 2.10.0 -------------- - -### Namespaces - -The Google API Client for PHP now uses namespaces for all classes. Code using -the legacy classnames will continue to work, but it is advised to upgrade to the -underspaced names, as the legacy classnames will be deprecated some time in the -future. - -**Before** - -```php -$client = new Google_Client(); -$service = new Google_Service_Books($client); -``` - -**After** -```php -$client = new Google\Client(); -$service = new Google\Service\Books($client); -``` - -### Service class constructors - -Service class constructors now accept an optional `Google\Client|array` parameter -as their first argument, rather than requiring an instance of `Google\Client`. - -**Before** - -```php -$client = new Google_Client(); -$client->setApplicationName("Client_Library_Examples"); -$client->setDeveloperKey("YOUR_APP_KEY"); - -$service = new Google_Service_Books($client); -``` - -**After** - -```php -$service = new Google\Service\Books([ - 'application_name' => "Client_Library_Examples", - 'developer_key' => "YOUR_APP_KEY", -]); -``` - -1.0 to 2.0 ----------- - -The Google API Client for PHP has undergone major internal changes in `2.0`. Please read through -the list below in order to upgrade to the latest version: - -## Installation now uses `Composer` - -**Before** - -The project was cloned in your project and you would run the autoloader from wherever: - -```php -// the autoload file was included -require_once 'google-api-php-client/src/Google/autoload.php'; // or wherever autoload.php is located -// OR classes were added one-by-one -require_once 'Google/Client.php'; -require_once 'Google/Service/YouTube.php'; -``` - -**After** - -This library now uses [composer](https://getcomposer.org) (We suggest installing -composer [globally](http://symfony.com/doc/current/cookbook/composer.html)). Add this library by -running the following in the root of your project: - -``` -$ composer require google/apiclient:~2.0 -``` - -This will install this library and generate an autoload file in `vendor/autoload.php` in the root -of your project. You can now include this library with the following code: - -```php -require_once 'vendor/autoload.php'; -``` - -## Access Tokens are passed around as arrays instead of JSON strings - -**Before** - -```php -$accessToken = $client->getAccessToken(); -print_r($accessToken); -// would output: -// string(153) "{"access_token":"ya29.FAKsaByOPoddfzvKRo_LBpWWCpVTiAm4BjsvBwxtN7IgSNoUfcErBk_VPl4iAiE1ntb_","token_type":"Bearer","expires_in":3593,"created":1445548590}" -file_put_contents($credentialsPath, $accessToken); -``` - -**After** - -```php -$accessToken = $client->getAccessToken(); -print_r($accessToken); -// will output: -// array(4) { -// ["access_token"]=> -// string(73) "ya29.FAKsaByOPoddfzvKRo_LBpWWCpVTiAm4BjsvBwxtN7IgSNoUfcErBk_VPl4iAiE1ntb_" -// ["token_type"]=> -// string(6) "Bearer" -// ["expires_in"]=> -// int(3593) -// ["created"]=> -// int(1445548590) -// } -file_put_contents($credentialsPath, json_encode($accessToken)); -``` - -## ID Token data is returned as an array - -**Before** - -```php -$ticket = $client->verifyIdToken($idToken); -$data = $ticket->getAttributes(); -$userId = $data['payload']['sub']; -``` - -**After** - -```php -$userData = $client->verifyIdToken($idToken); -$userId = $userData['sub']; -``` - -## `Google_Auth_AssertionCredentials` has been removed - -For service accounts, we now use `setAuthConfig` or `useApplicationDefaultCredentials` - -**Before** - -```php -$client_email = '1234567890-a1b2c3d4e5f6g7h8i@developer.gserviceaccount.com'; -$private_key = file_get_contents('MyProject.p12'); -$scopes = array('https://www.googleapis.com/auth/sqlservice.admin'); -$credentials = new Google_Auth_AssertionCredentials( - $client_email, - $scopes, - $private_key -); -``` - -**After** - -```php -$client->setAuthConfig('/path/to/service-account.json'); - -// OR use environment variables (recommended) - -putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json'); -$client->useApplicationDefaultCredentials(); -``` - -> Note: P12s are deprecated in favor of service account JSON, which can be generated in the -> Credentials section of Google Developer Console. - -In order to impersonate a user, call `setSubject` when your service account -credentials are being used. - -**Before** - -```php -$user_to_impersonate = 'user@example.org'; -$credentials = new Google_Auth_AssertionCredentials( - $client_email, - $scopes, - $private_key, - 'notasecret', // Default P12 password - 'http://oauth.net/grant_type/jwt/1.0/bearer', // Default grant type - $user_to_impersonate, -); -``` - -**After** - -```php -$user_to_impersonate = 'user@example.org'; -$client->setSubject($user_to_impersonate); -``` - -Additionally, `Google_Client::loadServiceAccountJson` has been removed in favor -of `Google_Client::setAuthConfig`: - -**Before** - -```php -$scopes = [ Google_Service_Books::BOOKS ]; -$client->loadServiceAccountJson('/path/to/service-account.json', $scopes); -``` - -**After** - -```php -$scopes = [ Google_Service_Books::BOOKS ]; -$client->setAuthConfig('/path/to/service-account.json'); -$client->setScopes($scopes); -``` - -## `Google_Auth_AppIdentity` has been removed - -For App Engine authentication, we now use the underlying [`google/auth`][Google Auth] and -call `useApplicationDefaultCredentials`: - -**Before** - -```php -$client->setAuth(new Google_Auth_AppIdentity($client)); -$client->getAuth() - ->authenticateForScope('https://www.googleapis.com/auth/sqlservice.admin') -``` - -**After** - -```php -$client->useApplicationDefaultCredentials(); -$client->addScope('https://www.googleapis.com/auth/sqlservice.admin'); -``` - -This will detect when the App Engine environment is present, and use the appropriate credentials. - -## `Google_Auth_Abstract` classes have been removed - -[`google/auth`][Google Auth] is now used for authentication. As a result, all -`Google_Auth`-related functionality has been removed. The methods that were a part of -`Google_Auth_Abstract` have been moved into the `Google_Client` object. - -**Before** - -```php -$request = new Google_Http_Request(); -$client->getAuth()->sign($request); -``` - -**After** - -```php -// create an authorized HTTP client -$httpClient = $client->authorize(); - -// OR add authorization to an existing client -$httpClient = new GuzzleHttp\Client(); -$httpClient = $client->authorize($httpClient); -``` - -**Before** - -```php -$request = new Google_Http_Request(); -$response = $client->getAuth()->authenticatedRequest($request); -``` - -**After** - -```php -$httpClient = $client->authorize(); -$request = new GuzzleHttp\Psr7\Request('POST', $url); -$response = $httpClient->send($request); -``` - -> NOTE: `$request` can be any class implementing -> `Psr\Http\Message\RequestInterface` - -In addition, other methods that were callable on `Google_Auth_OAuth2` are now called -on the `Google_Client` object: - -**Before** - -```php -$client->getAuth()->refreshToken($token); -$client->getAuth()->refreshTokenWithAssertion(); -$client->getAuth()->revokeToken($token); -$client->getAuth()->isAccessTokenExpired(); -``` - -**After** - -```php -$client->refreshToken($token); -$client->refreshTokenWithAssertion(); -$client->revokeToken($token); -$client->isAccessTokenExpired(); -``` - -## PHP 5.6 is now the minimum supported PHP version - -This was previously `PHP 5.2`. If you still need to use PHP 5.2, please continue to use -the [v1-master](https://github.com/google/google-api-php-client/tree/v1-master) branch. - -## Guzzle and PSR-7 are used for HTTP Requests - -The HTTP library Guzzle is used for all HTTP Requests. By default, [`Guzzle 6`][Guzzle 6] -is used, but this library is also compatible with [`Guzzle 5`][Guzzle 5]. As a result, -all `Google_IO`-related functionality and `Google_Http`-related functionality has been -changed or removed. - -1. Removed `Google_Http_Request` -1. Removed `Google_IO_Abstract`, `Google_IO_Exception`, `Google_IO_Curl`, and `Google_IO_Stream` -1. Removed methods `Google_Client::getIo` and `Google_Client::setIo` -1. Refactored `Google_Http_Batch` and `Google_Http_MediaFileUpload` for Guzzle -1. Added `Google_Client::getHttpClient` and `Google_Client::setHttpClient` for getting and -setting the Guzzle `GuzzleHttp\ClientInterface` object. - -> NOTE: `PSR-7`-compatible libraries can now be used with this library. - -## Other Changes - - - [`PSR 3`][PSR 3] `LoggerInterface` is now supported, and [Monolog][Monolog] is used for all - logging. As a result, all `Google_Logger`-related functionality has been removed: - 1. Removed `Google_Logger_Abstract`, `Google_Logger_Exception`, `Google_Logger_File`, - `Google_Logger_Null`, and `Google_Logger_Psr` - 1. `Google_Client::setLogger` now requires `Psr\Log\LoggerInterface` - - [`firebase/jwt`][Firebase JWT] is now used for all JWT signing and verifying. As a result, the - following classes have been changed or removed: - 1. Removed `Google_Signer_P12` - 1. Removed `Google_Verifier_Pem` - 1. Removed `Google_Auth_LoginTicket` (see below) - - The following classes and methods have been removed in favor of [`google/auth`][Google Auth]: - 1. Removed methods `Google_Client::getAuth` and `Google_Client::setAuth` - 1. Removed `Google_Auth_Abstract` - - `Google_Auth_Abstract::sign` and `Google_Auth_Abstract::authenticatedRequest` have been - replaced by `Google_Client::authorize`. See the above examples for more details. - 1. Removed `Google_Auth_AppIdentity`. This is now supported in [`google/auth`][Google Auth AppIdentity] - and is used automatically when `Google_Client::useApplicationDefaultCredentials` is called. - 1. Removed `Google_Auth_AssertionCredentials`. Use `Google_Client::setAuthConfig` instead. - 1. Removed `Google_Auth_ComputeEngine`. This is now supported in - [`google/auth`][Google Auth GCE], and is used automatically when - `Google_Client::useApplicationDefaultCredentials` is called. - 1. Removed `Google_Auth_Exception` - 1. Removed `Google_Auth_LoginTicket`. Calls to `Google_Client::verifyIdToken` now returns - the payload of the ID Token as an array if the verification is successful. - 1. Removed `Google_Auth_OAuth2`. This functionality is now supported in [`google/auth`][Google Auth OAuth2] and wrapped in `Google_Client`. These changes will only affect applications calling `Google_Client::getAuth`, - as the methods on `Google_Client` have not changed. - 1. Removed `Google_Auth_Simple`. This is now supported in [`google/auth`][Google Auth Simple] - and is used automatically when `Google_Client::setDeveloperKey` is called. - - `Google_Client::sign` has been replaced by `Google_Client::authorize`. This function - now takes a `GuzzleHttp\ClientInterface` object and uses the following decision tree for - authentication: - 1. Uses Application Default Credentials when - `Google_Client::useApplicationDefaultCredentials` is called - - Looks for `GOOGLE_APPLICATION_CREDENTIALS` environment variable if set - - Looks in `~/.config/gcloud/application_default_credentials.json` - - Otherwise, uses `GCECredentials` - 1. Uses API Key if set (see `Client::setDeveloperKey`) - 1. Uses Access Token if set (call `Client::setAccessToken`) - 1. Automatically refreshes access tokens if one is set and the access token is expired - - Removed `Google_Config` - - Removed `Google_Utils` - - [`PSR-6`][PSR 6] cache is used for all caching. As a result: - 1. Removed `Google_Cache_Abstract` - 1. Classes `Google_Cache_Apc`, `Google_Cache_File`, `Google_Cache_Memcache`, and - `Google_Cache_Null` now implement `Google\Auth\CacheInterface`. - 1. Google Auth provides simple [caching utilities][Google Auth Cache] which - are used by default unless you provide alternatives. - - Removed `$boundary` constructor argument for `Google_Http_MediaFileUpload` - -[PSR 3]: https://www.php-fig.org/psr/psr-3/ -[PSR 6]: https://www.php-fig.org/psr/psr-6/ -[Guzzle 5]: https://github.com/guzzle/guzzle -[Guzzle 6]: http://docs.guzzlephp.org/en/latest/psr7.html -[Monolog]: https://github.com/Seldaek/monolog -[Google Auth]: https://github.com/google/google-auth-library-php -[Google Auth Cache]: https://github.com/googleapis/google-auth-library-php/tree/master/src/Cache -[Google Auth GCE]: https://github.com/google/google-auth-library-php/blob/master/src/GCECredentials.php -[Google Auth OAuth2]: https://github.com/google/google-auth-library-php/blob/master/src/OAuth2.php -[Google Auth Simple]: https://github.com/google/google-auth-library-php/blob/master/src/Simple.php -[Google Auth AppIdentity]: https://github.com/google/google-auth-library-php/blob/master/src/AppIdentityCredentials.php -[Firebase JWT]: https://github.com/firebase/php-jwt diff --git a/lib/Google/composer.json b/lib/Google/composer.json index d9b165f42..fbc7e9f1d 100644 --- a/lib/Google/composer.json +++ b/lib/Google/composer.json @@ -6,7 +6,7 @@ "homepage": "http://developers.google.com/api-client-library/php", "license": "Apache-2.0", "require": { - "php": "^8.0", + "php": "^8.1", "google/auth": "^1.37", "google/apiclient-services": "~0.350", "firebase/php-jwt": "^6.0", @@ -21,6 +21,7 @@ "squizlabs/php_codesniffer": "^3.8", "symfony/dom-crawler": "~2.1", "symfony/css-selector": "~2.1", + "cache/filesystem-adapter": "^1.1", "phpcompatibility/php-compatibility": "^9.2", "composer/composer": "^1.10.23", "phpspec/prophecy-phpunit": "^2.1", diff --git a/lib/Google/composer.lock b/lib/Google/composer.lock index 4d755c492..e99036f19 100644 --- a/lib/Google/composer.lock +++ b/lib/Google/composer.lock @@ -4,29 +4,29 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ec2e2b541c95b7d592511c65e81a0226", + "content-hash": "2a5070868f1102d5ee547428a26ffd25", "packages": [ { "name": "brick/math", - "version": "0.11.0", + "version": "0.14.0", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478" + "reference": "113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/0ad82ce168c82ba30d1c01ec86116ab52f589478", - "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478", + "url": "https://api.github.com/repos/brick/math/zipball/113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2", + "reference": "113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2", "shasum": "" }, "require": { - "php": "^8.0" + "php": "^8.2" }, "require-dev": { "php-coveralls/php-coveralls": "^2.2", - "phpunit/phpunit": "^9.0", - "vimeo/psalm": "5.0.0" + "phpstan/phpstan": "2.1.22", + "phpunit/phpunit": "^11.5" }, "type": "library", "autoload": { @@ -46,12 +46,17 @@ "arithmetic", "bigdecimal", "bignum", + "bignumber", "brick", - "math" + "decimal", + "integer", + "math", + "mathematics", + "rational" ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.11.0" + "source": "https://github.com/brick/math/tree/0.14.0" }, "funding": [ { @@ -59,7 +64,7 @@ "type": "github" } ], - "time": "2023-01-15T23:15:59+00:00" + "time": "2025-08-29T12:40:03+00:00" }, { "name": "firebase/php-jwt", @@ -126,20 +131,20 @@ }, { "name": "google/apiclient-services", - "version": "v0.396.0", + "version": "v0.415.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "ceb2e432e4326c6775d24f62d554395a1a9ad3dd" + "reference": "080bdeb1d5243429164dc589b69426bae98dad1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/ceb2e432e4326c6775d24f62d554395a1a9ad3dd", - "reference": "ceb2e432e4326c6775d24f62d554395a1a9ad3dd", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/080bdeb1d5243429164dc589b69426bae98dad1d", + "reference": "080bdeb1d5243429164dc589b69426bae98dad1d", "shasum": "" }, "require": { - "php": "^8.0" + "php": "^8.1" }, "require-dev": { "phpunit/phpunit": "^9.6" @@ -164,29 +169,29 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.396.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.415.0" }, - "time": "2025-02-24T01:10:27+00:00" + "time": "2025-10-05T01:02:15+00:00" }, { "name": "google/auth", - "version": "v1.42.0", + "version": "v1.44.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "0c25599a91530b5847f129b271c536f75a7563f5" + "reference": "5670e56307d7a2eac931f677c0e59a4f8abb2e43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/0c25599a91530b5847f129b271c536f75a7563f5", - "reference": "0c25599a91530b5847f129b271c536f75a7563f5", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/5670e56307d7a2eac931f677c0e59a4f8abb2e43", + "reference": "5670e56307d7a2eac931f677c0e59a4f8abb2e43", "shasum": "" }, "require": { "firebase/php-jwt": "^6.0", "guzzlehttp/guzzle": "^7.4.5", "guzzlehttp/psr7": "^2.4.5", - "php": "^8.0", + "php": "^8.1", "psr/cache": "^2.0||^3.0", "psr/http-message": "^1.1||^2.0" }, @@ -224,9 +229,9 @@ "support": { "docs": "https://googleapis.github.io/google-auth-library-php/main/", "issues": "https://github.com/googleapis/google-auth-library-php/issues", - "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.42.0" + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.44.0" }, - "time": "2024-08-26T18:33:48+00:00" + "time": "2024-12-04T15:34:58+00:00" }, { "name": "google/cloud-core", @@ -296,21 +301,21 @@ }, { "name": "google/cloud-storage", - "version": "v1.48.1", + "version": "v1.48.4", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-storage.git", - "reference": "509b095c3ea44db92c9e62a94b5773563c831821" + "reference": "4b81b682f6b1517c0c5f6152b2980195d23c1cef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/509b095c3ea44db92c9e62a94b5773563c831821", - "reference": "509b095c3ea44db92c9e62a94b5773563c831821", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/4b81b682f6b1517c0c5f6152b2980195d23c1cef", + "reference": "4b81b682f6b1517c0c5f6152b2980195d23c1cef", "shasum": "" }, "require": { "google/cloud-core": "^1.57", - "php": "^8.0", + "php": "^8.1", "ramsey/uuid": "^4.2.3" }, "require-dev": { @@ -347,27 +352,27 @@ ], "description": "Cloud Storage Client for PHP", "support": { - "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.48.1" + "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.48.4" }, - "time": "2025-05-20T19:49:54+00:00" + "time": "2025-10-01T16:57:30+00:00" }, { "name": "google/common-protos", - "version": "4.12.1", + "version": "4.12.4", "source": { "type": "git", "url": "https://github.com/googleapis/common-protos-php.git", - "reference": "70c4eb1abab5484a23c17a43b0d455259f5d8c1b" + "reference": "0127156899af0df2681bd42024c60bd5360d64e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/70c4eb1abab5484a23c17a43b0d455259f5d8c1b", - "reference": "70c4eb1abab5484a23c17a43b0d455259f5d8c1b", + "url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/0127156899af0df2681bd42024c60bd5360d64e3", + "reference": "0127156899af0df2681bd42024c60bd5360d64e3", "shasum": "" }, "require": { - "google/protobuf": "^v3.25.3||^4.26.1", - "php": "^8.0" + "google/protobuf": "^4.31", + "php": "^8.1" }, "require-dev": { "phpunit/phpunit": "^9.6" @@ -406,9 +411,9 @@ "google" ], "support": { - "source": "https://github.com/googleapis/common-protos-php/tree/v4.12.1" + "source": "https://github.com/googleapis/common-protos-php/tree/v4.12.4" }, - "time": "2025-05-20T19:49:54+00:00" + "time": "2025-09-20T01:29:44+00:00" }, { "name": "google/gax", @@ -514,20 +519,20 @@ }, { "name": "google/longrunning", - "version": "0.4.7", + "version": "0.5.0", "source": { "type": "git", "url": "https://github.com/googleapis/php-longrunning.git", - "reference": "624cabb874c10e5ddc9034c999f724894b70a3d3" + "reference": "715519ab4aaf3c4268adb2b551ee0f34135c8c5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/php-longrunning/zipball/624cabb874c10e5ddc9034c999f724894b70a3d3", - "reference": "624cabb874c10e5ddc9034c999f724894b70a3d3", + "url": "https://api.github.com/repos/googleapis/php-longrunning/zipball/715519ab4aaf3c4268adb2b551ee0f34135c8c5f", + "reference": "715519ab4aaf3c4268adb2b551ee0f34135c8c5f", "shasum": "" }, "require-dev": { - "google/gax": "^1.36.0", + "google/gax": "^1.38.0", "phpunit/phpunit": "^9.0" }, "type": "library", @@ -552,29 +557,29 @@ ], "description": "Google LongRunning Client for PHP", "support": { - "source": "https://github.com/googleapis/php-longrunning/tree/v0.4.7" + "source": "https://github.com/googleapis/php-longrunning/tree/v0.5.0" }, - "time": "2025-01-24T21:24:06+00:00" + "time": "2025-09-20T01:29:44+00:00" }, { "name": "google/protobuf", - "version": "v4.31.1", + "version": "v4.32.1", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "2b028ce8876254e2acbeceea7d9b573faad41864" + "reference": "c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/2b028ce8876254e2acbeceea7d9b573faad41864", - "reference": "2b028ce8876254e2acbeceea7d9b573faad41864", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb", + "reference": "c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb", "shasum": "" }, "require": { - "php": ">=7.0.0" + "php": ">=8.1.0" }, "require-dev": { - "phpunit/phpunit": ">=5.0.0" + "phpunit/phpunit": ">=5.0.0 <8.5.27" }, "suggest": { "ext-bcmath": "Need to support JSON deserialization" @@ -596,22 +601,22 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.31.1" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.32.1" }, - "time": "2025-05-28T18:52:35+00:00" + "time": "2025-09-14T05:14:52+00:00" }, { "name": "grpc/grpc", - "version": "1.57.0", + "version": "1.74.0", "source": { "type": "git", "url": "https://github.com/grpc/grpc-php.git", - "reference": "b610c42022ed3a22f831439cb93802f2a4502fdf" + "reference": "32bf4dba256d60d395582fb6e4e8d3936bcdb713" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/grpc/grpc-php/zipball/b610c42022ed3a22f831439cb93802f2a4502fdf", - "reference": "b610c42022ed3a22f831439cb93802f2a4502fdf", + "url": "https://api.github.com/repos/grpc/grpc-php/zipball/32bf4dba256d60d395582fb6e4e8d3936bcdb713", + "reference": "32bf4dba256d60d395582fb6e4e8d3936bcdb713", "shasum": "" }, "require": { @@ -640,28 +645,28 @@ "rpc" ], "support": { - "source": "https://github.com/grpc/grpc-php/tree/v1.57.0" + "source": "https://github.com/grpc/grpc-php/tree/v1.74.0" }, - "time": "2023-08-14T23:57:54+00:00" + "time": "2025-07-24T20:02:16+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.9.3", + "version": "7.10.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" + "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", - "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", + "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0.3", - "guzzlehttp/psr7": "^2.7.0", + "guzzlehttp/promises": "^2.3", + "guzzlehttp/psr7": "^2.8", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -752,7 +757,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.9.3" + "source": "https://github.com/guzzle/guzzle/tree/7.10.0" }, "funding": [ { @@ -768,20 +773,20 @@ "type": "tidelift" } ], - "time": "2025-03-27T13:37:11+00:00" + "time": "2025-08-23T22:36:01+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.2.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" + "reference": "481557b130ef3790cf82b713667b43030dc9c957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", - "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", + "url": "https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957", + "reference": "481557b130ef3790cf82b713667b43030dc9c957", "shasum": "" }, "require": { @@ -789,7 +794,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.39 || ^9.6.20" + "phpunit/phpunit": "^8.5.44 || ^9.6.25" }, "type": "library", "extra": { @@ -835,7 +840,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.2.0" + "source": "https://github.com/guzzle/promises/tree/2.3.0" }, "funding": [ { @@ -851,20 +856,20 @@ "type": "tidelift" } ], - "time": "2025-03-27T13:27:01+00:00" + "time": "2025-08-22T14:34:08+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.7.1", + "version": "2.8.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16" + "reference": "21dc724a0583619cd1652f673303492272778051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16", - "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051", + "reference": "21dc724a0583619cd1652f673303492272778051", "shasum": "" }, "require": { @@ -880,7 +885,7 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "http-interop/http-factory-tests": "0.9.0", - "phpunit/phpunit": "^8.5.39 || ^9.6.20" + "phpunit/phpunit": "^8.5.44 || ^9.6.25" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -951,7 +956,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.7.1" + "source": "https://github.com/guzzle/psr7/tree/2.8.0" }, "funding": [ { @@ -967,7 +972,7 @@ "type": "tidelift" } ], - "time": "2025-03-27T12:30:47+00:00" + "time": "2025-08-23T21:21:41+00:00" }, { "name": "monolog/monolog", @@ -1073,24 +1078,26 @@ }, { "name": "paragonie/constant_time_encoding", - "version": "v3.0.0", + "version": "v3.1.3", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "df1e7fde177501eee2037dd159cf04f5f301a512" + "reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/df1e7fde177501eee2037dd159cf04f5f301a512", - "reference": "df1e7fde177501eee2037dd159cf04f5f301a512", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77", + "reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77", "shasum": "" }, "require": { "php": "^8" }, "require-dev": { - "phpunit/phpunit": "^9", - "vimeo/psalm": "^4|^5" + "infection/infection": "^0", + "nikic/php-fuzzer": "^0", + "phpunit/phpunit": "^9|^10|^11", + "vimeo/psalm": "^4|^5|^6" }, "type": "library", "autoload": { @@ -1136,7 +1143,7 @@ "issues": "https://github.com/paragonie/constant_time_encoding/issues", "source": "https://github.com/paragonie/constant_time_encoding" }, - "time": "2024-05-08T12:36:18+00:00" + "time": "2025-09-24T15:06:41+00:00" }, { "name": "paragonie/random_compat", @@ -1190,16 +1197,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.43", + "version": "3.0.47", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "709ec107af3cb2f385b9617be72af8cf62441d02" + "reference": "9d6ca36a6c2dd434765b1071b2644a1c683b385d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/709ec107af3cb2f385b9617be72af8cf62441d02", - "reference": "709ec107af3cb2f385b9617be72af8cf62441d02", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/9d6ca36a6c2dd434765b1071b2644a1c683b385d", + "reference": "9d6ca36a6c2dd434765b1071b2644a1c683b385d", "shasum": "" }, "require": { @@ -1280,7 +1287,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.43" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.47" }, "funding": [ { @@ -1296,20 +1303,20 @@ "type": "tidelift" } ], - "time": "2024-12-14T21:12:59+00:00" + "time": "2025-10-06T01:07:24+00:00" }, { "name": "psr/cache", - "version": "3.0.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "url": "https://api.github.com/repos/php-fig/cache/zipball/213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", "shasum": "" }, "require": { @@ -1343,9 +1350,9 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/3.0.0" + "source": "https://github.com/php-fig/cache/tree/2.0.0" }, - "time": "2021-02-03T23:26:27+00:00" + "time": "2021-02-03T23:23:37+00:00" }, { "name": "psr/http-client", @@ -1603,43 +1610,39 @@ }, { "name": "ramsey/collection", - "version": "1.3.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/ramsey/collection.git", - "reference": "ad7475d1c9e70b190ecffc58f2d989416af339b4" + "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/ad7475d1c9e70b190ecffc58f2d989416af339b4", - "reference": "ad7475d1c9e70b190ecffc58f2d989416af339b4", + "url": "https://api.github.com/repos/ramsey/collection/zipball/344572933ad0181accbf4ba763e85a0306a8c5e2", + "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2", "shasum": "" }, "require": { - "php": "^7.4 || ^8.0", - "symfony/polyfill-php81": "^1.23" + "php": "^8.1" }, "require-dev": { "captainhook/plugin-composer": "^5.3", - "ergebnis/composer-normalize": "^2.28.3", - "fakerphp/faker": "^1.21", + "ergebnis/composer-normalize": "^2.45", + "fakerphp/faker": "^1.24", "hamcrest/hamcrest-php": "^2.0", - "jangregor/phpstan-prophecy": "^1.0", - "mockery/mockery": "^1.5", + "jangregor/phpstan-prophecy": "^2.1", + "mockery/mockery": "^1.6", "php-parallel-lint/php-console-highlighter": "^1.0", - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpcsstandards/phpcsutils": "^1.0.0-rc1", - "phpspec/prophecy-phpunit": "^2.0", - "phpstan/extension-installer": "^1.2", - "phpstan/phpstan": "^1.9", - "phpstan/phpstan-mockery": "^1.1", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5", - "psalm/plugin-mockery": "^1.1", - "psalm/plugin-phpunit": "^0.18.4", - "ramsey/coding-standard": "^2.0.3", - "ramsey/conventional-commits": "^1.3", - "vimeo/psalm": "^5.4" + "php-parallel-lint/php-parallel-lint": "^1.4", + "phpspec/prophecy-phpunit": "^2.3", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-mockery": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^10.5", + "ramsey/coding-standard": "^2.3", + "ramsey/conventional-commits": "^1.6", + "roave/security-advisories": "dev-latest" }, "type": "library", "extra": { @@ -1677,36 +1680,26 @@ ], "support": { "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/1.3.0" + "source": "https://github.com/ramsey/collection/tree/2.1.1" }, - "funding": [ - { - "url": "https://github.com/ramsey", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/ramsey/collection", - "type": "tidelift" - } - ], - "time": "2022-12-27T19:12:24+00:00" + "time": "2025-03-22T05:38:12+00:00" }, { "name": "ramsey/uuid", - "version": "4.9.0", + "version": "4.9.1", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0" + "reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/4e0e23cc785f0724a0e838279a9eb03f28b092a0", - "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/81f941f6f729b1e3ceea61d9d014f8b6c6800440", + "reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440", "shasum": "" }, "require": { - "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13", + "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14", "php": "^8.0", "ramsey/collection": "^1.2 || ^2.0" }, @@ -1765,29 +1758,31 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.9.0" + "source": "https://github.com/ramsey/uuid/tree/4.9.1" }, - "time": "2025-06-25T14:20:11+00:00" + "time": "2025-09-04T20:59:21+00:00" }, { "name": "rize/uri-template", - "version": "0.3.8", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/rize/UriTemplate.git", - "reference": "34a5b96d0b65a5dddb7d20f09b6527a43faede24" + "reference": "56f374a9a42c7c3998f8b55b6b21b224de90c58b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rize/UriTemplate/zipball/34a5b96d0b65a5dddb7d20f09b6527a43faede24", - "reference": "34a5b96d0b65a5dddb7d20f09b6527a43faede24", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/56f374a9a42c7c3998f8b55b6b21b224de90c58b", + "reference": "56f374a9a42c7c3998f8b55b6b21b224de90c58b", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "~4.8.36" + "friendsofphp/php-cs-fixer": "^3.63", + "phpstan/phpstan": "^1.12", + "phpunit/phpunit": "~10.0" }, "type": "library", "autoload": { @@ -1813,7 +1808,7 @@ ], "support": { "issues": "https://github.com/rize/UriTemplate/issues", - "source": "https://github.com/rize/UriTemplate/tree/0.3.8" + "source": "https://github.com/rize/UriTemplate/tree/0.4.0" }, "funding": [ { @@ -1829,24 +1824,24 @@ "type": "open_collective" } ], - "time": "2024-08-30T07:09:40+00:00" + "time": "2024-11-27T12:13:42+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.0.2", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "type": "library", "extra": { @@ -1855,7 +1850,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.6-dev" } }, "autoload": { @@ -1880,7 +1875,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" }, "funding": [ { @@ -1896,41 +1891,115 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2024-09-25T14:21:43+00:00" + } + ], + "packages-dev": [ + { + "name": "cache/adapter-common", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/php-cache/adapter-common.git", + "reference": "8788309be72aa7be69b88cdc0687549c74a7d479" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-cache/adapter-common/zipball/8788309be72aa7be69b88cdc0687549c74a7d479", + "reference": "8788309be72aa7be69b88cdc0687549c74a7d479", + "shasum": "" + }, + "require": { + "cache/tag-interop": "^1.0", + "php": ">=7.4", + "psr/cache": "^1.0 || ^2.0", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "psr/simple-cache": "^1.0" + }, + "require-dev": { + "cache/integration-tests": "^0.17", + "phpunit/phpunit": "^7.5.20 || ^9.5.10" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Cache\\Adapter\\Common\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Scherer", + "email": "aequasi@gmail.com", + "homepage": "https://github.com/aequasi" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/nyholm" + } + ], + "description": "Common classes for PSR-6 adapters", + "homepage": "http://www.php-cache.com/en/latest/", + "keywords": [ + "cache", + "psr-6", + "tag" + ], + "support": { + "source": "https://github.com/php-cache/adapter-common/tree/1.3.0" + }, + "time": "2022-01-15T15:47:19+00:00" }, { - "name": "symfony/polyfill-php81", - "version": "v1.32.0", + "name": "cache/filesystem-adapter", + "version": "1.2.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" + "url": "https://github.com/php-cache/filesystem-adapter.git", + "reference": "f1faaae40aaa696ef899cef6f6888aedb90b419b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", - "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "url": "https://api.github.com/repos/php-cache/filesystem-adapter/zipball/f1faaae40aaa696ef899cef6f6888aedb90b419b", + "reference": "f1faaae40aaa696ef899cef6f6888aedb90b419b", "shasum": "" }, "require": { - "php": ">=7.2" + "cache/adapter-common": "^1.0", + "league/flysystem": "^1.0", + "php": ">=7.4", + "psr/cache": "^1.0 || ^2.0", + "psr/simple-cache": "^1.0" + }, + "provide": { + "psr/cache-implementation": "^1.0", + "psr/simple-cache-implementation": "^1.0" + }, + "require-dev": { + "cache/integration-tests": "^0.17", + "phpunit/phpunit": "^7.5.20 || ^9.5.10" }, "type": "library", "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" + "branch-alias": { + "dev-master": "1.1-dev" } }, "autoload": { - "files": [ - "bootstrap.php" - ], "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" + "Cache\\Adapter\\Filesystem\\": "" }, - "classmap": [ - "Resources/stubs" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1939,55 +2008,100 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Aaron Scherer", + "email": "aequasi@gmail.com", + "homepage": "https://github.com/aequasi" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/nyholm" } ], - "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", - "homepage": "https://symfony.com", + "description": "A PSR-6 cache implementation using filesystem. This implementation supports tags", + "homepage": "http://www.php-cache.com/en/latest/", "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" + "cache", + "filesystem", + "psr-6", + "tag" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.32.0" + "source": "https://github.com/php-cache/filesystem-adapter/tree/1.2.0" }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, + "time": "2022-01-15T15:47:19+00:00" + }, + { + "name": "cache/tag-interop", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-cache/tag-interop.git", + "reference": "b062b1d735357da50edf8387f7a8696f3027d328" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-cache/tag-interop/zipball/b062b1d735357da50edf8387f7a8696f3027d328", + "reference": "b062b1d735357da50edf8387f7a8696f3027d328", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0 || ^8.0", + "psr/cache": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Cache\\TagInterop\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ { - "url": "https://github.com/fabpot", - "type": "github" + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/nyholm" }, { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" + "name": "Nicolas Grekas", + "email": "p@tchwork.com", + "homepage": "https://github.com/nicolas-grekas" } ], - "time": "2024-09-09T11:45:10+00:00" - } - ], - "packages-dev": [ + "description": "Framework interoperable interfaces for tags", + "homepage": "https://www.php-cache.com/en/latest/", + "keywords": [ + "cache", + "psr", + "psr6", + "tag" + ], + "support": { + "issues": "https://github.com/php-cache/tag-interop/issues", + "source": "https://github.com/php-cache/tag-interop/tree/1.1.0" + }, + "time": "2021-12-31T10:03:23+00:00" + }, { "name": "composer/ca-bundle", - "version": "1.5.6", + "version": "1.5.8", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "f65c239c970e7f072f067ab78646e9f0b2935175" + "reference": "719026bb30813accb68271fee7e39552a58e9f65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/f65c239c970e7f072f067ab78646e9f0b2935175", - "reference": "f65c239c970e7f072f067ab78646e9f0b2935175", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/719026bb30813accb68271fee7e39552a58e9f65", + "reference": "719026bb30813accb68271fee7e39552a58e9f65", "shasum": "" }, "require": { @@ -2034,7 +2148,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.5.6" + "source": "https://github.com/composer/ca-bundle/tree/1.5.8" }, "funding": [ { @@ -2044,13 +2158,9 @@ { "url": "https://github.com/composer", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" } ], - "time": "2025-03-06T14:30:56+00:00" + "time": "2025-08-20T18:49:47+00:00" }, { "name": "composer/composer", @@ -2233,24 +2343,24 @@ }, { "name": "composer/spdx-licenses", - "version": "1.5.8", + "version": "1.5.9", "source": { "type": "git", "url": "https://github.com/composer/spdx-licenses.git", - "reference": "560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a" + "reference": "edf364cefe8c43501e21e88110aac10b284c3c9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a", - "reference": "560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/edf364cefe8c43501e21e88110aac10b284c3c9f", + "reference": "edf364cefe8c43501e21e88110aac10b284c3c9f", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.55", - "symfony/phpunit-bridge": "^4.2 || ^5" + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" }, "type": "library", "extra": { @@ -2293,7 +2403,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/spdx-licenses/issues", - "source": "https://github.com/composer/spdx-licenses/tree/1.5.8" + "source": "https://github.com/composer/spdx-licenses/tree/1.5.9" }, "funding": [ { @@ -2309,7 +2419,7 @@ "type": "tidelift" } ], - "time": "2023-11-20T07:44:33+00:00" + "time": "2025-05-12T21:07:07+00:00" }, { "name": "composer/xdebug-handler", @@ -2425,30 +2535,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.5.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^11", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.30 || ^5.4" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", "autoload": { @@ -2475,7 +2585,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -2491,7 +2601,7 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:15:36+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "justinrainbow/json-schema", @@ -2558,18 +2668,168 @@ }, "time": "2024-07-06T21:00:26+00:00" }, + { + "name": "league/flysystem", + "version": "1.1.10", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "3239285c825c152bcc315fe0e87d6b55f5972ed1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/3239285c825c152bcc315fe0e87d6b55f5972ed1", + "reference": "3239285c825c152bcc315fe0e87d6b55f5972ed1", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "league/mime-type-detection": "^1.3", + "php": "^7.2.5 || ^8.0" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" + }, + "require-dev": { + "phpspec/prophecy": "^1.11.1", + "phpunit/phpunit": "^8.5.8" + }, + "suggest": { + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "Cloud Files", + "WebDAV", + "abstraction", + "aws", + "cloud", + "copy.com", + "dropbox", + "file systems", + "files", + "filesystem", + "filesystems", + "ftp", + "rackspace", + "remote", + "s3", + "sftp", + "storage" + ], + "support": { + "issues": "https://github.com/thephpleague/flysystem/issues", + "source": "https://github.com/thephpleague/flysystem/tree/1.1.10" + }, + "funding": [ + { + "url": "https://offset.earth/frankdejonge", + "type": "other" + } + ], + "time": "2022-10-04T09:16:37+00:00" + }, + { + "name": "league/mime-type-detection", + "version": "1.16.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/mime-type-detection.git", + "reference": "2d6702ff215bf922936ccc1ad31007edc76451b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/2d6702ff215bf922936ccc1ad31007edc76451b9", + "reference": "2d6702ff215bf922936ccc1ad31007edc76451b9", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.2", + "phpstan/phpstan": "^0.12.68", + "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\MimeTypeDetection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "description": "Mime-type detection for Flysystem", + "support": { + "issues": "https://github.com/thephpleague/mime-type-detection/issues", + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.16.0" + }, + "funding": [ + { + "url": "https://github.com/frankdejonge", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/flysystem", + "type": "tidelift" + } + ], + "time": "2024-09-21T08:32:55+00:00" + }, { "name": "myclabs/deep-copy", - "version": "1.13.1", + "version": "1.13.4", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c" + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/1720ddd719e16cf0db4eb1c6eca108031636d46c", - "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a", "shasum": "" }, "require": { @@ -2608,7 +2868,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.13.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4" }, "funding": [ { @@ -2616,20 +2876,20 @@ "type": "tidelift" } ], - "time": "2025-04-29T12:36:36+00:00" + "time": "2025-08-01T08:46:24+00:00" }, { "name": "nikic/php-parser", - "version": "v5.4.0", + "version": "v5.6.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "447a020a1f875a434d62f2a401f53b82a396e494" + "reference": "f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494", - "reference": "447a020a1f875a434d62f2a401f53b82a396e494", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2", + "reference": "f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2", "shasum": "" }, "require": { @@ -2648,7 +2908,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.x-dev" } }, "autoload": { @@ -2672,9 +2932,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.6.1" }, - "time": "2024-12-30T11:07:19+00:00" + "time": "2025-08-13T20:13:15+00:00" }, { "name": "phar-io/manifest", @@ -2911,16 +3171,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.6.2", + "version": "5.6.3", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "92dde6a5919e34835c506ac8c523ef095a95ed62" + "reference": "94f8051919d1b0369a6bcc7931d679a511c03fe9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/92dde6a5919e34835c506ac8c523ef095a95ed62", - "reference": "92dde6a5919e34835c506ac8c523ef095a95ed62", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94f8051919d1b0369a6bcc7931d679a511c03fe9", + "reference": "94f8051919d1b0369a6bcc7931d679a511c03fe9", "shasum": "" }, "require": { @@ -2969,9 +3229,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.2" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.3" }, - "time": "2025-04-13T19:20:35+00:00" + "time": "2025-08-01T19:43:32+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -3033,30 +3293,31 @@ }, { "name": "phpspec/prophecy", - "version": "v1.22.0", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "35f1adb388946d92e6edab2aa2cb2b60e132ebd5" + "reference": "8cce4df9a20660cdc671e8f45ac61959ecdde8e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/35f1adb388946d92e6edab2aa2cb2b60e132ebd5", - "reference": "35f1adb388946d92e6edab2aa2cb2b60e132ebd5", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/8cce4df9a20660cdc671e8f45ac61959ecdde8e8", + "reference": "8cce4df9a20660cdc671e8f45ac61959ecdde8e8", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2 || ^2.0", - "php": "^7.4 || 8.0.* || 8.1.* || 8.2.* || 8.3.* || 8.4.*", + "php": "8.2.* || 8.3.* || 8.4.*", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", - "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0" + "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", + "symfony/deprecation-contracts": "^2.5 || ^3.1" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.40", - "phpspec/phpspec": "^6.0 || ^7.0", + "friendsofphp/php-cs-fixer": "^3.88", + "phpspec/phpspec": "^6.0 || ^7.0 || ^8.0", "phpstan/phpstan": "^2.1.13", - "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0" + "phpunit/phpunit": "^11.0 || ^12.0" }, "type": "library", "extra": { @@ -3097,28 +3358,28 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.22.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.23.0" }, - "time": "2025-04-29T14:58:06+00:00" + "time": "2025-10-08T08:50:26+00:00" }, { "name": "phpspec/prophecy-phpunit", - "version": "v2.3.0", + "version": "v2.4.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy-phpunit.git", - "reference": "8819516c1b489ecee4c60db5f5432fac1ea8ac6f" + "reference": "d3c28041d9390c9bca325a08c5b2993ac855bded" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/8819516c1b489ecee4c60db5f5432fac1ea8ac6f", - "reference": "8819516c1b489ecee4c60db5f5432fac1ea8ac6f", + "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/d3c28041d9390c9bca325a08c5b2993ac855bded", + "reference": "d3c28041d9390c9bca325a08c5b2993ac855bded", "shasum": "" }, "require": { "php": "^7.3 || ^8", "phpspec/prophecy": "^1.18", - "phpunit/phpunit": "^9.1 || ^10.1 || ^11.0" + "phpunit/phpunit": "^9.1 || ^10.1 || ^11.0 || ^12.0" }, "require-dev": { "phpstan/phpstan": "^1.10" @@ -3152,22 +3413,22 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy-phpunit/issues", - "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.3.0" + "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.4.0" }, - "time": "2024-11-19T13:24:17+00:00" + "time": "2025-05-13T13:52:32+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "2.1.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "9b30d6fd026b2c132b3985ce6b23bec09ab3aa68" + "reference": "1e0cd5370df5dd2e556a36b9c62f62e555870495" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/9b30d6fd026b2c132b3985ce6b23bec09ab3aa68", - "reference": "9b30d6fd026b2c132b3985ce6b23bec09ab3aa68", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/1e0cd5370df5dd2e556a36b9c62f62e555870495", + "reference": "1e0cd5370df5dd2e556a36b9c62f62e555870495", "shasum": "" }, "require": { @@ -3199,9 +3460,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/2.1.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.0" }, - "time": "2025-02-19T13:28:12+00:00" + "time": "2025-08-30T15:50:23+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3524,16 +3785,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.23", + "version": "9.6.29", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95" + "reference": "9ecfec57835a5581bc888ea7e13b51eb55ab9dd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", - "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9ecfec57835a5581bc888ea7e13b51eb55ab9dd3", + "reference": "9ecfec57835a5581bc888ea7e13b51eb55ab9dd3", "shasum": "" }, "require": { @@ -3544,7 +3805,7 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.13.1", + "myclabs/deep-copy": "^1.13.4", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=7.3", @@ -3555,11 +3816,11 @@ "phpunit/php-timer": "^5.0.3", "sebastian/cli-parser": "^1.0.2", "sebastian/code-unit": "^1.0.8", - "sebastian/comparator": "^4.0.8", + "sebastian/comparator": "^4.0.9", "sebastian/diff": "^4.0.6", "sebastian/environment": "^5.1.5", - "sebastian/exporter": "^4.0.6", - "sebastian/global-state": "^5.0.7", + "sebastian/exporter": "^4.0.8", + "sebastian/global-state": "^5.0.8", "sebastian/object-enumerator": "^4.0.4", "sebastian/resource-operations": "^3.0.4", "sebastian/type": "^3.2.1", @@ -3607,7 +3868,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.23" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.29" }, "funding": [ { @@ -3631,7 +3892,7 @@ "type": "tidelift" } ], - "time": "2025-05-02T06:40:34+00:00" + "time": "2025-09-24T06:29:11+00:00" }, { "name": "psr/container", @@ -3686,6 +3947,57 @@ }, "time": "2021-11-05T16:47:00+00:00" }, + { + "name": "psr/simple-cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "support": { + "source": "https://github.com/php-fig/simple-cache/tree/master" + }, + "time": "2017-10-23T01:57:42+00:00" + }, { "name": "sebastian/cli-parser", "version": "1.0.2", @@ -3855,16 +4167,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "4.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/67a2df3a62639eab2cc5906065e9805d4fd5dfc5", + "reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5", "shasum": "" }, "require": { @@ -3917,15 +4229,27 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.9" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator", + "type": "tidelift" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2025-08-10T06:51:50+00:00" }, { "name": "sebastian/complexity", @@ -4115,16 +4439,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.6", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" + "reference": "14c6ba52f95a36c3d27c835d65efc7123c446e8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/14c6ba52f95a36c3d27c835d65efc7123c446e8c", + "reference": "14c6ba52f95a36c3d27c835d65efc7123c446e8c", "shasum": "" }, "require": { @@ -4180,28 +4504,40 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.8" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/exporter", + "type": "tidelift" } ], - "time": "2024-03-02T06:33:00+00:00" + "time": "2025-09-24T06:03:27+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.7", + "version": "5.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + "reference": "b6781316bdcd28260904e7cc18ec983d0d2ef4f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/b6781316bdcd28260904e7cc18ec983d0d2ef4f6", + "reference": "b6781316bdcd28260904e7cc18ec983d0d2ef4f6", "shasum": "" }, "require": { @@ -4244,15 +4580,27 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.8" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/global-state", + "type": "tidelift" } ], - "time": "2024-03-02T06:35:11+00:00" + "time": "2025-08-10T07:10:35+00:00" }, { "name": "sebastian/lines-of-code", @@ -4425,16 +4773,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "539c6691e0623af6dc6f9c20384c120f963465a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/539c6691e0623af6dc6f9c20384c120f963465a0", + "reference": "539c6691e0623af6dc6f9c20384c120f963465a0", "shasum": "" }, "require": { @@ -4476,15 +4824,27 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.6" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", + "type": "tidelift" } ], - "time": "2023-02-03T06:07:39+00:00" + "time": "2025-08-10T06:57:39+00:00" }, { "name": "sebastian/resource-operations", @@ -4763,16 +5123,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.12.2", + "version": "3.13.4", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa" + "reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa", - "reference": "6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ad545ea9c1b7d270ce0fc9cbfb884161cd706119", + "reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119", "shasum": "" }, "require": { @@ -4843,7 +5203,7 @@ "type": "thanks_dev" } ], - "time": "2025-04-13T04:10:18+00:00" + "time": "2025-09-05T05:47:09+00:00" }, { "name": "symfony/console", @@ -5192,7 +5552,7 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.32.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -5251,7 +5611,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.33.0" }, "funding": [ { @@ -5262,6 +5622,10 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -5271,16 +5635,16 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.32.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" + "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", - "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70", + "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70", "shasum": "" }, "require": { @@ -5329,7 +5693,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.33.0" }, "funding": [ { @@ -5340,16 +5704,20 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2025-06-27T09:58:17+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.32.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -5410,7 +5778,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.33.0" }, "funding": [ { @@ -5421,6 +5789,10 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -5430,7 +5802,7 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.32.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", @@ -5491,7 +5863,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0" }, "funding": [ { @@ -5502,6 +5874,10 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -5511,7 +5887,7 @@ }, { "name": "symfony/polyfill-php73", - "version": "v1.32.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", @@ -5567,7 +5943,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.33.0" }, "funding": [ { @@ -5578,6 +5954,10 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -5587,7 +5967,7 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.32.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", @@ -5647,7 +6027,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.33.0" }, "funding": [ { @@ -5658,6 +6038,10 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -5729,28 +6113,26 @@ }, { "name": "symfony/service-contracts", - "version": "v3.0.2", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66" + "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d78d39c1599bd1188b8e26bb341da52c3c6d8a66", - "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f021b05a130d35510bd6b25fe9053c2a8a15d5d4", + "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4", "shasum": "" }, "require": { - "php": ">=8.0.2", - "psr/container": "^2.0" + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" }, "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "type": "library", "extra": { "thanks": { @@ -5758,13 +6140,16 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.6-dev" } }, "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -5791,7 +6176,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.0.2" + "source": "https://github.com/symfony/service-contracts/tree/v3.6.0" }, "funding": [ { @@ -5807,37 +6192,37 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:58+00:00" + "time": "2025-04-25T09:37:31+00:00" }, { "name": "symfony/string", - "version": "v6.0.19", + "version": "v6.4.26", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a" + "reference": "5621f039a71a11c87c106c1c598bdcd04a19aeea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/d9e72497367c23e08bf94176d2be45b00a9d232a", - "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a", + "url": "https://api.github.com/repos/symfony/string/zipball/5621f039a71a11c87c106c1c598bdcd04a19aeea", + "reference": "5621f039a71a11c87c106c1c598bdcd04a19aeea", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/error-handler": "^5.4|^6.0", - "symfony/http-client": "^5.4|^6.0", - "symfony/translation-contracts": "^2.0|^3.0", - "symfony/var-exporter": "^5.4|^6.0" + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/intl": "^6.2|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -5876,7 +6261,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.0.19" + "source": "https://github.com/symfony/string/tree/v6.4.26" }, "funding": [ { @@ -5887,12 +6272,16 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2023-01-01T08:36:10+00:00" + "time": "2025-09-11T14:32:46+00:00" }, { "name": "theseer/tokenizer", @@ -6009,7 +6398,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^8.0" + "php": "^8.1" }, "platform-dev": [], "plugin-api-version": "2.6.0" diff --git a/lib/Google/phpstan.neon.dist b/lib/Google/phpstan.neon.dist deleted file mode 100644 index dcef11342..000000000 --- a/lib/Google/phpstan.neon.dist +++ /dev/null @@ -1,5 +0,0 @@ -parameters: - treatPhpDocTypesAsCertain: false - level: 5 - paths: - - src diff --git a/lib/Google/src/AuthHandler/Guzzle6AuthHandler.php b/lib/Google/src/AuthHandler/Guzzle6AuthHandler.php index 352cf915c..05fe1b2b9 100644 --- a/lib/Google/src/AuthHandler/Guzzle6AuthHandler.php +++ b/lib/Google/src/AuthHandler/Guzzle6AuthHandler.php @@ -2,8 +2,8 @@ namespace Google\AuthHandler; -use Google\Auth\CredentialsLoader; use Google\Auth\FetchAuthTokenCache; +use Google\Auth\FetchAuthTokenInterface; use Google\Auth\HttpHandler\HttpHandlerFactory; use Google\Auth\Middleware\AuthTokenMiddleware; use Google\Auth\Middleware\ScopedAccessTokenMiddleware; @@ -28,7 +28,7 @@ public function __construct(?CacheItemPoolInterface $cache = null, array $cacheC public function attachCredentials( ClientInterface $http, - CredentialsLoader $credentials, + FetchAuthTokenInterface $credentials, ?callable $tokenCallback = null ) { // use the provided cache @@ -40,13 +40,21 @@ public function attachCredentials( ); } - return $this->attachCredentialsCache($http, $credentials, $tokenCallback); + return $this->attachToHttp($http, $credentials, $tokenCallback); } public function attachCredentialsCache( ClientInterface $http, FetchAuthTokenCache $credentials, ?callable $tokenCallback = null + ) { + return $this->attachToHttp($http, $credentials, $tokenCallback); + } + + private function attachToHttp( + ClientInterface $http, + FetchAuthTokenInterface $credentials, + ?callable $tokenCallback = null ) { // if we end up needing to make an HTTP request to retrieve credentials, we // can use our existing one, but we need to throw exceptions so the error @@ -63,9 +71,7 @@ public function attachCredentialsCache( $config['handler']->remove('google_auth'); $config['handler']->push($middleware, 'google_auth'); $config['auth'] = 'google_auth'; - $http = new Client($config); - - return $http; + return new Client($config); } public function attachToken(ClientInterface $http, array $token, array $scopes) diff --git a/lib/Google/src/Client.php b/lib/Google/src/Client.php index edfb1f83e..33147925f 100644 --- a/lib/Google/src/Client.php +++ b/lib/Google/src/Client.php @@ -27,6 +27,7 @@ use Google\Auth\Credentials\UserRefreshCredentials; use Google\Auth\CredentialsLoader; use Google\Auth\FetchAuthTokenCache; +use Google\Auth\FetchAuthTokenInterface; use Google\Auth\GetUniverseDomainInterface; use Google\Auth\HttpHandler\HttpHandlerFactory; use Google\Auth\OAuth2; @@ -90,7 +91,7 @@ class Client private $logger; /** - * @var ?CredentialsLoader $credentials + * @var ?FetchAuthTokenInterface $credentials */ private $credentials; @@ -118,10 +119,10 @@ class Client * Your Google Cloud client ID found in https://developers.google.com/console * @type string $client_secret * Your Google Cloud client secret found in https://developers.google.com/console - * @type string|array|CredentialsLoader $credentials + * @type string|array|FetchAuthTokenInterface $credentials * Can be a path to JSON credentials or an array representing those * credentials (@see Google\Client::setAuthConfig), or an instance of - * {@see CredentialsLoader}. + * {@see FetchAuthTokenInterface}. * @type string|array $scopes * {@see Google\Client::setScopes} * @type string $quota_project @@ -213,7 +214,7 @@ public function __construct(array $config = []) ], $config); if (!is_null($this->config['credentials'])) { - if ($this->config['credentials'] instanceof CredentialsLoader) { + if ($this->config['credentials'] instanceof FetchAuthTokenInterface) { $this->credentials = $this->config['credentials']; } else { $this->setAuthConfig($this->config['credentials']); @@ -460,7 +461,8 @@ public function authorize(?ClientInterface $http = null) $authHandler = $this->getAuthHandler(); // These conditionals represent the decision tree for authentication - // 1. Check if a Google\Auth\CredentialsLoader instance has been supplied via the "credentials" option + // 1. Check if an instance of Google\Auth\FetchAuthTokenInterface has + // been supplied via the "credentials" option // 2. Check for Application Default Credentials // 3a. Check for an Access Token // 3b. If access token exists but is expired, try to refresh it diff --git a/lib/Google/src/Task/Composer.php b/lib/Google/src/Task/Composer.php index fcad6bd13..fff4de22d 100644 --- a/lib/Google/src/Task/Composer.php +++ b/lib/Google/src/Task/Composer.php @@ -34,35 +34,37 @@ public static function cleanup( ) { $composer = $event->getComposer(); $extra = $composer->getPackage()->getExtra(); - $servicesToKeep = isset($extra['google/apiclient-services']) - ? $extra['google/apiclient-services'] - : []; - if ($servicesToKeep) { - $vendorDir = $composer->getConfig()->get('vendor-dir'); + $servicesToKeep = $extra['google/apiclient-services'] ?? []; + if (empty($servicesToKeep)) { + return; + } + $vendorDir = $composer->getConfig()->get('vendor-dir'); + $serviceDir = sprintf( + '%s/google/apiclient-services/src/Google/Service', + $vendorDir + ); + if (!is_dir($serviceDir)) { + // path for google/apiclient-services >= 0.200.0 $serviceDir = sprintf( - '%s/google/apiclient-services/src/Google/Service', + '%s/google/apiclient-services/src', $vendorDir ); - if (!is_dir($serviceDir)) { - // path for google/apiclient-services >= 0.200.0 - $serviceDir = sprintf( - '%s/google/apiclient-services/src', - $vendorDir - ); - } - self::verifyServicesToKeep($serviceDir, $servicesToKeep); - $finder = self::getServicesToRemove($serviceDir, $servicesToKeep); - $filesystem = $filesystem ?: new Filesystem(); - if (0 !== $count = count($finder)) { - $event->getIO()->write( - sprintf('Removing %s google services', $count) - ); - foreach ($finder as $file) { - $realpath = $file->getRealPath(); - $filesystem->remove($realpath); - $filesystem->remove($realpath . '.php'); - } - } + } + self::verifyServicesToKeep($serviceDir, $servicesToKeep); + $finder = self::getServicesToRemove($serviceDir, $servicesToKeep); + $filesystem = $filesystem ?: new Filesystem(); + $servicesToRemoveCount = $finder->count(); + if (0 === $servicesToRemoveCount) { + return; + } + $event->getIO()->write( + sprintf('Removing %d google services', $servicesToRemoveCount) + ); + $pathsToRemove = iterator_to_array($finder); + foreach ($pathsToRemove as $pathToRemove) { + $realpath = $pathToRemove->getRealPath(); + $filesystem->remove($realpath); + $filesystem->remove($realpath . '.php'); } } diff --git a/lib/Google/vendor/autoload.php b/lib/Google/vendor/autoload.php index 599daf634..5b422997d 100644 --- a/lib/Google/vendor/autoload.php +++ b/lib/Google/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitbd131085cfdbf47b26d7ae00fe412ae4::getLoader(); +return ComposerAutoloaderInit7d51b2283bec19db67d0861b0c8ead2c::getLoader(); diff --git a/lib/Google/vendor/brick/math/CHANGELOG.md b/lib/Google/vendor/brick/math/CHANGELOG.md index 17cea8d9f..377cdae22 100644 --- a/lib/Google/vendor/brick/math/CHANGELOG.md +++ b/lib/Google/vendor/brick/math/CHANGELOG.md @@ -2,6 +2,74 @@ All notable changes to this project will be documented in this file. +## [0.14.0](https://github.com/brick/math/releases/tag/0.14.0) - 2025-08-29 + +✨ **New features** + +- New methods: `BigInteger::clamp()` and `BigDecimal::clamp()` (#96 by @JesterIruka) + +✨ **Improvements** + +- All pure methods in `BigNumber` classes are now marked as `@pure` for better static analysis + +💥 **Breaking changes** + +- Minimum PHP version is now 8.2 +- `BigNumber` classes are now `readonly` +- `BigNumber` is now marked as sealed: it must not be extended outside of this package +- Exception classes are now `final` + +## [0.13.1](https://github.com/brick/math/releases/tag/0.13.1) - 2025-03-29 + +✨ **Improvements** + +- `__toString()` methods of `BigInteger` and `BigDecimal` are now type-hinted as returning `numeric-string` instead of `string` (#90 by @vudaltsov) + +## [0.13.0](https://github.com/brick/math/releases/tag/0.13.0) - 2025-03-03 + +💥 **Breaking changes** + +- `BigDecimal::ofUnscaledValue()` no longer throws an exception if the scale is negative +- `MathException` now extends `RuntimeException` instead of `Exception`; this reverts the change introduced in version `0.11.0` (#82) + +✨ **New features** + +- `BigDecimal::ofUnscaledValue()` allows a negative scale (and converts the values to create a zero scale number) + +## [0.12.3](https://github.com/brick/math/releases/tag/0.12.3) - 2025-02-28 + +✨ **New features** + +- `BigDecimal::getPrecision()` Returns the number of significant digits in a decimal number + +## [0.12.2](https://github.com/brick/math/releases/tag/0.12.2) - 2025-02-26 + +⚡️ **Performance improvements** + +- Division in `NativeCalculator` is now faster for small divisors, thanks to [@Izumi-kun](https://github.com/Izumi-kun) in [#87](https://github.com/brick/math/pull/87). + +👌 **Improvements** + +- Add missing `RoundingNecessaryException` to the `@throws` annotation of `BigNumber::of()` + +## [0.12.1](https://github.com/brick/math/releases/tag/0.12.1) - 2023-11-29 + +⚡️ **Performance improvements** + +- `BigNumber::of()` is now faster, thanks to [@SebastienDug](https://github.com/SebastienDug) in [#77](https://github.com/brick/math/pull/77). + +## [0.12.0](https://github.com/brick/math/releases/tag/0.12.0) - 2023-11-26 + +💥 **Breaking changes** + +- Minimum PHP version is now 8.1 +- `RoundingMode` is now an `enum`; if you're type-hinting rounding modes, you need to type-hint against `RoundingMode` instead of `int` now +- `BigNumber` classes do not implement the `Serializable` interface anymore (they use the [new custom object serialization mechanism](https://wiki.php.net/rfc/custom_object_serialization)) +- The following breaking changes only affect you if you're creating your own `BigNumber` subclasses: + - the return type of `BigNumber::of()` is now `static` + - `BigNumber` has a new abstract method `from()` + - all `public` and `protected` functions of `BigNumber` are now `final` + ## [0.11.0](https://github.com/brick/math/releases/tag/0.11.0) - 2023-01-16 💥 **Breaking changes** diff --git a/lib/Google/vendor/brick/math/composer.json b/lib/Google/vendor/brick/math/composer.json index ed817bdd0..ad1dfe07a 100644 --- a/lib/Google/vendor/brick/math/composer.json +++ b/lib/Google/vendor/brick/math/composer.json @@ -5,21 +5,26 @@ "keywords": [ "Brick", "Math", + "Mathematics", "Arbitrary-precision", "Arithmetic", "BigInteger", "BigDecimal", "BigRational", - "Bignum" + "BigNumber", + "Bignum", + "Decimal", + "Rational", + "Integer" ], "license": "MIT", "require": { - "php": "^8.0" + "php": "^8.2" }, "require-dev": { - "phpunit/phpunit": "^9.0", + "phpunit/phpunit": "^11.5", "php-coveralls/php-coveralls": "^2.2", - "vimeo/psalm": "5.0.0" + "phpstan/phpstan": "2.1.22" }, "autoload": { "psr-4": { diff --git a/lib/Google/vendor/brick/math/phpstan.neon b/lib/Google/vendor/brick/math/phpstan.neon new file mode 100644 index 000000000..216ba1e8d --- /dev/null +++ b/lib/Google/vendor/brick/math/phpstan.neon @@ -0,0 +1,14 @@ +parameters: + level: 10 + checkUninitializedProperties: true + paths: + - src + ignoreErrors: + - '~Impure call to function array_shift\(\) in pure method~' + - '~Possibly impure call to function assert\(\) in pure method~' + - '~Possibly impure call to function hex2bin\(\) in pure method~' + - '~Possibly impure call to function preg_match\(\) in pure method~' + - '~Impure static variable in pure method Brick\\Math\\Big(Integer|Decimal|Rational)::(zero|one|ten)\(\)~' + - + message: '~Parameter #\d \$\S+ of function bc\S+ expects numeric-string, string given~' + path: src/Internal/Calculator/BcMathCalculator.php diff --git a/lib/Google/vendor/brick/math/src/BigDecimal.php b/lib/Google/vendor/brick/math/src/BigDecimal.php index 02fc65612..1a540c7d6 100644 --- a/lib/Google/vendor/brick/math/src/BigDecimal.php +++ b/lib/Google/vendor/brick/math/src/BigDecimal.php @@ -8,13 +8,13 @@ use Brick\Math\Exception\MathException; use Brick\Math\Exception\NegativeNumberException; use Brick\Math\Internal\Calculator; +use Brick\Math\Internal\CalculatorRegistry; +use Override; /** * Immutable, arbitrary-precision signed decimal numbers. - * - * @psalm-immutable */ -final class BigDecimal extends BigNumber +final readonly class BigDecimal extends BigNumber { /** * The unscaled value of this decimal number. @@ -37,6 +37,8 @@ final class BigDecimal extends BigNumber * * @param string $value The unscaled value, validated. * @param int $scale The scale, validated. + * + * @pure */ protected function __construct(string $value, int $scale = 0) { @@ -44,16 +46,10 @@ protected function __construct(string $value, int $scale = 0) $this->scale = $scale; } - /** - * Creates a BigDecimal of the given value. - * - * @throws MathException If the value cannot be converted to a BigDecimal. - * - * @psalm-pure - */ - public static function of(BigNumber|int|float|string $value) : BigDecimal + #[Override] + protected static function from(BigNumber $number): static { - return parent::of($value)->toBigDecimal(); + return $number->toBigDecimal(); } /** @@ -62,32 +58,33 @@ public static function of(BigNumber|int|float|string $value) : BigDecimal * Example: `(12345, 3)` will result in the BigDecimal `12.345`. * * @param BigNumber|int|float|string $value The unscaled value. Must be convertible to a BigInteger. - * @param int $scale The scale of the number, positive or zero. + * @param int $scale The scale of the number. If negative, the scale will be set to zero + * and the unscaled value will be adjusted accordingly. * - * @throws \InvalidArgumentException If the scale is negative. - * - * @psalm-pure + * @pure */ public static function ofUnscaledValue(BigNumber|int|float|string $value, int $scale = 0) : BigDecimal { + $value = (string) BigInteger::of($value); + if ($scale < 0) { - throw new \InvalidArgumentException('The scale cannot be negative.'); + if ($value !== '0') { + $value .= \str_repeat('0', -$scale); + } + $scale = 0; } - return new BigDecimal((string) BigInteger::of($value), $scale); + return new BigDecimal($value, $scale); } /** * Returns a BigDecimal representing zero, with a scale of zero. * - * @psalm-pure + * @pure */ public static function zero() : BigDecimal { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigDecimal|null $zero - */ + /** @var BigDecimal|null $zero */ static $zero; if ($zero === null) { @@ -100,14 +97,11 @@ public static function zero() : BigDecimal /** * Returns a BigDecimal representing one, with a scale of zero. * - * @psalm-pure + * @pure */ public static function one() : BigDecimal { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigDecimal|null $one - */ + /** @var BigDecimal|null $one */ static $one; if ($one === null) { @@ -120,14 +114,11 @@ public static function one() : BigDecimal /** * Returns a BigDecimal representing ten, with a scale of zero. * - * @psalm-pure + * @pure */ public static function ten() : BigDecimal { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigDecimal|null $ten - */ + /** @var BigDecimal|null $ten */ static $ten; if ($ten === null) { @@ -145,6 +136,8 @@ public static function ten() : BigDecimal * @param BigNumber|int|float|string $that The number to add. Must be convertible to a BigDecimal. * * @throws MathException If the number is not valid, or is not convertible to a BigDecimal. + * + * @pure */ public function plus(BigNumber|int|float|string $that) : BigDecimal { @@ -160,7 +153,7 @@ public function plus(BigNumber|int|float|string $that) : BigDecimal [$a, $b] = $this->scaleValues($this, $that); - $value = Calculator::get()->add($a, $b); + $value = CalculatorRegistry::get()->add($a, $b); $scale = $this->scale > $that->scale ? $this->scale : $that->scale; return new BigDecimal($value, $scale); @@ -174,6 +167,8 @@ public function plus(BigNumber|int|float|string $that) : BigDecimal * @param BigNumber|int|float|string $that The number to subtract. Must be convertible to a BigDecimal. * * @throws MathException If the number is not valid, or is not convertible to a BigDecimal. + * + * @pure */ public function minus(BigNumber|int|float|string $that) : BigDecimal { @@ -185,7 +180,7 @@ public function minus(BigNumber|int|float|string $that) : BigDecimal [$a, $b] = $this->scaleValues($this, $that); - $value = Calculator::get()->sub($a, $b); + $value = CalculatorRegistry::get()->sub($a, $b); $scale = $this->scale > $that->scale ? $this->scale : $that->scale; return new BigDecimal($value, $scale); @@ -199,6 +194,8 @@ public function minus(BigNumber|int|float|string $that) : BigDecimal * @param BigNumber|int|float|string $that The multiplier. Must be convertible to a BigDecimal. * * @throws MathException If the multiplier is not a valid number, or is not convertible to a BigDecimal. + * + * @pure */ public function multipliedBy(BigNumber|int|float|string $that) : BigDecimal { @@ -212,7 +209,7 @@ public function multipliedBy(BigNumber|int|float|string $that) : BigDecimal return $that; } - $value = Calculator::get()->mul($this->value, $that->value); + $value = CalculatorRegistry::get()->mul($this->value, $that->value); $scale = $this->scale + $that->scale; return new BigDecimal($value, $scale); @@ -223,12 +220,14 @@ public function multipliedBy(BigNumber|int|float|string $that) : BigDecimal * * @param BigNumber|int|float|string $that The divisor. * @param int|null $scale The desired scale, or null to use the scale of this number. - * @param int $roundingMode An optional rounding mode. + * @param RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY. * * @throws \InvalidArgumentException If the scale or rounding mode is invalid. * @throws MathException If the number is invalid, is zero, or rounding was necessary. + * + * @pure */ - public function dividedBy(BigNumber|int|float|string $that, ?int $scale = null, int $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal + public function dividedBy(BigNumber|int|float|string $that, ?int $scale = null, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal { $that = BigDecimal::of($that); @@ -249,7 +248,7 @@ public function dividedBy(BigNumber|int|float|string $that, ?int $scale = null, $p = $this->valueWithMinScale($that->scale + $scale); $q = $that->valueWithMinScale($this->scale - $scale); - $result = Calculator::get()->divRound($p, $q, $roundingMode); + $result = CalculatorRegistry::get()->divRound($p, $q, $roundingMode); return new BigDecimal($result, $scale); } @@ -263,6 +262,8 @@ public function dividedBy(BigNumber|int|float|string $that, ?int $scale = null, * * @throws MathException If the divisor is not a valid number, is not convertible to a BigDecimal, is zero, * or the result yields an infinite number of digits. + * + * @pure */ public function exactlyDividedBy(BigNumber|int|float|string $that) : BigDecimal { @@ -277,7 +278,7 @@ public function exactlyDividedBy(BigNumber|int|float|string $that) : BigDecimal $d = \rtrim($b, '0'); $scale = \strlen($b) - \strlen($d); - $calculator = Calculator::get(); + $calculator = CalculatorRegistry::get(); foreach ([5, 2] as $prime) { for (;;) { @@ -295,12 +296,36 @@ public function exactlyDividedBy(BigNumber|int|float|string $that) : BigDecimal return $this->dividedBy($that, $scale)->stripTrailingZeros(); } + /** + * Limits (clamps) this number between the given minimum and maximum values. + * + * If the number is lower than $min, returns a copy of $min. + * If the number is greater than $max, returns a copy of $max. + * Otherwise, returns this number unchanged. + * + * @param BigNumber|int|float|string $min The minimum. Must be convertible to a BigDecimal. + * @param BigNumber|int|float|string $max The maximum. Must be convertible to a BigDecimal. + * + * @throws MathException If min/max are not convertible to a BigDecimal. + */ + public function clamp(BigNumber|int|float|string $min, BigNumber|int|float|string $max) : BigDecimal + { + if ($this->isLessThan($min)) { + return BigDecimal::of($min); + } elseif ($this->isGreaterThan($max)) { + return BigDecimal::of($max); + } + return $this; + } + /** * Returns this number exponentiated to the given value. * * The result has a scale of `$this->scale * $exponent`. * * @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000. + * + * @pure */ public function power(int $exponent) : BigDecimal { @@ -320,17 +345,19 @@ public function power(int $exponent) : BigDecimal )); } - return new BigDecimal(Calculator::get()->pow($this->value, $exponent), $this->scale * $exponent); + return new BigDecimal(CalculatorRegistry::get()->pow($this->value, $exponent), $this->scale * $exponent); } /** - * Returns the quotient of the division of this number by this given one. + * Returns the quotient of the division of this number by the given one. * * The quotient has a scale of `0`. * * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal. * * @throws MathException If the divisor is not a valid decimal number, or is zero. + * + * @pure */ public function quotient(BigNumber|int|float|string $that) : BigDecimal { @@ -343,19 +370,21 @@ public function quotient(BigNumber|int|float|string $that) : BigDecimal $p = $this->valueWithMinScale($that->scale); $q = $that->valueWithMinScale($this->scale); - $quotient = Calculator::get()->divQ($p, $q); + $quotient = CalculatorRegistry::get()->divQ($p, $q); return new BigDecimal($quotient, 0); } /** - * Returns the remainder of the division of this number by this given one. + * Returns the remainder of the division of this number by the given one. * * The remainder has a scale of `max($this->scale, $that->scale)`. * * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal. * * @throws MathException If the divisor is not a valid decimal number, or is zero. + * + * @pure */ public function remainder(BigNumber|int|float|string $that) : BigDecimal { @@ -368,7 +397,7 @@ public function remainder(BigNumber|int|float|string $that) : BigDecimal $p = $this->valueWithMinScale($that->scale); $q = $that->valueWithMinScale($this->scale); - $remainder = Calculator::get()->divR($p, $q); + $remainder = CalculatorRegistry::get()->divR($p, $q); $scale = $this->scale > $that->scale ? $this->scale : $that->scale; @@ -382,9 +411,11 @@ public function remainder(BigNumber|int|float|string $that) : BigDecimal * * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal. * - * @return BigDecimal[] An array containing the quotient and the remainder. + * @return array{BigDecimal, BigDecimal} An array containing the quotient and the remainder. * * @throws MathException If the divisor is not a valid decimal number, or is zero. + * + * @pure */ public function quotientAndRemainder(BigNumber|int|float|string $that) : array { @@ -397,7 +428,7 @@ public function quotientAndRemainder(BigNumber|int|float|string $that) : array $p = $this->valueWithMinScale($that->scale); $q = $that->valueWithMinScale($this->scale); - [$quotient, $remainder] = Calculator::get()->divQR($p, $q); + [$quotient, $remainder] = CalculatorRegistry::get()->divQR($p, $q); $scale = $this->scale > $that->scale ? $this->scale : $that->scale; @@ -412,6 +443,8 @@ public function quotientAndRemainder(BigNumber|int|float|string $that) : array * * @throws \InvalidArgumentException If the scale is negative. * @throws NegativeNumberException If this number is negative. + * + * @pure */ public function sqrt(int $scale) : BigDecimal { @@ -443,13 +476,15 @@ public function sqrt(int $scale) : BigDecimal $value = \substr($value, 0, $addDigits); } - $value = Calculator::get()->sqrt($value); + $value = CalculatorRegistry::get()->sqrt($value); return new BigDecimal($value, $scale); } /** * Returns a copy of this BigDecimal with the decimal point moved $n places to the left. + * + * @pure */ public function withPointMovedLeft(int $n) : BigDecimal { @@ -466,6 +501,8 @@ public function withPointMovedLeft(int $n) : BigDecimal /** * Returns a copy of this BigDecimal with the decimal point moved $n places to the right. + * + * @pure */ public function withPointMovedRight(int $n) : BigDecimal { @@ -492,6 +529,8 @@ public function withPointMovedRight(int $n) : BigDecimal /** * Returns a copy of this BigDecimal with any trailing zeros removed from the fractional part. + * + * @pure */ public function stripTrailingZeros() : BigDecimal { @@ -523,6 +562,8 @@ public function stripTrailingZeros() : BigDecimal /** * Returns the absolute value of this number. + * + * @pure */ public function abs() : BigDecimal { @@ -531,12 +572,15 @@ public function abs() : BigDecimal /** * Returns the negated value of this number. + * + * @pure */ public function negated() : BigDecimal { - return new BigDecimal(Calculator::get()->neg($this->value), $this->scale); + return new BigDecimal(CalculatorRegistry::get()->neg($this->value), $this->scale); } + #[Override] public function compareTo(BigNumber|int|float|string $that) : int { $that = BigNumber::of($that); @@ -548,31 +592,69 @@ public function compareTo(BigNumber|int|float|string $that) : int if ($that instanceof BigDecimal) { [$a, $b] = $this->scaleValues($this, $that); - return Calculator::get()->cmp($a, $b); + return CalculatorRegistry::get()->cmp($a, $b); } return - $that->compareTo($this); } + #[Override] public function getSign() : int { return ($this->value === '0') ? 0 : (($this->value[0] === '-') ? -1 : 1); } + /** + * @pure + */ public function getUnscaledValue() : BigInteger { return self::newBigInteger($this->value); } + /** + * @pure + */ public function getScale() : int { return $this->scale; } + /** + * Returns the number of significant digits in the number. + * + * This is the number of digits to both sides of the decimal point, stripped of leading zeros. + * The sign has no impact on the result. + * + * Examples: + * 0 => 0 + * 0.0 => 0 + * 123 => 3 + * 123.456 => 6 + * 0.00123 => 3 + * 0.0012300 => 5 + * + * @pure + */ + public function getPrecision(): int + { + $value = $this->value; + + if ($value === '0') { + return 0; + } + + $length = \strlen($value); + + return ($value[0] === '-') ? $length - 1 : $length; + } + /** * Returns a string representing the integral part of this decimal number. * * Example: `-123.456` => `-123`. + * + * @pure */ public function getIntegralPart() : string { @@ -591,6 +673,8 @@ public function getIntegralPart() : string * If the scale is zero, an empty string is returned. * * Examples: `-123.456` => '456', `123` => ''. + * + * @pure */ public function getFractionalPart() : string { @@ -605,12 +689,15 @@ public function getFractionalPart() : string /** * Returns whether this decimal number has a non-zero fractional part. + * + * @pure */ public function hasNonZeroFractionalPart() : bool { return $this->getFractionalPart() !== \str_repeat('0', $this->scale); } + #[Override] public function toBigInteger() : BigInteger { $zeroScaleDecimal = $this->scale === 0 ? $this : $this->dividedBy(1, 0); @@ -618,11 +705,13 @@ public function toBigInteger() : BigInteger return self::newBigInteger($zeroScaleDecimal->value); } + #[Override] public function toBigDecimal() : BigDecimal { return $this; } + #[Override] public function toBigRational() : BigRational { $numerator = self::newBigInteger($this->value); @@ -631,7 +720,8 @@ public function toBigRational() : BigRational return self::newBigRational($numerator, $denominator, false); } - public function toScale(int $scale, int $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal + #[Override] + public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal { if ($scale === $this->scale) { return $this; @@ -640,24 +730,32 @@ public function toScale(int $scale, int $roundingMode = RoundingMode::UNNECESSAR return $this->dividedBy(BigDecimal::one(), $scale, $roundingMode); } + #[Override] public function toInt() : int { return $this->toBigInteger()->toInt(); } + #[Override] public function toFloat() : float { return (float) (string) $this; } + /** + * @return numeric-string + */ + #[Override] public function __toString() : string { if ($this->scale === 0) { + /** @var numeric-string */ return $this->value; } $value = $this->getUnscaledValueWithLeadingZeros(); + /** @phpstan-ignore return.type */ return \substr($value, 0, -$this->scale) . '.' . \substr($value, -$this->scale); } @@ -677,7 +775,6 @@ public function __serialize(): array * This method is only here to allow unserializing the object and cannot be accessed directly. * * @internal - * @psalm-suppress RedundantPropertyInitializationCheck * * @param array{value: string, scale: int} $data * @@ -685,48 +782,22 @@ public function __serialize(): array */ public function __unserialize(array $data): void { + /** @phpstan-ignore isset.initializedProperty */ if (isset($this->value)) { throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); } + /** @phpstan-ignore deadCode.unreachable */ $this->value = $data['value']; $this->scale = $data['scale']; } - /** - * This method is required by interface Serializable and SHOULD NOT be accessed directly. - * - * @internal - */ - public function serialize() : string - { - return $this->value . ':' . $this->scale; - } - - /** - * This method is only here to implement interface Serializable and cannot be accessed directly. - * - * @internal - * @psalm-suppress RedundantPropertyInitializationCheck - * - * @throws \LogicException - */ - public function unserialize($value) : void - { - if (isset($this->value)) { - throw new \LogicException('unserialize() is an internal function, it must not be called directly.'); - } - - [$value, $scale] = \explode(':', $value); - - $this->value = $value; - $this->scale = (int) $scale; - } - /** * Puts the internal values of the given decimal numbers on the same scale. * * @return array{string, string} The scaled integer values of $x and $y. + * + * @pure */ private function scaleValues(BigDecimal $x, BigDecimal $y) : array { @@ -742,6 +813,9 @@ private function scaleValues(BigDecimal $x, BigDecimal $y) : array return [$a, $b]; } + /** + * @pure + */ private function valueWithMinScale(int $scale) : string { $value = $this->value; @@ -755,6 +829,8 @@ private function valueWithMinScale(int $scale) : string /** * Adds leading zeros if necessary to the unscaled value to represent the full decimal number. + * + * @pure */ private function getUnscaledValueWithLeadingZeros() : string { diff --git a/lib/Google/vendor/brick/math/src/BigInteger.php b/lib/Google/vendor/brick/math/src/BigInteger.php index 435679331..48a7bb3cf 100644 --- a/lib/Google/vendor/brick/math/src/BigInteger.php +++ b/lib/Google/vendor/brick/math/src/BigInteger.php @@ -10,16 +10,16 @@ use Brick\Math\Exception\NegativeNumberException; use Brick\Math\Exception\NumberFormatException; use Brick\Math\Internal\Calculator; +use Brick\Math\Internal\CalculatorRegistry; +use Override; /** * An arbitrary-size integer. * * All methods accepting a number as a parameter accept either a BigInteger instance, * an integer, or a string representing an arbitrary size integer. - * - * @psalm-immutable */ -final class BigInteger extends BigNumber +final readonly class BigInteger extends BigNumber { /** * The value, as a string of digits with optional leading minus sign. @@ -33,22 +33,18 @@ final class BigInteger extends BigNumber * Protected constructor. Use a factory method to obtain an instance. * * @param string $value A string of digits, with optional leading minus sign. + * + * @pure */ protected function __construct(string $value) { $this->value = $value; } - /** - * Creates a BigInteger of the given value. - * - * @throws MathException If the value cannot be converted to a BigInteger. - * - * @psalm-pure - */ - public static function of(BigNumber|int|float|string $value) : BigInteger + #[Override] + protected static function from(BigNumber $number): static { - return parent::of($value)->toBigInteger(); + return $number->toBigInteger(); } /** @@ -68,7 +64,7 @@ public static function of(BigNumber|int|float|string $value) : BigInteger * @throws NumberFormatException If the number is empty, or contains invalid chars for the given base. * @throws \InvalidArgumentException If the base is out of range. * - * @psalm-pure + * @pure */ public static function fromBase(string $number, int $base) : BigInteger { @@ -117,7 +113,7 @@ public static function fromBase(string $number, int $base) : BigInteger return new BigInteger($sign . $number); } - $result = Calculator::get()->fromBase($number, $base); + $result = CalculatorRegistry::get()->fromBase($number, $base); return new BigInteger($sign . $result); } @@ -133,7 +129,7 @@ public static function fromBase(string $number, int $base) : BigInteger * @throws NumberFormatException If the given number is empty or contains invalid chars for the given alphabet. * @throws \InvalidArgumentException If the alphabet does not contain at least 2 chars. * - * @psalm-pure + * @pure */ public static function fromArbitraryBase(string $number, string $alphabet) : BigInteger { @@ -153,7 +149,7 @@ public static function fromArbitraryBase(string $number, string $alphabet) : Big throw NumberFormatException::charNotInAlphabet($matches[0]); } - $number = Calculator::get()->fromArbitraryBase($number, $alphabet, $base); + $number = CalculatorRegistry::get()->fromArbitraryBase($number, $alphabet, $base); return new BigInteger($number); } @@ -174,6 +170,8 @@ public static function fromArbitraryBase(string $number, string $alphabet) : Big * sign bit. * * @throws NumberFormatException If the string is empty. + * + * @pure */ public static function fromBytes(string $value, bool $signed = true) : BigInteger { @@ -205,12 +203,10 @@ public static function fromBytes(string $value, bool $signed = true) : BigIntege * * Using the default random bytes generator, this method is suitable for cryptographic use. * - * @psalm-param (callable(int): string)|null $randomBytesGenerator - * - * @param int $numBits The number of bits. - * @param callable|null $randomBytesGenerator A function that accepts a number of bytes as an integer, and returns a - * string of random bytes of the given length. Defaults to the - * `random_bytes()` function. + * @param int $numBits The number of bits. + * @param (callable(int): string)|null $randomBytesGenerator A function that accepts a number of bytes, and returns + * a string of random bytes of the given length. Defaults + * to the `random_bytes()` function. * * @throws \InvalidArgumentException If $numBits is negative. */ @@ -225,9 +221,10 @@ public static function randomBits(int $numBits, ?callable $randomBytesGenerator } if ($randomBytesGenerator === null) { - $randomBytesGenerator = 'random_bytes'; + $randomBytesGenerator = random_bytes(...); } + /** @var int<1, max> $byteLength */ $byteLength = \intdiv($numBits - 1, 8) + 1; $extraBits = ($byteLength * 8 - $numBits); @@ -244,13 +241,11 @@ public static function randomBits(int $numBits, ?callable $randomBytesGenerator * * Using the default random bytes generator, this method is suitable for cryptographic use. * - * @psalm-param (callable(int): string)|null $randomBytesGenerator - * - * @param BigNumber|int|float|string $min The lower bound. Must be convertible to a BigInteger. - * @param BigNumber|int|float|string $max The upper bound. Must be convertible to a BigInteger. - * @param callable|null $randomBytesGenerator A function that accepts a number of bytes as an integer, - * and returns a string of random bytes of the given length. - * Defaults to the `random_bytes()` function. + * @param BigNumber|int|float|string $min The lower bound. Must be convertible to a BigInteger. + * @param BigNumber|int|float|string $max The upper bound. Must be convertible to a BigInteger. + * @param (callable(int): string)|null $randomBytesGenerator A function that accepts a number of bytes, and returns + * a string of random bytes of the given length. Defaults + * to the `random_bytes()` function. * * @throws MathException If one of the parameters cannot be converted to a BigInteger, * or `$min` is greater than `$max`. @@ -285,14 +280,11 @@ public static function randomRange( /** * Returns a BigInteger representing zero. * - * @psalm-pure + * @pure */ public static function zero() : BigInteger { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigInteger|null $zero - */ + /** @var BigInteger|null $zero */ static $zero; if ($zero === null) { @@ -305,14 +297,11 @@ public static function zero() : BigInteger /** * Returns a BigInteger representing one. * - * @psalm-pure + * @pure */ public static function one() : BigInteger { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigInteger|null $one - */ + /** @var BigInteger|null $one */ static $one; if ($one === null) { @@ -325,14 +314,11 @@ public static function one() : BigInteger /** * Returns a BigInteger representing ten. * - * @psalm-pure + * @pure */ public static function ten() : BigInteger { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigInteger|null $ten - */ + /** @var BigInteger|null $ten */ static $ten; if ($ten === null) { @@ -342,6 +328,9 @@ public static function ten() : BigInteger return $ten; } + /** + * @pure + */ public static function gcdMultiple(BigInteger $a, BigInteger ...$n): BigInteger { $result = $a; @@ -363,6 +352,8 @@ public static function gcdMultiple(BigInteger $a, BigInteger ...$n): BigInteger * @param BigNumber|int|float|string $that The number to add. Must be convertible to a BigInteger. * * @throws MathException If the number is not valid, or is not convertible to a BigInteger. + * + * @pure */ public function plus(BigNumber|int|float|string $that) : BigInteger { @@ -376,7 +367,7 @@ public function plus(BigNumber|int|float|string $that) : BigInteger return $that; } - $value = Calculator::get()->add($this->value, $that->value); + $value = CalculatorRegistry::get()->add($this->value, $that->value); return new BigInteger($value); } @@ -387,6 +378,8 @@ public function plus(BigNumber|int|float|string $that) : BigInteger * @param BigNumber|int|float|string $that The number to subtract. Must be convertible to a BigInteger. * * @throws MathException If the number is not valid, or is not convertible to a BigInteger. + * + * @pure */ public function minus(BigNumber|int|float|string $that) : BigInteger { @@ -396,7 +389,7 @@ public function minus(BigNumber|int|float|string $that) : BigInteger return $this; } - $value = Calculator::get()->sub($this->value, $that->value); + $value = CalculatorRegistry::get()->sub($this->value, $that->value); return new BigInteger($value); } @@ -407,6 +400,8 @@ public function minus(BigNumber|int|float|string $that) : BigInteger * @param BigNumber|int|float|string $that The multiplier. Must be convertible to a BigInteger. * * @throws MathException If the multiplier is not a valid number, or is not convertible to a BigInteger. + * + * @pure */ public function multipliedBy(BigNumber|int|float|string $that) : BigInteger { @@ -420,7 +415,7 @@ public function multipliedBy(BigNumber|int|float|string $that) : BigInteger return $that; } - $value = Calculator::get()->mul($this->value, $that->value); + $value = CalculatorRegistry::get()->mul($this->value, $that->value); return new BigInteger($value); } @@ -429,12 +424,14 @@ public function multipliedBy(BigNumber|int|float|string $that) : BigInteger * Returns the result of the division of this number by the given one. * * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. - * @param int $roundingMode An optional rounding mode. + * @param RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY. * * @throws MathException If the divisor is not a valid number, is not convertible to a BigInteger, is zero, * or RoundingMode::UNNECESSARY is used and the remainder is not zero. + * + * @pure */ - public function dividedBy(BigNumber|int|float|string $that, int $roundingMode = RoundingMode::UNNECESSARY) : BigInteger + public function dividedBy(BigNumber|int|float|string $that, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigInteger { $that = BigInteger::of($that); @@ -446,15 +443,40 @@ public function dividedBy(BigNumber|int|float|string $that, int $roundingMode = throw DivisionByZeroException::divisionByZero(); } - $result = Calculator::get()->divRound($this->value, $that->value, $roundingMode); + $result = CalculatorRegistry::get()->divRound($this->value, $that->value, $roundingMode); return new BigInteger($result); } + /** + * Limits (clamps) this number between the given minimum and maximum values. + * + * If the number is lower than $min, returns a copy of $min. + * If the number is greater than $max, returns a copy of $max. + * Otherwise, returns this number unchanged. + * + * @param BigNumber|int|float|string $min The minimum. Must be convertible to a BigInteger. + * @param BigNumber|int|float|string $max The maximum. Must be convertible to a BigInteger. + * + * @throws MathException If min/max are not convertible to a BigInteger. + */ + public function clamp(BigNumber|int|float|string $min, BigNumber|int|float|string $max) : BigInteger + { + if ($this->isLessThan($min)) { + return BigInteger::of($min); + } elseif ($this->isGreaterThan($max)) { + return BigInteger::of($max); + } + return $this; + } + + /** * Returns this number exponentiated to the given value. * * @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000. + * + * @pure */ public function power(int $exponent) : BigInteger { @@ -474,7 +496,7 @@ public function power(int $exponent) : BigInteger )); } - return new BigInteger(Calculator::get()->pow($this->value, $exponent)); + return new BigInteger(CalculatorRegistry::get()->pow($this->value, $exponent)); } /** @@ -483,6 +505,8 @@ public function power(int $exponent) : BigInteger * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. * * @throws DivisionByZeroException If the divisor is zero. + * + * @pure */ public function quotient(BigNumber|int|float|string $that) : BigInteger { @@ -496,7 +520,7 @@ public function quotient(BigNumber|int|float|string $that) : BigInteger throw DivisionByZeroException::divisionByZero(); } - $quotient = Calculator::get()->divQ($this->value, $that->value); + $quotient = CalculatorRegistry::get()->divQ($this->value, $that->value); return new BigInteger($quotient); } @@ -509,6 +533,8 @@ public function quotient(BigNumber|int|float|string $that) : BigInteger * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. * * @throws DivisionByZeroException If the divisor is zero. + * + * @pure */ public function remainder(BigNumber|int|float|string $that) : BigInteger { @@ -522,7 +548,7 @@ public function remainder(BigNumber|int|float|string $that) : BigInteger throw DivisionByZeroException::divisionByZero(); } - $remainder = Calculator::get()->divR($this->value, $that->value); + $remainder = CalculatorRegistry::get()->divR($this->value, $that->value); return new BigInteger($remainder); } @@ -532,9 +558,11 @@ public function remainder(BigNumber|int|float|string $that) : BigInteger * * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. * - * @return BigInteger[] An array containing the quotient and the remainder. + * @return array{BigInteger, BigInteger} An array containing the quotient and the remainder. * * @throws DivisionByZeroException If the divisor is zero. + * + * @pure */ public function quotientAndRemainder(BigNumber|int|float|string $that) : array { @@ -544,7 +572,7 @@ public function quotientAndRemainder(BigNumber|int|float|string $that) : array throw DivisionByZeroException::divisionByZero(); } - [$quotient, $remainder] = Calculator::get()->divQR($this->value, $that->value); + [$quotient, $remainder] = CalculatorRegistry::get()->divQR($this->value, $that->value); return [ new BigInteger($quotient), @@ -563,6 +591,8 @@ public function quotientAndRemainder(BigNumber|int|float|string $that) : array * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. * * @throws DivisionByZeroException If the divisor is zero. + * + * @pure */ public function mod(BigNumber|int|float|string $that) : BigInteger { @@ -572,7 +602,7 @@ public function mod(BigNumber|int|float|string $that) : BigInteger throw DivisionByZeroException::modulusMustNotBeZero(); } - $value = Calculator::get()->mod($this->value, $that->value); + $value = CalculatorRegistry::get()->mod($this->value, $that->value); return new BigInteger($value); } @@ -584,6 +614,8 @@ public function mod(BigNumber|int|float|string $that) : BigInteger * @throws NegativeNumberException If $m is negative. * @throws MathException If this BigInteger has no multiplicative inverse mod m (that is, this BigInteger * is not relatively prime to m). + * + * @pure */ public function modInverse(BigInteger $m) : BigInteger { @@ -599,7 +631,7 @@ public function modInverse(BigInteger $m) : BigInteger return BigInteger::zero(); } - $value = Calculator::get()->modInverse($this->value, $m->value); + $value = CalculatorRegistry::get()->modInverse($this->value, $m->value); if ($value === null) { throw new MathException('Unable to compute the modInverse for the given modulus.'); @@ -618,6 +650,8 @@ public function modInverse(BigInteger $m) : BigInteger * * @throws NegativeNumberException If any of the operands is negative. * @throws DivisionByZeroException If the modulus is zero. + * + * @pure */ public function modPow(BigNumber|int|float|string $exp, BigNumber|int|float|string $mod) : BigInteger { @@ -632,7 +666,7 @@ public function modPow(BigNumber|int|float|string $exp, BigNumber|int|float|stri throw DivisionByZeroException::modulusMustNotBeZero(); } - $result = Calculator::get()->modPow($this->value, $exp->value, $mod->value); + $result = CalculatorRegistry::get()->modPow($this->value, $exp->value, $mod->value); return new BigInteger($result); } @@ -643,6 +677,8 @@ public function modPow(BigNumber|int|float|string $exp, BigNumber|int|float|stri * The GCD is always positive, unless both operands are zero, in which case it is zero. * * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. + * + * @pure */ public function gcd(BigNumber|int|float|string $that) : BigInteger { @@ -656,7 +692,7 @@ public function gcd(BigNumber|int|float|string $that) : BigInteger return $that; } - $value = Calculator::get()->gcd($this->value, $that->value); + $value = CalculatorRegistry::get()->gcd($this->value, $that->value); return new BigInteger($value); } @@ -667,6 +703,8 @@ public function gcd(BigNumber|int|float|string $that) : BigInteger * The result is the largest x such that x² ≤ n. * * @throws NegativeNumberException If this number is negative. + * + * @pure */ public function sqrt() : BigInteger { @@ -674,13 +712,15 @@ public function sqrt() : BigInteger throw new NegativeNumberException('Cannot calculate the square root of a negative number.'); } - $value = Calculator::get()->sqrt($this->value); + $value = CalculatorRegistry::get()->sqrt($this->value); return new BigInteger($value); } /** * Returns the absolute value of this number. + * + * @pure */ public function abs() : BigInteger { @@ -689,10 +729,12 @@ public function abs() : BigInteger /** * Returns the inverse of this number. + * + * @pure */ public function negated() : BigInteger { - return new BigInteger(Calculator::get()->neg($this->value)); + return new BigInteger(CalculatorRegistry::get()->neg($this->value)); } /** @@ -701,12 +743,14 @@ public function negated() : BigInteger * This method returns a negative BigInteger if and only if both operands are negative. * * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. + * + * @pure */ public function and(BigNumber|int|float|string $that) : BigInteger { $that = BigInteger::of($that); - return new BigInteger(Calculator::get()->and($this->value, $that->value)); + return new BigInteger(CalculatorRegistry::get()->and($this->value, $that->value)); } /** @@ -715,12 +759,14 @@ public function and(BigNumber|int|float|string $that) : BigInteger * This method returns a negative BigInteger if and only if either of the operands is negative. * * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. + * + * @pure */ public function or(BigNumber|int|float|string $that) : BigInteger { $that = BigInteger::of($that); - return new BigInteger(Calculator::get()->or($this->value, $that->value)); + return new BigInteger(CalculatorRegistry::get()->or($this->value, $that->value)); } /** @@ -729,16 +775,20 @@ public function or(BigNumber|int|float|string $that) : BigInteger * This method returns a negative BigInteger if and only if exactly one of the operands is negative. * * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. + * + * @pure */ public function xor(BigNumber|int|float|string $that) : BigInteger { $that = BigInteger::of($that); - return new BigInteger(Calculator::get()->xor($this->value, $that->value)); + return new BigInteger(CalculatorRegistry::get()->xor($this->value, $that->value)); } /** * Returns the bitwise-not of this BigInteger. + * + * @pure */ public function not() : BigInteger { @@ -747,6 +797,8 @@ public function not() : BigInteger /** * Returns the integer left shifted by a given number of bits. + * + * @pure */ public function shiftedLeft(int $distance) : BigInteger { @@ -763,6 +815,8 @@ public function shiftedLeft(int $distance) : BigInteger /** * Returns the integer right shifted by a given number of bits. + * + * @pure */ public function shiftedRight(int $distance) : BigInteger { @@ -788,6 +842,8 @@ public function shiftedRight(int $distance) : BigInteger * * For positive BigIntegers, this is equivalent to the number of bits in the ordinary binary representation. * Computes (ceil(log2(this < 0 ? -this : this+1))). + * + * @pure */ public function getBitLength() : int { @@ -806,6 +862,8 @@ public function getBitLength() : int * Returns the index of the rightmost (lowest-order) one bit in this BigInteger. * * Returns -1 if this BigInteger contains no one bits. + * + * @pure */ public function getLowestSetBit() : int { @@ -825,6 +883,8 @@ public function getLowestSetBit() : int /** * Returns whether this number is even. + * + * @pure */ public function isEven() : bool { @@ -833,6 +893,8 @@ public function isEven() : bool /** * Returns whether this number is odd. + * + * @pure */ public function isOdd() : bool { @@ -847,6 +909,8 @@ public function isOdd() : bool * @param int $n The bit to test, 0-based. * * @throws \InvalidArgumentException If the bit to test is negative. + * + * @pure */ public function testBit(int $n) : bool { @@ -857,42 +921,49 @@ public function testBit(int $n) : bool return $this->shiftedRight($n)->isOdd(); } + #[Override] public function compareTo(BigNumber|int|float|string $that) : int { $that = BigNumber::of($that); if ($that instanceof BigInteger) { - return Calculator::get()->cmp($this->value, $that->value); + return CalculatorRegistry::get()->cmp($this->value, $that->value); } return - $that->compareTo($this); } + #[Override] public function getSign() : int { return ($this->value === '0') ? 0 : (($this->value[0] === '-') ? -1 : 1); } + #[Override] public function toBigInteger() : BigInteger { return $this; } + #[Override] public function toBigDecimal() : BigDecimal { return self::newBigDecimal($this->value); } + #[Override] public function toBigRational() : BigRational { return self::newBigRational($this, BigInteger::one(), false); } - public function toScale(int $scale, int $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal + #[Override] + public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal { return $this->toBigDecimal()->toScale($scale, $roundingMode); } + #[Override] public function toInt() : int { $intValue = (int) $this->value; @@ -904,6 +975,7 @@ public function toInt() : int return $intValue; } + #[Override] public function toFloat() : float { return (float) $this->value; @@ -915,6 +987,8 @@ public function toFloat() : float * The output will always be lowercase for bases greater than 10. * * @throws \InvalidArgumentException If the base is out of range. + * + * @pure */ public function toBase(int $base) : string { @@ -926,7 +1000,7 @@ public function toBase(int $base) : string throw new \InvalidArgumentException(\sprintf('Base %d is out of range [2, 36]', $base)); } - return Calculator::get()->toBase($this->value, $base); + return CalculatorRegistry::get()->toBase($this->value, $base); } /** @@ -939,6 +1013,8 @@ public function toBase(int $base) : string * * @throws NegativeNumberException If this number is negative. * @throws \InvalidArgumentException If the given alphabet does not contain at least 2 chars. + * + * @pure */ public function toArbitraryBase(string $alphabet) : string { @@ -952,7 +1028,7 @@ public function toArbitraryBase(string $alphabet) : string throw new NegativeNumberException(__FUNCTION__ . '() does not support negative numbers.'); } - return Calculator::get()->toArbitraryBase($this->value, $alphabet, $base); + return CalculatorRegistry::get()->toArbitraryBase($this->value, $alphabet, $base); } /** @@ -972,6 +1048,8 @@ public function toArbitraryBase(string $alphabet) : string * @param bool $signed Whether to output a signed number in two's-complement representation with a leading sign bit. * * @throws NegativeNumberException If $signed is false, and the number is negative. + * + * @pure */ public function toBytes(bool $signed = true) : string { @@ -1011,11 +1089,19 @@ public function toBytes(bool $signed = true) : string } } - return \hex2bin($hex); + $result = \hex2bin($hex); + assert($result !== false); + + return $result; } + /** + * @return numeric-string + */ + #[Override] public function __toString() : string { + /** @var numeric-string */ return $this->value; } @@ -1035,7 +1121,6 @@ public function __serialize(): array * This method is only here to allow unserializing the object and cannot be accessed directly. * * @internal - * @psalm-suppress RedundantPropertyInitializationCheck * * @param array{value: string} $data * @@ -1043,37 +1128,12 @@ public function __serialize(): array */ public function __unserialize(array $data): void { + /** @phpstan-ignore isset.initializedProperty */ if (isset($this->value)) { throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); } + /** @phpstan-ignore deadCode.unreachable */ $this->value = $data['value']; } - - /** - * This method is required by interface Serializable and SHOULD NOT be accessed directly. - * - * @internal - */ - public function serialize() : string - { - return $this->value; - } - - /** - * This method is only here to implement interface Serializable and cannot be accessed directly. - * - * @internal - * @psalm-suppress RedundantPropertyInitializationCheck - * - * @throws \LogicException - */ - public function unserialize($value) : void - { - if (isset($this->value)) { - throw new \LogicException('unserialize() is an internal function, it must not be called directly.'); - } - - $this->value = $value; - } } diff --git a/lib/Google/vendor/brick/math/src/BigNumber.php b/lib/Google/vendor/brick/math/src/BigNumber.php index 80146d207..2fbdf696e 100644 --- a/lib/Google/vendor/brick/math/src/BigNumber.php +++ b/lib/Google/vendor/brick/math/src/BigNumber.php @@ -8,38 +8,46 @@ use Brick\Math\Exception\MathException; use Brick\Math\Exception\NumberFormatException; use Brick\Math\Exception\RoundingNecessaryException; +use Override; /** - * Common interface for arbitrary-precision rational numbers. + * Base class for arbitrary-precision numbers. * - * @psalm-immutable + * This class is sealed: it is part of the public API but should not be subclassed in userland. + * Protected methods may change in any version. + * + * @phpstan-sealed BigInteger|BigDecimal|BigRational */ -abstract class BigNumber implements \Serializable, \JsonSerializable +abstract readonly class BigNumber implements \JsonSerializable, \Stringable { /** - * The regular expression used to parse integer, decimal and rational numbers. + * The regular expression used to parse integer or decimal numbers. */ - private const PARSE_REGEXP = + private const PARSE_REGEXP_NUMERICAL = '/^' . '(?[\-\+])?' . - '(?:' . - '(?:' . - '(?[0-9]+)?' . - '(?\.)?' . - '(?[0-9]+)?' . - '(?:[eE](?[\-\+]?[0-9]+))?' . - ')|(?:' . - '(?[0-9]+)' . - '\/?' . - '(?[0-9]+)' . - ')' . - ')' . + '(?[0-9]+)?' . + '(?\.)?' . + '(?[0-9]+)?' . + '(?:[eE](?[\-\+]?[0-9]+))?' . + '$/'; + + /** + * The regular expression used to parse rational numbers. + */ + private const PARSE_REGEXP_RATIONAL = + '/^' . + '(?[\-\+])?' . + '(?[0-9]+)' . + '\/?' . + '(?[0-9]+)' . '$/'; /** * Creates a BigNumber of the given value. * - * The concrete return type is dependent on the given value, with the following rules: + * When of() is called on BigNumber, the concrete return type is dependent on the given value, with the following + * rules: * * - BigNumber instances are returned as is * - integer numbers are returned as BigInteger @@ -48,12 +56,35 @@ abstract class BigNumber implements \Serializable, \JsonSerializable * - strings containing a `.` character or using an exponential notation are returned as BigDecimal * - strings containing only digits with an optional leading `+` or `-` sign are returned as BigInteger * - * @throws NumberFormatException If the format of the number is not valid. + * When of() is called on BigInteger, BigDecimal, or BigRational, the resulting number is converted to an instance + * of the subclass when possible; otherwise a RoundingNecessaryException exception is thrown. + * + * @throws NumberFormatException If the format of the number is not valid. * @throws DivisionByZeroException If the value represents a rational number with a denominator of zero. + * @throws RoundingNecessaryException If the value cannot be converted to an instance of the subclass without rounding. * - * @psalm-pure + * @pure */ - public static function of(BigNumber|int|float|string $value) : BigNumber + final public static function of(BigNumber|int|float|string $value) : static + { + $value = self::_of($value); + + if (static::class === BigNumber::class) { + assert($value instanceof static); + + return $value; + } + + return static::from($value); + } + + /** + * @throws NumberFormatException If the format of the number is not valid. + * @throws DivisionByZeroException If the value represents a rational number with a denominator of zero. + * + * @pure + */ + private static function _of(BigNumber|int|float|string $value) : BigNumber { if ($value instanceof BigNumber) { return $value; @@ -63,34 +94,22 @@ public static function of(BigNumber|int|float|string $value) : BigNumber return new BigInteger((string) $value); } - $value = \is_float($value) ? self::floatToString($value) : $value; - - $throw = static function() use ($value) : void { - throw new NumberFormatException(\sprintf( - 'The given value "%s" does not represent a valid number.', - $value - )); - }; - - if (\preg_match(self::PARSE_REGEXP, $value, $matches) !== 1) { - $throw(); + if (is_float($value)) { + $value = (string) $value; } - $getMatch = static fn(string $value): ?string => (($matches[$value] ?? '') !== '') ? $matches[$value] : null; - - $sign = $getMatch('sign'); - $numerator = $getMatch('numerator'); - $denominator = $getMatch('denominator'); - - if ($numerator !== null) { - assert($denominator !== null); - - if ($sign !== null) { - $numerator = $sign . $numerator; + if (str_contains($value, '/')) { + // Rational number + if (\preg_match(self::PARSE_REGEXP_RATIONAL, $value, $matches, PREG_UNMATCHED_AS_NULL) !== 1) { + throw NumberFormatException::invalidFormat($value); } - $numerator = self::cleanUp($numerator); - $denominator = self::cleanUp($denominator); + $sign = $matches['sign']; + $numerator = $matches['numerator']; + $denominator = $matches['denominator']; + + $numerator = self::cleanUp($sign, $numerator); + $denominator = self::cleanUp(null, $denominator); if ($denominator === '0') { throw DivisionByZeroException::denominatorMustNotBeZero(); @@ -101,75 +120,70 @@ public static function of(BigNumber|int|float|string $value) : BigNumber new BigInteger($denominator), false ); - } + } else { + // Integer or decimal number + if (\preg_match(self::PARSE_REGEXP_NUMERICAL, $value, $matches, PREG_UNMATCHED_AS_NULL) !== 1) { + throw NumberFormatException::invalidFormat($value); + } - $point = $getMatch('point'); - $integral = $getMatch('integral'); - $fractional = $getMatch('fractional'); - $exponent = $getMatch('exponent'); + $sign = $matches['sign']; + $point = $matches['point']; + $integral = $matches['integral']; + $fractional = $matches['fractional']; + $exponent = $matches['exponent']; - if ($integral === null && $fractional === null) { - $throw(); - } + if ($integral === null && $fractional === null) { + throw NumberFormatException::invalidFormat($value); + } - if ($integral === null) { - $integral = '0'; - } + if ($integral === null) { + $integral = '0'; + } - if ($point !== null || $exponent !== null) { - $fractional = ($fractional ?? ''); - $exponent = ($exponent !== null) ? (int) $exponent : 0; + if ($point !== null || $exponent !== null) { + $fractional ??= ''; + $exponent = ($exponent !== null) ? (int)$exponent : 0; - if ($exponent === PHP_INT_MIN || $exponent === PHP_INT_MAX) { - throw new NumberFormatException('Exponent too large.'); - } + if ($exponent === PHP_INT_MIN || $exponent === PHP_INT_MAX) { + throw new NumberFormatException('Exponent too large.'); + } - $unscaledValue = self::cleanUp(($sign ?? ''). $integral . $fractional); + $unscaledValue = self::cleanUp($sign, $integral . $fractional); - $scale = \strlen($fractional) - $exponent; + $scale = \strlen($fractional) - $exponent; - if ($scale < 0) { - if ($unscaledValue !== '0') { - $unscaledValue .= \str_repeat('0', - $scale); + if ($scale < 0) { + if ($unscaledValue !== '0') { + $unscaledValue .= \str_repeat('0', -$scale); + } + $scale = 0; } - $scale = 0; - } - return new BigDecimal($unscaledValue, $scale); - } + return new BigDecimal($unscaledValue, $scale); + } - $integral = self::cleanUp(($sign ?? '') . $integral); + $integral = self::cleanUp($sign, $integral); - return new BigInteger($integral); + return new BigInteger($integral); + } } /** - * Safely converts float to string, avoiding locale-dependent issues. + * Overridden by subclasses to convert a BigNumber to an instance of the subclass. * - * @see https://github.com/brick/math/pull/20 + * @throws RoundingNecessaryException If the value cannot be converted. * - * @psalm-pure - * @psalm-suppress ImpureFunctionCall + * @pure */ - private static function floatToString(float $float) : string - { - $currentLocale = \setlocale(LC_NUMERIC, '0'); - \setlocale(LC_NUMERIC, 'C'); - - $result = (string) $float; - - \setlocale(LC_NUMERIC, $currentLocale); - - return $result; - } + abstract protected static function from(BigNumber $number): static; /** * Proxy method to access BigInteger's protected constructor from sibling classes. * + * @pure * @internal - * @psalm-pure */ - protected function newBigInteger(string $value) : BigInteger + final protected function newBigInteger(string $value) : BigInteger { return new BigInteger($value); } @@ -177,10 +191,10 @@ protected function newBigInteger(string $value) : BigInteger /** * Proxy method to access BigDecimal's protected constructor from sibling classes. * + * @pure * @internal - * @psalm-pure */ - protected function newBigDecimal(string $value, int $scale = 0) : BigDecimal + final protected function newBigDecimal(string $value, int $scale = 0) : BigDecimal { return new BigDecimal($value, $scale); } @@ -188,10 +202,10 @@ protected function newBigDecimal(string $value, int $scale = 0) : BigDecimal /** * Proxy method to access BigRational's protected constructor from sibling classes. * + * @pure * @internal - * @psalm-pure */ - protected function newBigRational(BigInteger $numerator, BigInteger $denominator, bool $checkDenominator) : BigRational + final protected function newBigRational(BigInteger $numerator, BigInteger $denominator, bool $checkDenominator) : BigRational { return new BigRational($numerator, $denominator, $checkDenominator); } @@ -205,11 +219,9 @@ protected function newBigRational(BigInteger $numerator, BigInteger $denominator * @throws \InvalidArgumentException If no values are given. * @throws MathException If an argument is not valid. * - * @psalm-suppress LessSpecificReturnStatement - * @psalm-suppress MoreSpecificReturnType - * @psalm-pure + * @pure */ - public static function min(BigNumber|int|float|string ...$values) : static + final public static function min(BigNumber|int|float|string ...$values) : static { $min = null; @@ -237,11 +249,9 @@ public static function min(BigNumber|int|float|string ...$values) : static * @throws \InvalidArgumentException If no values are given. * @throws MathException If an argument is not valid. * - * @psalm-suppress LessSpecificReturnStatement - * @psalm-suppress MoreSpecificReturnType - * @psalm-pure + * @pure */ - public static function max(BigNumber|int|float|string ...$values) : static + final public static function max(BigNumber|int|float|string ...$values) : static { $max = null; @@ -263,41 +273,43 @@ public static function max(BigNumber|int|float|string ...$values) : static /** * Returns the sum of the given values. * - * @param BigNumber|int|float|string ...$values The numbers to add. All the numbers need to be convertible - * to an instance of the class this method is called on. + * When called on BigNumber, sum() accepts any supported type and returns a result whose type is the widest among + * the given values (BigInteger < BigDecimal < BigRational). + * + * When called on BigInteger, BigDecimal, or BigRational, sum() requires that all values can be converted to that + * specific subclass, and returns a result of the same type. + * + * @param BigNumber|int|float|string ...$values The values to add. All values must be convertible to the class on + * which this method is called. * * @throws \InvalidArgumentException If no values are given. * @throws MathException If an argument is not valid. * - * @psalm-pure + * @pure */ - public static function sum(BigNumber|int|float|string ...$values) : static + final public static function sum(BigNumber|int|float|string ...$values) : static { - /** @var static|null $sum */ - $sum = null; + $first = array_shift($values); - foreach ($values as $value) { - $value = static::of($value); - - $sum = $sum === null ? $value : self::add($sum, $value); + if ($first === null) { + throw new \InvalidArgumentException(__METHOD__ . '() expects at least one value.'); } - if ($sum === null) { - throw new \InvalidArgumentException(__METHOD__ . '() expects at least one value.'); + $sum = static::of($first); + + foreach ($values as $value) { + $sum = self::add($sum, static::of($value)); } + assert($sum instanceof static); + return $sum; } /** * Adds two BigNumber instances in the correct order to avoid a RoundingNecessaryException. * - * @todo This could be better resolved by creating an abstract protected method in BigNumber, and leaving to - * concrete classes the responsibility to perform the addition themselves or delegate it to the given number, - * depending on their ability to perform the operation. This will also require a version bump because we're - * potentially breaking custom BigNumber implementations (if any...) - * - * @psalm-pure + * @pure */ private static function add(BigNumber $a, BigNumber $b) : BigNumber { @@ -317,115 +329,124 @@ private static function add(BigNumber $a, BigNumber $b) : BigNumber return $b->plus($a); } - /** @var BigInteger $a */ - return $a->plus($b); } /** - * Removes optional leading zeros and + sign from the given number. + * Removes optional leading zeros and applies sign. * - * @param string $number The number, validated as a non-empty string of digits with optional leading sign. + * @param string|null $sign The sign, '+' or '-', optional. Null is allowed for convenience and treated as '+'. + * @param string $number The number, validated as a string of digits. * - * @psalm-pure + * @pure */ - private static function cleanUp(string $number) : string + private static function cleanUp(string|null $sign, string $number) : string { - $firstChar = $number[0]; - - if ($firstChar === '+' || $firstChar === '-') { - $number = \substr($number, 1); - } - $number = \ltrim($number, '0'); if ($number === '') { return '0'; } - if ($firstChar === '-') { - return '-' . $number; - } - - return $number; + return $sign === '-' ? '-' . $number : $number; } /** * Checks if this number is equal to the given one. + * + * @pure */ - public function isEqualTo(BigNumber|int|float|string $that) : bool + final public function isEqualTo(BigNumber|int|float|string $that) : bool { return $this->compareTo($that) === 0; } /** * Checks if this number is strictly lower than the given one. + * + * @pure */ - public function isLessThan(BigNumber|int|float|string $that) : bool + final public function isLessThan(BigNumber|int|float|string $that) : bool { return $this->compareTo($that) < 0; } /** * Checks if this number is lower than or equal to the given one. + * + * @pure */ - public function isLessThanOrEqualTo(BigNumber|int|float|string $that) : bool + final public function isLessThanOrEqualTo(BigNumber|int|float|string $that) : bool { return $this->compareTo($that) <= 0; } /** * Checks if this number is strictly greater than the given one. + * + * @pure */ - public function isGreaterThan(BigNumber|int|float|string $that) : bool + final public function isGreaterThan(BigNumber|int|float|string $that) : bool { return $this->compareTo($that) > 0; } /** * Checks if this number is greater than or equal to the given one. + * + * @pure */ - public function isGreaterThanOrEqualTo(BigNumber|int|float|string $that) : bool + final public function isGreaterThanOrEqualTo(BigNumber|int|float|string $that) : bool { return $this->compareTo($that) >= 0; } /** * Checks if this number equals zero. + * + * @pure */ - public function isZero() : bool + final public function isZero() : bool { return $this->getSign() === 0; } /** * Checks if this number is strictly negative. + * + * @pure */ - public function isNegative() : bool + final public function isNegative() : bool { return $this->getSign() < 0; } /** * Checks if this number is negative or zero. + * + * @pure */ - public function isNegativeOrZero() : bool + final public function isNegativeOrZero() : bool { return $this->getSign() <= 0; } /** * Checks if this number is strictly positive. + * + * @pure */ - public function isPositive() : bool + final public function isPositive() : bool { return $this->getSign() > 0; } /** * Checks if this number is positive or zero. + * + * @pure */ - public function isPositiveOrZero() : bool + final public function isPositiveOrZero() : bool { return $this->getSign() >= 0; } @@ -433,16 +454,24 @@ public function isPositiveOrZero() : bool /** * Returns the sign of this number. * - * @return int -1 if the number is negative, 0 if zero, 1 if positive. + * Returns -1 if the number is negative, 0 if zero, 1 if positive. + * + * @return -1|0|1 + * + * @pure */ abstract public function getSign() : int; /** * Compares this number to the given one. * - * @return int [-1,0,1] If `$this` is lower than, equal to, or greater than `$that`. + * Returns -1 if `$this` is lower than, 0 if equal to, 1 if greater than `$that`. + * + * @return -1|0|1 * * @throws MathException If the number is not valid. + * + * @pure */ abstract public function compareTo(BigNumber|int|float|string $that) : int; @@ -450,6 +479,8 @@ abstract public function compareTo(BigNumber|int|float|string $that) : int; * Converts this number to a BigInteger. * * @throws RoundingNecessaryException If this number cannot be converted to a BigInteger without rounding. + * + * @pure */ abstract public function toBigInteger() : BigInteger; @@ -457,24 +488,30 @@ abstract public function toBigInteger() : BigInteger; * Converts this number to a BigDecimal. * * @throws RoundingNecessaryException If this number cannot be converted to a BigDecimal without rounding. + * + * @pure */ abstract public function toBigDecimal() : BigDecimal; /** * Converts this number to a BigRational. + * + * @pure */ abstract public function toBigRational() : BigRational; /** * Converts this number to a BigDecimal with the given scale, using rounding if necessary. * - * @param int $scale The scale of the resulting `BigDecimal`. - * @param int $roundingMode A `RoundingMode` constant. + * @param int $scale The scale of the resulting `BigDecimal`. + * @param RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY. * * @throws RoundingNecessaryException If this number cannot be converted to the given scale without rounding. * This only applies when RoundingMode::UNNECESSARY is used. + * + * @pure */ - abstract public function toScale(int $scale, int $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal; + abstract public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal; /** * Returns the exact value of this number as a native integer. @@ -483,6 +520,8 @@ abstract public function toScale(int $scale, int $roundingMode = RoundingMode::U * Note that the acceptable range for an integer depends on the platform and differs for 32-bit and 64-bit. * * @throws MathException If this number cannot be exactly converted to a native integer. + * + * @pure */ abstract public function toInt() : int; @@ -494,6 +533,8 @@ abstract public function toInt() : int; * * If the number is greater than the largest representable floating point number, positive infinity is returned. * If the number is less than the smallest representable floating point number, negative infinity is returned. + * + * @pure */ abstract public function toFloat() : float; @@ -502,10 +543,13 @@ abstract public function toFloat() : float; * * The output of this method can be parsed by the `of()` factory method; * this will yield an object equal to this one, without any information loss. + * + * @pure */ abstract public function __toString() : string; - public function jsonSerialize() : string + #[Override] + final public function jsonSerialize() : string { return $this->__toString(); } diff --git a/lib/Google/vendor/brick/math/src/BigRational.php b/lib/Google/vendor/brick/math/src/BigRational.php index 31f2904fa..56045e537 100644 --- a/lib/Google/vendor/brick/math/src/BigRational.php +++ b/lib/Google/vendor/brick/math/src/BigRational.php @@ -8,15 +8,14 @@ use Brick\Math\Exception\MathException; use Brick\Math\Exception\NumberFormatException; use Brick\Math\Exception\RoundingNecessaryException; +use Override; /** * An arbitrarily large rational number. * * This class is immutable. - * - * @psalm-immutable */ -final class BigRational extends BigNumber +final readonly class BigRational extends BigNumber { /** * The numerator. @@ -36,6 +35,8 @@ final class BigRational extends BigNumber * @param bool $checkDenominator Whether to check the denominator for negative and zero. * * @throws DivisionByZeroException If the denominator is zero. + * + * @pure */ protected function __construct(BigInteger $numerator, BigInteger $denominator, bool $checkDenominator) { @@ -54,16 +55,10 @@ protected function __construct(BigInteger $numerator, BigInteger $denominator, b $this->denominator = $denominator; } - /** - * Creates a BigRational of the given value. - * - * @throws MathException If the value cannot be converted to a BigRational. - * - * @psalm-pure - */ - public static function of(BigNumber|int|float|string $value) : BigRational + #[Override] + protected static function from(BigNumber $number): static { - return parent::of($value)->toBigRational(); + return $number->toBigRational(); } /** @@ -79,7 +74,7 @@ public static function of(BigNumber|int|float|string $value) : BigRational * @throws RoundingNecessaryException If an argument represents a non-integer number. * @throws DivisionByZeroException If the denominator is zero. * - * @psalm-pure + * @pure */ public static function nd( BigNumber|int|float|string $numerator, @@ -94,14 +89,11 @@ public static function nd( /** * Returns a BigRational representing zero. * - * @psalm-pure + * @pure */ public static function zero() : BigRational { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigRational|null $zero - */ + /** @var BigRational|null $zero */ static $zero; if ($zero === null) { @@ -114,14 +106,11 @@ public static function zero() : BigRational /** * Returns a BigRational representing one. * - * @psalm-pure + * @pure */ public static function one() : BigRational { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigRational|null $one - */ + /** @var BigRational|null $one */ static $one; if ($one === null) { @@ -134,14 +123,11 @@ public static function one() : BigRational /** * Returns a BigRational representing ten. * - * @psalm-pure + * @pure */ public static function ten() : BigRational { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigRational|null $ten - */ + /** @var BigRational|null $ten */ static $ten; if ($ten === null) { @@ -151,11 +137,17 @@ public static function ten() : BigRational return $ten; } + /** + * @pure + */ public function getNumerator() : BigInteger { return $this->numerator; } + /** + * @pure + */ public function getDenominator() : BigInteger { return $this->denominator; @@ -163,6 +155,8 @@ public function getDenominator() : BigInteger /** * Returns the quotient of the division of the numerator by the denominator. + * + * @pure */ public function quotient() : BigInteger { @@ -171,6 +165,8 @@ public function quotient() : BigInteger /** * Returns the remainder of the division of the numerator by the denominator. + * + * @pure */ public function remainder() : BigInteger { @@ -180,7 +176,9 @@ public function remainder() : BigInteger /** * Returns the quotient and remainder of the division of the numerator by the denominator. * - * @return BigInteger[] + * @return array{BigInteger, BigInteger} + * + * @pure */ public function quotientAndRemainder() : array { @@ -193,6 +191,8 @@ public function quotientAndRemainder() : array * @param BigNumber|int|float|string $that The number to add. * * @throws MathException If the number is not valid. + * + * @pure */ public function plus(BigNumber|int|float|string $that) : BigRational { @@ -211,6 +211,8 @@ public function plus(BigNumber|int|float|string $that) : BigRational * @param BigNumber|int|float|string $that The number to subtract. * * @throws MathException If the number is not valid. + * + * @pure */ public function minus(BigNumber|int|float|string $that) : BigRational { @@ -229,6 +231,8 @@ public function minus(BigNumber|int|float|string $that) : BigRational * @param BigNumber|int|float|string $that The multiplier. * * @throws MathException If the multiplier is not a valid number. + * + * @pure */ public function multipliedBy(BigNumber|int|float|string $that) : BigRational { @@ -246,6 +250,8 @@ public function multipliedBy(BigNumber|int|float|string $that) : BigRational * @param BigNumber|int|float|string $that The divisor. * * @throws MathException If the divisor is not a valid number, or is zero. + * + * @pure */ public function dividedBy(BigNumber|int|float|string $that) : BigRational { @@ -261,6 +267,8 @@ public function dividedBy(BigNumber|int|float|string $that) : BigRational * Returns this number exponentiated to the given value. * * @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000. + * + * @pure */ public function power(int $exponent) : BigRational { @@ -287,6 +295,8 @@ public function power(int $exponent) : BigRational * The reciprocal has the numerator and denominator swapped. * * @throws DivisionByZeroException If the numerator is zero. + * + * @pure */ public function reciprocal() : BigRational { @@ -295,6 +305,8 @@ public function reciprocal() : BigRational /** * Returns the absolute value of this BigRational. + * + * @pure */ public function abs() : BigRational { @@ -303,6 +315,8 @@ public function abs() : BigRational /** * Returns the negated value of this BigRational. + * + * @pure */ public function negated() : BigRational { @@ -311,6 +325,8 @@ public function negated() : BigRational /** * Returns the simplified value of this BigRational. + * + * @pure */ public function simplified() : BigRational { @@ -322,16 +338,19 @@ public function simplified() : BigRational return new BigRational($numerator, $denominator, false); } + #[Override] public function compareTo(BigNumber|int|float|string $that) : int { return $this->minus($that)->getSign(); } + #[Override] public function getSign() : int { return $this->numerator->getSign(); } + #[Override] public function toBigInteger() : BigInteger { $simplified = $this->simplified(); @@ -343,32 +362,38 @@ public function toBigInteger() : BigInteger return $simplified->numerator; } + #[Override] public function toBigDecimal() : BigDecimal { return $this->numerator->toBigDecimal()->exactlyDividedBy($this->denominator); } + #[Override] public function toBigRational() : BigRational { return $this; } - public function toScale(int $scale, int $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal + #[Override] + public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal { return $this->numerator->toBigDecimal()->dividedBy($this->denominator, $scale, $roundingMode); } + #[Override] public function toInt() : int { return $this->toBigInteger()->toInt(); } + #[Override] public function toFloat() : float { $simplified = $this->simplified(); return $simplified->numerator->toFloat() / $simplified->denominator->toFloat(); } + #[Override] public function __toString() : string { $numerator = (string) $this->numerator; @@ -378,7 +403,7 @@ public function __toString() : string return $numerator; } - return $this->numerator . '/' . $this->denominator; + return $numerator . '/' . $denominator; } /** @@ -397,7 +422,6 @@ public function __serialize(): array * This method is only here to allow unserializing the object and cannot be accessed directly. * * @internal - * @psalm-suppress RedundantPropertyInitializationCheck * * @param array{numerator: BigInteger, denominator: BigInteger} $data * @@ -405,41 +429,13 @@ public function __serialize(): array */ public function __unserialize(array $data): void { + /** @phpstan-ignore isset.initializedProperty */ if (isset($this->numerator)) { throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); } + /** @phpstan-ignore deadCode.unreachable */ $this->numerator = $data['numerator']; $this->denominator = $data['denominator']; } - - /** - * This method is required by interface Serializable and SHOULD NOT be accessed directly. - * - * @internal - */ - public function serialize() : string - { - return $this->numerator . '/' . $this->denominator; - } - - /** - * This method is only here to implement interface Serializable and cannot be accessed directly. - * - * @internal - * @psalm-suppress RedundantPropertyInitializationCheck - * - * @throws \LogicException - */ - public function unserialize($value) : void - { - if (isset($this->numerator)) { - throw new \LogicException('unserialize() is an internal function, it must not be called directly.'); - } - - [$numerator, $denominator] = \explode('/', $value); - - $this->numerator = BigInteger::of($numerator); - $this->denominator = BigInteger::of($denominator); - } } diff --git a/lib/Google/vendor/brick/math/src/Exception/DivisionByZeroException.php b/lib/Google/vendor/brick/math/src/Exception/DivisionByZeroException.php index ce7769ac2..2daaf5ed8 100644 --- a/lib/Google/vendor/brick/math/src/Exception/DivisionByZeroException.php +++ b/lib/Google/vendor/brick/math/src/Exception/DivisionByZeroException.php @@ -7,10 +7,10 @@ /** * Exception thrown when a division by zero occurs. */ -class DivisionByZeroException extends MathException +final class DivisionByZeroException extends MathException { /** - * @psalm-pure + * @pure */ public static function divisionByZero() : DivisionByZeroException { @@ -18,7 +18,7 @@ public static function divisionByZero() : DivisionByZeroException } /** - * @psalm-pure + * @pure */ public static function modulusMustNotBeZero() : DivisionByZeroException { @@ -26,7 +26,7 @@ public static function modulusMustNotBeZero() : DivisionByZeroException } /** - * @psalm-pure + * @pure */ public static function denominatorMustNotBeZero() : DivisionByZeroException { diff --git a/lib/Google/vendor/brick/math/src/Exception/IntegerOverflowException.php b/lib/Google/vendor/brick/math/src/Exception/IntegerOverflowException.php index c73b49097..56f3cf84c 100644 --- a/lib/Google/vendor/brick/math/src/Exception/IntegerOverflowException.php +++ b/lib/Google/vendor/brick/math/src/Exception/IntegerOverflowException.php @@ -9,10 +9,10 @@ /** * Exception thrown when an integer overflow occurs. */ -class IntegerOverflowException extends MathException +final class IntegerOverflowException extends MathException { /** - * @psalm-pure + * @pure */ public static function toIntOverflow(BigInteger $value) : IntegerOverflowException { diff --git a/lib/Google/vendor/brick/math/src/Exception/MathException.php b/lib/Google/vendor/brick/math/src/Exception/MathException.php index 46e9c3fe4..8facd9c62 100644 --- a/lib/Google/vendor/brick/math/src/Exception/MathException.php +++ b/lib/Google/vendor/brick/math/src/Exception/MathException.php @@ -7,6 +7,6 @@ /** * Base class for all math exceptions. */ -class MathException extends \Exception +class MathException extends \RuntimeException { } diff --git a/lib/Google/vendor/brick/math/src/Exception/NegativeNumberException.php b/lib/Google/vendor/brick/math/src/Exception/NegativeNumberException.php index 473911341..73ed3a494 100644 --- a/lib/Google/vendor/brick/math/src/Exception/NegativeNumberException.php +++ b/lib/Google/vendor/brick/math/src/Exception/NegativeNumberException.php @@ -7,6 +7,6 @@ /** * Exception thrown when attempting to perform an unsupported operation, such as a square root, on a negative number. */ -class NegativeNumberException extends MathException +final class NegativeNumberException extends MathException { } diff --git a/lib/Google/vendor/brick/math/src/Exception/NumberFormatException.php b/lib/Google/vendor/brick/math/src/Exception/NumberFormatException.php index d9cf6ff5f..0dcda3483 100644 --- a/lib/Google/vendor/brick/math/src/Exception/NumberFormatException.php +++ b/lib/Google/vendor/brick/math/src/Exception/NumberFormatException.php @@ -7,12 +7,23 @@ /** * Exception thrown when attempting to create a number from a string with an invalid format. */ -class NumberFormatException extends MathException +final class NumberFormatException extends MathException { + /** + * @pure + */ + public static function invalidFormat(string $value) : self + { + return new self(\sprintf( + 'The given value "%s" does not represent a valid number.', + $value, + )); + } + /** * @param string $char The failing character. * - * @psalm-pure + * @pure */ public static function charNotInAlphabet(string $char) : self { @@ -28,6 +39,6 @@ public static function charNotInAlphabet(string $char) : self $char = '"' . $char . '"'; } - return new self(sprintf('Char %s is not a valid character in the given alphabet.', $char)); + return new self(\sprintf('Char %s is not a valid character in the given alphabet.', $char)); } } diff --git a/lib/Google/vendor/brick/math/src/Exception/RoundingNecessaryException.php b/lib/Google/vendor/brick/math/src/Exception/RoundingNecessaryException.php index 57bfcd844..034a04069 100644 --- a/lib/Google/vendor/brick/math/src/Exception/RoundingNecessaryException.php +++ b/lib/Google/vendor/brick/math/src/Exception/RoundingNecessaryException.php @@ -7,10 +7,10 @@ /** * Exception thrown when a number cannot be represented at the requested scale without rounding. */ -class RoundingNecessaryException extends MathException +final class RoundingNecessaryException extends MathException { /** - * @psalm-pure + * @pure */ public static function roundingNecessary() : RoundingNecessaryException { diff --git a/lib/Google/vendor/brick/math/src/Internal/Calculator.php b/lib/Google/vendor/brick/math/src/Internal/Calculator.php index b8cecda96..a5e000a42 100644 --- a/lib/Google/vendor/brick/math/src/Internal/Calculator.php +++ b/lib/Google/vendor/brick/math/src/Internal/Calculator.php @@ -17,78 +17,25 @@ * All methods must return strings respecting this format, unless specified otherwise. * * @internal - * - * @psalm-immutable */ -abstract class Calculator +abstract readonly class Calculator { /** * The maximum exponent value allowed for the pow() method. */ - public const MAX_POWER = 1000000; + public const MAX_POWER = 1_000_000; /** * The alphabet for converting from and to base 2 to 36, lowercase. */ public const ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz'; - /** - * The Calculator instance in use. - */ - private static ?Calculator $instance = null; - - /** - * Sets the Calculator instance to use. - * - * An instance is typically set only in unit tests: the autodetect is usually the best option. - * - * @param Calculator|null $calculator The calculator instance, or NULL to revert to autodetect. - */ - final public static function set(?Calculator $calculator) : void - { - self::$instance = $calculator; - } - - /** - * Returns the Calculator instance to use. - * - * If none has been explicitly set, the fastest available implementation will be returned. - * - * @psalm-pure - * @psalm-suppress ImpureStaticProperty - */ - final public static function get() : Calculator - { - if (self::$instance === null) { - /** @psalm-suppress ImpureMethodCall */ - self::$instance = self::detect(); - } - - return self::$instance; - } - - /** - * Returns the fastest available Calculator implementation. - * - * @codeCoverageIgnore - */ - private static function detect() : Calculator - { - if (\extension_loaded('gmp')) { - return new Calculator\GmpCalculator(); - } - - if (\extension_loaded('bcmath')) { - return new Calculator\BcMathCalculator(); - } - - return new Calculator\NativeCalculator(); - } - /** * Extracts the sign & digits of the operands. * * @return array{bool, bool, string, string} Whether $a and $b are negative, followed by their digits. + * + * @pure */ final protected function init(string $a, string $b) : array { @@ -103,6 +50,8 @@ final protected function init(string $a, string $b) : array /** * Returns the absolute value of a number. + * + * @pure */ final public function abs(string $n) : string { @@ -111,6 +60,8 @@ final public function abs(string $n) : string /** * Negates a number. + * + * @pure */ final public function neg(string $n) : string { @@ -128,7 +79,11 @@ final public function neg(string $n) : string /** * Compares two numbers. * - * @return int [-1, 0, 1] If the first number is less than, equal to, or greater than the second number. + * Returns -1 if the first number is less than, 0 if equal to, 1 if greater than the second number. + * + * @return -1|0|1 + * + * @pure */ final public function cmp(string $a, string $b) : int { @@ -158,16 +113,22 @@ final public function cmp(string $a, string $b) : int /** * Adds two numbers. + * + * @pure */ abstract public function add(string $a, string $b) : string; /** * Subtracts two numbers. + * + * @pure */ abstract public function sub(string $a, string $b) : string; /** * Multiplies two numbers. + * + * @pure */ abstract public function mul(string $a, string $b) : string; @@ -178,6 +139,8 @@ abstract public function mul(string $a, string $b) : string; * @param string $b The divisor, must not be zero. * * @return string The quotient. + * + * @pure */ abstract public function divQ(string $a, string $b) : string; @@ -188,6 +151,8 @@ abstract public function divQ(string $a, string $b) : string; * @param string $b The divisor, must not be zero. * * @return string The remainder. + * + * @pure */ abstract public function divR(string $a, string $b) : string; @@ -198,6 +163,8 @@ abstract public function divR(string $a, string $b) : string; * @param string $b The divisor, must not be zero. * * @return array{string, string} An array containing the quotient and remainder. + * + * @pure */ abstract public function divQR(string $a, string $b) : array; @@ -208,11 +175,15 @@ abstract public function divQR(string $a, string $b) : array; * @param int $e The exponent, validated as an integer between 0 and MAX_POWER. * * @return string The power. + * + * @pure */ abstract public function pow(string $a, int $e) : string; /** * @param string $b The modulus; must not be zero. + * + * @pure */ public function mod(string $a, string $b) : string { @@ -227,6 +198,8 @@ public function mod(string $a, string $b) : string * This method can be overridden by the concrete implementation if the underlying library has built-in support. * * @param string $m The modulus; must not be negative or zero. + * + * @pure */ public function modInverse(string $x, string $m) : ?string { @@ -255,6 +228,8 @@ public function modInverse(string $x, string $m) : ?string * @param string $base The base number; must be positive or zero. * @param string $exp The exponent; must be positive or zero. * @param string $mod The modulus; must be strictly positive. + * + * @pure */ abstract public function modPow(string $base, string $exp, string $mod) : string; @@ -265,6 +240,8 @@ abstract public function modPow(string $base, string $exp, string $mod) : string * has built-in support for GCD calculations. * * @return string The GCD, always positive, or zero if both arguments are zero. + * + * @pure */ public function gcd(string $a, string $b) : string { @@ -281,6 +258,8 @@ public function gcd(string $a, string $b) : string /** * @return array{string, string, string} GCD, X, Y + * + * @pure */ private function gcdExtended(string $a, string $b) : array { @@ -301,6 +280,8 @@ private function gcdExtended(string $a, string $b) : array * * The result is the largest x such that x² ≤ n. * The input MUST NOT be negative. + * + * @pure */ abstract public function sqrt(string $n) : string; @@ -314,6 +295,8 @@ abstract public function sqrt(string $n) : string; * @param int $base The base of the number, validated from 2 to 36. * * @return string The converted number, following the Calculator conventions. + * + * @pure */ public function fromBase(string $number, int $base) : string { @@ -330,6 +313,8 @@ public function fromBase(string $number, int $base) : string * @param int $base The base to convert to, validated from 2 to 36. * * @return string The converted number, lowercase. + * + * @pure */ public function toBase(string $number, int $base) : string { @@ -357,6 +342,8 @@ public function toBase(string $number, int $base) : string * @param int $base The base of the number, validated from 2 to alphabet length. * * @return string The number in base 10, following the Calculator conventions. + * + * @pure */ final public function fromArbitraryBase(string $number, string $alphabet, int $base) : string { @@ -403,6 +390,8 @@ final public function fromArbitraryBase(string $number, string $alphabet, int $b * @param int $base The base to convert to, validated from 2 to alphabet length. * * @return string The converted number in the given alphabet. + * + * @pure */ final public function toArbitraryBase(string $number, string $alphabet, int $base) : string { @@ -428,16 +417,15 @@ final public function toArbitraryBase(string $number, string $alphabet, int $bas * * Rounding is performed when the remainder of the division is not zero. * - * @param string $a The dividend. - * @param string $b The divisor, must not be zero. - * @param int $roundingMode The rounding mode. + * @param string $a The dividend. + * @param string $b The divisor, must not be zero. + * @param RoundingMode $roundingMode The rounding mode. * - * @throws \InvalidArgumentException If the rounding mode is invalid. * @throws RoundingNecessaryException If RoundingMode::UNNECESSARY is provided but rounding is necessary. * - * @psalm-suppress ImpureFunctionCall + * @pure */ - final public function divRound(string $a, string $b, int $roundingMode) : string + final public function divRound(string $a, string $b, RoundingMode $roundingMode) : string { [$quotient, $remainder] = $this->divQR($a, $b); @@ -496,9 +484,6 @@ final public function divRound(string $a, string $b, int $roundingMode) : string $lastDigitIsEven = ($lastDigit % 2 === 0); $increment = $lastDigitIsEven ? $discardedFractionSign() > 0 : $discardedFractionSign() >= 0; break; - - default: - throw new \InvalidArgumentException('Invalid rounding mode.'); } if ($increment) { @@ -513,6 +498,8 @@ final public function divRound(string $a, string $b, int $roundingMode) : string * * This method can be overridden by the concrete implementation if the underlying library * has built-in support for bitwise operations. + * + * @pure */ public function and(string $a, string $b) : string { @@ -524,6 +511,8 @@ public function and(string $a, string $b) : string * * This method can be overridden by the concrete implementation if the underlying library * has built-in support for bitwise operations. + * + * @pure */ public function or(string $a, string $b) : string { @@ -535,6 +524,8 @@ public function or(string $a, string $b) : string * * This method can be overridden by the concrete implementation if the underlying library * has built-in support for bitwise operations. + * + * @pure */ public function xor(string $a, string $b) : string { @@ -547,6 +538,8 @@ public function xor(string $a, string $b) : string * @param 'and'|'or'|'xor' $operator The operator to use. * @param string $a The left operand. * @param string $b The right operand. + * + * @pure */ private function bitwise(string $operator, string $a, string $b) : string { @@ -571,27 +564,17 @@ private function bitwise(string $operator, string $a, string $b) : string $bBin = $this->twosComplement($bBin); } - switch ($operator) { - case 'and': - $value = $aBin & $bBin; - $negative = ($aNeg and $bNeg); - break; - - case 'or': - $value = $aBin | $bBin; - $negative = ($aNeg or $bNeg); - break; - - case 'xor': - $value = $aBin ^ $bBin; - $negative = ($aNeg xor $bNeg); - break; + $value = match ($operator) { + 'and' => $aBin & $bBin, + 'or' => $aBin | $bBin, + 'xor' => $aBin ^ $bBin, + }; - // @codeCoverageIgnoreStart - default: - throw new \InvalidArgumentException('Invalid bitwise operator.'); - // @codeCoverageIgnoreEnd - } + $negative = match ($operator) { + 'and' => $aNeg and $bNeg, + 'or' => $aNeg or $bNeg, + 'xor' => $aNeg xor $bNeg, + }; if ($negative) { $value = $this->twosComplement($value); @@ -604,6 +587,8 @@ private function bitwise(string $operator, string $a, string $b) : string /** * @param string $number A positive, binary number. + * + * @pure */ private function twosComplement(string $number) : string { @@ -633,6 +618,8 @@ private function twosComplement(string $number) : string * Converts a decimal number to a binary string. * * @param string $number The number to convert, positive or zero, only digits. + * + * @pure */ private function toBinary(string $number) : string { @@ -650,6 +637,8 @@ private function toBinary(string $number) : string * Returns the positive decimal representation of a binary number. * * @param string $bytes The bytes representing the number. + * + * @pure */ private function toDecimal(string $bytes) : string { diff --git a/lib/Google/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php b/lib/Google/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php index 5457a3c98..5ba961ed3 100644 --- a/lib/Google/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php +++ b/lib/Google/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php @@ -5,69 +5,67 @@ namespace Brick\Math\Internal\Calculator; use Brick\Math\Internal\Calculator; +use Override; /** * Calculator implementation built around the bcmath library. * * @internal - * - * @psalm-immutable */ -class BcMathCalculator extends Calculator +final readonly class BcMathCalculator extends Calculator { + #[Override] public function add(string $a, string $b) : string { return \bcadd($a, $b, 0); } + #[Override] public function sub(string $a, string $b) : string { return \bcsub($a, $b, 0); } + #[Override] public function mul(string $a, string $b) : string { return \bcmul($a, $b, 0); } + #[Override] public function divQ(string $a, string $b) : string { return \bcdiv($a, $b, 0); } - /** - * @psalm-suppress InvalidNullableReturnType - * @psalm-suppress NullableReturnStatement - */ + #[Override] public function divR(string $a, string $b) : string { return \bcmod($a, $b, 0); } + #[Override] public function divQR(string $a, string $b) : array { $q = \bcdiv($a, $b, 0); $r = \bcmod($a, $b, 0); - assert($r !== null); - return [$q, $r]; } + #[Override] public function pow(string $a, int $e) : string { return \bcpow($a, (string) $e, 0); } + #[Override] public function modPow(string $base, string $exp, string $mod) : string { return \bcpowmod($base, $exp, $mod, 0); } - /** - * @psalm-suppress InvalidNullableReturnType - * @psalm-suppress NullableReturnStatement - */ + #[Override] public function sqrt(string $n) : string { return \bcsqrt($n, 0); diff --git a/lib/Google/vendor/brick/math/src/Internal/Calculator/GmpCalculator.php b/lib/Google/vendor/brick/math/src/Internal/Calculator/GmpCalculator.php index 42d4c6927..c0f9bd585 100644 --- a/lib/Google/vendor/brick/math/src/Internal/Calculator/GmpCalculator.php +++ b/lib/Google/vendor/brick/math/src/Internal/Calculator/GmpCalculator.php @@ -5,56 +5,68 @@ namespace Brick\Math\Internal\Calculator; use Brick\Math\Internal\Calculator; +use GMP; +use Override; /** * Calculator implementation built around the GMP library. * * @internal - * - * @psalm-immutable */ -class GmpCalculator extends Calculator +final readonly class GmpCalculator extends Calculator { + #[Override] public function add(string $a, string $b) : string { return \gmp_strval(\gmp_add($a, $b)); } + #[Override] public function sub(string $a, string $b) : string { return \gmp_strval(\gmp_sub($a, $b)); } + #[Override] public function mul(string $a, string $b) : string { return \gmp_strval(\gmp_mul($a, $b)); } + #[Override] public function divQ(string $a, string $b) : string { return \gmp_strval(\gmp_div_q($a, $b)); } + #[Override] public function divR(string $a, string $b) : string { return \gmp_strval(\gmp_div_r($a, $b)); } + #[Override] public function divQR(string $a, string $b) : array { [$q, $r] = \gmp_div_qr($a, $b); + /** + * @var GMP $q + * @var GMP $r + */ return [ \gmp_strval($q), \gmp_strval($r) ]; } + #[Override] public function pow(string $a, int $e) : string { return \gmp_strval(\gmp_pow($a, $e)); } + #[Override] public function modInverse(string $x, string $m) : ?string { $result = \gmp_invert($x, $m); @@ -66,41 +78,49 @@ public function modInverse(string $x, string $m) : ?string return \gmp_strval($result); } + #[Override] public function modPow(string $base, string $exp, string $mod) : string { return \gmp_strval(\gmp_powm($base, $exp, $mod)); } + #[Override] public function gcd(string $a, string $b) : string { return \gmp_strval(\gmp_gcd($a, $b)); } + #[Override] public function fromBase(string $number, int $base) : string { return \gmp_strval(\gmp_init($number, $base)); } + #[Override] public function toBase(string $number, int $base) : string { return \gmp_strval($number, $base); } + #[Override] public function and(string $a, string $b) : string { return \gmp_strval(\gmp_and($a, $b)); } + #[Override] public function or(string $a, string $b) : string { return \gmp_strval(\gmp_or($a, $b)); } + #[Override] public function xor(string $a, string $b) : string { return \gmp_strval(\gmp_xor($a, $b)); } + #[Override] public function sqrt(string $n) : string { return \gmp_strval(\gmp_sqrt($n)); diff --git a/lib/Google/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php b/lib/Google/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php index 7c679d24d..ee476c9f7 100644 --- a/lib/Google/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php +++ b/lib/Google/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php @@ -5,15 +5,14 @@ namespace Brick\Math\Internal\Calculator; use Brick\Math\Internal\Calculator; +use Override; /** * Calculator implementation using only native PHP code. * * @internal - * - * @psalm-immutable */ -class NativeCalculator extends Calculator +final readonly class NativeCalculator extends Calculator { /** * The max number of digits the platform can natively add, subtract, multiply or divide without overflow. @@ -26,29 +25,23 @@ class NativeCalculator extends Calculator private int $maxDigits; /** + * @pure * @codeCoverageIgnore */ public function __construct() { - switch (PHP_INT_SIZE) { - case 4: - $this->maxDigits = 9; - break; - - case 8: - $this->maxDigits = 18; - break; - - default: - throw new \RuntimeException('The platform is not 32-bit or 64-bit as expected.'); - } + $this->maxDigits = match (PHP_INT_SIZE) { + 4 => 9, + 8 => 18, + }; } + #[Override] public function add(string $a, string $b) : string { /** - * @psalm-var numeric-string $a - * @psalm-var numeric-string $b + * @var numeric-string $a + * @var numeric-string $b */ $result = $a + $b; @@ -75,16 +68,18 @@ public function add(string $a, string $b) : string return $result; } + #[Override] public function sub(string $a, string $b) : string { return $this->add($a, $this->neg($b)); } + #[Override] public function mul(string $a, string $b) : string { /** - * @psalm-var numeric-string $a - * @psalm-var numeric-string $b + * @var numeric-string $a + * @var numeric-string $b */ $result = $a * $b; @@ -123,16 +118,19 @@ public function mul(string $a, string $b) : string return $result; } + #[Override] public function divQ(string $a, string $b) : string { return $this->divQR($a, $b)[0]; } + #[Override] public function divR(string $a, string $b): string { return $this->divQR($a, $b)[1]; } + #[Override] public function divQR(string $a, string $b) : array { if ($a === '0') { @@ -151,20 +149,18 @@ public function divQR(string $a, string $b) : array return [$this->neg($a), '0']; } - /** @psalm-var numeric-string $a */ + /** @var numeric-string $a */ $na = $a * 1; // cast to number if (is_int($na)) { - /** @psalm-var numeric-string $b */ + /** @var numeric-string $b */ $nb = $b * 1; if (is_int($nb)) { // the only division that may overflow is PHP_INT_MIN / -1, // which cannot happen here as we've already handled a divisor of -1 above. + $q = intdiv($na, $nb); $r = $na % $nb; - $q = ($na - $r) / $nb; - - assert(is_int($q)); return [ (string) $q, @@ -188,6 +184,7 @@ public function divQR(string $a, string $b) : array return [$q, $r]; } + #[Override] public function pow(string $a, int $e) : string { if ($e === 0) { @@ -203,7 +200,6 @@ public function pow(string $a, int $e) : string $aa = $this->mul($a, $a); - /** @psalm-suppress PossiblyInvalidArgument We're sure that $e / 2 is an int now */ $result = $this->pow($aa, $e / 2); if ($odd === 1) { @@ -216,6 +212,7 @@ public function pow(string $a, int $e) : string /** * Algorithm from: https://www.geeksforgeeks.org/modular-exponentiation-power-in-modular-arithmetic/ */ + #[Override] public function modPow(string $base, string $exp, string $mod) : string { // special case: the algorithm below fails with 0 power 0 mod 1 (returns 1 instead of 0) @@ -250,6 +247,7 @@ public function modPow(string $base, string $exp, string $mod) : string /** * Adapted from https://cp-algorithms.com/num_methods/roots_newton.html */ + #[Override] public function sqrt(string $n) : string { if ($n === '0') { @@ -277,6 +275,8 @@ public function sqrt(string $n) : string /** * Performs the addition of two non-signed large integers. + * + * @pure */ private function doAdd(string $a, string $b) : string { @@ -290,14 +290,13 @@ private function doAdd(string $a, string $b) : string if ($i < 0) { $blockLength += $i; - /** @psalm-suppress LoopInvalidation */ $i = 0; } - /** @psalm-var numeric-string $blockA */ + /** @var numeric-string $blockA */ $blockA = \substr($a, $i, $blockLength); - /** @psalm-var numeric-string $blockB */ + /** @var numeric-string $blockB */ $blockB = \substr($b, $i, $blockLength); $sum = (string) ($blockA + $blockB + $carry); @@ -329,6 +328,8 @@ private function doAdd(string $a, string $b) : string /** * Performs the subtraction of two non-signed large integers. + * + * @pure */ private function doSub(string $a, string $b) : string { @@ -359,14 +360,13 @@ private function doSub(string $a, string $b) : string if ($i < 0) { $blockLength += $i; - /** @psalm-suppress LoopInvalidation */ $i = 0; } - /** @psalm-var numeric-string $blockA */ + /** @var numeric-string $blockA */ $blockA = \substr($a, $i, $blockLength); - /** @psalm-var numeric-string $blockB */ + /** @var numeric-string $blockB */ $blockB = \substr($b, $i, $blockLength); $sum = $blockA - $blockB - $carry; @@ -406,6 +406,8 @@ private function doSub(string $a, string $b) : string /** * Performs the multiplication of two non-signed large integers. + * + * @pure */ private function doMul(string $a, string $b) : string { @@ -422,7 +424,6 @@ private function doMul(string $a, string $b) : string if ($i < 0) { $blockALength += $i; - /** @psalm-suppress LoopInvalidation */ $i = 0; } @@ -436,7 +437,6 @@ private function doMul(string $a, string $b) : string if ($j < 0) { $blockBLength += $j; - /** @psalm-suppress LoopInvalidation */ $j = 0; } @@ -479,6 +479,8 @@ private function doMul(string $a, string $b) : string * Performs the division of two non-signed large integers. * * @return string[] The quotient and remainder. + * + * @pure */ private function doDiv(string $a, string $b) : array { @@ -497,6 +499,22 @@ private function doDiv(string $a, string $b) : array $r = $a; // remainder $z = $y; // focus length, always $y or $y+1 + /** @var numeric-string $b */ + $nb = $b * 1; // cast to number + // performance optimization in cases where the remainder will never cause int overflow + if (is_int(($nb - 1) * 10 + 9)) { + $r = (int) \substr($a, 0, $z - 1); + + for ($i = $z - 1; $i < $x; $i++) { + $n = $r * 10 + (int) $a[$i]; + /** @var int $nb */ + $q .= \intdiv($n, $nb); + $r = $n % $nb; + } + + return [\ltrim($q, '0') ?: '0', (string) $r]; + } + for (;;) { $focus = \substr($a, 0, $z); @@ -536,7 +554,9 @@ private function doDiv(string $a, string $b) : array /** * Compares two non-signed large numbers. * - * @return int [-1, 0, 1] + * @return -1|0|1 + * + * @pure */ private function doCmp(string $a, string $b) : int { @@ -549,7 +569,7 @@ private function doCmp(string $a, string $b) : int return $cmp; } - return \strcmp($a, $b) <=> 0; // enforce [-1, 0, 1] + return \strcmp($a, $b) <=> 0; // enforce -1|0|1 } /** @@ -558,6 +578,8 @@ private function doCmp(string $a, string $b) : int * The numbers must only consist of digits, without leading minus sign. * * @return array{string, string, int} + * + * @pure */ private function pad(string $a, string $b) : array { diff --git a/lib/Google/vendor/brick/math/src/Internal/CalculatorRegistry.php b/lib/Google/vendor/brick/math/src/Internal/CalculatorRegistry.php new file mode 100644 index 000000000..394fae69a --- /dev/null +++ b/lib/Google/vendor/brick/math/src/Internal/CalculatorRegistry.php @@ -0,0 +1,73 @@ += 0.5; otherwise, behaves as for DOWN. * Note that this is the rounding mode commonly taught at school. */ - public const HALF_UP = 5; + case HALF_UP; /** * Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round down. * * Behaves as for UP if the discarded fraction is > 0.5; otherwise, behaves as for DOWN. */ - public const HALF_DOWN = 6; + case HALF_DOWN; /** * Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round towards positive infinity. * * If the result is positive, behaves as for HALF_UP; if negative, behaves as for HALF_DOWN. */ - public const HALF_CEILING = 7; + case HALF_CEILING; /** * Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round towards negative infinity. * * If the result is positive, behaves as for HALF_DOWN; if negative, behaves as for HALF_UP. */ - public const HALF_FLOOR = 8; + case HALF_FLOOR; /** * Rounds towards the "nearest neighbor" unless both neighbors are equidistant, in which case rounds towards the even neighbor. @@ -103,5 +94,5 @@ private function __construct() * cumulative error when applied repeatedly over a sequence of calculations. * It is sometimes known as "Banker's rounding", and is chiefly used in the USA. */ - public const HALF_EVEN = 9; + case HALF_EVEN; } diff --git a/lib/Google/vendor/composer/autoload_classmap.php b/lib/Google/vendor/composer/autoload_classmap.php index c80dde643..375ca28e3 100644 --- a/lib/Google/vendor/composer/autoload_classmap.php +++ b/lib/Google/vendor/composer/autoload_classmap.php @@ -6,7 +6,6 @@ $baseDir = dirname($vendorDir); return array( - 'CURLStringFile' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php', 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 'GPBMetadata\\GrpcGcp' => $vendorDir . '/google/grpc-gcp/src/generated/GPBMetadata/GrpcGcp.php', 'Google_AccessToken_Revoke' => $baseDir . '/src/aliases.php', @@ -34,5 +33,4 @@ 'Grpc\\Gcp\\ApiConfig' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/ApiConfig.php', 'Grpc\\Gcp\\ChannelPoolConfig' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/ChannelPoolConfig.php', 'Grpc\\Gcp\\MethodConfig' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/MethodConfig.php', - 'ReturnTypeWillChange' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php', ); diff --git a/lib/Google/vendor/composer/autoload_files.php b/lib/Google/vendor/composer/autoload_files.php index 1b96f7179..78726fc7a 100644 --- a/lib/Google/vendor/composer/autoload_files.php +++ b/lib/Google/vendor/composer/autoload_files.php @@ -9,7 +9,6 @@ '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', - '23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php', 'e39a8b23c42d4e1452234d762b03835a' => $vendorDir . '/ramsey/uuid/src/functions.php', '1f87db08236948d07391152dccb70f04' => $vendorDir . '/google/apiclient-services/autoload.php', 'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php', diff --git a/lib/Google/vendor/composer/autoload_psr4.php b/lib/Google/vendor/composer/autoload_psr4.php index a6b60b0d6..6699d6ffd 100644 --- a/lib/Google/vendor/composer/autoload_psr4.php +++ b/lib/Google/vendor/composer/autoload_psr4.php @@ -7,7 +7,6 @@ return array( 'phpseclib3\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'), - 'Symfony\\Polyfill\\Php81\\' => array($vendorDir . '/symfony/polyfill-php81'), 'Rize\\' => array($vendorDir . '/rize/uri-template/src/Rize'), 'Ramsey\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'), 'Ramsey\\Collection\\' => array($vendorDir . '/ramsey/collection/src'), diff --git a/lib/Google/vendor/composer/autoload_real.php b/lib/Google/vendor/composer/autoload_real.php index 9659486a6..7dfe40e5b 100644 --- a/lib/Google/vendor/composer/autoload_real.php +++ b/lib/Google/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitbd131085cfdbf47b26d7ae00fe412ae4 +class ComposerAutoloaderInit7d51b2283bec19db67d0861b0c8ead2c { private static $loader; @@ -24,16 +24,16 @@ public static function getLoader() require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInitbd131085cfdbf47b26d7ae00fe412ae4', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit7d51b2283bec19db67d0861b0c8ead2c', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInitbd131085cfdbf47b26d7ae00fe412ae4', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit7d51b2283bec19db67d0861b0c8ead2c', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c::getInitializer($loader)); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c::$files; $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; diff --git a/lib/Google/vendor/composer/autoload_static.php b/lib/Google/vendor/composer/autoload_static.php index 2cad9318a..661fae55a 100644 --- a/lib/Google/vendor/composer/autoload_static.php +++ b/lib/Google/vendor/composer/autoload_static.php @@ -4,13 +4,12 @@ namespace Composer\Autoload; -class ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4 +class ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c { public static $files = array ( '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', - '23c18046f52bef3eea034657bafda50f' => __DIR__ . '/..' . '/symfony/polyfill-php81/bootstrap.php', 'e39a8b23c42d4e1452234d762b03835a' => __DIR__ . '/..' . '/ramsey/uuid/src/functions.php', '1f87db08236948d07391152dccb70f04' => __DIR__ . '/..' . '/google/apiclient-services/autoload.php', 'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php', @@ -22,10 +21,6 @@ class ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4 array ( 'phpseclib3\\' => 11, ), - 'S' => - array ( - 'Symfony\\Polyfill\\Php81\\' => 23, - ), 'R' => array ( 'Rize\\' => 5, @@ -90,10 +85,6 @@ class ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4 array ( 0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib', ), - 'Symfony\\Polyfill\\Php81\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-php81', - ), 'Rize\\' => array ( 0 => __DIR__ . '/..' . '/rize/uri-template/src/Rize', @@ -254,7 +245,6 @@ class ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4 ); public static $classMap = array ( - 'CURLStringFile' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php', 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 'GPBMetadata\\GrpcGcp' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/GPBMetadata/GrpcGcp.php', 'Google_AccessToken_Revoke' => __DIR__ . '/../..' . '/src/aliases.php', @@ -282,15 +272,14 @@ class ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4 'Grpc\\Gcp\\ApiConfig' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/ApiConfig.php', 'Grpc\\Gcp\\ChannelPoolConfig' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/ChannelPoolConfig.php', 'Grpc\\Gcp\\MethodConfig' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/MethodConfig.php', - 'ReturnTypeWillChange' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php', ); public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c::$classMap; }, null, ClassLoader::class); } diff --git a/lib/Google/vendor/composer/installed.json b/lib/Google/vendor/composer/installed.json index c21cb26d5..d93a6a7de 100644 --- a/lib/Google/vendor/composer/installed.json +++ b/lib/Google/vendor/composer/installed.json @@ -2,28 +2,28 @@ "packages": [ { "name": "brick/math", - "version": "0.11.0", - "version_normalized": "0.11.0.0", + "version": "0.14.0", + "version_normalized": "0.14.0.0", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478" + "reference": "113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/0ad82ce168c82ba30d1c01ec86116ab52f589478", - "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478", + "url": "https://api.github.com/repos/brick/math/zipball/113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2", + "reference": "113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2", "shasum": "" }, "require": { - "php": "^8.0" + "php": "^8.2" }, "require-dev": { "php-coveralls/php-coveralls": "^2.2", - "phpunit/phpunit": "^9.0", - "vimeo/psalm": "5.0.0" + "phpstan/phpstan": "2.1.22", + "phpunit/phpunit": "^11.5" }, - "time": "2023-01-15T23:15:59+00:00", + "time": "2025-08-29T12:40:03+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -43,12 +43,17 @@ "arithmetic", "bigdecimal", "bignum", + "bignumber", "brick", - "math" + "decimal", + "integer", + "math", + "mathematics", + "rational" ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.11.0" + "source": "https://github.com/brick/math/tree/0.14.0" }, "funding": [ { @@ -126,26 +131,26 @@ }, { "name": "google/apiclient-services", - "version": "v0.396.0", - "version_normalized": "0.396.0.0", + "version": "v0.415.0", + "version_normalized": "0.415.0.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "ceb2e432e4326c6775d24f62d554395a1a9ad3dd" + "reference": "080bdeb1d5243429164dc589b69426bae98dad1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/ceb2e432e4326c6775d24f62d554395a1a9ad3dd", - "reference": "ceb2e432e4326c6775d24f62d554395a1a9ad3dd", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/080bdeb1d5243429164dc589b69426bae98dad1d", + "reference": "080bdeb1d5243429164dc589b69426bae98dad1d", "shasum": "" }, "require": { - "php": "^8.0" + "php": "^8.1" }, "require-dev": { "phpunit/phpunit": "^9.6" }, - "time": "2025-02-24T01:10:27+00:00", + "time": "2025-10-05T01:02:15+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -167,30 +172,30 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.396.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.415.0" }, "install-path": "../google/apiclient-services" }, { "name": "google/auth", - "version": "v1.42.0", - "version_normalized": "1.42.0.0", + "version": "v1.44.0", + "version_normalized": "1.44.0.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "0c25599a91530b5847f129b271c536f75a7563f5" + "reference": "5670e56307d7a2eac931f677c0e59a4f8abb2e43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/0c25599a91530b5847f129b271c536f75a7563f5", - "reference": "0c25599a91530b5847f129b271c536f75a7563f5", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/5670e56307d7a2eac931f677c0e59a4f8abb2e43", + "reference": "5670e56307d7a2eac931f677c0e59a4f8abb2e43", "shasum": "" }, "require": { "firebase/php-jwt": "^6.0", "guzzlehttp/guzzle": "^7.4.5", "guzzlehttp/psr7": "^2.4.5", - "php": "^8.0", + "php": "^8.1", "psr/cache": "^2.0||^3.0", "psr/http-message": "^1.1||^2.0" }, @@ -208,7 +213,7 @@ "suggest": { "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2." }, - "time": "2024-08-26T18:33:48+00:00", + "time": "2024-12-04T15:34:58+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -230,7 +235,7 @@ "support": { "docs": "https://googleapis.github.io/google-auth-library-php/main/", "issues": "https://github.com/googleapis/google-auth-library-php/issues", - "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.42.0" + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.44.0" }, "install-path": "../google/auth" }, @@ -305,22 +310,22 @@ }, { "name": "google/cloud-storage", - "version": "v1.48.1", - "version_normalized": "1.48.1.0", + "version": "v1.48.4", + "version_normalized": "1.48.4.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-storage.git", - "reference": "509b095c3ea44db92c9e62a94b5773563c831821" + "reference": "4b81b682f6b1517c0c5f6152b2980195d23c1cef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/509b095c3ea44db92c9e62a94b5773563c831821", - "reference": "509b095c3ea44db92c9e62a94b5773563c831821", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/4b81b682f6b1517c0c5f6152b2980195d23c1cef", + "reference": "4b81b682f6b1517c0c5f6152b2980195d23c1cef", "shasum": "" }, "require": { "google/cloud-core": "^1.57", - "php": "^8.0", + "php": "^8.1", "ramsey/uuid": "^4.2.3" }, "require-dev": { @@ -337,7 +342,7 @@ "google/cloud-pubsub": "May be used to register a topic to receive bucket notifications.", "phpseclib/phpseclib": "May be used in place of OpenSSL for creating signed Cloud Storage URLs. Please require version ^2." }, - "time": "2025-05-20T19:49:54+00:00", + "time": "2025-10-01T16:57:30+00:00", "type": "library", "extra": { "component": { @@ -359,33 +364,33 @@ ], "description": "Cloud Storage Client for PHP", "support": { - "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.48.1" + "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.48.4" }, "install-path": "../google/cloud-storage" }, { "name": "google/common-protos", - "version": "4.12.1", - "version_normalized": "4.12.1.0", + "version": "4.12.4", + "version_normalized": "4.12.4.0", "source": { "type": "git", "url": "https://github.com/googleapis/common-protos-php.git", - "reference": "70c4eb1abab5484a23c17a43b0d455259f5d8c1b" + "reference": "0127156899af0df2681bd42024c60bd5360d64e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/70c4eb1abab5484a23c17a43b0d455259f5d8c1b", - "reference": "70c4eb1abab5484a23c17a43b0d455259f5d8c1b", + "url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/0127156899af0df2681bd42024c60bd5360d64e3", + "reference": "0127156899af0df2681bd42024c60bd5360d64e3", "shasum": "" }, "require": { - "google/protobuf": "^v3.25.3||^4.26.1", - "php": "^8.0" + "google/protobuf": "^4.31", + "php": "^8.1" }, "require-dev": { "phpunit/phpunit": "^9.6" }, - "time": "2025-05-20T19:49:54+00:00", + "time": "2025-09-20T01:29:44+00:00", "type": "library", "extra": { "component": { @@ -421,7 +426,7 @@ "google" ], "support": { - "source": "https://github.com/googleapis/common-protos-php/tree/v4.12.1" + "source": "https://github.com/googleapis/common-protos-php/tree/v4.12.4" }, "install-path": "../google/common-protos" }, @@ -535,24 +540,24 @@ }, { "name": "google/longrunning", - "version": "0.4.7", - "version_normalized": "0.4.7.0", + "version": "0.5.0", + "version_normalized": "0.5.0.0", "source": { "type": "git", "url": "https://github.com/googleapis/php-longrunning.git", - "reference": "624cabb874c10e5ddc9034c999f724894b70a3d3" + "reference": "715519ab4aaf3c4268adb2b551ee0f34135c8c5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/php-longrunning/zipball/624cabb874c10e5ddc9034c999f724894b70a3d3", - "reference": "624cabb874c10e5ddc9034c999f724894b70a3d3", + "url": "https://api.github.com/repos/googleapis/php-longrunning/zipball/715519ab4aaf3c4268adb2b551ee0f34135c8c5f", + "reference": "715519ab4aaf3c4268adb2b551ee0f34135c8c5f", "shasum": "" }, "require-dev": { - "google/gax": "^1.36.0", + "google/gax": "^1.38.0", "phpunit/phpunit": "^9.0" }, - "time": "2025-01-24T21:24:06+00:00", + "time": "2025-09-20T01:29:44+00:00", "type": "library", "extra": { "component": { @@ -576,35 +581,35 @@ ], "description": "Google LongRunning Client for PHP", "support": { - "source": "https://github.com/googleapis/php-longrunning/tree/v0.4.7" + "source": "https://github.com/googleapis/php-longrunning/tree/v0.5.0" }, "install-path": "../google/longrunning" }, { "name": "google/protobuf", - "version": "v4.31.1", - "version_normalized": "4.31.1.0", + "version": "v4.32.1", + "version_normalized": "4.32.1.0", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "2b028ce8876254e2acbeceea7d9b573faad41864" + "reference": "c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/2b028ce8876254e2acbeceea7d9b573faad41864", - "reference": "2b028ce8876254e2acbeceea7d9b573faad41864", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb", + "reference": "c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb", "shasum": "" }, "require": { - "php": ">=7.0.0" + "php": ">=8.1.0" }, "require-dev": { - "phpunit/phpunit": ">=5.0.0" + "phpunit/phpunit": ">=5.0.0 <8.5.27" }, "suggest": { "ext-bcmath": "Need to support JSON deserialization" }, - "time": "2025-05-28T18:52:35+00:00", + "time": "2025-09-14T05:14:52+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -623,23 +628,23 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.31.1" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.32.1" }, "install-path": "../google/protobuf" }, { "name": "grpc/grpc", - "version": "1.57.0", - "version_normalized": "1.57.0.0", + "version": "1.74.0", + "version_normalized": "1.74.0.0", "source": { "type": "git", "url": "https://github.com/grpc/grpc-php.git", - "reference": "b610c42022ed3a22f831439cb93802f2a4502fdf" + "reference": "32bf4dba256d60d395582fb6e4e8d3936bcdb713" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/grpc/grpc-php/zipball/b610c42022ed3a22f831439cb93802f2a4502fdf", - "reference": "b610c42022ed3a22f831439cb93802f2a4502fdf", + "url": "https://api.github.com/repos/grpc/grpc-php/zipball/32bf4dba256d60d395582fb6e4e8d3936bcdb713", + "reference": "32bf4dba256d60d395582fb6e4e8d3936bcdb713", "shasum": "" }, "require": { @@ -652,7 +657,7 @@ "ext-protobuf": "For better performance, install the protobuf C extension.", "google/protobuf": "To get started using grpc quickly, install the native protobuf library." }, - "time": "2023-08-14T23:57:54+00:00", + "time": "2025-07-24T20:02:16+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -670,29 +675,29 @@ "rpc" ], "support": { - "source": "https://github.com/grpc/grpc-php/tree/v1.57.0" + "source": "https://github.com/grpc/grpc-php/tree/v1.74.0" }, "install-path": "../grpc/grpc" }, { "name": "guzzlehttp/guzzle", - "version": "7.9.3", - "version_normalized": "7.9.3.0", + "version": "7.10.0", + "version_normalized": "7.10.0.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" + "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", - "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", + "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0.3", - "guzzlehttp/psr7": "^2.7.0", + "guzzlehttp/promises": "^2.3", + "guzzlehttp/psr7": "^2.8", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -713,7 +718,7 @@ "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, - "time": "2025-03-27T13:37:11+00:00", + "time": "2025-08-23T22:36:01+00:00", "type": "library", "extra": { "bamarni-bin": { @@ -785,7 +790,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.9.3" + "source": "https://github.com/guzzle/guzzle/tree/7.10.0" }, "funding": [ { @@ -805,17 +810,17 @@ }, { "name": "guzzlehttp/promises", - "version": "2.2.0", - "version_normalized": "2.2.0.0", + "version": "2.3.0", + "version_normalized": "2.3.0.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" + "reference": "481557b130ef3790cf82b713667b43030dc9c957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", - "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", + "url": "https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957", + "reference": "481557b130ef3790cf82b713667b43030dc9c957", "shasum": "" }, "require": { @@ -823,9 +828,9 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.39 || ^9.6.20" + "phpunit/phpunit": "^8.5.44 || ^9.6.25" }, - "time": "2025-03-27T13:27:01+00:00", + "time": "2025-08-22T14:34:08+00:00", "type": "library", "extra": { "bamarni-bin": { @@ -871,7 +876,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.2.0" + "source": "https://github.com/guzzle/promises/tree/2.3.0" }, "funding": [ { @@ -891,17 +896,17 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.7.1", - "version_normalized": "2.7.1.0", + "version": "2.8.0", + "version_normalized": "2.8.0.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16" + "reference": "21dc724a0583619cd1652f673303492272778051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16", - "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051", + "reference": "21dc724a0583619cd1652f673303492272778051", "shasum": "" }, "require": { @@ -917,12 +922,12 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "http-interop/http-factory-tests": "0.9.0", - "phpunit/phpunit": "^8.5.39 || ^9.6.20" + "phpunit/phpunit": "^8.5.44 || ^9.6.25" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, - "time": "2025-03-27T12:30:47+00:00", + "time": "2025-08-23T21:21:41+00:00", "type": "library", "extra": { "bamarni-bin": { @@ -990,7 +995,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.7.1" + "source": "https://github.com/guzzle/psr7/tree/2.8.0" }, "funding": [ { @@ -1115,27 +1120,29 @@ }, { "name": "paragonie/constant_time_encoding", - "version": "v3.0.0", - "version_normalized": "3.0.0.0", + "version": "v3.1.3", + "version_normalized": "3.1.3.0", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "df1e7fde177501eee2037dd159cf04f5f301a512" + "reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/df1e7fde177501eee2037dd159cf04f5f301a512", - "reference": "df1e7fde177501eee2037dd159cf04f5f301a512", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77", + "reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77", "shasum": "" }, "require": { "php": "^8" }, "require-dev": { - "phpunit/phpunit": "^9", - "vimeo/psalm": "^4|^5" + "infection/infection": "^0", + "nikic/php-fuzzer": "^0", + "phpunit/phpunit": "^9|^10|^11", + "vimeo/psalm": "^4|^5|^6" }, - "time": "2024-05-08T12:36:18+00:00", + "time": "2025-09-24T15:06:41+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1238,17 +1245,17 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.43", - "version_normalized": "3.0.43.0", + "version": "3.0.47", + "version_normalized": "3.0.47.0", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "709ec107af3cb2f385b9617be72af8cf62441d02" + "reference": "9d6ca36a6c2dd434765b1071b2644a1c683b385d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/709ec107af3cb2f385b9617be72af8cf62441d02", - "reference": "709ec107af3cb2f385b9617be72af8cf62441d02", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/9d6ca36a6c2dd434765b1071b2644a1c683b385d", + "reference": "9d6ca36a6c2dd434765b1071b2644a1c683b385d", "shasum": "" }, "require": { @@ -1266,7 +1273,7 @@ "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." }, - "time": "2024-12-14T21:12:59+00:00", + "time": "2025-10-06T01:07:24+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1331,7 +1338,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.43" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.47" }, "funding": [ { @@ -1351,23 +1358,23 @@ }, { "name": "psr/cache", - "version": "3.0.0", - "version_normalized": "3.0.0.0", + "version": "2.0.0", + "version_normalized": "2.0.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "url": "https://api.github.com/repos/php-fig/cache/zipball/213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", "shasum": "" }, "require": { "php": ">=8.0.0" }, - "time": "2021-02-03T23:26:27+00:00", + "time": "2021-02-03T23:23:37+00:00", "type": "library", "extra": { "branch-alias": { @@ -1397,7 +1404,7 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/3.0.0" + "source": "https://github.com/php-fig/cache/tree/2.0.0" }, "install-path": "../psr/cache" }, @@ -1672,46 +1679,42 @@ }, { "name": "ramsey/collection", - "version": "1.3.0", - "version_normalized": "1.3.0.0", + "version": "2.1.1", + "version_normalized": "2.1.1.0", "source": { "type": "git", "url": "https://github.com/ramsey/collection.git", - "reference": "ad7475d1c9e70b190ecffc58f2d989416af339b4" + "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/ad7475d1c9e70b190ecffc58f2d989416af339b4", - "reference": "ad7475d1c9e70b190ecffc58f2d989416af339b4", + "url": "https://api.github.com/repos/ramsey/collection/zipball/344572933ad0181accbf4ba763e85a0306a8c5e2", + "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2", "shasum": "" }, "require": { - "php": "^7.4 || ^8.0", - "symfony/polyfill-php81": "^1.23" + "php": "^8.1" }, "require-dev": { "captainhook/plugin-composer": "^5.3", - "ergebnis/composer-normalize": "^2.28.3", - "fakerphp/faker": "^1.21", + "ergebnis/composer-normalize": "^2.45", + "fakerphp/faker": "^1.24", "hamcrest/hamcrest-php": "^2.0", - "jangregor/phpstan-prophecy": "^1.0", - "mockery/mockery": "^1.5", + "jangregor/phpstan-prophecy": "^2.1", + "mockery/mockery": "^1.6", "php-parallel-lint/php-console-highlighter": "^1.0", - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpcsstandards/phpcsutils": "^1.0.0-rc1", - "phpspec/prophecy-phpunit": "^2.0", - "phpstan/extension-installer": "^1.2", - "phpstan/phpstan": "^1.9", - "phpstan/phpstan-mockery": "^1.1", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5", - "psalm/plugin-mockery": "^1.1", - "psalm/plugin-phpunit": "^0.18.4", - "ramsey/coding-standard": "^2.0.3", - "ramsey/conventional-commits": "^1.3", - "vimeo/psalm": "^5.4" + "php-parallel-lint/php-parallel-lint": "^1.4", + "phpspec/prophecy-phpunit": "^2.3", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-mockery": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^10.5", + "ramsey/coding-standard": "^2.3", + "ramsey/conventional-commits": "^1.6", + "roave/security-advisories": "dev-latest" }, - "time": "2022-12-27T19:12:24+00:00", + "time": "2025-03-22T05:38:12+00:00", "type": "library", "extra": { "captainhook": { @@ -1749,37 +1752,27 @@ ], "support": { "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/1.3.0" + "source": "https://github.com/ramsey/collection/tree/2.1.1" }, - "funding": [ - { - "url": "https://github.com/ramsey", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/ramsey/collection", - "type": "tidelift" - } - ], "install-path": "../ramsey/collection" }, { "name": "ramsey/uuid", - "version": "4.9.0", - "version_normalized": "4.9.0.0", + "version": "4.9.1", + "version_normalized": "4.9.1.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0" + "reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/4e0e23cc785f0724a0e838279a9eb03f28b092a0", - "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/81f941f6f729b1e3ceea61d9d014f8b6c6800440", + "reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440", "shasum": "" }, "require": { - "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13", + "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14", "php": "^8.0", "ramsey/collection": "^1.2 || ^2.0" }, @@ -1812,7 +1805,7 @@ "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." }, - "time": "2025-06-25T14:20:11+00:00", + "time": "2025-09-04T20:59:21+00:00", "type": "library", "extra": { "captainhook": { @@ -1840,32 +1833,34 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.9.0" + "source": "https://github.com/ramsey/uuid/tree/4.9.1" }, "install-path": "../ramsey/uuid" }, { "name": "rize/uri-template", - "version": "0.3.8", - "version_normalized": "0.3.8.0", + "version": "0.4.0", + "version_normalized": "0.4.0.0", "source": { "type": "git", "url": "https://github.com/rize/UriTemplate.git", - "reference": "34a5b96d0b65a5dddb7d20f09b6527a43faede24" + "reference": "56f374a9a42c7c3998f8b55b6b21b224de90c58b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rize/UriTemplate/zipball/34a5b96d0b65a5dddb7d20f09b6527a43faede24", - "reference": "34a5b96d0b65a5dddb7d20f09b6527a43faede24", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/56f374a9a42c7c3998f8b55b6b21b224de90c58b", + "reference": "56f374a9a42c7c3998f8b55b6b21b224de90c58b", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "~4.8.36" + "friendsofphp/php-cs-fixer": "^3.63", + "phpstan/phpstan": "^1.12", + "phpunit/phpunit": "~10.0" }, - "time": "2024-08-30T07:09:40+00:00", + "time": "2024-11-27T12:13:42+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1891,7 +1886,7 @@ ], "support": { "issues": "https://github.com/rize/UriTemplate/issues", - "source": "https://github.com/rize/UriTemplate/tree/0.3.8" + "source": "https://github.com/rize/UriTemplate/tree/0.4.0" }, "funding": [ { @@ -1911,23 +1906,23 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.0.2", - "version_normalized": "3.0.2.0", + "version": "v3.6.0", + "version_normalized": "3.6.0.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, - "time": "2022-01-02T09:55:41+00:00", + "time": "2024-09-25T14:21:43+00:00", "type": "library", "extra": { "thanks": { @@ -1935,7 +1930,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.6-dev" } }, "installation-source": "dist", @@ -1961,7 +1956,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" }, "funding": [ { @@ -1978,85 +1973,6 @@ } ], "install-path": "../symfony/deprecation-contracts" - }, - { - "name": "symfony/polyfill-php81", - "version": "v1.32.0", - "version_normalized": "1.32.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", - "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "time": "2024-09-09T11:45:10+00:00", - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.32.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/polyfill-php81" } ], "dev": false, diff --git a/lib/Google/vendor/composer/installed.php b/lib/Google/vendor/composer/installed.php index 751d577c6..ec08b6c33 100644 --- a/lib/Google/vendor/composer/installed.php +++ b/lib/Google/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'google/apiclient', 'pretty_version' => 'dev-latest', 'version' => 'dev-latest', - 'reference' => 'e9bccc39abc840b90f13f5054b669f3d2d2fe0df', + 'reference' => '5ea5a3f9fefe25636bdc90c500a88f5866ad5ae6', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -11,9 +11,9 @@ ), 'versions' => array( 'brick/math' => array( - 'pretty_version' => '0.11.0', - 'version' => '0.11.0.0', - 'reference' => '0ad82ce168c82ba30d1c01ec86116ab52f589478', + 'pretty_version' => '0.14.0', + 'version' => '0.14.0.0', + 'reference' => '113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2', 'type' => 'library', 'install_path' => __DIR__ . '/../brick/math', 'aliases' => array(), @@ -31,25 +31,25 @@ 'google/apiclient' => array( 'pretty_version' => 'dev-latest', 'version' => 'dev-latest', - 'reference' => 'e9bccc39abc840b90f13f5054b669f3d2d2fe0df', + 'reference' => '5ea5a3f9fefe25636bdc90c500a88f5866ad5ae6', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => false, ), 'google/apiclient-services' => array( - 'pretty_version' => 'v0.396.0', - 'version' => '0.396.0.0', - 'reference' => 'ceb2e432e4326c6775d24f62d554395a1a9ad3dd', + 'pretty_version' => 'v0.415.0', + 'version' => '0.415.0.0', + 'reference' => '080bdeb1d5243429164dc589b69426bae98dad1d', 'type' => 'library', 'install_path' => __DIR__ . '/../google/apiclient-services', 'aliases' => array(), 'dev_requirement' => false, ), 'google/auth' => array( - 'pretty_version' => 'v1.42.0', - 'version' => '1.42.0.0', - 'reference' => '0c25599a91530b5847f129b271c536f75a7563f5', + 'pretty_version' => 'v1.44.0', + 'version' => '1.44.0.0', + 'reference' => '5670e56307d7a2eac931f677c0e59a4f8abb2e43', 'type' => 'library', 'install_path' => __DIR__ . '/../google/auth', 'aliases' => array(), @@ -65,18 +65,18 @@ 'dev_requirement' => false, ), 'google/cloud-storage' => array( - 'pretty_version' => 'v1.48.1', - 'version' => '1.48.1.0', - 'reference' => '509b095c3ea44db92c9e62a94b5773563c831821', + 'pretty_version' => 'v1.48.4', + 'version' => '1.48.4.0', + 'reference' => '4b81b682f6b1517c0c5f6152b2980195d23c1cef', 'type' => 'library', 'install_path' => __DIR__ . '/../google/cloud-storage', 'aliases' => array(), 'dev_requirement' => false, ), 'google/common-protos' => array( - 'pretty_version' => '4.12.1', - 'version' => '4.12.1.0', - 'reference' => '70c4eb1abab5484a23c17a43b0d455259f5d8c1b', + 'pretty_version' => '4.12.4', + 'version' => '4.12.4.0', + 'reference' => '0127156899af0df2681bd42024c60bd5360d64e3', 'type' => 'library', 'install_path' => __DIR__ . '/../google/common-protos', 'aliases' => array(), @@ -101,54 +101,54 @@ 'dev_requirement' => false, ), 'google/longrunning' => array( - 'pretty_version' => '0.4.7', - 'version' => '0.4.7.0', - 'reference' => '624cabb874c10e5ddc9034c999f724894b70a3d3', + 'pretty_version' => '0.5.0', + 'version' => '0.5.0.0', + 'reference' => '715519ab4aaf3c4268adb2b551ee0f34135c8c5f', 'type' => 'library', 'install_path' => __DIR__ . '/../google/longrunning', 'aliases' => array(), 'dev_requirement' => false, ), 'google/protobuf' => array( - 'pretty_version' => 'v4.31.1', - 'version' => '4.31.1.0', - 'reference' => '2b028ce8876254e2acbeceea7d9b573faad41864', + 'pretty_version' => 'v4.32.1', + 'version' => '4.32.1.0', + 'reference' => 'c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb', 'type' => 'library', 'install_path' => __DIR__ . '/../google/protobuf', 'aliases' => array(), 'dev_requirement' => false, ), 'grpc/grpc' => array( - 'pretty_version' => '1.57.0', - 'version' => '1.57.0.0', - 'reference' => 'b610c42022ed3a22f831439cb93802f2a4502fdf', + 'pretty_version' => '1.74.0', + 'version' => '1.74.0.0', + 'reference' => '32bf4dba256d60d395582fb6e4e8d3936bcdb713', 'type' => 'library', 'install_path' => __DIR__ . '/../grpc/grpc', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/guzzle' => array( - 'pretty_version' => '7.9.3', - 'version' => '7.9.3.0', - 'reference' => '7b2f29fe81dc4da0ca0ea7d42107a0845946ea77', + 'pretty_version' => '7.10.0', + 'version' => '7.10.0.0', + 'reference' => 'b51ac707cfa420b7bfd4e4d5e510ba8008e822b4', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/guzzle', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/promises' => array( - 'pretty_version' => '2.2.0', - 'version' => '2.2.0.0', - 'reference' => '7c69f28996b0a6920945dd20b3857e499d9ca96c', + 'pretty_version' => '2.3.0', + 'version' => '2.3.0.0', + 'reference' => '481557b130ef3790cf82b713667b43030dc9c957', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/promises', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/psr7' => array( - 'pretty_version' => '2.7.1', - 'version' => '2.7.1.0', - 'reference' => 'c2270caaabe631b3b44c85f99e5a04bbb8060d16', + 'pretty_version' => '2.8.0', + 'version' => '2.8.0.0', + 'reference' => '21dc724a0583619cd1652f673303492272778051', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 'aliases' => array(), @@ -164,9 +164,9 @@ 'dev_requirement' => false, ), 'paragonie/constant_time_encoding' => array( - 'pretty_version' => 'v3.0.0', - 'version' => '3.0.0.0', - 'reference' => 'df1e7fde177501eee2037dd159cf04f5f301a512', + 'pretty_version' => 'v3.1.3', + 'version' => '3.1.3.0', + 'reference' => 'd5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77', 'type' => 'library', 'install_path' => __DIR__ . '/../paragonie/constant_time_encoding', 'aliases' => array(), @@ -182,18 +182,18 @@ 'dev_requirement' => false, ), 'phpseclib/phpseclib' => array( - 'pretty_version' => '3.0.43', - 'version' => '3.0.43.0', - 'reference' => '709ec107af3cb2f385b9617be72af8cf62441d02', + 'pretty_version' => '3.0.47', + 'version' => '3.0.47.0', + 'reference' => '9d6ca36a6c2dd434765b1071b2644a1c683b385d', 'type' => 'library', 'install_path' => __DIR__ . '/../phpseclib/phpseclib', 'aliases' => array(), 'dev_requirement' => false, ), 'psr/cache' => array( - 'pretty_version' => '3.0.0', - 'version' => '3.0.0.0', - 'reference' => 'aa5030cfa5405eccfdcb1083ce040c2cb8d253bf', + 'pretty_version' => '2.0.0', + 'version' => '2.0.0.0', + 'reference' => '213f9dbc5b9bfbc4f8db86d2838dc968752ce13b', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/cache', 'aliases' => array(), @@ -269,18 +269,18 @@ 'dev_requirement' => false, ), 'ramsey/collection' => array( - 'pretty_version' => '1.3.0', - 'version' => '1.3.0.0', - 'reference' => 'ad7475d1c9e70b190ecffc58f2d989416af339b4', + 'pretty_version' => '2.1.1', + 'version' => '2.1.1.0', + 'reference' => '344572933ad0181accbf4ba763e85a0306a8c5e2', 'type' => 'library', 'install_path' => __DIR__ . '/../ramsey/collection', 'aliases' => array(), 'dev_requirement' => false, ), 'ramsey/uuid' => array( - 'pretty_version' => '4.9.0', - 'version' => '4.9.0.0', - 'reference' => '4e0e23cc785f0724a0e838279a9eb03f28b092a0', + 'pretty_version' => '4.9.1', + 'version' => '4.9.1.0', + 'reference' => '81f941f6f729b1e3ceea61d9d014f8b6c6800440', 'type' => 'library', 'install_path' => __DIR__ . '/../ramsey/uuid', 'aliases' => array(), @@ -289,35 +289,26 @@ 'rhumsaa/uuid' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '4.9.0', + 0 => '4.9.1', ), ), 'rize/uri-template' => array( - 'pretty_version' => '0.3.8', - 'version' => '0.3.8.0', - 'reference' => '34a5b96d0b65a5dddb7d20f09b6527a43faede24', + 'pretty_version' => '0.4.0', + 'version' => '0.4.0.0', + 'reference' => '56f374a9a42c7c3998f8b55b6b21b224de90c58b', 'type' => 'library', 'install_path' => __DIR__ . '/../rize/uri-template', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/deprecation-contracts' => array( - 'pretty_version' => 'v3.0.2', - 'version' => '3.0.2.0', - 'reference' => '26954b3d62a6c5fd0ea8a2a00c0353a14978d05c', + 'pretty_version' => 'v3.6.0', + 'version' => '3.6.0.0', + 'reference' => '63afe740e99a13ba87ec199bb07bbdee937a5b62', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => false, ), - 'symfony/polyfill-php81' => array( - 'pretty_version' => 'v1.32.0', - 'version' => '1.32.0.0', - 'reference' => '4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c', - 'type' => 'library', - 'install_path' => __DIR__ . '/../symfony/polyfill-php81', - 'aliases' => array(), - 'dev_requirement' => false, - ), ), ); diff --git a/lib/Google/vendor/composer/platform_check.php b/lib/Google/vendor/composer/platform_check.php index b168ddd5d..d32d90c6a 100644 --- a/lib/Google/vendor/composer/platform_check.php +++ b/lib/Google/vendor/composer/platform_check.php @@ -4,8 +4,8 @@ $issues = array(); -if (!(PHP_VERSION_ID >= 80002)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 8.0.2". You are running ' . PHP_VERSION . '.'; +if (!(PHP_VERSION_ID >= 80200)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 8.2.0". You are running ' . PHP_VERSION . '.'; } if ($issues) { diff --git a/lib/Google/vendor/google/apiclient-services/composer.json b/lib/Google/vendor/google/apiclient-services/composer.json index 586694df8..8712550ac 100644 --- a/lib/Google/vendor/google/apiclient-services/composer.json +++ b/lib/Google/vendor/google/apiclient-services/composer.json @@ -6,7 +6,7 @@ "homepage": "http://developers.google.com/api-client-library/php", "license": "Apache-2.0", "require": { - "php": "^8.0" + "php": "^8.1" }, "require-dev": { "phpunit/phpunit": "^9.6" diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage.php b/lib/Google/vendor/google/apiclient-services/src/Storage.php index 38cedc75e..4fb7501ec 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage.php @@ -458,6 +458,10 @@ public function __construct($clientOrConfig = [], $rootUrl = null) 'location' => 'query', 'type' => 'string', ], + 'returnPartialSuccess' => [ + 'location' => 'query', + 'type' => 'boolean', + ], 'softDeleted' => [ 'location' => 'query', 'type' => 'boolean', @@ -1604,6 +1608,10 @@ public function __construct($clientOrConfig = [], $rootUrl = null) 'location' => 'query', 'type' => 'string', ], + 'filter' => [ + 'location' => 'query', + 'type' => 'string', + ], 'includeFoldersAsPrefixes' => [ 'location' => 'query', 'type' => 'boolean', @@ -1700,6 +1708,10 @@ public function __construct($clientOrConfig = [], $rootUrl = null) 'location' => 'query', 'type' => 'string', ], + 'projection' => [ + 'location' => 'query', + 'type' => 'string', + ], 'userProject' => [ 'location' => 'query', 'type' => 'string', diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryption.php b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryption.php index c44a60f8b..8c86aa718 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryption.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryption.php @@ -19,11 +19,45 @@ class BucketEncryption extends \Google\Model { + protected $customerManagedEncryptionEnforcementConfigType = BucketEncryptionCustomerManagedEncryptionEnforcementConfig::class; + protected $customerManagedEncryptionEnforcementConfigDataType = ''; + protected $customerSuppliedEncryptionEnforcementConfigType = BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig::class; + protected $customerSuppliedEncryptionEnforcementConfigDataType = ''; /** * @var string */ public $defaultKmsKeyName; + protected $googleManagedEncryptionEnforcementConfigType = BucketEncryptionGoogleManagedEncryptionEnforcementConfig::class; + protected $googleManagedEncryptionEnforcementConfigDataType = ''; + /** + * @param BucketEncryptionCustomerManagedEncryptionEnforcementConfig + */ + public function setCustomerManagedEncryptionEnforcementConfig(BucketEncryptionCustomerManagedEncryptionEnforcementConfig $customerManagedEncryptionEnforcementConfig) + { + $this->customerManagedEncryptionEnforcementConfig = $customerManagedEncryptionEnforcementConfig; + } + /** + * @return BucketEncryptionCustomerManagedEncryptionEnforcementConfig + */ + public function getCustomerManagedEncryptionEnforcementConfig() + { + return $this->customerManagedEncryptionEnforcementConfig; + } + /** + * @param BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig + */ + public function setCustomerSuppliedEncryptionEnforcementConfig(BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig $customerSuppliedEncryptionEnforcementConfig) + { + $this->customerSuppliedEncryptionEnforcementConfig = $customerSuppliedEncryptionEnforcementConfig; + } + /** + * @return BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig + */ + public function getCustomerSuppliedEncryptionEnforcementConfig() + { + return $this->customerSuppliedEncryptionEnforcementConfig; + } /** * @param string */ @@ -38,6 +72,20 @@ public function getDefaultKmsKeyName() { return $this->defaultKmsKeyName; } + /** + * @param BucketEncryptionGoogleManagedEncryptionEnforcementConfig + */ + public function setGoogleManagedEncryptionEnforcementConfig(BucketEncryptionGoogleManagedEncryptionEnforcementConfig $googleManagedEncryptionEnforcementConfig) + { + $this->googleManagedEncryptionEnforcementConfig = $googleManagedEncryptionEnforcementConfig; + } + /** + * @return BucketEncryptionGoogleManagedEncryptionEnforcementConfig + */ + public function getGoogleManagedEncryptionEnforcementConfig() + { + return $this->googleManagedEncryptionEnforcementConfig; + } } // Adding a class alias for backwards compatibility with the previous class name. diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerManagedEncryptionEnforcementConfig.php b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerManagedEncryptionEnforcementConfig.php new file mode 100644 index 000000000..c08d47811 --- /dev/null +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerManagedEncryptionEnforcementConfig.php @@ -0,0 +1,62 @@ +effectiveTime = $effectiveTime; + } + /** + * @return string + */ + public function getEffectiveTime() + { + return $this->effectiveTime; + } + /** + * @param string + */ + public function setRestrictionMode($restrictionMode) + { + $this->restrictionMode = $restrictionMode; + } + /** + * @return string + */ + public function getRestrictionMode() + { + return $this->restrictionMode; + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BucketEncryptionCustomerManagedEncryptionEnforcementConfig::class, 'Google_Service_Storage_BucketEncryptionCustomerManagedEncryptionEnforcementConfig'); diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig.php b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig.php new file mode 100644 index 000000000..c8971325c --- /dev/null +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig.php @@ -0,0 +1,62 @@ +effectiveTime = $effectiveTime; + } + /** + * @return string + */ + public function getEffectiveTime() + { + return $this->effectiveTime; + } + /** + * @param string + */ + public function setRestrictionMode($restrictionMode) + { + $this->restrictionMode = $restrictionMode; + } + /** + * @return string + */ + public function getRestrictionMode() + { + return $this->restrictionMode; + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig::class, 'Google_Service_Storage_BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig'); diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionGoogleManagedEncryptionEnforcementConfig.php b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionGoogleManagedEncryptionEnforcementConfig.php new file mode 100644 index 000000000..39fee8a7e --- /dev/null +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionGoogleManagedEncryptionEnforcementConfig.php @@ -0,0 +1,62 @@ +effectiveTime = $effectiveTime; + } + /** + * @return string + */ + public function getEffectiveTime() + { + return $this->effectiveTime; + } + /** + * @param string + */ + public function setRestrictionMode($restrictionMode) + { + $this->restrictionMode = $restrictionMode; + } + /** + * @return string + */ + public function getRestrictionMode() + { + return $this->restrictionMode; + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BucketEncryptionGoogleManagedEncryptionEnforcementConfig::class, 'Google_Service_Storage_BucketEncryptionGoogleManagedEncryptionEnforcementConfig'); diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketIpFilter.php b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketIpFilter.php index 8528a0550..735116c6b 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketIpFilter.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketIpFilter.php @@ -20,6 +20,14 @@ class BucketIpFilter extends \Google\Collection { protected $collection_key = 'vpcNetworkSources'; + /** + * @var bool + */ + public $allowAllServiceAgentAccess; + /** + * @var bool + */ + public $allowCrossOrgVpcs; /** * @var string */ @@ -29,6 +37,34 @@ class BucketIpFilter extends \Google\Collection protected $vpcNetworkSourcesType = BucketIpFilterVpcNetworkSources::class; protected $vpcNetworkSourcesDataType = 'array'; + /** + * @param bool + */ + public function setAllowAllServiceAgentAccess($allowAllServiceAgentAccess) + { + $this->allowAllServiceAgentAccess = $allowAllServiceAgentAccess; + } + /** + * @return bool + */ + public function getAllowAllServiceAgentAccess() + { + return $this->allowAllServiceAgentAccess; + } + /** + * @param bool + */ + public function setAllowCrossOrgVpcs($allowCrossOrgVpcs) + { + $this->allowCrossOrgVpcs = $allowCrossOrgVpcs; + } + /** + * @return bool + */ + public function getAllowCrossOrgVpcs() + { + return $this->allowCrossOrgVpcs; + } /** * @param string */ diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/Buckets.php b/lib/Google/vendor/google/apiclient-services/src/Storage/Buckets.php index c0e9d0f99..b1f7864ab 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/Buckets.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/Buckets.php @@ -19,7 +19,7 @@ class Buckets extends \Google\Collection { - protected $collection_key = 'items'; + protected $collection_key = 'unreachable'; protected $itemsType = Bucket::class; protected $itemsDataType = 'array'; /** @@ -30,6 +30,10 @@ class Buckets extends \Google\Collection * @var string */ public $nextPageToken; + /** + * @var string[] + */ + public $unreachable; /** * @param Bucket[] @@ -73,6 +77,20 @@ public function getNextPageToken() { return $this->nextPageToken; } + /** + * @param string[] + */ + public function setUnreachable($unreachable) + { + $this->unreachable = $unreachable; + } + /** + * @return string[] + */ + public function getUnreachable() + { + return $this->unreachable; + } } // Adding a class alias for backwards compatibility with the previous class name. diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/BulkRestoreObjectsRequest.php b/lib/Google/vendor/google/apiclient-services/src/Storage/BulkRestoreObjectsRequest.php index d7feda6f0..c77adbb53 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/BulkRestoreObjectsRequest.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/BulkRestoreObjectsRequest.php @@ -28,6 +28,14 @@ class BulkRestoreObjectsRequest extends \Google\Collection * @var bool */ public $copySourceAcl; + /** + * @var string + */ + public $createdAfterTime; + /** + * @var string + */ + public $createdBeforeTime; /** * @var string[] */ @@ -69,6 +77,34 @@ public function getCopySourceAcl() { return $this->copySourceAcl; } + /** + * @param string + */ + public function setCreatedAfterTime($createdAfterTime) + { + $this->createdAfterTime = $createdAfterTime; + } + /** + * @return string + */ + public function getCreatedAfterTime() + { + return $this->createdAfterTime; + } + /** + * @param string + */ + public function setCreatedBeforeTime($createdBeforeTime) + { + $this->createdBeforeTime = $createdBeforeTime; + } + /** + * @return string + */ + public function getCreatedBeforeTime() + { + return $this->createdBeforeTime; + } /** * @param string[] */ diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/ObjectCustomContextPayload.php b/lib/Google/vendor/google/apiclient-services/src/Storage/ObjectCustomContextPayload.php new file mode 100644 index 000000000..66a9803b7 --- /dev/null +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/ObjectCustomContextPayload.php @@ -0,0 +1,80 @@ +createTime = $createTime; + } + /** + * @return string + */ + public function getCreateTime() + { + return $this->createTime; + } + /** + * @param string + */ + public function setUpdateTime($updateTime) + { + $this->updateTime = $updateTime; + } + /** + * @return string + */ + public function getUpdateTime() + { + return $this->updateTime; + } + /** + * @param string + */ + public function setValue($value) + { + $this->value = $value; + } + /** + * @return string + */ + public function getValue() + { + return $this->value; + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ObjectCustomContextPayload::class, 'Google_Service_Storage_ObjectCustomContextPayload'); diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Buckets.php b/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Buckets.php index 3816df7c5..ab960a20c 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Buckets.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Buckets.php @@ -165,6 +165,8 @@ public function insert($project, Bucket $postBody, $optParams = []) * @opt_param string prefix Filter results to buckets whose names begin with * this prefix. * @opt_param string projection Set of properties to return. Defaults to noAcl. + * @opt_param bool returnPartialSuccess If true, return a list of bucket + * resource names for buckets that are in unreachable locations. * @opt_param bool softDeleted If true, only soft-deleted bucket versions will * be returned. The default is false. For more information, see [Soft * Delete](https://cloud.google.com/storage/docs/soft-delete). diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Folders.php b/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Folders.php index 6b9347da0..2e2395f11 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Folders.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Folders.php @@ -82,7 +82,7 @@ public function get($bucket, $folder, $optParams = []) * @param Folder $postBody * @param array $optParams Optional parameters. * - * @opt_param bool recursive If true, any parent folder which doesn’t exist will + * @opt_param bool recursive If true, any parent folder which doesn't exist will * be created automatically. * @return Folder * @throws \Google\Service\Exception diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Objects.php b/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Objects.php index 725c488ad..2168ec552 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Objects.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Objects.php @@ -316,6 +316,9 @@ public function insert($bucket, StorageObject $postBody, $optParams = []) * lexicographically before endOffset. If startOffset is also set, the objects * listed will have names between startOffset (inclusive) and endOffset * (exclusive). + * @opt_param string filter Filter the returned objects. Currently only + * supported for the contexts field. If delimiter is set, the returned prefixes + * are exempt from this filter. * @opt_param bool includeFoldersAsPrefixes Only applicable if delimiter is set * to '/'. If true, will also include folders and managed folders (besides * objects) in the returned prefixes. @@ -407,6 +410,7 @@ public function listObjects($bucket, $optParams = []) * match the given value. `ifSourceMetagenerationMatch` and * `ifSourceMetagenerationNotMatch` conditions are mutually exclusive: it's an * error for both of them to be set in the request. + * @opt_param string projection Set of properties to return. Defaults to noAcl. * @opt_param string userProject The project to be billed for this request. * Required for Requester Pays buckets. * @return StorageObject diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/StorageObject.php b/lib/Google/vendor/google/apiclient-services/src/Storage/StorageObject.php index 8f4b75b0d..ef8eb1bce 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/StorageObject.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/StorageObject.php @@ -50,6 +50,8 @@ class StorageObject extends \Google\Collection * @var string */ public $contentType; + protected $contextsType = StorageObjectContexts::class; + protected $contextsDataType = ''; /** * @var string */ @@ -273,6 +275,20 @@ public function getContentType() { return $this->contentType; } + /** + * @param StorageObjectContexts + */ + public function setContexts(StorageObjectContexts $contexts) + { + $this->contexts = $contexts; + } + /** + * @return StorageObjectContexts + */ + public function getContexts() + { + return $this->contexts; + } /** * @param string */ diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/StorageObjectContexts.php b/lib/Google/vendor/google/apiclient-services/src/Storage/StorageObjectContexts.php new file mode 100644 index 000000000..7518dc0e2 --- /dev/null +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/StorageObjectContexts.php @@ -0,0 +1,42 @@ +custom = $custom; + } + /** + * @return ObjectCustomContextPayload[] + */ + public function getCustom() + { + return $this->custom; + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StorageObjectContexts::class, 'Google_Service_Storage_StorageObjectContexts'); diff --git a/lib/Google/vendor/google/auth/VERSION b/lib/Google/vendor/google/auth/VERSION index a50908ca3..372cf402c 100644 --- a/lib/Google/vendor/google/auth/VERSION +++ b/lib/Google/vendor/google/auth/VERSION @@ -1 +1 @@ -1.42.0 +1.44.0 diff --git a/lib/Google/vendor/google/auth/composer.json b/lib/Google/vendor/google/auth/composer.json index 41a1d0532..72673f1f2 100644 --- a/lib/Google/vendor/google/auth/composer.json +++ b/lib/Google/vendor/google/auth/composer.json @@ -9,7 +9,7 @@ "docs": "https://googleapis.github.io/google-auth-library-php/main/" }, "require": { - "php": "^8.0", + "php": "^8.1", "firebase/php-jwt": "^6.0", "guzzlehttp/guzzle": "^7.4.5", "guzzlehttp/psr7": "^2.4.5", diff --git a/lib/Google/vendor/google/auth/src/AccessToken.php b/lib/Google/vendor/google/auth/src/AccessToken.php index 630b27961..9e27b692e 100644 --- a/lib/Google/vendor/google/auth/src/AccessToken.php +++ b/lib/Google/vendor/google/auth/src/AccessToken.php @@ -65,12 +65,12 @@ class AccessToken private $cache; /** - * @param callable $httpHandler [optional] An HTTP Handler to deliver PSR-7 requests. - * @param CacheItemPoolInterface $cache [optional] A PSR-6 compatible cache implementation. + * @param callable|null $httpHandler [optional] An HTTP Handler to deliver PSR-7 requests. + * @param CacheItemPoolInterface|null $cache [optional] A PSR-6 compatible cache implementation. */ public function __construct( - callable $httpHandler = null, - CacheItemPoolInterface $cache = null + ?callable $httpHandler = null, + ?CacheItemPoolInterface $cache = null ) { $this->httpHandler = $httpHandler ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); diff --git a/lib/Google/vendor/google/auth/src/ApplicationDefaultCredentials.php b/lib/Google/vendor/google/auth/src/ApplicationDefaultCredentials.php index 80437c8c9..18241670e 100644 --- a/lib/Google/vendor/google/auth/src/ApplicationDefaultCredentials.php +++ b/lib/Google/vendor/google/auth/src/ApplicationDefaultCredentials.php @@ -21,6 +21,7 @@ use Google\Auth\Credentials\AppIdentityCredentials; use Google\Auth\Credentials\GCECredentials; use Google\Auth\Credentials\ServiceAccountCredentials; +use Google\Auth\Credentials\UserRefreshCredentials; use Google\Auth\HttpHandler\HttpClientCache; use Google\Auth\HttpHandler\HttpHandlerFactory; use Google\Auth\Middleware\AuthTokenMiddleware; @@ -80,18 +81,18 @@ class ApplicationDefaultCredentials * * @param string|string[] $scope the scope of the access request, expressed * either as an Array or as a space-delimited String. - * @param callable $httpHandler callback which delivers psr7 request - * @param array $cacheConfig configuration for the cache when it's present - * @param CacheItemPoolInterface $cache A cache implementation, may be + * @param callable|null $httpHandler callback which delivers psr7 request + * @param array|null $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface|null $cache A cache implementation, may be * provided if you have one already available for use. * @return AuthTokenSubscriber * @throws DomainException if no implementation can be obtained. */ public static function getSubscriber(// @phpstan-ignore-line $scope = null, - callable $httpHandler = null, - array $cacheConfig = null, - CacheItemPoolInterface $cache = null + ?callable $httpHandler = null, + ?array $cacheConfig = null, + ?CacheItemPoolInterface $cache = null ) { $creds = self::getCredentials($scope, $httpHandler, $cacheConfig, $cache); @@ -108,9 +109,9 @@ public static function getSubscriber(// @phpstan-ignore-line * * @param string|string[] $scope the scope of the access request, expressed * either as an Array or as a space-delimited String. - * @param callable $httpHandler callback which delivers psr7 request - * @param array $cacheConfig configuration for the cache when it's present - * @param CacheItemPoolInterface $cache A cache implementation, may be + * @param callable|null $httpHandler callback which delivers psr7 request + * @param array|null $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface|null $cache A cache implementation, may be * provided if you have one already available for use. * @param string $quotaProject specifies a project to bill for access * charges associated with the request. @@ -119,9 +120,9 @@ public static function getSubscriber(// @phpstan-ignore-line */ public static function getMiddleware( $scope = null, - callable $httpHandler = null, - array $cacheConfig = null, - CacheItemPoolInterface $cache = null, + ?callable $httpHandler = null, + ?array $cacheConfig = null, + ?CacheItemPoolInterface $cache = null, $quotaProject = null ) { $creds = self::getCredentials($scope, $httpHandler, $cacheConfig, $cache, $quotaProject); @@ -135,16 +136,16 @@ public static function getMiddleware( * * @param string|string[] $scope the scope of the access request, expressed * either as an Array or as a space-delimited String. - * @param callable $httpHandler callback which delivers psr7 request - * @param array $cacheConfig configuration for the cache when it's present - * @param CacheItemPoolInterface $cache A cache implementation, may be + * @param callable|null $httpHandler callback which delivers psr7 request + * @param array|null $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface|null $cache A cache implementation, may be * provided if you have one already available for use. - * @param string $quotaProject specifies a project to bill for access + * @param string|null $quotaProject specifies a project to bill for access * charges associated with the request. - * @param string|string[] $defaultScope The default scope to use if no + * @param string|string[]|null $defaultScope The default scope to use if no * user-defined scopes exist, expressed either as an Array or as a * space-delimited string. - * @param string $universeDomain Specifies a universe domain to use for the + * @param string|null $universeDomain Specifies a universe domain to use for the * calling client library * * @return FetchAuthTokenInterface @@ -152,12 +153,12 @@ public static function getMiddleware( */ public static function getCredentials( $scope = null, - callable $httpHandler = null, - array $cacheConfig = null, - CacheItemPoolInterface $cache = null, + ?callable $httpHandler = null, + ?array $cacheConfig = null, + ?CacheItemPoolInterface $cache = null, $quotaProject = null, $defaultScope = null, - string $universeDomain = null + ?string $universeDomain = null ) { $creds = null; $jsonKey = CredentialsLoader::fromEnv() @@ -215,18 +216,18 @@ public static function getCredentials( * ID token. * * @param string $targetAudience The audience for the ID token. - * @param callable $httpHandler callback which delivers psr7 request - * @param array $cacheConfig configuration for the cache when it's present - * @param CacheItemPoolInterface $cache A cache implementation, may be + * @param callable|null $httpHandler callback which delivers psr7 request + * @param array|null $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface|null $cache A cache implementation, may be * provided if you have one already available for use. * @return AuthTokenMiddleware * @throws DomainException if no implementation can be obtained. */ public static function getIdTokenMiddleware( $targetAudience, - callable $httpHandler = null, - array $cacheConfig = null, - CacheItemPoolInterface $cache = null + ?callable $httpHandler = null, + ?array $cacheConfig = null, + ?CacheItemPoolInterface $cache = null ) { $creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache); @@ -242,18 +243,18 @@ public static function getIdTokenMiddleware( * ID token. * * @param string $targetAudience The audience for the ID token. - * @param callable $httpHandler callback which delivers psr7 request - * @param array $cacheConfig configuration for the cache when it's present - * @param CacheItemPoolInterface $cache A cache implementation, may be + * @param callable|null $httpHandler callback which delivers psr7 request + * @param array|null $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface|null $cache A cache implementation, may be * provided if you have one already available for use. * @return ProxyAuthTokenMiddleware * @throws DomainException if no implementation can be obtained. */ public static function getProxyIdTokenMiddleware( $targetAudience, - callable $httpHandler = null, - array $cacheConfig = null, - CacheItemPoolInterface $cache = null + ?callable $httpHandler = null, + ?array $cacheConfig = null, + ?CacheItemPoolInterface $cache = null ) { $creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache); @@ -266,9 +267,9 @@ public static function getProxyIdTokenMiddleware( * token. * * @param string $targetAudience The audience for the ID token. - * @param callable $httpHandler callback which delivers psr7 request - * @param array $cacheConfig configuration for the cache when it's present - * @param CacheItemPoolInterface $cache A cache implementation, may be + * @param callable|null $httpHandler callback which delivers psr7 request + * @param array|null $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface|null $cache A cache implementation, may be * provided if you have one already available for use. * @return FetchAuthTokenInterface * @throws DomainException if no implementation can be obtained. @@ -276,9 +277,9 @@ public static function getProxyIdTokenMiddleware( */ public static function getIdTokenCredentials( $targetAudience, - callable $httpHandler = null, - array $cacheConfig = null, - CacheItemPoolInterface $cache = null + ?callable $httpHandler = null, + ?array $cacheConfig = null, + ?CacheItemPoolInterface $cache = null ) { $creds = null; $jsonKey = CredentialsLoader::fromEnv() @@ -298,15 +299,11 @@ public static function getIdTokenCredentials( throw new \InvalidArgumentException('json key is missing the type field'); } - if ($jsonKey['type'] == 'authorized_user') { - throw new InvalidArgumentException('ID tokens are not supported for end user credentials'); - } - - if ($jsonKey['type'] != 'service_account') { - throw new InvalidArgumentException('invalid value in the type field'); - } - - $creds = new ServiceAccountCredentials(null, $jsonKey, null, $targetAudience); + $creds = match ($jsonKey['type']) { + 'authorized_user' => new UserRefreshCredentials(null, $jsonKey, $targetAudience), + 'service_account' => new ServiceAccountCredentials(null, $jsonKey, null, $targetAudience), + default => throw new InvalidArgumentException('invalid value in the type field') + }; } elseif (self::onGce($httpHandler, $cacheConfig, $cache)) { $creds = new GCECredentials(null, null, $targetAudience); $creds->setIsOnGce(true); // save the credentials a trip to the metadata server @@ -334,15 +331,15 @@ private static function notFound() } /** - * @param callable $httpHandler - * @param array $cacheConfig - * @param CacheItemPoolInterface $cache + * @param callable|null $httpHandler + * @param array|null $cacheConfig + * @param CacheItemPoolInterface|null $cache * @return bool */ private static function onGce( - callable $httpHandler = null, - array $cacheConfig = null, - CacheItemPoolInterface $cache = null + ?callable $httpHandler = null, + ?array $cacheConfig = null, + ?CacheItemPoolInterface $cache = null ) { $gceCacheConfig = []; foreach (['lifetime', 'prefix'] as $key) { diff --git a/lib/Google/vendor/google/auth/src/CredentialSource/AwsNativeSource.php b/lib/Google/vendor/google/auth/src/CredentialSource/AwsNativeSource.php index 6d9244ba2..880ca1001 100644 --- a/lib/Google/vendor/google/auth/src/CredentialSource/AwsNativeSource.php +++ b/lib/Google/vendor/google/auth/src/CredentialSource/AwsNativeSource.php @@ -50,9 +50,9 @@ class AwsNativeSource implements ExternalAccountCredentialSourceInterface public function __construct( string $audience, string $regionalCredVerificationUrl, - string $regionUrl = null, - string $securityCredentialsUrl = null, - string $imdsv2SessionTokenUrl = null + ?string $regionUrl = null, + ?string $securityCredentialsUrl = null, + ?string $imdsv2SessionTokenUrl = null ) { $this->audience = $audience; $this->regionalCredVerificationUrl = $regionalCredVerificationUrl; @@ -61,7 +61,7 @@ public function __construct( $this->imdsv2SessionTokenUrl = $imdsv2SessionTokenUrl; } - public function fetchSubjectToken(callable $httpHandler = null): string + public function fetchSubjectToken(?callable $httpHandler = null): string { if (is_null($httpHandler)) { $httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient()); @@ -103,7 +103,7 @@ public function fetchSubjectToken(callable $httpHandler = null): string $headers['x-goog-cloud-target-resource'] = $this->audience; // Format headers as they're expected in the subject token - $formattedHeaders= array_map( + $formattedHeaders = array_map( fn ($k, $v) => ['key' => $k, 'value' => $v], array_keys($headers), $headers, diff --git a/lib/Google/vendor/google/auth/src/CredentialSource/ExecutableSource.php b/lib/Google/vendor/google/auth/src/CredentialSource/ExecutableSource.php index ce3bd9fda..f6255bec9 100644 --- a/lib/Google/vendor/google/auth/src/CredentialSource/ExecutableSource.php +++ b/lib/Google/vendor/google/auth/src/CredentialSource/ExecutableSource.php @@ -88,12 +88,12 @@ class ExecutableSource implements ExternalAccountCredentialSourceInterface /** * @param string $command The string command to run to get the subject token. - * @param string $outputFile + * @param string|null $outputFile */ public function __construct( string $command, ?string $outputFile, - ExecutableHandler $executableHandler = null, + ?ExecutableHandler $executableHandler = null, ) { $this->command = $command; $this->outputFile = $outputFile; @@ -113,12 +113,12 @@ public function getCacheKey(): ?string } /** - * @param callable $httpHandler unused. + * @param callable|null $httpHandler unused. * @return string * @throws RuntimeException if the executable is not allowed to run. * @throws ExecutableResponseError if the executable response is invalid. */ - public function fetchSubjectToken(callable $httpHandler = null): string + public function fetchSubjectToken(?callable $httpHandler = null): string { // Check if the executable is allowed to run. if (getenv(self::GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES) !== '1') { diff --git a/lib/Google/vendor/google/auth/src/CredentialSource/FileSource.php b/lib/Google/vendor/google/auth/src/CredentialSource/FileSource.php index 00ac835a8..2e79119b8 100644 --- a/lib/Google/vendor/google/auth/src/CredentialSource/FileSource.php +++ b/lib/Google/vendor/google/auth/src/CredentialSource/FileSource.php @@ -31,15 +31,15 @@ class FileSource implements ExternalAccountCredentialSourceInterface private ?string $subjectTokenFieldName; /** - * @param string $file The file to read the subject token from. - * @param string $format The format of the token in the file. Can be null or "json". - * @param string $subjectTokenFieldName The name of the field containing the token in the file. This is required - * when format is "json". + * @param string $file The file to read the subject token from. + * @param string|null $format The format of the token in the file. Can be null or "json". + * @param string|null $subjectTokenFieldName The name of the field containing the token in the file. This is required + * when format is "json". */ public function __construct( string $file, - string $format = null, - string $subjectTokenFieldName = null + ?string $format = null, + ?string $subjectTokenFieldName = null ) { $this->file = $file; @@ -53,7 +53,7 @@ public function __construct( $this->subjectTokenFieldName = $subjectTokenFieldName; } - public function fetchSubjectToken(callable $httpHandler = null): string + public function fetchSubjectToken(?callable $httpHandler = null): string { $contents = file_get_contents($this->file); if ($this->format === 'json') { diff --git a/lib/Google/vendor/google/auth/src/CredentialSource/UrlSource.php b/lib/Google/vendor/google/auth/src/CredentialSource/UrlSource.php index 6046d52fa..d2f875ebf 100644 --- a/lib/Google/vendor/google/auth/src/CredentialSource/UrlSource.php +++ b/lib/Google/vendor/google/auth/src/CredentialSource/UrlSource.php @@ -39,17 +39,17 @@ class UrlSource implements ExternalAccountCredentialSourceInterface private ?array $headers; /** - * @param string $url The URL to fetch the subject token from. - * @param string $format The format of the token in the response. Can be null or "json". - * @param string $subjectTokenFieldName The name of the field containing the token in the response. This is required + * @param string $url The URL to fetch the subject token from. + * @param string|null $format The format of the token in the response. Can be null or "json". + * @param string|null $subjectTokenFieldName The name of the field containing the token in the response. This is required * when format is "json". - * @param array $headers Request headers to send in with the request to the URL. + * @param array|null $headers Request headers to send in with the request to the URL. */ public function __construct( string $url, - string $format = null, - string $subjectTokenFieldName = null, - array $headers = null + ?string $format = null, + ?string $subjectTokenFieldName = null, + ?array $headers = null ) { $this->url = $url; @@ -64,7 +64,7 @@ public function __construct( $this->headers = $headers; } - public function fetchSubjectToken(callable $httpHandler = null): string + public function fetchSubjectToken(?callable $httpHandler = null): string { if (is_null($httpHandler)) { $httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient()); diff --git a/lib/Google/vendor/google/auth/src/Credentials/AppIdentityCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/AppIdentityCredentials.php index db29438ab..5e4cfa53a 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/AppIdentityCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/AppIdentityCredentials.php @@ -116,7 +116,7 @@ public static function onAppEngine() * As the AppIdentityService uses protobufs to fetch the access token, * the GuzzleHttp\ClientInterface instance passed in will not be used. * - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request * @return array { * A set of auth related metadata, containing the following * @@ -124,7 +124,7 @@ public static function onAppEngine() * @type string $expiration_time * } */ - public function fetchAuthToken(callable $httpHandler = null) + public function fetchAuthToken(?callable $httpHandler = null) { try { $this->checkAppEngineContext(); @@ -161,10 +161,10 @@ public function signBlob($stringToSign, $forceOpenSsl = false) * * Returns null if AppIdentityService is unavailable. * - * @param callable $httpHandler Not used by this type. + * @param callable|null $httpHandler Not used by this type. * @return string|null */ - public function getProjectId(callable $httpHandler = null) + public function getProjectId(?callable $httpHandler = null) { try { $this->checkAppEngineContext(); @@ -181,11 +181,11 @@ public function getProjectId(callable $httpHandler = null) * * Subsequent calls to this method will return a cached value. * - * @param callable $httpHandler Not used in this implementation. + * @param callable|null $httpHandler Not used in this implementation. * @return string * @throws \Exception If AppEngine SDK or mock is not available. */ - public function getClientName(callable $httpHandler = null) + public function getClientName(?callable $httpHandler = null) { $this->checkAppEngineContext(); diff --git a/lib/Google/vendor/google/auth/src/Credentials/ExternalAccountCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/ExternalAccountCredentials.php index 3614d24d0..478063be1 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/ExternalAccountCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/ExternalAccountCredentials.php @@ -211,7 +211,7 @@ private static function buildCredentialSource(array $jsonKey): ExternalAccountCr /** * @param string $stsToken - * @param callable $httpHandler + * @param callable|null $httpHandler * * @return array { * A set of auth related metadata, containing the following @@ -220,7 +220,7 @@ private static function buildCredentialSource(array $jsonKey): ExternalAccountCr * @type int $expires_at * } */ - private function getImpersonatedAccessToken(string $stsToken, callable $httpHandler = null): array + private function getImpersonatedAccessToken(string $stsToken, ?callable $httpHandler = null): array { if (!isset($this->serviceAccountImpersonationUrl)) { throw new InvalidArgumentException( @@ -251,7 +251,9 @@ private function getImpersonatedAccessToken(string $stsToken, callable $httpHand } /** - * @param callable $httpHandler + * @param callable|null $httpHandler + * @param array $headers [optional] Metrics headers to be inserted + * into the token endpoint request present. * * @return array { * A set of auth related metadata, containing the following @@ -263,9 +265,9 @@ private function getImpersonatedAccessToken(string $stsToken, callable $httpHand * @type string $token_type (identity pool only) * } */ - public function fetchAuthToken(callable $httpHandler = null) + public function fetchAuthToken(?callable $httpHandler = null, array $headers = []) { - $stsToken = $this->auth->fetchAuthToken($httpHandler); + $stsToken = $this->auth->fetchAuthToken($httpHandler, $headers); if (isset($this->serviceAccountImpersonationUrl)) { return $this->getImpersonatedAccessToken($stsToken['access_token'], $httpHandler); @@ -325,13 +327,13 @@ public function getUniverseDomain(): string /** * Get the project ID. * - * @param callable $httpHandler Callback which delivers psr7 request - * @param string $accessToken The access token to use to sign the blob. If + * @param callable|null $httpHandler Callback which delivers psr7 request + * @param string|null $accessToken The access token to use to sign the blob. If * provided, saves a call to the metadata server for a new access * token. **Defaults to** `null`. * @return string|null */ - public function getProjectId(callable $httpHandler = null, string $accessToken = null) + public function getProjectId(?callable $httpHandler = null, ?string $accessToken = null) { if (isset($this->projectId)) { return $this->projectId; diff --git a/lib/Google/vendor/google/auth/src/Credentials/GCECredentials.php b/lib/Google/vendor/google/auth/src/Credentials/GCECredentials.php index 8b7547816..ab6753bd8 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/GCECredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/GCECredentials.php @@ -100,7 +100,7 @@ class GCECredentials extends CredentialsLoader implements /** * The metadata path of the project ID. */ - const UNIVERSE_DOMAIN_URI_PATH = 'v1/universe/universe_domain'; + const UNIVERSE_DOMAIN_URI_PATH = 'v1/universe/universe-domain'; /** * The header whose presence indicates GCE presence. @@ -199,7 +199,7 @@ class GCECredentials extends CredentialsLoader implements private ?string $universeDomain; /** - * @param Iam $iam [optional] An IAM instance. + * @param Iam|null $iam [optional] An IAM instance. * @param string|string[] $scope [optional] the scope of the access request, * expressed either as an array or as a space-delimited string. * @param string $targetAudience [optional] The audience for the ID token. @@ -207,16 +207,16 @@ class GCECredentials extends CredentialsLoader implements * charges associated with the request. * @param string $serviceAccountIdentity [optional] Specify a service * account identity name to use instead of "default". - * @param string $universeDomain [optional] Specify a universe domain to use + * @param string|null $universeDomain [optional] Specify a universe domain to use * instead of fetching one from the metadata server. */ public function __construct( - Iam $iam = null, + ?Iam $iam = null, $scope = null, $targetAudience = null, $quotaProject = null, $serviceAccountIdentity = null, - string $universeDomain = null + ?string $universeDomain = null ) { $this->iam = $iam; @@ -355,10 +355,10 @@ public static function onAppEngineFlexible() * host. * If $httpHandler is not specified a the default HttpHandler is used. * - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request * @return bool True if this a GCEInstance, false otherwise */ - public static function onGce(callable $httpHandler = null) + public static function onGce(?callable $httpHandler = null) { $httpHandler = $httpHandler ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); @@ -426,12 +426,12 @@ private static function detectResidencyWindows(string $registryProductKey): bool try { $productName = $shell->regRead($registryProductKey); - } catch(com_exception) { + } catch (com_exception) { // This means that we tried to read a key that doesn't exist on the registry // which might mean that it is a windows instance that is not on GCE return false; } - + return 0 === strpos($productName, self::PRODUCT_NAME); } @@ -441,7 +441,9 @@ private static function detectResidencyWindows(string $registryProductKey): bool * Fetches the auth tokens from the GCE metadata host if it is available. * If $httpHandler is not specified a the default HttpHandler is used. * - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request + * @param array $headers [optional] Headers to be inserted + * into the token endpoint request present. * * @return array { * A set of auth related metadata, based on the token type. @@ -453,7 +455,7 @@ private static function detectResidencyWindows(string $registryProductKey): bool * } * @throws \Exception */ - public function fetchAuthToken(callable $httpHandler = null) + public function fetchAuthToken(?callable $httpHandler = null, array $headers = []) { $httpHandler = $httpHandler ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); @@ -469,7 +471,7 @@ public function fetchAuthToken(callable $httpHandler = null) $response = $this->getFromMetadata( $httpHandler, $this->tokenUri, - $this->applyTokenEndpointMetrics([], $this->targetAudience ? 'it' : 'at') + $this->applyTokenEndpointMetrics($headers, $this->targetAudience ? 'it' : 'at') ); if ($this->targetAudience) { @@ -524,10 +526,10 @@ public function getLastReceivedToken() * * Subsequent calls will return a cached value. * - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request * @return string */ - public function getClientName(callable $httpHandler = null) + public function getClientName(?callable $httpHandler = null) { if ($this->clientName) { return $this->clientName; @@ -558,10 +560,10 @@ public function getClientName(callable $httpHandler = null) * * Returns null if called outside GCE. * - * @param callable $httpHandler Callback which delivers psr7 request + * @param callable|null $httpHandler Callback which delivers psr7 request * @return string|null */ - public function getProjectId(callable $httpHandler = null) + public function getProjectId(?callable $httpHandler = null) { if ($this->projectId) { return $this->projectId; @@ -586,10 +588,10 @@ public function getProjectId(callable $httpHandler = null) /** * Fetch the default universe domain from the metadata server. * - * @param callable $httpHandler Callback which delivers psr7 request + * @param callable|null $httpHandler Callback which delivers psr7 request * @return string */ - public function getUniverseDomain(callable $httpHandler = null): string + public function getUniverseDomain(?callable $httpHandler = null): string { if (null !== $this->universeDomain) { return $this->universeDomain; diff --git a/lib/Google/vendor/google/auth/src/Credentials/IAMCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/IAMCredentials.php index 98780c6e0..96d1df734 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/IAMCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/IAMCredentials.php @@ -71,7 +71,7 @@ public function getUpdateMetadataFunc() * * @param array $metadata metadata hashmap * @param string $unusedAuthUri optional auth uri - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request * Note: this param is unused here, only included here for * consistency with other credentials class * @@ -80,7 +80,7 @@ public function getUpdateMetadataFunc() public function updateMetadata( $metadata, $unusedAuthUri = null, - callable $httpHandler = null + ?callable $httpHandler = null ) { $metadata_copy = $metadata; $metadata_copy[self::SELECTOR_KEY] = $this->selector; diff --git a/lib/Google/vendor/google/auth/src/Credentials/ImpersonatedServiceAccountCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/ImpersonatedServiceAccountCredentials.php index 5d3522827..b907d8d96 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/ImpersonatedServiceAccountCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/ImpersonatedServiceAccountCredentials.php @@ -18,12 +18,20 @@ namespace Google\Auth\Credentials; +use Google\Auth\CacheTrait; use Google\Auth\CredentialsLoader; +use Google\Auth\FetchAuthTokenInterface; +use Google\Auth\HttpHandler\HttpClientCache; +use Google\Auth\HttpHandler\HttpHandlerFactory; use Google\Auth\IamSignerTrait; use Google\Auth\SignBlobInterface; +use GuzzleHttp\Psr7\Request; +use InvalidArgumentException; +use LogicException; class ImpersonatedServiceAccountCredentials extends CredentialsLoader implements SignBlobInterface { + use CacheTrait; use IamSignerTrait; private const CRED_TYPE = 'imp'; @@ -33,19 +41,36 @@ class ImpersonatedServiceAccountCredentials extends CredentialsLoader implements */ protected $impersonatedServiceAccountName; + protected FetchAuthTokenInterface $sourceCredentials; + + private string $serviceAccountImpersonationUrl; + /** - * @var UserRefreshCredentials + * @var string[] */ - protected $sourceCredentials; + private array $delegates; + + /** + * @var string|string[] + */ + private string|array $targetScope; + + private int $lifetime; /** * Instantiate an instance of ImpersonatedServiceAccountCredentials from a credentials file that - * has be created with the --impersonated-service-account flag. + * has be created with the --impersonate-service-account flag. + * + * @param string|string[]|null $scope The scope of the access request, expressed either as an + * array or as a space-delimited string. + * @param string|array $jsonKey JSON credential file path or JSON array credentials { + * JSON credentials as an associative array. * - * @param string|string[] $scope The scope of the access request, expressed either as an - * array or as a space-delimited string. - * @param string|array $jsonKey JSON credential file path or JSON credentials - * as an associative array. + * @type string $service_account_impersonation_url The URL to the service account + * @type string|FetchAuthTokenInterface $source_credentials The source credentials to impersonate + * @type int $lifetime The lifetime of the impersonated credentials + * @type string[] $delegates The delegates to impersonate + * } */ public function __construct( $scope, @@ -53,30 +78,38 @@ public function __construct( ) { if (is_string($jsonKey)) { if (!file_exists($jsonKey)) { - throw new \InvalidArgumentException('file does not exist'); + throw new InvalidArgumentException('file does not exist'); } $json = file_get_contents($jsonKey); if (!$jsonKey = json_decode((string) $json, true)) { - throw new \LogicException('invalid json for auth config'); + throw new LogicException('invalid json for auth config'); } } if (!array_key_exists('service_account_impersonation_url', $jsonKey)) { - throw new \LogicException( + throw new LogicException( 'json key is missing the service_account_impersonation_url field' ); } if (!array_key_exists('source_credentials', $jsonKey)) { - throw new \LogicException('json key is missing the source_credentials field'); + throw new LogicException('json key is missing the source_credentials field'); + } + if (is_array($jsonKey['source_credentials'])) { + if (!array_key_exists('type', $jsonKey['source_credentials'])) { + throw new InvalidArgumentException('json key source credentials are missing the type field'); + } + $jsonKey['source_credentials'] = CredentialsLoader::makeCredentials($scope, $jsonKey['source_credentials']); } + $this->targetScope = $scope ?? []; + $this->lifetime = $jsonKey['lifetime'] ?? 3600; + $this->delegates = $jsonKey['delegates'] ?? []; + + $this->serviceAccountImpersonationUrl = $jsonKey['service_account_impersonation_url']; $this->impersonatedServiceAccountName = $this->getImpersonatedServiceAccountNameFromUrl( - $jsonKey['service_account_impersonation_url'] + $this->serviceAccountImpersonationUrl ); - $this->sourceCredentials = new UserRefreshCredentials( - $scope, - $jsonKey['source_credentials'] - ); + $this->sourceCredentials = $jsonKey['source_credentials']; } /** @@ -103,13 +136,13 @@ private function getImpersonatedServiceAccountNameFromUrl( * @param callable|null $unusedHttpHandler not used by this credentials type. * @return string Token issuer email */ - public function getClientName(callable $unusedHttpHandler = null) + public function getClientName(?callable $unusedHttpHandler = null) { return $this->impersonatedServiceAccountName; } /** - * @param callable $httpHandler + * @param callable|null $httpHandler * * @return array { * A set of auth related metadata, containing the following @@ -121,13 +154,45 @@ public function getClientName(callable $unusedHttpHandler = null) * @type string $id_token * } */ - public function fetchAuthToken(callable $httpHandler = null) + public function fetchAuthToken(?callable $httpHandler = null) { - // We don't support id token endpoint requests as of now for Impersonated Cred - return $this->sourceCredentials->fetchAuthToken( + $httpHandler = $httpHandler ?? HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + + // The FetchAuthTokenInterface technically does not have a "headers" argument, but all of + // the implementations do. Additionally, passing in more parameters than the function has + // defined is allowed in PHP. So we'll just ignore the phpstan error here. + // @phpstan-ignore-next-line + $authToken = $this->sourceCredentials->fetchAuthToken( $httpHandler, $this->applyTokenEndpointMetrics([], 'at') ); + + $headers = $this->applyTokenEndpointMetrics([ + 'Content-Type' => 'application/json', + 'Cache-Control' => 'no-store', + 'Authorization' => sprintf('Bearer %s', $authToken['access_token'] ?? $authToken['id_token']), + ], 'at'); + + $body = [ + 'scope' => $this->targetScope, + 'delegates' => $this->delegates, + 'lifetime' => sprintf('%ss', $this->lifetime), + ]; + + $request = new Request( + 'POST', + $this->serviceAccountImpersonationUrl, + $headers, + (string) json_encode($body) + ); + + $response = $httpHandler($request); + $body = json_decode((string) $response->getBody(), true); + + return [ + 'access_token' => $body['accessToken'], + 'expires_at' => strtotime($body['expireTime']), + ]; } /** @@ -138,7 +203,9 @@ public function fetchAuthToken(callable $httpHandler = null) */ public function getCacheKey() { - return $this->sourceCredentials->getCacheKey(); + return $this->getFullCacheKey( + $this->serviceAccountImpersonationUrl . $this->sourceCredentials->getCacheKey() + ); } /** diff --git a/lib/Google/vendor/google/auth/src/Credentials/InsecureCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/InsecureCredentials.php index 9b9e24b11..5a2bef1c5 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/InsecureCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/InsecureCredentials.php @@ -36,10 +36,10 @@ class InsecureCredentials implements FetchAuthTokenInterface /** * Fetches the auth token. In this case it returns an empty string. * - * @param callable $httpHandler + * @param callable|null $httpHandler * @return array{access_token:string} A set of auth related metadata */ - public function fetchAuthToken(callable $httpHandler = null) + public function fetchAuthToken(?callable $httpHandler = null) { return $this->token; } diff --git a/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php index 5e7915333..3d23f71af 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php @@ -17,8 +17,10 @@ namespace Google\Auth\Credentials; +use Firebase\JWT\JWT; use Google\Auth\CredentialsLoader; use Google\Auth\GetQuotaProjectInterface; +use Google\Auth\Iam; use Google\Auth\OAuth2; use Google\Auth\ProjectIdProviderInterface; use Google\Auth\ServiceAccountSignerTrait; @@ -71,6 +73,7 @@ class ServiceAccountCredentials extends CredentialsLoader implements * @var string */ private const CRED_TYPE = 'sa'; + private const IAM_SCOPE = 'https://www.googleapis.com/auth/iam'; /** * The OAuth2 instance used to conduct authorization. @@ -111,6 +114,12 @@ class ServiceAccountCredentials extends CredentialsLoader implements */ private string $universeDomain; + /** + * Whether this is an ID token request or an access token request. Used when + * building the metric header. + */ + private bool $isIdTokenRequest = false; + /** * Create a new ServiceAccountCredentials. * @@ -158,6 +167,7 @@ public function __construct( $additionalClaims = []; if ($targetAudience) { $additionalClaims = ['target_audience' => $targetAudience]; + $this->isIdTokenRequest = true; } $this->auth = new OAuth2([ 'audience' => self::TOKEN_CREDENTIAL_URI, @@ -165,6 +175,7 @@ public function __construct( 'scope' => $scope, 'signingAlgorithm' => 'RS256', 'signingKey' => $jsonKey['private_key'], + 'signingKeyId' => $jsonKey['private_key_id'] ?? null, 'sub' => $sub, 'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI, 'additionalClaims' => $additionalClaims, @@ -189,7 +200,9 @@ public function useJwtAccessWithScope() } /** - * @param callable $httpHandler + * @param callable|null $httpHandler + * @param array $headers [optional] Headers to be inserted + * into the token endpoint request present. * * @return array { * A set of auth related metadata, containing the following @@ -199,7 +212,7 @@ public function useJwtAccessWithScope() * @type string $token_type * } */ - public function fetchAuthToken(callable $httpHandler = null) + public function fetchAuthToken(?callable $httpHandler = null, array $headers = []) { if ($this->useSelfSignedJwt()) { $jwtCreds = $this->createJwtAccessCredentials(); @@ -213,9 +226,34 @@ public function fetchAuthToken(callable $httpHandler = null) return $accessToken; } - $authRequestType = empty($this->auth->getAdditionalClaims()['target_audience']) - ? 'at' : 'it'; - return $this->auth->fetchAuthToken($httpHandler, $this->applyTokenEndpointMetrics([], $authRequestType)); + + if ($this->isIdTokenRequest && $this->getUniverseDomain() !== self::DEFAULT_UNIVERSE_DOMAIN) { + $now = time(); + $jwt = Jwt::encode( + [ + 'iss' => $this->auth->getIssuer(), + 'sub' => $this->auth->getIssuer(), + 'scope' => self::IAM_SCOPE, + 'exp' => ($now + $this->auth->getExpiry()), + 'iat' => ($now - OAuth2::DEFAULT_SKEW_SECONDS), + ], + $this->auth->getSigningKey(), + $this->auth->getSigningAlgorithm(), + $this->auth->getSigningKeyId() + ); + // We create a new instance of Iam each time because the `$httpHandler` might change. + $idToken = (new Iam($httpHandler, $this->getUniverseDomain()))->generateIdToken( + $this->auth->getIssuer(), + $this->auth->getAdditionalClaims()['target_audience'], + $jwt, + $this->applyTokenEndpointMetrics($headers, 'it') + ); + return ['id_token' => $idToken]; + } + return $this->auth->fetchAuthToken( + $httpHandler, + $this->applyTokenEndpointMetrics($headers, $this->isIdTokenRequest ? 'it' : 'at') + ); } /** @@ -258,10 +296,10 @@ public function getLastReceivedToken() * * Returns null if the project ID does not exist in the keyfile. * - * @param callable $httpHandler Not used by this credentials type. + * @param callable|null $httpHandler Not used by this credentials type. * @return string|null */ - public function getProjectId(callable $httpHandler = null) + public function getProjectId(?callable $httpHandler = null) { return $this->projectId; } @@ -271,13 +309,13 @@ public function getProjectId(callable $httpHandler = null) * * @param array $metadata metadata hashmap * @param string $authUri optional auth uri - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request * @return array updated metadata hashmap */ public function updateMetadata( $metadata, $authUri = null, - callable $httpHandler = null + ?callable $httpHandler = null ) { // scope exists. use oauth implementation if (!$this->useSelfSignedJwt()) { @@ -335,10 +373,10 @@ public function setSub($sub) * * In this case, it returns the keyfile's client_email key. * - * @param callable $httpHandler Not used by this credentials type. + * @param callable|null $httpHandler Not used by this credentials type. * @return string */ - public function getClientName(callable $httpHandler = null) + public function getClientName(?callable $httpHandler = null) { return $this->auth->getIssuer(); } @@ -399,8 +437,8 @@ private function useSelfSignedJwt() return false; } - // If claims are set, this call is for "id_tokens" - if ($this->auth->getAdditionalClaims()) { + // Do not use self-signed JWT for ID tokens + if ($this->isIdTokenRequest) { return false; } diff --git a/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php index 7bdc21848..50373760b 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php @@ -114,13 +114,13 @@ public function __construct($jsonKey, $scope = null) * * @param array $metadata metadata hashmap * @param string $authUri optional auth uri - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request * @return array updated metadata hashmap */ public function updateMetadata( $metadata, $authUri = null, - callable $httpHandler = null + ?callable $httpHandler = null ) { $scope = $this->auth->getScope(); if (empty($authUri) && empty($scope)) { @@ -135,11 +135,11 @@ public function updateMetadata( /** * Implements FetchAuthTokenInterface#fetchAuthToken. * - * @param callable $httpHandler + * @param callable|null $httpHandler * * @return null|array{access_token:string} A set of auth related metadata */ - public function fetchAuthToken(callable $httpHandler = null) + public function fetchAuthToken(?callable $httpHandler = null) { $audience = $this->auth->getAudience(); $scope = $this->auth->getScope(); @@ -196,10 +196,10 @@ public function getLastReceivedToken() * * Returns null if the project ID does not exist in the keyfile. * - * @param callable $httpHandler Not used by this credentials type. + * @param callable|null $httpHandler Not used by this credentials type. * @return string|null */ - public function getProjectId(callable $httpHandler = null) + public function getProjectId(?callable $httpHandler = null) { return $this->projectId; } @@ -209,10 +209,10 @@ public function getProjectId(callable $httpHandler = null) * * In this case, it returns the keyfile's client_email key. * - * @param callable $httpHandler Not used by this credentials type. + * @param callable|null $httpHandler Not used by this credentials type. * @return string */ - public function getClientName(callable $httpHandler = null) + public function getClientName(?callable $httpHandler = null) { return $this->auth->getIssuer(); } diff --git a/lib/Google/vendor/google/auth/src/Credentials/UserRefreshCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/UserRefreshCredentials.php index d40055562..326f6cd86 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/UserRefreshCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/UserRefreshCredentials.php @@ -20,6 +20,8 @@ use Google\Auth\CredentialsLoader; use Google\Auth\GetQuotaProjectInterface; use Google\Auth\OAuth2; +use InvalidArgumentException; +use LogicException; /** * Authenticates requests using User Refresh credentials. @@ -55,48 +57,67 @@ class UserRefreshCredentials extends CredentialsLoader implements GetQuotaProjec */ protected $quotaProject; + /** + * Whether this is an ID token request or an access token request. Used when + * building the metric header. + */ + private bool $isIdTokenRequest = false; + /** * Create a new UserRefreshCredentials. * - * @param string|string[] $scope the scope of the access request, expressed + * @param string|string[]|null $scope the scope of the access request, expressed * either as an Array or as a space-delimited String. * @param string|array $jsonKey JSON credential file path or JSON credentials * as an associative array + * @param string|null $targetAudience The audience for the ID token. */ public function __construct( $scope, - $jsonKey + $jsonKey, + ?string $targetAudience = null ) { if (is_string($jsonKey)) { if (!file_exists($jsonKey)) { - throw new \InvalidArgumentException('file does not exist'); + throw new InvalidArgumentException('file does not exist or is unreadable'); } $json = file_get_contents($jsonKey); if (!$jsonKey = json_decode((string) $json, true)) { - throw new \LogicException('invalid json for auth config'); + throw new LogicException('invalid json for auth config'); } } if (!array_key_exists('client_id', $jsonKey)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'json key is missing the client_id field' ); } if (!array_key_exists('client_secret', $jsonKey)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'json key is missing the client_secret field' ); } if (!array_key_exists('refresh_token', $jsonKey)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'json key is missing the refresh_token field' ); } + if ($scope && $targetAudience) { + throw new InvalidArgumentException( + 'Scope and targetAudience cannot both be supplied' + ); + } + $additionalClaims = []; + if ($targetAudience) { + $additionalClaims = ['target_audience' => $targetAudience]; + $this->isIdTokenRequest = true; + } $this->auth = new OAuth2([ 'clientId' => $jsonKey['client_id'], 'clientSecret' => $jsonKey['client_secret'], 'refresh_token' => $jsonKey['refresh_token'], 'scope' => $scope, 'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI, + 'additionalClaims' => $additionalClaims, ]); if (array_key_exists('quota_project_id', $jsonKey)) { $this->quotaProject = (string) $jsonKey['quota_project_id']; @@ -104,8 +125,8 @@ public function __construct( } /** - * @param callable $httpHandler - * @param array $metricsHeader [optional] Metrics headers to be inserted + * @param callable|null $httpHandler + * @param array $headers [optional] Metrics headers to be inserted * into the token endpoint request present. * This could be passed from ImersonatedServiceAccountCredentials as it uses * UserRefreshCredentials as source credentials. @@ -120,12 +141,11 @@ public function __construct( * @type string $id_token * } */ - public function fetchAuthToken(callable $httpHandler = null, array $metricsHeader = []) + public function fetchAuthToken(?callable $httpHandler = null, array $headers = []) { - // We don't support id token endpoint requests as of now for User Cred return $this->auth->fetchAuthToken( $httpHandler, - $this->applyTokenEndpointMetrics($metricsHeader, 'at') + $this->applyTokenEndpointMetrics($headers, $this->isIdTokenRequest ? 'it' : 'at') ); } diff --git a/lib/Google/vendor/google/auth/src/CredentialsLoader.php b/lib/Google/vendor/google/auth/src/CredentialsLoader.php index 746b957a9..6e21a27c0 100644 --- a/lib/Google/vendor/google/auth/src/CredentialsLoader.php +++ b/lib/Google/vendor/google/auth/src/CredentialsLoader.php @@ -85,6 +85,7 @@ public static function fromEnv() throw new \DomainException(self::unableToReadEnv($cause)); } $jsonKey = file_get_contents($path); + return json_decode((string) $jsonKey, true); } @@ -165,15 +166,15 @@ public static function makeCredentials( * * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token * @param array $httpClientOptions (optional) Array of request options to apply. - * @param callable $httpHandler (optional) http client to fetch the token. - * @param callable $tokenCallback (optional) function to be called when a new token is fetched. + * @param callable|null $httpHandler (optional) http client to fetch the token. + * @param callable|null $tokenCallback (optional) function to be called when a new token is fetched. * @return \GuzzleHttp\Client */ public static function makeHttpClient( FetchAuthTokenInterface $fetcher, array $httpClientOptions = [], - callable $httpHandler = null, - callable $tokenCallback = null + ?callable $httpHandler = null, + ?callable $tokenCallback = null ) { $middleware = new Middleware\AuthTokenMiddleware( $fetcher, diff --git a/lib/Google/vendor/google/auth/src/ExternalAccountCredentialSourceInterface.php b/lib/Google/vendor/google/auth/src/ExternalAccountCredentialSourceInterface.php index 041b18d51..1492c6991 100644 --- a/lib/Google/vendor/google/auth/src/ExternalAccountCredentialSourceInterface.php +++ b/lib/Google/vendor/google/auth/src/ExternalAccountCredentialSourceInterface.php @@ -1,5 +1,5 @@ $cacheConfig Configuration for the cache + * @param array|null $cacheConfig Configuration for the cache * @param CacheItemPoolInterface $cache */ public function __construct( FetchAuthTokenInterface $fetcher, - array $cacheConfig = null, - CacheItemPoolInterface $cache + ?array $cacheConfig = null, + ?CacheItemPoolInterface $cache = null ) { $this->fetcher = $fetcher; $this->cache = $cache; @@ -76,11 +76,11 @@ public function getFetcher() * Checks the cache for a valid auth token and fetches the auth tokens * from the supplied fetcher. * - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request * @return array the response * @throws \Exception */ - public function fetchAuthToken(callable $httpHandler = null) + public function fetchAuthToken(?callable $httpHandler = null) { if ($cached = $this->fetchAuthTokenFromCache()) { return $cached; @@ -112,10 +112,10 @@ public function getLastReceivedToken() /** * Get the client name from the fetcher. * - * @param callable $httpHandler An HTTP handler to deliver PSR7 requests. + * @param callable|null $httpHandler An HTTP handler to deliver PSR7 requests. * @return string */ - public function getClientName(callable $httpHandler = null) + public function getClientName(?callable $httpHandler = null) { if (!$this->fetcher instanceof SignBlobInterface) { throw new \RuntimeException( @@ -176,15 +176,15 @@ public function getQuotaProject() return null; } - /* + /** * Get the Project ID from the fetcher. * - * @param callable $httpHandler Callback which delivers psr7 request + * @param callable|null $httpHandler Callback which delivers psr7 request * @return string|null * @throws \RuntimeException If the fetcher does not implement * `Google\Auth\ProvidesProjectIdInterface`. */ - public function getProjectId(callable $httpHandler = null) + public function getProjectId(?callable $httpHandler = null) { if (!$this->fetcher instanceof ProjectIdProviderInterface) { throw new \RuntimeException( @@ -227,7 +227,7 @@ public function getUniverseDomain(): string * * @param array $metadata metadata hashmap * @param string $authUri optional auth uri - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request * @return array updated metadata hashmap * @throws \RuntimeException If the fetcher does not implement * `Google\Auth\UpdateMetadataInterface`. @@ -235,7 +235,7 @@ public function getUniverseDomain(): string public function updateMetadata( $metadata, $authUri = null, - callable $httpHandler = null + ?callable $httpHandler = null ) { if (!$this->fetcher instanceof UpdateMetadataInterface) { throw new \RuntimeException( diff --git a/lib/Google/vendor/google/auth/src/FetchAuthTokenInterface.php b/lib/Google/vendor/google/auth/src/FetchAuthTokenInterface.php index 64659550b..fbbd8b0c9 100644 --- a/lib/Google/vendor/google/auth/src/FetchAuthTokenInterface.php +++ b/lib/Google/vendor/google/auth/src/FetchAuthTokenInterface.php @@ -25,10 +25,10 @@ interface FetchAuthTokenInterface /** * Fetches the auth tokens based on the current state. * - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request * @return array a hash of auth tokens */ - public function fetchAuthToken(callable $httpHandler = null); + public function fetchAuthToken(?callable $httpHandler = null); /** * Obtains a key that can used to cache the results of #fetchAuthToken. diff --git a/lib/Google/vendor/google/auth/src/GCECache.php b/lib/Google/vendor/google/auth/src/GCECache.php index 804abdbe2..d3dcd8c6c 100644 --- a/lib/Google/vendor/google/auth/src/GCECache.php +++ b/lib/Google/vendor/google/auth/src/GCECache.php @@ -46,8 +46,8 @@ class GCECache * @param CacheItemPoolInterface $cache */ public function __construct( - array $cacheConfig = null, - CacheItemPoolInterface $cache = null + ?array $cacheConfig = null, + ?CacheItemPoolInterface $cache = null ) { $this->cache = $cache; $this->cacheConfig = array_merge([ @@ -60,10 +60,10 @@ public function __construct( * Caches the result of onGce so the metadata server is not called multiple * times. * - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request * @return bool True if this a GCEInstance, false otherwise */ - public function onGce(callable $httpHandler = null) + public function onGce(?callable $httpHandler = null) { if (is_null($this->cache)) { return GCECredentials::onGce($httpHandler); diff --git a/lib/Google/vendor/google/auth/src/HttpHandler/HttpClientCache.php b/lib/Google/vendor/google/auth/src/HttpHandler/HttpClientCache.php index f4a62b967..0159c8d09 100644 --- a/lib/Google/vendor/google/auth/src/HttpHandler/HttpClientCache.php +++ b/lib/Google/vendor/google/auth/src/HttpHandler/HttpClientCache.php @@ -37,7 +37,7 @@ class HttpClientCache * @param ClientInterface|null $client * @return void */ - public static function setHttpClient(ClientInterface $client = null) + public static function setHttpClient(?ClientInterface $client = null) { self::$httpClient = $client; } diff --git a/lib/Google/vendor/google/auth/src/HttpHandler/HttpHandlerFactory.php b/lib/Google/vendor/google/auth/src/HttpHandler/HttpHandlerFactory.php index f19f87443..3856022a2 100644 --- a/lib/Google/vendor/google/auth/src/HttpHandler/HttpHandlerFactory.php +++ b/lib/Google/vendor/google/auth/src/HttpHandler/HttpHandlerFactory.php @@ -27,11 +27,11 @@ class HttpHandlerFactory /** * Builds out a default http handler for the installed version of guzzle. * - * @param ClientInterface $client + * @param ClientInterface|null $client * @return Guzzle6HttpHandler|Guzzle7HttpHandler * @throws \Exception */ - public static function build(ClientInterface $client = null) + public static function build(?ClientInterface $client = null) { if (is_null($client)) { $stack = null; diff --git a/lib/Google/vendor/google/auth/src/Iam.php b/lib/Google/vendor/google/auth/src/Iam.php index 2f67f0009..b32ac6065 100644 --- a/lib/Google/vendor/google/auth/src/Iam.php +++ b/lib/Google/vendor/google/auth/src/Iam.php @@ -36,6 +36,7 @@ class Iam const SIGN_BLOB_PATH = '%s:signBlob?alt=json'; const SERVICE_ACCOUNT_NAME = 'projects/-/serviceAccounts/%s'; private const IAM_API_ROOT_TEMPLATE = 'https://iamcredentials.UNIVERSE_DOMAIN/v1'; + private const GENERATE_ID_TOKEN_PATH = '%s:generateIdToken'; /** * @var callable @@ -45,10 +46,10 @@ class Iam private string $universeDomain; /** - * @param callable $httpHandler [optional] The HTTP Handler to send requests. + * @param callable|null $httpHandler [optional] The HTTP Handler to send requests. */ public function __construct( - callable $httpHandler = null, + ?callable $httpHandler = null, string $universeDomain = GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN ) { $this->httpHandler = $httpHandler @@ -73,7 +74,6 @@ public function __construct( */ public function signBlob($email, $accessToken, $stringToSign, array $delegates = []) { - $httpHandler = $this->httpHandler; $name = sprintf(self::SERVICE_ACCOUNT_NAME, $email); $apiRoot = str_replace('UNIVERSE_DOMAIN', $this->universeDomain, self::IAM_API_ROOT_TEMPLATE); $uri = $apiRoot . '/' . sprintf(self::SIGN_BLOB_PATH, $name); @@ -102,9 +102,54 @@ public function signBlob($email, $accessToken, $stringToSign, array $delegates = Utils::streamFor(json_encode($body)) ); - $res = $httpHandler($request); + $res = ($this->httpHandler)($request); $body = json_decode((string) $res->getBody(), true); return $body['signedBlob']; } + + /** + * Sign a string using the IAM signBlob API. + * + * Note that signing using IAM requires your service account to have the + * `iam.serviceAccounts.signBlob` permission, part of the "Service Account + * Token Creator" IAM role. + * + * @param string $clientEmail The service account email. + * @param string $targetAudience The audience for the ID token. + * @param string $bearerToken The token to authenticate the IAM request. + * @param array $headers [optional] Additional headers to send with the request. + * + * @return string The signed string, base64-encoded. + */ + public function generateIdToken( + string $clientEmail, + string $targetAudience, + string $bearerToken, + array $headers = [] + ): string { + $name = sprintf(self::SERVICE_ACCOUNT_NAME, $clientEmail); + $apiRoot = str_replace('UNIVERSE_DOMAIN', $this->universeDomain, self::IAM_API_ROOT_TEMPLATE); + $uri = $apiRoot . '/' . sprintf(self::GENERATE_ID_TOKEN_PATH, $name); + + $headers['Authorization'] = 'Bearer ' . $bearerToken; + + $body = [ + 'audience' => $targetAudience, + 'includeEmail' => true, + 'useEmailAzp' => true, + ]; + + $request = new Psr7\Request( + 'POST', + $uri, + $headers, + Utils::streamFor(json_encode($body)) + ); + + $res = ($this->httpHandler)($request); + $body = json_decode((string) $res->getBody(), true); + + return $body['token']; + } } diff --git a/lib/Google/vendor/google/auth/src/Middleware/AuthTokenMiddleware.php b/lib/Google/vendor/google/auth/src/Middleware/AuthTokenMiddleware.php index 798766efa..b8f2c514c 100644 --- a/lib/Google/vendor/google/auth/src/Middleware/AuthTokenMiddleware.php +++ b/lib/Google/vendor/google/auth/src/Middleware/AuthTokenMiddleware.php @@ -59,13 +59,13 @@ class AuthTokenMiddleware * Creates a new AuthTokenMiddleware. * * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token - * @param callable $httpHandler (optional) callback which delivers psr7 request - * @param callable $tokenCallback (optional) function to be called when a new token is fetched. + * @param callable|null $httpHandler (optional) callback which delivers psr7 request + * @param callable|null $tokenCallback (optional) function to be called when a new token is fetched. */ public function __construct( FetchAuthTokenInterface $fetcher, - callable $httpHandler = null, - callable $tokenCallback = null + ?callable $httpHandler = null, + ?callable $tokenCallback = null ) { $this->fetcher = $fetcher; $this->httpHandler = $httpHandler; @@ -132,7 +132,8 @@ private function addAuthHeaders(RequestInterface $request) ) { $token = $this->fetcher->fetchAuthToken(); $request = $request->withHeader( - 'authorization', 'Bearer ' . ($token['access_token'] ?? $token['id_token'] ?? '') + 'authorization', + 'Bearer ' . ($token['access_token'] ?? $token['id_token'] ?? '') ); } else { $headers = $this->fetcher->updateMetadata($request->getHeaders(), null, $this->httpHandler); diff --git a/lib/Google/vendor/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php b/lib/Google/vendor/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php index 0f9ee429f..2c44871f9 100644 --- a/lib/Google/vendor/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php +++ b/lib/Google/vendor/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php @@ -53,13 +53,13 @@ class ProxyAuthTokenMiddleware * Creates a new ProxyAuthTokenMiddleware. * * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token - * @param callable $httpHandler (optional) callback which delivers psr7 request - * @param callable $tokenCallback (optional) function to be called when a new token is fetched. + * @param callable|null $httpHandler (optional) callback which delivers psr7 request + * @param callable|null $tokenCallback (optional) function to be called when a new token is fetched. */ public function __construct( FetchAuthTokenInterface $fetcher, - callable $httpHandler = null, - callable $tokenCallback = null + ?callable $httpHandler = null, + ?callable $tokenCallback = null ) { $this->fetcher = $fetcher; $this->httpHandler = $httpHandler; diff --git a/lib/Google/vendor/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php b/lib/Google/vendor/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php index 8bb1d7a0b..f2f85cc16 100644 --- a/lib/Google/vendor/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php +++ b/lib/Google/vendor/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php @@ -54,14 +54,14 @@ class ScopedAccessTokenMiddleware * * @param callable $tokenFunc a token generator function * @param array|string $scopes the token authentication scopes - * @param array $cacheConfig configuration for the cache when it's present - * @param CacheItemPoolInterface $cache an implementation of CacheItemPoolInterface + * @param array|null $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface|null $cache an implementation of CacheItemPoolInterface */ public function __construct( callable $tokenFunc, $scopes, - array $cacheConfig = null, - CacheItemPoolInterface $cache = null + ?array $cacheConfig = null, + ?CacheItemPoolInterface $cache = null ) { $this->tokenFunc = $tokenFunc; if (!(is_string($scopes) || is_array($scopes))) { diff --git a/lib/Google/vendor/google/auth/src/OAuth2.php b/lib/Google/vendor/google/auth/src/OAuth2.php index 4019e258a..c60b8827f 100644 --- a/lib/Google/vendor/google/auth/src/OAuth2.php +++ b/lib/Google/vendor/google/auth/src/OAuth2.php @@ -581,12 +581,12 @@ public function toJwt(array $config = []) /** * Generates a request for token credentials. * - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request * @param array $headers [optional] Additional headers to pass to * the token endpoint request. * @return RequestInterface the authorization Url. */ - public function generateCredentialsRequest(callable $httpHandler = null, $headers = []) + public function generateCredentialsRequest(?callable $httpHandler = null, array $headers = []) { $uri = $this->getTokenCredentialUri(); if (is_null($uri)) { @@ -611,6 +611,9 @@ public function generateCredentialsRequest(callable $httpHandler = null, $header break; case 'refresh_token': $params['refresh_token'] = $this->getRefreshToken(); + if (isset($this->getAdditionalClaims()['target_audience'])) { + $params['target_audience'] = $this->getAdditionalClaims()['target_audience']; + } $this->addClientCredentials($params); break; case self::JWT_URN: @@ -661,12 +664,12 @@ public function generateCredentialsRequest(callable $httpHandler = null, $header /** * Fetches the auth tokens based on the current state. * - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request * @param array $headers [optional] If present, add these headers to the token * endpoint request. * @return array the response */ - public function fetchAuthToken(callable $httpHandler = null, $headers = []) + public function fetchAuthToken(?callable $httpHandler = null, array $headers = []) { if (is_null($httpHandler)) { $httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient()); @@ -724,7 +727,7 @@ public function getSubjectTokenFetcher(): ?ExternalAccountCredentialSourceInterf */ public function parseTokenResponse(ResponseInterface $resp) { - $body = (string)$resp->getBody(); + $body = (string) $resp->getBody(); if ($resp->hasHeader('Content-Type') && $resp->getHeaderLine('Content-Type') == 'application/x-www-form-urlencoded' ) { @@ -1009,13 +1012,13 @@ public function setRedirectUri($uri) if (!$this->isAbsoluteUri($uri)) { // "postmessage" is a reserved URI string in Google-land // @see https://developers.google.com/identity/sign-in/web/server-side-flow - if ('postmessage' !== (string)$uri) { + if ('postmessage' !== (string) $uri) { throw new InvalidArgumentException( 'Redirect URI must be absolute' ); } } - $this->redirectUri = (string)$uri; + $this->redirectUri = (string) $uri; } /** @@ -1127,7 +1130,7 @@ public function setGrantType($grantType) 'invalid grant type' ); } - $this->grantType = (string)$grantType; + $this->grantType = (string) $grantType; } } @@ -1460,7 +1463,7 @@ public function setExpiresIn($expiresIn) $this->issuedAt = null; } else { $this->issuedAt = time(); - $this->expiresIn = (int)$expiresIn; + $this->expiresIn = (int) $expiresIn; } } @@ -1683,11 +1686,11 @@ public function getLastReceivedToken() * * Alias of {@see Google\Auth\OAuth2::getClientId()}. * - * @param callable $httpHandler + * @param callable|null $httpHandler * @return string * @access private */ - public function getClientName(callable $httpHandler = null) + public function getClientName(?callable $httpHandler = null) { return $this->getClientId(); } @@ -1768,7 +1771,8 @@ private function getFirebaseJwtKeys($publicKey, $allowedAlgs) throw new \InvalidArgumentException( 'To have multiple allowed algorithms, You must provide an' . ' array of Firebase\JWT\Key objects.' - . ' See https://github.com/firebase/php-jwt for more information.'); + . ' See https://github.com/firebase/php-jwt for more information.' + ); } $allowedAlg = array_pop($allowedAlgs); } else { diff --git a/lib/Google/vendor/google/auth/src/ProjectIdProviderInterface.php b/lib/Google/vendor/google/auth/src/ProjectIdProviderInterface.php index 0a41f7832..8d10c293a 100644 --- a/lib/Google/vendor/google/auth/src/ProjectIdProviderInterface.php +++ b/lib/Google/vendor/google/auth/src/ProjectIdProviderInterface.php @@ -25,8 +25,8 @@ interface ProjectIdProviderInterface /** * Get the project ID. * - * @param callable $httpHandler Callback which delivers psr7 request + * @param callable|null $httpHandler Callback which delivers psr7 request * @return string|null */ - public function getProjectId(callable $httpHandler = null); + public function getProjectId(?callable $httpHandler = null); } diff --git a/lib/Google/vendor/google/auth/src/SignBlobInterface.php b/lib/Google/vendor/google/auth/src/SignBlobInterface.php index 5f2c94414..b3c2b0505 100644 --- a/lib/Google/vendor/google/auth/src/SignBlobInterface.php +++ b/lib/Google/vendor/google/auth/src/SignBlobInterface.php @@ -36,9 +36,9 @@ public function signBlob($stringToSign, $forceOpenssl = false); /** * Returns the current Client Name. * - * @param callable $httpHandler callback which delivers psr7 request, if + * @param callable|null $httpHandler callback which delivers psr7 request, if * one is required to obtain a client name. * @return string */ - public function getClientName(callable $httpHandler = null); + public function getClientName(?callable $httpHandler = null); } diff --git a/lib/Google/vendor/google/auth/src/UpdateMetadataInterface.php b/lib/Google/vendor/google/auth/src/UpdateMetadataInterface.php index 6d2e7d5d5..5cf5b42cc 100644 --- a/lib/Google/vendor/google/auth/src/UpdateMetadataInterface.php +++ b/lib/Google/vendor/google/auth/src/UpdateMetadataInterface.php @@ -30,12 +30,12 @@ interface UpdateMetadataInterface * * @param array $metadata metadata hashmap * @param string $authUri optional auth uri - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request * @return array updated metadata hashmap */ public function updateMetadata( $metadata, $authUri = null, - callable $httpHandler = null + ?callable $httpHandler = null ); } diff --git a/lib/Google/vendor/google/auth/src/UpdateMetadataTrait.php b/lib/Google/vendor/google/auth/src/UpdateMetadataTrait.php index 30d4060cf..486ec72a5 100644 --- a/lib/Google/vendor/google/auth/src/UpdateMetadataTrait.php +++ b/lib/Google/vendor/google/auth/src/UpdateMetadataTrait.php @@ -44,13 +44,13 @@ public function getUpdateMetadataFunc() * * @param array $metadata metadata hashmap * @param string $authUri optional auth uri - * @param callable $httpHandler callback which delivers psr7 request + * @param callable|null $httpHandler callback which delivers psr7 request * @return array updated metadata hashmap */ public function updateMetadata( $metadata, $authUri = null, - callable $httpHandler = null + ?callable $httpHandler = null ) { $metadata_copy = $metadata; diff --git a/lib/Google/vendor/google/cloud-storage/VERSION b/lib/Google/vendor/google/cloud-storage/VERSION index 5525f03fa..71f35de05 100644 --- a/lib/Google/vendor/google/cloud-storage/VERSION +++ b/lib/Google/vendor/google/cloud-storage/VERSION @@ -1 +1 @@ -1.48.1 +1.48.4 diff --git a/lib/Google/vendor/google/cloud-storage/composer.json b/lib/Google/vendor/google/cloud-storage/composer.json index d0000cd74..a784163d5 100644 --- a/lib/Google/vendor/google/cloud-storage/composer.json +++ b/lib/Google/vendor/google/cloud-storage/composer.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "minimum-stability": "stable", "require": { - "php": "^8.0", + "php": "^8.1", "google/cloud-core": "^1.57", "ramsey/uuid": "^4.2.3" }, diff --git a/lib/Google/vendor/google/cloud-storage/src/Bucket.php b/lib/Google/vendor/google/cloud-storage/src/Bucket.php index 6abec40c8..e08884e8f 100644 --- a/lib/Google/vendor/google/cloud-storage/src/Bucket.php +++ b/lib/Google/vendor/google/cloud-storage/src/Bucket.php @@ -1519,14 +1519,50 @@ public function lockRetentionPolicy(array $options = []) * space, and line breaks will be replaced by an empty string. * V2 Signed URLs may not provide `x-goog-encryption-key` or * `x-goog-encryption-key-sha256` headers. - * @type array $keyFile Keyfile data to use in place of the keyfile with - * which the client was constructed. If `$options.keyFilePath` is - * set, this option is ignored. - * @type string $keyFilePath A path to a valid keyfile to use in place - * of the keyfile with which the client was constructed. - * @type string|array $scopes One or more authentication scopes to be - * used with a key file. This option is ignored unless - * `$options.keyFile` or `$options.keyFilePath` is set. + * @type FetchAuthTokenInterface $credentialsFetcher A credentials + * fetcher instance. + * @type array $keyFile [DEPRECATED] + * @deprecated This option is being deprecated because of a potential security risk. + * This option does not validate the credential configuration. The security + * risk occurs when a credential configuration is accepted from a source + * that is not under your control and used without validation on your side. + * If you know that you will be loading credential configurations of a + * specific type, it is recommended to create the credentials directly and + * configure them using the `credentialsFetcher` option instead. + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); + * ``` + * This will ensure that an unexpected credential type with potential for + * malicious intent is not loaded unintentionally. You might still have to do + * validation for certain credential types. + * If you are loading your credential configuration from an untrusted source and have + * not mitigated the risks (e.g. by validating the configuration yourself), make + * these changes as soon as possible to prevent security risks to your environment. + * Regardless of the method used, it is always your responsibility to validate + * configurations received from external sources. + * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials + * @type string $keyFilePath [DEPRECATED] + * @deprecated This option is being deprecated because of a potential security risk. + * This option does not validate the credential configuration. The security + * risk occurs when a credential configuration is accepted from a source + * that is not under your control and used without validation on your side. + * If you know that you will be loading credential configurations of a + * specific type, it is recommended to create the credentials directly and + * configure them using the `credentialsFetcher` option instead. + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); + * ``` + * This will ensure that an unexpected credential type with potential for + * malicious intent is not loaded unintentionally. You might still have to do + * validation for certain credential types. + * If you are loading your credential configuration from an untrusted source and have + * not mitigated the risks (e.g. by validating the configuration yourself), make + * these changes as soon as possible to prevent security risks to your environment. + * Regardless of the method used, it is always your responsibility to validate + * configurations received from external sources. + * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials * @type array $queryParams Additional query parameters to be included * as part of the signed URL query string. For allowed values, * see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers#query). @@ -1613,12 +1649,50 @@ public function signedUrl($expires, array $options = []) * `x-ignore` prefix), given as key/value pairs. * @type bool $forceOpenssl If true, OpenSSL will be used regardless of * whether phpseclib is available. **Defaults to** `false`. - * @type array $keyFile Keyfile data to use in place of the keyfile with - * which the client was constructed. If `$options.keyFilePath` is - * set, this option is ignored. - * @type string $keyFilePath A path to a valid Keyfile to use in place - * of the keyfile with which the client was constructed. - * @type string $scheme Either `http` or `https`. Only used if a custom + * @type FetchAuthTokenInterface $credentialsFetcher A credentials + * fetcher instance. + * @type array $keyFile [DEPRECATED] + * @deprecated This option is being deprecated because of a potential security risk. + * This option does not validate the credential configuration. The security + * risk occurs when a credential configuration is accepted from a source + * that is not under your control and used without validation on your side. + * If you know that you will be loading credential configurations of a + * specific type, it is recommended to create the credentials directly and + * configure them using the `credentialsFetcher` option instead. + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); + * ``` + * This will ensure that an unexpected credential type with potential for + * malicious intent is not loaded unintentionally. You might still have to do + * validation for certain credential types. + * If you are loading your credential configuration from an untrusted source and have + * not mitigated the risks (e.g. by validating the configuration yourself), make + * these changes as soon as possible to prevent security risks to your environment. + * Regardless of the method used, it is always your responsibility to validate + * configurations received from external sources. + * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials + * @type string $keyFilePath [DEPRECATED] + * @deprecated This option is being deprecated because of a potential security risk. + * This option does not validate the credential configuration. The security + * risk occurs when a credential configuration is accepted from a source + * that is not under your control and used without validation on your side. + * If you know that you will be loading credential configurations of a + * specific type, it is recommended to create the credentials directly and + * configure them using the `credentialsFetcher` option instead. + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); + * ``` + * This will ensure that an unexpected credential type with potential for + * malicious intent is not loaded unintentionally. You might still have to do + * validation for certain credential types. + * If you are loading your credential configuration from an untrusted source and have + * not mitigated the risks (e.g. by validating the configuration yourself), make + * these changes as soon as possible to prevent security risks to your environment. + * Regardless of the method used, it is always your responsibility to validate + * configurations received from external sources. + * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials * hostname is provided via `$options.bucketBoundHostname`. If a * custom bucketBoundHostname is provided, **defaults to** `http`. * In all other cases, **defaults to** `https`. diff --git a/lib/Google/vendor/google/cloud-storage/src/Connection/Rest.php b/lib/Google/vendor/google/cloud-storage/src/Connection/Rest.php index 928087478..4766c0ac2 100644 --- a/lib/Google/vendor/google/cloud-storage/src/Connection/Rest.php +++ b/lib/Google/vendor/google/cloud-storage/src/Connection/Rest.php @@ -100,6 +100,26 @@ class Rest implements ConnectionInterface */ private $restRetryFunction; + /** + * @var string|null + */ + private ?string $retryStrategy; + + /** + * @var callable|null + */ + private $restDelayFunction; + + /** + * @var callable|null + */ + private $restCalcDelayFunction; + + /** + * @var callable|null + */ + private $restRetryListener; + /** * @param array $config */ @@ -128,6 +148,10 @@ public function __construct(array $config = []) $this->projectId = $this->pluck('projectId', $config, false); $this->restRetryFunction = (isset($config['restRetryFunction'])) ? $config['restRetryFunction'] : null; + $this->retryStrategy = $config['retryStrategy'] ?? null; + $this->restDelayFunction = $config['restDelayFunction'] ?? null; + $this->restCalcDelayFunction = $config['restCalcDelayFunction'] ?? null; + $this->restRetryListener = $config['restRetryListener'] ?? null; } /** @@ -308,11 +332,13 @@ public function downloadObject(array $args = []) $resultStream = Utils::streamFor(null); $transcodedObj = false; + $args['retryStrategy'] ??= $this->retryStrategy; + list($request, $requestOptions) = $this->buildDownloadObjectParams($args); $invocationId = Uuid::uuid4()->toString(); $requestOptions['retryHeaders'] = self::getRetryHeaders($invocationId, 1); - $requestOptions['restRetryFunction'] = $this->getRestRetryFunction('objects', 'get', $requestOptions); + $requestOptions['restRetryFunction'] = $this->getRestRetryFunction('objects', 'get', $args); // We try to deduce if the object is a transcoded object when we receive the headers. $requestOptions['restOptions']['on_headers'] = function ($response) use (&$transcodedObj) { $header = $response->getHeader(self::TRANSCODED_OBJ_HEADER_KEY); @@ -461,6 +487,8 @@ private function resolveUploadOptions(array $args) 'userProject' => null, ]; + $args['retryStrategy'] ??= $this->retryStrategy; + $args['data'] = Utils::streamFor($args['data']); if ($args['resumable'] === null) { @@ -520,7 +548,7 @@ private function resolveUploadOptions(array $args) } /** - * @param array $args + * @param array $args */ public function getBucketIamPolicy(array $args) { @@ -528,7 +556,7 @@ public function getBucketIamPolicy(array $args) } /** - * @param array $args + * @param array $args */ public function setBucketIamPolicy(array $args) { @@ -536,7 +564,7 @@ public function setBucketIamPolicy(array $args) } /** - * @param array $args + * @param array $args */ public function testBucketIamPermissions(array $args) { @@ -677,7 +705,7 @@ private function buildDownloadObjectParams(array $args) } /** - * Choose a upload validation method based on user input and platform + * Choose an upload validation method based on user input and platform * requirements. * * @param array $args @@ -748,8 +776,8 @@ protected function crc32cExtensionLoaded() /** * Check if hash() supports crc32c. * - * @deprecated * @return bool + * @deprecated */ protected function supportsBuiltinCrc32c() { @@ -774,12 +802,20 @@ public function send($resource, $method, array $options = [], $whitelisted = fal 'objectAccessControls' => 'object_acl' ]; $retryResource = isset($retryMap[$resource]) ? $retryMap[$resource] : $resource; + $options['restRetryFunction'] = $this->restRetryFunction ?? $this->getRestRetryFunction( $retryResource, $method, $options ); + $options += array_filter([ + 'retryStrategy' => $this->retryStrategy, + 'restDelayFunction' => $this->restDelayFunction, + 'restCalcDelayFunction' => $this->restCalcDelayFunction, + 'restRetryListener' => $this->restRetryListener, + ]); + $options = $this->addRetryHeaderLogic($options); return $this->traitSend($resource, $method, $options); @@ -796,19 +832,26 @@ private function addRetryHeaderLogic(array $args) $invocationId = Uuid::uuid4()->toString(); $args['retryHeaders'] = self::getRetryHeaders($invocationId, 1); + $userListener = $args['restRetryListener'] ?? null; + // Adding callback logic to update headers while retrying $args['restRetryListener'] = function ( \Exception $e, $retryAttempt, &$arguments ) use ( - $invocationId + $invocationId, + $userListener ) { $arguments[0] = $this->modifyRequestForRetry( $arguments[0], $retryAttempt, $invocationId ); + + if ($userListener) { + $userListener($e, $retryAttempt, $arguments); + } }; return $args; diff --git a/lib/Google/vendor/google/cloud-storage/src/Connection/RetryTrait.php b/lib/Google/vendor/google/cloud-storage/src/Connection/RetryTrait.php index 4899e7e46..83a5dac47 100644 --- a/lib/Google/vendor/google/cloud-storage/src/Connection/RetryTrait.php +++ b/lib/Google/vendor/google/cloud-storage/src/Connection/RetryTrait.php @@ -31,7 +31,7 @@ trait RetryTrait * @var array */ private static $httpRetryCodes = [ - 0, // connetion-refused OR connection-reset gives status code of 0 + 0, // connection-refused OR connection-reset gives status code of 0 200, // partial download cases 408, 429, @@ -192,7 +192,7 @@ private function isPreConditionSupplied($methodName, array $args) * @param bool $isIdempotent * @param bool $preconditionNeeded * @param bool $preconditionSupplied - * @param int|null $maxRetries The maximum number of retries allowd. + * @param int|null $maxRetries The maximum number of retries allowed. * Null for no limit. * @return bool */ diff --git a/lib/Google/vendor/google/cloud-storage/src/SigningHelper.php b/lib/Google/vendor/google/cloud-storage/src/SigningHelper.php index 41acfbaf9..6f4292e72 100644 --- a/lib/Google/vendor/google/cloud-storage/src/SigningHelper.php +++ b/lib/Google/vendor/google/cloud-storage/src/SigningHelper.php @@ -628,6 +628,7 @@ private function normalizeOptions(array $options) 'headers' => [], 'keyFile' => null, 'keyFilePath' => null, + 'credentialsFetcher' => null, 'method' => 'GET', 'queryParams' => [], 'responseDisposition' => null, @@ -822,6 +823,8 @@ private function getSigningCredentials(ConnectionInterface $connection, array $o $scopes = $options['scopes'] ?? $rw->scopes(); $credentials = CredentialsLoader::makeCredentials($scopes, $keyFile); + } elseif (isset($options['credentialsFetcher'])) { + $credentials = $options['credentialsFetcher']; } else { $credentials = $rw->getCredentialsFetcher(); } @@ -838,6 +841,7 @@ private function getSigningCredentials(ConnectionInterface $connection, array $o unset( $options['keyFilePath'], $options['keyFile'], + $options['credentialsFetcher'], $options['scopes'] ); diff --git a/lib/Google/vendor/google/cloud-storage/src/StorageClient.php b/lib/Google/vendor/google/cloud-storage/src/StorageClient.php index 23355325c..f0df8ac27 100644 --- a/lib/Google/vendor/google/cloud-storage/src/StorageClient.php +++ b/lib/Google/vendor/google/cloud-storage/src/StorageClient.php @@ -47,7 +47,7 @@ class StorageClient use ArrayTrait; use ClientTrait; - const VERSION = '1.48.1'; + const VERSION = '1.48.4'; const FULL_CONTROL_SCOPE = 'https://www.googleapis.com/auth/devstorage.full_control'; const READ_ONLY_SCOPE = 'https://www.googleapis.com/auth/devstorage.read_only'; @@ -97,16 +97,71 @@ class StorageClient * fetcher instance. * @type callable $httpHandler A handler used to deliver Psr7 requests. * Only valid for requests sent over REST. - * @type array $keyFile The contents of the service account credentials - * .json file retrieved from the Google Developer's Console. - * Ex: `json_decode(file_get_contents($path), true)`. - * @type string $keyFilePath The full path to your service account - * credentials .json file retrieved from the Google Developers - * Console. + * @type array $keyFile [DEPRECATED] + * @deprecated This option is being deprecated because of a potential security risk. + * This option does not validate the credential configuration. The security + * risk occurs when a credential configuration is accepted from a source + * that is not under your control and used without validation on your side. + * If you know that you will be loading credential configurations of a + * specific type, it is recommended to create the credentials directly and + * configure them using the `credentialsFetcher` option instead. + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); + * $creds = new StorageClient(['credentialsFetcher' => $creds]); + * ``` + * This will ensure that an unexpected credential type with potential for + * malicious intent is not loaded unintentionally. You might still have to do + * validation for certain credential types. + * If you are loading your credential configuration from an untrusted source and have + * not mitigated the risks (e.g. by validating the configuration yourself), make + * these changes as soon as possible to prevent security risks to your environment. + * Regardless of the method used, it is always your responsibility to validate + * configurations received from external sources. + * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials + * @type string $keyFilePath [DEPRECATED] + * @deprecated This option is being deprecated because of a potential security risk. + * This option does not validate the credential configuration. The security + * risk occurs when a credential configuration is accepted from a source + * that is not under your control and used without validation on your side. + * If you know that you will be loading credential configurations of a + * specific type, it is recommended to create the credentials directly and + * configure them using the `credentialsFetcher` option instead. + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); + * $creds = new StorageClient(['credentialsFetcher' => $creds]); + * ``` + * This will ensure that an unexpected credential type with potential for + * malicious intent is not loaded unintentionally. You might still have to do + * validation for certain credential types. + * If you are loading your credential configuration from an untrusted source and have + * not mitigated the risks (e.g. by validating the configuration yourself), make + * these changes as soon as possible to prevent security risks to your environment. + * Regardless of the method used, it is always your responsibility to validate + * configurations received from external sources. + * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials * @type float $requestTimeout Seconds to wait before timing out the * request. **Defaults to** `0` with REST and `60` with gRPC. * @type int $retries Number of retries for a failed request. * **Defaults to** `3`. + * @type string $retryStrategy Retry strategy to signify that we never + * want to retry an operation even if the error is retryable. + * **Defaults to** `StorageClient::RETRY_IDEMPOTENT`. + * @type callable $restDelayFunction Executes a delay, defaults to + * utilizing `usleep`. Function signature should match: + * `function (int $delay) : void`. + * @type callable $restCalcDelayFunction Sets the conditions for + * determining how long to wait between attempts to retry. Function + * signature should match: `function (int $attempt) : int`. + * @type callable $restRetryFunction Sets the conditions for whether or + * not a request should attempt to retry. Function signature should + * match: `function (\Exception $ex) : bool`. + * @type callable $restRetryListener Runs after the restRetryFunction. + * This might be used to simply consume the exception and + * $arguments b/w retries. This returns the new $arguments thus + * allowing modification on demand for $arguments. For ex: + * changing the headers in b/w retries. * @type array $scopes Scopes to be used for the request. * @type string $quotaProject Specifies a user project to bill for * access charges associated with the request. diff --git a/lib/Google/vendor/google/cloud-storage/src/StorageObject.php b/lib/Google/vendor/google/cloud-storage/src/StorageObject.php index 5aa126002..824d456d1 100644 --- a/lib/Google/vendor/google/cloud-storage/src/StorageObject.php +++ b/lib/Google/vendor/google/cloud-storage/src/StorageObject.php @@ -925,11 +925,50 @@ public function downloadAsStreamAsync(array $options = []) * space, and line breaks will be replaced by an empty string. * V2 Signed URLs may not provide `x-goog-encryption-key` or * `x-goog-encryption-key-sha256` headers. - * @type array $keyFile Keyfile data to use in place of the keyfile with - * which the client was constructed. If `$options.keyFilePath` is - * set, this option is ignored. - * @type string $keyFilePath A path to a valid Keyfile to use in place - * of the keyfile with which the client was constructed. + * @type FetchAuthTokenInterface $credentialsFetcher A credentials + * fetcher instance. + * @type array $keyFile [DEPRECATED] + * @deprecated This option is being deprecated because of a potential security risk. + * This option does not validate the credential configuration. The security + * risk occurs when a credential configuration is accepted from a source + * that is not under your control and used without validation on your side. + * If you know that you will be loading credential configurations of a + * specific type, it is recommended to create the credentials directly and + * configure them using the `credentialsFetcher` option instead. + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); + * ``` + * This will ensure that an unexpected credential type with potential for + * malicious intent is not loaded unintentionally. You might still have to do + * validation for certain credential types. + * If you are loading your credential configuration from an untrusted source and have + * not mitigated the risks (e.g. by validating the configuration yourself), make + * these changes as soon as possible to prevent security risks to your environment. + * Regardless of the method used, it is always your responsibility to validate + * configurations received from external sources. + * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials + * @type string $keyFilePath [DEPRECATED] + * @deprecated This option is being deprecated because of a potential security risk. + * This option does not validate the credential configuration. The security + * risk occurs when a credential configuration is accepted from a source + * that is not under your control and used without validation on your side. + * If you know that you will be loading credential configurations of a + * specific type, it is recommended to create the credentials directly and + * configure them using the `credentialsFetcher` option instead. + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); + * ``` + * This will ensure that an unexpected credential type with potential for + * malicious intent is not loaded unintentionally. You might still have to do + * validation for certain credential types. + * If you are loading your credential configuration from an untrusted source and have + * not mitigated the risks (e.g. by validating the configuration yourself), make + * these changes as soon as possible to prevent security risks to your environment. + * Regardless of the method used, it is always your responsibility to validate + * configurations received from external sources. + * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials * @type string $method One of `GET`, `PUT` or `DELETE`. * **Defaults to** `GET`. * @type string $responseDisposition The @@ -1043,11 +1082,50 @@ public function signedUrl($expires, array $options = []) * space, and line breaks will be replaced by an empty string. * V2 Signed URLs may not provide `x-goog-encryption-key` or * `x-goog-encryption-key-sha256` headers. - * @type array $keyFile Keyfile data to use in place of the keyfile with - * which the client was constructed. If `$options.keyFilePath` is - * set, this option is ignored. - * @type string $keyFilePath A path to a valid Keyfile to use in place - * of the keyfile with which the client was constructed. + * @type FetchAuthTokenInterface $credentialsFetcher A credentials + * fetcher instance. + * @type array $keyFile [DEPRECATED] + * @deprecated This option is being deprecated because of a potential security risk. + * This option does not validate the credential configuration. The security + * risk occurs when a credential configuration is accepted from a source + * that is not under your control and used without validation on your side. + * If you know that you will be loading credential configurations of a + * specific type, it is recommended to create the credentials directly and + * configure them using the `credentialsFetcher` option instead. + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); + * ``` + * This will ensure that an unexpected credential type with potential for + * malicious intent is not loaded unintentionally. You might still have to do + * validation for certain credential types. + * If you are loading your credential configuration from an untrusted source and have + * not mitigated the risks (e.g. by validating the configuration yourself), make + * these changes as soon as possible to prevent security risks to your environment. + * Regardless of the method used, it is always your responsibility to validate + * configurations received from external sources. + * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials + * @type string $keyFilePath [DEPRECATED] + * @deprecated This option is being deprecated because of a potential security risk. + * This option does not validate the credential configuration. The security + * risk occurs when a credential configuration is accepted from a source + * that is not under your control and used without validation on your side. + * If you know that you will be loading credential configurations of a + * specific type, it is recommended to create the credentials directly and + * configure them using the `credentialsFetcher` option instead. + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); + * ``` + * This will ensure that an unexpected credential type with potential for + * malicious intent is not loaded unintentionally. You might still have to do + * validation for certain credential types. + * If you are loading your credential configuration from an untrusted source and have + * not mitigated the risks (e.g. by validating the configuration yourself), make + * these changes as soon as possible to prevent security risks to your environment. + * Regardless of the method used, it is always your responsibility to validate + * configurations received from external sources. + * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials * @type string $responseDisposition The * [`response-content-disposition`](http://www.iana.org/assignments/cont-disp/cont-disp.xhtml) * parameter of the signed url. @@ -1142,12 +1220,50 @@ public function signedUploadUrl($expires, array $options = []) * space, and line breaks will be replaced by an empty string. * V2 Signed URLs may not provide `x-goog-encryption-key` or * `x-goog-encryption-key-sha256` headers. - * @type array $keyFile Keyfile data to use in place of the keyfile with - * which the client was constructed. If `$options.keyFilePath` is - * set, this option is ignored. - * @type string $keyFilePath A path to a valid Keyfile to use in place - * of the keyfile with which the client was constructed. - * @type string $origin Value of CORS header + * @type FetchAuthTokenInterface $credentialsFetcher A credentials + * fetcher instance. + * @type array $keyFile [DEPRECATED] + * @deprecated This option is being deprecated because of a potential security risk. + * This option does not validate the credential configuration. The security + * risk occurs when a credential configuration is accepted from a source + * that is not under your control and used without validation on your side. + * If you know that you will be loading credential configurations of a + * specific type, it is recommended to create the credentials directly and + * configure them using the `credentialsFetcher` option instead. + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); + * ``` + * This will ensure that an unexpected credential type with potential for + * malicious intent is not loaded unintentionally. You might still have to do + * validation for certain credential types. + * If you are loading your credential configuration from an untrusted source and have + * not mitigated the risks (e.g. by validating the configuration yourself), make + * these changes as soon as possible to prevent security risks to your environment. + * Regardless of the method used, it is always your responsibility to validate + * configurations received from external sources. + * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials + * @type string $keyFilePath [DEPRECATED] + * @deprecated This option is being deprecated because of a potential security risk. + * This option does not validate the credential configuration. The security + * risk occurs when a credential configuration is accepted from a source + * that is not under your control and used without validation on your side. + * If you know that you will be loading credential configurations of a + * specific type, it is recommended to create the credentials directly and + * configure them using the `credentialsFetcher` option instead. + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); + * ``` + * This will ensure that an unexpected credential type with potential for + * malicious intent is not loaded unintentionally. You might still have to do + * validation for certain credential types. + * If you are loading your credential configuration from an untrusted source and have + * not mitigated the risks (e.g. by validating the configuration yourself), make + * these changes as soon as possible to prevent security risks to your environment. + * Regardless of the method used, it is always your responsibility to validate + * configurations received from external sources. + * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials * "Access-Control-Allow-Origin". **Defaults to** `"*"`. * @type string|array $scopes One or more authentication scopes to be * used with a key file. This option is ignored unless diff --git a/lib/Google/vendor/google/common-protos/VERSION b/lib/Google/vendor/google/common-protos/VERSION index 53cf85e17..23297c30e 100644 --- a/lib/Google/vendor/google/common-protos/VERSION +++ b/lib/Google/vendor/google/common-protos/VERSION @@ -1 +1 @@ -4.12.1 +4.12.4 diff --git a/lib/Google/vendor/google/common-protos/composer.json b/lib/Google/vendor/google/common-protos/composer.json index 7af87dcf4..a69cf2598 100644 --- a/lib/Google/vendor/google/common-protos/composer.json +++ b/lib/Google/vendor/google/common-protos/composer.json @@ -2,15 +2,15 @@ "name": "google/common-protos", "type": "library", "description": "Google API Common Protos for PHP", - "version": "4.12.1", + "version": "4.12.4", "keywords": [ "google" ], "homepage": "https://github.com/googleapis/common-protos-php", "license": "Apache-2.0", "require": { - "php": "^8.0", - "google/protobuf": "^v3.25.3||^4.26.1" + "php": "^8.1", + "google/protobuf": "^4.31" }, "require-dev": { "phpunit/phpunit": "^9.6" diff --git a/lib/Google/vendor/google/longrunning/VERSION b/lib/Google/vendor/google/longrunning/VERSION index f90568270..8f0916f76 100644 --- a/lib/Google/vendor/google/longrunning/VERSION +++ b/lib/Google/vendor/google/longrunning/VERSION @@ -1 +1 @@ -0.4.7 +0.5.0 diff --git a/lib/Google/vendor/google/longrunning/composer.json b/lib/Google/vendor/google/longrunning/composer.json index df405a30d..3df31cdb2 100644 --- a/lib/Google/vendor/google/longrunning/composer.json +++ b/lib/Google/vendor/google/longrunning/composer.json @@ -3,7 +3,7 @@ "description": "Google LongRunning Client for PHP", "license": "Apache-2.0", "minimum-stability": "stable", - "version": "0.4.7", + "version": "0.5.0", "autoload": { "psr-4": { "Google\\ApiCore\\LongRunning\\": "src/ApiCore/LongRunning", @@ -20,7 +20,7 @@ } }, "require-dev": { - "google/gax": "^1.36.0", + "google/gax": "^1.38.0", "phpunit/phpunit": "^9.0" } } diff --git a/lib/Google/vendor/google/longrunning/src/LongRunning/Client/OperationsClient.php b/lib/Google/vendor/google/longrunning/src/LongRunning/Client/OperationsClient.php index b5f5acafd..ea8662350 100644 --- a/lib/Google/vendor/google/longrunning/src/LongRunning/Client/OperationsClient.php +++ b/lib/Google/vendor/google/longrunning/src/LongRunning/Client/OperationsClient.php @@ -27,6 +27,7 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; +use Google\ApiCore\Options\ClientOptions; use Google\ApiCore\PagedListResponse; use Google\ApiCore\RetrySettings; use Google\ApiCore\Transport\TransportInterface; @@ -109,25 +110,28 @@ private static function getClientDefaults() /** * Constructor. * - * @param array $options { + * @param array|ClientOptions $options { * Optional. Options for configuring the service API wrapper. * * @type string $apiEndpoint * The address of the API remote host. May optionally include the port, formatted * as ":". Default 'longrunning.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * *Important*: If you accept a credential configuration (credential - * JSON/File/Stream) from an external source for authentication to Google Cloud - * Platform, you must validate it before providing it to any Google API or library. - * Providing an unvalidated credential configuration to Google APIs can compromise - * the security of your systems and data. For more information {@see + * @type FetchAuthTokenInterface|CredentialsWrapper $credentials + * This option should only be used with a pre-constructed + * {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that + * when one of these objects are provided, any settings in $credentialsConfig will + * be ignored. + * **Important**: If you are providing a path to a credentials file, or a decoded + * credentials file as a PHP array, this usage is now DEPRECATED. Providing an + * unvalidated credential configuration to Google APIs can compromise the security + * of your systems and data. It is recommended to create the credentials explicitly + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * use Google\LongRunning\OperationsClient; + * $creds = new ServiceAccountCredentials($scopes, $json); + * $options = new OperationsClient(['credentials' => $creds]); + * ``` + * {@see * https://cloud.google.com/docs/authentication/external/externally-sourced-credentials} * @type array $credentialsConfig * Options used to configure credentials, including auth token caching, for the @@ -165,11 +169,13 @@ private static function getClientDefaults() * @type false|LoggerInterface $logger * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * @type string $universeDomain + * The service domain for the client. Defaults to 'googleapis.com'. * } * * @throws ValidationException */ - public function __construct(array $options = []) + public function __construct(array|ClientOptions $options = []) { $clientOptions = $this->buildClientOptions($options); $this->setClientOptions($clientOptions); diff --git a/lib/Google/vendor/google/protobuf/composer.json b/lib/Google/vendor/google/protobuf/composer.json index 70af0a033..534647221 100644 --- a/lib/Google/vendor/google/protobuf/composer.json +++ b/lib/Google/vendor/google/protobuf/composer.json @@ -6,10 +6,10 @@ "homepage": "https://developers.google.com/protocol-buffers/", "license": "BSD-3-Clause", "require": { - "php": ">=7.0.0" + "php": ">=8.1.0" }, "require-dev": { - "phpunit/phpunit": ">=5.0.0" + "phpunit/phpunit": ">=5.0.0 <8.5.27" }, "suggest": { "ext-bcmath": "Need to support JSON deserialization" @@ -21,3 +21,4 @@ } } } + diff --git a/lib/Google/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Api.php b/lib/Google/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Api.php index 4485d3d0b..83e2748e4 100644 --- a/lib/Google/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Api.php +++ b/lib/Google/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Api.php @@ -18,7 +18,7 @@ public static function initOnce() { \GPBMetadata\Google\Protobuf\SourceContext::initOnce(); \GPBMetadata\Google\Protobuf\Type::initOnce(); $pool->internalAddGeneratedFile( - "\x0A\xC9\x05\x0A\x19google/protobuf/api.proto\x12\x0Fgoogle.protobuf\x1A\x1Agoogle/protobuf/type.proto\"\x81\x02\x0A\x03Api\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12(\x0A\x07methods\x18\x02 \x03(\x0B2\x17.google.protobuf.Method\x12(\x0A\x07options\x18\x03 \x03(\x0B2\x17.google.protobuf.Option\x12\x0F\x0A\x07version\x18\x04 \x01(\x09\x126\x0A\x0Esource_context\x18\x05 \x01(\x0B2\x1E.google.protobuf.SourceContext\x12&\x0A\x06mixins\x18\x06 \x03(\x0B2\x16.google.protobuf.Mixin\x12'\x0A\x06syntax\x18\x07 \x01(\x0E2\x17.google.protobuf.Syntax\"\xD5\x01\x0A\x06Method\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12\x18\x0A\x10request_type_url\x18\x02 \x01(\x09\x12\x19\x0A\x11request_streaming\x18\x03 \x01(\x08\x12\x19\x0A\x11response_type_url\x18\x04 \x01(\x09\x12\x1A\x0A\x12response_streaming\x18\x05 \x01(\x08\x12(\x0A\x07options\x18\x06 \x03(\x0B2\x17.google.protobuf.Option\x12'\x0A\x06syntax\x18\x07 \x01(\x0E2\x17.google.protobuf.Syntax\"#\x0A\x05Mixin\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12\x0C\x0A\x04root\x18\x02 \x01(\x09Bv\x0A\x13com.google.protobufB\x08ApiProtoP\x01Z,google.golang.org/protobuf/types/known/apipb\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" + "\x0A\xF3\x05\x0A\x19google/protobuf/api.proto\x12\x0Fgoogle.protobuf\x1A\x1Agoogle/protobuf/type.proto\"\x92\x02\x0A\x03Api\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12(\x0A\x07methods\x18\x02 \x03(\x0B2\x17.google.protobuf.Method\x12(\x0A\x07options\x18\x03 \x03(\x0B2\x17.google.protobuf.Option\x12\x0F\x0A\x07version\x18\x04 \x01(\x09\x126\x0A\x0Esource_context\x18\x05 \x01(\x0B2\x1E.google.protobuf.SourceContext\x12&\x0A\x06mixins\x18\x06 \x03(\x0B2\x16.google.protobuf.Mixin\x12'\x0A\x06syntax\x18\x07 \x01(\x0E2\x17.google.protobuf.Syntax\x12\x0F\x0A\x07edition\x18\x08 \x01(\x09\"\xEE\x01\x0A\x06Method\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12\x18\x0A\x10request_type_url\x18\x02 \x01(\x09\x12\x19\x0A\x11request_streaming\x18\x03 \x01(\x08\x12\x19\x0A\x11response_type_url\x18\x04 \x01(\x09\x12\x1A\x0A\x12response_streaming\x18\x05 \x01(\x08\x12(\x0A\x07options\x18\x06 \x03(\x0B2\x17.google.protobuf.Option\x12+\x0A\x06syntax\x18\x07 \x01(\x0E2\x17.google.protobuf.SyntaxB\x02\x18\x01\x12\x13\x0A\x07edition\x18\x08 \x01(\x09B\x02\x18\x01\"#\x0A\x05Mixin\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12\x0C\x0A\x04root\x18\x02 \x01(\x09Bv\x0A\x13com.google.protobufB\x08ApiProtoP\x01Z,google.golang.org/protobuf/types/known/apipb\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" , true); static::$is_initialized = true; diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Api.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Api.php index 341c56984..a44c858dc 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Api.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Api.php @@ -18,6 +18,10 @@ * sometimes simply referred to as "APIs" in other contexts, such as the name of * this message itself. See https://cloud.google.com/apis/design/glossary for * detailed terminology. + * New usages of this message as an alternative to ServiceDescriptorProto are + * strongly discouraged. This message does not reliability preserve all + * information necessary to model the schema and preserve semantics. Instead + * make use of FileDescriptorSet which preserves the necessary information. * * Generated from protobuf message google.protobuf.Api */ @@ -83,6 +87,12 @@ class Api extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.protobuf.Syntax syntax = 7; */ protected $syntax = 0; + /** + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. + * + * Generated from protobuf field string edition = 8; + */ + protected $edition = ''; /** * Constructor. @@ -122,6 +132,8 @@ class Api extends \Google\Protobuf\Internal\Message * Included interfaces. See [Mixin][]. * @type int $syntax * The source syntax of the service. + * @type string $edition + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. * } */ public function __construct($data = NULL) { @@ -357,5 +369,31 @@ public function setSyntax($var) return $this; } + /** + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. + * + * Generated from protobuf field string edition = 8; + * @return string + */ + public function getEdition() + { + return $this->edition; + } + + /** + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. + * + * Generated from protobuf field string edition = 8; + * @param string $var + * @return $this + */ + public function setEdition($var) + { + GPBUtil::checkString($var, True); + $this->edition = $var; + + return $this; + } + } diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Enum.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Enum.php index 296b0a019..ea3be4056 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Enum.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Enum.php @@ -11,6 +11,10 @@ /** * Enum type definition. + * New usages of this message as an alternative to EnumDescriptorProto are + * strongly discouraged. This message does not reliability preserve all + * information necessary to model the schema and preserve semantics. Instead + * make use of FileDescriptorSet which preserves the necessary information. * * Generated from protobuf message google.protobuf.Enum */ diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/EnumValue.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/EnumValue.php index a782640b8..f9dfece17 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/EnumValue.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/EnumValue.php @@ -11,6 +11,10 @@ /** * Enum value definition. + * New usages of this message as an alternative to EnumValueDescriptorProto are + * strongly discouraged. This message does not reliability preserve all + * information necessary to model the schema and preserve semantics. Instead + * make use of FileDescriptorSet which preserves the necessary information. * * Generated from protobuf message google.protobuf.EnumValue */ diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Field.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Field.php index 405a2c0ad..727453027 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Field.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Field.php @@ -11,6 +11,10 @@ /** * A single field of a message type. + * New usages of this message as an alternative to FieldDescriptorProto are + * strongly discouraged. This message does not reliability preserve all + * information necessary to model the schema and preserve semantics. Instead + * make use of FileDescriptorSet which preserves the necessary information. * * Generated from protobuf message google.protobuf.Field */ diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions.php index 0e6bff555..5442e5182 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions.php @@ -97,9 +97,11 @@ class FieldOptions extends \Google\Protobuf\Internal\Message */ protected $deprecated = null; /** + * DEPRECATED. DO NOT USE! * For Google-internal migration only. Do not use. * - * Generated from protobuf field optional bool weak = 10 [default = false]; + * Generated from protobuf field optional bool weak = 10 [default = false, deprecated = true]; + * @deprecated */ protected $weak = null; /** @@ -204,6 +206,7 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * for accessors, or it will be completely ignored; in the very least, this * is a formalization for deprecating fields. * @type bool $weak + * DEPRECATED. DO NOT USE! * For Google-internal migration only. Do not use. * @type bool $debug_redact * Indicate that the field value should not be printed out when using debug @@ -531,35 +534,47 @@ public function setDeprecated($var) } /** + * DEPRECATED. DO NOT USE! * For Google-internal migration only. Do not use. * - * Generated from protobuf field optional bool weak = 10 [default = false]; + * Generated from protobuf field optional bool weak = 10 [default = false, deprecated = true]; * @return bool + * @deprecated */ public function getWeak() { + if (isset($this->weak)) { + @trigger_error('weak is deprecated.', E_USER_DEPRECATED); + } return isset($this->weak) ? $this->weak : false; } public function hasWeak() { + if (isset($this->weak)) { + @trigger_error('weak is deprecated.', E_USER_DEPRECATED); + } return isset($this->weak); } public function clearWeak() { + @trigger_error('weak is deprecated.', E_USER_DEPRECATED); unset($this->weak); } /** + * DEPRECATED. DO NOT USE! * For Google-internal migration only. Do not use. * - * Generated from protobuf field optional bool weak = 10 [default = false]; + * Generated from protobuf field optional bool weak = 10 [default = false, deprecated = true]; * @param bool $var * @return $this + * @deprecated */ public function setWeak($var) { + @trigger_error('weak is deprecated.', E_USER_DEPRECATED); GPBUtil::checkBool($var); $this->weak = $var; diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBDecodeException.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBDecodeException.php index 6a143a2a0..7104109fa 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBDecodeException.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBDecodeException.php @@ -14,7 +14,7 @@ class GPBDecodeException extends \Exception public function __construct( $message, $code = 0, - \Exception $previous = null) + ?\Exception $previous = null) { parent::__construct( "Error occurred during parsing: " . $message, diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Method.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Method.php index 5e55a764c..6eb9c358c 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Method.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Method.php @@ -11,6 +11,10 @@ /** * Method represents a method of an API interface. + * New usages of this message as an alternative to MethodDescriptorProto are + * strongly discouraged. This message does not reliability preserve all + * information necessary to model the schema and preserve semantics. Instead + * make use of FileDescriptorSet which preserves the necessary information. * * Generated from protobuf message google.protobuf.Method */ @@ -54,10 +58,22 @@ class Method extends \Google\Protobuf\Internal\Message private $options; /** * The source syntax of this method. + * This field should be ignored, instead the syntax should be inherited from + * Api. This is similar to Field and EnumValue. * - * Generated from protobuf field .google.protobuf.Syntax syntax = 7; + * Generated from protobuf field .google.protobuf.Syntax syntax = 7 [deprecated = true]; + * @deprecated */ protected $syntax = 0; + /** + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. + * This field should be ignored, instead the edition should be inherited from + * Api. This is similar to Field and EnumValue. + * + * Generated from protobuf field string edition = 8 [deprecated = true]; + * @deprecated + */ + protected $edition = ''; /** * Constructor. @@ -79,6 +95,12 @@ class Method extends \Google\Protobuf\Internal\Message * Any metadata attached to the method. * @type int $syntax * The source syntax of this method. + * This field should be ignored, instead the syntax should be inherited from + * Api. This is similar to Field and EnumValue. + * @type string $edition + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. + * This field should be ignored, instead the edition should be inherited from + * Api. This is similar to Field and EnumValue. * } */ public function __construct($data = NULL) { @@ -244,29 +266,75 @@ public function setOptions($var) /** * The source syntax of this method. + * This field should be ignored, instead the syntax should be inherited from + * Api. This is similar to Field and EnumValue. * - * Generated from protobuf field .google.protobuf.Syntax syntax = 7; + * Generated from protobuf field .google.protobuf.Syntax syntax = 7 [deprecated = true]; * @return int + * @deprecated */ public function getSyntax() { + if ($this->syntax !== 0) { + @trigger_error('syntax is deprecated.', E_USER_DEPRECATED); + } return $this->syntax; } /** * The source syntax of this method. + * This field should be ignored, instead the syntax should be inherited from + * Api. This is similar to Field and EnumValue. * - * Generated from protobuf field .google.protobuf.Syntax syntax = 7; + * Generated from protobuf field .google.protobuf.Syntax syntax = 7 [deprecated = true]; * @param int $var * @return $this + * @deprecated */ public function setSyntax($var) { + @trigger_error('syntax is deprecated.', E_USER_DEPRECATED); GPBUtil::checkEnum($var, \Google\Protobuf\Syntax::class); $this->syntax = $var; return $this; } + /** + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. + * This field should be ignored, instead the edition should be inherited from + * Api. This is similar to Field and EnumValue. + * + * Generated from protobuf field string edition = 8 [deprecated = true]; + * @return string + * @deprecated + */ + public function getEdition() + { + if ($this->edition !== '') { + @trigger_error('edition is deprecated.', E_USER_DEPRECATED); + } + return $this->edition; + } + + /** + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. + * This field should be ignored, instead the edition should be inherited from + * Api. This is similar to Field and EnumValue. + * + * Generated from protobuf field string edition = 8 [deprecated = true]; + * @param string $var + * @return $this + * @deprecated + */ + public function setEdition($var) + { + @trigger_error('edition is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkString($var, True); + $this->edition = $var; + + return $this; + } + } diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Option.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Option.php index 7674fda83..4dc52ca23 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Option.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Option.php @@ -12,6 +12,9 @@ /** * A protocol buffer option, which can be attached to a message, field, * enumeration, etc. + * New usages of this message as an alternative to FileOptions, MessageOptions, + * FieldOptions, EnumOptions, EnumValueOptions, ServiceOptions, or MethodOptions + * are strongly discouraged. * * Generated from protobuf message google.protobuf.Option */ diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Type.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Type.php index c274909ab..ef37e778a 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Type.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Type.php @@ -11,6 +11,10 @@ /** * A protocol buffer message type. + * New usages of this message as an alternative to DescriptorProto are strongly + * discouraged. This message does not reliability preserve all information + * necessary to model the schema and preserve semantics. Instead make use of + * FileDescriptorSet which preserves the necessary information. * * Generated from protobuf message google.protobuf.Type */ diff --git a/lib/Google/vendor/grpc/grpc/composer.json b/lib/Google/vendor/grpc/grpc/composer.json index 755ea4bea..a585b40eb 100644 --- a/lib/Google/vendor/grpc/grpc/composer.json +++ b/lib/Google/vendor/grpc/grpc/composer.json @@ -5,7 +5,7 @@ "keywords": ["rpc"], "homepage": "https://grpc.io", "license": "Apache-2.0", - "version": "1.57.0", + "version": "1.74.0", "require": { "php": ">=7.0.0" }, diff --git a/lib/Google/vendor/grpc/grpc/src/lib/BaseStub.php b/lib/Google/vendor/grpc/grpc/src/lib/BaseStub.php index d9da4ca1a..97d0b2474 100644 --- a/lib/Google/vendor/grpc/grpc/src/lib/BaseStub.php +++ b/lib/Google/vendor/grpc/grpc/src/lib/BaseStub.php @@ -228,7 +228,7 @@ private function _get_jwt_aud_uri($method) } // Remove the port if it is 443 - // See https://github.com/grpc/grpc/blob/07c9f7a36b2a0d34fcffebc85649cf3b8c339b5d/src/core/lib/security/transport/client_auth_filter.cc#L205 + // See https://github.com/grpc/grpc/blob/07c9f7a36b2a0d34fcffebc85649cf3b8c339b5d/src/core/filter/auth/client_auth_filter.cc#L205 if ((strlen($hostname) > 4) && (substr($hostname, -4) === ":443")) { $hostname = substr($hostname, 0, -4); } diff --git a/lib/Google/vendor/grpc/grpc/src/lib/ServerCallWriter.php b/lib/Google/vendor/grpc/grpc/src/lib/ServerCallWriter.php index aceb20c38..40fbe995d 100644 --- a/lib/Google/vendor/grpc/grpc/src/lib/ServerCallWriter.php +++ b/lib/Google/vendor/grpc/grpc/src/lib/ServerCallWriter.php @@ -81,7 +81,7 @@ public function finish( private function addSendInitialMetadataOpIfNotSent( array &$batch, - array $initialMetadata = null + ?array $initialMetadata = null ) { if (!$this->initialMetadataSent_) { $batch[OP_SEND_INITIAL_METADATA] = $initialMetadata ?? []; diff --git a/lib/Google/vendor/grpc/grpc/src/lib/Status.php b/lib/Google/vendor/grpc/grpc/src/lib/Status.php index add208f6d..d47480fa8 100644 --- a/lib/Google/vendor/grpc/grpc/src/lib/Status.php +++ b/lib/Google/vendor/grpc/grpc/src/lib/Status.php @@ -32,7 +32,7 @@ */ class Status { - public static function status(int $code, string $details, array $metadata = null): array + public static function status(int $code, string $details, ?array $metadata = null): array { $status = [ 'code' => $code, @@ -44,7 +44,7 @@ public static function status(int $code, string $details, array $metadata = null return $status; } - public static function ok(array $metadata = null): array + public static function ok(?array $metadata = null): array { return Status::status(STATUS_OK, 'OK', $metadata); } diff --git a/lib/Google/vendor/grpc/grpc/src/lib/UnaryCall.php b/lib/Google/vendor/grpc/grpc/src/lib/UnaryCall.php index e8496492b..4b7180fba 100644 --- a/lib/Google/vendor/grpc/grpc/src/lib/UnaryCall.php +++ b/lib/Google/vendor/grpc/grpc/src/lib/UnaryCall.php @@ -22,6 +22,8 @@ /** * Represents an active call that sends a single message and then gets a * single response. + * + * @template T of \Google\Protobuf\Internal\Message */ class UnaryCall extends AbstractCall { @@ -50,7 +52,7 @@ public function start($data, array $metadata = [], array $options = []) /** * Wait for the server to respond with data and a status. * - * @return array [response data, status] + * @return array{0: T|null, 1: \stdClass} [response data, status] */ public function wait() { diff --git a/lib/Google/vendor/guzzlehttp/guzzle/CHANGELOG.md b/lib/Google/vendor/guzzlehttp/guzzle/CHANGELOG.md index 7600ef497..5fe721e03 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/CHANGELOG.md +++ b/lib/Google/vendor/guzzlehttp/guzzle/CHANGELOG.md @@ -2,6 +2,17 @@ Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version. +## 7.10.0 - 2025-08-23 + +### Added + +- Support for PHP 8.5 + +### Changed + +- Adjusted `guzzlehttp/promises` version constraint to `^2.3` +- Adjusted `guzzlehttp/psr7` version constraint to `^2.8` + ## 7.9.3 - 2025-03-27 diff --git a/lib/Google/vendor/guzzlehttp/guzzle/composer.json b/lib/Google/vendor/guzzlehttp/guzzle/composer.json index cbede149a..0db75a950 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/composer.json +++ b/lib/Google/vendor/guzzlehttp/guzzle/composer.json @@ -81,8 +81,8 @@ "require": { "php": "^7.2.5 || ^8.0", "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0.3", - "guzzlehttp/psr7": "^2.7.0", + "guzzlehttp/promises": "^2.3", + "guzzlehttp/psr7": "^2.8", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" }, diff --git a/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php b/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php index fe3613751..3c1fa9c13 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php +++ b/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php @@ -125,7 +125,9 @@ public function release(EasyHandle $easy): void unset($easy->handle); if (\count($this->handles) >= $this->maxHandles) { - \curl_close($resource); + if (PHP_VERSION_ID < 80000) { + \curl_close($resource); + } } else { // Remove all callback functions as they can hold onto references // and are not cleaned up by curl_reset. Using curl_setopt_array @@ -729,7 +731,10 @@ private function createHeaderFn(EasyHandle $easy): callable public function __destruct() { foreach ($this->handles as $id => $handle) { - \curl_close($handle); + if (PHP_VERSION_ID < 80000) { + \curl_close($handle); + } + unset($this->handles[$id]); } } diff --git a/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php index 73a6abe33..21abbedf3 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php +++ b/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php @@ -240,7 +240,10 @@ private function cancel($id): bool $handle = $this->handles[$id]['easy']->handle; unset($this->delays[$id], $this->handles[$id]); \curl_multi_remove_handle($this->_mh, $handle); - \curl_close($handle); + + if (PHP_VERSION_ID < 80000) { + \curl_close($handle); + } return true; } diff --git a/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php b/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php index 083049ea8..f24921f47 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php +++ b/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php @@ -333,8 +333,15 @@ static function () use ($context, $params) { ); return $this->createResource( - function () use ($uri, &$http_response_header, $contextResource, $context, $options, $request) { + function () use ($uri, $contextResource, $context, $options, $request) { $resource = @\fopen((string) $uri, 'r', false, $contextResource); + + // See https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_http_response_header_predefined_variable + if (function_exists('http_get_last_response_headers')) { + /** @var array|null */ + $http_response_header = \http_get_last_response_headers(); + } + $this->lastHeaders = $http_response_header ?? []; if (false === $resource) { diff --git a/lib/Google/vendor/guzzlehttp/guzzle/src/Middleware.php b/lib/Google/vendor/guzzlehttp/guzzle/src/Middleware.php index 6edbb3fe4..9901da44a 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/src/Middleware.php +++ b/lib/Google/vendor/guzzlehttp/guzzle/src/Middleware.php @@ -187,12 +187,12 @@ public static function retry(callable $decider, ?callable $delay = null): callab * Middleware that logs requests, responses, and errors using a message * formatter. * - * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests. - * * @param LoggerInterface $logger Logs messages. * @param MessageFormatterInterface|MessageFormatter $formatter Formatter used to create message strings. * @param string $logLevel Level at which to log requests. * + * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests. + * * @return callable Returns a function that accepts the next handler. */ public static function log(LoggerInterface $logger, $formatter, string $logLevel = 'info'): callable diff --git a/lib/Google/vendor/guzzlehttp/promises/CHANGELOG.md b/lib/Google/vendor/guzzlehttp/promises/CHANGELOG.md index 1d8045032..7df9c0ae6 100644 --- a/lib/Google/vendor/guzzlehttp/promises/CHANGELOG.md +++ b/lib/Google/vendor/guzzlehttp/promises/CHANGELOG.md @@ -1,6 +1,13 @@ # CHANGELOG +## 2.3.0 - 2025-08-22 + +### Added + +- PHP 8.5 support + + ## 2.2.0 - 2025-03-27 ### Fixed diff --git a/lib/Google/vendor/guzzlehttp/promises/README.md b/lib/Google/vendor/guzzlehttp/promises/README.md index d1c814fe7..493a9315b 100644 --- a/lib/Google/vendor/guzzlehttp/promises/README.md +++ b/lib/Google/vendor/guzzlehttp/promises/README.md @@ -41,7 +41,7 @@ composer require guzzlehttp/promises | Version | Status | PHP Version | |---------|---------------------|--------------| | 1.x | Security fixes only | >=5.5,<8.3 | -| 2.x | Latest | >=7.2.5,<8.5 | +| 2.x | Latest | >=7.2.5,<8.6 | ## Quick Start diff --git a/lib/Google/vendor/guzzlehttp/promises/composer.json b/lib/Google/vendor/guzzlehttp/promises/composer.json index f64ed7714..9d6e85678 100644 --- a/lib/Google/vendor/guzzlehttp/promises/composer.json +++ b/lib/Google/vendor/guzzlehttp/promises/composer.json @@ -30,7 +30,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.39 || ^9.6.20" + "phpunit/phpunit": "^8.5.44 || ^9.6.25" }, "autoload": { "psr-4": { diff --git a/lib/Google/vendor/guzzlehttp/psr7/CHANGELOG.md b/lib/Google/vendor/guzzlehttp/psr7/CHANGELOG.md index a85929521..4a2a12194 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/CHANGELOG.md +++ b/lib/Google/vendor/guzzlehttp/psr7/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 2.8.0 - 2025-08-23 + +### Added + +- Allow empty lists as header values + +### Changed + +- PHP 8.5 support + ## 2.7.1 - 2025-03-27 ### Fixed diff --git a/lib/Google/vendor/guzzlehttp/psr7/README.md b/lib/Google/vendor/guzzlehttp/psr7/README.md index 2e9bb0b9b..24aad8605 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/README.md +++ b/lib/Google/vendor/guzzlehttp/psr7/README.md @@ -25,7 +25,7 @@ composer require guzzlehttp/psr7 | Version | Status | PHP Version | |---------|---------------------|--------------| | 1.x | EOL (2024-06-30) | >=5.4,<8.2 | -| 2.x | Latest | >=7.2.5,<8.5 | +| 2.x | Latest | >=7.2.5,<8.6 | ## AppendStream diff --git a/lib/Google/vendor/guzzlehttp/psr7/composer.json b/lib/Google/vendor/guzzlehttp/psr7/composer.json index 28d15f571..96098f536 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/composer.json +++ b/lib/Google/vendor/guzzlehttp/psr7/composer.json @@ -62,7 +62,7 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "http-interop/http-factory-tests": "0.9.0", - "phpunit/phpunit": "^8.5.39 || ^9.6.20" + "phpunit/phpunit": "^8.5.44 || ^9.6.25" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/MessageTrait.php b/lib/Google/vendor/guzzlehttp/psr7/src/MessageTrait.php index 65dbc4ba0..c15ee63fc 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/MessageTrait.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -174,10 +174,6 @@ private function normalizeHeaderValue($value): array return $this->trimAndValidateHeaderValues([$value]); } - if (count($value) === 0) { - throw new \InvalidArgumentException('Header value can not be an empty array.'); - } - return $this->trimAndValidateHeaderValues($value); } diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/Utils.php b/lib/Google/vendor/guzzlehttp/psr7/src/Utils.php index 7682d2cdc..5451e3dcd 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/Utils.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/Utils.php @@ -397,7 +397,7 @@ public static function tryFopen(string $filename, string $mode) restore_error_handler(); if ($ex) { - /** @var $ex \RuntimeException */ + /** @var \RuntimeException $ex */ throw $ex; } @@ -444,7 +444,7 @@ public static function tryGetContents($stream): string restore_error_handler(); if ($ex) { - /** @var $ex \RuntimeException */ + /** @var \RuntimeException $ex */ throw $ex; } diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/composer.json b/lib/Google/vendor/paragonie/constant_time_encoding/composer.json index 5023095b4..11fad5e63 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/composer.json +++ b/lib/Google/vendor/paragonie/constant_time_encoding/composer.json @@ -40,8 +40,10 @@ "php": "^8" }, "require-dev": { - "phpunit/phpunit": "^9", - "vimeo/psalm": "^4|^5" + "infection/infection": "^0", + "nikic/php-fuzzer": "^0", + "phpunit/phpunit": "^9|^10|^11", + "vimeo/psalm": "^4|^5|^6" }, "autoload": { "psr-4": { @@ -52,5 +54,14 @@ "psr-4": { "ParagonIE\\ConstantTime\\Tests\\": "tests/" } + }, + "scripts": { + "mutation-test": "infection" + }, + "config": { + "process-timeout": 0, + "allow-plugins": { + "infection/extension-installer": true + } } } diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32.php index 48d00b991..379552af5 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32.php @@ -3,8 +3,15 @@ namespace ParagonIE\ConstantTime; use InvalidArgumentException; +use Override; use RangeException; +use SensitiveParameter; use TypeError; +use function pack; +use function rtrim; +use function strlen; +use function substr; +use function unpack; /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. @@ -44,8 +51,9 @@ abstract class Base32 implements EncoderInterface * @param bool $strictPadding * @return string */ + #[Override] public static function decode( - #[\SensitiveParameter] + #[SensitiveParameter] string $encodedString, bool $strictPadding = false ): string { @@ -60,7 +68,7 @@ public static function decode( * @return string */ public static function decodeUpper( - #[\SensitiveParameter] + #[SensitiveParameter] string $src, bool $strictPadding = false ): string { @@ -74,8 +82,9 @@ public static function decodeUpper( * @return string * @throws TypeError */ + #[Override] public static function encode( - #[\SensitiveParameter] + #[SensitiveParameter] string $binString ): string { return static::doEncode($binString, false, true); @@ -87,9 +96,10 @@ public static function encode( * @param string $src * @return string * @throws TypeError + * @api */ public static function encodeUnpadded( - #[\SensitiveParameter] + #[SensitiveParameter] string $src ): string { return static::doEncode($src, false, false); @@ -101,9 +111,10 @@ public static function encodeUnpadded( * @param string $src * @return string * @throws TypeError + * @api */ public static function encodeUpper( - #[\SensitiveParameter] + #[SensitiveParameter] string $src ): string { return static::doEncode($src, true, true); @@ -115,9 +126,10 @@ public static function encodeUpper( * @param string $src * @return string * @throws TypeError + * @api */ public static function encodeUpperUnpadded( - #[\SensitiveParameter] + #[SensitiveParameter] string $src ): string { return static::doEncode($src, true, false); @@ -129,6 +141,7 @@ public static function encodeUpperUnpadded( * * @param int $src * @return int + * @api */ protected static function decode5Bits(int $src): int { @@ -151,6 +164,7 @@ protected static function decode5Bits(int $src): int * * @param int $src * @return int + * @api */ protected static function decode5BitsUpper(int $src): int { @@ -171,6 +185,7 @@ protected static function decode5BitsUpper(int $src): int * * @param int $src * @return string + * @api */ protected static function encode5Bits(int $src): string { @@ -179,7 +194,7 @@ protected static function encode5Bits(int $src): string // if ($src > 25) $ret -= 72; $diff -= ((25 - $src) >> 8) & 73; - return \pack('C', $src + $diff); + return pack('C', $src + $diff); } /** @@ -190,6 +205,7 @@ protected static function encode5Bits(int $src): string * * @param int $src * @return string + * @api */ protected static function encode5BitsUpper(int $src): string { @@ -198,20 +214,21 @@ protected static function encode5BitsUpper(int $src): string // if ($src > 25) $ret -= 40; $diff -= ((25 - $src) >> 8) & 41; - return \pack('C', $src + $diff); + return pack('C', $src + $diff); } /** * @param string $encodedString * @param bool $upper * @return string + * @api */ public static function decodeNoPadding( - #[\SensitiveParameter] + #[SensitiveParameter] string $encodedString, bool $upper = false ): string { - $srcLen = Binary::safeStrlen($encodedString); + $srcLen = strlen($encodedString); if ($srcLen === 0) { return ''; } @@ -242,7 +259,7 @@ public static function decodeNoPadding( * @throws TypeError */ protected static function doDecode( - #[\SensitiveParameter] + #[SensitiveParameter] string $src, bool $upper = false, bool $strictPadding = false @@ -253,7 +270,7 @@ protected static function doDecode( : 'decode5Bits'; // Remove padding - $srcLen = Binary::safeStrlen($src); + $srcLen = strlen($src); if ($srcLen === 0) { return ''; } @@ -273,8 +290,8 @@ protected static function doDecode( ); } } else { - $src = \rtrim($src, '='); - $srcLen = Binary::safeStrlen($src); + $src = rtrim($src, '='); + $srcLen = strlen($src); } $err = 0; @@ -282,7 +299,7 @@ protected static function doDecode( // Main loop (no padding): for ($i = 0; $i + 8 <= $srcLen; $i += 8) { /** @var array $chunk */ - $chunk = \unpack('C*', Binary::safeSubstr($src, $i, 8)); + $chunk = unpack('C*', substr($src, $i, 8)); /** @var int $c0 */ $c0 = static::$method($chunk[1]); /** @var int $c1 */ @@ -300,7 +317,7 @@ protected static function doDecode( /** @var int $c7 */ $c7 = static::$method($chunk[8]); - $dest .= \pack( + $dest .= pack( 'CCCCC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff, @@ -313,7 +330,7 @@ protected static function doDecode( // The last chunk, which may have padding: if ($i < $srcLen) { /** @var array $chunk */ - $chunk = \unpack('C*', Binary::safeSubstr($src, $i, $srcLen - $i)); + $chunk = unpack('C*', substr($src, $i, $srcLen - $i)); /** @var int $c0 */ $c0 = static::$method($chunk[1]); @@ -331,7 +348,7 @@ protected static function doDecode( /** @var int $c6 */ $c6 = static::$method($chunk[7]); - $dest .= \pack( + $dest .= pack( 'CCCC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff, @@ -354,7 +371,7 @@ protected static function doDecode( /** @var int $c5 */ $c5 = static::$method($chunk[6]); - $dest .= \pack( + $dest .= pack( 'CCCC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff, @@ -372,7 +389,7 @@ protected static function doDecode( /** @var int $c4 */ $c4 = static::$method($chunk[5]); - $dest .= \pack( + $dest .= pack( 'CCC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff, @@ -390,7 +407,7 @@ protected static function doDecode( /** @var int $c3 */ $c3 = static::$method($chunk[4]); - $dest .= \pack( + $dest .= pack( 'CC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff @@ -405,7 +422,7 @@ protected static function doDecode( /** @var int $c2 */ $c2 = static::$method($chunk[3]); - $dest .= \pack( + $dest .= pack( 'CC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) ) & 0xff @@ -418,7 +435,7 @@ protected static function doDecode( /** @var int $c1 */ $c1 = static::$method($chunk[2]); - $dest .= \pack( + $dest .= pack( 'C', (($c0 << 3) | ($c1 >> 2) ) & 0xff ); @@ -427,7 +444,7 @@ protected static function doDecode( $err |= ($c1 << 6) & 0xff; } } else { - $dest .= \pack( + $dest .= pack( 'C', (($c0 << 3) ) & 0xff ); @@ -453,10 +470,10 @@ protected static function doDecode( * @throws TypeError */ protected static function doEncode( - #[\SensitiveParameter] + #[SensitiveParameter] string $src, bool $upper = false, - $pad = true + bool $pad = true ): string { // We do this to reduce code duplication: $method = $upper @@ -464,12 +481,12 @@ protected static function doEncode( : 'encode5Bits'; $dest = ''; - $srcLen = Binary::safeStrlen($src); + $srcLen = strlen($src); // Main loop (no padding): for ($i = 0; $i + 5 <= $srcLen; $i += 5) { /** @var array $chunk */ - $chunk = \unpack('C*', Binary::safeSubstr($src, $i, 5)); + $chunk = unpack('C*', substr($src, $i, 5)); $b0 = $chunk[1]; $b1 = $chunk[2]; $b2 = $chunk[3]; @@ -488,7 +505,7 @@ protected static function doEncode( // The last chunk, which may have padding: if ($i < $srcLen) { /** @var array $chunk */ - $chunk = \unpack('C*', Binary::safeSubstr($src, $i, $srcLen - $i)); + $chunk = unpack('C*', substr($src, $i, $srcLen - $i)); $b0 = $chunk[1]; if ($i + 3 < $srcLen) { $b1 = $chunk[2]; diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32Hex.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32Hex.php index b868dd048..4323a573a 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32Hex.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32Hex.php @@ -2,6 +2,9 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; +use Override; +use function pack; + /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) @@ -40,6 +43,7 @@ abstract class Base32Hex extends Base32 * @param int $src * @return int */ + #[Override] protected static function decode5Bits(int $src): int { $ret = -1; @@ -60,6 +64,7 @@ protected static function decode5Bits(int $src): int * @param int $src * @return int */ + #[Override] protected static function decode5BitsUpper(int $src): int { $ret = -1; @@ -80,6 +85,7 @@ protected static function decode5BitsUpper(int $src): int * @param int $src * @return string */ + #[Override] protected static function encode5Bits(int $src): string { $src += 0x30; @@ -87,7 +93,7 @@ protected static function encode5Bits(int $src): string // if ($src > 0x39) $src += 0x61 - 0x3a; // 39 $src += ((0x39 - $src) >> 8) & 39; - return \pack('C', $src); + return pack('C', $src); } /** @@ -99,6 +105,7 @@ protected static function encode5Bits(int $src): string * @param int $src * @return string */ + #[Override] protected static function encode5BitsUpper(int $src): string { $src += 0x30; @@ -106,6 +113,6 @@ protected static function encode5BitsUpper(int $src): string // if ($src > 0x39) $src += 0x41 - 0x3a; // 7 $src += ((0x39 - $src) >> 8) & 7; - return \pack('C', $src); + return pack('C', $src); } } \ No newline at end of file diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64.php index 2e3ecc859..9679748dc 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64.php @@ -3,8 +3,23 @@ namespace ParagonIE\ConstantTime; use InvalidArgumentException; +use Override; use RangeException; +use SensitiveParameter; +use SodiumException; use TypeError; +use function extension_loaded; +use function pack; +use function rtrim; +use function sodium_base642bin; +use function sodium_bin2base64; +use function strlen; +use function substr; +use function unpack; +use const SODIUM_BASE64_VARIANT_ORIGINAL; +use const SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING; +use const SODIUM_BASE64_VARIANT_URLSAFE; +use const SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING; /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. @@ -47,10 +62,25 @@ abstract class Base64 implements EncoderInterface * * @throws TypeError */ + #[Override] public static function encode( - #[\SensitiveParameter] + #[SensitiveParameter] string $binString ): string { + if (extension_loaded('sodium')) { + $variant = match(static::class) { + Base64::class => SODIUM_BASE64_VARIANT_ORIGINAL, + Base64UrlSafe::class => SODIUM_BASE64_VARIANT_URLSAFE, + default => 0, + }; + if ($variant > 0) { + try { + return sodium_bin2base64($binString, $variant); + } catch (SodiumException $ex) { + throw new RangeException($ex->getMessage(), $ex->getCode(), $ex); + } + } + } return static::doEncode($binString, true); } @@ -63,11 +93,26 @@ public static function encode( * @return string * * @throws TypeError + * @api */ public static function encodeUnpadded( - #[\SensitiveParameter] + #[SensitiveParameter] string $src ): string { + if (extension_loaded('sodium')) { + $variant = match(static::class) { + Base64::class => SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING, + Base64UrlSafe::class => SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING, + default => 0, + }; + if ($variant > 0) { + try { + return sodium_bin2base64($src, $variant); + } catch (SodiumException $ex) { + throw new RangeException($ex->getMessage(), $ex->getCode(), $ex); + } + } + } return static::doEncode($src, false); } @@ -79,16 +124,16 @@ public static function encodeUnpadded( * @throws TypeError */ protected static function doEncode( - #[\SensitiveParameter] + #[SensitiveParameter] string $src, bool $pad = true ): string { $dest = ''; - $srcLen = Binary::safeStrlen($src); + $srcLen = strlen($src); // Main loop (no padding): for ($i = 0; $i + 3 <= $srcLen; $i += 3) { /** @var array $chunk */ - $chunk = \unpack('C*', Binary::safeSubstr($src, $i, 3)); + $chunk = unpack('C*', substr($src, $i, 3)); $b0 = $chunk[1]; $b1 = $chunk[2]; $b2 = $chunk[3]; @@ -102,7 +147,7 @@ protected static function doEncode( // The last chunk, which may have padding: if ($i < $srcLen) { /** @var array $chunk */ - $chunk = \unpack('C*', Binary::safeSubstr($src, $i, $srcLen - $i)); + $chunk = unpack('C*', substr($src, $i, $srcLen - $i)); $b0 = $chunk[1]; if ($i + 1 < $srcLen) { $b1 = $chunk[2]; @@ -137,13 +182,14 @@ protected static function doEncode( * @throws RangeException * @throws TypeError */ + #[Override] public static function decode( - #[\SensitiveParameter] + #[SensitiveParameter] string $encodedString, bool $strictPadding = false ): string { // Remove padding - $srcLen = Binary::safeStrlen($encodedString); + $srcLen = strlen($encodedString); if ($srcLen === 0) { return ''; } @@ -167,9 +213,24 @@ public static function decode( 'Incorrect padding' ); } + if (extension_loaded('sodium')) { + $variant = match(static::class) { + Base64::class => SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING, + Base64UrlSafe::class => SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING, + default => 0, + }; + if ($variant > 0) { + try { + return sodium_base642bin(substr($encodedString, 0, $srcLen), $variant); + } catch (SodiumException $ex) { + throw new RangeException($ex->getMessage(), $ex->getCode(), $ex); + } + } + } } else { - $encodedString = \rtrim($encodedString, '='); - $srcLen = Binary::safeStrlen($encodedString); + // Just remove all padding. + $encodedString = rtrim($encodedString, '='); + $srcLen = strlen($encodedString); } $err = 0; @@ -177,13 +238,13 @@ public static function decode( // Main loop (no padding): for ($i = 0; $i + 4 <= $srcLen; $i += 4) { /** @var array $chunk */ - $chunk = \unpack('C*', Binary::safeSubstr($encodedString, $i, 4)); + $chunk = unpack('C*', substr($encodedString, $i, 4)); $c0 = static::decode6Bits($chunk[1]); $c1 = static::decode6Bits($chunk[2]); $c2 = static::decode6Bits($chunk[3]); $c3 = static::decode6Bits($chunk[4]); - $dest .= \pack( + $dest .= pack( 'CCC', ((($c0 << 2) | ($c1 >> 4)) & 0xff), ((($c1 << 4) | ($c2 >> 2)) & 0xff), @@ -194,13 +255,13 @@ public static function decode( // The last chunk, which may have padding: if ($i < $srcLen) { /** @var array $chunk */ - $chunk = \unpack('C*', Binary::safeSubstr($encodedString, $i, $srcLen - $i)); + $chunk = unpack('C*', substr($encodedString, $i, $srcLen - $i)); $c0 = static::decode6Bits($chunk[1]); if ($i + 2 < $srcLen) { $c1 = static::decode6Bits($chunk[2]); $c2 = static::decode6Bits($chunk[3]); - $dest .= \pack( + $dest .= pack( 'CC', ((($c0 << 2) | ($c1 >> 4)) & 0xff), ((($c1 << 4) | ($c2 >> 2)) & 0xff) @@ -211,7 +272,7 @@ public static function decode( } } elseif ($i + 1 < $srcLen) { $c1 = static::decode6Bits($chunk[2]); - $dest .= \pack( + $dest .= pack( 'C', ((($c0 << 2) | ($c1 >> 4)) & 0xff) ); @@ -235,12 +296,13 @@ public static function decode( /** * @param string $encodedString * @return string + * @api */ public static function decodeNoPadding( - #[\SensitiveParameter] + #[SensitiveParameter] string $encodedString ): string { - $srcLen = Binary::safeStrlen($encodedString); + $srcLen = strlen($encodedString); if ($srcLen === 0) { return ''; } @@ -314,6 +376,6 @@ protected static function encode6Bits(int $src): string // if ($src > 62) $diff += 0x2f - 0x2b - 1; // 3 $diff += ((62 - $src) >> 8) & 3; - return \pack('C', $src + $diff); + return pack('C', $src + $diff); } } diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlash.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlash.php index 5e98a8f79..847751767 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlash.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlash.php @@ -2,6 +2,8 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; +use Override; + /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) @@ -44,6 +46,7 @@ abstract class Base64DotSlash extends Base64 * @param int $src * @return int */ + #[Override] protected static function decode6Bits(int $src): int { $ret = -1; @@ -70,6 +73,7 @@ protected static function decode6Bits(int $src): int * @param int $src * @return string */ + #[Override] protected static function encode6Bits(int $src): string { $src += 0x2e; diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php index 9780b14bb..2c42db37f 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php @@ -2,6 +2,8 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; +use Override; + /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) @@ -44,6 +46,7 @@ abstract class Base64DotSlashOrdered extends Base64 * @param int $src * @return int */ + #[Override] protected static function decode6Bits(int $src): int { $ret = -1; @@ -67,6 +70,7 @@ protected static function decode6Bits(int $src): int * @param int $src * @return string */ + #[Override] protected static function encode6Bits(int $src): string { $src += 0x2e; diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64UrlSafe.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64UrlSafe.php index 8192c63d5..845aaf626 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64UrlSafe.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64UrlSafe.php @@ -2,6 +2,8 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; +use Override; + /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) @@ -45,6 +47,7 @@ abstract class Base64UrlSafe extends Base64 * @param int $src * @return int */ + #[Override] protected static function decode6Bits(int $src): int { $ret = -1; @@ -74,6 +77,7 @@ protected static function decode6Bits(int $src): int * @param int $src * @return string */ + #[Override] protected static function encode6Bits(int $src): string { $diff = 0x41; diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Binary.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Binary.php index a958f2f7c..369584407 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Binary.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Binary.php @@ -2,7 +2,10 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; +use SensitiveParameter; use TypeError; +use function strlen; +use function substr; /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. @@ -46,16 +49,10 @@ abstract class Binary * @return int */ public static function safeStrlen( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): int { - if (\function_exists('mb_strlen')) { - // mb_strlen in PHP 7.x can return false. - /** @psalm-suppress RedundantCast */ - return (int) \mb_strlen($str, '8bit'); - } else { - return \strlen($str); - } + return strlen($str); } /** @@ -72,7 +69,7 @@ public static function safeStrlen( * @throws TypeError */ public static function safeSubstr( - #[\SensitiveParameter] + #[SensitiveParameter] string $str, int $start = 0, ?int $length = null @@ -80,14 +77,11 @@ public static function safeSubstr( if ($length === 0) { return ''; } - if (\function_exists('mb_substr')) { - return \mb_substr($str, $start, $length, '8bit'); - } // Unlike mb_substr(), substr() doesn't accept NULL for length if ($length !== null) { - return \substr($str, $start, $length); + return substr($str, $start, $length); } else { - return \substr($str, $start); + return substr($str, $start); } } } diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/EncoderInterface.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/EncoderInterface.php index 9cafbf96c..cb358ea0d 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/EncoderInterface.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/EncoderInterface.php @@ -2,6 +2,8 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; +use SensitiveParameter; + /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) @@ -38,7 +40,10 @@ interface EncoderInterface * @param string $binString (raw binary) * @return string */ - public static function encode(string $binString): string; + public static function encode( + #[SensitiveParameter] + string $binString + ): string; /** * Convert a binary string into a hexadecimal string without cache-timing @@ -48,5 +53,9 @@ public static function encode(string $binString): string; * @param bool $strictPadding Error on invalid padding * @return string (raw binary) */ - public static function decode(string $encodedString, bool $strictPadding = false): string; + public static function decode( + #[SensitiveParameter] + string $encodedString, + bool $strictPadding = false + ): string; } diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Encoding.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Encoding.php index 8b7e3878e..b28a5014e 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Encoding.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Encoding.php @@ -2,6 +2,8 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; +use RangeException; +use SensitiveParameter; use TypeError; /** @@ -30,6 +32,7 @@ /** * Class Encoding * @package ParagonIE\ConstantTime + * @api */ abstract class Encoding { @@ -41,7 +44,7 @@ abstract class Encoding * @throws TypeError */ public static function base32Encode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base32::encode($str); @@ -55,7 +58,7 @@ public static function base32Encode( * @throws TypeError */ public static function base32EncodeUpper( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base32::encodeUpper($str); @@ -69,7 +72,7 @@ public static function base32EncodeUpper( * @throws TypeError */ public static function base32Decode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base32::decode($str); @@ -83,7 +86,7 @@ public static function base32Decode( * @throws TypeError */ public static function base32DecodeUpper( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base32::decodeUpper($str); @@ -97,7 +100,7 @@ public static function base32DecodeUpper( * @throws TypeError */ public static function base32HexEncode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base32Hex::encode($str); @@ -111,7 +114,7 @@ public static function base32HexEncode( * @throws TypeError */ public static function base32HexEncodeUpper( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base32Hex::encodeUpper($str); @@ -125,7 +128,7 @@ public static function base32HexEncodeUpper( * @throws TypeError */ public static function base32HexDecode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base32Hex::decode($str); @@ -139,7 +142,7 @@ public static function base32HexDecode( * @throws TypeError */ public static function base32HexDecodeUpper( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base32Hex::decodeUpper($str); @@ -153,7 +156,7 @@ public static function base32HexDecodeUpper( * @throws TypeError */ public static function base64Encode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base64::encode($str); @@ -167,7 +170,7 @@ public static function base64Encode( * @throws TypeError */ public static function base64Decode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base64::decode($str); @@ -182,7 +185,7 @@ public static function base64Decode( * @throws TypeError */ public static function base64EncodeDotSlash( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base64DotSlash::encode($str); @@ -195,11 +198,11 @@ public static function base64EncodeDotSlash( * * @param string $str * @return string - * @throws \RangeException + * @throws RangeException * @throws TypeError */ public static function base64DecodeDotSlash( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base64DotSlash::decode($str); @@ -214,7 +217,7 @@ public static function base64DecodeDotSlash( * @throws TypeError */ public static function base64EncodeDotSlashOrdered( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base64DotSlashOrdered::encode($str); @@ -227,11 +230,11 @@ public static function base64EncodeDotSlashOrdered( * * @param string $str * @return string - * @throws \RangeException + * @throws RangeException * @throws TypeError */ public static function base64DecodeDotSlashOrdered( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base64DotSlashOrdered::decode($str); @@ -246,7 +249,7 @@ public static function base64DecodeDotSlashOrdered( * @throws TypeError */ public static function hexEncode( - #[\SensitiveParameter] + #[SensitiveParameter] string $bin_string ): string { return Hex::encode($bin_string); @@ -258,10 +261,10 @@ public static function hexEncode( * * @param string $hex_string * @return string (raw binary) - * @throws \RangeException + * @throws RangeException */ public static function hexDecode( - #[\SensitiveParameter] + #[SensitiveParameter] string $hex_string ): string { return Hex::decode($hex_string); @@ -276,7 +279,7 @@ public static function hexDecode( * @throws TypeError */ public static function hexEncodeUpper( - #[\SensitiveParameter] + #[SensitiveParameter] string $bin_string ): string { return Hex::encodeUpper($bin_string); @@ -290,7 +293,7 @@ public static function hexEncodeUpper( * @return string */ public static function hexDecodeUpper( - #[\SensitiveParameter] + #[SensitiveParameter] string $bin_string ): string { return Hex::decode($bin_string); diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Hex.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Hex.php index 97c2046f0..b515b9758 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Hex.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Hex.php @@ -2,11 +2,20 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; +use Override; use RangeException; +use SensitiveParameter; +use SodiumException; use TypeError; +use function extension_loaded; +use function pack; +use function sodium_bin2hex; +use function sodium_hex2bin; +use function strlen; +use function unpack; /** - * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. + * Copyright (c) 2016 - 2025 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -42,19 +51,27 @@ abstract class Hex implements EncoderInterface * @return string * @throws TypeError */ + #[Override] public static function encode( - #[\SensitiveParameter] + #[SensitiveParameter] string $binString ): string { + if (extension_loaded('sodium')) { + try { + return sodium_bin2hex($binString); + } catch (SodiumException $ex) { + throw new RangeException($ex->getMessage(), $ex->getCode(), $ex); + } + } $hex = ''; - $len = Binary::safeStrlen($binString); + $len = strlen($binString); for ($i = 0; $i < $len; ++$i) { /** @var array $chunk */ - $chunk = \unpack('C', $binString[$i]); + $chunk = unpack('C', $binString[$i]); $c = $chunk[1] & 0xf; $b = $chunk[1] >> 4; - $hex .= \pack( + $hex .= pack( 'CC', (87 + $b + ((($b - 10) >> 8) & ~38)), (87 + $c + ((($c - 10) >> 8) & ~38)) @@ -72,19 +89,19 @@ public static function encode( * @throws TypeError */ public static function encodeUpper( - #[\SensitiveParameter] + #[SensitiveParameter] string $binString ): string { $hex = ''; - $len = Binary::safeStrlen($binString); + $len = strlen($binString); for ($i = 0; $i < $len; ++$i) { /** @var array $chunk */ - $chunk = \unpack('C', $binString[$i]); + $chunk = unpack('C', $binString[$i]); $c = $chunk[1] & 0xf; $b = $chunk[1] >> 4; - $hex .= \pack( + $hex .= pack( 'CC', (55 + $b + ((($b - 10) >> 8) & ~6)), (55 + $c + ((($c - 10) >> 8) & ~6)) @@ -102,15 +119,23 @@ public static function encodeUpper( * @return string (raw binary) * @throws RangeException */ + #[Override] public static function decode( - #[\SensitiveParameter] + #[SensitiveParameter] string $encodedString, bool $strictPadding = false ): string { + if (extension_loaded('sodium') && $strictPadding) { + try { + return sodium_hex2bin($encodedString); + } catch (SodiumException $ex) { + throw new RangeException($ex->getMessage(), $ex->getCode(), $ex); + } + } $hex_pos = 0; $bin = ''; $c_acc = 0; - $hex_len = Binary::safeStrlen($encodedString); + $hex_len = strlen($encodedString); $state = 0; if (($hex_len & 1) !== 0) { if ($strictPadding) { @@ -124,7 +149,7 @@ public static function decode( } /** @var array $chunk */ - $chunk = \unpack('C*', $encodedString); + $chunk = unpack('C*', $encodedString); while ($hex_pos < $hex_len) { ++$hex_pos; $c = $chunk[$hex_pos]; @@ -142,7 +167,7 @@ public static function decode( if ($state === 0) { $c_acc = $c_val * 16; } else { - $bin .= \pack('C', $c_acc | $c_val); + $bin .= pack('C', $c_acc | $c_val); } $state ^= 1; } diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/RFC4648.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/RFC4648.php index 7cd2e9909..fb66f73d7 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/RFC4648.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/RFC4648.php @@ -2,6 +2,7 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; +use SensitiveParameter; use TypeError; /** @@ -33,6 +34,7 @@ * This class conforms strictly to the RFC * * @package ParagonIE\ConstantTime + * @api */ abstract class RFC4648 { @@ -47,7 +49,7 @@ abstract class RFC4648 * @throws TypeError */ public static function base64Encode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base64::encode($str); @@ -64,7 +66,7 @@ public static function base64Encode( * @throws TypeError */ public static function base64Decode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base64::decode($str, true); @@ -81,7 +83,7 @@ public static function base64Decode( * @throws TypeError */ public static function base64UrlSafeEncode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base64UrlSafe::encode($str); @@ -98,7 +100,7 @@ public static function base64UrlSafeEncode( * @throws TypeError */ public static function base64UrlSafeDecode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base64UrlSafe::decode($str, true); @@ -115,7 +117,7 @@ public static function base64UrlSafeDecode( * @throws TypeError */ public static function base32Encode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base32::encodeUpper($str); @@ -132,7 +134,7 @@ public static function base32Encode( * @throws TypeError */ public static function base32Decode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base32::decodeUpper($str, true); @@ -149,7 +151,7 @@ public static function base32Decode( * @throws TypeError */ public static function base32HexEncode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base32::encodeUpper($str); @@ -166,7 +168,7 @@ public static function base32HexEncode( * @throws TypeError */ public static function base32HexDecode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Base32::decodeUpper($str, true); @@ -183,7 +185,7 @@ public static function base32HexDecode( * @throws TypeError */ public static function base16Encode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Hex::encodeUpper($str); @@ -198,7 +200,7 @@ public static function base16Encode( * @return string */ public static function base16Decode( - #[\SensitiveParameter] + #[SensitiveParameter] string $str ): string { return Hex::decode($str, true); diff --git a/lib/Google/vendor/phpseclib/phpseclib/README.md b/lib/Google/vendor/phpseclib/phpseclib/README.md index 37cbcb9d5..c26edd49b 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/README.md +++ b/lib/Google/vendor/phpseclib/phpseclib/README.md @@ -51,7 +51,7 @@ SSH-2, SFTP, X.509, an arbitrary-precision integer arithmetic library, Ed25519 / * PHP4 compatible * Composer compatible (PSR-0 autoloading) * Install using Composer: `composer require phpseclib/phpseclib:~1.0` -* [Download 1.0.23 as ZIP](http://sourceforge.net/projects/phpseclib/files/phpseclib1.0.23.zip/download) +* [Download 1.0.24 as ZIP](http://sourceforge.net/projects/phpseclib/files/phpseclib1.0.24.zip/download) ## Security contact information @@ -63,14 +63,20 @@ Need Support? * [Checkout Questions and Answers on Stack Overflow](http://stackoverflow.com/questions/tagged/phpseclib) * [Create a Support Ticket on GitHub](https://github.com/phpseclib/phpseclib/issues/new) -* [Browse the Support Forum](http://www.frostjedi.com/phpbb/viewforum.php?f=46) (no longer in use) ## Special Thanks -Special Thanks to our $50+ sponsors!: +

+ + Sovereign Tech Agency + +

+ +## Additional Thanks - Allan Simon - [ChargeOver](https://chargeover.com/) +- ## Contributing diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Common/Functions/Strings.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Common/Functions/Strings.php index fa750ba28..ad8f63b65 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Common/Functions/Strings.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Common/Functions/Strings.php @@ -126,7 +126,9 @@ public static function unpackSSH2($format, &$data) // 64-bit floats can be used to get larger numbers then 32-bit signed ints would allow // for. sure, you're not gonna get the full precision of 64-bit numbers but just because // you need > 32-bit precision doesn't mean you need the full 64-bit precision - extract(unpack('Nupper/Nlower', self::shift($data, 8))); + $unpacked = unpack('Nupper/Nlower', self::shift($data, 8)); + $upper = $unpacked['upper']; + $lower = $unpacked['lower']; $temp = $upper ? 4294967296 * $upper : 0; $temp += $lower < 0 ? ($lower & 0x7FFFFFFFF) + 0x80000000 : $lower; // $temp = hexdec(bin2hex(self::shift($data, 8))); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php index 3cb2b3055..998cf8bb3 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php @@ -129,7 +129,7 @@ class Blowfish extends BlockCipher /** * Block Length of the cipher * - * @see \phpseclib3\Crypt\Common\SymmetricKey::block_size + * @see Common\SymmetricKey::block_size * @var int */ protected $block_size = 8; @@ -137,7 +137,7 @@ class Blowfish extends BlockCipher /** * The mcrypt specific name of the cipher * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt + * @see Common\SymmetricKey::cipher_name_mcrypt * @var string */ protected $cipher_name_mcrypt = 'blowfish'; @@ -145,7 +145,7 @@ class Blowfish extends BlockCipher /** * Optimizing value while CFB-encrypting * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len + * @see Common\SymmetricKey::cfb_init_len * @var int */ protected $cfb_init_len = 500; @@ -325,7 +325,7 @@ class Blowfish extends BlockCipher * derive this from $key_length or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu * of that, we'll just precompute it once.} * - * @see \phpseclib3\Crypt\Common\SymmetricKey::setKeyLength() + * @see Common\SymmetricKey::setKeyLength() * @var int */ protected $key_length = 16; @@ -368,7 +368,7 @@ public function setKeyLength($length) * * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * - * @see \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() + * @see Common\SymmetricKey::isValidEngine() * @param int $engine * @return bool */ @@ -394,7 +394,7 @@ protected function isValidEngineHelper($engine) /** * Setup the key (expansion) * - * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupKey() + * @see Common\SymmetricKey::_setupKey() */ protected function setupKey() { @@ -755,7 +755,7 @@ protected function decryptBlock($in) /** * Setup the performance-optimized function for de/encrypt() * - * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupInlineCrypt() + * @see Common\SymmetricKey::_setupInlineCrypt() */ protected function setupInlineCrypt() { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/JWK.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/JWK.php index 4c761b839..98b8dacc9 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/JWK.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/JWK.php @@ -50,6 +50,14 @@ public static function load($key, $password = '') return $key; } + if (!is_object($key)) { + throw new \RuntimeException('invalid JWK: not an object'); + } + + if (!isset($key->keys)) { + throw new \RuntimeException('invalid JWK: object has no property "keys"'); + } + if (count($key->keys) != 1) { throw new \RuntimeException('Although the JWK key format supports multiple keys phpseclib does not'); } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php index 6c9a65006..2211a8747 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php @@ -361,7 +361,9 @@ protected static function load($key, $password = '') if (!$temp) { throw new \RuntimeException('Unable to decode BER'); } - extract(ASN1::asn1map($temp[0], Maps\PBEParameter::MAP)); + $map = ASN1::asn1map($temp[0], Maps\PBEParameter::MAP); + $salt = $map['salt']; + $iterationCount = $map['iterationCount']; $iterationCount = (int) $iterationCount->toString(); $cipher->setPassword($password, $kdf, $hash, $salt, $iterationCount); $key = $cipher->decrypt($decrypted['encryptedData']); @@ -379,7 +381,8 @@ protected static function load($key, $password = '') throw new \RuntimeException('Unable to decode BER'); } $temp = ASN1::asn1map($temp[0], Maps\PBES2params::MAP); - extract($temp); + $keyDerivationFunc = $temp['keyDerivationFunc']; + $encryptionScheme = $temp['encryptionScheme']; $cipher = self::getPBES2EncryptionObject($encryptionScheme['algorithm']); $meta['meta']['cipher'] = $encryptionScheme['algorithm']; @@ -389,7 +392,8 @@ protected static function load($key, $password = '') throw new \RuntimeException('Unable to decode BER'); } $temp = ASN1::asn1map($temp[0], Maps\PBES2params::MAP); - extract($temp); + $keyDerivationFunc = $temp['keyDerivationFunc']; + $encryptionScheme = $temp['encryptionScheme']; if (!$cipher instanceof RC2) { $cipher->setIV($encryptionScheme['parameters']['octetString']); @@ -398,7 +402,9 @@ protected static function load($key, $password = '') if (!$temp) { throw new \RuntimeException('Unable to decode BER'); } - extract(ASN1::asn1map($temp[0], Maps\RC2CBCParameter::MAP)); + $map = ASN1::asn1map($temp[0], Maps\RC2CBCParameter::MAP); + $rc2ParametersVersion = $map['rc2ParametersVersion']; + $iv = $map['iv']; $effectiveKeyLength = (int) $rc2ParametersVersion->toString(); switch ($effectiveKeyLength) { case 160: @@ -423,9 +429,13 @@ protected static function load($key, $password = '') if (!$temp) { throw new \RuntimeException('Unable to decode BER'); } - $prf = ['algorithm' => 'id-hmacWithSHA1']; $params = ASN1::asn1map($temp[0], Maps\PBKDF2params::MAP); - extract($params); + if (empty($params['prf'])) { + $params['prf'] = ['algorithm' => 'id-hmacWithSHA1']; + } + $salt = $params['salt']; + $iterationCount = $params['iterationCount']; + $prf = $params['prf']; $meta['meta']['prf'] = $prf['algorithm']; $hash = str_replace('-', '/', substr($prf['algorithm'], 11)); $params = [ diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php index 85da83a73..ff4a95a82 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php @@ -199,7 +199,7 @@ public static function load($key, $password) $source = Strings::packSSH2('ssss', $type, $encryption, $components['comment'], $public); - extract(unpack('Nlength', Strings::shift($public, 4))); + $length = unpack('Nlength', Strings::shift($public, 4))['length']; $newtype = Strings::shift($public, $length); if ($newtype != $type) { throw new \RuntimeException('The binary type does not match the human readable type field'); @@ -227,7 +227,10 @@ public static function load($key, $password) $parallelism = trim(preg_replace('#Argon2-Parallelism: (\d+)#', '$1', $key[$offset++])); $salt = Strings::hex2bin(trim(preg_replace('#Argon2-Salt: ([0-9a-f]+)#', '$1', $key[$offset++]))); - extract(self::generateV3Key($password, $flavour, $memory, $passes, $salt)); + $v3key = self::generateV3Key($password, $flavour, $memory, $passes, $salt); + $symkey = $v3key['symkey']; + $symiv = $v3key['symiv']; + $hashkey = $v3key['hashkey']; break; case 2: @@ -323,7 +326,10 @@ protected static function wrapPrivateKey($public, $private, $type, $password, ar $key .= "Argon2-Passes: 13\r\n"; $key .= "Argon2-Parallelism: 1\r\n"; $key .= "Argon2-Salt: " . Strings::bin2hex($salt) . "\r\n"; - extract(self::generateV3Key($password, 'Argon2id', 8192, 13, $salt)); + $v3key = self::generateV3Key($password, 'Argon2id', 8192, 13, $salt); + $symkey = $v3key['symkey']; + $symiv = $v3key['symiv']; + $hashkey = $v3key['hashkey']; $hash = new Hash('sha256'); $hash->setKey($hashkey); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/StreamCipher.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/StreamCipher.php index 0d9690822..c7c080f4e 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/StreamCipher.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/StreamCipher.php @@ -26,7 +26,7 @@ abstract class StreamCipher extends SymmetricKey * * Stream ciphers do not have a block size * - * @see \phpseclib3\Crypt\Common\SymmetricKey::block_size + * @see SymmetricKey::block_size * @var int */ protected $block_size = 0; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php index 3b0383000..93d7ad2ed 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php @@ -68,7 +68,7 @@ class DES extends BlockCipher /** * Block Length of the cipher * - * @see \phpseclib3\Crypt\Common\SymmetricKey::block_size + * @see Common\SymmetricKey::block_size * @var int */ protected $block_size = 8; @@ -76,7 +76,7 @@ class DES extends BlockCipher /** * Key Length (in bytes) * - * @see \phpseclib3\Crypt\Common\SymmetricKey::setKeyLength() + * @see Common\SymmetricKey::setKeyLength() * @var int */ protected $key_length = 8; @@ -84,7 +84,7 @@ class DES extends BlockCipher /** * The mcrypt specific name of the cipher * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt + * @see Common\SymmetricKey::cipher_name_mcrypt * @var string */ protected $cipher_name_mcrypt = 'des'; @@ -92,7 +92,7 @@ class DES extends BlockCipher /** * The OpenSSL names of the cipher / modes * - * @see \phpseclib3\Crypt\Common\SymmetricKey::openssl_mode_names + * @see Common\SymmetricKey::openssl_mode_names * @var array */ protected $openssl_mode_names = [ @@ -106,7 +106,7 @@ class DES extends BlockCipher /** * Optimizing value while CFB-encrypting * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len + * @see Common\SymmetricKey::cfb_init_len * @var int */ protected $cfb_init_len = 500; @@ -586,7 +586,7 @@ public function __construct($mode) * * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * - * @see \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() + * @see Common\SymmetricKey::isValidEngine() * @param int $engine * @return bool */ @@ -615,7 +615,7 @@ protected function isValidEngineHelper($engine) * * DES also requires that every eighth bit be a parity bit, however, we'll ignore that. * - * @see \phpseclib3\Crypt\Common\SymmetricKey::setKey() + * @see Common\SymmetricKey::setKey() * @param string $key */ public function setKey($key) @@ -631,8 +631,8 @@ public function setKey($key) /** * Encrypts a block * - * @see \phpseclib3\Crypt\Common\SymmetricKey::encryptBlock() - * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see Common\SymmetricKey::encryptBlock() + * @see Common\SymmetricKey::encrypt() * @see self::encrypt() * @param string $in * @return string @@ -645,8 +645,8 @@ protected function encryptBlock($in) /** * Decrypts a block * - * @see \phpseclib3\Crypt\Common\SymmetricKey::decryptBlock() - * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + * @see Common\SymmetricKey::decryptBlock() + * @see Common\SymmetricKey::decrypt() * @see self::decrypt() * @param string $in * @return string @@ -747,7 +747,7 @@ private function processBlock($block, $mode) /** * Creates the key schedule * - * @see \phpseclib3\Crypt\Common\SymmetricKey::setupKey() + * @see Common\SymmetricKey::setupKey() */ protected function setupKey() { @@ -1281,7 +1281,7 @@ protected function setupKey() /** * Setup the performance-optimized function for de/encrypt() * - * @see \phpseclib3\Crypt\Common\SymmetricKey::setupInlineCrypt() + * @see Common\SymmetricKey::setupInlineCrypt() */ protected function setupInlineCrypt() { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PuTTY.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PuTTY.php index f6177f462..8549a2ec7 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PuTTY.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PuTTY.php @@ -56,7 +56,10 @@ public static function load($key, $password = '') if (!isset($components['private'])) { return $components; } - extract($components); + $type = $components['type']; + $comment = $components['comment']; + $public = $components['public']; + $private = $components['private']; unset($components['public'], $components['private']); list($p, $q, $g, $y) = Strings::unpackSSH2('iiii', $public); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php index 87cd77a7a..90252139d 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php @@ -88,7 +88,9 @@ public function sign($message) return $signature; } - extract(ASN1Signature::load($signature)); + $loaded = ASN1Signature::load($signature); + $r = $loaded['r']; + $s = $loaded['s']; return $format::save($r, $s); } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php index c14ffbdf5..3e16762b8 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php @@ -40,7 +40,8 @@ public function verify($message, $signature) if ($params === false || count($params) != 2) { return false; } - extract($params); + $r = $params['r']; + $s = $params['s']; if (self::$engines['OpenSSL'] && in_array($this->hash->getHash(), openssl_get_md_methods())) { $sig = $format != 'ASN1' ? ASN1Signature::save($r, $s) : $signature; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Montgomery.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Montgomery.php index b792e161d..431f9575c 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Montgomery.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Montgomery.php @@ -246,7 +246,7 @@ public function multiplyPoint(array $p, BigInteger $d) * * x=X/Z * - * @return \phpseclib3\Math\PrimeField\Integer[] + * @return PrimeInteger[] */ public function convertToInternal(array $p) { @@ -266,7 +266,7 @@ public function convertToInternal(array $p) /** * Returns the affine point * - * @return \phpseclib3\Math\PrimeField\Integer[] + * @return PrimeInteger[] */ public function convertToAffine(array $p) { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Prime.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Prime.php index 620040170..b1970557f 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Prime.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Prime.php @@ -751,7 +751,7 @@ private static function getJSFPoints(Integer $k1, Integer $k2) * To convert a Jacobian Coordinate to an Affine Point * you do (x / z^2, y / z^3) * - * @return \phpseclib3\Math\PrimeField\Integer[] + * @return PrimeInteger[] */ public function convertToAffine(array $p) { @@ -770,7 +770,7 @@ public function convertToAffine(array $p) /** * Converts an affine point to a jacobian coordinate * - * @return \phpseclib3\Math\PrimeField\Integer[] + * @return PrimeInteger[] */ public function convertToInternal(array $p) { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/TwistedEdwards.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/TwistedEdwards.php index 004406acf..99aa38b20 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/TwistedEdwards.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/TwistedEdwards.php @@ -171,7 +171,7 @@ public function getBasePoint() /** * Returns the affine point * - * @return PrimeField\Integer[] + * @return PrimeInteger[] */ public function convertToAffine(array $p) { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/XML.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/XML.php index b0cb12650..7f6cf6345 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/XML.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/XML.php @@ -71,6 +71,10 @@ public static function load($key, $password = '') $use_errors = libxml_use_internal_errors(true); + if (substr($key, 0, 5) != '' . $key . ''; + } + $temp = self::isolateNamespace($key, 'http://www.w3.org/2009/xmldsig11#'); if ($temp) { $key = $temp; @@ -82,9 +86,6 @@ public static function load($key, $password = '') } $dom = new \DOMDocument(); - if (substr($key, 0, 5) != '' . $key . ''; - } if (!$dom->loadXML($key)) { libxml_use_internal_errors($use_errors); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php index 91253b8fd..9947bb7d5 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php @@ -157,7 +157,10 @@ public function sign($message) return $signature; } - extract(ASN1Signature::load($signature)); + $loaded = ASN1Signature::load($signature); + $r = $loaded['r']; + $s = $loaded['s']; + return $this->formatSignature($r, $s); } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php index 4558ce34d..d34c6c4dd 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php @@ -115,7 +115,8 @@ public function verify($message, $signature) if ($params === false || count($params) != 2) { return false; } - extract($params); + $r = $params['r']; + $s = $params['s']; if (self::$engines['OpenSSL'] && in_array($this->hash->getHash(), openssl_get_md_methods())) { $sig = $format != 'ASN1' ? ASN1Signature::save($r, $s) : $signature; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Hash.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Hash.php index 09e48f960..cc5b42c08 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Hash.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Hash.php @@ -194,6 +194,15 @@ class Hash private static $maxwordrange128; /**#@-*/ + /**#@+ + * AES_CMAC variables + * + * @var string + */ + private $k1; + private $k2; + /**#@-*/ + /** * Default Constructor. * @@ -299,6 +308,14 @@ public function setHash($hash) $this->length = abs(substr($hash, -3)) >> 3; $this->algo = 'umac'; return; + case 'aes_cmac': + if ($oldHash != $this->hashParam) { + $this->recomputeAESKey = true; + } + $this->blockSize = 128; + $this->length = 16; + $this->algo = 'aes_cmac'; + return; case 'md2-96': case 'md5-96': case 'sha1-96': @@ -977,6 +994,69 @@ private static function L3Hash($k1, $k2, $m) public function hash($text) { $algo = $this->algo; + // https://www.rfc-editor.org/rfc/rfc4493.html + // https://en.wikipedia.org/wiki/One-key_MAC + if ($algo == 'aes_cmac') { + $constZero = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; + if ($this->recomputeAESKey) { + if (!is_string($this->key)) { + throw new InsufficientSetupException('No key has been set'); + } + if (strlen($this->key) != 16) { + throw new \LengthException('Key must be 16 bytes long'); + } + // Algorithm Generate_Subkey + $constRb = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x87"; + $this->c = new AES('ecb'); + $this->c->setKey($this->key); + $this->c->disablePadding(); + $l = $this->c->encrypt($constZero); + $msb = ($l & "\x80") == "\x80"; + $l = new BigInteger($l, 256); + $l->setPrecision(128); + $l = $l->bitwise_leftShift(1)->toBytes(); + // make it constant time + $k1 = $msb ? $l ^ $constRb : $l | $constZero; + + $msb = ($k1 & "\x80") == "\x80"; + $k2 = new BigInteger($k1, 256); + $k2->setPrecision(128); + $k2 = $k2->bitwise_leftShift(1)->toBytes(); + // make it constant time + $k2 = $msb ? $k2 ^ $constRb : $k2 | $constZero; + + $this->k1 = $k1; + $this->k2 = $k2; + } + + $len = strlen($text); + $const_Bsize = 16; + $M = strlen($text) ? str_split($text, $const_Bsize) : ['']; + + // Step 2 + $n = ceil($len / $const_Bsize); + // Step 3 + if ($n == 0) { + $n = 1; + $flag = false; + } else { + $flag = $len % $const_Bsize == 0; + } + // Step 4 + $M_last = $flag ? + $M[$n - 1] ^ $k1 : + self::OMAC_padding($M[$n - 1], $const_Bsize) ^ $k2; + // Step 5 + $x = $constZero; + // Step 6 + $c = &$this->c; + for ($i = 0; $i < $n - 1; $i++) { + $y = $x ^ $M[$i]; + $x = $c->encrypt($y); + } + $y = $M_last ^ $x; + return $c->encrypt($y); + } if ($algo == 'umac') { if ($this->recomputeAESKey) { if (!is_string($this->nonce)) { @@ -1790,6 +1870,17 @@ private static function sha512_64($m, $hash) return pack('J*', ...$hash); } + /** + * OMAC Padding + * + * @link https://www.rfc-editor.org/rfc/rfc4493.html#section-2.4 + */ + private static function OMAC_padding($m, $length) + { + $count = $length - strlen($m) - 1; + return "$m\x80" . str_repeat("\0", $count); + } + /** * __toString() magic method */ diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php index 61afbaeb6..36264080c 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php @@ -32,6 +32,7 @@ abstract class PublicKeyLoader * @return AsymmetricKey * @param string|array $key * @param string $password optional + * @throws NoKeyLoadedException if key is not valid */ public static function load($key, $password = false) { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php index 654c90642..175c52e7b 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php @@ -45,7 +45,7 @@ class RC2 extends BlockCipher /** * Block Length of the cipher * - * @see \phpseclib3\Crypt\Common\SymmetricKey::block_size + * @see Common\SymmetricKey::block_size * @var int */ protected $block_size = 8; @@ -53,7 +53,7 @@ class RC2 extends BlockCipher /** * The Key * - * @see \phpseclib3\Crypt\Common\SymmetricKey::key + * @see Common\SymmetricKey::key * @see self::setKey() * @var string */ @@ -62,7 +62,7 @@ class RC2 extends BlockCipher /** * The Original (unpadded) Key * - * @see \phpseclib3\Crypt\Common\SymmetricKey::key + * @see Common\SymmetricKey::key * @see self::setKey() * @see self::encrypt() * @see self::decrypt() @@ -81,7 +81,7 @@ class RC2 extends BlockCipher /** * The mcrypt specific name of the cipher * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt + * @see Common\SymmetricKey::cipher_name_mcrypt * @var string */ protected $cipher_name_mcrypt = 'rc2'; @@ -89,7 +89,7 @@ class RC2 extends BlockCipher /** * Optimizing value while CFB-encrypting * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len + * @see Common\SymmetricKey::cfb_init_len * @var int */ protected $cfb_init_len = 500; @@ -261,7 +261,7 @@ public function __construct($mode) * * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * - * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + * @see Common\SymmetricKey::__construct() * @param int $engine * @return bool */ @@ -323,7 +323,7 @@ public function getKeyLength() * has more then 128 bytes in it, and set $key to a single null byte if * it is empty. * - * @see \phpseclib3\Crypt\Common\SymmetricKey::setKey() + * @see Common\SymmetricKey::setKey() * @param string $key * @param int|boolean $t1 optional Effective key length in bits. * @throws \LengthException if the key length isn't supported @@ -426,8 +426,8 @@ public function decrypt($ciphertext) /** * Encrypts a block * - * @see \phpseclib3\Crypt\Common\SymmetricKey::encryptBlock() - * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see Common\SymmetricKey::encryptBlock() + * @see Common\SymmetricKey::encrypt() * @param string $in * @return string */ @@ -470,8 +470,8 @@ protected function encryptBlock($in) /** * Decrypts a block * - * @see \phpseclib3\Crypt\Common\SymmetricKey::decryptBlock() - * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + * @see Common\SymmetricKey::decryptBlock() + * @see Common\SymmetricKey::decrypt() * @param string $in * @return string */ @@ -514,7 +514,7 @@ protected function decryptBlock($in) /** * Creates the key schedule * - * @see \phpseclib3\Crypt\Common\SymmetricKey::setupKey() + * @see Common\SymmetricKey::setupKey() */ protected function setupKey() { @@ -534,7 +534,7 @@ protected function setupKey() /** * Setup the performance-optimized function for de/encrypt() * - * @see \phpseclib3\Crypt\Common\SymmetricKey::setupInlineCrypt() + * @see Common\SymmetricKey::setupInlineCrypt() */ protected function setupInlineCrypt() { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC4.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC4.php index 5f3bff2c0..98cf01165 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC4.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC4.php @@ -72,7 +72,7 @@ class RC4 extends StreamCipher /** * The mcrypt specific name of the cipher * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt + * @see Common\SymmetricKey::cipher_name_mcrypt * @var string */ protected $cipher_name_mcrypt = 'arcfour'; @@ -98,7 +98,7 @@ class RC4 extends StreamCipher * * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * - * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + * @see Common\SymmetricKey::__construct() * @param int $engine * @return bool */ @@ -159,7 +159,7 @@ public function setKey($key) /** * Encrypts a message. * - * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + * @see Common\SymmetricKey::decrypt() * @see self::crypt() * @param string $plaintext * @return string $ciphertext @@ -178,7 +178,7 @@ public function encrypt($plaintext) * $this->decrypt($this->encrypt($plaintext)) == $this->encrypt($this->encrypt($plaintext)). * At least if the continuous buffer is disabled. * - * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see Common\SymmetricKey::encrypt() * @see self::crypt() * @param string $ciphertext * @return string $plaintext @@ -214,7 +214,7 @@ protected function decryptBlock($in) /** * Setup the key (expansion) * - * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupKey() + * @see Common\SymmetricKey::_setupKey() */ protected function setupKey() { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php index 9cbe6bfc7..0a11957b0 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php @@ -357,10 +357,9 @@ public static function createKey($bits = 2048) if ($i != $num_primes) { $primes[$i] = BigInteger::randomPrime($regSize); } else { - extract(BigInteger::minMaxBits($bits)); - /** @var BigInteger $min - * @var BigInteger $max - */ + $minMax = BigInteger::minMaxBits($bits); + $min = $minMax['min']; + $max = $minMax['max']; list($min) = $min->divide($n); $min = $min->add(self::$one); list($max) = $max->divide($n); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php index b60e48ea5..035fc8c38 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php @@ -88,13 +88,11 @@ public static function load($key, $password = '') // PUBLICKEYSTRUC publickeystruc // https://msdn.microsoft.com/en-us/library/windows/desktop/aa387453(v=vs.85).aspx - extract(unpack('atype/aversion/vreserved/Valgo', Strings::shift($key, 8))); - /** - * @var string $type - * @var string $version - * @var integer $reserved - * @var integer $algo - */ + $unpacked = unpack('atype/aversion/vreserved/Valgo', Strings::shift($key, 8)); + $type = $unpacked['type']; + $version = $unpacked['version']; + $reserved = $unpacked['reserved']; + $algo = $unpacked['algo']; switch (ord($type)) { case self::PUBLICKEYBLOB: case self::PUBLICKEYBLOBEX: @@ -121,12 +119,10 @@ public static function load($key, $password = '') // RSAPUBKEY rsapubkey // https://msdn.microsoft.com/en-us/library/windows/desktop/aa387685(v=vs.85).aspx // could do V for pubexp but that's unsigned 32-bit whereas some PHP installs only do signed 32-bit - extract(unpack('Vmagic/Vbitlen/a4pubexp', Strings::shift($key, 12))); - /** - * @var integer $magic - * @var integer $bitlen - * @var string $pubexp - */ + $unpacked = unpack('Vmagic/Vbitlen/a4pubexp', Strings::shift($key, 12)); + $magic = $unpacked['magic']; + $bitlen = $unpacked['bitlen']; + $pubexp = $unpacked['pubexp']; switch ($magic) { case self::RSA2: $components['isPublicKey'] = false; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS1.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS1.php index 76335567f..68d92701e 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS1.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS1.php @@ -96,6 +96,20 @@ public static function load($key, $password = '') $components['isPublicKey'] = true; } + $components = $components + $key; + foreach ($components as &$val) { + if ($val instanceof BigInteger) { + $val = self::makePositive($val); + } + if (is_array($val)) { + foreach ($val as &$subval) { + if ($subval instanceof BigInteger) { + $subval = self::makePositive($subval); + } + } + } + } + return $components + $key; } @@ -157,4 +171,17 @@ public static function savePublicKey(BigInteger $n, BigInteger $e) return self::wrapPublicKey($key, 'RSA'); } + + /** + * Negative numbers make no sense in RSA so convert them to positive + * + * @param BigInteger $x + * @return string + */ + private static function makePositive(BigInteger $x) + { + return $x->isNegative() ? + new BigInteger($x->toBytes(true), 256) : + $x; + } } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php index 293903cef..8416758c2 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php @@ -56,7 +56,10 @@ public static function load($key, $password = '') if (!isset($components['private'])) { return $components; } - extract($components); + $type = $components['type']; + $comment = $components['comment']; + $public = $components['public']; + $private = $components['private']; unset($components['public'], $components['private']); $isPublicKey = false; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php index ff31f9c88..5ba7cf7fe 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php @@ -74,8 +74,8 @@ class Rijndael extends BlockCipher * or not for the current $block_size/$key_length. * In case of, $cipher_name_mcrypt will be set dynamically at run time accordingly. * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt - * @see \phpseclib3\Crypt\Common\SymmetricKey::engine + * @see Common\SymmetricKey::cipher_name_mcrypt + * @see Common\SymmetricKey::engine * @see self::isValidEngine() * @var string */ diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php index 1ff5ed02b..932b7c611 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php @@ -66,8 +66,8 @@ class TripleDES extends DES /** * The mcrypt specific name of the cipher * - * @see \phpseclib3\Crypt\DES::cipher_name_mcrypt - * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt + * @see DES::cipher_name_mcrypt + * @see Common\SymmetricKey::cipher_name_mcrypt * @var string */ protected $cipher_name_mcrypt = 'tripledes'; @@ -75,7 +75,7 @@ class TripleDES extends DES /** * Optimizing value while CFB-encrypting * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len + * @see Common\SymmetricKey::cfb_init_len * @var int */ protected $cfb_init_len = 750; @@ -84,7 +84,7 @@ class TripleDES extends DES * max possible size of $key * * @see self::setKey() - * @see \phpseclib3\Crypt\DES::setKey() + * @see DES::setKey() * @var string */ protected $key_length_max = 24; @@ -126,8 +126,8 @@ class TripleDES extends DES * * - cbc3 (same as cbc) * - * @see \phpseclib3\Crypt\DES::__construct() - * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + * @see Crypt\DES::__construct() + * @see Common\SymmetricKey::__construct() * @param string $mode */ public function __construct($mode) @@ -169,7 +169,7 @@ public function __construct($mode) * * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * - * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + * @see Common\SymmetricKey::__construct() * @param int $engine * @return bool */ @@ -189,7 +189,7 @@ protected function isValidEngineHelper($engine) * * SetIV is not required when \phpseclib3\Crypt\Common\SymmetricKey::MODE_ECB is being used. * - * @see \phpseclib3\Crypt\Common\SymmetricKey::setIV() + * @see Common\SymmetricKey::setIV() * @param string $iv */ public function setIV($iv) @@ -209,7 +209,7 @@ public function setIV($iv) * * If you want to use a 64-bit key use DES.php * - * @see \phpseclib3\Crypt\Common\SymmetricKey:setKeyLength() + * @see Common\SymmetricKey:setKeyLength() * @throws \LengthException if the key length is invalid * @param int $length */ @@ -233,8 +233,8 @@ public function setKeyLength($length) * * DES also requires that every eighth bit be a parity bit, however, we'll ignore that. * - * @see \phpseclib3\Crypt\DES::setKey() - * @see \phpseclib3\Crypt\Common\SymmetricKey::setKey() + * @see DES::setKey() + * @see Common\SymmetricKey::setKey() * @throws \LengthException if the key length is invalid * @param string $key */ @@ -270,7 +270,7 @@ public function setKey($key) /** * Encrypts a message. * - * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see Common\SymmetricKey::encrypt() * @param string $plaintext * @return string $cipertext */ @@ -296,7 +296,7 @@ public function encrypt($plaintext) /** * Decrypts a message. * - * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + * @see Common\SymmetricKey::decrypt() * @param string $ciphertext * @return string $plaintext */ @@ -351,7 +351,7 @@ public function decrypt($ciphertext) * continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them), * however, they are also less intuitive and more likely to cause you problems. * - * @see \phpseclib3\Crypt\Common\SymmetricKey::enableContinuousBuffer() + * @see Common\SymmetricKey::enableContinuousBuffer() * @see self::disableContinuousBuffer() */ public function enableContinuousBuffer() @@ -369,7 +369,7 @@ public function enableContinuousBuffer() * * The default behavior. * - * @see \phpseclib3\Crypt\Common\SymmetricKey::disableContinuousBuffer() + * @see Common\SymmetricKey::disableContinuousBuffer() * @see self::enableContinuousBuffer() */ public function disableContinuousBuffer() @@ -385,8 +385,8 @@ public function disableContinuousBuffer() /** * Creates the key schedule * - * @see \phpseclib3\Crypt\DES::setupKey() - * @see \phpseclib3\Crypt\Common\SymmetricKey::setupKey() + * @see DES::setupKey() + * @see Common\SymmetricKey::setupKey() */ protected function setupKey() { @@ -419,8 +419,8 @@ protected function setupKey() /** * Sets the internal crypt engine * - * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() - * @see \phpseclib3\Crypt\Common\SymmetricKey::setPreferredEngine() + * @see Common\SymmetricKey::__construct() + * @see Common\SymmetricKey::setPreferredEngine() * @param int $engine */ public function setPreferredEngine($engine) diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php index bf765632a..141ad0141 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php @@ -49,7 +49,7 @@ class Twofish extends BlockCipher /** * The mcrypt specific name of the cipher * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt + * @see Common\SymmetricKey::cipher_name_mcrypt * @var string */ protected $cipher_name_mcrypt = 'twofish'; @@ -57,7 +57,7 @@ class Twofish extends BlockCipher /** * Optimizing value while CFB-encrypting * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len + * @see Common\SymmetricKey::cfb_init_len * @var int */ protected $cfb_init_len = 800; @@ -431,7 +431,7 @@ public function setKey($key) /** * Setup the key (expansion) * - * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupKey() + * @see Common\SymmetricKey::_setupKey() */ protected function setupKey() { @@ -700,7 +700,7 @@ protected function decryptBlock($in) /** * Setup the performance-optimized function for de/encrypt() * - * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupInlineCrypt() + * @see Common\SymmetricKey::_setupInlineCrypt() */ protected function setupInlineCrypt() { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php index c4b06a560..685a7cde0 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php @@ -273,8 +273,7 @@ private static function decode_ber($encoded, $start = 0, $encoded_pos = 0) // tags of indefinte length don't really have a header length; this length includes the tag $current += ['headerlength' => $length + 2]; $start += $length; - extract(unpack('Nlength', substr(str_pad($temp, 4, chr(0), STR_PAD_LEFT), -4))); - /** @var integer $length */ + $length = unpack('Nlength', substr(str_pad($temp, 4, chr(0), STR_PAD_LEFT), -4))['length']; } else { $current += ['headerlength' => 2]; } @@ -793,7 +792,11 @@ public static function asn1map(array $decoded, $mapping, $special = []) $temp = new BigInteger($decoded['content'], -256); } if (isset($mapping['mapping'])) { - $temp = (int) $temp->toString(); + $temp = $temp->toString(); + if (strlen($temp) > 1) { + return false; + } + $temp = (int) $temp; return isset($mapping['mapping'][$temp]) ? $mapping['mapping'][$temp] : false; @@ -931,7 +934,19 @@ private static function encode_der($source, array $mapping, $idx = null, array $ an untagged "DummyReference" (see ITU-T Rec. X.683 | ISO/IEC 8824-4, 8.3)." */ if (isset($child['explicit']) || $child['type'] == self::TYPE_CHOICE) { - $subtag = chr((self::CLASS_CONTEXT_SPECIFIC << 6) | 0x20 | $child['constant']); + if ($child['constant'] <= 30) { + $subtag = chr((self::CLASS_CONTEXT_SPECIFIC << 6) | 0x20 | $child['constant']); + } else { + $constant = $child['constant']; + $subtag = ''; + while ($constant > 0) { + $subtagvalue = $constant & 0x7F; + $subtag = (chr(0x80 | $subtagvalue)) . $subtag; + $constant = $constant >> 7; + } + $subtag[strlen($subtag) - 1] = $subtag[strlen($subtag) - 1] & chr(0x7F); + $subtag = chr((self::CLASS_CONTEXT_SPECIFIC << 6) | 0x20 | 0x1f) . $subtag; + } $temp = $subtag . self::encodeLength(strlen($temp)) . $temp; } else { $subtag = chr((self::CLASS_CONTEXT_SPECIFIC << 6) | (ord($temp[0]) & 0x20) | $child['constant']); @@ -1140,6 +1155,8 @@ private static function encode_der($source, array $mapping, $idx = null, array $ */ public static function decodeOID($content) { + // BigInteger's are used because of OIDs like 2.25.329800735698586629295641978511506172918 + // https://healthcaresecprivacy.blogspot.com/2011/02/creating-and-using-unique-id-uuid-oid.html elaborates. static $eighty; if (!$eighty) { $eighty = new BigInteger(80); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/X509.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/X509.php index 00504f15d..80e0bab10 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/X509.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/X509.php @@ -626,7 +626,9 @@ private function mapOutExtensions(array &$root, $path) $extensions = &$this->subArray($root, $path, !empty($this->extensionValues)); foreach ($this->extensionValues as $id => $data) { - extract($data); + $critical = $data['critical']; + $replace = $data['replace']; + $value = $data['value']; $newext = [ 'extnId' => $id, 'extnValue' => $value, @@ -1858,7 +1860,7 @@ public function getDN($format = self::DN_ARRAY, $dn = null) $dn = $this->getDN(self::DN_CANON, $dn); $hash = new Hash('sha1'); $hash = $hash->hash($dn); - extract(unpack('Vhash', $hash)); + $hash = unpack('Vhash', $hash)['hash']; return strtolower(Strings::bin2hex(pack('N', $hash))); } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php index 2a9cc0b43..a1ea0aebd 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php @@ -143,6 +143,11 @@ private static function initialize_static_variables() ['PHP64', ['DefaultEngine']], ['PHP32', ['DefaultEngine']] ]; + // per https://phpseclib.com/docs/speed PHP 8.4.0+ _significantly_ sped up BCMath + if (version_compare(PHP_VERSION, '8.4.0') >= 0) { + $engines[1][0] = 'BCMath'; + $engines[2][0] = 'PHP64'; + } foreach ($engines as $engine) { try { @@ -333,12 +338,10 @@ public function modInverse(BigInteger $n) */ public function extendedGCD(BigInteger $n) { - extract($this->value->extendedGCD($n->value)); - /** - * @var BigInteger $gcd - * @var BigInteger $x - * @var BigInteger $y - */ + $extended = $this->value->extendedGCD($n->value); + $gcd = $extended['gcd']; + $x = $extended['x']; + $y = $extended['y']; return [ 'gcd' => new static($gcd), 'x' => new static($x), @@ -399,7 +402,7 @@ public function getPrecision() * * Will be called, automatically, when serialize() is called on a BigInteger object. * - * __sleep() / __wakeup() have been around since PHP 4.0 + * __sleep() / __wakeup() have been around since PHP 4.0 but were deprecated in PHP 8.5 * * \Serializable was introduced in PHP 5.1 and deprecated in PHP 8.1: * https://wiki.php.net/rfc/phase_out_serializable @@ -434,6 +437,38 @@ public function __wakeup() } } + /** + * __serialize() magic method + * + * @see self::__unserialize() + * @return array + * @access public + */ + public function __serialize() + { + $result = ['hex' => $this->toHex(true)]; + if ($this->getPrecision() > 0) { + $result['precision'] = $this->getPrecision(); + } + return $result; + } + + /** + * __unserialize() magic method + * + * @see self::__serialize() + * @access public + */ + public function __unserialize(array $data) + { + $temp = new static($data['hex'], -16); + $this->value = $temp->value; + if (isset($data['precision']) && $data['precision'] > 0) { + // recalculate $this->bitmask + $this->setPrecision($data['precision']); + } + } + /** * JSON Serialize * @@ -617,10 +652,9 @@ public static function minMaxBits($bits) self::initialize_static_variables(); $class = self::$mainEngine; - extract($class::minMaxBits($bits)); - /** @var BigInteger $min - * @var BigInteger $max - */ + $minMax = $class::minMaxBits($bits); + $min = $minMax['min']; + $max = $minMax['max']; return [ 'min' => new static($min), 'max' => new static($max) diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath.php index e3a49906b..7b6283002 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath.php @@ -38,6 +38,11 @@ class BCMath extends Engine */ const ENGINE_DIR = 'BCMath'; + /** + * Test to see if bcmod() accepts 2 or 3 parameters + */ + const BCMOD_THREE_PARAMS = PHP_VERSION_ID >= 72000; + /** * Test for engine validity * @@ -148,7 +153,7 @@ public function toBytes($twos_compliment = false) } while (bccomp($current, '0', 0) > 0) { - $temp = bcmod($current, '16777216'); + $temp = self::BCMOD_THREE_PARAMS ? bcmod($current, '16777216', 0) : bcmod($current, '16777216'); $value = chr($temp >> 16) . chr($temp >> 8) . chr($temp) . $value; $current = bcdiv($current, '16777216', 0); } @@ -167,7 +172,7 @@ public function toBytes($twos_compliment = false) public function add(BCMath $y) { $temp = new self(); - $temp->value = bcadd($this->value, $y->value); + $temp->value = bcadd($this->value, $y->value, 0); return $this->normalize($temp); } @@ -181,7 +186,7 @@ public function add(BCMath $y) public function subtract(BCMath $y) { $temp = new self(); - $temp->value = bcsub($this->value, $y->value); + $temp->value = bcsub($this->value, $y->value, 0); return $this->normalize($temp); } @@ -195,7 +200,7 @@ public function subtract(BCMath $y) public function multiply(BCMath $x) { $temp = new self(); - $temp->value = bcmul($this->value, $x->value); + $temp->value = bcmul($this->value, $x->value, 0); return $this->normalize($temp); } @@ -217,7 +222,7 @@ public function divide(BCMath $y) $remainder = new self(); $quotient->value = bcdiv($this->value, $y->value, 0); - $remainder->value = bcmod($this->value, $y->value); + $remainder->value = self::BCMOD_THREE_PARAMS ? bcmod($this->value, $y->value, 0) : bcmod($this->value, $y->value); if ($remainder->value[0] == '-') { $remainder->value = bcadd($remainder->value, $y->value[0] == '-' ? substr($y->value, 1) : $y->value, 0); @@ -297,8 +302,7 @@ public function extendedGCD(BCMath $n) */ public function gcd(BCMath $n) { - extract($this->extendedGCD($n)); - /** @var BCMath $gcd */ + $gcd = $this->extendedGCD($n)['gcd']; return $gcd; } @@ -475,7 +479,7 @@ protected function normalize(BCMath $result) $result->bitmask = $this->bitmask; if ($result->bitmask !== false) { - $result->value = bcmod($result->value, $result->bitmask->value); + $result->value = self::BCMOD_THREE_PARAMS ? bcmod($result->value, $result->bitmask->value, 0) : bcmod($result->value, $result->bitmask->value); } return $result; @@ -523,7 +527,7 @@ public static function randomRange(BCMath $min, BCMath $max) protected function make_odd() { if (!$this->isOdd()) { - $this->value = bcadd($this->value, '1'); + $this->value = bcadd($this->value, '1', 0); } } @@ -547,7 +551,7 @@ protected function testSmallPrimes() $value = $this->value; foreach (self::PRIMES as $prime) { - $r = bcmod($this->value, $prime); + $r = self::BCMOD_THREE_PARAMS ? bcmod($this->value, $prime, 0) : bcmod($this->value, $prime); if ($r == '0') { return $this->value == $prime; } @@ -587,7 +591,7 @@ public static function scan1divide(BCMath $r) public function pow(BCMath $n) { $temp = new self(); - $temp->value = bcpow($this->value, $n->value); + $temp->value = bcpow($this->value, $n->value, 0); return $this->normalize($temp); } @@ -656,8 +660,9 @@ public function isOdd() */ public function testBit($x) { + $divisor = bcpow('2', $x + 1, 0); return bccomp( - bcmod($this->value, bcpow('2', $x + 1, 0)), + self::BCMOD_THREE_PARAMS ? bcmod($this->value, $divisor, 0) : bcmod($this->value, $divisor), bcpow('2', $x, 0), 0 ) >= 0; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Base.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Base.php index fe21e0411..88cd93e94 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Base.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Base.php @@ -91,7 +91,7 @@ protected static function prepareReduce($x, $n, $class) */ protected static function multiplyReduce($x, $y, $n, $class) { - return static::reduce(bcmul($x, $y), $n); + return static::reduce(bcmul($x, $y, 0), $n); } /** @@ -105,6 +105,6 @@ protected static function multiplyReduce($x, $y, $n, $class) */ protected static function squareReduce($x, $n, $class) { - return static::reduce(bcmul($x, $x), $n); + return static::reduce(bcmul($x, $x, 0), $n); } } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php index b7ca8a2c6..f8bbcfa27 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php @@ -33,7 +33,7 @@ abstract class BuiltIn extends BCMath protected static function powModHelper(BCMath $x, BCMath $e, BCMath $n) { $temp = new BCMath(); - $temp->value = bcpowmod($x->value, $e->value, $n->value); + $temp->value = bcpowmod($x->value, $e->value, $n->value, 0); return $x->normalize($temp); } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php index 9e01bf005..1bec0a11f 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php @@ -67,7 +67,7 @@ protected static function reduce($n, $m) $m_length = strlen($m); if (strlen($n) > 2 * $m_length) { - return bcmod($n, $m); + return self::BCMOD_THREE_PARAMS ? bcmod($n, $m, 0) : bcmod($n, $m); } // if (m.length >> 1) + 2 <= m.length then m is too small and n can't be reduced @@ -89,14 +89,16 @@ protected static function reduce($n, $m) $lhs = '1' . str_repeat('0', $m_length + ($m_length >> 1)); $u = bcdiv($lhs, $m, 0); - $m1 = bcsub($lhs, bcmul($u, $m)); + $m1 = bcsub($lhs, bcmul($u, $m, 0), 0); $cache[self::DATA][] = [ 'u' => $u, // m.length >> 1 (technically (m.length >> 1) + 1) 'm1' => $m1 // m.length ]; } else { - extract($cache[self::DATA][$key]); + $cacheValues = $cache[self::DATA][$key]; + $u = $cacheValues['u']; + $m1 = $cacheValues['m1']; } $cutoff = $m_length + ($m_length >> 1); @@ -104,8 +106,8 @@ protected static function reduce($n, $m) $lsd = substr($n, -$cutoff); $msd = substr($n, 0, -$cutoff); - $temp = bcmul($msd, $m1); // m.length + (m.length >> 1) - $n = bcadd($lsd, $temp); // m.length + (m.length >> 1) + 1 (so basically we're adding two same length numbers) + $temp = bcmul($msd, $m1, 0); // m.length + (m.length >> 1) + $n = bcadd($lsd, $temp, 0); // m.length + (m.length >> 1) + 1 (so basically we're adding two same length numbers) //if ($m_length & 1) { // return self::regularBarrett($n, $m); //} @@ -114,31 +116,31 @@ protected static function reduce($n, $m) $temp = substr($n, 0, -$m_length + 1); // if even: ((m.length >> 1) + 2) + (m.length >> 1) == m.length + 2 // if odd: ((m.length >> 1) + 2) + (m.length >> 1) == (m.length - 1) + 2 == m.length + 1 - $temp = bcmul($temp, $u); + $temp = bcmul($temp, $u, 0); // if even: (m.length + 2) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) + 1 // if odd: (m.length + 1) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) $temp = substr($temp, 0, -($m_length >> 1) - 1); // if even: (m.length - (m.length >> 1) + 1) + m.length = 2 * m.length - (m.length >> 1) + 1 // if odd: (m.length - (m.length >> 1)) + m.length = 2 * m.length - (m.length >> 1) - $temp = bcmul($temp, $m); + $temp = bcmul($temp, $m, 0); // at this point, if m had an odd number of digits, we'd be subtracting a 2 * m.length - (m.length >> 1) digit // number from a m.length + (m.length >> 1) + 1 digit number. ie. there'd be an extra digit and the while loop // following this comment would loop a lot (hence our calling _regularBarrett() in that situation). - $result = bcsub($n, $temp); + $result = bcsub($n, $temp, 0); //if (bccomp($result, '0') < 0) { if ($result[0] == '-') { $temp = '1' . str_repeat('0', $m_length + 1); - $result = bcadd($result, $temp); + $result = bcadd($result, $temp, 0); } - while (bccomp($result, $m) >= 0) { - $result = bcsub($result, $m); + while (bccomp($result, $m, 0) >= 0) { + $result = bcsub($result, $m, 0); } - return $correctionNeeded ? substr($result, 0, -1) : $result; + return $correctionNeeded && $result != '0' ? substr($result, 0, -1) : $result; } /** @@ -161,7 +163,7 @@ private static function regularBarrett($x, $n) $n_length = strlen($n); if (strlen($x) > 2 * $n_length) { - return bcmod($x, $n); + return self::BCMOD_THREE_PARAMS ? bcmod($x, $n, 0) : bcmod($x, $n); } if (($key = array_search($n, $cache[self::VARIABLE])) === false) { @@ -172,21 +174,21 @@ private static function regularBarrett($x, $n) } $temp = substr($x, 0, -$n_length + 1); - $temp = bcmul($temp, $cache[self::DATA][$key]); + $temp = bcmul($temp, $cache[self::DATA][$key], 0); $temp = substr($temp, 0, -$n_length - 1); $r1 = substr($x, -$n_length - 1); - $r2 = substr(bcmul($temp, $n), -$n_length - 1); + $r2 = substr(bcmul($temp, $n, 0), -$n_length - 1); $result = bcsub($r1, $r2); //if (bccomp($result, '0') < 0) { if ($result[0] == '-') { $q = '1' . str_repeat('0', $n_length + 1); - $result = bcadd($result, $q); + $result = bcadd($result, $q, 0); } - while (bccomp($result, $n) >= 0) { - $result = bcsub($result, $n); + while (bccomp($result, $n, 0) >= 0) { + $result = bcsub($result, $n, 0); } return $result; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php index e033ba575..040d7b5a7 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php @@ -58,7 +58,7 @@ protected static function generateCustomReduction(BCMath $m, $class) $m_length = strlen($m); if ($m_length < 5) { - $code = 'return bcmod($x, $n);'; + $code = 'return self::BCMOD_THREE_PARAMS ? bcmod($x, $n, 0) : bcmod($x, $n);'; eval('$func = function ($n) { ' . $code . '};'); self::$custom_reduction = $func; return; @@ -66,7 +66,7 @@ protected static function generateCustomReduction(BCMath $m, $class) $lhs = '1' . str_repeat('0', $m_length + ($m_length >> 1)); $u = bcdiv($lhs, $m, 0); - $m1 = bcsub($lhs, bcmul($u, $m)); + $m1 = bcsub($lhs, bcmul($u, $m, 0), 0); $cutoff = $m_length + ($m_length >> 1); @@ -78,23 +78,23 @@ protected static function generateCustomReduction(BCMath $m, $class) $lsd = substr($n, -' . $cutoff . '); $msd = substr($n, 0, -' . $cutoff . '); - $temp = bcmul($msd, ' . $m1 . '); - $n = bcadd($lsd, $temp); + $temp = bcmul($msd, ' . $m1 . ', 0); + $n = bcadd($lsd, $temp, 0); $temp = substr($n, 0, ' . (-$m_length + 1) . '); - $temp = bcmul($temp, ' . $u . '); + $temp = bcmul($temp, ' . $u . ', 0); $temp = substr($temp, 0, ' . (-($m_length >> 1) - 1) . '); - $temp = bcmul($temp, ' . $m . '); + $temp = bcmul($temp, ' . $m . ', 0); - $result = bcsub($n, $temp); + $result = bcsub($n, $temp, 0); if ($result[0] == \'-\') { $temp = \'1' . str_repeat('0', $m_length + 1) . '\'; - $result = bcadd($result, $temp); + $result = bcadd($result, $temp, 0); } while (bccomp($result, ' . $m . ') >= 0) { - $result = bcsub($result, ' . $m . '); + $result = bcsub($result, ' . $m . ', 0); } return $result;'; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php index 474abe105..ef3dcac9a 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php @@ -316,11 +316,9 @@ protected function modInverseHelper(Engine $n) return $this->normalize($n->subtract($temp)); } - extract($this->extendedGCD($n)); - /** - * @var Engine $gcd - * @var Engine $x - */ + $extended = $this->extendedGCD($n); + $gcd = $extended['gcd']; + $x = $extended['x']; if (!$gcd->equals(static::$one[static::class])) { return false; @@ -366,6 +364,44 @@ public function __wakeup() } } + /** + * __serialize() magic method + * + * __sleep / __wakeup were depreciated in PHP 8.5 + * Will be called, automatically, when serialize() is called on a Math_BigInteger object. + * + * @see self::__unserialize() + * @access public + */ + public function __serialize() + { + $result = ['hex' => $this->toHex(true)]; + if ($this->precision > 0) { + $result['precision'] = $this->precision; + } + return $result; + } + + /** + * __unserialize() magic method + * + * __sleep / __wakeup were depreciated in PHP 8.5 + * Will be called, automatically, when unserialize() is called on a Math_BigInteger object. + * + * @see self::__serialize() + * @access public + */ + public function __unserialize(array $data) + { + $temp = new static($data['hex'], -16); + $this->value = $temp->value; + $this->is_negative = $temp->is_negative; + if (isset($data['precision']) && $data['precision'] > 0) { + // recalculate $this->bitmask + $this->setPrecision($data['precision']); + } + } + /** * JSON Serialize * @@ -644,7 +680,7 @@ protected function powModOuter(Engine $e, Engine $n) return $this->normalize($temp->powModInner($e, $n)); } - if ($this->compare($n) > 0) { + if ($this->compare($n) > 0 || $this->isNegative()) { list(, $temp) = $this->divide($n); return $temp->powModInner($e, $n); } @@ -740,11 +776,9 @@ protected static function slidingWindow(Engine $x, Engine $e, Engine $n, $class) */ public static function random($size) { - extract(static::minMaxBits($size)); - /** - * @var BigInteger $min - * @var BigInteger $max - */ + $minMax = static::minMaxBits($size); + $min = $minMax['min']; + $max = $minMax['max']; return static::randomRange($min, $max); } @@ -758,11 +792,9 @@ public static function random($size) */ public static function randomPrime($size) { - extract(static::minMaxBits($size)); - /** - * @var static $min - * @var static $max - */ + $minMax = static::minMaxBits($size); + $min = $minMax['min']; + $max = $minMax['max']; return static::randomRangePrime($min, $max); } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP.php index f61636297..0db43ae63 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP.php @@ -296,7 +296,10 @@ public function modInverse(GMP $n) */ public function extendedGCD(GMP $n) { - extract(gmp_gcdext($this->value, $n->value)); + $extended = gmp_gcdext($this->value, $n->value); + $g = $extended['g']; + $s = $extended['s']; + $t = $extended['t']; return [ 'gcd' => $this->normalize(new self($g)), diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php index 2d8959522..de556a3b2 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php @@ -533,6 +533,9 @@ protected function divideHelper(PHP $y) $quotient = new static(); $remainder = new static(); $quotient->value = $q; + if ($this->is_negative) { + $r = $y->value[0] - $r; + } $remainder->value = [$r]; $quotient->is_negative = $this->is_negative != $y->is_negative; return [$this->normalize($quotient), $this->normalize($remainder)]; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php index 886896618..e624f3cad 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php @@ -98,7 +98,9 @@ protected static function reduce(array $n, array $m, $class) 'm1' => $m1 // m.length ]; } else { - extract($cache[self::DATA][$key]); + $cacheValues = $cache[self::DATA][$key]; + $u = $cacheValues['u']; + $m1 = $cacheValues['m1']; } $cutoff = $m_length + ($m_length >> 1); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php index 15eb99c7d..1ebb2f5d7 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php @@ -54,10 +54,24 @@ class Integer extends Base /** * Zero * - * @var BigInteger + * @var BigInteger[] */ protected static $zero; + /** + * One + * + * @var BigInteger[] + */ + protected static $one; + + /** + * Two + * + * @var BigInteger[] + */ + protected static $two; + /** * Default constructor * @@ -68,7 +82,7 @@ public function __construct($instanceID, $num = null) { $this->instanceID = $instanceID; if (!isset($num)) { - $this->value = clone static::$zero[static::class]; + $this->value = clone static::$zero[$instanceID]; } else { $reduce = static::$reduce[$instanceID]; $this->value = $reduce($num); @@ -95,8 +109,8 @@ public static function setModulo($instanceID, BigInteger $modulo) public static function setRecurringModuloFunction($instanceID, callable $function) { static::$reduce[$instanceID] = $function; - if (!isset(static::$zero[static::class])) { - static::$zero[static::class] = new BigInteger(); + if (!isset(static::$zero[$instanceID])) { + static::$zero[$instanceID] = new BigInteger(); } } @@ -107,6 +121,9 @@ public static function cleanupCache($instanceID) { unset(static::$modulo[$instanceID]); unset(static::$reduce[$instanceID]); + unset(static::$zero[$instanceID]); + unset(static::$one[$instanceID]); + unset(static::$two[$instanceID]); } /** @@ -240,32 +257,35 @@ public function pow(BigInteger $x) */ public function squareRoot() { - static $one, $two; - if (!isset($one)) { - $one = new BigInteger(1); - $two = new BigInteger(2); + if (!isset(static::$one[$this->instanceID])) { + static::$one[$this->instanceID] = new BigInteger(1); + static::$two[$this->instanceID] = new BigInteger(2); } - $reduce = static::$reduce[$this->instanceID]; - $p_1 = static::$modulo[$this->instanceID]->subtract($one); + $one = &static::$one[$this->instanceID]; + $two = &static::$two[$this->instanceID]; + $modulo = &static::$modulo[$this->instanceID]; + $reduce = &static::$reduce[$this->instanceID]; + + $p_1 = $modulo->subtract($one); $q = clone $p_1; $s = BigInteger::scan1divide($q); list($pow) = $p_1->divide($two); - for ($z = $one; !$z->equals(static::$modulo[$this->instanceID]); $z = $z->add($one)) { - $temp = $z->powMod($pow, static::$modulo[$this->instanceID]); + for ($z = $one; !$z->equals($modulo); $z = $z->add($one)) { + $temp = $z->powMod($pow, $modulo); if ($temp->equals($p_1)) { break; } } $m = new BigInteger($s); - $c = $z->powMod($q, static::$modulo[$this->instanceID]); - $t = $this->value->powMod($q, static::$modulo[$this->instanceID]); + $c = $z->powMod($q, $modulo); + $t = $this->value->powMod($q, $modulo); list($temp) = $q->add($one)->divide($two); - $r = $this->value->powMod($temp, static::$modulo[$this->instanceID]); + $r = $this->value->powMod($temp, $modulo); while (!$t->equals($one)) { for ($i = clone $one; $i->compare($m) < 0; $i = $i->add($one)) { - if ($t->powMod($two->pow($i), static::$modulo[$this->instanceID])->equals($one)) { + if ($t->powMod($two->pow($i), $modulo)->equals($one)) { break; } } @@ -273,7 +293,7 @@ public function squareRoot() if ($i->compare($m) == 0) { return false; } - $b = $c->powMod($two->pow($m->subtract($i)->subtract($one)), static::$modulo[$this->instanceID]); + $b = $c->powMod($two->pow($m->subtract($i)->subtract($one)), $modulo); $m = $i; $c = $reduce($b->multiply($b)); $t = $reduce($t->multiply($c)); @@ -356,6 +376,8 @@ public function getNAF($w = 1) { $w++; + $zero = &static::$zero[$this->instanceID]; + $mask = new BigInteger((1 << $w) - 1); $sub = new BigInteger(1 << $w); //$sub = new BigInteger(1 << ($w - 1)); @@ -363,7 +385,7 @@ public function getNAF($w = 1) $d_i = []; $i = 0; - while ($d->compare(static::$zero[static::class]) > 0) { + while ($d->compare($zero) > 0) { if ($d->isOdd()) { // start mods @@ -377,7 +399,7 @@ public function getNAF($w = 1) } else { $d_i[$i] = 0; } - $shift = !$d->equals(static::$zero[static::class]) && $d->bitwise_and($mask)->equals(static::$zero[static::class]) ? $w : 1; // $w or $w + 1? + $shift = !$d->equals($zero) && $d->bitwise_and($mask)->equals($zero) ? $w : 1; // $w or $w + 1? $d = $d->bitwise_rightShift($shift); while (--$shift > 0) { $d_i[++$i] = 0; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php index 47dac48f9..9d385ad75 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php @@ -836,6 +836,8 @@ public function realpath($path) return false; } + $path = (string) $path; + if (!$this->canonicalize_paths) { if ($this->pwd === true) { return '.'; @@ -923,6 +925,8 @@ public function chdir($dir) return false; } + $dir = (string) $dir; + // assume current dir if $dir is empty if ($dir === '') { $dir = './'; @@ -932,6 +936,9 @@ public function chdir($dir) } $dir = $this->realpath($dir); + if ($dir === false) { + return false; + } // confirm that $dir is, in fact, a valid directory if ($this->use_stat_cache && is_array($this->query_stat_cache($dir))) { @@ -3355,8 +3362,7 @@ private function get_sftp_packet($request_id = null) if (strlen($this->packet_buffer) < 4) { throw new \RuntimeException('Packet is too small'); } - extract(unpack('Nlength', Strings::shift($this->packet_buffer, 4))); - /** @var integer $length */ + $length = unpack('Nlength', Strings::shift($this->packet_buffer, 4))['length']; $tempLength = $length; $tempLength -= strlen($this->packet_buffer); @@ -3386,7 +3392,7 @@ private function get_sftp_packet($request_id = null) $this->packet_type = ord(Strings::shift($this->packet_buffer)); if ($this->use_request_id) { - extract(unpack('Npacket_id', Strings::shift($this->packet_buffer, 4))); // remove the request id + $packet_id = unpack('Npacket_id', Strings::shift($this->packet_buffer, 4))['packet_id']; // remove the request id $length -= 5; // account for the request id and the packet type } else { $length -= 1; // account for the packet type @@ -3559,7 +3565,6 @@ protected function disconnect_helper($reason) /** * Enable Date Preservation - * */ public function enableDatePreservation() { @@ -3568,13 +3573,101 @@ public function enableDatePreservation() /** * Disable Date Preservation - * */ public function disableDatePreservation() { $this->preserveTime = false; } + /** + * Copy + * + * This method (currently) only works if the copy-data extension is available + * + * @param string $oldname + * @param string $newname + * @return bool + */ + public function copy($oldname, $newname) + { + if (!$this->precheck()) { + return false; + } + + $oldname = $this->realpath($oldname); + $newname = $this->realpath($newname); + if ($oldname === false || $newname === false) { + return false; + } + + if (!isset($this->extensions['copy-data']) || $this->extensions['copy-data'] !== '1') { + throw new \RuntimeException( + "Extension 'copy-data' is not supported by the server. " . + "Call getSupportedVersions() to see a list of supported extension" + ); + } + + $size = $this->filesize($oldname); + + $packet = Strings::packSSH2('s', $oldname); + $packet .= $this->version >= 5 ? + pack('N3', 0, NET_SFTP_OPEN_OPEN_EXISTING, 0) : + pack('N2', NET_SFTP_OPEN_READ, 0); + $this->send_sftp_packet(NET_SFTP_OPEN, $packet); + + $response = $this->get_sftp_packet(); + switch ($this->packet_type) { + case NET_SFTP_HANDLE: + $oldhandle = substr($response, 4); + break; + case NET_SFTP_STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED + $this->logError($response); + return false; + default: + throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS. ' + . 'Got packet type: ' . $this->packet_type); + } + + if ($this->version >= 5) { + $flags = NET_SFTP_OPEN_OPEN_OR_CREATE; + } else { + $flags = NET_SFTP_OPEN_WRITE | NET_SFTP_OPEN_CREATE; + } + + $packet = Strings::packSSH2('s', $newname); + $packet .= $this->version >= 5 ? + pack('N3', 0, $flags, 0) : + pack('N2', $flags, 0); + $this->send_sftp_packet(NET_SFTP_OPEN, $packet); + + $response = $this->get_sftp_packet(); + switch ($this->packet_type) { + case NET_SFTP_HANDLE: + $newhandle = substr($response, 4); + break; + case NET_SFTP_STATUS: + $this->logError($response); + return false; + default: + throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS. ' + . 'Got packet type: ' . $this->packet_type); + } + + $packet = Strings::packSSH2('ssQQsQ', 'copy-data', $oldhandle, 0, $size, $newhandle, 0); + $this->send_sftp_packet(NET_SFTP_EXTENDED, $packet); + + $response = $this->get_sftp_packet(); + if ($this->packet_type != NET_SFTP_STATUS) { + throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' + . 'Got packet type: ' . $this->packet_type); + } + + $this->close_handle($oldhandle); + $this->close_handle($newhandle); + + return true; + } + /** * POSIX Rename * diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php index 24047b4b0..a1f2fa245 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php @@ -139,7 +139,15 @@ public function __construct() protected function parse_path($path) { $orig = $path; - extract(parse_url($path) + ['port' => 22]); + $url = parse_url($path) + ['port' => 22]; + + $keys = ['scheme', 'host', 'port', 'user', 'pass', 'path', 'query', 'fragment']; + foreach ($keys as $key) { + if (isset($url[$key])) { + $$key = $url[$key]; + } + } + if (isset($query)) { $path .= '?' . $query; } elseif (preg_match('/(\?|\?#)$/', $orig)) { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php index ac44eaacd..1c8a0e265 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php @@ -1477,7 +1477,7 @@ private function connect() } if (defined('NET_SSH2_LOGGING')) { - $this->append_log('<- (network: ' . round($totalElapsed, 4) . ')', $line); + $this->append_log('<- (network: ' . round($totalElapsed, 4) . ')', $data); } if (feof($this->fsock)) { @@ -1487,7 +1487,13 @@ private function connect() $extra = $matches[1]; - $this->server_identifier = trim($data, "\r\n"); + // earlier the SSH specs were quoted. + // "The server MAY send other lines of data before sending the version string." they said. + // the implication of this is that the lines of data before the server string are *not* a part of it + // getting this right is important because the correct server identifier needs to be fed into the + // exchange hash for the shared keys to be calculated correctly + $data = explode("\r\n", trim($data, "\r\n")); + $this->server_identifier = $data[count($data) - 1]; if (strlen($extra)) { $this->errors[] = $data; } @@ -1677,7 +1683,6 @@ private function key_exchange($kexinit_payload_server = false) case NET_SSH2_MSG_DISCONNECT: return $this->handleDisconnect($kexinit_payload_server); } - $this->kex_buffer[] = $kexinit_payload_server; } @@ -2977,7 +2982,7 @@ public function getOpenChannelCount() */ protected function open_channel($channel, $skip_extended = false) { - if (isset($this->channel_status[$channel]) && $this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_CLOSE) { + if (isset($this->channel_status[$channel])) { throw new \RuntimeException('Please close the channel (' . $channel . ') before trying to open it again'); } @@ -3346,6 +3351,27 @@ public function reset($channel = null) } } + /** + * Send EOF on a channel + * + * Sends an EOF to the stream; this is typically used to close standard + * input, while keeping output and error alive. + * + * @param int|null $channel Channel id returned by self::getInteractiveChannelId() + * @return void + */ + public function sendEOF($channel = null) + { + if ($channel === null) { + $channel = $this->get_interactive_channel(); + } + + $excludeStatuses = [NET_SSH2_MSG_CHANNEL_EOF, NET_SSH2_MSG_CHANNEL_CLOSE]; + if (isset($this->channel_status[$channel]) && !in_array($this->channel_status[$channel], $excludeStatuses)) { + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$channel])); + } + } + /** * Is timeout? * @@ -3722,7 +3748,7 @@ private function get_binary_packet() } $padding_length = 0; $payload = $packet->plain; - extract(unpack('Cpadding_length', Strings::shift($payload, 1))); + $padding_length = unpack('Cpadding_length', Strings::shift($payload, 1))['padding_length']; if ($padding_length > 0) { Strings::pop($payload, $padding_length); } @@ -3788,8 +3814,7 @@ private function get_binary_packet() $this->key_exchange(); } - // don't filter if we're in the middle of a key exchange (since _filter might send out packets) - return $this->keyExchangeInProgress ? $payload : $this->filter($payload); + return $this->filter($payload); } /** @@ -3809,13 +3834,13 @@ private function get_binary_packet_size(&$packet) switch ($this->decryptName) { case 'aes128-gcm@openssh.com': case 'aes256-gcm@openssh.com': - extract(unpack('Npacket_length', substr($packet->raw, 0, $packet_length_header_size))); + $packet_length = unpack('Npacket_length', substr($packet->raw, 0, $packet_length_header_size))['packet_length']; $packet->size = $packet_length_header_size + $packet_length + $this->decrypt_block_size; // expect tag break; case 'chacha20-poly1305@openssh.com': $this->lengthDecrypt->setNonce(pack('N2', 0, $this->get_seq_no)); $packet_length_header = $this->lengthDecrypt->decrypt(substr($packet->raw, 0, $packet_length_header_size)); - extract(unpack('Npacket_length', $packet_length_header)); + $packet_length = unpack('Npacket_length', $packet_length_header)['packet_length']; $packet->size = $packet_length_header_size + $packet_length + 16; // expect tag break; default: @@ -3824,17 +3849,17 @@ private function get_binary_packet_size(&$packet) return; } $packet->plain = $this->decrypt->decrypt(substr($packet->raw, 0, $this->decrypt_block_size)); - extract(unpack('Npacket_length', Strings::shift($packet->plain, $packet_length_header_size))); + $packet_length = unpack('Npacket_length', Strings::shift($packet->plain, $packet_length_header_size))['packet_length']; $packet->size = $packet_length_header_size + $packet_length; $added_validation_length = $packet_length_header_size; } else { - extract(unpack('Npacket_length', substr($packet->raw, 0, $packet_length_header_size))); + $packet_length = unpack('Npacket_length', substr($packet->raw, 0, $packet_length_header_size))['packet_length']; $packet->size = $packet_length_header_size + $packet_length; } break; } } else { - extract(unpack('Npacket_length', substr($packet->raw, 0, $packet_length_header_size))); + $packet_length = unpack('Npacket_length', substr($packet->raw, 0, $packet_length_header_size))['packet_length']; $packet->size = $packet_length_header_size + $packet_length; $added_validation_length = $packet_length_header_size; } @@ -3884,9 +3909,15 @@ private function handleDisconnect($payload) */ private function filter($payload) { + if (ord($payload[0]) == NET_SSH2_MSG_DISCONNECT) { + return $this->handleDisconnect($payload); + } + + if ($this->session_id === false && $this->keyExchangeInProgress) { + return $payload; + } + switch (ord($payload[0])) { - case NET_SSH2_MSG_DISCONNECT: - return $this->handleDisconnect($payload); case NET_SSH2_MSG_IGNORE: $payload = $this->get_binary_packet(); break; @@ -3900,7 +3931,7 @@ private function filter($payload) break; // return payload case NET_SSH2_MSG_KEXINIT: // this is here for server initiated key re-exchanges after the initial key exchange - if ($this->session_id !== false) { + if (!$this->keyExchangeInProgress && $this->session_id !== false) { if (!$this->key_exchange($payload)) { $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); throw new ConnectionClosedException('Key exchange failed'); @@ -3920,6 +3951,26 @@ private function filter($payload) $payload = $this->get_binary_packet(); } + /* + Once a party has sent a SSH_MSG_KEXINIT message for key exchange or + re-exchange, until it has sent a SSH_MSG_NEWKEYS message (Section + 7.3), it MUST NOT send any messages other than: + + o Transport layer generic messages (1 to 19) (but + SSH_MSG_SERVICE_REQUEST and SSH_MSG_SERVICE_ACCEPT MUST NOT be + sent); + + o Algorithm negotiation messages (20 to 29) (but further + SSH_MSG_KEXINIT messages MUST NOT be sent); + + o Specific key exchange method messages (30 to 49). + + -- https://www.rfc-editor.org/rfc/rfc4253#section-7.1 + */ + if ($this->keyExchangeInProgress) { + return $payload; + } + // see http://tools.ietf.org/html/rfc4252#section-5.4; only called when the encryption has been activated and when we haven't already logged in if (($this->bitmap & self::MASK_CONNECTED) && !$this->isAuthenticated() && ord($payload[0]) == NET_SSH2_MSG_USERAUTH_BANNER) { Strings::shift($payload, 1); @@ -3932,7 +3983,10 @@ private function filter($payload) switch (ord($payload[0])) { case NET_SSH2_MSG_CHANNEL_REQUEST: if (strlen($payload) == 31) { - extract(unpack('cpacket_type/Nchannel/Nlength', $payload)); + $unpacked = unpack('cpacket_type/Nchannel/Nlength', $payload); + $packet_type = $unpacked['packet_type']; + $channel = $unpacked['channel']; + $length = $unpacked['length']; if (substr($payload, 9, $length) == 'keepalive@openssh.com' && isset($this->server_channels[$channel])) { if (ord(substr($payload, 9 + $length))) { // want reply $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_SUCCESS, $this->server_channels[$channel])); @@ -4096,7 +4150,8 @@ public function isPTYEnabled() protected function get_channel_packet($client_channel, $skip_extended = false) { if (!empty($this->channel_buffers[$client_channel])) { - switch ($this->channel_status[$client_channel]) { + // in phpseclib 4.0 this should be changed to $this->channel_status[$client_channel] ?? null + switch (isset($this->channel_status[$client_channel]) ? $this->channel_status[$client_channel] : null) { case NET_SSH2_MSG_CHANNEL_REQUEST: foreach ($this->channel_buffers[$client_channel] as $i => $packet) { switch (ord($packet[0])) { @@ -4164,7 +4219,7 @@ protected function get_channel_packet($client_channel, $skip_extended = false) continue 2; case NET_SSH2_MSG_CHANNEL_REQUEST: - if ($this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_CLOSE) { + if (!isset($this->channel_status[$channel])) { continue 2; } list($value) = Strings::unpackSSH2('s', $response); @@ -4182,10 +4237,14 @@ protected function get_channel_packet($client_channel, $skip_extended = false) $this->errors[count($this->errors) - 1] .= "\r\n$error_message"; } - $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel])); - $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); + if (isset($this->channel_status[$channel]) && $this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_CLOSE) { + if ($this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_EOF) { + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$channel])); + } + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); - $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_EOF; + $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_CLOSE; + } continue 3; case 'exit-status': @@ -4286,11 +4345,11 @@ protected function get_channel_packet($client_channel, $skip_extended = false) $this->close_channel_bitmap($channel); - if ($this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_EOF) { + if ($this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_CLOSE) { $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); } - $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_CLOSE; + unset($this->channel_status[$channel]); $this->channelCount--; if ($client_channel == $channel) { @@ -4515,7 +4574,7 @@ private function append_log($message_number, $message) protected function append_log_helper($constant, $message_number, $message, array &$message_number_log, array &$message_log, &$log_size, &$realtime_log_file, &$realtime_log_wrap, &$realtime_log_size) { // remove the byte identifying the message type from all but the first two messages (ie. the identification strings) - if (strlen($message_number) > 2) { + if (!in_array(substr($message_number, 0, 4), ['<- (', '-> (']) && strlen($message_number) > 2) { Strings::shift($message); } @@ -4655,27 +4714,24 @@ protected function send_channel_packet($client_channel, $data) * @param bool $want_reply * @return void */ - private function close_channel($client_channel, $want_reply = false) + private function close_channel($client_channel) { // see http://tools.ietf.org/html/rfc4254#section-5.3 - $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel])); - - if (!$want_reply) { - $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel])); + if ($this->channel_status[$client_channel] != NET_SSH2_MSG_CHANNEL_EOF) { + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel])); } + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel])); $this->channel_status[$client_channel] = NET_SSH2_MSG_CHANNEL_CLOSE; + $this->channelCount--; $this->curTimeout = 5; - while (!is_bool($this->get_channel_packet($client_channel))) { } - if ($want_reply) { - $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel])); - } + unset($this->channel_status[$client_channel]); $this->close_channel_bitmap($client_channel); } diff --git a/lib/Google/vendor/psr/cache/src/CacheItemInterface.php b/lib/Google/vendor/psr/cache/src/CacheItemInterface.php index 2b2e4bb88..893315e6e 100644 --- a/lib/Google/vendor/psr/cache/src/CacheItemInterface.php +++ b/lib/Google/vendor/psr/cache/src/CacheItemInterface.php @@ -32,7 +32,7 @@ interface CacheItemInterface * @return string * The key string for this cache item. */ - public function getKey(): string; + public function getKey(); /** * Retrieves the value of the item from the cache associated with this object's key. @@ -46,7 +46,7 @@ public function getKey(): string; * @return mixed * The value corresponding to this cache item's key, or null if not found. */ - public function get(): mixed; + public function get(); /** * Confirms if the cache item lookup resulted in a cache hit. @@ -57,7 +57,7 @@ public function get(): mixed; * @return bool * True if the request resulted in a cache hit. False otherwise. */ - public function isHit(): bool; + public function isHit(); /** * Sets the value represented by this cache item. @@ -72,7 +72,7 @@ public function isHit(): bool; * @return static * The invoked object. */ - public function set(mixed $value): static; + public function set(mixed $value); /** * Sets the expiration time for this cache item. @@ -86,7 +86,7 @@ public function set(mixed $value): static; * @return static * The called object. */ - public function expiresAt(?\DateTimeInterface $expiration): static; + public function expiresAt(?\DateTimeInterface $expiration); /** * Sets the expiration time for this cache item. @@ -101,5 +101,5 @@ public function expiresAt(?\DateTimeInterface $expiration): static; * @return static * The called object. */ - public function expiresAfter(int|\DateInterval|null $time): static; + public function expiresAfter(int|\DateInterval|null $time); } diff --git a/lib/Google/vendor/psr/cache/src/CacheItemPoolInterface.php b/lib/Google/vendor/psr/cache/src/CacheItemPoolInterface.php index 4b3017c75..9ff99da6b 100644 --- a/lib/Google/vendor/psr/cache/src/CacheItemPoolInterface.php +++ b/lib/Google/vendor/psr/cache/src/CacheItemPoolInterface.php @@ -29,7 +29,7 @@ interface CacheItemPoolInterface * @return CacheItemInterface * The corresponding Cache Item. */ - public function getItem(string $key): CacheItemInterface; + public function getItem(string $key); /** * Returns a traversable set of cache items. @@ -41,13 +41,13 @@ public function getItem(string $key): CacheItemInterface; * If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException * MUST be thrown. * - * @return iterable - * An iterable collection of Cache Items keyed by the cache keys of + * @return array|\Traversable + * A traversable collection of Cache Items keyed by the cache keys of * each item. A Cache item will be returned for each key, even if that * key is not found. However, if no keys are specified then an empty * traversable MUST be returned instead. */ - public function getItems(array $keys = []): iterable; + public function getItems(array $keys = []); /** * Confirms if the cache contains specified cache item. @@ -66,7 +66,7 @@ public function getItems(array $keys = []): iterable; * @return bool * True if item exists in the cache, false otherwise. */ - public function hasItem(string $key): bool; + public function hasItem(string $key); /** * Deletes all items in the pool. @@ -74,7 +74,7 @@ public function hasItem(string $key): bool; * @return bool * True if the pool was successfully cleared. False if there was an error. */ - public function clear(): bool; + public function clear(); /** * Removes the item from the pool. @@ -89,7 +89,7 @@ public function clear(): bool; * @return bool * True if the item was successfully removed. False if there was an error. */ - public function deleteItem(string $key): bool; + public function deleteItem(string $key); /** * Removes multiple items from the pool. @@ -104,7 +104,7 @@ public function deleteItem(string $key): bool; * @return bool * True if the items were successfully removed. False if there was an error. */ - public function deleteItems(array $keys): bool; + public function deleteItems(array $keys); /** * Persists a cache item immediately. @@ -115,7 +115,7 @@ public function deleteItems(array $keys): bool; * @return bool * True if the item was successfully persisted. False if there was an error. */ - public function save(CacheItemInterface $item): bool; + public function save(CacheItemInterface $item); /** * Sets a cache item to be persisted later. @@ -126,7 +126,7 @@ public function save(CacheItemInterface $item): bool; * @return bool * False if the item could not be queued or if a commit was attempted and failed. True otherwise. */ - public function saveDeferred(CacheItemInterface $item): bool; + public function saveDeferred(CacheItemInterface $item); /** * Persists any deferred cache items. @@ -134,5 +134,5 @@ public function saveDeferred(CacheItemInterface $item): bool; * @return bool * True if all not-yet-saved items were successfully saved or there were none. False otherwise. */ - public function commit(): bool; + public function commit(); } diff --git a/lib/Google/vendor/ramsey/collection/README.md b/lib/Google/vendor/ramsey/collection/README.md index c77ffcb18..aacf940b3 100644 --- a/lib/Google/vendor/ramsey/collection/README.md +++ b/lib/Google/vendor/ramsey/collection/README.md @@ -11,7 +11,6 @@ Read License Build Status Codecov Code Coverage - Psalm Type Coverage

## About @@ -49,16 +48,6 @@ contribution of external security researchers. If you believe you've found a security issue in software that is maintained in this repository, please read [SECURITY.md][] for instructions on submitting a vulnerability report. -## ramsey/collection for Enterprise - -Available as part of the Tidelift Subscription. - -The maintainers of ramsey/collection and thousands of other packages are working -with Tidelift to deliver commercial support and maintenance for the open source -packages you use to build your applications. Save time, reduce risk, and improve -code health, while paying the maintainers of the exact packages you use. -[Learn more.](https://tidelift.com/subscription/pkg/packagist-ramsey-collection?utm_source=undefined&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - ## Copyright and License The ramsey/collection library is copyright © [Ben Ramsey](https://benramsey.com) diff --git a/lib/Google/vendor/ramsey/collection/composer.json b/lib/Google/vendor/ramsey/collection/composer.json index f09106a15..42fc22b95 100644 --- a/lib/Google/vendor/ramsey/collection/composer.json +++ b/lib/Google/vendor/ramsey/collection/composer.json @@ -19,32 +19,27 @@ } ], "require": { - "php": "^7.4 || ^8.0", - "symfony/polyfill-php81": "^1.23" + "php": "^8.1" }, "require-dev": { "captainhook/plugin-composer": "^5.3", - "ergebnis/composer-normalize": "^2.28.3", - "fakerphp/faker": "^1.21", + "ergebnis/composer-normalize": "^2.45", + "fakerphp/faker": "^1.24", "hamcrest/hamcrest-php": "^2.0", - "jangregor/phpstan-prophecy": "^1.0", - "mockery/mockery": "^1.5", + "jangregor/phpstan-prophecy": "^2.1", + "mockery/mockery": "^1.6", "php-parallel-lint/php-console-highlighter": "^1.0", - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpcsstandards/phpcsutils": "^1.0.0-rc1", - "phpspec/prophecy-phpunit": "^2.0", - "phpstan/extension-installer": "^1.2", - "phpstan/phpstan": "^1.9", - "phpstan/phpstan-mockery": "^1.1", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5", - "psalm/plugin-mockery": "^1.1", - "psalm/plugin-phpunit": "^0.18.4", - "ramsey/coding-standard": "^2.0.3", - "ramsey/conventional-commits": "^1.3", - "vimeo/psalm": "^5.4" + "php-parallel-lint/php-parallel-lint": "^1.4", + "phpspec/prophecy-phpunit": "^2.3", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-mockery": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^10.5", + "ramsey/coding-standard": "^2.3", + "ramsey/conventional-commits": "^1.6", + "roave/security-advisories": "dev-latest" }, - "minimum-stability": "RC", "prefer-stable": true, "autoload": { "psr-4": { @@ -53,19 +48,15 @@ }, "autoload-dev": { "psr-4": { - "Ramsey\\Collection\\Test\\": "tests/", - "Ramsey\\Test\\Generics\\": "tests/generics/" - }, - "files": [ - "vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php" - ] + "Ramsey\\Collection\\Test\\": "tests/" + } }, "config": { "allow-plugins": { + "captainhook/plugin-composer": true, "dealerdirect/phpcodesniffer-composer-installer": true, "ergebnis/composer-normalize": true, - "phpstan/extension-installer": true, - "captainhook/plugin-composer": true + "phpstan/extension-installer": true }, "sort-packages": true }, @@ -79,11 +70,9 @@ }, "scripts": { "dev:analyze": [ - "@dev:analyze:phpstan", - "@dev:analyze:psalm" + "@dev:analyze:phpstan" ], "dev:analyze:phpstan": "phpstan analyse --ansi --memory-limit=1G", - "dev:analyze:psalm": "psalm", "dev:build:clean": "git clean -fX build/", "dev:lint": [ "@dev:lint:syntax", @@ -105,7 +94,6 @@ "scripts-descriptions": { "dev:analyze": "Runs all static analysis checks.", "dev:analyze:phpstan": "Runs the PHPStan static analyzer.", - "dev:analyze:psalm": "Runs the Psalm static analyzer.", "dev:build:clean": "Cleans the build/ directory.", "dev:lint": "Runs all linting checks.", "dev:lint:fix": "Auto-fixes coding standards issues, if possible.", diff --git a/lib/Google/vendor/ramsey/collection/conventional-commits.json b/lib/Google/vendor/ramsey/collection/conventional-commits.json deleted file mode 100644 index 5fe21d2fa..000000000 --- a/lib/Google/vendor/ramsey/collection/conventional-commits.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "typeCase": "kebab", - "types": [ - "chore", - "ci", - "docs", - "feat", - "fix", - "refactor", - "security", - "style", - "test" - ], - "scopeCase": "kebab", - "scopeRequired": false, - "scopes": [], - "descriptionCase": null, - "descriptionEndMark": "", - "bodyRequired": false, - "bodyWrapWidth": 72, - "requiredFooters": [] -} diff --git a/lib/Google/vendor/ramsey/collection/src/AbstractArray.php b/lib/Google/vendor/ramsey/collection/src/AbstractArray.php index 9b39dd0cb..6d6b6d66b 100644 --- a/lib/Google/vendor/ramsey/collection/src/AbstractArray.php +++ b/lib/Google/vendor/ramsey/collection/src/AbstractArray.php @@ -18,8 +18,6 @@ use Traversable; use function count; -use function serialize; -use function unserialize; /** * This class provides a basic implementation of `ArrayInterface`, to minimize @@ -44,7 +42,7 @@ abstract class AbstractArray implements ArrayInterface */ public function __construct(array $data = []) { - // Invoke offsetSet() for each value added; in this way, sub-classes + // Invoke offsetSet() for each value added; in this way, subclasses // may provide additional logic about values added to the array object. foreach ($data as $key => $value) { $this[$key] = $value; @@ -70,7 +68,7 @@ public function getIterator(): Traversable * * @param array-key $offset The offset to check. */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->data[$offset]); } @@ -82,13 +80,12 @@ public function offsetExists($offset): bool * * @param array-key $offset The offset for which a value should be returned. * - * @return T|null the value stored at the offset, or null if the offset + * @return T the value stored at the offset, or null if the offset * does not exist. */ - #[\ReturnTypeWillChange] // phpcs:ignore - public function offsetGet($offset) + public function offsetGet(mixed $offset): mixed { - return $this->data[$offset] ?? null; + return $this->data[$offset]; } /** @@ -96,12 +93,11 @@ public function offsetGet($offset) * * @link http://php.net/manual/en/arrayaccess.offsetset.php ArrayAccess::offsetSet() * - * @param array-key|null $offset The offset to set. If `null`, the value may be - * set at a numerically-indexed offset. + * @param array-key | null $offset The offset to set. If `null`, the value + * may be set at a numerically-indexed offset. * @param T $value The value to set at the given offset. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if ($offset === null) { $this->data[] = $value; @@ -117,25 +113,11 @@ public function offsetSet($offset, $value): void * * @param array-key $offset The offset to remove from the array. */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->data[$offset]); } - /** - * Returns a serialized string representation of this array object. - * - * @deprecated The Serializable interface will go away in PHP 9. - * - * @link http://php.net/manual/en/serializable.serialize.php Serializable::serialize() - * - * @return string a PHP serialized string. - */ - public function serialize(): string - { - return serialize($this->data); - } - /** * Returns data suitable for PHP serialization. * @@ -149,25 +131,6 @@ public function __serialize(): array return $this->data; } - /** - * Converts a serialized string representation into an instance object. - * - * @deprecated The Serializable interface will go away in PHP 9. - * - * @link http://php.net/manual/en/serializable.unserialize.php Serializable::unserialize() - * - * @param string $serialized A PHP serialized string to unserialize. - * - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - */ - public function unserialize($serialized): void - { - /** @var array $data */ - $data = unserialize($serialized, ['allowed_classes' => false]); - - $this->data = $data; - } - /** * Adds unserialized data to the object. * @@ -203,6 +166,6 @@ public function toArray(): array public function isEmpty(): bool { - return count($this->data) === 0; + return $this->data === []; } } diff --git a/lib/Google/vendor/ramsey/collection/src/AbstractCollection.php b/lib/Google/vendor/ramsey/collection/src/AbstractCollection.php index 38ef7144c..2f006b90f 100644 --- a/lib/Google/vendor/ramsey/collection/src/AbstractCollection.php +++ b/lib/Google/vendor/ramsey/collection/src/AbstractCollection.php @@ -17,27 +17,27 @@ use Closure; use Ramsey\Collection\Exception\CollectionMismatchException; use Ramsey\Collection\Exception\InvalidArgumentException; -use Ramsey\Collection\Exception\InvalidSortOrderException; -use Ramsey\Collection\Exception\OutOfBoundsException; +use Ramsey\Collection\Exception\InvalidPropertyOrMethod; +use Ramsey\Collection\Exception\NoSuchElementException; +use Ramsey\Collection\Exception\UnsupportedOperationException; use Ramsey\Collection\Tool\TypeTrait; use Ramsey\Collection\Tool\ValueExtractorTrait; use Ramsey\Collection\Tool\ValueToStringTrait; use function array_filter; +use function array_key_first; +use function array_key_last; use function array_map; use function array_merge; +use function array_reduce; use function array_search; use function array_udiff; use function array_uintersect; -use function current; -use function end; use function in_array; use function is_int; use function is_object; -use function reset; use function spl_object_id; use function sprintf; -use function unserialize; use function usort; /** @@ -55,27 +55,24 @@ abstract class AbstractCollection extends AbstractArray implements CollectionInt use ValueExtractorTrait; /** - * @inheritDoc + * @throws InvalidArgumentException if $element is of the wrong type. */ - public function add($element): bool + public function add(mixed $element): bool { $this[] = $element; return true; } - /** - * @inheritDoc - */ - public function contains($element, bool $strict = true): bool + public function contains(mixed $element, bool $strict = true): bool { return in_array($element, $this->data, $strict); } /** - * @inheritDoc + * @throws InvalidArgumentException if $element is of the wrong type. */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if ($this->checkType($this->getType(), $value) === false) { throw new InvalidArgumentException( @@ -91,10 +88,7 @@ public function offsetSet($offset, $value): void } } - /** - * @inheritDoc - */ - public function remove($element): bool + public function remove(mixed $element): bool { if (($position = array_search($element, $this->data, true)) !== false) { unset($this[$position]); @@ -106,6 +100,11 @@ public function remove($element): bool } /** + * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist + * on the elements in this collection. + * @throws UnsupportedOperationException if unable to call column() on this + * collection. + * * @inheritDoc */ public function column(string $propertyOrMethod): array @@ -113,77 +112,74 @@ public function column(string $propertyOrMethod): array $temp = []; foreach ($this->data as $item) { - /** @var mixed $value */ - $value = $this->extractValue($item, $propertyOrMethod); - - /** @psalm-suppress MixedAssignment */ - $temp[] = $value; + $temp[] = $this->extractValue($item, $propertyOrMethod); } return $temp; } /** - * @inheritDoc + * @return T + * + * @throws NoSuchElementException if this collection is empty. */ - public function first() + public function first(): mixed { - if ($this->isEmpty()) { - throw new OutOfBoundsException('Can\'t determine first item. Collection is empty'); - } - - reset($this->data); + $firstIndex = array_key_first($this->data); - /** @var T $first */ - $first = current($this->data); + if ($firstIndex === null) { + throw new NoSuchElementException('Can\'t determine first item. Collection is empty'); + } - return $first; + return $this->data[$firstIndex]; } /** - * @inheritDoc + * @return T + * + * @throws NoSuchElementException if this collection is empty. */ - public function last() + public function last(): mixed { - if ($this->isEmpty()) { - throw new OutOfBoundsException('Can\'t determine last item. Collection is empty'); - } + $lastIndex = array_key_last($this->data); - /** @var T $item */ - $item = end($this->data); - reset($this->data); + if ($lastIndex === null) { + throw new NoSuchElementException('Can\'t determine last item. Collection is empty'); + } - return $item; + return $this->data[$lastIndex]; } - public function sort(string $propertyOrMethod, string $order = self::SORT_ASC): CollectionInterface + /** + * @return CollectionInterface + * + * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist + * on the elements in this collection. + * @throws UnsupportedOperationException if unable to call sort() on this + * collection. + */ + public function sort(?string $propertyOrMethod = null, Sort $order = Sort::Ascending): CollectionInterface { - if (!in_array($order, [self::SORT_ASC, self::SORT_DESC], true)) { - throw new InvalidSortOrderException('Invalid sort order given: ' . $order); - } - $collection = clone $this; usort( $collection->data, - /** - * @param T $a - * @param T $b - */ - function ($a, $b) use ($propertyOrMethod, $order): int { - /** @var mixed $aValue */ + function (mixed $a, mixed $b) use ($propertyOrMethod, $order): int { $aValue = $this->extractValue($a, $propertyOrMethod); - - /** @var mixed $bValue */ $bValue = $this->extractValue($b, $propertyOrMethod); - return ($aValue <=> $bValue) * ($order === self::SORT_DESC ? -1 : 1); + return ($aValue <=> $bValue) * ($order === Sort::Descending ? -1 : 1); }, ); return $collection; } + /** + * @param callable(T): bool $callback A callable to use for filtering elements. + * + * @return CollectionInterface + */ public function filter(callable $callback): CollectionInterface { $collection = clone $this; @@ -193,23 +189,56 @@ public function filter(callable $callback): CollectionInterface } /** - * {@inheritdoc} + * @return CollectionInterface + * + * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist + * on the elements in this collection. + * @throws UnsupportedOperationException if unable to call where() on this + * collection. */ - public function where(string $propertyOrMethod, $value): CollectionInterface + public function where(?string $propertyOrMethod, mixed $value): CollectionInterface { - return $this->filter(function ($item) use ($propertyOrMethod, $value) { - /** @var mixed $accessorValue */ - $accessorValue = $this->extractValue($item, $propertyOrMethod); - - return $accessorValue === $value; - }); + return $this->filter( + fn (mixed $item): bool => $this->extractValue($item, $propertyOrMethod) === $value, + ); } + /** + * @param callable(T): TCallbackReturn $callback A callable to apply to each + * item of the collection. + * + * @return CollectionInterface + * + * @template TCallbackReturn + */ public function map(callable $callback): CollectionInterface { return new Collection('mixed', array_map($callback, $this->data)); } + /** + * @param callable(TCarry, T): TCarry $callback A callable to apply to each + * item of the collection to reduce it to a single value. + * @param TCarry $initial This is the initial value provided to the callback. + * + * @return TCarry + * + * @template TCarry + */ + public function reduce(callable $callback, mixed $initial): mixed + { + return array_reduce($this->data, $callback, $initial); + } + + /** + * @param CollectionInterface $other The collection to check for divergent + * items. + * + * @return CollectionInterface + * + * @throws CollectionMismatchException if the compared collections are of + * differing types. + */ public function diff(CollectionInterface $other): CollectionInterface { $this->compareCollectionTypes($other); @@ -217,28 +246,40 @@ public function diff(CollectionInterface $other): CollectionInterface $diffAtoB = array_udiff($this->data, $other->toArray(), $this->getComparator()); $diffBtoA = array_udiff($other->toArray(), $this->data, $this->getComparator()); - /** @var array $diff */ - $diff = array_merge($diffAtoB, $diffBtoA); - $collection = clone $this; - $collection->data = $diff; + $collection->data = array_merge($diffAtoB, $diffBtoA); return $collection; } + /** + * @param CollectionInterface $other The collection to check for + * intersecting items. + * + * @return CollectionInterface + * + * @throws CollectionMismatchException if the compared collections are of + * differing types. + */ public function intersect(CollectionInterface $other): CollectionInterface { $this->compareCollectionTypes($other); - /** @var array $intersect */ - $intersect = array_uintersect($this->data, $other->toArray(), $this->getComparator()); - $collection = clone $this; - $collection->data = $intersect; + $collection->data = array_uintersect($this->data, $other->toArray(), $this->getComparator()); return $collection; } + /** + * @param CollectionInterface ...$collections The collections to merge. + * + * @return CollectionInterface + * + * @throws CollectionMismatchException if unable to merge any of the given + * collections or items within the given collections due to type + * mismatch errors. + */ public function merge(CollectionInterface ...$collections): CollectionInterface { $mergedCollection = clone $this; @@ -274,19 +315,10 @@ public function merge(CollectionInterface ...$collections): CollectionInterface return $mergedCollection; } - /** - * @inheritDoc - */ - public function unserialize($serialized): void - { - /** @var array $data */ - $data = unserialize($serialized, ['allowed_classes' => [$this->getType()]]); - - $this->data = $data; - } - /** * @param CollectionInterface $other + * + * @throws CollectionMismatchException */ private function compareCollectionTypes(CollectionInterface $other): void { @@ -303,23 +335,19 @@ private function compareCollectionTypes(CollectionInterface $other): void private function getComparator(): Closure { - return /** - * @param T $a - * @param T $b - */ - function ($a, $b): int { - // If the two values are object, we convert them to unique scalars. - // If the collection contains mixed values (unlikely) where some are objects - // and some are not, we leave them as they are. - // The comparator should still work and the result of $a < $b should - // be consistent but unpredictable since not documented. - if (is_object($a) && is_object($b)) { - $a = spl_object_id($a); - $b = spl_object_id($b); - } + return function (mixed $a, mixed $b): int { + // If the two values are object, we convert them to unique scalars. + // If the collection contains mixed values (unlikely) where some are objects + // and some are not, we leave them as they are. + // The comparator should still work and the result of $a < $b should + // be consistent but unpredictable since not documented. + if (is_object($a) && is_object($b)) { + $a = spl_object_id($a); + $b = spl_object_id($b); + } - return $a === $b ? 0 : ($a < $b ? 1 : -1); - }; + return $a === $b ? 0 : ($a < $b ? 1 : -1); + }; } /** @@ -327,15 +355,11 @@ function ($a, $b): int { */ private function getUniformType(CollectionInterface $collection): string { - switch ($collection->getType()) { - case 'integer': - return 'int'; - case 'boolean': - return 'bool'; - case 'double': - return 'float'; - default: - return $collection->getType(); - } + return match ($collection->getType()) { + 'integer' => 'int', + 'boolean' => 'bool', + 'double' => 'float', + default => $collection->getType(), + }; } } diff --git a/lib/Google/vendor/ramsey/collection/src/AbstractSet.php b/lib/Google/vendor/ramsey/collection/src/AbstractSet.php index 1126ccb0a..63f833156 100644 --- a/lib/Google/vendor/ramsey/collection/src/AbstractSet.php +++ b/lib/Google/vendor/ramsey/collection/src/AbstractSet.php @@ -24,22 +24,23 @@ */ abstract class AbstractSet extends AbstractCollection { - /** - * @inheritDoc - */ - public function add($element): bool + public function add(mixed $element): bool { if ($this->contains($element)) { return false; } - return parent::add($element); + // Call offsetSet() on the parent instead of add(), since calling + // parent::add() will invoke $this->offsetSet(), which will call + // $this->contains() a second time. This can cause performance issues + // with extremely large collections. For more information, see + // https://github.com/ramsey/collection/issues/68. + parent::offsetSet(null, $element); + + return true; } - /** - * @inheritDoc - */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if ($this->contains($value)) { return; diff --git a/lib/Google/vendor/ramsey/collection/src/ArrayInterface.php b/lib/Google/vendor/ramsey/collection/src/ArrayInterface.php index 27af6102b..bc7f6f424 100644 --- a/lib/Google/vendor/ramsey/collection/src/ArrayInterface.php +++ b/lib/Google/vendor/ramsey/collection/src/ArrayInterface.php @@ -17,7 +17,6 @@ use ArrayAccess; use Countable; use IteratorAggregate; -use Serializable; /** * `ArrayInterface` provides traversable array functionality to data types. @@ -29,8 +28,7 @@ interface ArrayInterface extends ArrayAccess, Countable, - IteratorAggregate, - Serializable + IteratorAggregate { /** * Removes all items from this array. diff --git a/lib/Google/vendor/ramsey/collection/src/Collection.php b/lib/Google/vendor/ramsey/collection/src/Collection.php index 532b971b6..3b0f7689d 100644 --- a/lib/Google/vendor/ramsey/collection/src/Collection.php +++ b/lib/Google/vendor/ramsey/collection/src/Collection.php @@ -24,7 +24,7 @@ * * Example usage: * - * ``` php + * ``` * $collection = new \Ramsey\Collection\Collection('My\\Foo'); * $collection->add(new \My\Foo()); * $collection->add(new \My\Foo()); @@ -37,7 +37,7 @@ * It is preferable to subclass `AbstractCollection` to create your own typed * collections. For example: * - * ``` php + * ``` * namespace My\Foo; * * class FooCollection extends \Ramsey\Collection\AbstractCollection @@ -51,7 +51,7 @@ * * And then use it similarly to the earlier example: * - * ``` php + * ``` * $fooCollection = new \My\Foo\FooCollection(); * $fooCollection->add(new \My\Foo()); * $fooCollection->add(new \My\Foo()); @@ -64,7 +64,7 @@ * The benefit with this approach is that you may do type-checking on the * collection object: * - * ``` php + * ``` * if ($collection instanceof \My\Foo\FooCollection) { * // the collection is a collection of My\Foo objects * } @@ -75,25 +75,16 @@ */ class Collection extends AbstractCollection { - /** - * The type of elements stored in this collection. - * - * A collection's type is immutable once it is set. For this reason, this - * property is set private. - */ - private string $collectionType; - /** * Constructs a collection object of the specified type, optionally with the * specified data. * - * @param string $collectionType The type (FQCN) associated with this + * @param string $collectionType The type or class name associated with this * collection. * @param array $data The initial items to store in the collection. */ - public function __construct(string $collectionType, array $data = []) + public function __construct(private readonly string $collectionType, array $data = []) { - $this->collectionType = $collectionType; parent::__construct($data); } diff --git a/lib/Google/vendor/ramsey/collection/src/CollectionInterface.php b/lib/Google/vendor/ramsey/collection/src/CollectionInterface.php index 9f86a2837..3ffbb1669 100644 --- a/lib/Google/vendor/ramsey/collection/src/CollectionInterface.php +++ b/lib/Google/vendor/ramsey/collection/src/CollectionInterface.php @@ -14,8 +14,14 @@ namespace Ramsey\Collection; +use Ramsey\Collection\Exception\CollectionMismatchException; +use Ramsey\Collection\Exception\InvalidArgumentException; +use Ramsey\Collection\Exception\InvalidPropertyOrMethod; +use Ramsey\Collection\Exception\NoSuchElementException; +use Ramsey\Collection\Exception\UnsupportedOperationException; + /** - * A collection represents a group of objects, known as its elements. + * A collection represents a group of values, known as its elements. * * Some collections allow duplicate elements and others do not. Some are ordered * and others unordered. @@ -25,16 +31,6 @@ */ interface CollectionInterface extends ArrayInterface { - /** - * Ascending sort type. - */ - public const SORT_ASC = 'asc'; - - /** - * Descending sort type. - */ - public const SORT_DESC = 'desc'; - /** * Ensures that this collection contains the specified element (optional * operation). @@ -58,9 +54,11 @@ interface CollectionInterface extends ArrayInterface * @param T $element The element to add to the collection. * * @return bool `true` if this collection changed as a result of the call. + * + * @throws InvalidArgumentException if the collection refuses to add the + * $element for any reason other than that it already contains the element. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function add($element): bool; + public function add(mixed $element): bool; /** * Returns `true` if this collection contains the specified element. @@ -68,8 +66,7 @@ public function add($element): bool; * @param T $element The element to check whether the collection contains. * @param bool $strict Whether to perform a strict type check on the value. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function contains($element, bool $strict = true): bool; + public function contains(mixed $element, bool $strict = true): bool; /** * Returns the type associated with this collection. @@ -84,15 +81,20 @@ public function getType(): string; * * @return bool `true` if an element was removed as a result of this call. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function remove($element): bool; + public function remove(mixed $element): bool; /** - * Returns the values from the given property or method. + * Returns the values from the given property, method, or array key. * - * @param string $propertyOrMethod The property or method name to filter by. + * @param string $propertyOrMethod The name of the property, method, or + * array key to evaluate and return. * * @return list + * + * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist + * on the elements in this collection. + * @throws UnsupportedOperationException if unable to call column() on this + * collection. */ public function column(string $propertyOrMethod): array; @@ -100,29 +102,41 @@ public function column(string $propertyOrMethod): array; * Returns the first item of the collection. * * @return T + * + * @throws NoSuchElementException if this collection is empty. */ - public function first(); + public function first(): mixed; /** * Returns the last item of the collection. * * @return T + * + * @throws NoSuchElementException if this collection is empty. */ - public function last(); + public function last(): mixed; /** - * Sort the collection by a property or method with the given sort order. + * Sort the collection by a property, method, or array key with the given + * sort order. + * + * If $propertyOrMethod is `null`, this will sort by comparing each element. * * This will always leave the original collection untouched and will return * a new one. * - * @param string $propertyOrMethod The property or method to sort by. - * @param string $order The sort order for the resulting collection (one of - * this interface's `SORT_*` constants). + * @param string | null $propertyOrMethod The property, method, or array key + * to sort by. + * @param Sort $order The sort order for the resulting collection. * * @return CollectionInterface + * + * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist + * on the elements in this collection. + * @throws UnsupportedOperationException if unable to call sort() on this + * collection. */ - public function sort(string $propertyOrMethod, string $order = self::SORT_ASC): self; + public function sort(?string $propertyOrMethod = null, Sort $order = Sort::Ascending): self; /** * Filter out items of the collection which don't match the criteria of @@ -134,25 +148,31 @@ public function sort(string $propertyOrMethod, string $order = self::SORT_ASC): * See the {@link http://php.net/manual/en/function.array-filter.php PHP array_filter() documentation} * for examples of how the `$callback` parameter works. * - * @param callable(T):bool $callback A callable to use for filtering elements. + * @param callable(T): bool $callback A callable to use for filtering elements. * * @return CollectionInterface */ public function filter(callable $callback): self; /** - * Create a new collection where items match the criteria of given callback. + * Create a new collection where the result of the given property, method, + * or array key of each item in the collection equals the given value. * * This will always leave the original collection untouched and will return * a new one. * - * @param string $propertyOrMethod The property or method to evaluate. + * @param string | null $propertyOrMethod The property, method, or array key + * to evaluate. If `null`, the element itself is compared to $value. * @param mixed $value The value to match. * * @return CollectionInterface + * + * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist + * on the elements in this collection. + * @throws UnsupportedOperationException if unable to call where() on this + * collection. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function where(string $propertyOrMethod, $value): self; + public function where(?string $propertyOrMethod, mixed $value): self; /** * Apply a given callback method on each item of the collection. @@ -164,7 +184,7 @@ public function where(string $propertyOrMethod, $value): self; * See the {@link http://php.net/manual/en/function.array-map.php PHP array_map() documentation} * for examples of how the `$callback` parameter works. * - * @param callable(T):TCallbackReturn $callback A callable to apply to each + * @param callable(T): TCallbackReturn $callback A callable to apply to each * item of the collection. * * @return CollectionInterface @@ -173,6 +193,23 @@ public function where(string $propertyOrMethod, $value): self; */ public function map(callable $callback): self; + /** + * Apply a given callback method on each item of the collection + * to reduce it to a single value. + * + * See the {@link http://php.net/manual/en/function.array-reduce.php PHP array_reduce() documentation} + * for examples of how the `$callback` and `$initial` parameters work. + * + * @param callable(TCarry, T): TCarry $callback A callable to apply to each + * item of the collection to reduce it to a single value. + * @param TCarry $initial This is the initial value provided to the callback. + * + * @return TCarry + * + * @template TCarry + */ + public function reduce(callable $callback, mixed $initial): mixed; + /** * Create a new collection with divergent items between current and given * collection. @@ -181,6 +218,9 @@ public function map(callable $callback): self; * items. * * @return CollectionInterface + * + * @throws CollectionMismatchException if the compared collections are of + * differing types. */ public function diff(CollectionInterface $other): self; @@ -192,6 +232,9 @@ public function diff(CollectionInterface $other): self; * intersecting items. * * @return CollectionInterface + * + * @throws CollectionMismatchException if the compared collections are of + * differing types. */ public function intersect(CollectionInterface $other): self; @@ -201,6 +244,10 @@ public function intersect(CollectionInterface $other): self; * @param CollectionInterface ...$collections The collections to merge. * * @return CollectionInterface + * + * @throws CollectionMismatchException if unable to merge any of the given + * collections or items within the given collections due to type + * mismatch errors. */ public function merge(CollectionInterface ...$collections): self; } diff --git a/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueue.php b/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueue.php index 4d1f71ea4..62947a24f 100644 --- a/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueue.php +++ b/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueue.php @@ -17,6 +17,10 @@ use Ramsey\Collection\Exception\InvalidArgumentException; use Ramsey\Collection\Exception\NoSuchElementException; +use function array_key_last; +use function array_pop; +use function array_unshift; + /** * This class provides a basic implementation of `DoubleEndedQueueInterface`, to * minimize the effort required to implement this interface. @@ -28,33 +32,21 @@ class DoubleEndedQueue extends Queue implements DoubleEndedQueueInterface { /** - * Index of the last element in the queue. - */ - private int $tail = -1; - - /** - * @inheritDoc + * Constructs a double-ended queue (dequeue) object of the specified type, + * optionally with the specified data. + * + * @param string $queueType The type or class name associated with this dequeue. + * @param array $data The initial items to store in the dequeue. */ - public function offsetSet($offset, $value): void + public function __construct(private readonly string $queueType, array $data = []) { - if ($this->checkType($this->getType(), $value) === false) { - throw new InvalidArgumentException( - 'Value must be of type ' . $this->getType() . '; value is ' - . $this->toolValueToString($value), - ); - } - - $this->tail++; - - $this->data[$this->tail] = $value; + parent::__construct($this->queueType, $data); } /** * @throws InvalidArgumentException if $element is of the wrong type - * - * @inheritDoc */ - public function addFirst($element): bool + public function addFirst(mixed $element): bool { if ($this->checkType($this->getType(), $element) === false) { throw new InvalidArgumentException( @@ -63,125 +55,112 @@ public function addFirst($element): bool ); } - $this->index--; - - $this->data[$this->index] = $element; + array_unshift($this->data, $element); return true; } /** - * @inheritDoc + * @throws InvalidArgumentException if $element is of the wrong type */ - public function addLast($element): bool + public function addLast(mixed $element): bool { return $this->add($element); } - /** - * @inheritDoc - */ - public function offerFirst($element): bool + public function offerFirst(mixed $element): bool { try { return $this->addFirst($element); - } catch (InvalidArgumentException $e) { + } catch (InvalidArgumentException) { return false; } } - /** - * @inheritDoc - */ - public function offerLast($element): bool + public function offerLast(mixed $element): bool { return $this->offer($element); } /** - * @inheritDoc + * @return T the first element in this queue. + * + * @throws NoSuchElementException if the queue is empty */ - public function removeFirst() + public function removeFirst(): mixed { return $this->remove(); } /** - * @inheritDoc + * @return T the last element in this queue. + * + * @throws NoSuchElementException if this queue is empty. */ - public function removeLast() + public function removeLast(): mixed { - $tail = $this->pollLast(); - - if ($tail === null) { - throw new NoSuchElementException('Can\'t return element from Queue. Queue is empty.'); - } - - return $tail; + return $this->pollLast() ?? throw new NoSuchElementException( + 'Can\'t return element from Queue. Queue is empty.', + ); } /** - * @inheritDoc + * @return T | null the head of this queue, or `null` if this queue is empty. */ - public function pollFirst() + public function pollFirst(): mixed { return $this->poll(); } /** - * @inheritDoc + * @return T | null the tail of this queue, or `null` if this queue is empty. */ - public function pollLast() + public function pollLast(): mixed { - if ($this->count() === 0) { - return null; - } - - $tail = $this[$this->tail]; - - unset($this[$this->tail]); - $this->tail--; - - return $tail; + return array_pop($this->data); } /** - * @inheritDoc + * @return T the head of this queue. + * + * @throws NoSuchElementException if this queue is empty. */ - public function firstElement() + public function firstElement(): mixed { return $this->element(); } /** - * @inheritDoc + * @return T the tail of this queue. + * + * @throws NoSuchElementException if this queue is empty. */ - public function lastElement() + public function lastElement(): mixed { - if ($this->count() === 0) { - throw new NoSuchElementException('Can\'t return element from Queue. Queue is empty.'); - } - - return $this->data[$this->tail]; + return $this->peekLast() ?? throw new NoSuchElementException( + 'Can\'t return element from Queue. Queue is empty.', + ); } /** - * @inheritDoc + * @return T | null the head of this queue, or `null` if this queue is empty. */ - public function peekFirst() + public function peekFirst(): mixed { return $this->peek(); } /** - * @inheritDoc + * @return T | null the tail of this queue, or `null` if this queue is empty. */ - public function peekLast() + public function peekLast(): mixed { - if ($this->count() === 0) { + $lastIndex = array_key_last($this->data); + + if ($lastIndex === null) { return null; } - return $this->data[$this->tail]; + return $this->data[$lastIndex]; } } diff --git a/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php b/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php index 3fa4ecab8..15cc0e97b 100644 --- a/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php +++ b/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php @@ -181,8 +181,7 @@ interface DoubleEndedQueueInterface extends QueueInterface * Implementations should use a more-specific exception that extends * `\RuntimeException`. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function addFirst($element): bool; + public function addFirst(mixed $element): bool; /** * Inserts the specified element at the end of this queue if it is possible @@ -202,8 +201,7 @@ public function addFirst($element): bool; * Implementations should use a more-specific exception that extends * `\RuntimeException`. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function addLast($element): bool; + public function addLast(mixed $element): bool; /** * Inserts the specified element at the front of this queue if it is @@ -217,8 +215,7 @@ public function addLast($element): bool; * * @return bool `true` if the element was added to this queue, else `false`. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function offerFirst($element): bool; + public function offerFirst(mixed $element): bool; /** * Inserts the specified element at the end of this queue if it is possible @@ -232,8 +229,7 @@ public function offerFirst($element): bool; * * @return bool `true` if the element was added to this queue, else `false`. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function offerLast($element): bool; + public function offerLast(mixed $element): bool; /** * Retrieves and removes the head of this queue. @@ -245,7 +241,7 @@ public function offerLast($element): bool; * * @throws NoSuchElementException if this queue is empty. */ - public function removeFirst(); + public function removeFirst(): mixed; /** * Retrieves and removes the tail of this queue. @@ -257,23 +253,23 @@ public function removeFirst(); * * @throws NoSuchElementException if this queue is empty. */ - public function removeLast(); + public function removeLast(): mixed; /** * Retrieves and removes the head of this queue, or returns `null` if this * queue is empty. * - * @return T|null the head of this queue, or `null` if this queue is empty. + * @return T | null the head of this queue, or `null` if this queue is empty. */ - public function pollFirst(); + public function pollFirst(): mixed; /** * Retrieves and removes the tail of this queue, or returns `null` if this * queue is empty. * - * @return T|null the tail of this queue, or `null` if this queue is empty. + * @return T | null the tail of this queue, or `null` if this queue is empty. */ - public function pollLast(); + public function pollLast(): mixed; /** * Retrieves, but does not remove, the head of this queue. @@ -285,7 +281,7 @@ public function pollLast(); * * @throws NoSuchElementException if this queue is empty. */ - public function firstElement(); + public function firstElement(): mixed; /** * Retrieves, but does not remove, the tail of this queue. @@ -297,21 +293,21 @@ public function firstElement(); * * @throws NoSuchElementException if this queue is empty. */ - public function lastElement(); + public function lastElement(): mixed; /** * Retrieves, but does not remove, the head of this queue, or returns `null` * if this queue is empty. * - * @return T|null the head of this queue, or `null` if this queue is empty. + * @return T | null the head of this queue, or `null` if this queue is empty. */ - public function peekFirst(); + public function peekFirst(): mixed; /** * Retrieves, but does not remove, the tail of this queue, or returns `null` * if this queue is empty. * - * @return T|null the tail of this queue, or `null` if this queue is empty. + * @return T | null the tail of this queue, or `null` if this queue is empty. */ - public function peekLast(); + public function peekLast(): mixed; } diff --git a/lib/Google/vendor/ramsey/collection/src/Exception/InvalidSortOrderException.php b/lib/Google/vendor/ramsey/collection/src/Exception/CollectionException.php similarity index 70% rename from lib/Google/vendor/ramsey/collection/src/Exception/InvalidSortOrderException.php rename to lib/Google/vendor/ramsey/collection/src/Exception/CollectionException.php index 4491429c7..4aa92bed8 100644 --- a/lib/Google/vendor/ramsey/collection/src/Exception/InvalidSortOrderException.php +++ b/lib/Google/vendor/ramsey/collection/src/Exception/CollectionException.php @@ -14,11 +14,8 @@ namespace Ramsey\Collection\Exception; -use RuntimeException; +use Throwable; -/** - * Thrown when attempting to use a sort order that is not recognized. - */ -class InvalidSortOrderException extends RuntimeException +interface CollectionException extends Throwable { } diff --git a/lib/Google/vendor/ramsey/collection/src/Exception/CollectionMismatchException.php b/lib/Google/vendor/ramsey/collection/src/Exception/CollectionMismatchException.php index 7058bcf6e..42f5be2df 100644 --- a/lib/Google/vendor/ramsey/collection/src/Exception/CollectionMismatchException.php +++ b/lib/Google/vendor/ramsey/collection/src/Exception/CollectionMismatchException.php @@ -19,6 +19,6 @@ /** * Thrown when attempting to operate on collections of differing types. */ -class CollectionMismatchException extends RuntimeException +class CollectionMismatchException extends RuntimeException implements CollectionException { } diff --git a/lib/Google/vendor/ramsey/collection/src/Exception/InvalidArgumentException.php b/lib/Google/vendor/ramsey/collection/src/Exception/InvalidArgumentException.php index dcc3eac60..7b41b4a7c 100644 --- a/lib/Google/vendor/ramsey/collection/src/Exception/InvalidArgumentException.php +++ b/lib/Google/vendor/ramsey/collection/src/Exception/InvalidArgumentException.php @@ -14,9 +14,11 @@ namespace Ramsey\Collection\Exception; +use InvalidArgumentException as PhpInvalidArgumentException; + /** * Thrown to indicate an argument is not of the expected type. */ -class InvalidArgumentException extends \InvalidArgumentException +class InvalidArgumentException extends PhpInvalidArgumentException implements CollectionException { } diff --git a/lib/Google/vendor/ramsey/collection/src/Exception/ValueExtractionException.php b/lib/Google/vendor/ramsey/collection/src/Exception/InvalidPropertyOrMethod.php similarity index 62% rename from lib/Google/vendor/ramsey/collection/src/Exception/ValueExtractionException.php rename to lib/Google/vendor/ramsey/collection/src/Exception/InvalidPropertyOrMethod.php index 32f2a175f..a53be14aa 100644 --- a/lib/Google/vendor/ramsey/collection/src/Exception/ValueExtractionException.php +++ b/lib/Google/vendor/ramsey/collection/src/Exception/InvalidPropertyOrMethod.php @@ -17,8 +17,10 @@ use RuntimeException; /** - * Thrown when attempting to extract a value for a method or property that does not exist. + * Thrown when attempting to evaluate a property, method, or array key + * that doesn't exist on an element or cannot otherwise be evaluated in the + * current context. */ -class ValueExtractionException extends RuntimeException +class InvalidPropertyOrMethod extends RuntimeException implements CollectionException { } diff --git a/lib/Google/vendor/ramsey/collection/src/Exception/NoSuchElementException.php b/lib/Google/vendor/ramsey/collection/src/Exception/NoSuchElementException.php index cabcb9d88..cd98f0c0f 100644 --- a/lib/Google/vendor/ramsey/collection/src/Exception/NoSuchElementException.php +++ b/lib/Google/vendor/ramsey/collection/src/Exception/NoSuchElementException.php @@ -19,6 +19,6 @@ /** * Thrown when attempting to access an element that does not exist. */ -class NoSuchElementException extends RuntimeException +class NoSuchElementException extends RuntimeException implements CollectionException { } diff --git a/lib/Google/vendor/ramsey/collection/src/Exception/OutOfBoundsException.php b/lib/Google/vendor/ramsey/collection/src/Exception/OutOfBoundsException.php index 4e9d16fa3..c75294e53 100644 --- a/lib/Google/vendor/ramsey/collection/src/Exception/OutOfBoundsException.php +++ b/lib/Google/vendor/ramsey/collection/src/Exception/OutOfBoundsException.php @@ -14,9 +14,11 @@ namespace Ramsey\Collection\Exception; +use OutOfBoundsException as PhpOutOfBoundsException; + /** * Thrown when attempting to access an element out of the range of the collection. */ -class OutOfBoundsException extends \OutOfBoundsException +class OutOfBoundsException extends PhpOutOfBoundsException implements CollectionException { } diff --git a/lib/Google/vendor/ramsey/collection/src/Exception/UnsupportedOperationException.php b/lib/Google/vendor/ramsey/collection/src/Exception/UnsupportedOperationException.php index 9b6228971..d074f45fd 100644 --- a/lib/Google/vendor/ramsey/collection/src/Exception/UnsupportedOperationException.php +++ b/lib/Google/vendor/ramsey/collection/src/Exception/UnsupportedOperationException.php @@ -19,6 +19,6 @@ /** * Thrown to indicate that the requested operation is not supported. */ -class UnsupportedOperationException extends RuntimeException +class UnsupportedOperationException extends RuntimeException implements CollectionException { } diff --git a/lib/Google/vendor/ramsey/collection/src/Map/AbstractMap.php b/lib/Google/vendor/ramsey/collection/src/Map/AbstractMap.php index 378807289..92f23e605 100644 --- a/lib/Google/vendor/ramsey/collection/src/Map/AbstractMap.php +++ b/lib/Google/vendor/ramsey/collection/src/Map/AbstractMap.php @@ -16,6 +16,7 @@ use Ramsey\Collection\AbstractArray; use Ramsey\Collection\Exception\InvalidArgumentException; +use Traversable; use function array_key_exists; use function array_keys; @@ -26,16 +27,36 @@ * This class provides a basic implementation of `MapInterface`, to minimize the * effort required to implement this interface. * + * @template K of array-key * @template T * @extends AbstractArray - * @implements MapInterface + * @implements MapInterface */ abstract class AbstractMap extends AbstractArray implements MapInterface { /** + * @param array $data The initial items to add to this map. + */ + public function __construct(array $data = []) + { + parent::__construct($data); + } + + /** + * @return Traversable + */ + public function getIterator(): Traversable + { + return parent::getIterator(); + } + + /** + * @param K $offset The offset to set + * @param T $value The value to set at the given offset. + * * @inheritDoc */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if ($offset === null) { throw new InvalidArgumentException( @@ -47,18 +68,12 @@ public function offsetSet($offset, $value): void $this->data[$offset] = $value; } - /** - * @inheritDoc - */ - public function containsKey($key): bool + public function containsKey(int | string $key): bool { return array_key_exists($key, $this->data); } - /** - * @inheritDoc - */ - public function containsValue($value): bool + public function containsValue(mixed $value): bool { return in_array($value, $this->data, true); } @@ -68,25 +83,29 @@ public function containsValue($value): bool */ public function keys(): array { + /** @var list */ return array_keys($this->data); } /** - * @inheritDoc + * @param K $key The key to return from the map. + * @param T | null $defaultValue The default value to use if `$key` is not found. + * + * @return T | null the value or `null` if the key could not be found. */ - public function get($key, $defaultValue = null) + public function get(int | string $key, mixed $defaultValue = null): mixed { - if (!$this->containsKey($key)) { - return $defaultValue; - } - - return $this[$key]; + return $this[$key] ?? $defaultValue; } /** - * @inheritDoc + * @param K $key The key to put or replace in the map. + * @param T $value The value to store at `$key`. + * + * @return T | null the previous value associated with key, or `null` if + * there was no mapping for `$key`. */ - public function put($key, $value) + public function put(int | string $key, mixed $value): mixed { $previousValue = $this->get($key); $this[$key] = $value; @@ -95,9 +114,13 @@ public function put($key, $value) } /** - * @inheritDoc + * @param K $key The key to put in the map. + * @param T $value The value to store at `$key`. + * + * @return T | null the previous value associated with key, or `null` if + * there was no mapping for `$key`. */ - public function putIfAbsent($key, $value) + public function putIfAbsent(int | string $key, mixed $value): mixed { $currentValue = $this->get($key); @@ -109,9 +132,12 @@ public function putIfAbsent($key, $value) } /** - * @inheritDoc + * @param K $key The key to remove from the map. + * + * @return T | null the previous value associated with key, or `null` if + * there was no mapping for `$key`. */ - public function remove($key) + public function remove(int | string $key): mixed { $previousValue = $this->get($key); unset($this[$key]); @@ -119,10 +145,7 @@ public function remove($key) return $previousValue; } - /** - * @inheritDoc - */ - public function removeIf($key, $value): bool + public function removeIf(int | string $key, mixed $value): bool { if ($this->get($key) === $value) { unset($this[$key]); @@ -134,9 +157,13 @@ public function removeIf($key, $value): bool } /** - * @inheritDoc + * @param K $key The key to replace. + * @param T $value The value to set at `$key`. + * + * @return T | null the previous value associated with key, or `null` if + * there was no mapping for `$key`. */ - public function replace($key, $value) + public function replace(int | string $key, mixed $value): mixed { $currentValue = $this->get($key); @@ -147,10 +174,7 @@ public function replace($key, $value) return $currentValue; } - /** - * @inheritDoc - */ - public function replaceIf($key, $oldValue, $newValue): bool + public function replaceIf(int | string $key, mixed $oldValue, mixed $newValue): bool { if ($this->get($key) === $oldValue) { $this[$key] = $newValue; @@ -160,4 +184,22 @@ public function replaceIf($key, $oldValue, $newValue): bool return false; } + + /** + * @return array + */ + public function __serialize(): array + { + /** @var array */ + return parent::__serialize(); + } + + /** + * @return array + */ + public function toArray(): array + { + /** @var array */ + return parent::toArray(); + } } diff --git a/lib/Google/vendor/ramsey/collection/src/Map/AbstractTypedMap.php b/lib/Google/vendor/ramsey/collection/src/Map/AbstractTypedMap.php index 486dc2e29..8b6cc0484 100644 --- a/lib/Google/vendor/ramsey/collection/src/Map/AbstractTypedMap.php +++ b/lib/Google/vendor/ramsey/collection/src/Map/AbstractTypedMap.php @@ -18,16 +18,14 @@ use Ramsey\Collection\Tool\TypeTrait; use Ramsey\Collection\Tool\ValueToStringTrait; -use function var_export; - /** * This class provides a basic implementation of `TypedMapInterface`, to * minimize the effort required to implement this interface. * * @template K of array-key * @template T - * @extends AbstractMap - * @implements TypedMapInterface + * @extends AbstractMap + * @implements TypedMapInterface */ abstract class AbstractTypedMap extends AbstractMap implements TypedMapInterface { @@ -35,20 +33,13 @@ abstract class AbstractTypedMap extends AbstractMap implements TypedMapInterface use ValueToStringTrait; /** - * @param K|null $offset + * @param K $offset * @param T $value * * @inheritDoc */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { - if ($offset === null) { - throw new InvalidArgumentException( - 'Map elements are key/value pairs; a key must be provided for ' - . 'value ' . var_export($value, true), - ); - } - if ($this->checkType($this->getKeyType(), $offset) === false) { throw new InvalidArgumentException( 'Key must be of type ' . $this->getKeyType() . '; key is ' diff --git a/lib/Google/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php b/lib/Google/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php index 79a314d96..34e4e853b 100644 --- a/lib/Google/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php +++ b/lib/Google/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php @@ -17,8 +17,7 @@ /** * `AssociativeArrayMap` represents a standard associative array object. * - * @template T - * @extends AbstractMap + * @extends AbstractMap */ class AssociativeArrayMap extends AbstractMap { diff --git a/lib/Google/vendor/ramsey/collection/src/Map/MapInterface.php b/lib/Google/vendor/ramsey/collection/src/Map/MapInterface.php index 6ed0b2967..22ba1bdd1 100644 --- a/lib/Google/vendor/ramsey/collection/src/Map/MapInterface.php +++ b/lib/Google/vendor/ramsey/collection/src/Map/MapInterface.php @@ -21,6 +21,7 @@ * * A map cannot contain duplicate keys; each key can map to at most one value. * + * @template K of array-key * @template T * @extends ArrayInterface */ @@ -29,9 +30,9 @@ interface MapInterface extends ArrayInterface /** * Returns `true` if this map contains a mapping for the specified key. * - * @param array-key $key The key to check in the map. + * @param K $key The key to check in the map. */ - public function containsKey($key): bool; + public function containsKey(int | string $key): bool; /** * Returns `true` if this map maps one or more keys to the specified value. @@ -40,13 +41,12 @@ public function containsKey($key): bool; * * @param T $value The value to check in the map. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function containsValue($value): bool; + public function containsValue(mixed $value): bool; /** * Return an array of the keys contained in this map. * - * @return list + * @return list */ public function keys(): array; @@ -55,13 +55,12 @@ public function keys(): array; * map contains no mapping for the key, or (optionally) `$defaultValue` if * this map contains no mapping for the key. * - * @param array-key $key The key to return from the map. - * @param T|null $defaultValue The default value to use if `$key` is not found. + * @param K $key The key to return from the map. + * @param T | null $defaultValue The default value to use if `$key` is not found. * - * @return T|null the value or `null` if the key could not be found. + * @return T | null the value or `null` if the key could not be found. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function get($key, $defaultValue = null); + public function get(int | string $key, mixed $defaultValue = null): mixed; /** * Associates the specified value with the specified key in this map. @@ -69,14 +68,13 @@ public function get($key, $defaultValue = null); * If the map previously contained a mapping for the key, the old value is * replaced by the specified value. * - * @param array-key $key The key to put or replace in the map. + * @param K $key The key to put or replace in the map. * @param T $value The value to store at `$key`. * - * @return T|null the previous value associated with key, or `null` if + * @return T | null the previous value associated with key, or `null` if * there was no mapping for `$key`. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function put($key, $value); + public function put(int | string $key, mixed $value): mixed; /** * Associates the specified value with the specified key in this map only if @@ -85,25 +83,23 @@ public function put($key, $value); * If there is already a value associated with `$key`, this returns that * value without replacing it. * - * @param array-key $key The key to put in the map. + * @param K $key The key to put in the map. * @param T $value The value to store at `$key`. * - * @return T|null the previous value associated with key, or `null` if + * @return T | null the previous value associated with key, or `null` if * there was no mapping for `$key`. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function putIfAbsent($key, $value); + public function putIfAbsent(int | string $key, mixed $value): mixed; /** * Removes the mapping for a key from this map if it is present. * - * @param array-key $key The key to remove from the map. + * @param K $key The key to remove from the map. * - * @return T|null the previous value associated with key, or `null` if + * @return T | null the previous value associated with key, or `null` if * there was no mapping for `$key`. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function remove($key); + public function remove(int | string $key): mixed; /** * Removes the entry for the specified key only if it is currently mapped to @@ -111,26 +107,24 @@ public function remove($key); * * This performs a strict type check on the value. * - * @param array-key $key The key to remove from the map. + * @param K $key The key to remove from the map. * @param T $value The value to match. * * @return bool true if the value was removed. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function removeIf($key, $value): bool; + public function removeIf(int | string $key, mixed $value): bool; /** * Replaces the entry for the specified key only if it is currently mapped * to some value. * - * @param array-key $key The key to replace. + * @param K $key The key to replace. * @param T $value The value to set at `$key`. * - * @return T|null the previous value associated with key, or `null` if + * @return T | null the previous value associated with key, or `null` if * there was no mapping for `$key`. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function replace($key, $value); + public function replace(int | string $key, mixed $value): mixed; /** * Replaces the entry for the specified key only if currently mapped to the @@ -138,12 +132,11 @@ public function replace($key, $value); * * This performs a strict type check on the value. * - * @param array-key $key The key to remove from the map. + * @param K $key The key to remove from the map. * @param T $oldValue The value to match. * @param T $newValue The value to use as a replacement. * * @return bool true if the value was replaced. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function replaceIf($key, $oldValue, $newValue): bool; + public function replaceIf(int | string $key, mixed $oldValue, mixed $newValue): bool; } diff --git a/lib/Google/vendor/ramsey/collection/src/Map/NamedParameterMap.php b/lib/Google/vendor/ramsey/collection/src/Map/NamedParameterMap.php index 6e391e970..f948e476c 100644 --- a/lib/Google/vendor/ramsey/collection/src/Map/NamedParameterMap.php +++ b/lib/Google/vendor/ramsey/collection/src/Map/NamedParameterMap.php @@ -21,13 +21,12 @@ use function array_combine; use function array_key_exists; use function is_int; -use function var_export; /** * `NamedParameterMap` represents a mapping of values to a set of named keys * that may optionally be typed * - * @extends AbstractMap + * @extends AbstractMap */ class NamedParameterMap extends AbstractMap { @@ -39,13 +38,13 @@ class NamedParameterMap extends AbstractMap * * @var array */ - protected array $namedParameters; + private readonly array $namedParameters; /** * Constructs a new `NamedParameterMap`. * * @param array $namedParameters The named parameters defined for this map. - * @param array $data An initial set of data to set on this map. + * @param array $data An initial set of data to set on this map. */ public function __construct(array $namedParameters, array $data = []) { @@ -63,22 +62,12 @@ public function getNamedParameters(): array return $this->namedParameters; } - /** - * @inheritDoc - */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { - if ($offset === null) { - throw new InvalidArgumentException( - 'Map elements are key/value pairs; a key must be provided for ' - . 'value ' . var_export($value, true), - ); - } - if (!array_key_exists($offset, $this->namedParameters)) { throw new InvalidArgumentException( 'Attempting to set value for unconfigured parameter \'' - . $offset . '\'', + . $this->toolValueToString($offset) . '\'', ); } diff --git a/lib/Google/vendor/ramsey/collection/src/Map/TypedMap.php b/lib/Google/vendor/ramsey/collection/src/Map/TypedMap.php index 77ef8d314..4a090c812 100644 --- a/lib/Google/vendor/ramsey/collection/src/Map/TypedMap.php +++ b/lib/Google/vendor/ramsey/collection/src/Map/TypedMap.php @@ -14,8 +14,6 @@ namespace Ramsey\Collection\Map; -use Ramsey\Collection\Tool\TypeTrait; - /** * A `TypedMap` represents a map of elements where key and value are typed. * @@ -31,7 +29,7 @@ * * Example usage: * - * ```php + * ``` * $map = new TypedMap('string', Foo::class); * $map['x'] = new Foo(); * foreach ($map as $key => $value) { @@ -53,7 +51,7 @@ * It is preferable to subclass `AbstractTypedMap` to create your own typed map * implementation: * - * ```php + * ``` * class FooTypedMap extends AbstractTypedMap * { * public function getKeyType() @@ -70,7 +68,7 @@ * * … but you also may use the `TypedMap` class: * - * ```php + * ``` * class FooTypedMap extends TypedMap * { * public function __constructor(array $data = []) @@ -86,24 +84,6 @@ */ class TypedMap extends AbstractTypedMap { - use TypeTrait; - - /** - * The data type of keys stored in this collection. - * - * A map key's type is immutable once it is set. For this reason, this - * property is set private. - */ - private string $keyType; - - /** - * The data type of values stored in this collection. - * - * A map value's type is immutable once it is set. For this reason, this - * property is set private. - */ - private string $valueType; - /** * Constructs a map object of the specified key and value types, * optionally with the specified data. @@ -112,11 +92,11 @@ class TypedMap extends AbstractTypedMap * @param string $valueType The data type of the map's values. * @param array $data The initial data to set for this map. */ - public function __construct(string $keyType, string $valueType, array $data = []) - { - $this->keyType = $keyType; - $this->valueType = $valueType; - + public function __construct( + private readonly string $keyType, + private readonly string $valueType, + array $data = [], + ) { parent::__construct($data); } diff --git a/lib/Google/vendor/ramsey/collection/src/Map/TypedMapInterface.php b/lib/Google/vendor/ramsey/collection/src/Map/TypedMapInterface.php index 0308109cc..5a44f0647 100644 --- a/lib/Google/vendor/ramsey/collection/src/Map/TypedMapInterface.php +++ b/lib/Google/vendor/ramsey/collection/src/Map/TypedMapInterface.php @@ -18,8 +18,9 @@ * A `TypedMapInterface` represents a map of elements where key and value are * typed. * + * @template K of array-key * @template T - * @extends MapInterface + * @extends MapInterface */ interface TypedMapInterface extends MapInterface { diff --git a/lib/Google/vendor/ramsey/collection/src/Queue.php b/lib/Google/vendor/ramsey/collection/src/Queue.php index bc8c24e1c..0f5b33740 100644 --- a/lib/Google/vendor/ramsey/collection/src/Queue.php +++ b/lib/Google/vendor/ramsey/collection/src/Queue.php @@ -19,6 +19,8 @@ use Ramsey\Collection\Tool\TypeTrait; use Ramsey\Collection\Tool\ValueToStringTrait; +use function array_key_first; + /** * This class provides a basic implementation of `QueueInterface`, to minimize * the effort required to implement this interface. @@ -32,29 +34,15 @@ class Queue extends AbstractArray implements QueueInterface use TypeTrait; use ValueToStringTrait; - /** - * The type of elements stored in this queue. - * - * A queue's type is immutable once it is set. For this reason, this - * property is set private. - */ - private string $queueType; - - /** - * The index of the head of the queue. - */ - protected int $index = 0; - /** * Constructs a queue object of the specified type, optionally with the * specified data. * - * @param string $queueType The type (FQCN) associated with this queue. - * @param array $data The initial items to store in the collection. + * @param string $queueType The type or class name associated with this queue. + * @param array $data The initial items to store in the queue. */ - public function __construct(string $queueType, array $data = []) + public function __construct(private readonly string $queueType, array $data = []) { - $this->queueType = $queueType; parent::__construct($data); } @@ -65,9 +53,9 @@ public function __construct(string $queueType, array $data = []) * serves only to fulfill the `ArrayAccess` interface requirements. It is * invoked by other operations when adding values to the queue. * - * @throws InvalidArgumentException if $value is of the wrong type + * @throws InvalidArgumentException if $value is of the wrong type. */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if ($this->checkType($this->getType(), $value) === false) { throw new InvalidArgumentException( @@ -80,11 +68,9 @@ public function offsetSet($offset, $value): void } /** - * @throws InvalidArgumentException if $value is of the wrong type - * - * @inheritDoc + * @throws InvalidArgumentException if $value is of the wrong type. */ - public function add($element): bool + public function add(mixed $element): bool { $this[] = $element; @@ -92,74 +78,67 @@ public function add($element): bool } /** - * @inheritDoc + * @return T + * + * @throws NoSuchElementException if this queue is empty. */ - public function element() + public function element(): mixed { - $element = $this->peek(); - - if ($element === null) { - throw new NoSuchElementException( - 'Can\'t return element from Queue. Queue is empty.', - ); - } - - return $element; + return $this->peek() ?? throw new NoSuchElementException( + 'Can\'t return element from Queue. Queue is empty.', + ); } - /** - * @inheritDoc - */ - public function offer($element): bool + public function offer(mixed $element): bool { try { return $this->add($element); - } catch (InvalidArgumentException $e) { + } catch (InvalidArgumentException) { return false; } } /** - * @inheritDoc + * @return T | null */ - public function peek() + public function peek(): mixed { - if ($this->count() === 0) { + $index = array_key_first($this->data); + + if ($index === null) { return null; } - return $this[$this->index]; + return $this[$index]; } /** - * @inheritDoc + * @return T | null */ - public function poll() + public function poll(): mixed { - if ($this->count() === 0) { + $index = array_key_first($this->data); + + if ($index === null) { return null; } - $head = $this[$this->index]; - - unset($this[$this->index]); - $this->index++; + $head = $this[$index]; + unset($this[$index]); return $head; } /** - * @inheritDoc + * @return T + * + * @throws NoSuchElementException if this queue is empty. */ - public function remove() + public function remove(): mixed { - $head = $this->poll(); - - if ($head === null) { - throw new NoSuchElementException('Can\'t return element from Queue. Queue is empty.'); - } - - return $head; + return $this->poll() ?? throw new NoSuchElementException( + 'Can\'t return element from Queue. Queue is empty.', + ); } public function getType(): string diff --git a/lib/Google/vendor/ramsey/collection/src/QueueInterface.php b/lib/Google/vendor/ramsey/collection/src/QueueInterface.php index 4f91487fa..f29ce43ab 100644 --- a/lib/Google/vendor/ramsey/collection/src/QueueInterface.php +++ b/lib/Google/vendor/ramsey/collection/src/QueueInterface.php @@ -129,8 +129,7 @@ interface QueueInterface extends ArrayInterface * Implementations should use a more-specific exception that extends * `\RuntimeException`. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function add($element): bool; + public function add(mixed $element): bool; /** * Retrieves, but does not remove, the head of this queue. @@ -144,7 +143,7 @@ public function add($element): bool; * * @throws NoSuchElementException if this queue is empty. */ - public function element(); + public function element(): mixed; /** * Inserts the specified element into this queue if it is possible to do so @@ -160,8 +159,7 @@ public function element(); * * @return bool `true` if the element was added to this queue, else `false`. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - public function offer($element): bool; + public function offer(mixed $element): bool; /** * Retrieves, but does not remove, the head of this queue, or returns `null` @@ -169,9 +167,9 @@ public function offer($element): bool; * * @see self::element() * - * @return T|null the head of this queue, or `null` if this queue is empty. + * @return T | null the head of this queue, or `null` if this queue is empty. */ - public function peek(); + public function peek(): mixed; /** * Retrieves and removes the head of this queue, or returns `null` @@ -179,9 +177,9 @@ public function peek(); * * @see self::remove() * - * @return T|null the head of this queue, or `null` if this queue is empty. + * @return T | null the head of this queue, or `null` if this queue is empty. */ - public function poll(); + public function poll(): mixed; /** * Retrieves and removes the head of this queue. @@ -195,7 +193,7 @@ public function poll(); * * @throws NoSuchElementException if this queue is empty. */ - public function remove(); + public function remove(): mixed; /** * Returns the type associated with this queue. diff --git a/lib/Google/vendor/ramsey/collection/src/Set.php b/lib/Google/vendor/ramsey/collection/src/Set.php index c1d37ccca..d60f2487a 100644 --- a/lib/Google/vendor/ramsey/collection/src/Set.php +++ b/lib/Google/vendor/ramsey/collection/src/Set.php @@ -24,11 +24,11 @@ * * Example usage: * - * ``` php + * ``` * $foo = new \My\Foo(); * $set = new Set(\My\Foo::class); * - * $set->add($foo); // returns TRUE, the element don't exists + * $set->add($foo); // returns TRUE, the element doesn't exist * $set->add($foo); // returns FALSE, the element already exists * * $bar = new \My\Foo(); @@ -40,23 +40,15 @@ */ class Set extends AbstractSet { - /** - * The type of elements stored in this set - * - * A set's type is immutable. For this reason, this property is private. - */ - private string $setType; - /** * Constructs a set object of the specified type, optionally with the * specified data. * - * @param string $setType The type (FQCN) associated with this set. + * @param string $setType The type or class name associated with this set. * @param array $data The initial items to store in the set. */ - public function __construct(string $setType, array $data = []) + public function __construct(private readonly string $setType, array $data = []) { - $this->setType = $setType; parent::__construct($data); } diff --git a/lib/Google/vendor/ramsey/collection/src/Sort.php b/lib/Google/vendor/ramsey/collection/src/Sort.php new file mode 100644 index 000000000..0c3c19213 --- /dev/null +++ b/lib/Google/vendor/ramsey/collection/src/Sort.php @@ -0,0 +1,31 @@ + + * @license http://opensource.org/licenses/MIT MIT + */ + +declare(strict_types=1); + +namespace Ramsey\Collection; + +/** + * Collection sorting + */ +enum Sort: string +{ + /** + * Sort items in a collection in ascending order. + */ + case Ascending = 'asc'; + + /** + * Sort items in a collection in descending order. + */ + case Descending = 'desc'; +} diff --git a/lib/Google/vendor/ramsey/collection/src/Tool/TypeTrait.php b/lib/Google/vendor/ramsey/collection/src/Tool/TypeTrait.php index 728d44b65..ac51b7f10 100644 --- a/lib/Google/vendor/ramsey/collection/src/Tool/TypeTrait.php +++ b/lib/Google/vendor/ramsey/collection/src/Tool/TypeTrait.php @@ -36,39 +36,22 @@ trait TypeTrait * @param string $type The type to check the value against. * @param mixed $value The value to check. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - protected function checkType(string $type, $value): bool + protected function checkType(string $type, mixed $value): bool { - switch ($type) { - case 'array': - return is_array($value); - case 'bool': - case 'boolean': - return is_bool($value); - case 'callable': - return is_callable($value); - case 'float': - case 'double': - return is_float($value); - case 'int': - case 'integer': - return is_int($value); - case 'null': - return $value === null; - case 'numeric': - return is_numeric($value); - case 'object': - return is_object($value); - case 'resource': - return is_resource($value); - case 'scalar': - return is_scalar($value); - case 'string': - return is_string($value); - case 'mixed': - return true; - default: - return $value instanceof $type; - } + return match ($type) { + 'array' => is_array($value), + 'bool', 'boolean' => is_bool($value), + 'callable' => is_callable($value), + 'float', 'double' => is_float($value), + 'int', 'integer' => is_int($value), + 'null' => $value === null, + 'numeric' => is_numeric($value), + 'object' => is_object($value), + 'resource' => is_resource($value), + 'scalar' => is_scalar($value), + 'string' => is_string($value), + 'mixed' => true, + default => $value instanceof $type, + }; } } diff --git a/lib/Google/vendor/ramsey/collection/src/Tool/ValueExtractorTrait.php b/lib/Google/vendor/ramsey/collection/src/Tool/ValueExtractorTrait.php index e10824283..bbe27b441 100644 --- a/lib/Google/vendor/ramsey/collection/src/Tool/ValueExtractorTrait.php +++ b/lib/Google/vendor/ramsey/collection/src/Tool/ValueExtractorTrait.php @@ -14,9 +14,11 @@ namespace Ramsey\Collection\Tool; -use Ramsey\Collection\Exception\ValueExtractionException; +use Ramsey\Collection\Exception\InvalidPropertyOrMethod; +use Ramsey\Collection\Exception\UnsupportedOperationException; +use ReflectionProperty; -use function get_class; +use function is_array; use function is_object; use function method_exists; use function property_exists; @@ -28,34 +30,71 @@ trait ValueExtractorTrait { /** - * Extracts the value of the given property or method from the object. + * Returns the type associated with this collection. + */ + abstract public function getType(): string; + + /** + * Extracts the value of the given property, method, or array key from the + * element. + * + * If `$propertyOrMethod` is `null`, we return the element as-is. * - * @param mixed $object The object to extract the value from. - * @param string $propertyOrMethod The property or method for which the + * @param mixed $element The element to extract the value from. + * @param string | null $propertyOrMethod The property or method for which the * value should be extracted. * - * @return mixed the value extracted from the specified property or method. + * @return mixed the value extracted from the specified property, method, + * or array key, or the element itself. * - * @throws ValueExtractionException if the method or property is not defined. + * @throws InvalidPropertyOrMethod + * @throws UnsupportedOperationException */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - protected function extractValue($object, string $propertyOrMethod) + protected function extractValue(mixed $element, ?string $propertyOrMethod): mixed { - if (!is_object($object)) { - throw new ValueExtractionException('Unable to extract a value from a non-object'); + if ($propertyOrMethod === null) { + return $element; + } + + if (!is_object($element) && !is_array($element)) { + throw new UnsupportedOperationException(sprintf( + 'The collection type "%s" does not support the $propertyOrMethod parameter', + $this->getType(), + )); + } + + if (is_array($element)) { + return $element[$propertyOrMethod] ?? throw new InvalidPropertyOrMethod(sprintf( + 'Key or index "%s" not found in collection elements', + $propertyOrMethod, + )); + } + + if (property_exists($element, $propertyOrMethod) && method_exists($element, $propertyOrMethod)) { + $reflectionProperty = new ReflectionProperty($element, $propertyOrMethod); + if ($reflectionProperty->isPublic()) { + return $element->$propertyOrMethod; + } + + return $element->{$propertyOrMethod}(); + } + + if (property_exists($element, $propertyOrMethod)) { + return $element->$propertyOrMethod; } - if (property_exists($object, $propertyOrMethod)) { - return $object->$propertyOrMethod; + if (method_exists($element, $propertyOrMethod)) { + return $element->{$propertyOrMethod}(); } - if (method_exists($object, $propertyOrMethod)) { - return $object->{$propertyOrMethod}(); + if (isset($element->$propertyOrMethod)) { + return $element->$propertyOrMethod; } - throw new ValueExtractionException( - // phpcs:ignore SlevomatCodingStandard.Classes.ModernClassNameReference.ClassNameReferencedViaFunctionCall - sprintf('Method or property "%s" not defined in %s', $propertyOrMethod, get_class($object)), - ); + throw new InvalidPropertyOrMethod(sprintf( + 'Method or property "%s" not defined in %s', + $propertyOrMethod, + $element::class, + )); } } diff --git a/lib/Google/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php b/lib/Google/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php index cacefc8b6..40c780325 100644 --- a/lib/Google/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php +++ b/lib/Google/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php @@ -16,7 +16,7 @@ use DateTimeInterface; -use function get_class; +use function assert; use function get_resource_type; use function is_array; use function is_bool; @@ -24,7 +24,6 @@ use function is_object; use function is_resource; use function is_scalar; -use function var_export; /** * Provides functionality to express a value as string @@ -46,8 +45,7 @@ trait ValueToStringTrait * * @param mixed $value the value to return as a string. */ - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - protected function toolValueToString($value): string + protected function toolValueToString(mixed $value): string { // null if ($value === null) { @@ -74,16 +72,13 @@ protected function toolValueToString($value): string return '(' . get_resource_type($value) . ' resource #' . (int) $value . ')'; } - // If we don't know what it is, use var_export(). - if (!is_object($value)) { - return '(' . var_export($value, true) . ')'; - } - // From here, $value should be an object. + assert(is_object($value)); // __toString() is implemented if (is_callable([$value, '__toString'])) { - return (string) $value->__toString(); + /** @var string */ + return $value->__toString(); } // object of type \DateTime @@ -92,7 +87,6 @@ protected function toolValueToString($value): string } // unknown type - // phpcs:ignore SlevomatCodingStandard.Classes.ModernClassNameReference.ClassNameReferencedViaFunctionCall - return '(' . get_class($value) . ' Object)'; + return '(' . $value::class . ' Object)'; } } diff --git a/lib/Google/vendor/ramsey/uuid/composer.json b/lib/Google/vendor/ramsey/uuid/composer.json index db4429217..b34d9b108 100644 --- a/lib/Google/vendor/ramsey/uuid/composer.json +++ b/lib/Google/vendor/ramsey/uuid/composer.json @@ -10,7 +10,7 @@ ], "require": { "php": "^8.0", - "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13", + "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14", "ramsey/collection": "^1.2 || ^2.0" }, "require-dev": { diff --git a/lib/Google/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php b/lib/Google/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php index 024ed51e1..a2615f1a3 100644 --- a/lib/Google/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php +++ b/lib/Google/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php @@ -15,7 +15,6 @@ namespace Ramsey\Uuid\Generator; use Brick\Math\BigInteger; -use DateTimeImmutable; use DateTimeInterface; use Ramsey\Uuid\Type\Hexadecimal; @@ -68,7 +67,12 @@ public function __construct( */ public function generate($node = null, ?int $clockSeq = null, ?DateTimeInterface $dateTime = null): string { - $time = ($dateTime ?? new DateTimeImmutable('now'))->format('Uv'); + if ($dateTime === null) { + $time = microtime(false); + $time = substr($time, 11) . substr($time, 2, 3); + } else { + $time = $dateTime->format('Uv'); + } if ($time > self::$time || ($dateTime !== null && $time !== self::$time)) { $this->randomize($time); diff --git a/lib/Google/vendor/ramsey/uuid/src/Math/BrickMathCalculator.php b/lib/Google/vendor/ramsey/uuid/src/Math/BrickMathCalculator.php index 869835e9c..649f58039 100644 --- a/lib/Google/vendor/ramsey/uuid/src/Math/BrickMathCalculator.php +++ b/lib/Google/vendor/ramsey/uuid/src/Math/BrickMathCalculator.php @@ -49,10 +49,10 @@ public function add(NumberInterface $augend, NumberInterface ...$addends): Numbe $sum = BigInteger::of($augend->toString()); foreach ($addends as $addend) { - $sum = $sum->plus($addend->toString()); /** @phpstan-ignore possiblyImpure.methodCall */ + $sum = $sum->plus($addend->toString()); } - /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.new */ return new IntegerObject((string) $sum); } @@ -61,10 +61,10 @@ public function subtract(NumberInterface $minuend, NumberInterface ...$subtrahen $difference = BigInteger::of($minuend->toString()); foreach ($subtrahends as $subtrahend) { - $difference = $difference->minus($subtrahend->toString()); /** @phpstan-ignore possiblyImpure.methodCall */ + $difference = $difference->minus($subtrahend->toString()); } - /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.new */ return new IntegerObject((string) $difference); } @@ -73,11 +73,10 @@ public function multiply(NumberInterface $multiplicand, NumberInterface ...$mult $product = BigInteger::of($multiplicand->toString()); foreach ($multipliers as $multiplier) { - /** @phpstan-ignore possiblyImpure.methodCall */ $product = $product->multipliedBy($multiplier->toString()); } - /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.new */ return new IntegerObject((string) $product); } @@ -93,23 +92,22 @@ public function divide( $quotient = BigDecimal::of($dividend->toString()); foreach ($divisors as $divisor) { - /** @phpstan-ignore possiblyImpure.methodCall */ $quotient = $quotient->dividedBy($divisor->toString(), $scale, $brickRounding); } if ($scale === 0) { - /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.methodCall, possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.new */ return new IntegerObject((string) $quotient->toBigInteger()); } - /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.new */ return new Decimal((string) $quotient); } public function fromBase(string $value, int $base): IntegerObject { try { - /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.new */ return new IntegerObject((string) BigInteger::fromBase($value, $base)); } catch (MathException | \InvalidArgumentException $exception) { throw new InvalidArgumentException( @@ -123,7 +121,6 @@ public function fromBase(string $value, int $base): IntegerObject public function toBase(IntegerObject $value, int $base): string { try { - /** @phpstan-ignore possiblyImpure.methodCall */ return BigInteger::of($value->toString())->toBase($base); } catch (MathException | \InvalidArgumentException $exception) { throw new InvalidArgumentException( diff --git a/lib/Google/vendor/rize/uri-template/.php-cs-fixer.dist.php b/lib/Google/vendor/rize/uri-template/.php-cs-fixer.dist.php new file mode 100644 index 000000000..cb2af3860 --- /dev/null +++ b/lib/Google/vendor/rize/uri-template/.php-cs-fixer.dist.php @@ -0,0 +1,19 @@ +setParallelConfig(ParallelConfigFactory::detect()) + ->setRiskyAllowed(true) + ->setUsingCache(false) + ->setRules([ + '@PER-CS2.0' => true, + ]) + ->setFinder( + (new Finder()) + ->in([__DIR__ . '/src', __DIR__ . '/tests']) + ); \ No newline at end of file diff --git a/lib/Google/vendor/rize/uri-template/README.md b/lib/Google/vendor/rize/uri-template/README.md index 52f52fefc..f2293df83 100644 --- a/lib/Google/vendor/rize/uri-template/README.md +++ b/lib/Google/vendor/rize/uri-template/README.md @@ -2,10 +2,13 @@ This is a URI Template implementation in PHP based on [RFC 6570 URI Template](http://tools.ietf.org/html/rfc6570). In addition to URI expansion, it also supports URI extraction (used by [Google Cloud Core](https://github.com/googleapis/google-cloud-php-core) and [Google Cloud Client Library](https://github.com/googleapis/google-cloud-php)). -![CI](https://github.com/rize/UriTemplate/workflows/CI/badge.svg) [![Total Downloads](https://poser.pugx.org/rize/uri-template/downloads.png)](https://packagist.org/packages/rize/uri-template) -[![Financial Contributors on Open Collective](https://opencollective.com/rize-uri-template/all/badge.svg?label=financial+contributors)](https://opencollective.com/rize-uri-template) +![CI](https://github.com/rize/UriTemplate/workflows/CI/badge.svg) [![Total Downloads](https://poser.pugx.org/rize/uri-template/downloads)](https://packagist.org/packages/rize/uri-template) [![Latest Stable Version](https://poser.pugx.org/rize/uri-template/v)](https://packagist.org/packages/rize/uri-template) [![PHP Version Require](https://poser.pugx.org/rize/uri-template/require/php)](https://packagist.org/packages/rize/uri-template) -* [Node.js/Javascript](https://github.com/rezigned/uri-template.js) URI Template +> [!NOTE] +> +> Due to the deprecation of implictly nullable parameter types in [PHP 8.4](https://wiki.php.net/rfc/deprecate-implicitly-nullable-types), we must introduce breaking change by adding explicit nullable types (`?T`) which requires PHP 7.1+. +> +> As a result, version [0.4.0](https://github.com/rize/UriTemplate/releases/tag/0.4.0) and later will no longer support PHP versions below 8.1. ## Usage @@ -217,6 +220,7 @@ Using `composer` * **0.2.5** Add strict mode support for `extract` method * **0.3.0** Improve code quality + RFC3986 support for `extract` method by @Maks3w * **0.3.1** Improve `extract` method to parse two or more adjacent variables separated by dot by @corleonis +* **0.4.0** Fixes the deprecation of implicitly nullable parameter types introduced in PHP 8.4. This version requires PHP 8.1 or later. ## Contributors diff --git a/lib/Google/vendor/rize/uri-template/composer.json b/lib/Google/vendor/rize/uri-template/composer.json index cec985a48..0dbfd2ead 100644 --- a/lib/Google/vendor/rize/uri-template/composer.json +++ b/lib/Google/vendor/rize/uri-template/composer.json @@ -11,10 +11,12 @@ } ], "require": { - "php": ">=5.3.0" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "~4.8.36" + "phpunit/phpunit": "~10.0", + "phpstan/phpstan": "^1.12", + "friendsofphp/php-cs-fixer": "^3.63" }, "autoload": { "psr-4": { @@ -22,6 +24,9 @@ } }, "scripts": { - "test": "vendor/bin/phpunit test/" + "test": "vendor/bin/phpunit", + "cs": "vendor/bin/php-cs-fixer fix --dry-run", + "cs-fix": "vendor/bin/php-cs-fixer fix", + "phpstan": "vendor/bin/phpstan" } } diff --git a/lib/Google/vendor/rize/uri-template/phpstan.neon b/lib/Google/vendor/rize/uri-template/phpstan.neon new file mode 100644 index 000000000..a76a83296 --- /dev/null +++ b/lib/Google/vendor/rize/uri-template/phpstan.neon @@ -0,0 +1,5 @@ +parameters: + level: 5 + paths: + - src + - tests \ No newline at end of file diff --git a/lib/Google/vendor/rize/uri-template/phpunit.xml b/lib/Google/vendor/rize/uri-template/phpunit.xml new file mode 100644 index 000000000..530f84f33 --- /dev/null +++ b/lib/Google/vendor/rize/uri-template/phpunit.xml @@ -0,0 +1,22 @@ + + + + + tests + + + + + + src + + + diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate.php index 330f39b80..51a841ddc 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate.php @@ -5,47 +5,38 @@ use Rize\UriTemplate\Parser; /** - * URI Template + * URI Template. */ class UriTemplate { - /** - * @var Parser - */ - protected $parser, - $parsed = array(), - $base_uri, - $params = array(); - - public function __construct($base_uri = '', $params = array(), Parser $parser = null) + protected Parser $parser; + protected array $parsed = []; + + public function __construct(protected string $base_uri = '', protected array $params = [], ?Parser $parser = null) { - $this->base_uri = $base_uri; - $this->params = $params; - $this->parser = $parser ?: $this->createNodeParser(); + $this->parser = $parser ?: $this->createNodeParser(); } /** - * Expands URI Template + * Expands URI Template. * - * @param string $uri URI Template - * @param array $params URI Template's parameters - * @return string + * @param mixed $params */ - public function expand($uri, $params = array()) + public function expand(string $uri, $params = []): string { $params += $this->params; - $uri = $this->base_uri.$uri; - $result = array(); + $uri = $this->base_uri . $uri; + $result = []; // quick check - if (($start = strpos($uri, '{')) === false) { + if (!str_contains($uri, '{')) { return $uri; } $parser = $this->parser; $nodes = $parser->parse($uri); - foreach($nodes as $node) { + foreach ($nodes as $node) { $result[] = $node->expand($parser, $params); } @@ -53,48 +44,48 @@ public function expand($uri, $params = array()) } /** - * Extracts variables from URI + * Extracts variables from URI. * - * @param string $template - * @param string $uri - * @param bool $strict This will perform a full match * @return null|array params or null if not match and $strict is true */ - public function extract($template, $uri, $strict = false) + public function extract(string $template, string $uri, bool $strict = false): ?array { - $params = array(); + $params = []; $nodes = $this->parser->parse($template); - # PHP 8.1.0RC4-dev still throws deprecation warning for `strlen`. - # $uri = (string) $uri; - - foreach($nodes as $node) { + // PHP 8.1.0RC4-dev still throws deprecation warning for `strlen`. + // $uri = (string) $uri; + foreach ($nodes as $node) { // if strict is given, and there's no remaining uri just return null - if ($strict && !strlen((string) $uri)) { + if ($strict && (string) $uri === '') { return null; } - // uri'll be truncated from the start when a match is found + // URI will be truncated from the start when a match is found $match = $node->match($this->parser, $uri, $params, $strict); - list($uri, $params) = $match; + if ($match === null) { + return null; + } + + [$uri, $params] = $match; } // if there's remaining $uri, matching is failed - if ($strict && strlen((string) $uri)) { + if ($strict && (string) $uri !== '') { return null; } return $params; } - public function getParser() + public function getParser(): Parser { return $this->parser; } - protected function createNodeParser() + protected function createNodeParser(): Parser { static $parser; @@ -102,6 +93,6 @@ protected function createNodeParser() return $parser; } - return $parser = new Parser; + return $parser = new Parser(); } } diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Abstraction.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Abstraction.php index 3f2e3501e..7332df5c4 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Abstraction.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Abstraction.php @@ -5,61 +5,45 @@ use Rize\UriTemplate\Parser; /** - * Base class for all Nodes + * Base class for all Nodes. */ abstract class Abstraction { - /** - * @var string - */ - private $token; - - public function __construct($token) - { - $this->token = $token; - } + public function __construct(private readonly string $token) {} /** * Expands URI template * - * @param Parser $parser - * @param array $params - * @return null|string + * @param array $params */ - public function expand(Parser $parser, array $params = array()) + public function expand(Parser $parser, array $params = []): ?string { return $this->token; } /** - * Matches given URI against current node + * Matches given URI against current node. + * + * @param array $params * - * @param Parser $parser - * @param string $uri - * @param array $params - * @param bool $strict - * @return null|array `uri and params` or `null` if not match and $strict is true + * @return null|array{0: string, 1: array} `uri and params` or `null` if not match and $strict is true */ - public function match(Parser $parser, $uri, $params = array(), $strict = false) + public function match(Parser $parser, string $uri, array $params = [], bool $strict = false): ?array { // match literal string from start to end - $length = strlen($this->token); - if (substr($uri, 0, $length) === $this->token) { - $uri = substr($uri, $length); + if (str_starts_with($uri, $this->token)) { + $uri = substr($uri, strlen($this->token)); } // when there's no match, just return null if strict mode is given - else if ($strict) { + elseif ($strict) { return null; } - return array($uri, $params); + return [$uri, $params]; } - /** - * @return string - */ - public function getToken() + public function getToken(): string { return $this->token; } diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Expression.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Expression.php index 892ccc695..a31fa24c2 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Expression.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Expression.php @@ -2,83 +2,53 @@ namespace Rize\UriTemplate\Node; -use Rize\UriTemplate\Parser; use Rize\UriTemplate\Operator; +use Rize\UriTemplate\Parser; -/** - * Description - */ class Expression extends Abstraction { /** - * @var Operator\Abstraction - */ - private $operator; - - /** - * @var array + * @param string $forwardLookupSeparator */ - private $variables = array(); - - /** - * Whether to do a forward lookup for a given separator - * @var string + public function __construct(string $token, private readonly Operator\Abstraction $operator, private readonly ?array $variables = null, /** + * Whether to do a forward lookup for a given separator. */ - private $forwardLookupSeparator; - - public function __construct($token, Operator\Abstraction $operator, array $variables = null, $forwardLookupSeparator = null) + private $forwardLookupSeparator = null) { parent::__construct($token); - $this->operator = $operator; - $this->variables = $variables; - $this->forwardLookupSeparator = $forwardLookupSeparator; } - /** - * @return Operator\Abstraction - */ - public function getOperator() + public function getOperator(): Operator\Abstraction { return $this->operator; } - /** - * @return array - */ - public function getVariables() + public function getVariables(): ?array { return $this->variables; } - /** - * @return string - */ - public function getForwardLookupSeparator() + public function getForwardLookupSeparator(): string { return $this->forwardLookupSeparator; } - /** - * @param string $forwardLookupSeparator - */ - public function setForwardLookupSeparator($forwardLookupSeparator) + public function setForwardLookupSeparator(string $forwardLookupSeparator): void { $this->forwardLookupSeparator = $forwardLookupSeparator; } - /** - * @param Parser $parser - * @param array $params - * @return null|string - */ - public function expand(Parser $parser, array $params = array()) + public function expand(Parser $parser, array $params = []): ?string { - $data = array(); - $op = $this->operator; + $data = []; + $op = $this->operator; - // check for variable modifiers - foreach($this->variables as $var) { + if ($this->variables === null) { + return $op->first; + } + // check for variable modifiers + foreach ($this->variables as $var) { $val = $op->expand($parser, $var, $params); // skip null value @@ -87,25 +57,21 @@ public function expand(Parser $parser, array $params = array()) } } - return $data ? $op->first.implode($op->sep, $data) : null; + return $data ? $op->first . implode($op->sep, $data) : null; } /** - * Matches given URI against current node + * Matches given URI against current node. * - * @param Parser $parser - * @param string $uri - * @param array $params - * @param bool $strict * @return null|array `uri and params` or `null` if not match and $strict is true */ - public function match(Parser $parser, $uri, $params = array(), $strict = false) + public function match(Parser $parser, string $uri, array $params = [], bool $strict = false): ?array { $op = $this->operator; // check expression operator first if ($op->id && isset($uri[0]) && $uri[0] !== $op->id) { - return array($uri, $params); + return [$uri, $params]; } // remove operator from input @@ -113,9 +79,8 @@ public function match(Parser $parser, $uri, $params = array(), $strict = false) $uri = substr($uri, 1); } - foreach($this->sortVariables($this->variables) as $var) { - /** @var \Rize\UriTemplate\Node\Variable $regex */ - $regex = '#'.$op->toRegex($parser, $var).'#'; + foreach ($this->sortVariables($this->variables) as $var) { + $regex = '#' . $op->toRegex($parser, $var) . '#'; $val = null; // do a forward lookup and get just the relevant part @@ -128,14 +93,13 @@ public function match(Parser $parser, $uri, $params = array(), $strict = false) } if (preg_match($regex, $preparedUri, $match)) { - // remove matched part from input - $preparedUri = preg_replace($regex, '', $preparedUri, $limit = 1); + $preparedUri = preg_replace($regex, '', $preparedUri, 1); $val = $op->extract($parser, $var, $match[0]); } // if strict is given, we quit immediately when there's no match - else if ($strict) { + elseif ($strict) { return null; } @@ -144,21 +108,16 @@ public function match(Parser $parser, $uri, $params = array(), $strict = false) $params[$var->getToken()] = $val; } - return array($uri, $params); + return [$uri, $params]; } /** * Sort variables before extracting data from uri. * We have to sort vars by non-explode to explode. - * - * @param array $vars - * @return array */ - protected function sortVariables(array $vars) + protected function sortVariables(array $vars): array { - usort($vars, function($a, $b) { - return $a->options['modifier'] >= $b->options['modifier'] ? 1 : -1; - }); + usort($vars, static fn($a, $b) => $a->options['modifier'] <=> $b->options['modifier']); return $vars; } diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Literal.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Literal.php index 1c54da129..bc939b6b0 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Literal.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Literal.php @@ -1,11 +1,5 @@ - null, - 'value' => null, - ); + /** + * Variable name without modifier + * e.g. 'term:1' becomes 'term'. + */ + public string $name; + public array $options = ['modifier' => null, 'value' => null]; - public function __construct($token, array $options = array()) + public function __construct(string $token, array $options = []) { parent::__construct($token); $this->options = $options + $this->options; @@ -25,9 +19,9 @@ public function __construct($token, array $options = array()) // normalize var name e.g. from 'term:1' becomes 'term' $name = $token; if ($options['modifier'] === ':') { - $name = substr($name, 0, strpos($name, $options['modifier'])); + $name = strstr($name, $options['modifier'], true); } $this->name = $name; } -} \ No newline at end of file +} diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Abstraction.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Abstraction.php index 1b7633762..856bd1c8f 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Abstraction.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Abstraction.php @@ -14,7 +14,7 @@ * | named | false false false false true true true false | * | ifemp | "" "" "" "" "" "=" "=" "" | * | allow | U U+R U U U U U U+R | - * `------------------------------------------------------------------' + * `------------------------------------------------------------------'. * * named = false * | 1 | {/list} /red,green,blue | {$value}*(?:,{$value}+)* @@ -35,7 +35,7 @@ * * RESERVED * -------- - * RFC 1738 ":" | "/" | "?" | | "@" | "!" | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=" | "-" | "_" | "." | + * RFC 1738 ":" | "/" | "?" | | "@" | "!" | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=" | "-" | "_" | "." | * RFC 3986 ":" | "/" | "?" | "#" | "[" | "]" | "@" | "!" | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=" * RFC 6570 ":" | "/" | "?" | "#" | "[" | "]" | "@" | "!" | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=" * @@ -47,108 +47,109 @@ abstract class Abstraction * start - Variable offset position, level-2 operators start at 1 * (exclude operator itself, e.g. {?query}) * first - If variables found, prepend this value to it - * named - Whether or not the expansion includes the variable or key name - * reserved - union of (unreserved / reserved / pct-encoded) + * named - Whether the expansion includes the variable or key name + * reserved - union of (unreserved / reserved / pct-encoded). */ - public $id, - $named, - $sep, - $empty, - $reserved, - $start, - $first; - - protected static $types = array( - '' => array( - 'sep' => ',', - 'named' => false, - 'empty' => '', - 'reserved' => false, - 'start' => 0, - 'first' => null, - ), - '+' => array( - 'sep' => ',', - 'named' => false, - 'empty' => '', - 'reserved' => true, - 'start' => 1, - 'first' => null, - ), - '.' => array( - 'sep' => '.', - 'named' => false, - 'empty' => '', - 'reserved' => false, - 'start' => 1, - 'first' => '.', - ), - '/' => array( - 'sep' => '/', - 'named' => false, - 'empty' => '', - 'reserved' => false, - 'start' => 1, - 'first' => '/', - ), - ';' => array( - 'sep' => ';', - 'named' => true, - 'empty' => '', - 'reserved' => false, - 'start' => 1, - 'first' => ';', - ), - '?' => array( - 'sep' => '&', - 'named' => true, - 'empty' => '=', - 'reserved' => false, - 'start' => 1, - 'first' => '?', - ), - '&' => array( - 'sep' => '&', - 'named' => true, - 'empty' => '=', - 'reserved' => false, - 'start' => 1, - 'first' => '&', - ), - '#' => array( - 'sep' => ',', - 'named' => false, - 'empty' => '', - 'reserved' => true, - 'start' => 1, - 'first' => '#', - ), - ), - $loaded = array(); - - /** - * gen-delims | sub-delims - */ - public static $reserved_chars = array( - '%3A' => ':', - '%2F' => '/', - '%3F' => '?', - '%23' => '#', - '%5B' => '[', - '%5D' => ']', - '%40' => '@', - '%21' => '!', - '%24' => '$', - '%26' => '&', - '%27' => "'", - '%28' => '(', - '%29' => ')', - '%2A' => '*', - '%2B' => '+', - '%2C' => ',', - '%3B' => ';', - '%3D' => '=', - ); + public $id; + public $named; + public $sep; + public $empty; + public $reserved; + public $start; + public $first; + + /** + * gen-delims | sub-delims. + */ + public static $reserved_chars = [ + '%3A' => ':', + '%2F' => '/', + '%3F' => '?', + '%23' => '#', + '%5B' => '[', + '%5D' => ']', + '%40' => '@', + '%21' => '!', + '%24' => '$', + '%26' => '&', + '%27' => "'", + '%28' => '(', + '%29' => ')', + '%2A' => '*', + '%2B' => '+', + '%2C' => ',', + '%3B' => ';', + '%3D' => '=', + ]; + + protected static $types = [ + '' => [ + 'sep' => ',', + 'named' => false, + 'empty' => '', + 'reserved' => false, + 'start' => 0, + 'first' => null, + ], + '+' => [ + 'sep' => ',', + 'named' => false, + 'empty' => '', + 'reserved' => true, + 'start' => 1, + 'first' => null, + ], + '.' => [ + 'sep' => '.', + 'named' => false, + 'empty' => '', + 'reserved' => false, + 'start' => 1, + 'first' => '.', + ], + '/' => [ + 'sep' => '/', + 'named' => false, + 'empty' => '', + 'reserved' => false, + 'start' => 1, + 'first' => '/', + ], + ';' => [ + 'sep' => ';', + 'named' => true, + 'empty' => '', + 'reserved' => false, + 'start' => 1, + 'first' => ';', + ], + '?' => [ + 'sep' => '&', + 'named' => true, + 'empty' => '=', + 'reserved' => false, + 'start' => 1, + 'first' => '?', + ], + '&' => [ + 'sep' => '&', + 'named' => true, + 'empty' => '=', + 'reserved' => false, + 'start' => 1, + 'first' => '&', + ], + '#' => [ + 'sep' => ',', + 'named' => false, + 'empty' => '', + 'reserved' => true, + 'start' => 1, + 'first' => '#', + ], + ]; + + protected static $loaded = []; /** * RFC 3986 Allowed path characters regex except the path delimiter '/'. @@ -166,29 +167,29 @@ abstract class Abstraction public function __construct($id, $named, $sep, $empty, $reserved, $start, $first) { - $this->id = $id; + $this->id = $id; $this->named = $named; - $this->sep = $sep; + $this->sep = $sep; $this->empty = $empty; $this->start = $start; $this->first = $first; $this->reserved = $reserved; } - abstract public function toRegex(Parser $parser, Node\Variable $var); + abstract public function toRegex(Parser $parser, Node\Variable $var): string; - public function expand(Parser $parser, Node\Variable $var, array $params = array()) + public function expand(Parser $parser, Node\Variable $var, array $params = []) { $options = $var->options; $name = $var->name; - $is_explode = in_array($options['modifier'], array('*', '%')); + $is_explode = in_array($options['modifier'], ['*', '%']); // skip null if (!isset($params[$name])) { return null; } - $val = $params[$name]; + $val = $params[$name]; // This algorithm is based on RFC6570 http://tools.ietf.org/html/rfc6570 // non-array, e.g. string @@ -197,38 +198,32 @@ public function expand(Parser $parser, Node\Variable $var, array $params = array } // non-explode ':' - else if (!$is_explode) { + if (!$is_explode) { return $this->expandNonExplode($parser, $var, $val); } // explode '*', '%' - else { - return $this->expandExplode($parser, $var, $val); - } + + return $this->expandExplode($parser, $var, $val); } public function expandString(Parser $parser, Node\Variable $var, $val) { - $val = (string)$val; + $val = (string) $val; $options = $var->options; $result = null; if ($options['modifier'] === ':') { - $val = substr($val, 0, (int)$options['value']); + $val = substr($val, 0, (int) $options['value']); } - return $result.$this->encode($parser, $var, $val); + return $result . $this->encode($parser, $var, $val); } /** - * Non explode modifier ':' - * - * @param Parser $parser - * @param Node\Variable $var - * @param array $val - * @return null|string + * Non explode modifier ':'. */ - public function expandNonExplode(Parser $parser, Node\Variable $var, array $val) + public function expandNonExplode(Parser $parser, Node\Variable $var, array $val): ?string { if (empty($val)) { return null; @@ -238,14 +233,9 @@ public function expandNonExplode(Parser $parser, Node\Variable $var, array $val) } /** - * Explode modifier '*', '%' - * - * @param Parser $parser - * @param Node\Variable $var - * @param array $val - * @return null|string + * Explode modifier '*', '%'. */ - public function expandExplode(Parser $parser, Node\Variable $var, array $val) + public function expandExplode(Parser $parser, Node\Variable $var, array $val): ?string { if (empty($val)) { return null; @@ -255,17 +245,13 @@ public function expandExplode(Parser $parser, Node\Variable $var, array $val) } /** - * Encodes variable according to spec (reserved or unreserved) - * - * @param Parser $parser - * @param Node\Variable $var - * @param mixed $values + * Encodes variable according to spec (reserved or unreserved). * * @return string encoded string */ - public function encode(Parser $parser, Node\Variable $var, $values) + public function encode(Parser $parser, Node\Variable $var, mixed $values) { - $values = (array)$values; + $values = (array) $values; $list = isset($values[0]); $reserved = $this->reserved; $maps = static::$reserved_chars; @@ -277,13 +263,12 @@ public function encode(Parser $parser, Node\Variable $var, $values) $assoc_sep = $sep = ','; } - array_walk($values, function(&$v, $k) use ($assoc_sep, $reserved, $list, $maps) { - + array_walk($values, function (&$v, $k) use ($assoc_sep, $reserved, $list, $maps): void { $encoded = rawurlencode($v); // assoc? encode key too if (!$list) { - $encoded = rawurlencode($k).$assoc_sep.$encoded; + $encoded = rawurlencode($k) . $assoc_sep . $encoded; } // rawurlencode is compliant with 'unreserved' set @@ -293,11 +278,10 @@ public function encode(Parser $parser, Node\Variable $var, $values) // decode chars in reserved set else { - $v = str_replace( array_keys($maps), $maps, - $encoded + $encoded, ); } }); @@ -306,71 +290,59 @@ public function encode(Parser $parser, Node\Variable $var, $values) } /** - * Decodes variable - * - * @param Parser $parser - * @param Node\Variable $var - * @param mixed $values + * Decodes variable. * * @return string decoded string */ - public function decode(Parser $parser, Node\Variable $var, $values) + public function decode(Parser $parser, Node\Variable $var, mixed $values) { $single = !is_array($values); - $values = (array)$values; + $values = (array) $values; - array_walk($values, function(&$v, $k) { + array_walk($values, function (&$v, $k): void { $v = rawurldecode($v); }); return $single ? reset($values) : $values; } - + /** - * Extracts value from variable - * - * @param Parser $parser - * @param Node\Variable $var - * @param string $data - * @return string + * Extracts value from variable. */ - public function extract(Parser $parser, Node\Variable $var, $data) + public function extract(Parser $parser, Node\Variable $var, string $data): array|string { - $value = $data; - $vals = array_filter(explode($this->sep, $data)); + $value = $data; + $vals = array_filter(explode($this->sep, $data)); $options = $var->options; switch ($options['modifier']) { - case '*': - $data = array(); - foreach($vals as $val) { - - if (strpos($val, '=') !== false) { - list($k, $v) = explode('=', $val); - $data[$k] = $v; - } - - else { - $data[] = $val; + $value = []; + foreach ($vals as $val) { + if (str_contains($val, '=')) { + [$k, $v] = explode('=', $val); + $value[$k] = $v; + } else { + $value[] = $val; } } break; + case ':': break; - default: - $data = strpos($data, $this->sep) !== false ? $vals : $value; + default: + $value = str_contains($value, (string) $this->sep) ? $vals : $value; } - return $this->decode($parser, $var, $data); + return $this->decode($parser, $var, $value); } public static function createById($id) { if (!isset(static::$types[$id])) { - throw new \Exception("Invalid operator [$id]"); + throw new \InvalidArgumentException("Invalid operator [{$id}]"); } if (isset(static::$loaded[$id])) { @@ -378,31 +350,24 @@ public static function createById($id) } $op = static::$types[$id]; - $class = __NAMESPACE__.'\\'.($op['named'] ? 'Named' : 'UnNamed'); + $class = __NAMESPACE__ . '\\' . ($op['named'] ? 'Named' : 'UnNamed'); return static::$loaded[$id] = new $class($id, $op['named'], $op['sep'], $op['empty'], $op['reserved'], $op['start'], $op['first']); } - public static function isValid($id) + public static function isValid($id): bool { return isset(static::$types[$id]); } /** - * Returns the correct regex given the variable location in the URI - * - * @return string + * Returns the correct regex given the variable location in the URI. */ - protected function getRegex() + protected function getRegex(): string { - switch ($this->id) { - case '?': - case '&': - case '#': - return self::$queryRegex; - case ';': - default: - return self::$pathRegex; - } + return match ($this->id) { + '?', '&', '#' => self::$queryRegex, + default => self::$pathRegex, + }; } } diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Named.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Named.php index 708710ce1..2c0a505de 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Named.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Named.php @@ -10,49 +10,51 @@ * | 2 | {?list*} ?list=red&list=green&list=blue | {name}+=(?:{$value}+(?:{sep}{name}+={$value}*))* * | 3 | {?keys} ?keys=semi,%3B,dot,.,comma,%2C | (same as 1) * | 4 | {?keys*} ?semi=%3B&dot=.&comma=%2C | (same as 2) - * | 5 | {?list*} ?list[]=red&list[]=green&list[]=blue | {name[]}+=(?:{$value}+(?:{sep}{name[]}+={$value}*))* + * | 5 | {?list*} ?list[]=red&list[]=green&list[]=blue | {name[]}+=(?:{$value}+(?:{sep}{name[]}+={$value}*))*. */ class Named extends Abstraction { - public function toRegex(Parser $parser, Node\Variable $var) + public function toRegex(Parser $parser, Node\Variable $var): string { - $regex = null; $name = $var->name; $value = $this->getRegex(); $options = $var->options; if ($options['modifier']) { - switch($options['modifier']) { + switch ($options['modifier']) { case '*': // 2 | 4 $regex = "{$name}+=(?:{$value}+(?:{$this->sep}{$name}+={$value}*)*)" . "|{$value}+=(?:{$value}+(?:{$this->sep}{$value}+={$value}*)*)"; + break; + case ':': - $regex = "{$value}\{0,{$options['value']}\}"; + $regex = "{$value}\\{0,{$options['value']}\\}"; + break; case '%': // 5 - $name = $name.'+(?:%5B|\[)[^=]*='; + $name .= '+(?:%5B|\[)[^=]*='; $regex = "{$name}(?:{$value}+(?:{$this->sep}{$name}{$value}*)*)"; + break; + default: - throw new \Exception("Unknown modifier `{$options['modifier']}`"); + throw new \InvalidArgumentException("Unknown modifier `{$options['modifier']}`"); } - } - - else { + } else { // 1, 3 $regex = "{$name}=(?:{$value}+(?:,{$value}+)*)*"; } - return '(?:&)?'.$regex; + return '(?:&)?' . $regex; } - public function expandString(Parser $parser, Node\Variable $var, $val) + public function expandString(Parser $parser, Node\Variable $var, $val): string { - $val = (string)$val; + $val = (string) $val; $options = $var->options; $result = $this->encode($parser, $var, $var->name); @@ -61,61 +63,42 @@ public function expandString(Parser $parser, Node\Variable $var, $val) return $result . $this->empty; } - else { - $result .= '='; - } + $result .= '='; if ($options['modifier'] === ':') { - $val = mb_substr($val, 0, (int)$options['value']); + $val = mb_substr($val, 0, (int) $options['value']); } - return $result.$this->encode($parser, $var, $val); + return $result . $this->encode($parser, $var, $val); } - public function expandNonExplode(Parser $parser, Node\Variable $var, array $val) + public function expandNonExplode(Parser $parser, Node\Variable $var, array $val): ?string { if (empty($val)) { return null; } - $result = $this->encode($parser, $var, $var->name); - - if (empty($val)) { - return $result . $this->empty; - } + $result = $this->encode($parser, $var, $var->name); - else { - $result .= '='; - } + $result .= '='; - return $result.$this->encode($parser, $var, $val); + return $result . $this->encode($parser, $var, $val); } - public function expandExplode(Parser $parser, Node\Variable $var, array $val) + public function expandExplode(Parser $parser, Node\Variable $var, array $val): ?string { if (empty($val)) { return null; } - $result = $this->encode($parser, $var, $var->name); - - // RFC6570 doesn't specify how to handle empty list/assoc array - // for explode modifier - if (empty($val)) { - return $result . $this->empty; - } - - $list = isset($val[0]); - $data = array(); - foreach($val as $k => $v) { - + $list = isset($val[0]); + $data = []; + foreach ($val as $k => $v) { // if value is a list, use `varname` as keyname, otherwise use `key` name $key = $list ? $var->name : $k; if ($list) { $data[$key][] = $v; - } - - else { + } else { $data[$key] = $v; } } @@ -123,14 +106,14 @@ public function expandExplode(Parser $parser, Node\Variable $var, array $val) // if it's array modifier, we have to use variable name as index // e.g. if variable name is 'query' and value is ['limit' => 1] // then we convert it to ['query' => ['limit' => 1]] - if (!$list and $var->options['modifier'] === '%') { - $data = array($var->name => $data); + if (!$list && $var->options['modifier'] === '%') { + $data = [$var->name => $data]; } - return $this->encodeExplodeVars($parser, $var, $data); + return $this->encodeExplodeVars($var, $data); } - public function extract(Parser $parser, Node\Variable $var, $data) + public function extract(Parser $parser, Node\Variable $var, $data): array|string { // get rid of optional `&` at the beginning if ($data[0] === '&') { @@ -143,45 +126,47 @@ public function extract(Parser $parser, Node\Variable $var, $data) switch ($options['modifier']) { case '%': - parse_str($data, $query); + parse_str($value, $query); return $query[$var->name]; case '*': - $data = array(); + $value = []; - foreach($vals as $val) { - list($k, $v) = explode('=', $val); + foreach ($vals as $val) { + [$k, $v] = explode('=', $val); // 2 if ($k === $var->getToken()) { - $data[] = $v; + $value[] = $v; } // 4 else { - $data[$k] = $v; + $value[$k] = $v; } } break; + case ':': break; + default: // 1, 3 // remove key from value e.g. 'lang=en,th' becomes 'en,th' - $value = str_replace($var->getToken().'=', '', $value); - $data = explode(',', $value); + $value = str_replace($var->getToken() . '=', '', $value); + $value = explode(',', $value); - if (sizeof($data) === 1) { - $data = current($data); + if (count($value) === 1) { + $value = current($value); } } - return $this->decode($parser, $var, $data); + return $this->decode($parser, $var, $value); } - public function encodeExplodeVars(Parser $parser, Node\Variable $var, $data) + public function encodeExplodeVars(Node\Variable $var, $data): null|array|string { // http_build_query uses PHP_QUERY_RFC1738 encoding by default // i.e. spaces are encoded as '+' (plus signs) we need to convert @@ -198,7 +183,6 @@ public function encodeExplodeVars(Parser $parser, Node\Variable $var, $data) // `:`, `*` modifiers else { - // by default, http_build_query will convert array values to `a[]=1&a[]=2` // which is different from the spec. It should be `a=1&a=2` $query = preg_replace('#%5B\d+%5D#', '', $query); @@ -206,11 +190,10 @@ public function encodeExplodeVars(Parser $parser, Node\Variable $var, $data) // handle reserved charset if ($this->reserved) { - $query = str_replace( array_keys(static::$reserved_chars), static::$reserved_chars, - $query + $query, ); } diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/UnNamed.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/UnNamed.php index 14a49b299..d1e53dd8f 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/UnNamed.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/UnNamed.php @@ -9,37 +9,39 @@ * | 1 | {/list} /red,green,blue | {$value}*(?:,{$value}+)* * | 2 | {/list*} /red/green/blue | {$value}+(?:{$sep}{$value}+)* * | 3 | {/keys} /semi,%3B,dot,.,comma,%2C | /(\w+,?)+ - * | 4 | {/keys*} /semi=%3B/dot=./comma=%2C | /(?:\w+=\w+/?)* + * | 4 | {/keys*} /semi=%3B/dot=./comma=%2C | /(?:\w+=\w+/?)*. */ class UnNamed extends Abstraction { - public function toRegex(Parser $parser, Node\Variable $var) + public function toRegex(Parser $parser, Node\Variable $var): string { - $regex = null; $value = $this->getRegex(); $options = $var->options; if ($options['modifier']) { - switch($options['modifier']) { + switch ($options['modifier']) { case '*': // 2 | 4 $regex = "{$value}+(?:{$this->sep}{$value}+)*"; + break; + case ':': - $regex = $value.'{0,'.$options['value'].'}'; + $regex = $value . '{0,' . $options['value'] . '}'; + break; + case '%': - throw new \Exception("% (array) modifier only works with Named type operators e.g. ;,?,&"); + throw new \InvalidArgumentException('% (array) modifier only works with Named type operators e.g. ;,?,&'); + default: - throw new \Exception("Unknown modifier `{$options['modifier']}`"); + throw new \InvalidArgumentException("Unknown modifier `{$options['modifier']}`"); } - } - - else { + } else { // 1, 3 $regex = "{$value}*(?:,{$value}+)*"; } return $regex; } -} \ No newline at end of file +} diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Parser.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Parser.php index 10ca382a2..48e8f17ca 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Parser.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Parser.php @@ -2,34 +2,33 @@ namespace Rize\UriTemplate; -use Rize\UriTemplate\Node; +use Rize\UriTemplate\Node\Abstraction; use Rize\UriTemplate\Node\Expression; -use Rize\UriTemplate\Operator; +use Rize\UriTemplate\Node\Variable; use Rize\UriTemplate\Operator\UnNamed; class Parser { - const REGEX_VARNAME = '(?:[A-z0-9_\.]|%[0-9a-fA-F]{2})'; + private const REGEX_VARNAME = '[A-z0-9.]|%[0-9a-fA-F]{2}'; /** - * Parses URI Template and returns nodes + * Parses URI Template and returns nodes. * - * @param string $template * @return Node\Abstraction[] */ - public function parse($template) + public function parse(string $template): array { - $parts = preg_split('#(\{[^\}]+\})#', $template, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); - $nodes = array(); + $parts = preg_split('#(\{[^}]+})#', $template, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); + $nodes = []; - foreach($parts as $part) { + foreach ($parts as $part) { $node = $this->createNode($part); // if current node has dot separator that requires a forward lookup // for the previous node iff previous node's operator is UnNamed if ($node instanceof Expression && $node->getOperator()->id === '.') { - if (sizeof($nodes) > 0) { - $previousNode = $nodes[sizeof($nodes) - 1]; + if (count($nodes) > 0) { + $previousNode = $nodes[count($nodes) - 1]; if ($previousNode instanceof Expression && $previousNode->getOperator() instanceof UnNamed) { $previousNode->setForwardLookupSeparator($node->getOperator()->id); } @@ -42,11 +41,7 @@ public function parse($template) return $nodes; } - /** - * @param string $token - * @return Node\Abstraction - */ - protected function createNode($token) + protected function createNode(string $token): Abstraction { // literal string if ($token[0] !== '{') { @@ -59,17 +54,16 @@ protected function createNode($token) return $node; } - protected function parseExpression($expression) + protected function parseExpression(string $expression): Expression { $token = $expression; $prefix = $token[0]; // not a valid operator? if (!Operator\Abstraction::isValid($prefix)) { - // not valid chars? - if (!preg_match('#'.self::REGEX_VARNAME.'#', $token)) { - throw new \Exception("Invalid operator [$prefix] found at {$token}"); + if (!preg_match('#' . self::REGEX_VARNAME . '#', $token)) { + throw new \InvalidArgumentException("Invalid operator [{$prefix}] found at {$token}"); } // default operator @@ -82,74 +76,71 @@ protected function parseExpression($expression) } // parse variables - $vars = array(); - foreach(explode(',', $token) as $var) { + $vars = []; + foreach (explode(',', $token) as $var) { $vars[] = $this->parseVariable($var); } return $this->createExpressionNode( $token, $this->createOperatorNode($prefix), - $vars + $vars, ); } - protected function parseVariable($var) + protected function parseVariable(string $var): Variable { $var = trim($var); $val = null; $modifier = null; // check for prefix (:) / explode (*) / array (%) modifier - if (strpos($var, ':') !== false) { + if (str_contains($var, ':')) { $modifier = ':'; - list($varname, $val) = explode(':', $var); + [$varname, $val] = explode(':', $var); // error checking if (!is_numeric($val)) { - throw new \Exception("Value for `:` modifier must be numeric value [$varname:$val]"); + throw new \InvalidArgumentException("Value for `:` modifier must be numeric value [{$varname}:{$val}]"); } } - switch($last = substr($var, -1)) { + switch ($last = substr($var, -1)) { case '*': case '%': - // there can be only 1 modifier per var if ($modifier) { - throw new \Exception("Multiple modifiers per variable are not allowed [$var]"); + throw new \InvalidArgumentException("Multiple modifiers per variable are not allowed [{$var}]"); } $modifier = $last; - $var = substr($var, 0, -1); + $var = substr($var, 0, -1); + break; } return $this->createVariableNode( $var, - array( - 'modifier' => $modifier, - 'value' => $val, - ) + ['modifier' => $modifier, 'value' => $val], ); } - protected function createVariableNode($token, $options = array()) + protected function createVariableNode($token, $options = []): Variable { - return new Node\Variable($token, $options); + return new Variable($token, $options); } - protected function createExpressionNode($token, Operator\Abstraction $operator = null, array $vars = array()) + protected function createExpressionNode($token, ?Operator\Abstraction $operator = null, array $vars = []): Expression { - return new Node\Expression($token, $operator, $vars); + return new Expression($token, $operator, $vars); } - protected function createLiteralNode($token) + protected function createLiteralNode(string $token): Node\Literal { return new Node\Literal($token); } - protected function createOperatorNode($token) + protected function createOperatorNode($token): Operator\Abstraction { return Operator\Abstraction::createById($token); } diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/UriTemplate.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/UriTemplate.php index 983d5b555..2170bfc80 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/UriTemplate.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/UriTemplate.php @@ -5,8 +5,6 @@ use Rize\UriTemplate as Template; /** - * Future compatibility + * Future compatibility. */ -class UriTemplate extends Template -{ -} +class UriTemplate extends Template {} diff --git a/lib/Google/vendor/rize/uri-template/tests/Rize/Uri/Node/ParserTest.php b/lib/Google/vendor/rize/uri-template/tests/Rize/Uri/Node/ParserTest.php new file mode 100644 index 000000000..203d2384e --- /dev/null +++ b/lib/Google/vendor/rize/uri-template/tests/Rize/Uri/Node/ParserTest.php @@ -0,0 +1,93 @@ + ':', 'value' => 1], + )], + ), new Node\Literal('/'), new Node\Expression( + 'term', + Operator\Abstraction::createById(''), + [new Node\Variable( + 'term', + ['modifier' => null, 'value' => null], + )], + ), new Node\Literal('/'), new Node\Expression( + 'test*', + Operator\Abstraction::createById(''), + [new Node\Variable( + 'test', + ['modifier' => '*', 'value' => null], + )], + ), new Node\Literal('/foo'), new Node\Expression( + 'query,number', + Operator\Abstraction::createById('?'), + [new Node\Variable( + 'query', + ['modifier' => null, 'value' => null], + ), new Node\Variable( + 'number', + ['modifier' => null, 'value' => null], + )], + )]; + + $service = $this->service(); + $actual = $service->parse($input); + + $this->assertEquals($expected, $actual); + } + + public function testParseTemplateWithLiteral() + { + // will pass + $uri = new UriTemplate('http://www.example.com/v1/company/', []); + $params = $uri->extract('/{countryCode}/{registrationNumber}/test{.format}', '/gb/0123456/test.json'); + static::assertEquals(['countryCode' => 'gb', 'registrationNumber' => '0123456', 'format' => 'json'], $params); + } + + #[Depends('testParseTemplateWithLiteral')] + public function testParseTemplateWithTwoVariablesAndDotBetween() + { + // will fail + $uri = new UriTemplate('http://www.example.com/v1/company/', []); + $params = $uri->extract('/{countryCode}/{registrationNumber}{.format}', '/gb/0123456.json'); + static::assertEquals(['countryCode' => 'gb', 'registrationNumber' => '0123456', 'format' => 'json'], $params); + } + + #[Depends('testParseTemplateWithLiteral')] + public function testParseTemplateWithTwoVariablesAndDotBetweenStrict() + { + // will fail + $uri = new UriTemplate('http://www.example.com/v1/company/', []); + $params = $uri->extract('/{countryCode}/{registrationNumber}{.format}', '/gb/0123456.json', true); + static::assertEquals(['countryCode' => 'gb', 'registrationNumber' => '0123456', 'format' => 'json'], $params); + } + + #[Depends('testParseTemplateWithLiteral')] + public function testParseTemplateWithThreeVariablesAndDotBetweenStrict() + { + // will fail + $uri = new UriTemplate('http://www.example.com/v1/company/', []); + $params = $uri->extract('/{countryCode}/{registrationNumber}{.namespace}{.format}', '/gb/0123456.company.json'); + static::assertEquals(['countryCode' => 'gb', 'registrationNumber' => '0123456', 'namespace' => 'company', 'format' => 'json'], $params); + } +} diff --git a/lib/Google/vendor/rize/uri-template/tests/Rize/UriTemplateTest.php b/lib/Google/vendor/rize/uri-template/tests/Rize/UriTemplateTest.php new file mode 100644 index 000000000..427f93f44 --- /dev/null +++ b/lib/Google/vendor/rize/uri-template/tests/Rize/UriTemplateTest.php @@ -0,0 +1,253 @@ + ["one", "two", "three"], 'dom' => ["example", "com"], 'dub' => "me/too", 'hello' => "Hello World!", 'half' => "50%", 'var' => "value", 'who' => "fred", 'base' => "http://example.com/home/", 'path' => "/foo/bar", 'list' => ["red", "green", "blue"], 'keys' => ["semi" => ";", "dot" => ".", "comma" => ","], 'list_with_empty' => [''], 'keys_with_empty' => ['john' => ''], 'v' => "6", 'x' => "1024", 'y' => "768", 'empty' => "", 'empty_keys' => [], 'undef' => null]; + + return [ + ['http://example.com/~john', ['uri' => 'http://example.com/~{username}', 'params' => ['username' => 'john']]], + ['http://example.com/dictionary/d/dog', ['uri' => 'http://example.com/dictionary/{term:1}/{term}', 'params' => ['term' => 'dog'], 'extract' => ['term:1' => 'd', 'term' => 'dog']]], + # Form-style parameters expression + ['http://example.com/j/john/search?q=mycelium&q=3&lang=th,jp,en', ['uri' => 'http://example.com/{term:1}/{term}/search{?q*,lang}', 'params' => ['q' => ['mycelium', 3], 'lang' => ['th', 'jp', 'en'], 'term' => 'john']]], + ['http://www.example.com/john', ['uri' => 'http://www.example.com/{username}', 'params' => ['username' => 'john']]], + ['http://www.example.com/foo?query=mycelium&number=100', ['uri' => 'http://www.example.com/foo{?query,number}', 'params' => ['query' => 'mycelium', 'number' => 100]]], + # 'query' is undefined + ['http://www.example.com/foo?number=100', [ + 'uri' => 'http://www.example.com/foo{?query,number}', + 'params' => ['number' => 100], + # we can't extract undefined values + 'extract' => false, + ]], + # undefined variables + ['http://www.example.com/foo', ['uri' => 'http://www.example.com/foo{?query,number}', 'params' => [], 'extract' => ['query' => null, 'number' => null]]], + ['http://www.example.com/foo', ['uri' => 'http://www.example.com/foo{?number}', 'params' => [], 'extract' => ['number' => null]]], + ['one,two,three|one,two,three|/one,two,three|/one/two/three|;count=one,two,three|;count=one;count=two;count=three|?count=one,two,three|?count=one&count=two&count=three|&count=one&count=two&count=three', ['uri' => '{count}|{count*}|{/count}|{/count*}|{;count}|{;count*}|{?count}|{?count*}|{&count*}', 'params' => ['count' => ['one', 'two', 'three']]]], + ['http://www.host.com/path/to/a/file.x.y', ['uri' => 'http://{host}{/segments*}/{file}{.extensions*}', 'params' => ['host' => 'www.host.com', 'segments' => ['path', 'to', 'a'], 'file' => 'file', 'extensions' => ['x', 'y']], 'extract' => ['host' => 'www.host.com', 'segments' => ['path', 'to', 'a'], 'file' => 'file.x.y', 'extensions' => null]]], + # level 1 - Simple String Expansion: {var} + ['value|Hello%20World%21|50%25|OX|OX|1024,768|1024,Hello%20World%21,768|?1024,|?1024|?768|val|value|red,green,blue|semi,%3B,dot,.,comma,%2C|semi=%3B,dot=.,comma=%2C', ['uri' => '{var}|{hello}|{half}|O{empty}X|O{undef}X|{x,y}|{x,hello,y}|?{x,empty}|?{x,undef}|?{undef,y}|{var:3}|{var:30}|{list}|{keys}|{keys*}', 'params' => $params]], + # level 2 - Reserved Expansion: {+var} + ['value|Hello%20World!|50%25|http%3A%2F%2Fexample.com%2Fhome%2Findex|http://example.com/home/index|OX|OX|/foo/bar/here|here?ref=/foo/bar|up/foo/barvalue/here|1024,Hello%20World!,768|/foo/bar,1024/here|/foo/b/here|red,green,blue|red,green,blue|semi,;,dot,.,comma,,|semi=;,dot=.,comma=,', ['uri' => '{+var}|{+hello}|{+half}|{base}index|{+base}index|O{+empty}X|O{+undef}X|{+path}/here|here?ref={+path}|up{+path}{var}/here|{+x,hello,y}|{+path,x}/here|{+path:6}/here|{+list}|{+list*}|{+keys}|{+keys*}', 'params' => $params]], + # level 2 - Fragment Expansion: {#var} + ['#value|#Hello%20World!|#50%25|foo#|foo|#1024,Hello%20World!,768|#/foo/bar,1024/here|#/foo/b/here|#red,green,blue|#red,green,blue|#semi,;,dot,.,comma,,|#semi=;,dot=.,comma=,', ['uri' => '{#var}|{#hello}|{#half}|foo{#empty}|foo{#undef}|{#x,hello,y}|{#path,x}/here|{#path:6}/here|{#list}|{#list*}|{#keys}|{#keys*}', 'params' => $params]], + # Label Expansion with Dot-Prefix: {.var} + ['.fred|.fred.fred|.50%25.fred|www.example.com|X.value|X.|X|X.val|X.red,green,blue|X.red.green.blue|X.semi,%3B,dot,.,comma,%2C|X.semi=%3B.dot=..comma=%2C|X|X', ['uri' => '{.who}|{.who,who}|{.half,who}|www{.dom*}|X{.var}|X{.empty}|X{.undef}|X{.var:3}|X{.list}|X{.list*}|X{.keys}|X{.keys*}|X{.empty_keys}|X{.empty_keys*}', 'params' => $params]], + # Path Segment Expansion: {/var} + ['/fred|/fred/fred|/50%25/fred|/fred/me%2Ftoo|/value|/value/|/value|/value/1024/here|/v/value|/red,green,blue|/red/green/blue|/red/green/blue/%2Ffoo|/semi,%3B,dot,.,comma,%2C|/semi=%3B/dot=./comma=%2C', ['uri' => '{/who}|{/who,who}|{/half,who}|{/who,dub}|{/var}|{/var,empty}|{/var,undef}|{/var,x}/here|{/var:1,var}|{/list}|{/list*}|{/list*,path:4}|{/keys}|{/keys*}', 'params' => $params]], + # Path-Style Parameter Expansion: {;var} + [';who=fred|;half=50%25|;empty|;v=6;empty;who=fred|;v=6;who=fred|;x=1024;y=768|;x=1024;y=768;empty|;x=1024;y=768|;hello=Hello|;list=red,green,blue|;list=red;list=green;list=blue|;keys=semi,%3B,dot,.,comma,%2C|;semi=%3B;dot=.;comma=%2C', ['uri' => '{;who}|{;half}|{;empty}|{;v,empty,who}|{;v,bar,who}|{;x,y}|{;x,y,empty}|{;x,y,undef}|{;hello:5}|{;list}|{;list*}|{;keys}|{;keys*}', 'params' => $params]], + # Form-Style Query Expansion: {?var} + ['?who=fred|?half=50%25|?x=1024&y=768|?x=1024&y=768&empty=|?x=1024&y=768|?var=val|?list=red,green,blue|?list=red&list=green&list=blue|?keys=semi,%3B,dot,.,comma,%2C|?semi=%3B&dot=.&comma=%2C|?list_with_empty=|?john=', ['uri' => '{?who}|{?half}|{?x,y}|{?x,y,empty}|{?x,y,undef}|{?var:3}|{?list}|{?list*}|{?keys}|{?keys*}|{?list_with_empty*}|{?keys_with_empty*}', 'params' => $params]], + # Form-Style Query Continuation: {&var} + ['&who=fred|&half=50%25|?fixed=yes&x=1024|&x=1024&y=768&empty=|&x=1024&y=768|&var=val|&list=red,green,blue|&list=red&list=green&list=blue|&keys=semi,%3B,dot,.,comma,%2C|&semi=%3B&dot=.&comma=%2C', ['uri' => '{&who}|{&half}|?fixed=yes{&x}|{&x,y,empty}|{&x,y,undef}|{&var:3}|{&list}|{&list*}|{&keys}|{&keys*}', 'params' => $params]], + # Test empty values + ['|||', ['uri' => '{empty}|{empty*}|{?empty}|{?empty*}', 'params' => ['empty' => []]]], + ]; + } + + public static function dataExpandWithArrayModifier() + { + return [ + # List + [ + # '?choices[]=a&choices[]=b&choices[]=c', + '?choices%5B%5D=a&choices%5B%5D=b&choices%5B%5D=c', + ['uri' => '{?choices%}', 'params' => ['choices' => ['a', 'b', 'c']]], + ], + # Keys + [ + # '?choices[a]=1&choices[b]=2&choices[c][test]=3', + '?choices%5Ba%5D=1&choices%5Bb%5D=2&choices%5Bc%5D%5Btest%5D=3', + ['uri' => '{?choices%}', 'params' => ['choices' => ['a' => 1, 'b' => 2, 'c' => ['test' => 3]]]], + ], + # Mixed + [ + # '?list[]=a&list[]=b&keys[a]=1&keys[b]=2', + '?list%5B%5D=a&list%5B%5D=b&keys%5Ba%5D=1&keys%5Bb%5D=2', + ['uri' => '{?list%,keys%}', 'params' => ['list' => ['a', 'b'], 'keys' => ['a' => 1, 'b' => 2]]], + ], + ]; + } + + public static function dataBaseTemplate() + { + return [ + [ + 'http://google.com/api/1/users/1', + # base uri + ['uri' => '{+host}/api/{v}', 'params' => ['host' => 'http://google.com', 'v' => 1]], + # other uri + ['uri' => '/{resource}/{id}', 'params' => ['resource' => 'users', 'id' => 1]], + ], + # test override base params + [ + 'http://github.com/api/1/users/1', + # base uri + ['uri' => '{+host}/api/{v}', 'params' => ['host' => 'http://google.com', 'v' => 1]], + # other uri + ['uri' => '/{resource}/{id}', 'params' => ['host' => 'http://github.com', 'resource' => 'users', 'id' => 1]], + ], + ]; + } + + public static function dataExtraction() + { + return [['/no/{term:1}/random/foo{?query,list%,keys%}', '/no/j/random/foo?query=1,2,3&list%5B%5D=a&list%5B%5D=b&keys%5Ba%5D=1&keys%5Bb%5D=2&keys%5Bc%5D%5Btest%5D%5Btest%5D=1', ['term:1' => 'j', 'query' => [1, 2, 3], 'list' => ['a', 'b'], 'keys' => ['a' => 1, 'b' => 2, 'c' => ['test' => ['test' => 1]]]]], ['/no/{term:1}/random/{term}/{test*}/foo{?query,number}', '/no/j/random/john/a,b,c/foo?query=1,2,3&number=10', ['term:1' => 'j', 'term' => 'john', 'test' => ['a', 'b', 'c'], 'query' => [1, 2, 3], 'number' => 10]], ['/search/{term:1}/{term}/{?q*,limit}', '/search/j/john/?a=1&b=2&limit=10', ['term:1' => 'j', 'term' => 'john', 'q' => ['a' => 1, 'b' => 2], 'limit' => 10]], ['http://www.example.com/foo{?query,number}', 'http://www.example.com/foo?query=5', ['query' => 5, 'number' => null]], ['{count}|{count*}|{/count}|{/count*}|{;count}|{;count*}|{?count}|{?count*}|{&count*}', 'one,two,three|one,two,three|/one,two,three|/one/two/three|;count=one,two,three|;count=one;count=two;count=three|?count=one,two,three|?count=one&count=two&count=three|&count=one&count=two&count=three', ['count' => ['one', 'two', 'three']]], ['http://example.com/{term:1}/{term}/search{?q*,lang}', 'http://example.com/j/john/search?q=Hello%20World%21&q=3&lang=th,jp,en', ['q' => ['Hello World!', 3], 'lang' => ['th', 'jp', 'en'], 'term' => 'john', 'term:1' => 'j']], ['/foo/bar/{number}', '/foo/bar/0', ['number' => 0]], ['/some/{path}{?ref}', '/some/foo', ['path' => 'foo', 'ref' => null]]]; + } + + /** + * @dataProvider dataExpansion + */ + public function testExpansion($expected, $input) + { + $service = $this->service(); + $result = $service->expand($input['uri'], $input['params']); + + $this->assertEquals($expected, $result); + } + + /** + * @dataProvider dataExpandWithArrayModifier + */ + public function testExpandWithArrayModifier($expected, $input) + { + $service = $this->service(); + $result = $service->expand($input['uri'], $input['params']); + + $this->assertEquals($expected, $result); + } + + /** + * @dataProvider dataBaseTemplate + */ + public function testBaseTemplate($expected, $base, $other) + { + $service = $this->service($base['uri'], $base['params']); + $result = $service->expand($other['uri'], $other['params']); + + $this->assertEquals($expected, $result); + } + + /** + * @dataProvider dataExtraction + */ + public function testExtract($template, $uri, $expected) + { + $service = $this->service(); + $actual = $service->extract($template, $uri); + + $this->assertEquals($expected, $actual); + } + + public function testExpandFromFixture() + { + $dir = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR; + $files = ['spec-examples.json', 'spec-examples-by-section.json', 'extended-tests.json']; + $service = $this->service(); + + foreach ($files as $file) { + $content = json_decode(file_get_contents($dir . $file), $array = true); + + # iterate through each fixture + foreach ($content as $fixture) { + $vars = $fixture['variables']; + + # assert each test cases + foreach ($fixture['testcases'] as $case) { + [$uri, $expected] = $case; + + $actual = $service->expand($uri, $vars); + + if (is_array($expected)) { + $expected = current(array_filter($expected, fn($input) => $actual === $input)); + } + + $this->assertEquals($expected, $actual); + } + } + } + } + + public static function dataExtractStrictMode() + { + $dataTest = [['/search/{term:1}/{term}/{?q*,limit}', '/search/j/john/?a=1&b=2&limit=10', ['term:1' => 'j', 'term' => 'john', 'limit' => '10', 'q' => ['a' => '1', 'b' => '2']]], ['http://example.com/{term:1}/{term}/search{?q*,lang}', 'http://example.com/j/john/search?q=Hello%20World%21&q=3&lang=th,jp,en', ['term:1' => 'j', 'term' => 'john', 'lang' => ['th', 'jp', 'en'], 'q' => ['Hello World!', '3']]], ['/foo/bar/{number}', '/foo/bar/0', ['number' => 0]], ['/', '/', []]]; + + $rfc3986AllowedPathCharacters = ['-', '.', '_', '~', '!', '$', '&', "'", '(', ')', '*', '+', ',', ';', '=', ':', '@']; + + foreach ($rfc3986AllowedPathCharacters as $char) { + $title = "RFC3986 path character ($char)"; + $title = str_replace("'", 'single quote', $title); // PhpStorm workaround + if ($char === ',') { // , means array on RFC6570 + $params = ['term' => ['foo', 'baz']]; + } else { + $params = ['term' => "foo{$char}baz"]; + } + + $data = ['/search/{term}', "/search/foo{$char}baz", $params]; + + $dataTest[$title] = $data; + $data = ['/search/{;term}', "/search/;term=foo{$char}baz", $params]; + $dataTest['Named ' . $title] = $data; + } + + $rfc3986AllowedQueryCharacters = $rfc3986AllowedPathCharacters; + $rfc3986AllowedQueryCharacters[] = '/'; + $rfc3986AllowedQueryCharacters[] = '?'; + unset($rfc3986AllowedQueryCharacters[array_search('&', $rfc3986AllowedQueryCharacters, true)]); + + foreach ($rfc3986AllowedQueryCharacters as $char) { + $title = "RFC3986 query character ($char)"; + $title = str_replace("'", 'single quote', $title); // PhpStorm workaround + if ($char === ',') { // , means array on RFC6570 + $params = ['term' => ['foo', 'baz']]; + } else { + $params = ['term' => "foo{$char}baz"]; + } + + $data = ['/search/{?term}', "/search/?term=foo{$char}baz", $params]; + $dataTest['Named ' . $title] = $data; + } + + return $dataTest; + } + + public static function extractStrictModeNotMatchProvider() + { + return [['/', '/a'], ['/{test}', '/a/'], ['/search/{term:1}/{term}/{?q*,limit}', '/search/j/?a=1&b=2&limit=10'], ['http://www.example.com/foo{?query,number}', 'http://www.example.com/foo?query=5'], ['http://www.example.com/foo{?query,number}', 'http://www.example.com/foo'], ['http://example.com/{term:1}/{term}/search{?q*,lang}', 'http://example.com/j/john/search?q=']]; + } + + #[DataProvider('dataExtractStrictMode')] + public function testExtractStrictMode(string $template, string $uri, array $expectedParams) + { + $service = $this->service(); + $params = $service->extract($template, $uri, true); + + $this->assertTrue(isset($params)); + $this->assertEquals($expectedParams, $params); + } + + #[DataProvider('extractStrictModeNotMatchProvider')] + public function testExtractStrictModeNotMatch(string $template, string $uri) + { + $service = $this->service(); + $actual = $service->extract($template, $uri, true); + + $this->assertFalse(isset($actual)); + } +} diff --git a/lib/Google/vendor/rize/uri-template/tests/fixtures/README.md b/lib/Google/vendor/rize/uri-template/tests/fixtures/README.md new file mode 100644 index 000000000..3eb519da6 --- /dev/null +++ b/lib/Google/vendor/rize/uri-template/tests/fixtures/README.md @@ -0,0 +1,90 @@ + +URI Template Tests +================== + +This is a set of tests for implementations of +[RFC6570](http://tools.ietf.org/html/rfc6570) - URI Template. It is designed +to be reused by any implementation, to improve interoperability and +implementation quality. + +If your project uses Git for version control, you can make uritemplate-tests into a [submodule](http://help.github.com/submodules/). + +Test Format +----------- + +Each test file is a [JSON](http://tools.ietf.org/html/RFC6627) document +containing an object whose properties are groups of related tests. +Alternatively, all tests are available in XML as well, with the XML files +being generated by transform-json-tests.xslt which uses json2xml.xslt as a +general-purpose JSON-to-XML parsing library. + +Each group, in turn, is an object with three children: + +* level - the level of the tests covered, as per the RFC (optional; if absent, + assume level 4). +* variables - an object representing the variables that are available to the + tests in the suite +* testcases - a list of testcases, where each case is a two-member list, the + first being the template, the second being the result of expanding the + template with the provided variables. + +Note that the result string can be a few different things: + +* string - if the second member is a string, the result of expansion is + expected to match it, character-for-character. +* list - if the second member is a list of strings, the result of expansion + is expected to match one of them; this allows for templates that can + expand into different, equally-acceptable URIs. +* false - if the second member is boolean false, expansion is expected to + fail (i.e., the template was invalid). + +For example: + + { + "Level 1 Examples" : + { + "level": 1, + "variables": { + "var" : "value", + "hello" : "Hello World!" + }, + "testcases" : [ + ["{var}", "value"], + ["{hello}", "Hello%20World%21"] + ] + } + } + + +Tests Included +-------------- + +The following test files are included: + +* spec-examples.json - The complete set of example templates from the RFC +* spec-examples-by-section.json - The examples, section by section +* extended-tests.json - more complex test cases +* negative-tests.json - invalid templates + +For all these test files, XML versions with the names *.xml can be +generated with the transform-json-tests.xslt XSLT stylesheet. The XSLT +contains the names of the above test files as a parameter, and can be +started with any XML as input (i.e., the XML input is ignored). + +License +------- + + Copyright 2011-2012 The Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/lib/Google/vendor/rize/uri-template/tests/fixtures/extended-tests.json b/lib/Google/vendor/rize/uri-template/tests/fixtures/extended-tests.json new file mode 100644 index 000000000..8ae8134cc --- /dev/null +++ b/lib/Google/vendor/rize/uri-template/tests/fixtures/extended-tests.json @@ -0,0 +1,118 @@ +{ + "Additional Examples 1":{ + "level":4, + "variables":{ + "id" : "person", + "token" : "12345", + "fields" : ["id", "name", "picture"], + "format" : "json", + "q" : "URI Templates", + "page" : "5", + "lang" : "en", + "geocode" : ["37.76","-122.427"], + "first_name" : "John", + "last.name" : "Doe", + "Some%20Thing" : "foo", + "number" : 6, + "long" : 37.76, + "lat" : -122.427, + "group_id" : "12345", + "query" : "PREFIX dc: SELECT ?book ?who WHERE { ?book dc:creator ?who }", + "uri" : "http://example.org/?uri=http%3A%2F%2Fexample.org%2F", + "word" : "drücken", + "Stra%C3%9Fe" : "Grüner Weg", + "random" : "šö䟜ñꀣ¥‡ÑÒÓÔÕÖרÙÚàáâãäåæçÿ", + "assoc_special_chars" : + { "šö䟜ñꀣ¥‡ÑÒÓÔÕ" : "ÖרÙÚàáâãäåæçÿ" } + }, + "testcases":[ + + [ "{/id*}" , "/person" ], + [ "{/id*}{?fields,first_name,last.name,token}" , [ + "/person?fields=id,name,picture&first_name=John&last.name=Doe&token=12345", + "/person?fields=id,picture,name&first_name=John&last.name=Doe&token=12345", + "/person?fields=picture,name,id&first_name=John&last.name=Doe&token=12345", + "/person?fields=picture,id,name&first_name=John&last.name=Doe&token=12345", + "/person?fields=name,picture,id&first_name=John&last.name=Doe&token=12345", + "/person?fields=name,id,picture&first_name=John&last.name=Doe&token=12345"] + ], + ["/search.{format}{?q,geocode,lang,locale,page,result_type}", + [ "/search.json?q=URI%20Templates&geocode=37.76,-122.427&lang=en&page=5", + "/search.json?q=URI%20Templates&geocode=-122.427,37.76&lang=en&page=5"] + ], + ["/test{/Some%20Thing}", "/test/foo" ], + ["/set{?number}", "/set?number=6"], + ["/loc{?long,lat}" , "/loc?long=37.76&lat=-122.427"], + ["/base{/group_id,first_name}/pages{/page,lang}{?format,q}","/base/12345/John/pages/5/en?format=json&q=URI%20Templates"], + ["/sparql{?query}", "/sparql?query=PREFIX%20dc%3A%20%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%20SELECT%20%3Fbook%20%3Fwho%20WHERE%20%7B%20%3Fbook%20dc%3Acreator%20%3Fwho%20%7D"], + ["/go{?uri}", "/go?uri=http%3A%2F%2Fexample.org%2F%3Furi%3Dhttp%253A%252F%252Fexample.org%252F"], + ["/service{?word}", "/service?word=dr%C3%BCcken"], + ["/lookup{?Stra%C3%9Fe}", "/lookup?Stra%25C3%259Fe=Gr%C3%BCner%20Weg"], + ["{random}" , "%C5%A1%C3%B6%C3%A4%C5%B8%C5%93%C3%B1%C3%AA%E2%82%AC%C2%A3%C2%A5%E2%80%A1%C3%91%C3%92%C3%93%C3%94%C3%95%C3%96%C3%97%C3%98%C3%99%C3%9A%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%BF"], + ["{?assoc_special_chars*}", "?%C5%A1%C3%B6%C3%A4%C5%B8%C5%93%C3%B1%C3%AA%E2%82%AC%C2%A3%C2%A5%E2%80%A1%C3%91%C3%92%C3%93%C3%94%C3%95=%C3%96%C3%97%C3%98%C3%99%C3%9A%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%BF"] + ] + }, + "Additional Examples 2":{ + "level":4, + "variables":{ + "id" : ["person","albums"], + "token" : "12345", + "fields" : ["id", "name", "picture"], + "format" : "atom", + "q" : "URI Templates", + "page" : "10", + "start" : "5", + "lang" : "en", + "geocode" : ["37.76","-122.427"] + }, + "testcases":[ + + [ "{/id*}" , ["/person/albums","/albums/person"] ], + [ "{/id*}{?fields,token}" , [ + "/person/albums?fields=id,name,picture&token=12345", + "/person/albums?fields=id,picture,name&token=12345", + "/person/albums?fields=picture,name,id&token=12345", + "/person/albums?fields=picture,id,name&token=12345", + "/person/albums?fields=name,picture,id&token=12345", + "/person/albums?fields=name,id,picture&token=12345", + "/albums/person?fields=id,name,picture&token=12345", + "/albums/person?fields=id,picture,name&token=12345", + "/albums/person?fields=picture,name,id&token=12345", + "/albums/person?fields=picture,id,name&token=12345", + "/albums/person?fields=name,picture,id&token=12345", + "/albums/person?fields=name,id,picture&token=12345"] + ] + ] + }, + "Additional Examples 3: Empty Variables":{ + "variables" : { + "empty_list" : [], + "empty_assoc" : {} + }, + "testcases":[ + [ "{/empty_list}", [ "" ] ], + [ "{/empty_list*}", [ "" ] ], + [ "{?empty_list}", [ ""] ], + [ "{?empty_list*}", [ "" ] ], + [ "{?empty_assoc}", [ "" ] ], + [ "{?empty_assoc*}", [ "" ] ] + ] + }, + "Additional Examples 4: Numeric Keys":{ + "variables" : { + "42" : "The Answer to the Ultimate Question of Life, the Universe, and Everything", + "1337" : ["leet", "as","it", "can","be"], + "german" : { + "11": "elf", + "12": "zwölf" + } + }, + "testcases":[ + [ "{42}", "The%20Answer%20to%20the%20Ultimate%20Question%20of%20Life%2C%20the%20Universe%2C%20and%20Everything"], + [ "{?42}", "?42=The%20Answer%20to%20the%20Ultimate%20Question%20of%20Life%2C%20the%20Universe%2C%20and%20Everything"], + [ "{1337}", "leet,as,it,can,be"], + [ "{?1337*}", "?1337=leet&1337=as&1337=it&1337=can&1337=be"], + [ "{?german*}", [ "?11=elf&12=zw%C3%B6lf", "?12=zw%C3%B6lf&11=elf"] ] + ] + } +} diff --git a/lib/Google/vendor/rize/uri-template/tests/fixtures/json2xml.xslt b/lib/Google/vendor/rize/uri-template/tests/fixtures/json2xml.xslt new file mode 100644 index 000000000..59b3548c0 --- /dev/null +++ b/lib/Google/vendor/rize/uri-template/tests/fixtures/json2xml.xslt @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \b + + + + + + + + + + + \v + + + + + \f + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/Google/vendor/rize/uri-template/tests/fixtures/negative-tests.json b/lib/Google/vendor/rize/uri-template/tests/fixtures/negative-tests.json new file mode 100644 index 000000000..552a6bf07 --- /dev/null +++ b/lib/Google/vendor/rize/uri-template/tests/fixtures/negative-tests.json @@ -0,0 +1,57 @@ +{ + "Failure Tests":{ + "level":4, + "variables":{ + "id" : "thing", + "var" : "value", + "hello" : "Hello World!", + "with space" : "fail", + " leading_space" : "Hi!", + "trailing_space " : "Bye!", + "empty" : "", + "path" : "/foo/bar", + "x" : "1024", + "y" : "768", + "list" : ["red", "green", "blue"], + "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, + "example" : "red", + "searchTerms" : "uri templates", + "~thing" : "some-user", + "default-graph-uri" : ["http://www.example/book/","http://www.example/papers/"], + "query" : "PREFIX dc: SELECT ?book ?who WHERE { ?book dc:creator ?who }" + + }, + "testcases":[ + [ "{/id*", false ], + [ "/id*}", false ], + [ "{/?id}", false ], + [ "{var:prefix}", false ], + [ "{hello:2*}", false ] , + [ "{??hello}", false ] , + [ "{!hello}", false ] , + [ "{with space}", false], + [ "{ leading_space}", false], + [ "{trailing_space }", false], + [ "{=path}", false ] , + [ "{$var}", false ], + [ "{|var*}", false ], + [ "{*keys?}", false ], + [ "{?empty=default,var}", false ], + [ "{var}{-prefix|/-/|var}" , false ], + [ "?q={searchTerms}&c={example:color?}" , false ], + [ "x{?empty|foo=none}" , false ], + [ "/h{#hello+}" , false ], + [ "/h#{hello+}" , false ], + [ "{keys:1}", false ], + [ "{+keys:1}", false ], + [ "{;keys:1*}", false ], + [ "?{-join|&|var,list}" , false ], + [ "/people/{~thing}", false], + [ "/{default-graph-uri}", false ], + [ "/sparql{?query,default-graph-uri}", false ], + [ "/sparql{?query){&default-graph-uri*}", false ], + [ "/resolution{?x, y}" , false ] + + ] + } +} \ No newline at end of file diff --git a/lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples-by-section.json b/lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples-by-section.json new file mode 100644 index 000000000..5aef18205 --- /dev/null +++ b/lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples-by-section.json @@ -0,0 +1,439 @@ +{ + "3.2.1 Variable Expansion" : + { + "variables": { + "count" : ["one", "two", "three"], + "dom" : ["example", "com"], + "dub" : "me/too", + "hello" : "Hello World!", + "half" : "50%", + "var" : "value", + "who" : "fred", + "base" : "http://example.com/home/", + "path" : "/foo/bar", + "list" : ["red", "green", "blue"], + "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, + "v" : "6", + "x" : "1024", + "y" : "768", + "empty" : "", + "empty_keys" : [], + "undef" : null + }, + "testcases" : [ + ["{count}", "one,two,three"], + ["{count*}", "one,two,three"], + ["{/count}", "/one,two,three"], + ["{/count*}", "/one/two/three"], + ["{;count}", ";count=one,two,three"], + ["{;count*}", ";count=one;count=two;count=three"], + ["{?count}", "?count=one,two,three"], + ["{?count*}", "?count=one&count=two&count=three"], + ["{&count*}", "&count=one&count=two&count=three"] + ] + }, + "3.2.2 Simple String Expansion" : + { + "variables": { + "count" : ["one", "two", "three"], + "dom" : ["example", "com"], + "dub" : "me/too", + "hello" : "Hello World!", + "half" : "50%", + "var" : "value", + "who" : "fred", + "base" : "http://example.com/home/", + "path" : "/foo/bar", + "list" : ["red", "green", "blue"], + "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, + "v" : "6", + "x" : "1024", + "y" : "768", + "empty" : "", + "empty_keys" : [], + "undef" : null + }, + "testcases" : [ + ["{var}", "value"], + ["{hello}", "Hello%20World%21"], + ["{half}", "50%25"], + ["O{empty}X", "OX"], + ["O{undef}X", "OX"], + ["{x,y}", "1024,768"], + ["{x,hello,y}", "1024,Hello%20World%21,768"], + ["?{x,empty}", "?1024,"], + ["?{x,undef}", "?1024"], + ["?{undef,y}", "?768"], + ["{var:3}", "val"], + ["{var:30}", "value"], + ["{list}", "red,green,blue"], + ["{list*}", "red,green,blue"], + ["{keys}", [ + "comma,%2C,dot,.,semi,%3B", + "comma,%2C,semi,%3B,dot,.", + "dot,.,comma,%2C,semi,%3B", + "dot,.,semi,%3B,comma,%2C", + "semi,%3B,comma,%2C,dot,.", + "semi,%3B,dot,.,comma,%2C" + ]], + ["{keys*}", [ + "comma=%2C,dot=.,semi=%3B", + "comma=%2C,semi=%3B,dot=.", + "dot=.,comma=%2C,semi=%3B", + "dot=.,semi=%3B,comma=%2C", + "semi=%3B,comma=%2C,dot=.", + "semi=%3B,dot=.,comma=%2C" + ]] + ] + }, + "3.2.3 Reserved Expansion" : + { + "variables": { + "count" : ["one", "two", "three"], + "dom" : ["example", "com"], + "dub" : "me/too", + "hello" : "Hello World!", + "half" : "50%", + "var" : "value", + "who" : "fred", + "base" : "http://example.com/home/", + "path" : "/foo/bar", + "list" : ["red", "green", "blue"], + "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, + "v" : "6", + "x" : "1024", + "y" : "768", + "empty" : "", + "empty_keys" : [], + "undef" : null + }, + "testcases" : [ + ["{+var}", "value"], + ["{/var,empty}", "/value/"], + ["{/var,undef}", "/value"], + ["{+hello}", "Hello%20World!"], + ["{+half}", "50%25"], + ["{base}index", "http%3A%2F%2Fexample.com%2Fhome%2Findex"], + ["{+base}index", "http://example.com/home/index"], + ["O{+empty}X", "OX"], + ["O{+undef}X", "OX"], + ["{+path}/here", "/foo/bar/here"], + ["{+path:6}/here", "/foo/b/here"], + ["here?ref={+path}", "here?ref=/foo/bar"], + ["up{+path}{var}/here", "up/foo/barvalue/here"], + ["{+x,hello,y}", "1024,Hello%20World!,768"], + ["{+path,x}/here", "/foo/bar,1024/here"], + ["{+list}", "red,green,blue"], + ["{+list*}", "red,green,blue"], + ["{+keys}", [ + "comma,,,dot,.,semi,;", + "comma,,,semi,;,dot,.", + "dot,.,comma,,,semi,;", + "dot,.,semi,;,comma,,", + "semi,;,comma,,,dot,.", + "semi,;,dot,.,comma,," + ]], + ["{+keys*}", [ + "comma=,,dot=.,semi=;", + "comma=,,semi=;,dot=.", + "dot=.,comma=,,semi=;", + "dot=.,semi=;,comma=,", + "semi=;,comma=,,dot=.", + "semi=;,dot=.,comma=," + ]] + ] + }, + "3.2.4 Fragment Expansion" : + { + "variables": { + "count" : ["one", "two", "three"], + "dom" : ["example", "com"], + "dub" : "me/too", + "hello" : "Hello World!", + "half" : "50%", + "var" : "value", + "who" : "fred", + "base" : "http://example.com/home/", + "path" : "/foo/bar", + "list" : ["red", "green", "blue"], + "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, + "v" : "6", + "x" : "1024", + "y" : "768", + "empty" : "", + "empty_keys" : [], + "undef" : null + }, + "testcases" : [ + ["{#var}", "#value"], + ["{#hello}", "#Hello%20World!"], + ["{#half}", "#50%25"], + ["foo{#empty}", "foo#"], + ["foo{#undef}", "foo"], + ["{#x,hello,y}", "#1024,Hello%20World!,768"], + ["{#path,x}/here", "#/foo/bar,1024/here"], + ["{#path:6}/here", "#/foo/b/here"], + ["{#list}", "#red,green,blue"], + ["{#list*}", "#red,green,blue"], + ["{#keys}", [ + "#comma,,,dot,.,semi,;", + "#comma,,,semi,;,dot,.", + "#dot,.,comma,,,semi,;", + "#dot,.,semi,;,comma,,", + "#semi,;,comma,,,dot,.", + "#semi,;,dot,.,comma,," + ]] + ] + }, + "3.2.5 Label Expansion with Dot-Prefix" : + { + "variables": { + "count" : ["one", "two", "three"], + "dom" : ["example", "com"], + "dub" : "me/too", + "hello" : "Hello World!", + "half" : "50%", + "var" : "value", + "who" : "fred", + "base" : "http://example.com/home/", + "path" : "/foo/bar", + "list" : ["red", "green", "blue"], + "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, + "v" : "6", + "x" : "1024", + "y" : "768", + "empty" : "", + "empty_keys" : [], + "undef" : null + }, + "testcases" : [ + ["{.who}", ".fred"], + ["{.who,who}", ".fred.fred"], + ["{.half,who}", ".50%25.fred"], + ["www{.dom*}", "www.example.com"], + ["X{.var}", "X.value"], + ["X{.var:3}", "X.val"], + ["X{.empty}", "X."], + ["X{.undef}", "X"], + ["X{.list}", "X.red,green,blue"], + ["X{.list*}", "X.red.green.blue"], + ["{#keys}", [ + "#comma,,,dot,.,semi,;", + "#comma,,,semi,;,dot,.", + "#dot,.,comma,,,semi,;", + "#dot,.,semi,;,comma,,", + "#semi,;,comma,,,dot,.", + "#semi,;,dot,.,comma,," + ]], + ["{#keys*}", [ + "#comma=,,dot=.,semi=;", + "#comma=,,semi=;,dot=.", + "#dot=.,comma=,,semi=;", + "#dot=.,semi=;,comma=,", + "#semi=;,comma=,,dot=.", + "#semi=;,dot=.,comma=," + ]], + ["X{.empty_keys}", "X"], + ["X{.empty_keys*}", "X"] + ] + }, + "3.2.6 Path Segment Expansion" : + { + "variables": { + "count" : ["one", "two", "three"], + "dom" : ["example", "com"], + "dub" : "me/too", + "hello" : "Hello World!", + "half" : "50%", + "var" : "value", + "who" : "fred", + "base" : "http://example.com/home/", + "path" : "/foo/bar", + "list" : ["red", "green", "blue"], + "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, + "v" : "6", + "x" : "1024", + "y" : "768", + "empty" : "", + "empty_keys" : [], + "undef" : null + }, + "testcases" : [ + ["{/who}", "/fred"], + ["{/who,who}", "/fred/fred"], + ["{/half,who}", "/50%25/fred"], + ["{/who,dub}", "/fred/me%2Ftoo"], + ["{/var}", "/value"], + ["{/var,empty}", "/value/"], + ["{/var,undef}", "/value"], + ["{/var,x}/here", "/value/1024/here"], + ["{/var:1,var}", "/v/value"], + ["{/list}", "/red,green,blue"], + ["{/list*}", "/red/green/blue"], + ["{/list*,path:4}", "/red/green/blue/%2Ffoo"], + ["{/keys}", [ + "/comma,%2C,dot,.,semi,%3B", + "/comma,%2C,semi,%3B,dot,.", + "/dot,.,comma,%2C,semi,%3B", + "/dot,.,semi,%3B,comma,%2C", + "/semi,%3B,comma,%2C,dot,.", + "/semi,%3B,dot,.,comma,%2C" + ]], + ["{/keys*}", [ + "/comma=%2C/dot=./semi=%3B", + "/comma=%2C/semi=%3B/dot=.", + "/dot=./comma=%2C/semi=%3B", + "/dot=./semi=%3B/comma=%2C", + "/semi=%3B/comma=%2C/dot=.", + "/semi=%3B/dot=./comma=%2C" + ]] + ] + }, + "3.2.7 Path-Style Parameter Expansion" : + { + "variables": { + "count" : ["one", "two", "three"], + "dom" : ["example", "com"], + "dub" : "me/too", + "hello" : "Hello World!", + "half" : "50%", + "var" : "value", + "who" : "fred", + "base" : "http://example.com/home/", + "path" : "/foo/bar", + "list" : ["red", "green", "blue"], + "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, + "v" : "6", + "x" : "1024", + "y" : "768", + "empty" : "", + "empty_keys" : [], + "undef" : null + }, + "testcases" : [ + ["{;who}", ";who=fred"], + ["{;half}", ";half=50%25"], + ["{;empty}", ";empty"], + ["{;hello:5}", ";hello=Hello"], + ["{;v,empty,who}", ";v=6;empty;who=fred"], + ["{;v,bar,who}", ";v=6;who=fred"], + ["{;x,y}", ";x=1024;y=768"], + ["{;x,y,empty}", ";x=1024;y=768;empty"], + ["{;x,y,undef}", ";x=1024;y=768"], + ["{;list}", ";list=red,green,blue"], + ["{;list*}", ";list=red;list=green;list=blue"], + ["{;keys}", [ + ";keys=comma,%2C,dot,.,semi,%3B", + ";keys=comma,%2C,semi,%3B,dot,.", + ";keys=dot,.,comma,%2C,semi,%3B", + ";keys=dot,.,semi,%3B,comma,%2C", + ";keys=semi,%3B,comma,%2C,dot,.", + ";keys=semi,%3B,dot,.,comma,%2C" + ]], + ["{;keys*}", [ + ";comma=%2C;dot=.;semi=%3B", + ";comma=%2C;semi=%3B;dot=.", + ";dot=.;comma=%2C;semi=%3B", + ";dot=.;semi=%3B;comma=%2C", + ";semi=%3B;comma=%2C;dot=.", + ";semi=%3B;dot=.;comma=%2C" + ]] + ] + }, + "3.2.8 Form-Style Query Expansion" : + { + "variables": { + "count" : ["one", "two", "three"], + "dom" : ["example", "com"], + "dub" : "me/too", + "hello" : "Hello World!", + "half" : "50%", + "var" : "value", + "who" : "fred", + "base" : "http://example.com/home/", + "path" : "/foo/bar", + "list" : ["red", "green", "blue"], + "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, + "v" : "6", + "x" : "1024", + "y" : "768", + "empty" : "", + "empty_keys" : [], + "undef" : null + }, + "testcases" : [ + ["{?who}", "?who=fred"], + ["{?half}", "?half=50%25"], + ["{?x,y}", "?x=1024&y=768"], + ["{?x,y,empty}", "?x=1024&y=768&empty="], + ["{?x,y,undef}", "?x=1024&y=768"], + ["{?var:3}", "?var=val"], + ["{?list}", "?list=red,green,blue"], + ["{?list*}", "?list=red&list=green&list=blue"], + ["{?keys}", [ + "?keys=comma,%2C,dot,.,semi,%3B", + "?keys=comma,%2C,semi,%3B,dot,.", + "?keys=dot,.,comma,%2C,semi,%3B", + "?keys=dot,.,semi,%3B,comma,%2C", + "?keys=semi,%3B,comma,%2C,dot,.", + "?keys=semi,%3B,dot,.,comma,%2C" + ]], + ["{?keys*}", [ + "?comma=%2C&dot=.&semi=%3B", + "?comma=%2C&semi=%3B&dot=.", + "?dot=.&comma=%2C&semi=%3B", + "?dot=.&semi=%3B&comma=%2C", + "?semi=%3B&comma=%2C&dot=.", + "?semi=%3B&dot=.&comma=%2C" + ]] + ] + }, + "3.2.9 Form-Style Query Continuation" : + { + "variables": { + "count" : ["one", "two", "three"], + "dom" : ["example", "com"], + "dub" : "me/too", + "hello" : "Hello World!", + "half" : "50%", + "var" : "value", + "who" : "fred", + "base" : "http://example.com/home/", + "path" : "/foo/bar", + "list" : ["red", "green", "blue"], + "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, + "v" : "6", + "x" : "1024", + "y" : "768", + "empty" : "", + "empty_keys" : [], + "undef" : null + }, + "testcases" : [ + ["{&who}", "&who=fred"], + ["{&half}", "&half=50%25"], + ["?fixed=yes{&x}", "?fixed=yes&x=1024"], + ["{&var:3}", "&var=val"], + ["{&x,y,empty}", "&x=1024&y=768&empty="], + ["{&x,y,undef}", "&x=1024&y=768"], + ["{&list}", "&list=red,green,blue"], + ["{&list*}", "&list=red&list=green&list=blue"], + ["{&keys}", [ + "&keys=comma,%2C,dot,.,semi,%3B", + "&keys=comma,%2C,semi,%3B,dot,.", + "&keys=dot,.,comma,%2C,semi,%3B", + "&keys=dot,.,semi,%3B,comma,%2C", + "&keys=semi,%3B,comma,%2C,dot,.", + "&keys=semi,%3B,dot,.,comma,%2C" + ]], + ["{&keys*}", [ + "&comma=%2C&dot=.&semi=%3B", + "&comma=%2C&semi=%3B&dot=.", + "&dot=.&comma=%2C&semi=%3B", + "&dot=.&semi=%3B&comma=%2C", + "&semi=%3B&comma=%2C&dot=.", + "&semi=%3B&dot=.&comma=%2C" + ]] + ] + } +} diff --git a/lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples.json b/lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples.json new file mode 100644 index 000000000..2e8e942da --- /dev/null +++ b/lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples.json @@ -0,0 +1,218 @@ +{ + "Level 1 Examples" : + { + "level": 1, + "variables": { + "var" : "value", + "hello" : "Hello World!" + }, + "testcases" : [ + ["{var}", "value"], + ["{hello}", "Hello%20World%21"] + ] + }, + "Level 2 Examples" : + { + "level": 2, + "variables": { + "var" : "value", + "hello" : "Hello World!", + "path" : "/foo/bar" + }, + "testcases" : [ + ["{+var}", "value"], + ["{+hello}", "Hello%20World!"], + ["{+path}/here", "/foo/bar/here"], + ["here?ref={+path}", "here?ref=/foo/bar"] + ] + }, + "Level 3 Examples" : + { + "level": 3, + "variables": { + "var" : "value", + "hello" : "Hello World!", + "empty" : "", + "path" : "/foo/bar", + "x" : "1024", + "y" : "768" + }, + "testcases" : [ + ["map?{x,y}", "map?1024,768"], + ["{x,hello,y}", "1024,Hello%20World%21,768"], + ["{+x,hello,y}", "1024,Hello%20World!,768"], + ["{+path,x}/here", "/foo/bar,1024/here"], + ["{#x,hello,y}", "#1024,Hello%20World!,768"], + ["{#path,x}/here", "#/foo/bar,1024/here"], + ["X{.var}", "X.value"], + ["X{.x,y}", "X.1024.768"], + ["{/var}", "/value"], + ["{/var,x}/here", "/value/1024/here"], + ["{;x,y}", ";x=1024;y=768"], + ["{;x,y,empty}", ";x=1024;y=768;empty"], + ["{?x,y}", "?x=1024&y=768"], + ["{?x,y,empty}", "?x=1024&y=768&empty="], + ["?fixed=yes{&x}", "?fixed=yes&x=1024"], + ["{&x,y,empty}", "&x=1024&y=768&empty="] + ] + }, + "Level 4 Examples" : + { + "level": 4, + "variables": { + "var": "value", + "hello": "Hello World!", + "path": "/foo/bar", + "list": ["red", "green", "blue"], + "keys": {"semi": ";", "dot": ".", "comma":","} + }, + "testcases": [ + ["{var:3}", "val"], + ["{var:30}", "value"], + ["{list}", "red,green,blue"], + ["{list*}", "red,green,blue"], + ["{keys}", [ + "comma,%2C,dot,.,semi,%3B", + "comma,%2C,semi,%3B,dot,.", + "dot,.,comma,%2C,semi,%3B", + "dot,.,semi,%3B,comma,%2C", + "semi,%3B,comma,%2C,dot,.", + "semi,%3B,dot,.,comma,%2C" + ]], + ["{keys*}", [ + "comma=%2C,dot=.,semi=%3B", + "comma=%2C,semi=%3B,dot=.", + "dot=.,comma=%2C,semi=%3B", + "dot=.,semi=%3B,comma=%2C", + "semi=%3B,comma=%2C,dot=.", + "semi=%3B,dot=.,comma=%2C" + ]], + ["{+path:6}/here", "/foo/b/here"], + ["{+list}", "red,green,blue"], + ["{+list*}", "red,green,blue"], + ["{+keys}", [ + "comma,,,dot,.,semi,;", + "comma,,,semi,;,dot,.", + "dot,.,comma,,,semi,;", + "dot,.,semi,;,comma,,", + "semi,;,comma,,,dot,.", + "semi,;,dot,.,comma,," + ]], + ["{+keys*}", [ + "comma=,,dot=.,semi=;", + "comma=,,semi=;,dot=.", + "dot=.,comma=,,semi=;", + "dot=.,semi=;,comma=,", + "semi=;,comma=,,dot=.", + "semi=;,dot=.,comma=," + ]], + ["{#path:6}/here", "#/foo/b/here"], + ["{#list}", "#red,green,blue"], + ["{#list*}", "#red,green,blue"], + ["{#keys}", [ + "#comma,,,dot,.,semi,;", + "#comma,,,semi,;,dot,.", + "#dot,.,comma,,,semi,;", + "#dot,.,semi,;,comma,,", + "#semi,;,comma,,,dot,.", + "#semi,;,dot,.,comma,," + ]], + ["{#keys*}", [ + "#comma=,,dot=.,semi=;", + "#comma=,,semi=;,dot=.", + "#dot=.,comma=,,semi=;", + "#dot=.,semi=;,comma=,", + "#semi=;,comma=,,dot=.", + "#semi=;,dot=.,comma=," + ]], + ["X{.var:3}", "X.val"], + ["X{.list}", "X.red,green,blue"], + ["X{.list*}", "X.red.green.blue"], + ["X{.keys}", [ + "X.comma,%2C,dot,.,semi,%3B", + "X.comma,%2C,semi,%3B,dot,.", + "X.dot,.,comma,%2C,semi,%3B", + "X.dot,.,semi,%3B,comma,%2C", + "X.semi,%3B,comma,%2C,dot,.", + "X.semi,%3B,dot,.,comma,%2C" + ]], + ["{/var:1,var}", "/v/value"], + ["{/list}", "/red,green,blue"], + ["{/list*}", "/red/green/blue"], + ["{/list*,path:4}", "/red/green/blue/%2Ffoo"], + ["{/keys}", [ + "/comma,%2C,dot,.,semi,%3B", + "/comma,%2C,semi,%3B,dot,.", + "/dot,.,comma,%2C,semi,%3B", + "/dot,.,semi,%3B,comma,%2C", + "/semi,%3B,comma,%2C,dot,.", + "/semi,%3B,dot,.,comma,%2C" + ]], + ["{/keys*}", [ + "/comma=%2C/dot=./semi=%3B", + "/comma=%2C/semi=%3B/dot=.", + "/dot=./comma=%2C/semi=%3B", + "/dot=./semi=%3B/comma=%2C", + "/semi=%3B/comma=%2C/dot=.", + "/semi=%3B/dot=./comma=%2C" + ]], + ["{;hello:5}", ";hello=Hello"], + ["{;list}", ";list=red,green,blue"], + ["{;list*}", ";list=red;list=green;list=blue"], + ["{;keys}", [ + ";keys=comma,%2C,dot,.,semi,%3B", + ";keys=comma,%2C,semi,%3B,dot,.", + ";keys=dot,.,comma,%2C,semi,%3B", + ";keys=dot,.,semi,%3B,comma,%2C", + ";keys=semi,%3B,comma,%2C,dot,.", + ";keys=semi,%3B,dot,.,comma,%2C" + ]], + ["{;keys*}", [ + ";comma=%2C;dot=.;semi=%3B", + ";comma=%2C;semi=%3B;dot=.", + ";dot=.;comma=%2C;semi=%3B", + ";dot=.;semi=%3B;comma=%2C", + ";semi=%3B;comma=%2C;dot=.", + ";semi=%3B;dot=.;comma=%2C" + ]], + ["{?var:3}", "?var=val"], + ["{?list}", "?list=red,green,blue"], + ["{?list*}", "?list=red&list=green&list=blue"], + ["{?keys}", [ + "?keys=comma,%2C,dot,.,semi,%3B", + "?keys=comma,%2C,semi,%3B,dot,.", + "?keys=dot,.,comma,%2C,semi,%3B", + "?keys=dot,.,semi,%3B,comma,%2C", + "?keys=semi,%3B,comma,%2C,dot,.", + "?keys=semi,%3B,dot,.,comma,%2C" + ]], + ["{?keys*}", [ + "?comma=%2C&dot=.&semi=%3B", + "?comma=%2C&semi=%3B&dot=.", + "?dot=.&comma=%2C&semi=%3B", + "?dot=.&semi=%3B&comma=%2C", + "?semi=%3B&comma=%2C&dot=.", + "?semi=%3B&dot=.&comma=%2C" + ]], + ["{&var:3}", "&var=val"], + ["{&list}", "&list=red,green,blue"], + ["{&list*}", "&list=red&list=green&list=blue"], + ["{&keys}", [ + "&keys=comma,%2C,dot,.,semi,%3B", + "&keys=comma,%2C,semi,%3B,dot,.", + "&keys=dot,.,comma,%2C,semi,%3B", + "&keys=dot,.,semi,%3B,comma,%2C", + "&keys=semi,%3B,comma,%2C,dot,.", + "&keys=semi,%3B,dot,.,comma,%2C" + ]], + ["{&keys*}", [ + "&comma=%2C&dot=.&semi=%3B", + "&comma=%2C&semi=%3B&dot=.", + "&dot=.&comma=%2C&semi=%3B", + "&dot=.&semi=%3B&comma=%2C", + "&semi=%3B&comma=%2C&dot=.", + "&semi=%3B&dot=.&comma=%2C" + ]] + ] + } +} diff --git a/lib/Google/vendor/rize/uri-template/tests/fixtures/transform-json-tests.xslt b/lib/Google/vendor/rize/uri-template/tests/fixtures/transform-json-tests.xslt new file mode 100644 index 000000000..d956b6bdb --- /dev/null +++ b/lib/Google/vendor/rize/uri-template/tests/fixtures/transform-json-tests.xslt @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/Google/vendor/symfony/deprecation-contracts/.gitignore b/lib/Google/vendor/symfony/deprecation-contracts/.gitignore deleted file mode 100644 index c49a5d8df..000000000 --- a/lib/Google/vendor/symfony/deprecation-contracts/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/lib/Google/vendor/symfony/deprecation-contracts/LICENSE b/lib/Google/vendor/symfony/deprecation-contracts/LICENSE index 406242ff2..0ed3a2465 100644 --- a/lib/Google/vendor/symfony/deprecation-contracts/LICENSE +++ b/lib/Google/vendor/symfony/deprecation-contracts/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020-2022 Fabien Potencier +Copyright (c) 2020-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/lib/Google/vendor/symfony/deprecation-contracts/README.md b/lib/Google/vendor/symfony/deprecation-contracts/README.md index 4957933a6..9814864c0 100644 --- a/lib/Google/vendor/symfony/deprecation-contracts/README.md +++ b/lib/Google/vendor/symfony/deprecation-contracts/README.md @@ -22,5 +22,5 @@ trigger_deprecation('symfony/blockchain', '8.9', 'Using "%s" is deprecated, use This will generate the following message: `Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.` -While not necessarily recommended, the deprecation notices can be completely ignored by declaring an empty +While not recommended, the deprecation notices can be completely ignored by declaring an empty `function trigger_deprecation() {}` in your application. diff --git a/lib/Google/vendor/symfony/deprecation-contracts/composer.json b/lib/Google/vendor/symfony/deprecation-contracts/composer.json index 1c1b4ba0e..5533b5c3f 100644 --- a/lib/Google/vendor/symfony/deprecation-contracts/composer.json +++ b/lib/Google/vendor/symfony/deprecation-contracts/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "autoload": { "files": [ @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.6-dev" }, "thanks": { "name": "symfony/contracts", diff --git a/lib/Google/vendor/symfony/polyfill-php81/LICENSE b/lib/Google/vendor/symfony/polyfill-php81/LICENSE deleted file mode 100644 index 99c6bdf35..000000000 --- a/lib/Google/vendor/symfony/polyfill-php81/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2021-present Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/lib/Google/vendor/symfony/polyfill-php81/Php81.php b/lib/Google/vendor/symfony/polyfill-php81/Php81.php deleted file mode 100644 index f0507b765..000000000 --- a/lib/Google/vendor/symfony/polyfill-php81/Php81.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Polyfill\Php81; - -/** - * @author Nicolas Grekas - * - * @internal - */ -final class Php81 -{ - public static function array_is_list(array $array): bool - { - if ([] === $array || $array === array_values($array)) { - return true; - } - - $nextKey = -1; - - foreach ($array as $k => $v) { - if ($k !== ++$nextKey) { - return false; - } - } - - return true; - } -} diff --git a/lib/Google/vendor/symfony/polyfill-php81/README.md b/lib/Google/vendor/symfony/polyfill-php81/README.md deleted file mode 100644 index c07ef7820..000000000 --- a/lib/Google/vendor/symfony/polyfill-php81/README.md +++ /dev/null @@ -1,18 +0,0 @@ -Symfony Polyfill / Php81 -======================== - -This component provides features added to PHP 8.1 core: - -- [`array_is_list`](https://php.net/array_is_list) -- [`enum_exists`](https://php.net/enum-exists) -- [`MYSQLI_REFRESH_REPLICA`](https://php.net/mysqli.constants#constantmysqli-refresh-replica) constant -- [`ReturnTypeWillChange`](https://wiki.php.net/rfc/internal_method_return_types) -- [`CURLStringFile`](https://php.net/CURLStringFile) (but only if PHP >= 7.4 is used) - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php b/lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php deleted file mode 100644 index 5ff93fcaf..000000000 --- a/lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -if (\PHP_VERSION_ID >= 70400 && extension_loaded('curl')) { - /** - * @property string $data - */ - class CURLStringFile extends CURLFile - { - private $data; - - public function __construct(string $data, string $postname, string $mime = 'application/octet-stream') - { - $this->data = $data; - parent::__construct('data://application/octet-stream;base64,'.base64_encode($data), $mime, $postname); - } - - public function __set(string $name, $value): void - { - if ('data' !== $name) { - $this->$name = $value; - - return; - } - - if (is_object($value) ? !method_exists($value, '__toString') : !is_scalar($value)) { - throw new TypeError('Cannot assign '.gettype($value).' to property CURLStringFile::$data of type string'); - } - - $this->name = 'data://application/octet-stream;base64,'.base64_encode($value); - } - - public function __isset(string $name): bool - { - return isset($this->$name); - } - - public function &__get(string $name) - { - return $this->$name; - } - } -} diff --git a/lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php b/lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php deleted file mode 100644 index cb7720a8d..000000000 --- a/lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -if (\PHP_VERSION_ID < 80100) { - #[Attribute(Attribute::TARGET_METHOD)] - final class ReturnTypeWillChange - { - public function __construct() - { - } - } -} diff --git a/lib/Google/vendor/symfony/polyfill-php81/bootstrap.php b/lib/Google/vendor/symfony/polyfill-php81/bootstrap.php deleted file mode 100644 index 9f872e02f..000000000 --- a/lib/Google/vendor/symfony/polyfill-php81/bootstrap.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Php81 as p; - -if (\PHP_VERSION_ID >= 80100) { - return; -} - -if (defined('MYSQLI_REFRESH_SLAVE') && !defined('MYSQLI_REFRESH_REPLICA')) { - define('MYSQLI_REFRESH_REPLICA', 64); -} - -if (!function_exists('array_is_list')) { - function array_is_list(array $array): bool { return p\Php81::array_is_list($array); } -} - -if (!function_exists('enum_exists')) { - function enum_exists(string $enum, bool $autoload = true): bool { return $autoload && class_exists($enum) && false; } -} diff --git a/lib/Google/vendor/symfony/polyfill-php81/composer.json b/lib/Google/vendor/symfony/polyfill-php81/composer.json deleted file mode 100644 index 28b6408ea..000000000 --- a/lib/Google/vendor/symfony/polyfill-php81/composer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "symfony/polyfill-php81", - "type": "library", - "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", - "keywords": ["polyfill", "shim", "compatibility", "portable"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.2" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Php81\\": "" }, - "files": [ "bootstrap.php" ], - "classmap": [ "Resources/stubs" ] - }, - "minimum-stability": "dev", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/lib/classes/class-bootstrap.php b/lib/classes/class-bootstrap.php index 6d266bb2a..fe25c385a 100644 --- a/lib/classes/class-bootstrap.php +++ b/lib/classes/class-bootstrap.php @@ -421,7 +421,7 @@ public function select_wp_image_editors($editors) { * @return StorageClient * @throws \Exception */ - public function init_gs_client(callable $httpHandler = null) { + public function init_gs_client(?callable $httpHandler = null) { // May be Loading Google SDK.... if (!class_exists('HttpHandlerFactory')) { include_once(ud_get_stateless_media()->path('lib/Google/vendor/autoload.php', 'dir')); diff --git a/lib/classes/class-settings.php b/lib/classes/class-settings.php index f241def0f..58877e0da 100644 --- a/lib/classes/class-settings.php +++ b/lib/classes/class-settings.php @@ -120,6 +120,22 @@ public function __construct($bootstrap = null) { // Settings page content add_action('wp_stateless_settings_tab_content', array($this, 'settings_tab_content')); add_action('wp_stateless_processing_tab_content', array($this, 'processing_tab_content')); + } + + /** + * Init + */ + public function init(){ + $this->save_media_settings(); + + add_action('admin_menu', array( $this, 'admin_menu' )); + + /** + * Manage specific Network Settings + */ + if( is_network_admin() ) { + add_action( 'network_admin_menu', array( $this, 'network_admin_menu' )); + } $site_url = parse_url( site_url() ); $site_url['path'] = isset($site_url['path']) ? $site_url['path'] : ''; @@ -158,22 +174,6 @@ public function __construct($bootstrap = null) { ); } - /** - * Init - */ - public function init(){ - $this->save_media_settings(); - - add_action('admin_menu', array( $this, 'admin_menu' )); - /** - * Manage specific Network Settings - */ - if( is_network_admin() ) { - add_action( 'network_admin_menu', array( $this, 'network_admin_menu' )); - } - - } - /** * Refresh settings */ diff --git a/readme.md b/readme.md index 62921f9b2..343bf6570 100644 --- a/readme.md +++ b/readme.md @@ -68,7 +68,7 @@ For a more detailed installation and setup walkthrough, please see the [manual s ### What are the minimum server requirements for this plugin? -Beyond the [official WordPress minimum requirements](https://codex.wordpress.org/Template:Server_requirements), WP-Stateless requires a minimum PHP version of 7.2 or higher and OpenSSL to be enabled. +Beyond the [official WordPress minimum requirements](https://codex.wordpress.org/Template:Server_requirements), WP-Stateless requires a minimum PHP version of 8.1 or higher and OpenSSL to be enabled. ### What wp-config constants are supported? diff --git a/readme.txt b/readme.txt index bea6d3a4d..a8c489cf9 100644 --- a/readme.txt +++ b/readme.txt @@ -3,10 +3,10 @@ Contributors: usability_dynamics, andypotanin, ideric, planvova, obolgun Donate link: https://udx.io Tags: google cloud, google cloud storage, cdn, uploads, backup License: GPLv2 or later -Requires PHP: 8.0 +Requires PHP: 8.1 Requires at least: 5.0 Tested up to: 6.8 -Stable tag: 4.2.0 +Stable tag: 4.2.1 Upload and serve your WordPress media files from Google Cloud Storage. @@ -87,7 +87,7 @@ For a more detailed installation and setup walkthrough, please see the [manual s = What are the minimum server requirements for this plugin? = -Beyond the [official WordPress minimum requirements](https://wordpress.org/about/requirements/), WP-Stateless requires a minimum PHP version of 8.0 or higher and OpenSSL to be enabled. +Beyond the [official WordPress minimum requirements](https://wordpress.org/about/requirements/), WP-Stateless requires a minimum PHP version of 8.1 or higher and OpenSSL to be enabled. = What wp-config constants are supported? = @@ -135,7 +135,14 @@ Before upgrading to WP-Stateless 3.2.0, please, make sure you use PHP 7.2 or abo Before upgrading to WP-Stateless 3.0, please, make sure you tested it on your development environment. == Changelog == -= 4.2 = += 4.2.1 = +* **WP-Stateless 4.2.1 requires PHP 8.1 or higher, in accordance with the requirements of the official Google API PHP Client Library.** +* ENHANCEMENT - Updated Client library for Google APIs from 2.18.3 to 2.18.4. +* ENHANCEMENT - updated `wpmetabox/meta-box` library from 5.10.11 to 5.10.15. +* FIX - correctly loads text domain to prevent PHP notices. +* FIX - `udx/lib-ud-api-client` package correctly loads text domain to prevent PHP notices. + += 4.2.0 = * ENHANCEMENT - Updated Client library for Google APIs from 2.18.2 to 2.18.3. * ENHANCEMENT - updated `firebase/php-jwt` library from 6.10.2 to 6.11.1. * ENHANCEMENT - updated `wpmetabox/meta-box` library from 5.10.1 to 5.10.11. diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 55efadc61..c474bc8e1 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -263,16 +263,16 @@ }, { "name": "udx/lib-ud-api-client", - "version": "1.2.4", - "version_normalized": "1.2.4.0", + "version": "1.2.5", + "version_normalized": "1.2.5.0", "source": { "type": "git", "url": "git@github.com:udx/lib-ud-api-client", - "reference": "1.2.4" + "reference": "1.2.5" }, "dist": { "type": "zip", - "url": "https://github.com/udx/lib-ud-api-client/archive/1.2.4.zip" + "url": "https://github.com/udx/lib-ud-api-client/archive/1.2.5.zip" }, "require": { "php": ">=5.3" @@ -345,16 +345,16 @@ }, { "name": "wpackagist-plugin/meta-box", - "version": "5.10.11", - "version_normalized": "5.10.11.0", + "version": "5.10.15", + "version_normalized": "5.10.15.0", "source": { "type": "svn", "url": "https://plugins.svn.wordpress.org/meta-box/", - "reference": "tags/5.10.11" + "reference": "tags/5.10.15" }, "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/plugin/meta-box.5.10.11.zip" + "url": "https://downloads.wordpress.org/plugin/meta-box.5.10.15.zip" }, "require": { "composer/installers": "^1.0 || ^2.0" diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index d632920b6..9f948208c 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'wpcloud/wp-stateless', 'pretty_version' => 'dev-latest', 'version' => 'dev-latest', - 'reference' => 'e9bccc39abc840b90f13f5054b669f3d2d2fe0df', + 'reference' => '28fb7b2fe86f07bf3656c001f844467acd4d2b35', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -38,9 +38,9 @@ 'dev_requirement' => false, ), 'udx/lib-ud-api-client' => array( - 'pretty_version' => '1.2.4', - 'version' => '1.2.4.0', - 'reference' => '1.2.4', + 'pretty_version' => '1.2.5', + 'version' => '1.2.5.0', + 'reference' => '1.2.5', 'type' => 'library', 'install_path' => __DIR__ . '/../udx/lib-ud-api-client', 'aliases' => array(), @@ -56,9 +56,9 @@ 'dev_requirement' => false, ), 'wpackagist-plugin/meta-box' => array( - 'pretty_version' => '5.10.11', - 'version' => '5.10.11.0', - 'reference' => 'tags/5.10.11', + 'pretty_version' => '5.10.15', + 'version' => '5.10.15.0', + 'reference' => 'tags/5.10.15', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../wpmetabox/meta-box', 'aliases' => array(), @@ -67,7 +67,7 @@ 'wpcloud/wp-stateless' => array( 'pretty_version' => 'dev-latest', 'version' => 'dev-latest', - 'reference' => 'e9bccc39abc840b90f13f5054b669f3d2d2fe0df', + 'reference' => '28fb7b2fe86f07bf3656c001f844467acd4d2b35', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php index adfb472fb..4c3a5d68f 100644 --- a/vendor/composer/platform_check.php +++ b/vendor/composer/platform_check.php @@ -4,8 +4,8 @@ $issues = array(); -if (!(PHP_VERSION_ID >= 80000)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 8.0.0". You are running ' . PHP_VERSION . '.'; +if (!(PHP_VERSION_ID >= 80100)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.'; } if ($issues) { diff --git a/vendor/udx/lib-ud-api-client/changes.md b/vendor/udx/lib-ud-api-client/changes.md index 8faaf0d15..cce11f8bb 100644 --- a/vendor/udx/lib-ud-api-client/changes.md +++ b/vendor/udx/lib-ud-api-client/changes.md @@ -1,3 +1,7 @@ +### 1.2.5 + +* Fix text domain initialization to prevent PHP notices. + ### 1.2.4 * Require user to be logged in while dismissing Admin Panel notices. diff --git a/vendor/udx/lib-ud-api-client/gruntfile.js b/vendor/udx/lib-ud-api-client/gruntfile.js index 4deb0ebf1..3ff20fcf7 100644 --- a/vendor/udx/lib-ud-api-client/gruntfile.js +++ b/vendor/udx/lib-ud-api-client/gruntfile.js @@ -2,7 +2,7 @@ * Build Plugin. * * @author potanin@UD - * @version 1.2.4 + * @version 1.2.5 * @param grunt */ module.exports = function( grunt ) { diff --git a/vendor/udx/lib-ud-api-client/lib/classes/class-admin.php b/vendor/udx/lib-ud-api-client/lib/classes/class-admin.php index 6cbdeb0b9..16ba6f022 100644 --- a/vendor/udx/lib-ud-api-client/lib/classes/class-admin.php +++ b/vendor/udx/lib-ud-api-client/lib/classes/class-admin.php @@ -82,25 +82,27 @@ public function __construct( $args = array() ) { ) ) ); //** Set available screens */ - $screens = array(); - if( $this->type == 'theme' ) { - $screens =array_filter( array( - 'licenses' => __( 'License', $this->domain ), - 'more_products' => false, - ) ); - } elseif ( $this->type == 'plugin' ) { - $screens =array_filter( array( - 'licenses' => __( 'Licenses', $this->domain ), - 'more_products' => __( 'More Products', $this->domain ), - ) ); - } - - //** UI */ - $this->ui = new UI( array_merge( $args, array( - 'token' => $this->token, - 'screens' => $screens, - ) ) ); - + add_action('init', function () use ($args) { + $screens = array(); + if( $this->type == 'theme' ) { + $screens =array_filter( array( + 'licenses' => __( 'License', $this->domain ), + 'more_products' => false, + ) ); + } elseif ( $this->type == 'plugin' ) { + $screens =array_filter( array( + 'licenses' => __( 'Licenses', $this->domain ), + 'more_products' => __( 'More Products', $this->domain ), + ) ); + } + + // Initialize UI + $this->ui = new UI( array_merge( $args, array( + 'token' => $this->token, + 'screens' => $screens, + ) ) ); + }, 20); + $path = wp_normalize_path( dirname( dirname( __DIR__ ) ) ); $this->screens_path = trailingslashit( $path . '/static/templates' ); if( $this->type == 'theme' && strpos( $path, wp_normalize_path( WP_PLUGIN_DIR ) ) === false ) { diff --git a/vendor/udx/lib-ud-api-client/lib/classes/class-bootstrap.php b/vendor/udx/lib-ud-api-client/lib/classes/class-bootstrap.php index ced9fdeb5..b90b4705c 100644 --- a/vendor/udx/lib-ud-api-client/lib/classes/class-bootstrap.php +++ b/vendor/udx/lib-ud-api-client/lib/classes/class-bootstrap.php @@ -18,7 +18,7 @@ class Bootstrap extends Scaffold { /** * */ - public static $version = '1.2.4'; + public static $version = '1.2.5'; /** * diff --git a/vendor/udx/lib-ud-api-client/package.json b/vendor/udx/lib-ud-api-client/package.json index 938163b99..7a116ceed 100644 --- a/vendor/udx/lib-ud-api-client/package.json +++ b/vendor/udx/lib-ud-api-client/package.json @@ -1,6 +1,6 @@ { "name": "lib-ud-api-client", - "version": "1.2.4", + "version": "1.2.5", "description": "UD Client for WooCommerce API Manager", "repository": { "type": "git", diff --git a/vendor/wpmetabox/meta-box/css/select-advanced.css b/vendor/wpmetabox/meta-box/css/select-advanced.css index 08a5c7154..3ec187de3 100644 --- a/vendor/wpmetabox/meta-box/css/select-advanced.css +++ b/vendor/wpmetabox/meta-box/css/select-advanced.css @@ -13,11 +13,9 @@ } .select2-container--open .select2-dropdown--below { border-top: 1px solid #7e8993; - top: -1px; } .select2-container--open .select2-dropdown--above { border-bottom: 1px solid #7e8993; - bottom: -1px; } .select2-container .select2-selection--single { height: 30px; diff --git a/vendor/wpmetabox/meta-box/inc/field.php b/vendor/wpmetabox/meta-box/inc/field.php index 43f043cb4..0d2466c9a 100644 --- a/vendor/wpmetabox/meta-box/inc/field.php +++ b/vendor/wpmetabox/meta-box/inc/field.php @@ -320,7 +320,7 @@ public static function normalize( $field ) { 'sanitize_callback' => null, ] ); - // Store the original ID to run correct filters for the clonable field. + // Store the original ID to run correct filters for the cloneable field. if ( $field['clone'] ) { $field['_original_id'] = $field['id']; } diff --git a/vendor/wpmetabox/meta-box/inc/fields/file-upload.php b/vendor/wpmetabox/meta-box/inc/fields/file-upload.php index 51e5376fa..313a3528c 100644 --- a/vendor/wpmetabox/meta-box/inc/fields/file-upload.php +++ b/vendor/wpmetabox/meta-box/inc/fields/file-upload.php @@ -31,12 +31,4 @@ public static function normalize( $field ) { return $field; } - - /** - * Template for media item. - */ - public static function print_templates() { - parent::print_templates(); - require RWMB_INC_DIR . 'templates/upload.php'; - } } diff --git a/vendor/wpmetabox/meta-box/inc/fields/image-advanced.php b/vendor/wpmetabox/meta-box/inc/fields/image-advanced.php index 77140bd0d..32c07e544 100644 --- a/vendor/wpmetabox/meta-box/inc/fields/image-advanced.php +++ b/vendor/wpmetabox/meta-box/inc/fields/image-advanced.php @@ -71,12 +71,4 @@ public static function file_info( $file, $args = [], $field = [] ) { public static function format_single_value( $field, $value, $args, $post_id ) { return RWMB_Image_Field::format_single_value( $field, $value, $args, $post_id ); } - - /** - * Template for media item. - */ - public static function print_templates() { - parent::print_templates(); - require RWMB_INC_DIR . 'templates/image-advanced.php'; - } } diff --git a/vendor/wpmetabox/meta-box/inc/fields/image-upload.php b/vendor/wpmetabox/meta-box/inc/fields/image-upload.php index 9ecd045e2..1ddf85cd7 100644 --- a/vendor/wpmetabox/meta-box/inc/fields/image-upload.php +++ b/vendor/wpmetabox/meta-box/inc/fields/image-upload.php @@ -22,12 +22,4 @@ public static function normalize( $field ) { $field = parent::normalize( $field ); return RWMB_File_Upload_Field::normalize( $field ); } - - /** - * Template for media item. - */ - public static function print_templates() { - parent::print_templates(); - RWMB_File_Upload_Field::print_templates(); - } } diff --git a/vendor/wpmetabox/meta-box/inc/fields/map.php b/vendor/wpmetabox/meta-box/inc/fields/map.php index 40107ff55..8f52c0245 100644 --- a/vendor/wpmetabox/meta-box/inc/fields/map.php +++ b/vendor/wpmetabox/meta-box/inc/fields/map.php @@ -50,10 +50,11 @@ public static function html( $meta, $field ) { $attributes['value'] = $meta; $html .= sprintf( - '
+ '
', esc_attr( $field['std'] ), esc_attr( $field['region'] ), + esc_attr( $field['marker_draggable'] ? 'true' : 'false' ), self::render_attributes( $attributes ) ); @@ -72,14 +73,15 @@ public static function html( $meta, $field ) { public static function normalize( $field ) { $field = parent::normalize( $field ); $field = wp_parse_args( $field, [ - 'std' => '', - 'address_field' => '', - 'language' => '', - 'region' => '', + 'std' => '', + 'address_field' => '', + 'language' => '', + 'region' => '', + 'marker_draggable' => true, // Default API key, required by Google Maps since June 2016. // Users should overwrite this key with their own key. - 'api_key' => 'AIzaSyC1mUh87SGFyf133tpZQJa-s96p0tgnraQ', + 'api_key' => 'AIzaSyC1mUh87SGFyf133tpZQJa-s96p0tgnraQ', ] ); return $field; diff --git a/vendor/wpmetabox/meta-box/inc/fields/media.php b/vendor/wpmetabox/meta-box/inc/fields/media.php index 9750bf7ab..202a2ac8d 100644 --- a/vendor/wpmetabox/meta-box/inc/fields/media.php +++ b/vendor/wpmetabox/meta-box/inc/fields/media.php @@ -32,10 +32,6 @@ public static function admin_enqueue_scripts() { ] ); } - public static function add_actions() { - add_action( 'print_media_templates', [ get_called_class(), 'print_templates' ] ); - } - /** * Get meta value. * @@ -206,11 +202,4 @@ public static function save( $new, $old, $post_id, $field ) { $storage->delete( $post_id, $field['id'] ); parent::save( $new, [], $post_id, $field ); } - - /** - * Template for media item. - */ - public static function print_templates() { - require RWMB_INC_DIR . 'templates/media.php'; - } } diff --git a/vendor/wpmetabox/meta-box/inc/fields/oembed.php b/vendor/wpmetabox/meta-box/inc/fields/oembed.php index a542e1ce8..5e09f9e77 100644 --- a/vendor/wpmetabox/meta-box/inc/fields/oembed.php +++ b/vendor/wpmetabox/meta-box/inc/fields/oembed.php @@ -55,7 +55,7 @@ public static function ajax_get_embed() { */ public static function get_embed( $url, $not_available = '' ) { /** - * Set arguments for getting embeded HTML. + * Set arguments for getting embedded HTML. * Without arguments, default width will be taken from global $content_width, which can break UI in the admin. * * @link https://github.com/rilwis/meta-box/issues/801 diff --git a/vendor/wpmetabox/meta-box/inc/fields/osm.php b/vendor/wpmetabox/meta-box/inc/fields/osm.php index e33e65398..57082fe15 100644 --- a/vendor/wpmetabox/meta-box/inc/fields/osm.php +++ b/vendor/wpmetabox/meta-box/inc/fields/osm.php @@ -37,11 +37,12 @@ public static function html( $meta, $field ) { $attributes['value'] = $meta; $html .= sprintf( - '
+ '
', esc_attr( $field['std'] ), esc_attr( $field['region'] ), esc_attr( $field['language'] ), + esc_attr( $field['marker_draggable'] ? 'true' : 'false' ), self::render_attributes( $attributes ) ); @@ -59,11 +60,12 @@ public static function html( $meta, $field ) { */ public static function normalize( $field ) { $field = parent::normalize( $field ); - $field = wp_parse_args( $field, [ - 'std' => '', - 'address_field' => '', - 'language' => '', - 'region' => '', + $field = wp_parse_args( $field, [ + 'std' => '', + 'address_field' => '', + 'language' => '', + 'region' => '', + 'marker_draggable' => true, ] ); return $field; diff --git a/vendor/wpmetabox/meta-box/inc/fields/video.php b/vendor/wpmetabox/meta-box/inc/fields/video.php index c659bb64d..b312c2af6 100644 --- a/vendor/wpmetabox/meta-box/inc/fields/video.php +++ b/vendor/wpmetabox/meta-box/inc/fields/video.php @@ -122,12 +122,4 @@ public static function format_clone_value( $field, $value, $args, $post_id ) { 'type' => 'video', ] ); } - - /** - * Template for media item. - */ - public static function print_templates() { - parent::print_templates(); - require RWMB_INC_DIR . 'templates/video.php'; - } } diff --git a/vendor/wpmetabox/meta-box/inc/loader.php b/vendor/wpmetabox/meta-box/inc/loader.php index 6ab3559b0..2408bbd75 100644 --- a/vendor/wpmetabox/meta-box/inc/loader.php +++ b/vendor/wpmetabox/meta-box/inc/loader.php @@ -7,7 +7,7 @@ class RWMB_Loader { protected function constants() { // Script version, used to add version for scripts and styles. - define( 'RWMB_VER', '5.10.11' ); + define( 'RWMB_VER', '5.10.15' ); list( $path, $url ) = self::get_path( dirname( __DIR__ ) ); diff --git a/vendor/wpmetabox/meta-box/inc/meta-box.php b/vendor/wpmetabox/meta-box/inc/meta-box.php index d50809151..a7c54930b 100644 --- a/vendor/wpmetabox/meta-box/inc/meta-box.php +++ b/vendor/wpmetabox/meta-box/inc/meta-box.php @@ -79,6 +79,13 @@ protected function global_hooks() { // Enqueue common styles and scripts. add_action( 'admin_enqueue_scripts', [ $this, 'enqueue' ] ); + // Enqueue assets for the block editor only, just for previewing (submission forms, custom blocks). + // Don't enqueue on frontend as front-end forms and blocks already call the enqueue() method. + // TODO: Uncomment this when we have a way to enqueue assets for the block/site editor. + // if ( is_admin() ) { + // add_action( 'enqueue_block_assets', [ $this, 'enqueue' ] ); + // } + // Add additional actions for fields. foreach ( $this->fields as $field ) { RWMB_Field::call( $field, 'add_actions' ); diff --git a/vendor/wpmetabox/meta-box/inc/templates/audio.php b/vendor/wpmetabox/meta-box/inc/templates/audio.php deleted file mode 100644 index c9090ae07..000000000 --- a/vendor/wpmetabox/meta-box/inc/templates/audio.php +++ /dev/null @@ -1,42 +0,0 @@ - - - diff --git a/vendor/wpmetabox/meta-box/inc/templates/image-advanced.php b/vendor/wpmetabox/meta-box/inc/templates/image-advanced.php deleted file mode 100644 index 494d4754c..000000000 --- a/vendor/wpmetabox/meta-box/inc/templates/image-advanced.php +++ /dev/null @@ -1,29 +0,0 @@ - - - diff --git a/vendor/wpmetabox/meta-box/inc/templates/media.php b/vendor/wpmetabox/meta-box/inc/templates/media.php deleted file mode 100644 index 0c91ead1f..000000000 --- a/vendor/wpmetabox/meta-box/inc/templates/media.php +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - diff --git a/vendor/wpmetabox/meta-box/inc/templates/upload.php b/vendor/wpmetabox/meta-box/inc/templates/upload.php deleted file mode 100644 index 0b6c2381a..000000000 --- a/vendor/wpmetabox/meta-box/inc/templates/upload.php +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/vendor/wpmetabox/meta-box/inc/templates/video.php b/vendor/wpmetabox/meta-box/inc/templates/video.php deleted file mode 100644 index c19900ae9..000000000 --- a/vendor/wpmetabox/meta-box/inc/templates/video.php +++ /dev/null @@ -1,37 +0,0 @@ - - - diff --git a/vendor/wpmetabox/meta-box/js/file-upload.js b/vendor/wpmetabox/meta-box/js/file-upload.js index 9c9126b46..85fc31af5 100644 --- a/vendor/wpmetabox/meta-box/js/file-upload.js +++ b/vendor/wpmetabox/meta-box/js/file-upload.js @@ -14,7 +14,13 @@ UploadButton = views.UploadButton = Backbone.View.extend( { className: 'rwmb-upload-area', tagName: 'div', - template: wp.template( 'rwmb-upload-area' ), + template: rwmb.template( ` +
+

{{{ i18nRwmbMedia.uploadInstructions }}}

+

{{{ i18nRwmbMedia.or }}}

+ +
+ ` ), render: function () { this.$el.html( this.template( {} ) ); return this; @@ -157,4 +163,8 @@ .on( 'mb_ready', init ) .on( 'clone', '.rwmb-file_upload', initFileUpload ) .on( 'click', '.rwmb-file-actions .rwmb-remove-media', removeFile ); + + wp?.hooks?.addAction( 'mb_ready', 'meta-box/ready/file_upload', ref => { + init( { target: ref } ); + } ); } )( jQuery, wp, rwmb ); diff --git a/vendor/wpmetabox/meta-box/js/image-advanced.js b/vendor/wpmetabox/meta-box/js/image-advanced.js index b7f0a0dff..89426b483 100644 --- a/vendor/wpmetabox/meta-box/js/image-advanced.js +++ b/vendor/wpmetabox/meta-box/js/image-advanced.js @@ -13,7 +13,33 @@ controller: this.controller, itemView: MediaItem.extend( { className: 'rwmb-image-item', - template: wp.template( 'rwmb-image-item' ) + template: rwmb.template( ` + +
+ <# if ( 'image' === data.type && data.sizes ) { #> + <# if ( data.sizes[data.controller.imageSize] ) { #> + + <# } else { #> + + <# } #> + <# } else { #> + <# if ( data.image && data.image.src && data.image.src !== data.icon ) { #> + + <# } else { #> + + <# } #> + <# } #> +
+
+ + ` ), } ) } ); } @@ -44,4 +70,8 @@ rwmb.$document .on( 'mb_ready', init ) .on( 'clone', '.rwmb-image_advanced', initImageField ); + + wp?.hooks?.addAction( 'mb_ready', 'meta-box/ready/image_advanced', ref => { + init( { target: ref } ); + } ); } )( jQuery, rwmb ); diff --git a/vendor/wpmetabox/meta-box/js/image-upload.js b/vendor/wpmetabox/meta-box/js/image-upload.js index e5f29a00c..9fa9051b2 100644 --- a/vendor/wpmetabox/meta-box/js/image-upload.js +++ b/vendor/wpmetabox/meta-box/js/image-upload.js @@ -38,4 +38,8 @@ rwmb.$document .on( 'mb_ready', init ) .on( 'clone', '.rwmb-image_upload, .rwmb-plupload_image', initImageUpload ) + + wp?.hooks?.addAction( 'mb_ready', 'meta-box/ready/image_upload', ref => { + init( { target: ref } ); + } ); } )( jQuery, rwmb ); diff --git a/vendor/wpmetabox/meta-box/js/map-frontend.js b/vendor/wpmetabox/meta-box/js/map-frontend.js index a300ded8f..f461eb149 100644 --- a/vendor/wpmetabox/meta-box/js/map-frontend.js +++ b/vendor/wpmetabox/meta-box/js/map-frontend.js @@ -32,7 +32,7 @@ } mapOptions.center = center; - // Typcast zoom to a number + // Typecast zoom to a number mapOptions.zoom *= 1; if ( typeof mapOptions.styles === 'string' ) { diff --git a/vendor/wpmetabox/meta-box/js/map.js b/vendor/wpmetabox/meta-box/js/map.js index f50e88b61..c364e11e2 100644 --- a/vendor/wpmetabox/meta-box/js/map.js +++ b/vendor/wpmetabox/meta-box/js/map.js @@ -43,7 +43,7 @@ this.marker = new google.maps.Marker( { position: location, map: this.map, - draggable: true, + draggable: this.$canvas.data( 'marker_draggable' ), } ); }, diff --git a/vendor/wpmetabox/meta-box/js/media.js b/vendor/wpmetabox/meta-box/js/media.js index 3d9c8686a..950240ee4 100644 --- a/vendor/wpmetabox/meta-box/js/media.js +++ b/vendor/wpmetabox/meta-box/js/media.js @@ -1,6 +1,28 @@ ( function ( $, wp, _, rwmb, i18n ) { 'use strict'; + /** + * Mimic the wp.template() to be able to use with raw template string intead of a DOM element. + * So it can be used in the iframed editor. + * + * @see https://codex.wordpress.org/Javascript_Reference/wp.template + * @see https://core.trac.wordpress.org/browser/trunk/src/js/_enqueues/wp/util.js#L0 + */ + rwmb.template = _.memoize( function ( template ) { + let compiled, + options = { + evaluate: /<#([\s\S]+?)#>/g, + interpolate: /\{\{\{([\s\S]+?)\}\}\}/g, + escape: /\{\{([^\}]+?)\}\}(?!\})/g, + variable: 'data' + }; + + return function ( data ) { + compiled = compiled || _.template( template, options ); + return compiled( data ); + }; + } ); + var views = rwmb.views = rwmb.views || {}, models = rwmb.models = rwmb.models || {}, media = wp.media, @@ -147,8 +169,8 @@ } let items = $( '
' ).html( this.$input.attr( 'data-attachments' ) ).text(), models = JSON.parse( items ).map( function( attachment ) { - return wp.media.model.Attachment.create( attachment ); - } ); + return wp.media.model.Attachment.create( attachment ); + } ); this.controller.get( 'items' ).add( models ); }, @@ -191,15 +213,15 @@ this.collection = this.controller.get( 'items' ); this.itemView = options.itemView || MediaItem; this.getItemView = _.memoize( function ( item ) { - var itemView = new this.itemView( { - model: item, - controller: this.controller - } ); + var itemView = new this.itemView( { + model: item, + controller: this.controller + } ); - this.listenToItemView( itemView ); + this.listenToItemView( itemView ); - return itemView; - }, + return itemView; + }, function ( item ) { return item.cid; } @@ -320,7 +342,12 @@ MediaStatus = views.MediaStatus = Backbone.View.extend( { tagName: 'div', className: 'rwmb-media-status', - template: wp.template( 'rwmb-media-status' ), + template: rwmb.template( ` + <# if ( data.maxFiles > 0 ) { #> + {{{ data.length }}}/{{{ data.maxFiles }}} + <# if ( 1 < data.maxFiles ) { #>{{{ i18nRwmbMedia.multiple }}}<# } else {#>{{{ i18nRwmbMedia.single }}}<# } #> + <# } #> + ` ), initialize: function ( options ) { this.controller = options.controller; @@ -351,7 +378,7 @@ MediaButton = views.MediaButton = Backbone.View.extend( { tagName: 'div', className: 'rwmb-media-add', - template: wp.template( 'rwmb-media-button' ), + template: rwmb.template( `{{{ data.text }}}` ), events: { 'click .button': function () { if ( this._frame ) { @@ -413,7 +440,48 @@ MediaItem = views.MediaItem = Backbone.View.extend( { tagName: 'li', className: 'rwmb-file', - template: wp.template( 'rwmb-media-item' ), + template: rwmb.template( ` + +
+ <# if ( data.sizes ) { #> + <# if ( data.sizes.thumbnail ) { #> + + <# } else { #> + + <# } #> + <# } else { #> + <# if ( data.image && data.image.src && data.image.src !== data.icon ) { #> + + <# } else { #> + + <# } #> + <# } #> +
+ + ` ), initialize: function ( options ) { this.controller = options.controller; this.collection = this.controller.get( 'items' ); @@ -587,4 +655,8 @@ rwmb.$document .on( 'mb_ready', init ) .on( 'clone', '.rwmb-file_advanced', initMediaField ); + + wp?.hooks?.addAction( 'mb_ready', 'meta-box/ready/media', ref => { + init( { target: ref } ); + } ); } )( jQuery, wp, _, rwmb, i18nRwmbMedia ); diff --git a/vendor/wpmetabox/meta-box/js/osm-frontend.js b/vendor/wpmetabox/meta-box/js/osm-frontend.js index c5b944aa8..97c78e28a 100644 --- a/vendor/wpmetabox/meta-box/js/osm-frontend.js +++ b/vendor/wpmetabox/meta-box/js/osm-frontend.js @@ -15,7 +15,7 @@ jQuery( function ( $ ) { mapOptions.center = center; - // Typcast zoom to a number + // Typecast zoom to a number mapOptions.zoom *= 1; mapOptions.gestureHandling = true; diff --git a/vendor/wpmetabox/meta-box/js/osm.js b/vendor/wpmetabox/meta-box/js/osm.js index 60a444ed3..19e45bf27 100644 --- a/vendor/wpmetabox/meta-box/js/osm.js +++ b/vendor/wpmetabox/meta-box/js/osm.js @@ -21,7 +21,7 @@ var map = this.map; setTimeout( function () { map.invalidateSize(); - }, 200 ); + }, 100 ); }, // Initialize DOM elements @@ -40,7 +40,7 @@ } this.marker = L.marker( location, { - draggable: true + draggable: this.$canvas.data( 'marker_draggable' ), } ).addTo( this.map ); }, diff --git a/vendor/wpmetabox/meta-box/js/select-advanced.js b/vendor/wpmetabox/meta-box/js/select-advanced.js index 2bb44fc96..3de87522a 100644 --- a/vendor/wpmetabox/meta-box/js/select-advanced.js +++ b/vendor/wpmetabox/meta-box/js/select-advanced.js @@ -60,7 +60,7 @@ delete params.data.page; } - // Create cache key from ajax params from only neccessary keys to make cache available for multiple fields. + // Create cache key from ajax params from only necessary keys to make cache available for multiple fields. var data = $.extend( true, {}, params.data ); delete data.field.id; delete data.action; diff --git a/vendor/wpmetabox/meta-box/js/video.js b/vendor/wpmetabox/meta-box/js/video.js index 998c4954d..0146e64d2 100644 --- a/vendor/wpmetabox/meta-box/js/video.js +++ b/vendor/wpmetabox/meta-box/js/video.js @@ -14,7 +14,41 @@ controller: this.controller, itemView: MediaItem.extend( { className: 'rwmb-video-item', - template : wp.template( 'rwmb-video-item' ), + template: rwmb.template( ` + + <# if( _.indexOf( i18nRwmbVideo.extensions, data.url.substr( data.url.lastIndexOf('.') + 1 ) ) > -1 ) { #> + + <# } else { #> + <# if ( data.image && data.image.src && data.image.src !== data.icon ) { #> + + <# } else { #> + + <# } #> + <# } #> + + ` ), render: function() { var settings = ! _.isUndefined( window._wpmejsSettings ) ? _.clone( _wpmejsSettings ) : {}; @@ -40,4 +74,8 @@ rwmb.$document .on( 'mb_ready', init ) .on( 'clone', '.rwmb-video', initVideoField ); + + wp?.hooks?.addAction( 'mb_ready', 'meta-box/ready/video', ref => { + init( { target: ref } ); + } ); } )( jQuery, rwmb ); diff --git a/vendor/wpmetabox/meta-box/meta-box.php b/vendor/wpmetabox/meta-box/meta-box.php index 2445b4f7b..a513cc268 100644 --- a/vendor/wpmetabox/meta-box/meta-box.php +++ b/vendor/wpmetabox/meta-box/meta-box.php @@ -3,7 +3,7 @@ * Plugin Name: Meta Box * Plugin URI: https://metabox.io * Description: Create custom meta boxes and custom fields in WordPress. - * Version: 5.10.11 + * Version: 5.10.15 * Author: MetaBox.io * Author URI: https://metabox.io * License: GPL2+ diff --git a/vendor/wpmetabox/meta-box/readme.txt b/vendor/wpmetabox/meta-box/readme.txt index 37ce7293b..ffbf20fda 100644 --- a/vendor/wpmetabox/meta-box/readme.txt +++ b/vendor/wpmetabox/meta-box/readme.txt @@ -2,10 +2,10 @@ Contributors: elightup, metabox, rilwis, f-j-kaiser, funkatronic, PerWiklander, ruanmer, tanng Donate link: https://metabox.io/pricing/ Tags: custom fields, custom post types, post type, custom taxonomies, meta box -Requires at least: 5.9 +Requires at least: 6.5 Requires PHP: 7.1 -Tested up to: 6.8.1 -Stable tag: 5.10.11 +Tested up to: 6.8.2 +Stable tag: 5.10.15 License: GPLv2 or later Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for your custom post types in WordPress. @@ -147,6 +147,23 @@ If you want to use Meta Box, please follow these steps: == Changelog == += 5.10.15 - 2025-10-06 = + +Add `marker_draggable` option for `map`/`osm` fields to disable changing the pin on the map. + += 5.10.14 - 2025-09-15 = + +Update dependencies + += 5.10.13 - 2025-08-14 = + +Fix `get_current_screen()` error for term meta + += 5.10.12 - 2025-08-13 = + +- Fix Open Street Maps field not showing (sometimes) with conditional logic +- Enqueue assets for the iframed editor, to make all fields are rendered properly in the iframed editor + = 5.10.11 - 2025-07-15 = Fix validation for blocks diff --git a/vendor/wpmetabox/meta-box/src/Dashboard/content.php b/vendor/wpmetabox/meta-box/src/Dashboard/content.php index 5ea39403d..c26d96c93 100644 --- a/vendor/wpmetabox/meta-box/src/Dashboard/content.php +++ b/vendor/wpmetabox/meta-box/src/Dashboard/content.php @@ -416,7 +416,7 @@ class="mb-dashboard__tutorial__image lightbox mb-dashboard__tooltip" - + @@ -486,7 +486,7 @@ class="mb-dashboard__tutorial__image lightbox mb-dashboard__tooltip" - + @@ -663,7 +663,7 @@ class="mb-dashboard__tutorial__image lightbox mb-dashboard__tooltip"
diff --git a/vendor/wpmetabox/meta-box/vendor/composer/installed.json b/vendor/wpmetabox/meta-box/vendor/composer/installed.json index 23ee2ce0c..57cca65dd 100644 --- a/vendor/wpmetabox/meta-box/vendor/composer/installed.json +++ b/vendor/wpmetabox/meta-box/vendor/composer/installed.json @@ -7,15 +7,15 @@ "source": { "type": "git", "url": "https://github.com/wpmetabox/support.git", - "reference": "f03f775f4ac3eb99d954e8f06caff97706a78b51" + "reference": "6c392347cdb77ed133b8a4227b5ee20db89a5717" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wpmetabox/support/zipball/f03f775f4ac3eb99d954e8f06caff97706a78b51", - "reference": "f03f775f4ac3eb99d954e8f06caff97706a78b51", + "url": "https://api.github.com/repos/wpmetabox/support/zipball/6c392347cdb77ed133b8a4227b5ee20db89a5717", + "reference": "6c392347cdb77ed133b8a4227b5ee20db89a5717", "shasum": "" }, - "time": "2025-07-12T09:16:27+00:00", + "time": "2025-09-12T23:29:48+00:00", "default-branch": true, "type": "library", "installation-source": "dist", diff --git a/vendor/wpmetabox/meta-box/vendor/composer/installed.php b/vendor/wpmetabox/meta-box/vendor/composer/installed.php index e9f45bfec..f4717626d 100644 --- a/vendor/wpmetabox/meta-box/vendor/composer/installed.php +++ b/vendor/wpmetabox/meta-box/vendor/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => 'wpmetabox/meta-box', - 'pretty_version' => '5.10.11', - 'version' => '5.10.11.0', - 'reference' => '856eb0901e5f71d6d70d0f6bae001b2a904d63d0', + 'pretty_version' => '5.10.15', + 'version' => '5.10.15.0', + 'reference' => 'bd60262221a018e56016bc06cb525685644ec1d1', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -11,9 +11,9 @@ ), 'versions' => array( 'wpmetabox/meta-box' => array( - 'pretty_version' => '5.10.11', - 'version' => '5.10.11.0', - 'reference' => '856eb0901e5f71d6d70d0f6bae001b2a904d63d0', + 'pretty_version' => '5.10.15', + 'version' => '5.10.15.0', + 'reference' => 'bd60262221a018e56016bc06cb525685644ec1d1', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -22,7 +22,7 @@ 'wpmetabox/support' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'f03f775f4ac3eb99d954e8f06caff97706a78b51', + 'reference' => '6c392347cdb77ed133b8a4227b5ee20db89a5717', 'type' => 'library', 'install_path' => __DIR__ . '/../wpmetabox/support', 'aliases' => array( diff --git a/vendor/wpmetabox/meta-box/vendor/wpmetabox/support/Data.php b/vendor/wpmetabox/meta-box/vendor/wpmetabox/support/Data.php index 813be9a70..0cab42e94 100644 --- a/vendor/wpmetabox/meta-box/vendor/wpmetabox/support/Data.php +++ b/vendor/wpmetabox/meta-box/vendor/wpmetabox/support/Data.php @@ -3,7 +3,15 @@ class Data { public static function get_post_types(): array { - $unsupported = [ + $unsupported = self::unsupported_post_types(); + $post_types = get_post_types( [], 'objects' ); + $post_types = array_diff_key( $post_types, array_flip( $unsupported ) ); + + return $post_types; + } + + public static function unsupported_post_types(): array { + return [ // WordPress built-in post types. 'customize_changeset', 'custom_css', @@ -16,10 +24,7 @@ public static function get_post_types(): array { 'wp_template_part', 'wp_global_styles', 'wp_navigation', - 'wp_template', - 'wp_template_part', - 'wp_global_styles', - 'wp_font_famlity', + 'wp_font_family', 'wp_font_face', // Meta Box post types. @@ -36,10 +41,6 @@ public static function get_post_types(): array { 'elementor_icons', 'elementor_snippet', ]; - $post_types = get_post_types( [], 'objects' ); - $post_types = array_diff_key( $post_types, array_flip( $unsupported ) ); - - return $post_types; } public static function get_taxonomies(): array { diff --git a/wp-stateless-media.php b/wp-stateless-media.php index 7a39b0843..e13abb05b 100644 --- a/wp-stateless-media.php +++ b/wp-stateless-media.php @@ -4,7 +4,7 @@ * Plugin URI: https://stateless.udx.io/ * Description: Upload and serve your WordPress media files from Google Cloud Storage. * Author: UDX - * Version: 4.2.0 + * Version: 4.2.1 * Text Domain: stateless-media * Author URI: https://udx.io * License: GPLv2 or later From 105dcddb089092ef1c34dc16df1a3b39db6d639c Mon Sep 17 00:00:00 2001 From: balexey88 Date: Wed, 15 Oct 2025 18:10:33 +0300 Subject: [PATCH 2/2] Release 4.2.1 --- changelog.txt | 2 - changes.md | 2 - composer.json | 2 +- composer.lock | 75 +- lib/Google/CHANGELOG.md | 14 - lib/Google/CODE_OF_CONDUCT.md | 43 + lib/Google/UPGRADING.md | 377 ++++++ lib/Google/composer.json | 5 +- lib/Google/composer.lock | 1099 ++++++----------- .../src/AuthHandler/Guzzle6AuthHandler.php | 18 +- lib/Google/src/Client.php | 12 +- lib/Google/src/Task/Composer.php | 54 +- lib/Google/vendor/autoload.php | 2 +- lib/Google/vendor/brick/math/CHANGELOG.md | 68 - lib/Google/vendor/brick/math/composer.json | 13 +- lib/Google/vendor/brick/math/phpstan.neon | 14 - .../vendor/brick/math/src/BigDecimal.php | 240 ++-- .../vendor/brick/math/src/BigInteger.php | 256 ++-- .../vendor/brick/math/src/BigNumber.php | 350 +++--- .../vendor/brick/math/src/BigRational.php | 120 +- .../src/Exception/DivisionByZeroException.php | 8 +- .../Exception/IntegerOverflowException.php | 4 +- .../math/src/Exception/MathException.php | 2 +- .../src/Exception/NegativeNumberException.php | 2 +- .../src/Exception/NumberFormatException.php | 17 +- .../Exception/RoundingNecessaryException.php | 4 +- .../brick/math/src/Internal/Calculator.php | 163 +-- .../Internal/Calculator/BcMathCalculator.php | 24 +- .../src/Internal/Calculator/GmpCalculator.php | 26 +- .../Internal/Calculator/NativeCalculator.php | 92 +- .../math/src/Internal/CalculatorRegistry.php | 73 -- .../vendor/brick/math/src/RoundingMode.php | 31 +- .../vendor/composer/autoload_classmap.php | 2 + lib/Google/vendor/composer/autoload_files.php | 1 + lib/Google/vendor/composer/autoload_psr4.php | 1 + lib/Google/vendor/composer/autoload_real.php | 10 +- .../vendor/composer/autoload_static.php | 19 +- lib/Google/vendor/composer/installed.json | 428 ++++--- lib/Google/vendor/composer/installed.php | 123 +- lib/Google/vendor/composer/platform_check.php | 4 +- .../google/apiclient-services/composer.json | 2 +- .../google/apiclient-services/src/Storage.php | 12 - .../src/Storage/BucketEncryption.php | 48 - ...omerManagedEncryptionEnforcementConfig.php | 62 - ...merSuppliedEncryptionEnforcementConfig.php | 62 - ...ogleManagedEncryptionEnforcementConfig.php | 62 - .../src/Storage/BucketIpFilter.php | 36 - .../src/Storage/Buckets.php | 20 +- .../src/Storage/BulkRestoreObjectsRequest.php | 36 - .../Storage/ObjectCustomContextPayload.php | 80 -- .../src/Storage/Resource/Buckets.php | 2 - .../src/Storage/Resource/Folders.php | 2 +- .../src/Storage/Resource/Objects.php | 4 - .../src/Storage/StorageObject.php | 16 - .../src/Storage/StorageObjectContexts.php | 42 - lib/Google/vendor/google/auth/VERSION | 2 +- lib/Google/vendor/google/auth/composer.json | 2 +- .../vendor/google/auth/src/AccessToken.php | 8 +- .../src/ApplicationDefaultCredentials.php | 107 +- .../src/CredentialSource/AwsNativeSource.php | 10 +- .../src/CredentialSource/ExecutableSource.php | 8 +- .../auth/src/CredentialSource/FileSource.php | 14 +- .../auth/src/CredentialSource/UrlSource.php | 16 +- .../Credentials/AppIdentityCredentials.php | 12 +- .../ExternalAccountCredentials.php | 18 +- .../auth/src/Credentials/GCECredentials.php | 38 +- .../auth/src/Credentials/IAMCredentials.php | 4 +- .../ImpersonatedServiceAccountCredentials.php | 111 +- .../src/Credentials/InsecureCredentials.php | 4 +- .../Credentials/ServiceAccountCredentials.php | 64 +- .../ServiceAccountJwtAccessCredentials.php | 16 +- .../Credentials/UserRefreshCredentials.php | 44 +- .../google/auth/src/CredentialsLoader.php | 9 +- ...ternalAccountCredentialSourceInterface.php | 4 +- .../google/auth/src/FetchAuthTokenCache.php | 24 +- .../auth/src/FetchAuthTokenInterface.php | 4 +- .../vendor/google/auth/src/GCECache.php | 8 +- .../auth/src/HttpHandler/HttpClientCache.php | 2 +- .../src/HttpHandler/HttpHandlerFactory.php | 4 +- lib/Google/vendor/google/auth/src/Iam.php | 53 +- .../src/Middleware/AuthTokenMiddleware.php | 11 +- .../Middleware/ProxyAuthTokenMiddleware.php | 8 +- .../ScopedAccessTokenMiddleware.php | 8 +- lib/Google/vendor/google/auth/src/OAuth2.php | 28 +- .../auth/src/ProjectIdProviderInterface.php | 4 +- .../google/auth/src/SignBlobInterface.php | 4 +- .../auth/src/UpdateMetadataInterface.php | 4 +- .../google/auth/src/UpdateMetadataTrait.php | 4 +- .../vendor/google/cloud-core/.gitattributes | 3 - .../google/cloud-storage/.gitattributes | 3 - .../vendor/google/cloud-storage/VERSION | 2 +- .../vendor/google/cloud-storage/composer.json | 2 +- .../google/cloud-storage/src/Bucket.php | 102 +- .../cloud-storage/src/Connection/Rest.php | 57 +- .../src/Connection/RetryTrait.php | 4 +- .../cloud-storage/src/SigningHelper.php | 4 - .../cloud-storage/src/StorageClient.php | 69 +- .../cloud-storage/src/StorageObject.php | 148 +-- .../vendor/google/common-protos/VERSION | 2 +- .../vendor/google/common-protos/composer.json | 6 +- .../vendor/google/gax/.repo-metadata.json | 7 - .../grpc-gcp/.github/release-please.yml | 3 - .../grpc-gcp/.github/workflows/tests.yml | 30 - lib/Google/vendor/google/grpc-gcp/.gitmodules | 3 - .../vendor/google/longrunning/.gitattributes | 6 - lib/Google/vendor/google/longrunning/VERSION | 2 +- .../vendor/google/longrunning/composer.json | 4 +- .../LongRunning/Client/OperationsClient.php | 36 +- .../vendor/google/protobuf/composer.json | 5 +- .../src/GPBMetadata/Google/Protobuf/Api.php | 2 +- .../protobuf/src/Google/Protobuf/Api.php | 38 - .../protobuf/src/Google/Protobuf/Enum.php | 4 - .../src/Google/Protobuf/EnumValue.php | 4 - .../protobuf/src/Google/Protobuf/Field.php | 4 - .../Google/Protobuf/Internal/FieldOptions.php | 21 +- .../Protobuf/Internal/GPBDecodeException.php | 2 +- .../protobuf/src/Google/Protobuf/Method.php | 74 +- .../protobuf/src/Google/Protobuf/Option.php | 3 - .../protobuf/src/Google/Protobuf/Type.php | 4 - lib/Google/vendor/grpc/grpc/composer.json | 2 +- .../vendor/grpc/grpc/src/lib/BaseStub.php | 2 +- .../grpc/grpc/src/lib/ServerCallWriter.php | 2 +- .../vendor/grpc/grpc/src/lib/Status.php | 4 +- .../vendor/grpc/grpc/src/lib/UnaryCall.php | 4 +- .../vendor/guzzlehttp/guzzle/CHANGELOG.md | 11 - .../vendor/guzzlehttp/guzzle/composer.json | 4 +- .../guzzle/src/Handler/CurlFactory.php | 9 +- .../guzzle/src/Handler/CurlMultiHandler.php | 5 +- .../guzzle/src/Handler/StreamHandler.php | 9 +- .../guzzlehttp/guzzle/src/Middleware.php | 4 +- .../vendor/guzzlehttp/promises/CHANGELOG.md | 7 - .../vendor/guzzlehttp/promises/README.md | 2 +- .../vendor/guzzlehttp/promises/composer.json | 2 +- .../vendor/guzzlehttp/psr7/CHANGELOG.md | 10 - lib/Google/vendor/guzzlehttp/psr7/README.md | 2 +- .../vendor/guzzlehttp/psr7/composer.json | 2 +- .../guzzlehttp/psr7/src/MessageTrait.php | 4 + .../vendor/guzzlehttp/psr7/src/Utils.php | 4 +- .../constant_time_encoding/composer.json | 15 +- .../constant_time_encoding/src/Base32.php | 75 +- .../constant_time_encoding/src/Base32Hex.php | 11 +- .../constant_time_encoding/src/Base64.php | 98 +- .../src/Base64DotSlash.php | 4 - .../src/Base64DotSlashOrdered.php | 4 - .../src/Base64UrlSafe.php | 4 - .../constant_time_encoding/src/Binary.php | 22 +- .../src/EncoderInterface.php | 13 +- .../constant_time_encoding/src/Encoding.php | 45 +- .../constant_time_encoding/src/Hex.php | 51 +- .../constant_time_encoding/src/RFC4648.php | 22 +- .../paragonie/random_compat/build-phar.sh | 5 - .../vendor/phpseclib/phpseclib/README.md | 12 +- .../phpseclib/Common/Functions/Strings.php | 4 +- .../phpseclib/phpseclib/Crypt/Blowfish.php | 14 +- .../Crypt/Common/Formats/Keys/JWK.php | 8 - .../Crypt/Common/Formats/Keys/PKCS8.php | 22 +- .../Crypt/Common/Formats/Keys/PuTTY.php | 12 +- .../phpseclib/Crypt/Common/StreamCipher.php | 2 +- .../phpseclib/phpseclib/Crypt/DES.php | 26 +- .../Crypt/DSA/Formats/Keys/PuTTY.php | 5 +- .../phpseclib/Crypt/DSA/PrivateKey.php | 4 +- .../phpseclib/Crypt/DSA/PublicKey.php | 3 +- .../Crypt/EC/BaseCurves/Montgomery.php | 4 +- .../phpseclib/Crypt/EC/BaseCurves/Prime.php | 4 +- .../Crypt/EC/BaseCurves/TwistedEdwards.php | 2 +- .../phpseclib/Crypt/EC/Formats/Keys/XML.php | 7 +- .../phpseclib/Crypt/EC/PrivateKey.php | 5 +- .../phpseclib/Crypt/EC/PublicKey.php | 3 +- .../phpseclib/phpseclib/Crypt/Hash.php | 91 -- .../phpseclib/Crypt/PublicKeyLoader.php | 1 - .../phpseclib/phpseclib/Crypt/RC2.php | 26 +- .../phpseclib/phpseclib/Crypt/RC4.php | 10 +- .../phpseclib/phpseclib/Crypt/RSA.php | 7 +- .../Crypt/RSA/Formats/Keys/MSBLOB.php | 22 +- .../Crypt/RSA/Formats/Keys/PKCS1.php | 27 - .../Crypt/RSA/Formats/Keys/PuTTY.php | 5 +- .../phpseclib/phpseclib/Crypt/Rijndael.php | 4 +- .../phpseclib/phpseclib/Crypt/TripleDES.php | 38 +- .../phpseclib/phpseclib/Crypt/Twofish.php | 8 +- .../phpseclib/phpseclib/File/ASN1.php | 25 +- .../phpseclib/phpseclib/File/X509.php | 6 +- .../phpseclib/phpseclib/Math/BigInteger.php | 56 +- .../Math/BigInteger/Engines/BCMath.php | 29 +- .../Math/BigInteger/Engines/BCMath/Base.php | 4 +- .../BigInteger/Engines/BCMath/BuiltIn.php | 2 +- .../Engines/BCMath/Reductions/Barrett.php | 38 +- .../Engines/BCMath/Reductions/EvalBarrett.php | 18 +- .../Math/BigInteger/Engines/Engine.php | 64 +- .../phpseclib/Math/BigInteger/Engines/GMP.php | 5 +- .../phpseclib/Math/BigInteger/Engines/PHP.php | 3 - .../Engines/PHP/Reductions/Barrett.php | 4 +- .../phpseclib/Math/PrimeField/Integer.php | 60 +- .../phpseclib/phpseclib/Net/SFTP.php | 103 +- .../phpseclib/phpseclib/Net/SFTP/Stream.php | 10 +- .../phpseclib/phpseclib/Net/SSH2.php | 122 +- .../psr/cache/src/CacheItemInterface.php | 12 +- .../psr/cache/src/CacheItemPoolInterface.php | 22 +- lib/Google/vendor/ramsey/collection/README.md | 11 + .../vendor/ramsey/collection/composer.json | 52 +- .../collection/conventional-commits.json | 22 + .../ramsey/collection/src/AbstractArray.php | 57 +- .../collection/src/AbstractCollection.php | 242 ++-- .../ramsey/collection/src/AbstractSet.php | 19 +- .../ramsey/collection/src/ArrayInterface.php | 4 +- .../ramsey/collection/src/Collection.php | 21 +- .../collection/src/CollectionInterface.php | 111 +- .../collection/src/DoubleEndedQueue.php | 127 +- .../src/DoubleEndedQueueInterface.php | 36 +- .../Exception/CollectionMismatchException.php | 2 +- .../Exception/InvalidArgumentException.php | 4 +- ...tion.php => InvalidSortOrderException.php} | 7 +- .../src/Exception/NoSuchElementException.php | 2 +- .../src/Exception/OutOfBoundsException.php | 4 +- .../UnsupportedOperationException.php | 2 +- ...ethod.php => ValueExtractionException.php} | 6 +- .../ramsey/collection/src/Map/AbstractMap.php | 108 +- .../collection/src/Map/AbstractTypedMap.php | 17 +- .../src/Map/AssociativeArrayMap.php | 3 +- .../collection/src/Map/MapInterface.php | 57 +- .../collection/src/Map/NamedParameterMap.php | 21 +- .../ramsey/collection/src/Map/TypedMap.php | 36 +- .../collection/src/Map/TypedMapInterface.php | 3 +- .../vendor/ramsey/collection/src/Queue.php | 97 +- .../ramsey/collection/src/QueueInterface.php | 18 +- .../vendor/ramsey/collection/src/Set.php | 16 +- .../vendor/ramsey/collection/src/Sort.php | 31 - .../ramsey/collection/src/Tool/TypeTrait.php | 49 +- .../src/Tool/ValueExtractorTrait.php | 77 +- .../src/Tool/ValueToStringTrait.php | 18 +- lib/Google/vendor/ramsey/uuid/composer.json | 2 +- .../uuid/src/Generator/UnixTimeGenerator.php | 8 +- .../uuid/src/Math/BrickMathCalculator.php | 19 +- .../rize/uri-template/.php-cs-fixer.dist.php | 19 - lib/Google/vendor/rize/uri-template/README.md | 10 +- .../vendor/rize/uri-template/composer.json | 11 +- .../vendor/rize/uri-template/phpstan.neon | 5 - .../vendor/rize/uri-template/phpunit.xml | 22 - .../uri-template/src/Rize/UriTemplate.php | 69 +- .../src/Rize/UriTemplate/Node/Abstraction.php | 44 +- .../src/Rize/UriTemplate/Node/Expression.php | 97 +- .../src/Rize/UriTemplate/Node/Literal.php | 10 +- .../src/Rize/UriTemplate/Node/Variable.php | 26 +- .../Rize/UriTemplate/Operator/Abstraction.php | 345 +++--- .../src/Rize/UriTemplate/Operator/Named.php | 109 +- .../src/Rize/UriTemplate/Operator/UnNamed.php | 24 +- .../src/Rize/UriTemplate/Parser.php | 73 +- .../src/Rize/UriTemplate/UriTemplate.php | 6 +- .../tests/Rize/Uri/Node/ParserTest.php | 93 -- .../tests/Rize/UriTemplateTest.php | 253 ---- .../uri-template/tests/fixtures/README.md | 90 -- .../tests/fixtures/extended-tests.json | 118 -- .../uri-template/tests/fixtures/json2xml.xslt | 201 --- .../tests/fixtures/negative-tests.json | 57 - .../fixtures/spec-examples-by-section.json | 439 ------- .../tests/fixtures/spec-examples.json | 218 ---- .../tests/fixtures/transform-json-tests.xslt | 51 - .../symfony/deprecation-contracts/LICENSE | 2 +- .../symfony/deprecation-contracts/README.md | 2 +- .../deprecation-contracts/composer.json | 4 +- .../vendor/symfony/polyfill-php81/LICENSE | 19 + .../vendor/symfony/polyfill-php81/Php81.php | 37 + .../vendor/symfony/polyfill-php81/README.md | 18 + .../Resources/stubs/CURLStringFile.php | 51 + .../Resources/stubs/ReturnTypeWillChange.php | 20 + .../symfony/polyfill-php81/bootstrap.php | 28 + .../symfony/polyfill-php81/composer.json | 33 + lib/classes/class-bootstrap.php | 12 +- lib/classes/class-errors.php | 9 +- readme.md | 2 +- readme.txt | 6 +- static/data/addons.php | 2 +- vendor/composer/installed.php | 4 +- vendor/composer/platform_check.php | 4 +- 273 files changed, 3865 insertions(+), 7101 deletions(-) create mode 100644 lib/Google/CODE_OF_CONDUCT.md create mode 100644 lib/Google/UPGRADING.md delete mode 100644 lib/Google/vendor/brick/math/phpstan.neon delete mode 100644 lib/Google/vendor/brick/math/src/Internal/CalculatorRegistry.php delete mode 100644 lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerManagedEncryptionEnforcementConfig.php delete mode 100644 lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig.php delete mode 100644 lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionGoogleManagedEncryptionEnforcementConfig.php delete mode 100644 lib/Google/vendor/google/apiclient-services/src/Storage/ObjectCustomContextPayload.php delete mode 100644 lib/Google/vendor/google/apiclient-services/src/Storage/StorageObjectContexts.php delete mode 100644 lib/Google/vendor/google/cloud-core/.gitattributes delete mode 100644 lib/Google/vendor/google/cloud-storage/.gitattributes delete mode 100644 lib/Google/vendor/google/gax/.repo-metadata.json delete mode 100644 lib/Google/vendor/google/grpc-gcp/.github/release-please.yml delete mode 100644 lib/Google/vendor/google/grpc-gcp/.github/workflows/tests.yml delete mode 100644 lib/Google/vendor/google/grpc-gcp/.gitmodules delete mode 100644 lib/Google/vendor/google/longrunning/.gitattributes delete mode 100755 lib/Google/vendor/paragonie/random_compat/build-phar.sh create mode 100644 lib/Google/vendor/ramsey/collection/conventional-commits.json rename lib/Google/vendor/ramsey/collection/src/Exception/{CollectionException.php => InvalidSortOrderException.php} (70%) rename lib/Google/vendor/ramsey/collection/src/Exception/{InvalidPropertyOrMethod.php => ValueExtractionException.php} (62%) delete mode 100644 lib/Google/vendor/ramsey/collection/src/Sort.php delete mode 100644 lib/Google/vendor/rize/uri-template/.php-cs-fixer.dist.php delete mode 100644 lib/Google/vendor/rize/uri-template/phpstan.neon delete mode 100644 lib/Google/vendor/rize/uri-template/phpunit.xml delete mode 100644 lib/Google/vendor/rize/uri-template/tests/Rize/Uri/Node/ParserTest.php delete mode 100644 lib/Google/vendor/rize/uri-template/tests/Rize/UriTemplateTest.php delete mode 100644 lib/Google/vendor/rize/uri-template/tests/fixtures/README.md delete mode 100644 lib/Google/vendor/rize/uri-template/tests/fixtures/extended-tests.json delete mode 100644 lib/Google/vendor/rize/uri-template/tests/fixtures/json2xml.xslt delete mode 100644 lib/Google/vendor/rize/uri-template/tests/fixtures/negative-tests.json delete mode 100644 lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples-by-section.json delete mode 100644 lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples.json delete mode 100644 lib/Google/vendor/rize/uri-template/tests/fixtures/transform-json-tests.xslt create mode 100644 lib/Google/vendor/symfony/polyfill-php81/LICENSE create mode 100644 lib/Google/vendor/symfony/polyfill-php81/Php81.php create mode 100644 lib/Google/vendor/symfony/polyfill-php81/README.md create mode 100644 lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php create mode 100644 lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php create mode 100644 lib/Google/vendor/symfony/polyfill-php81/bootstrap.php create mode 100644 lib/Google/vendor/symfony/polyfill-php81/composer.json diff --git a/changelog.txt b/changelog.txt index 0594344ae..b2dfc1eab 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,5 @@ == Changelog == = 4.2.1 = -* **WP-Stateless 4.2.1 requires PHP 8.1 or higher, in accordance with the requirements of the official Google API PHP Client Library.** -* ENHANCEMENT - Updated Client library for Google APIs from 2.18.3 to 2.18.4. * ENHANCEMENT - updated `wpmetabox/meta-box` library from 5.10.11 to 5.10.15. * FIX - correctly loads text domain to prevent PHP notices. * FIX - `udx/lib-ud-api-client` package correctly loads text domain to prevent PHP notices. diff --git a/changes.md b/changes.md index c4a47c6ae..18eff97d6 100644 --- a/changes.md +++ b/changes.md @@ -1,6 +1,4 @@ #### 4.2.1 -* **WP-Stateless 4.2.1 requires PHP 8.1 or higher, in accordance with the requirements of the official Google API PHP Client Library.** -* ENHANCEMENT - Updated Client library for Google APIs from 2.18.3 to 2.18.4. * ENHANCEMENT - updated `wpmetabox/meta-box` library from 5.10.11 to 5.10.15. * FIX - correctly loads text domain to prevent PHP notices. * FIX - `udx/lib-ud-api-client` package correctly loads text domain to prevent PHP notices. diff --git a/composer.json b/composer.json index 2550671cc..490494d87 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ } ], "require": { - "php": "^8.1", + "php": ">=7.4", "composer/installers": "~2.3", "ccampbell/chromephp": "^4.1", "firebase/php-jwt": "^6.1.2", diff --git a/composer.lock b/composer.lock index db02424b2..8d1b09bc0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "55c60770c8e78c149499c574151711ae", + "content-hash": "efe78ab64a63ac2a59fdd7be8e49f336", "packages": [ { "name": "ccampbell/chromephp", @@ -770,20 +770,20 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.6.0", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.0.2" }, "type": "library", "extra": { @@ -792,7 +792,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.6-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -817,7 +817,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" }, "funding": [ { @@ -833,7 +833,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:21:43+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/finder", @@ -1399,26 +1399,28 @@ }, { "name": "symfony/service-contracts", - "version": "v3.6.0", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4" + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f021b05a130d35510bd6b25fe9053c2a8a15d5d4", - "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d78d39c1599bd1188b8e26bb341da52c3c6d8a66", + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66", "shasum": "" }, "require": { - "php": ">=8.1", - "psr/container": "^1.1|^2.0", - "symfony/deprecation-contracts": "^2.5|^3" + "php": ">=8.0.2", + "psr/container": "^2.0" }, "conflict": { "ext-psr": "<1.1|>=2" }, + "suggest": { + "symfony/service-implementation": "" + }, "type": "library", "extra": { "thanks": { @@ -1426,16 +1428,13 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.6-dev" + "dev-main": "3.0-dev" } }, "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - }, - "exclude-from-classmap": [ - "/Test/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1462,7 +1461,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.6.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.0.2" }, "funding": [ { @@ -1478,37 +1477,37 @@ "type": "tidelift" } ], - "time": "2025-04-25T09:37:31+00:00" + "time": "2022-05-30T19:17:58+00:00" }, { "name": "symfony/string", - "version": "v6.4.26", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "5621f039a71a11c87c106c1c598bdcd04a19aeea" + "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/5621f039a71a11c87c106c1c598bdcd04a19aeea", - "reference": "5621f039a71a11c87c106c1c598bdcd04a19aeea", + "url": "https://api.github.com/repos/symfony/string/zipball/d9e72497367c23e08bf94176d2be45b00a9d232a", + "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.5" + "symfony/translation-contracts": "<2.0" }, "require-dev": { - "symfony/http-client": "^5.4|^6.0|^7.0", - "symfony/intl": "^6.2|^7.0", - "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^5.4|^6.0|^7.0" + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -1547,7 +1546,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.26" + "source": "https://github.com/symfony/string/tree/v6.0.19" }, "funding": [ { @@ -1558,16 +1557,12 @@ "url": "https://github.com/fabpot", "type": "github" }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2025-09-11T14:32:46+00:00" + "time": "2023-01-01T08:36:10+00:00" } ], "aliases": [], @@ -1576,7 +1571,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^8.1" + "php": ">=7.4" }, "platform-dev": [], "plugin-api-version": "2.6.0" diff --git a/lib/Google/CHANGELOG.md b/lib/Google/CHANGELOG.md index a0418c111..00f046fb5 100644 --- a/lib/Google/CHANGELOG.md +++ b/lib/Google/CHANGELOG.md @@ -1,19 +1,5 @@ # Changelog -## [2.18.4](https://github.com/googleapis/google-api-php-client/compare/v2.18.3...v2.18.4) (2025-09-29) - - -### Bug Fixes - -* Ensure credentials can be of type FetchAuthTokenInterface ([#2684](https://github.com/googleapis/google-api-php-client/issues/2684)) ([ed70802](https://github.com/googleapis/google-api-php-client/commit/ed70802cc4886ef1f513a2c0b56a8a972db5e7ab)) - -## [2.18.3](https://github.com/googleapis/google-api-php-client/compare/v2.18.2...v2.18.3) (2025-04-08) - - -### Bug Fixes - -* Convert Finder lazy iterator to array before deletion ([#2663](https://github.com/googleapis/google-api-php-client/issues/2663)) ([c699405](https://github.com/googleapis/google-api-php-client/commit/c6994051af1568359c97d267d9ef34ccbda31387)) - ## [2.18.2](https://github.com/googleapis/google-api-php-client/compare/v2.18.1...v2.18.2) (2024-12-16) diff --git a/lib/Google/CODE_OF_CONDUCT.md b/lib/Google/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..46b2a08ea --- /dev/null +++ b/lib/Google/CODE_OF_CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) diff --git a/lib/Google/UPGRADING.md b/lib/Google/UPGRADING.md new file mode 100644 index 000000000..ef939e943 --- /dev/null +++ b/lib/Google/UPGRADING.md @@ -0,0 +1,377 @@ +Google API Client Upgrade Guide +=============================== + +2.x to 2.10.0 +------------- + +### Namespaces + +The Google API Client for PHP now uses namespaces for all classes. Code using +the legacy classnames will continue to work, but it is advised to upgrade to the +underspaced names, as the legacy classnames will be deprecated some time in the +future. + +**Before** + +```php +$client = new Google_Client(); +$service = new Google_Service_Books($client); +``` + +**After** +```php +$client = new Google\Client(); +$service = new Google\Service\Books($client); +``` + +### Service class constructors + +Service class constructors now accept an optional `Google\Client|array` parameter +as their first argument, rather than requiring an instance of `Google\Client`. + +**Before** + +```php +$client = new Google_Client(); +$client->setApplicationName("Client_Library_Examples"); +$client->setDeveloperKey("YOUR_APP_KEY"); + +$service = new Google_Service_Books($client); +``` + +**After** + +```php +$service = new Google\Service\Books([ + 'application_name' => "Client_Library_Examples", + 'developer_key' => "YOUR_APP_KEY", +]); +``` + +1.0 to 2.0 +---------- + +The Google API Client for PHP has undergone major internal changes in `2.0`. Please read through +the list below in order to upgrade to the latest version: + +## Installation now uses `Composer` + +**Before** + +The project was cloned in your project and you would run the autoloader from wherever: + +```php +// the autoload file was included +require_once 'google-api-php-client/src/Google/autoload.php'; // or wherever autoload.php is located +// OR classes were added one-by-one +require_once 'Google/Client.php'; +require_once 'Google/Service/YouTube.php'; +``` + +**After** + +This library now uses [composer](https://getcomposer.org) (We suggest installing +composer [globally](http://symfony.com/doc/current/cookbook/composer.html)). Add this library by +running the following in the root of your project: + +``` +$ composer require google/apiclient:~2.0 +``` + +This will install this library and generate an autoload file in `vendor/autoload.php` in the root +of your project. You can now include this library with the following code: + +```php +require_once 'vendor/autoload.php'; +``` + +## Access Tokens are passed around as arrays instead of JSON strings + +**Before** + +```php +$accessToken = $client->getAccessToken(); +print_r($accessToken); +// would output: +// string(153) "{"access_token":"ya29.FAKsaByOPoddfzvKRo_LBpWWCpVTiAm4BjsvBwxtN7IgSNoUfcErBk_VPl4iAiE1ntb_","token_type":"Bearer","expires_in":3593,"created":1445548590}" +file_put_contents($credentialsPath, $accessToken); +``` + +**After** + +```php +$accessToken = $client->getAccessToken(); +print_r($accessToken); +// will output: +// array(4) { +// ["access_token"]=> +// string(73) "ya29.FAKsaByOPoddfzvKRo_LBpWWCpVTiAm4BjsvBwxtN7IgSNoUfcErBk_VPl4iAiE1ntb_" +// ["token_type"]=> +// string(6) "Bearer" +// ["expires_in"]=> +// int(3593) +// ["created"]=> +// int(1445548590) +// } +file_put_contents($credentialsPath, json_encode($accessToken)); +``` + +## ID Token data is returned as an array + +**Before** + +```php +$ticket = $client->verifyIdToken($idToken); +$data = $ticket->getAttributes(); +$userId = $data['payload']['sub']; +``` + +**After** + +```php +$userData = $client->verifyIdToken($idToken); +$userId = $userData['sub']; +``` + +## `Google_Auth_AssertionCredentials` has been removed + +For service accounts, we now use `setAuthConfig` or `useApplicationDefaultCredentials` + +**Before** + +```php +$client_email = '1234567890-a1b2c3d4e5f6g7h8i@developer.gserviceaccount.com'; +$private_key = file_get_contents('MyProject.p12'); +$scopes = array('https://www.googleapis.com/auth/sqlservice.admin'); +$credentials = new Google_Auth_AssertionCredentials( + $client_email, + $scopes, + $private_key +); +``` + +**After** + +```php +$client->setAuthConfig('/path/to/service-account.json'); + +// OR use environment variables (recommended) + +putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json'); +$client->useApplicationDefaultCredentials(); +``` + +> Note: P12s are deprecated in favor of service account JSON, which can be generated in the +> Credentials section of Google Developer Console. + +In order to impersonate a user, call `setSubject` when your service account +credentials are being used. + +**Before** + +```php +$user_to_impersonate = 'user@example.org'; +$credentials = new Google_Auth_AssertionCredentials( + $client_email, + $scopes, + $private_key, + 'notasecret', // Default P12 password + 'http://oauth.net/grant_type/jwt/1.0/bearer', // Default grant type + $user_to_impersonate, +); +``` + +**After** + +```php +$user_to_impersonate = 'user@example.org'; +$client->setSubject($user_to_impersonate); +``` + +Additionally, `Google_Client::loadServiceAccountJson` has been removed in favor +of `Google_Client::setAuthConfig`: + +**Before** + +```php +$scopes = [ Google_Service_Books::BOOKS ]; +$client->loadServiceAccountJson('/path/to/service-account.json', $scopes); +``` + +**After** + +```php +$scopes = [ Google_Service_Books::BOOKS ]; +$client->setAuthConfig('/path/to/service-account.json'); +$client->setScopes($scopes); +``` + +## `Google_Auth_AppIdentity` has been removed + +For App Engine authentication, we now use the underlying [`google/auth`][Google Auth] and +call `useApplicationDefaultCredentials`: + +**Before** + +```php +$client->setAuth(new Google_Auth_AppIdentity($client)); +$client->getAuth() + ->authenticateForScope('https://www.googleapis.com/auth/sqlservice.admin') +``` + +**After** + +```php +$client->useApplicationDefaultCredentials(); +$client->addScope('https://www.googleapis.com/auth/sqlservice.admin'); +``` + +This will detect when the App Engine environment is present, and use the appropriate credentials. + +## `Google_Auth_Abstract` classes have been removed + +[`google/auth`][Google Auth] is now used for authentication. As a result, all +`Google_Auth`-related functionality has been removed. The methods that were a part of +`Google_Auth_Abstract` have been moved into the `Google_Client` object. + +**Before** + +```php +$request = new Google_Http_Request(); +$client->getAuth()->sign($request); +``` + +**After** + +```php +// create an authorized HTTP client +$httpClient = $client->authorize(); + +// OR add authorization to an existing client +$httpClient = new GuzzleHttp\Client(); +$httpClient = $client->authorize($httpClient); +``` + +**Before** + +```php +$request = new Google_Http_Request(); +$response = $client->getAuth()->authenticatedRequest($request); +``` + +**After** + +```php +$httpClient = $client->authorize(); +$request = new GuzzleHttp\Psr7\Request('POST', $url); +$response = $httpClient->send($request); +``` + +> NOTE: `$request` can be any class implementing +> `Psr\Http\Message\RequestInterface` + +In addition, other methods that were callable on `Google_Auth_OAuth2` are now called +on the `Google_Client` object: + +**Before** + +```php +$client->getAuth()->refreshToken($token); +$client->getAuth()->refreshTokenWithAssertion(); +$client->getAuth()->revokeToken($token); +$client->getAuth()->isAccessTokenExpired(); +``` + +**After** + +```php +$client->refreshToken($token); +$client->refreshTokenWithAssertion(); +$client->revokeToken($token); +$client->isAccessTokenExpired(); +``` + +## PHP 5.6 is now the minimum supported PHP version + +This was previously `PHP 5.2`. If you still need to use PHP 5.2, please continue to use +the [v1-master](https://github.com/google/google-api-php-client/tree/v1-master) branch. + +## Guzzle and PSR-7 are used for HTTP Requests + +The HTTP library Guzzle is used for all HTTP Requests. By default, [`Guzzle 6`][Guzzle 6] +is used, but this library is also compatible with [`Guzzle 5`][Guzzle 5]. As a result, +all `Google_IO`-related functionality and `Google_Http`-related functionality has been +changed or removed. + +1. Removed `Google_Http_Request` +1. Removed `Google_IO_Abstract`, `Google_IO_Exception`, `Google_IO_Curl`, and `Google_IO_Stream` +1. Removed methods `Google_Client::getIo` and `Google_Client::setIo` +1. Refactored `Google_Http_Batch` and `Google_Http_MediaFileUpload` for Guzzle +1. Added `Google_Client::getHttpClient` and `Google_Client::setHttpClient` for getting and +setting the Guzzle `GuzzleHttp\ClientInterface` object. + +> NOTE: `PSR-7`-compatible libraries can now be used with this library. + +## Other Changes + + - [`PSR 3`][PSR 3] `LoggerInterface` is now supported, and [Monolog][Monolog] is used for all + logging. As a result, all `Google_Logger`-related functionality has been removed: + 1. Removed `Google_Logger_Abstract`, `Google_Logger_Exception`, `Google_Logger_File`, + `Google_Logger_Null`, and `Google_Logger_Psr` + 1. `Google_Client::setLogger` now requires `Psr\Log\LoggerInterface` + - [`firebase/jwt`][Firebase JWT] is now used for all JWT signing and verifying. As a result, the + following classes have been changed or removed: + 1. Removed `Google_Signer_P12` + 1. Removed `Google_Verifier_Pem` + 1. Removed `Google_Auth_LoginTicket` (see below) + - The following classes and methods have been removed in favor of [`google/auth`][Google Auth]: + 1. Removed methods `Google_Client::getAuth` and `Google_Client::setAuth` + 1. Removed `Google_Auth_Abstract` + - `Google_Auth_Abstract::sign` and `Google_Auth_Abstract::authenticatedRequest` have been + replaced by `Google_Client::authorize`. See the above examples for more details. + 1. Removed `Google_Auth_AppIdentity`. This is now supported in [`google/auth`][Google Auth AppIdentity] + and is used automatically when `Google_Client::useApplicationDefaultCredentials` is called. + 1. Removed `Google_Auth_AssertionCredentials`. Use `Google_Client::setAuthConfig` instead. + 1. Removed `Google_Auth_ComputeEngine`. This is now supported in + [`google/auth`][Google Auth GCE], and is used automatically when + `Google_Client::useApplicationDefaultCredentials` is called. + 1. Removed `Google_Auth_Exception` + 1. Removed `Google_Auth_LoginTicket`. Calls to `Google_Client::verifyIdToken` now returns + the payload of the ID Token as an array if the verification is successful. + 1. Removed `Google_Auth_OAuth2`. This functionality is now supported in [`google/auth`][Google Auth OAuth2] and wrapped in `Google_Client`. These changes will only affect applications calling `Google_Client::getAuth`, + as the methods on `Google_Client` have not changed. + 1. Removed `Google_Auth_Simple`. This is now supported in [`google/auth`][Google Auth Simple] + and is used automatically when `Google_Client::setDeveloperKey` is called. + - `Google_Client::sign` has been replaced by `Google_Client::authorize`. This function + now takes a `GuzzleHttp\ClientInterface` object and uses the following decision tree for + authentication: + 1. Uses Application Default Credentials when + `Google_Client::useApplicationDefaultCredentials` is called + - Looks for `GOOGLE_APPLICATION_CREDENTIALS` environment variable if set + - Looks in `~/.config/gcloud/application_default_credentials.json` + - Otherwise, uses `GCECredentials` + 1. Uses API Key if set (see `Client::setDeveloperKey`) + 1. Uses Access Token if set (call `Client::setAccessToken`) + 1. Automatically refreshes access tokens if one is set and the access token is expired + - Removed `Google_Config` + - Removed `Google_Utils` + - [`PSR-6`][PSR 6] cache is used for all caching. As a result: + 1. Removed `Google_Cache_Abstract` + 1. Classes `Google_Cache_Apc`, `Google_Cache_File`, `Google_Cache_Memcache`, and + `Google_Cache_Null` now implement `Google\Auth\CacheInterface`. + 1. Google Auth provides simple [caching utilities][Google Auth Cache] which + are used by default unless you provide alternatives. + - Removed `$boundary` constructor argument for `Google_Http_MediaFileUpload` + +[PSR 3]: https://www.php-fig.org/psr/psr-3/ +[PSR 6]: https://www.php-fig.org/psr/psr-6/ +[Guzzle 5]: https://github.com/guzzle/guzzle +[Guzzle 6]: http://docs.guzzlephp.org/en/latest/psr7.html +[Monolog]: https://github.com/Seldaek/monolog +[Google Auth]: https://github.com/google/google-auth-library-php +[Google Auth Cache]: https://github.com/googleapis/google-auth-library-php/tree/master/src/Cache +[Google Auth GCE]: https://github.com/google/google-auth-library-php/blob/master/src/GCECredentials.php +[Google Auth OAuth2]: https://github.com/google/google-auth-library-php/blob/master/src/OAuth2.php +[Google Auth Simple]: https://github.com/google/google-auth-library-php/blob/master/src/Simple.php +[Google Auth AppIdentity]: https://github.com/google/google-auth-library-php/blob/master/src/AppIdentityCredentials.php +[Firebase JWT]: https://github.com/firebase/php-jwt diff --git a/lib/Google/composer.json b/lib/Google/composer.json index fbc7e9f1d..b0deec34b 100644 --- a/lib/Google/composer.json +++ b/lib/Google/composer.json @@ -6,7 +6,7 @@ "homepage": "http://developers.google.com/api-client-library/php", "license": "Apache-2.0", "require": { - "php": "^8.1", + "php": "^8.0", "google/auth": "^1.37", "google/apiclient-services": "~0.350", "firebase/php-jwt": "^6.0", @@ -21,9 +21,8 @@ "squizlabs/php_codesniffer": "^3.8", "symfony/dom-crawler": "~2.1", "symfony/css-selector": "~2.1", - "cache/filesystem-adapter": "^1.1", "phpcompatibility/php-compatibility": "^9.2", - "composer/composer": "^1.10.23", + "composer/composer": "^1.10.23 || ^2.0.0", "phpspec/prophecy-phpunit": "^2.1", "phpunit/phpunit": "^9.6" }, diff --git a/lib/Google/composer.lock b/lib/Google/composer.lock index e99036f19..4d755c492 100644 --- a/lib/Google/composer.lock +++ b/lib/Google/composer.lock @@ -4,29 +4,29 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2a5070868f1102d5ee547428a26ffd25", + "content-hash": "ec2e2b541c95b7d592511c65e81a0226", "packages": [ { "name": "brick/math", - "version": "0.14.0", + "version": "0.11.0", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2" + "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2", - "reference": "113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2", + "url": "https://api.github.com/repos/brick/math/zipball/0ad82ce168c82ba30d1c01ec86116ab52f589478", + "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478", "shasum": "" }, "require": { - "php": "^8.2" + "php": "^8.0" }, "require-dev": { "php-coveralls/php-coveralls": "^2.2", - "phpstan/phpstan": "2.1.22", - "phpunit/phpunit": "^11.5" + "phpunit/phpunit": "^9.0", + "vimeo/psalm": "5.0.0" }, "type": "library", "autoload": { @@ -46,17 +46,12 @@ "arithmetic", "bigdecimal", "bignum", - "bignumber", "brick", - "decimal", - "integer", - "math", - "mathematics", - "rational" + "math" ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.14.0" + "source": "https://github.com/brick/math/tree/0.11.0" }, "funding": [ { @@ -64,7 +59,7 @@ "type": "github" } ], - "time": "2025-08-29T12:40:03+00:00" + "time": "2023-01-15T23:15:59+00:00" }, { "name": "firebase/php-jwt", @@ -131,20 +126,20 @@ }, { "name": "google/apiclient-services", - "version": "v0.415.0", + "version": "v0.396.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "080bdeb1d5243429164dc589b69426bae98dad1d" + "reference": "ceb2e432e4326c6775d24f62d554395a1a9ad3dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/080bdeb1d5243429164dc589b69426bae98dad1d", - "reference": "080bdeb1d5243429164dc589b69426bae98dad1d", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/ceb2e432e4326c6775d24f62d554395a1a9ad3dd", + "reference": "ceb2e432e4326c6775d24f62d554395a1a9ad3dd", "shasum": "" }, "require": { - "php": "^8.1" + "php": "^8.0" }, "require-dev": { "phpunit/phpunit": "^9.6" @@ -169,29 +164,29 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.415.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.396.0" }, - "time": "2025-10-05T01:02:15+00:00" + "time": "2025-02-24T01:10:27+00:00" }, { "name": "google/auth", - "version": "v1.44.0", + "version": "v1.42.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "5670e56307d7a2eac931f677c0e59a4f8abb2e43" + "reference": "0c25599a91530b5847f129b271c536f75a7563f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/5670e56307d7a2eac931f677c0e59a4f8abb2e43", - "reference": "5670e56307d7a2eac931f677c0e59a4f8abb2e43", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/0c25599a91530b5847f129b271c536f75a7563f5", + "reference": "0c25599a91530b5847f129b271c536f75a7563f5", "shasum": "" }, "require": { "firebase/php-jwt": "^6.0", "guzzlehttp/guzzle": "^7.4.5", "guzzlehttp/psr7": "^2.4.5", - "php": "^8.1", + "php": "^8.0", "psr/cache": "^2.0||^3.0", "psr/http-message": "^1.1||^2.0" }, @@ -229,9 +224,9 @@ "support": { "docs": "https://googleapis.github.io/google-auth-library-php/main/", "issues": "https://github.com/googleapis/google-auth-library-php/issues", - "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.44.0" + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.42.0" }, - "time": "2024-12-04T15:34:58+00:00" + "time": "2024-08-26T18:33:48+00:00" }, { "name": "google/cloud-core", @@ -301,21 +296,21 @@ }, { "name": "google/cloud-storage", - "version": "v1.48.4", + "version": "v1.48.1", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-storage.git", - "reference": "4b81b682f6b1517c0c5f6152b2980195d23c1cef" + "reference": "509b095c3ea44db92c9e62a94b5773563c831821" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/4b81b682f6b1517c0c5f6152b2980195d23c1cef", - "reference": "4b81b682f6b1517c0c5f6152b2980195d23c1cef", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/509b095c3ea44db92c9e62a94b5773563c831821", + "reference": "509b095c3ea44db92c9e62a94b5773563c831821", "shasum": "" }, "require": { "google/cloud-core": "^1.57", - "php": "^8.1", + "php": "^8.0", "ramsey/uuid": "^4.2.3" }, "require-dev": { @@ -352,27 +347,27 @@ ], "description": "Cloud Storage Client for PHP", "support": { - "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.48.4" + "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.48.1" }, - "time": "2025-10-01T16:57:30+00:00" + "time": "2025-05-20T19:49:54+00:00" }, { "name": "google/common-protos", - "version": "4.12.4", + "version": "4.12.1", "source": { "type": "git", "url": "https://github.com/googleapis/common-protos-php.git", - "reference": "0127156899af0df2681bd42024c60bd5360d64e3" + "reference": "70c4eb1abab5484a23c17a43b0d455259f5d8c1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/0127156899af0df2681bd42024c60bd5360d64e3", - "reference": "0127156899af0df2681bd42024c60bd5360d64e3", + "url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/70c4eb1abab5484a23c17a43b0d455259f5d8c1b", + "reference": "70c4eb1abab5484a23c17a43b0d455259f5d8c1b", "shasum": "" }, "require": { - "google/protobuf": "^4.31", - "php": "^8.1" + "google/protobuf": "^v3.25.3||^4.26.1", + "php": "^8.0" }, "require-dev": { "phpunit/phpunit": "^9.6" @@ -411,9 +406,9 @@ "google" ], "support": { - "source": "https://github.com/googleapis/common-protos-php/tree/v4.12.4" + "source": "https://github.com/googleapis/common-protos-php/tree/v4.12.1" }, - "time": "2025-09-20T01:29:44+00:00" + "time": "2025-05-20T19:49:54+00:00" }, { "name": "google/gax", @@ -519,20 +514,20 @@ }, { "name": "google/longrunning", - "version": "0.5.0", + "version": "0.4.7", "source": { "type": "git", "url": "https://github.com/googleapis/php-longrunning.git", - "reference": "715519ab4aaf3c4268adb2b551ee0f34135c8c5f" + "reference": "624cabb874c10e5ddc9034c999f724894b70a3d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/php-longrunning/zipball/715519ab4aaf3c4268adb2b551ee0f34135c8c5f", - "reference": "715519ab4aaf3c4268adb2b551ee0f34135c8c5f", + "url": "https://api.github.com/repos/googleapis/php-longrunning/zipball/624cabb874c10e5ddc9034c999f724894b70a3d3", + "reference": "624cabb874c10e5ddc9034c999f724894b70a3d3", "shasum": "" }, "require-dev": { - "google/gax": "^1.38.0", + "google/gax": "^1.36.0", "phpunit/phpunit": "^9.0" }, "type": "library", @@ -557,29 +552,29 @@ ], "description": "Google LongRunning Client for PHP", "support": { - "source": "https://github.com/googleapis/php-longrunning/tree/v0.5.0" + "source": "https://github.com/googleapis/php-longrunning/tree/v0.4.7" }, - "time": "2025-09-20T01:29:44+00:00" + "time": "2025-01-24T21:24:06+00:00" }, { "name": "google/protobuf", - "version": "v4.32.1", + "version": "v4.31.1", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb" + "reference": "2b028ce8876254e2acbeceea7d9b573faad41864" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb", - "reference": "c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/2b028ce8876254e2acbeceea7d9b573faad41864", + "reference": "2b028ce8876254e2acbeceea7d9b573faad41864", "shasum": "" }, "require": { - "php": ">=8.1.0" + "php": ">=7.0.0" }, "require-dev": { - "phpunit/phpunit": ">=5.0.0 <8.5.27" + "phpunit/phpunit": ">=5.0.0" }, "suggest": { "ext-bcmath": "Need to support JSON deserialization" @@ -601,22 +596,22 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.32.1" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.31.1" }, - "time": "2025-09-14T05:14:52+00:00" + "time": "2025-05-28T18:52:35+00:00" }, { "name": "grpc/grpc", - "version": "1.74.0", + "version": "1.57.0", "source": { "type": "git", "url": "https://github.com/grpc/grpc-php.git", - "reference": "32bf4dba256d60d395582fb6e4e8d3936bcdb713" + "reference": "b610c42022ed3a22f831439cb93802f2a4502fdf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/grpc/grpc-php/zipball/32bf4dba256d60d395582fb6e4e8d3936bcdb713", - "reference": "32bf4dba256d60d395582fb6e4e8d3936bcdb713", + "url": "https://api.github.com/repos/grpc/grpc-php/zipball/b610c42022ed3a22f831439cb93802f2a4502fdf", + "reference": "b610c42022ed3a22f831439cb93802f2a4502fdf", "shasum": "" }, "require": { @@ -645,28 +640,28 @@ "rpc" ], "support": { - "source": "https://github.com/grpc/grpc-php/tree/v1.74.0" + "source": "https://github.com/grpc/grpc-php/tree/v1.57.0" }, - "time": "2025-07-24T20:02:16+00:00" + "time": "2023-08-14T23:57:54+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.10.0", + "version": "7.9.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4" + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", - "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^2.3", - "guzzlehttp/psr7": "^2.8", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -757,7 +752,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.10.0" + "source": "https://github.com/guzzle/guzzle/tree/7.9.3" }, "funding": [ { @@ -773,20 +768,20 @@ "type": "tidelift" } ], - "time": "2025-08-23T22:36:01+00:00" + "time": "2025-03-27T13:37:11+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.3.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "481557b130ef3790cf82b713667b43030dc9c957" + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957", - "reference": "481557b130ef3790cf82b713667b43030dc9c957", + "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", "shasum": "" }, "require": { @@ -794,7 +789,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.44 || ^9.6.25" + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "type": "library", "extra": { @@ -840,7 +835,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.3.0" + "source": "https://github.com/guzzle/promises/tree/2.2.0" }, "funding": [ { @@ -856,20 +851,20 @@ "type": "tidelift" } ], - "time": "2025-08-22T14:34:08+00:00" + "time": "2025-03-27T13:27:01+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.8.0", + "version": "2.7.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "21dc724a0583619cd1652f673303492272778051" + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051", - "reference": "21dc724a0583619cd1652f673303492272778051", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16", "shasum": "" }, "require": { @@ -885,7 +880,7 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "http-interop/http-factory-tests": "0.9.0", - "phpunit/phpunit": "^8.5.44 || ^9.6.25" + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -956,7 +951,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.8.0" + "source": "https://github.com/guzzle/psr7/tree/2.7.1" }, "funding": [ { @@ -972,7 +967,7 @@ "type": "tidelift" } ], - "time": "2025-08-23T21:21:41+00:00" + "time": "2025-03-27T12:30:47+00:00" }, { "name": "monolog/monolog", @@ -1078,26 +1073,24 @@ }, { "name": "paragonie/constant_time_encoding", - "version": "v3.1.3", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77" + "reference": "df1e7fde177501eee2037dd159cf04f5f301a512" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77", - "reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/df1e7fde177501eee2037dd159cf04f5f301a512", + "reference": "df1e7fde177501eee2037dd159cf04f5f301a512", "shasum": "" }, "require": { "php": "^8" }, "require-dev": { - "infection/infection": "^0", - "nikic/php-fuzzer": "^0", - "phpunit/phpunit": "^9|^10|^11", - "vimeo/psalm": "^4|^5|^6" + "phpunit/phpunit": "^9", + "vimeo/psalm": "^4|^5" }, "type": "library", "autoload": { @@ -1143,7 +1136,7 @@ "issues": "https://github.com/paragonie/constant_time_encoding/issues", "source": "https://github.com/paragonie/constant_time_encoding" }, - "time": "2025-09-24T15:06:41+00:00" + "time": "2024-05-08T12:36:18+00:00" }, { "name": "paragonie/random_compat", @@ -1197,16 +1190,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.47", + "version": "3.0.43", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "9d6ca36a6c2dd434765b1071b2644a1c683b385d" + "reference": "709ec107af3cb2f385b9617be72af8cf62441d02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/9d6ca36a6c2dd434765b1071b2644a1c683b385d", - "reference": "9d6ca36a6c2dd434765b1071b2644a1c683b385d", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/709ec107af3cb2f385b9617be72af8cf62441d02", + "reference": "709ec107af3cb2f385b9617be72af8cf62441d02", "shasum": "" }, "require": { @@ -1287,7 +1280,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.47" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.43" }, "funding": [ { @@ -1303,20 +1296,20 @@ "type": "tidelift" } ], - "time": "2025-10-06T01:07:24+00:00" + "time": "2024-12-14T21:12:59+00:00" }, { "name": "psr/cache", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b" + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", - "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", "shasum": "" }, "require": { @@ -1350,9 +1343,9 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/2.0.0" + "source": "https://github.com/php-fig/cache/tree/3.0.0" }, - "time": "2021-02-03T23:23:37+00:00" + "time": "2021-02-03T23:26:27+00:00" }, { "name": "psr/http-client", @@ -1610,39 +1603,43 @@ }, { "name": "ramsey/collection", - "version": "2.1.1", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/ramsey/collection.git", - "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2" + "reference": "ad7475d1c9e70b190ecffc58f2d989416af339b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/344572933ad0181accbf4ba763e85a0306a8c5e2", - "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2", + "url": "https://api.github.com/repos/ramsey/collection/zipball/ad7475d1c9e70b190ecffc58f2d989416af339b4", + "reference": "ad7475d1c9e70b190ecffc58f2d989416af339b4", "shasum": "" }, "require": { - "php": "^8.1" + "php": "^7.4 || ^8.0", + "symfony/polyfill-php81": "^1.23" }, "require-dev": { "captainhook/plugin-composer": "^5.3", - "ergebnis/composer-normalize": "^2.45", - "fakerphp/faker": "^1.24", + "ergebnis/composer-normalize": "^2.28.3", + "fakerphp/faker": "^1.21", "hamcrest/hamcrest-php": "^2.0", - "jangregor/phpstan-prophecy": "^2.1", - "mockery/mockery": "^1.6", + "jangregor/phpstan-prophecy": "^1.0", + "mockery/mockery": "^1.5", "php-parallel-lint/php-console-highlighter": "^1.0", - "php-parallel-lint/php-parallel-lint": "^1.4", - "phpspec/prophecy-phpunit": "^2.3", - "phpstan/extension-installer": "^1.4", - "phpstan/phpstan": "^2.1", - "phpstan/phpstan-mockery": "^2.0", - "phpstan/phpstan-phpunit": "^2.0", - "phpunit/phpunit": "^10.5", - "ramsey/coding-standard": "^2.3", - "ramsey/conventional-commits": "^1.6", - "roave/security-advisories": "dev-latest" + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpcsstandards/phpcsutils": "^1.0.0-rc1", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan": "^1.9", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5", + "psalm/plugin-mockery": "^1.1", + "psalm/plugin-phpunit": "^0.18.4", + "ramsey/coding-standard": "^2.0.3", + "ramsey/conventional-commits": "^1.3", + "vimeo/psalm": "^5.4" }, "type": "library", "extra": { @@ -1680,26 +1677,36 @@ ], "support": { "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/2.1.1" + "source": "https://github.com/ramsey/collection/tree/1.3.0" }, - "time": "2025-03-22T05:38:12+00:00" + "funding": [ + { + "url": "https://github.com/ramsey", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/ramsey/collection", + "type": "tidelift" + } + ], + "time": "2022-12-27T19:12:24+00:00" }, { "name": "ramsey/uuid", - "version": "4.9.1", + "version": "4.9.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440" + "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/81f941f6f729b1e3ceea61d9d014f8b6c6800440", - "reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/4e0e23cc785f0724a0e838279a9eb03f28b092a0", + "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0", "shasum": "" }, "require": { - "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14", + "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13", "php": "^8.0", "ramsey/collection": "^1.2 || ^2.0" }, @@ -1758,31 +1765,29 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.9.1" + "source": "https://github.com/ramsey/uuid/tree/4.9.0" }, - "time": "2025-09-04T20:59:21+00:00" + "time": "2025-06-25T14:20:11+00:00" }, { "name": "rize/uri-template", - "version": "0.4.0", + "version": "0.3.8", "source": { "type": "git", "url": "https://github.com/rize/UriTemplate.git", - "reference": "56f374a9a42c7c3998f8b55b6b21b224de90c58b" + "reference": "34a5b96d0b65a5dddb7d20f09b6527a43faede24" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rize/UriTemplate/zipball/56f374a9a42c7c3998f8b55b6b21b224de90c58b", - "reference": "56f374a9a42c7c3998f8b55b6b21b224de90c58b", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/34a5b96d0b65a5dddb7d20f09b6527a43faede24", + "reference": "34a5b96d0b65a5dddb7d20f09b6527a43faede24", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=5.3.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.63", - "phpstan/phpstan": "^1.12", - "phpunit/phpunit": "~10.0" + "phpunit/phpunit": "~4.8.36" }, "type": "library", "autoload": { @@ -1808,7 +1813,7 @@ ], "support": { "issues": "https://github.com/rize/UriTemplate/issues", - "source": "https://github.com/rize/UriTemplate/tree/0.4.0" + "source": "https://github.com/rize/UriTemplate/tree/0.3.8" }, "funding": [ { @@ -1824,24 +1829,24 @@ "type": "open_collective" } ], - "time": "2024-11-27T12:13:42+00:00" + "time": "2024-08-30T07:09:40+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.6.0", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.0.2" }, "type": "library", "extra": { @@ -1850,7 +1855,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.6-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1875,7 +1880,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" }, "funding": [ { @@ -1891,115 +1896,41 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:21:43+00:00" - } - ], - "packages-dev": [ - { - "name": "cache/adapter-common", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://github.com/php-cache/adapter-common.git", - "reference": "8788309be72aa7be69b88cdc0687549c74a7d479" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-cache/adapter-common/zipball/8788309be72aa7be69b88cdc0687549c74a7d479", - "reference": "8788309be72aa7be69b88cdc0687549c74a7d479", - "shasum": "" - }, - "require": { - "cache/tag-interop": "^1.0", - "php": ">=7.4", - "psr/cache": "^1.0 || ^2.0", - "psr/log": "^1.0 || ^2.0 || ^3.0", - "psr/simple-cache": "^1.0" - }, - "require-dev": { - "cache/integration-tests": "^0.17", - "phpunit/phpunit": "^7.5.20 || ^9.5.10" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "Cache\\Adapter\\Common\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Aaron Scherer", - "email": "aequasi@gmail.com", - "homepage": "https://github.com/aequasi" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/nyholm" - } - ], - "description": "Common classes for PSR-6 adapters", - "homepage": "http://www.php-cache.com/en/latest/", - "keywords": [ - "cache", - "psr-6", - "tag" - ], - "support": { - "source": "https://github.com/php-cache/adapter-common/tree/1.3.0" - }, - "time": "2022-01-15T15:47:19+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { - "name": "cache/filesystem-adapter", - "version": "1.2.0", + "name": "symfony/polyfill-php81", + "version": "v1.32.0", "source": { "type": "git", - "url": "https://github.com/php-cache/filesystem-adapter.git", - "reference": "f1faaae40aaa696ef899cef6f6888aedb90b419b" + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-cache/filesystem-adapter/zipball/f1faaae40aaa696ef899cef6f6888aedb90b419b", - "reference": "f1faaae40aaa696ef899cef6f6888aedb90b419b", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", "shasum": "" }, "require": { - "cache/adapter-common": "^1.0", - "league/flysystem": "^1.0", - "php": ">=7.4", - "psr/cache": "^1.0 || ^2.0", - "psr/simple-cache": "^1.0" - }, - "provide": { - "psr/cache-implementation": "^1.0", - "psr/simple-cache-implementation": "^1.0" - }, - "require-dev": { - "cache/integration-tests": "^0.17", - "phpunit/phpunit": "^7.5.20 || ^9.5.10" + "php": ">=7.2" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.1-dev" + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { + "files": [ + "bootstrap.php" + ], "psr-4": { - "Cache\\Adapter\\Filesystem\\": "" + "Symfony\\Polyfill\\Php81\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2008,100 +1939,55 @@ ], "authors": [ { - "name": "Aaron Scherer", - "email": "aequasi@gmail.com", - "homepage": "https://github.com/aequasi" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/nyholm" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "A PSR-6 cache implementation using filesystem. This implementation supports tags", - "homepage": "http://www.php-cache.com/en/latest/", + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", "keywords": [ - "cache", - "filesystem", - "psr-6", - "tag" + "compatibility", + "polyfill", + "portable", + "shim" ], "support": { - "source": "https://github.com/php-cache/filesystem-adapter/tree/1.2.0" - }, - "time": "2022-01-15T15:47:19+00:00" - }, - { - "name": "cache/tag-interop", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/php-cache/tag-interop.git", - "reference": "b062b1d735357da50edf8387f7a8696f3027d328" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-cache/tag-interop/zipball/b062b1d735357da50edf8387f7a8696f3027d328", - "reference": "b062b1d735357da50edf8387f7a8696f3027d328", - "shasum": "" - }, - "require": { - "php": "^5.5 || ^7.0 || ^8.0", - "psr/cache": "^1.0 || ^2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } + "source": "https://github.com/symfony/polyfill-php81/tree/v1.32.0" }, - "autoload": { - "psr-4": { - "Cache\\TagInterop\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ + "funding": [ { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/nyholm" + "url": "https://symfony.com/sponsor", + "type": "custom" }, { - "name": "Nicolas Grekas", - "email": "p@tchwork.com", - "homepage": "https://github.com/nicolas-grekas" + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "Framework interoperable interfaces for tags", - "homepage": "https://www.php-cache.com/en/latest/", - "keywords": [ - "cache", - "psr", - "psr6", - "tag" - ], - "support": { - "issues": "https://github.com/php-cache/tag-interop/issues", - "source": "https://github.com/php-cache/tag-interop/tree/1.1.0" - }, - "time": "2021-12-31T10:03:23+00:00" - }, + "time": "2024-09-09T11:45:10+00:00" + } + ], + "packages-dev": [ { "name": "composer/ca-bundle", - "version": "1.5.8", + "version": "1.5.6", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "719026bb30813accb68271fee7e39552a58e9f65" + "reference": "f65c239c970e7f072f067ab78646e9f0b2935175" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/719026bb30813accb68271fee7e39552a58e9f65", - "reference": "719026bb30813accb68271fee7e39552a58e9f65", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/f65c239c970e7f072f067ab78646e9f0b2935175", + "reference": "f65c239c970e7f072f067ab78646e9f0b2935175", "shasum": "" }, "require": { @@ -2148,7 +2034,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.5.8" + "source": "https://github.com/composer/ca-bundle/tree/1.5.6" }, "funding": [ { @@ -2158,9 +2044,13 @@ { "url": "https://github.com/composer", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" } ], - "time": "2025-08-20T18:49:47+00:00" + "time": "2025-03-06T14:30:56+00:00" }, { "name": "composer/composer", @@ -2343,24 +2233,24 @@ }, { "name": "composer/spdx-licenses", - "version": "1.5.9", + "version": "1.5.8", "source": { "type": "git", "url": "https://github.com/composer/spdx-licenses.git", - "reference": "edf364cefe8c43501e21e88110aac10b284c3c9f" + "reference": "560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/edf364cefe8c43501e21e88110aac10b284c3c9f", - "reference": "edf364cefe8c43501e21e88110aac10b284c3c9f", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a", + "reference": "560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^1.11", - "symfony/phpunit-bridge": "^3 || ^7" + "phpstan/phpstan": "^0.12.55", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", "extra": { @@ -2403,7 +2293,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/spdx-licenses/issues", - "source": "https://github.com/composer/spdx-licenses/tree/1.5.9" + "source": "https://github.com/composer/spdx-licenses/tree/1.5.8" }, "funding": [ { @@ -2419,7 +2309,7 @@ "type": "tidelift" } ], - "time": "2025-05-12T21:07:07+00:00" + "time": "2023-11-20T07:44:33+00:00" }, { "name": "composer/xdebug-handler", @@ -2535,30 +2425,30 @@ }, { "name": "doctrine/instantiator", - "version": "2.0.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { - "php": "^8.1" + "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^11", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.9.4", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^5.4" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", "autoload": { @@ -2585,7 +2475,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.0.0" + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, "funding": [ { @@ -2601,7 +2491,7 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:23:10+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "justinrainbow/json-schema", @@ -2668,168 +2558,18 @@ }, "time": "2024-07-06T21:00:26+00:00" }, - { - "name": "league/flysystem", - "version": "1.1.10", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem.git", - "reference": "3239285c825c152bcc315fe0e87d6b55f5972ed1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/3239285c825c152bcc315fe0e87d6b55f5972ed1", - "reference": "3239285c825c152bcc315fe0e87d6b55f5972ed1", - "shasum": "" - }, - "require": { - "ext-fileinfo": "*", - "league/mime-type-detection": "^1.3", - "php": "^7.2.5 || ^8.0" - }, - "conflict": { - "league/flysystem-sftp": "<1.0.6" - }, - "require-dev": { - "phpspec/prophecy": "^1.11.1", - "phpunit/phpunit": "^8.5.8" - }, - "suggest": { - "ext-ftp": "Allows you to use FTP server storage", - "ext-openssl": "Allows you to use FTPS server storage", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "League\\Flysystem\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "description": "Filesystem abstraction: Many filesystems, one API.", - "keywords": [ - "Cloud Files", - "WebDAV", - "abstraction", - "aws", - "cloud", - "copy.com", - "dropbox", - "file systems", - "files", - "filesystem", - "filesystems", - "ftp", - "rackspace", - "remote", - "s3", - "sftp", - "storage" - ], - "support": { - "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/1.1.10" - }, - "funding": [ - { - "url": "https://offset.earth/frankdejonge", - "type": "other" - } - ], - "time": "2022-10-04T09:16:37+00:00" - }, - { - "name": "league/mime-type-detection", - "version": "1.16.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "2d6702ff215bf922936ccc1ad31007edc76451b9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/2d6702ff215bf922936ccc1ad31007edc76451b9", - "reference": "2d6702ff215bf922936ccc1ad31007edc76451b9", - "shasum": "" - }, - "require": { - "ext-fileinfo": "*", - "php": "^7.4 || ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.2", - "phpstan/phpstan": "^0.12.68", - "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "League\\MimeTypeDetection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frankdejonge.nl" - } - ], - "description": "Mime-type detection for Flysystem", - "support": { - "issues": "https://github.com/thephpleague/mime-type-detection/issues", - "source": "https://github.com/thephpleague/mime-type-detection/tree/1.16.0" - }, - "funding": [ - { - "url": "https://github.com/frankdejonge", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/league/flysystem", - "type": "tidelift" - } - ], - "time": "2024-09-21T08:32:55+00:00" - }, { "name": "myclabs/deep-copy", - "version": "1.13.4", + "version": "1.13.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a" + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a", - "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/1720ddd719e16cf0db4eb1c6eca108031636d46c", + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c", "shasum": "" }, "require": { @@ -2868,7 +2608,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.1" }, "funding": [ { @@ -2876,20 +2616,20 @@ "type": "tidelift" } ], - "time": "2025-08-01T08:46:24+00:00" + "time": "2025-04-29T12:36:36+00:00" }, { "name": "nikic/php-parser", - "version": "v5.6.1", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2" + "reference": "447a020a1f875a434d62f2a401f53b82a396e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2", - "reference": "f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494", + "reference": "447a020a1f875a434d62f2a401f53b82a396e494", "shasum": "" }, "require": { @@ -2908,7 +2648,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.x-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2932,9 +2672,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.6.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0" }, - "time": "2025-08-13T20:13:15+00:00" + "time": "2024-12-30T11:07:19+00:00" }, { "name": "phar-io/manifest", @@ -3171,16 +2911,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.6.3", + "version": "5.6.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94f8051919d1b0369a6bcc7931d679a511c03fe9" + "reference": "92dde6a5919e34835c506ac8c523ef095a95ed62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94f8051919d1b0369a6bcc7931d679a511c03fe9", - "reference": "94f8051919d1b0369a6bcc7931d679a511c03fe9", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/92dde6a5919e34835c506ac8c523ef095a95ed62", + "reference": "92dde6a5919e34835c506ac8c523ef095a95ed62", "shasum": "" }, "require": { @@ -3229,9 +2969,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.3" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.2" }, - "time": "2025-08-01T19:43:32+00:00" + "time": "2025-04-13T19:20:35+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -3293,31 +3033,30 @@ }, { "name": "phpspec/prophecy", - "version": "v1.23.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "8cce4df9a20660cdc671e8f45ac61959ecdde8e8" + "reference": "35f1adb388946d92e6edab2aa2cb2b60e132ebd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/8cce4df9a20660cdc671e8f45ac61959ecdde8e8", - "reference": "8cce4df9a20660cdc671e8f45ac61959ecdde8e8", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/35f1adb388946d92e6edab2aa2cb2b60e132ebd5", + "reference": "35f1adb388946d92e6edab2aa2cb2b60e132ebd5", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2 || ^2.0", - "php": "8.2.* || 8.3.* || 8.4.*", + "php": "^7.4 || 8.0.* || 8.1.* || 8.2.* || 8.3.* || 8.4.*", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", - "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", - "symfony/deprecation-contracts": "^2.5 || ^3.1" + "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.88", - "phpspec/phpspec": "^6.0 || ^7.0 || ^8.0", + "friendsofphp/php-cs-fixer": "^3.40", + "phpspec/phpspec": "^6.0 || ^7.0", "phpstan/phpstan": "^2.1.13", - "phpunit/phpunit": "^11.0 || ^12.0" + "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0" }, "type": "library", "extra": { @@ -3358,28 +3097,28 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.23.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.22.0" }, - "time": "2025-10-08T08:50:26+00:00" + "time": "2025-04-29T14:58:06+00:00" }, { "name": "phpspec/prophecy-phpunit", - "version": "v2.4.0", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy-phpunit.git", - "reference": "d3c28041d9390c9bca325a08c5b2993ac855bded" + "reference": "8819516c1b489ecee4c60db5f5432fac1ea8ac6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/d3c28041d9390c9bca325a08c5b2993ac855bded", - "reference": "d3c28041d9390c9bca325a08c5b2993ac855bded", + "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/8819516c1b489ecee4c60db5f5432fac1ea8ac6f", + "reference": "8819516c1b489ecee4c60db5f5432fac1ea8ac6f", "shasum": "" }, "require": { "php": "^7.3 || ^8", "phpspec/prophecy": "^1.18", - "phpunit/phpunit": "^9.1 || ^10.1 || ^11.0 || ^12.0" + "phpunit/phpunit": "^9.1 || ^10.1 || ^11.0" }, "require-dev": { "phpstan/phpstan": "^1.10" @@ -3413,22 +3152,22 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy-phpunit/issues", - "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.4.0" + "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.3.0" }, - "time": "2025-05-13T13:52:32+00:00" + "time": "2024-11-19T13:24:17+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "2.3.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "1e0cd5370df5dd2e556a36b9c62f62e555870495" + "reference": "9b30d6fd026b2c132b3985ce6b23bec09ab3aa68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/1e0cd5370df5dd2e556a36b9c62f62e555870495", - "reference": "1e0cd5370df5dd2e556a36b9c62f62e555870495", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/9b30d6fd026b2c132b3985ce6b23bec09ab3aa68", + "reference": "9b30d6fd026b2c132b3985ce6b23bec09ab3aa68", "shasum": "" }, "require": { @@ -3460,9 +3199,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.1.0" }, - "time": "2025-08-30T15:50:23+00:00" + "time": "2025-02-19T13:28:12+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3785,16 +3524,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.29", + "version": "9.6.23", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9ecfec57835a5581bc888ea7e13b51eb55ab9dd3" + "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9ecfec57835a5581bc888ea7e13b51eb55ab9dd3", - "reference": "9ecfec57835a5581bc888ea7e13b51eb55ab9dd3", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", + "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", "shasum": "" }, "require": { @@ -3805,7 +3544,7 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.13.4", + "myclabs/deep-copy": "^1.13.1", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=7.3", @@ -3816,11 +3555,11 @@ "phpunit/php-timer": "^5.0.3", "sebastian/cli-parser": "^1.0.2", "sebastian/code-unit": "^1.0.8", - "sebastian/comparator": "^4.0.9", + "sebastian/comparator": "^4.0.8", "sebastian/diff": "^4.0.6", "sebastian/environment": "^5.1.5", - "sebastian/exporter": "^4.0.8", - "sebastian/global-state": "^5.0.8", + "sebastian/exporter": "^4.0.6", + "sebastian/global-state": "^5.0.7", "sebastian/object-enumerator": "^4.0.4", "sebastian/resource-operations": "^3.0.4", "sebastian/type": "^3.2.1", @@ -3868,7 +3607,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.29" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.23" }, "funding": [ { @@ -3892,7 +3631,7 @@ "type": "tidelift" } ], - "time": "2025-09-24T06:29:11+00:00" + "time": "2025-05-02T06:40:34+00:00" }, { "name": "psr/container", @@ -3947,57 +3686,6 @@ }, "time": "2021-11-05T16:47:00+00:00" }, - { - "name": "psr/simple-cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ], - "support": { - "source": "https://github.com/php-fig/simple-cache/tree/master" - }, - "time": "2017-10-23T01:57:42+00:00" - }, { "name": "sebastian/cli-parser", "version": "1.0.2", @@ -4167,16 +3855,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.9", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/67a2df3a62639eab2cc5906065e9805d4fd5dfc5", - "reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { @@ -4229,27 +3917,15 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.9" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" - }, - { - "url": "https://liberapay.com/sebastianbergmann", - "type": "liberapay" - }, - { - "url": "https://thanks.dev/u/gh/sebastianbergmann", - "type": "thanks_dev" - }, - { - "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator", - "type": "tidelift" } ], - "time": "2025-08-10T06:51:50+00:00" + "time": "2022-09-14T12:41:17+00:00" }, { "name": "sebastian/complexity", @@ -4439,16 +4115,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.8", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "14c6ba52f95a36c3d27c835d65efc7123c446e8c" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/14c6ba52f95a36c3d27c835d65efc7123c446e8c", - "reference": "14c6ba52f95a36c3d27c835d65efc7123c446e8c", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { @@ -4504,40 +4180,28 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.8" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" - }, - { - "url": "https://liberapay.com/sebastianbergmann", - "type": "liberapay" - }, - { - "url": "https://thanks.dev/u/gh/sebastianbergmann", - "type": "thanks_dev" - }, - { - "url": "https://tidelift.com/funding/github/packagist/sebastian/exporter", - "type": "tidelift" } ], - "time": "2025-09-24T06:03:27+00:00" + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.8", + "version": "5.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "b6781316bdcd28260904e7cc18ec983d0d2ef4f6" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/b6781316bdcd28260904e7cc18ec983d0d2ef4f6", - "reference": "b6781316bdcd28260904e7cc18ec983d0d2ef4f6", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { @@ -4580,27 +4244,15 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.8" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" - }, - { - "url": "https://liberapay.com/sebastianbergmann", - "type": "liberapay" - }, - { - "url": "https://thanks.dev/u/gh/sebastianbergmann", - "type": "thanks_dev" - }, - { - "url": "https://tidelift.com/funding/github/packagist/sebastian/global-state", - "type": "tidelift" } ], - "time": "2025-08-10T07:10:35+00:00" + "time": "2024-03-02T06:35:11+00:00" }, { "name": "sebastian/lines-of-code", @@ -4773,16 +4425,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.6", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "539c6691e0623af6dc6f9c20384c120f963465a0" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/539c6691e0623af6dc6f9c20384c120f963465a0", - "reference": "539c6691e0623af6dc6f9c20384c120f963465a0", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { @@ -4824,27 +4476,15 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.6" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" - }, - { - "url": "https://liberapay.com/sebastianbergmann", - "type": "liberapay" - }, - { - "url": "https://thanks.dev/u/gh/sebastianbergmann", - "type": "thanks_dev" - }, - { - "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", - "type": "tidelift" } ], - "time": "2025-08-10T06:57:39+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", @@ -5123,16 +4763,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.13.4", + "version": "3.12.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119" + "reference": "6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ad545ea9c1b7d270ce0fc9cbfb884161cd706119", - "reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa", + "reference": "6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa", "shasum": "" }, "require": { @@ -5203,7 +4843,7 @@ "type": "thanks_dev" } ], - "time": "2025-09-05T05:47:09+00:00" + "time": "2025-04-13T04:10:18+00:00" }, { "name": "symfony/console", @@ -5552,7 +5192,7 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.33.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -5611,7 +5251,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.33.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.32.0" }, "funding": [ { @@ -5622,10 +5262,6 @@ "url": "https://github.com/fabpot", "type": "github" }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -5635,16 +5271,16 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.33.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70" + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70", - "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", "shasum": "" }, "require": { @@ -5693,7 +5329,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.33.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.32.0" }, "funding": [ { @@ -5704,20 +5340,16 @@ "url": "https://github.com/fabpot", "type": "github" }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2025-06-27T09:58:17+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.33.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -5778,7 +5410,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.33.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.32.0" }, "funding": [ { @@ -5789,10 +5421,6 @@ "url": "https://github.com/fabpot", "type": "github" }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -5802,7 +5430,7 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.33.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", @@ -5863,7 +5491,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0" }, "funding": [ { @@ -5874,10 +5502,6 @@ "url": "https://github.com/fabpot", "type": "github" }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -5887,7 +5511,7 @@ }, { "name": "symfony/polyfill-php73", - "version": "v1.33.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", @@ -5943,7 +5567,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.33.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.32.0" }, "funding": [ { @@ -5954,10 +5578,6 @@ "url": "https://github.com/fabpot", "type": "github" }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -5967,7 +5587,7 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.33.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", @@ -6027,7 +5647,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.33.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0" }, "funding": [ { @@ -6038,10 +5658,6 @@ "url": "https://github.com/fabpot", "type": "github" }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -6113,26 +5729,28 @@ }, { "name": "symfony/service-contracts", - "version": "v3.6.0", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4" + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f021b05a130d35510bd6b25fe9053c2a8a15d5d4", - "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d78d39c1599bd1188b8e26bb341da52c3c6d8a66", + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66", "shasum": "" }, "require": { - "php": ">=8.1", - "psr/container": "^1.1|^2.0", - "symfony/deprecation-contracts": "^2.5|^3" + "php": ">=8.0.2", + "psr/container": "^2.0" }, "conflict": { "ext-psr": "<1.1|>=2" }, + "suggest": { + "symfony/service-implementation": "" + }, "type": "library", "extra": { "thanks": { @@ -6140,16 +5758,13 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.6-dev" + "dev-main": "3.0-dev" } }, "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - }, - "exclude-from-classmap": [ - "/Test/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -6176,7 +5791,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.6.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.0.2" }, "funding": [ { @@ -6192,37 +5807,37 @@ "type": "tidelift" } ], - "time": "2025-04-25T09:37:31+00:00" + "time": "2022-05-30T19:17:58+00:00" }, { "name": "symfony/string", - "version": "v6.4.26", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "5621f039a71a11c87c106c1c598bdcd04a19aeea" + "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/5621f039a71a11c87c106c1c598bdcd04a19aeea", - "reference": "5621f039a71a11c87c106c1c598bdcd04a19aeea", + "url": "https://api.github.com/repos/symfony/string/zipball/d9e72497367c23e08bf94176d2be45b00a9d232a", + "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.5" + "symfony/translation-contracts": "<2.0" }, "require-dev": { - "symfony/http-client": "^5.4|^6.0|^7.0", - "symfony/intl": "^6.2|^7.0", - "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^5.4|^6.0|^7.0" + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -6261,7 +5876,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.26" + "source": "https://github.com/symfony/string/tree/v6.0.19" }, "funding": [ { @@ -6272,16 +5887,12 @@ "url": "https://github.com/fabpot", "type": "github" }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2025-09-11T14:32:46+00:00" + "time": "2023-01-01T08:36:10+00:00" }, { "name": "theseer/tokenizer", @@ -6398,7 +6009,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^8.1" + "php": "^8.0" }, "platform-dev": [], "plugin-api-version": "2.6.0" diff --git a/lib/Google/src/AuthHandler/Guzzle6AuthHandler.php b/lib/Google/src/AuthHandler/Guzzle6AuthHandler.php index 05fe1b2b9..352cf915c 100644 --- a/lib/Google/src/AuthHandler/Guzzle6AuthHandler.php +++ b/lib/Google/src/AuthHandler/Guzzle6AuthHandler.php @@ -2,8 +2,8 @@ namespace Google\AuthHandler; +use Google\Auth\CredentialsLoader; use Google\Auth\FetchAuthTokenCache; -use Google\Auth\FetchAuthTokenInterface; use Google\Auth\HttpHandler\HttpHandlerFactory; use Google\Auth\Middleware\AuthTokenMiddleware; use Google\Auth\Middleware\ScopedAccessTokenMiddleware; @@ -28,7 +28,7 @@ public function __construct(?CacheItemPoolInterface $cache = null, array $cacheC public function attachCredentials( ClientInterface $http, - FetchAuthTokenInterface $credentials, + CredentialsLoader $credentials, ?callable $tokenCallback = null ) { // use the provided cache @@ -40,21 +40,13 @@ public function attachCredentials( ); } - return $this->attachToHttp($http, $credentials, $tokenCallback); + return $this->attachCredentialsCache($http, $credentials, $tokenCallback); } public function attachCredentialsCache( ClientInterface $http, FetchAuthTokenCache $credentials, ?callable $tokenCallback = null - ) { - return $this->attachToHttp($http, $credentials, $tokenCallback); - } - - private function attachToHttp( - ClientInterface $http, - FetchAuthTokenInterface $credentials, - ?callable $tokenCallback = null ) { // if we end up needing to make an HTTP request to retrieve credentials, we // can use our existing one, but we need to throw exceptions so the error @@ -71,7 +63,9 @@ private function attachToHttp( $config['handler']->remove('google_auth'); $config['handler']->push($middleware, 'google_auth'); $config['auth'] = 'google_auth'; - return new Client($config); + $http = new Client($config); + + return $http; } public function attachToken(ClientInterface $http, array $token, array $scopes) diff --git a/lib/Google/src/Client.php b/lib/Google/src/Client.php index 33147925f..edfb1f83e 100644 --- a/lib/Google/src/Client.php +++ b/lib/Google/src/Client.php @@ -27,7 +27,6 @@ use Google\Auth\Credentials\UserRefreshCredentials; use Google\Auth\CredentialsLoader; use Google\Auth\FetchAuthTokenCache; -use Google\Auth\FetchAuthTokenInterface; use Google\Auth\GetUniverseDomainInterface; use Google\Auth\HttpHandler\HttpHandlerFactory; use Google\Auth\OAuth2; @@ -91,7 +90,7 @@ class Client private $logger; /** - * @var ?FetchAuthTokenInterface $credentials + * @var ?CredentialsLoader $credentials */ private $credentials; @@ -119,10 +118,10 @@ class Client * Your Google Cloud client ID found in https://developers.google.com/console * @type string $client_secret * Your Google Cloud client secret found in https://developers.google.com/console - * @type string|array|FetchAuthTokenInterface $credentials + * @type string|array|CredentialsLoader $credentials * Can be a path to JSON credentials or an array representing those * credentials (@see Google\Client::setAuthConfig), or an instance of - * {@see FetchAuthTokenInterface}. + * {@see CredentialsLoader}. * @type string|array $scopes * {@see Google\Client::setScopes} * @type string $quota_project @@ -214,7 +213,7 @@ public function __construct(array $config = []) ], $config); if (!is_null($this->config['credentials'])) { - if ($this->config['credentials'] instanceof FetchAuthTokenInterface) { + if ($this->config['credentials'] instanceof CredentialsLoader) { $this->credentials = $this->config['credentials']; } else { $this->setAuthConfig($this->config['credentials']); @@ -461,8 +460,7 @@ public function authorize(?ClientInterface $http = null) $authHandler = $this->getAuthHandler(); // These conditionals represent the decision tree for authentication - // 1. Check if an instance of Google\Auth\FetchAuthTokenInterface has - // been supplied via the "credentials" option + // 1. Check if a Google\Auth\CredentialsLoader instance has been supplied via the "credentials" option // 2. Check for Application Default Credentials // 3a. Check for an Access Token // 3b. If access token exists but is expired, try to refresh it diff --git a/lib/Google/src/Task/Composer.php b/lib/Google/src/Task/Composer.php index fff4de22d..fcad6bd13 100644 --- a/lib/Google/src/Task/Composer.php +++ b/lib/Google/src/Task/Composer.php @@ -34,37 +34,35 @@ public static function cleanup( ) { $composer = $event->getComposer(); $extra = $composer->getPackage()->getExtra(); - $servicesToKeep = $extra['google/apiclient-services'] ?? []; - if (empty($servicesToKeep)) { - return; - } - $vendorDir = $composer->getConfig()->get('vendor-dir'); - $serviceDir = sprintf( - '%s/google/apiclient-services/src/Google/Service', - $vendorDir - ); - if (!is_dir($serviceDir)) { - // path for google/apiclient-services >= 0.200.0 + $servicesToKeep = isset($extra['google/apiclient-services']) + ? $extra['google/apiclient-services'] + : []; + if ($servicesToKeep) { + $vendorDir = $composer->getConfig()->get('vendor-dir'); $serviceDir = sprintf( - '%s/google/apiclient-services/src', + '%s/google/apiclient-services/src/Google/Service', $vendorDir ); - } - self::verifyServicesToKeep($serviceDir, $servicesToKeep); - $finder = self::getServicesToRemove($serviceDir, $servicesToKeep); - $filesystem = $filesystem ?: new Filesystem(); - $servicesToRemoveCount = $finder->count(); - if (0 === $servicesToRemoveCount) { - return; - } - $event->getIO()->write( - sprintf('Removing %d google services', $servicesToRemoveCount) - ); - $pathsToRemove = iterator_to_array($finder); - foreach ($pathsToRemove as $pathToRemove) { - $realpath = $pathToRemove->getRealPath(); - $filesystem->remove($realpath); - $filesystem->remove($realpath . '.php'); + if (!is_dir($serviceDir)) { + // path for google/apiclient-services >= 0.200.0 + $serviceDir = sprintf( + '%s/google/apiclient-services/src', + $vendorDir + ); + } + self::verifyServicesToKeep($serviceDir, $servicesToKeep); + $finder = self::getServicesToRemove($serviceDir, $servicesToKeep); + $filesystem = $filesystem ?: new Filesystem(); + if (0 !== $count = count($finder)) { + $event->getIO()->write( + sprintf('Removing %s google services', $count) + ); + foreach ($finder as $file) { + $realpath = $file->getRealPath(); + $filesystem->remove($realpath); + $filesystem->remove($realpath . '.php'); + } + } } } diff --git a/lib/Google/vendor/autoload.php b/lib/Google/vendor/autoload.php index 5b422997d..599daf634 100644 --- a/lib/Google/vendor/autoload.php +++ b/lib/Google/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit7d51b2283bec19db67d0861b0c8ead2c::getLoader(); +return ComposerAutoloaderInitbd131085cfdbf47b26d7ae00fe412ae4::getLoader(); diff --git a/lib/Google/vendor/brick/math/CHANGELOG.md b/lib/Google/vendor/brick/math/CHANGELOG.md index 377cdae22..17cea8d9f 100644 --- a/lib/Google/vendor/brick/math/CHANGELOG.md +++ b/lib/Google/vendor/brick/math/CHANGELOG.md @@ -2,74 +2,6 @@ All notable changes to this project will be documented in this file. -## [0.14.0](https://github.com/brick/math/releases/tag/0.14.0) - 2025-08-29 - -✨ **New features** - -- New methods: `BigInteger::clamp()` and `BigDecimal::clamp()` (#96 by @JesterIruka) - -✨ **Improvements** - -- All pure methods in `BigNumber` classes are now marked as `@pure` for better static analysis - -💥 **Breaking changes** - -- Minimum PHP version is now 8.2 -- `BigNumber` classes are now `readonly` -- `BigNumber` is now marked as sealed: it must not be extended outside of this package -- Exception classes are now `final` - -## [0.13.1](https://github.com/brick/math/releases/tag/0.13.1) - 2025-03-29 - -✨ **Improvements** - -- `__toString()` methods of `BigInteger` and `BigDecimal` are now type-hinted as returning `numeric-string` instead of `string` (#90 by @vudaltsov) - -## [0.13.0](https://github.com/brick/math/releases/tag/0.13.0) - 2025-03-03 - -💥 **Breaking changes** - -- `BigDecimal::ofUnscaledValue()` no longer throws an exception if the scale is negative -- `MathException` now extends `RuntimeException` instead of `Exception`; this reverts the change introduced in version `0.11.0` (#82) - -✨ **New features** - -- `BigDecimal::ofUnscaledValue()` allows a negative scale (and converts the values to create a zero scale number) - -## [0.12.3](https://github.com/brick/math/releases/tag/0.12.3) - 2025-02-28 - -✨ **New features** - -- `BigDecimal::getPrecision()` Returns the number of significant digits in a decimal number - -## [0.12.2](https://github.com/brick/math/releases/tag/0.12.2) - 2025-02-26 - -⚡️ **Performance improvements** - -- Division in `NativeCalculator` is now faster for small divisors, thanks to [@Izumi-kun](https://github.com/Izumi-kun) in [#87](https://github.com/brick/math/pull/87). - -👌 **Improvements** - -- Add missing `RoundingNecessaryException` to the `@throws` annotation of `BigNumber::of()` - -## [0.12.1](https://github.com/brick/math/releases/tag/0.12.1) - 2023-11-29 - -⚡️ **Performance improvements** - -- `BigNumber::of()` is now faster, thanks to [@SebastienDug](https://github.com/SebastienDug) in [#77](https://github.com/brick/math/pull/77). - -## [0.12.0](https://github.com/brick/math/releases/tag/0.12.0) - 2023-11-26 - -💥 **Breaking changes** - -- Minimum PHP version is now 8.1 -- `RoundingMode` is now an `enum`; if you're type-hinting rounding modes, you need to type-hint against `RoundingMode` instead of `int` now -- `BigNumber` classes do not implement the `Serializable` interface anymore (they use the [new custom object serialization mechanism](https://wiki.php.net/rfc/custom_object_serialization)) -- The following breaking changes only affect you if you're creating your own `BigNumber` subclasses: - - the return type of `BigNumber::of()` is now `static` - - `BigNumber` has a new abstract method `from()` - - all `public` and `protected` functions of `BigNumber` are now `final` - ## [0.11.0](https://github.com/brick/math/releases/tag/0.11.0) - 2023-01-16 💥 **Breaking changes** diff --git a/lib/Google/vendor/brick/math/composer.json b/lib/Google/vendor/brick/math/composer.json index ad1dfe07a..ed817bdd0 100644 --- a/lib/Google/vendor/brick/math/composer.json +++ b/lib/Google/vendor/brick/math/composer.json @@ -5,26 +5,21 @@ "keywords": [ "Brick", "Math", - "Mathematics", "Arbitrary-precision", "Arithmetic", "BigInteger", "BigDecimal", "BigRational", - "BigNumber", - "Bignum", - "Decimal", - "Rational", - "Integer" + "Bignum" ], "license": "MIT", "require": { - "php": "^8.2" + "php": "^8.0" }, "require-dev": { - "phpunit/phpunit": "^11.5", + "phpunit/phpunit": "^9.0", "php-coveralls/php-coveralls": "^2.2", - "phpstan/phpstan": "2.1.22" + "vimeo/psalm": "5.0.0" }, "autoload": { "psr-4": { diff --git a/lib/Google/vendor/brick/math/phpstan.neon b/lib/Google/vendor/brick/math/phpstan.neon deleted file mode 100644 index 216ba1e8d..000000000 --- a/lib/Google/vendor/brick/math/phpstan.neon +++ /dev/null @@ -1,14 +0,0 @@ -parameters: - level: 10 - checkUninitializedProperties: true - paths: - - src - ignoreErrors: - - '~Impure call to function array_shift\(\) in pure method~' - - '~Possibly impure call to function assert\(\) in pure method~' - - '~Possibly impure call to function hex2bin\(\) in pure method~' - - '~Possibly impure call to function preg_match\(\) in pure method~' - - '~Impure static variable in pure method Brick\\Math\\Big(Integer|Decimal|Rational)::(zero|one|ten)\(\)~' - - - message: '~Parameter #\d \$\S+ of function bc\S+ expects numeric-string, string given~' - path: src/Internal/Calculator/BcMathCalculator.php diff --git a/lib/Google/vendor/brick/math/src/BigDecimal.php b/lib/Google/vendor/brick/math/src/BigDecimal.php index 1a540c7d6..02fc65612 100644 --- a/lib/Google/vendor/brick/math/src/BigDecimal.php +++ b/lib/Google/vendor/brick/math/src/BigDecimal.php @@ -8,13 +8,13 @@ use Brick\Math\Exception\MathException; use Brick\Math\Exception\NegativeNumberException; use Brick\Math\Internal\Calculator; -use Brick\Math\Internal\CalculatorRegistry; -use Override; /** * Immutable, arbitrary-precision signed decimal numbers. + * + * @psalm-immutable */ -final readonly class BigDecimal extends BigNumber +final class BigDecimal extends BigNumber { /** * The unscaled value of this decimal number. @@ -37,8 +37,6 @@ * * @param string $value The unscaled value, validated. * @param int $scale The scale, validated. - * - * @pure */ protected function __construct(string $value, int $scale = 0) { @@ -46,10 +44,16 @@ protected function __construct(string $value, int $scale = 0) $this->scale = $scale; } - #[Override] - protected static function from(BigNumber $number): static + /** + * Creates a BigDecimal of the given value. + * + * @throws MathException If the value cannot be converted to a BigDecimal. + * + * @psalm-pure + */ + public static function of(BigNumber|int|float|string $value) : BigDecimal { - return $number->toBigDecimal(); + return parent::of($value)->toBigDecimal(); } /** @@ -58,33 +62,32 @@ protected static function from(BigNumber $number): static * Example: `(12345, 3)` will result in the BigDecimal `12.345`. * * @param BigNumber|int|float|string $value The unscaled value. Must be convertible to a BigInteger. - * @param int $scale The scale of the number. If negative, the scale will be set to zero - * and the unscaled value will be adjusted accordingly. + * @param int $scale The scale of the number, positive or zero. * - * @pure + * @throws \InvalidArgumentException If the scale is negative. + * + * @psalm-pure */ public static function ofUnscaledValue(BigNumber|int|float|string $value, int $scale = 0) : BigDecimal { - $value = (string) BigInteger::of($value); - if ($scale < 0) { - if ($value !== '0') { - $value .= \str_repeat('0', -$scale); - } - $scale = 0; + throw new \InvalidArgumentException('The scale cannot be negative.'); } - return new BigDecimal($value, $scale); + return new BigDecimal((string) BigInteger::of($value), $scale); } /** * Returns a BigDecimal representing zero, with a scale of zero. * - * @pure + * @psalm-pure */ public static function zero() : BigDecimal { - /** @var BigDecimal|null $zero */ + /** + * @psalm-suppress ImpureStaticVariable + * @var BigDecimal|null $zero + */ static $zero; if ($zero === null) { @@ -97,11 +100,14 @@ public static function zero() : BigDecimal /** * Returns a BigDecimal representing one, with a scale of zero. * - * @pure + * @psalm-pure */ public static function one() : BigDecimal { - /** @var BigDecimal|null $one */ + /** + * @psalm-suppress ImpureStaticVariable + * @var BigDecimal|null $one + */ static $one; if ($one === null) { @@ -114,11 +120,14 @@ public static function one() : BigDecimal /** * Returns a BigDecimal representing ten, with a scale of zero. * - * @pure + * @psalm-pure */ public static function ten() : BigDecimal { - /** @var BigDecimal|null $ten */ + /** + * @psalm-suppress ImpureStaticVariable + * @var BigDecimal|null $ten + */ static $ten; if ($ten === null) { @@ -136,8 +145,6 @@ public static function ten() : BigDecimal * @param BigNumber|int|float|string $that The number to add. Must be convertible to a BigDecimal. * * @throws MathException If the number is not valid, or is not convertible to a BigDecimal. - * - * @pure */ public function plus(BigNumber|int|float|string $that) : BigDecimal { @@ -153,7 +160,7 @@ public function plus(BigNumber|int|float|string $that) : BigDecimal [$a, $b] = $this->scaleValues($this, $that); - $value = CalculatorRegistry::get()->add($a, $b); + $value = Calculator::get()->add($a, $b); $scale = $this->scale > $that->scale ? $this->scale : $that->scale; return new BigDecimal($value, $scale); @@ -167,8 +174,6 @@ public function plus(BigNumber|int|float|string $that) : BigDecimal * @param BigNumber|int|float|string $that The number to subtract. Must be convertible to a BigDecimal. * * @throws MathException If the number is not valid, or is not convertible to a BigDecimal. - * - * @pure */ public function minus(BigNumber|int|float|string $that) : BigDecimal { @@ -180,7 +185,7 @@ public function minus(BigNumber|int|float|string $that) : BigDecimal [$a, $b] = $this->scaleValues($this, $that); - $value = CalculatorRegistry::get()->sub($a, $b); + $value = Calculator::get()->sub($a, $b); $scale = $this->scale > $that->scale ? $this->scale : $that->scale; return new BigDecimal($value, $scale); @@ -194,8 +199,6 @@ public function minus(BigNumber|int|float|string $that) : BigDecimal * @param BigNumber|int|float|string $that The multiplier. Must be convertible to a BigDecimal. * * @throws MathException If the multiplier is not a valid number, or is not convertible to a BigDecimal. - * - * @pure */ public function multipliedBy(BigNumber|int|float|string $that) : BigDecimal { @@ -209,7 +212,7 @@ public function multipliedBy(BigNumber|int|float|string $that) : BigDecimal return $that; } - $value = CalculatorRegistry::get()->mul($this->value, $that->value); + $value = Calculator::get()->mul($this->value, $that->value); $scale = $this->scale + $that->scale; return new BigDecimal($value, $scale); @@ -220,14 +223,12 @@ public function multipliedBy(BigNumber|int|float|string $that) : BigDecimal * * @param BigNumber|int|float|string $that The divisor. * @param int|null $scale The desired scale, or null to use the scale of this number. - * @param RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY. + * @param int $roundingMode An optional rounding mode. * * @throws \InvalidArgumentException If the scale or rounding mode is invalid. * @throws MathException If the number is invalid, is zero, or rounding was necessary. - * - * @pure */ - public function dividedBy(BigNumber|int|float|string $that, ?int $scale = null, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal + public function dividedBy(BigNumber|int|float|string $that, ?int $scale = null, int $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal { $that = BigDecimal::of($that); @@ -248,7 +249,7 @@ public function dividedBy(BigNumber|int|float|string $that, ?int $scale = null, $p = $this->valueWithMinScale($that->scale + $scale); $q = $that->valueWithMinScale($this->scale - $scale); - $result = CalculatorRegistry::get()->divRound($p, $q, $roundingMode); + $result = Calculator::get()->divRound($p, $q, $roundingMode); return new BigDecimal($result, $scale); } @@ -262,8 +263,6 @@ public function dividedBy(BigNumber|int|float|string $that, ?int $scale = null, * * @throws MathException If the divisor is not a valid number, is not convertible to a BigDecimal, is zero, * or the result yields an infinite number of digits. - * - * @pure */ public function exactlyDividedBy(BigNumber|int|float|string $that) : BigDecimal { @@ -278,7 +277,7 @@ public function exactlyDividedBy(BigNumber|int|float|string $that) : BigDecimal $d = \rtrim($b, '0'); $scale = \strlen($b) - \strlen($d); - $calculator = CalculatorRegistry::get(); + $calculator = Calculator::get(); foreach ([5, 2] as $prime) { for (;;) { @@ -296,36 +295,12 @@ public function exactlyDividedBy(BigNumber|int|float|string $that) : BigDecimal return $this->dividedBy($that, $scale)->stripTrailingZeros(); } - /** - * Limits (clamps) this number between the given minimum and maximum values. - * - * If the number is lower than $min, returns a copy of $min. - * If the number is greater than $max, returns a copy of $max. - * Otherwise, returns this number unchanged. - * - * @param BigNumber|int|float|string $min The minimum. Must be convertible to a BigDecimal. - * @param BigNumber|int|float|string $max The maximum. Must be convertible to a BigDecimal. - * - * @throws MathException If min/max are not convertible to a BigDecimal. - */ - public function clamp(BigNumber|int|float|string $min, BigNumber|int|float|string $max) : BigDecimal - { - if ($this->isLessThan($min)) { - return BigDecimal::of($min); - } elseif ($this->isGreaterThan($max)) { - return BigDecimal::of($max); - } - return $this; - } - /** * Returns this number exponentiated to the given value. * * The result has a scale of `$this->scale * $exponent`. * * @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000. - * - * @pure */ public function power(int $exponent) : BigDecimal { @@ -345,19 +320,17 @@ public function power(int $exponent) : BigDecimal )); } - return new BigDecimal(CalculatorRegistry::get()->pow($this->value, $exponent), $this->scale * $exponent); + return new BigDecimal(Calculator::get()->pow($this->value, $exponent), $this->scale * $exponent); } /** - * Returns the quotient of the division of this number by the given one. + * Returns the quotient of the division of this number by this given one. * * The quotient has a scale of `0`. * * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal. * * @throws MathException If the divisor is not a valid decimal number, or is zero. - * - * @pure */ public function quotient(BigNumber|int|float|string $that) : BigDecimal { @@ -370,21 +343,19 @@ public function quotient(BigNumber|int|float|string $that) : BigDecimal $p = $this->valueWithMinScale($that->scale); $q = $that->valueWithMinScale($this->scale); - $quotient = CalculatorRegistry::get()->divQ($p, $q); + $quotient = Calculator::get()->divQ($p, $q); return new BigDecimal($quotient, 0); } /** - * Returns the remainder of the division of this number by the given one. + * Returns the remainder of the division of this number by this given one. * * The remainder has a scale of `max($this->scale, $that->scale)`. * * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal. * * @throws MathException If the divisor is not a valid decimal number, or is zero. - * - * @pure */ public function remainder(BigNumber|int|float|string $that) : BigDecimal { @@ -397,7 +368,7 @@ public function remainder(BigNumber|int|float|string $that) : BigDecimal $p = $this->valueWithMinScale($that->scale); $q = $that->valueWithMinScale($this->scale); - $remainder = CalculatorRegistry::get()->divR($p, $q); + $remainder = Calculator::get()->divR($p, $q); $scale = $this->scale > $that->scale ? $this->scale : $that->scale; @@ -411,11 +382,9 @@ public function remainder(BigNumber|int|float|string $that) : BigDecimal * * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal. * - * @return array{BigDecimal, BigDecimal} An array containing the quotient and the remainder. + * @return BigDecimal[] An array containing the quotient and the remainder. * * @throws MathException If the divisor is not a valid decimal number, or is zero. - * - * @pure */ public function quotientAndRemainder(BigNumber|int|float|string $that) : array { @@ -428,7 +397,7 @@ public function quotientAndRemainder(BigNumber|int|float|string $that) : array $p = $this->valueWithMinScale($that->scale); $q = $that->valueWithMinScale($this->scale); - [$quotient, $remainder] = CalculatorRegistry::get()->divQR($p, $q); + [$quotient, $remainder] = Calculator::get()->divQR($p, $q); $scale = $this->scale > $that->scale ? $this->scale : $that->scale; @@ -443,8 +412,6 @@ public function quotientAndRemainder(BigNumber|int|float|string $that) : array * * @throws \InvalidArgumentException If the scale is negative. * @throws NegativeNumberException If this number is negative. - * - * @pure */ public function sqrt(int $scale) : BigDecimal { @@ -476,15 +443,13 @@ public function sqrt(int $scale) : BigDecimal $value = \substr($value, 0, $addDigits); } - $value = CalculatorRegistry::get()->sqrt($value); + $value = Calculator::get()->sqrt($value); return new BigDecimal($value, $scale); } /** * Returns a copy of this BigDecimal with the decimal point moved $n places to the left. - * - * @pure */ public function withPointMovedLeft(int $n) : BigDecimal { @@ -501,8 +466,6 @@ public function withPointMovedLeft(int $n) : BigDecimal /** * Returns a copy of this BigDecimal with the decimal point moved $n places to the right. - * - * @pure */ public function withPointMovedRight(int $n) : BigDecimal { @@ -529,8 +492,6 @@ public function withPointMovedRight(int $n) : BigDecimal /** * Returns a copy of this BigDecimal with any trailing zeros removed from the fractional part. - * - * @pure */ public function stripTrailingZeros() : BigDecimal { @@ -562,8 +523,6 @@ public function stripTrailingZeros() : BigDecimal /** * Returns the absolute value of this number. - * - * @pure */ public function abs() : BigDecimal { @@ -572,15 +531,12 @@ public function abs() : BigDecimal /** * Returns the negated value of this number. - * - * @pure */ public function negated() : BigDecimal { - return new BigDecimal(CalculatorRegistry::get()->neg($this->value), $this->scale); + return new BigDecimal(Calculator::get()->neg($this->value), $this->scale); } - #[Override] public function compareTo(BigNumber|int|float|string $that) : int { $that = BigNumber::of($that); @@ -592,69 +548,31 @@ public function compareTo(BigNumber|int|float|string $that) : int if ($that instanceof BigDecimal) { [$a, $b] = $this->scaleValues($this, $that); - return CalculatorRegistry::get()->cmp($a, $b); + return Calculator::get()->cmp($a, $b); } return - $that->compareTo($this); } - #[Override] public function getSign() : int { return ($this->value === '0') ? 0 : (($this->value[0] === '-') ? -1 : 1); } - /** - * @pure - */ public function getUnscaledValue() : BigInteger { return self::newBigInteger($this->value); } - /** - * @pure - */ public function getScale() : int { return $this->scale; } - /** - * Returns the number of significant digits in the number. - * - * This is the number of digits to both sides of the decimal point, stripped of leading zeros. - * The sign has no impact on the result. - * - * Examples: - * 0 => 0 - * 0.0 => 0 - * 123 => 3 - * 123.456 => 6 - * 0.00123 => 3 - * 0.0012300 => 5 - * - * @pure - */ - public function getPrecision(): int - { - $value = $this->value; - - if ($value === '0') { - return 0; - } - - $length = \strlen($value); - - return ($value[0] === '-') ? $length - 1 : $length; - } - /** * Returns a string representing the integral part of this decimal number. * * Example: `-123.456` => `-123`. - * - * @pure */ public function getIntegralPart() : string { @@ -673,8 +591,6 @@ public function getIntegralPart() : string * If the scale is zero, an empty string is returned. * * Examples: `-123.456` => '456', `123` => ''. - * - * @pure */ public function getFractionalPart() : string { @@ -689,15 +605,12 @@ public function getFractionalPart() : string /** * Returns whether this decimal number has a non-zero fractional part. - * - * @pure */ public function hasNonZeroFractionalPart() : bool { return $this->getFractionalPart() !== \str_repeat('0', $this->scale); } - #[Override] public function toBigInteger() : BigInteger { $zeroScaleDecimal = $this->scale === 0 ? $this : $this->dividedBy(1, 0); @@ -705,13 +618,11 @@ public function toBigInteger() : BigInteger return self::newBigInteger($zeroScaleDecimal->value); } - #[Override] public function toBigDecimal() : BigDecimal { return $this; } - #[Override] public function toBigRational() : BigRational { $numerator = self::newBigInteger($this->value); @@ -720,8 +631,7 @@ public function toBigRational() : BigRational return self::newBigRational($numerator, $denominator, false); } - #[Override] - public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal + public function toScale(int $scale, int $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal { if ($scale === $this->scale) { return $this; @@ -730,32 +640,24 @@ public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::U return $this->dividedBy(BigDecimal::one(), $scale, $roundingMode); } - #[Override] public function toInt() : int { return $this->toBigInteger()->toInt(); } - #[Override] public function toFloat() : float { return (float) (string) $this; } - /** - * @return numeric-string - */ - #[Override] public function __toString() : string { if ($this->scale === 0) { - /** @var numeric-string */ return $this->value; } $value = $this->getUnscaledValueWithLeadingZeros(); - /** @phpstan-ignore return.type */ return \substr($value, 0, -$this->scale) . '.' . \substr($value, -$this->scale); } @@ -775,6 +677,7 @@ public function __serialize(): array * This method is only here to allow unserializing the object and cannot be accessed directly. * * @internal + * @psalm-suppress RedundantPropertyInitializationCheck * * @param array{value: string, scale: int} $data * @@ -782,22 +685,48 @@ public function __serialize(): array */ public function __unserialize(array $data): void { - /** @phpstan-ignore isset.initializedProperty */ if (isset($this->value)) { throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); } - /** @phpstan-ignore deadCode.unreachable */ $this->value = $data['value']; $this->scale = $data['scale']; } + /** + * This method is required by interface Serializable and SHOULD NOT be accessed directly. + * + * @internal + */ + public function serialize() : string + { + return $this->value . ':' . $this->scale; + } + + /** + * This method is only here to implement interface Serializable and cannot be accessed directly. + * + * @internal + * @psalm-suppress RedundantPropertyInitializationCheck + * + * @throws \LogicException + */ + public function unserialize($value) : void + { + if (isset($this->value)) { + throw new \LogicException('unserialize() is an internal function, it must not be called directly.'); + } + + [$value, $scale] = \explode(':', $value); + + $this->value = $value; + $this->scale = (int) $scale; + } + /** * Puts the internal values of the given decimal numbers on the same scale. * * @return array{string, string} The scaled integer values of $x and $y. - * - * @pure */ private function scaleValues(BigDecimal $x, BigDecimal $y) : array { @@ -813,9 +742,6 @@ private function scaleValues(BigDecimal $x, BigDecimal $y) : array return [$a, $b]; } - /** - * @pure - */ private function valueWithMinScale(int $scale) : string { $value = $this->value; @@ -829,8 +755,6 @@ private function valueWithMinScale(int $scale) : string /** * Adds leading zeros if necessary to the unscaled value to represent the full decimal number. - * - * @pure */ private function getUnscaledValueWithLeadingZeros() : string { diff --git a/lib/Google/vendor/brick/math/src/BigInteger.php b/lib/Google/vendor/brick/math/src/BigInteger.php index 48a7bb3cf..435679331 100644 --- a/lib/Google/vendor/brick/math/src/BigInteger.php +++ b/lib/Google/vendor/brick/math/src/BigInteger.php @@ -10,16 +10,16 @@ use Brick\Math\Exception\NegativeNumberException; use Brick\Math\Exception\NumberFormatException; use Brick\Math\Internal\Calculator; -use Brick\Math\Internal\CalculatorRegistry; -use Override; /** * An arbitrary-size integer. * * All methods accepting a number as a parameter accept either a BigInteger instance, * an integer, or a string representing an arbitrary size integer. + * + * @psalm-immutable */ -final readonly class BigInteger extends BigNumber +final class BigInteger extends BigNumber { /** * The value, as a string of digits with optional leading minus sign. @@ -33,18 +33,22 @@ * Protected constructor. Use a factory method to obtain an instance. * * @param string $value A string of digits, with optional leading minus sign. - * - * @pure */ protected function __construct(string $value) { $this->value = $value; } - #[Override] - protected static function from(BigNumber $number): static + /** + * Creates a BigInteger of the given value. + * + * @throws MathException If the value cannot be converted to a BigInteger. + * + * @psalm-pure + */ + public static function of(BigNumber|int|float|string $value) : BigInteger { - return $number->toBigInteger(); + return parent::of($value)->toBigInteger(); } /** @@ -64,7 +68,7 @@ protected static function from(BigNumber $number): static * @throws NumberFormatException If the number is empty, or contains invalid chars for the given base. * @throws \InvalidArgumentException If the base is out of range. * - * @pure + * @psalm-pure */ public static function fromBase(string $number, int $base) : BigInteger { @@ -113,7 +117,7 @@ public static function fromBase(string $number, int $base) : BigInteger return new BigInteger($sign . $number); } - $result = CalculatorRegistry::get()->fromBase($number, $base); + $result = Calculator::get()->fromBase($number, $base); return new BigInteger($sign . $result); } @@ -129,7 +133,7 @@ public static function fromBase(string $number, int $base) : BigInteger * @throws NumberFormatException If the given number is empty or contains invalid chars for the given alphabet. * @throws \InvalidArgumentException If the alphabet does not contain at least 2 chars. * - * @pure + * @psalm-pure */ public static function fromArbitraryBase(string $number, string $alphabet) : BigInteger { @@ -149,7 +153,7 @@ public static function fromArbitraryBase(string $number, string $alphabet) : Big throw NumberFormatException::charNotInAlphabet($matches[0]); } - $number = CalculatorRegistry::get()->fromArbitraryBase($number, $alphabet, $base); + $number = Calculator::get()->fromArbitraryBase($number, $alphabet, $base); return new BigInteger($number); } @@ -170,8 +174,6 @@ public static function fromArbitraryBase(string $number, string $alphabet) : Big * sign bit. * * @throws NumberFormatException If the string is empty. - * - * @pure */ public static function fromBytes(string $value, bool $signed = true) : BigInteger { @@ -203,10 +205,12 @@ public static function fromBytes(string $value, bool $signed = true) : BigIntege * * Using the default random bytes generator, this method is suitable for cryptographic use. * - * @param int $numBits The number of bits. - * @param (callable(int): string)|null $randomBytesGenerator A function that accepts a number of bytes, and returns - * a string of random bytes of the given length. Defaults - * to the `random_bytes()` function. + * @psalm-param (callable(int): string)|null $randomBytesGenerator + * + * @param int $numBits The number of bits. + * @param callable|null $randomBytesGenerator A function that accepts a number of bytes as an integer, and returns a + * string of random bytes of the given length. Defaults to the + * `random_bytes()` function. * * @throws \InvalidArgumentException If $numBits is negative. */ @@ -221,10 +225,9 @@ public static function randomBits(int $numBits, ?callable $randomBytesGenerator } if ($randomBytesGenerator === null) { - $randomBytesGenerator = random_bytes(...); + $randomBytesGenerator = 'random_bytes'; } - /** @var int<1, max> $byteLength */ $byteLength = \intdiv($numBits - 1, 8) + 1; $extraBits = ($byteLength * 8 - $numBits); @@ -241,11 +244,13 @@ public static function randomBits(int $numBits, ?callable $randomBytesGenerator * * Using the default random bytes generator, this method is suitable for cryptographic use. * - * @param BigNumber|int|float|string $min The lower bound. Must be convertible to a BigInteger. - * @param BigNumber|int|float|string $max The upper bound. Must be convertible to a BigInteger. - * @param (callable(int): string)|null $randomBytesGenerator A function that accepts a number of bytes, and returns - * a string of random bytes of the given length. Defaults - * to the `random_bytes()` function. + * @psalm-param (callable(int): string)|null $randomBytesGenerator + * + * @param BigNumber|int|float|string $min The lower bound. Must be convertible to a BigInteger. + * @param BigNumber|int|float|string $max The upper bound. Must be convertible to a BigInteger. + * @param callable|null $randomBytesGenerator A function that accepts a number of bytes as an integer, + * and returns a string of random bytes of the given length. + * Defaults to the `random_bytes()` function. * * @throws MathException If one of the parameters cannot be converted to a BigInteger, * or `$min` is greater than `$max`. @@ -280,11 +285,14 @@ public static function randomRange( /** * Returns a BigInteger representing zero. * - * @pure + * @psalm-pure */ public static function zero() : BigInteger { - /** @var BigInteger|null $zero */ + /** + * @psalm-suppress ImpureStaticVariable + * @var BigInteger|null $zero + */ static $zero; if ($zero === null) { @@ -297,11 +305,14 @@ public static function zero() : BigInteger /** * Returns a BigInteger representing one. * - * @pure + * @psalm-pure */ public static function one() : BigInteger { - /** @var BigInteger|null $one */ + /** + * @psalm-suppress ImpureStaticVariable + * @var BigInteger|null $one + */ static $one; if ($one === null) { @@ -314,11 +325,14 @@ public static function one() : BigInteger /** * Returns a BigInteger representing ten. * - * @pure + * @psalm-pure */ public static function ten() : BigInteger { - /** @var BigInteger|null $ten */ + /** + * @psalm-suppress ImpureStaticVariable + * @var BigInteger|null $ten + */ static $ten; if ($ten === null) { @@ -328,9 +342,6 @@ public static function ten() : BigInteger return $ten; } - /** - * @pure - */ public static function gcdMultiple(BigInteger $a, BigInteger ...$n): BigInteger { $result = $a; @@ -352,8 +363,6 @@ public static function gcdMultiple(BigInteger $a, BigInteger ...$n): BigInteger * @param BigNumber|int|float|string $that The number to add. Must be convertible to a BigInteger. * * @throws MathException If the number is not valid, or is not convertible to a BigInteger. - * - * @pure */ public function plus(BigNumber|int|float|string $that) : BigInteger { @@ -367,7 +376,7 @@ public function plus(BigNumber|int|float|string $that) : BigInteger return $that; } - $value = CalculatorRegistry::get()->add($this->value, $that->value); + $value = Calculator::get()->add($this->value, $that->value); return new BigInteger($value); } @@ -378,8 +387,6 @@ public function plus(BigNumber|int|float|string $that) : BigInteger * @param BigNumber|int|float|string $that The number to subtract. Must be convertible to a BigInteger. * * @throws MathException If the number is not valid, or is not convertible to a BigInteger. - * - * @pure */ public function minus(BigNumber|int|float|string $that) : BigInteger { @@ -389,7 +396,7 @@ public function minus(BigNumber|int|float|string $that) : BigInteger return $this; } - $value = CalculatorRegistry::get()->sub($this->value, $that->value); + $value = Calculator::get()->sub($this->value, $that->value); return new BigInteger($value); } @@ -400,8 +407,6 @@ public function minus(BigNumber|int|float|string $that) : BigInteger * @param BigNumber|int|float|string $that The multiplier. Must be convertible to a BigInteger. * * @throws MathException If the multiplier is not a valid number, or is not convertible to a BigInteger. - * - * @pure */ public function multipliedBy(BigNumber|int|float|string $that) : BigInteger { @@ -415,7 +420,7 @@ public function multipliedBy(BigNumber|int|float|string $that) : BigInteger return $that; } - $value = CalculatorRegistry::get()->mul($this->value, $that->value); + $value = Calculator::get()->mul($this->value, $that->value); return new BigInteger($value); } @@ -424,14 +429,12 @@ public function multipliedBy(BigNumber|int|float|string $that) : BigInteger * Returns the result of the division of this number by the given one. * * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. - * @param RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY. + * @param int $roundingMode An optional rounding mode. * * @throws MathException If the divisor is not a valid number, is not convertible to a BigInteger, is zero, * or RoundingMode::UNNECESSARY is used and the remainder is not zero. - * - * @pure */ - public function dividedBy(BigNumber|int|float|string $that, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigInteger + public function dividedBy(BigNumber|int|float|string $that, int $roundingMode = RoundingMode::UNNECESSARY) : BigInteger { $that = BigInteger::of($that); @@ -443,40 +446,15 @@ public function dividedBy(BigNumber|int|float|string $that, RoundingMode $roundi throw DivisionByZeroException::divisionByZero(); } - $result = CalculatorRegistry::get()->divRound($this->value, $that->value, $roundingMode); + $result = Calculator::get()->divRound($this->value, $that->value, $roundingMode); return new BigInteger($result); } - /** - * Limits (clamps) this number between the given minimum and maximum values. - * - * If the number is lower than $min, returns a copy of $min. - * If the number is greater than $max, returns a copy of $max. - * Otherwise, returns this number unchanged. - * - * @param BigNumber|int|float|string $min The minimum. Must be convertible to a BigInteger. - * @param BigNumber|int|float|string $max The maximum. Must be convertible to a BigInteger. - * - * @throws MathException If min/max are not convertible to a BigInteger. - */ - public function clamp(BigNumber|int|float|string $min, BigNumber|int|float|string $max) : BigInteger - { - if ($this->isLessThan($min)) { - return BigInteger::of($min); - } elseif ($this->isGreaterThan($max)) { - return BigInteger::of($max); - } - return $this; - } - - /** * Returns this number exponentiated to the given value. * * @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000. - * - * @pure */ public function power(int $exponent) : BigInteger { @@ -496,7 +474,7 @@ public function power(int $exponent) : BigInteger )); } - return new BigInteger(CalculatorRegistry::get()->pow($this->value, $exponent)); + return new BigInteger(Calculator::get()->pow($this->value, $exponent)); } /** @@ -505,8 +483,6 @@ public function power(int $exponent) : BigInteger * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. * * @throws DivisionByZeroException If the divisor is zero. - * - * @pure */ public function quotient(BigNumber|int|float|string $that) : BigInteger { @@ -520,7 +496,7 @@ public function quotient(BigNumber|int|float|string $that) : BigInteger throw DivisionByZeroException::divisionByZero(); } - $quotient = CalculatorRegistry::get()->divQ($this->value, $that->value); + $quotient = Calculator::get()->divQ($this->value, $that->value); return new BigInteger($quotient); } @@ -533,8 +509,6 @@ public function quotient(BigNumber|int|float|string $that) : BigInteger * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. * * @throws DivisionByZeroException If the divisor is zero. - * - * @pure */ public function remainder(BigNumber|int|float|string $that) : BigInteger { @@ -548,7 +522,7 @@ public function remainder(BigNumber|int|float|string $that) : BigInteger throw DivisionByZeroException::divisionByZero(); } - $remainder = CalculatorRegistry::get()->divR($this->value, $that->value); + $remainder = Calculator::get()->divR($this->value, $that->value); return new BigInteger($remainder); } @@ -558,11 +532,9 @@ public function remainder(BigNumber|int|float|string $that) : BigInteger * * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. * - * @return array{BigInteger, BigInteger} An array containing the quotient and the remainder. + * @return BigInteger[] An array containing the quotient and the remainder. * * @throws DivisionByZeroException If the divisor is zero. - * - * @pure */ public function quotientAndRemainder(BigNumber|int|float|string $that) : array { @@ -572,7 +544,7 @@ public function quotientAndRemainder(BigNumber|int|float|string $that) : array throw DivisionByZeroException::divisionByZero(); } - [$quotient, $remainder] = CalculatorRegistry::get()->divQR($this->value, $that->value); + [$quotient, $remainder] = Calculator::get()->divQR($this->value, $that->value); return [ new BigInteger($quotient), @@ -591,8 +563,6 @@ public function quotientAndRemainder(BigNumber|int|float|string $that) : array * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. * * @throws DivisionByZeroException If the divisor is zero. - * - * @pure */ public function mod(BigNumber|int|float|string $that) : BigInteger { @@ -602,7 +572,7 @@ public function mod(BigNumber|int|float|string $that) : BigInteger throw DivisionByZeroException::modulusMustNotBeZero(); } - $value = CalculatorRegistry::get()->mod($this->value, $that->value); + $value = Calculator::get()->mod($this->value, $that->value); return new BigInteger($value); } @@ -614,8 +584,6 @@ public function mod(BigNumber|int|float|string $that) : BigInteger * @throws NegativeNumberException If $m is negative. * @throws MathException If this BigInteger has no multiplicative inverse mod m (that is, this BigInteger * is not relatively prime to m). - * - * @pure */ public function modInverse(BigInteger $m) : BigInteger { @@ -631,7 +599,7 @@ public function modInverse(BigInteger $m) : BigInteger return BigInteger::zero(); } - $value = CalculatorRegistry::get()->modInverse($this->value, $m->value); + $value = Calculator::get()->modInverse($this->value, $m->value); if ($value === null) { throw new MathException('Unable to compute the modInverse for the given modulus.'); @@ -650,8 +618,6 @@ public function modInverse(BigInteger $m) : BigInteger * * @throws NegativeNumberException If any of the operands is negative. * @throws DivisionByZeroException If the modulus is zero. - * - * @pure */ public function modPow(BigNumber|int|float|string $exp, BigNumber|int|float|string $mod) : BigInteger { @@ -666,7 +632,7 @@ public function modPow(BigNumber|int|float|string $exp, BigNumber|int|float|stri throw DivisionByZeroException::modulusMustNotBeZero(); } - $result = CalculatorRegistry::get()->modPow($this->value, $exp->value, $mod->value); + $result = Calculator::get()->modPow($this->value, $exp->value, $mod->value); return new BigInteger($result); } @@ -677,8 +643,6 @@ public function modPow(BigNumber|int|float|string $exp, BigNumber|int|float|stri * The GCD is always positive, unless both operands are zero, in which case it is zero. * * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. - * - * @pure */ public function gcd(BigNumber|int|float|string $that) : BigInteger { @@ -692,7 +656,7 @@ public function gcd(BigNumber|int|float|string $that) : BigInteger return $that; } - $value = CalculatorRegistry::get()->gcd($this->value, $that->value); + $value = Calculator::get()->gcd($this->value, $that->value); return new BigInteger($value); } @@ -703,8 +667,6 @@ public function gcd(BigNumber|int|float|string $that) : BigInteger * The result is the largest x such that x² ≤ n. * * @throws NegativeNumberException If this number is negative. - * - * @pure */ public function sqrt() : BigInteger { @@ -712,15 +674,13 @@ public function sqrt() : BigInteger throw new NegativeNumberException('Cannot calculate the square root of a negative number.'); } - $value = CalculatorRegistry::get()->sqrt($this->value); + $value = Calculator::get()->sqrt($this->value); return new BigInteger($value); } /** * Returns the absolute value of this number. - * - * @pure */ public function abs() : BigInteger { @@ -729,12 +689,10 @@ public function abs() : BigInteger /** * Returns the inverse of this number. - * - * @pure */ public function negated() : BigInteger { - return new BigInteger(CalculatorRegistry::get()->neg($this->value)); + return new BigInteger(Calculator::get()->neg($this->value)); } /** @@ -743,14 +701,12 @@ public function negated() : BigInteger * This method returns a negative BigInteger if and only if both operands are negative. * * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. - * - * @pure */ public function and(BigNumber|int|float|string $that) : BigInteger { $that = BigInteger::of($that); - return new BigInteger(CalculatorRegistry::get()->and($this->value, $that->value)); + return new BigInteger(Calculator::get()->and($this->value, $that->value)); } /** @@ -759,14 +715,12 @@ public function and(BigNumber|int|float|string $that) : BigInteger * This method returns a negative BigInteger if and only if either of the operands is negative. * * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. - * - * @pure */ public function or(BigNumber|int|float|string $that) : BigInteger { $that = BigInteger::of($that); - return new BigInteger(CalculatorRegistry::get()->or($this->value, $that->value)); + return new BigInteger(Calculator::get()->or($this->value, $that->value)); } /** @@ -775,20 +729,16 @@ public function or(BigNumber|int|float|string $that) : BigInteger * This method returns a negative BigInteger if and only if exactly one of the operands is negative. * * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. - * - * @pure */ public function xor(BigNumber|int|float|string $that) : BigInteger { $that = BigInteger::of($that); - return new BigInteger(CalculatorRegistry::get()->xor($this->value, $that->value)); + return new BigInteger(Calculator::get()->xor($this->value, $that->value)); } /** * Returns the bitwise-not of this BigInteger. - * - * @pure */ public function not() : BigInteger { @@ -797,8 +747,6 @@ public function not() : BigInteger /** * Returns the integer left shifted by a given number of bits. - * - * @pure */ public function shiftedLeft(int $distance) : BigInteger { @@ -815,8 +763,6 @@ public function shiftedLeft(int $distance) : BigInteger /** * Returns the integer right shifted by a given number of bits. - * - * @pure */ public function shiftedRight(int $distance) : BigInteger { @@ -842,8 +788,6 @@ public function shiftedRight(int $distance) : BigInteger * * For positive BigIntegers, this is equivalent to the number of bits in the ordinary binary representation. * Computes (ceil(log2(this < 0 ? -this : this+1))). - * - * @pure */ public function getBitLength() : int { @@ -862,8 +806,6 @@ public function getBitLength() : int * Returns the index of the rightmost (lowest-order) one bit in this BigInteger. * * Returns -1 if this BigInteger contains no one bits. - * - * @pure */ public function getLowestSetBit() : int { @@ -883,8 +825,6 @@ public function getLowestSetBit() : int /** * Returns whether this number is even. - * - * @pure */ public function isEven() : bool { @@ -893,8 +833,6 @@ public function isEven() : bool /** * Returns whether this number is odd. - * - * @pure */ public function isOdd() : bool { @@ -909,8 +847,6 @@ public function isOdd() : bool * @param int $n The bit to test, 0-based. * * @throws \InvalidArgumentException If the bit to test is negative. - * - * @pure */ public function testBit(int $n) : bool { @@ -921,49 +857,42 @@ public function testBit(int $n) : bool return $this->shiftedRight($n)->isOdd(); } - #[Override] public function compareTo(BigNumber|int|float|string $that) : int { $that = BigNumber::of($that); if ($that instanceof BigInteger) { - return CalculatorRegistry::get()->cmp($this->value, $that->value); + return Calculator::get()->cmp($this->value, $that->value); } return - $that->compareTo($this); } - #[Override] public function getSign() : int { return ($this->value === '0') ? 0 : (($this->value[0] === '-') ? -1 : 1); } - #[Override] public function toBigInteger() : BigInteger { return $this; } - #[Override] public function toBigDecimal() : BigDecimal { return self::newBigDecimal($this->value); } - #[Override] public function toBigRational() : BigRational { return self::newBigRational($this, BigInteger::one(), false); } - #[Override] - public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal + public function toScale(int $scale, int $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal { return $this->toBigDecimal()->toScale($scale, $roundingMode); } - #[Override] public function toInt() : int { $intValue = (int) $this->value; @@ -975,7 +904,6 @@ public function toInt() : int return $intValue; } - #[Override] public function toFloat() : float { return (float) $this->value; @@ -987,8 +915,6 @@ public function toFloat() : float * The output will always be lowercase for bases greater than 10. * * @throws \InvalidArgumentException If the base is out of range. - * - * @pure */ public function toBase(int $base) : string { @@ -1000,7 +926,7 @@ public function toBase(int $base) : string throw new \InvalidArgumentException(\sprintf('Base %d is out of range [2, 36]', $base)); } - return CalculatorRegistry::get()->toBase($this->value, $base); + return Calculator::get()->toBase($this->value, $base); } /** @@ -1013,8 +939,6 @@ public function toBase(int $base) : string * * @throws NegativeNumberException If this number is negative. * @throws \InvalidArgumentException If the given alphabet does not contain at least 2 chars. - * - * @pure */ public function toArbitraryBase(string $alphabet) : string { @@ -1028,7 +952,7 @@ public function toArbitraryBase(string $alphabet) : string throw new NegativeNumberException(__FUNCTION__ . '() does not support negative numbers.'); } - return CalculatorRegistry::get()->toArbitraryBase($this->value, $alphabet, $base); + return Calculator::get()->toArbitraryBase($this->value, $alphabet, $base); } /** @@ -1048,8 +972,6 @@ public function toArbitraryBase(string $alphabet) : string * @param bool $signed Whether to output a signed number in two's-complement representation with a leading sign bit. * * @throws NegativeNumberException If $signed is false, and the number is negative. - * - * @pure */ public function toBytes(bool $signed = true) : string { @@ -1089,19 +1011,11 @@ public function toBytes(bool $signed = true) : string } } - $result = \hex2bin($hex); - assert($result !== false); - - return $result; + return \hex2bin($hex); } - /** - * @return numeric-string - */ - #[Override] public function __toString() : string { - /** @var numeric-string */ return $this->value; } @@ -1121,6 +1035,7 @@ public function __serialize(): array * This method is only here to allow unserializing the object and cannot be accessed directly. * * @internal + * @psalm-suppress RedundantPropertyInitializationCheck * * @param array{value: string} $data * @@ -1128,12 +1043,37 @@ public function __serialize(): array */ public function __unserialize(array $data): void { - /** @phpstan-ignore isset.initializedProperty */ if (isset($this->value)) { throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); } - /** @phpstan-ignore deadCode.unreachable */ $this->value = $data['value']; } + + /** + * This method is required by interface Serializable and SHOULD NOT be accessed directly. + * + * @internal + */ + public function serialize() : string + { + return $this->value; + } + + /** + * This method is only here to implement interface Serializable and cannot be accessed directly. + * + * @internal + * @psalm-suppress RedundantPropertyInitializationCheck + * + * @throws \LogicException + */ + public function unserialize($value) : void + { + if (isset($this->value)) { + throw new \LogicException('unserialize() is an internal function, it must not be called directly.'); + } + + $this->value = $value; + } } diff --git a/lib/Google/vendor/brick/math/src/BigNumber.php b/lib/Google/vendor/brick/math/src/BigNumber.php index 2fbdf696e..80146d207 100644 --- a/lib/Google/vendor/brick/math/src/BigNumber.php +++ b/lib/Google/vendor/brick/math/src/BigNumber.php @@ -8,46 +8,38 @@ use Brick\Math\Exception\MathException; use Brick\Math\Exception\NumberFormatException; use Brick\Math\Exception\RoundingNecessaryException; -use Override; /** - * Base class for arbitrary-precision numbers. + * Common interface for arbitrary-precision rational numbers. * - * This class is sealed: it is part of the public API but should not be subclassed in userland. - * Protected methods may change in any version. - * - * @phpstan-sealed BigInteger|BigDecimal|BigRational + * @psalm-immutable */ -abstract readonly class BigNumber implements \JsonSerializable, \Stringable +abstract class BigNumber implements \Serializable, \JsonSerializable { /** - * The regular expression used to parse integer or decimal numbers. + * The regular expression used to parse integer, decimal and rational numbers. */ - private const PARSE_REGEXP_NUMERICAL = + private const PARSE_REGEXP = '/^' . '(?[\-\+])?' . - '(?[0-9]+)?' . - '(?\.)?' . - '(?[0-9]+)?' . - '(?:[eE](?[\-\+]?[0-9]+))?' . - '$/'; - - /** - * The regular expression used to parse rational numbers. - */ - private const PARSE_REGEXP_RATIONAL = - '/^' . - '(?[\-\+])?' . - '(?[0-9]+)' . - '\/?' . - '(?[0-9]+)' . + '(?:' . + '(?:' . + '(?[0-9]+)?' . + '(?\.)?' . + '(?[0-9]+)?' . + '(?:[eE](?[\-\+]?[0-9]+))?' . + ')|(?:' . + '(?[0-9]+)' . + '\/?' . + '(?[0-9]+)' . + ')' . + ')' . '$/'; /** * Creates a BigNumber of the given value. * - * When of() is called on BigNumber, the concrete return type is dependent on the given value, with the following - * rules: + * The concrete return type is dependent on the given value, with the following rules: * * - BigNumber instances are returned as is * - integer numbers are returned as BigInteger @@ -56,35 +48,12 @@ * - strings containing a `.` character or using an exponential notation are returned as BigDecimal * - strings containing only digits with an optional leading `+` or `-` sign are returned as BigInteger * - * When of() is called on BigInteger, BigDecimal, or BigRational, the resulting number is converted to an instance - * of the subclass when possible; otherwise a RoundingNecessaryException exception is thrown. - * - * @throws NumberFormatException If the format of the number is not valid. + * @throws NumberFormatException If the format of the number is not valid. * @throws DivisionByZeroException If the value represents a rational number with a denominator of zero. - * @throws RoundingNecessaryException If the value cannot be converted to an instance of the subclass without rounding. * - * @pure + * @psalm-pure */ - final public static function of(BigNumber|int|float|string $value) : static - { - $value = self::_of($value); - - if (static::class === BigNumber::class) { - assert($value instanceof static); - - return $value; - } - - return static::from($value); - } - - /** - * @throws NumberFormatException If the format of the number is not valid. - * @throws DivisionByZeroException If the value represents a rational number with a denominator of zero. - * - * @pure - */ - private static function _of(BigNumber|int|float|string $value) : BigNumber + public static function of(BigNumber|int|float|string $value) : BigNumber { if ($value instanceof BigNumber) { return $value; @@ -94,22 +63,34 @@ private static function _of(BigNumber|int|float|string $value) : BigNumber return new BigInteger((string) $value); } - if (is_float($value)) { - $value = (string) $value; + $value = \is_float($value) ? self::floatToString($value) : $value; + + $throw = static function() use ($value) : void { + throw new NumberFormatException(\sprintf( + 'The given value "%s" does not represent a valid number.', + $value + )); + }; + + if (\preg_match(self::PARSE_REGEXP, $value, $matches) !== 1) { + $throw(); } - if (str_contains($value, '/')) { - // Rational number - if (\preg_match(self::PARSE_REGEXP_RATIONAL, $value, $matches, PREG_UNMATCHED_AS_NULL) !== 1) { - throw NumberFormatException::invalidFormat($value); - } + $getMatch = static fn(string $value): ?string => (($matches[$value] ?? '') !== '') ? $matches[$value] : null; + + $sign = $getMatch('sign'); + $numerator = $getMatch('numerator'); + $denominator = $getMatch('denominator'); - $sign = $matches['sign']; - $numerator = $matches['numerator']; - $denominator = $matches['denominator']; + if ($numerator !== null) { + assert($denominator !== null); + + if ($sign !== null) { + $numerator = $sign . $numerator; + } - $numerator = self::cleanUp($sign, $numerator); - $denominator = self::cleanUp(null, $denominator); + $numerator = self::cleanUp($numerator); + $denominator = self::cleanUp($denominator); if ($denominator === '0') { throw DivisionByZeroException::denominatorMustNotBeZero(); @@ -120,70 +101,75 @@ private static function _of(BigNumber|int|float|string $value) : BigNumber new BigInteger($denominator), false ); - } else { - // Integer or decimal number - if (\preg_match(self::PARSE_REGEXP_NUMERICAL, $value, $matches, PREG_UNMATCHED_AS_NULL) !== 1) { - throw NumberFormatException::invalidFormat($value); - } + } - $sign = $matches['sign']; - $point = $matches['point']; - $integral = $matches['integral']; - $fractional = $matches['fractional']; - $exponent = $matches['exponent']; + $point = $getMatch('point'); + $integral = $getMatch('integral'); + $fractional = $getMatch('fractional'); + $exponent = $getMatch('exponent'); - if ($integral === null && $fractional === null) { - throw NumberFormatException::invalidFormat($value); - } + if ($integral === null && $fractional === null) { + $throw(); + } - if ($integral === null) { - $integral = '0'; - } + if ($integral === null) { + $integral = '0'; + } - if ($point !== null || $exponent !== null) { - $fractional ??= ''; - $exponent = ($exponent !== null) ? (int)$exponent : 0; + if ($point !== null || $exponent !== null) { + $fractional = ($fractional ?? ''); + $exponent = ($exponent !== null) ? (int) $exponent : 0; - if ($exponent === PHP_INT_MIN || $exponent === PHP_INT_MAX) { - throw new NumberFormatException('Exponent too large.'); - } + if ($exponent === PHP_INT_MIN || $exponent === PHP_INT_MAX) { + throw new NumberFormatException('Exponent too large.'); + } - $unscaledValue = self::cleanUp($sign, $integral . $fractional); + $unscaledValue = self::cleanUp(($sign ?? ''). $integral . $fractional); - $scale = \strlen($fractional) - $exponent; + $scale = \strlen($fractional) - $exponent; - if ($scale < 0) { - if ($unscaledValue !== '0') { - $unscaledValue .= \str_repeat('0', -$scale); - } - $scale = 0; + if ($scale < 0) { + if ($unscaledValue !== '0') { + $unscaledValue .= \str_repeat('0', - $scale); } - - return new BigDecimal($unscaledValue, $scale); + $scale = 0; } - $integral = self::cleanUp($sign, $integral); - - return new BigInteger($integral); + return new BigDecimal($unscaledValue, $scale); } + + $integral = self::cleanUp(($sign ?? '') . $integral); + + return new BigInteger($integral); } /** - * Overridden by subclasses to convert a BigNumber to an instance of the subclass. + * Safely converts float to string, avoiding locale-dependent issues. * - * @throws RoundingNecessaryException If the value cannot be converted. + * @see https://github.com/brick/math/pull/20 * - * @pure + * @psalm-pure + * @psalm-suppress ImpureFunctionCall */ - abstract protected static function from(BigNumber $number): static; + private static function floatToString(float $float) : string + { + $currentLocale = \setlocale(LC_NUMERIC, '0'); + \setlocale(LC_NUMERIC, 'C'); + + $result = (string) $float; + + \setlocale(LC_NUMERIC, $currentLocale); + + return $result; + } /** * Proxy method to access BigInteger's protected constructor from sibling classes. * - * @pure * @internal + * @psalm-pure */ - final protected function newBigInteger(string $value) : BigInteger + protected function newBigInteger(string $value) : BigInteger { return new BigInteger($value); } @@ -191,10 +177,10 @@ final protected function newBigInteger(string $value) : BigInteger /** * Proxy method to access BigDecimal's protected constructor from sibling classes. * - * @pure * @internal + * @psalm-pure */ - final protected function newBigDecimal(string $value, int $scale = 0) : BigDecimal + protected function newBigDecimal(string $value, int $scale = 0) : BigDecimal { return new BigDecimal($value, $scale); } @@ -202,10 +188,10 @@ final protected function newBigDecimal(string $value, int $scale = 0) : BigDecim /** * Proxy method to access BigRational's protected constructor from sibling classes. * - * @pure * @internal + * @psalm-pure */ - final protected function newBigRational(BigInteger $numerator, BigInteger $denominator, bool $checkDenominator) : BigRational + protected function newBigRational(BigInteger $numerator, BigInteger $denominator, bool $checkDenominator) : BigRational { return new BigRational($numerator, $denominator, $checkDenominator); } @@ -219,9 +205,11 @@ final protected function newBigRational(BigInteger $numerator, BigInteger $denom * @throws \InvalidArgumentException If no values are given. * @throws MathException If an argument is not valid. * - * @pure + * @psalm-suppress LessSpecificReturnStatement + * @psalm-suppress MoreSpecificReturnType + * @psalm-pure */ - final public static function min(BigNumber|int|float|string ...$values) : static + public static function min(BigNumber|int|float|string ...$values) : static { $min = null; @@ -249,9 +237,11 @@ final public static function min(BigNumber|int|float|string ...$values) : static * @throws \InvalidArgumentException If no values are given. * @throws MathException If an argument is not valid. * - * @pure + * @psalm-suppress LessSpecificReturnStatement + * @psalm-suppress MoreSpecificReturnType + * @psalm-pure */ - final public static function max(BigNumber|int|float|string ...$values) : static + public static function max(BigNumber|int|float|string ...$values) : static { $max = null; @@ -273,35 +263,28 @@ final public static function max(BigNumber|int|float|string ...$values) : static /** * Returns the sum of the given values. * - * When called on BigNumber, sum() accepts any supported type and returns a result whose type is the widest among - * the given values (BigInteger < BigDecimal < BigRational). - * - * When called on BigInteger, BigDecimal, or BigRational, sum() requires that all values can be converted to that - * specific subclass, and returns a result of the same type. - * - * @param BigNumber|int|float|string ...$values The values to add. All values must be convertible to the class on - * which this method is called. + * @param BigNumber|int|float|string ...$values The numbers to add. All the numbers need to be convertible + * to an instance of the class this method is called on. * * @throws \InvalidArgumentException If no values are given. * @throws MathException If an argument is not valid. * - * @pure + * @psalm-pure */ - final public static function sum(BigNumber|int|float|string ...$values) : static + public static function sum(BigNumber|int|float|string ...$values) : static { - $first = array_shift($values); - - if ($first === null) { - throw new \InvalidArgumentException(__METHOD__ . '() expects at least one value.'); - } - - $sum = static::of($first); + /** @var static|null $sum */ + $sum = null; foreach ($values as $value) { - $sum = self::add($sum, static::of($value)); + $value = static::of($value); + + $sum = $sum === null ? $value : self::add($sum, $value); } - assert($sum instanceof static); + if ($sum === null) { + throw new \InvalidArgumentException(__METHOD__ . '() expects at least one value.'); + } return $sum; } @@ -309,7 +292,12 @@ final public static function sum(BigNumber|int|float|string ...$values) : static /** * Adds two BigNumber instances in the correct order to avoid a RoundingNecessaryException. * - * @pure + * @todo This could be better resolved by creating an abstract protected method in BigNumber, and leaving to + * concrete classes the responsibility to perform the addition themselves or delegate it to the given number, + * depending on their ability to perform the operation. This will also require a version bump because we're + * potentially breaking custom BigNumber implementations (if any...) + * + * @psalm-pure */ private static function add(BigNumber $a, BigNumber $b) : BigNumber { @@ -329,124 +317,115 @@ private static function add(BigNumber $a, BigNumber $b) : BigNumber return $b->plus($a); } + /** @var BigInteger $a */ + return $a->plus($b); } /** - * Removes optional leading zeros and applies sign. + * Removes optional leading zeros and + sign from the given number. * - * @param string|null $sign The sign, '+' or '-', optional. Null is allowed for convenience and treated as '+'. - * @param string $number The number, validated as a string of digits. + * @param string $number The number, validated as a non-empty string of digits with optional leading sign. * - * @pure + * @psalm-pure */ - private static function cleanUp(string|null $sign, string $number) : string + private static function cleanUp(string $number) : string { + $firstChar = $number[0]; + + if ($firstChar === '+' || $firstChar === '-') { + $number = \substr($number, 1); + } + $number = \ltrim($number, '0'); if ($number === '') { return '0'; } - return $sign === '-' ? '-' . $number : $number; + if ($firstChar === '-') { + return '-' . $number; + } + + return $number; } /** * Checks if this number is equal to the given one. - * - * @pure */ - final public function isEqualTo(BigNumber|int|float|string $that) : bool + public function isEqualTo(BigNumber|int|float|string $that) : bool { return $this->compareTo($that) === 0; } /** * Checks if this number is strictly lower than the given one. - * - * @pure */ - final public function isLessThan(BigNumber|int|float|string $that) : bool + public function isLessThan(BigNumber|int|float|string $that) : bool { return $this->compareTo($that) < 0; } /** * Checks if this number is lower than or equal to the given one. - * - * @pure */ - final public function isLessThanOrEqualTo(BigNumber|int|float|string $that) : bool + public function isLessThanOrEqualTo(BigNumber|int|float|string $that) : bool { return $this->compareTo($that) <= 0; } /** * Checks if this number is strictly greater than the given one. - * - * @pure */ - final public function isGreaterThan(BigNumber|int|float|string $that) : bool + public function isGreaterThan(BigNumber|int|float|string $that) : bool { return $this->compareTo($that) > 0; } /** * Checks if this number is greater than or equal to the given one. - * - * @pure */ - final public function isGreaterThanOrEqualTo(BigNumber|int|float|string $that) : bool + public function isGreaterThanOrEqualTo(BigNumber|int|float|string $that) : bool { return $this->compareTo($that) >= 0; } /** * Checks if this number equals zero. - * - * @pure */ - final public function isZero() : bool + public function isZero() : bool { return $this->getSign() === 0; } /** * Checks if this number is strictly negative. - * - * @pure */ - final public function isNegative() : bool + public function isNegative() : bool { return $this->getSign() < 0; } /** * Checks if this number is negative or zero. - * - * @pure */ - final public function isNegativeOrZero() : bool + public function isNegativeOrZero() : bool { return $this->getSign() <= 0; } /** * Checks if this number is strictly positive. - * - * @pure */ - final public function isPositive() : bool + public function isPositive() : bool { return $this->getSign() > 0; } /** * Checks if this number is positive or zero. - * - * @pure */ - final public function isPositiveOrZero() : bool + public function isPositiveOrZero() : bool { return $this->getSign() >= 0; } @@ -454,24 +433,16 @@ final public function isPositiveOrZero() : bool /** * Returns the sign of this number. * - * Returns -1 if the number is negative, 0 if zero, 1 if positive. - * - * @return -1|0|1 - * - * @pure + * @return int -1 if the number is negative, 0 if zero, 1 if positive. */ abstract public function getSign() : int; /** * Compares this number to the given one. * - * Returns -1 if `$this` is lower than, 0 if equal to, 1 if greater than `$that`. - * - * @return -1|0|1 + * @return int [-1,0,1] If `$this` is lower than, equal to, or greater than `$that`. * * @throws MathException If the number is not valid. - * - * @pure */ abstract public function compareTo(BigNumber|int|float|string $that) : int; @@ -479,8 +450,6 @@ abstract public function compareTo(BigNumber|int|float|string $that) : int; * Converts this number to a BigInteger. * * @throws RoundingNecessaryException If this number cannot be converted to a BigInteger without rounding. - * - * @pure */ abstract public function toBigInteger() : BigInteger; @@ -488,30 +457,24 @@ abstract public function toBigInteger() : BigInteger; * Converts this number to a BigDecimal. * * @throws RoundingNecessaryException If this number cannot be converted to a BigDecimal without rounding. - * - * @pure */ abstract public function toBigDecimal() : BigDecimal; /** * Converts this number to a BigRational. - * - * @pure */ abstract public function toBigRational() : BigRational; /** * Converts this number to a BigDecimal with the given scale, using rounding if necessary. * - * @param int $scale The scale of the resulting `BigDecimal`. - * @param RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY. + * @param int $scale The scale of the resulting `BigDecimal`. + * @param int $roundingMode A `RoundingMode` constant. * * @throws RoundingNecessaryException If this number cannot be converted to the given scale without rounding. * This only applies when RoundingMode::UNNECESSARY is used. - * - * @pure */ - abstract public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal; + abstract public function toScale(int $scale, int $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal; /** * Returns the exact value of this number as a native integer. @@ -520,8 +483,6 @@ abstract public function toScale(int $scale, RoundingMode $roundingMode = Roundi * Note that the acceptable range for an integer depends on the platform and differs for 32-bit and 64-bit. * * @throws MathException If this number cannot be exactly converted to a native integer. - * - * @pure */ abstract public function toInt() : int; @@ -533,8 +494,6 @@ abstract public function toInt() : int; * * If the number is greater than the largest representable floating point number, positive infinity is returned. * If the number is less than the smallest representable floating point number, negative infinity is returned. - * - * @pure */ abstract public function toFloat() : float; @@ -543,13 +502,10 @@ abstract public function toFloat() : float; * * The output of this method can be parsed by the `of()` factory method; * this will yield an object equal to this one, without any information loss. - * - * @pure */ abstract public function __toString() : string; - #[Override] - final public function jsonSerialize() : string + public function jsonSerialize() : string { return $this->__toString(); } diff --git a/lib/Google/vendor/brick/math/src/BigRational.php b/lib/Google/vendor/brick/math/src/BigRational.php index 56045e537..31f2904fa 100644 --- a/lib/Google/vendor/brick/math/src/BigRational.php +++ b/lib/Google/vendor/brick/math/src/BigRational.php @@ -8,14 +8,15 @@ use Brick\Math\Exception\MathException; use Brick\Math\Exception\NumberFormatException; use Brick\Math\Exception\RoundingNecessaryException; -use Override; /** * An arbitrarily large rational number. * * This class is immutable. + * + * @psalm-immutable */ -final readonly class BigRational extends BigNumber +final class BigRational extends BigNumber { /** * The numerator. @@ -35,8 +36,6 @@ * @param bool $checkDenominator Whether to check the denominator for negative and zero. * * @throws DivisionByZeroException If the denominator is zero. - * - * @pure */ protected function __construct(BigInteger $numerator, BigInteger $denominator, bool $checkDenominator) { @@ -55,10 +54,16 @@ protected function __construct(BigInteger $numerator, BigInteger $denominator, b $this->denominator = $denominator; } - #[Override] - protected static function from(BigNumber $number): static + /** + * Creates a BigRational of the given value. + * + * @throws MathException If the value cannot be converted to a BigRational. + * + * @psalm-pure + */ + public static function of(BigNumber|int|float|string $value) : BigRational { - return $number->toBigRational(); + return parent::of($value)->toBigRational(); } /** @@ -74,7 +79,7 @@ protected static function from(BigNumber $number): static * @throws RoundingNecessaryException If an argument represents a non-integer number. * @throws DivisionByZeroException If the denominator is zero. * - * @pure + * @psalm-pure */ public static function nd( BigNumber|int|float|string $numerator, @@ -89,11 +94,14 @@ public static function nd( /** * Returns a BigRational representing zero. * - * @pure + * @psalm-pure */ public static function zero() : BigRational { - /** @var BigRational|null $zero */ + /** + * @psalm-suppress ImpureStaticVariable + * @var BigRational|null $zero + */ static $zero; if ($zero === null) { @@ -106,11 +114,14 @@ public static function zero() : BigRational /** * Returns a BigRational representing one. * - * @pure + * @psalm-pure */ public static function one() : BigRational { - /** @var BigRational|null $one */ + /** + * @psalm-suppress ImpureStaticVariable + * @var BigRational|null $one + */ static $one; if ($one === null) { @@ -123,11 +134,14 @@ public static function one() : BigRational /** * Returns a BigRational representing ten. * - * @pure + * @psalm-pure */ public static function ten() : BigRational { - /** @var BigRational|null $ten */ + /** + * @psalm-suppress ImpureStaticVariable + * @var BigRational|null $ten + */ static $ten; if ($ten === null) { @@ -137,17 +151,11 @@ public static function ten() : BigRational return $ten; } - /** - * @pure - */ public function getNumerator() : BigInteger { return $this->numerator; } - /** - * @pure - */ public function getDenominator() : BigInteger { return $this->denominator; @@ -155,8 +163,6 @@ public function getDenominator() : BigInteger /** * Returns the quotient of the division of the numerator by the denominator. - * - * @pure */ public function quotient() : BigInteger { @@ -165,8 +171,6 @@ public function quotient() : BigInteger /** * Returns the remainder of the division of the numerator by the denominator. - * - * @pure */ public function remainder() : BigInteger { @@ -176,9 +180,7 @@ public function remainder() : BigInteger /** * Returns the quotient and remainder of the division of the numerator by the denominator. * - * @return array{BigInteger, BigInteger} - * - * @pure + * @return BigInteger[] */ public function quotientAndRemainder() : array { @@ -191,8 +193,6 @@ public function quotientAndRemainder() : array * @param BigNumber|int|float|string $that The number to add. * * @throws MathException If the number is not valid. - * - * @pure */ public function plus(BigNumber|int|float|string $that) : BigRational { @@ -211,8 +211,6 @@ public function plus(BigNumber|int|float|string $that) : BigRational * @param BigNumber|int|float|string $that The number to subtract. * * @throws MathException If the number is not valid. - * - * @pure */ public function minus(BigNumber|int|float|string $that) : BigRational { @@ -231,8 +229,6 @@ public function minus(BigNumber|int|float|string $that) : BigRational * @param BigNumber|int|float|string $that The multiplier. * * @throws MathException If the multiplier is not a valid number. - * - * @pure */ public function multipliedBy(BigNumber|int|float|string $that) : BigRational { @@ -250,8 +246,6 @@ public function multipliedBy(BigNumber|int|float|string $that) : BigRational * @param BigNumber|int|float|string $that The divisor. * * @throws MathException If the divisor is not a valid number, or is zero. - * - * @pure */ public function dividedBy(BigNumber|int|float|string $that) : BigRational { @@ -267,8 +261,6 @@ public function dividedBy(BigNumber|int|float|string $that) : BigRational * Returns this number exponentiated to the given value. * * @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000. - * - * @pure */ public function power(int $exponent) : BigRational { @@ -295,8 +287,6 @@ public function power(int $exponent) : BigRational * The reciprocal has the numerator and denominator swapped. * * @throws DivisionByZeroException If the numerator is zero. - * - * @pure */ public function reciprocal() : BigRational { @@ -305,8 +295,6 @@ public function reciprocal() : BigRational /** * Returns the absolute value of this BigRational. - * - * @pure */ public function abs() : BigRational { @@ -315,8 +303,6 @@ public function abs() : BigRational /** * Returns the negated value of this BigRational. - * - * @pure */ public function negated() : BigRational { @@ -325,8 +311,6 @@ public function negated() : BigRational /** * Returns the simplified value of this BigRational. - * - * @pure */ public function simplified() : BigRational { @@ -338,19 +322,16 @@ public function simplified() : BigRational return new BigRational($numerator, $denominator, false); } - #[Override] public function compareTo(BigNumber|int|float|string $that) : int { return $this->minus($that)->getSign(); } - #[Override] public function getSign() : int { return $this->numerator->getSign(); } - #[Override] public function toBigInteger() : BigInteger { $simplified = $this->simplified(); @@ -362,38 +343,32 @@ public function toBigInteger() : BigInteger return $simplified->numerator; } - #[Override] public function toBigDecimal() : BigDecimal { return $this->numerator->toBigDecimal()->exactlyDividedBy($this->denominator); } - #[Override] public function toBigRational() : BigRational { return $this; } - #[Override] - public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal + public function toScale(int $scale, int $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal { return $this->numerator->toBigDecimal()->dividedBy($this->denominator, $scale, $roundingMode); } - #[Override] public function toInt() : int { return $this->toBigInteger()->toInt(); } - #[Override] public function toFloat() : float { $simplified = $this->simplified(); return $simplified->numerator->toFloat() / $simplified->denominator->toFloat(); } - #[Override] public function __toString() : string { $numerator = (string) $this->numerator; @@ -403,7 +378,7 @@ public function __toString() : string return $numerator; } - return $numerator . '/' . $denominator; + return $this->numerator . '/' . $this->denominator; } /** @@ -422,6 +397,7 @@ public function __serialize(): array * This method is only here to allow unserializing the object and cannot be accessed directly. * * @internal + * @psalm-suppress RedundantPropertyInitializationCheck * * @param array{numerator: BigInteger, denominator: BigInteger} $data * @@ -429,13 +405,41 @@ public function __serialize(): array */ public function __unserialize(array $data): void { - /** @phpstan-ignore isset.initializedProperty */ if (isset($this->numerator)) { throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); } - /** @phpstan-ignore deadCode.unreachable */ $this->numerator = $data['numerator']; $this->denominator = $data['denominator']; } + + /** + * This method is required by interface Serializable and SHOULD NOT be accessed directly. + * + * @internal + */ + public function serialize() : string + { + return $this->numerator . '/' . $this->denominator; + } + + /** + * This method is only here to implement interface Serializable and cannot be accessed directly. + * + * @internal + * @psalm-suppress RedundantPropertyInitializationCheck + * + * @throws \LogicException + */ + public function unserialize($value) : void + { + if (isset($this->numerator)) { + throw new \LogicException('unserialize() is an internal function, it must not be called directly.'); + } + + [$numerator, $denominator] = \explode('/', $value); + + $this->numerator = BigInteger::of($numerator); + $this->denominator = BigInteger::of($denominator); + } } diff --git a/lib/Google/vendor/brick/math/src/Exception/DivisionByZeroException.php b/lib/Google/vendor/brick/math/src/Exception/DivisionByZeroException.php index 2daaf5ed8..ce7769ac2 100644 --- a/lib/Google/vendor/brick/math/src/Exception/DivisionByZeroException.php +++ b/lib/Google/vendor/brick/math/src/Exception/DivisionByZeroException.php @@ -7,10 +7,10 @@ /** * Exception thrown when a division by zero occurs. */ -final class DivisionByZeroException extends MathException +class DivisionByZeroException extends MathException { /** - * @pure + * @psalm-pure */ public static function divisionByZero() : DivisionByZeroException { @@ -18,7 +18,7 @@ public static function divisionByZero() : DivisionByZeroException } /** - * @pure + * @psalm-pure */ public static function modulusMustNotBeZero() : DivisionByZeroException { @@ -26,7 +26,7 @@ public static function modulusMustNotBeZero() : DivisionByZeroException } /** - * @pure + * @psalm-pure */ public static function denominatorMustNotBeZero() : DivisionByZeroException { diff --git a/lib/Google/vendor/brick/math/src/Exception/IntegerOverflowException.php b/lib/Google/vendor/brick/math/src/Exception/IntegerOverflowException.php index 56f3cf84c..c73b49097 100644 --- a/lib/Google/vendor/brick/math/src/Exception/IntegerOverflowException.php +++ b/lib/Google/vendor/brick/math/src/Exception/IntegerOverflowException.php @@ -9,10 +9,10 @@ /** * Exception thrown when an integer overflow occurs. */ -final class IntegerOverflowException extends MathException +class IntegerOverflowException extends MathException { /** - * @pure + * @psalm-pure */ public static function toIntOverflow(BigInteger $value) : IntegerOverflowException { diff --git a/lib/Google/vendor/brick/math/src/Exception/MathException.php b/lib/Google/vendor/brick/math/src/Exception/MathException.php index 8facd9c62..46e9c3fe4 100644 --- a/lib/Google/vendor/brick/math/src/Exception/MathException.php +++ b/lib/Google/vendor/brick/math/src/Exception/MathException.php @@ -7,6 +7,6 @@ /** * Base class for all math exceptions. */ -class MathException extends \RuntimeException +class MathException extends \Exception { } diff --git a/lib/Google/vendor/brick/math/src/Exception/NegativeNumberException.php b/lib/Google/vendor/brick/math/src/Exception/NegativeNumberException.php index 73ed3a494..473911341 100644 --- a/lib/Google/vendor/brick/math/src/Exception/NegativeNumberException.php +++ b/lib/Google/vendor/brick/math/src/Exception/NegativeNumberException.php @@ -7,6 +7,6 @@ /** * Exception thrown when attempting to perform an unsupported operation, such as a square root, on a negative number. */ -final class NegativeNumberException extends MathException +class NegativeNumberException extends MathException { } diff --git a/lib/Google/vendor/brick/math/src/Exception/NumberFormatException.php b/lib/Google/vendor/brick/math/src/Exception/NumberFormatException.php index 0dcda3483..d9cf6ff5f 100644 --- a/lib/Google/vendor/brick/math/src/Exception/NumberFormatException.php +++ b/lib/Google/vendor/brick/math/src/Exception/NumberFormatException.php @@ -7,23 +7,12 @@ /** * Exception thrown when attempting to create a number from a string with an invalid format. */ -final class NumberFormatException extends MathException +class NumberFormatException extends MathException { - /** - * @pure - */ - public static function invalidFormat(string $value) : self - { - return new self(\sprintf( - 'The given value "%s" does not represent a valid number.', - $value, - )); - } - /** * @param string $char The failing character. * - * @pure + * @psalm-pure */ public static function charNotInAlphabet(string $char) : self { @@ -39,6 +28,6 @@ public static function charNotInAlphabet(string $char) : self $char = '"' . $char . '"'; } - return new self(\sprintf('Char %s is not a valid character in the given alphabet.', $char)); + return new self(sprintf('Char %s is not a valid character in the given alphabet.', $char)); } } diff --git a/lib/Google/vendor/brick/math/src/Exception/RoundingNecessaryException.php b/lib/Google/vendor/brick/math/src/Exception/RoundingNecessaryException.php index 034a04069..57bfcd844 100644 --- a/lib/Google/vendor/brick/math/src/Exception/RoundingNecessaryException.php +++ b/lib/Google/vendor/brick/math/src/Exception/RoundingNecessaryException.php @@ -7,10 +7,10 @@ /** * Exception thrown when a number cannot be represented at the requested scale without rounding. */ -final class RoundingNecessaryException extends MathException +class RoundingNecessaryException extends MathException { /** - * @pure + * @psalm-pure */ public static function roundingNecessary() : RoundingNecessaryException { diff --git a/lib/Google/vendor/brick/math/src/Internal/Calculator.php b/lib/Google/vendor/brick/math/src/Internal/Calculator.php index a5e000a42..b8cecda96 100644 --- a/lib/Google/vendor/brick/math/src/Internal/Calculator.php +++ b/lib/Google/vendor/brick/math/src/Internal/Calculator.php @@ -17,25 +17,78 @@ * All methods must return strings respecting this format, unless specified otherwise. * * @internal + * + * @psalm-immutable */ -abstract readonly class Calculator +abstract class Calculator { /** * The maximum exponent value allowed for the pow() method. */ - public const MAX_POWER = 1_000_000; + public const MAX_POWER = 1000000; /** * The alphabet for converting from and to base 2 to 36, lowercase. */ public const ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz'; + /** + * The Calculator instance in use. + */ + private static ?Calculator $instance = null; + + /** + * Sets the Calculator instance to use. + * + * An instance is typically set only in unit tests: the autodetect is usually the best option. + * + * @param Calculator|null $calculator The calculator instance, or NULL to revert to autodetect. + */ + final public static function set(?Calculator $calculator) : void + { + self::$instance = $calculator; + } + + /** + * Returns the Calculator instance to use. + * + * If none has been explicitly set, the fastest available implementation will be returned. + * + * @psalm-pure + * @psalm-suppress ImpureStaticProperty + */ + final public static function get() : Calculator + { + if (self::$instance === null) { + /** @psalm-suppress ImpureMethodCall */ + self::$instance = self::detect(); + } + + return self::$instance; + } + + /** + * Returns the fastest available Calculator implementation. + * + * @codeCoverageIgnore + */ + private static function detect() : Calculator + { + if (\extension_loaded('gmp')) { + return new Calculator\GmpCalculator(); + } + + if (\extension_loaded('bcmath')) { + return new Calculator\BcMathCalculator(); + } + + return new Calculator\NativeCalculator(); + } + /** * Extracts the sign & digits of the operands. * * @return array{bool, bool, string, string} Whether $a and $b are negative, followed by their digits. - * - * @pure */ final protected function init(string $a, string $b) : array { @@ -50,8 +103,6 @@ final protected function init(string $a, string $b) : array /** * Returns the absolute value of a number. - * - * @pure */ final public function abs(string $n) : string { @@ -60,8 +111,6 @@ final public function abs(string $n) : string /** * Negates a number. - * - * @pure */ final public function neg(string $n) : string { @@ -79,11 +128,7 @@ final public function neg(string $n) : string /** * Compares two numbers. * - * Returns -1 if the first number is less than, 0 if equal to, 1 if greater than the second number. - * - * @return -1|0|1 - * - * @pure + * @return int [-1, 0, 1] If the first number is less than, equal to, or greater than the second number. */ final public function cmp(string $a, string $b) : int { @@ -113,22 +158,16 @@ final public function cmp(string $a, string $b) : int /** * Adds two numbers. - * - * @pure */ abstract public function add(string $a, string $b) : string; /** * Subtracts two numbers. - * - * @pure */ abstract public function sub(string $a, string $b) : string; /** * Multiplies two numbers. - * - * @pure */ abstract public function mul(string $a, string $b) : string; @@ -139,8 +178,6 @@ abstract public function mul(string $a, string $b) : string; * @param string $b The divisor, must not be zero. * * @return string The quotient. - * - * @pure */ abstract public function divQ(string $a, string $b) : string; @@ -151,8 +188,6 @@ abstract public function divQ(string $a, string $b) : string; * @param string $b The divisor, must not be zero. * * @return string The remainder. - * - * @pure */ abstract public function divR(string $a, string $b) : string; @@ -163,8 +198,6 @@ abstract public function divR(string $a, string $b) : string; * @param string $b The divisor, must not be zero. * * @return array{string, string} An array containing the quotient and remainder. - * - * @pure */ abstract public function divQR(string $a, string $b) : array; @@ -175,15 +208,11 @@ abstract public function divQR(string $a, string $b) : array; * @param int $e The exponent, validated as an integer between 0 and MAX_POWER. * * @return string The power. - * - * @pure */ abstract public function pow(string $a, int $e) : string; /** * @param string $b The modulus; must not be zero. - * - * @pure */ public function mod(string $a, string $b) : string { @@ -198,8 +227,6 @@ public function mod(string $a, string $b) : string * This method can be overridden by the concrete implementation if the underlying library has built-in support. * * @param string $m The modulus; must not be negative or zero. - * - * @pure */ public function modInverse(string $x, string $m) : ?string { @@ -228,8 +255,6 @@ public function modInverse(string $x, string $m) : ?string * @param string $base The base number; must be positive or zero. * @param string $exp The exponent; must be positive or zero. * @param string $mod The modulus; must be strictly positive. - * - * @pure */ abstract public function modPow(string $base, string $exp, string $mod) : string; @@ -240,8 +265,6 @@ abstract public function modPow(string $base, string $exp, string $mod) : string * has built-in support for GCD calculations. * * @return string The GCD, always positive, or zero if both arguments are zero. - * - * @pure */ public function gcd(string $a, string $b) : string { @@ -258,8 +281,6 @@ public function gcd(string $a, string $b) : string /** * @return array{string, string, string} GCD, X, Y - * - * @pure */ private function gcdExtended(string $a, string $b) : array { @@ -280,8 +301,6 @@ private function gcdExtended(string $a, string $b) : array * * The result is the largest x such that x² ≤ n. * The input MUST NOT be negative. - * - * @pure */ abstract public function sqrt(string $n) : string; @@ -295,8 +314,6 @@ abstract public function sqrt(string $n) : string; * @param int $base The base of the number, validated from 2 to 36. * * @return string The converted number, following the Calculator conventions. - * - * @pure */ public function fromBase(string $number, int $base) : string { @@ -313,8 +330,6 @@ public function fromBase(string $number, int $base) : string * @param int $base The base to convert to, validated from 2 to 36. * * @return string The converted number, lowercase. - * - * @pure */ public function toBase(string $number, int $base) : string { @@ -342,8 +357,6 @@ public function toBase(string $number, int $base) : string * @param int $base The base of the number, validated from 2 to alphabet length. * * @return string The number in base 10, following the Calculator conventions. - * - * @pure */ final public function fromArbitraryBase(string $number, string $alphabet, int $base) : string { @@ -390,8 +403,6 @@ final public function fromArbitraryBase(string $number, string $alphabet, int $b * @param int $base The base to convert to, validated from 2 to alphabet length. * * @return string The converted number in the given alphabet. - * - * @pure */ final public function toArbitraryBase(string $number, string $alphabet, int $base) : string { @@ -417,15 +428,16 @@ final public function toArbitraryBase(string $number, string $alphabet, int $bas * * Rounding is performed when the remainder of the division is not zero. * - * @param string $a The dividend. - * @param string $b The divisor, must not be zero. - * @param RoundingMode $roundingMode The rounding mode. + * @param string $a The dividend. + * @param string $b The divisor, must not be zero. + * @param int $roundingMode The rounding mode. * + * @throws \InvalidArgumentException If the rounding mode is invalid. * @throws RoundingNecessaryException If RoundingMode::UNNECESSARY is provided but rounding is necessary. * - * @pure + * @psalm-suppress ImpureFunctionCall */ - final public function divRound(string $a, string $b, RoundingMode $roundingMode) : string + final public function divRound(string $a, string $b, int $roundingMode) : string { [$quotient, $remainder] = $this->divQR($a, $b); @@ -484,6 +496,9 @@ final public function divRound(string $a, string $b, RoundingMode $roundingMode) $lastDigitIsEven = ($lastDigit % 2 === 0); $increment = $lastDigitIsEven ? $discardedFractionSign() > 0 : $discardedFractionSign() >= 0; break; + + default: + throw new \InvalidArgumentException('Invalid rounding mode.'); } if ($increment) { @@ -498,8 +513,6 @@ final public function divRound(string $a, string $b, RoundingMode $roundingMode) * * This method can be overridden by the concrete implementation if the underlying library * has built-in support for bitwise operations. - * - * @pure */ public function and(string $a, string $b) : string { @@ -511,8 +524,6 @@ public function and(string $a, string $b) : string * * This method can be overridden by the concrete implementation if the underlying library * has built-in support for bitwise operations. - * - * @pure */ public function or(string $a, string $b) : string { @@ -524,8 +535,6 @@ public function or(string $a, string $b) : string * * This method can be overridden by the concrete implementation if the underlying library * has built-in support for bitwise operations. - * - * @pure */ public function xor(string $a, string $b) : string { @@ -538,8 +547,6 @@ public function xor(string $a, string $b) : string * @param 'and'|'or'|'xor' $operator The operator to use. * @param string $a The left operand. * @param string $b The right operand. - * - * @pure */ private function bitwise(string $operator, string $a, string $b) : string { @@ -564,17 +571,27 @@ private function bitwise(string $operator, string $a, string $b) : string $bBin = $this->twosComplement($bBin); } - $value = match ($operator) { - 'and' => $aBin & $bBin, - 'or' => $aBin | $bBin, - 'xor' => $aBin ^ $bBin, - }; + switch ($operator) { + case 'and': + $value = $aBin & $bBin; + $negative = ($aNeg and $bNeg); + break; - $negative = match ($operator) { - 'and' => $aNeg and $bNeg, - 'or' => $aNeg or $bNeg, - 'xor' => $aNeg xor $bNeg, - }; + case 'or': + $value = $aBin | $bBin; + $negative = ($aNeg or $bNeg); + break; + + case 'xor': + $value = $aBin ^ $bBin; + $negative = ($aNeg xor $bNeg); + break; + + // @codeCoverageIgnoreStart + default: + throw new \InvalidArgumentException('Invalid bitwise operator.'); + // @codeCoverageIgnoreEnd + } if ($negative) { $value = $this->twosComplement($value); @@ -587,8 +604,6 @@ private function bitwise(string $operator, string $a, string $b) : string /** * @param string $number A positive, binary number. - * - * @pure */ private function twosComplement(string $number) : string { @@ -618,8 +633,6 @@ private function twosComplement(string $number) : string * Converts a decimal number to a binary string. * * @param string $number The number to convert, positive or zero, only digits. - * - * @pure */ private function toBinary(string $number) : string { @@ -637,8 +650,6 @@ private function toBinary(string $number) : string * Returns the positive decimal representation of a binary number. * * @param string $bytes The bytes representing the number. - * - * @pure */ private function toDecimal(string $bytes) : string { diff --git a/lib/Google/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php b/lib/Google/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php index 5ba961ed3..5457a3c98 100644 --- a/lib/Google/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php +++ b/lib/Google/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php @@ -5,67 +5,69 @@ namespace Brick\Math\Internal\Calculator; use Brick\Math\Internal\Calculator; -use Override; /** * Calculator implementation built around the bcmath library. * * @internal + * + * @psalm-immutable */ -final readonly class BcMathCalculator extends Calculator +class BcMathCalculator extends Calculator { - #[Override] public function add(string $a, string $b) : string { return \bcadd($a, $b, 0); } - #[Override] public function sub(string $a, string $b) : string { return \bcsub($a, $b, 0); } - #[Override] public function mul(string $a, string $b) : string { return \bcmul($a, $b, 0); } - #[Override] public function divQ(string $a, string $b) : string { return \bcdiv($a, $b, 0); } - #[Override] + /** + * @psalm-suppress InvalidNullableReturnType + * @psalm-suppress NullableReturnStatement + */ public function divR(string $a, string $b) : string { return \bcmod($a, $b, 0); } - #[Override] public function divQR(string $a, string $b) : array { $q = \bcdiv($a, $b, 0); $r = \bcmod($a, $b, 0); + assert($r !== null); + return [$q, $r]; } - #[Override] public function pow(string $a, int $e) : string { return \bcpow($a, (string) $e, 0); } - #[Override] public function modPow(string $base, string $exp, string $mod) : string { return \bcpowmod($base, $exp, $mod, 0); } - #[Override] + /** + * @psalm-suppress InvalidNullableReturnType + * @psalm-suppress NullableReturnStatement + */ public function sqrt(string $n) : string { return \bcsqrt($n, 0); diff --git a/lib/Google/vendor/brick/math/src/Internal/Calculator/GmpCalculator.php b/lib/Google/vendor/brick/math/src/Internal/Calculator/GmpCalculator.php index c0f9bd585..42d4c6927 100644 --- a/lib/Google/vendor/brick/math/src/Internal/Calculator/GmpCalculator.php +++ b/lib/Google/vendor/brick/math/src/Internal/Calculator/GmpCalculator.php @@ -5,68 +5,56 @@ namespace Brick\Math\Internal\Calculator; use Brick\Math\Internal\Calculator; -use GMP; -use Override; /** * Calculator implementation built around the GMP library. * * @internal + * + * @psalm-immutable */ -final readonly class GmpCalculator extends Calculator +class GmpCalculator extends Calculator { - #[Override] public function add(string $a, string $b) : string { return \gmp_strval(\gmp_add($a, $b)); } - #[Override] public function sub(string $a, string $b) : string { return \gmp_strval(\gmp_sub($a, $b)); } - #[Override] public function mul(string $a, string $b) : string { return \gmp_strval(\gmp_mul($a, $b)); } - #[Override] public function divQ(string $a, string $b) : string { return \gmp_strval(\gmp_div_q($a, $b)); } - #[Override] public function divR(string $a, string $b) : string { return \gmp_strval(\gmp_div_r($a, $b)); } - #[Override] public function divQR(string $a, string $b) : array { [$q, $r] = \gmp_div_qr($a, $b); - /** - * @var GMP $q - * @var GMP $r - */ return [ \gmp_strval($q), \gmp_strval($r) ]; } - #[Override] public function pow(string $a, int $e) : string { return \gmp_strval(\gmp_pow($a, $e)); } - #[Override] public function modInverse(string $x, string $m) : ?string { $result = \gmp_invert($x, $m); @@ -78,49 +66,41 @@ public function modInverse(string $x, string $m) : ?string return \gmp_strval($result); } - #[Override] public function modPow(string $base, string $exp, string $mod) : string { return \gmp_strval(\gmp_powm($base, $exp, $mod)); } - #[Override] public function gcd(string $a, string $b) : string { return \gmp_strval(\gmp_gcd($a, $b)); } - #[Override] public function fromBase(string $number, int $base) : string { return \gmp_strval(\gmp_init($number, $base)); } - #[Override] public function toBase(string $number, int $base) : string { return \gmp_strval($number, $base); } - #[Override] public function and(string $a, string $b) : string { return \gmp_strval(\gmp_and($a, $b)); } - #[Override] public function or(string $a, string $b) : string { return \gmp_strval(\gmp_or($a, $b)); } - #[Override] public function xor(string $a, string $b) : string { return \gmp_strval(\gmp_xor($a, $b)); } - #[Override] public function sqrt(string $n) : string { return \gmp_strval(\gmp_sqrt($n)); diff --git a/lib/Google/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php b/lib/Google/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php index ee476c9f7..7c679d24d 100644 --- a/lib/Google/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php +++ b/lib/Google/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php @@ -5,14 +5,15 @@ namespace Brick\Math\Internal\Calculator; use Brick\Math\Internal\Calculator; -use Override; /** * Calculator implementation using only native PHP code. * * @internal + * + * @psalm-immutable */ -final readonly class NativeCalculator extends Calculator +class NativeCalculator extends Calculator { /** * The max number of digits the platform can natively add, subtract, multiply or divide without overflow. @@ -25,23 +26,29 @@ private int $maxDigits; /** - * @pure * @codeCoverageIgnore */ public function __construct() { - $this->maxDigits = match (PHP_INT_SIZE) { - 4 => 9, - 8 => 18, - }; + switch (PHP_INT_SIZE) { + case 4: + $this->maxDigits = 9; + break; + + case 8: + $this->maxDigits = 18; + break; + + default: + throw new \RuntimeException('The platform is not 32-bit or 64-bit as expected.'); + } } - #[Override] public function add(string $a, string $b) : string { /** - * @var numeric-string $a - * @var numeric-string $b + * @psalm-var numeric-string $a + * @psalm-var numeric-string $b */ $result = $a + $b; @@ -68,18 +75,16 @@ public function add(string $a, string $b) : string return $result; } - #[Override] public function sub(string $a, string $b) : string { return $this->add($a, $this->neg($b)); } - #[Override] public function mul(string $a, string $b) : string { /** - * @var numeric-string $a - * @var numeric-string $b + * @psalm-var numeric-string $a + * @psalm-var numeric-string $b */ $result = $a * $b; @@ -118,19 +123,16 @@ public function mul(string $a, string $b) : string return $result; } - #[Override] public function divQ(string $a, string $b) : string { return $this->divQR($a, $b)[0]; } - #[Override] public function divR(string $a, string $b): string { return $this->divQR($a, $b)[1]; } - #[Override] public function divQR(string $a, string $b) : array { if ($a === '0') { @@ -149,18 +151,20 @@ public function divQR(string $a, string $b) : array return [$this->neg($a), '0']; } - /** @var numeric-string $a */ + /** @psalm-var numeric-string $a */ $na = $a * 1; // cast to number if (is_int($na)) { - /** @var numeric-string $b */ + /** @psalm-var numeric-string $b */ $nb = $b * 1; if (is_int($nb)) { // the only division that may overflow is PHP_INT_MIN / -1, // which cannot happen here as we've already handled a divisor of -1 above. - $q = intdiv($na, $nb); $r = $na % $nb; + $q = ($na - $r) / $nb; + + assert(is_int($q)); return [ (string) $q, @@ -184,7 +188,6 @@ public function divQR(string $a, string $b) : array return [$q, $r]; } - #[Override] public function pow(string $a, int $e) : string { if ($e === 0) { @@ -200,6 +203,7 @@ public function pow(string $a, int $e) : string $aa = $this->mul($a, $a); + /** @psalm-suppress PossiblyInvalidArgument We're sure that $e / 2 is an int now */ $result = $this->pow($aa, $e / 2); if ($odd === 1) { @@ -212,7 +216,6 @@ public function pow(string $a, int $e) : string /** * Algorithm from: https://www.geeksforgeeks.org/modular-exponentiation-power-in-modular-arithmetic/ */ - #[Override] public function modPow(string $base, string $exp, string $mod) : string { // special case: the algorithm below fails with 0 power 0 mod 1 (returns 1 instead of 0) @@ -247,7 +250,6 @@ public function modPow(string $base, string $exp, string $mod) : string /** * Adapted from https://cp-algorithms.com/num_methods/roots_newton.html */ - #[Override] public function sqrt(string $n) : string { if ($n === '0') { @@ -275,8 +277,6 @@ public function sqrt(string $n) : string /** * Performs the addition of two non-signed large integers. - * - * @pure */ private function doAdd(string $a, string $b) : string { @@ -290,13 +290,14 @@ private function doAdd(string $a, string $b) : string if ($i < 0) { $blockLength += $i; + /** @psalm-suppress LoopInvalidation */ $i = 0; } - /** @var numeric-string $blockA */ + /** @psalm-var numeric-string $blockA */ $blockA = \substr($a, $i, $blockLength); - /** @var numeric-string $blockB */ + /** @psalm-var numeric-string $blockB */ $blockB = \substr($b, $i, $blockLength); $sum = (string) ($blockA + $blockB + $carry); @@ -328,8 +329,6 @@ private function doAdd(string $a, string $b) : string /** * Performs the subtraction of two non-signed large integers. - * - * @pure */ private function doSub(string $a, string $b) : string { @@ -360,13 +359,14 @@ private function doSub(string $a, string $b) : string if ($i < 0) { $blockLength += $i; + /** @psalm-suppress LoopInvalidation */ $i = 0; } - /** @var numeric-string $blockA */ + /** @psalm-var numeric-string $blockA */ $blockA = \substr($a, $i, $blockLength); - /** @var numeric-string $blockB */ + /** @psalm-var numeric-string $blockB */ $blockB = \substr($b, $i, $blockLength); $sum = $blockA - $blockB - $carry; @@ -406,8 +406,6 @@ private function doSub(string $a, string $b) : string /** * Performs the multiplication of two non-signed large integers. - * - * @pure */ private function doMul(string $a, string $b) : string { @@ -424,6 +422,7 @@ private function doMul(string $a, string $b) : string if ($i < 0) { $blockALength += $i; + /** @psalm-suppress LoopInvalidation */ $i = 0; } @@ -437,6 +436,7 @@ private function doMul(string $a, string $b) : string if ($j < 0) { $blockBLength += $j; + /** @psalm-suppress LoopInvalidation */ $j = 0; } @@ -479,8 +479,6 @@ private function doMul(string $a, string $b) : string * Performs the division of two non-signed large integers. * * @return string[] The quotient and remainder. - * - * @pure */ private function doDiv(string $a, string $b) : array { @@ -499,22 +497,6 @@ private function doDiv(string $a, string $b) : array $r = $a; // remainder $z = $y; // focus length, always $y or $y+1 - /** @var numeric-string $b */ - $nb = $b * 1; // cast to number - // performance optimization in cases where the remainder will never cause int overflow - if (is_int(($nb - 1) * 10 + 9)) { - $r = (int) \substr($a, 0, $z - 1); - - for ($i = $z - 1; $i < $x; $i++) { - $n = $r * 10 + (int) $a[$i]; - /** @var int $nb */ - $q .= \intdiv($n, $nb); - $r = $n % $nb; - } - - return [\ltrim($q, '0') ?: '0', (string) $r]; - } - for (;;) { $focus = \substr($a, 0, $z); @@ -554,9 +536,7 @@ private function doDiv(string $a, string $b) : array /** * Compares two non-signed large numbers. * - * @return -1|0|1 - * - * @pure + * @return int [-1, 0, 1] */ private function doCmp(string $a, string $b) : int { @@ -569,7 +549,7 @@ private function doCmp(string $a, string $b) : int return $cmp; } - return \strcmp($a, $b) <=> 0; // enforce -1|0|1 + return \strcmp($a, $b) <=> 0; // enforce [-1, 0, 1] } /** @@ -578,8 +558,6 @@ private function doCmp(string $a, string $b) : int * The numbers must only consist of digits, without leading minus sign. * * @return array{string, string, int} - * - * @pure */ private function pad(string $a, string $b) : array { diff --git a/lib/Google/vendor/brick/math/src/Internal/CalculatorRegistry.php b/lib/Google/vendor/brick/math/src/Internal/CalculatorRegistry.php deleted file mode 100644 index 394fae69a..000000000 --- a/lib/Google/vendor/brick/math/src/Internal/CalculatorRegistry.php +++ /dev/null @@ -1,73 +0,0 @@ -= 0.5; otherwise, behaves as for DOWN. * Note that this is the rounding mode commonly taught at school. */ - case HALF_UP; + public const HALF_UP = 5; /** * Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round down. * * Behaves as for UP if the discarded fraction is > 0.5; otherwise, behaves as for DOWN. */ - case HALF_DOWN; + public const HALF_DOWN = 6; /** * Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round towards positive infinity. * * If the result is positive, behaves as for HALF_UP; if negative, behaves as for HALF_DOWN. */ - case HALF_CEILING; + public const HALF_CEILING = 7; /** * Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round towards negative infinity. * * If the result is positive, behaves as for HALF_DOWN; if negative, behaves as for HALF_UP. */ - case HALF_FLOOR; + public const HALF_FLOOR = 8; /** * Rounds towards the "nearest neighbor" unless both neighbors are equidistant, in which case rounds towards the even neighbor. @@ -94,5 +103,5 @@ enum RoundingMode * cumulative error when applied repeatedly over a sequence of calculations. * It is sometimes known as "Banker's rounding", and is chiefly used in the USA. */ - case HALF_EVEN; + public const HALF_EVEN = 9; } diff --git a/lib/Google/vendor/composer/autoload_classmap.php b/lib/Google/vendor/composer/autoload_classmap.php index 375ca28e3..c80dde643 100644 --- a/lib/Google/vendor/composer/autoload_classmap.php +++ b/lib/Google/vendor/composer/autoload_classmap.php @@ -6,6 +6,7 @@ $baseDir = dirname($vendorDir); return array( + 'CURLStringFile' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php', 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 'GPBMetadata\\GrpcGcp' => $vendorDir . '/google/grpc-gcp/src/generated/GPBMetadata/GrpcGcp.php', 'Google_AccessToken_Revoke' => $baseDir . '/src/aliases.php', @@ -33,4 +34,5 @@ 'Grpc\\Gcp\\ApiConfig' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/ApiConfig.php', 'Grpc\\Gcp\\ChannelPoolConfig' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/ChannelPoolConfig.php', 'Grpc\\Gcp\\MethodConfig' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/MethodConfig.php', + 'ReturnTypeWillChange' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php', ); diff --git a/lib/Google/vendor/composer/autoload_files.php b/lib/Google/vendor/composer/autoload_files.php index 78726fc7a..1b96f7179 100644 --- a/lib/Google/vendor/composer/autoload_files.php +++ b/lib/Google/vendor/composer/autoload_files.php @@ -9,6 +9,7 @@ '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', + '23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php', 'e39a8b23c42d4e1452234d762b03835a' => $vendorDir . '/ramsey/uuid/src/functions.php', '1f87db08236948d07391152dccb70f04' => $vendorDir . '/google/apiclient-services/autoload.php', 'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php', diff --git a/lib/Google/vendor/composer/autoload_psr4.php b/lib/Google/vendor/composer/autoload_psr4.php index 6699d6ffd..a6b60b0d6 100644 --- a/lib/Google/vendor/composer/autoload_psr4.php +++ b/lib/Google/vendor/composer/autoload_psr4.php @@ -7,6 +7,7 @@ return array( 'phpseclib3\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'), + 'Symfony\\Polyfill\\Php81\\' => array($vendorDir . '/symfony/polyfill-php81'), 'Rize\\' => array($vendorDir . '/rize/uri-template/src/Rize'), 'Ramsey\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'), 'Ramsey\\Collection\\' => array($vendorDir . '/ramsey/collection/src'), diff --git a/lib/Google/vendor/composer/autoload_real.php b/lib/Google/vendor/composer/autoload_real.php index 7dfe40e5b..9659486a6 100644 --- a/lib/Google/vendor/composer/autoload_real.php +++ b/lib/Google/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit7d51b2283bec19db67d0861b0c8ead2c +class ComposerAutoloaderInitbd131085cfdbf47b26d7ae00fe412ae4 { private static $loader; @@ -24,16 +24,16 @@ public static function getLoader() require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInit7d51b2283bec19db67d0861b0c8ead2c', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitbd131085cfdbf47b26d7ae00fe412ae4', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit7d51b2283bec19db67d0861b0c8ead2c', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitbd131085cfdbf47b26d7ae00fe412ae4', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4::getInitializer($loader)); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4::$files; $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; diff --git a/lib/Google/vendor/composer/autoload_static.php b/lib/Google/vendor/composer/autoload_static.php index 661fae55a..2cad9318a 100644 --- a/lib/Google/vendor/composer/autoload_static.php +++ b/lib/Google/vendor/composer/autoload_static.php @@ -4,12 +4,13 @@ namespace Composer\Autoload; -class ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c +class ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4 { public static $files = array ( '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', + '23c18046f52bef3eea034657bafda50f' => __DIR__ . '/..' . '/symfony/polyfill-php81/bootstrap.php', 'e39a8b23c42d4e1452234d762b03835a' => __DIR__ . '/..' . '/ramsey/uuid/src/functions.php', '1f87db08236948d07391152dccb70f04' => __DIR__ . '/..' . '/google/apiclient-services/autoload.php', 'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php', @@ -21,6 +22,10 @@ class ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c array ( 'phpseclib3\\' => 11, ), + 'S' => + array ( + 'Symfony\\Polyfill\\Php81\\' => 23, + ), 'R' => array ( 'Rize\\' => 5, @@ -85,6 +90,10 @@ class ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c array ( 0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib', ), + 'Symfony\\Polyfill\\Php81\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php81', + ), 'Rize\\' => array ( 0 => __DIR__ . '/..' . '/rize/uri-template/src/Rize', @@ -245,6 +254,7 @@ class ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c ); public static $classMap = array ( + 'CURLStringFile' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php', 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 'GPBMetadata\\GrpcGcp' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/GPBMetadata/GrpcGcp.php', 'Google_AccessToken_Revoke' => __DIR__ . '/../..' . '/src/aliases.php', @@ -272,14 +282,15 @@ class ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c 'Grpc\\Gcp\\ApiConfig' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/ApiConfig.php', 'Grpc\\Gcp\\ChannelPoolConfig' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/ChannelPoolConfig.php', 'Grpc\\Gcp\\MethodConfig' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/MethodConfig.php', + 'ReturnTypeWillChange' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php', ); public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit7d51b2283bec19db67d0861b0c8ead2c::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitbd131085cfdbf47b26d7ae00fe412ae4::$classMap; }, null, ClassLoader::class); } diff --git a/lib/Google/vendor/composer/installed.json b/lib/Google/vendor/composer/installed.json index d93a6a7de..c21cb26d5 100644 --- a/lib/Google/vendor/composer/installed.json +++ b/lib/Google/vendor/composer/installed.json @@ -2,28 +2,28 @@ "packages": [ { "name": "brick/math", - "version": "0.14.0", - "version_normalized": "0.14.0.0", + "version": "0.11.0", + "version_normalized": "0.11.0.0", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2" + "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2", - "reference": "113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2", + "url": "https://api.github.com/repos/brick/math/zipball/0ad82ce168c82ba30d1c01ec86116ab52f589478", + "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478", "shasum": "" }, "require": { - "php": "^8.2" + "php": "^8.0" }, "require-dev": { "php-coveralls/php-coveralls": "^2.2", - "phpstan/phpstan": "2.1.22", - "phpunit/phpunit": "^11.5" + "phpunit/phpunit": "^9.0", + "vimeo/psalm": "5.0.0" }, - "time": "2025-08-29T12:40:03+00:00", + "time": "2023-01-15T23:15:59+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -43,17 +43,12 @@ "arithmetic", "bigdecimal", "bignum", - "bignumber", "brick", - "decimal", - "integer", - "math", - "mathematics", - "rational" + "math" ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.14.0" + "source": "https://github.com/brick/math/tree/0.11.0" }, "funding": [ { @@ -131,26 +126,26 @@ }, { "name": "google/apiclient-services", - "version": "v0.415.0", - "version_normalized": "0.415.0.0", + "version": "v0.396.0", + "version_normalized": "0.396.0.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "080bdeb1d5243429164dc589b69426bae98dad1d" + "reference": "ceb2e432e4326c6775d24f62d554395a1a9ad3dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/080bdeb1d5243429164dc589b69426bae98dad1d", - "reference": "080bdeb1d5243429164dc589b69426bae98dad1d", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/ceb2e432e4326c6775d24f62d554395a1a9ad3dd", + "reference": "ceb2e432e4326c6775d24f62d554395a1a9ad3dd", "shasum": "" }, "require": { - "php": "^8.1" + "php": "^8.0" }, "require-dev": { "phpunit/phpunit": "^9.6" }, - "time": "2025-10-05T01:02:15+00:00", + "time": "2025-02-24T01:10:27+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -172,30 +167,30 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.415.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.396.0" }, "install-path": "../google/apiclient-services" }, { "name": "google/auth", - "version": "v1.44.0", - "version_normalized": "1.44.0.0", + "version": "v1.42.0", + "version_normalized": "1.42.0.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "5670e56307d7a2eac931f677c0e59a4f8abb2e43" + "reference": "0c25599a91530b5847f129b271c536f75a7563f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/5670e56307d7a2eac931f677c0e59a4f8abb2e43", - "reference": "5670e56307d7a2eac931f677c0e59a4f8abb2e43", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/0c25599a91530b5847f129b271c536f75a7563f5", + "reference": "0c25599a91530b5847f129b271c536f75a7563f5", "shasum": "" }, "require": { "firebase/php-jwt": "^6.0", "guzzlehttp/guzzle": "^7.4.5", "guzzlehttp/psr7": "^2.4.5", - "php": "^8.1", + "php": "^8.0", "psr/cache": "^2.0||^3.0", "psr/http-message": "^1.1||^2.0" }, @@ -213,7 +208,7 @@ "suggest": { "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2." }, - "time": "2024-12-04T15:34:58+00:00", + "time": "2024-08-26T18:33:48+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -235,7 +230,7 @@ "support": { "docs": "https://googleapis.github.io/google-auth-library-php/main/", "issues": "https://github.com/googleapis/google-auth-library-php/issues", - "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.44.0" + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.42.0" }, "install-path": "../google/auth" }, @@ -310,22 +305,22 @@ }, { "name": "google/cloud-storage", - "version": "v1.48.4", - "version_normalized": "1.48.4.0", + "version": "v1.48.1", + "version_normalized": "1.48.1.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-storage.git", - "reference": "4b81b682f6b1517c0c5f6152b2980195d23c1cef" + "reference": "509b095c3ea44db92c9e62a94b5773563c831821" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/4b81b682f6b1517c0c5f6152b2980195d23c1cef", - "reference": "4b81b682f6b1517c0c5f6152b2980195d23c1cef", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/509b095c3ea44db92c9e62a94b5773563c831821", + "reference": "509b095c3ea44db92c9e62a94b5773563c831821", "shasum": "" }, "require": { "google/cloud-core": "^1.57", - "php": "^8.1", + "php": "^8.0", "ramsey/uuid": "^4.2.3" }, "require-dev": { @@ -342,7 +337,7 @@ "google/cloud-pubsub": "May be used to register a topic to receive bucket notifications.", "phpseclib/phpseclib": "May be used in place of OpenSSL for creating signed Cloud Storage URLs. Please require version ^2." }, - "time": "2025-10-01T16:57:30+00:00", + "time": "2025-05-20T19:49:54+00:00", "type": "library", "extra": { "component": { @@ -364,33 +359,33 @@ ], "description": "Cloud Storage Client for PHP", "support": { - "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.48.4" + "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.48.1" }, "install-path": "../google/cloud-storage" }, { "name": "google/common-protos", - "version": "4.12.4", - "version_normalized": "4.12.4.0", + "version": "4.12.1", + "version_normalized": "4.12.1.0", "source": { "type": "git", "url": "https://github.com/googleapis/common-protos-php.git", - "reference": "0127156899af0df2681bd42024c60bd5360d64e3" + "reference": "70c4eb1abab5484a23c17a43b0d455259f5d8c1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/0127156899af0df2681bd42024c60bd5360d64e3", - "reference": "0127156899af0df2681bd42024c60bd5360d64e3", + "url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/70c4eb1abab5484a23c17a43b0d455259f5d8c1b", + "reference": "70c4eb1abab5484a23c17a43b0d455259f5d8c1b", "shasum": "" }, "require": { - "google/protobuf": "^4.31", - "php": "^8.1" + "google/protobuf": "^v3.25.3||^4.26.1", + "php": "^8.0" }, "require-dev": { "phpunit/phpunit": "^9.6" }, - "time": "2025-09-20T01:29:44+00:00", + "time": "2025-05-20T19:49:54+00:00", "type": "library", "extra": { "component": { @@ -426,7 +421,7 @@ "google" ], "support": { - "source": "https://github.com/googleapis/common-protos-php/tree/v4.12.4" + "source": "https://github.com/googleapis/common-protos-php/tree/v4.12.1" }, "install-path": "../google/common-protos" }, @@ -540,24 +535,24 @@ }, { "name": "google/longrunning", - "version": "0.5.0", - "version_normalized": "0.5.0.0", + "version": "0.4.7", + "version_normalized": "0.4.7.0", "source": { "type": "git", "url": "https://github.com/googleapis/php-longrunning.git", - "reference": "715519ab4aaf3c4268adb2b551ee0f34135c8c5f" + "reference": "624cabb874c10e5ddc9034c999f724894b70a3d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/php-longrunning/zipball/715519ab4aaf3c4268adb2b551ee0f34135c8c5f", - "reference": "715519ab4aaf3c4268adb2b551ee0f34135c8c5f", + "url": "https://api.github.com/repos/googleapis/php-longrunning/zipball/624cabb874c10e5ddc9034c999f724894b70a3d3", + "reference": "624cabb874c10e5ddc9034c999f724894b70a3d3", "shasum": "" }, "require-dev": { - "google/gax": "^1.38.0", + "google/gax": "^1.36.0", "phpunit/phpunit": "^9.0" }, - "time": "2025-09-20T01:29:44+00:00", + "time": "2025-01-24T21:24:06+00:00", "type": "library", "extra": { "component": { @@ -581,35 +576,35 @@ ], "description": "Google LongRunning Client for PHP", "support": { - "source": "https://github.com/googleapis/php-longrunning/tree/v0.5.0" + "source": "https://github.com/googleapis/php-longrunning/tree/v0.4.7" }, "install-path": "../google/longrunning" }, { "name": "google/protobuf", - "version": "v4.32.1", - "version_normalized": "4.32.1.0", + "version": "v4.31.1", + "version_normalized": "4.31.1.0", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb" + "reference": "2b028ce8876254e2acbeceea7d9b573faad41864" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb", - "reference": "c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/2b028ce8876254e2acbeceea7d9b573faad41864", + "reference": "2b028ce8876254e2acbeceea7d9b573faad41864", "shasum": "" }, "require": { - "php": ">=8.1.0" + "php": ">=7.0.0" }, "require-dev": { - "phpunit/phpunit": ">=5.0.0 <8.5.27" + "phpunit/phpunit": ">=5.0.0" }, "suggest": { "ext-bcmath": "Need to support JSON deserialization" }, - "time": "2025-09-14T05:14:52+00:00", + "time": "2025-05-28T18:52:35+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -628,23 +623,23 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.32.1" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.31.1" }, "install-path": "../google/protobuf" }, { "name": "grpc/grpc", - "version": "1.74.0", - "version_normalized": "1.74.0.0", + "version": "1.57.0", + "version_normalized": "1.57.0.0", "source": { "type": "git", "url": "https://github.com/grpc/grpc-php.git", - "reference": "32bf4dba256d60d395582fb6e4e8d3936bcdb713" + "reference": "b610c42022ed3a22f831439cb93802f2a4502fdf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/grpc/grpc-php/zipball/32bf4dba256d60d395582fb6e4e8d3936bcdb713", - "reference": "32bf4dba256d60d395582fb6e4e8d3936bcdb713", + "url": "https://api.github.com/repos/grpc/grpc-php/zipball/b610c42022ed3a22f831439cb93802f2a4502fdf", + "reference": "b610c42022ed3a22f831439cb93802f2a4502fdf", "shasum": "" }, "require": { @@ -657,7 +652,7 @@ "ext-protobuf": "For better performance, install the protobuf C extension.", "google/protobuf": "To get started using grpc quickly, install the native protobuf library." }, - "time": "2025-07-24T20:02:16+00:00", + "time": "2023-08-14T23:57:54+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -675,29 +670,29 @@ "rpc" ], "support": { - "source": "https://github.com/grpc/grpc-php/tree/v1.74.0" + "source": "https://github.com/grpc/grpc-php/tree/v1.57.0" }, "install-path": "../grpc/grpc" }, { "name": "guzzlehttp/guzzle", - "version": "7.10.0", - "version_normalized": "7.10.0.0", + "version": "7.9.3", + "version_normalized": "7.9.3.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4" + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", - "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^2.3", - "guzzlehttp/psr7": "^2.8", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -718,7 +713,7 @@ "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, - "time": "2025-08-23T22:36:01+00:00", + "time": "2025-03-27T13:37:11+00:00", "type": "library", "extra": { "bamarni-bin": { @@ -790,7 +785,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.10.0" + "source": "https://github.com/guzzle/guzzle/tree/7.9.3" }, "funding": [ { @@ -810,17 +805,17 @@ }, { "name": "guzzlehttp/promises", - "version": "2.3.0", - "version_normalized": "2.3.0.0", + "version": "2.2.0", + "version_normalized": "2.2.0.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "481557b130ef3790cf82b713667b43030dc9c957" + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957", - "reference": "481557b130ef3790cf82b713667b43030dc9c957", + "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", "shasum": "" }, "require": { @@ -828,9 +823,9 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.44 || ^9.6.25" + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, - "time": "2025-08-22T14:34:08+00:00", + "time": "2025-03-27T13:27:01+00:00", "type": "library", "extra": { "bamarni-bin": { @@ -876,7 +871,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.3.0" + "source": "https://github.com/guzzle/promises/tree/2.2.0" }, "funding": [ { @@ -896,17 +891,17 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.8.0", - "version_normalized": "2.8.0.0", + "version": "2.7.1", + "version_normalized": "2.7.1.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "21dc724a0583619cd1652f673303492272778051" + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051", - "reference": "21dc724a0583619cd1652f673303492272778051", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16", "shasum": "" }, "require": { @@ -922,12 +917,12 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "http-interop/http-factory-tests": "0.9.0", - "phpunit/phpunit": "^8.5.44 || ^9.6.25" + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, - "time": "2025-08-23T21:21:41+00:00", + "time": "2025-03-27T12:30:47+00:00", "type": "library", "extra": { "bamarni-bin": { @@ -995,7 +990,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.8.0" + "source": "https://github.com/guzzle/psr7/tree/2.7.1" }, "funding": [ { @@ -1120,29 +1115,27 @@ }, { "name": "paragonie/constant_time_encoding", - "version": "v3.1.3", - "version_normalized": "3.1.3.0", + "version": "v3.0.0", + "version_normalized": "3.0.0.0", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77" + "reference": "df1e7fde177501eee2037dd159cf04f5f301a512" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77", - "reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/df1e7fde177501eee2037dd159cf04f5f301a512", + "reference": "df1e7fde177501eee2037dd159cf04f5f301a512", "shasum": "" }, "require": { "php": "^8" }, "require-dev": { - "infection/infection": "^0", - "nikic/php-fuzzer": "^0", - "phpunit/phpunit": "^9|^10|^11", - "vimeo/psalm": "^4|^5|^6" + "phpunit/phpunit": "^9", + "vimeo/psalm": "^4|^5" }, - "time": "2025-09-24T15:06:41+00:00", + "time": "2024-05-08T12:36:18+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1245,17 +1238,17 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.47", - "version_normalized": "3.0.47.0", + "version": "3.0.43", + "version_normalized": "3.0.43.0", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "9d6ca36a6c2dd434765b1071b2644a1c683b385d" + "reference": "709ec107af3cb2f385b9617be72af8cf62441d02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/9d6ca36a6c2dd434765b1071b2644a1c683b385d", - "reference": "9d6ca36a6c2dd434765b1071b2644a1c683b385d", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/709ec107af3cb2f385b9617be72af8cf62441d02", + "reference": "709ec107af3cb2f385b9617be72af8cf62441d02", "shasum": "" }, "require": { @@ -1273,7 +1266,7 @@ "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." }, - "time": "2025-10-06T01:07:24+00:00", + "time": "2024-12-14T21:12:59+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1338,7 +1331,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.47" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.43" }, "funding": [ { @@ -1358,23 +1351,23 @@ }, { "name": "psr/cache", - "version": "2.0.0", - "version_normalized": "2.0.0.0", + "version": "3.0.0", + "version_normalized": "3.0.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b" + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", - "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", "shasum": "" }, "require": { "php": ">=8.0.0" }, - "time": "2021-02-03T23:23:37+00:00", + "time": "2021-02-03T23:26:27+00:00", "type": "library", "extra": { "branch-alias": { @@ -1404,7 +1397,7 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/2.0.0" + "source": "https://github.com/php-fig/cache/tree/3.0.0" }, "install-path": "../psr/cache" }, @@ -1679,42 +1672,46 @@ }, { "name": "ramsey/collection", - "version": "2.1.1", - "version_normalized": "2.1.1.0", + "version": "1.3.0", + "version_normalized": "1.3.0.0", "source": { "type": "git", "url": "https://github.com/ramsey/collection.git", - "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2" + "reference": "ad7475d1c9e70b190ecffc58f2d989416af339b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/344572933ad0181accbf4ba763e85a0306a8c5e2", - "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2", + "url": "https://api.github.com/repos/ramsey/collection/zipball/ad7475d1c9e70b190ecffc58f2d989416af339b4", + "reference": "ad7475d1c9e70b190ecffc58f2d989416af339b4", "shasum": "" }, "require": { - "php": "^8.1" + "php": "^7.4 || ^8.0", + "symfony/polyfill-php81": "^1.23" }, "require-dev": { "captainhook/plugin-composer": "^5.3", - "ergebnis/composer-normalize": "^2.45", - "fakerphp/faker": "^1.24", + "ergebnis/composer-normalize": "^2.28.3", + "fakerphp/faker": "^1.21", "hamcrest/hamcrest-php": "^2.0", - "jangregor/phpstan-prophecy": "^2.1", - "mockery/mockery": "^1.6", + "jangregor/phpstan-prophecy": "^1.0", + "mockery/mockery": "^1.5", "php-parallel-lint/php-console-highlighter": "^1.0", - "php-parallel-lint/php-parallel-lint": "^1.4", - "phpspec/prophecy-phpunit": "^2.3", - "phpstan/extension-installer": "^1.4", - "phpstan/phpstan": "^2.1", - "phpstan/phpstan-mockery": "^2.0", - "phpstan/phpstan-phpunit": "^2.0", - "phpunit/phpunit": "^10.5", - "ramsey/coding-standard": "^2.3", - "ramsey/conventional-commits": "^1.6", - "roave/security-advisories": "dev-latest" + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpcsstandards/phpcsutils": "^1.0.0-rc1", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan": "^1.9", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5", + "psalm/plugin-mockery": "^1.1", + "psalm/plugin-phpunit": "^0.18.4", + "ramsey/coding-standard": "^2.0.3", + "ramsey/conventional-commits": "^1.3", + "vimeo/psalm": "^5.4" }, - "time": "2025-03-22T05:38:12+00:00", + "time": "2022-12-27T19:12:24+00:00", "type": "library", "extra": { "captainhook": { @@ -1752,27 +1749,37 @@ ], "support": { "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/2.1.1" + "source": "https://github.com/ramsey/collection/tree/1.3.0" }, + "funding": [ + { + "url": "https://github.com/ramsey", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/ramsey/collection", + "type": "tidelift" + } + ], "install-path": "../ramsey/collection" }, { "name": "ramsey/uuid", - "version": "4.9.1", - "version_normalized": "4.9.1.0", + "version": "4.9.0", + "version_normalized": "4.9.0.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440" + "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/81f941f6f729b1e3ceea61d9d014f8b6c6800440", - "reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/4e0e23cc785f0724a0e838279a9eb03f28b092a0", + "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0", "shasum": "" }, "require": { - "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14", + "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13", "php": "^8.0", "ramsey/collection": "^1.2 || ^2.0" }, @@ -1805,7 +1812,7 @@ "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." }, - "time": "2025-09-04T20:59:21+00:00", + "time": "2025-06-25T14:20:11+00:00", "type": "library", "extra": { "captainhook": { @@ -1833,34 +1840,32 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.9.1" + "source": "https://github.com/ramsey/uuid/tree/4.9.0" }, "install-path": "../ramsey/uuid" }, { "name": "rize/uri-template", - "version": "0.4.0", - "version_normalized": "0.4.0.0", + "version": "0.3.8", + "version_normalized": "0.3.8.0", "source": { "type": "git", "url": "https://github.com/rize/UriTemplate.git", - "reference": "56f374a9a42c7c3998f8b55b6b21b224de90c58b" + "reference": "34a5b96d0b65a5dddb7d20f09b6527a43faede24" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rize/UriTemplate/zipball/56f374a9a42c7c3998f8b55b6b21b224de90c58b", - "reference": "56f374a9a42c7c3998f8b55b6b21b224de90c58b", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/34a5b96d0b65a5dddb7d20f09b6527a43faede24", + "reference": "34a5b96d0b65a5dddb7d20f09b6527a43faede24", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=5.3.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.63", - "phpstan/phpstan": "^1.12", - "phpunit/phpunit": "~10.0" + "phpunit/phpunit": "~4.8.36" }, - "time": "2024-11-27T12:13:42+00:00", + "time": "2024-08-30T07:09:40+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1886,7 +1891,7 @@ ], "support": { "issues": "https://github.com/rize/UriTemplate/issues", - "source": "https://github.com/rize/UriTemplate/tree/0.4.0" + "source": "https://github.com/rize/UriTemplate/tree/0.3.8" }, "funding": [ { @@ -1906,23 +1911,23 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.6.0", - "version_normalized": "3.6.0.0", + "version": "v3.0.2", + "version_normalized": "3.0.2.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.0.2" }, - "time": "2024-09-25T14:21:43+00:00", + "time": "2022-01-02T09:55:41+00:00", "type": "library", "extra": { "thanks": { @@ -1930,7 +1935,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.6-dev" + "dev-main": "3.0-dev" } }, "installation-source": "dist", @@ -1956,7 +1961,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" }, "funding": [ { @@ -1973,6 +1978,85 @@ } ], "install-path": "../symfony/deprecation-contracts" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.32.0", + "version_normalized": "1.32.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "time": "2024-09-09T11:45:10+00:00", + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.32.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-php81" } ], "dev": false, diff --git a/lib/Google/vendor/composer/installed.php b/lib/Google/vendor/composer/installed.php index ec08b6c33..751d577c6 100644 --- a/lib/Google/vendor/composer/installed.php +++ b/lib/Google/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'google/apiclient', 'pretty_version' => 'dev-latest', 'version' => 'dev-latest', - 'reference' => '5ea5a3f9fefe25636bdc90c500a88f5866ad5ae6', + 'reference' => 'e9bccc39abc840b90f13f5054b669f3d2d2fe0df', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -11,9 +11,9 @@ ), 'versions' => array( 'brick/math' => array( - 'pretty_version' => '0.14.0', - 'version' => '0.14.0.0', - 'reference' => '113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2', + 'pretty_version' => '0.11.0', + 'version' => '0.11.0.0', + 'reference' => '0ad82ce168c82ba30d1c01ec86116ab52f589478', 'type' => 'library', 'install_path' => __DIR__ . '/../brick/math', 'aliases' => array(), @@ -31,25 +31,25 @@ 'google/apiclient' => array( 'pretty_version' => 'dev-latest', 'version' => 'dev-latest', - 'reference' => '5ea5a3f9fefe25636bdc90c500a88f5866ad5ae6', + 'reference' => 'e9bccc39abc840b90f13f5054b669f3d2d2fe0df', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => false, ), 'google/apiclient-services' => array( - 'pretty_version' => 'v0.415.0', - 'version' => '0.415.0.0', - 'reference' => '080bdeb1d5243429164dc589b69426bae98dad1d', + 'pretty_version' => 'v0.396.0', + 'version' => '0.396.0.0', + 'reference' => 'ceb2e432e4326c6775d24f62d554395a1a9ad3dd', 'type' => 'library', 'install_path' => __DIR__ . '/../google/apiclient-services', 'aliases' => array(), 'dev_requirement' => false, ), 'google/auth' => array( - 'pretty_version' => 'v1.44.0', - 'version' => '1.44.0.0', - 'reference' => '5670e56307d7a2eac931f677c0e59a4f8abb2e43', + 'pretty_version' => 'v1.42.0', + 'version' => '1.42.0.0', + 'reference' => '0c25599a91530b5847f129b271c536f75a7563f5', 'type' => 'library', 'install_path' => __DIR__ . '/../google/auth', 'aliases' => array(), @@ -65,18 +65,18 @@ 'dev_requirement' => false, ), 'google/cloud-storage' => array( - 'pretty_version' => 'v1.48.4', - 'version' => '1.48.4.0', - 'reference' => '4b81b682f6b1517c0c5f6152b2980195d23c1cef', + 'pretty_version' => 'v1.48.1', + 'version' => '1.48.1.0', + 'reference' => '509b095c3ea44db92c9e62a94b5773563c831821', 'type' => 'library', 'install_path' => __DIR__ . '/../google/cloud-storage', 'aliases' => array(), 'dev_requirement' => false, ), 'google/common-protos' => array( - 'pretty_version' => '4.12.4', - 'version' => '4.12.4.0', - 'reference' => '0127156899af0df2681bd42024c60bd5360d64e3', + 'pretty_version' => '4.12.1', + 'version' => '4.12.1.0', + 'reference' => '70c4eb1abab5484a23c17a43b0d455259f5d8c1b', 'type' => 'library', 'install_path' => __DIR__ . '/../google/common-protos', 'aliases' => array(), @@ -101,54 +101,54 @@ 'dev_requirement' => false, ), 'google/longrunning' => array( - 'pretty_version' => '0.5.0', - 'version' => '0.5.0.0', - 'reference' => '715519ab4aaf3c4268adb2b551ee0f34135c8c5f', + 'pretty_version' => '0.4.7', + 'version' => '0.4.7.0', + 'reference' => '624cabb874c10e5ddc9034c999f724894b70a3d3', 'type' => 'library', 'install_path' => __DIR__ . '/../google/longrunning', 'aliases' => array(), 'dev_requirement' => false, ), 'google/protobuf' => array( - 'pretty_version' => 'v4.32.1', - 'version' => '4.32.1.0', - 'reference' => 'c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb', + 'pretty_version' => 'v4.31.1', + 'version' => '4.31.1.0', + 'reference' => '2b028ce8876254e2acbeceea7d9b573faad41864', 'type' => 'library', 'install_path' => __DIR__ . '/../google/protobuf', 'aliases' => array(), 'dev_requirement' => false, ), 'grpc/grpc' => array( - 'pretty_version' => '1.74.0', - 'version' => '1.74.0.0', - 'reference' => '32bf4dba256d60d395582fb6e4e8d3936bcdb713', + 'pretty_version' => '1.57.0', + 'version' => '1.57.0.0', + 'reference' => 'b610c42022ed3a22f831439cb93802f2a4502fdf', 'type' => 'library', 'install_path' => __DIR__ . '/../grpc/grpc', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/guzzle' => array( - 'pretty_version' => '7.10.0', - 'version' => '7.10.0.0', - 'reference' => 'b51ac707cfa420b7bfd4e4d5e510ba8008e822b4', + 'pretty_version' => '7.9.3', + 'version' => '7.9.3.0', + 'reference' => '7b2f29fe81dc4da0ca0ea7d42107a0845946ea77', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/guzzle', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/promises' => array( - 'pretty_version' => '2.3.0', - 'version' => '2.3.0.0', - 'reference' => '481557b130ef3790cf82b713667b43030dc9c957', + 'pretty_version' => '2.2.0', + 'version' => '2.2.0.0', + 'reference' => '7c69f28996b0a6920945dd20b3857e499d9ca96c', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/promises', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/psr7' => array( - 'pretty_version' => '2.8.0', - 'version' => '2.8.0.0', - 'reference' => '21dc724a0583619cd1652f673303492272778051', + 'pretty_version' => '2.7.1', + 'version' => '2.7.1.0', + 'reference' => 'c2270caaabe631b3b44c85f99e5a04bbb8060d16', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 'aliases' => array(), @@ -164,9 +164,9 @@ 'dev_requirement' => false, ), 'paragonie/constant_time_encoding' => array( - 'pretty_version' => 'v3.1.3', - 'version' => '3.1.3.0', - 'reference' => 'd5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77', + 'pretty_version' => 'v3.0.0', + 'version' => '3.0.0.0', + 'reference' => 'df1e7fde177501eee2037dd159cf04f5f301a512', 'type' => 'library', 'install_path' => __DIR__ . '/../paragonie/constant_time_encoding', 'aliases' => array(), @@ -182,18 +182,18 @@ 'dev_requirement' => false, ), 'phpseclib/phpseclib' => array( - 'pretty_version' => '3.0.47', - 'version' => '3.0.47.0', - 'reference' => '9d6ca36a6c2dd434765b1071b2644a1c683b385d', + 'pretty_version' => '3.0.43', + 'version' => '3.0.43.0', + 'reference' => '709ec107af3cb2f385b9617be72af8cf62441d02', 'type' => 'library', 'install_path' => __DIR__ . '/../phpseclib/phpseclib', 'aliases' => array(), 'dev_requirement' => false, ), 'psr/cache' => array( - 'pretty_version' => '2.0.0', - 'version' => '2.0.0.0', - 'reference' => '213f9dbc5b9bfbc4f8db86d2838dc968752ce13b', + 'pretty_version' => '3.0.0', + 'version' => '3.0.0.0', + 'reference' => 'aa5030cfa5405eccfdcb1083ce040c2cb8d253bf', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/cache', 'aliases' => array(), @@ -269,18 +269,18 @@ 'dev_requirement' => false, ), 'ramsey/collection' => array( - 'pretty_version' => '2.1.1', - 'version' => '2.1.1.0', - 'reference' => '344572933ad0181accbf4ba763e85a0306a8c5e2', + 'pretty_version' => '1.3.0', + 'version' => '1.3.0.0', + 'reference' => 'ad7475d1c9e70b190ecffc58f2d989416af339b4', 'type' => 'library', 'install_path' => __DIR__ . '/../ramsey/collection', 'aliases' => array(), 'dev_requirement' => false, ), 'ramsey/uuid' => array( - 'pretty_version' => '4.9.1', - 'version' => '4.9.1.0', - 'reference' => '81f941f6f729b1e3ceea61d9d014f8b6c6800440', + 'pretty_version' => '4.9.0', + 'version' => '4.9.0.0', + 'reference' => '4e0e23cc785f0724a0e838279a9eb03f28b092a0', 'type' => 'library', 'install_path' => __DIR__ . '/../ramsey/uuid', 'aliases' => array(), @@ -289,26 +289,35 @@ 'rhumsaa/uuid' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '4.9.1', + 0 => '4.9.0', ), ), 'rize/uri-template' => array( - 'pretty_version' => '0.4.0', - 'version' => '0.4.0.0', - 'reference' => '56f374a9a42c7c3998f8b55b6b21b224de90c58b', + 'pretty_version' => '0.3.8', + 'version' => '0.3.8.0', + 'reference' => '34a5b96d0b65a5dddb7d20f09b6527a43faede24', 'type' => 'library', 'install_path' => __DIR__ . '/../rize/uri-template', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/deprecation-contracts' => array( - 'pretty_version' => 'v3.6.0', - 'version' => '3.6.0.0', - 'reference' => '63afe740e99a13ba87ec199bb07bbdee937a5b62', + 'pretty_version' => 'v3.0.2', + 'version' => '3.0.2.0', + 'reference' => '26954b3d62a6c5fd0ea8a2a00c0353a14978d05c', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => false, ), + 'symfony/polyfill-php81' => array( + 'pretty_version' => 'v1.32.0', + 'version' => '1.32.0.0', + 'reference' => '4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-php81', + 'aliases' => array(), + 'dev_requirement' => false, + ), ), ); diff --git a/lib/Google/vendor/composer/platform_check.php b/lib/Google/vendor/composer/platform_check.php index d32d90c6a..b168ddd5d 100644 --- a/lib/Google/vendor/composer/platform_check.php +++ b/lib/Google/vendor/composer/platform_check.php @@ -4,8 +4,8 @@ $issues = array(); -if (!(PHP_VERSION_ID >= 80200)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 8.2.0". You are running ' . PHP_VERSION . '.'; +if (!(PHP_VERSION_ID >= 80002)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 8.0.2". You are running ' . PHP_VERSION . '.'; } if ($issues) { diff --git a/lib/Google/vendor/google/apiclient-services/composer.json b/lib/Google/vendor/google/apiclient-services/composer.json index 8712550ac..586694df8 100644 --- a/lib/Google/vendor/google/apiclient-services/composer.json +++ b/lib/Google/vendor/google/apiclient-services/composer.json @@ -6,7 +6,7 @@ "homepage": "http://developers.google.com/api-client-library/php", "license": "Apache-2.0", "require": { - "php": "^8.1" + "php": "^8.0" }, "require-dev": { "phpunit/phpunit": "^9.6" diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage.php b/lib/Google/vendor/google/apiclient-services/src/Storage.php index 4fb7501ec..38cedc75e 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage.php @@ -458,10 +458,6 @@ public function __construct($clientOrConfig = [], $rootUrl = null) 'location' => 'query', 'type' => 'string', ], - 'returnPartialSuccess' => [ - 'location' => 'query', - 'type' => 'boolean', - ], 'softDeleted' => [ 'location' => 'query', 'type' => 'boolean', @@ -1608,10 +1604,6 @@ public function __construct($clientOrConfig = [], $rootUrl = null) 'location' => 'query', 'type' => 'string', ], - 'filter' => [ - 'location' => 'query', - 'type' => 'string', - ], 'includeFoldersAsPrefixes' => [ 'location' => 'query', 'type' => 'boolean', @@ -1708,10 +1700,6 @@ public function __construct($clientOrConfig = [], $rootUrl = null) 'location' => 'query', 'type' => 'string', ], - 'projection' => [ - 'location' => 'query', - 'type' => 'string', - ], 'userProject' => [ 'location' => 'query', 'type' => 'string', diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryption.php b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryption.php index 8c86aa718..c44a60f8b 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryption.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryption.php @@ -19,45 +19,11 @@ class BucketEncryption extends \Google\Model { - protected $customerManagedEncryptionEnforcementConfigType = BucketEncryptionCustomerManagedEncryptionEnforcementConfig::class; - protected $customerManagedEncryptionEnforcementConfigDataType = ''; - protected $customerSuppliedEncryptionEnforcementConfigType = BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig::class; - protected $customerSuppliedEncryptionEnforcementConfigDataType = ''; /** * @var string */ public $defaultKmsKeyName; - protected $googleManagedEncryptionEnforcementConfigType = BucketEncryptionGoogleManagedEncryptionEnforcementConfig::class; - protected $googleManagedEncryptionEnforcementConfigDataType = ''; - /** - * @param BucketEncryptionCustomerManagedEncryptionEnforcementConfig - */ - public function setCustomerManagedEncryptionEnforcementConfig(BucketEncryptionCustomerManagedEncryptionEnforcementConfig $customerManagedEncryptionEnforcementConfig) - { - $this->customerManagedEncryptionEnforcementConfig = $customerManagedEncryptionEnforcementConfig; - } - /** - * @return BucketEncryptionCustomerManagedEncryptionEnforcementConfig - */ - public function getCustomerManagedEncryptionEnforcementConfig() - { - return $this->customerManagedEncryptionEnforcementConfig; - } - /** - * @param BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig - */ - public function setCustomerSuppliedEncryptionEnforcementConfig(BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig $customerSuppliedEncryptionEnforcementConfig) - { - $this->customerSuppliedEncryptionEnforcementConfig = $customerSuppliedEncryptionEnforcementConfig; - } - /** - * @return BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig - */ - public function getCustomerSuppliedEncryptionEnforcementConfig() - { - return $this->customerSuppliedEncryptionEnforcementConfig; - } /** * @param string */ @@ -72,20 +38,6 @@ public function getDefaultKmsKeyName() { return $this->defaultKmsKeyName; } - /** - * @param BucketEncryptionGoogleManagedEncryptionEnforcementConfig - */ - public function setGoogleManagedEncryptionEnforcementConfig(BucketEncryptionGoogleManagedEncryptionEnforcementConfig $googleManagedEncryptionEnforcementConfig) - { - $this->googleManagedEncryptionEnforcementConfig = $googleManagedEncryptionEnforcementConfig; - } - /** - * @return BucketEncryptionGoogleManagedEncryptionEnforcementConfig - */ - public function getGoogleManagedEncryptionEnforcementConfig() - { - return $this->googleManagedEncryptionEnforcementConfig; - } } // Adding a class alias for backwards compatibility with the previous class name. diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerManagedEncryptionEnforcementConfig.php b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerManagedEncryptionEnforcementConfig.php deleted file mode 100644 index c08d47811..000000000 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerManagedEncryptionEnforcementConfig.php +++ /dev/null @@ -1,62 +0,0 @@ -effectiveTime = $effectiveTime; - } - /** - * @return string - */ - public function getEffectiveTime() - { - return $this->effectiveTime; - } - /** - * @param string - */ - public function setRestrictionMode($restrictionMode) - { - $this->restrictionMode = $restrictionMode; - } - /** - * @return string - */ - public function getRestrictionMode() - { - return $this->restrictionMode; - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(BucketEncryptionCustomerManagedEncryptionEnforcementConfig::class, 'Google_Service_Storage_BucketEncryptionCustomerManagedEncryptionEnforcementConfig'); diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig.php b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig.php deleted file mode 100644 index c8971325c..000000000 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig.php +++ /dev/null @@ -1,62 +0,0 @@ -effectiveTime = $effectiveTime; - } - /** - * @return string - */ - public function getEffectiveTime() - { - return $this->effectiveTime; - } - /** - * @param string - */ - public function setRestrictionMode($restrictionMode) - { - $this->restrictionMode = $restrictionMode; - } - /** - * @return string - */ - public function getRestrictionMode() - { - return $this->restrictionMode; - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig::class, 'Google_Service_Storage_BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig'); diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionGoogleManagedEncryptionEnforcementConfig.php b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionGoogleManagedEncryptionEnforcementConfig.php deleted file mode 100644 index 39fee8a7e..000000000 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionGoogleManagedEncryptionEnforcementConfig.php +++ /dev/null @@ -1,62 +0,0 @@ -effectiveTime = $effectiveTime; - } - /** - * @return string - */ - public function getEffectiveTime() - { - return $this->effectiveTime; - } - /** - * @param string - */ - public function setRestrictionMode($restrictionMode) - { - $this->restrictionMode = $restrictionMode; - } - /** - * @return string - */ - public function getRestrictionMode() - { - return $this->restrictionMode; - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(BucketEncryptionGoogleManagedEncryptionEnforcementConfig::class, 'Google_Service_Storage_BucketEncryptionGoogleManagedEncryptionEnforcementConfig'); diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketIpFilter.php b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketIpFilter.php index 735116c6b..8528a0550 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/BucketIpFilter.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/BucketIpFilter.php @@ -20,14 +20,6 @@ class BucketIpFilter extends \Google\Collection { protected $collection_key = 'vpcNetworkSources'; - /** - * @var bool - */ - public $allowAllServiceAgentAccess; - /** - * @var bool - */ - public $allowCrossOrgVpcs; /** * @var string */ @@ -37,34 +29,6 @@ class BucketIpFilter extends \Google\Collection protected $vpcNetworkSourcesType = BucketIpFilterVpcNetworkSources::class; protected $vpcNetworkSourcesDataType = 'array'; - /** - * @param bool - */ - public function setAllowAllServiceAgentAccess($allowAllServiceAgentAccess) - { - $this->allowAllServiceAgentAccess = $allowAllServiceAgentAccess; - } - /** - * @return bool - */ - public function getAllowAllServiceAgentAccess() - { - return $this->allowAllServiceAgentAccess; - } - /** - * @param bool - */ - public function setAllowCrossOrgVpcs($allowCrossOrgVpcs) - { - $this->allowCrossOrgVpcs = $allowCrossOrgVpcs; - } - /** - * @return bool - */ - public function getAllowCrossOrgVpcs() - { - return $this->allowCrossOrgVpcs; - } /** * @param string */ diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/Buckets.php b/lib/Google/vendor/google/apiclient-services/src/Storage/Buckets.php index b1f7864ab..c0e9d0f99 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/Buckets.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/Buckets.php @@ -19,7 +19,7 @@ class Buckets extends \Google\Collection { - protected $collection_key = 'unreachable'; + protected $collection_key = 'items'; protected $itemsType = Bucket::class; protected $itemsDataType = 'array'; /** @@ -30,10 +30,6 @@ class Buckets extends \Google\Collection * @var string */ public $nextPageToken; - /** - * @var string[] - */ - public $unreachable; /** * @param Bucket[] @@ -77,20 +73,6 @@ public function getNextPageToken() { return $this->nextPageToken; } - /** - * @param string[] - */ - public function setUnreachable($unreachable) - { - $this->unreachable = $unreachable; - } - /** - * @return string[] - */ - public function getUnreachable() - { - return $this->unreachable; - } } // Adding a class alias for backwards compatibility with the previous class name. diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/BulkRestoreObjectsRequest.php b/lib/Google/vendor/google/apiclient-services/src/Storage/BulkRestoreObjectsRequest.php index c77adbb53..d7feda6f0 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/BulkRestoreObjectsRequest.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/BulkRestoreObjectsRequest.php @@ -28,14 +28,6 @@ class BulkRestoreObjectsRequest extends \Google\Collection * @var bool */ public $copySourceAcl; - /** - * @var string - */ - public $createdAfterTime; - /** - * @var string - */ - public $createdBeforeTime; /** * @var string[] */ @@ -77,34 +69,6 @@ public function getCopySourceAcl() { return $this->copySourceAcl; } - /** - * @param string - */ - public function setCreatedAfterTime($createdAfterTime) - { - $this->createdAfterTime = $createdAfterTime; - } - /** - * @return string - */ - public function getCreatedAfterTime() - { - return $this->createdAfterTime; - } - /** - * @param string - */ - public function setCreatedBeforeTime($createdBeforeTime) - { - $this->createdBeforeTime = $createdBeforeTime; - } - /** - * @return string - */ - public function getCreatedBeforeTime() - { - return $this->createdBeforeTime; - } /** * @param string[] */ diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/ObjectCustomContextPayload.php b/lib/Google/vendor/google/apiclient-services/src/Storage/ObjectCustomContextPayload.php deleted file mode 100644 index 66a9803b7..000000000 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/ObjectCustomContextPayload.php +++ /dev/null @@ -1,80 +0,0 @@ -createTime = $createTime; - } - /** - * @return string - */ - public function getCreateTime() - { - return $this->createTime; - } - /** - * @param string - */ - public function setUpdateTime($updateTime) - { - $this->updateTime = $updateTime; - } - /** - * @return string - */ - public function getUpdateTime() - { - return $this->updateTime; - } - /** - * @param string - */ - public function setValue($value) - { - $this->value = $value; - } - /** - * @return string - */ - public function getValue() - { - return $this->value; - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ObjectCustomContextPayload::class, 'Google_Service_Storage_ObjectCustomContextPayload'); diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Buckets.php b/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Buckets.php index ab960a20c..3816df7c5 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Buckets.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Buckets.php @@ -165,8 +165,6 @@ public function insert($project, Bucket $postBody, $optParams = []) * @opt_param string prefix Filter results to buckets whose names begin with * this prefix. * @opt_param string projection Set of properties to return. Defaults to noAcl. - * @opt_param bool returnPartialSuccess If true, return a list of bucket - * resource names for buckets that are in unreachable locations. * @opt_param bool softDeleted If true, only soft-deleted bucket versions will * be returned. The default is false. For more information, see [Soft * Delete](https://cloud.google.com/storage/docs/soft-delete). diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Folders.php b/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Folders.php index 2e2395f11..6b9347da0 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Folders.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Folders.php @@ -82,7 +82,7 @@ public function get($bucket, $folder, $optParams = []) * @param Folder $postBody * @param array $optParams Optional parameters. * - * @opt_param bool recursive If true, any parent folder which doesn't exist will + * @opt_param bool recursive If true, any parent folder which doesn’t exist will * be created automatically. * @return Folder * @throws \Google\Service\Exception diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Objects.php b/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Objects.php index 2168ec552..725c488ad 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Objects.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Objects.php @@ -316,9 +316,6 @@ public function insert($bucket, StorageObject $postBody, $optParams = []) * lexicographically before endOffset. If startOffset is also set, the objects * listed will have names between startOffset (inclusive) and endOffset * (exclusive). - * @opt_param string filter Filter the returned objects. Currently only - * supported for the contexts field. If delimiter is set, the returned prefixes - * are exempt from this filter. * @opt_param bool includeFoldersAsPrefixes Only applicable if delimiter is set * to '/'. If true, will also include folders and managed folders (besides * objects) in the returned prefixes. @@ -410,7 +407,6 @@ public function listObjects($bucket, $optParams = []) * match the given value. `ifSourceMetagenerationMatch` and * `ifSourceMetagenerationNotMatch` conditions are mutually exclusive: it's an * error for both of them to be set in the request. - * @opt_param string projection Set of properties to return. Defaults to noAcl. * @opt_param string userProject The project to be billed for this request. * Required for Requester Pays buckets. * @return StorageObject diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/StorageObject.php b/lib/Google/vendor/google/apiclient-services/src/Storage/StorageObject.php index ef8eb1bce..8f4b75b0d 100644 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/StorageObject.php +++ b/lib/Google/vendor/google/apiclient-services/src/Storage/StorageObject.php @@ -50,8 +50,6 @@ class StorageObject extends \Google\Collection * @var string */ public $contentType; - protected $contextsType = StorageObjectContexts::class; - protected $contextsDataType = ''; /** * @var string */ @@ -275,20 +273,6 @@ public function getContentType() { return $this->contentType; } - /** - * @param StorageObjectContexts - */ - public function setContexts(StorageObjectContexts $contexts) - { - $this->contexts = $contexts; - } - /** - * @return StorageObjectContexts - */ - public function getContexts() - { - return $this->contexts; - } /** * @param string */ diff --git a/lib/Google/vendor/google/apiclient-services/src/Storage/StorageObjectContexts.php b/lib/Google/vendor/google/apiclient-services/src/Storage/StorageObjectContexts.php deleted file mode 100644 index 7518dc0e2..000000000 --- a/lib/Google/vendor/google/apiclient-services/src/Storage/StorageObjectContexts.php +++ /dev/null @@ -1,42 +0,0 @@ -custom = $custom; - } - /** - * @return ObjectCustomContextPayload[] - */ - public function getCustom() - { - return $this->custom; - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(StorageObjectContexts::class, 'Google_Service_Storage_StorageObjectContexts'); diff --git a/lib/Google/vendor/google/auth/VERSION b/lib/Google/vendor/google/auth/VERSION index 372cf402c..a50908ca3 100644 --- a/lib/Google/vendor/google/auth/VERSION +++ b/lib/Google/vendor/google/auth/VERSION @@ -1 +1 @@ -1.44.0 +1.42.0 diff --git a/lib/Google/vendor/google/auth/composer.json b/lib/Google/vendor/google/auth/composer.json index 72673f1f2..41a1d0532 100644 --- a/lib/Google/vendor/google/auth/composer.json +++ b/lib/Google/vendor/google/auth/composer.json @@ -9,7 +9,7 @@ "docs": "https://googleapis.github.io/google-auth-library-php/main/" }, "require": { - "php": "^8.1", + "php": "^8.0", "firebase/php-jwt": "^6.0", "guzzlehttp/guzzle": "^7.4.5", "guzzlehttp/psr7": "^2.4.5", diff --git a/lib/Google/vendor/google/auth/src/AccessToken.php b/lib/Google/vendor/google/auth/src/AccessToken.php index 9e27b692e..630b27961 100644 --- a/lib/Google/vendor/google/auth/src/AccessToken.php +++ b/lib/Google/vendor/google/auth/src/AccessToken.php @@ -65,12 +65,12 @@ class AccessToken private $cache; /** - * @param callable|null $httpHandler [optional] An HTTP Handler to deliver PSR-7 requests. - * @param CacheItemPoolInterface|null $cache [optional] A PSR-6 compatible cache implementation. + * @param callable $httpHandler [optional] An HTTP Handler to deliver PSR-7 requests. + * @param CacheItemPoolInterface $cache [optional] A PSR-6 compatible cache implementation. */ public function __construct( - ?callable $httpHandler = null, - ?CacheItemPoolInterface $cache = null + callable $httpHandler = null, + CacheItemPoolInterface $cache = null ) { $this->httpHandler = $httpHandler ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); diff --git a/lib/Google/vendor/google/auth/src/ApplicationDefaultCredentials.php b/lib/Google/vendor/google/auth/src/ApplicationDefaultCredentials.php index 18241670e..80437c8c9 100644 --- a/lib/Google/vendor/google/auth/src/ApplicationDefaultCredentials.php +++ b/lib/Google/vendor/google/auth/src/ApplicationDefaultCredentials.php @@ -21,7 +21,6 @@ use Google\Auth\Credentials\AppIdentityCredentials; use Google\Auth\Credentials\GCECredentials; use Google\Auth\Credentials\ServiceAccountCredentials; -use Google\Auth\Credentials\UserRefreshCredentials; use Google\Auth\HttpHandler\HttpClientCache; use Google\Auth\HttpHandler\HttpHandlerFactory; use Google\Auth\Middleware\AuthTokenMiddleware; @@ -81,18 +80,18 @@ class ApplicationDefaultCredentials * * @param string|string[] $scope the scope of the access request, expressed * either as an Array or as a space-delimited String. - * @param callable|null $httpHandler callback which delivers psr7 request - * @param array|null $cacheConfig configuration for the cache when it's present - * @param CacheItemPoolInterface|null $cache A cache implementation, may be + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be * provided if you have one already available for use. * @return AuthTokenSubscriber * @throws DomainException if no implementation can be obtained. */ public static function getSubscriber(// @phpstan-ignore-line $scope = null, - ?callable $httpHandler = null, - ?array $cacheConfig = null, - ?CacheItemPoolInterface $cache = null + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null ) { $creds = self::getCredentials($scope, $httpHandler, $cacheConfig, $cache); @@ -109,9 +108,9 @@ public static function getSubscriber(// @phpstan-ignore-line * * @param string|string[] $scope the scope of the access request, expressed * either as an Array or as a space-delimited String. - * @param callable|null $httpHandler callback which delivers psr7 request - * @param array|null $cacheConfig configuration for the cache when it's present - * @param CacheItemPoolInterface|null $cache A cache implementation, may be + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be * provided if you have one already available for use. * @param string $quotaProject specifies a project to bill for access * charges associated with the request. @@ -120,9 +119,9 @@ public static function getSubscriber(// @phpstan-ignore-line */ public static function getMiddleware( $scope = null, - ?callable $httpHandler = null, - ?array $cacheConfig = null, - ?CacheItemPoolInterface $cache = null, + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null, $quotaProject = null ) { $creds = self::getCredentials($scope, $httpHandler, $cacheConfig, $cache, $quotaProject); @@ -136,16 +135,16 @@ public static function getMiddleware( * * @param string|string[] $scope the scope of the access request, expressed * either as an Array or as a space-delimited String. - * @param callable|null $httpHandler callback which delivers psr7 request - * @param array|null $cacheConfig configuration for the cache when it's present - * @param CacheItemPoolInterface|null $cache A cache implementation, may be + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be * provided if you have one already available for use. - * @param string|null $quotaProject specifies a project to bill for access + * @param string $quotaProject specifies a project to bill for access * charges associated with the request. - * @param string|string[]|null $defaultScope The default scope to use if no + * @param string|string[] $defaultScope The default scope to use if no * user-defined scopes exist, expressed either as an Array or as a * space-delimited string. - * @param string|null $universeDomain Specifies a universe domain to use for the + * @param string $universeDomain Specifies a universe domain to use for the * calling client library * * @return FetchAuthTokenInterface @@ -153,12 +152,12 @@ public static function getMiddleware( */ public static function getCredentials( $scope = null, - ?callable $httpHandler = null, - ?array $cacheConfig = null, - ?CacheItemPoolInterface $cache = null, + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null, $quotaProject = null, $defaultScope = null, - ?string $universeDomain = null + string $universeDomain = null ) { $creds = null; $jsonKey = CredentialsLoader::fromEnv() @@ -216,18 +215,18 @@ public static function getCredentials( * ID token. * * @param string $targetAudience The audience for the ID token. - * @param callable|null $httpHandler callback which delivers psr7 request - * @param array|null $cacheConfig configuration for the cache when it's present - * @param CacheItemPoolInterface|null $cache A cache implementation, may be + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be * provided if you have one already available for use. * @return AuthTokenMiddleware * @throws DomainException if no implementation can be obtained. */ public static function getIdTokenMiddleware( $targetAudience, - ?callable $httpHandler = null, - ?array $cacheConfig = null, - ?CacheItemPoolInterface $cache = null + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null ) { $creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache); @@ -243,18 +242,18 @@ public static function getIdTokenMiddleware( * ID token. * * @param string $targetAudience The audience for the ID token. - * @param callable|null $httpHandler callback which delivers psr7 request - * @param array|null $cacheConfig configuration for the cache when it's present - * @param CacheItemPoolInterface|null $cache A cache implementation, may be + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be * provided if you have one already available for use. * @return ProxyAuthTokenMiddleware * @throws DomainException if no implementation can be obtained. */ public static function getProxyIdTokenMiddleware( $targetAudience, - ?callable $httpHandler = null, - ?array $cacheConfig = null, - ?CacheItemPoolInterface $cache = null + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null ) { $creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache); @@ -267,9 +266,9 @@ public static function getProxyIdTokenMiddleware( * token. * * @param string $targetAudience The audience for the ID token. - * @param callable|null $httpHandler callback which delivers psr7 request - * @param array|null $cacheConfig configuration for the cache when it's present - * @param CacheItemPoolInterface|null $cache A cache implementation, may be + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be * provided if you have one already available for use. * @return FetchAuthTokenInterface * @throws DomainException if no implementation can be obtained. @@ -277,9 +276,9 @@ public static function getProxyIdTokenMiddleware( */ public static function getIdTokenCredentials( $targetAudience, - ?callable $httpHandler = null, - ?array $cacheConfig = null, - ?CacheItemPoolInterface $cache = null + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null ) { $creds = null; $jsonKey = CredentialsLoader::fromEnv() @@ -299,11 +298,15 @@ public static function getIdTokenCredentials( throw new \InvalidArgumentException('json key is missing the type field'); } - $creds = match ($jsonKey['type']) { - 'authorized_user' => new UserRefreshCredentials(null, $jsonKey, $targetAudience), - 'service_account' => new ServiceAccountCredentials(null, $jsonKey, null, $targetAudience), - default => throw new InvalidArgumentException('invalid value in the type field') - }; + if ($jsonKey['type'] == 'authorized_user') { + throw new InvalidArgumentException('ID tokens are not supported for end user credentials'); + } + + if ($jsonKey['type'] != 'service_account') { + throw new InvalidArgumentException('invalid value in the type field'); + } + + $creds = new ServiceAccountCredentials(null, $jsonKey, null, $targetAudience); } elseif (self::onGce($httpHandler, $cacheConfig, $cache)) { $creds = new GCECredentials(null, null, $targetAudience); $creds->setIsOnGce(true); // save the credentials a trip to the metadata server @@ -331,15 +334,15 @@ private static function notFound() } /** - * @param callable|null $httpHandler - * @param array|null $cacheConfig - * @param CacheItemPoolInterface|null $cache + * @param callable $httpHandler + * @param array $cacheConfig + * @param CacheItemPoolInterface $cache * @return bool */ private static function onGce( - ?callable $httpHandler = null, - ?array $cacheConfig = null, - ?CacheItemPoolInterface $cache = null + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null ) { $gceCacheConfig = []; foreach (['lifetime', 'prefix'] as $key) { diff --git a/lib/Google/vendor/google/auth/src/CredentialSource/AwsNativeSource.php b/lib/Google/vendor/google/auth/src/CredentialSource/AwsNativeSource.php index 880ca1001..6d9244ba2 100644 --- a/lib/Google/vendor/google/auth/src/CredentialSource/AwsNativeSource.php +++ b/lib/Google/vendor/google/auth/src/CredentialSource/AwsNativeSource.php @@ -50,9 +50,9 @@ class AwsNativeSource implements ExternalAccountCredentialSourceInterface public function __construct( string $audience, string $regionalCredVerificationUrl, - ?string $regionUrl = null, - ?string $securityCredentialsUrl = null, - ?string $imdsv2SessionTokenUrl = null + string $regionUrl = null, + string $securityCredentialsUrl = null, + string $imdsv2SessionTokenUrl = null ) { $this->audience = $audience; $this->regionalCredVerificationUrl = $regionalCredVerificationUrl; @@ -61,7 +61,7 @@ public function __construct( $this->imdsv2SessionTokenUrl = $imdsv2SessionTokenUrl; } - public function fetchSubjectToken(?callable $httpHandler = null): string + public function fetchSubjectToken(callable $httpHandler = null): string { if (is_null($httpHandler)) { $httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient()); @@ -103,7 +103,7 @@ public function fetchSubjectToken(?callable $httpHandler = null): string $headers['x-goog-cloud-target-resource'] = $this->audience; // Format headers as they're expected in the subject token - $formattedHeaders = array_map( + $formattedHeaders= array_map( fn ($k, $v) => ['key' => $k, 'value' => $v], array_keys($headers), $headers, diff --git a/lib/Google/vendor/google/auth/src/CredentialSource/ExecutableSource.php b/lib/Google/vendor/google/auth/src/CredentialSource/ExecutableSource.php index f6255bec9..ce3bd9fda 100644 --- a/lib/Google/vendor/google/auth/src/CredentialSource/ExecutableSource.php +++ b/lib/Google/vendor/google/auth/src/CredentialSource/ExecutableSource.php @@ -88,12 +88,12 @@ class ExecutableSource implements ExternalAccountCredentialSourceInterface /** * @param string $command The string command to run to get the subject token. - * @param string|null $outputFile + * @param string $outputFile */ public function __construct( string $command, ?string $outputFile, - ?ExecutableHandler $executableHandler = null, + ExecutableHandler $executableHandler = null, ) { $this->command = $command; $this->outputFile = $outputFile; @@ -113,12 +113,12 @@ public function getCacheKey(): ?string } /** - * @param callable|null $httpHandler unused. + * @param callable $httpHandler unused. * @return string * @throws RuntimeException if the executable is not allowed to run. * @throws ExecutableResponseError if the executable response is invalid. */ - public function fetchSubjectToken(?callable $httpHandler = null): string + public function fetchSubjectToken(callable $httpHandler = null): string { // Check if the executable is allowed to run. if (getenv(self::GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES) !== '1') { diff --git a/lib/Google/vendor/google/auth/src/CredentialSource/FileSource.php b/lib/Google/vendor/google/auth/src/CredentialSource/FileSource.php index 2e79119b8..00ac835a8 100644 --- a/lib/Google/vendor/google/auth/src/CredentialSource/FileSource.php +++ b/lib/Google/vendor/google/auth/src/CredentialSource/FileSource.php @@ -31,15 +31,15 @@ class FileSource implements ExternalAccountCredentialSourceInterface private ?string $subjectTokenFieldName; /** - * @param string $file The file to read the subject token from. - * @param string|null $format The format of the token in the file. Can be null or "json". - * @param string|null $subjectTokenFieldName The name of the field containing the token in the file. This is required - * when format is "json". + * @param string $file The file to read the subject token from. + * @param string $format The format of the token in the file. Can be null or "json". + * @param string $subjectTokenFieldName The name of the field containing the token in the file. This is required + * when format is "json". */ public function __construct( string $file, - ?string $format = null, - ?string $subjectTokenFieldName = null + string $format = null, + string $subjectTokenFieldName = null ) { $this->file = $file; @@ -53,7 +53,7 @@ public function __construct( $this->subjectTokenFieldName = $subjectTokenFieldName; } - public function fetchSubjectToken(?callable $httpHandler = null): string + public function fetchSubjectToken(callable $httpHandler = null): string { $contents = file_get_contents($this->file); if ($this->format === 'json') { diff --git a/lib/Google/vendor/google/auth/src/CredentialSource/UrlSource.php b/lib/Google/vendor/google/auth/src/CredentialSource/UrlSource.php index d2f875ebf..6046d52fa 100644 --- a/lib/Google/vendor/google/auth/src/CredentialSource/UrlSource.php +++ b/lib/Google/vendor/google/auth/src/CredentialSource/UrlSource.php @@ -39,17 +39,17 @@ class UrlSource implements ExternalAccountCredentialSourceInterface private ?array $headers; /** - * @param string $url The URL to fetch the subject token from. - * @param string|null $format The format of the token in the response. Can be null or "json". - * @param string|null $subjectTokenFieldName The name of the field containing the token in the response. This is required + * @param string $url The URL to fetch the subject token from. + * @param string $format The format of the token in the response. Can be null or "json". + * @param string $subjectTokenFieldName The name of the field containing the token in the response. This is required * when format is "json". - * @param array|null $headers Request headers to send in with the request to the URL. + * @param array $headers Request headers to send in with the request to the URL. */ public function __construct( string $url, - ?string $format = null, - ?string $subjectTokenFieldName = null, - ?array $headers = null + string $format = null, + string $subjectTokenFieldName = null, + array $headers = null ) { $this->url = $url; @@ -64,7 +64,7 @@ public function __construct( $this->headers = $headers; } - public function fetchSubjectToken(?callable $httpHandler = null): string + public function fetchSubjectToken(callable $httpHandler = null): string { if (is_null($httpHandler)) { $httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient()); diff --git a/lib/Google/vendor/google/auth/src/Credentials/AppIdentityCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/AppIdentityCredentials.php index 5e4cfa53a..db29438ab 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/AppIdentityCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/AppIdentityCredentials.php @@ -116,7 +116,7 @@ public static function onAppEngine() * As the AppIdentityService uses protobufs to fetch the access token, * the GuzzleHttp\ClientInterface instance passed in will not be used. * - * @param callable|null $httpHandler callback which delivers psr7 request + * @param callable $httpHandler callback which delivers psr7 request * @return array { * A set of auth related metadata, containing the following * @@ -124,7 +124,7 @@ public static function onAppEngine() * @type string $expiration_time * } */ - public function fetchAuthToken(?callable $httpHandler = null) + public function fetchAuthToken(callable $httpHandler = null) { try { $this->checkAppEngineContext(); @@ -161,10 +161,10 @@ public function signBlob($stringToSign, $forceOpenSsl = false) * * Returns null if AppIdentityService is unavailable. * - * @param callable|null $httpHandler Not used by this type. + * @param callable $httpHandler Not used by this type. * @return string|null */ - public function getProjectId(?callable $httpHandler = null) + public function getProjectId(callable $httpHandler = null) { try { $this->checkAppEngineContext(); @@ -181,11 +181,11 @@ public function getProjectId(?callable $httpHandler = null) * * Subsequent calls to this method will return a cached value. * - * @param callable|null $httpHandler Not used in this implementation. + * @param callable $httpHandler Not used in this implementation. * @return string * @throws \Exception If AppEngine SDK or mock is not available. */ - public function getClientName(?callable $httpHandler = null) + public function getClientName(callable $httpHandler = null) { $this->checkAppEngineContext(); diff --git a/lib/Google/vendor/google/auth/src/Credentials/ExternalAccountCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/ExternalAccountCredentials.php index 478063be1..3614d24d0 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/ExternalAccountCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/ExternalAccountCredentials.php @@ -211,7 +211,7 @@ private static function buildCredentialSource(array $jsonKey): ExternalAccountCr /** * @param string $stsToken - * @param callable|null $httpHandler + * @param callable $httpHandler * * @return array { * A set of auth related metadata, containing the following @@ -220,7 +220,7 @@ private static function buildCredentialSource(array $jsonKey): ExternalAccountCr * @type int $expires_at * } */ - private function getImpersonatedAccessToken(string $stsToken, ?callable $httpHandler = null): array + private function getImpersonatedAccessToken(string $stsToken, callable $httpHandler = null): array { if (!isset($this->serviceAccountImpersonationUrl)) { throw new InvalidArgumentException( @@ -251,9 +251,7 @@ private function getImpersonatedAccessToken(string $stsToken, ?callable $httpHan } /** - * @param callable|null $httpHandler - * @param array $headers [optional] Metrics headers to be inserted - * into the token endpoint request present. + * @param callable $httpHandler * * @return array { * A set of auth related metadata, containing the following @@ -265,9 +263,9 @@ private function getImpersonatedAccessToken(string $stsToken, ?callable $httpHan * @type string $token_type (identity pool only) * } */ - public function fetchAuthToken(?callable $httpHandler = null, array $headers = []) + public function fetchAuthToken(callable $httpHandler = null) { - $stsToken = $this->auth->fetchAuthToken($httpHandler, $headers); + $stsToken = $this->auth->fetchAuthToken($httpHandler); if (isset($this->serviceAccountImpersonationUrl)) { return $this->getImpersonatedAccessToken($stsToken['access_token'], $httpHandler); @@ -327,13 +325,13 @@ public function getUniverseDomain(): string /** * Get the project ID. * - * @param callable|null $httpHandler Callback which delivers psr7 request - * @param string|null $accessToken The access token to use to sign the blob. If + * @param callable $httpHandler Callback which delivers psr7 request + * @param string $accessToken The access token to use to sign the blob. If * provided, saves a call to the metadata server for a new access * token. **Defaults to** `null`. * @return string|null */ - public function getProjectId(?callable $httpHandler = null, ?string $accessToken = null) + public function getProjectId(callable $httpHandler = null, string $accessToken = null) { if (isset($this->projectId)) { return $this->projectId; diff --git a/lib/Google/vendor/google/auth/src/Credentials/GCECredentials.php b/lib/Google/vendor/google/auth/src/Credentials/GCECredentials.php index ab6753bd8..8b7547816 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/GCECredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/GCECredentials.php @@ -100,7 +100,7 @@ class GCECredentials extends CredentialsLoader implements /** * The metadata path of the project ID. */ - const UNIVERSE_DOMAIN_URI_PATH = 'v1/universe/universe-domain'; + const UNIVERSE_DOMAIN_URI_PATH = 'v1/universe/universe_domain'; /** * The header whose presence indicates GCE presence. @@ -199,7 +199,7 @@ class GCECredentials extends CredentialsLoader implements private ?string $universeDomain; /** - * @param Iam|null $iam [optional] An IAM instance. + * @param Iam $iam [optional] An IAM instance. * @param string|string[] $scope [optional] the scope of the access request, * expressed either as an array or as a space-delimited string. * @param string $targetAudience [optional] The audience for the ID token. @@ -207,16 +207,16 @@ class GCECredentials extends CredentialsLoader implements * charges associated with the request. * @param string $serviceAccountIdentity [optional] Specify a service * account identity name to use instead of "default". - * @param string|null $universeDomain [optional] Specify a universe domain to use + * @param string $universeDomain [optional] Specify a universe domain to use * instead of fetching one from the metadata server. */ public function __construct( - ?Iam $iam = null, + Iam $iam = null, $scope = null, $targetAudience = null, $quotaProject = null, $serviceAccountIdentity = null, - ?string $universeDomain = null + string $universeDomain = null ) { $this->iam = $iam; @@ -355,10 +355,10 @@ public static function onAppEngineFlexible() * host. * If $httpHandler is not specified a the default HttpHandler is used. * - * @param callable|null $httpHandler callback which delivers psr7 request + * @param callable $httpHandler callback which delivers psr7 request * @return bool True if this a GCEInstance, false otherwise */ - public static function onGce(?callable $httpHandler = null) + public static function onGce(callable $httpHandler = null) { $httpHandler = $httpHandler ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); @@ -426,12 +426,12 @@ private static function detectResidencyWindows(string $registryProductKey): bool try { $productName = $shell->regRead($registryProductKey); - } catch (com_exception) { + } catch(com_exception) { // This means that we tried to read a key that doesn't exist on the registry // which might mean that it is a windows instance that is not on GCE return false; } - + return 0 === strpos($productName, self::PRODUCT_NAME); } @@ -441,9 +441,7 @@ private static function detectResidencyWindows(string $registryProductKey): bool * Fetches the auth tokens from the GCE metadata host if it is available. * If $httpHandler is not specified a the default HttpHandler is used. * - * @param callable|null $httpHandler callback which delivers psr7 request - * @param array $headers [optional] Headers to be inserted - * into the token endpoint request present. + * @param callable $httpHandler callback which delivers psr7 request * * @return array { * A set of auth related metadata, based on the token type. @@ -455,7 +453,7 @@ private static function detectResidencyWindows(string $registryProductKey): bool * } * @throws \Exception */ - public function fetchAuthToken(?callable $httpHandler = null, array $headers = []) + public function fetchAuthToken(callable $httpHandler = null) { $httpHandler = $httpHandler ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); @@ -471,7 +469,7 @@ public function fetchAuthToken(?callable $httpHandler = null, array $headers = [ $response = $this->getFromMetadata( $httpHandler, $this->tokenUri, - $this->applyTokenEndpointMetrics($headers, $this->targetAudience ? 'it' : 'at') + $this->applyTokenEndpointMetrics([], $this->targetAudience ? 'it' : 'at') ); if ($this->targetAudience) { @@ -526,10 +524,10 @@ public function getLastReceivedToken() * * Subsequent calls will return a cached value. * - * @param callable|null $httpHandler callback which delivers psr7 request + * @param callable $httpHandler callback which delivers psr7 request * @return string */ - public function getClientName(?callable $httpHandler = null) + public function getClientName(callable $httpHandler = null) { if ($this->clientName) { return $this->clientName; @@ -560,10 +558,10 @@ public function getClientName(?callable $httpHandler = null) * * Returns null if called outside GCE. * - * @param callable|null $httpHandler Callback which delivers psr7 request + * @param callable $httpHandler Callback which delivers psr7 request * @return string|null */ - public function getProjectId(?callable $httpHandler = null) + public function getProjectId(callable $httpHandler = null) { if ($this->projectId) { return $this->projectId; @@ -588,10 +586,10 @@ public function getProjectId(?callable $httpHandler = null) /** * Fetch the default universe domain from the metadata server. * - * @param callable|null $httpHandler Callback which delivers psr7 request + * @param callable $httpHandler Callback which delivers psr7 request * @return string */ - public function getUniverseDomain(?callable $httpHandler = null): string + public function getUniverseDomain(callable $httpHandler = null): string { if (null !== $this->universeDomain) { return $this->universeDomain; diff --git a/lib/Google/vendor/google/auth/src/Credentials/IAMCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/IAMCredentials.php index 96d1df734..98780c6e0 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/IAMCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/IAMCredentials.php @@ -71,7 +71,7 @@ public function getUpdateMetadataFunc() * * @param array $metadata metadata hashmap * @param string $unusedAuthUri optional auth uri - * @param callable|null $httpHandler callback which delivers psr7 request + * @param callable $httpHandler callback which delivers psr7 request * Note: this param is unused here, only included here for * consistency with other credentials class * @@ -80,7 +80,7 @@ public function getUpdateMetadataFunc() public function updateMetadata( $metadata, $unusedAuthUri = null, - ?callable $httpHandler = null + callable $httpHandler = null ) { $metadata_copy = $metadata; $metadata_copy[self::SELECTOR_KEY] = $this->selector; diff --git a/lib/Google/vendor/google/auth/src/Credentials/ImpersonatedServiceAccountCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/ImpersonatedServiceAccountCredentials.php index b907d8d96..5d3522827 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/ImpersonatedServiceAccountCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/ImpersonatedServiceAccountCredentials.php @@ -18,20 +18,12 @@ namespace Google\Auth\Credentials; -use Google\Auth\CacheTrait; use Google\Auth\CredentialsLoader; -use Google\Auth\FetchAuthTokenInterface; -use Google\Auth\HttpHandler\HttpClientCache; -use Google\Auth\HttpHandler\HttpHandlerFactory; use Google\Auth\IamSignerTrait; use Google\Auth\SignBlobInterface; -use GuzzleHttp\Psr7\Request; -use InvalidArgumentException; -use LogicException; class ImpersonatedServiceAccountCredentials extends CredentialsLoader implements SignBlobInterface { - use CacheTrait; use IamSignerTrait; private const CRED_TYPE = 'imp'; @@ -41,36 +33,19 @@ class ImpersonatedServiceAccountCredentials extends CredentialsLoader implements */ protected $impersonatedServiceAccountName; - protected FetchAuthTokenInterface $sourceCredentials; - - private string $serviceAccountImpersonationUrl; - /** - * @var string[] + * @var UserRefreshCredentials */ - private array $delegates; - - /** - * @var string|string[] - */ - private string|array $targetScope; - - private int $lifetime; + protected $sourceCredentials; /** * Instantiate an instance of ImpersonatedServiceAccountCredentials from a credentials file that - * has be created with the --impersonate-service-account flag. - * - * @param string|string[]|null $scope The scope of the access request, expressed either as an - * array or as a space-delimited string. - * @param string|array $jsonKey JSON credential file path or JSON array credentials { - * JSON credentials as an associative array. + * has be created with the --impersonated-service-account flag. * - * @type string $service_account_impersonation_url The URL to the service account - * @type string|FetchAuthTokenInterface $source_credentials The source credentials to impersonate - * @type int $lifetime The lifetime of the impersonated credentials - * @type string[] $delegates The delegates to impersonate - * } + * @param string|string[] $scope The scope of the access request, expressed either as an + * array or as a space-delimited string. + * @param string|array $jsonKey JSON credential file path or JSON credentials + * as an associative array. */ public function __construct( $scope, @@ -78,38 +53,30 @@ public function __construct( ) { if (is_string($jsonKey)) { if (!file_exists($jsonKey)) { - throw new InvalidArgumentException('file does not exist'); + throw new \InvalidArgumentException('file does not exist'); } $json = file_get_contents($jsonKey); if (!$jsonKey = json_decode((string) $json, true)) { - throw new LogicException('invalid json for auth config'); + throw new \LogicException('invalid json for auth config'); } } if (!array_key_exists('service_account_impersonation_url', $jsonKey)) { - throw new LogicException( + throw new \LogicException( 'json key is missing the service_account_impersonation_url field' ); } if (!array_key_exists('source_credentials', $jsonKey)) { - throw new LogicException('json key is missing the source_credentials field'); - } - if (is_array($jsonKey['source_credentials'])) { - if (!array_key_exists('type', $jsonKey['source_credentials'])) { - throw new InvalidArgumentException('json key source credentials are missing the type field'); - } - $jsonKey['source_credentials'] = CredentialsLoader::makeCredentials($scope, $jsonKey['source_credentials']); + throw new \LogicException('json key is missing the source_credentials field'); } - $this->targetScope = $scope ?? []; - $this->lifetime = $jsonKey['lifetime'] ?? 3600; - $this->delegates = $jsonKey['delegates'] ?? []; - - $this->serviceAccountImpersonationUrl = $jsonKey['service_account_impersonation_url']; $this->impersonatedServiceAccountName = $this->getImpersonatedServiceAccountNameFromUrl( - $this->serviceAccountImpersonationUrl + $jsonKey['service_account_impersonation_url'] ); - $this->sourceCredentials = $jsonKey['source_credentials']; + $this->sourceCredentials = new UserRefreshCredentials( + $scope, + $jsonKey['source_credentials'] + ); } /** @@ -136,13 +103,13 @@ private function getImpersonatedServiceAccountNameFromUrl( * @param callable|null $unusedHttpHandler not used by this credentials type. * @return string Token issuer email */ - public function getClientName(?callable $unusedHttpHandler = null) + public function getClientName(callable $unusedHttpHandler = null) { return $this->impersonatedServiceAccountName; } /** - * @param callable|null $httpHandler + * @param callable $httpHandler * * @return array { * A set of auth related metadata, containing the following @@ -154,45 +121,13 @@ public function getClientName(?callable $unusedHttpHandler = null) * @type string $id_token * } */ - public function fetchAuthToken(?callable $httpHandler = null) + public function fetchAuthToken(callable $httpHandler = null) { - $httpHandler = $httpHandler ?? HttpHandlerFactory::build(HttpClientCache::getHttpClient()); - - // The FetchAuthTokenInterface technically does not have a "headers" argument, but all of - // the implementations do. Additionally, passing in more parameters than the function has - // defined is allowed in PHP. So we'll just ignore the phpstan error here. - // @phpstan-ignore-next-line - $authToken = $this->sourceCredentials->fetchAuthToken( + // We don't support id token endpoint requests as of now for Impersonated Cred + return $this->sourceCredentials->fetchAuthToken( $httpHandler, $this->applyTokenEndpointMetrics([], 'at') ); - - $headers = $this->applyTokenEndpointMetrics([ - 'Content-Type' => 'application/json', - 'Cache-Control' => 'no-store', - 'Authorization' => sprintf('Bearer %s', $authToken['access_token'] ?? $authToken['id_token']), - ], 'at'); - - $body = [ - 'scope' => $this->targetScope, - 'delegates' => $this->delegates, - 'lifetime' => sprintf('%ss', $this->lifetime), - ]; - - $request = new Request( - 'POST', - $this->serviceAccountImpersonationUrl, - $headers, - (string) json_encode($body) - ); - - $response = $httpHandler($request); - $body = json_decode((string) $response->getBody(), true); - - return [ - 'access_token' => $body['accessToken'], - 'expires_at' => strtotime($body['expireTime']), - ]; } /** @@ -203,9 +138,7 @@ public function fetchAuthToken(?callable $httpHandler = null) */ public function getCacheKey() { - return $this->getFullCacheKey( - $this->serviceAccountImpersonationUrl . $this->sourceCredentials->getCacheKey() - ); + return $this->sourceCredentials->getCacheKey(); } /** diff --git a/lib/Google/vendor/google/auth/src/Credentials/InsecureCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/InsecureCredentials.php index 5a2bef1c5..9b9e24b11 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/InsecureCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/InsecureCredentials.php @@ -36,10 +36,10 @@ class InsecureCredentials implements FetchAuthTokenInterface /** * Fetches the auth token. In this case it returns an empty string. * - * @param callable|null $httpHandler + * @param callable $httpHandler * @return array{access_token:string} A set of auth related metadata */ - public function fetchAuthToken(?callable $httpHandler = null) + public function fetchAuthToken(callable $httpHandler = null) { return $this->token; } diff --git a/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php index 3d23f71af..5e7915333 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php @@ -17,10 +17,8 @@ namespace Google\Auth\Credentials; -use Firebase\JWT\JWT; use Google\Auth\CredentialsLoader; use Google\Auth\GetQuotaProjectInterface; -use Google\Auth\Iam; use Google\Auth\OAuth2; use Google\Auth\ProjectIdProviderInterface; use Google\Auth\ServiceAccountSignerTrait; @@ -73,7 +71,6 @@ class ServiceAccountCredentials extends CredentialsLoader implements * @var string */ private const CRED_TYPE = 'sa'; - private const IAM_SCOPE = 'https://www.googleapis.com/auth/iam'; /** * The OAuth2 instance used to conduct authorization. @@ -114,12 +111,6 @@ class ServiceAccountCredentials extends CredentialsLoader implements */ private string $universeDomain; - /** - * Whether this is an ID token request or an access token request. Used when - * building the metric header. - */ - private bool $isIdTokenRequest = false; - /** * Create a new ServiceAccountCredentials. * @@ -167,7 +158,6 @@ public function __construct( $additionalClaims = []; if ($targetAudience) { $additionalClaims = ['target_audience' => $targetAudience]; - $this->isIdTokenRequest = true; } $this->auth = new OAuth2([ 'audience' => self::TOKEN_CREDENTIAL_URI, @@ -175,7 +165,6 @@ public function __construct( 'scope' => $scope, 'signingAlgorithm' => 'RS256', 'signingKey' => $jsonKey['private_key'], - 'signingKeyId' => $jsonKey['private_key_id'] ?? null, 'sub' => $sub, 'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI, 'additionalClaims' => $additionalClaims, @@ -200,9 +189,7 @@ public function useJwtAccessWithScope() } /** - * @param callable|null $httpHandler - * @param array $headers [optional] Headers to be inserted - * into the token endpoint request present. + * @param callable $httpHandler * * @return array { * A set of auth related metadata, containing the following @@ -212,7 +199,7 @@ public function useJwtAccessWithScope() * @type string $token_type * } */ - public function fetchAuthToken(?callable $httpHandler = null, array $headers = []) + public function fetchAuthToken(callable $httpHandler = null) { if ($this->useSelfSignedJwt()) { $jwtCreds = $this->createJwtAccessCredentials(); @@ -226,34 +213,9 @@ public function fetchAuthToken(?callable $httpHandler = null, array $headers = [ return $accessToken; } - - if ($this->isIdTokenRequest && $this->getUniverseDomain() !== self::DEFAULT_UNIVERSE_DOMAIN) { - $now = time(); - $jwt = Jwt::encode( - [ - 'iss' => $this->auth->getIssuer(), - 'sub' => $this->auth->getIssuer(), - 'scope' => self::IAM_SCOPE, - 'exp' => ($now + $this->auth->getExpiry()), - 'iat' => ($now - OAuth2::DEFAULT_SKEW_SECONDS), - ], - $this->auth->getSigningKey(), - $this->auth->getSigningAlgorithm(), - $this->auth->getSigningKeyId() - ); - // We create a new instance of Iam each time because the `$httpHandler` might change. - $idToken = (new Iam($httpHandler, $this->getUniverseDomain()))->generateIdToken( - $this->auth->getIssuer(), - $this->auth->getAdditionalClaims()['target_audience'], - $jwt, - $this->applyTokenEndpointMetrics($headers, 'it') - ); - return ['id_token' => $idToken]; - } - return $this->auth->fetchAuthToken( - $httpHandler, - $this->applyTokenEndpointMetrics($headers, $this->isIdTokenRequest ? 'it' : 'at') - ); + $authRequestType = empty($this->auth->getAdditionalClaims()['target_audience']) + ? 'at' : 'it'; + return $this->auth->fetchAuthToken($httpHandler, $this->applyTokenEndpointMetrics([], $authRequestType)); } /** @@ -296,10 +258,10 @@ public function getLastReceivedToken() * * Returns null if the project ID does not exist in the keyfile. * - * @param callable|null $httpHandler Not used by this credentials type. + * @param callable $httpHandler Not used by this credentials type. * @return string|null */ - public function getProjectId(?callable $httpHandler = null) + public function getProjectId(callable $httpHandler = null) { return $this->projectId; } @@ -309,13 +271,13 @@ public function getProjectId(?callable $httpHandler = null) * * @param array $metadata metadata hashmap * @param string $authUri optional auth uri - * @param callable|null $httpHandler callback which delivers psr7 request + * @param callable $httpHandler callback which delivers psr7 request * @return array updated metadata hashmap */ public function updateMetadata( $metadata, $authUri = null, - ?callable $httpHandler = null + callable $httpHandler = null ) { // scope exists. use oauth implementation if (!$this->useSelfSignedJwt()) { @@ -373,10 +335,10 @@ public function setSub($sub) * * In this case, it returns the keyfile's client_email key. * - * @param callable|null $httpHandler Not used by this credentials type. + * @param callable $httpHandler Not used by this credentials type. * @return string */ - public function getClientName(?callable $httpHandler = null) + public function getClientName(callable $httpHandler = null) { return $this->auth->getIssuer(); } @@ -437,8 +399,8 @@ private function useSelfSignedJwt() return false; } - // Do not use self-signed JWT for ID tokens - if ($this->isIdTokenRequest) { + // If claims are set, this call is for "id_tokens" + if ($this->auth->getAdditionalClaims()) { return false; } diff --git a/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php index 50373760b..7bdc21848 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php @@ -114,13 +114,13 @@ public function __construct($jsonKey, $scope = null) * * @param array $metadata metadata hashmap * @param string $authUri optional auth uri - * @param callable|null $httpHandler callback which delivers psr7 request + * @param callable $httpHandler callback which delivers psr7 request * @return array updated metadata hashmap */ public function updateMetadata( $metadata, $authUri = null, - ?callable $httpHandler = null + callable $httpHandler = null ) { $scope = $this->auth->getScope(); if (empty($authUri) && empty($scope)) { @@ -135,11 +135,11 @@ public function updateMetadata( /** * Implements FetchAuthTokenInterface#fetchAuthToken. * - * @param callable|null $httpHandler + * @param callable $httpHandler * * @return null|array{access_token:string} A set of auth related metadata */ - public function fetchAuthToken(?callable $httpHandler = null) + public function fetchAuthToken(callable $httpHandler = null) { $audience = $this->auth->getAudience(); $scope = $this->auth->getScope(); @@ -196,10 +196,10 @@ public function getLastReceivedToken() * * Returns null if the project ID does not exist in the keyfile. * - * @param callable|null $httpHandler Not used by this credentials type. + * @param callable $httpHandler Not used by this credentials type. * @return string|null */ - public function getProjectId(?callable $httpHandler = null) + public function getProjectId(callable $httpHandler = null) { return $this->projectId; } @@ -209,10 +209,10 @@ public function getProjectId(?callable $httpHandler = null) * * In this case, it returns the keyfile's client_email key. * - * @param callable|null $httpHandler Not used by this credentials type. + * @param callable $httpHandler Not used by this credentials type. * @return string */ - public function getClientName(?callable $httpHandler = null) + public function getClientName(callable $httpHandler = null) { return $this->auth->getIssuer(); } diff --git a/lib/Google/vendor/google/auth/src/Credentials/UserRefreshCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/UserRefreshCredentials.php index 326f6cd86..d40055562 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/UserRefreshCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/UserRefreshCredentials.php @@ -20,8 +20,6 @@ use Google\Auth\CredentialsLoader; use Google\Auth\GetQuotaProjectInterface; use Google\Auth\OAuth2; -use InvalidArgumentException; -use LogicException; /** * Authenticates requests using User Refresh credentials. @@ -57,67 +55,48 @@ class UserRefreshCredentials extends CredentialsLoader implements GetQuotaProjec */ protected $quotaProject; - /** - * Whether this is an ID token request or an access token request. Used when - * building the metric header. - */ - private bool $isIdTokenRequest = false; - /** * Create a new UserRefreshCredentials. * - * @param string|string[]|null $scope the scope of the access request, expressed + * @param string|string[] $scope the scope of the access request, expressed * either as an Array or as a space-delimited String. * @param string|array $jsonKey JSON credential file path or JSON credentials * as an associative array - * @param string|null $targetAudience The audience for the ID token. */ public function __construct( $scope, - $jsonKey, - ?string $targetAudience = null + $jsonKey ) { if (is_string($jsonKey)) { if (!file_exists($jsonKey)) { - throw new InvalidArgumentException('file does not exist or is unreadable'); + throw new \InvalidArgumentException('file does not exist'); } $json = file_get_contents($jsonKey); if (!$jsonKey = json_decode((string) $json, true)) { - throw new LogicException('invalid json for auth config'); + throw new \LogicException('invalid json for auth config'); } } if (!array_key_exists('client_id', $jsonKey)) { - throw new InvalidArgumentException( + throw new \InvalidArgumentException( 'json key is missing the client_id field' ); } if (!array_key_exists('client_secret', $jsonKey)) { - throw new InvalidArgumentException( + throw new \InvalidArgumentException( 'json key is missing the client_secret field' ); } if (!array_key_exists('refresh_token', $jsonKey)) { - throw new InvalidArgumentException( + throw new \InvalidArgumentException( 'json key is missing the refresh_token field' ); } - if ($scope && $targetAudience) { - throw new InvalidArgumentException( - 'Scope and targetAudience cannot both be supplied' - ); - } - $additionalClaims = []; - if ($targetAudience) { - $additionalClaims = ['target_audience' => $targetAudience]; - $this->isIdTokenRequest = true; - } $this->auth = new OAuth2([ 'clientId' => $jsonKey['client_id'], 'clientSecret' => $jsonKey['client_secret'], 'refresh_token' => $jsonKey['refresh_token'], 'scope' => $scope, 'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI, - 'additionalClaims' => $additionalClaims, ]); if (array_key_exists('quota_project_id', $jsonKey)) { $this->quotaProject = (string) $jsonKey['quota_project_id']; @@ -125,8 +104,8 @@ public function __construct( } /** - * @param callable|null $httpHandler - * @param array $headers [optional] Metrics headers to be inserted + * @param callable $httpHandler + * @param array $metricsHeader [optional] Metrics headers to be inserted * into the token endpoint request present. * This could be passed from ImersonatedServiceAccountCredentials as it uses * UserRefreshCredentials as source credentials. @@ -141,11 +120,12 @@ public function __construct( * @type string $id_token * } */ - public function fetchAuthToken(?callable $httpHandler = null, array $headers = []) + public function fetchAuthToken(callable $httpHandler = null, array $metricsHeader = []) { + // We don't support id token endpoint requests as of now for User Cred return $this->auth->fetchAuthToken( $httpHandler, - $this->applyTokenEndpointMetrics($headers, $this->isIdTokenRequest ? 'it' : 'at') + $this->applyTokenEndpointMetrics($metricsHeader, 'at') ); } diff --git a/lib/Google/vendor/google/auth/src/CredentialsLoader.php b/lib/Google/vendor/google/auth/src/CredentialsLoader.php index 6e21a27c0..746b957a9 100644 --- a/lib/Google/vendor/google/auth/src/CredentialsLoader.php +++ b/lib/Google/vendor/google/auth/src/CredentialsLoader.php @@ -85,7 +85,6 @@ public static function fromEnv() throw new \DomainException(self::unableToReadEnv($cause)); } $jsonKey = file_get_contents($path); - return json_decode((string) $jsonKey, true); } @@ -166,15 +165,15 @@ public static function makeCredentials( * * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token * @param array $httpClientOptions (optional) Array of request options to apply. - * @param callable|null $httpHandler (optional) http client to fetch the token. - * @param callable|null $tokenCallback (optional) function to be called when a new token is fetched. + * @param callable $httpHandler (optional) http client to fetch the token. + * @param callable $tokenCallback (optional) function to be called when a new token is fetched. * @return \GuzzleHttp\Client */ public static function makeHttpClient( FetchAuthTokenInterface $fetcher, array $httpClientOptions = [], - ?callable $httpHandler = null, - ?callable $tokenCallback = null + callable $httpHandler = null, + callable $tokenCallback = null ) { $middleware = new Middleware\AuthTokenMiddleware( $fetcher, diff --git a/lib/Google/vendor/google/auth/src/ExternalAccountCredentialSourceInterface.php b/lib/Google/vendor/google/auth/src/ExternalAccountCredentialSourceInterface.php index 1492c6991..041b18d51 100644 --- a/lib/Google/vendor/google/auth/src/ExternalAccountCredentialSourceInterface.php +++ b/lib/Google/vendor/google/auth/src/ExternalAccountCredentialSourceInterface.php @@ -1,5 +1,5 @@ |null $cacheConfig Configuration for the cache + * @param array $cacheConfig Configuration for the cache * @param CacheItemPoolInterface $cache */ public function __construct( FetchAuthTokenInterface $fetcher, - ?array $cacheConfig = null, - ?CacheItemPoolInterface $cache = null + array $cacheConfig = null, + CacheItemPoolInterface $cache ) { $this->fetcher = $fetcher; $this->cache = $cache; @@ -76,11 +76,11 @@ public function getFetcher() * Checks the cache for a valid auth token and fetches the auth tokens * from the supplied fetcher. * - * @param callable|null $httpHandler callback which delivers psr7 request + * @param callable $httpHandler callback which delivers psr7 request * @return array the response * @throws \Exception */ - public function fetchAuthToken(?callable $httpHandler = null) + public function fetchAuthToken(callable $httpHandler = null) { if ($cached = $this->fetchAuthTokenFromCache()) { return $cached; @@ -112,10 +112,10 @@ public function getLastReceivedToken() /** * Get the client name from the fetcher. * - * @param callable|null $httpHandler An HTTP handler to deliver PSR7 requests. + * @param callable $httpHandler An HTTP handler to deliver PSR7 requests. * @return string */ - public function getClientName(?callable $httpHandler = null) + public function getClientName(callable $httpHandler = null) { if (!$this->fetcher instanceof SignBlobInterface) { throw new \RuntimeException( @@ -176,15 +176,15 @@ public function getQuotaProject() return null; } - /** + /* * Get the Project ID from the fetcher. * - * @param callable|null $httpHandler Callback which delivers psr7 request + * @param callable $httpHandler Callback which delivers psr7 request * @return string|null * @throws \RuntimeException If the fetcher does not implement * `Google\Auth\ProvidesProjectIdInterface`. */ - public function getProjectId(?callable $httpHandler = null) + public function getProjectId(callable $httpHandler = null) { if (!$this->fetcher instanceof ProjectIdProviderInterface) { throw new \RuntimeException( @@ -227,7 +227,7 @@ public function getUniverseDomain(): string * * @param array $metadata metadata hashmap * @param string $authUri optional auth uri - * @param callable|null $httpHandler callback which delivers psr7 request + * @param callable $httpHandler callback which delivers psr7 request * @return array updated metadata hashmap * @throws \RuntimeException If the fetcher does not implement * `Google\Auth\UpdateMetadataInterface`. @@ -235,7 +235,7 @@ public function getUniverseDomain(): string public function updateMetadata( $metadata, $authUri = null, - ?callable $httpHandler = null + callable $httpHandler = null ) { if (!$this->fetcher instanceof UpdateMetadataInterface) { throw new \RuntimeException( diff --git a/lib/Google/vendor/google/auth/src/FetchAuthTokenInterface.php b/lib/Google/vendor/google/auth/src/FetchAuthTokenInterface.php index fbbd8b0c9..64659550b 100644 --- a/lib/Google/vendor/google/auth/src/FetchAuthTokenInterface.php +++ b/lib/Google/vendor/google/auth/src/FetchAuthTokenInterface.php @@ -25,10 +25,10 @@ interface FetchAuthTokenInterface /** * Fetches the auth tokens based on the current state. * - * @param callable|null $httpHandler callback which delivers psr7 request + * @param callable $httpHandler callback which delivers psr7 request * @return array a hash of auth tokens */ - public function fetchAuthToken(?callable $httpHandler = null); + public function fetchAuthToken(callable $httpHandler = null); /** * Obtains a key that can used to cache the results of #fetchAuthToken. diff --git a/lib/Google/vendor/google/auth/src/GCECache.php b/lib/Google/vendor/google/auth/src/GCECache.php index d3dcd8c6c..804abdbe2 100644 --- a/lib/Google/vendor/google/auth/src/GCECache.php +++ b/lib/Google/vendor/google/auth/src/GCECache.php @@ -46,8 +46,8 @@ class GCECache * @param CacheItemPoolInterface $cache */ public function __construct( - ?array $cacheConfig = null, - ?CacheItemPoolInterface $cache = null + array $cacheConfig = null, + CacheItemPoolInterface $cache = null ) { $this->cache = $cache; $this->cacheConfig = array_merge([ @@ -60,10 +60,10 @@ public function __construct( * Caches the result of onGce so the metadata server is not called multiple * times. * - * @param callable|null $httpHandler callback which delivers psr7 request + * @param callable $httpHandler callback which delivers psr7 request * @return bool True if this a GCEInstance, false otherwise */ - public function onGce(?callable $httpHandler = null) + public function onGce(callable $httpHandler = null) { if (is_null($this->cache)) { return GCECredentials::onGce($httpHandler); diff --git a/lib/Google/vendor/google/auth/src/HttpHandler/HttpClientCache.php b/lib/Google/vendor/google/auth/src/HttpHandler/HttpClientCache.php index 0159c8d09..f4a62b967 100644 --- a/lib/Google/vendor/google/auth/src/HttpHandler/HttpClientCache.php +++ b/lib/Google/vendor/google/auth/src/HttpHandler/HttpClientCache.php @@ -37,7 +37,7 @@ class HttpClientCache * @param ClientInterface|null $client * @return void */ - public static function setHttpClient(?ClientInterface $client = null) + public static function setHttpClient(ClientInterface $client = null) { self::$httpClient = $client; } diff --git a/lib/Google/vendor/google/auth/src/HttpHandler/HttpHandlerFactory.php b/lib/Google/vendor/google/auth/src/HttpHandler/HttpHandlerFactory.php index 3856022a2..f19f87443 100644 --- a/lib/Google/vendor/google/auth/src/HttpHandler/HttpHandlerFactory.php +++ b/lib/Google/vendor/google/auth/src/HttpHandler/HttpHandlerFactory.php @@ -27,11 +27,11 @@ class HttpHandlerFactory /** * Builds out a default http handler for the installed version of guzzle. * - * @param ClientInterface|null $client + * @param ClientInterface $client * @return Guzzle6HttpHandler|Guzzle7HttpHandler * @throws \Exception */ - public static function build(?ClientInterface $client = null) + public static function build(ClientInterface $client = null) { if (is_null($client)) { $stack = null; diff --git a/lib/Google/vendor/google/auth/src/Iam.php b/lib/Google/vendor/google/auth/src/Iam.php index b32ac6065..2f67f0009 100644 --- a/lib/Google/vendor/google/auth/src/Iam.php +++ b/lib/Google/vendor/google/auth/src/Iam.php @@ -36,7 +36,6 @@ class Iam const SIGN_BLOB_PATH = '%s:signBlob?alt=json'; const SERVICE_ACCOUNT_NAME = 'projects/-/serviceAccounts/%s'; private const IAM_API_ROOT_TEMPLATE = 'https://iamcredentials.UNIVERSE_DOMAIN/v1'; - private const GENERATE_ID_TOKEN_PATH = '%s:generateIdToken'; /** * @var callable @@ -46,10 +45,10 @@ class Iam private string $universeDomain; /** - * @param callable|null $httpHandler [optional] The HTTP Handler to send requests. + * @param callable $httpHandler [optional] The HTTP Handler to send requests. */ public function __construct( - ?callable $httpHandler = null, + callable $httpHandler = null, string $universeDomain = GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN ) { $this->httpHandler = $httpHandler @@ -74,6 +73,7 @@ public function __construct( */ public function signBlob($email, $accessToken, $stringToSign, array $delegates = []) { + $httpHandler = $this->httpHandler; $name = sprintf(self::SERVICE_ACCOUNT_NAME, $email); $apiRoot = str_replace('UNIVERSE_DOMAIN', $this->universeDomain, self::IAM_API_ROOT_TEMPLATE); $uri = $apiRoot . '/' . sprintf(self::SIGN_BLOB_PATH, $name); @@ -102,54 +102,9 @@ public function signBlob($email, $accessToken, $stringToSign, array $delegates = Utils::streamFor(json_encode($body)) ); - $res = ($this->httpHandler)($request); + $res = $httpHandler($request); $body = json_decode((string) $res->getBody(), true); return $body['signedBlob']; } - - /** - * Sign a string using the IAM signBlob API. - * - * Note that signing using IAM requires your service account to have the - * `iam.serviceAccounts.signBlob` permission, part of the "Service Account - * Token Creator" IAM role. - * - * @param string $clientEmail The service account email. - * @param string $targetAudience The audience for the ID token. - * @param string $bearerToken The token to authenticate the IAM request. - * @param array $headers [optional] Additional headers to send with the request. - * - * @return string The signed string, base64-encoded. - */ - public function generateIdToken( - string $clientEmail, - string $targetAudience, - string $bearerToken, - array $headers = [] - ): string { - $name = sprintf(self::SERVICE_ACCOUNT_NAME, $clientEmail); - $apiRoot = str_replace('UNIVERSE_DOMAIN', $this->universeDomain, self::IAM_API_ROOT_TEMPLATE); - $uri = $apiRoot . '/' . sprintf(self::GENERATE_ID_TOKEN_PATH, $name); - - $headers['Authorization'] = 'Bearer ' . $bearerToken; - - $body = [ - 'audience' => $targetAudience, - 'includeEmail' => true, - 'useEmailAzp' => true, - ]; - - $request = new Psr7\Request( - 'POST', - $uri, - $headers, - Utils::streamFor(json_encode($body)) - ); - - $res = ($this->httpHandler)($request); - $body = json_decode((string) $res->getBody(), true); - - return $body['token']; - } } diff --git a/lib/Google/vendor/google/auth/src/Middleware/AuthTokenMiddleware.php b/lib/Google/vendor/google/auth/src/Middleware/AuthTokenMiddleware.php index b8f2c514c..798766efa 100644 --- a/lib/Google/vendor/google/auth/src/Middleware/AuthTokenMiddleware.php +++ b/lib/Google/vendor/google/auth/src/Middleware/AuthTokenMiddleware.php @@ -59,13 +59,13 @@ class AuthTokenMiddleware * Creates a new AuthTokenMiddleware. * * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token - * @param callable|null $httpHandler (optional) callback which delivers psr7 request - * @param callable|null $tokenCallback (optional) function to be called when a new token is fetched. + * @param callable $httpHandler (optional) callback which delivers psr7 request + * @param callable $tokenCallback (optional) function to be called when a new token is fetched. */ public function __construct( FetchAuthTokenInterface $fetcher, - ?callable $httpHandler = null, - ?callable $tokenCallback = null + callable $httpHandler = null, + callable $tokenCallback = null ) { $this->fetcher = $fetcher; $this->httpHandler = $httpHandler; @@ -132,8 +132,7 @@ private function addAuthHeaders(RequestInterface $request) ) { $token = $this->fetcher->fetchAuthToken(); $request = $request->withHeader( - 'authorization', - 'Bearer ' . ($token['access_token'] ?? $token['id_token'] ?? '') + 'authorization', 'Bearer ' . ($token['access_token'] ?? $token['id_token'] ?? '') ); } else { $headers = $this->fetcher->updateMetadata($request->getHeaders(), null, $this->httpHandler); diff --git a/lib/Google/vendor/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php b/lib/Google/vendor/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php index 2c44871f9..0f9ee429f 100644 --- a/lib/Google/vendor/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php +++ b/lib/Google/vendor/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php @@ -53,13 +53,13 @@ class ProxyAuthTokenMiddleware * Creates a new ProxyAuthTokenMiddleware. * * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token - * @param callable|null $httpHandler (optional) callback which delivers psr7 request - * @param callable|null $tokenCallback (optional) function to be called when a new token is fetched. + * @param callable $httpHandler (optional) callback which delivers psr7 request + * @param callable $tokenCallback (optional) function to be called when a new token is fetched. */ public function __construct( FetchAuthTokenInterface $fetcher, - ?callable $httpHandler = null, - ?callable $tokenCallback = null + callable $httpHandler = null, + callable $tokenCallback = null ) { $this->fetcher = $fetcher; $this->httpHandler = $httpHandler; diff --git a/lib/Google/vendor/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php b/lib/Google/vendor/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php index f2f85cc16..8bb1d7a0b 100644 --- a/lib/Google/vendor/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php +++ b/lib/Google/vendor/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php @@ -54,14 +54,14 @@ class ScopedAccessTokenMiddleware * * @param callable $tokenFunc a token generator function * @param array|string $scopes the token authentication scopes - * @param array|null $cacheConfig configuration for the cache when it's present - * @param CacheItemPoolInterface|null $cache an implementation of CacheItemPoolInterface + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache an implementation of CacheItemPoolInterface */ public function __construct( callable $tokenFunc, $scopes, - ?array $cacheConfig = null, - ?CacheItemPoolInterface $cache = null + array $cacheConfig = null, + CacheItemPoolInterface $cache = null ) { $this->tokenFunc = $tokenFunc; if (!(is_string($scopes) || is_array($scopes))) { diff --git a/lib/Google/vendor/google/auth/src/OAuth2.php b/lib/Google/vendor/google/auth/src/OAuth2.php index c60b8827f..4019e258a 100644 --- a/lib/Google/vendor/google/auth/src/OAuth2.php +++ b/lib/Google/vendor/google/auth/src/OAuth2.php @@ -581,12 +581,12 @@ public function toJwt(array $config = []) /** * Generates a request for token credentials. * - * @param callable|null $httpHandler callback which delivers psr7 request + * @param callable $httpHandler callback which delivers psr7 request * @param array $headers [optional] Additional headers to pass to * the token endpoint request. * @return RequestInterface the authorization Url. */ - public function generateCredentialsRequest(?callable $httpHandler = null, array $headers = []) + public function generateCredentialsRequest(callable $httpHandler = null, $headers = []) { $uri = $this->getTokenCredentialUri(); if (is_null($uri)) { @@ -611,9 +611,6 @@ public function generateCredentialsRequest(?callable $httpHandler = null, array break; case 'refresh_token': $params['refresh_token'] = $this->getRefreshToken(); - if (isset($this->getAdditionalClaims()['target_audience'])) { - $params['target_audience'] = $this->getAdditionalClaims()['target_audience']; - } $this->addClientCredentials($params); break; case self::JWT_URN: @@ -664,12 +661,12 @@ public function generateCredentialsRequest(?callable $httpHandler = null, array /** * Fetches the auth tokens based on the current state. * - * @param callable|null $httpHandler callback which delivers psr7 request + * @param callable $httpHandler callback which delivers psr7 request * @param array $headers [optional] If present, add these headers to the token * endpoint request. * @return array the response */ - public function fetchAuthToken(?callable $httpHandler = null, array $headers = []) + public function fetchAuthToken(callable $httpHandler = null, $headers = []) { if (is_null($httpHandler)) { $httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient()); @@ -727,7 +724,7 @@ public function getSubjectTokenFetcher(): ?ExternalAccountCredentialSourceInterf */ public function parseTokenResponse(ResponseInterface $resp) { - $body = (string) $resp->getBody(); + $body = (string)$resp->getBody(); if ($resp->hasHeader('Content-Type') && $resp->getHeaderLine('Content-Type') == 'application/x-www-form-urlencoded' ) { @@ -1012,13 +1009,13 @@ public function setRedirectUri($uri) if (!$this->isAbsoluteUri($uri)) { // "postmessage" is a reserved URI string in Google-land // @see https://developers.google.com/identity/sign-in/web/server-side-flow - if ('postmessage' !== (string) $uri) { + if ('postmessage' !== (string)$uri) { throw new InvalidArgumentException( 'Redirect URI must be absolute' ); } } - $this->redirectUri = (string) $uri; + $this->redirectUri = (string)$uri; } /** @@ -1130,7 +1127,7 @@ public function setGrantType($grantType) 'invalid grant type' ); } - $this->grantType = (string) $grantType; + $this->grantType = (string)$grantType; } } @@ -1463,7 +1460,7 @@ public function setExpiresIn($expiresIn) $this->issuedAt = null; } else { $this->issuedAt = time(); - $this->expiresIn = (int) $expiresIn; + $this->expiresIn = (int)$expiresIn; } } @@ -1686,11 +1683,11 @@ public function getLastReceivedToken() * * Alias of {@see Google\Auth\OAuth2::getClientId()}. * - * @param callable|null $httpHandler + * @param callable $httpHandler * @return string * @access private */ - public function getClientName(?callable $httpHandler = null) + public function getClientName(callable $httpHandler = null) { return $this->getClientId(); } @@ -1771,8 +1768,7 @@ private function getFirebaseJwtKeys($publicKey, $allowedAlgs) throw new \InvalidArgumentException( 'To have multiple allowed algorithms, You must provide an' . ' array of Firebase\JWT\Key objects.' - . ' See https://github.com/firebase/php-jwt for more information.' - ); + . ' See https://github.com/firebase/php-jwt for more information.'); } $allowedAlg = array_pop($allowedAlgs); } else { diff --git a/lib/Google/vendor/google/auth/src/ProjectIdProviderInterface.php b/lib/Google/vendor/google/auth/src/ProjectIdProviderInterface.php index 8d10c293a..0a41f7832 100644 --- a/lib/Google/vendor/google/auth/src/ProjectIdProviderInterface.php +++ b/lib/Google/vendor/google/auth/src/ProjectIdProviderInterface.php @@ -25,8 +25,8 @@ interface ProjectIdProviderInterface /** * Get the project ID. * - * @param callable|null $httpHandler Callback which delivers psr7 request + * @param callable $httpHandler Callback which delivers psr7 request * @return string|null */ - public function getProjectId(?callable $httpHandler = null); + public function getProjectId(callable $httpHandler = null); } diff --git a/lib/Google/vendor/google/auth/src/SignBlobInterface.php b/lib/Google/vendor/google/auth/src/SignBlobInterface.php index b3c2b0505..5f2c94414 100644 --- a/lib/Google/vendor/google/auth/src/SignBlobInterface.php +++ b/lib/Google/vendor/google/auth/src/SignBlobInterface.php @@ -36,9 +36,9 @@ public function signBlob($stringToSign, $forceOpenssl = false); /** * Returns the current Client Name. * - * @param callable|null $httpHandler callback which delivers psr7 request, if + * @param callable $httpHandler callback which delivers psr7 request, if * one is required to obtain a client name. * @return string */ - public function getClientName(?callable $httpHandler = null); + public function getClientName(callable $httpHandler = null); } diff --git a/lib/Google/vendor/google/auth/src/UpdateMetadataInterface.php b/lib/Google/vendor/google/auth/src/UpdateMetadataInterface.php index 5cf5b42cc..6d2e7d5d5 100644 --- a/lib/Google/vendor/google/auth/src/UpdateMetadataInterface.php +++ b/lib/Google/vendor/google/auth/src/UpdateMetadataInterface.php @@ -30,12 +30,12 @@ interface UpdateMetadataInterface * * @param array $metadata metadata hashmap * @param string $authUri optional auth uri - * @param callable|null $httpHandler callback which delivers psr7 request + * @param callable $httpHandler callback which delivers psr7 request * @return array updated metadata hashmap */ public function updateMetadata( $metadata, $authUri = null, - ?callable $httpHandler = null + callable $httpHandler = null ); } diff --git a/lib/Google/vendor/google/auth/src/UpdateMetadataTrait.php b/lib/Google/vendor/google/auth/src/UpdateMetadataTrait.php index 486ec72a5..30d4060cf 100644 --- a/lib/Google/vendor/google/auth/src/UpdateMetadataTrait.php +++ b/lib/Google/vendor/google/auth/src/UpdateMetadataTrait.php @@ -44,13 +44,13 @@ public function getUpdateMetadataFunc() * * @param array $metadata metadata hashmap * @param string $authUri optional auth uri - * @param callable|null $httpHandler callback which delivers psr7 request + * @param callable $httpHandler callback which delivers psr7 request * @return array updated metadata hashmap */ public function updateMetadata( $metadata, $authUri = null, - ?callable $httpHandler = null + callable $httpHandler = null ) { $metadata_copy = $metadata; diff --git a/lib/Google/vendor/google/cloud-core/.gitattributes b/lib/Google/vendor/google/cloud-core/.gitattributes deleted file mode 100644 index d43b60862..000000000 --- a/lib/Google/vendor/google/cloud-core/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -/*.xml.dist export-ignore -/tests export-ignore -/.github export-ignore diff --git a/lib/Google/vendor/google/cloud-storage/.gitattributes b/lib/Google/vendor/google/cloud-storage/.gitattributes deleted file mode 100644 index d43b60862..000000000 --- a/lib/Google/vendor/google/cloud-storage/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -/*.xml.dist export-ignore -/tests export-ignore -/.github export-ignore diff --git a/lib/Google/vendor/google/cloud-storage/VERSION b/lib/Google/vendor/google/cloud-storage/VERSION index 71f35de05..5525f03fa 100644 --- a/lib/Google/vendor/google/cloud-storage/VERSION +++ b/lib/Google/vendor/google/cloud-storage/VERSION @@ -1 +1 @@ -1.48.4 +1.48.1 diff --git a/lib/Google/vendor/google/cloud-storage/composer.json b/lib/Google/vendor/google/cloud-storage/composer.json index a784163d5..d0000cd74 100644 --- a/lib/Google/vendor/google/cloud-storage/composer.json +++ b/lib/Google/vendor/google/cloud-storage/composer.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "minimum-stability": "stable", "require": { - "php": "^8.1", + "php": "^8.0", "google/cloud-core": "^1.57", "ramsey/uuid": "^4.2.3" }, diff --git a/lib/Google/vendor/google/cloud-storage/src/Bucket.php b/lib/Google/vendor/google/cloud-storage/src/Bucket.php index e08884e8f..6abec40c8 100644 --- a/lib/Google/vendor/google/cloud-storage/src/Bucket.php +++ b/lib/Google/vendor/google/cloud-storage/src/Bucket.php @@ -1519,50 +1519,14 @@ public function lockRetentionPolicy(array $options = []) * space, and line breaks will be replaced by an empty string. * V2 Signed URLs may not provide `x-goog-encryption-key` or * `x-goog-encryption-key-sha256` headers. - * @type FetchAuthTokenInterface $credentialsFetcher A credentials - * fetcher instance. - * @type array $keyFile [DEPRECATED] - * @deprecated This option is being deprecated because of a potential security risk. - * This option does not validate the credential configuration. The security - * risk occurs when a credential configuration is accepted from a source - * that is not under your control and used without validation on your side. - * If you know that you will be loading credential configurations of a - * specific type, it is recommended to create the credentials directly and - * configure them using the `credentialsFetcher` option instead. - * ``` - * use Google\Auth\Credentials\ServiceAccountCredentials; - * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); - * ``` - * This will ensure that an unexpected credential type with potential for - * malicious intent is not loaded unintentionally. You might still have to do - * validation for certain credential types. - * If you are loading your credential configuration from an untrusted source and have - * not mitigated the risks (e.g. by validating the configuration yourself), make - * these changes as soon as possible to prevent security risks to your environment. - * Regardless of the method used, it is always your responsibility to validate - * configurations received from external sources. - * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials - * @type string $keyFilePath [DEPRECATED] - * @deprecated This option is being deprecated because of a potential security risk. - * This option does not validate the credential configuration. The security - * risk occurs when a credential configuration is accepted from a source - * that is not under your control and used without validation on your side. - * If you know that you will be loading credential configurations of a - * specific type, it is recommended to create the credentials directly and - * configure them using the `credentialsFetcher` option instead. - * ``` - * use Google\Auth\Credentials\ServiceAccountCredentials; - * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); - * ``` - * This will ensure that an unexpected credential type with potential for - * malicious intent is not loaded unintentionally. You might still have to do - * validation for certain credential types. - * If you are loading your credential configuration from an untrusted source and have - * not mitigated the risks (e.g. by validating the configuration yourself), make - * these changes as soon as possible to prevent security risks to your environment. - * Regardless of the method used, it is always your responsibility to validate - * configurations received from external sources. - * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials + * @type array $keyFile Keyfile data to use in place of the keyfile with + * which the client was constructed. If `$options.keyFilePath` is + * set, this option is ignored. + * @type string $keyFilePath A path to a valid keyfile to use in place + * of the keyfile with which the client was constructed. + * @type string|array $scopes One or more authentication scopes to be + * used with a key file. This option is ignored unless + * `$options.keyFile` or `$options.keyFilePath` is set. * @type array $queryParams Additional query parameters to be included * as part of the signed URL query string. For allowed values, * see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers#query). @@ -1649,50 +1613,12 @@ public function signedUrl($expires, array $options = []) * `x-ignore` prefix), given as key/value pairs. * @type bool $forceOpenssl If true, OpenSSL will be used regardless of * whether phpseclib is available. **Defaults to** `false`. - * @type FetchAuthTokenInterface $credentialsFetcher A credentials - * fetcher instance. - * @type array $keyFile [DEPRECATED] - * @deprecated This option is being deprecated because of a potential security risk. - * This option does not validate the credential configuration. The security - * risk occurs when a credential configuration is accepted from a source - * that is not under your control and used without validation on your side. - * If you know that you will be loading credential configurations of a - * specific type, it is recommended to create the credentials directly and - * configure them using the `credentialsFetcher` option instead. - * ``` - * use Google\Auth\Credentials\ServiceAccountCredentials; - * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); - * ``` - * This will ensure that an unexpected credential type with potential for - * malicious intent is not loaded unintentionally. You might still have to do - * validation for certain credential types. - * If you are loading your credential configuration from an untrusted source and have - * not mitigated the risks (e.g. by validating the configuration yourself), make - * these changes as soon as possible to prevent security risks to your environment. - * Regardless of the method used, it is always your responsibility to validate - * configurations received from external sources. - * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials - * @type string $keyFilePath [DEPRECATED] - * @deprecated This option is being deprecated because of a potential security risk. - * This option does not validate the credential configuration. The security - * risk occurs when a credential configuration is accepted from a source - * that is not under your control and used without validation on your side. - * If you know that you will be loading credential configurations of a - * specific type, it is recommended to create the credentials directly and - * configure them using the `credentialsFetcher` option instead. - * ``` - * use Google\Auth\Credentials\ServiceAccountCredentials; - * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); - * ``` - * This will ensure that an unexpected credential type with potential for - * malicious intent is not loaded unintentionally. You might still have to do - * validation for certain credential types. - * If you are loading your credential configuration from an untrusted source and have - * not mitigated the risks (e.g. by validating the configuration yourself), make - * these changes as soon as possible to prevent security risks to your environment. - * Regardless of the method used, it is always your responsibility to validate - * configurations received from external sources. - * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials + * @type array $keyFile Keyfile data to use in place of the keyfile with + * which the client was constructed. If `$options.keyFilePath` is + * set, this option is ignored. + * @type string $keyFilePath A path to a valid Keyfile to use in place + * of the keyfile with which the client was constructed. + * @type string $scheme Either `http` or `https`. Only used if a custom * hostname is provided via `$options.bucketBoundHostname`. If a * custom bucketBoundHostname is provided, **defaults to** `http`. * In all other cases, **defaults to** `https`. diff --git a/lib/Google/vendor/google/cloud-storage/src/Connection/Rest.php b/lib/Google/vendor/google/cloud-storage/src/Connection/Rest.php index 4766c0ac2..928087478 100644 --- a/lib/Google/vendor/google/cloud-storage/src/Connection/Rest.php +++ b/lib/Google/vendor/google/cloud-storage/src/Connection/Rest.php @@ -100,26 +100,6 @@ class Rest implements ConnectionInterface */ private $restRetryFunction; - /** - * @var string|null - */ - private ?string $retryStrategy; - - /** - * @var callable|null - */ - private $restDelayFunction; - - /** - * @var callable|null - */ - private $restCalcDelayFunction; - - /** - * @var callable|null - */ - private $restRetryListener; - /** * @param array $config */ @@ -148,10 +128,6 @@ public function __construct(array $config = []) $this->projectId = $this->pluck('projectId', $config, false); $this->restRetryFunction = (isset($config['restRetryFunction'])) ? $config['restRetryFunction'] : null; - $this->retryStrategy = $config['retryStrategy'] ?? null; - $this->restDelayFunction = $config['restDelayFunction'] ?? null; - $this->restCalcDelayFunction = $config['restCalcDelayFunction'] ?? null; - $this->restRetryListener = $config['restRetryListener'] ?? null; } /** @@ -332,13 +308,11 @@ public function downloadObject(array $args = []) $resultStream = Utils::streamFor(null); $transcodedObj = false; - $args['retryStrategy'] ??= $this->retryStrategy; - list($request, $requestOptions) = $this->buildDownloadObjectParams($args); $invocationId = Uuid::uuid4()->toString(); $requestOptions['retryHeaders'] = self::getRetryHeaders($invocationId, 1); - $requestOptions['restRetryFunction'] = $this->getRestRetryFunction('objects', 'get', $args); + $requestOptions['restRetryFunction'] = $this->getRestRetryFunction('objects', 'get', $requestOptions); // We try to deduce if the object is a transcoded object when we receive the headers. $requestOptions['restOptions']['on_headers'] = function ($response) use (&$transcodedObj) { $header = $response->getHeader(self::TRANSCODED_OBJ_HEADER_KEY); @@ -487,8 +461,6 @@ private function resolveUploadOptions(array $args) 'userProject' => null, ]; - $args['retryStrategy'] ??= $this->retryStrategy; - $args['data'] = Utils::streamFor($args['data']); if ($args['resumable'] === null) { @@ -548,7 +520,7 @@ private function resolveUploadOptions(array $args) } /** - * @param array $args + * @param array $args */ public function getBucketIamPolicy(array $args) { @@ -556,7 +528,7 @@ public function getBucketIamPolicy(array $args) } /** - * @param array $args + * @param array $args */ public function setBucketIamPolicy(array $args) { @@ -564,7 +536,7 @@ public function setBucketIamPolicy(array $args) } /** - * @param array $args + * @param array $args */ public function testBucketIamPermissions(array $args) { @@ -705,7 +677,7 @@ private function buildDownloadObjectParams(array $args) } /** - * Choose an upload validation method based on user input and platform + * Choose a upload validation method based on user input and platform * requirements. * * @param array $args @@ -776,8 +748,8 @@ protected function crc32cExtensionLoaded() /** * Check if hash() supports crc32c. * - * @return bool * @deprecated + * @return bool */ protected function supportsBuiltinCrc32c() { @@ -802,20 +774,12 @@ public function send($resource, $method, array $options = [], $whitelisted = fal 'objectAccessControls' => 'object_acl' ]; $retryResource = isset($retryMap[$resource]) ? $retryMap[$resource] : $resource; - $options['restRetryFunction'] = $this->restRetryFunction ?? $this->getRestRetryFunction( $retryResource, $method, $options ); - $options += array_filter([ - 'retryStrategy' => $this->retryStrategy, - 'restDelayFunction' => $this->restDelayFunction, - 'restCalcDelayFunction' => $this->restCalcDelayFunction, - 'restRetryListener' => $this->restRetryListener, - ]); - $options = $this->addRetryHeaderLogic($options); return $this->traitSend($resource, $method, $options); @@ -832,26 +796,19 @@ private function addRetryHeaderLogic(array $args) $invocationId = Uuid::uuid4()->toString(); $args['retryHeaders'] = self::getRetryHeaders($invocationId, 1); - $userListener = $args['restRetryListener'] ?? null; - // Adding callback logic to update headers while retrying $args['restRetryListener'] = function ( \Exception $e, $retryAttempt, &$arguments ) use ( - $invocationId, - $userListener + $invocationId ) { $arguments[0] = $this->modifyRequestForRetry( $arguments[0], $retryAttempt, $invocationId ); - - if ($userListener) { - $userListener($e, $retryAttempt, $arguments); - } }; return $args; diff --git a/lib/Google/vendor/google/cloud-storage/src/Connection/RetryTrait.php b/lib/Google/vendor/google/cloud-storage/src/Connection/RetryTrait.php index 83a5dac47..4899e7e46 100644 --- a/lib/Google/vendor/google/cloud-storage/src/Connection/RetryTrait.php +++ b/lib/Google/vendor/google/cloud-storage/src/Connection/RetryTrait.php @@ -31,7 +31,7 @@ trait RetryTrait * @var array */ private static $httpRetryCodes = [ - 0, // connection-refused OR connection-reset gives status code of 0 + 0, // connetion-refused OR connection-reset gives status code of 0 200, // partial download cases 408, 429, @@ -192,7 +192,7 @@ private function isPreConditionSupplied($methodName, array $args) * @param bool $isIdempotent * @param bool $preconditionNeeded * @param bool $preconditionSupplied - * @param int|null $maxRetries The maximum number of retries allowed. + * @param int|null $maxRetries The maximum number of retries allowd. * Null for no limit. * @return bool */ diff --git a/lib/Google/vendor/google/cloud-storage/src/SigningHelper.php b/lib/Google/vendor/google/cloud-storage/src/SigningHelper.php index 6f4292e72..41acfbaf9 100644 --- a/lib/Google/vendor/google/cloud-storage/src/SigningHelper.php +++ b/lib/Google/vendor/google/cloud-storage/src/SigningHelper.php @@ -628,7 +628,6 @@ private function normalizeOptions(array $options) 'headers' => [], 'keyFile' => null, 'keyFilePath' => null, - 'credentialsFetcher' => null, 'method' => 'GET', 'queryParams' => [], 'responseDisposition' => null, @@ -823,8 +822,6 @@ private function getSigningCredentials(ConnectionInterface $connection, array $o $scopes = $options['scopes'] ?? $rw->scopes(); $credentials = CredentialsLoader::makeCredentials($scopes, $keyFile); - } elseif (isset($options['credentialsFetcher'])) { - $credentials = $options['credentialsFetcher']; } else { $credentials = $rw->getCredentialsFetcher(); } @@ -841,7 +838,6 @@ private function getSigningCredentials(ConnectionInterface $connection, array $o unset( $options['keyFilePath'], $options['keyFile'], - $options['credentialsFetcher'], $options['scopes'] ); diff --git a/lib/Google/vendor/google/cloud-storage/src/StorageClient.php b/lib/Google/vendor/google/cloud-storage/src/StorageClient.php index f0df8ac27..23355325c 100644 --- a/lib/Google/vendor/google/cloud-storage/src/StorageClient.php +++ b/lib/Google/vendor/google/cloud-storage/src/StorageClient.php @@ -47,7 +47,7 @@ class StorageClient use ArrayTrait; use ClientTrait; - const VERSION = '1.48.4'; + const VERSION = '1.48.1'; const FULL_CONTROL_SCOPE = 'https://www.googleapis.com/auth/devstorage.full_control'; const READ_ONLY_SCOPE = 'https://www.googleapis.com/auth/devstorage.read_only'; @@ -97,71 +97,16 @@ class StorageClient * fetcher instance. * @type callable $httpHandler A handler used to deliver Psr7 requests. * Only valid for requests sent over REST. - * @type array $keyFile [DEPRECATED] - * @deprecated This option is being deprecated because of a potential security risk. - * This option does not validate the credential configuration. The security - * risk occurs when a credential configuration is accepted from a source - * that is not under your control and used without validation on your side. - * If you know that you will be loading credential configurations of a - * specific type, it is recommended to create the credentials directly and - * configure them using the `credentialsFetcher` option instead. - * ``` - * use Google\Auth\Credentials\ServiceAccountCredentials; - * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); - * $creds = new StorageClient(['credentialsFetcher' => $creds]); - * ``` - * This will ensure that an unexpected credential type with potential for - * malicious intent is not loaded unintentionally. You might still have to do - * validation for certain credential types. - * If you are loading your credential configuration from an untrusted source and have - * not mitigated the risks (e.g. by validating the configuration yourself), make - * these changes as soon as possible to prevent security risks to your environment. - * Regardless of the method used, it is always your responsibility to validate - * configurations received from external sources. - * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials - * @type string $keyFilePath [DEPRECATED] - * @deprecated This option is being deprecated because of a potential security risk. - * This option does not validate the credential configuration. The security - * risk occurs when a credential configuration is accepted from a source - * that is not under your control and used without validation on your side. - * If you know that you will be loading credential configurations of a - * specific type, it is recommended to create the credentials directly and - * configure them using the `credentialsFetcher` option instead. - * ``` - * use Google\Auth\Credentials\ServiceAccountCredentials; - * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); - * $creds = new StorageClient(['credentialsFetcher' => $creds]); - * ``` - * This will ensure that an unexpected credential type with potential for - * malicious intent is not loaded unintentionally. You might still have to do - * validation for certain credential types. - * If you are loading your credential configuration from an untrusted source and have - * not mitigated the risks (e.g. by validating the configuration yourself), make - * these changes as soon as possible to prevent security risks to your environment. - * Regardless of the method used, it is always your responsibility to validate - * configurations received from external sources. - * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials + * @type array $keyFile The contents of the service account credentials + * .json file retrieved from the Google Developer's Console. + * Ex: `json_decode(file_get_contents($path), true)`. + * @type string $keyFilePath The full path to your service account + * credentials .json file retrieved from the Google Developers + * Console. * @type float $requestTimeout Seconds to wait before timing out the * request. **Defaults to** `0` with REST and `60` with gRPC. * @type int $retries Number of retries for a failed request. * **Defaults to** `3`. - * @type string $retryStrategy Retry strategy to signify that we never - * want to retry an operation even if the error is retryable. - * **Defaults to** `StorageClient::RETRY_IDEMPOTENT`. - * @type callable $restDelayFunction Executes a delay, defaults to - * utilizing `usleep`. Function signature should match: - * `function (int $delay) : void`. - * @type callable $restCalcDelayFunction Sets the conditions for - * determining how long to wait between attempts to retry. Function - * signature should match: `function (int $attempt) : int`. - * @type callable $restRetryFunction Sets the conditions for whether or - * not a request should attempt to retry. Function signature should - * match: `function (\Exception $ex) : bool`. - * @type callable $restRetryListener Runs after the restRetryFunction. - * This might be used to simply consume the exception and - * $arguments b/w retries. This returns the new $arguments thus - * allowing modification on demand for $arguments. For ex: - * changing the headers in b/w retries. * @type array $scopes Scopes to be used for the request. * @type string $quotaProject Specifies a user project to bill for * access charges associated with the request. diff --git a/lib/Google/vendor/google/cloud-storage/src/StorageObject.php b/lib/Google/vendor/google/cloud-storage/src/StorageObject.php index 824d456d1..5aa126002 100644 --- a/lib/Google/vendor/google/cloud-storage/src/StorageObject.php +++ b/lib/Google/vendor/google/cloud-storage/src/StorageObject.php @@ -925,50 +925,11 @@ public function downloadAsStreamAsync(array $options = []) * space, and line breaks will be replaced by an empty string. * V2 Signed URLs may not provide `x-goog-encryption-key` or * `x-goog-encryption-key-sha256` headers. - * @type FetchAuthTokenInterface $credentialsFetcher A credentials - * fetcher instance. - * @type array $keyFile [DEPRECATED] - * @deprecated This option is being deprecated because of a potential security risk. - * This option does not validate the credential configuration. The security - * risk occurs when a credential configuration is accepted from a source - * that is not under your control and used without validation on your side. - * If you know that you will be loading credential configurations of a - * specific type, it is recommended to create the credentials directly and - * configure them using the `credentialsFetcher` option instead. - * ``` - * use Google\Auth\Credentials\ServiceAccountCredentials; - * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); - * ``` - * This will ensure that an unexpected credential type with potential for - * malicious intent is not loaded unintentionally. You might still have to do - * validation for certain credential types. - * If you are loading your credential configuration from an untrusted source and have - * not mitigated the risks (e.g. by validating the configuration yourself), make - * these changes as soon as possible to prevent security risks to your environment. - * Regardless of the method used, it is always your responsibility to validate - * configurations received from external sources. - * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials - * @type string $keyFilePath [DEPRECATED] - * @deprecated This option is being deprecated because of a potential security risk. - * This option does not validate the credential configuration. The security - * risk occurs when a credential configuration is accepted from a source - * that is not under your control and used without validation on your side. - * If you know that you will be loading credential configurations of a - * specific type, it is recommended to create the credentials directly and - * configure them using the `credentialsFetcher` option instead. - * ``` - * use Google\Auth\Credentials\ServiceAccountCredentials; - * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); - * ``` - * This will ensure that an unexpected credential type with potential for - * malicious intent is not loaded unintentionally. You might still have to do - * validation for certain credential types. - * If you are loading your credential configuration from an untrusted source and have - * not mitigated the risks (e.g. by validating the configuration yourself), make - * these changes as soon as possible to prevent security risks to your environment. - * Regardless of the method used, it is always your responsibility to validate - * configurations received from external sources. - * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials + * @type array $keyFile Keyfile data to use in place of the keyfile with + * which the client was constructed. If `$options.keyFilePath` is + * set, this option is ignored. + * @type string $keyFilePath A path to a valid Keyfile to use in place + * of the keyfile with which the client was constructed. * @type string $method One of `GET`, `PUT` or `DELETE`. * **Defaults to** `GET`. * @type string $responseDisposition The @@ -1082,50 +1043,11 @@ public function signedUrl($expires, array $options = []) * space, and line breaks will be replaced by an empty string. * V2 Signed URLs may not provide `x-goog-encryption-key` or * `x-goog-encryption-key-sha256` headers. - * @type FetchAuthTokenInterface $credentialsFetcher A credentials - * fetcher instance. - * @type array $keyFile [DEPRECATED] - * @deprecated This option is being deprecated because of a potential security risk. - * This option does not validate the credential configuration. The security - * risk occurs when a credential configuration is accepted from a source - * that is not under your control and used without validation on your side. - * If you know that you will be loading credential configurations of a - * specific type, it is recommended to create the credentials directly and - * configure them using the `credentialsFetcher` option instead. - * ``` - * use Google\Auth\Credentials\ServiceAccountCredentials; - * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); - * ``` - * This will ensure that an unexpected credential type with potential for - * malicious intent is not loaded unintentionally. You might still have to do - * validation for certain credential types. - * If you are loading your credential configuration from an untrusted source and have - * not mitigated the risks (e.g. by validating the configuration yourself), make - * these changes as soon as possible to prevent security risks to your environment. - * Regardless of the method used, it is always your responsibility to validate - * configurations received from external sources. - * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials - * @type string $keyFilePath [DEPRECATED] - * @deprecated This option is being deprecated because of a potential security risk. - * This option does not validate the credential configuration. The security - * risk occurs when a credential configuration is accepted from a source - * that is not under your control and used without validation on your side. - * If you know that you will be loading credential configurations of a - * specific type, it is recommended to create the credentials directly and - * configure them using the `credentialsFetcher` option instead. - * ``` - * use Google\Auth\Credentials\ServiceAccountCredentials; - * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); - * ``` - * This will ensure that an unexpected credential type with potential for - * malicious intent is not loaded unintentionally. You might still have to do - * validation for certain credential types. - * If you are loading your credential configuration from an untrusted source and have - * not mitigated the risks (e.g. by validating the configuration yourself), make - * these changes as soon as possible to prevent security risks to your environment. - * Regardless of the method used, it is always your responsibility to validate - * configurations received from external sources. - * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials + * @type array $keyFile Keyfile data to use in place of the keyfile with + * which the client was constructed. If `$options.keyFilePath` is + * set, this option is ignored. + * @type string $keyFilePath A path to a valid Keyfile to use in place + * of the keyfile with which the client was constructed. * @type string $responseDisposition The * [`response-content-disposition`](http://www.iana.org/assignments/cont-disp/cont-disp.xhtml) * parameter of the signed url. @@ -1220,50 +1142,12 @@ public function signedUploadUrl($expires, array $options = []) * space, and line breaks will be replaced by an empty string. * V2 Signed URLs may not provide `x-goog-encryption-key` or * `x-goog-encryption-key-sha256` headers. - * @type FetchAuthTokenInterface $credentialsFetcher A credentials - * fetcher instance. - * @type array $keyFile [DEPRECATED] - * @deprecated This option is being deprecated because of a potential security risk. - * This option does not validate the credential configuration. The security - * risk occurs when a credential configuration is accepted from a source - * that is not under your control and used without validation on your side. - * If you know that you will be loading credential configurations of a - * specific type, it is recommended to create the credentials directly and - * configure them using the `credentialsFetcher` option instead. - * ``` - * use Google\Auth\Credentials\ServiceAccountCredentials; - * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); - * ``` - * This will ensure that an unexpected credential type with potential for - * malicious intent is not loaded unintentionally. You might still have to do - * validation for certain credential types. - * If you are loading your credential configuration from an untrusted source and have - * not mitigated the risks (e.g. by validating the configuration yourself), make - * these changes as soon as possible to prevent security risks to your environment. - * Regardless of the method used, it is always your responsibility to validate - * configurations received from external sources. - * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials - * @type string $keyFilePath [DEPRECATED] - * @deprecated This option is being deprecated because of a potential security risk. - * This option does not validate the credential configuration. The security - * risk occurs when a credential configuration is accepted from a source - * that is not under your control and used without validation on your side. - * If you know that you will be loading credential configurations of a - * specific type, it is recommended to create the credentials directly and - * configure them using the `credentialsFetcher` option instead. - * ``` - * use Google\Auth\Credentials\ServiceAccountCredentials; - * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json); - * ``` - * This will ensure that an unexpected credential type with potential for - * malicious intent is not loaded unintentionally. You might still have to do - * validation for certain credential types. - * If you are loading your credential configuration from an untrusted source and have - * not mitigated the risks (e.g. by validating the configuration yourself), make - * these changes as soon as possible to prevent security risks to your environment. - * Regardless of the method used, it is always your responsibility to validate - * configurations received from external sources. - * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials + * @type array $keyFile Keyfile data to use in place of the keyfile with + * which the client was constructed. If `$options.keyFilePath` is + * set, this option is ignored. + * @type string $keyFilePath A path to a valid Keyfile to use in place + * of the keyfile with which the client was constructed. + * @type string $origin Value of CORS header * "Access-Control-Allow-Origin". **Defaults to** `"*"`. * @type string|array $scopes One or more authentication scopes to be * used with a key file. This option is ignored unless diff --git a/lib/Google/vendor/google/common-protos/VERSION b/lib/Google/vendor/google/common-protos/VERSION index 23297c30e..53cf85e17 100644 --- a/lib/Google/vendor/google/common-protos/VERSION +++ b/lib/Google/vendor/google/common-protos/VERSION @@ -1 +1 @@ -4.12.4 +4.12.1 diff --git a/lib/Google/vendor/google/common-protos/composer.json b/lib/Google/vendor/google/common-protos/composer.json index a69cf2598..7af87dcf4 100644 --- a/lib/Google/vendor/google/common-protos/composer.json +++ b/lib/Google/vendor/google/common-protos/composer.json @@ -2,15 +2,15 @@ "name": "google/common-protos", "type": "library", "description": "Google API Common Protos for PHP", - "version": "4.12.4", + "version": "4.12.1", "keywords": [ "google" ], "homepage": "https://github.com/googleapis/common-protos-php", "license": "Apache-2.0", "require": { - "php": "^8.1", - "google/protobuf": "^4.31" + "php": "^8.0", + "google/protobuf": "^v3.25.3||^4.26.1" }, "require-dev": { "phpunit/phpunit": "^9.6" diff --git a/lib/Google/vendor/google/gax/.repo-metadata.json b/lib/Google/vendor/google/gax/.repo-metadata.json deleted file mode 100644 index 2fe16da27..000000000 --- a/lib/Google/vendor/google/gax/.repo-metadata.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "language": "php", - "distribution_name": "google/gax", - "release_level": "stable", - "client_documentation": "https://cloud.google.com/php/docs/reference/gax/latest", - "library_type": "CORE" -} diff --git a/lib/Google/vendor/google/grpc-gcp/.github/release-please.yml b/lib/Google/vendor/google/grpc-gcp/.github/release-please.yml deleted file mode 100644 index ddc69395d..000000000 --- a/lib/Google/vendor/google/grpc-gcp/.github/release-please.yml +++ /dev/null @@ -1,3 +0,0 @@ -releaseType: simple -handleGHRelease: true -primaryBranch: main diff --git a/lib/Google/vendor/google/grpc-gcp/.github/workflows/tests.yml b/lib/Google/vendor/google/grpc-gcp/.github/workflows/tests.yml deleted file mode 100644 index fe47b44c0..000000000 --- a/lib/Google/vendor/google/grpc-gcp/.github/workflows/tests.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Test Suite -on: - push: - branches: - - master - pull_request: -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - php: [ "8.0", "8.1", "8.2", "8.3", "8.4" ] - name: "PHP ${{ matrix.php }} Unit Test" - steps: - - uses: actions/checkout@v2 - - uses: codecov/codecov-action@v1 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - tools: pecl - extensions: grpc-1.49.0 - - name: Install composer dependencies - uses: nick-invision/retry@v1 - with: - timeout_minutes: 10 - max_attempts: 3 - command: composer install - - name: Run PHPUnit - run: vendor/bin/phpunit -v diff --git a/lib/Google/vendor/google/grpc-gcp/.gitmodules b/lib/Google/vendor/google/grpc-gcp/.gitmodules deleted file mode 100644 index 6c20e7b68..000000000 --- a/lib/Google/vendor/google/grpc-gcp/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "third_party/googleapis"] - path = third_party/googleapis - url = https://github.com/googleapis/googleapis.git diff --git a/lib/Google/vendor/google/longrunning/.gitattributes b/lib/Google/vendor/google/longrunning/.gitattributes deleted file mode 100644 index f51251a9b..000000000 --- a/lib/Google/vendor/google/longrunning/.gitattributes +++ /dev/null @@ -1,6 +0,0 @@ -/*.xml.dist export-ignore -/tests export-ignore -/.github export-ignore -/.OwlBot.yaml export-ignore -/owlbot.py export-ignore -/src/**/gapic_metadata.json export-ignore diff --git a/lib/Google/vendor/google/longrunning/VERSION b/lib/Google/vendor/google/longrunning/VERSION index 8f0916f76..f90568270 100644 --- a/lib/Google/vendor/google/longrunning/VERSION +++ b/lib/Google/vendor/google/longrunning/VERSION @@ -1 +1 @@ -0.5.0 +0.4.7 diff --git a/lib/Google/vendor/google/longrunning/composer.json b/lib/Google/vendor/google/longrunning/composer.json index 3df31cdb2..df405a30d 100644 --- a/lib/Google/vendor/google/longrunning/composer.json +++ b/lib/Google/vendor/google/longrunning/composer.json @@ -3,7 +3,7 @@ "description": "Google LongRunning Client for PHP", "license": "Apache-2.0", "minimum-stability": "stable", - "version": "0.5.0", + "version": "0.4.7", "autoload": { "psr-4": { "Google\\ApiCore\\LongRunning\\": "src/ApiCore/LongRunning", @@ -20,7 +20,7 @@ } }, "require-dev": { - "google/gax": "^1.38.0", + "google/gax": "^1.36.0", "phpunit/phpunit": "^9.0" } } diff --git a/lib/Google/vendor/google/longrunning/src/LongRunning/Client/OperationsClient.php b/lib/Google/vendor/google/longrunning/src/LongRunning/Client/OperationsClient.php index ea8662350..b5f5acafd 100644 --- a/lib/Google/vendor/google/longrunning/src/LongRunning/Client/OperationsClient.php +++ b/lib/Google/vendor/google/longrunning/src/LongRunning/Client/OperationsClient.php @@ -27,7 +27,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\Options\ClientOptions; use Google\ApiCore\PagedListResponse; use Google\ApiCore\RetrySettings; use Google\ApiCore\Transport\TransportInterface; @@ -110,28 +109,25 @@ private static function getClientDefaults() /** * Constructor. * - * @param array|ClientOptions $options { + * @param array $options { * Optional. Options for configuring the service API wrapper. * * @type string $apiEndpoint * The address of the API remote host. May optionally include the port, formatted * as ":". Default 'longrunning.googleapis.com:443'. - * @type FetchAuthTokenInterface|CredentialsWrapper $credentials - * This option should only be used with a pre-constructed - * {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that - * when one of these objects are provided, any settings in $credentialsConfig will - * be ignored. - * **Important**: If you are providing a path to a credentials file, or a decoded - * credentials file as a PHP array, this usage is now DEPRECATED. Providing an - * unvalidated credential configuration to Google APIs can compromise the security - * of your systems and data. It is recommended to create the credentials explicitly - * ``` - * use Google\Auth\Credentials\ServiceAccountCredentials; - * use Google\LongRunning\OperationsClient; - * $creds = new ServiceAccountCredentials($scopes, $json); - * $options = new OperationsClient(['credentials' => $creds]); - * ``` - * {@see + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * *Important*: If you accept a credential configuration (credential + * JSON/File/Stream) from an external source for authentication to Google Cloud + * Platform, you must validate it before providing it to any Google API or library. + * Providing an unvalidated credential configuration to Google APIs can compromise + * the security of your systems and data. For more information {@see * https://cloud.google.com/docs/authentication/external/externally-sourced-credentials} * @type array $credentialsConfig * Options used to configure credentials, including auth token caching, for the @@ -169,13 +165,11 @@ private static function getClientDefaults() * @type false|LoggerInterface $logger * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the * 'GOOGLE_SDK_PHP_LOGGING' environment flag - * @type string $universeDomain - * The service domain for the client. Defaults to 'googleapis.com'. * } * * @throws ValidationException */ - public function __construct(array|ClientOptions $options = []) + public function __construct(array $options = []) { $clientOptions = $this->buildClientOptions($options); $this->setClientOptions($clientOptions); diff --git a/lib/Google/vendor/google/protobuf/composer.json b/lib/Google/vendor/google/protobuf/composer.json index 534647221..70af0a033 100644 --- a/lib/Google/vendor/google/protobuf/composer.json +++ b/lib/Google/vendor/google/protobuf/composer.json @@ -6,10 +6,10 @@ "homepage": "https://developers.google.com/protocol-buffers/", "license": "BSD-3-Clause", "require": { - "php": ">=8.1.0" + "php": ">=7.0.0" }, "require-dev": { - "phpunit/phpunit": ">=5.0.0 <8.5.27" + "phpunit/phpunit": ">=5.0.0" }, "suggest": { "ext-bcmath": "Need to support JSON deserialization" @@ -21,4 +21,3 @@ } } } - diff --git a/lib/Google/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Api.php b/lib/Google/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Api.php index 83e2748e4..4485d3d0b 100644 --- a/lib/Google/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Api.php +++ b/lib/Google/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Api.php @@ -18,7 +18,7 @@ public static function initOnce() { \GPBMetadata\Google\Protobuf\SourceContext::initOnce(); \GPBMetadata\Google\Protobuf\Type::initOnce(); $pool->internalAddGeneratedFile( - "\x0A\xF3\x05\x0A\x19google/protobuf/api.proto\x12\x0Fgoogle.protobuf\x1A\x1Agoogle/protobuf/type.proto\"\x92\x02\x0A\x03Api\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12(\x0A\x07methods\x18\x02 \x03(\x0B2\x17.google.protobuf.Method\x12(\x0A\x07options\x18\x03 \x03(\x0B2\x17.google.protobuf.Option\x12\x0F\x0A\x07version\x18\x04 \x01(\x09\x126\x0A\x0Esource_context\x18\x05 \x01(\x0B2\x1E.google.protobuf.SourceContext\x12&\x0A\x06mixins\x18\x06 \x03(\x0B2\x16.google.protobuf.Mixin\x12'\x0A\x06syntax\x18\x07 \x01(\x0E2\x17.google.protobuf.Syntax\x12\x0F\x0A\x07edition\x18\x08 \x01(\x09\"\xEE\x01\x0A\x06Method\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12\x18\x0A\x10request_type_url\x18\x02 \x01(\x09\x12\x19\x0A\x11request_streaming\x18\x03 \x01(\x08\x12\x19\x0A\x11response_type_url\x18\x04 \x01(\x09\x12\x1A\x0A\x12response_streaming\x18\x05 \x01(\x08\x12(\x0A\x07options\x18\x06 \x03(\x0B2\x17.google.protobuf.Option\x12+\x0A\x06syntax\x18\x07 \x01(\x0E2\x17.google.protobuf.SyntaxB\x02\x18\x01\x12\x13\x0A\x07edition\x18\x08 \x01(\x09B\x02\x18\x01\"#\x0A\x05Mixin\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12\x0C\x0A\x04root\x18\x02 \x01(\x09Bv\x0A\x13com.google.protobufB\x08ApiProtoP\x01Z,google.golang.org/protobuf/types/known/apipb\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" + "\x0A\xC9\x05\x0A\x19google/protobuf/api.proto\x12\x0Fgoogle.protobuf\x1A\x1Agoogle/protobuf/type.proto\"\x81\x02\x0A\x03Api\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12(\x0A\x07methods\x18\x02 \x03(\x0B2\x17.google.protobuf.Method\x12(\x0A\x07options\x18\x03 \x03(\x0B2\x17.google.protobuf.Option\x12\x0F\x0A\x07version\x18\x04 \x01(\x09\x126\x0A\x0Esource_context\x18\x05 \x01(\x0B2\x1E.google.protobuf.SourceContext\x12&\x0A\x06mixins\x18\x06 \x03(\x0B2\x16.google.protobuf.Mixin\x12'\x0A\x06syntax\x18\x07 \x01(\x0E2\x17.google.protobuf.Syntax\"\xD5\x01\x0A\x06Method\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12\x18\x0A\x10request_type_url\x18\x02 \x01(\x09\x12\x19\x0A\x11request_streaming\x18\x03 \x01(\x08\x12\x19\x0A\x11response_type_url\x18\x04 \x01(\x09\x12\x1A\x0A\x12response_streaming\x18\x05 \x01(\x08\x12(\x0A\x07options\x18\x06 \x03(\x0B2\x17.google.protobuf.Option\x12'\x0A\x06syntax\x18\x07 \x01(\x0E2\x17.google.protobuf.Syntax\"#\x0A\x05Mixin\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12\x0C\x0A\x04root\x18\x02 \x01(\x09Bv\x0A\x13com.google.protobufB\x08ApiProtoP\x01Z,google.golang.org/protobuf/types/known/apipb\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" , true); static::$is_initialized = true; diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Api.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Api.php index a44c858dc..341c56984 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Api.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Api.php @@ -18,10 +18,6 @@ * sometimes simply referred to as "APIs" in other contexts, such as the name of * this message itself. See https://cloud.google.com/apis/design/glossary for * detailed terminology. - * New usages of this message as an alternative to ServiceDescriptorProto are - * strongly discouraged. This message does not reliability preserve all - * information necessary to model the schema and preserve semantics. Instead - * make use of FileDescriptorSet which preserves the necessary information. * * Generated from protobuf message google.protobuf.Api */ @@ -87,12 +83,6 @@ class Api extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.protobuf.Syntax syntax = 7; */ protected $syntax = 0; - /** - * The source edition string, only valid when syntax is SYNTAX_EDITIONS. - * - * Generated from protobuf field string edition = 8; - */ - protected $edition = ''; /** * Constructor. @@ -132,8 +122,6 @@ class Api extends \Google\Protobuf\Internal\Message * Included interfaces. See [Mixin][]. * @type int $syntax * The source syntax of the service. - * @type string $edition - * The source edition string, only valid when syntax is SYNTAX_EDITIONS. * } */ public function __construct($data = NULL) { @@ -369,31 +357,5 @@ public function setSyntax($var) return $this; } - /** - * The source edition string, only valid when syntax is SYNTAX_EDITIONS. - * - * Generated from protobuf field string edition = 8; - * @return string - */ - public function getEdition() - { - return $this->edition; - } - - /** - * The source edition string, only valid when syntax is SYNTAX_EDITIONS. - * - * Generated from protobuf field string edition = 8; - * @param string $var - * @return $this - */ - public function setEdition($var) - { - GPBUtil::checkString($var, True); - $this->edition = $var; - - return $this; - } - } diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Enum.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Enum.php index ea3be4056..296b0a019 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Enum.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Enum.php @@ -11,10 +11,6 @@ /** * Enum type definition. - * New usages of this message as an alternative to EnumDescriptorProto are - * strongly discouraged. This message does not reliability preserve all - * information necessary to model the schema and preserve semantics. Instead - * make use of FileDescriptorSet which preserves the necessary information. * * Generated from protobuf message google.protobuf.Enum */ diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/EnumValue.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/EnumValue.php index f9dfece17..a782640b8 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/EnumValue.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/EnumValue.php @@ -11,10 +11,6 @@ /** * Enum value definition. - * New usages of this message as an alternative to EnumValueDescriptorProto are - * strongly discouraged. This message does not reliability preserve all - * information necessary to model the schema and preserve semantics. Instead - * make use of FileDescriptorSet which preserves the necessary information. * * Generated from protobuf message google.protobuf.EnumValue */ diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Field.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Field.php index 727453027..405a2c0ad 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Field.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Field.php @@ -11,10 +11,6 @@ /** * A single field of a message type. - * New usages of this message as an alternative to FieldDescriptorProto are - * strongly discouraged. This message does not reliability preserve all - * information necessary to model the schema and preserve semantics. Instead - * make use of FileDescriptorSet which preserves the necessary information. * * Generated from protobuf message google.protobuf.Field */ diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions.php index 5442e5182..0e6bff555 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions.php @@ -97,11 +97,9 @@ class FieldOptions extends \Google\Protobuf\Internal\Message */ protected $deprecated = null; /** - * DEPRECATED. DO NOT USE! * For Google-internal migration only. Do not use. * - * Generated from protobuf field optional bool weak = 10 [default = false, deprecated = true]; - * @deprecated + * Generated from protobuf field optional bool weak = 10 [default = false]; */ protected $weak = null; /** @@ -206,7 +204,6 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * for accessors, or it will be completely ignored; in the very least, this * is a formalization for deprecating fields. * @type bool $weak - * DEPRECATED. DO NOT USE! * For Google-internal migration only. Do not use. * @type bool $debug_redact * Indicate that the field value should not be printed out when using debug @@ -534,47 +531,35 @@ public function setDeprecated($var) } /** - * DEPRECATED. DO NOT USE! * For Google-internal migration only. Do not use. * - * Generated from protobuf field optional bool weak = 10 [default = false, deprecated = true]; + * Generated from protobuf field optional bool weak = 10 [default = false]; * @return bool - * @deprecated */ public function getWeak() { - if (isset($this->weak)) { - @trigger_error('weak is deprecated.', E_USER_DEPRECATED); - } return isset($this->weak) ? $this->weak : false; } public function hasWeak() { - if (isset($this->weak)) { - @trigger_error('weak is deprecated.', E_USER_DEPRECATED); - } return isset($this->weak); } public function clearWeak() { - @trigger_error('weak is deprecated.', E_USER_DEPRECATED); unset($this->weak); } /** - * DEPRECATED. DO NOT USE! * For Google-internal migration only. Do not use. * - * Generated from protobuf field optional bool weak = 10 [default = false, deprecated = true]; + * Generated from protobuf field optional bool weak = 10 [default = false]; * @param bool $var * @return $this - * @deprecated */ public function setWeak($var) { - @trigger_error('weak is deprecated.', E_USER_DEPRECATED); GPBUtil::checkBool($var); $this->weak = $var; diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBDecodeException.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBDecodeException.php index 7104109fa..6a143a2a0 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBDecodeException.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBDecodeException.php @@ -14,7 +14,7 @@ class GPBDecodeException extends \Exception public function __construct( $message, $code = 0, - ?\Exception $previous = null) + \Exception $previous = null) { parent::__construct( "Error occurred during parsing: " . $message, diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Method.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Method.php index 6eb9c358c..5e55a764c 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Method.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Method.php @@ -11,10 +11,6 @@ /** * Method represents a method of an API interface. - * New usages of this message as an alternative to MethodDescriptorProto are - * strongly discouraged. This message does not reliability preserve all - * information necessary to model the schema and preserve semantics. Instead - * make use of FileDescriptorSet which preserves the necessary information. * * Generated from protobuf message google.protobuf.Method */ @@ -58,22 +54,10 @@ class Method extends \Google\Protobuf\Internal\Message private $options; /** * The source syntax of this method. - * This field should be ignored, instead the syntax should be inherited from - * Api. This is similar to Field and EnumValue. * - * Generated from protobuf field .google.protobuf.Syntax syntax = 7 [deprecated = true]; - * @deprecated + * Generated from protobuf field .google.protobuf.Syntax syntax = 7; */ protected $syntax = 0; - /** - * The source edition string, only valid when syntax is SYNTAX_EDITIONS. - * This field should be ignored, instead the edition should be inherited from - * Api. This is similar to Field and EnumValue. - * - * Generated from protobuf field string edition = 8 [deprecated = true]; - * @deprecated - */ - protected $edition = ''; /** * Constructor. @@ -95,12 +79,6 @@ class Method extends \Google\Protobuf\Internal\Message * Any metadata attached to the method. * @type int $syntax * The source syntax of this method. - * This field should be ignored, instead the syntax should be inherited from - * Api. This is similar to Field and EnumValue. - * @type string $edition - * The source edition string, only valid when syntax is SYNTAX_EDITIONS. - * This field should be ignored, instead the edition should be inherited from - * Api. This is similar to Field and EnumValue. * } */ public function __construct($data = NULL) { @@ -266,75 +244,29 @@ public function setOptions($var) /** * The source syntax of this method. - * This field should be ignored, instead the syntax should be inherited from - * Api. This is similar to Field and EnumValue. * - * Generated from protobuf field .google.protobuf.Syntax syntax = 7 [deprecated = true]; + * Generated from protobuf field .google.protobuf.Syntax syntax = 7; * @return int - * @deprecated */ public function getSyntax() { - if ($this->syntax !== 0) { - @trigger_error('syntax is deprecated.', E_USER_DEPRECATED); - } return $this->syntax; } /** * The source syntax of this method. - * This field should be ignored, instead the syntax should be inherited from - * Api. This is similar to Field and EnumValue. * - * Generated from protobuf field .google.protobuf.Syntax syntax = 7 [deprecated = true]; + * Generated from protobuf field .google.protobuf.Syntax syntax = 7; * @param int $var * @return $this - * @deprecated */ public function setSyntax($var) { - @trigger_error('syntax is deprecated.', E_USER_DEPRECATED); GPBUtil::checkEnum($var, \Google\Protobuf\Syntax::class); $this->syntax = $var; return $this; } - /** - * The source edition string, only valid when syntax is SYNTAX_EDITIONS. - * This field should be ignored, instead the edition should be inherited from - * Api. This is similar to Field and EnumValue. - * - * Generated from protobuf field string edition = 8 [deprecated = true]; - * @return string - * @deprecated - */ - public function getEdition() - { - if ($this->edition !== '') { - @trigger_error('edition is deprecated.', E_USER_DEPRECATED); - } - return $this->edition; - } - - /** - * The source edition string, only valid when syntax is SYNTAX_EDITIONS. - * This field should be ignored, instead the edition should be inherited from - * Api. This is similar to Field and EnumValue. - * - * Generated from protobuf field string edition = 8 [deprecated = true]; - * @param string $var - * @return $this - * @deprecated - */ - public function setEdition($var) - { - @trigger_error('edition is deprecated.', E_USER_DEPRECATED); - GPBUtil::checkString($var, True); - $this->edition = $var; - - return $this; - } - } diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Option.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Option.php index 4dc52ca23..7674fda83 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Option.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Option.php @@ -12,9 +12,6 @@ /** * A protocol buffer option, which can be attached to a message, field, * enumeration, etc. - * New usages of this message as an alternative to FileOptions, MessageOptions, - * FieldOptions, EnumOptions, EnumValueOptions, ServiceOptions, or MethodOptions - * are strongly discouraged. * * Generated from protobuf message google.protobuf.Option */ diff --git a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Type.php b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Type.php index ef37e778a..c274909ab 100644 --- a/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Type.php +++ b/lib/Google/vendor/google/protobuf/src/Google/Protobuf/Type.php @@ -11,10 +11,6 @@ /** * A protocol buffer message type. - * New usages of this message as an alternative to DescriptorProto are strongly - * discouraged. This message does not reliability preserve all information - * necessary to model the schema and preserve semantics. Instead make use of - * FileDescriptorSet which preserves the necessary information. * * Generated from protobuf message google.protobuf.Type */ diff --git a/lib/Google/vendor/grpc/grpc/composer.json b/lib/Google/vendor/grpc/grpc/composer.json index a585b40eb..755ea4bea 100644 --- a/lib/Google/vendor/grpc/grpc/composer.json +++ b/lib/Google/vendor/grpc/grpc/composer.json @@ -5,7 +5,7 @@ "keywords": ["rpc"], "homepage": "https://grpc.io", "license": "Apache-2.0", - "version": "1.74.0", + "version": "1.57.0", "require": { "php": ">=7.0.0" }, diff --git a/lib/Google/vendor/grpc/grpc/src/lib/BaseStub.php b/lib/Google/vendor/grpc/grpc/src/lib/BaseStub.php index 97d0b2474..d9da4ca1a 100644 --- a/lib/Google/vendor/grpc/grpc/src/lib/BaseStub.php +++ b/lib/Google/vendor/grpc/grpc/src/lib/BaseStub.php @@ -228,7 +228,7 @@ private function _get_jwt_aud_uri($method) } // Remove the port if it is 443 - // See https://github.com/grpc/grpc/blob/07c9f7a36b2a0d34fcffebc85649cf3b8c339b5d/src/core/filter/auth/client_auth_filter.cc#L205 + // See https://github.com/grpc/grpc/blob/07c9f7a36b2a0d34fcffebc85649cf3b8c339b5d/src/core/lib/security/transport/client_auth_filter.cc#L205 if ((strlen($hostname) > 4) && (substr($hostname, -4) === ":443")) { $hostname = substr($hostname, 0, -4); } diff --git a/lib/Google/vendor/grpc/grpc/src/lib/ServerCallWriter.php b/lib/Google/vendor/grpc/grpc/src/lib/ServerCallWriter.php index 40fbe995d..aceb20c38 100644 --- a/lib/Google/vendor/grpc/grpc/src/lib/ServerCallWriter.php +++ b/lib/Google/vendor/grpc/grpc/src/lib/ServerCallWriter.php @@ -81,7 +81,7 @@ public function finish( private function addSendInitialMetadataOpIfNotSent( array &$batch, - ?array $initialMetadata = null + array $initialMetadata = null ) { if (!$this->initialMetadataSent_) { $batch[OP_SEND_INITIAL_METADATA] = $initialMetadata ?? []; diff --git a/lib/Google/vendor/grpc/grpc/src/lib/Status.php b/lib/Google/vendor/grpc/grpc/src/lib/Status.php index d47480fa8..add208f6d 100644 --- a/lib/Google/vendor/grpc/grpc/src/lib/Status.php +++ b/lib/Google/vendor/grpc/grpc/src/lib/Status.php @@ -32,7 +32,7 @@ */ class Status { - public static function status(int $code, string $details, ?array $metadata = null): array + public static function status(int $code, string $details, array $metadata = null): array { $status = [ 'code' => $code, @@ -44,7 +44,7 @@ public static function status(int $code, string $details, ?array $metadata = nul return $status; } - public static function ok(?array $metadata = null): array + public static function ok(array $metadata = null): array { return Status::status(STATUS_OK, 'OK', $metadata); } diff --git a/lib/Google/vendor/grpc/grpc/src/lib/UnaryCall.php b/lib/Google/vendor/grpc/grpc/src/lib/UnaryCall.php index 4b7180fba..e8496492b 100644 --- a/lib/Google/vendor/grpc/grpc/src/lib/UnaryCall.php +++ b/lib/Google/vendor/grpc/grpc/src/lib/UnaryCall.php @@ -22,8 +22,6 @@ /** * Represents an active call that sends a single message and then gets a * single response. - * - * @template T of \Google\Protobuf\Internal\Message */ class UnaryCall extends AbstractCall { @@ -52,7 +50,7 @@ public function start($data, array $metadata = [], array $options = []) /** * Wait for the server to respond with data and a status. * - * @return array{0: T|null, 1: \stdClass} [response data, status] + * @return array [response data, status] */ public function wait() { diff --git a/lib/Google/vendor/guzzlehttp/guzzle/CHANGELOG.md b/lib/Google/vendor/guzzlehttp/guzzle/CHANGELOG.md index 5fe721e03..7600ef497 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/CHANGELOG.md +++ b/lib/Google/vendor/guzzlehttp/guzzle/CHANGELOG.md @@ -2,17 +2,6 @@ Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version. -## 7.10.0 - 2025-08-23 - -### Added - -- Support for PHP 8.5 - -### Changed - -- Adjusted `guzzlehttp/promises` version constraint to `^2.3` -- Adjusted `guzzlehttp/psr7` version constraint to `^2.8` - ## 7.9.3 - 2025-03-27 diff --git a/lib/Google/vendor/guzzlehttp/guzzle/composer.json b/lib/Google/vendor/guzzlehttp/guzzle/composer.json index 0db75a950..cbede149a 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/composer.json +++ b/lib/Google/vendor/guzzlehttp/guzzle/composer.json @@ -81,8 +81,8 @@ "require": { "php": "^7.2.5 || ^8.0", "ext-json": "*", - "guzzlehttp/promises": "^2.3", - "guzzlehttp/psr7": "^2.8", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" }, diff --git a/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php b/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php index 3c1fa9c13..fe3613751 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php +++ b/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php @@ -125,9 +125,7 @@ public function release(EasyHandle $easy): void unset($easy->handle); if (\count($this->handles) >= $this->maxHandles) { - if (PHP_VERSION_ID < 80000) { - \curl_close($resource); - } + \curl_close($resource); } else { // Remove all callback functions as they can hold onto references // and are not cleaned up by curl_reset. Using curl_setopt_array @@ -731,10 +729,7 @@ private function createHeaderFn(EasyHandle $easy): callable public function __destruct() { foreach ($this->handles as $id => $handle) { - if (PHP_VERSION_ID < 80000) { - \curl_close($handle); - } - + \curl_close($handle); unset($this->handles[$id]); } } diff --git a/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php index 21abbedf3..73a6abe33 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php +++ b/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php @@ -240,10 +240,7 @@ private function cancel($id): bool $handle = $this->handles[$id]['easy']->handle; unset($this->delays[$id], $this->handles[$id]); \curl_multi_remove_handle($this->_mh, $handle); - - if (PHP_VERSION_ID < 80000) { - \curl_close($handle); - } + \curl_close($handle); return true; } diff --git a/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php b/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php index f24921f47..083049ea8 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php +++ b/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php @@ -333,15 +333,8 @@ static function () use ($context, $params) { ); return $this->createResource( - function () use ($uri, $contextResource, $context, $options, $request) { + function () use ($uri, &$http_response_header, $contextResource, $context, $options, $request) { $resource = @\fopen((string) $uri, 'r', false, $contextResource); - - // See https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_http_response_header_predefined_variable - if (function_exists('http_get_last_response_headers')) { - /** @var array|null */ - $http_response_header = \http_get_last_response_headers(); - } - $this->lastHeaders = $http_response_header ?? []; if (false === $resource) { diff --git a/lib/Google/vendor/guzzlehttp/guzzle/src/Middleware.php b/lib/Google/vendor/guzzlehttp/guzzle/src/Middleware.php index 9901da44a..6edbb3fe4 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/src/Middleware.php +++ b/lib/Google/vendor/guzzlehttp/guzzle/src/Middleware.php @@ -187,12 +187,12 @@ public static function retry(callable $decider, ?callable $delay = null): callab * Middleware that logs requests, responses, and errors using a message * formatter. * + * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests. + * * @param LoggerInterface $logger Logs messages. * @param MessageFormatterInterface|MessageFormatter $formatter Formatter used to create message strings. * @param string $logLevel Level at which to log requests. * - * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests. - * * @return callable Returns a function that accepts the next handler. */ public static function log(LoggerInterface $logger, $formatter, string $logLevel = 'info'): callable diff --git a/lib/Google/vendor/guzzlehttp/promises/CHANGELOG.md b/lib/Google/vendor/guzzlehttp/promises/CHANGELOG.md index 7df9c0ae6..1d8045032 100644 --- a/lib/Google/vendor/guzzlehttp/promises/CHANGELOG.md +++ b/lib/Google/vendor/guzzlehttp/promises/CHANGELOG.md @@ -1,13 +1,6 @@ # CHANGELOG -## 2.3.0 - 2025-08-22 - -### Added - -- PHP 8.5 support - - ## 2.2.0 - 2025-03-27 ### Fixed diff --git a/lib/Google/vendor/guzzlehttp/promises/README.md b/lib/Google/vendor/guzzlehttp/promises/README.md index 493a9315b..d1c814fe7 100644 --- a/lib/Google/vendor/guzzlehttp/promises/README.md +++ b/lib/Google/vendor/guzzlehttp/promises/README.md @@ -41,7 +41,7 @@ composer require guzzlehttp/promises | Version | Status | PHP Version | |---------|---------------------|--------------| | 1.x | Security fixes only | >=5.5,<8.3 | -| 2.x | Latest | >=7.2.5,<8.6 | +| 2.x | Latest | >=7.2.5,<8.5 | ## Quick Start diff --git a/lib/Google/vendor/guzzlehttp/promises/composer.json b/lib/Google/vendor/guzzlehttp/promises/composer.json index 9d6e85678..f64ed7714 100644 --- a/lib/Google/vendor/guzzlehttp/promises/composer.json +++ b/lib/Google/vendor/guzzlehttp/promises/composer.json @@ -30,7 +30,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.44 || ^9.6.25" + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "autoload": { "psr-4": { diff --git a/lib/Google/vendor/guzzlehttp/psr7/CHANGELOG.md b/lib/Google/vendor/guzzlehttp/psr7/CHANGELOG.md index 4a2a12194..a85929521 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/CHANGELOG.md +++ b/lib/Google/vendor/guzzlehttp/psr7/CHANGELOG.md @@ -5,16 +5,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## 2.8.0 - 2025-08-23 - -### Added - -- Allow empty lists as header values - -### Changed - -- PHP 8.5 support - ## 2.7.1 - 2025-03-27 ### Fixed diff --git a/lib/Google/vendor/guzzlehttp/psr7/README.md b/lib/Google/vendor/guzzlehttp/psr7/README.md index 24aad8605..2e9bb0b9b 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/README.md +++ b/lib/Google/vendor/guzzlehttp/psr7/README.md @@ -25,7 +25,7 @@ composer require guzzlehttp/psr7 | Version | Status | PHP Version | |---------|---------------------|--------------| | 1.x | EOL (2024-06-30) | >=5.4,<8.2 | -| 2.x | Latest | >=7.2.5,<8.6 | +| 2.x | Latest | >=7.2.5,<8.5 | ## AppendStream diff --git a/lib/Google/vendor/guzzlehttp/psr7/composer.json b/lib/Google/vendor/guzzlehttp/psr7/composer.json index 96098f536..28d15f571 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/composer.json +++ b/lib/Google/vendor/guzzlehttp/psr7/composer.json @@ -62,7 +62,7 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "http-interop/http-factory-tests": "0.9.0", - "phpunit/phpunit": "^8.5.44 || ^9.6.25" + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/MessageTrait.php b/lib/Google/vendor/guzzlehttp/psr7/src/MessageTrait.php index c15ee63fc..65dbc4ba0 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/MessageTrait.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -174,6 +174,10 @@ private function normalizeHeaderValue($value): array return $this->trimAndValidateHeaderValues([$value]); } + if (count($value) === 0) { + throw new \InvalidArgumentException('Header value can not be an empty array.'); + } + return $this->trimAndValidateHeaderValues($value); } diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/Utils.php b/lib/Google/vendor/guzzlehttp/psr7/src/Utils.php index 5451e3dcd..7682d2cdc 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/Utils.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/Utils.php @@ -397,7 +397,7 @@ public static function tryFopen(string $filename, string $mode) restore_error_handler(); if ($ex) { - /** @var \RuntimeException $ex */ + /** @var $ex \RuntimeException */ throw $ex; } @@ -444,7 +444,7 @@ public static function tryGetContents($stream): string restore_error_handler(); if ($ex) { - /** @var \RuntimeException $ex */ + /** @var $ex \RuntimeException */ throw $ex; } diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/composer.json b/lib/Google/vendor/paragonie/constant_time_encoding/composer.json index 11fad5e63..5023095b4 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/composer.json +++ b/lib/Google/vendor/paragonie/constant_time_encoding/composer.json @@ -40,10 +40,8 @@ "php": "^8" }, "require-dev": { - "infection/infection": "^0", - "nikic/php-fuzzer": "^0", - "phpunit/phpunit": "^9|^10|^11", - "vimeo/psalm": "^4|^5|^6" + "phpunit/phpunit": "^9", + "vimeo/psalm": "^4|^5" }, "autoload": { "psr-4": { @@ -54,14 +52,5 @@ "psr-4": { "ParagonIE\\ConstantTime\\Tests\\": "tests/" } - }, - "scripts": { - "mutation-test": "infection" - }, - "config": { - "process-timeout": 0, - "allow-plugins": { - "infection/extension-installer": true - } } } diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32.php index 379552af5..48d00b991 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32.php @@ -3,15 +3,8 @@ namespace ParagonIE\ConstantTime; use InvalidArgumentException; -use Override; use RangeException; -use SensitiveParameter; use TypeError; -use function pack; -use function rtrim; -use function strlen; -use function substr; -use function unpack; /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. @@ -51,9 +44,8 @@ abstract class Base32 implements EncoderInterface * @param bool $strictPadding * @return string */ - #[Override] public static function decode( - #[SensitiveParameter] + #[\SensitiveParameter] string $encodedString, bool $strictPadding = false ): string { @@ -68,7 +60,7 @@ public static function decode( * @return string */ public static function decodeUpper( - #[SensitiveParameter] + #[\SensitiveParameter] string $src, bool $strictPadding = false ): string { @@ -82,9 +74,8 @@ public static function decodeUpper( * @return string * @throws TypeError */ - #[Override] public static function encode( - #[SensitiveParameter] + #[\SensitiveParameter] string $binString ): string { return static::doEncode($binString, false, true); @@ -96,10 +87,9 @@ public static function encode( * @param string $src * @return string * @throws TypeError - * @api */ public static function encodeUnpadded( - #[SensitiveParameter] + #[\SensitiveParameter] string $src ): string { return static::doEncode($src, false, false); @@ -111,10 +101,9 @@ public static function encodeUnpadded( * @param string $src * @return string * @throws TypeError - * @api */ public static function encodeUpper( - #[SensitiveParameter] + #[\SensitiveParameter] string $src ): string { return static::doEncode($src, true, true); @@ -126,10 +115,9 @@ public static function encodeUpper( * @param string $src * @return string * @throws TypeError - * @api */ public static function encodeUpperUnpadded( - #[SensitiveParameter] + #[\SensitiveParameter] string $src ): string { return static::doEncode($src, true, false); @@ -141,7 +129,6 @@ public static function encodeUpperUnpadded( * * @param int $src * @return int - * @api */ protected static function decode5Bits(int $src): int { @@ -164,7 +151,6 @@ protected static function decode5Bits(int $src): int * * @param int $src * @return int - * @api */ protected static function decode5BitsUpper(int $src): int { @@ -185,7 +171,6 @@ protected static function decode5BitsUpper(int $src): int * * @param int $src * @return string - * @api */ protected static function encode5Bits(int $src): string { @@ -194,7 +179,7 @@ protected static function encode5Bits(int $src): string // if ($src > 25) $ret -= 72; $diff -= ((25 - $src) >> 8) & 73; - return pack('C', $src + $diff); + return \pack('C', $src + $diff); } /** @@ -205,7 +190,6 @@ protected static function encode5Bits(int $src): string * * @param int $src * @return string - * @api */ protected static function encode5BitsUpper(int $src): string { @@ -214,21 +198,20 @@ protected static function encode5BitsUpper(int $src): string // if ($src > 25) $ret -= 40; $diff -= ((25 - $src) >> 8) & 41; - return pack('C', $src + $diff); + return \pack('C', $src + $diff); } /** * @param string $encodedString * @param bool $upper * @return string - * @api */ public static function decodeNoPadding( - #[SensitiveParameter] + #[\SensitiveParameter] string $encodedString, bool $upper = false ): string { - $srcLen = strlen($encodedString); + $srcLen = Binary::safeStrlen($encodedString); if ($srcLen === 0) { return ''; } @@ -259,7 +242,7 @@ public static function decodeNoPadding( * @throws TypeError */ protected static function doDecode( - #[SensitiveParameter] + #[\SensitiveParameter] string $src, bool $upper = false, bool $strictPadding = false @@ -270,7 +253,7 @@ protected static function doDecode( : 'decode5Bits'; // Remove padding - $srcLen = strlen($src); + $srcLen = Binary::safeStrlen($src); if ($srcLen === 0) { return ''; } @@ -290,8 +273,8 @@ protected static function doDecode( ); } } else { - $src = rtrim($src, '='); - $srcLen = strlen($src); + $src = \rtrim($src, '='); + $srcLen = Binary::safeStrlen($src); } $err = 0; @@ -299,7 +282,7 @@ protected static function doDecode( // Main loop (no padding): for ($i = 0; $i + 8 <= $srcLen; $i += 8) { /** @var array $chunk */ - $chunk = unpack('C*', substr($src, $i, 8)); + $chunk = \unpack('C*', Binary::safeSubstr($src, $i, 8)); /** @var int $c0 */ $c0 = static::$method($chunk[1]); /** @var int $c1 */ @@ -317,7 +300,7 @@ protected static function doDecode( /** @var int $c7 */ $c7 = static::$method($chunk[8]); - $dest .= pack( + $dest .= \pack( 'CCCCC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff, @@ -330,7 +313,7 @@ protected static function doDecode( // The last chunk, which may have padding: if ($i < $srcLen) { /** @var array $chunk */ - $chunk = unpack('C*', substr($src, $i, $srcLen - $i)); + $chunk = \unpack('C*', Binary::safeSubstr($src, $i, $srcLen - $i)); /** @var int $c0 */ $c0 = static::$method($chunk[1]); @@ -348,7 +331,7 @@ protected static function doDecode( /** @var int $c6 */ $c6 = static::$method($chunk[7]); - $dest .= pack( + $dest .= \pack( 'CCCC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff, @@ -371,7 +354,7 @@ protected static function doDecode( /** @var int $c5 */ $c5 = static::$method($chunk[6]); - $dest .= pack( + $dest .= \pack( 'CCCC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff, @@ -389,7 +372,7 @@ protected static function doDecode( /** @var int $c4 */ $c4 = static::$method($chunk[5]); - $dest .= pack( + $dest .= \pack( 'CCC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff, @@ -407,7 +390,7 @@ protected static function doDecode( /** @var int $c3 */ $c3 = static::$method($chunk[4]); - $dest .= pack( + $dest .= \pack( 'CC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff @@ -422,7 +405,7 @@ protected static function doDecode( /** @var int $c2 */ $c2 = static::$method($chunk[3]); - $dest .= pack( + $dest .= \pack( 'CC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) ) & 0xff @@ -435,7 +418,7 @@ protected static function doDecode( /** @var int $c1 */ $c1 = static::$method($chunk[2]); - $dest .= pack( + $dest .= \pack( 'C', (($c0 << 3) | ($c1 >> 2) ) & 0xff ); @@ -444,7 +427,7 @@ protected static function doDecode( $err |= ($c1 << 6) & 0xff; } } else { - $dest .= pack( + $dest .= \pack( 'C', (($c0 << 3) ) & 0xff ); @@ -470,10 +453,10 @@ protected static function doDecode( * @throws TypeError */ protected static function doEncode( - #[SensitiveParameter] + #[\SensitiveParameter] string $src, bool $upper = false, - bool $pad = true + $pad = true ): string { // We do this to reduce code duplication: $method = $upper @@ -481,12 +464,12 @@ protected static function doEncode( : 'encode5Bits'; $dest = ''; - $srcLen = strlen($src); + $srcLen = Binary::safeStrlen($src); // Main loop (no padding): for ($i = 0; $i + 5 <= $srcLen; $i += 5) { /** @var array $chunk */ - $chunk = unpack('C*', substr($src, $i, 5)); + $chunk = \unpack('C*', Binary::safeSubstr($src, $i, 5)); $b0 = $chunk[1]; $b1 = $chunk[2]; $b2 = $chunk[3]; @@ -505,7 +488,7 @@ protected static function doEncode( // The last chunk, which may have padding: if ($i < $srcLen) { /** @var array $chunk */ - $chunk = unpack('C*', substr($src, $i, $srcLen - $i)); + $chunk = \unpack('C*', Binary::safeSubstr($src, $i, $srcLen - $i)); $b0 = $chunk[1]; if ($i + 3 < $srcLen) { $b1 = $chunk[2]; diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32Hex.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32Hex.php index 4323a573a..b868dd048 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32Hex.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base32Hex.php @@ -2,9 +2,6 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; -use Override; -use function pack; - /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) @@ -43,7 +40,6 @@ abstract class Base32Hex extends Base32 * @param int $src * @return int */ - #[Override] protected static function decode5Bits(int $src): int { $ret = -1; @@ -64,7 +60,6 @@ protected static function decode5Bits(int $src): int * @param int $src * @return int */ - #[Override] protected static function decode5BitsUpper(int $src): int { $ret = -1; @@ -85,7 +80,6 @@ protected static function decode5BitsUpper(int $src): int * @param int $src * @return string */ - #[Override] protected static function encode5Bits(int $src): string { $src += 0x30; @@ -93,7 +87,7 @@ protected static function encode5Bits(int $src): string // if ($src > 0x39) $src += 0x61 - 0x3a; // 39 $src += ((0x39 - $src) >> 8) & 39; - return pack('C', $src); + return \pack('C', $src); } /** @@ -105,7 +99,6 @@ protected static function encode5Bits(int $src): string * @param int $src * @return string */ - #[Override] protected static function encode5BitsUpper(int $src): string { $src += 0x30; @@ -113,6 +106,6 @@ protected static function encode5BitsUpper(int $src): string // if ($src > 0x39) $src += 0x41 - 0x3a; // 7 $src += ((0x39 - $src) >> 8) & 7; - return pack('C', $src); + return \pack('C', $src); } } \ No newline at end of file diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64.php index 9679748dc..2e3ecc859 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64.php @@ -3,23 +3,8 @@ namespace ParagonIE\ConstantTime; use InvalidArgumentException; -use Override; use RangeException; -use SensitiveParameter; -use SodiumException; use TypeError; -use function extension_loaded; -use function pack; -use function rtrim; -use function sodium_base642bin; -use function sodium_bin2base64; -use function strlen; -use function substr; -use function unpack; -use const SODIUM_BASE64_VARIANT_ORIGINAL; -use const SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING; -use const SODIUM_BASE64_VARIANT_URLSAFE; -use const SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING; /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. @@ -62,25 +47,10 @@ abstract class Base64 implements EncoderInterface * * @throws TypeError */ - #[Override] public static function encode( - #[SensitiveParameter] + #[\SensitiveParameter] string $binString ): string { - if (extension_loaded('sodium')) { - $variant = match(static::class) { - Base64::class => SODIUM_BASE64_VARIANT_ORIGINAL, - Base64UrlSafe::class => SODIUM_BASE64_VARIANT_URLSAFE, - default => 0, - }; - if ($variant > 0) { - try { - return sodium_bin2base64($binString, $variant); - } catch (SodiumException $ex) { - throw new RangeException($ex->getMessage(), $ex->getCode(), $ex); - } - } - } return static::doEncode($binString, true); } @@ -93,26 +63,11 @@ public static function encode( * @return string * * @throws TypeError - * @api */ public static function encodeUnpadded( - #[SensitiveParameter] + #[\SensitiveParameter] string $src ): string { - if (extension_loaded('sodium')) { - $variant = match(static::class) { - Base64::class => SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING, - Base64UrlSafe::class => SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING, - default => 0, - }; - if ($variant > 0) { - try { - return sodium_bin2base64($src, $variant); - } catch (SodiumException $ex) { - throw new RangeException($ex->getMessage(), $ex->getCode(), $ex); - } - } - } return static::doEncode($src, false); } @@ -124,16 +79,16 @@ public static function encodeUnpadded( * @throws TypeError */ protected static function doEncode( - #[SensitiveParameter] + #[\SensitiveParameter] string $src, bool $pad = true ): string { $dest = ''; - $srcLen = strlen($src); + $srcLen = Binary::safeStrlen($src); // Main loop (no padding): for ($i = 0; $i + 3 <= $srcLen; $i += 3) { /** @var array $chunk */ - $chunk = unpack('C*', substr($src, $i, 3)); + $chunk = \unpack('C*', Binary::safeSubstr($src, $i, 3)); $b0 = $chunk[1]; $b1 = $chunk[2]; $b2 = $chunk[3]; @@ -147,7 +102,7 @@ protected static function doEncode( // The last chunk, which may have padding: if ($i < $srcLen) { /** @var array $chunk */ - $chunk = unpack('C*', substr($src, $i, $srcLen - $i)); + $chunk = \unpack('C*', Binary::safeSubstr($src, $i, $srcLen - $i)); $b0 = $chunk[1]; if ($i + 1 < $srcLen) { $b1 = $chunk[2]; @@ -182,14 +137,13 @@ protected static function doEncode( * @throws RangeException * @throws TypeError */ - #[Override] public static function decode( - #[SensitiveParameter] + #[\SensitiveParameter] string $encodedString, bool $strictPadding = false ): string { // Remove padding - $srcLen = strlen($encodedString); + $srcLen = Binary::safeStrlen($encodedString); if ($srcLen === 0) { return ''; } @@ -213,24 +167,9 @@ public static function decode( 'Incorrect padding' ); } - if (extension_loaded('sodium')) { - $variant = match(static::class) { - Base64::class => SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING, - Base64UrlSafe::class => SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING, - default => 0, - }; - if ($variant > 0) { - try { - return sodium_base642bin(substr($encodedString, 0, $srcLen), $variant); - } catch (SodiumException $ex) { - throw new RangeException($ex->getMessage(), $ex->getCode(), $ex); - } - } - } } else { - // Just remove all padding. - $encodedString = rtrim($encodedString, '='); - $srcLen = strlen($encodedString); + $encodedString = \rtrim($encodedString, '='); + $srcLen = Binary::safeStrlen($encodedString); } $err = 0; @@ -238,13 +177,13 @@ public static function decode( // Main loop (no padding): for ($i = 0; $i + 4 <= $srcLen; $i += 4) { /** @var array $chunk */ - $chunk = unpack('C*', substr($encodedString, $i, 4)); + $chunk = \unpack('C*', Binary::safeSubstr($encodedString, $i, 4)); $c0 = static::decode6Bits($chunk[1]); $c1 = static::decode6Bits($chunk[2]); $c2 = static::decode6Bits($chunk[3]); $c3 = static::decode6Bits($chunk[4]); - $dest .= pack( + $dest .= \pack( 'CCC', ((($c0 << 2) | ($c1 >> 4)) & 0xff), ((($c1 << 4) | ($c2 >> 2)) & 0xff), @@ -255,13 +194,13 @@ public static function decode( // The last chunk, which may have padding: if ($i < $srcLen) { /** @var array $chunk */ - $chunk = unpack('C*', substr($encodedString, $i, $srcLen - $i)); + $chunk = \unpack('C*', Binary::safeSubstr($encodedString, $i, $srcLen - $i)); $c0 = static::decode6Bits($chunk[1]); if ($i + 2 < $srcLen) { $c1 = static::decode6Bits($chunk[2]); $c2 = static::decode6Bits($chunk[3]); - $dest .= pack( + $dest .= \pack( 'CC', ((($c0 << 2) | ($c1 >> 4)) & 0xff), ((($c1 << 4) | ($c2 >> 2)) & 0xff) @@ -272,7 +211,7 @@ public static function decode( } } elseif ($i + 1 < $srcLen) { $c1 = static::decode6Bits($chunk[2]); - $dest .= pack( + $dest .= \pack( 'C', ((($c0 << 2) | ($c1 >> 4)) & 0xff) ); @@ -296,13 +235,12 @@ public static function decode( /** * @param string $encodedString * @return string - * @api */ public static function decodeNoPadding( - #[SensitiveParameter] + #[\SensitiveParameter] string $encodedString ): string { - $srcLen = strlen($encodedString); + $srcLen = Binary::safeStrlen($encodedString); if ($srcLen === 0) { return ''; } @@ -376,6 +314,6 @@ protected static function encode6Bits(int $src): string // if ($src > 62) $diff += 0x2f - 0x2b - 1; // 3 $diff += ((62 - $src) >> 8) & 3; - return pack('C', $src + $diff); + return \pack('C', $src + $diff); } } diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlash.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlash.php index 847751767..5e98a8f79 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlash.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlash.php @@ -2,8 +2,6 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; -use Override; - /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) @@ -46,7 +44,6 @@ abstract class Base64DotSlash extends Base64 * @param int $src * @return int */ - #[Override] protected static function decode6Bits(int $src): int { $ret = -1; @@ -73,7 +70,6 @@ protected static function decode6Bits(int $src): int * @param int $src * @return string */ - #[Override] protected static function encode6Bits(int $src): string { $src += 0x2e; diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php index 2c42db37f..9780b14bb 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php @@ -2,8 +2,6 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; -use Override; - /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) @@ -46,7 +44,6 @@ abstract class Base64DotSlashOrdered extends Base64 * @param int $src * @return int */ - #[Override] protected static function decode6Bits(int $src): int { $ret = -1; @@ -70,7 +67,6 @@ protected static function decode6Bits(int $src): int * @param int $src * @return string */ - #[Override] protected static function encode6Bits(int $src): string { $src += 0x2e; diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64UrlSafe.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64UrlSafe.php index 845aaf626..8192c63d5 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64UrlSafe.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Base64UrlSafe.php @@ -2,8 +2,6 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; -use Override; - /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) @@ -47,7 +45,6 @@ abstract class Base64UrlSafe extends Base64 * @param int $src * @return int */ - #[Override] protected static function decode6Bits(int $src): int { $ret = -1; @@ -77,7 +74,6 @@ protected static function decode6Bits(int $src): int * @param int $src * @return string */ - #[Override] protected static function encode6Bits(int $src): string { $diff = 0x41; diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Binary.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Binary.php index 369584407..a958f2f7c 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Binary.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Binary.php @@ -2,10 +2,7 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; -use SensitiveParameter; use TypeError; -use function strlen; -use function substr; /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. @@ -49,10 +46,16 @@ abstract class Binary * @return int */ public static function safeStrlen( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): int { - return strlen($str); + if (\function_exists('mb_strlen')) { + // mb_strlen in PHP 7.x can return false. + /** @psalm-suppress RedundantCast */ + return (int) \mb_strlen($str, '8bit'); + } else { + return \strlen($str); + } } /** @@ -69,7 +72,7 @@ public static function safeStrlen( * @throws TypeError */ public static function safeSubstr( - #[SensitiveParameter] + #[\SensitiveParameter] string $str, int $start = 0, ?int $length = null @@ -77,11 +80,14 @@ public static function safeSubstr( if ($length === 0) { return ''; } + if (\function_exists('mb_substr')) { + return \mb_substr($str, $start, $length, '8bit'); + } // Unlike mb_substr(), substr() doesn't accept NULL for length if ($length !== null) { - return substr($str, $start, $length); + return \substr($str, $start, $length); } else { - return substr($str, $start); + return \substr($str, $start); } } } diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/EncoderInterface.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/EncoderInterface.php index cb358ea0d..9cafbf96c 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/EncoderInterface.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/EncoderInterface.php @@ -2,8 +2,6 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; -use SensitiveParameter; - /** * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) @@ -40,10 +38,7 @@ interface EncoderInterface * @param string $binString (raw binary) * @return string */ - public static function encode( - #[SensitiveParameter] - string $binString - ): string; + public static function encode(string $binString): string; /** * Convert a binary string into a hexadecimal string without cache-timing @@ -53,9 +48,5 @@ public static function encode( * @param bool $strictPadding Error on invalid padding * @return string (raw binary) */ - public static function decode( - #[SensitiveParameter] - string $encodedString, - bool $strictPadding = false - ): string; + public static function decode(string $encodedString, bool $strictPadding = false): string; } diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Encoding.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Encoding.php index b28a5014e..8b7e3878e 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Encoding.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Encoding.php @@ -2,8 +2,6 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; -use RangeException; -use SensitiveParameter; use TypeError; /** @@ -32,7 +30,6 @@ /** * Class Encoding * @package ParagonIE\ConstantTime - * @api */ abstract class Encoding { @@ -44,7 +41,7 @@ abstract class Encoding * @throws TypeError */ public static function base32Encode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base32::encode($str); @@ -58,7 +55,7 @@ public static function base32Encode( * @throws TypeError */ public static function base32EncodeUpper( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base32::encodeUpper($str); @@ -72,7 +69,7 @@ public static function base32EncodeUpper( * @throws TypeError */ public static function base32Decode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base32::decode($str); @@ -86,7 +83,7 @@ public static function base32Decode( * @throws TypeError */ public static function base32DecodeUpper( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base32::decodeUpper($str); @@ -100,7 +97,7 @@ public static function base32DecodeUpper( * @throws TypeError */ public static function base32HexEncode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base32Hex::encode($str); @@ -114,7 +111,7 @@ public static function base32HexEncode( * @throws TypeError */ public static function base32HexEncodeUpper( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base32Hex::encodeUpper($str); @@ -128,7 +125,7 @@ public static function base32HexEncodeUpper( * @throws TypeError */ public static function base32HexDecode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base32Hex::decode($str); @@ -142,7 +139,7 @@ public static function base32HexDecode( * @throws TypeError */ public static function base32HexDecodeUpper( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base32Hex::decodeUpper($str); @@ -156,7 +153,7 @@ public static function base32HexDecodeUpper( * @throws TypeError */ public static function base64Encode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base64::encode($str); @@ -170,7 +167,7 @@ public static function base64Encode( * @throws TypeError */ public static function base64Decode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base64::decode($str); @@ -185,7 +182,7 @@ public static function base64Decode( * @throws TypeError */ public static function base64EncodeDotSlash( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base64DotSlash::encode($str); @@ -198,11 +195,11 @@ public static function base64EncodeDotSlash( * * @param string $str * @return string - * @throws RangeException + * @throws \RangeException * @throws TypeError */ public static function base64DecodeDotSlash( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base64DotSlash::decode($str); @@ -217,7 +214,7 @@ public static function base64DecodeDotSlash( * @throws TypeError */ public static function base64EncodeDotSlashOrdered( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base64DotSlashOrdered::encode($str); @@ -230,11 +227,11 @@ public static function base64EncodeDotSlashOrdered( * * @param string $str * @return string - * @throws RangeException + * @throws \RangeException * @throws TypeError */ public static function base64DecodeDotSlashOrdered( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base64DotSlashOrdered::decode($str); @@ -249,7 +246,7 @@ public static function base64DecodeDotSlashOrdered( * @throws TypeError */ public static function hexEncode( - #[SensitiveParameter] + #[\SensitiveParameter] string $bin_string ): string { return Hex::encode($bin_string); @@ -261,10 +258,10 @@ public static function hexEncode( * * @param string $hex_string * @return string (raw binary) - * @throws RangeException + * @throws \RangeException */ public static function hexDecode( - #[SensitiveParameter] + #[\SensitiveParameter] string $hex_string ): string { return Hex::decode($hex_string); @@ -279,7 +276,7 @@ public static function hexDecode( * @throws TypeError */ public static function hexEncodeUpper( - #[SensitiveParameter] + #[\SensitiveParameter] string $bin_string ): string { return Hex::encodeUpper($bin_string); @@ -293,7 +290,7 @@ public static function hexEncodeUpper( * @return string */ public static function hexDecodeUpper( - #[SensitiveParameter] + #[\SensitiveParameter] string $bin_string ): string { return Hex::decode($bin_string); diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/Hex.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/Hex.php index b515b9758..97c2046f0 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/Hex.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/Hex.php @@ -2,20 +2,11 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; -use Override; use RangeException; -use SensitiveParameter; -use SodiumException; use TypeError; -use function extension_loaded; -use function pack; -use function sodium_bin2hex; -use function sodium_hex2bin; -use function strlen; -use function unpack; /** - * Copyright (c) 2016 - 2025 Paragon Initiative Enterprises. + * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -51,27 +42,19 @@ abstract class Hex implements EncoderInterface * @return string * @throws TypeError */ - #[Override] public static function encode( - #[SensitiveParameter] + #[\SensitiveParameter] string $binString ): string { - if (extension_loaded('sodium')) { - try { - return sodium_bin2hex($binString); - } catch (SodiumException $ex) { - throw new RangeException($ex->getMessage(), $ex->getCode(), $ex); - } - } $hex = ''; - $len = strlen($binString); + $len = Binary::safeStrlen($binString); for ($i = 0; $i < $len; ++$i) { /** @var array $chunk */ - $chunk = unpack('C', $binString[$i]); + $chunk = \unpack('C', $binString[$i]); $c = $chunk[1] & 0xf; $b = $chunk[1] >> 4; - $hex .= pack( + $hex .= \pack( 'CC', (87 + $b + ((($b - 10) >> 8) & ~38)), (87 + $c + ((($c - 10) >> 8) & ~38)) @@ -89,19 +72,19 @@ public static function encode( * @throws TypeError */ public static function encodeUpper( - #[SensitiveParameter] + #[\SensitiveParameter] string $binString ): string { $hex = ''; - $len = strlen($binString); + $len = Binary::safeStrlen($binString); for ($i = 0; $i < $len; ++$i) { /** @var array $chunk */ - $chunk = unpack('C', $binString[$i]); + $chunk = \unpack('C', $binString[$i]); $c = $chunk[1] & 0xf; $b = $chunk[1] >> 4; - $hex .= pack( + $hex .= \pack( 'CC', (55 + $b + ((($b - 10) >> 8) & ~6)), (55 + $c + ((($c - 10) >> 8) & ~6)) @@ -119,23 +102,15 @@ public static function encodeUpper( * @return string (raw binary) * @throws RangeException */ - #[Override] public static function decode( - #[SensitiveParameter] + #[\SensitiveParameter] string $encodedString, bool $strictPadding = false ): string { - if (extension_loaded('sodium') && $strictPadding) { - try { - return sodium_hex2bin($encodedString); - } catch (SodiumException $ex) { - throw new RangeException($ex->getMessage(), $ex->getCode(), $ex); - } - } $hex_pos = 0; $bin = ''; $c_acc = 0; - $hex_len = strlen($encodedString); + $hex_len = Binary::safeStrlen($encodedString); $state = 0; if (($hex_len & 1) !== 0) { if ($strictPadding) { @@ -149,7 +124,7 @@ public static function decode( } /** @var array $chunk */ - $chunk = unpack('C*', $encodedString); + $chunk = \unpack('C*', $encodedString); while ($hex_pos < $hex_len) { ++$hex_pos; $c = $chunk[$hex_pos]; @@ -167,7 +142,7 @@ public static function decode( if ($state === 0) { $c_acc = $c_val * 16; } else { - $bin .= pack('C', $c_acc | $c_val); + $bin .= \pack('C', $c_acc | $c_val); } $state ^= 1; } diff --git a/lib/Google/vendor/paragonie/constant_time_encoding/src/RFC4648.php b/lib/Google/vendor/paragonie/constant_time_encoding/src/RFC4648.php index fb66f73d7..7cd2e9909 100644 --- a/lib/Google/vendor/paragonie/constant_time_encoding/src/RFC4648.php +++ b/lib/Google/vendor/paragonie/constant_time_encoding/src/RFC4648.php @@ -2,7 +2,6 @@ declare(strict_types=1); namespace ParagonIE\ConstantTime; -use SensitiveParameter; use TypeError; /** @@ -34,7 +33,6 @@ * This class conforms strictly to the RFC * * @package ParagonIE\ConstantTime - * @api */ abstract class RFC4648 { @@ -49,7 +47,7 @@ abstract class RFC4648 * @throws TypeError */ public static function base64Encode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base64::encode($str); @@ -66,7 +64,7 @@ public static function base64Encode( * @throws TypeError */ public static function base64Decode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base64::decode($str, true); @@ -83,7 +81,7 @@ public static function base64Decode( * @throws TypeError */ public static function base64UrlSafeEncode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base64UrlSafe::encode($str); @@ -100,7 +98,7 @@ public static function base64UrlSafeEncode( * @throws TypeError */ public static function base64UrlSafeDecode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base64UrlSafe::decode($str, true); @@ -117,7 +115,7 @@ public static function base64UrlSafeDecode( * @throws TypeError */ public static function base32Encode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base32::encodeUpper($str); @@ -134,7 +132,7 @@ public static function base32Encode( * @throws TypeError */ public static function base32Decode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base32::decodeUpper($str, true); @@ -151,7 +149,7 @@ public static function base32Decode( * @throws TypeError */ public static function base32HexEncode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base32::encodeUpper($str); @@ -168,7 +166,7 @@ public static function base32HexEncode( * @throws TypeError */ public static function base32HexDecode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Base32::decodeUpper($str, true); @@ -185,7 +183,7 @@ public static function base32HexDecode( * @throws TypeError */ public static function base16Encode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Hex::encodeUpper($str); @@ -200,7 +198,7 @@ public static function base16Encode( * @return string */ public static function base16Decode( - #[SensitiveParameter] + #[\SensitiveParameter] string $str ): string { return Hex::decode($str, true); diff --git a/lib/Google/vendor/paragonie/random_compat/build-phar.sh b/lib/Google/vendor/paragonie/random_compat/build-phar.sh deleted file mode 100755 index b4a5ba31c..000000000 --- a/lib/Google/vendor/paragonie/random_compat/build-phar.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -basedir=$( dirname $( readlink -f ${BASH_SOURCE[0]} ) ) - -php -dphar.readonly=0 "$basedir/other/build_phar.php" $* \ No newline at end of file diff --git a/lib/Google/vendor/phpseclib/phpseclib/README.md b/lib/Google/vendor/phpseclib/phpseclib/README.md index c26edd49b..37cbcb9d5 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/README.md +++ b/lib/Google/vendor/phpseclib/phpseclib/README.md @@ -51,7 +51,7 @@ SSH-2, SFTP, X.509, an arbitrary-precision integer arithmetic library, Ed25519 / * PHP4 compatible * Composer compatible (PSR-0 autoloading) * Install using Composer: `composer require phpseclib/phpseclib:~1.0` -* [Download 1.0.24 as ZIP](http://sourceforge.net/projects/phpseclib/files/phpseclib1.0.24.zip/download) +* [Download 1.0.23 as ZIP](http://sourceforge.net/projects/phpseclib/files/phpseclib1.0.23.zip/download) ## Security contact information @@ -63,20 +63,14 @@ Need Support? * [Checkout Questions and Answers on Stack Overflow](http://stackoverflow.com/questions/tagged/phpseclib) * [Create a Support Ticket on GitHub](https://github.com/phpseclib/phpseclib/issues/new) +* [Browse the Support Forum](http://www.frostjedi.com/phpbb/viewforum.php?f=46) (no longer in use) ## Special Thanks -

- - Sovereign Tech Agency - -

- -## Additional Thanks +Special Thanks to our $50+ sponsors!: - Allan Simon - [ChargeOver](https://chargeover.com/) -- ## Contributing diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Common/Functions/Strings.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Common/Functions/Strings.php index ad8f63b65..fa750ba28 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Common/Functions/Strings.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Common/Functions/Strings.php @@ -126,9 +126,7 @@ public static function unpackSSH2($format, &$data) // 64-bit floats can be used to get larger numbers then 32-bit signed ints would allow // for. sure, you're not gonna get the full precision of 64-bit numbers but just because // you need > 32-bit precision doesn't mean you need the full 64-bit precision - $unpacked = unpack('Nupper/Nlower', self::shift($data, 8)); - $upper = $unpacked['upper']; - $lower = $unpacked['lower']; + extract(unpack('Nupper/Nlower', self::shift($data, 8))); $temp = $upper ? 4294967296 * $upper : 0; $temp += $lower < 0 ? ($lower & 0x7FFFFFFFF) + 0x80000000 : $lower; // $temp = hexdec(bin2hex(self::shift($data, 8))); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php index 998cf8bb3..3cb2b3055 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php @@ -129,7 +129,7 @@ class Blowfish extends BlockCipher /** * Block Length of the cipher * - * @see Common\SymmetricKey::block_size + * @see \phpseclib3\Crypt\Common\SymmetricKey::block_size * @var int */ protected $block_size = 8; @@ -137,7 +137,7 @@ class Blowfish extends BlockCipher /** * The mcrypt specific name of the cipher * - * @see Common\SymmetricKey::cipher_name_mcrypt + * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt * @var string */ protected $cipher_name_mcrypt = 'blowfish'; @@ -145,7 +145,7 @@ class Blowfish extends BlockCipher /** * Optimizing value while CFB-encrypting * - * @see Common\SymmetricKey::cfb_init_len + * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len * @var int */ protected $cfb_init_len = 500; @@ -325,7 +325,7 @@ class Blowfish extends BlockCipher * derive this from $key_length or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu * of that, we'll just precompute it once.} * - * @see Common\SymmetricKey::setKeyLength() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setKeyLength() * @var int */ protected $key_length = 16; @@ -368,7 +368,7 @@ public function setKeyLength($length) * * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * - * @see Common\SymmetricKey::isValidEngine() + * @see \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * @param int $engine * @return bool */ @@ -394,7 +394,7 @@ protected function isValidEngineHelper($engine) /** * Setup the key (expansion) * - * @see Common\SymmetricKey::_setupKey() + * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupKey() */ protected function setupKey() { @@ -755,7 +755,7 @@ protected function decryptBlock($in) /** * Setup the performance-optimized function for de/encrypt() * - * @see Common\SymmetricKey::_setupInlineCrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupInlineCrypt() */ protected function setupInlineCrypt() { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/JWK.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/JWK.php index 98b8dacc9..4c761b839 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/JWK.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/JWK.php @@ -50,14 +50,6 @@ public static function load($key, $password = '') return $key; } - if (!is_object($key)) { - throw new \RuntimeException('invalid JWK: not an object'); - } - - if (!isset($key->keys)) { - throw new \RuntimeException('invalid JWK: object has no property "keys"'); - } - if (count($key->keys) != 1) { throw new \RuntimeException('Although the JWK key format supports multiple keys phpseclib does not'); } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php index 2211a8747..6c9a65006 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php @@ -361,9 +361,7 @@ protected static function load($key, $password = '') if (!$temp) { throw new \RuntimeException('Unable to decode BER'); } - $map = ASN1::asn1map($temp[0], Maps\PBEParameter::MAP); - $salt = $map['salt']; - $iterationCount = $map['iterationCount']; + extract(ASN1::asn1map($temp[0], Maps\PBEParameter::MAP)); $iterationCount = (int) $iterationCount->toString(); $cipher->setPassword($password, $kdf, $hash, $salt, $iterationCount); $key = $cipher->decrypt($decrypted['encryptedData']); @@ -381,8 +379,7 @@ protected static function load($key, $password = '') throw new \RuntimeException('Unable to decode BER'); } $temp = ASN1::asn1map($temp[0], Maps\PBES2params::MAP); - $keyDerivationFunc = $temp['keyDerivationFunc']; - $encryptionScheme = $temp['encryptionScheme']; + extract($temp); $cipher = self::getPBES2EncryptionObject($encryptionScheme['algorithm']); $meta['meta']['cipher'] = $encryptionScheme['algorithm']; @@ -392,8 +389,7 @@ protected static function load($key, $password = '') throw new \RuntimeException('Unable to decode BER'); } $temp = ASN1::asn1map($temp[0], Maps\PBES2params::MAP); - $keyDerivationFunc = $temp['keyDerivationFunc']; - $encryptionScheme = $temp['encryptionScheme']; + extract($temp); if (!$cipher instanceof RC2) { $cipher->setIV($encryptionScheme['parameters']['octetString']); @@ -402,9 +398,7 @@ protected static function load($key, $password = '') if (!$temp) { throw new \RuntimeException('Unable to decode BER'); } - $map = ASN1::asn1map($temp[0], Maps\RC2CBCParameter::MAP); - $rc2ParametersVersion = $map['rc2ParametersVersion']; - $iv = $map['iv']; + extract(ASN1::asn1map($temp[0], Maps\RC2CBCParameter::MAP)); $effectiveKeyLength = (int) $rc2ParametersVersion->toString(); switch ($effectiveKeyLength) { case 160: @@ -429,13 +423,9 @@ protected static function load($key, $password = '') if (!$temp) { throw new \RuntimeException('Unable to decode BER'); } + $prf = ['algorithm' => 'id-hmacWithSHA1']; $params = ASN1::asn1map($temp[0], Maps\PBKDF2params::MAP); - if (empty($params['prf'])) { - $params['prf'] = ['algorithm' => 'id-hmacWithSHA1']; - } - $salt = $params['salt']; - $iterationCount = $params['iterationCount']; - $prf = $params['prf']; + extract($params); $meta['meta']['prf'] = $prf['algorithm']; $hash = str_replace('-', '/', substr($prf['algorithm'], 11)); $params = [ diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php index ff4a95a82..85da83a73 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php @@ -199,7 +199,7 @@ public static function load($key, $password) $source = Strings::packSSH2('ssss', $type, $encryption, $components['comment'], $public); - $length = unpack('Nlength', Strings::shift($public, 4))['length']; + extract(unpack('Nlength', Strings::shift($public, 4))); $newtype = Strings::shift($public, $length); if ($newtype != $type) { throw new \RuntimeException('The binary type does not match the human readable type field'); @@ -227,10 +227,7 @@ public static function load($key, $password) $parallelism = trim(preg_replace('#Argon2-Parallelism: (\d+)#', '$1', $key[$offset++])); $salt = Strings::hex2bin(trim(preg_replace('#Argon2-Salt: ([0-9a-f]+)#', '$1', $key[$offset++]))); - $v3key = self::generateV3Key($password, $flavour, $memory, $passes, $salt); - $symkey = $v3key['symkey']; - $symiv = $v3key['symiv']; - $hashkey = $v3key['hashkey']; + extract(self::generateV3Key($password, $flavour, $memory, $passes, $salt)); break; case 2: @@ -326,10 +323,7 @@ protected static function wrapPrivateKey($public, $private, $type, $password, ar $key .= "Argon2-Passes: 13\r\n"; $key .= "Argon2-Parallelism: 1\r\n"; $key .= "Argon2-Salt: " . Strings::bin2hex($salt) . "\r\n"; - $v3key = self::generateV3Key($password, 'Argon2id', 8192, 13, $salt); - $symkey = $v3key['symkey']; - $symiv = $v3key['symiv']; - $hashkey = $v3key['hashkey']; + extract(self::generateV3Key($password, 'Argon2id', 8192, 13, $salt)); $hash = new Hash('sha256'); $hash->setKey($hashkey); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/StreamCipher.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/StreamCipher.php index c7c080f4e..0d9690822 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/StreamCipher.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/StreamCipher.php @@ -26,7 +26,7 @@ abstract class StreamCipher extends SymmetricKey * * Stream ciphers do not have a block size * - * @see SymmetricKey::block_size + * @see \phpseclib3\Crypt\Common\SymmetricKey::block_size * @var int */ protected $block_size = 0; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php index 93d7ad2ed..3b0383000 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php @@ -68,7 +68,7 @@ class DES extends BlockCipher /** * Block Length of the cipher * - * @see Common\SymmetricKey::block_size + * @see \phpseclib3\Crypt\Common\SymmetricKey::block_size * @var int */ protected $block_size = 8; @@ -76,7 +76,7 @@ class DES extends BlockCipher /** * Key Length (in bytes) * - * @see Common\SymmetricKey::setKeyLength() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setKeyLength() * @var int */ protected $key_length = 8; @@ -84,7 +84,7 @@ class DES extends BlockCipher /** * The mcrypt specific name of the cipher * - * @see Common\SymmetricKey::cipher_name_mcrypt + * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt * @var string */ protected $cipher_name_mcrypt = 'des'; @@ -92,7 +92,7 @@ class DES extends BlockCipher /** * The OpenSSL names of the cipher / modes * - * @see Common\SymmetricKey::openssl_mode_names + * @see \phpseclib3\Crypt\Common\SymmetricKey::openssl_mode_names * @var array */ protected $openssl_mode_names = [ @@ -106,7 +106,7 @@ class DES extends BlockCipher /** * Optimizing value while CFB-encrypting * - * @see Common\SymmetricKey::cfb_init_len + * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len * @var int */ protected $cfb_init_len = 500; @@ -586,7 +586,7 @@ public function __construct($mode) * * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * - * @see Common\SymmetricKey::isValidEngine() + * @see \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * @param int $engine * @return bool */ @@ -615,7 +615,7 @@ protected function isValidEngineHelper($engine) * * DES also requires that every eighth bit be a parity bit, however, we'll ignore that. * - * @see Common\SymmetricKey::setKey() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setKey() * @param string $key */ public function setKey($key) @@ -631,8 +631,8 @@ public function setKey($key) /** * Encrypts a block * - * @see Common\SymmetricKey::encryptBlock() - * @see Common\SymmetricKey::encrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::encryptBlock() + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see self::encrypt() * @param string $in * @return string @@ -645,8 +645,8 @@ protected function encryptBlock($in) /** * Decrypts a block * - * @see Common\SymmetricKey::decryptBlock() - * @see Common\SymmetricKey::decrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decryptBlock() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() * @see self::decrypt() * @param string $in * @return string @@ -747,7 +747,7 @@ private function processBlock($block, $mode) /** * Creates the key schedule * - * @see Common\SymmetricKey::setupKey() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setupKey() */ protected function setupKey() { @@ -1281,7 +1281,7 @@ protected function setupKey() /** * Setup the performance-optimized function for de/encrypt() * - * @see Common\SymmetricKey::setupInlineCrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setupInlineCrypt() */ protected function setupInlineCrypt() { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PuTTY.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PuTTY.php index 8549a2ec7..f6177f462 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PuTTY.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PuTTY.php @@ -56,10 +56,7 @@ public static function load($key, $password = '') if (!isset($components['private'])) { return $components; } - $type = $components['type']; - $comment = $components['comment']; - $public = $components['public']; - $private = $components['private']; + extract($components); unset($components['public'], $components['private']); list($p, $q, $g, $y) = Strings::unpackSSH2('iiii', $public); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php index 90252139d..87cd77a7a 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php @@ -88,9 +88,7 @@ public function sign($message) return $signature; } - $loaded = ASN1Signature::load($signature); - $r = $loaded['r']; - $s = $loaded['s']; + extract(ASN1Signature::load($signature)); return $format::save($r, $s); } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php index 3e16762b8..c14ffbdf5 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php @@ -40,8 +40,7 @@ public function verify($message, $signature) if ($params === false || count($params) != 2) { return false; } - $r = $params['r']; - $s = $params['s']; + extract($params); if (self::$engines['OpenSSL'] && in_array($this->hash->getHash(), openssl_get_md_methods())) { $sig = $format != 'ASN1' ? ASN1Signature::save($r, $s) : $signature; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Montgomery.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Montgomery.php index 431f9575c..b792e161d 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Montgomery.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Montgomery.php @@ -246,7 +246,7 @@ public function multiplyPoint(array $p, BigInteger $d) * * x=X/Z * - * @return PrimeInteger[] + * @return \phpseclib3\Math\PrimeField\Integer[] */ public function convertToInternal(array $p) { @@ -266,7 +266,7 @@ public function convertToInternal(array $p) /** * Returns the affine point * - * @return PrimeInteger[] + * @return \phpseclib3\Math\PrimeField\Integer[] */ public function convertToAffine(array $p) { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Prime.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Prime.php index b1970557f..620040170 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Prime.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Prime.php @@ -751,7 +751,7 @@ private static function getJSFPoints(Integer $k1, Integer $k2) * To convert a Jacobian Coordinate to an Affine Point * you do (x / z^2, y / z^3) * - * @return PrimeInteger[] + * @return \phpseclib3\Math\PrimeField\Integer[] */ public function convertToAffine(array $p) { @@ -770,7 +770,7 @@ public function convertToAffine(array $p) /** * Converts an affine point to a jacobian coordinate * - * @return PrimeInteger[] + * @return \phpseclib3\Math\PrimeField\Integer[] */ public function convertToInternal(array $p) { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/TwistedEdwards.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/TwistedEdwards.php index 99aa38b20..004406acf 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/TwistedEdwards.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/TwistedEdwards.php @@ -171,7 +171,7 @@ public function getBasePoint() /** * Returns the affine point * - * @return PrimeInteger[] + * @return PrimeField\Integer[] */ public function convertToAffine(array $p) { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/XML.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/XML.php index 7f6cf6345..b0cb12650 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/XML.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/XML.php @@ -71,10 +71,6 @@ public static function load($key, $password = '') $use_errors = libxml_use_internal_errors(true); - if (substr($key, 0, 5) != '' . $key . ''; - } - $temp = self::isolateNamespace($key, 'http://www.w3.org/2009/xmldsig11#'); if ($temp) { $key = $temp; @@ -86,6 +82,9 @@ public static function load($key, $password = '') } $dom = new \DOMDocument(); + if (substr($key, 0, 5) != '' . $key . ''; + } if (!$dom->loadXML($key)) { libxml_use_internal_errors($use_errors); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php index 9947bb7d5..91253b8fd 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php @@ -157,10 +157,7 @@ public function sign($message) return $signature; } - $loaded = ASN1Signature::load($signature); - $r = $loaded['r']; - $s = $loaded['s']; - + extract(ASN1Signature::load($signature)); return $this->formatSignature($r, $s); } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php index d34c6c4dd..4558ce34d 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php @@ -115,8 +115,7 @@ public function verify($message, $signature) if ($params === false || count($params) != 2) { return false; } - $r = $params['r']; - $s = $params['s']; + extract($params); if (self::$engines['OpenSSL'] && in_array($this->hash->getHash(), openssl_get_md_methods())) { $sig = $format != 'ASN1' ? ASN1Signature::save($r, $s) : $signature; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Hash.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Hash.php index cc5b42c08..09e48f960 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Hash.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Hash.php @@ -194,15 +194,6 @@ class Hash private static $maxwordrange128; /**#@-*/ - /**#@+ - * AES_CMAC variables - * - * @var string - */ - private $k1; - private $k2; - /**#@-*/ - /** * Default Constructor. * @@ -308,14 +299,6 @@ public function setHash($hash) $this->length = abs(substr($hash, -3)) >> 3; $this->algo = 'umac'; return; - case 'aes_cmac': - if ($oldHash != $this->hashParam) { - $this->recomputeAESKey = true; - } - $this->blockSize = 128; - $this->length = 16; - $this->algo = 'aes_cmac'; - return; case 'md2-96': case 'md5-96': case 'sha1-96': @@ -994,69 +977,6 @@ private static function L3Hash($k1, $k2, $m) public function hash($text) { $algo = $this->algo; - // https://www.rfc-editor.org/rfc/rfc4493.html - // https://en.wikipedia.org/wiki/One-key_MAC - if ($algo == 'aes_cmac') { - $constZero = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; - if ($this->recomputeAESKey) { - if (!is_string($this->key)) { - throw new InsufficientSetupException('No key has been set'); - } - if (strlen($this->key) != 16) { - throw new \LengthException('Key must be 16 bytes long'); - } - // Algorithm Generate_Subkey - $constRb = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x87"; - $this->c = new AES('ecb'); - $this->c->setKey($this->key); - $this->c->disablePadding(); - $l = $this->c->encrypt($constZero); - $msb = ($l & "\x80") == "\x80"; - $l = new BigInteger($l, 256); - $l->setPrecision(128); - $l = $l->bitwise_leftShift(1)->toBytes(); - // make it constant time - $k1 = $msb ? $l ^ $constRb : $l | $constZero; - - $msb = ($k1 & "\x80") == "\x80"; - $k2 = new BigInteger($k1, 256); - $k2->setPrecision(128); - $k2 = $k2->bitwise_leftShift(1)->toBytes(); - // make it constant time - $k2 = $msb ? $k2 ^ $constRb : $k2 | $constZero; - - $this->k1 = $k1; - $this->k2 = $k2; - } - - $len = strlen($text); - $const_Bsize = 16; - $M = strlen($text) ? str_split($text, $const_Bsize) : ['']; - - // Step 2 - $n = ceil($len / $const_Bsize); - // Step 3 - if ($n == 0) { - $n = 1; - $flag = false; - } else { - $flag = $len % $const_Bsize == 0; - } - // Step 4 - $M_last = $flag ? - $M[$n - 1] ^ $k1 : - self::OMAC_padding($M[$n - 1], $const_Bsize) ^ $k2; - // Step 5 - $x = $constZero; - // Step 6 - $c = &$this->c; - for ($i = 0; $i < $n - 1; $i++) { - $y = $x ^ $M[$i]; - $x = $c->encrypt($y); - } - $y = $M_last ^ $x; - return $c->encrypt($y); - } if ($algo == 'umac') { if ($this->recomputeAESKey) { if (!is_string($this->nonce)) { @@ -1870,17 +1790,6 @@ private static function sha512_64($m, $hash) return pack('J*', ...$hash); } - /** - * OMAC Padding - * - * @link https://www.rfc-editor.org/rfc/rfc4493.html#section-2.4 - */ - private static function OMAC_padding($m, $length) - { - $count = $length - strlen($m) - 1; - return "$m\x80" . str_repeat("\0", $count); - } - /** * __toString() magic method */ diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php index 36264080c..61afbaeb6 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php @@ -32,7 +32,6 @@ abstract class PublicKeyLoader * @return AsymmetricKey * @param string|array $key * @param string $password optional - * @throws NoKeyLoadedException if key is not valid */ public static function load($key, $password = false) { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php index 175c52e7b..654c90642 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php @@ -45,7 +45,7 @@ class RC2 extends BlockCipher /** * Block Length of the cipher * - * @see Common\SymmetricKey::block_size + * @see \phpseclib3\Crypt\Common\SymmetricKey::block_size * @var int */ protected $block_size = 8; @@ -53,7 +53,7 @@ class RC2 extends BlockCipher /** * The Key * - * @see Common\SymmetricKey::key + * @see \phpseclib3\Crypt\Common\SymmetricKey::key * @see self::setKey() * @var string */ @@ -62,7 +62,7 @@ class RC2 extends BlockCipher /** * The Original (unpadded) Key * - * @see Common\SymmetricKey::key + * @see \phpseclib3\Crypt\Common\SymmetricKey::key * @see self::setKey() * @see self::encrypt() * @see self::decrypt() @@ -81,7 +81,7 @@ class RC2 extends BlockCipher /** * The mcrypt specific name of the cipher * - * @see Common\SymmetricKey::cipher_name_mcrypt + * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt * @var string */ protected $cipher_name_mcrypt = 'rc2'; @@ -89,7 +89,7 @@ class RC2 extends BlockCipher /** * Optimizing value while CFB-encrypting * - * @see Common\SymmetricKey::cfb_init_len + * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len * @var int */ protected $cfb_init_len = 500; @@ -261,7 +261,7 @@ public function __construct($mode) * * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * - * @see Common\SymmetricKey::__construct() + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() * @param int $engine * @return bool */ @@ -323,7 +323,7 @@ public function getKeyLength() * has more then 128 bytes in it, and set $key to a single null byte if * it is empty. * - * @see Common\SymmetricKey::setKey() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setKey() * @param string $key * @param int|boolean $t1 optional Effective key length in bits. * @throws \LengthException if the key length isn't supported @@ -426,8 +426,8 @@ public function decrypt($ciphertext) /** * Encrypts a block * - * @see Common\SymmetricKey::encryptBlock() - * @see Common\SymmetricKey::encrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::encryptBlock() + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @param string $in * @return string */ @@ -470,8 +470,8 @@ protected function encryptBlock($in) /** * Decrypts a block * - * @see Common\SymmetricKey::decryptBlock() - * @see Common\SymmetricKey::decrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decryptBlock() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() * @param string $in * @return string */ @@ -514,7 +514,7 @@ protected function decryptBlock($in) /** * Creates the key schedule * - * @see Common\SymmetricKey::setupKey() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setupKey() */ protected function setupKey() { @@ -534,7 +534,7 @@ protected function setupKey() /** * Setup the performance-optimized function for de/encrypt() * - * @see Common\SymmetricKey::setupInlineCrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setupInlineCrypt() */ protected function setupInlineCrypt() { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC4.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC4.php index 98cf01165..5f3bff2c0 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC4.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC4.php @@ -72,7 +72,7 @@ class RC4 extends StreamCipher /** * The mcrypt specific name of the cipher * - * @see Common\SymmetricKey::cipher_name_mcrypt + * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt * @var string */ protected $cipher_name_mcrypt = 'arcfour'; @@ -98,7 +98,7 @@ class RC4 extends StreamCipher * * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * - * @see Common\SymmetricKey::__construct() + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() * @param int $engine * @return bool */ @@ -159,7 +159,7 @@ public function setKey($key) /** * Encrypts a message. * - * @see Common\SymmetricKey::decrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() * @see self::crypt() * @param string $plaintext * @return string $ciphertext @@ -178,7 +178,7 @@ public function encrypt($plaintext) * $this->decrypt($this->encrypt($plaintext)) == $this->encrypt($this->encrypt($plaintext)). * At least if the continuous buffer is disabled. * - * @see Common\SymmetricKey::encrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see self::crypt() * @param string $ciphertext * @return string $plaintext @@ -214,7 +214,7 @@ protected function decryptBlock($in) /** * Setup the key (expansion) * - * @see Common\SymmetricKey::_setupKey() + * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupKey() */ protected function setupKey() { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php index 0a11957b0..9cbe6bfc7 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php @@ -357,9 +357,10 @@ public static function createKey($bits = 2048) if ($i != $num_primes) { $primes[$i] = BigInteger::randomPrime($regSize); } else { - $minMax = BigInteger::minMaxBits($bits); - $min = $minMax['min']; - $max = $minMax['max']; + extract(BigInteger::minMaxBits($bits)); + /** @var BigInteger $min + * @var BigInteger $max + */ list($min) = $min->divide($n); $min = $min->add(self::$one); list($max) = $max->divide($n); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php index 035fc8c38..b60e48ea5 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php @@ -88,11 +88,13 @@ public static function load($key, $password = '') // PUBLICKEYSTRUC publickeystruc // https://msdn.microsoft.com/en-us/library/windows/desktop/aa387453(v=vs.85).aspx - $unpacked = unpack('atype/aversion/vreserved/Valgo', Strings::shift($key, 8)); - $type = $unpacked['type']; - $version = $unpacked['version']; - $reserved = $unpacked['reserved']; - $algo = $unpacked['algo']; + extract(unpack('atype/aversion/vreserved/Valgo', Strings::shift($key, 8))); + /** + * @var string $type + * @var string $version + * @var integer $reserved + * @var integer $algo + */ switch (ord($type)) { case self::PUBLICKEYBLOB: case self::PUBLICKEYBLOBEX: @@ -119,10 +121,12 @@ public static function load($key, $password = '') // RSAPUBKEY rsapubkey // https://msdn.microsoft.com/en-us/library/windows/desktop/aa387685(v=vs.85).aspx // could do V for pubexp but that's unsigned 32-bit whereas some PHP installs only do signed 32-bit - $unpacked = unpack('Vmagic/Vbitlen/a4pubexp', Strings::shift($key, 12)); - $magic = $unpacked['magic']; - $bitlen = $unpacked['bitlen']; - $pubexp = $unpacked['pubexp']; + extract(unpack('Vmagic/Vbitlen/a4pubexp', Strings::shift($key, 12))); + /** + * @var integer $magic + * @var integer $bitlen + * @var string $pubexp + */ switch ($magic) { case self::RSA2: $components['isPublicKey'] = false; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS1.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS1.php index 68d92701e..76335567f 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS1.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS1.php @@ -96,20 +96,6 @@ public static function load($key, $password = '') $components['isPublicKey'] = true; } - $components = $components + $key; - foreach ($components as &$val) { - if ($val instanceof BigInteger) { - $val = self::makePositive($val); - } - if (is_array($val)) { - foreach ($val as &$subval) { - if ($subval instanceof BigInteger) { - $subval = self::makePositive($subval); - } - } - } - } - return $components + $key; } @@ -171,17 +157,4 @@ public static function savePublicKey(BigInteger $n, BigInteger $e) return self::wrapPublicKey($key, 'RSA'); } - - /** - * Negative numbers make no sense in RSA so convert them to positive - * - * @param BigInteger $x - * @return string - */ - private static function makePositive(BigInteger $x) - { - return $x->isNegative() ? - new BigInteger($x->toBytes(true), 256) : - $x; - } } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php index 8416758c2..293903cef 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php @@ -56,10 +56,7 @@ public static function load($key, $password = '') if (!isset($components['private'])) { return $components; } - $type = $components['type']; - $comment = $components['comment']; - $public = $components['public']; - $private = $components['private']; + extract($components); unset($components['public'], $components['private']); $isPublicKey = false; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php index 5ba7cf7fe..ff31f9c88 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php @@ -74,8 +74,8 @@ class Rijndael extends BlockCipher * or not for the current $block_size/$key_length. * In case of, $cipher_name_mcrypt will be set dynamically at run time accordingly. * - * @see Common\SymmetricKey::cipher_name_mcrypt - * @see Common\SymmetricKey::engine + * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt + * @see \phpseclib3\Crypt\Common\SymmetricKey::engine * @see self::isValidEngine() * @var string */ diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php index 932b7c611..1ff5ed02b 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php @@ -66,8 +66,8 @@ class TripleDES extends DES /** * The mcrypt specific name of the cipher * - * @see DES::cipher_name_mcrypt - * @see Common\SymmetricKey::cipher_name_mcrypt + * @see \phpseclib3\Crypt\DES::cipher_name_mcrypt + * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt * @var string */ protected $cipher_name_mcrypt = 'tripledes'; @@ -75,7 +75,7 @@ class TripleDES extends DES /** * Optimizing value while CFB-encrypting * - * @see Common\SymmetricKey::cfb_init_len + * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len * @var int */ protected $cfb_init_len = 750; @@ -84,7 +84,7 @@ class TripleDES extends DES * max possible size of $key * * @see self::setKey() - * @see DES::setKey() + * @see \phpseclib3\Crypt\DES::setKey() * @var string */ protected $key_length_max = 24; @@ -126,8 +126,8 @@ class TripleDES extends DES * * - cbc3 (same as cbc) * - * @see Crypt\DES::__construct() - * @see Common\SymmetricKey::__construct() + * @see \phpseclib3\Crypt\DES::__construct() + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() * @param string $mode */ public function __construct($mode) @@ -169,7 +169,7 @@ public function __construct($mode) * * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * - * @see Common\SymmetricKey::__construct() + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() * @param int $engine * @return bool */ @@ -189,7 +189,7 @@ protected function isValidEngineHelper($engine) * * SetIV is not required when \phpseclib3\Crypt\Common\SymmetricKey::MODE_ECB is being used. * - * @see Common\SymmetricKey::setIV() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setIV() * @param string $iv */ public function setIV($iv) @@ -209,7 +209,7 @@ public function setIV($iv) * * If you want to use a 64-bit key use DES.php * - * @see Common\SymmetricKey:setKeyLength() + * @see \phpseclib3\Crypt\Common\SymmetricKey:setKeyLength() * @throws \LengthException if the key length is invalid * @param int $length */ @@ -233,8 +233,8 @@ public function setKeyLength($length) * * DES also requires that every eighth bit be a parity bit, however, we'll ignore that. * - * @see DES::setKey() - * @see Common\SymmetricKey::setKey() + * @see \phpseclib3\Crypt\DES::setKey() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setKey() * @throws \LengthException if the key length is invalid * @param string $key */ @@ -270,7 +270,7 @@ public function setKey($key) /** * Encrypts a message. * - * @see Common\SymmetricKey::encrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @param string $plaintext * @return string $cipertext */ @@ -296,7 +296,7 @@ public function encrypt($plaintext) /** * Decrypts a message. * - * @see Common\SymmetricKey::decrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() * @param string $ciphertext * @return string $plaintext */ @@ -351,7 +351,7 @@ public function decrypt($ciphertext) * continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them), * however, they are also less intuitive and more likely to cause you problems. * - * @see Common\SymmetricKey::enableContinuousBuffer() + * @see \phpseclib3\Crypt\Common\SymmetricKey::enableContinuousBuffer() * @see self::disableContinuousBuffer() */ public function enableContinuousBuffer() @@ -369,7 +369,7 @@ public function enableContinuousBuffer() * * The default behavior. * - * @see Common\SymmetricKey::disableContinuousBuffer() + * @see \phpseclib3\Crypt\Common\SymmetricKey::disableContinuousBuffer() * @see self::enableContinuousBuffer() */ public function disableContinuousBuffer() @@ -385,8 +385,8 @@ public function disableContinuousBuffer() /** * Creates the key schedule * - * @see DES::setupKey() - * @see Common\SymmetricKey::setupKey() + * @see \phpseclib3\Crypt\DES::setupKey() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setupKey() */ protected function setupKey() { @@ -419,8 +419,8 @@ protected function setupKey() /** * Sets the internal crypt engine * - * @see Common\SymmetricKey::__construct() - * @see Common\SymmetricKey::setPreferredEngine() + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setPreferredEngine() * @param int $engine */ public function setPreferredEngine($engine) diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php index 141ad0141..bf765632a 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php @@ -49,7 +49,7 @@ class Twofish extends BlockCipher /** * The mcrypt specific name of the cipher * - * @see Common\SymmetricKey::cipher_name_mcrypt + * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt * @var string */ protected $cipher_name_mcrypt = 'twofish'; @@ -57,7 +57,7 @@ class Twofish extends BlockCipher /** * Optimizing value while CFB-encrypting * - * @see Common\SymmetricKey::cfb_init_len + * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len * @var int */ protected $cfb_init_len = 800; @@ -431,7 +431,7 @@ public function setKey($key) /** * Setup the key (expansion) * - * @see Common\SymmetricKey::_setupKey() + * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupKey() */ protected function setupKey() { @@ -700,7 +700,7 @@ protected function decryptBlock($in) /** * Setup the performance-optimized function for de/encrypt() * - * @see Common\SymmetricKey::_setupInlineCrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupInlineCrypt() */ protected function setupInlineCrypt() { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php index 685a7cde0..c4b06a560 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php @@ -273,7 +273,8 @@ private static function decode_ber($encoded, $start = 0, $encoded_pos = 0) // tags of indefinte length don't really have a header length; this length includes the tag $current += ['headerlength' => $length + 2]; $start += $length; - $length = unpack('Nlength', substr(str_pad($temp, 4, chr(0), STR_PAD_LEFT), -4))['length']; + extract(unpack('Nlength', substr(str_pad($temp, 4, chr(0), STR_PAD_LEFT), -4))); + /** @var integer $length */ } else { $current += ['headerlength' => 2]; } @@ -792,11 +793,7 @@ public static function asn1map(array $decoded, $mapping, $special = []) $temp = new BigInteger($decoded['content'], -256); } if (isset($mapping['mapping'])) { - $temp = $temp->toString(); - if (strlen($temp) > 1) { - return false; - } - $temp = (int) $temp; + $temp = (int) $temp->toString(); return isset($mapping['mapping'][$temp]) ? $mapping['mapping'][$temp] : false; @@ -934,19 +931,7 @@ private static function encode_der($source, array $mapping, $idx = null, array $ an untagged "DummyReference" (see ITU-T Rec. X.683 | ISO/IEC 8824-4, 8.3)." */ if (isset($child['explicit']) || $child['type'] == self::TYPE_CHOICE) { - if ($child['constant'] <= 30) { - $subtag = chr((self::CLASS_CONTEXT_SPECIFIC << 6) | 0x20 | $child['constant']); - } else { - $constant = $child['constant']; - $subtag = ''; - while ($constant > 0) { - $subtagvalue = $constant & 0x7F; - $subtag = (chr(0x80 | $subtagvalue)) . $subtag; - $constant = $constant >> 7; - } - $subtag[strlen($subtag) - 1] = $subtag[strlen($subtag) - 1] & chr(0x7F); - $subtag = chr((self::CLASS_CONTEXT_SPECIFIC << 6) | 0x20 | 0x1f) . $subtag; - } + $subtag = chr((self::CLASS_CONTEXT_SPECIFIC << 6) | 0x20 | $child['constant']); $temp = $subtag . self::encodeLength(strlen($temp)) . $temp; } else { $subtag = chr((self::CLASS_CONTEXT_SPECIFIC << 6) | (ord($temp[0]) & 0x20) | $child['constant']); @@ -1155,8 +1140,6 @@ private static function encode_der($source, array $mapping, $idx = null, array $ */ public static function decodeOID($content) { - // BigInteger's are used because of OIDs like 2.25.329800735698586629295641978511506172918 - // https://healthcaresecprivacy.blogspot.com/2011/02/creating-and-using-unique-id-uuid-oid.html elaborates. static $eighty; if (!$eighty) { $eighty = new BigInteger(80); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/X509.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/X509.php index 80e0bab10..00504f15d 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/X509.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/File/X509.php @@ -626,9 +626,7 @@ private function mapOutExtensions(array &$root, $path) $extensions = &$this->subArray($root, $path, !empty($this->extensionValues)); foreach ($this->extensionValues as $id => $data) { - $critical = $data['critical']; - $replace = $data['replace']; - $value = $data['value']; + extract($data); $newext = [ 'extnId' => $id, 'extnValue' => $value, @@ -1860,7 +1858,7 @@ public function getDN($format = self::DN_ARRAY, $dn = null) $dn = $this->getDN(self::DN_CANON, $dn); $hash = new Hash('sha1'); $hash = $hash->hash($dn); - $hash = unpack('Vhash', $hash)['hash']; + extract(unpack('Vhash', $hash)); return strtolower(Strings::bin2hex(pack('N', $hash))); } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php index a1ea0aebd..2a9cc0b43 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php @@ -143,11 +143,6 @@ private static function initialize_static_variables() ['PHP64', ['DefaultEngine']], ['PHP32', ['DefaultEngine']] ]; - // per https://phpseclib.com/docs/speed PHP 8.4.0+ _significantly_ sped up BCMath - if (version_compare(PHP_VERSION, '8.4.0') >= 0) { - $engines[1][0] = 'BCMath'; - $engines[2][0] = 'PHP64'; - } foreach ($engines as $engine) { try { @@ -338,10 +333,12 @@ public function modInverse(BigInteger $n) */ public function extendedGCD(BigInteger $n) { - $extended = $this->value->extendedGCD($n->value); - $gcd = $extended['gcd']; - $x = $extended['x']; - $y = $extended['y']; + extract($this->value->extendedGCD($n->value)); + /** + * @var BigInteger $gcd + * @var BigInteger $x + * @var BigInteger $y + */ return [ 'gcd' => new static($gcd), 'x' => new static($x), @@ -402,7 +399,7 @@ public function getPrecision() * * Will be called, automatically, when serialize() is called on a BigInteger object. * - * __sleep() / __wakeup() have been around since PHP 4.0 but were deprecated in PHP 8.5 + * __sleep() / __wakeup() have been around since PHP 4.0 * * \Serializable was introduced in PHP 5.1 and deprecated in PHP 8.1: * https://wiki.php.net/rfc/phase_out_serializable @@ -437,38 +434,6 @@ public function __wakeup() } } - /** - * __serialize() magic method - * - * @see self::__unserialize() - * @return array - * @access public - */ - public function __serialize() - { - $result = ['hex' => $this->toHex(true)]; - if ($this->getPrecision() > 0) { - $result['precision'] = $this->getPrecision(); - } - return $result; - } - - /** - * __unserialize() magic method - * - * @see self::__serialize() - * @access public - */ - public function __unserialize(array $data) - { - $temp = new static($data['hex'], -16); - $this->value = $temp->value; - if (isset($data['precision']) && $data['precision'] > 0) { - // recalculate $this->bitmask - $this->setPrecision($data['precision']); - } - } - /** * JSON Serialize * @@ -652,9 +617,10 @@ public static function minMaxBits($bits) self::initialize_static_variables(); $class = self::$mainEngine; - $minMax = $class::minMaxBits($bits); - $min = $minMax['min']; - $max = $minMax['max']; + extract($class::minMaxBits($bits)); + /** @var BigInteger $min + * @var BigInteger $max + */ return [ 'min' => new static($min), 'max' => new static($max) diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath.php index 7b6283002..e3a49906b 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath.php @@ -38,11 +38,6 @@ class BCMath extends Engine */ const ENGINE_DIR = 'BCMath'; - /** - * Test to see if bcmod() accepts 2 or 3 parameters - */ - const BCMOD_THREE_PARAMS = PHP_VERSION_ID >= 72000; - /** * Test for engine validity * @@ -153,7 +148,7 @@ public function toBytes($twos_compliment = false) } while (bccomp($current, '0', 0) > 0) { - $temp = self::BCMOD_THREE_PARAMS ? bcmod($current, '16777216', 0) : bcmod($current, '16777216'); + $temp = bcmod($current, '16777216'); $value = chr($temp >> 16) . chr($temp >> 8) . chr($temp) . $value; $current = bcdiv($current, '16777216', 0); } @@ -172,7 +167,7 @@ public function toBytes($twos_compliment = false) public function add(BCMath $y) { $temp = new self(); - $temp->value = bcadd($this->value, $y->value, 0); + $temp->value = bcadd($this->value, $y->value); return $this->normalize($temp); } @@ -186,7 +181,7 @@ public function add(BCMath $y) public function subtract(BCMath $y) { $temp = new self(); - $temp->value = bcsub($this->value, $y->value, 0); + $temp->value = bcsub($this->value, $y->value); return $this->normalize($temp); } @@ -200,7 +195,7 @@ public function subtract(BCMath $y) public function multiply(BCMath $x) { $temp = new self(); - $temp->value = bcmul($this->value, $x->value, 0); + $temp->value = bcmul($this->value, $x->value); return $this->normalize($temp); } @@ -222,7 +217,7 @@ public function divide(BCMath $y) $remainder = new self(); $quotient->value = bcdiv($this->value, $y->value, 0); - $remainder->value = self::BCMOD_THREE_PARAMS ? bcmod($this->value, $y->value, 0) : bcmod($this->value, $y->value); + $remainder->value = bcmod($this->value, $y->value); if ($remainder->value[0] == '-') { $remainder->value = bcadd($remainder->value, $y->value[0] == '-' ? substr($y->value, 1) : $y->value, 0); @@ -302,7 +297,8 @@ public function extendedGCD(BCMath $n) */ public function gcd(BCMath $n) { - $gcd = $this->extendedGCD($n)['gcd']; + extract($this->extendedGCD($n)); + /** @var BCMath $gcd */ return $gcd; } @@ -479,7 +475,7 @@ protected function normalize(BCMath $result) $result->bitmask = $this->bitmask; if ($result->bitmask !== false) { - $result->value = self::BCMOD_THREE_PARAMS ? bcmod($result->value, $result->bitmask->value, 0) : bcmod($result->value, $result->bitmask->value); + $result->value = bcmod($result->value, $result->bitmask->value); } return $result; @@ -527,7 +523,7 @@ public static function randomRange(BCMath $min, BCMath $max) protected function make_odd() { if (!$this->isOdd()) { - $this->value = bcadd($this->value, '1', 0); + $this->value = bcadd($this->value, '1'); } } @@ -551,7 +547,7 @@ protected function testSmallPrimes() $value = $this->value; foreach (self::PRIMES as $prime) { - $r = self::BCMOD_THREE_PARAMS ? bcmod($this->value, $prime, 0) : bcmod($this->value, $prime); + $r = bcmod($this->value, $prime); if ($r == '0') { return $this->value == $prime; } @@ -591,7 +587,7 @@ public static function scan1divide(BCMath $r) public function pow(BCMath $n) { $temp = new self(); - $temp->value = bcpow($this->value, $n->value, 0); + $temp->value = bcpow($this->value, $n->value); return $this->normalize($temp); } @@ -660,9 +656,8 @@ public function isOdd() */ public function testBit($x) { - $divisor = bcpow('2', $x + 1, 0); return bccomp( - self::BCMOD_THREE_PARAMS ? bcmod($this->value, $divisor, 0) : bcmod($this->value, $divisor), + bcmod($this->value, bcpow('2', $x + 1, 0)), bcpow('2', $x, 0), 0 ) >= 0; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Base.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Base.php index 88cd93e94..fe21e0411 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Base.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Base.php @@ -91,7 +91,7 @@ protected static function prepareReduce($x, $n, $class) */ protected static function multiplyReduce($x, $y, $n, $class) { - return static::reduce(bcmul($x, $y, 0), $n); + return static::reduce(bcmul($x, $y), $n); } /** @@ -105,6 +105,6 @@ protected static function multiplyReduce($x, $y, $n, $class) */ protected static function squareReduce($x, $n, $class) { - return static::reduce(bcmul($x, $x, 0), $n); + return static::reduce(bcmul($x, $x), $n); } } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php index f8bbcfa27..b7ca8a2c6 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php @@ -33,7 +33,7 @@ abstract class BuiltIn extends BCMath protected static function powModHelper(BCMath $x, BCMath $e, BCMath $n) { $temp = new BCMath(); - $temp->value = bcpowmod($x->value, $e->value, $n->value, 0); + $temp->value = bcpowmod($x->value, $e->value, $n->value); return $x->normalize($temp); } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php index 1bec0a11f..9e01bf005 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php @@ -67,7 +67,7 @@ protected static function reduce($n, $m) $m_length = strlen($m); if (strlen($n) > 2 * $m_length) { - return self::BCMOD_THREE_PARAMS ? bcmod($n, $m, 0) : bcmod($n, $m); + return bcmod($n, $m); } // if (m.length >> 1) + 2 <= m.length then m is too small and n can't be reduced @@ -89,16 +89,14 @@ protected static function reduce($n, $m) $lhs = '1' . str_repeat('0', $m_length + ($m_length >> 1)); $u = bcdiv($lhs, $m, 0); - $m1 = bcsub($lhs, bcmul($u, $m, 0), 0); + $m1 = bcsub($lhs, bcmul($u, $m)); $cache[self::DATA][] = [ 'u' => $u, // m.length >> 1 (technically (m.length >> 1) + 1) 'm1' => $m1 // m.length ]; } else { - $cacheValues = $cache[self::DATA][$key]; - $u = $cacheValues['u']; - $m1 = $cacheValues['m1']; + extract($cache[self::DATA][$key]); } $cutoff = $m_length + ($m_length >> 1); @@ -106,8 +104,8 @@ protected static function reduce($n, $m) $lsd = substr($n, -$cutoff); $msd = substr($n, 0, -$cutoff); - $temp = bcmul($msd, $m1, 0); // m.length + (m.length >> 1) - $n = bcadd($lsd, $temp, 0); // m.length + (m.length >> 1) + 1 (so basically we're adding two same length numbers) + $temp = bcmul($msd, $m1); // m.length + (m.length >> 1) + $n = bcadd($lsd, $temp); // m.length + (m.length >> 1) + 1 (so basically we're adding two same length numbers) //if ($m_length & 1) { // return self::regularBarrett($n, $m); //} @@ -116,31 +114,31 @@ protected static function reduce($n, $m) $temp = substr($n, 0, -$m_length + 1); // if even: ((m.length >> 1) + 2) + (m.length >> 1) == m.length + 2 // if odd: ((m.length >> 1) + 2) + (m.length >> 1) == (m.length - 1) + 2 == m.length + 1 - $temp = bcmul($temp, $u, 0); + $temp = bcmul($temp, $u); // if even: (m.length + 2) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) + 1 // if odd: (m.length + 1) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) $temp = substr($temp, 0, -($m_length >> 1) - 1); // if even: (m.length - (m.length >> 1) + 1) + m.length = 2 * m.length - (m.length >> 1) + 1 // if odd: (m.length - (m.length >> 1)) + m.length = 2 * m.length - (m.length >> 1) - $temp = bcmul($temp, $m, 0); + $temp = bcmul($temp, $m); // at this point, if m had an odd number of digits, we'd be subtracting a 2 * m.length - (m.length >> 1) digit // number from a m.length + (m.length >> 1) + 1 digit number. ie. there'd be an extra digit and the while loop // following this comment would loop a lot (hence our calling _regularBarrett() in that situation). - $result = bcsub($n, $temp, 0); + $result = bcsub($n, $temp); //if (bccomp($result, '0') < 0) { if ($result[0] == '-') { $temp = '1' . str_repeat('0', $m_length + 1); - $result = bcadd($result, $temp, 0); + $result = bcadd($result, $temp); } - while (bccomp($result, $m, 0) >= 0) { - $result = bcsub($result, $m, 0); + while (bccomp($result, $m) >= 0) { + $result = bcsub($result, $m); } - return $correctionNeeded && $result != '0' ? substr($result, 0, -1) : $result; + return $correctionNeeded ? substr($result, 0, -1) : $result; } /** @@ -163,7 +161,7 @@ private static function regularBarrett($x, $n) $n_length = strlen($n); if (strlen($x) > 2 * $n_length) { - return self::BCMOD_THREE_PARAMS ? bcmod($x, $n, 0) : bcmod($x, $n); + return bcmod($x, $n); } if (($key = array_search($n, $cache[self::VARIABLE])) === false) { @@ -174,21 +172,21 @@ private static function regularBarrett($x, $n) } $temp = substr($x, 0, -$n_length + 1); - $temp = bcmul($temp, $cache[self::DATA][$key], 0); + $temp = bcmul($temp, $cache[self::DATA][$key]); $temp = substr($temp, 0, -$n_length - 1); $r1 = substr($x, -$n_length - 1); - $r2 = substr(bcmul($temp, $n, 0), -$n_length - 1); + $r2 = substr(bcmul($temp, $n), -$n_length - 1); $result = bcsub($r1, $r2); //if (bccomp($result, '0') < 0) { if ($result[0] == '-') { $q = '1' . str_repeat('0', $n_length + 1); - $result = bcadd($result, $q, 0); + $result = bcadd($result, $q); } - while (bccomp($result, $n, 0) >= 0) { - $result = bcsub($result, $n, 0); + while (bccomp($result, $n) >= 0) { + $result = bcsub($result, $n); } return $result; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php index 040d7b5a7..e033ba575 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php @@ -58,7 +58,7 @@ protected static function generateCustomReduction(BCMath $m, $class) $m_length = strlen($m); if ($m_length < 5) { - $code = 'return self::BCMOD_THREE_PARAMS ? bcmod($x, $n, 0) : bcmod($x, $n);'; + $code = 'return bcmod($x, $n);'; eval('$func = function ($n) { ' . $code . '};'); self::$custom_reduction = $func; return; @@ -66,7 +66,7 @@ protected static function generateCustomReduction(BCMath $m, $class) $lhs = '1' . str_repeat('0', $m_length + ($m_length >> 1)); $u = bcdiv($lhs, $m, 0); - $m1 = bcsub($lhs, bcmul($u, $m, 0), 0); + $m1 = bcsub($lhs, bcmul($u, $m)); $cutoff = $m_length + ($m_length >> 1); @@ -78,23 +78,23 @@ protected static function generateCustomReduction(BCMath $m, $class) $lsd = substr($n, -' . $cutoff . '); $msd = substr($n, 0, -' . $cutoff . '); - $temp = bcmul($msd, ' . $m1 . ', 0); - $n = bcadd($lsd, $temp, 0); + $temp = bcmul($msd, ' . $m1 . '); + $n = bcadd($lsd, $temp); $temp = substr($n, 0, ' . (-$m_length + 1) . '); - $temp = bcmul($temp, ' . $u . ', 0); + $temp = bcmul($temp, ' . $u . '); $temp = substr($temp, 0, ' . (-($m_length >> 1) - 1) . '); - $temp = bcmul($temp, ' . $m . ', 0); + $temp = bcmul($temp, ' . $m . '); - $result = bcsub($n, $temp, 0); + $result = bcsub($n, $temp); if ($result[0] == \'-\') { $temp = \'1' . str_repeat('0', $m_length + 1) . '\'; - $result = bcadd($result, $temp, 0); + $result = bcadd($result, $temp); } while (bccomp($result, ' . $m . ') >= 0) { - $result = bcsub($result, ' . $m . ', 0); + $result = bcsub($result, ' . $m . '); } return $result;'; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php index ef3dcac9a..474abe105 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php @@ -316,9 +316,11 @@ protected function modInverseHelper(Engine $n) return $this->normalize($n->subtract($temp)); } - $extended = $this->extendedGCD($n); - $gcd = $extended['gcd']; - $x = $extended['x']; + extract($this->extendedGCD($n)); + /** + * @var Engine $gcd + * @var Engine $x + */ if (!$gcd->equals(static::$one[static::class])) { return false; @@ -364,44 +366,6 @@ public function __wakeup() } } - /** - * __serialize() magic method - * - * __sleep / __wakeup were depreciated in PHP 8.5 - * Will be called, automatically, when serialize() is called on a Math_BigInteger object. - * - * @see self::__unserialize() - * @access public - */ - public function __serialize() - { - $result = ['hex' => $this->toHex(true)]; - if ($this->precision > 0) { - $result['precision'] = $this->precision; - } - return $result; - } - - /** - * __unserialize() magic method - * - * __sleep / __wakeup were depreciated in PHP 8.5 - * Will be called, automatically, when unserialize() is called on a Math_BigInteger object. - * - * @see self::__serialize() - * @access public - */ - public function __unserialize(array $data) - { - $temp = new static($data['hex'], -16); - $this->value = $temp->value; - $this->is_negative = $temp->is_negative; - if (isset($data['precision']) && $data['precision'] > 0) { - // recalculate $this->bitmask - $this->setPrecision($data['precision']); - } - } - /** * JSON Serialize * @@ -680,7 +644,7 @@ protected function powModOuter(Engine $e, Engine $n) return $this->normalize($temp->powModInner($e, $n)); } - if ($this->compare($n) > 0 || $this->isNegative()) { + if ($this->compare($n) > 0) { list(, $temp) = $this->divide($n); return $temp->powModInner($e, $n); } @@ -776,9 +740,11 @@ protected static function slidingWindow(Engine $x, Engine $e, Engine $n, $class) */ public static function random($size) { - $minMax = static::minMaxBits($size); - $min = $minMax['min']; - $max = $minMax['max']; + extract(static::minMaxBits($size)); + /** + * @var BigInteger $min + * @var BigInteger $max + */ return static::randomRange($min, $max); } @@ -792,9 +758,11 @@ public static function random($size) */ public static function randomPrime($size) { - $minMax = static::minMaxBits($size); - $min = $minMax['min']; - $max = $minMax['max']; + extract(static::minMaxBits($size)); + /** + * @var static $min + * @var static $max + */ return static::randomRangePrime($min, $max); } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP.php index 0db43ae63..f61636297 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP.php @@ -296,10 +296,7 @@ public function modInverse(GMP $n) */ public function extendedGCD(GMP $n) { - $extended = gmp_gcdext($this->value, $n->value); - $g = $extended['g']; - $s = $extended['s']; - $t = $extended['t']; + extract(gmp_gcdext($this->value, $n->value)); return [ 'gcd' => $this->normalize(new self($g)), diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php index de556a3b2..2d8959522 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php @@ -533,9 +533,6 @@ protected function divideHelper(PHP $y) $quotient = new static(); $remainder = new static(); $quotient->value = $q; - if ($this->is_negative) { - $r = $y->value[0] - $r; - } $remainder->value = [$r]; $quotient->is_negative = $this->is_negative != $y->is_negative; return [$this->normalize($quotient), $this->normalize($remainder)]; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php index e624f3cad..886896618 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php @@ -98,9 +98,7 @@ protected static function reduce(array $n, array $m, $class) 'm1' => $m1 // m.length ]; } else { - $cacheValues = $cache[self::DATA][$key]; - $u = $cacheValues['u']; - $m1 = $cacheValues['m1']; + extract($cache[self::DATA][$key]); } $cutoff = $m_length + ($m_length >> 1); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php index 1ebb2f5d7..15eb99c7d 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php @@ -54,24 +54,10 @@ class Integer extends Base /** * Zero * - * @var BigInteger[] + * @var BigInteger */ protected static $zero; - /** - * One - * - * @var BigInteger[] - */ - protected static $one; - - /** - * Two - * - * @var BigInteger[] - */ - protected static $two; - /** * Default constructor * @@ -82,7 +68,7 @@ public function __construct($instanceID, $num = null) { $this->instanceID = $instanceID; if (!isset($num)) { - $this->value = clone static::$zero[$instanceID]; + $this->value = clone static::$zero[static::class]; } else { $reduce = static::$reduce[$instanceID]; $this->value = $reduce($num); @@ -109,8 +95,8 @@ public static function setModulo($instanceID, BigInteger $modulo) public static function setRecurringModuloFunction($instanceID, callable $function) { static::$reduce[$instanceID] = $function; - if (!isset(static::$zero[$instanceID])) { - static::$zero[$instanceID] = new BigInteger(); + if (!isset(static::$zero[static::class])) { + static::$zero[static::class] = new BigInteger(); } } @@ -121,9 +107,6 @@ public static function cleanupCache($instanceID) { unset(static::$modulo[$instanceID]); unset(static::$reduce[$instanceID]); - unset(static::$zero[$instanceID]); - unset(static::$one[$instanceID]); - unset(static::$two[$instanceID]); } /** @@ -257,35 +240,32 @@ public function pow(BigInteger $x) */ public function squareRoot() { - if (!isset(static::$one[$this->instanceID])) { - static::$one[$this->instanceID] = new BigInteger(1); - static::$two[$this->instanceID] = new BigInteger(2); + static $one, $two; + if (!isset($one)) { + $one = new BigInteger(1); + $two = new BigInteger(2); } - $one = &static::$one[$this->instanceID]; - $two = &static::$two[$this->instanceID]; - $modulo = &static::$modulo[$this->instanceID]; - $reduce = &static::$reduce[$this->instanceID]; - - $p_1 = $modulo->subtract($one); + $reduce = static::$reduce[$this->instanceID]; + $p_1 = static::$modulo[$this->instanceID]->subtract($one); $q = clone $p_1; $s = BigInteger::scan1divide($q); list($pow) = $p_1->divide($two); - for ($z = $one; !$z->equals($modulo); $z = $z->add($one)) { - $temp = $z->powMod($pow, $modulo); + for ($z = $one; !$z->equals(static::$modulo[$this->instanceID]); $z = $z->add($one)) { + $temp = $z->powMod($pow, static::$modulo[$this->instanceID]); if ($temp->equals($p_1)) { break; } } $m = new BigInteger($s); - $c = $z->powMod($q, $modulo); - $t = $this->value->powMod($q, $modulo); + $c = $z->powMod($q, static::$modulo[$this->instanceID]); + $t = $this->value->powMod($q, static::$modulo[$this->instanceID]); list($temp) = $q->add($one)->divide($two); - $r = $this->value->powMod($temp, $modulo); + $r = $this->value->powMod($temp, static::$modulo[$this->instanceID]); while (!$t->equals($one)) { for ($i = clone $one; $i->compare($m) < 0; $i = $i->add($one)) { - if ($t->powMod($two->pow($i), $modulo)->equals($one)) { + if ($t->powMod($two->pow($i), static::$modulo[$this->instanceID])->equals($one)) { break; } } @@ -293,7 +273,7 @@ public function squareRoot() if ($i->compare($m) == 0) { return false; } - $b = $c->powMod($two->pow($m->subtract($i)->subtract($one)), $modulo); + $b = $c->powMod($two->pow($m->subtract($i)->subtract($one)), static::$modulo[$this->instanceID]); $m = $i; $c = $reduce($b->multiply($b)); $t = $reduce($t->multiply($c)); @@ -376,8 +356,6 @@ public function getNAF($w = 1) { $w++; - $zero = &static::$zero[$this->instanceID]; - $mask = new BigInteger((1 << $w) - 1); $sub = new BigInteger(1 << $w); //$sub = new BigInteger(1 << ($w - 1)); @@ -385,7 +363,7 @@ public function getNAF($w = 1) $d_i = []; $i = 0; - while ($d->compare($zero) > 0) { + while ($d->compare(static::$zero[static::class]) > 0) { if ($d->isOdd()) { // start mods @@ -399,7 +377,7 @@ public function getNAF($w = 1) } else { $d_i[$i] = 0; } - $shift = !$d->equals($zero) && $d->bitwise_and($mask)->equals($zero) ? $w : 1; // $w or $w + 1? + $shift = !$d->equals(static::$zero[static::class]) && $d->bitwise_and($mask)->equals(static::$zero[static::class]) ? $w : 1; // $w or $w + 1? $d = $d->bitwise_rightShift($shift); while (--$shift > 0) { $d_i[++$i] = 0; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php index 9d385ad75..47dac48f9 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php @@ -836,8 +836,6 @@ public function realpath($path) return false; } - $path = (string) $path; - if (!$this->canonicalize_paths) { if ($this->pwd === true) { return '.'; @@ -925,8 +923,6 @@ public function chdir($dir) return false; } - $dir = (string) $dir; - // assume current dir if $dir is empty if ($dir === '') { $dir = './'; @@ -936,9 +932,6 @@ public function chdir($dir) } $dir = $this->realpath($dir); - if ($dir === false) { - return false; - } // confirm that $dir is, in fact, a valid directory if ($this->use_stat_cache && is_array($this->query_stat_cache($dir))) { @@ -3362,7 +3355,8 @@ private function get_sftp_packet($request_id = null) if (strlen($this->packet_buffer) < 4) { throw new \RuntimeException('Packet is too small'); } - $length = unpack('Nlength', Strings::shift($this->packet_buffer, 4))['length']; + extract(unpack('Nlength', Strings::shift($this->packet_buffer, 4))); + /** @var integer $length */ $tempLength = $length; $tempLength -= strlen($this->packet_buffer); @@ -3392,7 +3386,7 @@ private function get_sftp_packet($request_id = null) $this->packet_type = ord(Strings::shift($this->packet_buffer)); if ($this->use_request_id) { - $packet_id = unpack('Npacket_id', Strings::shift($this->packet_buffer, 4))['packet_id']; // remove the request id + extract(unpack('Npacket_id', Strings::shift($this->packet_buffer, 4))); // remove the request id $length -= 5; // account for the request id and the packet type } else { $length -= 1; // account for the packet type @@ -3565,6 +3559,7 @@ protected function disconnect_helper($reason) /** * Enable Date Preservation + * */ public function enableDatePreservation() { @@ -3573,101 +3568,13 @@ public function enableDatePreservation() /** * Disable Date Preservation + * */ public function disableDatePreservation() { $this->preserveTime = false; } - /** - * Copy - * - * This method (currently) only works if the copy-data extension is available - * - * @param string $oldname - * @param string $newname - * @return bool - */ - public function copy($oldname, $newname) - { - if (!$this->precheck()) { - return false; - } - - $oldname = $this->realpath($oldname); - $newname = $this->realpath($newname); - if ($oldname === false || $newname === false) { - return false; - } - - if (!isset($this->extensions['copy-data']) || $this->extensions['copy-data'] !== '1') { - throw new \RuntimeException( - "Extension 'copy-data' is not supported by the server. " . - "Call getSupportedVersions() to see a list of supported extension" - ); - } - - $size = $this->filesize($oldname); - - $packet = Strings::packSSH2('s', $oldname); - $packet .= $this->version >= 5 ? - pack('N3', 0, NET_SFTP_OPEN_OPEN_EXISTING, 0) : - pack('N2', NET_SFTP_OPEN_READ, 0); - $this->send_sftp_packet(NET_SFTP_OPEN, $packet); - - $response = $this->get_sftp_packet(); - switch ($this->packet_type) { - case NET_SFTP_HANDLE: - $oldhandle = substr($response, 4); - break; - case NET_SFTP_STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED - $this->logError($response); - return false; - default: - throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS. ' - . 'Got packet type: ' . $this->packet_type); - } - - if ($this->version >= 5) { - $flags = NET_SFTP_OPEN_OPEN_OR_CREATE; - } else { - $flags = NET_SFTP_OPEN_WRITE | NET_SFTP_OPEN_CREATE; - } - - $packet = Strings::packSSH2('s', $newname); - $packet .= $this->version >= 5 ? - pack('N3', 0, $flags, 0) : - pack('N2', $flags, 0); - $this->send_sftp_packet(NET_SFTP_OPEN, $packet); - - $response = $this->get_sftp_packet(); - switch ($this->packet_type) { - case NET_SFTP_HANDLE: - $newhandle = substr($response, 4); - break; - case NET_SFTP_STATUS: - $this->logError($response); - return false; - default: - throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS. ' - . 'Got packet type: ' . $this->packet_type); - } - - $packet = Strings::packSSH2('ssQQsQ', 'copy-data', $oldhandle, 0, $size, $newhandle, 0); - $this->send_sftp_packet(NET_SFTP_EXTENDED, $packet); - - $response = $this->get_sftp_packet(); - if ($this->packet_type != NET_SFTP_STATUS) { - throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' - . 'Got packet type: ' . $this->packet_type); - } - - $this->close_handle($oldhandle); - $this->close_handle($newhandle); - - return true; - } - /** * POSIX Rename * diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php index a1f2fa245..24047b4b0 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php @@ -139,15 +139,7 @@ public function __construct() protected function parse_path($path) { $orig = $path; - $url = parse_url($path) + ['port' => 22]; - - $keys = ['scheme', 'host', 'port', 'user', 'pass', 'path', 'query', 'fragment']; - foreach ($keys as $key) { - if (isset($url[$key])) { - $$key = $url[$key]; - } - } - + extract(parse_url($path) + ['port' => 22]); if (isset($query)) { $path .= '?' . $query; } elseif (preg_match('/(\?|\?#)$/', $orig)) { diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php index 1c8a0e265..ac44eaacd 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php @@ -1477,7 +1477,7 @@ private function connect() } if (defined('NET_SSH2_LOGGING')) { - $this->append_log('<- (network: ' . round($totalElapsed, 4) . ')', $data); + $this->append_log('<- (network: ' . round($totalElapsed, 4) . ')', $line); } if (feof($this->fsock)) { @@ -1487,13 +1487,7 @@ private function connect() $extra = $matches[1]; - // earlier the SSH specs were quoted. - // "The server MAY send other lines of data before sending the version string." they said. - // the implication of this is that the lines of data before the server string are *not* a part of it - // getting this right is important because the correct server identifier needs to be fed into the - // exchange hash for the shared keys to be calculated correctly - $data = explode("\r\n", trim($data, "\r\n")); - $this->server_identifier = $data[count($data) - 1]; + $this->server_identifier = trim($data, "\r\n"); if (strlen($extra)) { $this->errors[] = $data; } @@ -1683,6 +1677,7 @@ private function key_exchange($kexinit_payload_server = false) case NET_SSH2_MSG_DISCONNECT: return $this->handleDisconnect($kexinit_payload_server); } + $this->kex_buffer[] = $kexinit_payload_server; } @@ -2982,7 +2977,7 @@ public function getOpenChannelCount() */ protected function open_channel($channel, $skip_extended = false) { - if (isset($this->channel_status[$channel])) { + if (isset($this->channel_status[$channel]) && $this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_CLOSE) { throw new \RuntimeException('Please close the channel (' . $channel . ') before trying to open it again'); } @@ -3351,27 +3346,6 @@ public function reset($channel = null) } } - /** - * Send EOF on a channel - * - * Sends an EOF to the stream; this is typically used to close standard - * input, while keeping output and error alive. - * - * @param int|null $channel Channel id returned by self::getInteractiveChannelId() - * @return void - */ - public function sendEOF($channel = null) - { - if ($channel === null) { - $channel = $this->get_interactive_channel(); - } - - $excludeStatuses = [NET_SSH2_MSG_CHANNEL_EOF, NET_SSH2_MSG_CHANNEL_CLOSE]; - if (isset($this->channel_status[$channel]) && !in_array($this->channel_status[$channel], $excludeStatuses)) { - $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$channel])); - } - } - /** * Is timeout? * @@ -3748,7 +3722,7 @@ private function get_binary_packet() } $padding_length = 0; $payload = $packet->plain; - $padding_length = unpack('Cpadding_length', Strings::shift($payload, 1))['padding_length']; + extract(unpack('Cpadding_length', Strings::shift($payload, 1))); if ($padding_length > 0) { Strings::pop($payload, $padding_length); } @@ -3814,7 +3788,8 @@ private function get_binary_packet() $this->key_exchange(); } - return $this->filter($payload); + // don't filter if we're in the middle of a key exchange (since _filter might send out packets) + return $this->keyExchangeInProgress ? $payload : $this->filter($payload); } /** @@ -3834,13 +3809,13 @@ private function get_binary_packet_size(&$packet) switch ($this->decryptName) { case 'aes128-gcm@openssh.com': case 'aes256-gcm@openssh.com': - $packet_length = unpack('Npacket_length', substr($packet->raw, 0, $packet_length_header_size))['packet_length']; + extract(unpack('Npacket_length', substr($packet->raw, 0, $packet_length_header_size))); $packet->size = $packet_length_header_size + $packet_length + $this->decrypt_block_size; // expect tag break; case 'chacha20-poly1305@openssh.com': $this->lengthDecrypt->setNonce(pack('N2', 0, $this->get_seq_no)); $packet_length_header = $this->lengthDecrypt->decrypt(substr($packet->raw, 0, $packet_length_header_size)); - $packet_length = unpack('Npacket_length', $packet_length_header)['packet_length']; + extract(unpack('Npacket_length', $packet_length_header)); $packet->size = $packet_length_header_size + $packet_length + 16; // expect tag break; default: @@ -3849,17 +3824,17 @@ private function get_binary_packet_size(&$packet) return; } $packet->plain = $this->decrypt->decrypt(substr($packet->raw, 0, $this->decrypt_block_size)); - $packet_length = unpack('Npacket_length', Strings::shift($packet->plain, $packet_length_header_size))['packet_length']; + extract(unpack('Npacket_length', Strings::shift($packet->plain, $packet_length_header_size))); $packet->size = $packet_length_header_size + $packet_length; $added_validation_length = $packet_length_header_size; } else { - $packet_length = unpack('Npacket_length', substr($packet->raw, 0, $packet_length_header_size))['packet_length']; + extract(unpack('Npacket_length', substr($packet->raw, 0, $packet_length_header_size))); $packet->size = $packet_length_header_size + $packet_length; } break; } } else { - $packet_length = unpack('Npacket_length', substr($packet->raw, 0, $packet_length_header_size))['packet_length']; + extract(unpack('Npacket_length', substr($packet->raw, 0, $packet_length_header_size))); $packet->size = $packet_length_header_size + $packet_length; $added_validation_length = $packet_length_header_size; } @@ -3909,15 +3884,9 @@ private function handleDisconnect($payload) */ private function filter($payload) { - if (ord($payload[0]) == NET_SSH2_MSG_DISCONNECT) { - return $this->handleDisconnect($payload); - } - - if ($this->session_id === false && $this->keyExchangeInProgress) { - return $payload; - } - switch (ord($payload[0])) { + case NET_SSH2_MSG_DISCONNECT: + return $this->handleDisconnect($payload); case NET_SSH2_MSG_IGNORE: $payload = $this->get_binary_packet(); break; @@ -3931,7 +3900,7 @@ private function filter($payload) break; // return payload case NET_SSH2_MSG_KEXINIT: // this is here for server initiated key re-exchanges after the initial key exchange - if (!$this->keyExchangeInProgress && $this->session_id !== false) { + if ($this->session_id !== false) { if (!$this->key_exchange($payload)) { $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); throw new ConnectionClosedException('Key exchange failed'); @@ -3951,26 +3920,6 @@ private function filter($payload) $payload = $this->get_binary_packet(); } - /* - Once a party has sent a SSH_MSG_KEXINIT message for key exchange or - re-exchange, until it has sent a SSH_MSG_NEWKEYS message (Section - 7.3), it MUST NOT send any messages other than: - - o Transport layer generic messages (1 to 19) (but - SSH_MSG_SERVICE_REQUEST and SSH_MSG_SERVICE_ACCEPT MUST NOT be - sent); - - o Algorithm negotiation messages (20 to 29) (but further - SSH_MSG_KEXINIT messages MUST NOT be sent); - - o Specific key exchange method messages (30 to 49). - - -- https://www.rfc-editor.org/rfc/rfc4253#section-7.1 - */ - if ($this->keyExchangeInProgress) { - return $payload; - } - // see http://tools.ietf.org/html/rfc4252#section-5.4; only called when the encryption has been activated and when we haven't already logged in if (($this->bitmap & self::MASK_CONNECTED) && !$this->isAuthenticated() && ord($payload[0]) == NET_SSH2_MSG_USERAUTH_BANNER) { Strings::shift($payload, 1); @@ -3983,10 +3932,7 @@ private function filter($payload) switch (ord($payload[0])) { case NET_SSH2_MSG_CHANNEL_REQUEST: if (strlen($payload) == 31) { - $unpacked = unpack('cpacket_type/Nchannel/Nlength', $payload); - $packet_type = $unpacked['packet_type']; - $channel = $unpacked['channel']; - $length = $unpacked['length']; + extract(unpack('cpacket_type/Nchannel/Nlength', $payload)); if (substr($payload, 9, $length) == 'keepalive@openssh.com' && isset($this->server_channels[$channel])) { if (ord(substr($payload, 9 + $length))) { // want reply $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_SUCCESS, $this->server_channels[$channel])); @@ -4150,8 +4096,7 @@ public function isPTYEnabled() protected function get_channel_packet($client_channel, $skip_extended = false) { if (!empty($this->channel_buffers[$client_channel])) { - // in phpseclib 4.0 this should be changed to $this->channel_status[$client_channel] ?? null - switch (isset($this->channel_status[$client_channel]) ? $this->channel_status[$client_channel] : null) { + switch ($this->channel_status[$client_channel]) { case NET_SSH2_MSG_CHANNEL_REQUEST: foreach ($this->channel_buffers[$client_channel] as $i => $packet) { switch (ord($packet[0])) { @@ -4219,7 +4164,7 @@ protected function get_channel_packet($client_channel, $skip_extended = false) continue 2; case NET_SSH2_MSG_CHANNEL_REQUEST: - if (!isset($this->channel_status[$channel])) { + if ($this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_CLOSE) { continue 2; } list($value) = Strings::unpackSSH2('s', $response); @@ -4237,14 +4182,10 @@ protected function get_channel_packet($client_channel, $skip_extended = false) $this->errors[count($this->errors) - 1] .= "\r\n$error_message"; } - if (isset($this->channel_status[$channel]) && $this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_CLOSE) { - if ($this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_EOF) { - $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$channel])); - } - $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel])); + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); - $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_CLOSE; - } + $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_EOF; continue 3; case 'exit-status': @@ -4345,11 +4286,11 @@ protected function get_channel_packet($client_channel, $skip_extended = false) $this->close_channel_bitmap($channel); - if ($this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_CLOSE) { + if ($this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_EOF) { $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); } - unset($this->channel_status[$channel]); + $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_CLOSE; $this->channelCount--; if ($client_channel == $channel) { @@ -4574,7 +4515,7 @@ private function append_log($message_number, $message) protected function append_log_helper($constant, $message_number, $message, array &$message_number_log, array &$message_log, &$log_size, &$realtime_log_file, &$realtime_log_wrap, &$realtime_log_size) { // remove the byte identifying the message type from all but the first two messages (ie. the identification strings) - if (!in_array(substr($message_number, 0, 4), ['<- (', '-> (']) && strlen($message_number) > 2) { + if (strlen($message_number) > 2) { Strings::shift($message); } @@ -4714,24 +4655,27 @@ protected function send_channel_packet($client_channel, $data) * @param bool $want_reply * @return void */ - private function close_channel($client_channel) + private function close_channel($client_channel, $want_reply = false) { // see http://tools.ietf.org/html/rfc4254#section-5.3 - if ($this->channel_status[$client_channel] != NET_SSH2_MSG_CHANNEL_EOF) { - $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel])); + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel])); + + if (!$want_reply) { + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel])); } - $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel])); $this->channel_status[$client_channel] = NET_SSH2_MSG_CHANNEL_CLOSE; - $this->channelCount--; $this->curTimeout = 5; + while (!is_bool($this->get_channel_packet($client_channel))) { } - unset($this->channel_status[$client_channel]); + if ($want_reply) { + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel])); + } $this->close_channel_bitmap($client_channel); } diff --git a/lib/Google/vendor/psr/cache/src/CacheItemInterface.php b/lib/Google/vendor/psr/cache/src/CacheItemInterface.php index 893315e6e..2b2e4bb88 100644 --- a/lib/Google/vendor/psr/cache/src/CacheItemInterface.php +++ b/lib/Google/vendor/psr/cache/src/CacheItemInterface.php @@ -32,7 +32,7 @@ interface CacheItemInterface * @return string * The key string for this cache item. */ - public function getKey(); + public function getKey(): string; /** * Retrieves the value of the item from the cache associated with this object's key. @@ -46,7 +46,7 @@ public function getKey(); * @return mixed * The value corresponding to this cache item's key, or null if not found. */ - public function get(); + public function get(): mixed; /** * Confirms if the cache item lookup resulted in a cache hit. @@ -57,7 +57,7 @@ public function get(); * @return bool * True if the request resulted in a cache hit. False otherwise. */ - public function isHit(); + public function isHit(): bool; /** * Sets the value represented by this cache item. @@ -72,7 +72,7 @@ public function isHit(); * @return static * The invoked object. */ - public function set(mixed $value); + public function set(mixed $value): static; /** * Sets the expiration time for this cache item. @@ -86,7 +86,7 @@ public function set(mixed $value); * @return static * The called object. */ - public function expiresAt(?\DateTimeInterface $expiration); + public function expiresAt(?\DateTimeInterface $expiration): static; /** * Sets the expiration time for this cache item. @@ -101,5 +101,5 @@ public function expiresAt(?\DateTimeInterface $expiration); * @return static * The called object. */ - public function expiresAfter(int|\DateInterval|null $time); + public function expiresAfter(int|\DateInterval|null $time): static; } diff --git a/lib/Google/vendor/psr/cache/src/CacheItemPoolInterface.php b/lib/Google/vendor/psr/cache/src/CacheItemPoolInterface.php index 9ff99da6b..4b3017c75 100644 --- a/lib/Google/vendor/psr/cache/src/CacheItemPoolInterface.php +++ b/lib/Google/vendor/psr/cache/src/CacheItemPoolInterface.php @@ -29,7 +29,7 @@ interface CacheItemPoolInterface * @return CacheItemInterface * The corresponding Cache Item. */ - public function getItem(string $key); + public function getItem(string $key): CacheItemInterface; /** * Returns a traversable set of cache items. @@ -41,13 +41,13 @@ public function getItem(string $key); * If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException * MUST be thrown. * - * @return array|\Traversable - * A traversable collection of Cache Items keyed by the cache keys of + * @return iterable + * An iterable collection of Cache Items keyed by the cache keys of * each item. A Cache item will be returned for each key, even if that * key is not found. However, if no keys are specified then an empty * traversable MUST be returned instead. */ - public function getItems(array $keys = []); + public function getItems(array $keys = []): iterable; /** * Confirms if the cache contains specified cache item. @@ -66,7 +66,7 @@ public function getItems(array $keys = []); * @return bool * True if item exists in the cache, false otherwise. */ - public function hasItem(string $key); + public function hasItem(string $key): bool; /** * Deletes all items in the pool. @@ -74,7 +74,7 @@ public function hasItem(string $key); * @return bool * True if the pool was successfully cleared. False if there was an error. */ - public function clear(); + public function clear(): bool; /** * Removes the item from the pool. @@ -89,7 +89,7 @@ public function clear(); * @return bool * True if the item was successfully removed. False if there was an error. */ - public function deleteItem(string $key); + public function deleteItem(string $key): bool; /** * Removes multiple items from the pool. @@ -104,7 +104,7 @@ public function deleteItem(string $key); * @return bool * True if the items were successfully removed. False if there was an error. */ - public function deleteItems(array $keys); + public function deleteItems(array $keys): bool; /** * Persists a cache item immediately. @@ -115,7 +115,7 @@ public function deleteItems(array $keys); * @return bool * True if the item was successfully persisted. False if there was an error. */ - public function save(CacheItemInterface $item); + public function save(CacheItemInterface $item): bool; /** * Sets a cache item to be persisted later. @@ -126,7 +126,7 @@ public function save(CacheItemInterface $item); * @return bool * False if the item could not be queued or if a commit was attempted and failed. True otherwise. */ - public function saveDeferred(CacheItemInterface $item); + public function saveDeferred(CacheItemInterface $item): bool; /** * Persists any deferred cache items. @@ -134,5 +134,5 @@ public function saveDeferred(CacheItemInterface $item); * @return bool * True if all not-yet-saved items were successfully saved or there were none. False otherwise. */ - public function commit(); + public function commit(): bool; } diff --git a/lib/Google/vendor/ramsey/collection/README.md b/lib/Google/vendor/ramsey/collection/README.md index aacf940b3..c77ffcb18 100644 --- a/lib/Google/vendor/ramsey/collection/README.md +++ b/lib/Google/vendor/ramsey/collection/README.md @@ -11,6 +11,7 @@ Read License Build Status Codecov Code Coverage + Psalm Type Coverage

## About @@ -48,6 +49,16 @@ contribution of external security researchers. If you believe you've found a security issue in software that is maintained in this repository, please read [SECURITY.md][] for instructions on submitting a vulnerability report. +## ramsey/collection for Enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of ramsey/collection and thousands of other packages are working +with Tidelift to deliver commercial support and maintenance for the open source +packages you use to build your applications. Save time, reduce risk, and improve +code health, while paying the maintainers of the exact packages you use. +[Learn more.](https://tidelift.com/subscription/pkg/packagist-ramsey-collection?utm_source=undefined&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + ## Copyright and License The ramsey/collection library is copyright © [Ben Ramsey](https://benramsey.com) diff --git a/lib/Google/vendor/ramsey/collection/composer.json b/lib/Google/vendor/ramsey/collection/composer.json index 42fc22b95..f09106a15 100644 --- a/lib/Google/vendor/ramsey/collection/composer.json +++ b/lib/Google/vendor/ramsey/collection/composer.json @@ -19,27 +19,32 @@ } ], "require": { - "php": "^8.1" + "php": "^7.4 || ^8.0", + "symfony/polyfill-php81": "^1.23" }, "require-dev": { "captainhook/plugin-composer": "^5.3", - "ergebnis/composer-normalize": "^2.45", - "fakerphp/faker": "^1.24", + "ergebnis/composer-normalize": "^2.28.3", + "fakerphp/faker": "^1.21", "hamcrest/hamcrest-php": "^2.0", - "jangregor/phpstan-prophecy": "^2.1", - "mockery/mockery": "^1.6", + "jangregor/phpstan-prophecy": "^1.0", + "mockery/mockery": "^1.5", "php-parallel-lint/php-console-highlighter": "^1.0", - "php-parallel-lint/php-parallel-lint": "^1.4", - "phpspec/prophecy-phpunit": "^2.3", - "phpstan/extension-installer": "^1.4", - "phpstan/phpstan": "^2.1", - "phpstan/phpstan-mockery": "^2.0", - "phpstan/phpstan-phpunit": "^2.0", - "phpunit/phpunit": "^10.5", - "ramsey/coding-standard": "^2.3", - "ramsey/conventional-commits": "^1.6", - "roave/security-advisories": "dev-latest" + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpcsstandards/phpcsutils": "^1.0.0-rc1", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan": "^1.9", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5", + "psalm/plugin-mockery": "^1.1", + "psalm/plugin-phpunit": "^0.18.4", + "ramsey/coding-standard": "^2.0.3", + "ramsey/conventional-commits": "^1.3", + "vimeo/psalm": "^5.4" }, + "minimum-stability": "RC", "prefer-stable": true, "autoload": { "psr-4": { @@ -48,15 +53,19 @@ }, "autoload-dev": { "psr-4": { - "Ramsey\\Collection\\Test\\": "tests/" - } + "Ramsey\\Collection\\Test\\": "tests/", + "Ramsey\\Test\\Generics\\": "tests/generics/" + }, + "files": [ + "vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php" + ] }, "config": { "allow-plugins": { - "captainhook/plugin-composer": true, "dealerdirect/phpcodesniffer-composer-installer": true, "ergebnis/composer-normalize": true, - "phpstan/extension-installer": true + "phpstan/extension-installer": true, + "captainhook/plugin-composer": true }, "sort-packages": true }, @@ -70,9 +79,11 @@ }, "scripts": { "dev:analyze": [ - "@dev:analyze:phpstan" + "@dev:analyze:phpstan", + "@dev:analyze:psalm" ], "dev:analyze:phpstan": "phpstan analyse --ansi --memory-limit=1G", + "dev:analyze:psalm": "psalm", "dev:build:clean": "git clean -fX build/", "dev:lint": [ "@dev:lint:syntax", @@ -94,6 +105,7 @@ "scripts-descriptions": { "dev:analyze": "Runs all static analysis checks.", "dev:analyze:phpstan": "Runs the PHPStan static analyzer.", + "dev:analyze:psalm": "Runs the Psalm static analyzer.", "dev:build:clean": "Cleans the build/ directory.", "dev:lint": "Runs all linting checks.", "dev:lint:fix": "Auto-fixes coding standards issues, if possible.", diff --git a/lib/Google/vendor/ramsey/collection/conventional-commits.json b/lib/Google/vendor/ramsey/collection/conventional-commits.json new file mode 100644 index 000000000..5fe21d2fa --- /dev/null +++ b/lib/Google/vendor/ramsey/collection/conventional-commits.json @@ -0,0 +1,22 @@ +{ + "typeCase": "kebab", + "types": [ + "chore", + "ci", + "docs", + "feat", + "fix", + "refactor", + "security", + "style", + "test" + ], + "scopeCase": "kebab", + "scopeRequired": false, + "scopes": [], + "descriptionCase": null, + "descriptionEndMark": "", + "bodyRequired": false, + "bodyWrapWidth": 72, + "requiredFooters": [] +} diff --git a/lib/Google/vendor/ramsey/collection/src/AbstractArray.php b/lib/Google/vendor/ramsey/collection/src/AbstractArray.php index 6d6b6d66b..9b39dd0cb 100644 --- a/lib/Google/vendor/ramsey/collection/src/AbstractArray.php +++ b/lib/Google/vendor/ramsey/collection/src/AbstractArray.php @@ -18,6 +18,8 @@ use Traversable; use function count; +use function serialize; +use function unserialize; /** * This class provides a basic implementation of `ArrayInterface`, to minimize @@ -42,7 +44,7 @@ abstract class AbstractArray implements ArrayInterface */ public function __construct(array $data = []) { - // Invoke offsetSet() for each value added; in this way, subclasses + // Invoke offsetSet() for each value added; in this way, sub-classes // may provide additional logic about values added to the array object. foreach ($data as $key => $value) { $this[$key] = $value; @@ -68,7 +70,7 @@ public function getIterator(): Traversable * * @param array-key $offset The offset to check. */ - public function offsetExists(mixed $offset): bool + public function offsetExists($offset): bool { return isset($this->data[$offset]); } @@ -80,12 +82,13 @@ public function offsetExists(mixed $offset): bool * * @param array-key $offset The offset for which a value should be returned. * - * @return T the value stored at the offset, or null if the offset + * @return T|null the value stored at the offset, or null if the offset * does not exist. */ - public function offsetGet(mixed $offset): mixed + #[\ReturnTypeWillChange] // phpcs:ignore + public function offsetGet($offset) { - return $this->data[$offset]; + return $this->data[$offset] ?? null; } /** @@ -93,11 +96,12 @@ public function offsetGet(mixed $offset): mixed * * @link http://php.net/manual/en/arrayaccess.offsetset.php ArrayAccess::offsetSet() * - * @param array-key | null $offset The offset to set. If `null`, the value - * may be set at a numerically-indexed offset. + * @param array-key|null $offset The offset to set. If `null`, the value may be + * set at a numerically-indexed offset. * @param T $value The value to set at the given offset. */ - public function offsetSet(mixed $offset, mixed $value): void + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function offsetSet($offset, $value): void { if ($offset === null) { $this->data[] = $value; @@ -113,11 +117,25 @@ public function offsetSet(mixed $offset, mixed $value): void * * @param array-key $offset The offset to remove from the array. */ - public function offsetUnset(mixed $offset): void + public function offsetUnset($offset): void { unset($this->data[$offset]); } + /** + * Returns a serialized string representation of this array object. + * + * @deprecated The Serializable interface will go away in PHP 9. + * + * @link http://php.net/manual/en/serializable.serialize.php Serializable::serialize() + * + * @return string a PHP serialized string. + */ + public function serialize(): string + { + return serialize($this->data); + } + /** * Returns data suitable for PHP serialization. * @@ -131,6 +149,25 @@ public function __serialize(): array return $this->data; } + /** + * Converts a serialized string representation into an instance object. + * + * @deprecated The Serializable interface will go away in PHP 9. + * + * @link http://php.net/manual/en/serializable.unserialize.php Serializable::unserialize() + * + * @param string $serialized A PHP serialized string to unserialize. + * + * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + */ + public function unserialize($serialized): void + { + /** @var array $data */ + $data = unserialize($serialized, ['allowed_classes' => false]); + + $this->data = $data; + } + /** * Adds unserialized data to the object. * @@ -166,6 +203,6 @@ public function toArray(): array public function isEmpty(): bool { - return $this->data === []; + return count($this->data) === 0; } } diff --git a/lib/Google/vendor/ramsey/collection/src/AbstractCollection.php b/lib/Google/vendor/ramsey/collection/src/AbstractCollection.php index 2f006b90f..38ef7144c 100644 --- a/lib/Google/vendor/ramsey/collection/src/AbstractCollection.php +++ b/lib/Google/vendor/ramsey/collection/src/AbstractCollection.php @@ -17,27 +17,27 @@ use Closure; use Ramsey\Collection\Exception\CollectionMismatchException; use Ramsey\Collection\Exception\InvalidArgumentException; -use Ramsey\Collection\Exception\InvalidPropertyOrMethod; -use Ramsey\Collection\Exception\NoSuchElementException; -use Ramsey\Collection\Exception\UnsupportedOperationException; +use Ramsey\Collection\Exception\InvalidSortOrderException; +use Ramsey\Collection\Exception\OutOfBoundsException; use Ramsey\Collection\Tool\TypeTrait; use Ramsey\Collection\Tool\ValueExtractorTrait; use Ramsey\Collection\Tool\ValueToStringTrait; use function array_filter; -use function array_key_first; -use function array_key_last; use function array_map; use function array_merge; -use function array_reduce; use function array_search; use function array_udiff; use function array_uintersect; +use function current; +use function end; use function in_array; use function is_int; use function is_object; +use function reset; use function spl_object_id; use function sprintf; +use function unserialize; use function usort; /** @@ -55,24 +55,27 @@ abstract class AbstractCollection extends AbstractArray implements CollectionInt use ValueExtractorTrait; /** - * @throws InvalidArgumentException if $element is of the wrong type. + * @inheritDoc */ - public function add(mixed $element): bool + public function add($element): bool { $this[] = $element; return true; } - public function contains(mixed $element, bool $strict = true): bool + /** + * @inheritDoc + */ + public function contains($element, bool $strict = true): bool { return in_array($element, $this->data, $strict); } /** - * @throws InvalidArgumentException if $element is of the wrong type. + * @inheritDoc */ - public function offsetSet(mixed $offset, mixed $value): void + public function offsetSet($offset, $value): void { if ($this->checkType($this->getType(), $value) === false) { throw new InvalidArgumentException( @@ -88,7 +91,10 @@ public function offsetSet(mixed $offset, mixed $value): void } } - public function remove(mixed $element): bool + /** + * @inheritDoc + */ + public function remove($element): bool { if (($position = array_search($element, $this->data, true)) !== false) { unset($this[$position]); @@ -100,11 +106,6 @@ public function remove(mixed $element): bool } /** - * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist - * on the elements in this collection. - * @throws UnsupportedOperationException if unable to call column() on this - * collection. - * * @inheritDoc */ public function column(string $propertyOrMethod): array @@ -112,74 +113,77 @@ public function column(string $propertyOrMethod): array $temp = []; foreach ($this->data as $item) { - $temp[] = $this->extractValue($item, $propertyOrMethod); + /** @var mixed $value */ + $value = $this->extractValue($item, $propertyOrMethod); + + /** @psalm-suppress MixedAssignment */ + $temp[] = $value; } return $temp; } /** - * @return T - * - * @throws NoSuchElementException if this collection is empty. + * @inheritDoc */ - public function first(): mixed + public function first() { - $firstIndex = array_key_first($this->data); - - if ($firstIndex === null) { - throw new NoSuchElementException('Can\'t determine first item. Collection is empty'); + if ($this->isEmpty()) { + throw new OutOfBoundsException('Can\'t determine first item. Collection is empty'); } - return $this->data[$firstIndex]; + reset($this->data); + + /** @var T $first */ + $first = current($this->data); + + return $first; } /** - * @return T - * - * @throws NoSuchElementException if this collection is empty. + * @inheritDoc */ - public function last(): mixed + public function last() { - $lastIndex = array_key_last($this->data); - - if ($lastIndex === null) { - throw new NoSuchElementException('Can\'t determine last item. Collection is empty'); + if ($this->isEmpty()) { + throw new OutOfBoundsException('Can\'t determine last item. Collection is empty'); } - return $this->data[$lastIndex]; + /** @var T $item */ + $item = end($this->data); + reset($this->data); + + return $item; } - /** - * @return CollectionInterface - * - * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist - * on the elements in this collection. - * @throws UnsupportedOperationException if unable to call sort() on this - * collection. - */ - public function sort(?string $propertyOrMethod = null, Sort $order = Sort::Ascending): CollectionInterface + public function sort(string $propertyOrMethod, string $order = self::SORT_ASC): CollectionInterface { + if (!in_array($order, [self::SORT_ASC, self::SORT_DESC], true)) { + throw new InvalidSortOrderException('Invalid sort order given: ' . $order); + } + $collection = clone $this; usort( $collection->data, - function (mixed $a, mixed $b) use ($propertyOrMethod, $order): int { + /** + * @param T $a + * @param T $b + */ + function ($a, $b) use ($propertyOrMethod, $order): int { + /** @var mixed $aValue */ $aValue = $this->extractValue($a, $propertyOrMethod); + + /** @var mixed $bValue */ $bValue = $this->extractValue($b, $propertyOrMethod); - return ($aValue <=> $bValue) * ($order === Sort::Descending ? -1 : 1); + return ($aValue <=> $bValue) * ($order === self::SORT_DESC ? -1 : 1); }, ); return $collection; } - /** - * @param callable(T): bool $callback A callable to use for filtering elements. - * - * @return CollectionInterface - */ public function filter(callable $callback): CollectionInterface { $collection = clone $this; @@ -189,56 +193,23 @@ public function filter(callable $callback): CollectionInterface } /** - * @return CollectionInterface - * - * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist - * on the elements in this collection. - * @throws UnsupportedOperationException if unable to call where() on this - * collection. + * {@inheritdoc} */ - public function where(?string $propertyOrMethod, mixed $value): CollectionInterface + public function where(string $propertyOrMethod, $value): CollectionInterface { - return $this->filter( - fn (mixed $item): bool => $this->extractValue($item, $propertyOrMethod) === $value, - ); + return $this->filter(function ($item) use ($propertyOrMethod, $value) { + /** @var mixed $accessorValue */ + $accessorValue = $this->extractValue($item, $propertyOrMethod); + + return $accessorValue === $value; + }); } - /** - * @param callable(T): TCallbackReturn $callback A callable to apply to each - * item of the collection. - * - * @return CollectionInterface - * - * @template TCallbackReturn - */ public function map(callable $callback): CollectionInterface { return new Collection('mixed', array_map($callback, $this->data)); } - /** - * @param callable(TCarry, T): TCarry $callback A callable to apply to each - * item of the collection to reduce it to a single value. - * @param TCarry $initial This is the initial value provided to the callback. - * - * @return TCarry - * - * @template TCarry - */ - public function reduce(callable $callback, mixed $initial): mixed - { - return array_reduce($this->data, $callback, $initial); - } - - /** - * @param CollectionInterface $other The collection to check for divergent - * items. - * - * @return CollectionInterface - * - * @throws CollectionMismatchException if the compared collections are of - * differing types. - */ public function diff(CollectionInterface $other): CollectionInterface { $this->compareCollectionTypes($other); @@ -246,40 +217,28 @@ public function diff(CollectionInterface $other): CollectionInterface $diffAtoB = array_udiff($this->data, $other->toArray(), $this->getComparator()); $diffBtoA = array_udiff($other->toArray(), $this->data, $this->getComparator()); + /** @var array $diff */ + $diff = array_merge($diffAtoB, $diffBtoA); + $collection = clone $this; - $collection->data = array_merge($diffAtoB, $diffBtoA); + $collection->data = $diff; return $collection; } - /** - * @param CollectionInterface $other The collection to check for - * intersecting items. - * - * @return CollectionInterface - * - * @throws CollectionMismatchException if the compared collections are of - * differing types. - */ public function intersect(CollectionInterface $other): CollectionInterface { $this->compareCollectionTypes($other); + /** @var array $intersect */ + $intersect = array_uintersect($this->data, $other->toArray(), $this->getComparator()); + $collection = clone $this; - $collection->data = array_uintersect($this->data, $other->toArray(), $this->getComparator()); + $collection->data = $intersect; return $collection; } - /** - * @param CollectionInterface ...$collections The collections to merge. - * - * @return CollectionInterface - * - * @throws CollectionMismatchException if unable to merge any of the given - * collections or items within the given collections due to type - * mismatch errors. - */ public function merge(CollectionInterface ...$collections): CollectionInterface { $mergedCollection = clone $this; @@ -315,10 +274,19 @@ public function merge(CollectionInterface ...$collections): CollectionInterface return $mergedCollection; } + /** + * @inheritDoc + */ + public function unserialize($serialized): void + { + /** @var array $data */ + $data = unserialize($serialized, ['allowed_classes' => [$this->getType()]]); + + $this->data = $data; + } + /** * @param CollectionInterface $other - * - * @throws CollectionMismatchException */ private function compareCollectionTypes(CollectionInterface $other): void { @@ -335,19 +303,23 @@ private function compareCollectionTypes(CollectionInterface $other): void private function getComparator(): Closure { - return function (mixed $a, mixed $b): int { - // If the two values are object, we convert them to unique scalars. - // If the collection contains mixed values (unlikely) where some are objects - // and some are not, we leave them as they are. - // The comparator should still work and the result of $a < $b should - // be consistent but unpredictable since not documented. - if (is_object($a) && is_object($b)) { - $a = spl_object_id($a); - $b = spl_object_id($b); - } + return /** + * @param T $a + * @param T $b + */ + function ($a, $b): int { + // If the two values are object, we convert them to unique scalars. + // If the collection contains mixed values (unlikely) where some are objects + // and some are not, we leave them as they are. + // The comparator should still work and the result of $a < $b should + // be consistent but unpredictable since not documented. + if (is_object($a) && is_object($b)) { + $a = spl_object_id($a); + $b = spl_object_id($b); + } - return $a === $b ? 0 : ($a < $b ? 1 : -1); - }; + return $a === $b ? 0 : ($a < $b ? 1 : -1); + }; } /** @@ -355,11 +327,15 @@ private function getComparator(): Closure */ private function getUniformType(CollectionInterface $collection): string { - return match ($collection->getType()) { - 'integer' => 'int', - 'boolean' => 'bool', - 'double' => 'float', - default => $collection->getType(), - }; + switch ($collection->getType()) { + case 'integer': + return 'int'; + case 'boolean': + return 'bool'; + case 'double': + return 'float'; + default: + return $collection->getType(); + } } } diff --git a/lib/Google/vendor/ramsey/collection/src/AbstractSet.php b/lib/Google/vendor/ramsey/collection/src/AbstractSet.php index 63f833156..1126ccb0a 100644 --- a/lib/Google/vendor/ramsey/collection/src/AbstractSet.php +++ b/lib/Google/vendor/ramsey/collection/src/AbstractSet.php @@ -24,23 +24,22 @@ */ abstract class AbstractSet extends AbstractCollection { - public function add(mixed $element): bool + /** + * @inheritDoc + */ + public function add($element): bool { if ($this->contains($element)) { return false; } - // Call offsetSet() on the parent instead of add(), since calling - // parent::add() will invoke $this->offsetSet(), which will call - // $this->contains() a second time. This can cause performance issues - // with extremely large collections. For more information, see - // https://github.com/ramsey/collection/issues/68. - parent::offsetSet(null, $element); - - return true; + return parent::add($element); } - public function offsetSet(mixed $offset, mixed $value): void + /** + * @inheritDoc + */ + public function offsetSet($offset, $value): void { if ($this->contains($value)) { return; diff --git a/lib/Google/vendor/ramsey/collection/src/ArrayInterface.php b/lib/Google/vendor/ramsey/collection/src/ArrayInterface.php index bc7f6f424..27af6102b 100644 --- a/lib/Google/vendor/ramsey/collection/src/ArrayInterface.php +++ b/lib/Google/vendor/ramsey/collection/src/ArrayInterface.php @@ -17,6 +17,7 @@ use ArrayAccess; use Countable; use IteratorAggregate; +use Serializable; /** * `ArrayInterface` provides traversable array functionality to data types. @@ -28,7 +29,8 @@ interface ArrayInterface extends ArrayAccess, Countable, - IteratorAggregate + IteratorAggregate, + Serializable { /** * Removes all items from this array. diff --git a/lib/Google/vendor/ramsey/collection/src/Collection.php b/lib/Google/vendor/ramsey/collection/src/Collection.php index 3b0f7689d..532b971b6 100644 --- a/lib/Google/vendor/ramsey/collection/src/Collection.php +++ b/lib/Google/vendor/ramsey/collection/src/Collection.php @@ -24,7 +24,7 @@ * * Example usage: * - * ``` + * ``` php * $collection = new \Ramsey\Collection\Collection('My\\Foo'); * $collection->add(new \My\Foo()); * $collection->add(new \My\Foo()); @@ -37,7 +37,7 @@ * It is preferable to subclass `AbstractCollection` to create your own typed * collections. For example: * - * ``` + * ``` php * namespace My\Foo; * * class FooCollection extends \Ramsey\Collection\AbstractCollection @@ -51,7 +51,7 @@ * * And then use it similarly to the earlier example: * - * ``` + * ``` php * $fooCollection = new \My\Foo\FooCollection(); * $fooCollection->add(new \My\Foo()); * $fooCollection->add(new \My\Foo()); @@ -64,7 +64,7 @@ * The benefit with this approach is that you may do type-checking on the * collection object: * - * ``` + * ``` php * if ($collection instanceof \My\Foo\FooCollection) { * // the collection is a collection of My\Foo objects * } @@ -75,16 +75,25 @@ */ class Collection extends AbstractCollection { + /** + * The type of elements stored in this collection. + * + * A collection's type is immutable once it is set. For this reason, this + * property is set private. + */ + private string $collectionType; + /** * Constructs a collection object of the specified type, optionally with the * specified data. * - * @param string $collectionType The type or class name associated with this + * @param string $collectionType The type (FQCN) associated with this * collection. * @param array $data The initial items to store in the collection. */ - public function __construct(private readonly string $collectionType, array $data = []) + public function __construct(string $collectionType, array $data = []) { + $this->collectionType = $collectionType; parent::__construct($data); } diff --git a/lib/Google/vendor/ramsey/collection/src/CollectionInterface.php b/lib/Google/vendor/ramsey/collection/src/CollectionInterface.php index 3ffbb1669..9f86a2837 100644 --- a/lib/Google/vendor/ramsey/collection/src/CollectionInterface.php +++ b/lib/Google/vendor/ramsey/collection/src/CollectionInterface.php @@ -14,14 +14,8 @@ namespace Ramsey\Collection; -use Ramsey\Collection\Exception\CollectionMismatchException; -use Ramsey\Collection\Exception\InvalidArgumentException; -use Ramsey\Collection\Exception\InvalidPropertyOrMethod; -use Ramsey\Collection\Exception\NoSuchElementException; -use Ramsey\Collection\Exception\UnsupportedOperationException; - /** - * A collection represents a group of values, known as its elements. + * A collection represents a group of objects, known as its elements. * * Some collections allow duplicate elements and others do not. Some are ordered * and others unordered. @@ -31,6 +25,16 @@ */ interface CollectionInterface extends ArrayInterface { + /** + * Ascending sort type. + */ + public const SORT_ASC = 'asc'; + + /** + * Descending sort type. + */ + public const SORT_DESC = 'desc'; + /** * Ensures that this collection contains the specified element (optional * operation). @@ -54,11 +58,9 @@ interface CollectionInterface extends ArrayInterface * @param T $element The element to add to the collection. * * @return bool `true` if this collection changed as a result of the call. - * - * @throws InvalidArgumentException if the collection refuses to add the - * $element for any reason other than that it already contains the element. */ - public function add(mixed $element): bool; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function add($element): bool; /** * Returns `true` if this collection contains the specified element. @@ -66,7 +68,8 @@ public function add(mixed $element): bool; * @param T $element The element to check whether the collection contains. * @param bool $strict Whether to perform a strict type check on the value. */ - public function contains(mixed $element, bool $strict = true): bool; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function contains($element, bool $strict = true): bool; /** * Returns the type associated with this collection. @@ -81,20 +84,15 @@ public function getType(): string; * * @return bool `true` if an element was removed as a result of this call. */ - public function remove(mixed $element): bool; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function remove($element): bool; /** - * Returns the values from the given property, method, or array key. + * Returns the values from the given property or method. * - * @param string $propertyOrMethod The name of the property, method, or - * array key to evaluate and return. + * @param string $propertyOrMethod The property or method name to filter by. * * @return list - * - * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist - * on the elements in this collection. - * @throws UnsupportedOperationException if unable to call column() on this - * collection. */ public function column(string $propertyOrMethod): array; @@ -102,41 +100,29 @@ public function column(string $propertyOrMethod): array; * Returns the first item of the collection. * * @return T - * - * @throws NoSuchElementException if this collection is empty. */ - public function first(): mixed; + public function first(); /** * Returns the last item of the collection. * * @return T - * - * @throws NoSuchElementException if this collection is empty. */ - public function last(): mixed; + public function last(); /** - * Sort the collection by a property, method, or array key with the given - * sort order. - * - * If $propertyOrMethod is `null`, this will sort by comparing each element. + * Sort the collection by a property or method with the given sort order. * * This will always leave the original collection untouched and will return * a new one. * - * @param string | null $propertyOrMethod The property, method, or array key - * to sort by. - * @param Sort $order The sort order for the resulting collection. + * @param string $propertyOrMethod The property or method to sort by. + * @param string $order The sort order for the resulting collection (one of + * this interface's `SORT_*` constants). * * @return CollectionInterface - * - * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist - * on the elements in this collection. - * @throws UnsupportedOperationException if unable to call sort() on this - * collection. */ - public function sort(?string $propertyOrMethod = null, Sort $order = Sort::Ascending): self; + public function sort(string $propertyOrMethod, string $order = self::SORT_ASC): self; /** * Filter out items of the collection which don't match the criteria of @@ -148,31 +134,25 @@ public function sort(?string $propertyOrMethod = null, Sort $order = Sort::Ascen * See the {@link http://php.net/manual/en/function.array-filter.php PHP array_filter() documentation} * for examples of how the `$callback` parameter works. * - * @param callable(T): bool $callback A callable to use for filtering elements. + * @param callable(T):bool $callback A callable to use for filtering elements. * * @return CollectionInterface */ public function filter(callable $callback): self; /** - * Create a new collection where the result of the given property, method, - * or array key of each item in the collection equals the given value. + * Create a new collection where items match the criteria of given callback. * * This will always leave the original collection untouched and will return * a new one. * - * @param string | null $propertyOrMethod The property, method, or array key - * to evaluate. If `null`, the element itself is compared to $value. + * @param string $propertyOrMethod The property or method to evaluate. * @param mixed $value The value to match. * * @return CollectionInterface - * - * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist - * on the elements in this collection. - * @throws UnsupportedOperationException if unable to call where() on this - * collection. */ - public function where(?string $propertyOrMethod, mixed $value): self; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function where(string $propertyOrMethod, $value): self; /** * Apply a given callback method on each item of the collection. @@ -184,7 +164,7 @@ public function where(?string $propertyOrMethod, mixed $value): self; * See the {@link http://php.net/manual/en/function.array-map.php PHP array_map() documentation} * for examples of how the `$callback` parameter works. * - * @param callable(T): TCallbackReturn $callback A callable to apply to each + * @param callable(T):TCallbackReturn $callback A callable to apply to each * item of the collection. * * @return CollectionInterface @@ -193,23 +173,6 @@ public function where(?string $propertyOrMethod, mixed $value): self; */ public function map(callable $callback): self; - /** - * Apply a given callback method on each item of the collection - * to reduce it to a single value. - * - * See the {@link http://php.net/manual/en/function.array-reduce.php PHP array_reduce() documentation} - * for examples of how the `$callback` and `$initial` parameters work. - * - * @param callable(TCarry, T): TCarry $callback A callable to apply to each - * item of the collection to reduce it to a single value. - * @param TCarry $initial This is the initial value provided to the callback. - * - * @return TCarry - * - * @template TCarry - */ - public function reduce(callable $callback, mixed $initial): mixed; - /** * Create a new collection with divergent items between current and given * collection. @@ -218,9 +181,6 @@ public function reduce(callable $callback, mixed $initial): mixed; * items. * * @return CollectionInterface - * - * @throws CollectionMismatchException if the compared collections are of - * differing types. */ public function diff(CollectionInterface $other): self; @@ -232,9 +192,6 @@ public function diff(CollectionInterface $other): self; * intersecting items. * * @return CollectionInterface - * - * @throws CollectionMismatchException if the compared collections are of - * differing types. */ public function intersect(CollectionInterface $other): self; @@ -244,10 +201,6 @@ public function intersect(CollectionInterface $other): self; * @param CollectionInterface ...$collections The collections to merge. * * @return CollectionInterface - * - * @throws CollectionMismatchException if unable to merge any of the given - * collections or items within the given collections due to type - * mismatch errors. */ public function merge(CollectionInterface ...$collections): self; } diff --git a/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueue.php b/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueue.php index 62947a24f..4d1f71ea4 100644 --- a/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueue.php +++ b/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueue.php @@ -17,10 +17,6 @@ use Ramsey\Collection\Exception\InvalidArgumentException; use Ramsey\Collection\Exception\NoSuchElementException; -use function array_key_last; -use function array_pop; -use function array_unshift; - /** * This class provides a basic implementation of `DoubleEndedQueueInterface`, to * minimize the effort required to implement this interface. @@ -32,21 +28,33 @@ class DoubleEndedQueue extends Queue implements DoubleEndedQueueInterface { /** - * Constructs a double-ended queue (dequeue) object of the specified type, - * optionally with the specified data. - * - * @param string $queueType The type or class name associated with this dequeue. - * @param array $data The initial items to store in the dequeue. + * Index of the last element in the queue. + */ + private int $tail = -1; + + /** + * @inheritDoc */ - public function __construct(private readonly string $queueType, array $data = []) + public function offsetSet($offset, $value): void { - parent::__construct($this->queueType, $data); + if ($this->checkType($this->getType(), $value) === false) { + throw new InvalidArgumentException( + 'Value must be of type ' . $this->getType() . '; value is ' + . $this->toolValueToString($value), + ); + } + + $this->tail++; + + $this->data[$this->tail] = $value; } /** * @throws InvalidArgumentException if $element is of the wrong type + * + * @inheritDoc */ - public function addFirst(mixed $element): bool + public function addFirst($element): bool { if ($this->checkType($this->getType(), $element) === false) { throw new InvalidArgumentException( @@ -55,112 +63,125 @@ public function addFirst(mixed $element): bool ); } - array_unshift($this->data, $element); + $this->index--; + + $this->data[$this->index] = $element; return true; } /** - * @throws InvalidArgumentException if $element is of the wrong type + * @inheritDoc */ - public function addLast(mixed $element): bool + public function addLast($element): bool { return $this->add($element); } - public function offerFirst(mixed $element): bool + /** + * @inheritDoc + */ + public function offerFirst($element): bool { try { return $this->addFirst($element); - } catch (InvalidArgumentException) { + } catch (InvalidArgumentException $e) { return false; } } - public function offerLast(mixed $element): bool + /** + * @inheritDoc + */ + public function offerLast($element): bool { return $this->offer($element); } /** - * @return T the first element in this queue. - * - * @throws NoSuchElementException if the queue is empty + * @inheritDoc */ - public function removeFirst(): mixed + public function removeFirst() { return $this->remove(); } /** - * @return T the last element in this queue. - * - * @throws NoSuchElementException if this queue is empty. + * @inheritDoc */ - public function removeLast(): mixed + public function removeLast() { - return $this->pollLast() ?? throw new NoSuchElementException( - 'Can\'t return element from Queue. Queue is empty.', - ); + $tail = $this->pollLast(); + + if ($tail === null) { + throw new NoSuchElementException('Can\'t return element from Queue. Queue is empty.'); + } + + return $tail; } /** - * @return T | null the head of this queue, or `null` if this queue is empty. + * @inheritDoc */ - public function pollFirst(): mixed + public function pollFirst() { return $this->poll(); } /** - * @return T | null the tail of this queue, or `null` if this queue is empty. + * @inheritDoc */ - public function pollLast(): mixed + public function pollLast() { - return array_pop($this->data); + if ($this->count() === 0) { + return null; + } + + $tail = $this[$this->tail]; + + unset($this[$this->tail]); + $this->tail--; + + return $tail; } /** - * @return T the head of this queue. - * - * @throws NoSuchElementException if this queue is empty. + * @inheritDoc */ - public function firstElement(): mixed + public function firstElement() { return $this->element(); } /** - * @return T the tail of this queue. - * - * @throws NoSuchElementException if this queue is empty. + * @inheritDoc */ - public function lastElement(): mixed + public function lastElement() { - return $this->peekLast() ?? throw new NoSuchElementException( - 'Can\'t return element from Queue. Queue is empty.', - ); + if ($this->count() === 0) { + throw new NoSuchElementException('Can\'t return element from Queue. Queue is empty.'); + } + + return $this->data[$this->tail]; } /** - * @return T | null the head of this queue, or `null` if this queue is empty. + * @inheritDoc */ - public function peekFirst(): mixed + public function peekFirst() { return $this->peek(); } /** - * @return T | null the tail of this queue, or `null` if this queue is empty. + * @inheritDoc */ - public function peekLast(): mixed + public function peekLast() { - $lastIndex = array_key_last($this->data); - - if ($lastIndex === null) { + if ($this->count() === 0) { return null; } - return $this->data[$lastIndex]; + return $this->data[$this->tail]; } } diff --git a/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php b/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php index 15cc0e97b..3fa4ecab8 100644 --- a/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php +++ b/lib/Google/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php @@ -181,7 +181,8 @@ interface DoubleEndedQueueInterface extends QueueInterface * Implementations should use a more-specific exception that extends * `\RuntimeException`. */ - public function addFirst(mixed $element): bool; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function addFirst($element): bool; /** * Inserts the specified element at the end of this queue if it is possible @@ -201,7 +202,8 @@ public function addFirst(mixed $element): bool; * Implementations should use a more-specific exception that extends * `\RuntimeException`. */ - public function addLast(mixed $element): bool; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function addLast($element): bool; /** * Inserts the specified element at the front of this queue if it is @@ -215,7 +217,8 @@ public function addLast(mixed $element): bool; * * @return bool `true` if the element was added to this queue, else `false`. */ - public function offerFirst(mixed $element): bool; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function offerFirst($element): bool; /** * Inserts the specified element at the end of this queue if it is possible @@ -229,7 +232,8 @@ public function offerFirst(mixed $element): bool; * * @return bool `true` if the element was added to this queue, else `false`. */ - public function offerLast(mixed $element): bool; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function offerLast($element): bool; /** * Retrieves and removes the head of this queue. @@ -241,7 +245,7 @@ public function offerLast(mixed $element): bool; * * @throws NoSuchElementException if this queue is empty. */ - public function removeFirst(): mixed; + public function removeFirst(); /** * Retrieves and removes the tail of this queue. @@ -253,23 +257,23 @@ public function removeFirst(): mixed; * * @throws NoSuchElementException if this queue is empty. */ - public function removeLast(): mixed; + public function removeLast(); /** * Retrieves and removes the head of this queue, or returns `null` if this * queue is empty. * - * @return T | null the head of this queue, or `null` if this queue is empty. + * @return T|null the head of this queue, or `null` if this queue is empty. */ - public function pollFirst(): mixed; + public function pollFirst(); /** * Retrieves and removes the tail of this queue, or returns `null` if this * queue is empty. * - * @return T | null the tail of this queue, or `null` if this queue is empty. + * @return T|null the tail of this queue, or `null` if this queue is empty. */ - public function pollLast(): mixed; + public function pollLast(); /** * Retrieves, but does not remove, the head of this queue. @@ -281,7 +285,7 @@ public function pollLast(): mixed; * * @throws NoSuchElementException if this queue is empty. */ - public function firstElement(): mixed; + public function firstElement(); /** * Retrieves, but does not remove, the tail of this queue. @@ -293,21 +297,21 @@ public function firstElement(): mixed; * * @throws NoSuchElementException if this queue is empty. */ - public function lastElement(): mixed; + public function lastElement(); /** * Retrieves, but does not remove, the head of this queue, or returns `null` * if this queue is empty. * - * @return T | null the head of this queue, or `null` if this queue is empty. + * @return T|null the head of this queue, or `null` if this queue is empty. */ - public function peekFirst(): mixed; + public function peekFirst(); /** * Retrieves, but does not remove, the tail of this queue, or returns `null` * if this queue is empty. * - * @return T | null the tail of this queue, or `null` if this queue is empty. + * @return T|null the tail of this queue, or `null` if this queue is empty. */ - public function peekLast(): mixed; + public function peekLast(); } diff --git a/lib/Google/vendor/ramsey/collection/src/Exception/CollectionMismatchException.php b/lib/Google/vendor/ramsey/collection/src/Exception/CollectionMismatchException.php index 42f5be2df..7058bcf6e 100644 --- a/lib/Google/vendor/ramsey/collection/src/Exception/CollectionMismatchException.php +++ b/lib/Google/vendor/ramsey/collection/src/Exception/CollectionMismatchException.php @@ -19,6 +19,6 @@ /** * Thrown when attempting to operate on collections of differing types. */ -class CollectionMismatchException extends RuntimeException implements CollectionException +class CollectionMismatchException extends RuntimeException { } diff --git a/lib/Google/vendor/ramsey/collection/src/Exception/InvalidArgumentException.php b/lib/Google/vendor/ramsey/collection/src/Exception/InvalidArgumentException.php index 7b41b4a7c..dcc3eac60 100644 --- a/lib/Google/vendor/ramsey/collection/src/Exception/InvalidArgumentException.php +++ b/lib/Google/vendor/ramsey/collection/src/Exception/InvalidArgumentException.php @@ -14,11 +14,9 @@ namespace Ramsey\Collection\Exception; -use InvalidArgumentException as PhpInvalidArgumentException; - /** * Thrown to indicate an argument is not of the expected type. */ -class InvalidArgumentException extends PhpInvalidArgumentException implements CollectionException +class InvalidArgumentException extends \InvalidArgumentException { } diff --git a/lib/Google/vendor/ramsey/collection/src/Exception/CollectionException.php b/lib/Google/vendor/ramsey/collection/src/Exception/InvalidSortOrderException.php similarity index 70% rename from lib/Google/vendor/ramsey/collection/src/Exception/CollectionException.php rename to lib/Google/vendor/ramsey/collection/src/Exception/InvalidSortOrderException.php index 4aa92bed8..4491429c7 100644 --- a/lib/Google/vendor/ramsey/collection/src/Exception/CollectionException.php +++ b/lib/Google/vendor/ramsey/collection/src/Exception/InvalidSortOrderException.php @@ -14,8 +14,11 @@ namespace Ramsey\Collection\Exception; -use Throwable; +use RuntimeException; -interface CollectionException extends Throwable +/** + * Thrown when attempting to use a sort order that is not recognized. + */ +class InvalidSortOrderException extends RuntimeException { } diff --git a/lib/Google/vendor/ramsey/collection/src/Exception/NoSuchElementException.php b/lib/Google/vendor/ramsey/collection/src/Exception/NoSuchElementException.php index cd98f0c0f..cabcb9d88 100644 --- a/lib/Google/vendor/ramsey/collection/src/Exception/NoSuchElementException.php +++ b/lib/Google/vendor/ramsey/collection/src/Exception/NoSuchElementException.php @@ -19,6 +19,6 @@ /** * Thrown when attempting to access an element that does not exist. */ -class NoSuchElementException extends RuntimeException implements CollectionException +class NoSuchElementException extends RuntimeException { } diff --git a/lib/Google/vendor/ramsey/collection/src/Exception/OutOfBoundsException.php b/lib/Google/vendor/ramsey/collection/src/Exception/OutOfBoundsException.php index c75294e53..4e9d16fa3 100644 --- a/lib/Google/vendor/ramsey/collection/src/Exception/OutOfBoundsException.php +++ b/lib/Google/vendor/ramsey/collection/src/Exception/OutOfBoundsException.php @@ -14,11 +14,9 @@ namespace Ramsey\Collection\Exception; -use OutOfBoundsException as PhpOutOfBoundsException; - /** * Thrown when attempting to access an element out of the range of the collection. */ -class OutOfBoundsException extends PhpOutOfBoundsException implements CollectionException +class OutOfBoundsException extends \OutOfBoundsException { } diff --git a/lib/Google/vendor/ramsey/collection/src/Exception/UnsupportedOperationException.php b/lib/Google/vendor/ramsey/collection/src/Exception/UnsupportedOperationException.php index d074f45fd..9b6228971 100644 --- a/lib/Google/vendor/ramsey/collection/src/Exception/UnsupportedOperationException.php +++ b/lib/Google/vendor/ramsey/collection/src/Exception/UnsupportedOperationException.php @@ -19,6 +19,6 @@ /** * Thrown to indicate that the requested operation is not supported. */ -class UnsupportedOperationException extends RuntimeException implements CollectionException +class UnsupportedOperationException extends RuntimeException { } diff --git a/lib/Google/vendor/ramsey/collection/src/Exception/InvalidPropertyOrMethod.php b/lib/Google/vendor/ramsey/collection/src/Exception/ValueExtractionException.php similarity index 62% rename from lib/Google/vendor/ramsey/collection/src/Exception/InvalidPropertyOrMethod.php rename to lib/Google/vendor/ramsey/collection/src/Exception/ValueExtractionException.php index a53be14aa..32f2a175f 100644 --- a/lib/Google/vendor/ramsey/collection/src/Exception/InvalidPropertyOrMethod.php +++ b/lib/Google/vendor/ramsey/collection/src/Exception/ValueExtractionException.php @@ -17,10 +17,8 @@ use RuntimeException; /** - * Thrown when attempting to evaluate a property, method, or array key - * that doesn't exist on an element or cannot otherwise be evaluated in the - * current context. + * Thrown when attempting to extract a value for a method or property that does not exist. */ -class InvalidPropertyOrMethod extends RuntimeException implements CollectionException +class ValueExtractionException extends RuntimeException { } diff --git a/lib/Google/vendor/ramsey/collection/src/Map/AbstractMap.php b/lib/Google/vendor/ramsey/collection/src/Map/AbstractMap.php index 92f23e605..378807289 100644 --- a/lib/Google/vendor/ramsey/collection/src/Map/AbstractMap.php +++ b/lib/Google/vendor/ramsey/collection/src/Map/AbstractMap.php @@ -16,7 +16,6 @@ use Ramsey\Collection\AbstractArray; use Ramsey\Collection\Exception\InvalidArgumentException; -use Traversable; use function array_key_exists; use function array_keys; @@ -27,36 +26,16 @@ * This class provides a basic implementation of `MapInterface`, to minimize the * effort required to implement this interface. * - * @template K of array-key * @template T * @extends AbstractArray - * @implements MapInterface + * @implements MapInterface */ abstract class AbstractMap extends AbstractArray implements MapInterface { /** - * @param array $data The initial items to add to this map. - */ - public function __construct(array $data = []) - { - parent::__construct($data); - } - - /** - * @return Traversable - */ - public function getIterator(): Traversable - { - return parent::getIterator(); - } - - /** - * @param K $offset The offset to set - * @param T $value The value to set at the given offset. - * * @inheritDoc */ - public function offsetSet(mixed $offset, mixed $value): void + public function offsetSet($offset, $value): void { if ($offset === null) { throw new InvalidArgumentException( @@ -68,12 +47,18 @@ public function offsetSet(mixed $offset, mixed $value): void $this->data[$offset] = $value; } - public function containsKey(int | string $key): bool + /** + * @inheritDoc + */ + public function containsKey($key): bool { return array_key_exists($key, $this->data); } - public function containsValue(mixed $value): bool + /** + * @inheritDoc + */ + public function containsValue($value): bool { return in_array($value, $this->data, true); } @@ -83,29 +68,25 @@ public function containsValue(mixed $value): bool */ public function keys(): array { - /** @var list */ return array_keys($this->data); } /** - * @param K $key The key to return from the map. - * @param T | null $defaultValue The default value to use if `$key` is not found. - * - * @return T | null the value or `null` if the key could not be found. + * @inheritDoc */ - public function get(int | string $key, mixed $defaultValue = null): mixed + public function get($key, $defaultValue = null) { - return $this[$key] ?? $defaultValue; + if (!$this->containsKey($key)) { + return $defaultValue; + } + + return $this[$key]; } /** - * @param K $key The key to put or replace in the map. - * @param T $value The value to store at `$key`. - * - * @return T | null the previous value associated with key, or `null` if - * there was no mapping for `$key`. + * @inheritDoc */ - public function put(int | string $key, mixed $value): mixed + public function put($key, $value) { $previousValue = $this->get($key); $this[$key] = $value; @@ -114,13 +95,9 @@ public function put(int | string $key, mixed $value): mixed } /** - * @param K $key The key to put in the map. - * @param T $value The value to store at `$key`. - * - * @return T | null the previous value associated with key, or `null` if - * there was no mapping for `$key`. + * @inheritDoc */ - public function putIfAbsent(int | string $key, mixed $value): mixed + public function putIfAbsent($key, $value) { $currentValue = $this->get($key); @@ -132,12 +109,9 @@ public function putIfAbsent(int | string $key, mixed $value): mixed } /** - * @param K $key The key to remove from the map. - * - * @return T | null the previous value associated with key, or `null` if - * there was no mapping for `$key`. + * @inheritDoc */ - public function remove(int | string $key): mixed + public function remove($key) { $previousValue = $this->get($key); unset($this[$key]); @@ -145,7 +119,10 @@ public function remove(int | string $key): mixed return $previousValue; } - public function removeIf(int | string $key, mixed $value): bool + /** + * @inheritDoc + */ + public function removeIf($key, $value): bool { if ($this->get($key) === $value) { unset($this[$key]); @@ -157,13 +134,9 @@ public function removeIf(int | string $key, mixed $value): bool } /** - * @param K $key The key to replace. - * @param T $value The value to set at `$key`. - * - * @return T | null the previous value associated with key, or `null` if - * there was no mapping for `$key`. + * @inheritDoc */ - public function replace(int | string $key, mixed $value): mixed + public function replace($key, $value) { $currentValue = $this->get($key); @@ -174,7 +147,10 @@ public function replace(int | string $key, mixed $value): mixed return $currentValue; } - public function replaceIf(int | string $key, mixed $oldValue, mixed $newValue): bool + /** + * @inheritDoc + */ + public function replaceIf($key, $oldValue, $newValue): bool { if ($this->get($key) === $oldValue) { $this[$key] = $newValue; @@ -184,22 +160,4 @@ public function replaceIf(int | string $key, mixed $oldValue, mixed $newValue): return false; } - - /** - * @return array - */ - public function __serialize(): array - { - /** @var array */ - return parent::__serialize(); - } - - /** - * @return array - */ - public function toArray(): array - { - /** @var array */ - return parent::toArray(); - } } diff --git a/lib/Google/vendor/ramsey/collection/src/Map/AbstractTypedMap.php b/lib/Google/vendor/ramsey/collection/src/Map/AbstractTypedMap.php index 8b6cc0484..486dc2e29 100644 --- a/lib/Google/vendor/ramsey/collection/src/Map/AbstractTypedMap.php +++ b/lib/Google/vendor/ramsey/collection/src/Map/AbstractTypedMap.php @@ -18,14 +18,16 @@ use Ramsey\Collection\Tool\TypeTrait; use Ramsey\Collection\Tool\ValueToStringTrait; +use function var_export; + /** * This class provides a basic implementation of `TypedMapInterface`, to * minimize the effort required to implement this interface. * * @template K of array-key * @template T - * @extends AbstractMap - * @implements TypedMapInterface + * @extends AbstractMap + * @implements TypedMapInterface */ abstract class AbstractTypedMap extends AbstractMap implements TypedMapInterface { @@ -33,13 +35,20 @@ abstract class AbstractTypedMap extends AbstractMap implements TypedMapInterface use ValueToStringTrait; /** - * @param K $offset + * @param K|null $offset * @param T $value * * @inheritDoc */ - public function offsetSet(mixed $offset, mixed $value): void + public function offsetSet($offset, $value): void { + if ($offset === null) { + throw new InvalidArgumentException( + 'Map elements are key/value pairs; a key must be provided for ' + . 'value ' . var_export($value, true), + ); + } + if ($this->checkType($this->getKeyType(), $offset) === false) { throw new InvalidArgumentException( 'Key must be of type ' . $this->getKeyType() . '; key is ' diff --git a/lib/Google/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php b/lib/Google/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php index 34e4e853b..79a314d96 100644 --- a/lib/Google/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php +++ b/lib/Google/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php @@ -17,7 +17,8 @@ /** * `AssociativeArrayMap` represents a standard associative array object. * - * @extends AbstractMap + * @template T + * @extends AbstractMap */ class AssociativeArrayMap extends AbstractMap { diff --git a/lib/Google/vendor/ramsey/collection/src/Map/MapInterface.php b/lib/Google/vendor/ramsey/collection/src/Map/MapInterface.php index 22ba1bdd1..6ed0b2967 100644 --- a/lib/Google/vendor/ramsey/collection/src/Map/MapInterface.php +++ b/lib/Google/vendor/ramsey/collection/src/Map/MapInterface.php @@ -21,7 +21,6 @@ * * A map cannot contain duplicate keys; each key can map to at most one value. * - * @template K of array-key * @template T * @extends ArrayInterface */ @@ -30,9 +29,9 @@ interface MapInterface extends ArrayInterface /** * Returns `true` if this map contains a mapping for the specified key. * - * @param K $key The key to check in the map. + * @param array-key $key The key to check in the map. */ - public function containsKey(int | string $key): bool; + public function containsKey($key): bool; /** * Returns `true` if this map maps one or more keys to the specified value. @@ -41,12 +40,13 @@ public function containsKey(int | string $key): bool; * * @param T $value The value to check in the map. */ - public function containsValue(mixed $value): bool; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function containsValue($value): bool; /** * Return an array of the keys contained in this map. * - * @return list + * @return list */ public function keys(): array; @@ -55,12 +55,13 @@ public function keys(): array; * map contains no mapping for the key, or (optionally) `$defaultValue` if * this map contains no mapping for the key. * - * @param K $key The key to return from the map. - * @param T | null $defaultValue The default value to use if `$key` is not found. + * @param array-key $key The key to return from the map. + * @param T|null $defaultValue The default value to use if `$key` is not found. * - * @return T | null the value or `null` if the key could not be found. + * @return T|null the value or `null` if the key could not be found. */ - public function get(int | string $key, mixed $defaultValue = null): mixed; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function get($key, $defaultValue = null); /** * Associates the specified value with the specified key in this map. @@ -68,13 +69,14 @@ public function get(int | string $key, mixed $defaultValue = null): mixed; * If the map previously contained a mapping for the key, the old value is * replaced by the specified value. * - * @param K $key The key to put or replace in the map. + * @param array-key $key The key to put or replace in the map. * @param T $value The value to store at `$key`. * - * @return T | null the previous value associated with key, or `null` if + * @return T|null the previous value associated with key, or `null` if * there was no mapping for `$key`. */ - public function put(int | string $key, mixed $value): mixed; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function put($key, $value); /** * Associates the specified value with the specified key in this map only if @@ -83,23 +85,25 @@ public function put(int | string $key, mixed $value): mixed; * If there is already a value associated with `$key`, this returns that * value without replacing it. * - * @param K $key The key to put in the map. + * @param array-key $key The key to put in the map. * @param T $value The value to store at `$key`. * - * @return T | null the previous value associated with key, or `null` if + * @return T|null the previous value associated with key, or `null` if * there was no mapping for `$key`. */ - public function putIfAbsent(int | string $key, mixed $value): mixed; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function putIfAbsent($key, $value); /** * Removes the mapping for a key from this map if it is present. * - * @param K $key The key to remove from the map. + * @param array-key $key The key to remove from the map. * - * @return T | null the previous value associated with key, or `null` if + * @return T|null the previous value associated with key, or `null` if * there was no mapping for `$key`. */ - public function remove(int | string $key): mixed; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function remove($key); /** * Removes the entry for the specified key only if it is currently mapped to @@ -107,24 +111,26 @@ public function remove(int | string $key): mixed; * * This performs a strict type check on the value. * - * @param K $key The key to remove from the map. + * @param array-key $key The key to remove from the map. * @param T $value The value to match. * * @return bool true if the value was removed. */ - public function removeIf(int | string $key, mixed $value): bool; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function removeIf($key, $value): bool; /** * Replaces the entry for the specified key only if it is currently mapped * to some value. * - * @param K $key The key to replace. + * @param array-key $key The key to replace. * @param T $value The value to set at `$key`. * - * @return T | null the previous value associated with key, or `null` if + * @return T|null the previous value associated with key, or `null` if * there was no mapping for `$key`. */ - public function replace(int | string $key, mixed $value): mixed; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function replace($key, $value); /** * Replaces the entry for the specified key only if currently mapped to the @@ -132,11 +138,12 @@ public function replace(int | string $key, mixed $value): mixed; * * This performs a strict type check on the value. * - * @param K $key The key to remove from the map. + * @param array-key $key The key to remove from the map. * @param T $oldValue The value to match. * @param T $newValue The value to use as a replacement. * * @return bool true if the value was replaced. */ - public function replaceIf(int | string $key, mixed $oldValue, mixed $newValue): bool; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function replaceIf($key, $oldValue, $newValue): bool; } diff --git a/lib/Google/vendor/ramsey/collection/src/Map/NamedParameterMap.php b/lib/Google/vendor/ramsey/collection/src/Map/NamedParameterMap.php index f948e476c..6e391e970 100644 --- a/lib/Google/vendor/ramsey/collection/src/Map/NamedParameterMap.php +++ b/lib/Google/vendor/ramsey/collection/src/Map/NamedParameterMap.php @@ -21,12 +21,13 @@ use function array_combine; use function array_key_exists; use function is_int; +use function var_export; /** * `NamedParameterMap` represents a mapping of values to a set of named keys * that may optionally be typed * - * @extends AbstractMap + * @extends AbstractMap */ class NamedParameterMap extends AbstractMap { @@ -38,13 +39,13 @@ class NamedParameterMap extends AbstractMap * * @var array */ - private readonly array $namedParameters; + protected array $namedParameters; /** * Constructs a new `NamedParameterMap`. * * @param array $namedParameters The named parameters defined for this map. - * @param array $data An initial set of data to set on this map. + * @param array $data An initial set of data to set on this map. */ public function __construct(array $namedParameters, array $data = []) { @@ -62,12 +63,22 @@ public function getNamedParameters(): array return $this->namedParameters; } - public function offsetSet(mixed $offset, mixed $value): void + /** + * @inheritDoc + */ + public function offsetSet($offset, $value): void { + if ($offset === null) { + throw new InvalidArgumentException( + 'Map elements are key/value pairs; a key must be provided for ' + . 'value ' . var_export($value, true), + ); + } + if (!array_key_exists($offset, $this->namedParameters)) { throw new InvalidArgumentException( 'Attempting to set value for unconfigured parameter \'' - . $this->toolValueToString($offset) . '\'', + . $offset . '\'', ); } diff --git a/lib/Google/vendor/ramsey/collection/src/Map/TypedMap.php b/lib/Google/vendor/ramsey/collection/src/Map/TypedMap.php index 4a090c812..77ef8d314 100644 --- a/lib/Google/vendor/ramsey/collection/src/Map/TypedMap.php +++ b/lib/Google/vendor/ramsey/collection/src/Map/TypedMap.php @@ -14,6 +14,8 @@ namespace Ramsey\Collection\Map; +use Ramsey\Collection\Tool\TypeTrait; + /** * A `TypedMap` represents a map of elements where key and value are typed. * @@ -29,7 +31,7 @@ * * Example usage: * - * ``` + * ```php * $map = new TypedMap('string', Foo::class); * $map['x'] = new Foo(); * foreach ($map as $key => $value) { @@ -51,7 +53,7 @@ * It is preferable to subclass `AbstractTypedMap` to create your own typed map * implementation: * - * ``` + * ```php * class FooTypedMap extends AbstractTypedMap * { * public function getKeyType() @@ -68,7 +70,7 @@ * * … but you also may use the `TypedMap` class: * - * ``` + * ```php * class FooTypedMap extends TypedMap * { * public function __constructor(array $data = []) @@ -84,6 +86,24 @@ */ class TypedMap extends AbstractTypedMap { + use TypeTrait; + + /** + * The data type of keys stored in this collection. + * + * A map key's type is immutable once it is set. For this reason, this + * property is set private. + */ + private string $keyType; + + /** + * The data type of values stored in this collection. + * + * A map value's type is immutable once it is set. For this reason, this + * property is set private. + */ + private string $valueType; + /** * Constructs a map object of the specified key and value types, * optionally with the specified data. @@ -92,11 +112,11 @@ class TypedMap extends AbstractTypedMap * @param string $valueType The data type of the map's values. * @param array $data The initial data to set for this map. */ - public function __construct( - private readonly string $keyType, - private readonly string $valueType, - array $data = [], - ) { + public function __construct(string $keyType, string $valueType, array $data = []) + { + $this->keyType = $keyType; + $this->valueType = $valueType; + parent::__construct($data); } diff --git a/lib/Google/vendor/ramsey/collection/src/Map/TypedMapInterface.php b/lib/Google/vendor/ramsey/collection/src/Map/TypedMapInterface.php index 5a44f0647..0308109cc 100644 --- a/lib/Google/vendor/ramsey/collection/src/Map/TypedMapInterface.php +++ b/lib/Google/vendor/ramsey/collection/src/Map/TypedMapInterface.php @@ -18,9 +18,8 @@ * A `TypedMapInterface` represents a map of elements where key and value are * typed. * - * @template K of array-key * @template T - * @extends MapInterface + * @extends MapInterface */ interface TypedMapInterface extends MapInterface { diff --git a/lib/Google/vendor/ramsey/collection/src/Queue.php b/lib/Google/vendor/ramsey/collection/src/Queue.php index 0f5b33740..bc8c24e1c 100644 --- a/lib/Google/vendor/ramsey/collection/src/Queue.php +++ b/lib/Google/vendor/ramsey/collection/src/Queue.php @@ -19,8 +19,6 @@ use Ramsey\Collection\Tool\TypeTrait; use Ramsey\Collection\Tool\ValueToStringTrait; -use function array_key_first; - /** * This class provides a basic implementation of `QueueInterface`, to minimize * the effort required to implement this interface. @@ -34,15 +32,29 @@ class Queue extends AbstractArray implements QueueInterface use TypeTrait; use ValueToStringTrait; + /** + * The type of elements stored in this queue. + * + * A queue's type is immutable once it is set. For this reason, this + * property is set private. + */ + private string $queueType; + + /** + * The index of the head of the queue. + */ + protected int $index = 0; + /** * Constructs a queue object of the specified type, optionally with the * specified data. * - * @param string $queueType The type or class name associated with this queue. - * @param array $data The initial items to store in the queue. + * @param string $queueType The type (FQCN) associated with this queue. + * @param array $data The initial items to store in the collection. */ - public function __construct(private readonly string $queueType, array $data = []) + public function __construct(string $queueType, array $data = []) { + $this->queueType = $queueType; parent::__construct($data); } @@ -53,9 +65,9 @@ public function __construct(private readonly string $queueType, array $data = [] * serves only to fulfill the `ArrayAccess` interface requirements. It is * invoked by other operations when adding values to the queue. * - * @throws InvalidArgumentException if $value is of the wrong type. + * @throws InvalidArgumentException if $value is of the wrong type */ - public function offsetSet(mixed $offset, mixed $value): void + public function offsetSet($offset, $value): void { if ($this->checkType($this->getType(), $value) === false) { throw new InvalidArgumentException( @@ -68,9 +80,11 @@ public function offsetSet(mixed $offset, mixed $value): void } /** - * @throws InvalidArgumentException if $value is of the wrong type. + * @throws InvalidArgumentException if $value is of the wrong type + * + * @inheritDoc */ - public function add(mixed $element): bool + public function add($element): bool { $this[] = $element; @@ -78,67 +92,74 @@ public function add(mixed $element): bool } /** - * @return T - * - * @throws NoSuchElementException if this queue is empty. + * @inheritDoc */ - public function element(): mixed + public function element() { - return $this->peek() ?? throw new NoSuchElementException( - 'Can\'t return element from Queue. Queue is empty.', - ); + $element = $this->peek(); + + if ($element === null) { + throw new NoSuchElementException( + 'Can\'t return element from Queue. Queue is empty.', + ); + } + + return $element; } - public function offer(mixed $element): bool + /** + * @inheritDoc + */ + public function offer($element): bool { try { return $this->add($element); - } catch (InvalidArgumentException) { + } catch (InvalidArgumentException $e) { return false; } } /** - * @return T | null + * @inheritDoc */ - public function peek(): mixed + public function peek() { - $index = array_key_first($this->data); - - if ($index === null) { + if ($this->count() === 0) { return null; } - return $this[$index]; + return $this[$this->index]; } /** - * @return T | null + * @inheritDoc */ - public function poll(): mixed + public function poll() { - $index = array_key_first($this->data); - - if ($index === null) { + if ($this->count() === 0) { return null; } - $head = $this[$index]; - unset($this[$index]); + $head = $this[$this->index]; + + unset($this[$this->index]); + $this->index++; return $head; } /** - * @return T - * - * @throws NoSuchElementException if this queue is empty. + * @inheritDoc */ - public function remove(): mixed + public function remove() { - return $this->poll() ?? throw new NoSuchElementException( - 'Can\'t return element from Queue. Queue is empty.', - ); + $head = $this->poll(); + + if ($head === null) { + throw new NoSuchElementException('Can\'t return element from Queue. Queue is empty.'); + } + + return $head; } public function getType(): string diff --git a/lib/Google/vendor/ramsey/collection/src/QueueInterface.php b/lib/Google/vendor/ramsey/collection/src/QueueInterface.php index f29ce43ab..4f91487fa 100644 --- a/lib/Google/vendor/ramsey/collection/src/QueueInterface.php +++ b/lib/Google/vendor/ramsey/collection/src/QueueInterface.php @@ -129,7 +129,8 @@ interface QueueInterface extends ArrayInterface * Implementations should use a more-specific exception that extends * `\RuntimeException`. */ - public function add(mixed $element): bool; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function add($element): bool; /** * Retrieves, but does not remove, the head of this queue. @@ -143,7 +144,7 @@ public function add(mixed $element): bool; * * @throws NoSuchElementException if this queue is empty. */ - public function element(): mixed; + public function element(); /** * Inserts the specified element into this queue if it is possible to do so @@ -159,7 +160,8 @@ public function element(): mixed; * * @return bool `true` if the element was added to this queue, else `false`. */ - public function offer(mixed $element): bool; + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function offer($element): bool; /** * Retrieves, but does not remove, the head of this queue, or returns `null` @@ -167,9 +169,9 @@ public function offer(mixed $element): bool; * * @see self::element() * - * @return T | null the head of this queue, or `null` if this queue is empty. + * @return T|null the head of this queue, or `null` if this queue is empty. */ - public function peek(): mixed; + public function peek(); /** * Retrieves and removes the head of this queue, or returns `null` @@ -177,9 +179,9 @@ public function peek(): mixed; * * @see self::remove() * - * @return T | null the head of this queue, or `null` if this queue is empty. + * @return T|null the head of this queue, or `null` if this queue is empty. */ - public function poll(): mixed; + public function poll(); /** * Retrieves and removes the head of this queue. @@ -193,7 +195,7 @@ public function poll(): mixed; * * @throws NoSuchElementException if this queue is empty. */ - public function remove(): mixed; + public function remove(); /** * Returns the type associated with this queue. diff --git a/lib/Google/vendor/ramsey/collection/src/Set.php b/lib/Google/vendor/ramsey/collection/src/Set.php index d60f2487a..c1d37ccca 100644 --- a/lib/Google/vendor/ramsey/collection/src/Set.php +++ b/lib/Google/vendor/ramsey/collection/src/Set.php @@ -24,11 +24,11 @@ * * Example usage: * - * ``` + * ``` php * $foo = new \My\Foo(); * $set = new Set(\My\Foo::class); * - * $set->add($foo); // returns TRUE, the element doesn't exist + * $set->add($foo); // returns TRUE, the element don't exists * $set->add($foo); // returns FALSE, the element already exists * * $bar = new \My\Foo(); @@ -40,15 +40,23 @@ */ class Set extends AbstractSet { + /** + * The type of elements stored in this set + * + * A set's type is immutable. For this reason, this property is private. + */ + private string $setType; + /** * Constructs a set object of the specified type, optionally with the * specified data. * - * @param string $setType The type or class name associated with this set. + * @param string $setType The type (FQCN) associated with this set. * @param array $data The initial items to store in the set. */ - public function __construct(private readonly string $setType, array $data = []) + public function __construct(string $setType, array $data = []) { + $this->setType = $setType; parent::__construct($data); } diff --git a/lib/Google/vendor/ramsey/collection/src/Sort.php b/lib/Google/vendor/ramsey/collection/src/Sort.php deleted file mode 100644 index 0c3c19213..000000000 --- a/lib/Google/vendor/ramsey/collection/src/Sort.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @license http://opensource.org/licenses/MIT MIT - */ - -declare(strict_types=1); - -namespace Ramsey\Collection; - -/** - * Collection sorting - */ -enum Sort: string -{ - /** - * Sort items in a collection in ascending order. - */ - case Ascending = 'asc'; - - /** - * Sort items in a collection in descending order. - */ - case Descending = 'desc'; -} diff --git a/lib/Google/vendor/ramsey/collection/src/Tool/TypeTrait.php b/lib/Google/vendor/ramsey/collection/src/Tool/TypeTrait.php index ac51b7f10..728d44b65 100644 --- a/lib/Google/vendor/ramsey/collection/src/Tool/TypeTrait.php +++ b/lib/Google/vendor/ramsey/collection/src/Tool/TypeTrait.php @@ -36,22 +36,39 @@ trait TypeTrait * @param string $type The type to check the value against. * @param mixed $value The value to check. */ - protected function checkType(string $type, mixed $value): bool + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + protected function checkType(string $type, $value): bool { - return match ($type) { - 'array' => is_array($value), - 'bool', 'boolean' => is_bool($value), - 'callable' => is_callable($value), - 'float', 'double' => is_float($value), - 'int', 'integer' => is_int($value), - 'null' => $value === null, - 'numeric' => is_numeric($value), - 'object' => is_object($value), - 'resource' => is_resource($value), - 'scalar' => is_scalar($value), - 'string' => is_string($value), - 'mixed' => true, - default => $value instanceof $type, - }; + switch ($type) { + case 'array': + return is_array($value); + case 'bool': + case 'boolean': + return is_bool($value); + case 'callable': + return is_callable($value); + case 'float': + case 'double': + return is_float($value); + case 'int': + case 'integer': + return is_int($value); + case 'null': + return $value === null; + case 'numeric': + return is_numeric($value); + case 'object': + return is_object($value); + case 'resource': + return is_resource($value); + case 'scalar': + return is_scalar($value); + case 'string': + return is_string($value); + case 'mixed': + return true; + default: + return $value instanceof $type; + } } } diff --git a/lib/Google/vendor/ramsey/collection/src/Tool/ValueExtractorTrait.php b/lib/Google/vendor/ramsey/collection/src/Tool/ValueExtractorTrait.php index bbe27b441..e10824283 100644 --- a/lib/Google/vendor/ramsey/collection/src/Tool/ValueExtractorTrait.php +++ b/lib/Google/vendor/ramsey/collection/src/Tool/ValueExtractorTrait.php @@ -14,11 +14,9 @@ namespace Ramsey\Collection\Tool; -use Ramsey\Collection\Exception\InvalidPropertyOrMethod; -use Ramsey\Collection\Exception\UnsupportedOperationException; -use ReflectionProperty; +use Ramsey\Collection\Exception\ValueExtractionException; -use function is_array; +use function get_class; use function is_object; use function method_exists; use function property_exists; @@ -30,71 +28,34 @@ trait ValueExtractorTrait { /** - * Returns the type associated with this collection. - */ - abstract public function getType(): string; - - /** - * Extracts the value of the given property, method, or array key from the - * element. - * - * If `$propertyOrMethod` is `null`, we return the element as-is. + * Extracts the value of the given property or method from the object. * - * @param mixed $element The element to extract the value from. - * @param string | null $propertyOrMethod The property or method for which the + * @param mixed $object The object to extract the value from. + * @param string $propertyOrMethod The property or method for which the * value should be extracted. * - * @return mixed the value extracted from the specified property, method, - * or array key, or the element itself. + * @return mixed the value extracted from the specified property or method. * - * @throws InvalidPropertyOrMethod - * @throws UnsupportedOperationException + * @throws ValueExtractionException if the method or property is not defined. */ - protected function extractValue(mixed $element, ?string $propertyOrMethod): mixed + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + protected function extractValue($object, string $propertyOrMethod) { - if ($propertyOrMethod === null) { - return $element; - } - - if (!is_object($element) && !is_array($element)) { - throw new UnsupportedOperationException(sprintf( - 'The collection type "%s" does not support the $propertyOrMethod parameter', - $this->getType(), - )); - } - - if (is_array($element)) { - return $element[$propertyOrMethod] ?? throw new InvalidPropertyOrMethod(sprintf( - 'Key or index "%s" not found in collection elements', - $propertyOrMethod, - )); - } - - if (property_exists($element, $propertyOrMethod) && method_exists($element, $propertyOrMethod)) { - $reflectionProperty = new ReflectionProperty($element, $propertyOrMethod); - if ($reflectionProperty->isPublic()) { - return $element->$propertyOrMethod; - } - - return $element->{$propertyOrMethod}(); - } - - if (property_exists($element, $propertyOrMethod)) { - return $element->$propertyOrMethod; + if (!is_object($object)) { + throw new ValueExtractionException('Unable to extract a value from a non-object'); } - if (method_exists($element, $propertyOrMethod)) { - return $element->{$propertyOrMethod}(); + if (property_exists($object, $propertyOrMethod)) { + return $object->$propertyOrMethod; } - if (isset($element->$propertyOrMethod)) { - return $element->$propertyOrMethod; + if (method_exists($object, $propertyOrMethod)) { + return $object->{$propertyOrMethod}(); } - throw new InvalidPropertyOrMethod(sprintf( - 'Method or property "%s" not defined in %s', - $propertyOrMethod, - $element::class, - )); + throw new ValueExtractionException( + // phpcs:ignore SlevomatCodingStandard.Classes.ModernClassNameReference.ClassNameReferencedViaFunctionCall + sprintf('Method or property "%s" not defined in %s', $propertyOrMethod, get_class($object)), + ); } } diff --git a/lib/Google/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php b/lib/Google/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php index 40c780325..cacefc8b6 100644 --- a/lib/Google/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php +++ b/lib/Google/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php @@ -16,7 +16,7 @@ use DateTimeInterface; -use function assert; +use function get_class; use function get_resource_type; use function is_array; use function is_bool; @@ -24,6 +24,7 @@ use function is_object; use function is_resource; use function is_scalar; +use function var_export; /** * Provides functionality to express a value as string @@ -45,7 +46,8 @@ trait ValueToStringTrait * * @param mixed $value the value to return as a string. */ - protected function toolValueToString(mixed $value): string + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + protected function toolValueToString($value): string { // null if ($value === null) { @@ -72,13 +74,16 @@ protected function toolValueToString(mixed $value): string return '(' . get_resource_type($value) . ' resource #' . (int) $value . ')'; } + // If we don't know what it is, use var_export(). + if (!is_object($value)) { + return '(' . var_export($value, true) . ')'; + } + // From here, $value should be an object. - assert(is_object($value)); // __toString() is implemented if (is_callable([$value, '__toString'])) { - /** @var string */ - return $value->__toString(); + return (string) $value->__toString(); } // object of type \DateTime @@ -87,6 +92,7 @@ protected function toolValueToString(mixed $value): string } // unknown type - return '(' . $value::class . ' Object)'; + // phpcs:ignore SlevomatCodingStandard.Classes.ModernClassNameReference.ClassNameReferencedViaFunctionCall + return '(' . get_class($value) . ' Object)'; } } diff --git a/lib/Google/vendor/ramsey/uuid/composer.json b/lib/Google/vendor/ramsey/uuid/composer.json index b34d9b108..db4429217 100644 --- a/lib/Google/vendor/ramsey/uuid/composer.json +++ b/lib/Google/vendor/ramsey/uuid/composer.json @@ -10,7 +10,7 @@ ], "require": { "php": "^8.0", - "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14", + "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13", "ramsey/collection": "^1.2 || ^2.0" }, "require-dev": { diff --git a/lib/Google/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php b/lib/Google/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php index a2615f1a3..024ed51e1 100644 --- a/lib/Google/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php +++ b/lib/Google/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php @@ -15,6 +15,7 @@ namespace Ramsey\Uuid\Generator; use Brick\Math\BigInteger; +use DateTimeImmutable; use DateTimeInterface; use Ramsey\Uuid\Type\Hexadecimal; @@ -67,12 +68,7 @@ public function __construct( */ public function generate($node = null, ?int $clockSeq = null, ?DateTimeInterface $dateTime = null): string { - if ($dateTime === null) { - $time = microtime(false); - $time = substr($time, 11) . substr($time, 2, 3); - } else { - $time = $dateTime->format('Uv'); - } + $time = ($dateTime ?? new DateTimeImmutable('now'))->format('Uv'); if ($time > self::$time || ($dateTime !== null && $time !== self::$time)) { $this->randomize($time); diff --git a/lib/Google/vendor/ramsey/uuid/src/Math/BrickMathCalculator.php b/lib/Google/vendor/ramsey/uuid/src/Math/BrickMathCalculator.php index 649f58039..869835e9c 100644 --- a/lib/Google/vendor/ramsey/uuid/src/Math/BrickMathCalculator.php +++ b/lib/Google/vendor/ramsey/uuid/src/Math/BrickMathCalculator.php @@ -49,10 +49,10 @@ public function add(NumberInterface $augend, NumberInterface ...$addends): Numbe $sum = BigInteger::of($augend->toString()); foreach ($addends as $addend) { - $sum = $sum->plus($addend->toString()); + $sum = $sum->plus($addend->toString()); /** @phpstan-ignore possiblyImpure.methodCall */ } - /** @phpstan-ignore possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ return new IntegerObject((string) $sum); } @@ -61,10 +61,10 @@ public function subtract(NumberInterface $minuend, NumberInterface ...$subtrahen $difference = BigInteger::of($minuend->toString()); foreach ($subtrahends as $subtrahend) { - $difference = $difference->minus($subtrahend->toString()); + $difference = $difference->minus($subtrahend->toString()); /** @phpstan-ignore possiblyImpure.methodCall */ } - /** @phpstan-ignore possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ return new IntegerObject((string) $difference); } @@ -73,10 +73,11 @@ public function multiply(NumberInterface $multiplicand, NumberInterface ...$mult $product = BigInteger::of($multiplicand->toString()); foreach ($multipliers as $multiplier) { + /** @phpstan-ignore possiblyImpure.methodCall */ $product = $product->multipliedBy($multiplier->toString()); } - /** @phpstan-ignore possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ return new IntegerObject((string) $product); } @@ -92,22 +93,23 @@ public function divide( $quotient = BigDecimal::of($dividend->toString()); foreach ($divisors as $divisor) { + /** @phpstan-ignore possiblyImpure.methodCall */ $quotient = $quotient->dividedBy($divisor->toString(), $scale, $brickRounding); } if ($scale === 0) { - /** @phpstan-ignore possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.methodCall, possiblyImpure.new */ return new IntegerObject((string) $quotient->toBigInteger()); } - /** @phpstan-ignore possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ return new Decimal((string) $quotient); } public function fromBase(string $value, int $base): IntegerObject { try { - /** @phpstan-ignore possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ return new IntegerObject((string) BigInteger::fromBase($value, $base)); } catch (MathException | \InvalidArgumentException $exception) { throw new InvalidArgumentException( @@ -121,6 +123,7 @@ public function fromBase(string $value, int $base): IntegerObject public function toBase(IntegerObject $value, int $base): string { try { + /** @phpstan-ignore possiblyImpure.methodCall */ return BigInteger::of($value->toString())->toBase($base); } catch (MathException | \InvalidArgumentException $exception) { throw new InvalidArgumentException( diff --git a/lib/Google/vendor/rize/uri-template/.php-cs-fixer.dist.php b/lib/Google/vendor/rize/uri-template/.php-cs-fixer.dist.php deleted file mode 100644 index cb2af3860..000000000 --- a/lib/Google/vendor/rize/uri-template/.php-cs-fixer.dist.php +++ /dev/null @@ -1,19 +0,0 @@ -setParallelConfig(ParallelConfigFactory::detect()) - ->setRiskyAllowed(true) - ->setUsingCache(false) - ->setRules([ - '@PER-CS2.0' => true, - ]) - ->setFinder( - (new Finder()) - ->in([__DIR__ . '/src', __DIR__ . '/tests']) - ); \ No newline at end of file diff --git a/lib/Google/vendor/rize/uri-template/README.md b/lib/Google/vendor/rize/uri-template/README.md index f2293df83..52f52fefc 100644 --- a/lib/Google/vendor/rize/uri-template/README.md +++ b/lib/Google/vendor/rize/uri-template/README.md @@ -2,13 +2,10 @@ This is a URI Template implementation in PHP based on [RFC 6570 URI Template](http://tools.ietf.org/html/rfc6570). In addition to URI expansion, it also supports URI extraction (used by [Google Cloud Core](https://github.com/googleapis/google-cloud-php-core) and [Google Cloud Client Library](https://github.com/googleapis/google-cloud-php)). -![CI](https://github.com/rize/UriTemplate/workflows/CI/badge.svg) [![Total Downloads](https://poser.pugx.org/rize/uri-template/downloads)](https://packagist.org/packages/rize/uri-template) [![Latest Stable Version](https://poser.pugx.org/rize/uri-template/v)](https://packagist.org/packages/rize/uri-template) [![PHP Version Require](https://poser.pugx.org/rize/uri-template/require/php)](https://packagist.org/packages/rize/uri-template) +![CI](https://github.com/rize/UriTemplate/workflows/CI/badge.svg) [![Total Downloads](https://poser.pugx.org/rize/uri-template/downloads.png)](https://packagist.org/packages/rize/uri-template) +[![Financial Contributors on Open Collective](https://opencollective.com/rize-uri-template/all/badge.svg?label=financial+contributors)](https://opencollective.com/rize-uri-template) -> [!NOTE] -> -> Due to the deprecation of implictly nullable parameter types in [PHP 8.4](https://wiki.php.net/rfc/deprecate-implicitly-nullable-types), we must introduce breaking change by adding explicit nullable types (`?T`) which requires PHP 7.1+. -> -> As a result, version [0.4.0](https://github.com/rize/UriTemplate/releases/tag/0.4.0) and later will no longer support PHP versions below 8.1. +* [Node.js/Javascript](https://github.com/rezigned/uri-template.js) URI Template ## Usage @@ -220,7 +217,6 @@ Using `composer` * **0.2.5** Add strict mode support for `extract` method * **0.3.0** Improve code quality + RFC3986 support for `extract` method by @Maks3w * **0.3.1** Improve `extract` method to parse two or more adjacent variables separated by dot by @corleonis -* **0.4.0** Fixes the deprecation of implicitly nullable parameter types introduced in PHP 8.4. This version requires PHP 8.1 or later. ## Contributors diff --git a/lib/Google/vendor/rize/uri-template/composer.json b/lib/Google/vendor/rize/uri-template/composer.json index 0dbfd2ead..cec985a48 100644 --- a/lib/Google/vendor/rize/uri-template/composer.json +++ b/lib/Google/vendor/rize/uri-template/composer.json @@ -11,12 +11,10 @@ } ], "require": { - "php": ">=8.1" + "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "~10.0", - "phpstan/phpstan": "^1.12", - "friendsofphp/php-cs-fixer": "^3.63" + "phpunit/phpunit": "~4.8.36" }, "autoload": { "psr-4": { @@ -24,9 +22,6 @@ } }, "scripts": { - "test": "vendor/bin/phpunit", - "cs": "vendor/bin/php-cs-fixer fix --dry-run", - "cs-fix": "vendor/bin/php-cs-fixer fix", - "phpstan": "vendor/bin/phpstan" + "test": "vendor/bin/phpunit test/" } } diff --git a/lib/Google/vendor/rize/uri-template/phpstan.neon b/lib/Google/vendor/rize/uri-template/phpstan.neon deleted file mode 100644 index a76a83296..000000000 --- a/lib/Google/vendor/rize/uri-template/phpstan.neon +++ /dev/null @@ -1,5 +0,0 @@ -parameters: - level: 5 - paths: - - src - - tests \ No newline at end of file diff --git a/lib/Google/vendor/rize/uri-template/phpunit.xml b/lib/Google/vendor/rize/uri-template/phpunit.xml deleted file mode 100644 index 530f84f33..000000000 --- a/lib/Google/vendor/rize/uri-template/phpunit.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - tests - - - - - - src - - - diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate.php index 51a841ddc..330f39b80 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate.php @@ -5,38 +5,47 @@ use Rize\UriTemplate\Parser; /** - * URI Template. + * URI Template */ class UriTemplate { - protected Parser $parser; - protected array $parsed = []; - - public function __construct(protected string $base_uri = '', protected array $params = [], ?Parser $parser = null) + /** + * @var Parser + */ + protected $parser, + $parsed = array(), + $base_uri, + $params = array(); + + public function __construct($base_uri = '', $params = array(), Parser $parser = null) { - $this->parser = $parser ?: $this->createNodeParser(); + $this->base_uri = $base_uri; + $this->params = $params; + $this->parser = $parser ?: $this->createNodeParser(); } /** - * Expands URI Template. + * Expands URI Template * - * @param mixed $params + * @param string $uri URI Template + * @param array $params URI Template's parameters + * @return string */ - public function expand(string $uri, $params = []): string + public function expand($uri, $params = array()) { $params += $this->params; - $uri = $this->base_uri . $uri; - $result = []; + $uri = $this->base_uri.$uri; + $result = array(); // quick check - if (!str_contains($uri, '{')) { + if (($start = strpos($uri, '{')) === false) { return $uri; } $parser = $this->parser; $nodes = $parser->parse($uri); - foreach ($nodes as $node) { + foreach($nodes as $node) { $result[] = $node->expand($parser, $params); } @@ -44,48 +53,48 @@ public function expand(string $uri, $params = []): string } /** - * Extracts variables from URI. + * Extracts variables from URI * + * @param string $template + * @param string $uri + * @param bool $strict This will perform a full match * @return null|array params or null if not match and $strict is true */ - public function extract(string $template, string $uri, bool $strict = false): ?array + public function extract($template, $uri, $strict = false) { - $params = []; + $params = array(); $nodes = $this->parser->parse($template); - // PHP 8.1.0RC4-dev still throws deprecation warning for `strlen`. - // $uri = (string) $uri; + # PHP 8.1.0RC4-dev still throws deprecation warning for `strlen`. + # $uri = (string) $uri; + + foreach($nodes as $node) { - foreach ($nodes as $node) { // if strict is given, and there's no remaining uri just return null - if ($strict && (string) $uri === '') { + if ($strict && !strlen((string) $uri)) { return null; } - // URI will be truncated from the start when a match is found + // uri'll be truncated from the start when a match is found $match = $node->match($this->parser, $uri, $params, $strict); - if ($match === null) { - return null; - } - - [$uri, $params] = $match; + list($uri, $params) = $match; } // if there's remaining $uri, matching is failed - if ($strict && (string) $uri !== '') { + if ($strict && strlen((string) $uri)) { return null; } return $params; } - public function getParser(): Parser + public function getParser() { return $this->parser; } - protected function createNodeParser(): Parser + protected function createNodeParser() { static $parser; @@ -93,6 +102,6 @@ protected function createNodeParser(): Parser return $parser; } - return $parser = new Parser(); + return $parser = new Parser; } } diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Abstraction.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Abstraction.php index 7332df5c4..3f2e3501e 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Abstraction.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Abstraction.php @@ -5,45 +5,61 @@ use Rize\UriTemplate\Parser; /** - * Base class for all Nodes. + * Base class for all Nodes */ abstract class Abstraction { - public function __construct(private readonly string $token) {} + /** + * @var string + */ + private $token; + + public function __construct($token) + { + $this->token = $token; + } /** * Expands URI template * - * @param array $params + * @param Parser $parser + * @param array $params + * @return null|string */ - public function expand(Parser $parser, array $params = []): ?string + public function expand(Parser $parser, array $params = array()) { return $this->token; } /** - * Matches given URI against current node. - * - * @param array $params + * Matches given URI against current node * - * @return null|array{0: string, 1: array} `uri and params` or `null` if not match and $strict is true + * @param Parser $parser + * @param string $uri + * @param array $params + * @param bool $strict + * @return null|array `uri and params` or `null` if not match and $strict is true */ - public function match(Parser $parser, string $uri, array $params = [], bool $strict = false): ?array + public function match(Parser $parser, $uri, $params = array(), $strict = false) { // match literal string from start to end - if (str_starts_with($uri, $this->token)) { - $uri = substr($uri, strlen($this->token)); + $length = strlen($this->token); + if (substr($uri, 0, $length) === $this->token) { + $uri = substr($uri, $length); } // when there's no match, just return null if strict mode is given - elseif ($strict) { + else if ($strict) { return null; } - return [$uri, $params]; + return array($uri, $params); } - public function getToken(): string + /** + * @return string + */ + public function getToken() { return $this->token; } diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Expression.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Expression.php index a31fa24c2..892ccc695 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Expression.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Expression.php @@ -2,53 +2,83 @@ namespace Rize\UriTemplate\Node; -use Rize\UriTemplate\Operator; use Rize\UriTemplate\Parser; +use Rize\UriTemplate\Operator; +/** + * Description + */ class Expression extends Abstraction { /** - * @param string $forwardLookupSeparator + * @var Operator\Abstraction */ - public function __construct(string $token, private readonly Operator\Abstraction $operator, private readonly ?array $variables = null, /** - * Whether to do a forward lookup for a given separator. + private $operator; + + /** + * @var array + */ + private $variables = array(); + + /** + * Whether to do a forward lookup for a given separator + * @var string */ - private $forwardLookupSeparator = null) + private $forwardLookupSeparator; + + public function __construct($token, Operator\Abstraction $operator, array $variables = null, $forwardLookupSeparator = null) { parent::__construct($token); + $this->operator = $operator; + $this->variables = $variables; + $this->forwardLookupSeparator = $forwardLookupSeparator; } - public function getOperator(): Operator\Abstraction + /** + * @return Operator\Abstraction + */ + public function getOperator() { return $this->operator; } - public function getVariables(): ?array + /** + * @return array + */ + public function getVariables() { return $this->variables; } - public function getForwardLookupSeparator(): string + /** + * @return string + */ + public function getForwardLookupSeparator() { return $this->forwardLookupSeparator; } - public function setForwardLookupSeparator(string $forwardLookupSeparator): void + /** + * @param string $forwardLookupSeparator + */ + public function setForwardLookupSeparator($forwardLookupSeparator) { $this->forwardLookupSeparator = $forwardLookupSeparator; } - public function expand(Parser $parser, array $params = []): ?string + /** + * @param Parser $parser + * @param array $params + * @return null|string + */ + public function expand(Parser $parser, array $params = array()) { - $data = []; - $op = $this->operator; - - if ($this->variables === null) { - return $op->first; - } + $data = array(); + $op = $this->operator; // check for variable modifiers - foreach ($this->variables as $var) { + foreach($this->variables as $var) { + $val = $op->expand($parser, $var, $params); // skip null value @@ -57,21 +87,25 @@ public function expand(Parser $parser, array $params = []): ?string } } - return $data ? $op->first . implode($op->sep, $data) : null; + return $data ? $op->first.implode($op->sep, $data) : null; } /** - * Matches given URI against current node. + * Matches given URI against current node * + * @param Parser $parser + * @param string $uri + * @param array $params + * @param bool $strict * @return null|array `uri and params` or `null` if not match and $strict is true */ - public function match(Parser $parser, string $uri, array $params = [], bool $strict = false): ?array + public function match(Parser $parser, $uri, $params = array(), $strict = false) { $op = $this->operator; // check expression operator first if ($op->id && isset($uri[0]) && $uri[0] !== $op->id) { - return [$uri, $params]; + return array($uri, $params); } // remove operator from input @@ -79,8 +113,9 @@ public function match(Parser $parser, string $uri, array $params = [], bool $str $uri = substr($uri, 1); } - foreach ($this->sortVariables($this->variables) as $var) { - $regex = '#' . $op->toRegex($parser, $var) . '#'; + foreach($this->sortVariables($this->variables) as $var) { + /** @var \Rize\UriTemplate\Node\Variable $regex */ + $regex = '#'.$op->toRegex($parser, $var).'#'; $val = null; // do a forward lookup and get just the relevant part @@ -93,13 +128,14 @@ public function match(Parser $parser, string $uri, array $params = [], bool $str } if (preg_match($regex, $preparedUri, $match)) { + // remove matched part from input - $preparedUri = preg_replace($regex, '', $preparedUri, 1); + $preparedUri = preg_replace($regex, '', $preparedUri, $limit = 1); $val = $op->extract($parser, $var, $match[0]); } // if strict is given, we quit immediately when there's no match - elseif ($strict) { + else if ($strict) { return null; } @@ -108,16 +144,21 @@ public function match(Parser $parser, string $uri, array $params = [], bool $str $params[$var->getToken()] = $val; } - return [$uri, $params]; + return array($uri, $params); } /** * Sort variables before extracting data from uri. * We have to sort vars by non-explode to explode. + * + * @param array $vars + * @return array */ - protected function sortVariables(array $vars): array + protected function sortVariables(array $vars) { - usort($vars, static fn($a, $b) => $a->options['modifier'] <=> $b->options['modifier']); + usort($vars, function($a, $b) { + return $a->options['modifier'] >= $b->options['modifier'] ? 1 : -1; + }); return $vars; } diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Literal.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Literal.php index bc939b6b0..1c54da129 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Literal.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Node/Literal.php @@ -1,5 +1,11 @@ - null, 'value' => null]; + /** + * Variable name without modifier + * e.g. 'term:1' becomes 'term' + */ + public $name, + $options = array( + 'modifier' => null, + 'value' => null, + ); - public function __construct(string $token, array $options = []) + public function __construct($token, array $options = array()) { parent::__construct($token); $this->options = $options + $this->options; @@ -19,9 +25,9 @@ public function __construct(string $token, array $options = []) // normalize var name e.g. from 'term:1' becomes 'term' $name = $token; if ($options['modifier'] === ':') { - $name = strstr($name, $options['modifier'], true); + $name = substr($name, 0, strpos($name, $options['modifier'])); } $this->name = $name; } -} +} \ No newline at end of file diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Abstraction.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Abstraction.php index 856bd1c8f..1b7633762 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Abstraction.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Abstraction.php @@ -14,7 +14,7 @@ * | named | false false false false true true true false | * | ifemp | "" "" "" "" "" "=" "=" "" | * | allow | U U+R U U U U U U+R | - * `------------------------------------------------------------------'. + * `------------------------------------------------------------------' * * named = false * | 1 | {/list} /red,green,blue | {$value}*(?:,{$value}+)* @@ -35,7 +35,7 @@ * * RESERVED * -------- - * RFC 1738 ":" | "/" | "?" | | "@" | "!" | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=" | "-" | "_" | "." | + * RFC 1738 ":" | "/" | "?" | | "@" | "!" | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=" | "-" | "_" | "." | * RFC 3986 ":" | "/" | "?" | "#" | "[" | "]" | "@" | "!" | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=" * RFC 6570 ":" | "/" | "?" | "#" | "[" | "]" | "@" | "!" | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=" * @@ -47,109 +47,108 @@ abstract class Abstraction * start - Variable offset position, level-2 operators start at 1 * (exclude operator itself, e.g. {?query}) * first - If variables found, prepend this value to it - * named - Whether the expansion includes the variable or key name - * reserved - union of (unreserved / reserved / pct-encoded). + * named - Whether or not the expansion includes the variable or key name + * reserved - union of (unreserved / reserved / pct-encoded) */ - public $id; - public $named; - public $sep; - public $empty; - public $reserved; - public $start; - public $first; - - /** - * gen-delims | sub-delims. - */ - public static $reserved_chars = [ - '%3A' => ':', - '%2F' => '/', - '%3F' => '?', - '%23' => '#', - '%5B' => '[', - '%5D' => ']', - '%40' => '@', - '%21' => '!', - '%24' => '$', - '%26' => '&', - '%27' => "'", - '%28' => '(', - '%29' => ')', - '%2A' => '*', - '%2B' => '+', - '%2C' => ',', - '%3B' => ';', - '%3D' => '=', - ]; - - protected static $types = [ - '' => [ - 'sep' => ',', - 'named' => false, - 'empty' => '', - 'reserved' => false, - 'start' => 0, - 'first' => null, - ], - '+' => [ - 'sep' => ',', - 'named' => false, - 'empty' => '', - 'reserved' => true, - 'start' => 1, - 'first' => null, - ], - '.' => [ - 'sep' => '.', - 'named' => false, - 'empty' => '', - 'reserved' => false, - 'start' => 1, - 'first' => '.', - ], - '/' => [ - 'sep' => '/', - 'named' => false, - 'empty' => '', - 'reserved' => false, - 'start' => 1, - 'first' => '/', - ], - ';' => [ - 'sep' => ';', - 'named' => true, - 'empty' => '', - 'reserved' => false, - 'start' => 1, - 'first' => ';', - ], - '?' => [ - 'sep' => '&', - 'named' => true, - 'empty' => '=', - 'reserved' => false, - 'start' => 1, - 'first' => '?', - ], - '&' => [ - 'sep' => '&', - 'named' => true, - 'empty' => '=', - 'reserved' => false, - 'start' => 1, - 'first' => '&', - ], - '#' => [ - 'sep' => ',', - 'named' => false, - 'empty' => '', - 'reserved' => true, - 'start' => 1, - 'first' => '#', - ], - ]; - - protected static $loaded = []; + public $id, + $named, + $sep, + $empty, + $reserved, + $start, + $first; + + protected static $types = array( + '' => array( + 'sep' => ',', + 'named' => false, + 'empty' => '', + 'reserved' => false, + 'start' => 0, + 'first' => null, + ), + '+' => array( + 'sep' => ',', + 'named' => false, + 'empty' => '', + 'reserved' => true, + 'start' => 1, + 'first' => null, + ), + '.' => array( + 'sep' => '.', + 'named' => false, + 'empty' => '', + 'reserved' => false, + 'start' => 1, + 'first' => '.', + ), + '/' => array( + 'sep' => '/', + 'named' => false, + 'empty' => '', + 'reserved' => false, + 'start' => 1, + 'first' => '/', + ), + ';' => array( + 'sep' => ';', + 'named' => true, + 'empty' => '', + 'reserved' => false, + 'start' => 1, + 'first' => ';', + ), + '?' => array( + 'sep' => '&', + 'named' => true, + 'empty' => '=', + 'reserved' => false, + 'start' => 1, + 'first' => '?', + ), + '&' => array( + 'sep' => '&', + 'named' => true, + 'empty' => '=', + 'reserved' => false, + 'start' => 1, + 'first' => '&', + ), + '#' => array( + 'sep' => ',', + 'named' => false, + 'empty' => '', + 'reserved' => true, + 'start' => 1, + 'first' => '#', + ), + ), + $loaded = array(); + + /** + * gen-delims | sub-delims + */ + public static $reserved_chars = array( + '%3A' => ':', + '%2F' => '/', + '%3F' => '?', + '%23' => '#', + '%5B' => '[', + '%5D' => ']', + '%40' => '@', + '%21' => '!', + '%24' => '$', + '%26' => '&', + '%27' => "'", + '%28' => '(', + '%29' => ')', + '%2A' => '*', + '%2B' => '+', + '%2C' => ',', + '%3B' => ';', + '%3D' => '=', + ); /** * RFC 3986 Allowed path characters regex except the path delimiter '/'. @@ -167,29 +166,29 @@ abstract class Abstraction public function __construct($id, $named, $sep, $empty, $reserved, $start, $first) { - $this->id = $id; + $this->id = $id; $this->named = $named; - $this->sep = $sep; + $this->sep = $sep; $this->empty = $empty; $this->start = $start; $this->first = $first; $this->reserved = $reserved; } - abstract public function toRegex(Parser $parser, Node\Variable $var): string; + abstract public function toRegex(Parser $parser, Node\Variable $var); - public function expand(Parser $parser, Node\Variable $var, array $params = []) + public function expand(Parser $parser, Node\Variable $var, array $params = array()) { $options = $var->options; $name = $var->name; - $is_explode = in_array($options['modifier'], ['*', '%']); + $is_explode = in_array($options['modifier'], array('*', '%')); // skip null if (!isset($params[$name])) { return null; } - $val = $params[$name]; + $val = $params[$name]; // This algorithm is based on RFC6570 http://tools.ietf.org/html/rfc6570 // non-array, e.g. string @@ -198,32 +197,38 @@ public function expand(Parser $parser, Node\Variable $var, array $params = []) } // non-explode ':' - if (!$is_explode) { + else if (!$is_explode) { return $this->expandNonExplode($parser, $var, $val); } // explode '*', '%' - - return $this->expandExplode($parser, $var, $val); + else { + return $this->expandExplode($parser, $var, $val); + } } public function expandString(Parser $parser, Node\Variable $var, $val) { - $val = (string) $val; + $val = (string)$val; $options = $var->options; $result = null; if ($options['modifier'] === ':') { - $val = substr($val, 0, (int) $options['value']); + $val = substr($val, 0, (int)$options['value']); } - return $result . $this->encode($parser, $var, $val); + return $result.$this->encode($parser, $var, $val); } /** - * Non explode modifier ':'. + * Non explode modifier ':' + * + * @param Parser $parser + * @param Node\Variable $var + * @param array $val + * @return null|string */ - public function expandNonExplode(Parser $parser, Node\Variable $var, array $val): ?string + public function expandNonExplode(Parser $parser, Node\Variable $var, array $val) { if (empty($val)) { return null; @@ -233,9 +238,14 @@ public function expandNonExplode(Parser $parser, Node\Variable $var, array $val) } /** - * Explode modifier '*', '%'. + * Explode modifier '*', '%' + * + * @param Parser $parser + * @param Node\Variable $var + * @param array $val + * @return null|string */ - public function expandExplode(Parser $parser, Node\Variable $var, array $val): ?string + public function expandExplode(Parser $parser, Node\Variable $var, array $val) { if (empty($val)) { return null; @@ -245,13 +255,17 @@ public function expandExplode(Parser $parser, Node\Variable $var, array $val): ? } /** - * Encodes variable according to spec (reserved or unreserved). + * Encodes variable according to spec (reserved or unreserved) + * + * @param Parser $parser + * @param Node\Variable $var + * @param mixed $values * * @return string encoded string */ - public function encode(Parser $parser, Node\Variable $var, mixed $values) + public function encode(Parser $parser, Node\Variable $var, $values) { - $values = (array) $values; + $values = (array)$values; $list = isset($values[0]); $reserved = $this->reserved; $maps = static::$reserved_chars; @@ -263,12 +277,13 @@ public function encode(Parser $parser, Node\Variable $var, mixed $values) $assoc_sep = $sep = ','; } - array_walk($values, function (&$v, $k) use ($assoc_sep, $reserved, $list, $maps): void { + array_walk($values, function(&$v, $k) use ($assoc_sep, $reserved, $list, $maps) { + $encoded = rawurlencode($v); // assoc? encode key too if (!$list) { - $encoded = rawurlencode($k) . $assoc_sep . $encoded; + $encoded = rawurlencode($k).$assoc_sep.$encoded; } // rawurlencode is compliant with 'unreserved' set @@ -278,10 +293,11 @@ public function encode(Parser $parser, Node\Variable $var, mixed $values) // decode chars in reserved set else { + $v = str_replace( array_keys($maps), $maps, - $encoded, + $encoded ); } }); @@ -290,59 +306,71 @@ public function encode(Parser $parser, Node\Variable $var, mixed $values) } /** - * Decodes variable. + * Decodes variable + * + * @param Parser $parser + * @param Node\Variable $var + * @param mixed $values * * @return string decoded string */ - public function decode(Parser $parser, Node\Variable $var, mixed $values) + public function decode(Parser $parser, Node\Variable $var, $values) { $single = !is_array($values); - $values = (array) $values; + $values = (array)$values; - array_walk($values, function (&$v, $k): void { + array_walk($values, function(&$v, $k) { $v = rawurldecode($v); }); return $single ? reset($values) : $values; } - + /** - * Extracts value from variable. + * Extracts value from variable + * + * @param Parser $parser + * @param Node\Variable $var + * @param string $data + * @return string */ - public function extract(Parser $parser, Node\Variable $var, string $data): array|string + public function extract(Parser $parser, Node\Variable $var, $data) { - $value = $data; - $vals = array_filter(explode($this->sep, $data)); + $value = $data; + $vals = array_filter(explode($this->sep, $data)); $options = $var->options; switch ($options['modifier']) { + case '*': - $value = []; - foreach ($vals as $val) { - if (str_contains($val, '=')) { - [$k, $v] = explode('=', $val); - $value[$k] = $v; - } else { - $value[] = $val; + $data = array(); + foreach($vals as $val) { + + if (strpos($val, '=') !== false) { + list($k, $v) = explode('=', $val); + $data[$k] = $v; + } + + else { + $data[] = $val; } } break; - case ':': break; - default: - $value = str_contains($value, (string) $this->sep) ? $vals : $value; + $data = strpos($data, $this->sep) !== false ? $vals : $value; + } - return $this->decode($parser, $var, $value); + return $this->decode($parser, $var, $data); } public static function createById($id) { if (!isset(static::$types[$id])) { - throw new \InvalidArgumentException("Invalid operator [{$id}]"); + throw new \Exception("Invalid operator [$id]"); } if (isset(static::$loaded[$id])) { @@ -350,24 +378,31 @@ public static function createById($id) } $op = static::$types[$id]; - $class = __NAMESPACE__ . '\\' . ($op['named'] ? 'Named' : 'UnNamed'); + $class = __NAMESPACE__.'\\'.($op['named'] ? 'Named' : 'UnNamed'); return static::$loaded[$id] = new $class($id, $op['named'], $op['sep'], $op['empty'], $op['reserved'], $op['start'], $op['first']); } - public static function isValid($id): bool + public static function isValid($id) { return isset(static::$types[$id]); } /** - * Returns the correct regex given the variable location in the URI. + * Returns the correct regex given the variable location in the URI + * + * @return string */ - protected function getRegex(): string + protected function getRegex() { - return match ($this->id) { - '?', '&', '#' => self::$queryRegex, - default => self::$pathRegex, - }; + switch ($this->id) { + case '?': + case '&': + case '#': + return self::$queryRegex; + case ';': + default: + return self::$pathRegex; + } } } diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Named.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Named.php index 2c0a505de..708710ce1 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Named.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/Named.php @@ -10,51 +10,49 @@ * | 2 | {?list*} ?list=red&list=green&list=blue | {name}+=(?:{$value}+(?:{sep}{name}+={$value}*))* * | 3 | {?keys} ?keys=semi,%3B,dot,.,comma,%2C | (same as 1) * | 4 | {?keys*} ?semi=%3B&dot=.&comma=%2C | (same as 2) - * | 5 | {?list*} ?list[]=red&list[]=green&list[]=blue | {name[]}+=(?:{$value}+(?:{sep}{name[]}+={$value}*))*. + * | 5 | {?list*} ?list[]=red&list[]=green&list[]=blue | {name[]}+=(?:{$value}+(?:{sep}{name[]}+={$value}*))* */ class Named extends Abstraction { - public function toRegex(Parser $parser, Node\Variable $var): string + public function toRegex(Parser $parser, Node\Variable $var) { + $regex = null; $name = $var->name; $value = $this->getRegex(); $options = $var->options; if ($options['modifier']) { - switch ($options['modifier']) { + switch($options['modifier']) { case '*': // 2 | 4 $regex = "{$name}+=(?:{$value}+(?:{$this->sep}{$name}+={$value}*)*)" . "|{$value}+=(?:{$value}+(?:{$this->sep}{$value}+={$value}*)*)"; - break; - case ':': - $regex = "{$value}\\{0,{$options['value']}\\}"; - + $regex = "{$value}\{0,{$options['value']}\}"; break; case '%': // 5 - $name .= '+(?:%5B|\[)[^=]*='; + $name = $name.'+(?:%5B|\[)[^=]*='; $regex = "{$name}(?:{$value}+(?:{$this->sep}{$name}{$value}*)*)"; - break; - default: - throw new \InvalidArgumentException("Unknown modifier `{$options['modifier']}`"); + throw new \Exception("Unknown modifier `{$options['modifier']}`"); } - } else { + } + + else { // 1, 3 $regex = "{$name}=(?:{$value}+(?:,{$value}+)*)*"; } - return '(?:&)?' . $regex; + return '(?:&)?'.$regex; } - public function expandString(Parser $parser, Node\Variable $var, $val): string + public function expandString(Parser $parser, Node\Variable $var, $val) { - $val = (string) $val; + $val = (string)$val; $options = $var->options; $result = $this->encode($parser, $var, $var->name); @@ -63,42 +61,61 @@ public function expandString(Parser $parser, Node\Variable $var, $val): string return $result . $this->empty; } - $result .= '='; + else { + $result .= '='; + } if ($options['modifier'] === ':') { - $val = mb_substr($val, 0, (int) $options['value']); + $val = mb_substr($val, 0, (int)$options['value']); } - return $result . $this->encode($parser, $var, $val); + return $result.$this->encode($parser, $var, $val); } - public function expandNonExplode(Parser $parser, Node\Variable $var, array $val): ?string + public function expandNonExplode(Parser $parser, Node\Variable $var, array $val) { if (empty($val)) { return null; } - $result = $this->encode($parser, $var, $var->name); + $result = $this->encode($parser, $var, $var->name); + + if (empty($val)) { + return $result . $this->empty; + } - $result .= '='; + else { + $result .= '='; + } - return $result . $this->encode($parser, $var, $val); + return $result.$this->encode($parser, $var, $val); } - public function expandExplode(Parser $parser, Node\Variable $var, array $val): ?string + public function expandExplode(Parser $parser, Node\Variable $var, array $val) { if (empty($val)) { return null; } - $list = isset($val[0]); - $data = []; - foreach ($val as $k => $v) { + $result = $this->encode($parser, $var, $var->name); + + // RFC6570 doesn't specify how to handle empty list/assoc array + // for explode modifier + if (empty($val)) { + return $result . $this->empty; + } + + $list = isset($val[0]); + $data = array(); + foreach($val as $k => $v) { + // if value is a list, use `varname` as keyname, otherwise use `key` name $key = $list ? $var->name : $k; if ($list) { $data[$key][] = $v; - } else { + } + + else { $data[$key] = $v; } } @@ -106,14 +123,14 @@ public function expandExplode(Parser $parser, Node\Variable $var, array $val): ? // if it's array modifier, we have to use variable name as index // e.g. if variable name is 'query' and value is ['limit' => 1] // then we convert it to ['query' => ['limit' => 1]] - if (!$list && $var->options['modifier'] === '%') { - $data = [$var->name => $data]; + if (!$list and $var->options['modifier'] === '%') { + $data = array($var->name => $data); } - return $this->encodeExplodeVars($var, $data); + return $this->encodeExplodeVars($parser, $var, $data); } - public function extract(Parser $parser, Node\Variable $var, $data): array|string + public function extract(Parser $parser, Node\Variable $var, $data) { // get rid of optional `&` at the beginning if ($data[0] === '&') { @@ -126,47 +143,45 @@ public function extract(Parser $parser, Node\Variable $var, $data): array|string switch ($options['modifier']) { case '%': - parse_str($value, $query); + parse_str($data, $query); return $query[$var->name]; case '*': - $value = []; + $data = array(); - foreach ($vals as $val) { - [$k, $v] = explode('=', $val); + foreach($vals as $val) { + list($k, $v) = explode('=', $val); // 2 if ($k === $var->getToken()) { - $value[] = $v; + $data[] = $v; } // 4 else { - $value[$k] = $v; + $data[$k] = $v; } } break; - case ':': break; - default: // 1, 3 // remove key from value e.g. 'lang=en,th' becomes 'en,th' - $value = str_replace($var->getToken() . '=', '', $value); - $value = explode(',', $value); + $value = str_replace($var->getToken().'=', '', $value); + $data = explode(',', $value); - if (count($value) === 1) { - $value = current($value); + if (sizeof($data) === 1) { + $data = current($data); } } - return $this->decode($parser, $var, $value); + return $this->decode($parser, $var, $data); } - public function encodeExplodeVars(Node\Variable $var, $data): null|array|string + public function encodeExplodeVars(Parser $parser, Node\Variable $var, $data) { // http_build_query uses PHP_QUERY_RFC1738 encoding by default // i.e. spaces are encoded as '+' (plus signs) we need to convert @@ -183,6 +198,7 @@ public function encodeExplodeVars(Node\Variable $var, $data): null|array|string // `:`, `*` modifiers else { + // by default, http_build_query will convert array values to `a[]=1&a[]=2` // which is different from the spec. It should be `a=1&a=2` $query = preg_replace('#%5B\d+%5D#', '', $query); @@ -190,10 +206,11 @@ public function encodeExplodeVars(Node\Variable $var, $data): null|array|string // handle reserved charset if ($this->reserved) { + $query = str_replace( array_keys(static::$reserved_chars), static::$reserved_chars, - $query, + $query ); } diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/UnNamed.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/UnNamed.php index d1e53dd8f..14a49b299 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/UnNamed.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Operator/UnNamed.php @@ -9,39 +9,37 @@ * | 1 | {/list} /red,green,blue | {$value}*(?:,{$value}+)* * | 2 | {/list*} /red/green/blue | {$value}+(?:{$sep}{$value}+)* * | 3 | {/keys} /semi,%3B,dot,.,comma,%2C | /(\w+,?)+ - * | 4 | {/keys*} /semi=%3B/dot=./comma=%2C | /(?:\w+=\w+/?)*. + * | 4 | {/keys*} /semi=%3B/dot=./comma=%2C | /(?:\w+=\w+/?)* */ class UnNamed extends Abstraction { - public function toRegex(Parser $parser, Node\Variable $var): string + public function toRegex(Parser $parser, Node\Variable $var) { + $regex = null; $value = $this->getRegex(); $options = $var->options; if ($options['modifier']) { - switch ($options['modifier']) { + switch($options['modifier']) { case '*': // 2 | 4 $regex = "{$value}+(?:{$this->sep}{$value}+)*"; - break; - case ':': - $regex = $value . '{0,' . $options['value'] . '}'; - + $regex = $value.'{0,'.$options['value'].'}'; break; - case '%': - throw new \InvalidArgumentException('% (array) modifier only works with Named type operators e.g. ;,?,&'); - + throw new \Exception("% (array) modifier only works with Named type operators e.g. ;,?,&"); default: - throw new \InvalidArgumentException("Unknown modifier `{$options['modifier']}`"); + throw new \Exception("Unknown modifier `{$options['modifier']}`"); } - } else { + } + + else { // 1, 3 $regex = "{$value}*(?:,{$value}+)*"; } return $regex; } -} +} \ No newline at end of file diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Parser.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Parser.php index 48e8f17ca..10ca382a2 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Parser.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/Parser.php @@ -2,33 +2,34 @@ namespace Rize\UriTemplate; -use Rize\UriTemplate\Node\Abstraction; +use Rize\UriTemplate\Node; use Rize\UriTemplate\Node\Expression; -use Rize\UriTemplate\Node\Variable; +use Rize\UriTemplate\Operator; use Rize\UriTemplate\Operator\UnNamed; class Parser { - private const REGEX_VARNAME = '[A-z0-9.]|%[0-9a-fA-F]{2}'; + const REGEX_VARNAME = '(?:[A-z0-9_\.]|%[0-9a-fA-F]{2})'; /** - * Parses URI Template and returns nodes. + * Parses URI Template and returns nodes * + * @param string $template * @return Node\Abstraction[] */ - public function parse(string $template): array + public function parse($template) { - $parts = preg_split('#(\{[^}]+})#', $template, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); - $nodes = []; + $parts = preg_split('#(\{[^\}]+\})#', $template, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); + $nodes = array(); - foreach ($parts as $part) { + foreach($parts as $part) { $node = $this->createNode($part); // if current node has dot separator that requires a forward lookup // for the previous node iff previous node's operator is UnNamed if ($node instanceof Expression && $node->getOperator()->id === '.') { - if (count($nodes) > 0) { - $previousNode = $nodes[count($nodes) - 1]; + if (sizeof($nodes) > 0) { + $previousNode = $nodes[sizeof($nodes) - 1]; if ($previousNode instanceof Expression && $previousNode->getOperator() instanceof UnNamed) { $previousNode->setForwardLookupSeparator($node->getOperator()->id); } @@ -41,7 +42,11 @@ public function parse(string $template): array return $nodes; } - protected function createNode(string $token): Abstraction + /** + * @param string $token + * @return Node\Abstraction + */ + protected function createNode($token) { // literal string if ($token[0] !== '{') { @@ -54,16 +59,17 @@ protected function createNode(string $token): Abstraction return $node; } - protected function parseExpression(string $expression): Expression + protected function parseExpression($expression) { $token = $expression; $prefix = $token[0]; // not a valid operator? if (!Operator\Abstraction::isValid($prefix)) { + // not valid chars? - if (!preg_match('#' . self::REGEX_VARNAME . '#', $token)) { - throw new \InvalidArgumentException("Invalid operator [{$prefix}] found at {$token}"); + if (!preg_match('#'.self::REGEX_VARNAME.'#', $token)) { + throw new \Exception("Invalid operator [$prefix] found at {$token}"); } // default operator @@ -76,71 +82,74 @@ protected function parseExpression(string $expression): Expression } // parse variables - $vars = []; - foreach (explode(',', $token) as $var) { + $vars = array(); + foreach(explode(',', $token) as $var) { $vars[] = $this->parseVariable($var); } return $this->createExpressionNode( $token, $this->createOperatorNode($prefix), - $vars, + $vars ); } - protected function parseVariable(string $var): Variable + protected function parseVariable($var) { $var = trim($var); $val = null; $modifier = null; // check for prefix (:) / explode (*) / array (%) modifier - if (str_contains($var, ':')) { + if (strpos($var, ':') !== false) { $modifier = ':'; - [$varname, $val] = explode(':', $var); + list($varname, $val) = explode(':', $var); // error checking if (!is_numeric($val)) { - throw new \InvalidArgumentException("Value for `:` modifier must be numeric value [{$varname}:{$val}]"); + throw new \Exception("Value for `:` modifier must be numeric value [$varname:$val]"); } } - switch ($last = substr($var, -1)) { + switch($last = substr($var, -1)) { case '*': case '%': + // there can be only 1 modifier per var if ($modifier) { - throw new \InvalidArgumentException("Multiple modifiers per variable are not allowed [{$var}]"); + throw new \Exception("Multiple modifiers per variable are not allowed [$var]"); } $modifier = $last; - $var = substr($var, 0, -1); - + $var = substr($var, 0, -1); break; } return $this->createVariableNode( $var, - ['modifier' => $modifier, 'value' => $val], + array( + 'modifier' => $modifier, + 'value' => $val, + ) ); } - protected function createVariableNode($token, $options = []): Variable + protected function createVariableNode($token, $options = array()) { - return new Variable($token, $options); + return new Node\Variable($token, $options); } - protected function createExpressionNode($token, ?Operator\Abstraction $operator = null, array $vars = []): Expression + protected function createExpressionNode($token, Operator\Abstraction $operator = null, array $vars = array()) { - return new Expression($token, $operator, $vars); + return new Node\Expression($token, $operator, $vars); } - protected function createLiteralNode(string $token): Node\Literal + protected function createLiteralNode($token) { return new Node\Literal($token); } - protected function createOperatorNode($token): Operator\Abstraction + protected function createOperatorNode($token) { return Operator\Abstraction::createById($token); } diff --git a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/UriTemplate.php b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/UriTemplate.php index 2170bfc80..983d5b555 100644 --- a/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/UriTemplate.php +++ b/lib/Google/vendor/rize/uri-template/src/Rize/UriTemplate/UriTemplate.php @@ -5,6 +5,8 @@ use Rize\UriTemplate as Template; /** - * Future compatibility. + * Future compatibility */ -class UriTemplate extends Template {} +class UriTemplate extends Template +{ +} diff --git a/lib/Google/vendor/rize/uri-template/tests/Rize/Uri/Node/ParserTest.php b/lib/Google/vendor/rize/uri-template/tests/Rize/Uri/Node/ParserTest.php deleted file mode 100644 index 203d2384e..000000000 --- a/lib/Google/vendor/rize/uri-template/tests/Rize/Uri/Node/ParserTest.php +++ /dev/null @@ -1,93 +0,0 @@ - ':', 'value' => 1], - )], - ), new Node\Literal('/'), new Node\Expression( - 'term', - Operator\Abstraction::createById(''), - [new Node\Variable( - 'term', - ['modifier' => null, 'value' => null], - )], - ), new Node\Literal('/'), new Node\Expression( - 'test*', - Operator\Abstraction::createById(''), - [new Node\Variable( - 'test', - ['modifier' => '*', 'value' => null], - )], - ), new Node\Literal('/foo'), new Node\Expression( - 'query,number', - Operator\Abstraction::createById('?'), - [new Node\Variable( - 'query', - ['modifier' => null, 'value' => null], - ), new Node\Variable( - 'number', - ['modifier' => null, 'value' => null], - )], - )]; - - $service = $this->service(); - $actual = $service->parse($input); - - $this->assertEquals($expected, $actual); - } - - public function testParseTemplateWithLiteral() - { - // will pass - $uri = new UriTemplate('http://www.example.com/v1/company/', []); - $params = $uri->extract('/{countryCode}/{registrationNumber}/test{.format}', '/gb/0123456/test.json'); - static::assertEquals(['countryCode' => 'gb', 'registrationNumber' => '0123456', 'format' => 'json'], $params); - } - - #[Depends('testParseTemplateWithLiteral')] - public function testParseTemplateWithTwoVariablesAndDotBetween() - { - // will fail - $uri = new UriTemplate('http://www.example.com/v1/company/', []); - $params = $uri->extract('/{countryCode}/{registrationNumber}{.format}', '/gb/0123456.json'); - static::assertEquals(['countryCode' => 'gb', 'registrationNumber' => '0123456', 'format' => 'json'], $params); - } - - #[Depends('testParseTemplateWithLiteral')] - public function testParseTemplateWithTwoVariablesAndDotBetweenStrict() - { - // will fail - $uri = new UriTemplate('http://www.example.com/v1/company/', []); - $params = $uri->extract('/{countryCode}/{registrationNumber}{.format}', '/gb/0123456.json', true); - static::assertEquals(['countryCode' => 'gb', 'registrationNumber' => '0123456', 'format' => 'json'], $params); - } - - #[Depends('testParseTemplateWithLiteral')] - public function testParseTemplateWithThreeVariablesAndDotBetweenStrict() - { - // will fail - $uri = new UriTemplate('http://www.example.com/v1/company/', []); - $params = $uri->extract('/{countryCode}/{registrationNumber}{.namespace}{.format}', '/gb/0123456.company.json'); - static::assertEquals(['countryCode' => 'gb', 'registrationNumber' => '0123456', 'namespace' => 'company', 'format' => 'json'], $params); - } -} diff --git a/lib/Google/vendor/rize/uri-template/tests/Rize/UriTemplateTest.php b/lib/Google/vendor/rize/uri-template/tests/Rize/UriTemplateTest.php deleted file mode 100644 index 427f93f44..000000000 --- a/lib/Google/vendor/rize/uri-template/tests/Rize/UriTemplateTest.php +++ /dev/null @@ -1,253 +0,0 @@ - ["one", "two", "three"], 'dom' => ["example", "com"], 'dub' => "me/too", 'hello' => "Hello World!", 'half' => "50%", 'var' => "value", 'who' => "fred", 'base' => "http://example.com/home/", 'path' => "/foo/bar", 'list' => ["red", "green", "blue"], 'keys' => ["semi" => ";", "dot" => ".", "comma" => ","], 'list_with_empty' => [''], 'keys_with_empty' => ['john' => ''], 'v' => "6", 'x' => "1024", 'y' => "768", 'empty' => "", 'empty_keys' => [], 'undef' => null]; - - return [ - ['http://example.com/~john', ['uri' => 'http://example.com/~{username}', 'params' => ['username' => 'john']]], - ['http://example.com/dictionary/d/dog', ['uri' => 'http://example.com/dictionary/{term:1}/{term}', 'params' => ['term' => 'dog'], 'extract' => ['term:1' => 'd', 'term' => 'dog']]], - # Form-style parameters expression - ['http://example.com/j/john/search?q=mycelium&q=3&lang=th,jp,en', ['uri' => 'http://example.com/{term:1}/{term}/search{?q*,lang}', 'params' => ['q' => ['mycelium', 3], 'lang' => ['th', 'jp', 'en'], 'term' => 'john']]], - ['http://www.example.com/john', ['uri' => 'http://www.example.com/{username}', 'params' => ['username' => 'john']]], - ['http://www.example.com/foo?query=mycelium&number=100', ['uri' => 'http://www.example.com/foo{?query,number}', 'params' => ['query' => 'mycelium', 'number' => 100]]], - # 'query' is undefined - ['http://www.example.com/foo?number=100', [ - 'uri' => 'http://www.example.com/foo{?query,number}', - 'params' => ['number' => 100], - # we can't extract undefined values - 'extract' => false, - ]], - # undefined variables - ['http://www.example.com/foo', ['uri' => 'http://www.example.com/foo{?query,number}', 'params' => [], 'extract' => ['query' => null, 'number' => null]]], - ['http://www.example.com/foo', ['uri' => 'http://www.example.com/foo{?number}', 'params' => [], 'extract' => ['number' => null]]], - ['one,two,three|one,two,three|/one,two,three|/one/two/three|;count=one,two,three|;count=one;count=two;count=three|?count=one,two,three|?count=one&count=two&count=three|&count=one&count=two&count=three', ['uri' => '{count}|{count*}|{/count}|{/count*}|{;count}|{;count*}|{?count}|{?count*}|{&count*}', 'params' => ['count' => ['one', 'two', 'three']]]], - ['http://www.host.com/path/to/a/file.x.y', ['uri' => 'http://{host}{/segments*}/{file}{.extensions*}', 'params' => ['host' => 'www.host.com', 'segments' => ['path', 'to', 'a'], 'file' => 'file', 'extensions' => ['x', 'y']], 'extract' => ['host' => 'www.host.com', 'segments' => ['path', 'to', 'a'], 'file' => 'file.x.y', 'extensions' => null]]], - # level 1 - Simple String Expansion: {var} - ['value|Hello%20World%21|50%25|OX|OX|1024,768|1024,Hello%20World%21,768|?1024,|?1024|?768|val|value|red,green,blue|semi,%3B,dot,.,comma,%2C|semi=%3B,dot=.,comma=%2C', ['uri' => '{var}|{hello}|{half}|O{empty}X|O{undef}X|{x,y}|{x,hello,y}|?{x,empty}|?{x,undef}|?{undef,y}|{var:3}|{var:30}|{list}|{keys}|{keys*}', 'params' => $params]], - # level 2 - Reserved Expansion: {+var} - ['value|Hello%20World!|50%25|http%3A%2F%2Fexample.com%2Fhome%2Findex|http://example.com/home/index|OX|OX|/foo/bar/here|here?ref=/foo/bar|up/foo/barvalue/here|1024,Hello%20World!,768|/foo/bar,1024/here|/foo/b/here|red,green,blue|red,green,blue|semi,;,dot,.,comma,,|semi=;,dot=.,comma=,', ['uri' => '{+var}|{+hello}|{+half}|{base}index|{+base}index|O{+empty}X|O{+undef}X|{+path}/here|here?ref={+path}|up{+path}{var}/here|{+x,hello,y}|{+path,x}/here|{+path:6}/here|{+list}|{+list*}|{+keys}|{+keys*}', 'params' => $params]], - # level 2 - Fragment Expansion: {#var} - ['#value|#Hello%20World!|#50%25|foo#|foo|#1024,Hello%20World!,768|#/foo/bar,1024/here|#/foo/b/here|#red,green,blue|#red,green,blue|#semi,;,dot,.,comma,,|#semi=;,dot=.,comma=,', ['uri' => '{#var}|{#hello}|{#half}|foo{#empty}|foo{#undef}|{#x,hello,y}|{#path,x}/here|{#path:6}/here|{#list}|{#list*}|{#keys}|{#keys*}', 'params' => $params]], - # Label Expansion with Dot-Prefix: {.var} - ['.fred|.fred.fred|.50%25.fred|www.example.com|X.value|X.|X|X.val|X.red,green,blue|X.red.green.blue|X.semi,%3B,dot,.,comma,%2C|X.semi=%3B.dot=..comma=%2C|X|X', ['uri' => '{.who}|{.who,who}|{.half,who}|www{.dom*}|X{.var}|X{.empty}|X{.undef}|X{.var:3}|X{.list}|X{.list*}|X{.keys}|X{.keys*}|X{.empty_keys}|X{.empty_keys*}', 'params' => $params]], - # Path Segment Expansion: {/var} - ['/fred|/fred/fred|/50%25/fred|/fred/me%2Ftoo|/value|/value/|/value|/value/1024/here|/v/value|/red,green,blue|/red/green/blue|/red/green/blue/%2Ffoo|/semi,%3B,dot,.,comma,%2C|/semi=%3B/dot=./comma=%2C', ['uri' => '{/who}|{/who,who}|{/half,who}|{/who,dub}|{/var}|{/var,empty}|{/var,undef}|{/var,x}/here|{/var:1,var}|{/list}|{/list*}|{/list*,path:4}|{/keys}|{/keys*}', 'params' => $params]], - # Path-Style Parameter Expansion: {;var} - [';who=fred|;half=50%25|;empty|;v=6;empty;who=fred|;v=6;who=fred|;x=1024;y=768|;x=1024;y=768;empty|;x=1024;y=768|;hello=Hello|;list=red,green,blue|;list=red;list=green;list=blue|;keys=semi,%3B,dot,.,comma,%2C|;semi=%3B;dot=.;comma=%2C', ['uri' => '{;who}|{;half}|{;empty}|{;v,empty,who}|{;v,bar,who}|{;x,y}|{;x,y,empty}|{;x,y,undef}|{;hello:5}|{;list}|{;list*}|{;keys}|{;keys*}', 'params' => $params]], - # Form-Style Query Expansion: {?var} - ['?who=fred|?half=50%25|?x=1024&y=768|?x=1024&y=768&empty=|?x=1024&y=768|?var=val|?list=red,green,blue|?list=red&list=green&list=blue|?keys=semi,%3B,dot,.,comma,%2C|?semi=%3B&dot=.&comma=%2C|?list_with_empty=|?john=', ['uri' => '{?who}|{?half}|{?x,y}|{?x,y,empty}|{?x,y,undef}|{?var:3}|{?list}|{?list*}|{?keys}|{?keys*}|{?list_with_empty*}|{?keys_with_empty*}', 'params' => $params]], - # Form-Style Query Continuation: {&var} - ['&who=fred|&half=50%25|?fixed=yes&x=1024|&x=1024&y=768&empty=|&x=1024&y=768|&var=val|&list=red,green,blue|&list=red&list=green&list=blue|&keys=semi,%3B,dot,.,comma,%2C|&semi=%3B&dot=.&comma=%2C', ['uri' => '{&who}|{&half}|?fixed=yes{&x}|{&x,y,empty}|{&x,y,undef}|{&var:3}|{&list}|{&list*}|{&keys}|{&keys*}', 'params' => $params]], - # Test empty values - ['|||', ['uri' => '{empty}|{empty*}|{?empty}|{?empty*}', 'params' => ['empty' => []]]], - ]; - } - - public static function dataExpandWithArrayModifier() - { - return [ - # List - [ - # '?choices[]=a&choices[]=b&choices[]=c', - '?choices%5B%5D=a&choices%5B%5D=b&choices%5B%5D=c', - ['uri' => '{?choices%}', 'params' => ['choices' => ['a', 'b', 'c']]], - ], - # Keys - [ - # '?choices[a]=1&choices[b]=2&choices[c][test]=3', - '?choices%5Ba%5D=1&choices%5Bb%5D=2&choices%5Bc%5D%5Btest%5D=3', - ['uri' => '{?choices%}', 'params' => ['choices' => ['a' => 1, 'b' => 2, 'c' => ['test' => 3]]]], - ], - # Mixed - [ - # '?list[]=a&list[]=b&keys[a]=1&keys[b]=2', - '?list%5B%5D=a&list%5B%5D=b&keys%5Ba%5D=1&keys%5Bb%5D=2', - ['uri' => '{?list%,keys%}', 'params' => ['list' => ['a', 'b'], 'keys' => ['a' => 1, 'b' => 2]]], - ], - ]; - } - - public static function dataBaseTemplate() - { - return [ - [ - 'http://google.com/api/1/users/1', - # base uri - ['uri' => '{+host}/api/{v}', 'params' => ['host' => 'http://google.com', 'v' => 1]], - # other uri - ['uri' => '/{resource}/{id}', 'params' => ['resource' => 'users', 'id' => 1]], - ], - # test override base params - [ - 'http://github.com/api/1/users/1', - # base uri - ['uri' => '{+host}/api/{v}', 'params' => ['host' => 'http://google.com', 'v' => 1]], - # other uri - ['uri' => '/{resource}/{id}', 'params' => ['host' => 'http://github.com', 'resource' => 'users', 'id' => 1]], - ], - ]; - } - - public static function dataExtraction() - { - return [['/no/{term:1}/random/foo{?query,list%,keys%}', '/no/j/random/foo?query=1,2,3&list%5B%5D=a&list%5B%5D=b&keys%5Ba%5D=1&keys%5Bb%5D=2&keys%5Bc%5D%5Btest%5D%5Btest%5D=1', ['term:1' => 'j', 'query' => [1, 2, 3], 'list' => ['a', 'b'], 'keys' => ['a' => 1, 'b' => 2, 'c' => ['test' => ['test' => 1]]]]], ['/no/{term:1}/random/{term}/{test*}/foo{?query,number}', '/no/j/random/john/a,b,c/foo?query=1,2,3&number=10', ['term:1' => 'j', 'term' => 'john', 'test' => ['a', 'b', 'c'], 'query' => [1, 2, 3], 'number' => 10]], ['/search/{term:1}/{term}/{?q*,limit}', '/search/j/john/?a=1&b=2&limit=10', ['term:1' => 'j', 'term' => 'john', 'q' => ['a' => 1, 'b' => 2], 'limit' => 10]], ['http://www.example.com/foo{?query,number}', 'http://www.example.com/foo?query=5', ['query' => 5, 'number' => null]], ['{count}|{count*}|{/count}|{/count*}|{;count}|{;count*}|{?count}|{?count*}|{&count*}', 'one,two,three|one,two,three|/one,two,three|/one/two/three|;count=one,two,three|;count=one;count=two;count=three|?count=one,two,three|?count=one&count=two&count=three|&count=one&count=two&count=three', ['count' => ['one', 'two', 'three']]], ['http://example.com/{term:1}/{term}/search{?q*,lang}', 'http://example.com/j/john/search?q=Hello%20World%21&q=3&lang=th,jp,en', ['q' => ['Hello World!', 3], 'lang' => ['th', 'jp', 'en'], 'term' => 'john', 'term:1' => 'j']], ['/foo/bar/{number}', '/foo/bar/0', ['number' => 0]], ['/some/{path}{?ref}', '/some/foo', ['path' => 'foo', 'ref' => null]]]; - } - - /** - * @dataProvider dataExpansion - */ - public function testExpansion($expected, $input) - { - $service = $this->service(); - $result = $service->expand($input['uri'], $input['params']); - - $this->assertEquals($expected, $result); - } - - /** - * @dataProvider dataExpandWithArrayModifier - */ - public function testExpandWithArrayModifier($expected, $input) - { - $service = $this->service(); - $result = $service->expand($input['uri'], $input['params']); - - $this->assertEquals($expected, $result); - } - - /** - * @dataProvider dataBaseTemplate - */ - public function testBaseTemplate($expected, $base, $other) - { - $service = $this->service($base['uri'], $base['params']); - $result = $service->expand($other['uri'], $other['params']); - - $this->assertEquals($expected, $result); - } - - /** - * @dataProvider dataExtraction - */ - public function testExtract($template, $uri, $expected) - { - $service = $this->service(); - $actual = $service->extract($template, $uri); - - $this->assertEquals($expected, $actual); - } - - public function testExpandFromFixture() - { - $dir = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR; - $files = ['spec-examples.json', 'spec-examples-by-section.json', 'extended-tests.json']; - $service = $this->service(); - - foreach ($files as $file) { - $content = json_decode(file_get_contents($dir . $file), $array = true); - - # iterate through each fixture - foreach ($content as $fixture) { - $vars = $fixture['variables']; - - # assert each test cases - foreach ($fixture['testcases'] as $case) { - [$uri, $expected] = $case; - - $actual = $service->expand($uri, $vars); - - if (is_array($expected)) { - $expected = current(array_filter($expected, fn($input) => $actual === $input)); - } - - $this->assertEquals($expected, $actual); - } - } - } - } - - public static function dataExtractStrictMode() - { - $dataTest = [['/search/{term:1}/{term}/{?q*,limit}', '/search/j/john/?a=1&b=2&limit=10', ['term:1' => 'j', 'term' => 'john', 'limit' => '10', 'q' => ['a' => '1', 'b' => '2']]], ['http://example.com/{term:1}/{term}/search{?q*,lang}', 'http://example.com/j/john/search?q=Hello%20World%21&q=3&lang=th,jp,en', ['term:1' => 'j', 'term' => 'john', 'lang' => ['th', 'jp', 'en'], 'q' => ['Hello World!', '3']]], ['/foo/bar/{number}', '/foo/bar/0', ['number' => 0]], ['/', '/', []]]; - - $rfc3986AllowedPathCharacters = ['-', '.', '_', '~', '!', '$', '&', "'", '(', ')', '*', '+', ',', ';', '=', ':', '@']; - - foreach ($rfc3986AllowedPathCharacters as $char) { - $title = "RFC3986 path character ($char)"; - $title = str_replace("'", 'single quote', $title); // PhpStorm workaround - if ($char === ',') { // , means array on RFC6570 - $params = ['term' => ['foo', 'baz']]; - } else { - $params = ['term' => "foo{$char}baz"]; - } - - $data = ['/search/{term}', "/search/foo{$char}baz", $params]; - - $dataTest[$title] = $data; - $data = ['/search/{;term}', "/search/;term=foo{$char}baz", $params]; - $dataTest['Named ' . $title] = $data; - } - - $rfc3986AllowedQueryCharacters = $rfc3986AllowedPathCharacters; - $rfc3986AllowedQueryCharacters[] = '/'; - $rfc3986AllowedQueryCharacters[] = '?'; - unset($rfc3986AllowedQueryCharacters[array_search('&', $rfc3986AllowedQueryCharacters, true)]); - - foreach ($rfc3986AllowedQueryCharacters as $char) { - $title = "RFC3986 query character ($char)"; - $title = str_replace("'", 'single quote', $title); // PhpStorm workaround - if ($char === ',') { // , means array on RFC6570 - $params = ['term' => ['foo', 'baz']]; - } else { - $params = ['term' => "foo{$char}baz"]; - } - - $data = ['/search/{?term}', "/search/?term=foo{$char}baz", $params]; - $dataTest['Named ' . $title] = $data; - } - - return $dataTest; - } - - public static function extractStrictModeNotMatchProvider() - { - return [['/', '/a'], ['/{test}', '/a/'], ['/search/{term:1}/{term}/{?q*,limit}', '/search/j/?a=1&b=2&limit=10'], ['http://www.example.com/foo{?query,number}', 'http://www.example.com/foo?query=5'], ['http://www.example.com/foo{?query,number}', 'http://www.example.com/foo'], ['http://example.com/{term:1}/{term}/search{?q*,lang}', 'http://example.com/j/john/search?q=']]; - } - - #[DataProvider('dataExtractStrictMode')] - public function testExtractStrictMode(string $template, string $uri, array $expectedParams) - { - $service = $this->service(); - $params = $service->extract($template, $uri, true); - - $this->assertTrue(isset($params)); - $this->assertEquals($expectedParams, $params); - } - - #[DataProvider('extractStrictModeNotMatchProvider')] - public function testExtractStrictModeNotMatch(string $template, string $uri) - { - $service = $this->service(); - $actual = $service->extract($template, $uri, true); - - $this->assertFalse(isset($actual)); - } -} diff --git a/lib/Google/vendor/rize/uri-template/tests/fixtures/README.md b/lib/Google/vendor/rize/uri-template/tests/fixtures/README.md deleted file mode 100644 index 3eb519da6..000000000 --- a/lib/Google/vendor/rize/uri-template/tests/fixtures/README.md +++ /dev/null @@ -1,90 +0,0 @@ - -URI Template Tests -================== - -This is a set of tests for implementations of -[RFC6570](http://tools.ietf.org/html/rfc6570) - URI Template. It is designed -to be reused by any implementation, to improve interoperability and -implementation quality. - -If your project uses Git for version control, you can make uritemplate-tests into a [submodule](http://help.github.com/submodules/). - -Test Format ------------ - -Each test file is a [JSON](http://tools.ietf.org/html/RFC6627) document -containing an object whose properties are groups of related tests. -Alternatively, all tests are available in XML as well, with the XML files -being generated by transform-json-tests.xslt which uses json2xml.xslt as a -general-purpose JSON-to-XML parsing library. - -Each group, in turn, is an object with three children: - -* level - the level of the tests covered, as per the RFC (optional; if absent, - assume level 4). -* variables - an object representing the variables that are available to the - tests in the suite -* testcases - a list of testcases, where each case is a two-member list, the - first being the template, the second being the result of expanding the - template with the provided variables. - -Note that the result string can be a few different things: - -* string - if the second member is a string, the result of expansion is - expected to match it, character-for-character. -* list - if the second member is a list of strings, the result of expansion - is expected to match one of them; this allows for templates that can - expand into different, equally-acceptable URIs. -* false - if the second member is boolean false, expansion is expected to - fail (i.e., the template was invalid). - -For example: - - { - "Level 1 Examples" : - { - "level": 1, - "variables": { - "var" : "value", - "hello" : "Hello World!" - }, - "testcases" : [ - ["{var}", "value"], - ["{hello}", "Hello%20World%21"] - ] - } - } - - -Tests Included --------------- - -The following test files are included: - -* spec-examples.json - The complete set of example templates from the RFC -* spec-examples-by-section.json - The examples, section by section -* extended-tests.json - more complex test cases -* negative-tests.json - invalid templates - -For all these test files, XML versions with the names *.xml can be -generated with the transform-json-tests.xslt XSLT stylesheet. The XSLT -contains the names of the above test files as a parameter, and can be -started with any XML as input (i.e., the XML input is ignored). - -License -------- - - Copyright 2011-2012 The Authors - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/lib/Google/vendor/rize/uri-template/tests/fixtures/extended-tests.json b/lib/Google/vendor/rize/uri-template/tests/fixtures/extended-tests.json deleted file mode 100644 index 8ae8134cc..000000000 --- a/lib/Google/vendor/rize/uri-template/tests/fixtures/extended-tests.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "Additional Examples 1":{ - "level":4, - "variables":{ - "id" : "person", - "token" : "12345", - "fields" : ["id", "name", "picture"], - "format" : "json", - "q" : "URI Templates", - "page" : "5", - "lang" : "en", - "geocode" : ["37.76","-122.427"], - "first_name" : "John", - "last.name" : "Doe", - "Some%20Thing" : "foo", - "number" : 6, - "long" : 37.76, - "lat" : -122.427, - "group_id" : "12345", - "query" : "PREFIX dc: SELECT ?book ?who WHERE { ?book dc:creator ?who }", - "uri" : "http://example.org/?uri=http%3A%2F%2Fexample.org%2F", - "word" : "drücken", - "Stra%C3%9Fe" : "Grüner Weg", - "random" : "šö䟜ñꀣ¥‡ÑÒÓÔÕÖרÙÚàáâãäåæçÿ", - "assoc_special_chars" : - { "šö䟜ñꀣ¥‡ÑÒÓÔÕ" : "ÖרÙÚàáâãäåæçÿ" } - }, - "testcases":[ - - [ "{/id*}" , "/person" ], - [ "{/id*}{?fields,first_name,last.name,token}" , [ - "/person?fields=id,name,picture&first_name=John&last.name=Doe&token=12345", - "/person?fields=id,picture,name&first_name=John&last.name=Doe&token=12345", - "/person?fields=picture,name,id&first_name=John&last.name=Doe&token=12345", - "/person?fields=picture,id,name&first_name=John&last.name=Doe&token=12345", - "/person?fields=name,picture,id&first_name=John&last.name=Doe&token=12345", - "/person?fields=name,id,picture&first_name=John&last.name=Doe&token=12345"] - ], - ["/search.{format}{?q,geocode,lang,locale,page,result_type}", - [ "/search.json?q=URI%20Templates&geocode=37.76,-122.427&lang=en&page=5", - "/search.json?q=URI%20Templates&geocode=-122.427,37.76&lang=en&page=5"] - ], - ["/test{/Some%20Thing}", "/test/foo" ], - ["/set{?number}", "/set?number=6"], - ["/loc{?long,lat}" , "/loc?long=37.76&lat=-122.427"], - ["/base{/group_id,first_name}/pages{/page,lang}{?format,q}","/base/12345/John/pages/5/en?format=json&q=URI%20Templates"], - ["/sparql{?query}", "/sparql?query=PREFIX%20dc%3A%20%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%20SELECT%20%3Fbook%20%3Fwho%20WHERE%20%7B%20%3Fbook%20dc%3Acreator%20%3Fwho%20%7D"], - ["/go{?uri}", "/go?uri=http%3A%2F%2Fexample.org%2F%3Furi%3Dhttp%253A%252F%252Fexample.org%252F"], - ["/service{?word}", "/service?word=dr%C3%BCcken"], - ["/lookup{?Stra%C3%9Fe}", "/lookup?Stra%25C3%259Fe=Gr%C3%BCner%20Weg"], - ["{random}" , "%C5%A1%C3%B6%C3%A4%C5%B8%C5%93%C3%B1%C3%AA%E2%82%AC%C2%A3%C2%A5%E2%80%A1%C3%91%C3%92%C3%93%C3%94%C3%95%C3%96%C3%97%C3%98%C3%99%C3%9A%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%BF"], - ["{?assoc_special_chars*}", "?%C5%A1%C3%B6%C3%A4%C5%B8%C5%93%C3%B1%C3%AA%E2%82%AC%C2%A3%C2%A5%E2%80%A1%C3%91%C3%92%C3%93%C3%94%C3%95=%C3%96%C3%97%C3%98%C3%99%C3%9A%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%BF"] - ] - }, - "Additional Examples 2":{ - "level":4, - "variables":{ - "id" : ["person","albums"], - "token" : "12345", - "fields" : ["id", "name", "picture"], - "format" : "atom", - "q" : "URI Templates", - "page" : "10", - "start" : "5", - "lang" : "en", - "geocode" : ["37.76","-122.427"] - }, - "testcases":[ - - [ "{/id*}" , ["/person/albums","/albums/person"] ], - [ "{/id*}{?fields,token}" , [ - "/person/albums?fields=id,name,picture&token=12345", - "/person/albums?fields=id,picture,name&token=12345", - "/person/albums?fields=picture,name,id&token=12345", - "/person/albums?fields=picture,id,name&token=12345", - "/person/albums?fields=name,picture,id&token=12345", - "/person/albums?fields=name,id,picture&token=12345", - "/albums/person?fields=id,name,picture&token=12345", - "/albums/person?fields=id,picture,name&token=12345", - "/albums/person?fields=picture,name,id&token=12345", - "/albums/person?fields=picture,id,name&token=12345", - "/albums/person?fields=name,picture,id&token=12345", - "/albums/person?fields=name,id,picture&token=12345"] - ] - ] - }, - "Additional Examples 3: Empty Variables":{ - "variables" : { - "empty_list" : [], - "empty_assoc" : {} - }, - "testcases":[ - [ "{/empty_list}", [ "" ] ], - [ "{/empty_list*}", [ "" ] ], - [ "{?empty_list}", [ ""] ], - [ "{?empty_list*}", [ "" ] ], - [ "{?empty_assoc}", [ "" ] ], - [ "{?empty_assoc*}", [ "" ] ] - ] - }, - "Additional Examples 4: Numeric Keys":{ - "variables" : { - "42" : "The Answer to the Ultimate Question of Life, the Universe, and Everything", - "1337" : ["leet", "as","it", "can","be"], - "german" : { - "11": "elf", - "12": "zwölf" - } - }, - "testcases":[ - [ "{42}", "The%20Answer%20to%20the%20Ultimate%20Question%20of%20Life%2C%20the%20Universe%2C%20and%20Everything"], - [ "{?42}", "?42=The%20Answer%20to%20the%20Ultimate%20Question%20of%20Life%2C%20the%20Universe%2C%20and%20Everything"], - [ "{1337}", "leet,as,it,can,be"], - [ "{?1337*}", "?1337=leet&1337=as&1337=it&1337=can&1337=be"], - [ "{?german*}", [ "?11=elf&12=zw%C3%B6lf", "?12=zw%C3%B6lf&11=elf"] ] - ] - } -} diff --git a/lib/Google/vendor/rize/uri-template/tests/fixtures/json2xml.xslt b/lib/Google/vendor/rize/uri-template/tests/fixtures/json2xml.xslt deleted file mode 100644 index 59b3548c0..000000000 --- a/lib/Google/vendor/rize/uri-template/tests/fixtures/json2xml.xslt +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \b - - - - - - - - - - - \v - - - - - \f - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/Google/vendor/rize/uri-template/tests/fixtures/negative-tests.json b/lib/Google/vendor/rize/uri-template/tests/fixtures/negative-tests.json deleted file mode 100644 index 552a6bf07..000000000 --- a/lib/Google/vendor/rize/uri-template/tests/fixtures/negative-tests.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "Failure Tests":{ - "level":4, - "variables":{ - "id" : "thing", - "var" : "value", - "hello" : "Hello World!", - "with space" : "fail", - " leading_space" : "Hi!", - "trailing_space " : "Bye!", - "empty" : "", - "path" : "/foo/bar", - "x" : "1024", - "y" : "768", - "list" : ["red", "green", "blue"], - "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, - "example" : "red", - "searchTerms" : "uri templates", - "~thing" : "some-user", - "default-graph-uri" : ["http://www.example/book/","http://www.example/papers/"], - "query" : "PREFIX dc: SELECT ?book ?who WHERE { ?book dc:creator ?who }" - - }, - "testcases":[ - [ "{/id*", false ], - [ "/id*}", false ], - [ "{/?id}", false ], - [ "{var:prefix}", false ], - [ "{hello:2*}", false ] , - [ "{??hello}", false ] , - [ "{!hello}", false ] , - [ "{with space}", false], - [ "{ leading_space}", false], - [ "{trailing_space }", false], - [ "{=path}", false ] , - [ "{$var}", false ], - [ "{|var*}", false ], - [ "{*keys?}", false ], - [ "{?empty=default,var}", false ], - [ "{var}{-prefix|/-/|var}" , false ], - [ "?q={searchTerms}&c={example:color?}" , false ], - [ "x{?empty|foo=none}" , false ], - [ "/h{#hello+}" , false ], - [ "/h#{hello+}" , false ], - [ "{keys:1}", false ], - [ "{+keys:1}", false ], - [ "{;keys:1*}", false ], - [ "?{-join|&|var,list}" , false ], - [ "/people/{~thing}", false], - [ "/{default-graph-uri}", false ], - [ "/sparql{?query,default-graph-uri}", false ], - [ "/sparql{?query){&default-graph-uri*}", false ], - [ "/resolution{?x, y}" , false ] - - ] - } -} \ No newline at end of file diff --git a/lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples-by-section.json b/lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples-by-section.json deleted file mode 100644 index 5aef18205..000000000 --- a/lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples-by-section.json +++ /dev/null @@ -1,439 +0,0 @@ -{ - "3.2.1 Variable Expansion" : - { - "variables": { - "count" : ["one", "two", "three"], - "dom" : ["example", "com"], - "dub" : "me/too", - "hello" : "Hello World!", - "half" : "50%", - "var" : "value", - "who" : "fred", - "base" : "http://example.com/home/", - "path" : "/foo/bar", - "list" : ["red", "green", "blue"], - "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, - "v" : "6", - "x" : "1024", - "y" : "768", - "empty" : "", - "empty_keys" : [], - "undef" : null - }, - "testcases" : [ - ["{count}", "one,two,three"], - ["{count*}", "one,two,three"], - ["{/count}", "/one,two,three"], - ["{/count*}", "/one/two/three"], - ["{;count}", ";count=one,two,three"], - ["{;count*}", ";count=one;count=two;count=three"], - ["{?count}", "?count=one,two,three"], - ["{?count*}", "?count=one&count=two&count=three"], - ["{&count*}", "&count=one&count=two&count=three"] - ] - }, - "3.2.2 Simple String Expansion" : - { - "variables": { - "count" : ["one", "two", "three"], - "dom" : ["example", "com"], - "dub" : "me/too", - "hello" : "Hello World!", - "half" : "50%", - "var" : "value", - "who" : "fred", - "base" : "http://example.com/home/", - "path" : "/foo/bar", - "list" : ["red", "green", "blue"], - "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, - "v" : "6", - "x" : "1024", - "y" : "768", - "empty" : "", - "empty_keys" : [], - "undef" : null - }, - "testcases" : [ - ["{var}", "value"], - ["{hello}", "Hello%20World%21"], - ["{half}", "50%25"], - ["O{empty}X", "OX"], - ["O{undef}X", "OX"], - ["{x,y}", "1024,768"], - ["{x,hello,y}", "1024,Hello%20World%21,768"], - ["?{x,empty}", "?1024,"], - ["?{x,undef}", "?1024"], - ["?{undef,y}", "?768"], - ["{var:3}", "val"], - ["{var:30}", "value"], - ["{list}", "red,green,blue"], - ["{list*}", "red,green,blue"], - ["{keys}", [ - "comma,%2C,dot,.,semi,%3B", - "comma,%2C,semi,%3B,dot,.", - "dot,.,comma,%2C,semi,%3B", - "dot,.,semi,%3B,comma,%2C", - "semi,%3B,comma,%2C,dot,.", - "semi,%3B,dot,.,comma,%2C" - ]], - ["{keys*}", [ - "comma=%2C,dot=.,semi=%3B", - "comma=%2C,semi=%3B,dot=.", - "dot=.,comma=%2C,semi=%3B", - "dot=.,semi=%3B,comma=%2C", - "semi=%3B,comma=%2C,dot=.", - "semi=%3B,dot=.,comma=%2C" - ]] - ] - }, - "3.2.3 Reserved Expansion" : - { - "variables": { - "count" : ["one", "two", "three"], - "dom" : ["example", "com"], - "dub" : "me/too", - "hello" : "Hello World!", - "half" : "50%", - "var" : "value", - "who" : "fred", - "base" : "http://example.com/home/", - "path" : "/foo/bar", - "list" : ["red", "green", "blue"], - "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, - "v" : "6", - "x" : "1024", - "y" : "768", - "empty" : "", - "empty_keys" : [], - "undef" : null - }, - "testcases" : [ - ["{+var}", "value"], - ["{/var,empty}", "/value/"], - ["{/var,undef}", "/value"], - ["{+hello}", "Hello%20World!"], - ["{+half}", "50%25"], - ["{base}index", "http%3A%2F%2Fexample.com%2Fhome%2Findex"], - ["{+base}index", "http://example.com/home/index"], - ["O{+empty}X", "OX"], - ["O{+undef}X", "OX"], - ["{+path}/here", "/foo/bar/here"], - ["{+path:6}/here", "/foo/b/here"], - ["here?ref={+path}", "here?ref=/foo/bar"], - ["up{+path}{var}/here", "up/foo/barvalue/here"], - ["{+x,hello,y}", "1024,Hello%20World!,768"], - ["{+path,x}/here", "/foo/bar,1024/here"], - ["{+list}", "red,green,blue"], - ["{+list*}", "red,green,blue"], - ["{+keys}", [ - "comma,,,dot,.,semi,;", - "comma,,,semi,;,dot,.", - "dot,.,comma,,,semi,;", - "dot,.,semi,;,comma,,", - "semi,;,comma,,,dot,.", - "semi,;,dot,.,comma,," - ]], - ["{+keys*}", [ - "comma=,,dot=.,semi=;", - "comma=,,semi=;,dot=.", - "dot=.,comma=,,semi=;", - "dot=.,semi=;,comma=,", - "semi=;,comma=,,dot=.", - "semi=;,dot=.,comma=," - ]] - ] - }, - "3.2.4 Fragment Expansion" : - { - "variables": { - "count" : ["one", "two", "three"], - "dom" : ["example", "com"], - "dub" : "me/too", - "hello" : "Hello World!", - "half" : "50%", - "var" : "value", - "who" : "fred", - "base" : "http://example.com/home/", - "path" : "/foo/bar", - "list" : ["red", "green", "blue"], - "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, - "v" : "6", - "x" : "1024", - "y" : "768", - "empty" : "", - "empty_keys" : [], - "undef" : null - }, - "testcases" : [ - ["{#var}", "#value"], - ["{#hello}", "#Hello%20World!"], - ["{#half}", "#50%25"], - ["foo{#empty}", "foo#"], - ["foo{#undef}", "foo"], - ["{#x,hello,y}", "#1024,Hello%20World!,768"], - ["{#path,x}/here", "#/foo/bar,1024/here"], - ["{#path:6}/here", "#/foo/b/here"], - ["{#list}", "#red,green,blue"], - ["{#list*}", "#red,green,blue"], - ["{#keys}", [ - "#comma,,,dot,.,semi,;", - "#comma,,,semi,;,dot,.", - "#dot,.,comma,,,semi,;", - "#dot,.,semi,;,comma,,", - "#semi,;,comma,,,dot,.", - "#semi,;,dot,.,comma,," - ]] - ] - }, - "3.2.5 Label Expansion with Dot-Prefix" : - { - "variables": { - "count" : ["one", "two", "three"], - "dom" : ["example", "com"], - "dub" : "me/too", - "hello" : "Hello World!", - "half" : "50%", - "var" : "value", - "who" : "fred", - "base" : "http://example.com/home/", - "path" : "/foo/bar", - "list" : ["red", "green", "blue"], - "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, - "v" : "6", - "x" : "1024", - "y" : "768", - "empty" : "", - "empty_keys" : [], - "undef" : null - }, - "testcases" : [ - ["{.who}", ".fred"], - ["{.who,who}", ".fred.fred"], - ["{.half,who}", ".50%25.fred"], - ["www{.dom*}", "www.example.com"], - ["X{.var}", "X.value"], - ["X{.var:3}", "X.val"], - ["X{.empty}", "X."], - ["X{.undef}", "X"], - ["X{.list}", "X.red,green,blue"], - ["X{.list*}", "X.red.green.blue"], - ["{#keys}", [ - "#comma,,,dot,.,semi,;", - "#comma,,,semi,;,dot,.", - "#dot,.,comma,,,semi,;", - "#dot,.,semi,;,comma,,", - "#semi,;,comma,,,dot,.", - "#semi,;,dot,.,comma,," - ]], - ["{#keys*}", [ - "#comma=,,dot=.,semi=;", - "#comma=,,semi=;,dot=.", - "#dot=.,comma=,,semi=;", - "#dot=.,semi=;,comma=,", - "#semi=;,comma=,,dot=.", - "#semi=;,dot=.,comma=," - ]], - ["X{.empty_keys}", "X"], - ["X{.empty_keys*}", "X"] - ] - }, - "3.2.6 Path Segment Expansion" : - { - "variables": { - "count" : ["one", "two", "three"], - "dom" : ["example", "com"], - "dub" : "me/too", - "hello" : "Hello World!", - "half" : "50%", - "var" : "value", - "who" : "fred", - "base" : "http://example.com/home/", - "path" : "/foo/bar", - "list" : ["red", "green", "blue"], - "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, - "v" : "6", - "x" : "1024", - "y" : "768", - "empty" : "", - "empty_keys" : [], - "undef" : null - }, - "testcases" : [ - ["{/who}", "/fred"], - ["{/who,who}", "/fred/fred"], - ["{/half,who}", "/50%25/fred"], - ["{/who,dub}", "/fred/me%2Ftoo"], - ["{/var}", "/value"], - ["{/var,empty}", "/value/"], - ["{/var,undef}", "/value"], - ["{/var,x}/here", "/value/1024/here"], - ["{/var:1,var}", "/v/value"], - ["{/list}", "/red,green,blue"], - ["{/list*}", "/red/green/blue"], - ["{/list*,path:4}", "/red/green/blue/%2Ffoo"], - ["{/keys}", [ - "/comma,%2C,dot,.,semi,%3B", - "/comma,%2C,semi,%3B,dot,.", - "/dot,.,comma,%2C,semi,%3B", - "/dot,.,semi,%3B,comma,%2C", - "/semi,%3B,comma,%2C,dot,.", - "/semi,%3B,dot,.,comma,%2C" - ]], - ["{/keys*}", [ - "/comma=%2C/dot=./semi=%3B", - "/comma=%2C/semi=%3B/dot=.", - "/dot=./comma=%2C/semi=%3B", - "/dot=./semi=%3B/comma=%2C", - "/semi=%3B/comma=%2C/dot=.", - "/semi=%3B/dot=./comma=%2C" - ]] - ] - }, - "3.2.7 Path-Style Parameter Expansion" : - { - "variables": { - "count" : ["one", "two", "three"], - "dom" : ["example", "com"], - "dub" : "me/too", - "hello" : "Hello World!", - "half" : "50%", - "var" : "value", - "who" : "fred", - "base" : "http://example.com/home/", - "path" : "/foo/bar", - "list" : ["red", "green", "blue"], - "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, - "v" : "6", - "x" : "1024", - "y" : "768", - "empty" : "", - "empty_keys" : [], - "undef" : null - }, - "testcases" : [ - ["{;who}", ";who=fred"], - ["{;half}", ";half=50%25"], - ["{;empty}", ";empty"], - ["{;hello:5}", ";hello=Hello"], - ["{;v,empty,who}", ";v=6;empty;who=fred"], - ["{;v,bar,who}", ";v=6;who=fred"], - ["{;x,y}", ";x=1024;y=768"], - ["{;x,y,empty}", ";x=1024;y=768;empty"], - ["{;x,y,undef}", ";x=1024;y=768"], - ["{;list}", ";list=red,green,blue"], - ["{;list*}", ";list=red;list=green;list=blue"], - ["{;keys}", [ - ";keys=comma,%2C,dot,.,semi,%3B", - ";keys=comma,%2C,semi,%3B,dot,.", - ";keys=dot,.,comma,%2C,semi,%3B", - ";keys=dot,.,semi,%3B,comma,%2C", - ";keys=semi,%3B,comma,%2C,dot,.", - ";keys=semi,%3B,dot,.,comma,%2C" - ]], - ["{;keys*}", [ - ";comma=%2C;dot=.;semi=%3B", - ";comma=%2C;semi=%3B;dot=.", - ";dot=.;comma=%2C;semi=%3B", - ";dot=.;semi=%3B;comma=%2C", - ";semi=%3B;comma=%2C;dot=.", - ";semi=%3B;dot=.;comma=%2C" - ]] - ] - }, - "3.2.8 Form-Style Query Expansion" : - { - "variables": { - "count" : ["one", "two", "three"], - "dom" : ["example", "com"], - "dub" : "me/too", - "hello" : "Hello World!", - "half" : "50%", - "var" : "value", - "who" : "fred", - "base" : "http://example.com/home/", - "path" : "/foo/bar", - "list" : ["red", "green", "blue"], - "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, - "v" : "6", - "x" : "1024", - "y" : "768", - "empty" : "", - "empty_keys" : [], - "undef" : null - }, - "testcases" : [ - ["{?who}", "?who=fred"], - ["{?half}", "?half=50%25"], - ["{?x,y}", "?x=1024&y=768"], - ["{?x,y,empty}", "?x=1024&y=768&empty="], - ["{?x,y,undef}", "?x=1024&y=768"], - ["{?var:3}", "?var=val"], - ["{?list}", "?list=red,green,blue"], - ["{?list*}", "?list=red&list=green&list=blue"], - ["{?keys}", [ - "?keys=comma,%2C,dot,.,semi,%3B", - "?keys=comma,%2C,semi,%3B,dot,.", - "?keys=dot,.,comma,%2C,semi,%3B", - "?keys=dot,.,semi,%3B,comma,%2C", - "?keys=semi,%3B,comma,%2C,dot,.", - "?keys=semi,%3B,dot,.,comma,%2C" - ]], - ["{?keys*}", [ - "?comma=%2C&dot=.&semi=%3B", - "?comma=%2C&semi=%3B&dot=.", - "?dot=.&comma=%2C&semi=%3B", - "?dot=.&semi=%3B&comma=%2C", - "?semi=%3B&comma=%2C&dot=.", - "?semi=%3B&dot=.&comma=%2C" - ]] - ] - }, - "3.2.9 Form-Style Query Continuation" : - { - "variables": { - "count" : ["one", "two", "three"], - "dom" : ["example", "com"], - "dub" : "me/too", - "hello" : "Hello World!", - "half" : "50%", - "var" : "value", - "who" : "fred", - "base" : "http://example.com/home/", - "path" : "/foo/bar", - "list" : ["red", "green", "blue"], - "keys" : { "semi" : ";", "dot" : ".", "comma" : ","}, - "v" : "6", - "x" : "1024", - "y" : "768", - "empty" : "", - "empty_keys" : [], - "undef" : null - }, - "testcases" : [ - ["{&who}", "&who=fred"], - ["{&half}", "&half=50%25"], - ["?fixed=yes{&x}", "?fixed=yes&x=1024"], - ["{&var:3}", "&var=val"], - ["{&x,y,empty}", "&x=1024&y=768&empty="], - ["{&x,y,undef}", "&x=1024&y=768"], - ["{&list}", "&list=red,green,blue"], - ["{&list*}", "&list=red&list=green&list=blue"], - ["{&keys}", [ - "&keys=comma,%2C,dot,.,semi,%3B", - "&keys=comma,%2C,semi,%3B,dot,.", - "&keys=dot,.,comma,%2C,semi,%3B", - "&keys=dot,.,semi,%3B,comma,%2C", - "&keys=semi,%3B,comma,%2C,dot,.", - "&keys=semi,%3B,dot,.,comma,%2C" - ]], - ["{&keys*}", [ - "&comma=%2C&dot=.&semi=%3B", - "&comma=%2C&semi=%3B&dot=.", - "&dot=.&comma=%2C&semi=%3B", - "&dot=.&semi=%3B&comma=%2C", - "&semi=%3B&comma=%2C&dot=.", - "&semi=%3B&dot=.&comma=%2C" - ]] - ] - } -} diff --git a/lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples.json b/lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples.json deleted file mode 100644 index 2e8e942da..000000000 --- a/lib/Google/vendor/rize/uri-template/tests/fixtures/spec-examples.json +++ /dev/null @@ -1,218 +0,0 @@ -{ - "Level 1 Examples" : - { - "level": 1, - "variables": { - "var" : "value", - "hello" : "Hello World!" - }, - "testcases" : [ - ["{var}", "value"], - ["{hello}", "Hello%20World%21"] - ] - }, - "Level 2 Examples" : - { - "level": 2, - "variables": { - "var" : "value", - "hello" : "Hello World!", - "path" : "/foo/bar" - }, - "testcases" : [ - ["{+var}", "value"], - ["{+hello}", "Hello%20World!"], - ["{+path}/here", "/foo/bar/here"], - ["here?ref={+path}", "here?ref=/foo/bar"] - ] - }, - "Level 3 Examples" : - { - "level": 3, - "variables": { - "var" : "value", - "hello" : "Hello World!", - "empty" : "", - "path" : "/foo/bar", - "x" : "1024", - "y" : "768" - }, - "testcases" : [ - ["map?{x,y}", "map?1024,768"], - ["{x,hello,y}", "1024,Hello%20World%21,768"], - ["{+x,hello,y}", "1024,Hello%20World!,768"], - ["{+path,x}/here", "/foo/bar,1024/here"], - ["{#x,hello,y}", "#1024,Hello%20World!,768"], - ["{#path,x}/here", "#/foo/bar,1024/here"], - ["X{.var}", "X.value"], - ["X{.x,y}", "X.1024.768"], - ["{/var}", "/value"], - ["{/var,x}/here", "/value/1024/here"], - ["{;x,y}", ";x=1024;y=768"], - ["{;x,y,empty}", ";x=1024;y=768;empty"], - ["{?x,y}", "?x=1024&y=768"], - ["{?x,y,empty}", "?x=1024&y=768&empty="], - ["?fixed=yes{&x}", "?fixed=yes&x=1024"], - ["{&x,y,empty}", "&x=1024&y=768&empty="] - ] - }, - "Level 4 Examples" : - { - "level": 4, - "variables": { - "var": "value", - "hello": "Hello World!", - "path": "/foo/bar", - "list": ["red", "green", "blue"], - "keys": {"semi": ";", "dot": ".", "comma":","} - }, - "testcases": [ - ["{var:3}", "val"], - ["{var:30}", "value"], - ["{list}", "red,green,blue"], - ["{list*}", "red,green,blue"], - ["{keys}", [ - "comma,%2C,dot,.,semi,%3B", - "comma,%2C,semi,%3B,dot,.", - "dot,.,comma,%2C,semi,%3B", - "dot,.,semi,%3B,comma,%2C", - "semi,%3B,comma,%2C,dot,.", - "semi,%3B,dot,.,comma,%2C" - ]], - ["{keys*}", [ - "comma=%2C,dot=.,semi=%3B", - "comma=%2C,semi=%3B,dot=.", - "dot=.,comma=%2C,semi=%3B", - "dot=.,semi=%3B,comma=%2C", - "semi=%3B,comma=%2C,dot=.", - "semi=%3B,dot=.,comma=%2C" - ]], - ["{+path:6}/here", "/foo/b/here"], - ["{+list}", "red,green,blue"], - ["{+list*}", "red,green,blue"], - ["{+keys}", [ - "comma,,,dot,.,semi,;", - "comma,,,semi,;,dot,.", - "dot,.,comma,,,semi,;", - "dot,.,semi,;,comma,,", - "semi,;,comma,,,dot,.", - "semi,;,dot,.,comma,," - ]], - ["{+keys*}", [ - "comma=,,dot=.,semi=;", - "comma=,,semi=;,dot=.", - "dot=.,comma=,,semi=;", - "dot=.,semi=;,comma=,", - "semi=;,comma=,,dot=.", - "semi=;,dot=.,comma=," - ]], - ["{#path:6}/here", "#/foo/b/here"], - ["{#list}", "#red,green,blue"], - ["{#list*}", "#red,green,blue"], - ["{#keys}", [ - "#comma,,,dot,.,semi,;", - "#comma,,,semi,;,dot,.", - "#dot,.,comma,,,semi,;", - "#dot,.,semi,;,comma,,", - "#semi,;,comma,,,dot,.", - "#semi,;,dot,.,comma,," - ]], - ["{#keys*}", [ - "#comma=,,dot=.,semi=;", - "#comma=,,semi=;,dot=.", - "#dot=.,comma=,,semi=;", - "#dot=.,semi=;,comma=,", - "#semi=;,comma=,,dot=.", - "#semi=;,dot=.,comma=," - ]], - ["X{.var:3}", "X.val"], - ["X{.list}", "X.red,green,blue"], - ["X{.list*}", "X.red.green.blue"], - ["X{.keys}", [ - "X.comma,%2C,dot,.,semi,%3B", - "X.comma,%2C,semi,%3B,dot,.", - "X.dot,.,comma,%2C,semi,%3B", - "X.dot,.,semi,%3B,comma,%2C", - "X.semi,%3B,comma,%2C,dot,.", - "X.semi,%3B,dot,.,comma,%2C" - ]], - ["{/var:1,var}", "/v/value"], - ["{/list}", "/red,green,blue"], - ["{/list*}", "/red/green/blue"], - ["{/list*,path:4}", "/red/green/blue/%2Ffoo"], - ["{/keys}", [ - "/comma,%2C,dot,.,semi,%3B", - "/comma,%2C,semi,%3B,dot,.", - "/dot,.,comma,%2C,semi,%3B", - "/dot,.,semi,%3B,comma,%2C", - "/semi,%3B,comma,%2C,dot,.", - "/semi,%3B,dot,.,comma,%2C" - ]], - ["{/keys*}", [ - "/comma=%2C/dot=./semi=%3B", - "/comma=%2C/semi=%3B/dot=.", - "/dot=./comma=%2C/semi=%3B", - "/dot=./semi=%3B/comma=%2C", - "/semi=%3B/comma=%2C/dot=.", - "/semi=%3B/dot=./comma=%2C" - ]], - ["{;hello:5}", ";hello=Hello"], - ["{;list}", ";list=red,green,blue"], - ["{;list*}", ";list=red;list=green;list=blue"], - ["{;keys}", [ - ";keys=comma,%2C,dot,.,semi,%3B", - ";keys=comma,%2C,semi,%3B,dot,.", - ";keys=dot,.,comma,%2C,semi,%3B", - ";keys=dot,.,semi,%3B,comma,%2C", - ";keys=semi,%3B,comma,%2C,dot,.", - ";keys=semi,%3B,dot,.,comma,%2C" - ]], - ["{;keys*}", [ - ";comma=%2C;dot=.;semi=%3B", - ";comma=%2C;semi=%3B;dot=.", - ";dot=.;comma=%2C;semi=%3B", - ";dot=.;semi=%3B;comma=%2C", - ";semi=%3B;comma=%2C;dot=.", - ";semi=%3B;dot=.;comma=%2C" - ]], - ["{?var:3}", "?var=val"], - ["{?list}", "?list=red,green,blue"], - ["{?list*}", "?list=red&list=green&list=blue"], - ["{?keys}", [ - "?keys=comma,%2C,dot,.,semi,%3B", - "?keys=comma,%2C,semi,%3B,dot,.", - "?keys=dot,.,comma,%2C,semi,%3B", - "?keys=dot,.,semi,%3B,comma,%2C", - "?keys=semi,%3B,comma,%2C,dot,.", - "?keys=semi,%3B,dot,.,comma,%2C" - ]], - ["{?keys*}", [ - "?comma=%2C&dot=.&semi=%3B", - "?comma=%2C&semi=%3B&dot=.", - "?dot=.&comma=%2C&semi=%3B", - "?dot=.&semi=%3B&comma=%2C", - "?semi=%3B&comma=%2C&dot=.", - "?semi=%3B&dot=.&comma=%2C" - ]], - ["{&var:3}", "&var=val"], - ["{&list}", "&list=red,green,blue"], - ["{&list*}", "&list=red&list=green&list=blue"], - ["{&keys}", [ - "&keys=comma,%2C,dot,.,semi,%3B", - "&keys=comma,%2C,semi,%3B,dot,.", - "&keys=dot,.,comma,%2C,semi,%3B", - "&keys=dot,.,semi,%3B,comma,%2C", - "&keys=semi,%3B,comma,%2C,dot,.", - "&keys=semi,%3B,dot,.,comma,%2C" - ]], - ["{&keys*}", [ - "&comma=%2C&dot=.&semi=%3B", - "&comma=%2C&semi=%3B&dot=.", - "&dot=.&comma=%2C&semi=%3B", - "&dot=.&semi=%3B&comma=%2C", - "&semi=%3B&comma=%2C&dot=.", - "&semi=%3B&dot=.&comma=%2C" - ]] - ] - } -} diff --git a/lib/Google/vendor/rize/uri-template/tests/fixtures/transform-json-tests.xslt b/lib/Google/vendor/rize/uri-template/tests/fixtures/transform-json-tests.xslt deleted file mode 100644 index d956b6bdb..000000000 --- a/lib/Google/vendor/rize/uri-template/tests/fixtures/transform-json-tests.xslt +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/Google/vendor/symfony/deprecation-contracts/LICENSE b/lib/Google/vendor/symfony/deprecation-contracts/LICENSE index 0ed3a2465..406242ff2 100644 --- a/lib/Google/vendor/symfony/deprecation-contracts/LICENSE +++ b/lib/Google/vendor/symfony/deprecation-contracts/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020-present Fabien Potencier +Copyright (c) 2020-2022 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/lib/Google/vendor/symfony/deprecation-contracts/README.md b/lib/Google/vendor/symfony/deprecation-contracts/README.md index 9814864c0..4957933a6 100644 --- a/lib/Google/vendor/symfony/deprecation-contracts/README.md +++ b/lib/Google/vendor/symfony/deprecation-contracts/README.md @@ -22,5 +22,5 @@ trigger_deprecation('symfony/blockchain', '8.9', 'Using "%s" is deprecated, use This will generate the following message: `Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.` -While not recommended, the deprecation notices can be completely ignored by declaring an empty +While not necessarily recommended, the deprecation notices can be completely ignored by declaring an empty `function trigger_deprecation() {}` in your application. diff --git a/lib/Google/vendor/symfony/deprecation-contracts/composer.json b/lib/Google/vendor/symfony/deprecation-contracts/composer.json index 5533b5c3f..1c1b4ba0e 100644 --- a/lib/Google/vendor/symfony/deprecation-contracts/composer.json +++ b/lib/Google/vendor/symfony/deprecation-contracts/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": ">=8.1" + "php": ">=8.0.2" }, "autoload": { "files": [ @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "3.6-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", diff --git a/lib/Google/vendor/symfony/polyfill-php81/LICENSE b/lib/Google/vendor/symfony/polyfill-php81/LICENSE new file mode 100644 index 000000000..99c6bdf35 --- /dev/null +++ b/lib/Google/vendor/symfony/polyfill-php81/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2021-present Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/lib/Google/vendor/symfony/polyfill-php81/Php81.php b/lib/Google/vendor/symfony/polyfill-php81/Php81.php new file mode 100644 index 000000000..f0507b765 --- /dev/null +++ b/lib/Google/vendor/symfony/polyfill-php81/Php81.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Php81; + +/** + * @author Nicolas Grekas + * + * @internal + */ +final class Php81 +{ + public static function array_is_list(array $array): bool + { + if ([] === $array || $array === array_values($array)) { + return true; + } + + $nextKey = -1; + + foreach ($array as $k => $v) { + if ($k !== ++$nextKey) { + return false; + } + } + + return true; + } +} diff --git a/lib/Google/vendor/symfony/polyfill-php81/README.md b/lib/Google/vendor/symfony/polyfill-php81/README.md new file mode 100644 index 000000000..c07ef7820 --- /dev/null +++ b/lib/Google/vendor/symfony/polyfill-php81/README.md @@ -0,0 +1,18 @@ +Symfony Polyfill / Php81 +======================== + +This component provides features added to PHP 8.1 core: + +- [`array_is_list`](https://php.net/array_is_list) +- [`enum_exists`](https://php.net/enum-exists) +- [`MYSQLI_REFRESH_REPLICA`](https://php.net/mysqli.constants#constantmysqli-refresh-replica) constant +- [`ReturnTypeWillChange`](https://wiki.php.net/rfc/internal_method_return_types) +- [`CURLStringFile`](https://php.net/CURLStringFile) (but only if PHP >= 7.4 is used) + +More information can be found in the +[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). + +License +======= + +This library is released under the [MIT license](LICENSE). diff --git a/lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php b/lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php new file mode 100644 index 000000000..5ff93fcaf --- /dev/null +++ b/lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (\PHP_VERSION_ID >= 70400 && extension_loaded('curl')) { + /** + * @property string $data + */ + class CURLStringFile extends CURLFile + { + private $data; + + public function __construct(string $data, string $postname, string $mime = 'application/octet-stream') + { + $this->data = $data; + parent::__construct('data://application/octet-stream;base64,'.base64_encode($data), $mime, $postname); + } + + public function __set(string $name, $value): void + { + if ('data' !== $name) { + $this->$name = $value; + + return; + } + + if (is_object($value) ? !method_exists($value, '__toString') : !is_scalar($value)) { + throw new TypeError('Cannot assign '.gettype($value).' to property CURLStringFile::$data of type string'); + } + + $this->name = 'data://application/octet-stream;base64,'.base64_encode($value); + } + + public function __isset(string $name): bool + { + return isset($this->$name); + } + + public function &__get(string $name) + { + return $this->$name; + } + } +} diff --git a/lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php b/lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php new file mode 100644 index 000000000..cb7720a8d --- /dev/null +++ b/lib/Google/vendor/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (\PHP_VERSION_ID < 80100) { + #[Attribute(Attribute::TARGET_METHOD)] + final class ReturnTypeWillChange + { + public function __construct() + { + } + } +} diff --git a/lib/Google/vendor/symfony/polyfill-php81/bootstrap.php b/lib/Google/vendor/symfony/polyfill-php81/bootstrap.php new file mode 100644 index 000000000..9f872e02f --- /dev/null +++ b/lib/Google/vendor/symfony/polyfill-php81/bootstrap.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Php81 as p; + +if (\PHP_VERSION_ID >= 80100) { + return; +} + +if (defined('MYSQLI_REFRESH_SLAVE') && !defined('MYSQLI_REFRESH_REPLICA')) { + define('MYSQLI_REFRESH_REPLICA', 64); +} + +if (!function_exists('array_is_list')) { + function array_is_list(array $array): bool { return p\Php81::array_is_list($array); } +} + +if (!function_exists('enum_exists')) { + function enum_exists(string $enum, bool $autoload = true): bool { return $autoload && class_exists($enum) && false; } +} diff --git a/lib/Google/vendor/symfony/polyfill-php81/composer.json b/lib/Google/vendor/symfony/polyfill-php81/composer.json new file mode 100644 index 000000000..28b6408ea --- /dev/null +++ b/lib/Google/vendor/symfony/polyfill-php81/composer.json @@ -0,0 +1,33 @@ +{ + "name": "symfony/polyfill-php81", + "type": "library", + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "keywords": ["polyfill", "shim", "compatibility", "portable"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2" + }, + "autoload": { + "psr-4": { "Symfony\\Polyfill\\Php81\\": "" }, + "files": [ "bootstrap.php" ], + "classmap": [ "Resources/stubs" ] + }, + "minimum-stability": "dev", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + } +} diff --git a/lib/classes/class-bootstrap.php b/lib/classes/class-bootstrap.php index fe25c385a..04fdb3f38 100644 --- a/lib/classes/class-bootstrap.php +++ b/lib/classes/class-bootstrap.php @@ -213,11 +213,11 @@ public function init() { $is_connected = $this->is_connected_to_gs(); if (is_wp_error($is_connected)) { - $this->errors->add($is_connected->get_error_message(), 'warning'); + $this->errors->add($is_connected->get_error_message(), 'warning', false); } if ($googleSDKVersionConflictError = get_transient("wp_stateless_google_sdk_conflict")) { - $this->errors->add($googleSDKVersionConflictError, 'warning'); + $this->errors->add($googleSDKVersionConflictError, 'warning', false); } /** @@ -281,11 +281,11 @@ public function init() { $is_connected = $this->is_connected_to_gs(); if (is_wp_error($is_connected)) { - $this->errors->add($is_connected->get_error_message(), 'warning'); + $this->errors->add($is_connected->get_error_message(), 'warning', false); } if ($googleSDKVersionConflictError = get_transient("wp_stateless_google_sdk_conflict")) { - $this->errors->add($googleSDKVersionConflictError, 'warning'); + $this->errors->add($googleSDKVersionConflictError, 'warning', false); } /** @@ -1650,7 +1650,7 @@ public function is_connected_to_gs() { $connected = $client->is_connected(); if ($connected !== true) { $trnst['success'] = 'false'; - $trnst['error'] = sprintf(__('Could not connect to Google Storage bucket. Please be sure that bucket with name %s exists and the access credentials are correct.', $this->domain), esc_html($this->get('sm.bucket'))); + $trnst['error'] = sprintf('Could not connect to Google Storage bucket. Please be sure that bucket with name %s exists and the access credentials are correct.', esc_html($this->get('sm.bucket'))); if (is_callable(array($connected, 'getHandlerContext')) && $handlerContext = $connected->getHandlerContext()) { if (!empty($handlerContext['error'])) { @@ -1670,7 +1670,7 @@ public function is_connected_to_gs() { } if (isset($trnst['success']) && $trnst['success'] == 'false') { - return new \WP_Error('error', (!empty($trnst['error']) ? $trnst['error'] : __('There is an Error on connection to Google Storage.', $this->domain))); + return new \WP_Error('error', (!empty($trnst['error']) ? $trnst['error'] : 'There is an Error on connection to Google Storage.')); } return true; diff --git a/lib/classes/class-errors.php b/lib/classes/class-errors.php index 3e94b6095..88530003a 100644 --- a/lib/classes/class-errors.php +++ b/lib/classes/class-errors.php @@ -112,9 +112,10 @@ private function add_message( &$collection, $message ) { * * @param string $message * @param string $type Values: 'error', 'message', 'warning' + * @param string $translate Values: true, false * @author peshkov@UD */ - public function add( $message, $type = 'error' ) { + public function add( $message, $type = 'error', $translate = true ) { switch( $type ) { case 'error': $this->add_message($this->errors, $message); @@ -123,8 +124,12 @@ public function add( $message, $type = 'error' ) { case 'warning': case 'notice': if(!is_array($message)){ + $title = $translate + ? sprintf( __( '%s has the following notice:', $this->domain ), esc_html($this->name) ) + : sprintf( '%s has the following notice:', esc_html($this->name) ); + $message = array( - 'title' => sprintf( __( '%s has the following notice:', $this->domain ), esc_html($this->name) ), + 'title' => $title, 'message' => $message, 'button' => null, ); diff --git a/readme.md b/readme.md index 343bf6570..fd4612678 100644 --- a/readme.md +++ b/readme.md @@ -68,7 +68,7 @@ For a more detailed installation and setup walkthrough, please see the [manual s ### What are the minimum server requirements for this plugin? -Beyond the [official WordPress minimum requirements](https://codex.wordpress.org/Template:Server_requirements), WP-Stateless requires a minimum PHP version of 8.1 or higher and OpenSSL to be enabled. +Beyond the [official WordPress minimum requirements](https://codex.wordpress.org/Template:Server_requirements), WP-Stateless requires a minimum PHP version of 8.0 or higher and OpenSSL to be enabled. ### What wp-config constants are supported? diff --git a/readme.txt b/readme.txt index a8c489cf9..bf4751400 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: usability_dynamics, andypotanin, ideric, planvova, obolgun Donate link: https://udx.io Tags: google cloud, google cloud storage, cdn, uploads, backup License: GPLv2 or later -Requires PHP: 8.1 +Requires PHP: 8.0 Requires at least: 5.0 Tested up to: 6.8 Stable tag: 4.2.1 @@ -87,7 +87,7 @@ For a more detailed installation and setup walkthrough, please see the [manual s = What are the minimum server requirements for this plugin? = -Beyond the [official WordPress minimum requirements](https://wordpress.org/about/requirements/), WP-Stateless requires a minimum PHP version of 8.1 or higher and OpenSSL to be enabled. +Beyond the [official WordPress minimum requirements](https://wordpress.org/about/requirements/), WP-Stateless requires a minimum PHP version of 8.0 or higher and OpenSSL to be enabled. = What wp-config constants are supported? = @@ -136,8 +136,6 @@ Before upgrading to WP-Stateless 3.0, please, make sure you tested it on your de == Changelog == = 4.2.1 = -* **WP-Stateless 4.2.1 requires PHP 8.1 or higher, in accordance with the requirements of the official Google API PHP Client Library.** -* ENHANCEMENT - Updated Client library for Google APIs from 2.18.3 to 2.18.4. * ENHANCEMENT - updated `wpmetabox/meta-box` library from 5.10.11 to 5.10.15. * FIX - correctly loads text domain to prevent PHP notices. * FIX - `udx/lib-ud-api-client` package correctly loads text domain to prevent PHP notices. diff --git a/static/data/addons.php b/static/data/addons.php index e06582fe2..648299884 100644 --- a/static/data/addons.php +++ b/static/data/addons.php @@ -47,7 +47,7 @@ 'title' => 'WooCommerce', 'plugin_files' => ['woocommerce/woocommerce.php'], 'addon_file' => 'wp-stateless-woocommerce-addon/wp-stateless-woocommerce-addon.php', - 'icon' => 'https://ps.w.org/woocommerce/assets/icon-128x128.gif', + 'icon' => 'https://ps.w.org/woocommerce/assets/icon.svg', 'repo' => 'udx/wp-stateless-woocommerce-addon', 'wp' => 'https://wordpress.org/plugins/wp-stateless-woocommerce-addon/', 'hubspot_id' => '151478251047', diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 9f948208c..390e393a9 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'wpcloud/wp-stateless', 'pretty_version' => 'dev-latest', 'version' => 'dev-latest', - 'reference' => '28fb7b2fe86f07bf3656c001f844467acd4d2b35', + 'reference' => 'e87ce7a5a22978757737b6a23716cb2b015c5809', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -67,7 +67,7 @@ 'wpcloud/wp-stateless' => array( 'pretty_version' => 'dev-latest', 'version' => 'dev-latest', - 'reference' => '28fb7b2fe86f07bf3656c001f844467acd4d2b35', + 'reference' => 'e87ce7a5a22978757737b6a23716cb2b015c5809', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php index 4c3a5d68f..adfb472fb 100644 --- a/vendor/composer/platform_check.php +++ b/vendor/composer/platform_check.php @@ -4,8 +4,8 @@ $issues = array(); -if (!(PHP_VERSION_ID >= 80100)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.'; +if (!(PHP_VERSION_ID >= 80000)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 8.0.0". You are running ' . PHP_VERSION . '.'; } if ($issues) {