diff --git a/packages/framework/src/Foundation/PharSupport.php b/packages/framework/src/Foundation/PharSupport.php index 7f76b02f0d4..7117df5b884 100644 --- a/packages/framework/src/Foundation/PharSupport.php +++ b/packages/framework/src/Foundation/PharSupport.php @@ -6,7 +6,6 @@ use Hyde\Hyde; use Phar; -use BadMethodCallException; use function dirname; use function is_dir; @@ -47,10 +46,6 @@ public static function hasVendorDirectory(): bool public static function vendorPath(string $path = '', string $package = 'framework'): string { - if ($package !== 'framework') { - throw new BadMethodCallException('Cannot use vendorPath() outside of the framework package when running from a Phar archive.'); - } - - return rtrim(str_replace('/', DIRECTORY_SEPARATOR, rtrim(dirname(__DIR__, 2).'/'.$path, '/\\')), '/\\'); + return rtrim(str_replace('/', DIRECTORY_SEPARATOR, rtrim(dirname(__DIR__, 3).'/'.$package.'/'.$path, '/\\')), '/\\'); } } diff --git a/packages/framework/tests/Feature/PharSupportTest.php b/packages/framework/tests/Feature/PharSupportTest.php index 8bca9b57805..f6e46f32241 100644 --- a/packages/framework/tests/Feature/PharSupportTest.php +++ b/packages/framework/tests/Feature/PharSupportTest.php @@ -4,7 +4,6 @@ namespace Hyde\Framework\Testing\Feature; -use BadMethodCallException; use Hyde\Foundation\PharSupport; use Hyde\Hyde; use Hyde\Testing\TestCase; @@ -65,16 +64,6 @@ public function test_vendor_path_can_run_in_phar_with_path_argument() $this->assertEquals($this->replaceSlashes(Hyde::path("{$this->getBaseVendorPath()}/framework/file.php")), Hyde::vendorPath('file.php')); } - public function test_vendor_path_can_run_in_phar_with_package_argument_but_throws() - { - PharSupport::mock('running', true); - PharSupport::mock('hasVendorDirectory', false); - - $this->expectException(BadMethodCallException::class); - - Hyde::vendorPath(package: 'realtime-compiler'); - } - protected function getBaseVendorPath(): string { // Monorepo support for symlinked packages directory