Skip to content

Commit

Permalink
Update boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Nov 29, 2024
1 parent 29a0a32 commit d6e56ef
Show file tree
Hide file tree
Showing 17 changed files with 83 additions and 78 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
php-version:
- "8.2"
- "8.3"
- "8.4"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.phpunit.cache
.phpunit.result.cache
build
composer.lock
vendor
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CHANGELOG

# v5.0 to v6.0
# v5.x to v6.0

### New requirements

Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -35,6 +35,8 @@ RUN <<-EOF
SHELL
EOF

RUN composer global require squizlabs/php_codesniffer

# package specifics

RUN <<-EOF
Expand Down
43 changes: 17 additions & 26 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>

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.
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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:
Expand Down
26 changes: 9 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/<name>.svg)](https://packagist.org/packages/icanboogie/<name>)
[![Code Coverage](https://coveralls.io/repos/github/ICanBoogie/<Name>/badge.svg?branch=6.0)](https://coveralls.io/r/ICanBoogie/<Name>?branch=6.0)
[![Downloads](https://img.shields.io/packagist/dt/icanboogie/<name>.svg)](https://packagist.org/packages/icanboogie/<name>)

Together with [icanboogie/service][], this package binds [symfony/dependency-injection][] to
[ICanBoogie][] and allows the container to be used to provide services.
Expand Down Expand Up @@ -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/<Name>/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/<Name>/actions/workflows/test.yml/badge.svg?branch=6.0)](https://github.com/ICanBoogie/<Name>/actions/workflows/test.yml)
[![Static Analysis](https://github.com/ICanBoogie/<Name>/actions/workflows/static-analysis.yml/badge.svg?branch=6.0)](https://github.com/ICanBoogie/<Name>/actions/workflows/static-analysis.yml)
[![Code Style](https://github.com/ICanBoogie/<Name>/actions/workflows/code-style.yml/badge.svg?branch=6.0)](https://github.com/ICanBoogie/<Name>/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.



Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"injection"
],
"homepage": "https://icanboogie.org/",
"license": "BSD-3-Clause",
"license": "MIT",
"authors": [
{
"name": "Olivier Laviale",
Expand All @@ -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,
Expand All @@ -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": {
Expand All @@ -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",
Expand Down
23 changes: 17 additions & 6 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,30 @@ 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:
context: .
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
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<exclude-pattern>tests/sandbox/*</exclude-pattern>
<exclude-pattern>tests/var/*</exclude-pattern>

<arg name="colors"/>
<arg name="colors"/>

<rule ref="PSR1">
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# $schema: https://phpstan.olvlvl.com/schema.json
parameters:
level: 8
paths:
Expand Down
8 changes: 5 additions & 3 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
bootstrap="tests/bootstrap.php"
cacheDirectory=".phpunit.cache"
colors="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnPhpunitDeprecations="true"
executionOrder="depends,defects"
>
<testsuites>
<testsuite name="icanboogie/bind-symfony-dependency-injection">
<directory>./tests/src</directory>
<directory>tests/src</directory>
</testsuite>
</testsuites>
<source>
Expand Down
2 changes: 2 additions & 0 deletions src/ConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ContainerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private function instantiate_container(): ContainerInterface
$app = $this->app;
$pathname = ContainerPathname::from($app);
/** @var class-string<ContainerInterface> $class */
$class = 'ApplicationContainer';
$class = 'ApplicationContainer'; // @phpstan-ignore varTag.nativeType

if (!$this->config->use_caching || !file_exists($pathname)) {
$builder = $this->create_container_builder();
Expand Down

0 comments on commit d6e56ef

Please sign in to comment.