Skip to content

Commit

Permalink
fix: Fixed backwards compatibility for older PsySH/Laravel versions (…
Browse files Browse the repository at this point in the history
…PHP >= 7.0, Laravel >= 5.5)
  • Loading branch information
Roboroads committed Jun 19, 2024
1 parent b13ace5 commit 7be6c52
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 3 deletions.
79 changes: 79 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/phpunit.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions src/main/resources/scripts/tinker_run.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@
'prompt' => '',
'theme' => 'compact',
]);
$config->setRawOutput(true);
if (method_exists($config, 'setRawOutput')) {
$config->setRawOutput(true);
}
if (method_exists($config, 'setInteractiveMode')) {
$config->setInteractiveMode(Configuration::INTERACTIVE_MODE_DISABLED);
}
$config->setColorMode(Configuration::COLOR_MODE_FORCED);
$config->setInteractiveMode(Configuration::INTERACTIVE_MODE_DISABLED);

$casters = [
'Illuminate\Support\Collection' => 'Laravel\Tinker\TinkerCaster::castCollection',
Expand Down Expand Up @@ -63,7 +67,7 @@
$sanitizedRunCode = '';
foreach($unsanitizedRunCode as $token) {
if (!is_string($token)) {
[$id, $token] = $token;
list($id, $token) = $token;
if (in_array($id, [T_COMMENT, T_DOC_COMMENT, T_OPEN_TAG, T_OPEN_TAG_WITH_ECHO, T_CLOSE_TAG], true)) {
continue;
}
Expand Down

0 comments on commit 7be6c52

Please sign in to comment.