From 14ab64b780ebab92769ff6991f31f5839dc115c9 Mon Sep 17 00:00:00 2001 From: tonis Date: Sat, 12 Oct 2024 10:14:48 +0300 Subject: [PATCH] Replace Uuid dependency with Yii's password for reducing dependencies, allow newer phpunit versions --- .github/workflows/php.yml | 2 +- composer.json | 7 +++---- src/Translator.php | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index d37a404..8b650c7 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -20,7 +20,7 @@ jobs: - name: Cache Composer packages id: composer-cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: vendor key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} diff --git a/composer.json b/composer.json index 60d33f4..4c58ce5 100644 --- a/composer.json +++ b/composer.json @@ -31,11 +31,10 @@ ], "require": { "yiisoft/yii2": "~2.0.0", - "solutosoft/yii2-plugin": "~1.0.0", - "pascaldevink/shortuuid": "^3.0 || ^4.0" + "solutosoft/yii2-plugin": "~1.0.0" }, "require-dev": { - "phpunit/phpunit": "^8.0 || ^9.0", + "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0 || ^11.0", "phpstan/phpstan": "^1" }, @@ -46,7 +45,7 @@ }, "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "3.2.x-dev" } }, "config": { diff --git a/src/Translator.php b/src/Translator.php index 59c12c9..b090410 100644 --- a/src/Translator.php +++ b/src/Translator.php @@ -2,9 +2,8 @@ namespace leandrogehlen\querybuilder; -use PascalDeVink\ShortUuid\ShortUuid; -use Ramsey\Uuid\Uuid; use yii\base\BaseObject; +use yii\base\Security; use yii\helpers\ArrayHelper; /** @@ -189,8 +188,9 @@ public function params() * @return string */ private function getNewParamName(){ - $shortUUid = new ShortUuid(); - return $shortUUid->encode(Uuid::uuid4()); + /** @var Security $security */ + $security = \Yii::createObject(Security::class); + return $security->generateRandomString(20); } /**