Skip to content

Commit cdfdeef

Browse files
committedNov 11, 2023
Merge branch 'develop'
* develop: specify next release fix psalm error fix showing same relation multiple times fix tests
2 parents b364879 + 795948a commit cdfdeef

7 files changed

+31
-26
lines changed
 

‎CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 3.4.1 - 2023-11-11
4+
5+
### Fixed
6+
7+
- Same relation was displayed multiple times
8+
39
## 3.4.0 - 2023-09-24
410

511
### Added

‎src/Loader/Dependencies.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
Set,
1212
Map,
1313
Maybe,
14+
Predicate\Instance,
1415
};
1516

1617
final class Dependencies
@@ -62,12 +63,9 @@ private function loadRelations(Model $dependency): Set
6263
*/
6364
private function lookup(Model\Name $relation): Maybe
6465
{
65-
/** @psalm-suppress InvalidArgument Because it doesn't understand the filter */
66-
return $this
67-
->cache
68-
->get($relation->toString())
69-
->filter(static fn($ref) => \is_object($ref->get()))
66+
return Maybe::defer(fn() => $this->cache->get($relation->toString()))
7067
->map(static fn($ref) => $ref->get())
68+
->keep(Instance::of(Model::class))
7169
->otherwise(fn() => $this->fetch($relation))
7270
->map($this->loadRelations(...));
7371
}

‎src/Loader/VendorDependencies.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ private function loadRelations(PackageModel $dependency): Set
6969
*/
7070
private function lookup(PackageModel\Name $relation): Maybe
7171
{
72-
return $this
73-
->cache
74-
->get($relation->toString())
72+
return Maybe::defer(fn() => $this->cache->get($relation->toString()))
7573
->map(static fn($ref) => $ref->get())
7674
->keep(Instance::of(PackageModel::class))
7775
->otherwise(fn() => $this->fetch($relation));

‎tests/Loader/DependenciesTest.php

+14-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testInvokation()
3131
subgraph cluster_innmind {
3232
label="innmind"
3333
URL="https://packagist.org/packages/innmind/"
34-
innmind__immutable [label="immutable@5.0.0"];
34+
innmind__immutable [label="immutable@5.3.0"];
3535
innmind__url [label="url@4.3.0"];
3636
}
3737
subgraph cluster_league {
@@ -56,7 +56,7 @@ public function testInvokation()
5656
innmind__url -> innmind__immutable [color="#085cd3", label="~4.15|~5.0"];
5757
innmind__url -> league__uri_parser [color="#085cd3", style="dotted", label="~1.2"];
5858
innmind__url -> league__uri_components [color="#ff0000", style="bold", label="~2.0"];
59-
innmind__immutable [shape="ellipse", width="0.75", height="0.5", color="#a7e599", URL="https://packagist.org/packages/innmind/immutable#5.0.0"];
59+
innmind__immutable [shape="ellipse", width="0.75", height="0.5", color="#a7e599", URL="https://packagist.org/packages/innmind/immutable#5.3.0"];
6060
league__uri_parser [shape="ellipse", width="0.75", height="0.5", color="#bcf2f6", URL="https://packagist.org/packages/league/uri-parser#1.4.1"];
6161
psr__http_message [shape="ellipse", width="0.75", height="0.5", color="#8da3f1", URL="https://packagist.org/packages/psr/http-message#2.0"];
6262
psr__http_factory [shape="ellipse", width="0.75", height="0.5", color="#8ac267", URL="https://packagist.org/packages/psr/http-factory#1.0.2"];
@@ -69,4 +69,16 @@ public function testInvokation()
6969

7070
$this->assertSame($expected, (new Render)($packages)->toString());
7171
}
72+
73+
public function testDuplicatedRelationsRegression()
74+
{
75+
$load = new Dependencies(
76+
new Package(Curl::of(new Clock)->maxConcurrency(20)),
77+
);
78+
79+
$packages = $load(PackageModel\Name::of('innmind/http-transport'));
80+
81+
$this->assertInstanceOf(Set::class, $packages);
82+
$this->assertCount(23, $packages);
83+
}
7284
}

‎tests/Loader/DependentsTest.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,13 @@ public function testInvokation()
3434
);
3535

3636
$this->assertInstanceOf(Set::class, $packages);
37+
$this->assertCount(75, $packages);
3738
$this->assertSame(
3839
[
3940
'innmind/acl',
4041
'innmind/amqp',
4142
'innmind/ark',
4243
'innmind/async-http-server',
43-
'innmind/async-operating-system',
44-
'innmind/async-socket',
45-
'innmind/async-stream',
46-
'innmind/async-time-warp',
4744
'innmind/cli',
4845
'innmind/colour',
4946
'innmind/crawler',
@@ -52,6 +49,7 @@ public function testInvokation()
5249
'innmind/debug',
5350
'innmind/dependency-graph',
5451
'innmind/doctrine',
52+
'innmind/encoding',
5553
'innmind/file-watch',
5654
'innmind/filesystem',
5755
'innmind/framework',
@@ -85,8 +83,6 @@ public function testInvokation()
8583
'innmind/mantle',
8684
'innmind/math',
8785
'innmind/media-type',
88-
'innmind/neo4j-dbal',
89-
'innmind/neo4j-onm',
9086
'innmind/object-graph',
9187
'innmind/operating-system',
9288
'innmind/process-manager',
@@ -112,6 +108,7 @@ public function testInvokation()
112108
'innmind/url',
113109
'innmind/url-resolver',
114110
'innmind/url-template',
111+
'innmind/validation',
115112
'innmind/virtual-machine',
116113
'innmind/warden',
117114
'innmind/xml',

‎tests/Loader/VendorDependenciesTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ public function testInvokation()
4040
'innmind/ark',
4141
'innmind/async-http-server',
4242
'innmind/async-operating-system',
43-
'innmind/async-socket',
44-
'innmind/async-stream',
45-
'innmind/async-time-warp',
4643
'innmind/black-box',
4744
'innmind/black-box-symfony',
4845
'innmind/cli',
@@ -57,6 +54,7 @@ public function testInvokation()
5754
'innmind/dependency-graph',
5855
'innmind/di',
5956
'innmind/doctrine',
57+
'innmind/encoding',
6058
'innmind/event-bus',
6159
'innmind/file-watch',
6260
'innmind/filesystem',
@@ -93,7 +91,6 @@ public function testInvokation()
9391
'innmind/mantle',
9492
'innmind/math',
9593
'innmind/media-type',
96-
'innmind/neo4j-dbal',
9794
'innmind/neo4j-onm',
9895
'innmind/object-graph',
9996
'innmind/operating-system',
@@ -125,6 +122,7 @@ public function testInvokation()
125122
'innmind/url',
126123
'innmind/url-resolver',
127124
'innmind/url-template',
125+
'innmind/validation',
128126
'innmind/virtual-machine',
129127
'innmind/warden',
130128
'innmind/xml',

‎tests/Loader/VendorTest.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ public function testInvokation()
2929
'innmind/amqp',
3030
'innmind/ark',
3131
'innmind/async-http-server',
32-
'innmind/async-operating-system',
33-
'innmind/async-socket',
34-
'innmind/async-stream',
35-
'innmind/async-time-warp',
3632
'innmind/black-box',
3733
'innmind/black-box-symfony',
3834
'innmind/cli',
@@ -45,6 +41,7 @@ public function testInvokation()
4541
'innmind/dependency-graph',
4642
'innmind/di',
4743
'innmind/doctrine',
44+
'innmind/encoding',
4845
'innmind/file-watch',
4946
'innmind/filesystem',
5047
'innmind/framework',
@@ -79,8 +76,6 @@ public function testInvokation()
7976
'innmind/mantle',
8077
'innmind/math',
8178
'innmind/media-type',
82-
'innmind/neo4j-dbal',
83-
'innmind/neo4j-onm',
8479
'innmind/object-graph',
8580
'innmind/operating-system',
8681
'innmind/process-manager',
@@ -109,6 +104,7 @@ public function testInvokation()
109104
'innmind/url',
110105
'innmind/url-resolver',
111106
'innmind/url-template',
107+
'innmind/validation',
112108
'innmind/virtual-machine',
113109
'innmind/warden',
114110
'innmind/xml',

0 commit comments

Comments
 (0)
Please sign in to comment.