1 | <?php |
||
29 | class PrepareCommitMsg extends Hook |
||
30 | { |
||
31 | /** |
||
32 | * Hook to execute |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $hookName = Hooks::PREPARE_COMMIT_MSG; |
||
37 | |||
38 | /** |
||
39 | * File to read/write the commit message from/to |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | private $file; |
||
44 | |||
45 | /** |
||
46 | * Commit mode [null|message|template|merge|squash|commit] |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | private $mode; |
||
51 | |||
52 | /** |
||
53 | * Commit hash if mode is commit during -c or --amend |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | private $hash; |
||
58 | |||
59 | /** |
||
60 | * Configure the command |
||
61 | */ |
||
62 | 1 | protected function configure() |
|
69 | /** |
||
70 | * Read the commit message from file |
||
71 | * |
||
72 | * @param \Symfony\Component\Console\Input\InputInterface $input |
||
73 | * @param \Symfony\Component\Console\Output\OutputInterface $output |
||
74 | * @param \CaptainHook\App\Config $config |
||
75 | * @param \SebastianFeldmann\Git\Repository $repository |
||
76 | */ |
||
77 | 1 | protected function setup(InputInterface $input, OutputInterface $output, Config $config, Repository $repository) |
|
89 | |||
90 | /** |
||
91 | * Post action after all the configured actions are executed |
||
92 | * |
||
93 | * @param \Symfony\Component\Console\Input\InputInterface $input |
||
94 | * @param \Symfony\Component\Console\Output\OutputInterface $output |
||
95 | * @param \CaptainHook\App\Config $config |
||
96 | * @param \SebastianFeldmann\Git\Repository $repository |
||
97 | */ |
||
98 | 1 | protected function tearDown(InputInterface $input, OutputInterface $output, Config $config, Repository $repository) |
|
102 | } |
||
103 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.