Reedy has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/394514 )
Change subject: Update psy/psyssh from 0.8.11 to 0.8.15 ...................................................................... Update psy/psyssh from 0.8.11 to 0.8.15 https://github.com/bobthecow/psysh/releases/tag/v0.8.12 https://github.com/bobthecow/psysh/releases/tag/v0.8.13 https://github.com/bobthecow/psysh/releases/tag/v0.8.14 https://github.com/bobthecow/psysh/releases/tag/v0.8.15 https://github.com/bobthecow/psysh/compare/v0.8.11...v0.8.15 Change-Id: If03398bbc565c03987ef843534ab1ee3a4779ca1 --- M composer.json M composer.lock M composer/autoload_classmap.php M composer/autoload_static.php M composer/installed.json M psy/psysh/.gitignore M psy/psysh/.styleci.yml M psy/psysh/.travis.yml M psy/psysh/composer.json M psy/psysh/src/Psy/CodeCleaner/FunctionReturnInWriteContextPass.php M psy/psysh/src/Psy/Command/DocCommand.php A psy/psysh/src/Psy/Command/EditCommand.php M psy/psysh/src/Psy/Command/ListCommand.php M psy/psysh/src/Psy/Command/ListCommand/ClassEnumerator.php M psy/psysh/src/Psy/Command/ListCommand/ConstantEnumerator.php M psy/psysh/src/Psy/Command/ListCommand/InterfaceEnumerator.php M psy/psysh/src/Psy/Command/ListCommand/TraitEnumerator.php M psy/psysh/src/Psy/Command/WhereamiCommand.php M psy/psysh/src/Psy/ConfigPaths.php M psy/psysh/src/Psy/Configuration.php M psy/psysh/src/Psy/Exception/ErrorException.php M psy/psysh/src/Psy/Input/ShellInput.php M psy/psysh/src/Psy/Shell.php A psy/psysh/src/Psy/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php M psy/psysh/src/Psy/TabCompletion/Matcher/ClassAttributesMatcher.php A psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php M psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodsMatcher.php A psy/psysh/src/Psy/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php M psy/psysh/src/Psy/TabCompletion/Matcher/ObjectAttributesMatcher.php A psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php M psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php M psy/psysh/src/Psy/VarDumper/Dumper.php M psy/psysh/src/Psy/VarDumper/Presenter.php M psy/psysh/src/Psy/VersionUpdater/GitHubChecker.php M psy/psysh/src/Psy/functions.php M psy/psysh/test/Psy/Test/AutoloaderTest.php M psy/psysh/test/Psy/Test/CodeCleaner/CodeCleanerTestCase.php M psy/psysh/test/Psy/Test/CodeCleaner/FunctionReturnInWriteContextPassTest.php M psy/psysh/test/Psy/Test/CodeCleanerTest.php M psy/psysh/test/Psy/Test/ConfigurationTest.php M psy/psysh/test/Psy/Test/ConsoleColorFactoryTest.php M psy/psysh/test/Psy/Test/Exception/BreakExceptionTest.php M psy/psysh/test/Psy/Test/Exception/ErrorExceptionTest.php M psy/psysh/test/Psy/Test/Exception/FatalErrorExceptionTest.php M psy/psysh/test/Psy/Test/Exception/ParseErrorExceptionTest.php M psy/psysh/test/Psy/Test/Exception/RuntimeExceptionTest.php M psy/psysh/test/Psy/Test/Formatter/CodeFormatterTest.php M psy/psysh/test/Psy/Test/Formatter/DocblockFormatterTest.php M psy/psysh/test/Psy/Test/Formatter/SignatureFormatterTest.php M psy/psysh/test/Psy/Test/Input/CodeArgumentTest.php M psy/psysh/test/Psy/Test/Input/ShellInputTest.php M psy/psysh/test/Psy/Test/Readline/GNUReadlineTest.php M psy/psysh/test/Psy/Test/Readline/HoaConsoleTest.php M psy/psysh/test/Psy/Test/Readline/LibeditTest.php M psy/psysh/test/Psy/Test/Readline/TransientTest.php M psy/psysh/test/Psy/Test/Reflection/ReflectionConstantTest.php M psy/psysh/test/Psy/Test/ShellTest.php M psy/psysh/test/Psy/Test/TabCompletion/AutoCompleterTest.php M psy/psysh/test/Psy/Test/Util/DocblockTest.php M psy/psysh/test/Psy/Test/Util/MirrorTest.php M psy/psysh/test/Psy/Test/Util/StrTest.php M psy/psysh/test/Psy/Test/VersionUpdater/GitHubCheckerTest.php 62 files changed, 905 insertions(+), 184 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vendor refs/changes/14/394514/1 diff --git a/composer.json b/composer.json index 087e52f..f70f4a8 100644 --- a/composer.json +++ b/composer.json @@ -96,7 +96,7 @@ "php": ">=5.5.9", "pimple/pimple": "3.0.2", "psr/log": "1.0.2", - "psy/psysh": "0.8.11", + "psy/psysh": "0.8.15", "ruflin/elastica": "5.3.0", "serialization/serialization": "3.2.2", "stil/gd-text": "1.0.0", diff --git a/composer.lock b/composer.lock index dbad8e6..f4f365e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "75dfcdd9f65a99995bfd9302c0096caf", + "content-hash": "8f7c0f6b85df2fe0ec83fa2ec6f8e97f", "packages": [ { "name": "composer/semver", @@ -1891,16 +1891,16 @@ }, { "name": "psy/psysh", - "version": "v0.8.11", + "version": "v0.8.15", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "b193cd020e8c6b66cea6457826ae005e94e6d2c0" + "reference": "b1d289c2cb03a2f8249912c53e96ced38f879926" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/b193cd020e8c6b66cea6457826ae005e94e6d2c0", - "reference": "b193cd020e8c6b66cea6457826ae005e94e6d2c0", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/b1d289c2cb03a2f8249912c53e96ced38f879926", + "reference": "b1d289c2cb03a2f8249912c53e96ced38f879926", "shasum": "" }, "require": { @@ -1914,7 +1914,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": "~1.11", "hoa/console": "~3.16|~1.14", - "phpunit/phpunit": "~4.4|~5.0", + "phpunit/phpunit": "^4.8.35|^5.4.3", "symfony/finder": "~2.1|~3.0" }, "suggest": { @@ -1960,7 +1960,7 @@ "interactive", "shell" ], - "time": "2017-07-29T19:30:02+00:00" + "time": "2017-11-16T14:29:51+00:00" }, { "name": "ruflin/elastica", diff --git a/composer/autoload_classmap.php b/composer/autoload_classmap.php index a906060..79db23e 100644 --- a/composer/autoload_classmap.php +++ b/composer/autoload_classmap.php @@ -1103,6 +1103,7 @@ 'Psy\\Command\\Command' => $vendorDir . '/psy/psysh/src/Psy/Command/Command.php', 'Psy\\Command\\DocCommand' => $vendorDir . '/psy/psysh/src/Psy/Command/DocCommand.php', 'Psy\\Command\\DumpCommand' => $vendorDir . '/psy/psysh/src/Psy/Command/DumpCommand.php', + 'Psy\\Command\\EditCommand' => $vendorDir . '/psy/psysh/src/Psy/Command/EditCommand.php', 'Psy\\Command\\ExitCommand' => $vendorDir . '/psy/psysh/src/Psy/Command/ExitCommand.php', 'Psy\\Command\\HelpCommand' => $vendorDir . '/psy/psysh/src/Psy/Command/HelpCommand.php', 'Psy\\Command\\HistoryCommand' => $vendorDir . '/psy/psysh/src/Psy/Command/HistoryCommand.php', @@ -1170,17 +1171,21 @@ 'Psy\\Sudo\\SudoVisitor' => $vendorDir . '/psy/psysh/src/Psy/Sudo/SudoVisitor.php', 'Psy\\TabCompletion\\AutoCompleter' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/AutoCompleter.php', 'Psy\\TabCompletion\\Matcher\\AbstractContextAwareMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractContextAwareMatcher.php', + 'Psy\\TabCompletion\\Matcher\\AbstractDefaultParametersMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php', 'Psy\\TabCompletion\\Matcher\\AbstractMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractMatcher.php', 'Psy\\TabCompletion\\Matcher\\ClassAttributesMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/ClassAttributesMatcher.php', + 'Psy\\TabCompletion\\Matcher\\ClassMethodDefaultParametersMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php', 'Psy\\TabCompletion\\Matcher\\ClassMethodsMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodsMatcher.php', 'Psy\\TabCompletion\\Matcher\\ClassNamesMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/ClassNamesMatcher.php', 'Psy\\TabCompletion\\Matcher\\CommandsMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/CommandsMatcher.php', 'Psy\\TabCompletion\\Matcher\\ConstantsMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/ConstantsMatcher.php', + 'Psy\\TabCompletion\\Matcher\\FunctionDefaultParametersMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php', 'Psy\\TabCompletion\\Matcher\\FunctionsMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/FunctionsMatcher.php', 'Psy\\TabCompletion\\Matcher\\KeywordsMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/KeywordsMatcher.php', 'Psy\\TabCompletion\\Matcher\\MongoClientMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/MongoClientMatcher.php', 'Psy\\TabCompletion\\Matcher\\MongoDatabaseMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/MongoDatabaseMatcher.php', 'Psy\\TabCompletion\\Matcher\\ObjectAttributesMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectAttributesMatcher.php', + 'Psy\\TabCompletion\\Matcher\\ObjectMethodDefaultParametersMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php', 'Psy\\TabCompletion\\Matcher\\ObjectMethodsMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php', 'Psy\\TabCompletion\\Matcher\\VariablesMatcher' => $vendorDir . '/psy/psysh/src/Psy/TabCompletion/Matcher/VariablesMatcher.php', 'Psy\\Util\\Docblock' => $vendorDir . '/psy/psysh/src/Psy/Util/Docblock.php', diff --git a/composer/autoload_static.php b/composer/autoload_static.php index a3f5444..b496766 100644 --- a/composer/autoload_static.php +++ b/composer/autoload_static.php @@ -1476,6 +1476,7 @@ 'Psy\\Command\\Command' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/Command.php', 'Psy\\Command\\DocCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/DocCommand.php', 'Psy\\Command\\DumpCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/DumpCommand.php', + 'Psy\\Command\\EditCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/EditCommand.php', 'Psy\\Command\\ExitCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ExitCommand.php', 'Psy\\Command\\HelpCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/HelpCommand.php', 'Psy\\Command\\HistoryCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/HistoryCommand.php', @@ -1543,17 +1544,21 @@ 'Psy\\Sudo\\SudoVisitor' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Sudo/SudoVisitor.php', 'Psy\\TabCompletion\\AutoCompleter' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/AutoCompleter.php', 'Psy\\TabCompletion\\Matcher\\AbstractContextAwareMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractContextAwareMatcher.php', + 'Psy\\TabCompletion\\Matcher\\AbstractDefaultParametersMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php', 'Psy\\TabCompletion\\Matcher\\AbstractMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractMatcher.php', 'Psy\\TabCompletion\\Matcher\\ClassAttributesMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/ClassAttributesMatcher.php', + 'Psy\\TabCompletion\\Matcher\\ClassMethodDefaultParametersMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php', 'Psy\\TabCompletion\\Matcher\\ClassMethodsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodsMatcher.php', 'Psy\\TabCompletion\\Matcher\\ClassNamesMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/ClassNamesMatcher.php', 'Psy\\TabCompletion\\Matcher\\CommandsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/CommandsMatcher.php', 'Psy\\TabCompletion\\Matcher\\ConstantsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/ConstantsMatcher.php', + 'Psy\\TabCompletion\\Matcher\\FunctionDefaultParametersMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php', 'Psy\\TabCompletion\\Matcher\\FunctionsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/FunctionsMatcher.php', 'Psy\\TabCompletion\\Matcher\\KeywordsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/KeywordsMatcher.php', 'Psy\\TabCompletion\\Matcher\\MongoClientMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/MongoClientMatcher.php', 'Psy\\TabCompletion\\Matcher\\MongoDatabaseMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/MongoDatabaseMatcher.php', 'Psy\\TabCompletion\\Matcher\\ObjectAttributesMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectAttributesMatcher.php', + 'Psy\\TabCompletion\\Matcher\\ObjectMethodDefaultParametersMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php', 'Psy\\TabCompletion\\Matcher\\ObjectMethodsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php', 'Psy\\TabCompletion\\Matcher\\VariablesMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/VariablesMatcher.php', 'Psy\\Util\\Docblock' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Util/Docblock.php', diff --git a/composer/installed.json b/composer/installed.json index beea8ad..7711bd0 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -2330,81 +2330,6 @@ ] }, { - "name": "psy/psysh", - "version": "v0.8.11", - "version_normalized": "0.8.11.0", - "source": { - "type": "git", - "url": "https://github.com/bobthecow/psysh.git", - "reference": "b193cd020e8c6b66cea6457826ae005e94e6d2c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/b193cd020e8c6b66cea6457826ae005e94e6d2c0", - "reference": "b193cd020e8c6b66cea6457826ae005e94e6d2c0", - "shasum": "" - }, - "require": { - "dnoegel/php-xdg-base-dir": "0.1", - "jakub-onderka/php-console-highlighter": "0.3.*", - "nikic/php-parser": "~1.3|~2.0|~3.0", - "php": ">=5.3.9", - "symfony/console": "~2.3.10|^2.4.2|~3.0", - "symfony/var-dumper": "~2.7|~3.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~1.11", - "hoa/console": "~3.16|~1.14", - "phpunit/phpunit": "~4.4|~5.0", - "symfony/finder": "~2.1|~3.0" - }, - "suggest": { - "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", - "ext-pdo-sqlite": "The doc command requires SQLite to work.", - "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", - "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.", - "hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit." - }, - "time": "2017-07-29T19:30:02+00:00", - "bin": [ - "bin/psysh" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.8.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "src/Psy/functions.php" - ], - "psr-4": { - "Psy\\": "src/Psy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Justin Hileman", - "email": "jus...@justinhileman.info", - "homepage": "http://justinhileman.com" - } - ], - "description": "An interactive shell for modern PHP.", - "homepage": "http://psysh.org", - "keywords": [ - "REPL", - "console", - "interactive", - "shell" - ] - }, - { "name": "serialization/serialization", "version": "3.2.2", "version_normalized": "3.2.2.0", @@ -3834,5 +3759,80 @@ ], "description": "Mail_Mime provides classes to create MIME messages", "homepage": "http://pear.php.net/package/Mail_Mime" + }, + { + "name": "psy/psysh", + "version": "v0.8.15", + "version_normalized": "0.8.15.0", + "source": { + "type": "git", + "url": "https://github.com/bobthecow/psysh.git", + "reference": "b1d289c2cb03a2f8249912c53e96ced38f879926" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/b1d289c2cb03a2f8249912c53e96ced38f879926", + "reference": "b1d289c2cb03a2f8249912c53e96ced38f879926", + "shasum": "" + }, + "require": { + "dnoegel/php-xdg-base-dir": "0.1", + "jakub-onderka/php-console-highlighter": "0.3.*", + "nikic/php-parser": "~1.3|~2.0|~3.0", + "php": ">=5.3.9", + "symfony/console": "~2.3.10|^2.4.2|~3.0", + "symfony/var-dumper": "~2.7|~3.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~1.11", + "hoa/console": "~3.16|~1.14", + "phpunit/phpunit": "^4.8.35|^5.4.3", + "symfony/finder": "~2.1|~3.0" + }, + "suggest": { + "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", + "ext-pdo-sqlite": "The doc command requires SQLite to work.", + "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", + "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.", + "hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit." + }, + "time": "2017-11-16T14:29:51+00:00", + "bin": [ + "bin/psysh" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.8.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/Psy/functions.php" + ], + "psr-4": { + "Psy\\": "src/Psy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Hileman", + "email": "jus...@justinhileman.info", + "homepage": "http://justinhileman.com" + } + ], + "description": "An interactive shell for modern PHP.", + "homepage": "http://psysh.org", + "keywords": [ + "REPL", + "console", + "interactive", + "shell" + ] } ] diff --git a/psy/psysh/.gitignore b/psy/psysh/.gitignore index 98f9b0a..d4300e2 100644 --- a/psy/psysh/.gitignore +++ b/psy/psysh/.gitignore @@ -7,3 +7,5 @@ dist/ __pycache__ .php_cs.cache +psysh.phar +psysh-compat.phar diff --git a/psy/psysh/.styleci.yml b/psy/psysh/.styleci.yml index c6fa146..27a247e 100644 --- a/psy/psysh/.styleci.yml +++ b/psy/psysh/.styleci.yml @@ -8,11 +8,16 @@ - strict disabled: + - blank_line_before_break + - blank_line_before_continue + - blank_line_before_throw + - blank_line_before_try - concat_without_spaces - method_argument_space - pre_increment - unalign_double_arrow - unalign_equals + - yoda_style finder: name: diff --git a/psy/psysh/.travis.yml b/psy/psysh/.travis.yml index 428f334..86528da 100644 --- a/psy/psysh/.travis.yml +++ b/psy/psysh/.travis.yml @@ -5,6 +5,7 @@ matrix: include: - php: 5.3 + dist: precise - php: 5.4 - php: 5.5 - php: 5.6 diff --git a/psy/psysh/composer.json b/psy/psysh/composer.json index 17926ef..29f69cd 100644 --- a/psy/psysh/composer.json +++ b/psy/psysh/composer.json @@ -21,7 +21,7 @@ "jakub-onderka/php-console-highlighter": "0.3.*" }, "require-dev": { - "phpunit/phpunit": "~4.4|~5.0", + "phpunit/phpunit": "^4.8.35|^5.4.3", "symfony/finder": "~2.1|~3.0", "friendsofphp/php-cs-fixer": "~1.11", "hoa/console": "~3.16|~1.14" diff --git a/psy/psysh/src/Psy/CodeCleaner/FunctionReturnInWriteContextPass.php b/psy/psysh/src/Psy/CodeCleaner/FunctionReturnInWriteContextPass.php index de25306..42aae5e 100644 --- a/psy/psysh/src/Psy/CodeCleaner/FunctionReturnInWriteContextPass.php +++ b/psy/psysh/src/Psy/CodeCleaner/FunctionReturnInWriteContextPass.php @@ -19,6 +19,7 @@ use PhpParser\Node\Expr\Isset_; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\StaticCall; +use PhpParser\Node\Stmt\Unset_; use Psy\Exception\FatalErrorException; /** @@ -53,17 +54,17 @@ if ($node instanceof Array_ || $this->isCallNode($node)) { $items = $node instanceof Array_ ? $node->items : $node->args; foreach ($items as $item) { - if ($item->byRef && $this->isCallNode($item->value)) { + if ($item && $item->byRef && $this->isCallNode($item->value)) { throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, E_ERROR, null, $node->getLine()); } } - } elseif ($node instanceof Isset_) { + } elseif ($node instanceof Isset_ || $node instanceof Unset_) { foreach ($node->vars as $var) { if (!$this->isCallNode($var)) { continue; } - $msg = $this->isPhp55 ? self::PHP55_MESSAGE : self::EXCEPTION_MESSAGE; + $msg = ($node instanceof Isset_ && $this->isPhp55) ? self::PHP55_MESSAGE : self::EXCEPTION_MESSAGE; throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine()); } } elseif ($node instanceof Empty_ && !$this->isPhp55 && $this->isCallNode($node->expr)) { diff --git a/psy/psysh/src/Psy/Command/DocCommand.php b/psy/psysh/src/Psy/Command/DocCommand.php index 3ff66aa..9f5fb5b 100644 --- a/psy/psysh/src/Psy/Command/DocCommand.php +++ b/psy/psysh/src/Psy/Command/DocCommand.php @@ -87,6 +87,8 @@ private function getManualDoc($reflector) { switch (get_class($reflector)) { + case 'ReflectionClass': + case 'ReflectionObject': case 'ReflectionFunction': $id = $reflector->name; break; @@ -95,6 +97,10 @@ $id = $reflector->class . '::' . $reflector->name; break; + case 'ReflectionProperty': + $id = $reflector->class . '::$' . $reflector->name; + break; + default: return false; } diff --git a/psy/psysh/src/Psy/Command/EditCommand.php b/psy/psysh/src/Psy/Command/EditCommand.php new file mode 100644 index 0000000..a1c6ee4 --- /dev/null +++ b/psy/psysh/src/Psy/Command/EditCommand.php @@ -0,0 +1,187 @@ +<?php + +/* + * This file is part of Psy Shell. + * + * (c) 2012-2017 Justin Hileman + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Psy\Command; + +use Psy\Context; +use Psy\ContextAware; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +class EditCommand extends Command implements ContextAware +{ + /** + * @var string + */ + private $runtimeDir = ''; + + /** + * @var Context + */ + private $context; + + /** + * Constructor. + * + * @param string $runtimeDir The directory to use for temporary files + * @param string|null $name The name of the command; passing null means it must be set in configure() + * + * @throws \Symfony\Component\Console\Exception\LogicException When the command name is empty + */ + public function __construct($runtimeDir, $name = null) + { + parent::__construct($name); + + $this->runtimeDir = $runtimeDir; + } + + protected function configure() + { + $this + ->setName('edit') + ->setDefinition(array( + new InputArgument('file', InputArgument::OPTIONAL, 'The file to open for editing. If this is not given, edits a temporary file.', null), + new InputOption( + 'exec', + 'e', + InputOption::VALUE_NONE, + 'Execute the file content after editing. This is the default when a file name argument is not given.', + null + ), + new InputOption( + 'no-exec', + 'E', + InputOption::VALUE_NONE, + 'Do not execute the file content after editing. This is the default when a file name argument is given.', + null + ), + )) + ->setDescription('Open an external editor. Afterwards, get produced code in input buffer.') + ->setHelp('Set the EDITOR environment variable to something you\'d like to use.'); + } + + /** + * @param InputInterface $input + * @param OutputInterface $output + * + * @throws \InvalidArgumentException when both exec and no-exec flags are given or if a given variable is not found in the current context + * @throws \UnexpectedValueException if file_get_contents on the edited file returns false instead of a string + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + if ($input->getOption('exec') && + $input->getOption('no-exec')) { + throw new \InvalidArgumentException('The --exec and --no-exec flags are mutually exclusive.'); + } + + $filePath = $this->extractFilePath($input->getArgument('file')); + + $execute = $this->shouldExecuteFile( + $input->getOption('exec'), + $input->getOption('no-exec'), + $filePath + ); + + $shouldRemoveFile = false; + + if ($filePath === null) { + $filePath = tempnam($this->runtimeDir, 'psysh-edit-command'); + $shouldRemoveFile = true; + } + + $editedContent = $this->editFile($filePath, $shouldRemoveFile); + + if ($execute) { + $this->getApplication()->addInput($editedContent); + } + } + + /** + * @param bool $execOption + * @param bool $noExecOption + * @param string|null $filePath + * + * @return bool + */ + private function shouldExecuteFile($execOption, $noExecOption, $filePath) + { + if ($execOption) { + return true; + } + + if ($noExecOption) { + return false; + } + + // By default, code that is edited is executed if there was no given input file path + return $filePath === null; + } + + /** + * @param string|null $fileArgument + * + * @return string|null The file path to edit, null if the input was null, or the value of the referenced variable + * + * @throws \InvalidArgumentException If the variable is not found in the current context + */ + private function extractFilePath($fileArgument) + { + // If the file argument was a variable, get it from the context + if ($fileArgument !== null && + strlen($fileArgument) > 0 && + $fileArgument[0] === '$') { + $fileArgument = $this->context->get(preg_replace('/^\$/', '', $fileArgument)); + } + + return $fileArgument; + } + + /** + * @param string $filePath + * @param string $shouldRemoveFile + * + * @return string + * + * @throws \UnexpectedValueException if file_get_contents on $filePath returns false instead of a string + */ + private function editFile($filePath, $shouldRemoveFile) + { + $escapedFilePath = escapeshellarg($filePath); + + $pipes = array(); + $proc = proc_open((getenv('EDITOR') ?: 'nano') . " {$escapedFilePath}", array(STDIN, STDOUT, STDERR), $pipes); + proc_close($proc); + + $editedContent = @file_get_contents($filePath); + + if ($shouldRemoveFile) { + @unlink($filePath); + } + + if ($editedContent === false) { + throw new \UnexpectedValueException("Reading {$filePath} returned false"); + } + + return $editedContent; + } + + /** + * Set the Context reference. + * + * @param Context $context + */ + public function setContext(Context $context) + { + $this->context = $context; + } +} diff --git a/psy/psysh/src/Psy/Command/ListCommand.php b/psy/psysh/src/Psy/Command/ListCommand.php index cd38eb5..8ce0227 100644 --- a/psy/psysh/src/Psy/Command/ListCommand.php +++ b/psy/psysh/src/Psy/Command/ListCommand.php @@ -16,10 +16,8 @@ use Psy\Command\ListCommand\ConstantEnumerator; use Psy\Command\ListCommand\FunctionEnumerator; use Psy\Command\ListCommand\GlobalVariableEnumerator; -use Psy\Command\ListCommand\InterfaceEnumerator; use Psy\Command\ListCommand\MethodEnumerator; use Psy\Command\ListCommand\PropertyEnumerator; -use Psy\Command\ListCommand\TraitEnumerator; use Psy\Command\ListCommand\VariableEnumerator; use Psy\Exception\RuntimeException; use Psy\Input\FilterOptions; @@ -159,10 +157,8 @@ new ConstantEnumerator($mgr), new FunctionEnumerator($mgr), new GlobalVariableEnumerator($mgr), - new InterfaceEnumerator($mgr), new PropertyEnumerator($mgr), new MethodEnumerator($mgr), - new TraitEnumerator($mgr), new VariableEnumerator($mgr, $this->context), ); } diff --git a/psy/psysh/src/Psy/Command/ListCommand/ClassEnumerator.php b/psy/psysh/src/Psy/Command/ListCommand/ClassEnumerator.php index 038b464..6dcabe2 100644 --- a/psy/psysh/src/Psy/Command/ListCommand/ClassEnumerator.php +++ b/psy/psysh/src/Psy/Command/ListCommand/ClassEnumerator.php @@ -35,20 +35,66 @@ return; } - // only list classes if we are specifically asked - if (!$input->getOption('classes')) { - return; + $user = $input->getOption('user'); + $internal = $input->getOption('internal'); + + $ret = array(); + + // only list classes, interfaces and traits if we are specifically asked + + if ($input->getOption('classes')) { + $ret = array_merge($ret, $this->filterClasses('Classes', get_declared_classes(), $internal, $user)); } - $classes = $this->prepareClasses(get_declared_classes()); - - if (empty($classes)) { - return; + if ($input->getOption('interfaces')) { + $ret = array_merge($ret, $this->filterClasses('Interfaces', get_declared_interfaces(), $internal, $user)); } - return array( - 'Classes' => $classes, - ); + if (function_exists('get_declared_traits') && $input->getOption('traits')) { + $ret = array_merge($ret, $this->filterClasses('Traits', get_declared_traits(), $internal, $user)); + } + + return array_map(array($this, 'prepareClasses'), array_filter($ret)); + } + + /** + * Filter a list of classes, interfaces or traits. + * + * If $internal or $user is defined, results will be limited to internal or + * user-defined classes as appropriate. + * + * @param string $key + * @param array $classes + * @param bool $internal + * @param bool $user + * + * @return array + */ + protected function filterClasses($key, $classes, $internal, $user) + { + $ret = array(); + + if ($internal) { + $ret['Internal ' . $key] = array_filter($classes, function ($class) { + $refl = new \ReflectionClass($class); + + return $refl->isInternal(); + }); + } + + if ($user) { + $ret['User ' . $key] = array_filter($classes, function ($class) { + $refl = new \ReflectionClass($class); + + return !$refl->isInternal(); + }); + } + + if (!$user && !$internal) { + $ret[$key] = $classes; + } + + return $ret; } /** diff --git a/psy/psysh/src/Psy/Command/ListCommand/ConstantEnumerator.php b/psy/psysh/src/Psy/Command/ListCommand/ConstantEnumerator.php index e8479f2..88d348d 100644 --- a/psy/psysh/src/Psy/Command/ListCommand/ConstantEnumerator.php +++ b/psy/psysh/src/Psy/Command/ListCommand/ConstantEnumerator.php @@ -39,24 +39,37 @@ return; } - $category = $input->getOption('user') ? 'user' : $input->getOption('category'); - $label = $category ? ucfirst($category) . ' Constants' : 'Constants'; - $constants = $this->prepareConstants($this->getConstants($category)); - - if (empty($constants)) { - return; - } + $user = $input->getOption('user'); + $internal = $input->getOption('internal'); + $category = $input->getOption('category'); $ret = array(); - $ret[$label] = $constants; - return $ret; + if ($user) { + $ret['User Constants'] = $this->getConstants('user'); + } + + if ($internal) { + $ret['Interal Constants'] = $this->getConstants('internal'); + } + + if ($category) { + $label = ucfirst($category) . ' Constants'; + $ret[$label] = $this->getConstants($category); + } + + if (!$user && !$internal && !$category) { + $ret['Constants'] = $this->getConstants(); + } + + return array_map(array($this, 'prepareConstants'), array_filter($ret)); } /** * Get defined constants. * - * Optionally restrict constants to a given category, e.g. "date". + * Optionally restrict constants to a given category, e.g. "date". If the + * category is "internal", include all non-user-defined constants. * * @param string $category * @@ -70,6 +83,12 @@ $consts = get_defined_constants(true); + if ($category === 'internal') { + unset($consts['user']); + + return call_user_func_array('array_merge', $consts); + } + return isset($consts[$category]) ? $consts[$category] : array(); } diff --git a/psy/psysh/src/Psy/Command/ListCommand/InterfaceEnumerator.php b/psy/psysh/src/Psy/Command/ListCommand/InterfaceEnumerator.php index b89b750..91ba985 100644 --- a/psy/psysh/src/Psy/Command/ListCommand/InterfaceEnumerator.php +++ b/psy/psysh/src/Psy/Command/ListCommand/InterfaceEnumerator.php @@ -11,13 +11,21 @@ namespace Psy\Command\ListCommand; +use Psy\VarDumper\Presenter; use Symfony\Component\Console\Input\InputInterface; /** * Interface Enumerator class. + * + * @deprecated Nothing should use this anymore */ class InterfaceEnumerator extends Enumerator { + public function __construct(Presenter $presenter) + { + @trigger_error('InterfaceEnumerator is no longer used', E_USER_DEPRECATED); + } + /** * {@inheritdoc} */ diff --git a/psy/psysh/src/Psy/Command/ListCommand/TraitEnumerator.php b/psy/psysh/src/Psy/Command/ListCommand/TraitEnumerator.php index 615bfd3..12941f4 100644 --- a/psy/psysh/src/Psy/Command/ListCommand/TraitEnumerator.php +++ b/psy/psysh/src/Psy/Command/ListCommand/TraitEnumerator.php @@ -11,13 +11,21 @@ namespace Psy\Command\ListCommand; +use Psy\VarDumper\Presenter; use Symfony\Component\Console\Input\InputInterface; /** * Trait Enumerator class. + * + * @deprecated Nothing should use this anymore */ class TraitEnumerator extends Enumerator { + public function __construct(Presenter $presenter) + { + @trigger_error('TraitEnumerator is no longer used', E_USER_DEPRECATED); + } + /** * {@inheritdoc} */ diff --git a/psy/psysh/src/Psy/Command/WhereamiCommand.php b/psy/psysh/src/Psy/Command/WhereamiCommand.php index 1422ac9..b18a46b 100644 --- a/psy/psysh/src/Psy/Command/WhereamiCommand.php +++ b/psy/psysh/src/Psy/Command/WhereamiCommand.php @@ -122,6 +122,31 @@ $colors = $factory->getConsoleColor(); $highlighter = new Highlighter($colors); $contents = file_get_contents($info['file']); - $output->page($highlighter->getCodeSnippet($contents, $info['line'], $num, $num), ShellOutput::OUTPUT_RAW); + + $output->startPaging(); + $output->writeln(''); + $output->writeln(sprintf('From <info>%s:%s</info>:', $this->replaceCwd($info['file']), $info['line'])); + $output->writeln(''); + $output->write($highlighter->getCodeSnippet($contents, $info['line'], $num, $num), ShellOutput::OUTPUT_RAW); + $output->stopPaging(); + } + + /** + * Replace the given directory from the start of a filepath. + * + * @param string $file + * + * @return string + */ + private function replaceCwd($file) + { + $cwd = getcwd(); + if ($cwd === false) { + return $file; + } + + $cwd = rtrim($cwd, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + + return preg_replace('/^' . preg_quote($cwd, '/') . '/', '', $file); } } diff --git a/psy/psysh/src/Psy/ConfigPaths.php b/psy/psysh/src/Psy/ConfigPaths.php index 2295a91..6672491 100644 --- a/psy/psysh/src/Psy/ConfigPaths.php +++ b/psy/psysh/src/Psy/ConfigPaths.php @@ -136,7 +136,22 @@ { $xdg = new Xdg(); - return $xdg->getRuntimeDir(false) . '/psysh'; + set_error_handler(array('Psy\Exception\ErrorException', 'throwException')); + + try { + // XDG doesn't really work on Windows, sometimes complains about + // permissions, sometimes tries to remove non-empty directories. + // It's a bit flaky. So we'll give this a shot first... + $runtimeDir = $xdg->getRuntimeDir(false); + } catch (\Exception $e) { + // Well. That didn't work. Fall back to a boring old folder in the + // system temp dir. + $runtimeDir = sys_get_temp_dir(); + } + + restore_error_handler(); + + return strtr($runtimeDir, '\\', '/') . '/psysh'; } private static function getDirNames(array $baseDirs) diff --git a/psy/psysh/src/Psy/Configuration.php b/psy/psysh/src/Psy/Configuration.php index 37ed82e..821d83f 100644 --- a/psy/psysh/src/Psy/Configuration.php +++ b/psy/psysh/src/Psy/Configuration.php @@ -47,10 +47,12 @@ 'defaultIncludes', 'eraseDuplicates', 'errorLoggingLevel', + 'forceArrayIndexes', 'historySize', 'loop', 'manualDbFile', 'pager', + 'prompt', 'requireSemicolons', 'runtimeDir', 'startupMessage', @@ -88,6 +90,7 @@ private $colorMode; private $updateCheck; private $startupMessage; + private $forceArrayIndexes = false; // services private $readline; @@ -100,6 +103,7 @@ private $presenter; private $completer; private $checker; + private $prompt; /** * Construct a Configuration instance. @@ -1072,7 +1076,7 @@ public function getPresenter() { if (!isset($this->presenter)) { - $this->presenter = new Presenter($this->getOutput()->getFormatter()); + $this->presenter = new Presenter($this->getOutput()->getFormatter(), $this->forceArrayIndexes()); } return $this->presenter; @@ -1251,4 +1255,44 @@ { return $this->startupMessage; } + + /** + * Set the prompt. + * + * @param string $prompt + */ + public function setPrompt($prompt) + { + $this->prompt = $prompt; + } + + /** + * Get the prompt. + * + * @return string + */ + public function getPrompt() + { + return $this->prompt; + } + + /** + * Get the force array indexes. + * + * @return bool + */ + public function forceArrayIndexes() + { + return $this->forceArrayIndexes; + } + + /** + * Set the force array indexes. + * + * @param bool $forceArrayIndexes + */ + public function setForceArrayIndexes($forceArrayIndexes) + { + $this->forceArrayIndexes = $forceArrayIndexes; + } } diff --git a/psy/psysh/src/Psy/Exception/ErrorException.php b/psy/psysh/src/Psy/Exception/ErrorException.php index 66c172c..85820ac 100644 --- a/psy/psysh/src/Psy/Exception/ErrorException.php +++ b/psy/psysh/src/Psy/Exception/ErrorException.php @@ -37,19 +37,33 @@ } switch ($severity) { - case E_WARNING: - case E_CORE_WARNING: - case E_COMPILE_WARNING: - case E_USER_WARNING: - $type = 'warning'; - break; - case E_STRICT: $type = 'Strict error'; break; + case E_NOTICE: + case E_USER_NOTICE: + $type = 'Notice'; + break; + + case E_WARNING: + case E_CORE_WARNING: + case E_COMPILE_WARNING: + case E_USER_WARNING: + $type = 'Warning'; + break; + + case E_DEPRECATED: + case E_USER_DEPRECATED: + $type = 'Deprecated'; + break; + + case E_RECOVERABLE_ERROR: + $type = 'Recoverable fatal error'; + break; + default: - $type = 'error'; + $type = 'Error'; break; } diff --git a/psy/psysh/src/Psy/Input/ShellInput.php b/psy/psysh/src/Psy/Input/ShellInput.php index e25db46..84de293 100644 --- a/psy/psysh/src/Psy/Input/ShellInput.php +++ b/psy/psysh/src/Psy/Input/ShellInput.php @@ -165,20 +165,24 @@ $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token; } + return; + } + // if last argument isArray(), append token to last argument - } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) { + if ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) { $arg = $this->definition->getArgument($c - 1); $this->arguments[$arg->getName()][] = $token; - // unexpected argument - } else { - $all = $this->definition->getArguments(); - if (count($all)) { - throw new \RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all)))); - } - - throw new \RuntimeException(sprintf('No arguments expected, got "%s".', $token)); + return; } + + // unexpected argument + $all = $this->definition->getArguments(); + if (count($all)) { + throw new \RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all)))); + } + + throw new \RuntimeException(sprintf('No arguments expected, got "%s".', $token)); } // Everything below this is copypasta from ArgvInput private methods diff --git a/psy/psysh/src/Psy/Shell.php b/psy/psysh/src/Psy/Shell.php index 65c931b..8e2814a 100644 --- a/psy/psysh/src/Psy/Shell.php +++ b/psy/psysh/src/Psy/Shell.php @@ -44,7 +44,7 @@ */ class Shell extends Application { - const VERSION = 'v0.8.11'; + const VERSION = 'v0.8.15'; const PROMPT = '>>> '; const BUFF_PROMPT = '... '; @@ -66,6 +66,7 @@ private $completion; private $tabCompletionMatchers = array(); private $stdoutBuffer; + private $prompt; /** * Create a new Psy Shell. @@ -181,6 +182,7 @@ new Command\TraceCommand(), new Command\BufferCommand(), new Command\ClearCommand(), + new Command\EditCommand($this->config->getRuntimeDir()), // new Command\PsyVersionCommand(), $sudo, $hist, @@ -205,6 +207,9 @@ new Matcher\ClassAttributesMatcher(), new Matcher\ObjectMethodsMatcher(), new Matcher\ObjectAttributesMatcher(), + new Matcher\ClassMethodDefaultParametersMatcher(), + new Matcher\ObjectMethodDefaultParametersMatcher(), + new Matcher\FunctionDefaultParametersMatcher(), ); } @@ -334,6 +339,7 @@ if ($this->hasCommand($input)) { $this->readline->addHistory($input); $this->runCommand($input); + continue; } @@ -526,6 +532,7 @@ } catch (\Exception $e) { // Add failed code blocks to the readline history. $this->addCodeBufferToHistory(); + throw $e; } } @@ -739,7 +746,11 @@ { $message = $e->getMessage(); if (!$e instanceof PsyException) { - $message = sprintf('%s with message \'%s\'', get_class($e), $message); + if ($message === '') { + $message = get_class($e); + } else { + $message = sprintf('%s with message \'%s\'', get_class($e), $message); + } } $severity = ($e instanceof \ErrorException) ? $this->getSeverity($e) : 'error'; @@ -866,7 +877,11 @@ */ protected function getPrompt() { - return $this->hasCode() ? static::BUFF_PROMPT : static::PROMPT; + if ($this->hasCode()) { + return static::BUFF_PROMPT; + } + + return $this->config->getPrompt() ?: static::PROMPT; } /** diff --git a/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php b/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php new file mode 100644 index 0000000..e34e4c6 --- /dev/null +++ b/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of Psy Shell. + * + * (c) 2012-2017 Justin Hileman + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Psy\TabCompletion\Matcher; + +abstract class AbstractDefaultParametersMatcher extends AbstractContextAwareMatcher +{ + /** + * @param \ReflectionParameter[] $reflectionParameters + * + * @return array + */ + public function getDefaultParameterCompletion(array $reflectionParameters) + { + $parametersProcessed = array(); + + foreach ($reflectionParameters as $parameter) { + if (!$parameter->isDefaultValueAvailable()) { + return array(); + } + + $defaultValue = $this->valueToShortString($parameter->getDefaultValue()); + + $parametersProcessed[] = "\${$parameter->getName()} = $defaultValue"; + } + + if (empty($parametersProcessed)) { + return array(); + } + + return array(implode(', ', $parametersProcessed) . ')'); + } + + /** + * Takes in the default value of a parameter and turns it into a + * string representation that fits inline. + * This is not 100% true to the original (newlines are inlined, for example). + * + * @param mixed $value + * + * @return string + */ + private function valueToShortString($value) + { + if (!is_array($value)) { + return json_encode($value); + } + + $chunks = array(); + $chunksSequential = array(); + + $allSequential = true; + + foreach ($value as $key => $item) { + $allSequential = $allSequential && is_numeric($key) && $key === count($chunksSequential); + + $keyString = $this->valueToShortString($key); + $itemString = $this->valueToShortString($item); + + $chunks[] = "{$keyString} => {$itemString}"; + $chunksSequential[] = $itemString; + } + + $chunksToImplode = $allSequential ? $chunksSequential : $chunks; + + return '[' . implode(', ', $chunksToImplode) . ']'; + } +} diff --git a/psy/psysh/src/Psy/TabCompletion/Matcher/ClassAttributesMatcher.php b/psy/psysh/src/Psy/TabCompletion/Matcher/ClassAttributesMatcher.php index 4695f57..3b5df25 100644 --- a/psy/psysh/src/Psy/TabCompletion/Matcher/ClassAttributesMatcher.php +++ b/psy/psysh/src/Psy/TabCompletion/Matcher/ClassAttributesMatcher.php @@ -36,7 +36,12 @@ $class = $this->getNamespaceAndClass($tokens); - $reflection = new \ReflectionClass($class); + try { + $reflection = new \ReflectionClass($class); + } catch (\ReflectionException $re) { + return array(); + } + $vars = array_merge( array_map( function ($var) { diff --git a/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php b/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php new file mode 100644 index 0000000..c52dd09 --- /dev/null +++ b/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php @@ -0,0 +1,64 @@ +<?php + +/* + * This file is part of Psy Shell. + * + * (c) 2012-2017 Justin Hileman + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Psy\TabCompletion\Matcher; + +class ClassMethodDefaultParametersMatcher extends AbstractDefaultParametersMatcher +{ + public function getMatches(array $tokens, array $info = array()) + { + $openBracket = array_pop($tokens); + $functionName = array_pop($tokens); + $methodOperator = array_pop($tokens); + + $class = $this->getNamespaceAndClass($tokens); + + try { + $reflection = new \ReflectionClass($class); + } catch (\ReflectionException $e) { + // In this case the class apparently does not exist, so we can do nothing + return array(); + } + + $methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC); + + foreach ($methods as $method) { + if ($method->getName() === $functionName[1]) { + return $this->getDefaultParameterCompletion($method->getParameters()); + } + } + + return array(); + } + + public function hasMatched(array $tokens) + { + $openBracket = array_pop($tokens); + + if ($openBracket !== '(') { + return false; + } + + $functionName = array_pop($tokens); + + if (!self::tokenIs($functionName, self::T_STRING)) { + return false; + } + + $operator = array_pop($tokens); + + if (!self::tokenIs($operator, self::T_DOUBLE_COLON)) { + return false; + } + + return true; + } +} diff --git a/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodsMatcher.php b/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodsMatcher.php index 6045ed9..0822278 100644 --- a/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodsMatcher.php +++ b/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodsMatcher.php @@ -36,7 +36,12 @@ $class = $this->getNamespaceAndClass($tokens); - $reflection = new \ReflectionClass($class); + try { + $reflection = new \ReflectionClass($class); + } catch (\ReflectionException $re) { + return array(); + } + $methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC); $methods = array_map(function (\ReflectionMethod $method) { return $method->getName(); diff --git a/psy/psysh/src/Psy/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php b/psy/psysh/src/Psy/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php new file mode 100644 index 0000000..47be34b --- /dev/null +++ b/psy/psysh/src/Psy/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php @@ -0,0 +1,53 @@ +<?php + +/* + * This file is part of Psy Shell. + * + * (c) 2012-2017 Justin Hileman + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Psy\TabCompletion\Matcher; + +class FunctionDefaultParametersMatcher extends AbstractDefaultParametersMatcher +{ + public function getMatches(array $tokens, array $info = array()) + { + array_pop($tokens); // open bracket + + $functionName = array_pop($tokens); + + try { + $reflection = new \ReflectionFunction($functionName[1]); + } catch (\ReflectionException $e) { + return array(); + } + + $parameters = $reflection->getParameters(); + + return $this->getDefaultParameterCompletion($parameters); + } + + public function hasMatched(array $tokens) + { + $openBracket = array_pop($tokens); + + if ($openBracket !== '(') { + return false; + } + + $functionName = array_pop($tokens); + + if (!self::tokenIs($functionName, self::T_STRING)) { + return false; + } + + if (!function_exists($functionName[1])) { + return false; + } + + return true; + } +} diff --git a/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectAttributesMatcher.php b/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectAttributesMatcher.php index 5d1894e..c87bccf 100644 --- a/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectAttributesMatcher.php +++ b/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectAttributesMatcher.php @@ -47,6 +47,10 @@ return array(); } + if (!is_object($object)) { + return array(); + } + return array_filter( array_keys(get_class_vars(get_class($object))), function ($var) use ($input) { diff --git a/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php b/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php new file mode 100644 index 0000000..0e7cb1f --- /dev/null +++ b/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php @@ -0,0 +1,71 @@ +<?php + +/* + * This file is part of Psy Shell. + * + * (c) 2012-2017 Justin Hileman + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Psy\TabCompletion\Matcher; + +class ObjectMethodDefaultParametersMatcher extends AbstractDefaultParametersMatcher +{ + public function getMatches(array $tokens, array $info = array()) + { + $openBracket = array_pop($tokens); + $functionName = array_pop($tokens); + $methodOperator = array_pop($tokens); + + $objectToken = array_pop($tokens); + if (!is_array($objectToken)) { + return array(); + } + + $objectName = str_replace('$', '', $objectToken[1]); + + try { + $object = $this->getVariable($objectName); + $reflection = new \ReflectionObject($object); + } catch (InvalidArgumentException $e) { + return array(); + } catch (\ReflectionException $e) { + return array(); + } + + $methods = $reflection->getMethods(); + + foreach ($methods as $method) { + if ($method->getName() === $functionName[1]) { + return $this->getDefaultParameterCompletion($method->getParameters()); + } + } + + return array(); + } + + public function hasMatched(array $tokens) + { + $openBracket = array_pop($tokens); + + if ($openBracket !== '(') { + return false; + } + + $functionName = array_pop($tokens); + + if (!self::tokenIs($functionName, self::T_STRING)) { + return false; + } + + $operator = array_pop($tokens); + + if (!self::tokenIs($operator, self::T_OBJECT_OPERATOR)) { + return false; + } + + return true; + } +} diff --git a/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php b/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php index 5983aad..be2df08 100644 --- a/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php +++ b/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php @@ -47,10 +47,16 @@ return array(); } + if (!is_object($object)) { + return array(); + } + return array_filter( get_class_methods($object), function ($var) use ($input) { - return AbstractMatcher::startsWith($input, $var); + return AbstractMatcher::startsWith($input, $var) && + // also check that we do not suggest invoking a super method(__construct, __wakeup, …) + !AbstractMatcher::startsWith('__', $var); } ); } diff --git a/psy/psysh/src/Psy/VarDumper/Dumper.php b/psy/psysh/src/Psy/VarDumper/Dumper.php index 6e166af..05fc46f 100644 --- a/psy/psysh/src/Psy/VarDumper/Dumper.php +++ b/psy/psysh/src/Psy/VarDumper/Dumper.php @@ -21,6 +21,7 @@ class Dumper extends CliDumper { private $formatter; + private $forceArrayIndexes; protected static $onlyControlCharsRx = '/^[\x00-\x1F\x7F]+$/'; protected static $controlCharsRx = '/([\x00-\x1F\x7F]+)/'; @@ -34,9 +35,10 @@ "\033" => '\e', ); - public function __construct(OutputFormatter $formatter) + public function __construct(OutputFormatter $formatter, $forceArrayIndexes = false) { $this->formatter = $formatter; + $this->forceArrayIndexes = $forceArrayIndexes; parent::__construct(); $this->setColors(false); } @@ -57,7 +59,7 @@ */ protected function dumpKey(Cursor $cursor) { - if (Cursor::HASH_INDEXED !== $cursor->hashType) { + if ($this->forceArrayIndexes || Cursor::HASH_INDEXED !== $cursor->hashType) { parent::dumpKey($cursor); } } diff --git a/psy/psysh/src/Psy/VarDumper/Presenter.php b/psy/psysh/src/Psy/VarDumper/Presenter.php index 9ecf39b..b48ca9d 100644 --- a/psy/psysh/src/Psy/VarDumper/Presenter.php +++ b/psy/psysh/src/Psy/VarDumper/Presenter.php @@ -46,13 +46,13 @@ 'index' => 'number', ); - public function __construct(OutputFormatter $formatter) + public function __construct(OutputFormatter $formatter, $forceArrayIndexes = false) { // Work around https://github.com/symfony/symfony/issues/23572 $oldLocale = setlocale(LC_NUMERIC, 0); setlocale(LC_NUMERIC, 'C'); - $this->dumper = new Dumper($formatter); + $this->dumper = new Dumper($formatter, $forceArrayIndexes); $this->dumper->setStyles($this->styles); // Now put the locale back diff --git a/psy/psysh/src/Psy/VersionUpdater/GitHubChecker.php b/psy/psysh/src/Psy/VersionUpdater/GitHubChecker.php index 520d7c5..5ac6969 100644 --- a/psy/psysh/src/Psy/VersionUpdater/GitHubChecker.php +++ b/psy/psysh/src/Psy/VersionUpdater/GitHubChecker.php @@ -68,8 +68,22 @@ */ public function fetchLatestRelease() { - $context = stream_context_create(array('http' => array('user_agent' => 'PsySH/' . Shell::VERSION))); + $context = stream_context_create(array( + 'http' => array( + 'user_agent' => 'PsySH/' . Shell::VERSION, + 'timeout' => 3, + ), + )); - return json_decode(@file_get_contents(self::URL, false, $context)); + set_error_handler(function () { + // Just ignore all errors with this. The checker will throw an exception + // if it doesn't work :) + }); + + $result = @file_get_contents(self::URL, false, $context); + + restore_error_handler(); + + return json_decode($result); } } diff --git a/psy/psysh/src/Psy/functions.php b/psy/psysh/src/Psy/functions.php index 96e865f..dc77e12 100644 --- a/psy/psysh/src/Psy/functions.php +++ b/psy/psysh/src/Psy/functions.php @@ -144,9 +144,17 @@ // Use an explicit, fresh update check here, rather than relying on whatever is in $config. $checker = new GitHubChecker(); + $updateAvailable = null; + $latest = null; + try { + $updateAvailable = !$checker->isLatest(); + $latest = $checker->getLatest(); + } catch (\Exception $e) { + } + $updates = array( - 'update available' => !$checker->isLatest(), - 'latest release version' => $checker->getLatest(), + 'update available' => $updateAvailable, + 'latest release version' => $latest, 'update check interval' => $config->getUpdateCheck(), 'update cache file' => $prettyPath($config->getUpdateCheckCacheFile()), ); @@ -177,6 +185,11 @@ 'pcntl available' => function_exists('pcntl_signal'), 'posix available' => function_exists('posix_getpid'), ); + + $disabledFuncs = array_map('trim', explode(',', ini_get('disable_functions'))); + if (in_array('pcntl_signal', $disabledFuncs) || in_array('pcntl_fork', $disabledFuncs)) { + $pcntl['pcntl disabled'] = true; + } $history = array( 'history file' => $prettyPath($config->getHistoryFile()), @@ -220,6 +233,7 @@ $autocomplete = array( 'tab completion enabled' => $config->getTabCompletion(), 'custom matchers' => array_map('get_class', $config->getTabCompletionMatchers()), + 'bracketed paste' => $config->useBracketedPaste(), ); return array_merge($core, compact('updates', 'pcntl', 'readline', 'history', 'docs', 'autocomplete')); diff --git a/psy/psysh/test/Psy/Test/AutoloaderTest.php b/psy/psysh/test/Psy/Test/AutoloaderTest.php index b906aaf..fdd6d5f 100644 --- a/psy/psysh/test/Psy/Test/AutoloaderTest.php +++ b/psy/psysh/test/Psy/Test/AutoloaderTest.php @@ -13,7 +13,7 @@ use Psy\Autoloader; -class AutoloaderTest extends \PHPUnit_Framework_TestCase +class AutoloaderTest extends \PHPUnit\Framework\TestCase { public function testRegister() { diff --git a/psy/psysh/test/Psy/Test/CodeCleaner/CodeCleanerTestCase.php b/psy/psysh/test/Psy/Test/CodeCleaner/CodeCleanerTestCase.php index b2f2fcd..d1a3027 100644 --- a/psy/psysh/test/Psy/Test/CodeCleaner/CodeCleanerTestCase.php +++ b/psy/psysh/test/Psy/Test/CodeCleaner/CodeCleanerTestCase.php @@ -17,7 +17,7 @@ use Psy\Exception\ParseErrorException; use Psy\ParserFactory; -class CodeCleanerTestCase extends \PHPUnit_Framework_TestCase +class CodeCleanerTestCase extends \PHPUnit\Framework\TestCase { protected $pass; protected $traverser; diff --git a/psy/psysh/test/Psy/Test/CodeCleaner/FunctionReturnInWriteContextPassTest.php b/psy/psysh/test/Psy/Test/CodeCleaner/FunctionReturnInWriteContextPassTest.php index c9069e5..0403495 100644 --- a/psy/psysh/test/Psy/Test/CodeCleaner/FunctionReturnInWriteContextPassTest.php +++ b/psy/psysh/test/Psy/Test/CodeCleaner/FunctionReturnInWriteContextPassTest.php @@ -43,6 +43,7 @@ array('$a->method(& $closure())'), array('array(& A::b())'), array('f() = 5'), + array('unset(h())'), ); } diff --git a/psy/psysh/test/Psy/Test/CodeCleanerTest.php b/psy/psysh/test/Psy/Test/CodeCleanerTest.php index 9df92dd..f46b6da 100644 --- a/psy/psysh/test/Psy/Test/CodeCleanerTest.php +++ b/psy/psysh/test/Psy/Test/CodeCleanerTest.php @@ -13,7 +13,7 @@ use Psy\CodeCleaner; -class CodeCleanerTest extends \PHPUnit_Framework_TestCase +class CodeCleanerTest extends \PHPUnit\Framework\TestCase { /** * @dataProvider semicolonCodeProvider diff --git a/psy/psysh/test/Psy/Test/ConfigurationTest.php b/psy/psysh/test/Psy/Test/ConfigurationTest.php index 72abf97..ca18b98 100644 --- a/psy/psysh/test/Psy/Test/ConfigurationTest.php +++ b/psy/psysh/test/Psy/Test/ConfigurationTest.php @@ -18,7 +18,7 @@ use Psy\VersionUpdater\GitHubChecker; use Symfony\Component\Console\Output\ConsoleOutput; -class ConfigurationTest extends \PHPUnit_Framework_TestCase +class ConfigurationTest extends \PHPUnit\Framework\TestCase { private function getConfig($configFile = null) { diff --git a/psy/psysh/test/Psy/Test/ConsoleColorFactoryTest.php b/psy/psysh/test/Psy/Test/ConsoleColorFactoryTest.php index 9e9ced7..b597946 100644 --- a/psy/psysh/test/Psy/Test/ConsoleColorFactoryTest.php +++ b/psy/psysh/test/Psy/Test/ConsoleColorFactoryTest.php @@ -14,7 +14,7 @@ use Psy\Configuration; use Psy\ConsoleColorFactory; -class ConsoleColorFactoryTest extends \PHPUnit_Framework_TestCase +class ConsoleColorFactoryTest extends \PHPUnit\Framework\TestCase { public function testGetConsoleColorAuto() { diff --git a/psy/psysh/test/Psy/Test/Exception/BreakExceptionTest.php b/psy/psysh/test/Psy/Test/Exception/BreakExceptionTest.php index 75f5e5d..fb09498 100644 --- a/psy/psysh/test/Psy/Test/Exception/BreakExceptionTest.php +++ b/psy/psysh/test/Psy/Test/Exception/BreakExceptionTest.php @@ -14,7 +14,7 @@ use Psy\Exception\BreakException; use Psy\Exception\Exception; -class BreakExceptionTest extends \PHPUnit_Framework_TestCase +class BreakExceptionTest extends \PHPUnit\Framework\TestCase { public function testInstance() { diff --git a/psy/psysh/test/Psy/Test/Exception/ErrorExceptionTest.php b/psy/psysh/test/Psy/Test/Exception/ErrorExceptionTest.php index f4ca54f..4bc7f55 100644 --- a/psy/psysh/test/Psy/Test/Exception/ErrorExceptionTest.php +++ b/psy/psysh/test/Psy/Test/Exception/ErrorExceptionTest.php @@ -14,7 +14,7 @@ use Psy\Exception\ErrorException; use Psy\Exception\Exception; -class ErrorExceptionTest extends \PHPUnit_Framework_TestCase +class ErrorExceptionTest extends \PHPUnit\Framework\TestCase { public function testInstance() { @@ -60,12 +60,12 @@ public function getLevels() { return array( - array(E_WARNING, 'warning'), - array(E_CORE_WARNING, 'warning'), - array(E_COMPILE_WARNING, 'warning'), - array(E_USER_WARNING, 'warning'), + array(E_WARNING, 'Warning'), + array(E_CORE_WARNING, 'Warning'), + array(E_COMPILE_WARNING, 'Warning'), + array(E_USER_WARNING, 'Warning'), array(E_STRICT, 'Strict error'), - array(0, 'error'), + array(0, 'Error'), ); } @@ -87,10 +87,10 @@ public function getUserLevels() { return array( - array(E_USER_ERROR, 'error'), - array(E_USER_WARNING, 'warning'), - array(E_USER_NOTICE, 'error'), - array(E_USER_DEPRECATED, 'error'), + array(E_USER_ERROR, 'Error'), + array(E_USER_WARNING, 'Warning'), + array(E_USER_NOTICE, 'Notice'), + array(E_USER_DEPRECATED, 'Deprecated'), ); } diff --git a/psy/psysh/test/Psy/Test/Exception/FatalErrorExceptionTest.php b/psy/psysh/test/Psy/Test/Exception/FatalErrorExceptionTest.php index 2a443ca..9ff66b9 100644 --- a/psy/psysh/test/Psy/Test/Exception/FatalErrorExceptionTest.php +++ b/psy/psysh/test/Psy/Test/Exception/FatalErrorExceptionTest.php @@ -14,7 +14,7 @@ use Psy\Exception\Exception; use Psy\Exception\FatalErrorException; -class FatalErrorExceptionTest extends \PHPUnit_Framework_TestCase +class FatalErrorExceptionTest extends \PHPUnit\Framework\TestCase { public function testInstance() { diff --git a/psy/psysh/test/Psy/Test/Exception/ParseErrorExceptionTest.php b/psy/psysh/test/Psy/Test/Exception/ParseErrorExceptionTest.php index c681002..9fa9750 100644 --- a/psy/psysh/test/Psy/Test/Exception/ParseErrorExceptionTest.php +++ b/psy/psysh/test/Psy/Test/Exception/ParseErrorExceptionTest.php @@ -14,7 +14,7 @@ use Psy\Exception\Exception; use Psy\Exception\ParseErrorException; -class ParseErrorExceptionTest extends \PHPUnit_Framework_TestCase +class ParseErrorExceptionTest extends \PHPUnit\Framework\TestCase { public function testInstance() { diff --git a/psy/psysh/test/Psy/Test/Exception/RuntimeExceptionTest.php b/psy/psysh/test/Psy/Test/Exception/RuntimeExceptionTest.php index c1eb5e1..8eca134 100644 --- a/psy/psysh/test/Psy/Test/Exception/RuntimeExceptionTest.php +++ b/psy/psysh/test/Psy/Test/Exception/RuntimeExceptionTest.php @@ -14,7 +14,7 @@ use Psy\Exception\Exception; use Psy\Exception\RuntimeException; -class RuntimeExceptionTest extends \PHPUnit_Framework_TestCase +class RuntimeExceptionTest extends \PHPUnit\Framework\TestCase { public function testException() { diff --git a/psy/psysh/test/Psy/Test/Formatter/CodeFormatterTest.php b/psy/psysh/test/Psy/Test/Formatter/CodeFormatterTest.php index 0927ec1..7f1635e 100644 --- a/psy/psysh/test/Psy/Test/Formatter/CodeFormatterTest.php +++ b/psy/psysh/test/Psy/Test/Formatter/CodeFormatterTest.php @@ -13,7 +13,7 @@ use Psy\Formatter\CodeFormatter; -class CodeFormatterTest extends \PHPUnit_Framework_TestCase +class CodeFormatterTest extends \PHPUnit\Framework\TestCase { private function ignoreThisMethod($arg) { diff --git a/psy/psysh/test/Psy/Test/Formatter/DocblockFormatterTest.php b/psy/psysh/test/Psy/Test/Formatter/DocblockFormatterTest.php index 3a736d7..fa742b0 100644 --- a/psy/psysh/test/Psy/Test/Formatter/DocblockFormatterTest.php +++ b/psy/psysh/test/Psy/Test/Formatter/DocblockFormatterTest.php @@ -13,7 +13,7 @@ use Psy\Formatter\DocblockFormatter; -class DocblockFormatterTest extends \PHPUnit_Framework_TestCase +class DocblockFormatterTest extends \PHPUnit\Framework\TestCase { /** * This is a docblock! diff --git a/psy/psysh/test/Psy/Test/Formatter/SignatureFormatterTest.php b/psy/psysh/test/Psy/Test/Formatter/SignatureFormatterTest.php index 0ceb5b4..cfbe0b3 100644 --- a/psy/psysh/test/Psy/Test/Formatter/SignatureFormatterTest.php +++ b/psy/psysh/test/Psy/Test/Formatter/SignatureFormatterTest.php @@ -14,7 +14,7 @@ use Psy\Formatter\SignatureFormatter; use Psy\Reflection\ReflectionConstant; -class SignatureFormatterTest extends \PHPUnit_Framework_TestCase +class SignatureFormatterTest extends \PHPUnit\Framework\TestCase { const FOO = 'foo value'; private static $bar = 'bar value'; @@ -37,7 +37,7 @@ array( new \ReflectionClass($this), "class Psy\Test\Formatter\SignatureFormatterTest " - . 'extends PHPUnit_Framework_TestCase implements ' + . 'extends PHPUnit\Framework\TestCase implements ' . 'Countable, PHPUnit_Framework_SelfDescribing, ' . 'PHPUnit_Framework_Test', ), diff --git a/psy/psysh/test/Psy/Test/Input/CodeArgumentTest.php b/psy/psysh/test/Psy/Test/Input/CodeArgumentTest.php index a87357e..4329a03 100644 --- a/psy/psysh/test/Psy/Test/Input/CodeArgumentTest.php +++ b/psy/psysh/test/Psy/Test/Input/CodeArgumentTest.php @@ -14,7 +14,7 @@ use Psy\Input\CodeArgument; use Symfony\Component\Console\Input\InputArgument; -class CodeArgumentTest extends \PHPUnit_Framework_TestCase +class CodeArgumentTest extends \PHPUnit\Framework\TestCase { /** * @dataProvider getInvalidModes diff --git a/psy/psysh/test/Psy/Test/Input/ShellInputTest.php b/psy/psysh/test/Psy/Test/Input/ShellInputTest.php index 5b15bcc..98a8977 100644 --- a/psy/psysh/test/Psy/Test/Input/ShellInputTest.php +++ b/psy/psysh/test/Psy/Test/Input/ShellInputTest.php @@ -17,7 +17,7 @@ use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; -class ShellInputTest extends \PHPUnit_Framework_TestCase +class ShellInputTest extends \PHPUnit\Framework\TestCase { /** * @dataProvider getTokenizeData diff --git a/psy/psysh/test/Psy/Test/Readline/GNUReadlineTest.php b/psy/psysh/test/Psy/Test/Readline/GNUReadlineTest.php index 45fbb9b..95a40e7 100644 --- a/psy/psysh/test/Psy/Test/Readline/GNUReadlineTest.php +++ b/psy/psysh/test/Psy/Test/Readline/GNUReadlineTest.php @@ -13,7 +13,7 @@ use Psy\Readline\GNUReadline; -class GNUReadlineTest extends \PHPUnit_Framework_TestCase +class GNUReadlineTest extends \PHPUnit\Framework\TestCase { private $historyFile; diff --git a/psy/psysh/test/Psy/Test/Readline/HoaConsoleTest.php b/psy/psysh/test/Psy/Test/Readline/HoaConsoleTest.php index 2ddbbc9..707837d 100644 --- a/psy/psysh/test/Psy/Test/Readline/HoaConsoleTest.php +++ b/psy/psysh/test/Psy/Test/Readline/HoaConsoleTest.php @@ -13,7 +13,7 @@ use Psy\Readline\HoaConsole; -class HoaConsoleTest extends \PHPUnit_Framework_TestCase +class HoaConsoleTest extends \PHPUnit\Framework\TestCase { public function testHistory() { diff --git a/psy/psysh/test/Psy/Test/Readline/LibeditTest.php b/psy/psysh/test/Psy/Test/Readline/LibeditTest.php index c87d22c..fb0aaa5 100644 --- a/psy/psysh/test/Psy/Test/Readline/LibeditTest.php +++ b/psy/psysh/test/Psy/Test/Readline/LibeditTest.php @@ -13,7 +13,7 @@ use Psy\Readline\Libedit; -class LibeditTest extends \PHPUnit_Framework_TestCase +class LibeditTest extends \PHPUnit\Framework\TestCase { private $historyFile; diff --git a/psy/psysh/test/Psy/Test/Readline/TransientTest.php b/psy/psysh/test/Psy/Test/Readline/TransientTest.php index 133f577..24eafba 100644 --- a/psy/psysh/test/Psy/Test/Readline/TransientTest.php +++ b/psy/psysh/test/Psy/Test/Readline/TransientTest.php @@ -13,7 +13,7 @@ use Psy\Readline\Transient; -class TransientTest extends \PHPUnit_Framework_TestCase +class TransientTest extends \PHPUnit\Framework\TestCase { public function testHistory() { diff --git a/psy/psysh/test/Psy/Test/Reflection/ReflectionConstantTest.php b/psy/psysh/test/Psy/Test/Reflection/ReflectionConstantTest.php index a3c6464..60164f7 100644 --- a/psy/psysh/test/Psy/Test/Reflection/ReflectionConstantTest.php +++ b/psy/psysh/test/Psy/Test/Reflection/ReflectionConstantTest.php @@ -13,7 +13,7 @@ use Psy\Reflection\ReflectionConstant; -class ReflectionConstantTest extends \PHPUnit_Framework_TestCase +class ReflectionConstantTest extends \PHPUnit\Framework\TestCase { const CONSTANT_ONE = 'one'; diff --git a/psy/psysh/test/Psy/Test/ShellTest.php b/psy/psysh/test/Psy/Test/ShellTest.php index ade798d..2acf3c0 100644 --- a/psy/psysh/test/Psy/Test/ShellTest.php +++ b/psy/psysh/test/Psy/Test/ShellTest.php @@ -18,7 +18,7 @@ use Psy\TabCompletion\Matcher\ClassMethodsMatcher; use Symfony\Component\Console\Output\StreamOutput; -class ShellTest extends \PHPUnit_Framework_TestCase +class ShellTest extends \PHPUnit\Framework\TestCase { private $streams = array(); @@ -151,9 +151,9 @@ rewind($stream); $streamContents = stream_get_contents($stream); - $this->assertContains('PHP error:', $streamContents); - $this->assertContains('wheee', $streamContents); - $this->assertContains('line 13', $streamContents); + $this->assertContains('PHP Notice:', $streamContents); + $this->assertContains('wheee', $streamContents); + $this->assertContains('line 13', $streamContents); } /** diff --git a/psy/psysh/test/Psy/Test/TabCompletion/AutoCompleterTest.php b/psy/psysh/test/Psy/Test/TabCompletion/AutoCompleterTest.php index c05048d..3f2fda9 100644 --- a/psy/psysh/test/Psy/Test/TabCompletion/AutoCompleterTest.php +++ b/psy/psysh/test/Psy/Test/TabCompletion/AutoCompleterTest.php @@ -18,7 +18,7 @@ use Psy\ContextAware; use Psy\TabCompletion\Matcher; -class AutoCompleterTest extends \PHPUnit_Framework_TestCase +class AutoCompleterTest extends \PHPUnit\Framework\TestCase { /** * @param $line diff --git a/psy/psysh/test/Psy/Test/Util/DocblockTest.php b/psy/psysh/test/Psy/Test/Util/DocblockTest.php index 66e773a..9ed3c02 100644 --- a/psy/psysh/test/Psy/Test/Util/DocblockTest.php +++ b/psy/psysh/test/Psy/Test/Util/DocblockTest.php @@ -13,7 +13,7 @@ use Psy\Util\Docblock; -class DocblockTest extends \PHPUnit_Framework_TestCase +class DocblockTest extends \PHPUnit\Framework\TestCase { /** * @dataProvider comments diff --git a/psy/psysh/test/Psy/Test/Util/MirrorTest.php b/psy/psysh/test/Psy/Test/Util/MirrorTest.php index 7d6a432..ab0b172 100644 --- a/psy/psysh/test/Psy/Test/Util/MirrorTest.php +++ b/psy/psysh/test/Psy/Test/Util/MirrorTest.php @@ -14,7 +14,7 @@ use Psy\Reflection\ReflectionConstant; use Psy\Util\Mirror; -class MirrorTest extends \PHPUnit_Framework_TestCase +class MirrorTest extends \PHPUnit\Framework\TestCase { const FOO = 1; private $bar = 2; diff --git a/psy/psysh/test/Psy/Test/Util/StrTest.php b/psy/psysh/test/Psy/Test/Util/StrTest.php index 25602f9..8bd8e90 100644 --- a/psy/psysh/test/Psy/Test/Util/StrTest.php +++ b/psy/psysh/test/Psy/Test/Util/StrTest.php @@ -13,7 +13,7 @@ use Psy\Util\Str; -class StrTest extends \PHPUnit_Framework_TestCase +class StrTest extends \PHPUnit\Framework\TestCase { /** * @dataProvider testUnvisProvider diff --git a/psy/psysh/test/Psy/Test/VersionUpdater/GitHubCheckerTest.php b/psy/psysh/test/Psy/Test/VersionUpdater/GitHubCheckerTest.php index 32a7e53..07eb0c6 100644 --- a/psy/psysh/test/Psy/Test/VersionUpdater/GitHubCheckerTest.php +++ b/psy/psysh/test/Psy/Test/VersionUpdater/GitHubCheckerTest.php @@ -13,7 +13,7 @@ use Psy\Shell; -class GitHubCheckerTest extends \PHPUnit_Framework_TestCase +class GitHubCheckerTest extends \PHPUnit\Framework\TestCase { /** * @dataProvider malformedResults -- To view, visit https://gerrit.wikimedia.org/r/394514 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If03398bbc565c03987ef843534ab1ee3a4779ca1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/vendor Gerrit-Branch: master Gerrit-Owner: Reedy <re...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits