Mercurial > hg > isophonics-drupal-site
comparison vendor/psy/psysh/src/ExecutionLoop/RunkitReloader.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 5fb285c0d0e3 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
28 * | 28 * |
29 * @return bool | 29 * @return bool |
30 */ | 30 */ |
31 public static function isSupported() | 31 public static function isSupported() |
32 { | 32 { |
33 return extension_loaded('runkit'); | 33 return \extension_loaded('runkit'); |
34 } | 34 } |
35 | 35 |
36 /** | 36 /** |
37 * Construct a Runkit Reloader. | 37 * Construct a Runkit Reloader. |
38 * | 38 * |
60 * | 60 * |
61 * @param Shell $shell | 61 * @param Shell $shell |
62 */ | 62 */ |
63 private function reload(Shell $shell) | 63 private function reload(Shell $shell) |
64 { | 64 { |
65 clearstatcache(); | 65 \clearstatcache(); |
66 $modified = []; | 66 $modified = []; |
67 | 67 |
68 foreach (get_included_files() as $file) { | 68 foreach (\get_included_files() as $file) { |
69 $timestamp = filemtime($file); | 69 $timestamp = \filemtime($file); |
70 | 70 |
71 if (!isset($this->timestamps[$file])) { | 71 if (!isset($this->timestamps[$file])) { |
72 $this->timestamps[$file] = $timestamp; | 72 $this->timestamps[$file] = $timestamp; |
73 continue; | 73 continue; |
74 } | 74 } |
76 if ($this->timestamps[$file] === $timestamp) { | 76 if ($this->timestamps[$file] === $timestamp) { |
77 continue; | 77 continue; |
78 } | 78 } |
79 | 79 |
80 if (!$this->lintFile($file)) { | 80 if (!$this->lintFile($file)) { |
81 $msg = sprintf('Modified file "%s" could not be reloaded', $file); | 81 $msg = \sprintf('Modified file "%s" could not be reloaded', $file); |
82 $shell->writeException(new ParseErrorException($msg)); | 82 $shell->writeException(new ParseErrorException($msg)); |
83 continue; | 83 continue; |
84 } | 84 } |
85 | 85 |
86 $modified[] = $file; | 86 $modified[] = $file; |
123 */ | 123 */ |
124 private function lintFile($file) | 124 private function lintFile($file) |
125 { | 125 { |
126 // first try to parse it | 126 // first try to parse it |
127 try { | 127 try { |
128 $this->parser->parse(file_get_contents($file)); | 128 $this->parser->parse(\file_get_contents($file)); |
129 } catch (\Exception $e) { | 129 } catch (\Exception $e) { |
130 return false; | 130 return false; |
131 } | 131 } |
132 | 132 |
133 return true; | 133 return true; |