@@ -11,12 +11,25 @@ abstract class BaseLoader implements LoaderInterface
1111{
1212 protected Tinker $ tinker ;
1313
14- public function init ()
14+ public function init (): void
1515 {
1616 $ config = new Configuration ([
1717 'configFile ' => null ,
1818 ]);
1919 $ config ->setUpdateCheck (Checker::NEVER );
20+ $ config ->setRawOutput (true );
21+ $ config ->setInteractiveMode (Configuration::INTERACTIVE_MODE_DISABLED );
22+ $ config ->setColorMode (Configuration::COLOR_MODE_DISABLED );
23+ $ config ->setTheme ([
24+ 'prompt ' => '' ,
25+ ]);
26+ $ config ->setVerbosity (Configuration::VERBOSITY_QUIET );
27+ $ config ->setHistoryFile (defined ('PHP_WINDOWS_VERSION_BUILD ' ) ? 'null ' : '/dev/null ' );
28+ $ config ->setRawOutput (false );
29+ if (getenv ('KUBERNETES_SERVICE_HOST ' ) || defined ('PHP_WINDOWS_VERSION_BUILD ' )) {
30+ $ config ->setUsePcntl (false );
31+ }
32+
2033 if (class_exists ('Illuminate\Support\Collection ' ) && class_exists ('Laravel\Tinker\TinkerCaster ' )) {
2134 $ config ->getPresenter ()->addCasters ([
2235 \Illuminate \Support \Collection::class => 'Laravel\Tinker\TinkerCaster::castCollection ' ,
@@ -32,15 +45,14 @@ public function init()
3245 \Illuminate \Foundation \Application::class => 'Laravel\Tinker\TinkerCaster::castApplication ' ,
3346 ]);
3447 }
35- $ config ->setRawOutput (true );
3648
37- $ this ->tinker = new Tinker (new CustomOutputModifier () , $ config );
49+ $ this ->tinker = new Tinker (new CustomOutputModifier , $ config );
3850 }
3951
40- public function execute (string $ code )
52+ public function execute (string $ code ): string
4153 {
4254 $ output = $ this ->tinker ->execute ($ code );
4355
44- echo trim ($ output );
56+ return trim ($ output );
4557 }
46- }
58+ }
0 commit comments