Skip to content

Commit 8846e11

Browse files
authored
Merge pull request #37 from wayfair-contribs/fix_native_function_invocation
Automated native_function_invocation fixes
2 parents 0578e52 + 099e7eb commit 8846e11

27 files changed

+70
-70
lines changed

src/Bipartit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function getColors()
6060
// breadth search all vertices in same component
6161
do {
6262
// next vertex in color
63-
$vertex = array_shift($queue);
63+
$vertex = \array_shift($queue);
6464
$color = $colors[$vertex->getId()];
6565
$nextColor = 1-$color;
6666

src/ConnectedComponents.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function isSingle()
7878
}
7979
$alg = $this->createSearch($vertex);
8080

81-
return (count($this->graph->getVertices()) === count($alg->getVertices()));
81+
return (\count($this->graph->getVertices()) === \count($alg->getVertices()));
8282
}
8383

8484
/**

src/Degree.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function isVertexSink(Vertex $vertex)
164164
*/
165165
public function getDegreeVertex(Vertex $vertex)
166166
{
167-
return count($vertex->getEdges());
167+
return \count($vertex->getEdges());
168168
}
169169

170170
/**

src/Groups.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Groups extends BaseGraph
1616
*/
1717
public function getNumberOfGroups()
1818
{
19-
return count($this->getGroups());
19+
return \count($this->getGroups());
2020
}
2121

2222
/**
@@ -63,7 +63,7 @@ public function getGroups()
6363
$groups[$vertex->getGroup()] = true;
6464
}
6565

66-
return array_keys($groups);
66+
return \array_keys($groups);
6767
}
6868

6969
/**

src/MaximumMatching/Base.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ abstract class Base extends BaseGraph
1818
*/
1919
public function getNumberOfMatches()
2020
{
21-
return count($this->getEdges());
21+
return \count($this->getEdges());
2222
}
2323

2424
/**

src/MinimumSpanningTree/Kruskal.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function getEdges()
103103
$worseColor = $bColor;
104104

105105
// more vertices with color a => paint all in b in a's color
106-
if (count($colorVertices[$bColor]) > count($colorVertices[$aColor])) {
106+
if (\count($colorVertices[$bColor]) > \count($colorVertices[$aColor])) {
107107
$betterColor = $bColor;
108108
$worseColor = $aColor;
109109
}
@@ -125,7 +125,7 @@ public function getEdges()
125125

126126
// definition of spanning tree: number of edges = number of vertices - 1
127127
// above algorithm does not check isolated edges or may otherwise return multiple connected components => force check
128-
if (count($returnEdges) !== (count($this->graph->getVertices()) - 1)) {
128+
if (\count($returnEdges) !== (\count($this->graph->getVertices()) - 1)) {
129129
throw new UnexpectedValueException('Graph is not connected');
130130
}
131131

src/MinimumSpanningTree/Prim.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function getEdges()
3535
$returnEdges = array();
3636

3737
// iterate n-1 times (per definition, resulting MST MUST have n-1 edges)
38-
for ($i = 0, $n = count($this->startVertex->getGraph()->getVertices()) - 1; $i < $n; ++$i) {
38+
for ($i = 0, $n = \count($this->startVertex->getGraph()->getVertices()) - 1; $i < $n; ++$i) {
3939
$markInserted[$vertexCurrent->getId()] = true;
4040

4141
// get unvisited vertex of the edge and add edges from new vertex

src/Parallel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function getEdgesParallelEdge(Edge $edge)
6868
$edges = $ends->getVertexFirst()->getEdges()->getEdgesIntersection($ends->getVertexLast()->getEdges())->getVector();
6969
}
7070

71-
$pos = array_search($edge, $edges, true);
71+
$pos = \array_search($edge, $edges, true);
7272

7373
if ($pos === false) {
7474
// @codeCoverageIgnoreStart
@@ -79,6 +79,6 @@ public function getEdgesParallelEdge(Edge $edge)
7979
// exclude current edge from parallel edges
8080
unset($edges[$pos]);
8181

82-
return new Edges(array_values($edges));
82+
return new Edges(\array_values($edges));
8383
}
8484
}

src/Property/GraphProperty.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ public function isNull()
4646
*/
4747
public function isTrivial()
4848
{
49-
return ($this->graph->getEdges()->isEmpty() && count($this->graph->getVertices()) === 1);
49+
return ($this->graph->getEdges()->isEmpty() && \count($this->graph->getVertices()) === 1);
5050
}
5151
}

src/Property/WalkProperty.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function hasCycle()
162162
*/
163163
public function isLoop()
164164
{
165-
return (count($this->walk->getEdges()) === 1 && $this->isCycle());
165+
return (\count($this->walk->getEdges()) === 1 && $this->isCycle());
166166
}
167167

168168
/**
@@ -214,11 +214,11 @@ public function hasLoop()
214214
public function isDigon()
215215
{
216216
// exactly 2 edges
217-
return (count($this->walk->getEdges()) === 2 &&
217+
return (\count($this->walk->getEdges()) === 2 &&
218218
// no duplicate edges
219219
!$this->hasArrayDuplicates($this->walk->getEdges()->getVector()) &&
220220
// exactly two distinct vertices
221-
count($this->walk->getVertices()->getVerticesDistinct()) === 2 &&
221+
\count($this->walk->getVertices()->getVerticesDistinct()) === 2 &&
222222
// this is actually a cycle
223223
$this->isCycle());
224224
}
@@ -238,9 +238,9 @@ public function isDigon()
238238
public function isTriangle()
239239
{
240240
// exactly 3 (implicitly distinct) edges
241-
return (count($this->walk->getEdges()) === 3 &&
241+
return (\count($this->walk->getEdges()) === 3 &&
242242
// exactly three distinct vertices
243-
count($this->walk->getVertices()->getVerticesDistinct()) === 3 &&
243+
\count($this->walk->getVertices()->getVerticesDistinct()) === 3 &&
244244
// this is actually a cycle
245245
$this->isCycle());
246246
}
@@ -347,7 +347,7 @@ private function hasArrayDuplicates($array)
347347
$compare = array();
348348
foreach ($array as $element) {
349349
// duplicate element found
350-
if (in_array($element, $compare, true)) {
350+
if (\in_array($element, $compare, true)) {
351351
return true;
352352
} else {
353353
// add element to temporary array to check for duplicates
@@ -368,7 +368,7 @@ private function hasArrayDuplicates($array)
368368
private function isArrayContentsEqual($a, $b)
369369
{
370370
foreach ($b as $one) {
371-
$pos = array_search($one, $a, true);
371+
$pos = \array_search($one, $a, true);
372372
if ($pos === false) {
373373
return false;
374374
} else {

0 commit comments

Comments
 (0)