Skip to content
Snippets Groups Projects
Verified Commit 811581ef authored by Bartek Jaskulski's avatar Bartek Jaskulski
Browse files

refactor: enforce strong types

parent ab8de984
No related branches found
No related tags found
2 merge requests!3improve into wp-hook and some additional unfinished things,!21.x
...@@ -3,6 +3,7 @@ declare( strict_types=1 ); ...@@ -3,6 +3,7 @@ declare( strict_types=1 );
namespace WPDesk\Init\Binding\Loader; namespace WPDesk\Init\Binding\Loader;
use WPDesk\Init\Binding\Definition;
use WPDesk\Init\Binding\DefinitionFactory; use WPDesk\Init\Binding\DefinitionFactory;
use WPDesk\Init\Configuration\ReadableConfig; use WPDesk\Init\Configuration\ReadableConfig;
use WPDesk\Init\Plugin\Plugin; use WPDesk\Init\Plugin\Plugin;
...@@ -24,8 +25,7 @@ class ArrayDefinitions implements BindingDefinitions { ...@@ -24,8 +25,7 @@ class ArrayDefinitions implements BindingDefinitions {
yield from $this->normalize( $this->bindings ); yield from $this->normalize( $this->bindings );
} }
private function normalize( $bindings ) { private function normalize( iterable $bindings ): iterable {
$normalized = [];
foreach ( $bindings as $key => $value ) { foreach ( $bindings as $key => $value ) {
if ( is_array( $value ) ) { if ( is_array( $value ) ) {
foreach ( $value as $unit ) { foreach ( $value as $unit ) {
...@@ -37,7 +37,11 @@ class ArrayDefinitions implements BindingDefinitions { ...@@ -37,7 +37,11 @@ class ArrayDefinitions implements BindingDefinitions {
} }
} }
private function create( $value, $hook ) { /**
* @param mixed $value
* @param int|string $hook
*/
private function create( $value, $hook ): Definition {
return $this->factory->create( $value, is_int( $hook ) ? null : $hook ); return $this->factory->create( $value, is_int( $hook ) ? null : $hook );
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment