diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index edc66d3f209..9b19d874a66 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -31,6 +31,7 @@ This serves two purposes: ### Deprecated - The `PostAuthor::getName()` method is now deprecated and will be removed in v2. (use `$author->name` instead) in https://github.com/hydephp/develop/pull/1794 - Deprecated the `FeaturedImage::isRemote()` method in favor of the new `Hyperlinks::isRemote()` method in https://github.com/hydephp/develop/pull/1882 +- Deprecated the `Hyde::mediaLink()` method in favor of the `Hyde::asset()` method in https://github.com/hydephp/develop/pull/1993 ### Removed - for now removed features. diff --git a/packages/framework/src/Foundation/Concerns/ForwardsHyperlinks.php b/packages/framework/src/Foundation/Concerns/ForwardsHyperlinks.php index 9d194fd5f42..7f5bef1d14e 100644 --- a/packages/framework/src/Foundation/Concerns/ForwardsHyperlinks.php +++ b/packages/framework/src/Foundation/Concerns/ForwardsHyperlinks.php @@ -5,6 +5,7 @@ namespace Hyde\Foundation\Concerns; use Hyde\Support\Models\Route; +use JetBrains\PhpStorm\Deprecated; /** * @internal Single-use trait for the HydeKernel class. @@ -23,8 +24,14 @@ public function relativeLink(string $destination): string return $this->hyperlinks->relativeLink($destination); } + /** + * @deprecated This method will be removed in v2.0. Please use `asset()` instead. + */ + #[Deprecated(reason: 'Use `asset` method instead.', replacement: '%class%::asset(%parameter0%)')] public function mediaLink(string $destination, bool $validate = false): string { + trigger_deprecation('hyde/framework', '1.8.0', 'The %s() method is deprecated, use %s() instead.', __METHOD__, 'asset'); + return $this->hyperlinks->mediaLink($destination, $validate); } diff --git a/packages/framework/src/Foundation/Kernel/Hyperlinks.php b/packages/framework/src/Foundation/Kernel/Hyperlinks.php index 1e352060001..2a94165d2c2 100644 --- a/packages/framework/src/Foundation/Kernel/Hyperlinks.php +++ b/packages/framework/src/Foundation/Kernel/Hyperlinks.php @@ -7,6 +7,7 @@ use Hyde\Facades\Config; use Hyde\Support\Models\Route; use Hyde\Foundation\HydeKernel; +use JetBrains\PhpStorm\Deprecated; use Hyde\Framework\Exceptions\BaseUrlNotSetException; use Hyde\Framework\Exceptions\FileNotFoundException; use Illuminate\Support\Str; @@ -92,7 +93,10 @@ public function relativeLink(string $destination): string * * An exception will be thrown if the file does not exist in the _media directory, * and the second argument is set to true. + * + * @deprecated This method will be removed in v2.0. Please use `asset()` instead. */ + #[Deprecated(reason: 'Use `asset` method instead.', replacement: '%class%->asset(%parameter0%)')] public function mediaLink(string $destination, bool $validate = false): string { if ($validate && ! file_exists($sourcePath = "{$this->kernel->getMediaDirectory()}/$destination")) {