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

Commit

Permalink
Merge branch 'develop' into phpstan-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasvargiu authored Oct 19, 2018
2 parents 12091e5 + f98a895 commit 2efa798
Show file tree
Hide file tree
Showing 75 changed files with 1,538 additions and 769 deletions.
33 changes: 6 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,20 @@ cache:

env:
global:
- COMPOSER_ARGS="--no-interaction --no-plugins"
- COVERAGE_DEPS="satooshi/php-coveralls"
- COMPOSER_ARGS="--no-interaction"
- COVERAGE_DEPS="php-coveralls/php-coveralls"
- PHPSTAN_DEPS="phpstan/phpstan:^0.10.3"

matrix:
include:
- php: 5.6
env:
- DEPS=lowest
- php: 5.6
env:
- DEPS=locked
- LEGACY_DEPS="ocramius/proxy-manager phpbench/phpbench phpunit/phpunit"
- php: 5.6
env:
- DEPS=latest
- php: 7
env:
- DEPS=lowest
- php: 7
env:
- DEPS=locked
- LEGACY_DEPS="ocramius/proxy-manager phpbench/phpbench phpunit/phpunit"
- php: 7
env:
- DEPS=latest
- php: 7.1
env:
- DEPS=lowest
- php: 7.1
env:
- DEPS=locked
- BENCHMARKS=true
- CS_CHECK=true
- BENCHMARKS=true
- TEST_COVERAGE=true
- PHPSTAN_TEST=true
- LEGACY_DEPS="ocramius/proxy-manager phpbench/phpbench phpunit/phpunit"
Expand All @@ -62,10 +42,9 @@ before_install:
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi

install:
- travis_retry composer install $COMPOSER_ARGS --ignore-platform-reqs
- if [[ $LEGACY_DEPS != '' ]]; then travis_retry composer update --with-dependencies $COMPOSER_ARGS $LEGACY_DEPS ; fi
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
- travis_retry composer install $COMPOSER_ARGS
- 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 $COVERAGE_DEPS ; fi
- if [[ $PHPSTAN_TEST == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $PHPSTAN_DEPS ; fi
- stty cols 120 && composer show
Expand All @@ -77,7 +56,7 @@ script:
- if [[ $PHPSTAN_TEST == 'true' ]]; then ./vendor/bin/phpstan analyse --no-progress . ; fi

after_script:
- if [[ $TEST_COVERAGE == 'true' ]]; then composer upload-coverage ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then vendor/bin/php-coveralls -v ; fi

notifications:
email: false
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@

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

## 4.0.0 - TBD

### Added

- Nothing.

### Changed

- [#221](https://github.com/zendframework/zend-servicemanager/pull/221) provides
enormous performance improvements for each of the various mutator methods
(`setAlias()`, `setFactory()`, etc.), `has()` lookups, and initial
container configuration.

### Deprecated

- Nothing.

### Removed

- [#197](https://github.com/zendframework/zend-servicemanager/pull/197) drops
support for PHP versions prior to 7.1.

- [#193](https://github.com/zendframework/zend-servicemanager/pull/193) drops
support for HHVM.

### Fixed

- [#230](https://github.com/zendframework/zend-servicemanager/pull/230) fixes a
problem in detecting cyclic aliases, ensuring they are detected correctly.

## 3.3.2 - 2018-01-29

### Added
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/BenchAsset/AbstractFactoryFoo.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace ZendBench\ServiceManager\BenchAsset;

use Psr\Container\ContainerInterface;
use Zend\ServiceManager\Factory\AbstractFactoryInterface;
use Interop\Container\ContainerInterface;

class AbstractFactoryFoo implements AbstractFactoryInterface
{
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/BenchAsset/FactoryFoo.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace ZendBench\ServiceManager\BenchAsset;

use Psr\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;
use Interop\Container\ContainerInterface;

class FactoryFoo implements FactoryInterface
{
Expand Down
113 changes: 113 additions & 0 deletions benchmarks/HasBench.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?php
/**
* @link http://github.com/zendframework/zend-servicemanager for the canonical source repository
* @copyright Copyright (c) 2016 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace ZendBench\ServiceManager;

use PhpBench\Benchmark\Metadata\Annotations\Iterations;
use PhpBench\Benchmark\Metadata\Annotations\Revs;
use PhpBench\Benchmark\Metadata\Annotations\Warmup;
use Zend\ServiceManager\ServiceManager;

/**
* @Revs(1000)
* @Iterations(20)
* @Warmup(2)
*/
class HasBench
{
/**
* @var ServiceManager
*/
private $sm;

public function __construct()
{
$this->sm = new ServiceManager([
'factories' => [
'factory1' => BenchAsset\FactoryFoo::class,
],
'invokables' => [
'invokable1' => BenchAsset\Foo::class,
],
'services' => [
'service1' => new \stdClass(),
],
'aliases' => [
'alias1' => 'service1',
'recursiveAlias1' => 'alias1',
'recursiveAlias2' => 'recursiveAlias1',
],
'abstract_factories' => [
BenchAsset\AbstractFactoryFoo::class
]
]);
}

public function benchHasFactory1()
{
// @todo @link https://github.com/phpbench/phpbench/issues/304
$sm = clone $this->sm;

$sm->has('factory1');
}

public function benchHasInvokable1()
{
// @todo @link https://github.com/phpbench/phpbench/issues/304
$sm = clone $this->sm;

$sm->has('invokable1');
}

public function benchHasService1()
{
// @todo @link https://github.com/phpbench/phpbench/issues/304
$sm = clone $this->sm;

$sm->has('service1');
}

public function benchHasAlias1()
{
// @todo @link https://github.com/phpbench/phpbench/issues/304
$sm = clone $this->sm;

$sm->has('alias1');
}

public function benchHasRecursiveAlias1()
{
// @todo @link https://github.com/phpbench/phpbench/issues/304
$sm = clone $this->sm;

$sm->has('recursiveAlias1');
}

public function benchHasRecursiveAlias2()
{
// @todo @link https://github.com/phpbench/phpbench/issues/304
$sm = clone $this->sm;

$sm->has('recursiveAlias2');
}

public function benchHasAbstractFactory()
{
// @todo @link https://github.com/phpbench/phpbench/issues/304
$sm = clone $this->sm;

$sm->has('foo');
}

public function benchHasNot()
{
// @todo @link https://github.com/phpbench/phpbench/issues/304
$sm = clone $this->sm;

$sm->has('42');
}
}
8 changes: 8 additions & 0 deletions benchmarks/SetNewServicesBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ public function __construct()
$this->sm = new ServiceManager($config);
}

public function benchSetService()
{
// @todo @link https://github.com/phpbench/phpbench/issues/304
$sm = clone $this->sm;

$sm->setService('service2', new \stdClass());
}

public function benchSetFactory()
{
// @todo @link https://github.com/phpbench/phpbench/issues/304
Expand Down
23 changes: 12 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,24 @@
"forum": "https://discourse.zendframework.com/c/questions/components"
},
"require": {
"php": "^5.6 || ^7.0",
"container-interop/container-interop": "^1.2",
"php": "^7.1",
"psr/container": "^1.0",
"zendframework/zend-stdlib": "^3.1"
},
"require-dev": {
"mikey179/vfsStream": "^1.6.5",
"ocramius/proxy-manager": "^1.0 || ^2.0",
"mikey179/vfsStream": "^1.6.4",
"ocramius/proxy-manager": "^2.1.1",
"phpbench/phpbench": "^0.13.0",
"phpunit/phpunit": "^5.7.25 || ^6.4.4",
"zendframework/zend-coding-standard": "~1.0.0"
"phpunit/phpunit": "^6.4.4",
"zendframework/zend-coding-standard": "~1.0.0",
"zendframework/zend-container-config-test": "^0.2.1"
},
"provide": {
"container-interop/container-interop-implementation": "^1.2",
"psr/container-implementation": "^1.0"
},
"suggest": {
"ocramius/proxy-manager": "ProxyManager 1.* to handle lazy initialization of services",
"zendframework/zend-stdlib": "zend-stdlib ^2.5 if you wish to use the MergeReplaceKey or MergeRemoveKey features in Config instances"
"ocramius/proxy-manager": "ProxyManager ^2.1.1 to handle lazy initialization of services",
"zendframework/zend-stdlib": "zend-stdlib ^2.7.7 | ^3.1 if you wish to use the MergeReplaceKey or MergeRemoveKey features in Config instances"
},
"autoload": {
"psr-4": {
Expand All @@ -55,6 +54,9 @@
"config": {
"sort-packages": true
},
"conflict": {
"container-interop/container-interop": "<1.2.0"
},
"extra": {
"branch-alias": {
"dev-master": "3.3-dev",
Expand All @@ -73,7 +75,6 @@
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
"upload-coverage": "coveralls -v"
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
}
}
Loading

0 comments on commit 2efa798

Please sign in to comment.