Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

Commit

Permalink
update base-container dependency to a tagged release instead of dev-m…
Browse files Browse the repository at this point in the history
…aster
  • Loading branch information
calvinalkan committed Apr 21, 2021
1 parent cc690e9 commit be4c346
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 47 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"require": {
"php": "^7.3",
"illuminate/support": "8.35.1",
"calvinalkan/base-container": "0.1.1"
"calvinalkan/base-container": "0.1.3"
},
"require-dev": {
"phpunit/phpunit": "^9.0",
Expand Down
38 changes: 19 additions & 19 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/BetterWpHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
use BetterWpHooks\Contracts\Dispatcher;
use BetterWpHooks\Exceptions\ConfigurationException;
use BetterWpHooks\Mappers\WordpressEventMapper;
use Contracts\SniccoContainerAdapter;
use Contracts\ContainerAdapter ;
use Illuminate\Support\Arr;

class BetterWpHooks {


/**
* @var SniccoContainerAdapter
* @var ContainerAdapter
*/
private $container_adapter;

Expand All @@ -30,7 +30,7 @@ class BetterWpHooks {
private $listen = [];
private $mapped_events = [];

public function __construct( SniccoContainerAdapter $container_adapter, Dispatcher $dispatcher,
public function __construct( ContainerAdapter $container_adapter, Dispatcher $dispatcher,
EventMapper $event_mapper ) {

$this->container_adapter = $container_adapter;
Expand Down Expand Up @@ -64,7 +64,7 @@ public function boot() {

}

public function container(): SniccoContainerAdapter {
public function container(): ContainerAdapter {

return $this->container_adapter;

Expand Down
9 changes: 4 additions & 5 deletions src/ListenerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
use BetterWpHooks\Exceptions\InvalidListenerException;
use BetterWpHooks\Exceptions\ExecutionErrorHandler;
use BetterWpHooks\Listeners\ClassListener;

use BetterWpHooks\Listeners\ClosureListener;
use BetterWpHooks\Listeners\InstanceListener;
use BetterWpHooks\Traits\ReflectsCallable;
use Closure;
use Contracts\SniccoContainerAdapter;
use Contracts\ContainerAdapter;
use Illuminate\Support\Arr;
use Illuminate\Support\Reflector;
use Illuminate\Support\Str;
Expand All @@ -34,7 +35,7 @@ class ListenerFactory {
private $error_handler;


public function __construct( SniccoContainerAdapter $container = NULL, ErrorHandler $error_handler = NULL ) {
public function __construct( ContainerAdapter $container = NULL, ErrorHandler $error_handler = NULL ) {

$this->container = $container ?? new BaseContainerAdapter();

Expand Down Expand Up @@ -120,9 +121,7 @@ private function wrap( AbstractListener $listener ): Closure {
$this->error_handler->handle($e);

}





};

Expand Down
6 changes: 3 additions & 3 deletions src/Listeners/ClassListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use BetterWpHooks\Contracts\AbstractListener;
use BetterWpHooks\Traits\ReflectsCallable;
use Contracts\SniccoContainerAdapter;
use Contracts\ContainerAdapter;

use function BetterWpHooks\Functions\normalizeClassMethod;

Expand All @@ -18,11 +18,11 @@ class ClassListener extends AbstractListener {
private $class_callable;

/**
* @var \Contracts\SniccoContainerAdapter
* @var \Contracts\ContainerAdapter
*/
private $container;

public function __construct( array $listener, SniccoContainerAdapter $container ) {
public function __construct( array $listener, ContainerAdapter $container ) {

$this->class_callable = array_values( $listener );
$this->container = $container;
Expand Down
6 changes: 3 additions & 3 deletions src/Listeners/ClosureListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use BetterWpHooks\Contracts\AbstractListener;
use BetterWpHooks\Traits\ReflectsCallable;
use Contracts\SniccoContainerAdapter;
use Contracts\ContainerAdapter;

class ClosureListener extends AbstractListener {

Expand All @@ -16,11 +16,11 @@ class ClosureListener extends AbstractListener {
private $closure;

/**
* @var \Contracts\SniccoContainerAdapter
* @var \Contracts\ContainerAdapter
*/
private $container;

public function __construct( \Closure $closure, SniccoContainerAdapter $container) {
public function __construct( \Closure $closure, ContainerAdapter $container) {

$this->closure = $closure;
$this->container = $container;
Expand Down
6 changes: 3 additions & 3 deletions src/Listeners/InstanceListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use BetterWpHooks\Contracts\AbstractListener;
use BetterWpHooks\Traits\ReflectsCallable;
use Contracts\SniccoContainerAdapter;
use Contracts\ContainerAdapter;

class InstanceListener extends AbstractListener {

Expand All @@ -16,11 +16,11 @@ class InstanceListener extends AbstractListener {
private $instance;

/**
* @var \Contracts\SniccoContainerAdapter
* @var \Contracts\ContainerAdapter
*/
private $container;

public function __construct( array $instance, SniccoContainerAdapter $container ) {
public function __construct( array $instance, ContainerAdapter $container ) {

$this->instance = array_values( $instance );
$this->container = $container;
Expand Down
6 changes: 3 additions & 3 deletions src/Traits/BetterWpHooksFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use BetterWpHooks\Mappers\WordpressEventMapper;
use BetterWpHooks\Testing\FakeDispatcher;
use BetterWpHooks\WordpressApi;
use Contracts\SniccoContainerAdapter;
use Contracts\ContainerAdapter;
use SniccoAdapter\BaseContainerAdapter;

use function BetterWpHooks\Functions\hasTrait;
Expand All @@ -30,7 +30,7 @@ trait BetterWpHooksFacade
*/
public static $instance = NULL;

public static function make ( SniccoContainerAdapter $container_adapter = NULL ) : ?BetterWpHooks
public static function make ( ContainerAdapter $container_adapter = NULL ) : ?BetterWpHooks
{


Expand Down Expand Up @@ -225,7 +225,7 @@ public static function fake ( $eventsToFake = [] ) : FakeDispatcher
}


private static function createInstance ( SniccoContainerAdapter $container_adapter = NULL ) : BetterWpHooks
private static function createInstance ( ContainerAdapter $container_adapter = NULL ) : BetterWpHooks
{

$container_adapter = $container_adapter ?? new BaseContainerAdapter();
Expand Down
3 changes: 1 addition & 2 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ function splitAtSign( string $string ) {
function isClosure( $object ): bool {

return $object instanceof Closure;



}


Expand Down
19 changes: 15 additions & 4 deletions tests/TestStubs/DifferentContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

namespace Tests\TestStubs;

use Contracts\SniccoContainerAdapter;
use Closure;
use Contracts\ContainerAdapter;

class DifferentContainer implements SniccoContainerAdapter {
class DifferentContainer implements ContainerAdapter {

/**
* @param mixed $offset
Expand Down Expand Up @@ -78,5 +79,15 @@ public function instance( $abstract, $instance ) {
public function call( $callable, array $parameters = [] ) {

}

}

public function bind($abstract, $concrete)
{
// TODO: Implement bind() method.
}

public function singleton($abstract, $concrete)
{
// TODO: Implement singleton() method.
}

}

0 comments on commit be4c346

Please sign in to comment.