From ec628b1ff546101f9fc64c5780ca59a4e8fa05f7 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 21 Jul 2026 09:08:52 +0545 Subject: [PATCH] fix: declare spyc directly and align DetectorTest with rector Removing matomo/device-detector also dropped mustangostang/spyc, which Compose.php uses directly as a yaml_parse fallback via Spyc::YAMLLoadString. Declare it as a direct dependency instead of relying on the transitive pull. Switch the new DetectorTest assertions to assertSame to satisfy the refactor:check Rector rule. --- composer.json | 1 + composer.lock | 56 +++++++++++++++++++++++++++- tests/unit/Detector/DetectorTest.php | 8 ++-- 3 files changed, 60 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 29f4227c51..02fbfbf704 100644 --- a/composer.json +++ b/composer.json @@ -95,6 +95,7 @@ "utopia-php/system": "0.10.*", "utopia-php/telemetry": "^0.4", "utopia-php/user-agent": "0.1.*", + "mustangostang/spyc": "0.6.*", "utopia-php/vcs": "^4.4.2", "utopia-php/websocket": "1.0.*", "dragonmantank/cron-expression": "3.4.*", diff --git a/composer.lock b/composer.lock index cc1369062a..8a33f3e085 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": "38ff4f69a268151556ee8776b1afab39", + "content-hash": "f9e477526d52de114f4bc6b07ebd21ea", "packages": [ { "name": "adhocore/jwt", @@ -877,6 +877,60 @@ }, "time": "2025-10-06T12:12:40+00:00" }, + { + "name": "mustangostang/spyc", + "version": "0.6.3", + "source": { + "type": "git", + "url": "https://github.com/mustangostang/spyc.git", + "reference": "4627c838b16550b666d15aeae1e5289dd5b77da0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mustangostang/spyc/zipball/4627c838b16550b666d15aeae1e5289dd5b77da0", + "reference": "4627c838b16550b666d15aeae1e5289dd5b77da0", + "shasum": "" + }, + "require": { + "php": ">=5.3.1" + }, + "require-dev": { + "phpunit/phpunit": "4.3.*@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.5.x-dev" + } + }, + "autoload": { + "files": [ + "Spyc.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "mustangostang", + "email": "vlad.andersen@gmail.com" + } + ], + "description": "A simple YAML loader/dumper class for PHP", + "homepage": "https://github.com/mustangostang/spyc/", + "keywords": [ + "spyc", + "yaml", + "yml" + ], + "support": { + "issues": "https://github.com/mustangostang/spyc/issues", + "source": "https://github.com/mustangostang/spyc/tree/0.6.3" + }, + "time": "2019-09-10T13:16:29+00:00" + }, { "name": "nyholm/psr7", "version": "1.8.2", diff --git a/tests/unit/Detector/DetectorTest.php b/tests/unit/Detector/DetectorTest.php index 4614602276..7f1d6e4f1e 100644 --- a/tests/unit/Detector/DetectorTest.php +++ b/tests/unit/Detector/DetectorTest.php @@ -54,9 +54,9 @@ final class DetectorTest extends TestCase { $detector = new Detector('Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1'); - $this->assertEquals(['osCode' => 'IOS', 'osName' => 'iOS', 'osVersion' => '17.0'], $detector->getOS()); + $this->assertSame(['osCode' => 'IOS', 'osName' => 'iOS', 'osVersion' => '17.0'], $detector->getOS()); $this->assertEquals('MF', $detector->getClient()['clientCode']); - $this->assertEquals([ + $this->assertSame([ 'deviceName' => 'smartphone', 'deviceBrand' => 'Apple', 'deviceModel' => 'iPhone', @@ -67,7 +67,7 @@ final class DetectorTest extends TestCase { $detector = new Detector('AppwriteCLI/2.0.0 (linux; x64) node/18.0.0'); - $this->assertEquals([ + $this->assertSame([ 'clientType' => 'desktop', 'clientCode' => 'cli', 'clientName' => 'Appwrite CLI', @@ -82,7 +82,7 @@ final class DetectorTest extends TestCase $detector = new Detector(''); // OS and client fields default to an empty string, device fields to null. - $this->assertEquals(['osCode' => '', 'osName' => '', 'osVersion' => ''], $detector->getOS()); + $this->assertSame(['osCode' => '', 'osName' => '', 'osVersion' => ''], $detector->getOS()); $this->assertEquals('', $detector->getClient()['clientType']); $this->assertEquals([ 'deviceName' => null,