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 = array( |
||
24 | 'symfony-app-dir' => 'app', |
||
25 | 'symfony-web-dir' => 'web', |
||
26 | 'symfony-assets-install' => 'hard', |
||
27 | 'symfony-cache-warmup' => false, |
||
28 | ); |
||
29 | |||
30 | /** |
||
31 | * @param Event $event |
||
32 | */ |
||
33 | public static function updateDatabase(Event $event) |
||
44 | |||
45 | /** |
||
46 | * @param Event $event |
||
47 | * @param string $cmd |
||
48 | * @param int $timeout |
||
49 | */ |
||
50 | private static function executeCommand(Event $event, $consoleDir, $cmd, $timeout = 300) |
||
70 | |||
71 | /** |
||
72 | * @param Event $event |
||
73 | * |
||
74 | * @return array |
||
75 | */ |
||
76 | protected static function getOptions(Event $event) |
||
87 | |||
88 | /** |
||
89 | * Returns a relative path to the directory that contains the `console` command. |
||
90 | * |
||
91 | * @param Event $event The command event |
||
92 | * @param string $actionName The name of the action |
||
93 | * |
||
94 | * @return string|null The path to the console directory, null if not found. |
||
95 | */ |
||
96 | private static function getConsoleDir(Event $event, $actionName) |
||
114 | |||
115 | /** |
||
116 | * @param Event $event |
||
117 | * @param string $configName |
||
118 | * @param string $path |
||
119 | * @param string $actionName |
||
120 | * |
||
121 | * @return bool |
||
122 | */ |
||
123 | private static function hasDirectory(Event $event, $configName, $path, $actionName) |
||
133 | |||
134 | /** |
||
135 | * Returns true if the new directory structure is used. |
||
136 | * |
||
137 | * @param array $options Composer options |
||
138 | * |
||
139 | * @return bool |
||
140 | */ |
||
141 | private static function useNewDirectoryStructure(array $options) |
||
145 | |||
146 | /** |
||
147 | * Get path to php executable. |
||
148 | * |
||
149 | * @param bool $include_args |
||
150 | * |
||
151 | * @throws \RuntimeException |
||
152 | * |
||
153 | * @return string |
||
154 | */ |
||
155 | private static function getPhp($include_args = true) |
||
164 | |||
165 | /** |
||
166 | * @return array |
||
167 | */ |
||
168 | private static function getPhpArguments() |
||
190 | } |
||
191 |
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: