Skip to content

Commit

Permalink
Merge pull request #25 from doctrine/WindowsSupport
Browse files Browse the repository at this point in the history
Bugfix: Add path checks for windows.
  • Loading branch information
beberlei authored Mar 21, 2021
2 parents 816a70b + 9e41eba commit 9504165
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Doctrine/Deprecations/Deprecation.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,14 @@ public static function triggerIfCalledFromOutside(string $package, string $link,
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);

// first check that the caller is not from a tests folder, in which case we always let deprecations pass
if (strpos($backtrace[1]['file'], '/tests/') === false) {
if (strpos($backtrace[0]['file'], '/vendor/' . $package . '/') === false) {
if (strpos($backtrace[1]['file'], DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR) === false) {
$path = DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR;

if (strpos($backtrace[0]['file'], $path) === false) {
return;
}

if (strpos($backtrace[1]['file'], '/vendor/' . $package . '/') !== false) {
if (strpos($backtrace[1]['file'], $path) !== false) {
return;
}
}
Expand Down

0 comments on commit 9504165

Please sign in to comment.