Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #6 from tux-rampage/zf3
Browse files Browse the repository at this point in the history
Refactoring of the Dependency Injection component (v3)

Conflicts:
	.travis.yml
	composer.json
	composer.lock
	phpcs.xml
	src/Config.php
	src/Definition/ArrayDefinition.php
	src/Definition/BuilderDefinition.php
	src/Definition/ClassDefinition.php
	src/Definition/CompilerDefinition.php
	src/Definition/RuntimeDefinition.php
	src/DefinitionList.php
	src/Di.php
	src/Exception/UnexpectedValueException.php
	src/InstanceManager.php
	src/ServiceLocator.php
	src/ServiceLocator/DependencyInjectorProxy.php
	src/ServiceLocator/Generator.php
	test/ConfigTest.php
	test/Definition/CompilerDefinitionTest.php
	test/Definition/RuntimeDefinitionTest.php
	test/DiCompatibilityTest.php
	test/DiTest.php
	test/InstanceManagerTest.php
	test/TestAsset/AggregateClasses/AggregateItems.php
	test/TestAsset/CallbackClasses/B.php
	test/TestAsset/ConstructorInjection/C.php
	test/TestAsset/ConstructorInjection/OptionalParameters.php
	test/TestAsset/ContainerExtension.php
	test/TestAsset/DependencyTree/Level2.php
	test/TestAsset/InjectionClasses/A.php
	test/TestAsset/IterableDependency.php
	test/TestAsset/StaticFactory.php
	test/_files/definition-array.php
	test/_files/sample.php
  • Loading branch information
weierophinney committed Nov 14, 2017
2 parents 417cee1 + caf46ff commit e8b7c14
Show file tree
Hide file tree
Showing 179 changed files with 6,059 additions and 9,751 deletions.
35 changes: 2 additions & 33 deletions .travis.yml
Expand Up @@ -15,36 +15,17 @@ env:
global:
- COMPOSER_ARGS="--no-interaction"
- COVERAGE_DEPS="satooshi/php-coveralls"
- LEGACY_DEPS="phpunit/phpunit"

matrix:
include:
- php: 5.6
env:
- DEPS=lowest
- php: 5.6
env:
- DEPS=locked
- TEST_COVERAGE=true
- php: 5.6
env:
- DEPS=latest
- php: 7
env:
- DEPS=lowest
- php: 7
env:
- DEPS=locked
- CHECK_CS=true
- php: 7
env:
- DEPS=latest
- php: 7.1
env:
- DEPS=lowest
- php: 7.1
env:
- DEPS=locked
- TEST_COVERAGE=true
- CHECK_CS=true
- php: 7.1
env:
- DEPS=latest
Expand All @@ -57,17 +38,6 @@ matrix:
- php: 7.2
env:
- DEPS=latest
- php: hhvm
env:
- DEPS=lowest
- php: hhvm
env:
- DEPS=locked
- php: hhvm
env:
- DEPS=latest
allow_failures:
- php: hhvm

notifications:
email: false
Expand All @@ -77,7 +47,6 @@ before_install:

install:
- travis_retry composer install $COMPOSER_ARGS --ignore-platform-reqs
- if [[ $TRAVIS_PHP_VERSION =~ ^5.6 ]]; then travis_retry composer update $COMPOSER_ARGS --with-dependencies $LEGACY_DEPS ; fi
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS satooshi/php-coveralls:^1.0 ; fi
Expand Down
48 changes: 48 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,54 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 3.0.0 - WIP

### Added

- `Zend\Di\DefaultContainer` that implements `Psr\Container\ContainerInterface`
* Can act as a standalone IoC container
* Provides `build()` to be signature compatible with `Zend\ServiceManager\ServiceManager`
- Renamed `Zend\Di\DependencyInjectionInterface` to `Zend\Di\InjectorInterface`. It defines
the injector to create new instances based on a class or alias name.
* `newInstance()` Changed to `create()`
* `has()` Changed to `canCreate()`
* Removed `get()`
- `Zend\Di\Injector` as implementation of `Zend\Di\InjectorInterface`
* Is designed to incorporate with `Psr\Container\ContainerInterface`
* Utilizes `Zend\Di\Resolver\DependencyResolverInterface`
- Moved strategies to resolve method parameters to `Zend\Di\Resolver`
- PHP 7.1 Typesafety
- Classes to wrap value and type injections
- Support for zend-component-installer
- `Zend\Di\ConfigInterface` to implement custom configurations
- Code generator for generating a pre-resolved injector and factories

### Deprecated

- Nothing

### Removed

- Support for PHP < 7.1
- `Zend\Di\Defintion\CompilerDefinition` in favour of `Zend\Di\CodeGenerator`.
- `Zend\Di\InstanceManager`, `Zend\Di\ServiceLocator`, `Zend\Di\ServiceLocatorInterface`
and `Zend\Di\LocatorInterface` in favour of `Psr\Container\ContainerInterface`
- `Zend\Di\Di` is removed in favour of `Zend\Di\DefaultContainer`
- `Zend\Di\DefintionList`
- `Zend\Di\Definition\BuilderDefinition`
- `Zend\Di\Definition\ArrayDefinition`
- Parameters passed to `newInstance()` will only be used for constructing the requested class and no longer be forwarded to nested instanciations.
- `get()` does no longer support a `$parameters` array, `newInstance()` still does
- Removed setter/method injections
- Generators in `Zend\Di\ServiceLocator` in favor of `Zend\Di\CodeGenerator`

### Fixed

- [#6](https://github.com/zendframework/zend-di/pull/6) Full ZF3 Compatibility
- [#20](https://github.com/zendframework/zend-di/pull/20) Update composer deps and travis config
- [#17](https://github.com/zendframework/zend-di/pull/17) Fix mkdocs config (src_dir is deprecated)
- [#18](https://github.com/zendframework/zend-di/issues/18) Di Runtime Compiler Definition

## 2.7.0 - TBD

### Added
Expand Down
26 changes: 25 additions & 1 deletion README.md
Expand Up @@ -3,10 +3,34 @@
[![Build Status](https://secure.travis-ci.org/zendframework/zend-di.svg?branch=master)](https://secure.travis-ci.org/zendframework/zend-di)
[![Coverage Status](https://coveralls.io/repos/zendframework/zend-di/badge.svg?branch=master)](https://coveralls.io/r/zendframework/zend-di?branch=master)

`Zend\Di` is an example of an Inversion of Control (IoC) container. IoC containers
`Zend\Di` provides auto wiring to implement Inversion of Control (IoC) containers. IoC containers
are widely used to create object instances that have all dependencies resolved
and injected. Dependency Injection containers are one form of IoC – but not the
only form.

`Zend\Di` is designed to be simple, fast and reusable. It provides the following features:

* Constructor injection
* Autowiring:
- Recursively through all dependencies
- With configured type preferences
- with configured injections
- With injections passed in the create() call
* Code generators to create factories usable by other IoC containers like Zend\ServiceManager

It does __not__ provide:

* Setter, interface, property or any other injection method than constructor injection
* Support for factories
* Declaring shared/unshared instances
- the injector always creates new instances
- the default container always shares instances
* Support for variadic arguments in __construct

If you need these features combine it with another IoC container like [`Zend\ServiceManager`](https://docs.zendframework.com/zend-servicemanager/).


- File issues at https://github.com/zendframework/zend-di/issues
- Documentation is at https://zendframework.github.io/zend-di/


71 changes: 45 additions & 26 deletions composer.json
@@ -1,38 +1,57 @@
{
"name": "zendframework/zend-di",
"description": " ",
"license": "BSD-3-Clause",
"keywords": [
"zf2",
"di"
"name" : "zendframework/zend-di",
"description" : "Automated dependency injection and instance manager.",
"license" : "BSD-3-Clause",
"keywords" : [
"zf",
"zendframework",
"di",
"psr-11"
],
"homepage": "https://github.com/zendframework/zend-di",
"autoload": {
"psr-4": {
"Zend\\Di\\": "src/"
"support": {
"docs": "https://docs.zendframework.com/zend-di/",
"issues": "https://github.com/zendframework/zend-di/issues",
"source": "https://github.com/zendframework/zend-di",
"rss": "https://github.com/{org}/zend-di/releases.atom",
"slack": "https://zendframework-slack.herokuapp.com",
"forum": "https://discourse.zendframework.com/c/questions/components"
},
"extra": {
"branch-alias": {
"dev-master": "2.6-dev",
"dev-develop": "3.0-dev"
},
"zf" : {
"component" : "Zend\\Di",
"config-provider" : "Zend\\Di\\ConfigProvider"
}
},
"require": {
"php": "^5.6 || ^7.0",
"container-interop/container-interop": "^1.1",
"zendframework/zend-code": "^2.6 || ^3.0",
"zendframework/zend-stdlib": "^2.7 || ^3.0"
"require" : {
"php" : "^7.1",
"psr/container" : "^1.0",
"zendframework/zend-stdlib" : "^2.7 || ^3.0"
},
"require-dev": {
"phpunit/PHPUnit": "^4.8",
"require-dev" : {
"phpunit/phpunit" : "^6.3",
"zendframework/zend-code" : "^2.6 || ^3.0",
"zendframework/zend-servicemanager" : "^3.0",
"zendframework/zend-coding-standard": "~1.0.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-master": "2.6-dev",
"dev-develop": "2.7-dev"
"conflict": {
"zendframework/zend-servicemanager-di": "*"
},
"suggest" : {
"zendframework/zend-servicemanager" : "An IoC container without auto wiring capabilities",
"zendframework/zend-code" : "Required if you want to generate code"
},
"autoload" : {
"psr-4" : {
"Zend\\Di\\" : "src/"
}
},
"autoload-dev": {
"psr-4": {
"ZendTest\\Di\\": "test/"
"autoload-dev" : {
"psr-4" : {
"ZendTest\\Di\\" : "test/"
}
},
"scripts": {
Expand Down

0 comments on commit e8b7c14

Please sign in to comment.