Skip to content

Commit 1e56bbb

Browse files
committed
Fix phpstan error
1 parent bdb0d0a commit 1e56bbb

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

docs/config.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -634,16 +634,15 @@ Lazy object implementation
634634

635635
Doctrine MongoDB ODM uses lazy objects for lazy instantiation of references.
636636
The original implementation is based on the `ProxyManager` library.
637-
Since version 2.10 of Doctrine MongoDB ODM, support for Symfony lazy ghost
638-
objects has been added. And in version 2.14, support for PHP 8.4 native lazy
639-
objects has been added.
637+
In version 2.10, support for Symfony lazy ghost objects has been added.
638+
And in version 2.14, support for PHP 8.4 native lazy objects has been added.
640639

641-
The bundle select the best available lazy object implementation based on the
640+
The bundle selects the best available lazy object implementation based on the
642641
installed packages and PHP version. You can override this behavior by setting
643-
the following configuration options to enable or disable specific lazy object
644-
implementations. This is not recommended unless you have a specific reason to do
645-
so. Please open an issue if the default Native Lazy Objects are not working as
646-
expected.
642+
the following configuration options disable specific lazy object implementations.
643+
This is not recommended unless you have a specific reason to do so.
644+
Please open an issue if the default Native Lazy Objects are not working as expected
645+
as it is the preferred implementation, other will be removed in future versions.
647646

648647
- ``enable_native_lazy_objects`` is ``true`` by default when PHP 8.4+ and ``doctrine/mongodb-odm`` 2.14+ are installed.
649648
When enabled, native lazy objects will be used for lazy loading references.

phpstan-baseline.neon

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ parameters:
186186
count: 2
187187
path: src/DependencyInjection/Configuration.php
188188

189+
-
190+
message: '#^Call to function method_exists\(\) with ''Doctrine\\\\ODM\\\\MongoDB\\\\Configuration'' and ''setUseNativeLazyObj…'' will always evaluate to true\.$#'
191+
identifier: function.alreadyNarrowedType
192+
count: 2
193+
path: src/DependencyInjection/Configuration.php
194+
189195
-
190196
message: '#^Parameter \#1 \$rootNode of method Doctrine\\Bundle\\MongoDBBundle\\DependencyInjection\\Configuration\:\:addConnectionsSection\(\) expects Symfony\\Component\\Config\\Definition\\Builder\\ArrayNodeDefinition, Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition given\.$#'
191197
identifier: argument.type
@@ -525,7 +531,13 @@ parameters:
525531
-
526532
message: '#^Call to function method_exists\(\) with ''Doctrine\\\\ODM\\\\MongoDB\\\\Configuration'' and ''setUseLazyGhostObje…'' will always evaluate to true\.$#'
527533
identifier: function.alreadyNarrowedType
528-
count: 2
534+
count: 1
535+
path: tests/DependencyInjection/ConfigurationTest.php
536+
537+
-
538+
message: '#^Call to function method_exists\(\) with ''Doctrine\\\\ODM\\\\MongoDB\\\\Configuration'' and ''setUseNativeLazyObj…'' will always evaluate to true\.$#'
539+
identifier: function.alreadyNarrowedType
540+
count: 1
529541
path: tests/DependencyInjection/ConfigurationTest.php
530542

531543
-
@@ -803,3 +815,9 @@ parameters:
803815
identifier: argument.type
804816
count: 1
805817
path: tests/ServiceRepositoryTest.php
818+
819+
-
820+
message: '#^Call to function method_exists\(\) with Doctrine\\ODM\\MongoDB\\Configuration and ''setUseLazyGhostObje…'' will always evaluate to true\.$#'
821+
identifier: function.alreadyNarrowedType
822+
count: 1
823+
path: tests/TestCase.php

tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static function createTestDocumentManager(array $paths = []): DocumentMan
3838
$config->setUseLazyGhostObject(false);
3939
}
4040

41-
$uri = getenv('MONGODB_URI') ?? throw new RuntimeException('The MONGODB_URI environment variable is not set.');
41+
$uri = getenv('MONGODB_URI') ?: throw new RuntimeException('The MONGODB_URI environment variable is not set.');
4242

4343
return DocumentManager::create(new Client($uri), $config);
4444
}

0 commit comments

Comments
 (0)