File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 1313 * the LICENSE file that was distributed with this source code.
1414 */
1515
16- error_reporting (E_ERROR & E_USER_ERROR );
16+ // Log all errors when requiring autoloader
17+ error_reporting (E_ALL );
1718
1819$ VERSION = '1.2.3 ' ;
1920
3233
3334use Yannoff \Component \Console \Application ;
3435use Yannoff \PhpCodeCompiler \Command \Compile ;
36+ use Yannoff \PhpCodeCompiler \Phar ;
37+
38+ // If the script is executed from the compiled phar, lower error log level
39+ if (Phar::runsInPhar ()) {
40+ error_reporting (E_ERROR & E_USER_ERROR );
41+ }
3542
3643$ app = new Application ('PHP Code Compiler ' , $ VERSION , (new Compile ()));
3744$ app ->run ();
Original file line number Diff line number Diff line change @@ -49,4 +49,16 @@ public function has(string $file): bool
4949 {
5050 return $ this ->offsetExists ($ file );
5151 }
52+
53+ /**
54+ * Check whether the script is run from inside a Phar
55+ *
56+ * @return bool
57+ */
58+ static public function runsInPhar ()
59+ {
60+ @list ($ protocol , $ uri ) = explode (':// ' , __DIR__ );
61+
62+ return $ protocol == 'phar ' ;
63+ }
5264}
You can’t perform that action at this time.
0 commit comments