Skip to content

Commit a92ca8a

Browse files
committed
Remove deprecated, increase countInstantiatedServices performances
1 parent c149267 commit a92ca8a

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

ContainerIntrospectionService.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,11 @@ public function countRegisteredServices(): int
5151

5252
public function getInstantiatedServices(): array
5353
{
54-
$services = array_keys($this->getPrivatePropertyValue('services'));
55-
sort($services);
54+
$services = $this->getPrivatePropertyValue('services');
55+
ksort($services);
5656

5757
$return = [];
58-
foreach ($services as $id) {
59-
$service = $this->container->get($id);
60-
58+
foreach ($services as $id => $service) {
6159
if (is_object($service)) {
6260
$ocramiusLazy = $service instanceof VirtualProxyInterface;
6361
$className = ($ocramiusLazy) ? get_parent_class($service) : get_class($service);
@@ -101,7 +99,7 @@ public function getInstantiatedServices(): array
10199

102100
public function countInstantiatedServices(): int
103101
{
104-
return count($this->getInstantiatedServices());
102+
return count($this->getPrivatePropertyValue('services'));
105103
}
106104

107105
public function getPrivateServices(): array

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
[![version](https://img.shields.io/badge/version-1.0.1-green.svg)](https://github.com/steevanb/symfony-container-introspection/tree/1.0.1)
1+
[![version](https://img.shields.io/badge/version-1.0.2-green.svg)](https://github.com/steevanb/symfony-container-introspection/tree/1.0.2)
22
[![php](https://img.shields.io/badge/php-^7.1-blue.svg)](https://php.net)
33
[![symfony](https://img.shields.io/badge/symfony/dependency--injection-^3.4||^4.0-blue.svg)](https://symfony.com)
4-
![Lines](https://img.shields.io/badge/code%20lines-734-green.svg)
4+
![Lines](https://img.shields.io/badge/code%20lines-738-green.svg)
55
![Total Downloads](https://poser.pugx.org/steevanb/symfony-container-introspection/downloads)
66
[![Scrutinizer](https://scrutinizer-ci.com/g/steevanb/symfony-container-introspection/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/steevanb/symfony-container-introspection/)
77

@@ -24,7 +24,7 @@ Installation
2424
============
2525

2626
```bash
27-
composer require --dev steevanb/symfony-container-introspection ^1.0
27+
composer require --dev steevanb/symfony-container-introspection ^1.0.2
2828
```
2929

3030
If you use Symfony (and not just symfony/dependency-injection), you can add `ContainerIntrospectionBundle` to your Kernel:

changelog.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
### [1.0.1](../../../compare/1.0.0...1.0.1) - 2018-06-06
1+
### [1.0.2](../../compare/1.0.1...1.0.2) - 2018-08-06
2+
3+
- Do not call `ContainerInterface::get()` to retrieve informations on service, we already got it. It remove deprecated for private services in Symfony 3, and retrieve private service informations in Symfony 4.
4+
- Increase `ContainerIntrospectionService::countInstantiatedServices()` performances
5+
6+
### [1.0.1](../../compare/1.0.0...1.0.1) - 2018-06-06
27

38
- Fix when service is not an object
49

0 commit comments

Comments
 (0)