1 | <?php |
||
10 | class Neuron implements Node |
||
11 | { |
||
12 | /** |
||
13 | * @var Synapse[] |
||
14 | */ |
||
15 | protected $synapses; |
||
16 | |||
17 | /** |
||
18 | * @var ActivationFunction |
||
19 | */ |
||
20 | protected $activationFunction; |
||
21 | |||
22 | /** |
||
23 | * @var float |
||
24 | */ |
||
25 | protected $output; |
||
26 | |||
27 | /** |
||
28 | * @param ActivationFunction|null $activationFunction |
||
29 | */ |
||
30 | public function __construct(ActivationFunction $activationFunction = null) |
||
36 | |||
37 | /** |
||
38 | * @param Synapse $synapse |
||
39 | */ |
||
40 | public function addSynapse(Synapse $synapse) |
||
44 | |||
45 | /** |
||
46 | * @return Synapse[] |
||
47 | */ |
||
48 | public function getSynapses() |
||
52 | |||
53 | /** |
||
54 | * @return float |
||
55 | */ |
||
56 | public function getOutput(): float |
||
69 | |||
70 | public function refresh() |
||
74 | } |
||
75 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.