diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 13a15b5..b385bc8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 - diff --git a/README.md b/README.md index 2c569bd..6d22215 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/bin/ci/phpcs b/bin/ci/phpcs index 5a23748..70e623d 100755 --- a/bin/ci/phpcs +++ b/bin/ci/phpcs @@ -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 "${@}" diff --git a/bin/ci/phpstan.php b/bin/ci/phpstan.php index 92c50a2..046ed44 100644 --- a/bin/ci/phpstan.php +++ b/bin/ci/phpstan.php @@ -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) { diff --git a/changelog.md b/changelog.md index c35bf7f..2e7f34f 100644 --- a/changelog.md +++ b/changelog.md @@ -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()` @@ -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 diff --git a/composer.json b/composer.json index 6ac0698..774b672 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/config/ci/phpcs.xml b/config/ci/phpcs.xml new file mode 100644 index 0000000..db53786 --- /dev/null +++ b/config/ci/phpcs.xml @@ -0,0 +1,22 @@ + + + + + /var + /vendor + src/Doctrine/ORM/EntityManager.php + + + ../.. + + + + + + + + + + + + diff --git a/config/ci/phpstan.neon b/config/ci/phpstan.neon index 8a5d96d..628351a 100644 --- a/config/ci/phpstan.neon +++ b/config/ci/phpstan.neon @@ -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 diff --git a/config/ci/phpstan.php-8.2.neon b/config/ci/phpstan.php-8.2.neon new file mode 100644 index 0000000..ff3353f --- /dev/null +++ b/config/ci/phpstan.php-8.2.neon @@ -0,0 +1,4 @@ +includes: + - phpstan.neon +parameters: + tmpDir: ../../var/ci/phpstan/php-8-2 diff --git a/config/ci/phpstan.php-8.3.neon b/config/ci/phpstan.php-8.3.neon new file mode 100644 index 0000000..9b518dd --- /dev/null +++ b/config/ci/phpstan.php-8.3.neon @@ -0,0 +1,4 @@ +includes: + - phpstan.neon +parameters: + tmpDir: ../../var/ci/phpstan/php-8-3 diff --git a/docker/ci/Dockerfile b/docker/ci/Dockerfile index 54d5719..2456ba4 100644 --- a/docker/ci/Dockerfile +++ b/docker/ci/Dockerfile @@ -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 @@ -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 \ @@ -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 \ diff --git a/src/Bridge/ContainerIntrospectionBundle/DataCollector/ContainerIntrospectionCollector.php b/src/Bridge/ContainerIntrospectionBundle/DataCollector/ContainerIntrospectionCollector.php index 4f524ee..6133495 100644 --- a/src/Bridge/ContainerIntrospectionBundle/DataCollector/ContainerIntrospectionCollector.php +++ b/src/Bridge/ContainerIntrospectionBundle/DataCollector/ContainerIntrospectionCollector.php @@ -132,9 +132,10 @@ public function countServices(): int return $this->data['countServices']; } - /** @return array */ + /** @return array|null */ public function getInstantiatedInfos(string $id): ?array { + /** @var array> $services */ $services = $this->getInstantiatedServices(); return array_key_exists($id, $services) ? $services[$id] : null; diff --git a/src/Bridge/ContainerIntrospectionBundle/DependencyInjection/ContainerIntrospectionExtension.php b/src/Bridge/ContainerIntrospectionBundle/DependencyInjection/ContainerIntrospectionExtension.php index 9bfeb8d..10d3732 100644 --- a/src/Bridge/ContainerIntrospectionBundle/DependencyInjection/ContainerIntrospectionExtension.php +++ b/src/Bridge/ContainerIntrospectionBundle/DependencyInjection/ContainerIntrospectionExtension.php @@ -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 { diff --git a/src/ContainerIntrospectionService.php b/src/ContainerIntrospectionService.php index 8d9d9b0..879c26b 100644 --- a/src/ContainerIntrospectionService.php +++ b/src/ContainerIntrospectionService.php @@ -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) does not accept array */ - $this->publicServices = - array_flip( - array_unique( - array_merge($fileMapServices, $methodMapServices, $services) - ) - ); + /** @var array $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) {