From 650d5a7e815033bdbdc60c6eb0e6c4a7899883b2 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Fri, 26 Jul 2024 16:54:58 +0200 Subject: [PATCH] Manually proxy and deprecate legacy facade methods This is so we can get an overview of the outdated methods that are inconsistently named This means they are lost from the HydeKernel which could be a problem to review before merge. --- .../hyde-kernel-filesystem-methods.md | 18 +-------------- .../Concerns/ForwardsFilesystem.php | 10 -------- .../src/Foundation/Kernel/Filesystem.php | 17 -------------- packages/framework/src/Hyde.php | 2 -- .../framework/src/Support/V1Compatibility.php | 23 ++++++++++++++++++- 5 files changed, 23 insertions(+), 47 deletions(-) diff --git a/docs/_data/partials/hyde-pages-api/hyde-kernel-filesystem-methods.md b/docs/_data/partials/hyde-pages-api/hyde-kernel-filesystem-methods.md index 204bb419328..eb5983597e6 100644 --- a/docs/_data/partials/hyde-pages-api/hyde-kernel-filesystem-methods.md +++ b/docs/_data/partials/hyde-pages-api/hyde-kernel-filesystem-methods.md @@ -1,7 +1,7 @@
- + #### `filesystem()` @@ -27,22 +27,6 @@ No description provided. Hyde::vendorPath(string $path, string $package): string ``` -#### `mediaPath()` - -No description provided. - -```php -Hyde::mediaPath(string $path): string -``` - -#### `siteMediaPath()` - -No description provided. - -```php -Hyde::siteMediaPath(string $path): string -``` - #### `sitePath()` No description provided. diff --git a/packages/framework/src/Foundation/Concerns/ForwardsFilesystem.php b/packages/framework/src/Foundation/Concerns/ForwardsFilesystem.php index c0ac1518277..cea06f5bbc2 100644 --- a/packages/framework/src/Foundation/Concerns/ForwardsFilesystem.php +++ b/packages/framework/src/Foundation/Concerns/ForwardsFilesystem.php @@ -28,16 +28,6 @@ public function vendorPath(string $path = '', string $package = 'framework'): st return $this->filesystem->vendorPath($path, $package); } - public function mediaPath(string $path = ''): string - { - return $this->filesystem->mediaPath($path); - } - - public function siteMediaPath(string $path = ''): string - { - return $this->filesystem->siteMediaPath($path); - } - public function sitePath(string $path = ''): string { return $this->filesystem->sitePath($path); diff --git a/packages/framework/src/Foundation/Kernel/Filesystem.php b/packages/framework/src/Foundation/Kernel/Filesystem.php index f254440d3e8..8f3bb2fd2aa 100644 --- a/packages/framework/src/Foundation/Kernel/Filesystem.php +++ b/packages/framework/src/Foundation/Kernel/Filesystem.php @@ -7,7 +7,6 @@ use Hyde\Hyde; use Hyde\Foundation\HydeKernel; use Hyde\Foundation\PharSupport; -use Hyde\Support\Filesystem\MediaFile; use Illuminate\Support\Collection; use function collect; @@ -92,22 +91,6 @@ public function pathToRelative(string $path): string : $path); } - /** - * Get the absolute path to the media source directory, or a file within it. - */ - public function mediaPath(string $path = ''): string - { - return MediaFile::sourcePath($path); - } - - /** - * Get the absolute path to the compiled site's media directory, or a file within it. - */ - public function siteMediaPath(string $path = ''): string - { - return MediaFile::outputPath($path); - } - /** * Get the absolute path to the compiled site directory, or a file within it. */ diff --git a/packages/framework/src/Hyde.php b/packages/framework/src/Hyde.php index 105b42de812..9590fb6133a 100644 --- a/packages/framework/src/Hyde.php +++ b/packages/framework/src/Hyde.php @@ -34,8 +34,6 @@ * @method static string pathToAbsolute(string $path) * @method static string pathToRelative(string $path) * @method static string sitePath(string $path = '') - * @method static string mediaPath(string $path = '') - * @method static string siteMediaPath(string $path = '') * @method static string formatLink(string $destination) * @method static string relativeLink(string $destination) * @method static string mediaLink(string $destination, bool $validate = false) diff --git a/packages/framework/src/Support/V1Compatibility.php b/packages/framework/src/Support/V1Compatibility.php index ed03754713d..f6bd2de40c7 100644 --- a/packages/framework/src/Support/V1Compatibility.php +++ b/packages/framework/src/Support/V1Compatibility.php @@ -4,6 +4,9 @@ namespace Hyde\Support; +use JetBrains\PhpStorm\Deprecated; +use Hyde\Support\Filesystem\MediaFile; + /** * @internal Hyde Facade support to aid in the v1 to v2 transition. * @@ -11,5 +14,23 @@ */ trait V1Compatibility { - // + /** + * @deprecated Use MediaFile::sourcePath() instead. + * @see \Hyde\Support\Filesystem\MediaFile::sourcePath() + */ + #[Deprecated(reason: 'Use MediaFile::sourcePath() instead', replacement: '\Hyde\Support\Filesystem\MediaFile::sourcePath()')] + public static function mediaPath(string $path = ''): string + { + return MediaFile::sourcePath($path); + } + + /** + * @deprecated Use MediaFile::outputPath() instead. + * @see \Hyde\Support\Filesystem\MediaFile::outputPath() + */ + #[Deprecated(reason: 'Use MediaFile::outputPath() instead', replacement: '\Hyde\Support\Filesystem\MediaFile::outputPath()')] + public static function siteMediaPath(string $path = ''): string + { + return MediaFile::outputPath($path); + } }