From e6031556be664796195126338833123bbf5dda27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Mon, 27 Jan 2025 10:48:29 +0100 Subject: [PATCH 1/3] Upgrade psalm v6 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5a2c10def..18453ab82 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "phpunit/phpunit": "^10.5.35", "rector/rector": "^1.2", "squizlabs/php_codesniffer": "^3.7", - "vimeo/psalm": "^5.13" + "vimeo/psalm": "^6" }, "replace": { "mongodb/builder": "*" From 456ccd836a3f661b408ba40bd7f8883618b2d2b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Mon, 27 Jan 2025 10:53:16 +0100 Subject: [PATCH 2/3] Remove psalm stubs --- psalm.xml.dist | 6 ---- stubs/BSON/Document.stub.php | 49 --------------------------------- stubs/BSON/Iterator.stub.php | 29 ------------------- stubs/BSON/PackedArray.stub.php | 40 --------------------------- 4 files changed, 124 deletions(-) delete mode 100644 stubs/BSON/Document.stub.php delete mode 100644 stubs/BSON/Iterator.stub.php delete mode 100644 stubs/BSON/PackedArray.stub.php diff --git a/psalm.xml.dist b/psalm.xml.dist index 83d825d51..08eb020ac 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -17,12 +17,6 @@ - - - - - - diff --git a/stubs/BSON/Document.stub.php b/stubs/BSON/Document.stub.php deleted file mode 100644 index b1b3c60fb..000000000 --- a/stubs/BSON/Document.stub.php +++ /dev/null @@ -1,49 +0,0 @@ - - */ -final class Document implements \IteratorAggregate, \Serializable -{ - private function __construct() {} - - final static public function fromBSON(string $bson): Document {} - - final static public function fromJSON(string $json): Document {} - - /** @param array|object $value */ - final static public function fromPHP($value): Document {} - - /** @return TValue */ - final public function get(string $key) {} - - /** @return Iterator */ - final public function getIterator(): Iterator {} - - final public function has(string $key): bool {} - - /** @return array|object */ - final public function toPHP(?array $typeMap = null) {} - - final public function toCanonicalExtendedJSON(): string {} - - final public function toRelaxedExtendedJSON(): string {} - - final public function __toString(): string {} - - final public static function __set_state(array $properties): Document {} - - final public function serialize(): string {} - - /** @param string $serialized */ - final public function unserialize($serialized): void {} - - final public function __unserialize(array $data): void {} - - final public function __serialize(): array {} -} diff --git a/stubs/BSON/Iterator.stub.php b/stubs/BSON/Iterator.stub.php deleted file mode 100644 index cc8f699e4..000000000 --- a/stubs/BSON/Iterator.stub.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ -final class Iterator implements \Iterator -{ - final private function __construct() {} - - /** @return TValue */ - final public function current() {} - - /** @return TKey */ - final public function key() {} - - final public function next(): void {} - - final public function rewind(): void {} - - final public function valid(): bool {} - - final public function __wakeup(): void {} -} diff --git a/stubs/BSON/PackedArray.stub.php b/stubs/BSON/PackedArray.stub.php deleted file mode 100644 index 231a55019..000000000 --- a/stubs/BSON/PackedArray.stub.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ -final class PackedArray implements \IteratorAggregate, \Serializable -{ - private function __construct() {} - - final static public function fromPHP(array $value): PackedArray {} - - /** @return TValue */ - final public function get(int $index) {} - - /** @return Iterator */ - final public function getIterator(): Iterator {} - - final public function has(int $index): bool {} - - /** @return array|object */ - final public function toPHP(?array $typeMap = null) {} - - final public function __toString(): string {} - - final public static function __set_state(array $properties): PackedArray {} - - final public function serialize(): string {} - - /** @param string $serialized */ - final public function unserialize($serialized): void {} - - final public function __unserialize(array $data): void {} - - final public function __serialize(): array {} -} From e5b8d7a91e07eb43b9a666a5f6c7fccb84d6719f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Tue, 11 Feb 2025 12:51:37 +0100 Subject: [PATCH 3/3] Disable internal null and false return --- .github/actions/setup/action.yml | 4 +--- composer.json | 2 +- psalm-baseline.xml | 20 +------------------- psalm.xml.dist | 2 ++ 4 files changed, 5 insertions(+), 23 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index da58ba8a5..48d916394 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -49,7 +49,5 @@ runs: - name: Install dependencies with Composer uses: ramsey/composer-install@3.0.0 with: - # Revert when psalm supports PHP 8.4 - # composer-options: "--no-suggest" - composer-options: "--no-suggest ${{ inputs.php-version == '8.4' && '--ignore-platform-req=php+' || '' }}" + composer-options: "--no-suggest" working-directory: "${{ inputs.working-directory }}" diff --git a/composer.json b/composer.json index 18453ab82..f4aee2618 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "phpunit/phpunit": "^10.5.35", "rector/rector": "^1.2", "squizlabs/php_codesniffer": "^3.7", - "vimeo/psalm": "^6" + "vimeo/psalm": "^6.5" }, "replace": { "mongodb/builder": "*" diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 321bbc05a..eb68663a1 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + @@ -398,11 +398,6 @@ current()]]> - - - - - @@ -754,9 +749,6 @@ - - - @@ -772,9 +764,6 @@ - - - @@ -922,9 +911,6 @@ postBatchResumeToken]]> - - - cursor->firstBatch]]> cursor->postBatchResumeToken]]> @@ -963,10 +949,6 @@ - - - - diff --git a/psalm.xml.dist b/psalm.xml.dist index 08eb020ac..ba737bd6a 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -2,6 +2,8 @@