diff --git a/lib/Doctrine/Deprecations/Deprecation.php b/lib/Doctrine/Deprecations/Deprecation.php index 07cb43b..bad5070 100644 --- a/lib/Doctrine/Deprecations/Deprecation.php +++ b/lib/Doctrine/Deprecations/Deprecation.php @@ -11,6 +11,7 @@ use function assert; use function debug_backtrace; use function sprintf; +use function str_replace; use function strpos; use function strrpos; use function substr; @@ -138,7 +139,7 @@ public static function triggerIfCalledFromOutside(string $package, string $link, // first check that the caller is not from a tests folder, in which case we always let deprecations pass if (isset($backtrace[1]['file'], $backtrace[0]['file']) && strpos($backtrace[1]['file'], DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR) === false) { - $path = DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR; + $path = DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $package) . DIRECTORY_SEPARATOR; if (strpos($backtrace[0]['file'], $path) === false) { return; diff --git a/tests/Doctrine/Deprecations/DeprecationTest.php b/tests/Doctrine/Deprecations/DeprecationTest.php index d39968e..597027d 100644 --- a/tests/Doctrine/Deprecations/DeprecationTest.php +++ b/tests/Doctrine/Deprecations/DeprecationTest.php @@ -234,6 +234,8 @@ public function testDeprecationIfCalledFromOutside(): void ); Foo::triggerDependencyWithDeprecation(); + + $this->assertEquals(1, Deprecation::getUniqueTriggeredDeprecationsCount()); } public function testDeprecationIfCalledFromOutsideNotTriggeringFromInside(): void