From c8cd17bc33ace4afc0255481e244ff211f7081d7 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 19 Oct 2023 20:55:15 +1300 Subject: [PATCH] Update pint + phpstan --- bin/tasks/load.php | 12 +++--- composer.json | 2 +- composer.lock | 40 +++++++++---------- src/Database/Adapter/Mongo.php | 2 +- src/Database/Adapter/MySQL.php | 12 +++--- src/Database/Validator/Roles.php | 14 +++---- tests/Database/Base.php | 18 ++++----- .../Database/Validator/IndexedQueriesTest.php | 2 +- 8 files changed, 51 insertions(+), 51 deletions(-) diff --git a/bin/tasks/load.php b/bin/tasks/load.php index 1a4804290..9362b100d 100644 --- a/bin/tasks/load.php +++ b/bin/tasks/load.php @@ -84,7 +84,7 @@ ); // A coroutine is assigned per 1000 documents - for ($i=0; $i < $limit/1000; $i++) { + for ($i = 0; $i < $limit / 1000; $i++) { go(function () use ($pool, $faker, $name, $cache, $namespace) { $pdo = $pool->get(); @@ -93,7 +93,7 @@ $database->setNamespace($namespace); // Each coroutine loads 1000 documents - for ($i=0; $i < 1000; $i++) { + for ($i = 0; $i < 1000; $i++) { addArticle($database, $faker); } @@ -145,7 +145,7 @@ ); // A coroutine is assigned per 1000 documents - for ($i=0; $i < $limit/1000; $i++) { + for ($i = 0; $i < $limit / 1000; $i++) { go(function () use ($pool, $faker, $name, $cache, $namespace) { $pdo = $pool->get(); @@ -154,7 +154,7 @@ $database->setNamespace($namespace); // Each coroutine loads 1000 documents - for ($i=0; $i < 1000; $i++) { + for ($i = 0; $i < 1000; $i++) { addArticle($database, $faker); } @@ -189,14 +189,14 @@ $start = microtime(true); - for ($i=0; $i < $limit/1000; $i++) { + for ($i = 0; $i < $limit / 1000; $i++) { go(function () use ($client, $faker, $name, $namespace, $cache) { $database = new Database(new Mongo($client), $cache); $database->setDefaultDatabase($name); $database->setNamespace($namespace); // Each coroutine loads 1000 documents - for ($i=0; $i < 1000; $i++) { + for ($i = 0; $i < 1000; $i++) { addArticle($database, $faker); } diff --git a/composer.json b/composer.json index ae846a3ca..eda86eba2 100755 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "pcov/clobber": "^2.0", "swoole/ide-helper": "4.8.0", "utopia-php/cli": "^0.14.0", - "laravel/pint": "1.4.*", + "laravel/pint": "1.13.*", "phpstan/phpstan": "1.10.*", "rregeer/phpunit-coverage-check": "^0.3.1" }, diff --git a/composer.lock b/composer.lock index d476dd777..91cb09a27 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": "6811aec6a1675620a039ab1a7c240a17", + "content-hash": "d061889d90a313cff4207a1449b549df", "packages": [ { "name": "jean85/pretty-package-versions", @@ -513,16 +513,16 @@ }, { "name": "laravel/pint", - "version": "v1.4.1", + "version": "v1.13.3", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "80ddf23a5d97825e79bb1018eebb6f3f985d4fa8" + "reference": "93b2d0d49719bc6e444ba21cd4dbbccec935413d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/80ddf23a5d97825e79bb1018eebb6f3f985d4fa8", - "reference": "80ddf23a5d97825e79bb1018eebb6f3f985d4fa8", + "url": "https://api.github.com/repos/laravel/pint/zipball/93b2d0d49719bc6e444ba21cd4dbbccec935413d", + "reference": "93b2d0d49719bc6e444ba21cd4dbbccec935413d", "shasum": "" }, "require": { @@ -530,16 +530,16 @@ "ext-mbstring": "*", "ext-tokenizer": "*", "ext-xml": "*", - "php": "^8.0" + "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.14", - "illuminate/view": "^9.32.0", - "laravel-zero/framework": "^9.2.0", - "mockery/mockery": "^1.5.1", - "nunomaduro/larastan": "^2.2.0", - "nunomaduro/termwind": "^1.14.0", - "pestphp/pest": "^1.22.1" + "friendsofphp/php-cs-fixer": "^3.34.1", + "illuminate/view": "^10.23.1", + "laravel-zero/framework": "^10.1.2", + "mockery/mockery": "^1.6.6", + "nunomaduro/larastan": "^2.6.4", + "nunomaduro/termwind": "^1.15.1", + "pestphp/pest": "^2.18.2" }, "bin": [ "builds/pint" @@ -575,7 +575,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2023-01-31T15:50:45+00:00" + "time": "2023-10-10T15:39:09+00:00" }, { "name": "myclabs/deep-copy", @@ -839,16 +839,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.38", + "version": "1.10.39", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691" + "reference": "d9dedb0413f678b4d03cbc2279a48f91592c97c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5302bb402c57f00fb3c2c015bac86e0827e4b691", - "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d9dedb0413f678b4d03cbc2279a48f91592c97c4", + "reference": "d9dedb0413f678b4d03cbc2279a48f91592c97c4", "shasum": "" }, "require": { @@ -897,7 +897,7 @@ "type": "tidelift" } ], - "time": "2023-10-06T14:19:14+00:00" + "time": "2023-10-17T15:46:26+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2608,5 +2608,5 @@ "php": ">=8.0" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.6.0" } diff --git a/src/Database/Adapter/Mongo.php b/src/Database/Adapter/Mongo.php index df827a405..2a2f138d4 100644 --- a/src/Database/Adapter/Mongo.php +++ b/src/Database/Adapter/Mongo.php @@ -979,7 +979,7 @@ private function timeFilter(array $filters): array foreach ($filters as $k => $v) { if ($k === '_createdAt' || $k == '_updatedAt') { if (is_array($v)) { - foreach ($v as $sk=>$sv) { + foreach ($v as $sk => $sv) { $results[$k][$sk] = $this->toMongoDatetime($sv); } } else { diff --git a/src/Database/Adapter/MySQL.php b/src/Database/Adapter/MySQL.php index 3260cb412..92fe39772 100644 --- a/src/Database/Adapter/MySQL.php +++ b/src/Database/Adapter/MySQL.php @@ -79,12 +79,12 @@ protected function processException(PDOException $e): void throw $e; } - /** - * Get Collection Size - * @param string $collection - * @return int - * @throws DatabaseException - */ + /** + * Get Collection Size + * @param string $collection + * @return int + * @throws DatabaseException + */ public function getSizeOfCollection(string $collection): int { $collection = $this->filter($collection); diff --git a/src/Database/Validator/Roles.php b/src/Database/Validator/Roles.php index 77ac5d454..0306118e7 100644 --- a/src/Database/Validator/Roles.php +++ b/src/Database/Validator/Roles.php @@ -41,7 +41,7 @@ class Roles extends Validator 'allowed' => false, 'required' => false, ], - 'dimension' =>[ + 'dimension' => [ 'allowed' => false, 'required' => false, ], @@ -51,7 +51,7 @@ class Roles extends Validator 'allowed' => false, 'required' => false, ], - 'dimension' =>[ + 'dimension' => [ 'allowed' => false, 'required' => false, ], @@ -61,7 +61,7 @@ class Roles extends Validator 'allowed' => false, 'required' => false, ], - 'dimension' =>[ + 'dimension' => [ 'allowed' => true, 'required' => false, 'options' => self::USER_DIMENSIONS @@ -72,7 +72,7 @@ class Roles extends Validator 'allowed' => true, 'required' => true, ], - 'dimension' =>[ + 'dimension' => [ 'allowed' => true, 'required' => false, 'options' => self::USER_DIMENSIONS @@ -83,7 +83,7 @@ class Roles extends Validator 'allowed' => true, 'required' => true, ], - 'dimension' =>[ + 'dimension' => [ 'allowed' => true, 'required' => false, ], @@ -93,7 +93,7 @@ class Roles extends Validator 'allowed' => true, 'required' => true, ], - 'dimension' =>[ + 'dimension' => [ 'allowed' => false, 'required' => false, ], @@ -103,7 +103,7 @@ class Roles extends Validator 'allowed' => true, 'required' => true, ], - 'dimension' =>[ + 'dimension' => [ 'allowed' => false, 'required' => false, ], diff --git a/tests/Database/Base.php b/tests/Database/Base.php index 99e7b41d0..7117a0e68 100644 --- a/tests/Database/Base.php +++ b/tests/Database/Base.php @@ -3452,13 +3452,13 @@ public function testNoChangeUpdateDocumentWithRelationWithoutPermission(): void Permission::create(Role::any()), Permission::delete(Role::any()), ]; - for ($i=1; $i < 6; $i++) { + for ($i = 1; $i < 6; $i++) { static::getDatabase()->createCollection("level{$i}", [$attribute], [], $permissions); } for ($i = 1; $i < 5; $i++) { $collectionId = $i; - $relatedCollectionId = $i+1; + $relatedCollectionId = $i + 1; static::getDatabase()->createRelationship( collection: "level{$collectionId}", relatedCollection: "level{$relatedCollectionId}", @@ -3520,7 +3520,7 @@ public function testNoChangeUpdateDocumentWithRelationWithoutPermission(): void $level1 = static::getDatabase()->updateDocument('level1', $level1->getId(), $level1); $this->assertEquals('updated value', $level1['level2']['level3']['name']); - for ($i=1; $i < 6; $i++) { + for ($i = 1; $i < 6; $i++) { static::getDatabase()->deleteCollection("level{$i}"); } } @@ -3686,7 +3686,7 @@ public function testExceptionWidthLimit(int $key, int $stringSize, int $stringCo */ public function testCheckAttributeWidthLimit(int $key, int $stringSize, int $stringCount, int $intCount, int $floatCount, int $boolCount): void { - if (static::getDatabase()->getAdapter()::getDocumentSizeLimit()> 0) { + if (static::getDatabase()->getAdapter()::getDocumentSizeLimit() > 0) { $collection = static::getDatabase()->getCollection("widthLimit{$key}"); // create same attribute in testExceptionWidthLimit @@ -4141,7 +4141,7 @@ public function testUpdateAttributeStructure(): void $this->assertEquals(false, $attribute['array']); $this->assertEquals(false, $attribute['required']); $this->assertEquals('priceRange', $attribute['format']); - $this->assertEquals(['min'=>1, 'max'=>10000], $attribute['formatOptions']); + $this->assertEquals(['min' => 1, 'max' => 10000], $attribute['formatOptions']); $database->updateAttribute('flowers', 'price', default: 100); $collection = $database->getCollection('flowers'); @@ -4153,7 +4153,7 @@ public function testUpdateAttributeStructure(): void $this->assertEquals(false, $attribute['array']); $this->assertEquals(false, $attribute['required']); $this->assertEquals('priceRange', $attribute['format']); - $this->assertEquals(['min'=>1, 'max'=>10000], $attribute['formatOptions']); + $this->assertEquals(['min' => 1, 'max' => 10000], $attribute['formatOptions']); $database->updateAttribute('flowers', 'price', format: 'priceRangeNew'); $collection = $database->getCollection('flowers'); @@ -4165,7 +4165,7 @@ public function testUpdateAttributeStructure(): void $this->assertEquals(false, $attribute['array']); $this->assertEquals(false, $attribute['required']); $this->assertEquals('priceRangeNew', $attribute['format']); - $this->assertEquals(['min'=>1, 'max'=>10000], $attribute['formatOptions']); + $this->assertEquals(['min' => 1, 'max' => 10000], $attribute['formatOptions']); $database->updateAttribute('flowers', 'price', format: ''); $collection = $database->getCollection('flowers'); @@ -4177,7 +4177,7 @@ public function testUpdateAttributeStructure(): void $this->assertEquals(false, $attribute['array']); $this->assertEquals(false, $attribute['required']); $this->assertEquals('', $attribute['format']); - $this->assertEquals(['min'=>1, 'max'=>10000], $attribute['formatOptions']); + $this->assertEquals(['min' => 1, 'max' => 10000], $attribute['formatOptions']); $database->updateAttribute('flowers', 'price', formatOptions: ['min' => 1, 'max' => 999]); $collection = $database->getCollection('flowers'); @@ -4189,7 +4189,7 @@ public function testUpdateAttributeStructure(): void $this->assertEquals(false, $attribute['array']); $this->assertEquals(false, $attribute['required']); $this->assertEquals('', $attribute['format']); - $this->assertEquals(['min'=>1, 'max'=>999], $attribute['formatOptions']); + $this->assertEquals(['min' => 1, 'max' => 999], $attribute['formatOptions']); $database->updateAttribute('flowers', 'price', formatOptions: []); $collection = $database->getCollection('flowers'); diff --git a/tests/Database/Validator/IndexedQueriesTest.php b/tests/Database/Validator/IndexedQueriesTest.php index 2e5b5893d..764626fd5 100644 --- a/tests/Database/Validator/IndexedQueriesTest.php +++ b/tests/Database/Validator/IndexedQueriesTest.php @@ -87,7 +87,7 @@ public function testValid(): void ); $this->assertEquals(true, $validator->isValid(['cursorAfter("asdf")']), $validator->getDescription()); - $this->assertEquals(true, $validator->isValid([Query::cursorAfter(new Document(['$id'=>'asdf']))]), $validator->getDescription()); + $this->assertEquals(true, $validator->isValid([Query::cursorAfter(new Document(['$id' => 'asdf']))]), $validator->getDescription()); $this->assertEquals(true, $validator->isValid(['equal("name", "value")']), $validator->getDescription()); $this->assertEquals(true, $validator->isValid([Query::equal('name', ['value'])]), $validator->getDescription()); $this->assertEquals(true, $validator->isValid(['limit(10)']), $validator->getDescription());