Skip to content

Commit 4d5b3e4

Browse files
committed
Require symfony/dependency-injection v6.3
1 parent 90c40a7 commit 4d5b3e4

17 files changed

+105
-97
lines changed

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Install PHP
1515
uses: shivammathur/setup-php@v2
1616
with:
17-
php-version: "8.0"
17+
php-version: "8.1"
1818
ini-values: memory_limit=-1
1919
tools: composer:v2
2020
- name: Cache dependencies

.github/workflows/test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ jobs:
1111
strategy:
1212
matrix:
1313
php-version:
14-
- "8.0"
1514
- "8.1"
1615
- "8.2"
1716
steps:
@@ -40,7 +39,7 @@ jobs:
4039
run: make test-coveralls
4140

4241
- name: Upload code coverage
43-
if: ${{ matrix.php-version == '8.0' }}
42+
if: ${{ matrix.php-version == '8.1' }}
4443
env:
4544
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4645
run: |

MIGRATION.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,31 @@
11
# Migration
22

3-
## v3.x to v4.x
3+
## v4.x to v5.0
4+
5+
### New requirements
6+
7+
- Requires PHP v8.1+
8+
- Requires `symfony/dependency-injection` v6.3+
9+
10+
### New features
11+
12+
N/A
13+
14+
### Backward Incompatible Changes
15+
16+
N/A
17+
18+
### Deprecated Features
19+
20+
N/A
21+
22+
### Other Changes
23+
24+
N/A
25+
26+
27+
28+
## v3.x to v4.0
429

530
### New requirements
631

Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ test-cleanup:
2525
@rm -rf tests/sandbox/*
2626

2727
.PHONY: test-container
28-
test-container: test-container-80
29-
30-
.PHONY: test-container-80
31-
test-container-80:
32-
@-docker-compose run --rm app80 bash
33-
@docker-compose down -v
28+
test-container: test-container-81
3429

3530
.PHONY: test-container-81
3631
test-container-81:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ implementation][2]. Here are some differences:
1212
- Can proxy `final` classes.
1313
- Can only proxy classes with interfaces.
1414
- The generated proxies are self-contained.
15-
- The package is ~10Kb and doesn't have dependencies, other than `symfony/dependency-injection` of course.
15+
- The package is ~10Kb and doesn't have dependencies.
1616
- The package can be removed once the proxies have been generated.
1717

1818
If you're not familiar with proxy services, better have a look at [Symfony's documentation][3]

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
"prefer-stable": true,
2020
"prefer-dist": true,
2121
"require": {
22-
"php": ">=8.0.2",
22+
"php": ">=8.1",
2323
"ext-json": "*",
24-
"symfony/dependency-injection": ">=6.0 <6.3"
24+
"symfony/dependency-injection": "^6.3"
2525
},
2626
"require-dev": {
27-
"phpstan/phpstan": "^1.6",
28-
"phpunit/phpunit": "^9.5",
29-
"symfony/config": "^6.0"
27+
"phpstan/phpstan": "^1.10",
28+
"phpunit/phpunit": "^10.3",
29+
"symfony/config": "^6.3"
3030
},
3131
"autoload": {
3232
"psr-4": {

docker-compose.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
---
22
version: "3.2"
33
services:
4-
app80:
5-
build:
6-
context: .
7-
args:
8-
PHP_VERSION: "8.0"
9-
environment:
10-
PHP_IDE_CONFIG: "serverName=symfony-di-proxy"
11-
volumes:
12-
- .:/app:delegated
13-
- ~/.composer:/root/.composer:delegated
144
app81:
155
build:
166
context: .

lib/FactoryRenderer.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
class FactoryRenderer
2222
{
2323
public function __construct(
24-
private MethodRenderer $methodRenderer
24+
private readonly MethodRenderer $methodRenderer
2525
) {
2626
}
2727

@@ -36,16 +36,13 @@ public function __invoke(string $interface, string $factoryCode): string
3636

3737
return <<<PHPTPL
3838
new class(
39-
function () {
40-
return $factoryCode;
41-
}
39+
static fn () => $factoryCode
4240
) implements \\$interface
4341
{
4442
private \$service;
4543
46-
public function __construct(
47-
private \Closure \$factory
48-
) {
44+
public function __construct(private \Closure \$factory)
45+
{
4946
}
5047
5148
$methods

lib/ProxyDumper.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,10 @@
2525

2626
final class ProxyDumper implements DumperInterface
2727
{
28-
private InterfaceResolver $interfaceResolver;
29-
private FactoryRenderer $factoryRenderer;
30-
3128
public function __construct(
32-
InterfaceResolver $interfaceResolver = null,
33-
FactoryRenderer $factoryRenderer = null
29+
private readonly InterfaceResolver $interfaceResolver = new BasicInterfaceResolver(),
30+
private readonly FactoryRenderer $factoryRenderer = new FactoryRenderer(new MethodRenderer()),
3431
) {
35-
$this->interfaceResolver = $interfaceResolver ?? new BasicInterfaceResolver();
36-
$this->factoryRenderer = $factoryRenderer ?? new FactoryRenderer(new MethodRenderer());
3732
}
3833

3934
/**
@@ -60,7 +55,7 @@ public function getProxyFactoryCode(Definition $definition, string $id, string $
6055

6156
if ($definition->isShared()) {
6257
$store = sprintf(
63-
'$this->%s[\'%s\'] = ',
58+
'$container->%s[\'%s\'] = ',
6459
$definition->isPublic() && !$definition->isPrivate() ? 'services' : 'privates',
6560
$id
6661
);

phpunit.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
<phpunit
2-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
4-
colors="true"
5-
bootstrap="./vendor/autoload.php"
1+
<?xml version="1.0"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
4+
colors="true"
5+
bootstrap="tests/bootstrap.php"
66
>
7-
<coverage>
8-
<include>
9-
<directory suffix=".php">./lib</directory>
10-
</include>
11-
</coverage>
127
<testsuites>
138
<testsuite name="olvlvl/symfony-dependency-injection-proxy">
149
<directory>./tests</directory>
1510
</testsuite>
1611
</testsuites>
12+
<source>
13+
<include>
14+
<directory>./lib</directory>
15+
</include>
16+
</source>
1717
</phpunit>

0 commit comments

Comments
 (0)