1 | <?php |
||
11 | class Neuron implements Node |
||
12 | { |
||
13 | /** |
||
14 | * @var Synapse[] |
||
15 | */ |
||
16 | protected $synapses; |
||
17 | |||
18 | /** |
||
19 | * @var ActivationFunction |
||
20 | */ |
||
21 | protected $activationFunction; |
||
22 | |||
23 | /** |
||
24 | * @var float |
||
25 | */ |
||
26 | protected $output; |
||
27 | |||
28 | /** |
||
29 | * @param ActivationFunction|null $activationFunction |
||
30 | */ |
||
31 | public function __construct(ActivationFunction $activationFunction = null) |
||
37 | |||
38 | /** |
||
39 | * @param Synapse $synapse |
||
40 | */ |
||
41 | public function addSynapse(Synapse $synapse) |
||
45 | |||
46 | /** |
||
47 | * @return Synapse[] |
||
48 | */ |
||
49 | public function getSynapses() |
||
53 | |||
54 | /** |
||
55 | * @return float |
||
56 | */ |
||
57 | public function getOutput(): float |
||
70 | |||
71 | public function reset() |
||
75 | } |
||
76 |
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.