diff --git a/CHANGELOG.md b/CHANGELOG.md index edd119625..382bee76a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,9 @@ All notable changes to this project will be documented in this file. ## [unreleased] * New aggregation pipeline builder by @GromNaN in [#2738](https://github.com/mongodb/laravel-mongodb/pull/2738) +* Drop support for Composer 1.x by @GromNaN in [#2784](https://github.com/mongodb/laravel-mongodb/pull/2784) -## [4.2.0] - 2024-12-14 +## [4.2.0] - 2024-03-14 * Add support for Laravel 11 by @GromNaN in [#2735](https://github.com/mongodb/laravel-mongodb/pull/2735) * Implement Model::createOrFirst() using findOneAndUpdate operation by @GromNaN in [#2742](https://github.com/mongodb/laravel-mongodb/pull/2742) diff --git a/composer.json b/composer.json index 3769bdfe6..51c7e1e43 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ "require": { "php": "^8.1", "ext-mongodb": "^1.15", + "composer-runtime-api": "^2.0.0", "illuminate/support": "^10.0|^11", "illuminate/container": "^10.0|^11", "illuminate/database": "^10.30|^11", diff --git a/src/Connection.php b/src/Connection.php index 3f529cdea..01232c7ae 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -16,7 +16,6 @@ use MongoDB\Laravel\Concerns\ManagesTransactions; use Throwable; -use function class_exists; use function filter_var; use function implode; use function is_array; @@ -324,14 +323,10 @@ private static function getVersion(): string private static function lookupVersion(): string { - if (class_exists(InstalledVersions::class)) { - try { - return self::$version = InstalledVersions::getPrettyVersion('mongodb/laravel-mongodb'); - } catch (Throwable) { - return self::$version = 'error'; - } + try { + return self::$version = InstalledVersions::getPrettyVersion('mongodb/laravel-mongodb') ?? 'unknown'; + } catch (Throwable) { + return self::$version = 'error'; } - - return self::$version = 'unknown'; } }