Skip to content

Commit

Permalink
Sets "mixed" var on array helper vars (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexstandiford committed Feb 2, 2023
1 parent 053e926 commit 024f812
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
7 changes: 5 additions & 2 deletions lib/Factories/Event_Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
15 changes: 11 additions & 4 deletions lib/Helpers/Array_Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
}

Expand Down Expand Up @@ -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 ] ) ) {
Expand Down Expand Up @@ -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 );
}
Expand All @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions lib/Registries/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;


/**
Expand Down

0 comments on commit 024f812

Please sign in to comment.