Skip to content

Commit 0217225

Browse files
Steevan BARBOYONsteevanb
Steevan BARBOYON
authored andcommitted
Compatibility with Symfony 7, PHP 8.2, PHP 8.3 and update CI tools
1 parent 02ea84c commit 0217225

File tree

14 files changed

+77
-38
lines changed

14 files changed

+77
-38
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
runs-on: ubuntu-latest
3131
strategy:
3232
matrix:
33-
php-version: [--php=7.4, --php=8.0, --php=8.1]
33+
php-version: [--php=7.4, --php=8.0, --php=8.1, --php=8.2, --php=8.3]
3434
steps:
3535
- uses: actions/checkout@v2
3636
-

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ symfony-container-introspection
88

99
It helps you to know which services are instanciated, removed, public and list container parameters.
1010

11-
You have access to Container cache statistics: files count, count code lines and cache size.
11+
You have access to Container cache statistics: files count, code lines count and cache size.
1212

1313
With Symfony, a new profiler tab will appear:
1414

bin/ci/phpcs

+1-10
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,4 @@ if [ ! -d "${ROOT_DIR}"/var/ci/phpcs ]; then
1212
mkdir -p "${ROOT_DIR}"/var/ci/phpcs
1313
fi
1414

15-
phpcs \
16-
-p \
17-
--warning-severity=0 \
18-
--ignore=/vendor/,/var/,src/Doctrine/ORM/EntityManager.php \
19-
--bootstrap=config/ci/phpcs.php \
20-
--standard="${COMPOSER_HOME}"/vendor/steevanb/php-code-sniffs/src/Steevanb/ruleset.xml \
21-
--report=steevanb\\PhpCodeSniffs\\Reports\\Steevanb \
22-
--cache="${ROOT_DIR}"/var/ci/phpcs/cache \
23-
. \
24-
"${@}"
15+
phpcs -p --standard="${ROOT_DIR}"/config/ci/phpcs.xml "${@}"

bin/ci/phpstan.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
function createPhpstanProcesses(string $phpVersion = null): ProcessArray
1717
{
18-
$phpVersions = is_string($phpVersion) ? [$phpVersion] : ['7.4', '8.0', '8.1'];
18+
$phpVersions = is_string($phpVersion) ? [$phpVersion] : ['7.4', '8.0', '8.1', '8.2', '8.3'];
1919

2020
$return = new ProcessArray();
2121
foreach ($phpVersions as $loopPhpVersion) {

changelog.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
### master
22

3+
- Add `Symfony ^7.0` compatibility
4+
- Add `PHP 8.2` and `8.3` compatibility
5+
- Update CI tools
6+
37
### [3.0.1](../../compare/3.0.0...3.0.1) - 2022-11-22
48

59
- Fix `You must call introspect() before getContainerCachePath()`
@@ -10,7 +14,7 @@
1014
- [BC Break] Move files from root directory to `src`
1115
- Add `bin`, `config` and `docker` directories
1216
- Add binaries to start the project, build Docker images, run CI tools etc
13-
- Add PHP 8.0 and 8.1 compatibility
17+
- Add `PHP ^8.0` compatibility
1418

1519
### [2.0.0](../../compare/1.1.1...2.0.0) - 2020-10-26
1620

composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"name": "steevanb/symfony-container-introspection",
3-
"type": "lib",
43
"description": "Get all Symfony Container informations you need: registered services, instanciated services etc",
54
"license": "MIT",
5+
"type": "lib",
66
"require": {
77
"php": "^7.1 || ^8.0",
8-
"symfony/dependency-injection": "^5.0 || ^6.0"
8+
"symfony/dependency-injection": "^5.0 || ^6.0 || ^7.0"
99
},
1010
"require-dev": {
1111
"ocramius/proxy-manager": "^2.0",
12-
"symfony/config": "^5.0 || ^6.0",
13-
"symfony/http-kernel": "^5.0 || ^6.0"
12+
"symfony/config": "~5.0.0",
13+
"symfony/http-kernel": "~5.0.0"
1414
},
1515
"autoload": {
1616
"psr-4": {

config/ci/phpcs.xml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="phpcs">
3+
<rule ref="/composer/vendor/steevanb/php-code-sniffs/src/Steevanb/ruleset.xml"/>
4+
<arg name="warning-severity" value="0"/>
5+
<exclude-pattern>/var</exclude-pattern>
6+
<exclude-pattern>/vendor</exclude-pattern>
7+
<exclude-pattern>src/Doctrine/ORM/EntityManager.php</exclude-pattern>
8+
<arg name="report" value="steevanb\PhpCodeSniffs\Reports\Steevanb"/>
9+
<arg name="cache" value="../../var/ci/phpcs/cache"/>
10+
<file>../..</file>
11+
<rule ref="Steevanb.Uses.GroupUses">
12+
<properties>
13+
<property name="thirdLevelPrefixes" type="array">
14+
<element value="Steevanb\ContainerIntrospection"/>
15+
<element value="Symfony\Component"/>
16+
</property>
17+
</properties>
18+
</rule>
19+
<rule ref="Steevanb.ReturnType.Php81StaticInsteadOfSelf">
20+
<exclude name="Steevanb.ReturnType.Php81StaticInsteadOfSelf.ReturnTypeStatic"/>
21+
</rule>
22+
</ruleset>

config/ci/phpstan.neon

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ parameters:
44
- ../../src
55
includes:
66
- /composer/vendor/phpstan/phpstan-deprecation-rules/rules.neon
7+
- /composer/vendor/phpstan/phpstan-phpunit/extension.neon
78
- /composer/vendor/phpstan/phpstan-phpunit/rules.neon
89
- /composer/vendor/phpstan/phpstan-strict-rules/rules.neon
910
- /composer/vendor/spaze/phpstan-disallowed-calls/extension.neon

config/ci/phpstan.php-8.2.neon

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
includes:
2+
- phpstan.neon
3+
parameters:
4+
tmpDir: ../../var/ci/phpstan/php-8-2

config/ci/phpstan.php-8.3.neon

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
includes:
2+
- phpstan.neon
3+
parameters:
4+
tmpDir: ../../var/ci/phpstan/php-8-3

docker/ci/Dockerfile

+21-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM ubuntu:22.04
1+
FROM ubuntu:24.04
22

3-
COPY --from=composer:2.4.4 /usr/bin/composer /usr/local/bin/composer
3+
COPY --from=composer:2.7.8 /usr/bin/composer /usr/local/bin/composer
44

55
ENV COMPOSER_HOME=/composer
66
ENV COMPOSER_CACHE_DIR=/app/var/composer
@@ -28,6 +28,12 @@ RUN \
2828
php8.1-cli \
2929
php8.1-simplexml \
3030
php8.1-mbstring \
31+
php8.2-cli \
32+
php8.2-simplexml \
33+
php8.2-mbstring \
34+
php8.3-cli \
35+
php8.3-simplexml \
36+
php8.3-mbstring \
3137
# For Composer
3238
curl \
3339
zip \
@@ -37,23 +43,27 @@ RUN \
3743
php8.0-zip \
3844
php8.1-curl \
3945
php8.1-zip \
46+
php8.2-curl \
47+
php8.2-zip \
48+
php8.3-curl \
49+
php8.3-zip \
4050

4151
# For php scripts in bin who will be executed with PHP 8.0
4252
&& php7.4 /usr/local/bin/composer global require steevanb/php-parallel-processes:0.2.* \
4353

4454
# Install CI tools
4555
&& php7.4 /usr/local/bin/composer global require \
46-
maglnet/composer-require-checker:3.5.* \
56+
maglnet/composer-require-checker:3.8.* \
4757
wapmorgan/php-deprecation-detector:2.0.* \
48-
steevanb/php-code-sniffs:4.2.* \
49-
phpstan/phpstan:1.1.* \
50-
phpstan/phpstan-deprecation-rules:1.0.* \
51-
phpstan/phpstan-strict-rules:1.0. \
52-
phpstan/phpstan-phpunit:1.0.* \
53-
spaze/phpstan-disallowed-calls:2.0.* \
58+
steevanb/php-code-sniffs:5.0.* \
59+
phpstan/phpstan:1.12.* \
60+
phpstan/phpstan-deprecation-rules:1.2.* \
61+
phpstan/phpstan-strict-rules:1.6.* \
62+
phpstan/phpstan-phpunit:1.4.* \
63+
spaze/phpstan-disallowed-calls:3.4.* \
5464
ergebnis/phpstan-rules:1.0.* \
55-
insolita/unused-scanner:2.3.* \
56-
ergebnis/composer-normalize:2.15.* \
65+
insolita/unused-scanner:2.4.* \
66+
ergebnis/composer-normalize:2.43.* \
5767
&& ln -s ${COMPOSER_HOME}/vendor/bin/composer-require-checker /usr/local/bin/composer-require-checker \
5868
&& ln -s ${COMPOSER_HOME}/vendor/bin/phpdd /usr/local/bin/phpdd \
5969
&& ln -s ${COMPOSER_HOME}/vendor/bin/phpcs /usr/local/bin/phpcs \

src/Bridge/ContainerIntrospectionBundle/DataCollector/ContainerIntrospectionCollector.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,10 @@ public function countServices(): int
132132
return $this->data['countServices'];
133133
}
134134

135-
/** @return array<mixed> */
135+
/** @return array<mixed>|null */
136136
public function getInstantiatedInfos(string $id): ?array
137137
{
138+
/** @var array<array<mixed>> $services */
138139
$services = $this->getInstantiatedServices();
139140

140141
return array_key_exists($id, $services) ? $services[$id] : null;

src/Bridge/ContainerIntrospectionBundle/DependencyInjection/ContainerIntrospectionExtension.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
namespace Steevanb\ContainerIntrospection\Bridge\ContainerIntrospectionBundle\DependencyInjection;
66

77
use Symfony\Component\Config\FileLocator;
8+
use Symfony\Component\HttpKernel\{
9+
DependencyInjection\Extension
10+
};
811
use Symfony\Component\DependencyInjection\{
912
ContainerBuilder,
1013
Loader\YamlFileLoader
1114
};
12-
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
1315

1416
class ContainerIntrospectionExtension extends Extension
1517
{

src/ContainerIntrospectionService.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,13 @@ protected function introspectPublicServices(): self
317317
$privateServices = array_keys($this->getPrivateArrayPropertyValue('privates'));
318318
$services = array_keys($this->getPrivateArrayPropertyValue('services'));
319319

320-
/** @phpstan-ignore-next-line $publicServices (array<string>) does not accept array<int|string, int> */
321-
$this->publicServices =
322-
array_flip(
323-
array_unique(
324-
array_merge($fileMapServices, $methodMapServices, $services)
325-
)
326-
);
320+
/** @var array<string> $publicServices */
321+
$publicServices = array_flip(
322+
array_unique(
323+
array_merge($fileMapServices, $methodMapServices, $services)
324+
)
325+
);
326+
$this->publicServices = $publicServices;
327327

328328
// It looks like fileMap and methodMap only registers public services, but I filter them to be sure
329329
foreach (array_merge($privateServices, $removedServices) as $privateServiceId) {

0 commit comments

Comments
 (0)