Skip to content

Compatibility with Symfony 7 #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [--php=7.4, --php=8.0, --php=8.1]
php-version: [--php=7.4, --php=8.0, --php=8.1, --php=8.2, --php=8.3]
steps:
- uses: actions/checkout@v2
-
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ symfony-container-introspection

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

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

With Symfony, a new profiler tab will appear:

Expand Down
11 changes: 1 addition & 10 deletions bin/ci/phpcs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,4 @@ if [ ! -d "${ROOT_DIR}"/var/ci/phpcs ]; then
mkdir -p "${ROOT_DIR}"/var/ci/phpcs
fi

phpcs \
-p \
--warning-severity=0 \
--ignore=/vendor/,/var/,src/Doctrine/ORM/EntityManager.php \
--bootstrap=config/ci/phpcs.php \
--standard="${COMPOSER_HOME}"/vendor/steevanb/php-code-sniffs/src/Steevanb/ruleset.xml \
--report=steevanb\\PhpCodeSniffs\\Reports\\Steevanb \
--cache="${ROOT_DIR}"/var/ci/phpcs/cache \
. \
"${@}"
phpcs -p --standard="${ROOT_DIR}"/config/ci/phpcs.xml "${@}"
2 changes: 1 addition & 1 deletion bin/ci/phpstan.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

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

$return = new ProcessArray();
foreach ($phpVersions as $loopPhpVersion) {
Expand Down
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
### master

- Add `Symfony ^7.0` compatibility
- Add `PHP 8.2` and `8.3` compatibility
- Update CI tools

### [3.0.1](../../compare/3.0.0...3.0.1) - 2022-11-22

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

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

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "steevanb/symfony-container-introspection",
"type": "lib",
"description": "Get all Symfony Container informations you need: registered services, instanciated services etc",
"license": "MIT",
"type": "lib",
"require": {
"php": "^7.1 || ^8.0",
"symfony/dependency-injection": "^5.0 || ^6.0"
"symfony/dependency-injection": "^5.0 || ^6.0 || ^7.0"
},
"require-dev": {
"ocramius/proxy-manager": "^2.0",
"symfony/config": "^5.0 || ^6.0",
"symfony/http-kernel": "^5.0 || ^6.0"
"symfony/config": "~5.0.0",
"symfony/http-kernel": "~5.0.0"
},
"autoload": {
"psr-4": {
Expand Down
22 changes: 22 additions & 0 deletions config/ci/phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<ruleset name="phpcs">
<rule ref="/composer/vendor/steevanb/php-code-sniffs/src/Steevanb/ruleset.xml"/>
<arg name="warning-severity" value="0"/>
<exclude-pattern>/var</exclude-pattern>
<exclude-pattern>/vendor</exclude-pattern>
<exclude-pattern>src/Doctrine/ORM/EntityManager.php</exclude-pattern>
<arg name="report" value="steevanb\PhpCodeSniffs\Reports\Steevanb"/>
<arg name="cache" value="../../var/ci/phpcs/cache"/>
<file>../..</file>
<rule ref="Steevanb.Uses.GroupUses">
<properties>
<property name="thirdLevelPrefixes" type="array">
<element value="Steevanb\ContainerIntrospection"/>
<element value="Symfony\Component"/>
</property>
</properties>
</rule>
<rule ref="Steevanb.ReturnType.Php81StaticInsteadOfSelf">
<exclude name="Steevanb.ReturnType.Php81StaticInsteadOfSelf.ReturnTypeStatic"/>
</rule>
</ruleset>
1 change: 1 addition & 0 deletions config/ci/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ parameters:
- ../../src
includes:
- /composer/vendor/phpstan/phpstan-deprecation-rules/rules.neon
- /composer/vendor/phpstan/phpstan-phpunit/extension.neon
- /composer/vendor/phpstan/phpstan-phpunit/rules.neon
- /composer/vendor/phpstan/phpstan-strict-rules/rules.neon
- /composer/vendor/spaze/phpstan-disallowed-calls/extension.neon
Expand Down
4 changes: 4 additions & 0 deletions config/ci/phpstan.php-8.2.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
includes:
- phpstan.neon
parameters:
tmpDir: ../../var/ci/phpstan/php-8-2
4 changes: 4 additions & 0 deletions config/ci/phpstan.php-8.3.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
includes:
- phpstan.neon
parameters:
tmpDir: ../../var/ci/phpstan/php-8-3
32 changes: 21 additions & 11 deletions docker/ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:22.04
FROM ubuntu:24.04

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

ENV COMPOSER_HOME=/composer
ENV COMPOSER_CACHE_DIR=/app/var/composer
Expand Down Expand Up @@ -28,6 +28,12 @@ RUN \
php8.1-cli \
php8.1-simplexml \
php8.1-mbstring \
php8.2-cli \
php8.2-simplexml \
php8.2-mbstring \
php8.3-cli \
php8.3-simplexml \
php8.3-mbstring \
# For Composer
curl \
zip \
Expand All @@ -37,23 +43,27 @@ RUN \
php8.0-zip \
php8.1-curl \
php8.1-zip \
php8.2-curl \
php8.2-zip \
php8.3-curl \
php8.3-zip \

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

# Install CI tools
&& php7.4 /usr/local/bin/composer global require \
maglnet/composer-require-checker:3.5.* \
maglnet/composer-require-checker:3.8.* \
wapmorgan/php-deprecation-detector:2.0.* \
steevanb/php-code-sniffs:4.2.* \
phpstan/phpstan:1.1.* \
phpstan/phpstan-deprecation-rules:1.0.* \
phpstan/phpstan-strict-rules:1.0. \
phpstan/phpstan-phpunit:1.0.* \
spaze/phpstan-disallowed-calls:2.0.* \
steevanb/php-code-sniffs:5.0.* \
phpstan/phpstan:1.12.* \
phpstan/phpstan-deprecation-rules:1.2.* \
phpstan/phpstan-strict-rules:1.6.* \
phpstan/phpstan-phpunit:1.4.* \
spaze/phpstan-disallowed-calls:3.4.* \
ergebnis/phpstan-rules:1.0.* \
insolita/unused-scanner:2.3.* \
ergebnis/composer-normalize:2.15.* \
insolita/unused-scanner:2.4.* \
ergebnis/composer-normalize:2.43.* \
&& ln -s ${COMPOSER_HOME}/vendor/bin/composer-require-checker /usr/local/bin/composer-require-checker \
&& ln -s ${COMPOSER_HOME}/vendor/bin/phpdd /usr/local/bin/phpdd \
&& ln -s ${COMPOSER_HOME}/vendor/bin/phpcs /usr/local/bin/phpcs \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ public function countServices(): int
return $this->data['countServices'];
}

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

return array_key_exists($id, $services) ? $services[$id] : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
namespace Steevanb\ContainerIntrospection\Bridge\ContainerIntrospectionBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\{
DependencyInjection\Extension
};
use Symfony\Component\DependencyInjection\{
ContainerBuilder,
Loader\YamlFileLoader
};
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

class ContainerIntrospectionExtension extends Extension
{
Expand Down
14 changes: 7 additions & 7 deletions src/ContainerIntrospectionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,13 @@ protected function introspectPublicServices(): self
$privateServices = array_keys($this->getPrivateArrayPropertyValue('privates'));
$services = array_keys($this->getPrivateArrayPropertyValue('services'));

/** @phpstan-ignore-next-line $publicServices (array<string>) does not accept array<int|string, int> */
$this->publicServices =
array_flip(
array_unique(
array_merge($fileMapServices, $methodMapServices, $services)
)
);
/** @var array<string> $publicServices */
$publicServices = array_flip(
array_unique(
array_merge($fileMapServices, $methodMapServices, $services)
)
);
$this->publicServices = $publicServices;

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