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

refactor: enforce strong types


Signed-off-by: default avatarBart Jaskulski <bjaskulski@protonmail.com>
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 );
namespace WPDesk\Init\Binding\Loader;
use WPDesk\Init\Binding\Definition;
use WPDesk\Init\Binding\DefinitionFactory;
use WPDesk\Init\Configuration\ReadableConfig;
use WPDesk\Init\Plugin\Plugin;
......@@ -24,8 +25,7 @@ class ArrayDefinitions implements BindingDefinitions {
yield from $this->normalize( $this->bindings );
}
private function normalize( $bindings ) {
$normalized = [];
private function normalize( iterable $bindings ): iterable {
foreach ( $bindings as $key => $value ) {
if ( is_array( $value ) ) {
foreach ( $value as $unit ) {
......@@ -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 );
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment