diff --git a/lib/Factories/Event_Type.php b/lib/Factories/Event_Type.php index 014c283..50da9d6 100644 --- a/lib/Factories/Event_Type.php +++ b/lib/Factories/Event_Type.php @@ -13,6 +13,7 @@ use Underpin\Enums\Logger_Item_Events; use Underpin\Exceptions\Invalid_Registry_Item; use Underpin\Exceptions\Operation_Failed; +use Underpin\Exceptions\Unknown_Registry_Item; use Underpin\Interfaces; use Underpin\Interfaces\Can_Convert_To_Array; use Underpin\Interfaces\Data_Provider; @@ -173,11 +174,13 @@ protected function broadcast( Logger_Item_Events $id, ?Data_Provider $provider = /** * @param Logger_Item_Events $key - * @param Observer $observer + * @param callable $observer * * @return $this + * @throws Operation_Failed + * @throws Unknown_Registry_Item */ - public function attach( Logger_Item_Events $key, Observer $observer ): static { + public function attach( Logger_Item_Events $key, callable $observer ): static { $this->get_broadcaster()->attach( $key->name, $observer ); return $this; diff --git a/lib/Helpers/Array_Helper.php b/lib/Helpers/Array_Helper.php index e81014b..711c7b1 100644 --- a/lib/Helpers/Array_Helper.php +++ b/lib/Helpers/Array_Helper.php @@ -15,7 +15,14 @@ class Array_Helper { use With_Closure_Converter; - public static function process( $subject ): Array_Processor { + /** + * Process this array + * + * @param mixed $subject + * + * @return Array_Processor + */ + public static function process( mixed $subject ): Array_Processor { return new Array_Processor( self::wrap( $subject ) ); } @@ -312,7 +319,7 @@ public static function reverse( array $subject, bool $preserve_keys = true ): ar * * @return mixed The value */ - public static function pluck( array $item, string $key, mixed $default = null ): mixed { + public static function pluck( mixed $item, string $key, mixed $default = null ): mixed { $array = self::wrap( $item ); if ( isset( $array[ $key ] ) ) { @@ -396,7 +403,7 @@ public static function is_associative( array $items ): bool { * * @return void */ - public static function prepend( array &$array, mixed ...$items ): void { + public static function prepend( mixed &$array, mixed ...$items ): void { $array = self::wrap( $array ); array_unshift( $array, ...$items ); } @@ -409,7 +416,7 @@ public static function prepend( array &$array, mixed ...$items ): void { * * @return void */ - public static function append( array &$array, mixed ...$items ): void { + public static function append( mixed &$array, mixed ...$items ): void { $array = self::wrap( $array ); foreach ( $items as $item ) { $array[] = $item; diff --git a/lib/Registries/Logger.php b/lib/Registries/Logger.php index f155440..4a6ef94 100644 --- a/lib/Registries/Logger.php +++ b/lib/Registries/Logger.php @@ -7,21 +7,16 @@ use Underpin\Abstracts\Registries\Object_Registry; use Underpin\Enums\Logger_Events; use Underpin\Exceptions\Instance_Not_Ready; -use Underpin\Exceptions\Invalid_Callback; use Underpin\Exceptions\Invalid_Registry_Item; use Underpin\Exceptions\Operation_Failed; use Underpin\Exceptions\Unknown_Registry_Item; use Underpin\Factories\Data_Providers\Int_Provider; use Underpin\Factories\Event_Type; use Underpin\Factories\Log_Item; -use Underpin\Helpers\Array_Helper; -use Underpin\Helpers\Processors\Array_Processor; use Underpin\Interfaces as Interfaces; use Underpin\Interfaces\Data_Provider; -use Underpin\Interfaces\Observer; use Underpin\Interfaces\Singleton; use Underpin\Traits\With_Broadcaster; -use UnitEnum; /**