diff --git a/src/Admin/PostTable.php b/src/Admin/PostTable.php index 374c9903..9586f41e 100644 --- a/src/Admin/PostTable.php +++ b/src/Admin/PostTable.php @@ -201,8 +201,14 @@ public function adjustTrashLink($rowActions, $post) return $rowActions; } + $deleteUrl = get_delete_post_link($post->ID, '', true); + + if (!is_string($deleteUrl)) { + return $rowActions; + } + $rowActions['trash'] = '' . esc_html__('Remove', 'notification') . ''; diff --git a/src/Store/Carrier.php b/src/Store/Carrier.php index dc3a11af..f1112c94 100644 --- a/src/Store/Carrier.php +++ b/src/Store/Carrier.php @@ -10,16 +10,14 @@ namespace BracketSpace\Notification\Store; -use BracketSpace\Notification\Interfaces\Storable; +use BracketSpace\Notification\Interfaces; use BracketSpace\Notification\Traits\Storage; /** * Carrier Store - * - * @method static array all() Gets all registered Carriers - * @method static \BracketSpace\Notification\Interfaces\Sendable|null get(string $index) Gets registered Carrier */ -class Carrier implements Storable +class Carrier implements Interfaces\Storable { + /** @use Storage */ use Storage; } diff --git a/src/Store/GlobalMergeTag.php b/src/Store/GlobalMergeTag.php index e1982a92..ad13bc63 100644 --- a/src/Store/GlobalMergeTag.php +++ b/src/Store/GlobalMergeTag.php @@ -15,12 +15,9 @@ /** * Global Merge Tag Store - * //phpcs:ignore Generic.Files.LineLength.TooLong - * @method static array all() Gets all registered Global MergeTags - * //phpcs:ignore Generic.Files.LineLength.TooLong - * @method static \BracketSpace\Notification\Interfaces\Taggable|null get(string $index) Gets registered Global MergeTag */ class GlobalMergeTag implements Interfaces\Storable { + /** @use Storage */ use Storage; } diff --git a/src/Store/Notification.php b/src/Store/Notification.php index 3b3babd4..46d75585 100644 --- a/src/Store/Notification.php +++ b/src/Store/Notification.php @@ -20,6 +20,7 @@ class Notification implements Storable { use Casegnostic; + /** @use Storage */ use Storage; /** diff --git a/src/Store/Resolver.php b/src/Store/Resolver.php index eb75e867..87d23931 100644 --- a/src/Store/Resolver.php +++ b/src/Store/Resolver.php @@ -18,12 +18,13 @@ */ class Resolver implements Interfaces\Storable { + /** @use Storage */ use Storage; /** * Gets all Resolvers sorted by priority. * - * @return array + * @return array * @since 8.0.0 */ public static function sorted(): array diff --git a/src/Store/Trigger.php b/src/Store/Trigger.php index fe36f7ea..ccc7b33a 100644 --- a/src/Store/Trigger.php +++ b/src/Store/Trigger.php @@ -15,18 +15,16 @@ /** * Trigger Store - * - * @method static array all() Gets all registered Triggers - * @method static \BracketSpace\Notification\Interfaces\Triggerable|null get(string $index) Gets registered Trigger */ class Trigger implements Interfaces\Storable { + /** @use Storage */ use Storage; /** * Gets all Triggers grouped. * - * @return array> + * @return array> * @since 8.0.0 */ public static function grouped(): array diff --git a/src/Traits/Storage.php b/src/Traits/Storage.php index 186831fd..96f1bf61 100644 --- a/src/Traits/Storage.php +++ b/src/Traits/Storage.php @@ -14,20 +14,22 @@ /** * Storage trait + * + * @template TItem */ trait Storage { /** * Stored items * - * @var array + * @var array */ - private static $items = []; + protected static $items = []; /** * Adds an item to the Store * - * @param mixed $item Item to add. + * @param TItem $item Item to add. * @return void * @since 8.0.0 */ @@ -40,7 +42,7 @@ public static function add($item) * Inserts an item at a specific index. * * @param int|string $index Item index. - * @param mixed $item Item to add. + * @param TItem $item Item to add. * @return void * @since 8.0.0 */ @@ -64,7 +66,7 @@ public static function insert($index, $item) /** * Gets all items * - * @return array + * @return array * @since 8.0.0 */ public static function all(): array @@ -87,7 +89,7 @@ public static function clear() * Get item by index * * @param mixed $index Intex of an item. - * @return mixed + * @return TItem|null * @since 8.0.0 */ public static function get($index) @@ -101,7 +103,7 @@ public static function get($index) ) ); - return; + return null; } return static::$items[$index];