From 87a038311b2d911ae7687df7240411a31fc0a4df Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 24 Mar 2024 07:49:03 +0000 Subject: [PATCH 1/6] move tests to github action --- .github/workflows/codeql-analysis.yml | 20 +++++++++++++++++++ .github/workflows/test.yml | 28 +++++++++++++++++++++++++++ .travis.yml | 14 -------------- composer.json | 6 ++++-- 4 files changed, 52 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..2c8c1fe --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,20 @@ +name: "CodeQL" + +on: [pull_request] +jobs: + lint: + name: CodeQL + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - run: git checkout HEAD^2 + + - name: Run CodeQL + run: | + docker run --rm -v $PWD:/app composer sh -c \ + "composer install --profile --ignore-platform-reqs && composer check" \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..00096f3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,28 @@ +name: "Tests" + +on: [pull_request] +jobs: + lint: + name: Tests ${{ matrix.php-versions }} + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: ['8.1', '8.2', '8.3', 'nightly'] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup PHP ${{ matrix.php-versions }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Compose install + run: composer install --ignore-platform-reqs + + - name: Run tests + run: composer test \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8d142c7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: php - -php: -- 8.0 -- nightly - -notifications: - email: - - team@appwrite.io - -before_script: composer install --ignore-platform-reqs - -script: -- vendor/bin/phpunit --configuration phpunit.xml diff --git a/composer.json b/composer.json index f6f02ca..49f2bef 100755 --- a/composer.json +++ b/composer.json @@ -20,7 +20,8 @@ "scripts": { "test": "vendor/bin/phpunit", "lint": "./vendor/bin/pint --test", - "format": "./vendor/bin/pint" + "format": "./vendor/bin/pint", + "check": "./vendor/bin/phpstan analyse --level 8 src tests" }, "require": { "php": ">=8.0", @@ -28,7 +29,8 @@ }, "require-dev": { "phpunit/phpunit": "^9.3", - "laravel/pint": "1.2.*" + "laravel/pint": "1.2.*", + "phpstan/phpstan": "1.9.x-dev" }, "minimum-stability": "dev" } From 9de3eeb425048c7b01062522c92274ee1c5a018b Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 24 Mar 2024 07:51:53 +0000 Subject: [PATCH 2/6] composer updated --- composer.lock | 193 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 127 insertions(+), 66 deletions(-) diff --git a/composer.lock b/composer.lock index f23385c..685572d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "457461f188b78f8ac02fc00218dac9e1", + "content-hash": "e1a082e186afde49f25909021ab1850c", "packages": [ { "name": "utopia-php/framework", - "version": "0.31.x-dev", + "version": "0.x-dev", "source": { "type": "git", - "url": "https://github.com/utopia-php/framework.git", - "reference": "32e18aff924149221d660a5387bccd6d2b5e9ee7" + "url": "https://github.com/utopia-php/http.git", + "reference": "e3ff6b933082d57b48e7c4267bb605c0bf2250fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/framework/zipball/32e18aff924149221d660a5387bccd6d2b5e9ee7", - "reference": "32e18aff924149221d660a5387bccd6d2b5e9ee7", + "url": "https://api.github.com/repos/utopia-php/http/zipball/e3ff6b933082d57b48e7c4267bb605c0bf2250fd", + "reference": "e3ff6b933082d57b48e7c4267bb605c0bf2250fd", "shasum": "" }, "require": { @@ -46,10 +46,10 @@ "upf" ], "support": { - "issues": "https://github.com/utopia-php/framework/issues", - "source": "https://github.com/utopia-php/framework/tree/0.31.x" + "issues": "https://github.com/utopia-php/http/issues", + "source": "https://github.com/utopia-php/http/tree/0.33.0" }, - "time": "2023-12-08T18:46:26+00:00" + "time": "2024-01-08T13:30:27+00:00" } ], "packages-dev": [ @@ -196,12 +196,12 @@ "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "202aaf6b7c2e1e0a622b0298e9f3f537e4d84018" + "reference": "2f5294676c802a62b0549f6bc8983f14294ce369" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/202aaf6b7c2e1e0a622b0298e9f3f537e4d84018", - "reference": "202aaf6b7c2e1e0a622b0298e9f3f537e4d84018", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/2f5294676c802a62b0549f6bc8983f14294ce369", + "reference": "2f5294676c802a62b0549f6bc8983f14294ce369", "shasum": "" }, "require": { @@ -249,7 +249,7 @@ "type": "tidelift" } ], - "time": "2023-11-01T08:01:43+00:00" + "time": "2024-02-10T11:10:03+00:00" }, { "name": "nikic/php-parser", @@ -257,12 +257,12 @@ "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "1eeeb2d5252d6d8706c5a8d9d88b8d1e7ecf2109" + "reference": "46be4560c4cd4bab2b74882c0da39a4548a5cfbe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1eeeb2d5252d6d8706c5a8d9d88b8d1e7ecf2109", - "reference": "1eeeb2d5252d6d8706c5a8d9d88b8d1e7ecf2109", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/46be4560c4cd4bab2b74882c0da39a4548a5cfbe", + "reference": "46be4560c4cd4bab2b74882c0da39a4548a5cfbe", "shasum": "" }, "require": { @@ -273,7 +273,7 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "default-branch": true, "bin": [ @@ -308,7 +308,7 @@ "issues": "https://github.com/nikic/PHP-Parser/issues", "source": "https://github.com/nikic/PHP-Parser/tree/master" }, - "time": "2023-12-22T18:57:32+00:00" + "time": "2024-03-17T10:24:36+00:00" }, { "name": "phar-io/manifest", @@ -316,12 +316,12 @@ "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "67729272c564ab9f953c81f48db44e8b1cb1e1c3" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/67729272c564ab9f953c81f48db44e8b1cb1e1c3", - "reference": "67729272c564ab9f953c81f48db44e8b1cb1e1c3", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { @@ -330,7 +330,7 @@ "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", - "php": "^7.3 || ^8.0" + "php": "^7.2 || ^8.0" }, "default-branch": true, "type": "library", @@ -368,7 +368,7 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, "funding": [ { @@ -376,7 +376,7 @@ "type": "github" } ], - "time": "2023-06-01T14:19:47+00:00" + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -429,18 +429,77 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "phpstan/phpstan", + "version": "1.9.x-dev", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "6c0217aa2b146c3e28474e8be3e87188fac55dac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/6c0217aa2b146c3e28474e8be3e87188fac55dac", + "reference": "6c0217aa2b146c3e28474e8be3e87188fac55dac", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpstan/phpstan/issues", + "source": "https://github.com/phpstan/phpstan/tree/1.9.x" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2023-02-18T15:01:46+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089" + "reference": "3352293d9e91513d5508c415835014881b420218" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca2bd87d2f9215904682a9cb9bb37dda98e76089", - "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/3352293d9e91513d5508c415835014881b420218", + "reference": "3352293d9e91513d5508c415835014881b420218", "shasum": "" }, "require": { @@ -497,7 +556,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.30" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2" }, "funding": [ { @@ -505,7 +564,7 @@ "type": "github" } ], - "time": "2023-12-22T06:47:57+00:00" + "time": "2024-03-22T05:16:32+00:00" }, { "name": "phpunit/php-file-iterator", @@ -754,12 +813,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "37dcc921d6b2fdf5c3b8191d6bc9c9431abb05e8" + "reference": "5378382017ced87e600e79919bcd3009317f0baa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/37dcc921d6b2fdf5c3b8191d6bc9c9431abb05e8", - "reference": "37dcc921d6b2fdf5c3b8191d6bc9c9431abb05e8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5378382017ced87e600e79919bcd3009317f0baa", + "reference": "5378382017ced87e600e79919bcd3009317f0baa", "shasum": "" }, "require": { @@ -849,20 +908,20 @@ "type": "tidelift" } ], - "time": "2023-12-22T07:28:31+00:00" + "time": "2024-03-23T07:30:30+00:00" }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "1.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", "shasum": "" }, "require": { @@ -897,7 +956,7 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" }, "funding": [ { @@ -905,7 +964,7 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-03-02T06:27:43+00:00" }, { "name": "sebastian/code-unit", @@ -1155,12 +1214,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", "shasum": "" }, "require": { @@ -1205,7 +1264,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" }, "funding": [ { @@ -1213,7 +1272,7 @@ "type": "github" } ], - "time": "2023-05-07T05:35:17+00:00" + "time": "2024-03-02T06:30:58+00:00" }, { "name": "sebastian/environment", @@ -1284,12 +1343,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { @@ -1345,7 +1404,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, "funding": [ { @@ -1353,7 +1412,7 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", @@ -1361,12 +1420,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bde739e7565280bda77be70044ac1047bc007e34" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", - "reference": "bde739e7565280bda77be70044ac1047bc007e34", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { @@ -1409,7 +1468,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" }, "funding": [ { @@ -1417,7 +1476,7 @@ "type": "github" } ], - "time": "2023-08-02T09:26:13+00:00" + "time": "2024-03-02T06:35:11+00:00" }, { "name": "sebastian/lines-of-code", @@ -1657,12 +1716,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "20bdda85c7c585ab265c0c37ec052a019bae29c4" + "reference": "ff553e7482dcee39fa4acc2b175d6ddeb0f7bc25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/20bdda85c7c585ab265c0c37ec052a019bae29c4", - "reference": "20bdda85c7c585ab265c0c37ec052a019bae29c4", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ff553e7482dcee39fa4acc2b175d6ddeb0f7bc25", + "reference": "ff553e7482dcee39fa4acc2b175d6ddeb0f7bc25", "shasum": "" }, "require": { @@ -1704,7 +1763,7 @@ "type": "github" } ], - "time": "2023-03-25T08:11:39+00:00" + "time": "2024-03-14T18:47:08+00:00" }, { "name": "sebastian/type", @@ -1817,16 +1876,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -1855,7 +1914,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.2" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -1863,17 +1922,19 @@ "type": "github" } ], - "time": "2023-11-20T00:12:19+00:00" + "time": "2024-03-03T12:36:25+00:00" } ], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "phpstan/phpstan": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">=8.0" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } From 09f631d0c85fb3f54e3ab5421ac268c6c9acdbbf Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 24 Mar 2024 08:03:06 +0000 Subject: [PATCH 3/6] fix level 2 errors --- composer.json | 2 +- src/Domains/Adapter.php | 14 ++++++++++++-- src/Domains/Contact.php | 2 +- src/Domains/Registrar/Adapter.php | 4 ++-- src/Domains/Registrar/OpenSRS.php | 1 - 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 49f2bef..314f71c 100755 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "test": "vendor/bin/phpunit", "lint": "./vendor/bin/pint --test", "format": "./vendor/bin/pint", - "check": "./vendor/bin/phpstan analyse --level 8 src tests" + "check": "./vendor/bin/phpstan analyse --level 2 src tests" }, "require": { "php": ">=8.0", diff --git a/src/Domains/Adapter.php b/src/Domains/Adapter.php index fbd246f..6d4673f 100644 --- a/src/Domains/Adapter.php +++ b/src/Domains/Adapter.php @@ -12,6 +12,7 @@ abstract class Adapter protected string $apiSecret; + /** @var array */ protected $headers = [ 'Content-Type' => 'application/json', ]; @@ -20,7 +21,9 @@ abstract class Adapter * __construct * Instantiate a new adapter. * - * @param string $env + * @param string $endpoint + * @param string $apiKey + * @param string $apiSecret */ public function __construct(string $endpoint, string $apiKey, string $apiSecret) { @@ -40,7 +43,11 @@ public function __construct(string $endpoint, string $apiKey, string $apiSecret) * * Make an API call * - * @param array $params + * @param string $method + * @param string $path + * @param array|string $params + * @param array $headers + * @retury array|string * * @throws \Exception */ @@ -144,6 +151,9 @@ public function call(string $method, string $path = '', array|string $params = [ /** * Flatten params array to PHP multiple format + * @param array $data + * @param string $prefix + * @return array */ protected function flatten(array $data, string $prefix = ''): array { diff --git a/src/Domains/Contact.php b/src/Domains/Contact.php index fad324f..fbc9ca0 100644 --- a/src/Domains/Contact.php +++ b/src/Domains/Contact.php @@ -21,7 +21,7 @@ public function __construct( ) { } - public function toArray() + public function toArray(): array { $owner = $this->owner ?? $this->firstname . ' ' . $this->lastname; diff --git a/src/Domains/Registrar/Adapter.php b/src/Domains/Registrar/Adapter.php index d09a4ab..de30cd5 100644 --- a/src/Domains/Registrar/Adapter.php +++ b/src/Domains/Registrar/Adapter.php @@ -14,7 +14,7 @@ abstract public function available(string $domain): bool; /** * @param string $domain - * @param Utopia\Domains\Contact[] $contacts + * @param array<\Utopia\Domains\Contact> $contacts * @param array $nameservers * @return array */ @@ -49,7 +49,7 @@ abstract public function renew(string $domain, int $years): array; /** * @param string $domain - * @param Utopia\Domains\Contact[] $contacts + * @param array<\Utopia\Domains\Contact> $contacts * @param array $nameservers * @return array */ diff --git a/src/Domains/Registrar/OpenSRS.php b/src/Domains/Registrar/OpenSRS.php index b6728db..fe72f7a 100644 --- a/src/Domains/Registrar/OpenSRS.php +++ b/src/Domains/Registrar/OpenSRS.php @@ -360,7 +360,6 @@ public function renew(string $domain, int $years): array 'domain' => $domain, 'auto_renew' => 0, 'currentexpirationyear' => '2022', - 'domain' => $domain, 'period' => $years, 'handle' => 'process', ], From 77e69f330a80d46d181375b286e61fe1c35f8446 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 24 Mar 2024 08:04:24 +0000 Subject: [PATCH 4/6] fix level 4 errors --- composer.json | 2 +- src/Domains/Adapter.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 314f71c..4f88fb8 100755 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "test": "vendor/bin/phpunit", "lint": "./vendor/bin/pint --test", "format": "./vendor/bin/pint", - "check": "./vendor/bin/phpstan analyse --level 2 src tests" + "check": "./vendor/bin/phpstan analyse --level 4 src tests" }, "require": { "php": ">=8.0", diff --git a/src/Domains/Adapter.php b/src/Domains/Adapter.php index 6d4673f..b3a91d7 100644 --- a/src/Domains/Adapter.php +++ b/src/Domains/Adapter.php @@ -12,7 +12,7 @@ abstract class Adapter protected string $apiSecret; - /** @var array */ + /** @var array */ protected $headers = [ 'Content-Type' => 'application/json', ]; From f46a92bc30402052fd822690df843061bb76b278 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 25 Mar 2024 06:05:50 +0000 Subject: [PATCH 5/6] fix --- tests/OpenSRSTest.php | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/OpenSRSTest.php b/tests/OpenSRSTest.php index 2e929db..256250a 100644 --- a/tests/OpenSRSTest.php +++ b/tests/OpenSRSTest.php @@ -20,7 +20,7 @@ protected function setUp(): void $this->assertNotEmpty($key); $this->assertNotEmpty($secret); - $this->domain = self::generateRandomString().'.net'; + $this->domain = self::generateRandomString() . '.net'; $this->client = new OpenSRS( $key, $secret, @@ -139,18 +139,18 @@ public function testTransfer(string $domain): void private static function purchaseContact(string $suffix = ''): array { $contact = new Contact( - 'Test'.$suffix, - 'Tester'.$suffix, - '+1.8031234567'.$suffix, - 'testing@test.com'.$suffix, - '123 Main St'.$suffix, - 'Suite 100'.$suffix, - ''.$suffix, - 'San Francisco'.$suffix, + 'Test' . $suffix, + 'Tester' . $suffix, + '+1.8031234567' . $suffix, + 'testing@test.com' . $suffix, + '123 Main St' . $suffix, + 'Suite 100' . $suffix, + '' . $suffix, + 'San Francisco' . $suffix, 'CA', 'US', '94105', - 'Test Inc'.$suffix, + 'Test Inc' . $suffix, ); return [ @@ -161,16 +161,16 @@ private static function purchaseContact(string $suffix = ''): array ]; } - private function generateRandomString(int $length = 10): string - { - $characters = 'abcdefghijklmnopqrstuvwxyz'; - $charactersLength = strlen($characters); - $randomString = ''; + private function generateRandomString(int $length = 10): string + { + $characters = 'abcdefghijklmnopqrstuvwxyz'; + $charactersLength = strlen($characters); + $randomString = ''; - for ($i = 0; $i < $length; $i++) { - $randomString .= $characters[random_int(0, $charactersLength - 1)]; - } + for ($i = 0; $i < $length; $i++) { + $randomString .= $characters[random_int(0, $charactersLength - 1)]; + } - return $randomString; - } + return $randomString; + } } From 9a50ab75192bb1e708a8b4fbcff15878263ef3b9 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 25 Mar 2024 06:10:55 +0000 Subject: [PATCH 6/6] update environment variable --- .github/workflows/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 00096f3..ccfc259 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,4 +25,7 @@ jobs: run: composer install --ignore-platform-reqs - name: Run tests - run: composer test \ No newline at end of file + run: | + export OPENSRS_KEY=${{ secrets.OPENSRS_KEY }} + export OPENSRS_USERNAME=${{ secrets.OPENSRS_USERNAME }} + composer test \ No newline at end of file