Skip to content

Commit af90076

Browse files
committed
update dependencies
1 parent 55af61d commit af90076

34 files changed

Lines changed: 931 additions & 787 deletions

.github/workflows/ci.yml

Lines changed: 8 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,14 @@
11
name: CI
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
6-
phpunit:
7-
runs-on: ${{ matrix.os }}
8-
strategy:
9-
matrix:
10-
os: [ubuntu-latest, macOS-latest]
11-
php-version: ['8.2', '8.3']
12-
dependencies: ['lowest', 'highest']
13-
name: 'PHPUnit'
14-
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v4
17-
- name: Setup PHP
18-
uses: shivammathur/setup-php@v2
19-
with:
20-
php-version: ${{ matrix.php-version }}
21-
extensions: mbstring, intl
22-
coverage: xdebug
23-
ini-values: xdebug.max_nesting_level=2048
24-
- name: Composer
25-
uses: "ramsey/composer-install@v3"
26-
with:
27-
dependency-versions: ${{ matrix.dependencies }}
28-
- name: PHPUnit
29-
run: vendor/bin/phpunit --coverage-clover=coverage.clover
30-
- uses: codecov/codecov-action@v4
31-
with:
32-
token: ${{ secrets.CODECOV_TOKEN }}
6+
blackbox:
7+
uses: innmind/github-workflows/.github/workflows/black-box-matrix.yml@main
8+
coverage:
9+
uses: innmind/github-workflows/.github/workflows/coverage-matrix.yml@main
10+
secrets: inherit
3311
psalm:
34-
runs-on: ubuntu-latest
35-
strategy:
36-
matrix:
37-
php-version: ['8.2', '8.3']
38-
dependencies: ['lowest', 'highest']
39-
name: 'Psalm'
40-
steps:
41-
- name: Checkout
42-
uses: actions/checkout@v4
43-
- name: Setup PHP
44-
uses: shivammathur/setup-php@v2
45-
with:
46-
php-version: ${{ matrix.php-version }}
47-
extensions: mbstring, intl
48-
- name: Composer
49-
uses: "ramsey/composer-install@v3"
50-
with:
51-
dependency-versions: ${{ matrix.dependencies }}
52-
- name: Psalm
53-
run: vendor/bin/psalm --shepherd
12+
uses: innmind/github-workflows/.github/workflows/psalm-matrix.yml@main
5413
cs:
55-
runs-on: ubuntu-latest
56-
strategy:
57-
matrix:
58-
php-version: ['8.2']
59-
name: 'CS'
60-
steps:
61-
- name: Checkout
62-
uses: actions/checkout@v4
63-
- name: Setup PHP
64-
uses: shivammathur/setup-php@v2
65-
with:
66-
php-version: ${{ matrix.php-version }}
67-
extensions: mbstring, intl
68-
- name: Composer
69-
uses: "ramsey/composer-install@v3"
70-
- name: CS
71-
run: vendor/bin/php-cs-fixer fix --diff --dry-run
14+
uses: innmind/github-workflows/.github/workflows/cs.yml@main

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [Unreleased]
4+
5+
### Changed
6+
7+
- Requires PHP `8.4`
8+
- Requires `innmind/foundation:~2.1`
9+
- Requires `innmind/framework:~4.0`
10+
311
## 3.8.0 - 2024-11-11
412

513
### Changed

composer.json

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@
1515
"issues": "http://github.com/Innmind/DependencyGraph/issues"
1616
},
1717
"require": {
18-
"php": "~8.2",
19-
"innmind/immutable": "~5.10",
20-
"innmind/url": "~4.1",
21-
"innmind/operating-system": "~4.1|~5.0",
22-
"innmind/json": "^1.1",
23-
"innmind/graphviz": "~3.1",
18+
"php": "~8.4",
19+
"innmind/foundation": "~2.1",
20+
"innmind/graphviz": "~5.0",
2421
"composer/semver": "^3.4.4",
25-
"innmind/framework": "~2.0",
26-
"innmind/validation": "~1.7"
22+
"innmind/framework": "~4.0"
2723
},
2824
"autoload": {
2925
"psr-4": {
@@ -36,10 +32,11 @@
3632
}
3733
},
3834
"require-dev": {
39-
"phpunit/phpunit": "~10.2",
40-
"vimeo/psalm": "~5.15",
41-
"innmind/black-box": "~5.5",
42-
"innmind/coding-standard": "~2.0"
35+
"phpunit/phpunit": "~12.0",
36+
"innmind/static-analysis": "~1.3",
37+
"innmind/black-box": "~6.5",
38+
"innmind/coding-standard": "~2.0",
39+
"innmind/url": "~5.1"
4340
},
4441
"bin": ["dependency-graph"]
4542
}

src/Command/CheckDotInstalled.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
use Innmind\CLI\{
77
Console,
88
Command,
9+
Command\Usage,
910
};
1011
use Innmind\Server\Control\Server\{
1112
Processes,
1213
Command as Process
1314
};
14-
use Innmind\Immutable\Str;
15+
use Innmind\Immutable\{
16+
Str,
17+
Attempt,
18+
};
1519

1620
final class CheckDotInstalled implements Command
1721
{
@@ -24,7 +28,8 @@ public function __construct(Command $command, Processes $processes)
2428
$this->processes = $processes;
2529
}
2630

27-
public function __invoke(Console $console): Console
31+
#[\Override]
32+
public function __invoke(Console $console): Attempt
2833
{
2934
/** @psalm-suppress ArgumentTypeCoercion Due to the environment variables */
3035
return $this
@@ -36,19 +41,24 @@ public function __invoke(Console $console): Console
3641
static fn($name) => $name === 'PATH',
3742
)),
3843
)
39-
->wait()
44+
->flatMap(
45+
static fn($process) => $process
46+
->wait()
47+
->attempt(static fn() => new \Exception),
48+
)
4049
->match(
4150
fn() => ($this->command)($console),
4251
static fn() => $console
43-
->output(Str::of("Graphviz needs to be installed first\n"))
44-
->exit(1),
52+
->exit(1)
53+
->output(Str::of("Graphviz needs to be installed first\n")),
4554
);
4655
}
4756

4857
/**
4958
* @psalm-mutation-free
5059
*/
51-
public function usage(): string
60+
#[\Override]
61+
public function usage(): Usage
5262
{
5363
return $this->command->usage();
5464
}

src/Command/DependsOn.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
};
1313
use Innmind\CLI\{
1414
Command,
15+
Command\Usage,
1516
Console,
1617
};
1718
use Innmind\Immutable\{
1819
Set,
1920
Str,
21+
Attempt,
2022
};
2123

2224
final class DependsOn implements Command
@@ -32,7 +34,8 @@ public function __construct(Dependents $load, Save $save, Display $display)
3234
$this->display = $display;
3335
}
3436

35-
public function __invoke(Console $console): Console
37+
#[\Override]
38+
public function __invoke(Console $console): Attempt
3639
{
3740
/** @psalm-suppress MixedArgumentTypeCoercion Due to the reduce */
3841
$vendors = $console
@@ -63,28 +66,31 @@ public function __invoke(Console $console): Console
6366
$fileName = $fileName->prepend('direct_');
6467
}
6568

66-
return $console
67-
->options()
68-
->maybe('output')
69-
->match(
70-
fn() => ($this->display)($console, $packages),
71-
fn() => ($this->save)($console, $fileName, $packages),
72-
);
69+
return Attempt::result(
70+
$console
71+
->options()
72+
->maybe('output')
73+
->match(
74+
fn() => ($this->display)($console, $packages),
75+
fn() => ($this->save)($console, $fileName, $packages),
76+
),
77+
);
7378
}
7479

7580
/**
7681
* @psalm-pure
7782
*/
78-
public function usage(): string
83+
#[\Override]
84+
public function usage(): Usage
7985
{
80-
return <<<USAGE
86+
return Usage::parse(<<<USAGE
8187
depends-on package vendor ...vendors --direct --output
8288
8389
Generate a graph of all packages depending on a given package
8490
8591
The packages are searched in a given set of vendors. This restriction
8692
is due to the fact that packagist.org doesn't expose via an api the
8793
packages that depends on an other.
88-
USAGE;
94+
USAGE);
8995
}
9096
}

src/Command/FromLock.php

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010
};
1111
use Innmind\CLI\{
1212
Command,
13+
Command\Usage,
1314
Console,
1415
};
15-
use Innmind\Immutable\Str;
16+
use Innmind\Immutable\{
17+
Str,
18+
Attempt,
19+
};
1620

1721
final class FromLock implements Command
1822
{
@@ -27,38 +31,42 @@ public function __construct(ComposerLock $load, Save $save, Display $display)
2731
$this->display = $display;
2832
}
2933

30-
public function __invoke(Console $console): Console
34+
#[\Override]
35+
public function __invoke(Console $console): Attempt
3136
{
3237
$packages = ($this->load)($console->workingDirectory());
3338

3439
if ($packages->empty()) {
3540
return $console
36-
->error(Str::of("No packages found\n"))
37-
->exit(1);
41+
->exit(1)
42+
->error(Str::of("No packages found\n"));
3843
}
3944

4045
$fileName = Str::of('dependencies.svg');
4146

42-
return $console
43-
->options()
44-
->maybe('output')
45-
->match(
46-
fn() => ($this->display)($console, $packages),
47-
fn() => ($this->save)($console, $fileName, $packages),
48-
);
47+
return Attempt::result(
48+
$console
49+
->options()
50+
->maybe('output')
51+
->match(
52+
fn() => ($this->display)($console, $packages),
53+
fn() => ($this->save)($console, $fileName, $packages),
54+
),
55+
);
4956
}
5057

5158
/**
5259
* @psalm-pure
5360
*/
54-
public function usage(): string
61+
#[\Override]
62+
public function usage(): Usage
5563
{
56-
return <<<USAGE
64+
return Usage::parse(<<<USAGE
5765
from-lock --output
5866
5967
Generate the dependency graph out of a composer.lock
6068
6169
It will look for a composer.lock in the working directory
62-
USAGE;
70+
USAGE);
6371
}
6472
}

src/Command/Of.php

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@
1111
};
1212
use Innmind\CLI\{
1313
Command,
14+
Command\Usage,
1415
Console,
1516
};
16-
use Innmind\Immutable\Str;
17+
use Innmind\Immutable\{
18+
Str,
19+
Attempt,
20+
};
1721

1822
final class Of implements Command
1923
{
@@ -28,31 +32,35 @@ public function __construct(Dependencies $load, Save $save, Display $display)
2832
$this->display = $display;
2933
}
3034

31-
public function __invoke(Console $console): Console
35+
#[\Override]
36+
public function __invoke(Console $console): Attempt
3237
{
3338
$packages = ($this->load)(Name::of($console->arguments()->get('package')));
3439
$fileName = Str::of($console->arguments()->get('package'))
3540
->replace('/', '_')
3641
->append('_dependencies.svg');
3742

38-
return $console
39-
->options()
40-
->maybe('output')
41-
->match(
42-
fn() => ($this->display)($console, $packages),
43-
fn() => ($this->save)($console, $fileName, $packages),
44-
);
43+
return Attempt::result(
44+
$console
45+
->options()
46+
->maybe('output')
47+
->match(
48+
fn() => ($this->display)($console, $packages),
49+
fn() => ($this->save)($console, $fileName, $packages),
50+
),
51+
);
4552
}
4653

4754
/**
4855
* @psalm-pure
4956
*/
50-
public function usage(): string
57+
#[\Override]
58+
public function usage(): Usage
5159
{
52-
return <<<USAGE
60+
return Usage::parse(<<<USAGE
5361
of package --output
5462
5563
Generate the dependency graph of the given package
56-
USAGE;
64+
USAGE);
5765
}
5866
}

0 commit comments

Comments
 (0)