Issues (34)

src/Edge/Specifics/WeightedEdgeSpecifics.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace Graphp\Edge\Specifics;
4
5
use Graphp\Edge\EdgeInterface;
6
use Graphp\Vertex\VertexInterface;
7
8
/**
9
 * Class WeightedEdgeSpecifics
10
 *
11
 * @package Graphp\Edge\Specifics
12
 */
13
class WeightedEdgeSpecifics extends UniformEdgeSpecifics
14
{
15
    /**
16
     * Get the edge weight
17
     *
18
     * @param EdgeInterface $edge - the edge
19
     *
20
     * @return null|float
21
     */
22 8
    public function getEdgeWeight(EdgeInterface $edge): ?float
23
    {
24 8
        return $edge->getWeight();
0 ignored issues
show
The method getWeight() does not exist on Graphp\Edge\EdgeInterface. It seems like you code against a sub-type of Graphp\Edge\EdgeInterface such as Graphp\Edge\DefaultWeightedEdge. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        return $edge->/** @scrutinizer ignore-call */ getWeight();
Loading history...
25
    }
26
    
27
    /**
28
     * Set the edge weight
29
     *
30
     * @param EdgeInterface $edge - the edge
31
     * @param float $weight - the weight
32
     */
33 9
    public function setEdgeWeight(EdgeInterface $edge, ?float $weight = null): void
34
    {
35 9
        $edge->setWeight($weight);
0 ignored issues
show
The method setWeight() does not exist on Graphp\Edge\EdgeInterface. It seems like you code against a sub-type of Graphp\Edge\EdgeInterface such as Graphp\Edge\DefaultWeightedEdge. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
        $edge->/** @scrutinizer ignore-call */ 
36
               setWeight($weight);
Loading history...
36 9
    }
37
}
38