1 | <?php |
||
16 | class ScriptHandler |
||
17 | { |
||
18 | /** |
||
19 | * Composer variables are declared static so that an event could update |
||
20 | * a composer.json and set new options, making them immediately available |
||
21 | * to forthcoming listeners. |
||
22 | */ |
||
23 | private static $options = [ |
||
24 | 'symfony-app-dir' => 'app', |
||
25 | ]; |
||
26 | |||
27 | /** |
||
28 | * @param Event $event |
||
29 | */ |
||
30 | public static function updateDatabase(Event $event) |
||
41 | |||
42 | /** |
||
43 | * @param Event $event |
||
44 | * @param string $console_dir |
||
45 | * @param string $cmd |
||
46 | * @param int $timeout |
||
47 | */ |
||
48 | protected static function executeCommand(Event $event, $console_dir, $cmd, $timeout = 300) |
||
70 | |||
71 | /** |
||
72 | * @param Event $event |
||
73 | * |
||
74 | * @return array |
||
75 | */ |
||
76 | protected static function getOptions(Event $event) |
||
84 | |||
85 | /** |
||
86 | * Returns a relative path to the directory that contains the `console` command or null if not found. |
||
87 | * |
||
88 | * @param Event $event The command event |
||
89 | * @param string $action_name The name of the action |
||
90 | * |
||
91 | * @return string|null |
||
92 | */ |
||
93 | protected static function getConsoleDir(Event $event, $action_name) |
||
111 | |||
112 | /** |
||
113 | * @param Event $event |
||
114 | * @param string $config_name |
||
115 | * @param string $path |
||
116 | * @param string $action_name |
||
117 | * |
||
118 | * @return bool |
||
119 | */ |
||
120 | private static function hasDirectory(Event $event, $config_name, $path, $action_name) |
||
136 | |||
137 | /** |
||
138 | * Returns true if the new directory structure is used. |
||
139 | * |
||
140 | * @param array $options Composer options |
||
141 | * |
||
142 | * @return bool |
||
143 | */ |
||
144 | private static function useNewDirectoryStructure(array $options) |
||
148 | |||
149 | /** |
||
150 | * Get path to php executable. |
||
151 | * |
||
152 | * @param bool $include_args |
||
153 | * |
||
154 | * @throws \RuntimeException |
||
155 | * |
||
156 | * @return string |
||
157 | */ |
||
158 | private static function getPhp($include_args = true) |
||
167 | |||
168 | /** |
||
169 | * @return array |
||
170 | */ |
||
171 | private static function getPhpArguments() |
||
193 | } |
||
194 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: