diff --git a/src/AopPostfixClassName.php b/src/AopPostfixClassName.php index a05c0f3f..3d332284 100644 --- a/src/AopPostfixClassName.php +++ b/src/AopPostfixClassName.php @@ -18,10 +18,10 @@ final class AopPostfixClassName public $postFix; /** @param class-string $class */ - public function __construct(string $class, string $bindings) + public function __construct(string $class, string $bindings, string $classDir) { $fileTime = (string) filemtime((string) (new ReflectionClass($class))->getFileName()); - $this->postFix = '_' . crc32($fileTime . $bindings); + $this->postFix = '_' . crc32($fileTime . $bindings . $classDir); $this->fqn = $class . $this->postFix; } } diff --git a/src/Compiler.php b/src/Compiler.php index 2cd72cb5..bb8b521f 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -65,7 +65,7 @@ public function compile(string $class, BindInterface $bind): string return $class; } - $className = new AopPostfixClassName($class, (string) $bind); + $className = new AopPostfixClassName($class, (string) $bind, $this->classDir); if (class_exists($className->fqn, false)) { return $className->fqn; } diff --git a/src/Weaver.php b/src/Weaver.php index 546de004..bf5c769c 100644 --- a/src/Weaver.php +++ b/src/Weaver.php @@ -62,7 +62,7 @@ public function newInstance(string $class, array $args): object */ public function weave(string $class): string { - $aopClass = new AopPostfixClassName($class, $this->bindName); + $aopClass = new AopPostfixClassName($class, $this->bindName, $this->classDir); if (class_exists($aopClass->fqn, false)) { return $aopClass->fqn; }