Add pear modules, mail and net_smtp via composer (#93)
Add pear modules, mail and net_smtp via composer, remove php 5.6 build due to phpunit 6
This commit is contained in:
@@ -2,6 +2,21 @@
|
||||
|
||||
All Notable changes to `League\Container` will be documented in this file
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Added
|
||||
- Now implementation of the PSR-11.
|
||||
|
||||
### Changed
|
||||
- Can now wrap shared objects as `RawArgument`.
|
||||
- Ability to override shared items.
|
||||
|
||||
### Fixed
|
||||
- Booleans now recognised as accepted values.
|
||||
- Various docblock fixes.
|
||||
- Unused imports removed.
|
||||
- Unreachable arguments no longer passed.
|
||||
|
||||
## 2.2.0
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -16,6 +16,7 @@ please send a patch via pull request.
|
||||
[PSR-1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md
|
||||
[PSR-2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
|
||||
[PSR-4]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md
|
||||
[PSR-11]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md
|
||||
|
||||
## Install
|
||||
|
||||
@@ -33,6 +34,7 @@ The following versions of PHP are supported by this version.
|
||||
* PHP 5.5
|
||||
* PHP 5.6
|
||||
* PHP 7.0
|
||||
* PHP 7.1
|
||||
* HHVM
|
||||
|
||||
## Documentation
|
||||
|
||||
@@ -21,14 +21,15 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"container-interop/container-interop": "^1.1"
|
||||
"php": "^5.4.0 || ^7.0",
|
||||
"container-interop/container-interop": "^1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit" : "4.*"
|
||||
},
|
||||
"provide": {
|
||||
"container-interop/container-interop-implementation": "^1.1"
|
||||
"container-interop/container-interop-implementation": "^1.2",
|
||||
"psr/container-implementation": "^1.0"
|
||||
},
|
||||
"replace": {
|
||||
"orno/di": "~2.0"
|
||||
@@ -45,7 +46,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.x-dev",
|
||||
"dev-2.x": "2.x-dev",
|
||||
"dev-1.x": "1.x-dev"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ trait ArgumentResolverTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ContainerInterface
|
||||
* @return \League\Container\ContainerInterface
|
||||
*/
|
||||
abstract public function getContainer();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace League\Container;
|
||||
|
||||
use Interop\Container\ContainerInterface as InteropContainerInterface;
|
||||
use League\Container\Argument\RawArgumentInterface;
|
||||
use League\Container\Definition\DefinitionFactory;
|
||||
use League\Container\Definition\DefinitionFactoryInterface;
|
||||
use League\Container\Definition\DefinitionInterface;
|
||||
@@ -80,24 +81,19 @@ class Container implements ContainerInterface
|
||||
*/
|
||||
public function get($alias, array $args = [])
|
||||
{
|
||||
$service = $this->getFromThisContainer($alias, $args);
|
||||
try {
|
||||
return $this->getFromThisContainer($alias, $args);
|
||||
} catch (NotFoundException $exception) {
|
||||
if ($this->providers->provides($alias)) {
|
||||
$this->providers->register($alias);
|
||||
|
||||
if ($service === false && $this->providers->provides($alias)) {
|
||||
$this->providers->register($alias);
|
||||
$service = $this->getFromThisContainer($alias, $args);
|
||||
}
|
||||
return $this->getFromThisContainer($alias, $args);
|
||||
}
|
||||
|
||||
if ($service !== false) {
|
||||
return $service;
|
||||
}
|
||||
$resolved = $this->getFromDelegate($alias, $args);
|
||||
|
||||
if ($resolved = $this->getFromDelegate($alias, $args)) {
|
||||
return $this->inflectors->inflect($resolved);
|
||||
}
|
||||
|
||||
throw new NotFoundException(
|
||||
sprintf('Alias (%s) is not being managed by the container', $alias)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,6 +131,10 @@ class Container implements ContainerInterface
|
||||
*/
|
||||
public function add($alias, $concrete = null, $share = false)
|
||||
{
|
||||
unset($this->shared[$alias]);
|
||||
unset($this->definitions[$alias]);
|
||||
unset($this->sharedDefinitions[$alias]);
|
||||
|
||||
if (is_null($concrete)) {
|
||||
$concrete = $alias;
|
||||
}
|
||||
@@ -263,7 +263,10 @@ class Container implements ContainerInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
return false;
|
||||
throw new NotFoundException(
|
||||
sprintf('Alias (%s) is not being managed by the container', $alias)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,7 +279,11 @@ class Container implements ContainerInterface
|
||||
protected function getFromThisContainer($alias, array $args = [])
|
||||
{
|
||||
if ($this->hasShared($alias, true)) {
|
||||
return $this->inflectors->inflect($this->shared[$alias]);
|
||||
$shared = $this->inflectors->inflect($this->shared[$alias]);
|
||||
if ($shared instanceof RawArgumentInterface) {
|
||||
return $shared->getValue();
|
||||
}
|
||||
return $shared;
|
||||
}
|
||||
|
||||
if (array_key_exists($alias, $this->sharedDefinitions)) {
|
||||
@@ -291,6 +298,8 @@ class Container implements ContainerInterface
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
throw new NotFoundException(
|
||||
sprintf('Alias (%s) is not being managed by the container', $alias)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class DefinitionFactory implements DefinitionFactoryInterface
|
||||
return (new ClassDefinition($alias, $concrete))->setContainer($this->getContainer());
|
||||
}
|
||||
|
||||
// if the item is not defineable we just return the value to be stored
|
||||
// if the item is not definable we just return the value to be stored
|
||||
// in the container as an arbitrary value/instance
|
||||
return $concrete;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ use League\Container\Argument\ArgumentResolverInterface;
|
||||
use League\Container\Argument\ArgumentResolverTrait;
|
||||
use League\Container\Exception\NotFoundException;
|
||||
use ReflectionClass;
|
||||
use ReflectionException;
|
||||
use ReflectionFunction;
|
||||
use ReflectionMethod;
|
||||
|
||||
@@ -62,6 +61,10 @@ class ReflectionContainer implements
|
||||
}
|
||||
|
||||
if (is_array($callable)) {
|
||||
if (is_string($callable[0])) {
|
||||
$callable[0] = $this->getContainer()->get($callable[0]);
|
||||
}
|
||||
|
||||
$reflection = new ReflectionMethod($callable[0], $callable[1]);
|
||||
|
||||
if ($reflection->isStatic()) {
|
||||
@@ -71,6 +74,12 @@ class ReflectionContainer implements
|
||||
return $reflection->invokeArgs($callable[0], $this->reflectArguments($reflection, $args));
|
||||
}
|
||||
|
||||
if (is_object($callable)) {
|
||||
$reflection = new ReflectionMethod($callable, '__invoke');
|
||||
|
||||
return $reflection->invokeArgs($callable, $this->reflectArguments($reflection, $args));
|
||||
}
|
||||
|
||||
$reflection = new ReflectionFunction($callable);
|
||||
|
||||
return $reflection->invokeArgs($this->reflectArguments($reflection, $args));
|
||||
|
||||
@@ -25,8 +25,8 @@ interface ServiceProviderAggregateInterface extends ContainerAwareInterface
|
||||
/**
|
||||
* Invokes the register method of a provider that provides a specific service.
|
||||
*
|
||||
* @param string $provider
|
||||
* @param string $service
|
||||
* @return void
|
||||
*/
|
||||
public function register($provider);
|
||||
public function register($service);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user