diff --git a/.editorconfig b/.editorconfig index fafef05..c11eed3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,5 +11,8 @@ indent_size = 4 [{*.yaml,*.yml,*.neon,*.json}] indent_size = 2 -[Dockerfile] +[*.md] +max_line_length = 100 + +[{Dockerfile,Makefile}] indent_style = tab diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 66a1b3d..ca5ce00 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -14,7 +14,7 @@ jobs: uses: shivammathur/setup-php@v2 with: coverage: none - php-version: "8.3" + php-version: "8.2" ini-values: memory_limit=-1 tools: phpcs, cs2pr - name: Run PHP Code Sniffer diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 6a87b5e..81f7cd9 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -14,7 +14,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: "8.3" + php-version: "8.2" ini-values: memory_limit=-1 tools: composer:v2 - name: Cache dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0446d81..ba60a0a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,6 +13,7 @@ jobs: php-version: - "8.2" - "8.3" + - "8.4" steps: - name: Checkout uses: actions/checkout@v4 @@ -40,7 +41,7 @@ jobs: run: make test-coveralls - name: Upload code coverage - if: ${{ matrix.php-version == '8.3' }} + if: ${{ matrix.php-version == '8.2' }} env: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | diff --git a/.gitignore b/.gitignore index 14010f5..4edb3d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -.phpunit.cache +.phpunit.result.cache build composer.lock vendor diff --git a/CHANGELOG.md b/CHANGELOG.md index 23fd969..3f487ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -# v5.0 to v6.0 +# v5.x to v6.0 ### New requirements diff --git a/Dockerfile b/Dockerfile index 09cc22c..40061cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -ARG PHP_VERSION +ARG PHP_VERSION=8.2 FROM php:${PHP_VERSION}-cli-bookworm RUN <<-EOF - apt-get update + apt-get update apt-get install -y autoconf pkg-config pecl channel-update pecl.php.net pecl install xdebug @@ -35,6 +35,8 @@ RUN <<-EOF SHELL EOF +RUN composer global require squizlabs/php_codesniffer + # package specifics RUN <<-EOF diff --git a/LICENSE b/LICENSE index 6ffa4f5..32c7803 100644 --- a/LICENSE +++ b/LICENSE @@ -1,30 +1,21 @@ -The icanboogie/bind-symfony-dependency-injection package is free software. -It is released under the terms of the following BSD License. +MIT License -Copyright (c) 2017-present by Olivier Laviale -All rights reserved. +Copyright (c) 2017 Olivier LAVIALE -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Olivier Laviale nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile index 9f102f0..f148a54 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,9 @@ # customization -PACKAGE_NAME = icanboogie/bind-symfony-dependency-injection PHPUNIT = vendor/bin/phpunit # do not edit the following lines -.PHONY: usage -usage: - @echo "test: Runs the test suite.\ndoc: Creates the documentation.\nclean: Removes the documentation, the dependencies and the Composer files." - vendor: @composer install @@ -40,13 +35,18 @@ test-container: test-container-82 .PHONY: test-container-82 test-container-82: - @-docker-compose run --rm app82 bash - @docker-compose down -v + @-docker compose run --rm app82 bash + @docker compose down -v .PHONY: test-container-83 test-container-83: - @-docker-compose run --rm app83 bash - @docker-compose down -v + @-docker compose run --rm app83 bash + @docker compose down -v + +.PHONY: test-container-84 +test-container-84: + @-docker compose run --rm app84 bash + @docker compose down -v .PHONY: lint lint: diff --git a/README.md b/README.md index 1e4c5b6..5f3c6fd 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ # bind-symfony-dependency-injection -[![Release](https://img.shields.io/packagist/v/ICanBoogie/bind-symfony-dependency-injection.svg)](https://packagist.org/packages/ICanBoogie/bind-symfony-dependency-injection) -[![Code Quality](https://img.shields.io/scrutinizer/g/ICanBoogie/bind-symfony-dependency-injection.svg)](https://scrutinizer-ci.com/g/ICanBoogie/bind-symfony-dependency-injection) -[![Code Coverage](https://img.shields.io/coveralls/ICanBoogie/bind-symfony-dependency-injection.svg)](https://coveralls.io/r/ICanBoogie/bind-symfony-dependency-injection) -[![Packagist](https://img.shields.io/packagist/dt/ICanBoogie/bind-symfony-dependency-injection.svg)](https://packagist.org/packages/ICanBoogie/bind-symfony-dependency-injection) +[![Release](https://img.shields.io/packagist/v/icanboogie/.svg)](https://packagist.org/packages/icanboogie/) +[![Code Coverage](https://coveralls.io/repos/github/ICanBoogie//badge.svg?branch=6.0)](https://coveralls.io/r/ICanBoogie/?branch=6.0) +[![Downloads](https://img.shields.io/packagist/dt/icanboogie/.svg)](https://packagist.org/packages/icanboogie/) Together with [icanboogie/service][], this package binds [symfony/dependency-injection][] to [ICanBoogie][] and allows the container to be used to provide services. @@ -131,31 +130,24 @@ return fn(ConfigBuilder $config) => $config ## Continuous Integration -The project is continuously tested by [GitHub actions](https://github.com/ICanBoogie/bind-symfony-dependency-injection/actions). +The project is continuously tested by [GitHub actions](https://github.com/ICanBoogie//actions). -[![Tests](https://github.com/ICanBoogie/bind-symfony-dependency-injection/workflows/test/badge.svg)](https://github.com/ICanBoogie/bind-symfony-dependency-injection/actions?query=workflow%3Atest) -[![Static Analysis](https://github.com/ICanBoogie/bind-symfony-dependency-injection/workflows/static-analysis/badge.svg)](https://github.com/ICanBoogie/bind-symfony-dependency-injection/actions?query=workflow%3Astatic-analysis) -[![Code Style](https://github.com/ICanBoogie/bind-symfony-dependency-injection/workflows/code-style/badge.svg)](https://github.com/ICanBoogie/bind-symfony-dependency-injection/actions?query=workflow%3Acode-style) +[![Tests](https://github.com/ICanBoogie//actions/workflows/test.yml/badge.svg?branch=6.0)](https://github.com/ICanBoogie//actions/workflows/test.yml) +[![Static Analysis](https://github.com/ICanBoogie//actions/workflows/static-analysis.yml/badge.svg?branch=6.0)](https://github.com/ICanBoogie//actions/workflows/static-analysis.yml) +[![Code Style](https://github.com/ICanBoogie//actions/workflows/code-style.yml/badge.svg?branch=6.0)](https://github.com/ICanBoogie//actions/workflows/code-style.yml) ## Code of Conduct This project adheres to a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in -this project and its community, you are expected to uphold this code. +this project and its community, you're expected to uphold this code. ## Contributing -Please see [CONTRIBUTING](CONTRIBUTING.md) for details. - - - -## License - -**icanboogie/bind-symfony-dependency-injection** is released under the [BSD-3-Clause](LICENSE). - +See [CONTRIBUTING](CONTRIBUTING.md) for details. diff --git a/composer.json b/composer.json index cfb1b23..1d1b365 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "injection" ], "homepage": "https://icanboogie.org/", - "license": "BSD-3-Clause", + "license": "MIT", "authors": [ { "name": "Olivier Laviale", @@ -22,7 +22,10 @@ "source": "https://github.com/ICanBoogie/bind-symfony-dependency-injection" }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "icanboogie/autoconfig": true + } }, "minimum-stability": "dev", "prefer-stable": true, @@ -34,8 +37,8 @@ "symfony/yaml": "^7.0" }, "require-dev": { - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^10.5" + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^11.4" }, "autoload": { "psr-4": { @@ -47,9 +50,6 @@ "Test\\ICanBoogie\\Binding\\SymfonyDependencyInjection\\": "tests/src" } }, - "scripts": { - "post-autoload-dump": "ICanBoogie\\Autoconfig\\Hooks::on_autoload_dump" - }, "extra": { "icanboogie": { "config-path": "config", diff --git a/docker-compose.yaml b/docker-compose.yaml index c61b622..f13cb79 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -6,10 +6,10 @@ services: args: PHP_VERSION: "8.2" environment: - PHP_IDE_CONFIG: 'serverName=icanboogie-bind-symfony-dependency-injection' + PHP_IDE_CONFIG: 'serverName=icanboogie-bind-symfony-dependency-injection' volumes: - - .:/app:delegated - - ~/.composer:/root/.composer:delegated + - .:/app:delegated + - ~/.composer:/root/.composer:delegated working_dir: /app app83: build: @@ -17,8 +17,19 @@ services: args: PHP_VERSION: "8.3" environment: - PHP_IDE_CONFIG: 'serverName=icanboogie-bind-symfony-dependency-injection' + PHP_IDE_CONFIG: 'serverName=icanboogie-bind-symfony-dependency-injection' volumes: - - .:/app:delegated - - ~/.composer:/root/.composer:delegated + - .:/app:delegated + - ~/.composer:/root/.composer:delegated + working_dir: /app + app84: + build: + context: . + args: + PHP_VERSION: "8.4" + environment: + PHP_IDE_CONFIG: 'serverName=icanboogie-bind-symfony-dependency-injection' + volumes: + - .:/app:delegated + - ~/.composer:/root/.composer:delegated working_dir: /app diff --git a/phpcs.xml b/phpcs.xml index adc9f47..35133b9 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -6,7 +6,7 @@ tests/sandbox/* tests/var/* - + diff --git a/phpstan.neon b/phpstan.neon index a7c64bd..54666fa 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,4 @@ +# $schema: https://phpstan.olvlvl.com/schema.json parameters: level: 8 paths: diff --git a/phpunit.xml b/phpunit.xml index 626489e..6834824 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,17 +1,19 @@ - ./tests/src + tests/src diff --git a/src/ConfigBuilder.php b/src/ConfigBuilder.php index 400b88c..c551965 100644 --- a/src/ConfigBuilder.php +++ b/src/ConfigBuilder.php @@ -49,6 +49,7 @@ public function build(): Config */ public function add_compiler_pass(string $compiler_pass_class): self { + // @phpstan-ignore-next-line if (!is_subclass_of($compiler_pass_class, CompilerPassInterface::class)) { throw new InvalidArgumentException("Compiler pass must implement " . CompilerPassInterface::class); } @@ -68,6 +69,7 @@ public function add_compiler_pass(string $compiler_pass_class): self */ public function add_extension(string $extension_class): self { + // @phpstan-ignore-next-line if (!is_subclass_of($extension_class, ExtensionInterface::class)) { throw new InvalidArgumentException("Extension must implement " . ExtensionInterface::class); } diff --git a/src/ContainerFactory.php b/src/ContainerFactory.php index 45d6b73..5df1e54 100644 --- a/src/ContainerFactory.php +++ b/src/ContainerFactory.php @@ -62,7 +62,7 @@ private function instantiate_container(): ContainerInterface $app = $this->app; $pathname = ContainerPathname::from($app); /** @var class-string $class */ - $class = 'ApplicationContainer'; + $class = 'ApplicationContainer'; // @phpstan-ignore varTag.nativeType if (!$this->config->use_caching || !file_exists($pathname)) { $builder = $this->create_container_builder();