Skip to content
This repository was archived by the owner on Feb 6, 2020. It is now read-only.

Commit d464520

Browse files
committed
Removes extraneous whitespace and adds array typehint
Also updates test exception message expectations to match changes in class.
1 parent 52e117e commit d464520

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

src/Exception/CyclicAliasException.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ class CyclicAliasException extends InvalidArgumentException
2222
/**
2323
* @param string $alias conflicting alias key
2424
* @param string[] $aliases map of referenced services, indexed by alias name (string)
25-
*
2625
* @return self
2726
*/
28-
public static function fromCyclicAlias($alias, $aliases)
27+
public static function fromCyclicAlias($alias, array $aliases)
2928
{
3029
$cycle = $alias;
3130
$cursor = $alias;
@@ -36,14 +35,13 @@ public static function fromCyclicAlias($alias, $aliases)
3635
$cycle .= ' -> ' . $alias . "\n";
3736

3837
return new self(sprintf(
39-
"A cycle was detected within the aliases defintions:\n%s",
38+
"A cycle was detected within the aliases definitions:\n%s",
4039
$cycle
4140
));
4241
}
4342

4443
/**
4544
* @param string[] $aliases map of referenced services, indexed by alias name (string)
46-
*
4745
* @return self
4846
*/
4947
public static function fromAliasesMap(array $aliases)
@@ -75,7 +73,6 @@ function ($alias) use ($aliases) {
7573
*
7674
* @param string[] $aliases
7775
* @param string $alias
78-
*
7976
* @return array|null
8077
*/
8178
private static function getCycleFor(array $aliases, $alias)
@@ -89,7 +86,6 @@ private static function getCycleFor(array $aliases, $alias)
8986
}
9087

9188
$cycleCandidate[$targetName] = true;
92-
9389
$targetName = $aliases[$targetName];
9490
}
9591

@@ -98,7 +94,6 @@ private static function getCycleFor(array $aliases, $alias)
9894

9995
/**
10096
* @param string[] $aliases
101-
*
10297
* @return string
10398
*/
10499
private static function printReferencesMap(array $aliases)
@@ -114,7 +109,6 @@ private static function printReferencesMap(array $aliases)
114109

115110
/**
116111
* @param string[][] $detectedCycles
117-
*
118112
* @return string
119113
*/
120114
private static function printCycles(array $detectedCycles)
@@ -124,7 +118,6 @@ private static function printCycles(array $detectedCycles)
124118

125119
/**
126120
* @param string[] $detectedCycle
127-
*
128121
* @return string
129122
*/
130123
private static function printCycle(array $detectedCycle)
@@ -145,7 +138,6 @@ function ($cycle) {
145138

146139
/**
147140
* @param bool[][] $detectedCycles
148-
*
149141
* @return bool[][] de-duplicated
150142
*/
151143
private static function deDuplicateDetectedCycles(array $detectedCycles)

test/Exception/CyclicAliasExceptionTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function cyclicAliasProvider()
4444
[
4545
'a' => 'a',
4646
],
47-
"A cycle was detected within the aliases defintions:\n"
47+
"A cycle was detected within the aliases definitions:\n"
4848
. "a -> a\n",
4949
],
5050
[
@@ -53,7 +53,7 @@ public function cyclicAliasProvider()
5353
'a' => 'b',
5454
'b' => 'a'
5555
],
56-
"A cycle was detected within the aliases defintions:\n"
56+
"A cycle was detected within the aliases definitions:\n"
5757
. "a -> b -> a\n",
5858
],
5959
[
@@ -62,7 +62,7 @@ public function cyclicAliasProvider()
6262
'a' => 'b',
6363
'b' => 'a'
6464
],
65-
"A cycle was detected within the aliases defintions:\n"
65+
"A cycle was detected within the aliases definitions:\n"
6666
. "b -> a -> b\n",
6767
],
6868
[
@@ -71,7 +71,7 @@ public function cyclicAliasProvider()
7171
'a' => 'b',
7272
'b' => 'a',
7373
],
74-
"A cycle was detected within the aliases defintions:\n"
74+
"A cycle was detected within the aliases definitions:\n"
7575
. "b -> a -> b\n",
7676
],
7777
[
@@ -81,7 +81,7 @@ public function cyclicAliasProvider()
8181
'b' => 'c',
8282
'c' => 'a',
8383
],
84-
"A cycle was detected within the aliases defintions:\n"
84+
"A cycle was detected within the aliases definitions:\n"
8585
. "a -> b -> c -> a\n",
8686
],
8787
[
@@ -91,7 +91,7 @@ public function cyclicAliasProvider()
9191
'b' => 'c',
9292
'c' => 'a',
9393
],
94-
"A cycle was detected within the aliases defintions:\n"
94+
"A cycle was detected within the aliases definitions:\n"
9595
. "b -> c -> a -> b\n",
9696
],
9797
[
@@ -101,7 +101,7 @@ public function cyclicAliasProvider()
101101
'b' => 'c',
102102
'c' => 'a',
103103
],
104-
"A cycle was detected within the aliases defintions:\n"
104+
"A cycle was detected within the aliases definitions:\n"
105105
. "c -> a -> b -> c\n",
106106
],
107107
];

0 commit comments

Comments
 (0)