Skip to content

Commit

Permalink
Merge 412b826 into ecdb841
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed Sep 19, 2015
2 parents ecdb841 + 412b826 commit 3067aca
Show file tree
Hide file tree
Showing 198 changed files with 263 additions and 1,570 deletions.
14 changes: 4 additions & 10 deletions src/DI/Annotation/Inject.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
<?php
/**
* PHP-DI
*
* @link http://php-di.org/
* @copyright Matthieu Napoli (http://mnapoli.fr/)
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/

namespace DI\Annotation;

use DI\Definition\Exception\AnnotationException;

/**
* "Inject" annotation
* "Inject" annotation.
*
* Marks a property or method as an injection point
*
Expand All @@ -24,13 +17,13 @@
final class Inject
{
/**
* Entry name
* Entry name.
* @var string
*/
private $name;

/**
* Parameters, indexed by the parameter number (index) or name
* Parameters, indexed by the parameter number (index) or name.
*
* Used if the annotation is set on a method
* @var array
Expand All @@ -47,6 +40,7 @@ public function __construct(array $values)
// @Inject(name="foo")
if (isset($values['name']) && is_string($values['name'])) {
$this->name = $values['name'];

return;
}

Expand Down
17 changes: 5 additions & 12 deletions src/DI/Annotation/Injectable.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
<?php
/**
* PHP-DI
*
* @link http://php-di.org/
* @copyright Matthieu Napoli (http://mnapoli.fr/)
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/

namespace DI\Annotation;

use DI\Scope;
use UnexpectedValueException;

/**
* "Injectable" annotation
* "Injectable" annotation.
*
* Marks a class as injectable
*
Expand All @@ -26,14 +19,14 @@
final class Injectable
{
/**
* The scope of an class: prototype, singleton
* The scope of an class: prototype, singleton.
* @var string|null
*/
private $scope;

/**
* Should the object be lazy-loaded
* @var boolean|null
* Should the object be lazy-loaded.
* @var bool|null
*/
private $lazy;

Expand Down Expand Up @@ -65,7 +58,7 @@ public function getScope()
}

/**
* @return boolean|null
* @return bool|null
*/
public function isLazy()
{
Expand Down
11 changes: 2 additions & 9 deletions src/DI/Cache/ArrayCache.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<?php
/**
* PHP-DI
*
* @link http://php-di.org/
* @copyright Matthieu Napoli (http://mnapoli.fr/)
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/

namespace DI\Cache;

Expand All @@ -31,7 +24,7 @@
class ArrayCache implements Cache, FlushableCache, ClearableCache
{
/**
* @var array $data
* @var array
*/
private $data = [];

Expand Down Expand Up @@ -67,7 +60,7 @@ public function getStats()

public function flushAll()
{
$this->data = array();
$this->data = [];

return true;
}
Expand Down
15 changes: 4 additions & 11 deletions src/DI/Container.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
<?php
/**
* PHP-DI
*
* @link http://php-di.org/
* @copyright Matthieu Napoli (http://mnapoli.fr/)
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/

namespace DI;

use DI\Definition\ObjectDefinition;
use DI\Definition\Definition;
use DI\Definition\FactoryDefinition;
use DI\Definition\Helper\DefinitionHelper;
use DI\Definition\InstanceDefinition;
use DI\Definition\ObjectDefinition;
use DI\Definition\Resolver\DefinitionResolver;
use DI\Definition\Resolver\ResolverDispatcher;
use DI\Definition\Source\CachedDefinitionSource;
use DI\Definition\Source\DefinitionSource;
use DI\Definition\Source\MutableDefinitionSource;
use DI\Definition\Helper\DefinitionHelper;
use DI\Definition\Resolver\DefinitionResolver;
use DI\Invoker\DefinitionParameterResolver;
use DI\Proxy\ProxyFactory;
use Exception;
Expand Down Expand Up @@ -207,7 +200,7 @@ public function has($name)
}

/**
* Inject all dependencies on an existing instance
* Inject all dependencies on an existing instance.
*
* @param object $instance Object to perform injection upon
* @throws InvalidArgumentException
Expand Down
41 changes: 19 additions & 22 deletions src/DI/ContainerBuilder.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
<?php
/**
* PHP-DI
*
* @link http://php-di.org/
* @copyright Matthieu Napoli (http://mnapoli.fr/)
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/

namespace DI;

use DI\Definition\Source\AnnotationReader;
use DI\Definition\Source\DefinitionArray;
use DI\Definition\Source\Autowiring;
use DI\Definition\Source\CachedDefinitionSource;
use DI\Definition\Source\DefinitionSource;
use DI\Definition\Source\DefinitionArray;
use DI\Definition\Source\DefinitionFile;
use DI\Definition\Source\Autowiring;
use DI\Definition\Source\DefinitionSource;
use DI\Definition\Source\SourceChain;
use DI\Proxy\ProxyFactory;
use Doctrine\Common\Cache\Cache;
Expand Down Expand Up @@ -43,17 +36,17 @@ class ContainerBuilder
private $containerClass;

/**
* @var boolean
* @var bool
*/
private $useAutowiring = true;

/**
* @var boolean
* @var bool
*/
private $useAnnotations = false;

/**
* @var boolean
* @var bool
*/
private $ignorePhpDocErrors = false;

Expand All @@ -64,7 +57,7 @@ class ContainerBuilder

/**
* If true, write the proxies to disk to improve performances.
* @var boolean
* @var bool
*/
private $writeProxiesToFile = false;

Expand Down Expand Up @@ -93,6 +86,7 @@ class ContainerBuilder
public static function buildDevContainer()
{
$builder = new self();

return $builder->build();
}

Expand Down Expand Up @@ -141,12 +135,13 @@ public function build()
*
* Enabled by default.
*
* @param boolean $bool
* @param bool $bool
* @return ContainerBuilder
*/
public function useAutowiring($bool)
{
$this->useAutowiring = $bool;

return $this;
}

Expand All @@ -155,24 +150,26 @@ public function useAutowiring($bool)
*
* Disabled by default.
*
* @param boolean $bool
* @param bool $bool
* @return ContainerBuilder
*/
public function useAnnotations($bool)
{
$this->useAnnotations = $bool;

return $this;
}

/**
* Enable or disable ignoring phpdoc errors (non-existent classes in `@param` or `@var`)
* Enable or disable ignoring phpdoc errors (non-existent classes in `@param` or `@var`).
*
* @param boolean $bool
* @param bool $bool
* @return ContainerBuilder
*/
public function ignorePhpDocErrors($bool)
{
$this->ignorePhpDocErrors = $bool;

return $this;
}

Expand All @@ -185,20 +182,20 @@ public function ignorePhpDocErrors($bool)
public function setDefinitionCache(Cache $cache)
{
$this->cache = $cache;

return $this;
}

/**
* Configure the proxy generation
* Configure the proxy generation.
*
* For dev environment, use writeProxiesToFile(false) (default configuration)
* For production environment, use writeProxiesToFile(true, 'tmp/proxies')
*
* @param boolean $writeToFile If true, write the proxies to disk to improve performances
* @param bool $writeToFile If true, write the proxies to disk to improve performances
* @param string|null $proxyDirectory Directory where to write the proxies
* @return ContainerBuilder
*
* @throws InvalidArgumentException when writeToFile is set to true and the proxy directory is null
* @return ContainerBuilder
*/
public function writeProxiesToFile($writeToFile, $proxyDirectory = null)
{
Expand Down
7 changes: 0 additions & 7 deletions src/DI/Debug.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<?php
/**
* PHP-DI
*
* @link http://php-di.org/
* @copyright Matthieu Napoli (http://mnapoli.fr/)
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/

namespace DI;

Expand Down
11 changes: 2 additions & 9 deletions src/DI/Definition/AliasDefinition.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<?php
/**
* PHP-DI
*
* @link http://php-di.org/
* @copyright Matthieu Napoli (http://mnapoli.fr/)
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/

namespace DI\Definition;

Expand All @@ -19,13 +12,13 @@
class AliasDefinition implements CacheableDefinition
{
/**
* Entry name
* Entry name.
* @var string
*/
private $name;

/**
* Name of the target entry
* Name of the target entry.
* @var string
*/
private $targetEntryName;
Expand Down
9 changes: 1 addition & 8 deletions src/DI/Definition/ArrayDefinition.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<?php
/**
* PHP-DI
*
* @link http://php-di.org/
* @copyright Matthieu Napoli (http://mnapoli.fr/)
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/

namespace DI\Definition;

Expand All @@ -20,7 +13,7 @@
class ArrayDefinition implements Definition
{
/**
* Entry name
* Entry name.
* @var string
*/
private $name;
Expand Down
7 changes: 0 additions & 7 deletions src/DI/Definition/ArrayDefinitionExtension.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<?php
/**
* PHP-DI
*
* @link http://php-di.org/
* @copyright Matthieu Napoli (http://mnapoli.fr/)
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/

namespace DI\Definition;

Expand Down
9 changes: 1 addition & 8 deletions src/DI/Definition/CacheableDefinition.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
<?php
/**
* PHP-DI
*
* @link http://php-di.org/
* @copyright Matthieu Napoli (http://mnapoli.fr/)
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/

namespace DI\Definition;

/**
* Cacheable definition
* Cacheable definition.
*
* @author Matthieu Napoli <matthieu@mnapoli.fr>
*/
Expand Down
7 changes: 0 additions & 7 deletions src/DI/Definition/DecoratorDefinition.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<?php
/**
* PHP-DI
*
* @link http://php-di.org/
* @copyright Matthieu Napoli (http://mnapoli.fr/)
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/

namespace DI\Definition;

Expand Down
Loading

0 comments on commit 3067aca

Please sign in to comment.