From de1084eed1f3097ef85ae253d561c68f38b86a8b Mon Sep 17 00:00:00 2001 From: "R. Eric Wheeler" Date: Mon, 25 Jan 2021 21:31:43 +0000 Subject: [PATCH 01/13] Update .gitlab-ci.yml --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c842cc3..d7fe50e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,7 +21,7 @@ before_script: # If Xdebug was installed you can generate a coverage report and see code coverage metrics. test:7.4: only: - - master + - 1.x-dev tags: - default image: php:7.4 @@ -29,7 +29,7 @@ test:7.4: - vendor/bin/phpunit --configuration phpunit.xml --coverage-text --colors=never test:8.0: only: - - master + - 1.x-dev tags: - default image: php:8.0 -- 2.39.5 From ad7928afde91c09bcc8f731094d2d878f4510d76 Mon Sep 17 00:00:00 2001 From: "R. Eric Wheeler" Date: Mon, 25 Jan 2021 14:03:39 -0800 Subject: [PATCH 02/13] Update gitlab-ci --- .gitlab-ci.yml | 4 ++-- README.md | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d7fe50e..981c08c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,7 +21,7 @@ before_script: # If Xdebug was installed you can generate a coverage report and see code coverage metrics. test:7.4: only: - - 1.x-dev + - 1.x tags: - default image: php:7.4 @@ -29,7 +29,7 @@ test:7.4: - vendor/bin/phpunit --configuration phpunit.xml --coverage-text --colors=never test:8.0: only: - - 1.x-dev + - 1.x tags: - default image: php:8.0 diff --git a/README.md b/README.md index b4cb16d..3c4c622 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ This simply uses the FFI extension to enable _getch and _ungetch in Windows and linux. +[![pipeline status](https://repos.bgemi.net/sikofitt/getch/badges/1.x/pipeline.svg)](https://repos.bgemi.net/sikofitt/getch/-/commits/1.x) +[![coverage report](https://repos.bgemi.net/sikofitt/getch/badges/1.x/coverage.svg)](https://repos.bgemi.net/sikofitt/getch/-/commits/1.x) + ```shell script $ composer require sikofitt/getch:dev-master ``` -- 2.39.5 From be74c6f097630e8c6c46cc922f2f32b9581acc0b Mon Sep 17 00:00:00 2001 From: "R. Eric Wheeler" Date: Mon, 15 Feb 2021 11:44:39 -0800 Subject: [PATCH 03/13] Implement returns of special character codes --- composer.lock | 144 ++++++++-------- src/Console/Getch.php | 30 ++++ src/Console/Resources/getch.c | 268 +++++++++++++++++++++++++++-- src/Console/Resources/keycodes.txt | 16 ++ src/Console/Resources/libgetch.so | Bin 16440 -> 16696 bytes tests/Getch/GetchTest.php | 23 ++- tests/Ungetch/UngetchTest.php | 4 +- tests/test.h | 2 + 8 files changed, 395 insertions(+), 92 deletions(-) create mode 100644 src/Console/Resources/keycodes.txt diff --git a/composer.lock b/composer.lock index 935e256..b0b2ea0 100644 --- a/composer.lock +++ b/composer.lock @@ -377,16 +377,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.18.1", + "version": "v2.18.2", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "c68ff6231adb276857761e43b7ed082f164dce0b" + "reference": "18f8c9d184ba777380794a389fabc179896ba913" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c68ff6231adb276857761e43b7ed082f164dce0b", - "reference": "c68ff6231adb276857761e43b7ed082f164dce0b", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/18f8c9d184ba777380794a389fabc179896ba913", + "reference": "18f8c9d184ba777380794a389fabc179896ba913", "shasum": "" }, "require": { @@ -468,7 +468,7 @@ "description": "A tool to automatically fix PHP code style", "support": { "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", - "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.18.1" + "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.18.2" }, "funding": [ { @@ -476,7 +476,7 @@ "type": "github" } ], - "time": "2021-01-21T18:50:42+00:00" + "time": "2021-01-26T00:22:21+00:00" }, { "name": "jetbrains/phpstorm-stubs", @@ -484,12 +484,12 @@ "source": { "type": "git", "url": "https://github.com/JetBrains/phpstorm-stubs.git", - "reference": "44640f75da5865d1c3b0e433cc72ee4cdc677926" + "reference": "b8cf707c050f775cdb7693afa6099bd227b383f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/44640f75da5865d1c3b0e433cc72ee4cdc677926", - "reference": "44640f75da5865d1c3b0e433cc72ee4cdc677926", + "url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/b8cf707c050f775cdb7693afa6099bd227b383f4", + "reference": "b8cf707c050f775cdb7693afa6099bd227b383f4", "shasum": "" }, "require-dev": { @@ -524,7 +524,7 @@ "support": { "source": "https://github.com/JetBrains/phpstorm-stubs/tree/master" }, - "time": "2021-01-25T16:29:22+00:00" + "time": "2021-02-15T11:11:55+00:00" }, { "name": "myclabs/deep-copy", @@ -1351,16 +1351,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.1", + "version": "9.5.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "e7bdf4085de85a825f4424eae52c99a1cec2f360" + "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7bdf4085de85a825f4424eae52c99a1cec2f360", - "reference": "e7bdf4085de85a825f4424eae52c99a1cec2f360", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f661659747f2f87f9e72095bb207bceb0f151cb4", + "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4", "shasum": "" }, "require": { @@ -1438,7 +1438,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.1" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.2" }, "funding": [ { @@ -1450,7 +1450,7 @@ "type": "github" } ], - "time": "2021-01-17T07:42:25+00:00" + "time": "2021-02-02T14:45:58+00:00" }, { "name": "psr/container", @@ -2571,16 +2571,16 @@ }, { "name": "symfony/console", - "version": "v5.2.1", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "47c02526c532fb381374dab26df05e7313978976" + "reference": "89d4b176d12a2946a1ae4e34906a025b7b6b135a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/47c02526c532fb381374dab26df05e7313978976", - "reference": "47c02526c532fb381374dab26df05e7313978976", + "url": "https://api.github.com/repos/symfony/console/zipball/89d4b176d12a2946a1ae4e34906a025b7b6b135a", + "reference": "89d4b176d12a2946a1ae4e34906a025b7b6b135a", "shasum": "" }, "require": { @@ -2639,7 +2639,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Console Component", + "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", "keywords": [ "cli", @@ -2648,7 +2648,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.2.1" + "source": "https://github.com/symfony/console/tree/v5.2.3" }, "funding": [ { @@ -2664,7 +2664,7 @@ "type": "tidelift" } ], - "time": "2020-12-18T08:03:05+00:00" + "time": "2021-01-28T22:06:19+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2735,16 +2735,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v5.2.1", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "1c93f7a1dff592c252574c79a8635a8a80856042" + "reference": "4f9760f8074978ad82e2ce854dff79a71fe45367" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1c93f7a1dff592c252574c79a8635a8a80856042", - "reference": "1c93f7a1dff592c252574c79a8635a8a80856042", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4f9760f8074978ad82e2ce854dff79a71fe45367", + "reference": "4f9760f8074978ad82e2ce854dff79a71fe45367", "shasum": "" }, "require": { @@ -2797,10 +2797,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony EventDispatcher Component", + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.2.1" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.2.3" }, "funding": [ { @@ -2816,7 +2816,7 @@ "type": "tidelift" } ], - "time": "2020-12-18T08:03:05+00:00" + "time": "2021-01-27T10:36:42+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -2899,16 +2899,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.2.1", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "fa8f8cab6b65e2d99a118e082935344c5ba8c60d" + "reference": "262d033b57c73e8b59cd6e68a45c528318b15038" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/fa8f8cab6b65e2d99a118e082935344c5ba8c60d", - "reference": "fa8f8cab6b65e2d99a118e082935344c5ba8c60d", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/262d033b57c73e8b59cd6e68a45c528318b15038", + "reference": "262d033b57c73e8b59cd6e68a45c528318b15038", "shasum": "" }, "require": { @@ -2938,10 +2938,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.2.1" + "source": "https://github.com/symfony/filesystem/tree/v5.2.3" }, "funding": [ { @@ -2957,20 +2957,20 @@ "type": "tidelift" } ], - "time": "2020-11-30T17:05:38+00:00" + "time": "2021-01-27T10:01:46+00:00" }, { "name": "symfony/finder", - "version": "v5.2.1", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "0b9231a5922fd7287ba5b411893c0ecd2733e5ba" + "reference": "4adc8d172d602008c204c2e16956f99257248e03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/0b9231a5922fd7287ba5b411893c0ecd2733e5ba", - "reference": "0b9231a5922fd7287ba5b411893c0ecd2733e5ba", + "url": "https://api.github.com/repos/symfony/finder/zipball/4adc8d172d602008c204c2e16956f99257248e03", + "reference": "4adc8d172d602008c204c2e16956f99257248e03", "shasum": "" }, "require": { @@ -2999,10 +2999,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Finder Component", + "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.2.1" + "source": "https://github.com/symfony/finder/tree/v5.2.3" }, "funding": [ { @@ -3018,20 +3018,20 @@ "type": "tidelift" } ], - "time": "2020-12-08T17:02:38+00:00" + "time": "2021-01-28T22:06:19+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.2.1", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "87a2a4a766244e796dd9cb9d6f58c123358cd986" + "reference": "5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/87a2a4a766244e796dd9cb9d6f58c123358cd986", - "reference": "87a2a4a766244e796dd9cb9d6f58c123358cd986", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce", + "reference": "5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce", "shasum": "" }, "require": { @@ -3063,7 +3063,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony OptionsResolver Component", + "description": "Provides an improved replacement for the array_replace PHP function", "homepage": "https://symfony.com", "keywords": [ "config", @@ -3071,7 +3071,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.2.1" + "source": "https://github.com/symfony/options-resolver/tree/v5.2.3" }, "funding": [ { @@ -3087,7 +3087,7 @@ "type": "tidelift" } ], - "time": "2020-10-24T12:08:07+00:00" + "time": "2021-01-27T12:56:27+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3721,16 +3721,16 @@ }, { "name": "symfony/process", - "version": "v5.2.1", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "bd8815b8b6705298beaa384f04fabd459c10bedd" + "reference": "313a38f09c77fbcdc1d223e57d368cea76a2fd2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/bd8815b8b6705298beaa384f04fabd459c10bedd", - "reference": "bd8815b8b6705298beaa384f04fabd459c10bedd", + "url": "https://api.github.com/repos/symfony/process/zipball/313a38f09c77fbcdc1d223e57d368cea76a2fd2f", + "reference": "313a38f09c77fbcdc1d223e57d368cea76a2fd2f", "shasum": "" }, "require": { @@ -3760,10 +3760,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Process Component", + "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.2.1" + "source": "https://github.com/symfony/process/tree/v5.2.3" }, "funding": [ { @@ -3779,7 +3779,7 @@ "type": "tidelift" } ], - "time": "2020-12-08T17:03:37+00:00" + "time": "2021-01-27T10:15:41+00:00" }, { "name": "symfony/service-contracts", @@ -3862,16 +3862,16 @@ }, { "name": "symfony/stopwatch", - "version": "v5.2.1", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "2b105c0354f39a63038a1d8bf776ee92852813af" + "reference": "b12274acfab9d9850c52583d136a24398cdf1a0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/2b105c0354f39a63038a1d8bf776ee92852813af", - "reference": "2b105c0354f39a63038a1d8bf776ee92852813af", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/b12274acfab9d9850c52583d136a24398cdf1a0c", + "reference": "b12274acfab9d9850c52583d136a24398cdf1a0c", "shasum": "" }, "require": { @@ -3901,10 +3901,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Stopwatch Component", + "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.2.1" + "source": "https://github.com/symfony/stopwatch/tree/v5.2.3" }, "funding": [ { @@ -3920,20 +3920,20 @@ "type": "tidelift" } ], - "time": "2020-11-01T16:14:45+00:00" + "time": "2021-01-27T10:15:41+00:00" }, { "name": "symfony/string", - "version": "v5.2.1", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed" + "reference": "c95468897f408dd0aca2ff582074423dd0455122" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed", - "reference": "5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed", + "url": "https://api.github.com/repos/symfony/string/zipball/c95468897f408dd0aca2ff582074423dd0455122", + "reference": "c95468897f408dd0aca2ff582074423dd0455122", "shasum": "" }, "require": { @@ -3976,7 +3976,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony String component", + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", "homepage": "https://symfony.com", "keywords": [ "grapheme", @@ -3987,7 +3987,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.2.1" + "source": "https://github.com/symfony/string/tree/v5.2.3" }, "funding": [ { @@ -4003,7 +4003,7 @@ "type": "tidelift" } ], - "time": "2020-12-05T07:33:16+00:00" + "time": "2021-01-25T15:14:59+00:00" }, { "name": "theseer/tokenizer", diff --git a/src/Console/Getch.php b/src/Console/Getch.php index 301c2e1..4825458 100644 --- a/src/Console/Getch.php +++ b/src/Console/Getch.php @@ -19,6 +19,31 @@ use RuntimeException; final class Getch { + // Special key codes + public const GETCH_SPECIAL = 0; + public const GETCH_F1 = 59; + public const GETCH_F2 = 60; + public const GETCH_F3 = 61; + public const GETCH_F4 = 62; + public const GETCH_F5 = 63; + public const GETCH_F6 = 64; + public const GETCH_F7 = 65; + public const GETCH_F8 = 66; + public const GETCH_F9 = 67; + public const GETCH_F10 = 68; + public const GETCH_F11 = 87; + public const GETCH_F12 = 88; + public const GETCH_UP_ARROW = 72; + public const GETCH_LEFT_ARROW = 75; + public const GETCH_RIGHT_ARROW = 77; + public const GETCH_DOWN_ARROW = 80; + public const GETCH_DELETE = 83; + public const GETCH_HOME = 102; + public const GETCH_PGUP = 104; + public const GETCH_END = 107; + public const GETCH_PGDN = 109; + public const GETCH_INSERT = 110; + private const LINUX_LIBRARY = __DIR__.'/Resources/libgetch.so'; private const WINDOWS_LIBRARY = 'ucrtbase.dll'; private const DECLARATIONS = << #include #include -static struct termios oldattr; +#include +#include +#define CTRL_KEY(k) ((k) & 0x1f) + +static struct termios oldattr; +static int stdin_flags; + +/* static char *strrev(char *str) { char *p1, *p2; @@ -19,26 +26,152 @@ static char *strrev(char *str) } return str; } - - -static void setRawMode(void) -{ - struct termios newattr; - - tcgetattr(STDIN_FILENO, &oldattr); - newattr = oldattr; - cfmakeraw(&newattr); - tcsetattr(STDIN_FILENO, TCSANOW, &newattr); - -} +*/ static void setNormalMode(void) { tcsetattr(STDIN_FILENO, TCSANOW, &oldattr); + fcntl(STDIN_FILENO, F_SETFL, stdin_flags); } +static void setRawMode(void) +{ + tcgetattr(STDIN_FILENO, &oldattr); + atexit(setNormalMode); + + struct termios raw = oldattr; + + raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); + raw.c_oflag &= ~(OPOST); + raw.c_cflag |= (CS8); + raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); + raw.c_cc[VMIN] = 0; + raw.c_cc[VTIME] = 1; + + tcsetattr(STDIN_FILENO, TCSANOW, &raw); + +} + +// F1 - 59 +// F2 - 60, +// F3 - 61, +// F2 - 62 +// F1-12 = 59 - 68 +enum special_keycodes { + GETCH_F1 = 59, + GETCH_F2, + GETCH_F3, + GETCH_F4, + GETCH_F5, + GETCH_F6, + GETCH_F7, + GETCH_F8, + GETCH_F9, + GETCH_F10, + GETCH_UP_ARROW = 72, + GETCH_LEFT_ARROW = 75, + GETCH_RIGHT_ARROW = 77, + GETCH_DOWN_ARROW = 80, + GETCH_DELETE = 83, + GETCH_F11 = 87, + GETCH_F12, + GETCH_HOME = 102, + GETCH_PGUP = 104, + GETCH_END = 107, + GETCH_PGDOWN = 109, + GETCH_INSERT +}; + +void _ungetc(int c) { + ungetc(c, stdin); +} + +int readKey(void) { + +int bytesRead; + + char key; + + while ((key = fgetc(stdin)) == EOF) { + } + + if (key == '\x1b') { + char seq[4]; + if ((seq[0] = getchar()) == EOF) return '\x1b'; // [ + if ((seq[1] = getchar()) == EOF) return '\x1b'; + + if (seq[0] == '[') { + if(seq[1] == 'H') { _ungetc(GETCH_HOME); return 0; } + if(seq[1] == 'F') { _ungetc(GETCH_END); return 0; } + + if (seq[1] >= '0' && seq[1] <= '9') { + if ((seq[2] = getchar()) == EOF) return '\x1b'; + if (seq[2] == '~') { + switch (seq[1]) { + case '1': _ungetc(GETCH_HOME); return 0; + case '2': _ungetc(GETCH_INSERT); return 0; + case '3': _ungetc(GETCH_DELETE); return 0; + case '4': _ungetc(GETCH_END); return 0; + case '5': _ungetc(GETCH_PGUP); return 0; + case '6': _ungetc(GETCH_PGDOWN); return 0; + case '7': _ungetc(GETCH_HOME); return 0; + case '8': _ungetc(GETCH_END); return 0; + } + } else if(seq[2] >= '0' && seq[2] <= '9') { + if ((seq[3] = getchar()) == EOF) return '\x1b'; + if(seq[3] != '~') return seq[3]; + + switch(seq[2]) { + case '5': _ungetc(GETCH_F5); return 0; + case '7': _ungetc(GETCH_F6); return 0; + case '8': _ungetc(GETCH_F7); return 0; + case '9': _ungetc(GETCH_F8); return 0; + case '0': _ungetc(GETCH_F9); return 0; + case '1': _ungetc(GETCH_F10); return 0; + case '3': _ungetc(GETCH_F11); return 0; + case '4': _ungetc(GETCH_F12); return 0; + } + + } else { return seq[2]; } + } else { + switch (seq[1]) { + case 'A': _ungetc(GETCH_UP_ARROW); return 0; + case 'B': _ungetc(GETCH_DOWN_ARROW); return 0; + case 'C': _ungetc(GETCH_RIGHT_ARROW); return 0; + case 'D': _ungetc(GETCH_LEFT_ARROW); return 0; + case 'H': _ungetc(GETCH_HOME); return 0; + case 'F': _ungetc(GETCH_END); return 0; + } + } + } + else if (seq[0] == 'O') { + switch (seq[1]) { + case 'H': _ungetc(GETCH_HOME); return 0; + case 'F': _ungetc(GETCH_END); return 0; + case 'P': _ungetc(GETCH_F1); return 0; + case 'Q': _ungetc(GETCH_F2); return 0; + case 'R': _ungetc(GETCH_F3); return 0; + case 'S': _ungetc(GETCH_F4); return 0; + } + } + return '\x1b'; + } else { + return key; + } +} + +int _getch(void) { + + setRawMode(); + + int key = readKey(); + + setNormalMode(); + + return key; +} /* reads from keypress, doesn't echo */ -int _getch(void) +int old_getch(void) { int ch; @@ -49,6 +182,113 @@ int _getch(void) setNormalMode(); +if(ch == 27) { + +char sequence[4]; + +if (read(STDIN_FILENO, &sequence[0], 1) != 1) return 27; // [ +if (read(STDIN_FILENO, &sequence[1], 1) != 1) return 27; // 0-9 + + switch(ch) + { + case 79: // F1-F4 + ch = getchar(); + switch(ch) { + case 80: // F1, [ESC]OP + _ungetc(GETCH_F1); + return 0; + break; + case 81: // F2, [ESC]OQ + _ungetc(GETCH_F2); + return 0; + break; + case 82: // F3,, [ESC]OR + _ungetc(61); + return 0; + case 83: // F4, , [ESC]OS + _ungetc(62); + return 0; + } + case 91: // [, Everything else + ch = getchar(); + switch(ch) { + case 49: // 1, F5-F8, HOME + ch = getchar(); + switch(ch) { + case 53: // 5, F5 + getchar(); // get the ~ + _ungetc(63); + return 0; + case 55: // 7, F6 + getchar(); + _ungetc(64); + return 0; + case 56: // 8, F7 + getchar(); + _ungetc(65); + return 0; + case 57: // 9, F8 + getchar(); + _ungetc(66); + return 0; + case 126: // ~, HOME + _ungetc(102); + return 0; + } + case 50: // 2, F9-F12, INSERT + ch = getchar(); + switch(ch) { + case 48: // 0, F9, [ESC][20~ + getchar(); + _ungetc(67); + return 0; + case 49: // 1, F10, [ESC][21~ + getchar(); + _ungetc(68); + return 0; + case 51: // 3, F11, [ESC][23~ + getchar(); + _ungetc(87); + return 0; + case 52: // 4, F12, [ESC][24~ + getchar(); + _ungetc(88); + return 0; + case 126: // ~, INSERT, [ESC][2~ + _ungetc(110); + return 0; + } + case 51: // 3, DELETE, [ESC][3~ + getchar(); // ~ + _ungetc(83); + return 0; + case 52: // 4, END, [ESC][4~ + getchar(); // ~ + _ungetc(107); + return 0; + case 53: // 5, PGUP, [ESC][5~ + getchar(); // ~ + _ungetc(104); + return 0; + case 54: // 6, PGDN, [ESC][6~ + getchar(); // ~ + _ungetc(109); + return 0; + case 65: // A, UP_ARROW, [ESC][A //72 + _ungetc(72); + return 0; + case 66: // B, DOWN_ARROW, [ESC][B // 80 + _ungetc(80); + return 0; + case 67: // C, RIGHT_ARROW, [ESC][C /77 + _ungetc(77); + return 0; + case 68: // D, LEFT_ARROW, [ESC][D //75 + _ungetc(75); + return 0; + } + } + } return ch; } diff --git a/src/Console/Resources/keycodes.txt b/src/Console/Resources/keycodes.txt new file mode 100644 index 0000000..58ce75a --- /dev/null +++ b/src/Console/Resources/keycodes.txt @@ -0,0 +1,16 @@ +F1-10 = 59..68 +UP_ARROW = 72 +LEFT_ARROW = 75 +RIGHT_ARROW = 77 +DOWN_ARROW = 80 +DELETE = 83 +F11-12 = 87..88 +HOME = 102 +PGUP = 104 +END = 107 +PGDN = 109 +INSERT = 110 + + + + diff --git a/src/Console/Resources/libgetch.so b/src/Console/Resources/libgetch.so index 8750c7b2d20a7bc1ce5539d80fcf26417a03bb0e..82dae79752af20315d789689f8a515987fd7fc90 100755 GIT binary patch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gl!G;DNDEwqD76@#8a;#NCfKDEYno_)I0gyC0wB&JRD1*}>!XZZ_1L}NSru<~_eFcH>fyXxmwtSnsy09Bv2$Ja zMf>$}Gl+W;Q?JKc9hnbaX}wyg_EpvYyjM-v={lOBKEM}qf1&$Q9j^XTAfEINhVWn# z!d;BZeNI~2fJ(&U5A{c-9Y>@}d~(34eYtOvE|no15j8!|F9NUT{|T+XPz}dXLHVj7 z>J%uof0Fm7>vvwje!%z+PIA!ix`4gTc!clA`W+Xr^Ej&YTPvOyp&!Bgd4d8JDAn5e z6LiSW0q$4cef?GA)939K;E^ix;bVghnPOk7Xqhtg7fDtjZdG48-Ul*T|6*P zHUW>K?_hZhIEUUR$^x&JUou<+Kd$jPDwxmlQVspnz@xq%4RfxB{vT@KS2aF8zvPn| z`t$3mk84E@ybX9YKlcJ(R>gnSQ*esTAa-B%sGDgkwv)4aC~>8TG?7%^K9J4tPiF0u zlP?tQ|m)$v!&kCLWi>8cL@zX+3@{n8kBbx-O8=b5lZX1=5a8c8_1h zO&apUZeEa^UgVd%8Ag8Cn=TZPP|DMPkk;h4QnBJt&PnbEbqa>|N$o)YV5~1$>{GGS zP(RcRMIKa)Bu}Ob#Z126$Jme+(%B>#aBU##sF?nlVyMOr+_GW2F2xSid2}k z24LJdePuZ~T62q;tjC1X{g4W+Z>cKwvR+=vGO?F+n^0NTLroWMPFO`rW3|HZyD zYBYtmkkC_P+yc>hkk(4_{3p-NZvL()G8KEF-vi$4v6uCGOUxLE9-F)KNAPh7Xzob= zvd))0=Mwubaffi = \FFI::load(__DIR__.'/../test.h'); - $stdin = $this->ffi->stdin; + $file = $this->ffi->stdin; + $stdin = $this->ffi->fopen('/dev/stdin', 'a+'); foreach (range('D', 'A') as $character) { - $this->ffi->ungetc(ord($character), $stdin); + $this->ffi->ungetc(ord($character), $file); } - - parent::setUp(); // TODO: Change the autogenerated stub } /** * @preserveGlobalState disabled + * @backupStaticAttributes false + * @backupGlobals false */ public function testFailureOnInvalidLibrary() { + Getch::resetFFI(); $this->expectException(\RuntimeException::class); \getch(__DIR__.'/library.so'); } @@ -53,4 +56,16 @@ class GetchTest extends TestCase $this->expectException(\RuntimeException::class); \getch(); } + + public function testHomeKey() + { + $stdin = $this->ffi->stdin; + + foreach (str_split(strrev(self::HOME_KEY)) as $character) { + $this->ffi->ungetc(ord($character), $stdin); + } + $g = new Getch(); + self::assertEquals(0, $g->getch()); + self::assertEquals(102, $g->getch()); + } } diff --git a/tests/Ungetch/UngetchTest.php b/tests/Ungetch/UngetchTest.php index 1b5515a..e495257 100644 --- a/tests/Ungetch/UngetchTest.php +++ b/tests/Ungetch/UngetchTest.php @@ -34,14 +34,14 @@ class UngetchTest extends TestCase public function testForFun() { - foreach(\str_split(\strrev('Hello World!')) as $char) { + foreach (\str_split(\strrev('Hello World!')) as $char) { ungetch($char); } $result = ''; do { $ord = getch(); $result .= \chr($ord); - } while($ord !== ord('!')); + } while ($ord !== ord('!')); self::assertSame('Hello World!', $result); } } diff --git a/tests/test.h b/tests/test.h index 5f84fc9..9de0eca 100644 --- a/tests/test.h +++ b/tests/test.h @@ -13,5 +13,7 @@ typedef struct _iobuf FILE *stdin; +FILE *fopen(const char *filename, const char *mode); + int ungetc(int ch, FILE *stream); -- 2.39.5 From a918fd2cac10e435f21eaa4dce8c0b02b230a2ba Mon Sep 17 00:00:00 2001 From: "R. Eric Wheeler" Date: Mon, 15 Feb 2021 13:20:10 -0800 Subject: [PATCH 04/13] Fixed readKey function --- src/Console/Resources/getch.c | 21 ++++++--------------- src/Console/Resources/libgetch.so | Bin 16696 -> 16616 bytes 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/Console/Resources/getch.c b/src/Console/Resources/getch.c index 7e56040..e30ed66 100644 --- a/src/Console/Resources/getch.c +++ b/src/Console/Resources/getch.c @@ -4,12 +4,10 @@ #include #include #include -#include #define CTRL_KEY(k) ((k) & 0x1f) static struct termios oldattr; -static int stdin_flags; /* static char *strrev(char *str) @@ -30,23 +28,15 @@ static char *strrev(char *str) static void setNormalMode(void) { tcsetattr(STDIN_FILENO, TCSANOW, &oldattr); - fcntl(STDIN_FILENO, F_SETFL, stdin_flags); } static void setRawMode(void) { tcgetattr(STDIN_FILENO, &oldattr); - atexit(setNormalMode); struct termios raw = oldattr; - raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); - raw.c_oflag &= ~(OPOST); - raw.c_cflag |= (CS8); - raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); - raw.c_cc[VMIN] = 0; - raw.c_cc[VTIME] = 1; - + cfmakeraw(&raw); tcsetattr(STDIN_FILENO, TCSANOW, &raw); } @@ -87,12 +77,12 @@ void _ungetc(int c) { int readKey(void) { -int bytesRead; - char key; - while ((key = fgetc(stdin)) == EOF) { - } + + + int key = getchar(); + if (key == '\x1b') { char seq[4]; @@ -161,6 +151,7 @@ int bytesRead; int _getch(void) { + atexit(setNormalMode); setRawMode(); int key = readKey(); diff --git a/src/Console/Resources/libgetch.so b/src/Console/Resources/libgetch.so index 82dae79752af20315d789689f8a515987fd7fc90..3142cc7e347e1feede842fcd6e56bc20525b9480 100755 GIT binary patch delta 3929 zcma))IqR=3JsUU#2M(ypMMNE5qDt475gdMWPcezMHzOVLZd?)_`z zW^&4dzBCXS#(opG;}){X%v_XbdBna8IXCT>Gv!UR)#8y4YxfuFs>LsNX!*5#r{^qQ z3R=DLAGA`7wLHvCWk@N~-V9`LmFS6d04ei&j}Bh2>ggVXpEmrzZ`1ifgJ&83lXNV- zYVh~R>R^JwrDe<3to!kL%C|LUwys#Ss4fcjE3A?Q zKS{fDPS4Aj3;oBlVv)|n!IFW{UB&pOUZUiTg77{-z5M+BL;}720zipocX1L49aSQWPJ%{s`g5K3fL;J?*Xeeh z_JUpp-J%!!qV{Kyi-c5VH@9jV(XbL7tF?NA+zra7RPqbM^G);6=u!sS1i~CX6u+$xCA`GQ0sVT&>a3g z(V!~WF8VYpcg$6kJ41KyNOy)GX$iTrGv$Y=Bzt^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0Nb8z9j8y6H-qVq28b|fB;Y_aiti{sczJklApn|nGtx4^{3+0b5(Th_ogI4$rKL#XBP%D`U-3;?_mJDwFD{3#@FrVO`zIupM5t z3}<%q2^d))s%j!;w?(>|>BP>mFRZFtd22n;<*PQ>VN2Ut%hmzH;U1lXy?n*$rFARp z)eQ}IgxA~a>z1wv<17%>+MLPxM<;`1?L#3xc|+%Ij(H`r{V{FLc(T)fi=u~%yBZBfa29XT5 z#=zpd6t2{Hp%g>+i-=&fO?TI}W@N&gGFAOnS#TO9L^|7>P<+gxoKZQM&*nrz1TlCz zF(3+!#(x^4#|Qp~iD7uFzzIzkdSG6^vw9U0^v=L$yl!MVg!zpEt#t$4771D-usyG9 znGR}2mV4X3QQK2JDDZm|Q-04Pdpupo_%8~Ke8TT_<~ggMx84;UuV-K)LnE$k`+&A% zIw-Yr7k-R0rR`*H`ynl0%I)PGm}g48*lo}2Nv4nR3#!h5%jNvGdhB@}&y?RUS>N0K zK5ftUM+CH{ro)D`JoSFb&7h;rNW`-7n*bOrVsLwk^*wI9F# z^7_}DUuH#3*`Dct0r$J?`F*4^s0>(7o16Z}_yGv0?{WG3-ood+2X*~f&USns>E)eN zSkCV^$8P|LP_2l$vOUumA#vM_kXEfxv|F=G*pBI|5V-C6eW_d9v!2(U`J+gX4%fdg zq$IuCzEQE}8Zar9pzXp`zE(F Date: Mon, 22 Feb 2021 17:35:17 -0800 Subject: [PATCH 05/13] updated libgetch --- src/Console/Getch.php | 16 ++ src/Console/Resources/Makefile | 2 +- src/Console/Resources/getch.c | 412 +++++++++++++----------------- src/Console/Resources/libgetch.so | Bin 16616 -> 17264 bytes tests/Getch/GetchTest.php | 4 +- 5 files changed, 203 insertions(+), 231 deletions(-) diff --git a/src/Console/Getch.php b/src/Console/Getch.php index 4825458..5479c35 100644 --- a/src/Console/Getch.php +++ b/src/Console/Getch.php @@ -80,6 +80,22 @@ final class Getch } } +/* public function keyCode(string $device): array + { + + $arrayType = \FFI::arrayType(self::$ffi->type('int'), [3]); + $res = \FFI::new($arrayType); + + $arrayType = self::$ffi->keyCode($device); + + return [ + 'type' => $arrayType[0], + 'code' => $arrayType[1], + 'value' => $arrayType[2], + 'keyCode' => $arrayType[3], + ]; + }*/ + public function getch(): int { return self::$ffi->_getch(); diff --git a/src/Console/Resources/Makefile b/src/Console/Resources/Makefile index fa3a278..1bdfab1 100644 --- a/src/Console/Resources/Makefile +++ b/src/Console/Resources/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -shared -Wall -fPIC +CFLAGS = -shared -Wall -Wno-unknown-pragmas -fPIC all: @${CC} ${CFLAGS} getch.c -o libgetch.so diff --git a/src/Console/Resources/getch.c b/src/Console/Resources/getch.c index e30ed66..54a6105 100644 --- a/src/Console/Resources/getch.c +++ b/src/Console/Resources/getch.c @@ -3,14 +3,105 @@ #include #include #include -#include +#include +#include +#include -#define CTRL_KEY(k) ((k) & 0x1f) +// #define FKEY(k) ((k) >= KEY_F1 && (k) <= KEY_F10) || (k) == KEY_F12 || (k) == KEY_F11 +#define NOTNUMPAD(k) ((k) >= KEY_HOME && (k) <= KEY_DELETE) -static struct termios oldattr; +#define EVENT_DEVICE_GLOB "/dev/input/by-path/*-event-kbd" -/* -static char *strrev(char *str) +static struct termios oldTermAttributes; + +static void setRawMode(void); +static void setNormalMode(void); + +inline static int discardRead(unsigned int length) +{ + char buffer[length]; + ssize_t bytes_read; + + int flags = fcntl(STDIN_FILENO, F_GETFL); + fcntl(STDIN_FILENO, F_SETFL, flags|O_NONBLOCK); + + if( (bytes_read = fread(buffer, sizeof(char), length, stdin)) == -1) { + perror("discardRead"); + } + + fcntl(STDIN_FILENO, F_SETFL, flags); + + return (int)bytes_read; +} + +int getEventDevice(const char * device) +{ + glob_t search; + + int globResult = glob( + EVENT_DEVICE_GLOB, + GLOB_NOSORT, + NULL, + &search + ); + + if(0 != globResult) { + globfree(&search); + return -1; + } + + if(search.gl_pathc == 0) { + globfree(&search); + return -1; + } + + size_t pathLength; + + for(int i = 0; i= '0' && seq[1] <= '9') { - if ((seq[2] = getchar()) == EOF) return '\x1b'; - if (seq[2] == '~') { - switch (seq[1]) { - case '1': _ungetc(GETCH_HOME); return 0; - case '2': _ungetc(GETCH_INSERT); return 0; - case '3': _ungetc(GETCH_DELETE); return 0; - case '4': _ungetc(GETCH_END); return 0; - case '5': _ungetc(GETCH_PGUP); return 0; - case '6': _ungetc(GETCH_PGDOWN); return 0; - case '7': _ungetc(GETCH_HOME); return 0; - case '8': _ungetc(GETCH_END); return 0; - } - } else if(seq[2] >= '0' && seq[2] <= '9') { - if ((seq[3] = getchar()) == EOF) return '\x1b'; - if(seq[3] != '~') return seq[3]; - - switch(seq[2]) { - case '5': _ungetc(GETCH_F5); return 0; - case '7': _ungetc(GETCH_F6); return 0; - case '8': _ungetc(GETCH_F7); return 0; - case '9': _ungetc(GETCH_F8); return 0; - case '0': _ungetc(GETCH_F9); return 0; - case '1': _ungetc(GETCH_F10); return 0; - case '3': _ungetc(GETCH_F11); return 0; - case '4': _ungetc(GETCH_F12); return 0; - } - - } else { return seq[2]; } - } else { - switch (seq[1]) { - case 'A': _ungetc(GETCH_UP_ARROW); return 0; - case 'B': _ungetc(GETCH_DOWN_ARROW); return 0; - case 'C': _ungetc(GETCH_RIGHT_ARROW); return 0; - case 'D': _ungetc(GETCH_LEFT_ARROW); return 0; - case 'H': _ungetc(GETCH_HOME); return 0; - case 'F': _ungetc(GETCH_END); return 0; - } - } + if (scanCode == KEY_ESC) { + return 27; } - else if (seq[0] == 'O') { - switch (seq[1]) { - case 'H': _ungetc(GETCH_HOME); return 0; - case 'F': _ungetc(GETCH_END); return 0; - case 'P': _ungetc(GETCH_F1); return 0; - case 'Q': _ungetc(GETCH_F2); return 0; - case 'R': _ungetc(GETCH_F3); return 0; - case 'S': _ungetc(GETCH_F4); return 0; - } + + int returnResult = 0; + + if (NOTNUMPAD(scanCode)) { + scanCode = resolveScanCode(scanCode); + returnResult = 224; } - return '\x1b'; - } else { - return key; + + u_short discardBytes; + + switch (scanCode) { + case KEY_F1: + case KEY_F2: + case KEY_F3: + case KEY_F4: + + case KEY_KP1: // END + case KEY_KP2: // DOWN + case KEY_KP4: // LEFT + case KEY_KP6: // RIGHT + case KEY_KP7: // HOME + case KEY_KP8: // UP + discardBytes = 2; + break; + case KEY_KP0: // INSERT + case KEY_KPDOT: // DELETE + case KEY_KP9: // PAGEUP + case KEY_KP3: // PAGEDOWN + discardBytes = 3; + break; + case KEY_F5: + case KEY_F6: + case KEY_F7: + case KEY_F8: + case KEY_F9: + case KEY_F10: + case KEY_F11: + case KEY_F12: + discardBytes = 4; + break; + + default: + discardBytes = 0; + } + + if (discardBytes != 0) { + discardRead(discardBytes); + } + + pushStdin(scanCode); + return returnResult; } + + return key; } int _getch(void) { @@ -161,129 +237,7 @@ int _getch(void) { return key; } -/* reads from keypress, doesn't echo */ -int old_getch(void) -{ - int ch; - - setRawMode(); - atexit(setNormalMode); - - ch = getchar(); - - setNormalMode(); - -if(ch == 27) { - -char sequence[4]; - -if (read(STDIN_FILENO, &sequence[0], 1) != 1) return 27; // [ -if (read(STDIN_FILENO, &sequence[1], 1) != 1) return 27; // 0-9 - - switch(ch) - { - case 79: // F1-F4 - ch = getchar(); - switch(ch) { - case 80: // F1, [ESC]OP - _ungetc(GETCH_F1); - return 0; - break; - case 81: // F2, [ESC]OQ - _ungetc(GETCH_F2); - return 0; - break; - case 82: // F3,, [ESC]OR - _ungetc(61); - return 0; - case 83: // F4, , [ESC]OS - _ungetc(62); - return 0; - } - case 91: // [, Everything else - ch = getchar(); - switch(ch) { - case 49: // 1, F5-F8, HOME - ch = getchar(); - switch(ch) { - case 53: // 5, F5 - getchar(); // get the ~ - _ungetc(63); - return 0; - case 55: // 7, F6 - getchar(); - _ungetc(64); - return 0; - case 56: // 8, F7 - getchar(); - _ungetc(65); - return 0; - case 57: // 9, F8 - getchar(); - _ungetc(66); - return 0; - case 126: // ~, HOME - _ungetc(102); - return 0; - } - case 50: // 2, F9-F12, INSERT - ch = getchar(); - switch(ch) { - case 48: // 0, F9, [ESC][20~ - getchar(); - _ungetc(67); - return 0; - case 49: // 1, F10, [ESC][21~ - getchar(); - _ungetc(68); - return 0; - case 51: // 3, F11, [ESC][23~ - getchar(); - _ungetc(87); - return 0; - case 52: // 4, F12, [ESC][24~ - getchar(); - _ungetc(88); - return 0; - case 126: // ~, INSERT, [ESC][2~ - _ungetc(110); - return 0; - } - case 51: // 3, DELETE, [ESC][3~ - getchar(); // ~ - _ungetc(83); - return 0; - case 52: // 4, END, [ESC][4~ - getchar(); // ~ - _ungetc(107); - return 0; - case 53: // 5, PGUP, [ESC][5~ - getchar(); // ~ - _ungetc(104); - return 0; - case 54: // 6, PGDN, [ESC][6~ - getchar(); // ~ - _ungetc(109); - return 0; - case 65: // A, UP_ARROW, [ESC][A //72 - _ungetc(72); - return 0; - case 66: // B, DOWN_ARROW, [ESC][B // 80 - _ungetc(80); - return 0; - case 67: // C, RIGHT_ARROW, [ESC][C /77 - _ungetc(77); - return 0; - case 68: // D, LEFT_ARROW, [ESC][D //75 - _ungetc(75); - return 0; - } - } - } - return ch; -} - -int _ungetch(char ch) +int _ungetch(int ch) { return ungetc(ch, stdin); } \ No newline at end of file diff --git a/src/Console/Resources/libgetch.so b/src/Console/Resources/libgetch.so index 3142cc7e347e1feede842fcd6e56bc20525b9480..90d8939257245cb6ef4f0a8d9e998f299d5c2899 100755 GIT binary patch literal 17264 zcmeHPeUMYvb-!Be!rF`3H8B($LlgorI6+`+4E_LXS+qQCz_73$w~iyU(i6KyyV{Z7 z^3~a}wY-j1l@3W=mq|0z9mjD<(#}w~F^Xfm0=ovMB%?Bo<4Kxyrj+oO3_UyYIex_1@V-!Ofiw9*^MU73&0XW7jGqpasY8 z))|n1SR(POvVyx=Emw{HK< zJFooNTmSL5-~IE?nd_c#j0h;X(w~B#<-&;lW(}PB;ltrhVF1<2c?h^3q7^3HHT1t) z10Se?zgz?Fsew;}1FN-@{OZHuPOkx|rvFwA{Kqx$LJj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C-llhXcd=l5s%Bp9;c z_V0}<%}(vVRf*;pHk@MUb7E@0HaA-K4;w@=WJ}3QdF&~TIu7UpYxTrH{{s=k{o(nS kt`Baz@>Iv+rHc0W3g>#+me$y%{2P`ji#OO%Q@{WJ0H#<5Q~&?~ diff --git a/tests/Getch/GetchTest.php b/tests/Getch/GetchTest.php index bde782b..b71ee8c 100644 --- a/tests/Getch/GetchTest.php +++ b/tests/Getch/GetchTest.php @@ -59,6 +59,8 @@ class GetchTest extends TestCase public function testHomeKey() { + self::markTestSkipped('This seems impossible to test, since it relies on someone actually pressing keys on the keyboard.'); + $stdin = $this->ffi->stdin; foreach (str_split(strrev(self::HOME_KEY)) as $character) { @@ -66,6 +68,6 @@ class GetchTest extends TestCase } $g = new Getch(); self::assertEquals(0, $g->getch()); - self::assertEquals(102, $g->getch()); + self::assertEquals(71, $g->getch()); } } -- 2.39.5 From e06f9e0cc79429ae0c2d55e7964d3945d7d485f7 Mon Sep 17 00:00:00 2001 From: "R. Eric Wheeler" Date: Wed, 24 Feb 2021 20:47:44 -0800 Subject: [PATCH 06/13] Updated libgetch --- src/Console/Resources/getch.c | 79 +++++++++++++----------------- src/Console/Resources/libgetch.so | Bin 17264 -> 16792 bytes 2 files changed, 33 insertions(+), 46 deletions(-) diff --git a/src/Console/Resources/getch.c b/src/Console/Resources/getch.c index 54a6105..ac71127 100644 --- a/src/Console/Resources/getch.c +++ b/src/Console/Resources/getch.c @@ -1,3 +1,9 @@ +/*********************************************************************** + * This Source Code Form is subject to the terms of the Mozilla Public * + * License, v. 2.0. If a copy of the MPL was not distributed with this * + * file, You can obtain one at http://mozilla.org/MPL/2.0/. * + ***********************************************************************/ + #include #include #include @@ -7,34 +13,31 @@ #include #include -// #define FKEY(k) ((k) >= KEY_F1 && (k) <= KEY_F10) || (k) == KEY_F12 || (k) == KEY_F11 +#define FKEY(k) ((k) >= KEY_F1 && (k) <= KEY_F10) || (k) == KEY_F12 || (k) == KEY_F11 #define NOTNUMPAD(k) ((k) >= KEY_HOME && (k) <= KEY_DELETE) #define EVENT_DEVICE_GLOB "/dev/input/by-path/*-event-kbd" static struct termios oldTermAttributes; -static void setRawMode(void); -static void setNormalMode(void); - -inline static int discardRead(unsigned int length) +static int discardRead(unsigned int length) { char buffer[length]; - ssize_t bytes_read; + ssize_t bytesRead; int flags = fcntl(STDIN_FILENO, F_GETFL); fcntl(STDIN_FILENO, F_SETFL, flags|O_NONBLOCK); - if( (bytes_read = fread(buffer, sizeof(char), length, stdin)) == -1) { + if( (bytesRead = fread(buffer, sizeof(char), length, stdin)) == -1) { perror("discardRead"); } fcntl(STDIN_FILENO, F_SETFL, flags); - return (int)bytes_read; + return (int)bytesRead; } -int getEventDevice(const char * device) +static int getEventDevice(const char * device) { glob_t search; @@ -70,28 +73,33 @@ int getEventDevice(const char * device) return -1; } -unsigned short getScanCode() +static unsigned short getScanCode() { - struct input_event inputEvent[5]; - int fd; + struct input_event inputEvent[3]; + int eventDevice; const char device[FILENAME_MAX]; - if(-1 == getEventDevice(device)) { + if(getEventDevice(device) == -1) { + perror("getEventDevice"); return KEY_RESERVED; } - if( (fd = open(device, O_RDONLY)) == -1 ) { + if( ( eventDevice = open(device, O_RDONLY)) == -1 ) { + perror("open"); return KEY_RESERVED; }; - if( read(fd, &inputEvent, sizeof (inputEvent)) == -1 ) { + + + if( read(eventDevice, &inputEvent, sizeof(inputEvent)) == -1) { + close(eventDevice); return KEY_RESERVED; } - close(fd); + close(eventDevice); - for(int i = 0; i<=5; i++) { - if(inputEvent[i].type == EV_KEY) { + for(int i = 0;i<3;i++) { + if(inputEvent[i].type == EV_KEY && inputEvent[i].code != KEY_ENTER) { return inputEvent[i].code; } } @@ -99,37 +107,16 @@ unsigned short getScanCode() return KEY_RESERVED; } -#pragma clang diagnostic push -#pragma ide diagnostic ignored "cppcoreguidelines-narrowing-conversions" -inline static char *reverseString(char *str) -{ - char *p1, *p2; - - if (! str || ! *str) - return str; - for (p1 = str, p2 = str + strlen(str) - 1; p2 > p1; ++p1, --p2) - { - *p1 ^= *p2; - *p2 ^= *p1; - *p1 ^= *p2; - } - return str; -} -#pragma clang diagnostic pop - -#pragma clang diagnostic push -#pragma ide diagnostic ignored "bugprone-reserved-identifier" inline static void pushStdin(int c) { ungetc(c, stdin); } -#pragma clang diagnostic pop -inline static void setNormalMode(void) +static void setNormalMode(void) { tcsetattr(STDIN_FILENO, TCSANOW, &oldTermAttributes); } -inline static void setRawMode(void) +static void setRawMode(void) { tcgetattr(STDIN_FILENO, &oldTermAttributes); @@ -140,7 +127,7 @@ inline static void setRawMode(void) } -unsigned short resolveScanCode(unsigned short key) +static unsigned short resolveScanCode(unsigned short key) { switch(key) { case KEY_DOWN: return KEY_KP2; @@ -157,16 +144,15 @@ unsigned short resolveScanCode(unsigned short key) }; } -int readKey(void) { +static int readKey(void) { - unsigned short scanCode; int key = getchar(); if (key == 27) { - scanCode = getScanCode(); + unsigned short scanCode = getScanCode(); - if (scanCode == KEY_ESC) { + if (scanCode == KEY_ESC || scanCode == KEY_RESERVED) { return 27; } @@ -219,6 +205,7 @@ int readKey(void) { } pushStdin(scanCode); + return returnResult; } diff --git a/src/Console/Resources/libgetch.so b/src/Console/Resources/libgetch.so index 90d8939257245cb6ef4f0a8d9e998f299d5c2899..886aca96e3c846fb87143e52dcac58b210e627b9 100755 GIT binary patch delta 3608 zcmai14Qx}_6~6a5j^hv~abm|#Nt-yKG(f>l3JIY&F#)fSiLQZ(iEa%9K~fMc36n#M zXcnjm)H5zg4jO1fo7vDBru{_AIuL(NiUdUi8a544F}k#3k`Za=Fhquh~RwOvb#*H?{Ow6Y1?T>A=GA1z>eUk2~$j#Hb<<@Gb?2?d;(&;|fr!%r_fk|uz&CYPy5HeL7XlI6tHe_TKPDyc$ zH3c+9jAWx2JVr56+axxJPJ=D7X4!U3V(s)9*kxe5C$ahTxYb2(fQ?ULoddjVljXO$ zD|qKm=P=gN&GaJ2{7b!z$uV=ifSU1;Q;wQf!$dNu^m(1k&&gLFgd7-Po<2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i2N)wwDVmEj|+)^co_S61U+0Iv#;Qia!(Hl}Il;9X4<-c%a#Ru@c^t3ErlPlC86R+72y d`t&=iRZGZ7E9$D!POntekBBeLqth!h{|htvlkorm -- 2.39.5 From ba09e1d356a5f8b5c25de3cec25fbcc51fdc944b Mon Sep 17 00:00:00 2001 From: "R. Eric Wheeler" Date: Sat, 27 Feb 2021 19:10:44 -0800 Subject: [PATCH 07/13] Updated libgetch, now includes cinPeek function --- src/Console/Getch.php | 19 +++++- src/Console/Resources/getch.c | 101 +++++++++++++++++++++++++++--- src/Console/Resources/libgetch.so | Bin 16792 -> 17032 bytes tests/Getch/GetchTest.php | 10 +++ 4 files changed, 118 insertions(+), 12 deletions(-) diff --git a/src/Console/Getch.php b/src/Console/Getch.php index 5479c35..dbcc7d8 100644 --- a/src/Console/Getch.php +++ b/src/Console/Getch.php @@ -67,19 +67,32 @@ final class Getch if (null === self::$ffi) { $osFamily = PHP_OS_FAMILY; if ('Windows' === $osFamily) { - self::$ffi = FFI::cdef(self::DECLARATIONS, self::WINDOWS_LIBRARY); + $declarations = self::DECLARATIONS . ' int _kbhit();'; + self::$ffi = FFI::cdef($declarations, self::WINDOWS_LIBRARY); } elseif ('Linux' === $osFamily) { if (!file_exists($linuxLibrary)) { throw new RuntimeException(sprintf('Could not find library file %s.', $linuxLibrary)); } - - self::$ffi = FFI::cdef(self::DECLARATIONS, $linuxLibrary); + $declarations = self::DECLARATIONS . ' int cinPeek();'; + self::$ffi = FFI::cdef($declarations, $linuxLibrary); } else { throw new RuntimeException(sprintf('Sorry, %s is not supported yet.', $osFamily)); } } } + public function peek(): int + { + if(PHP_OS_FAMILY === 'Windows') { + if($ffi->_kbhit()) { + $result = $ffi->_getch(); + $ffi->_ungetch($result); + return $result; + } + return -1; + } + return $ffi->cinPeek(); + } /* public function keyCode(string $device): array { diff --git a/src/Console/Resources/getch.c b/src/Console/Resources/getch.c index ac71127..b39122a 100644 --- a/src/Console/Resources/getch.c +++ b/src/Console/Resources/getch.c @@ -20,6 +20,33 @@ static struct termios oldTermAttributes; +inline static void reverseString(char * str) +{ + if (str) + { + char * end = str + strlen(str) - 1; + + // swap the values in the two given variables + // XXX: fails when a and b refer to same memory location +# define XOR_SWAP(a,b) do\ + {\ + (a) ^= (b);\ + (b) ^= (a);\ + (a) ^= (b);\ + } while (0) + + // walk inwards from both ends of the string, + // swapping until we get to the middle + while (str < end) + { + XOR_SWAP(*str, *end); + str++; + end--; + } +# undef XOR_SWAP + } +} + static int discardRead(unsigned int length) { char buffer[length]; @@ -37,7 +64,7 @@ static int discardRead(unsigned int length) return (int)bytesRead; } -static int getEventDevice(const char * device) +static int getEventDevice(char ** device) { glob_t search; @@ -63,7 +90,8 @@ static int getEventDevice(const char * device) for(int i = 0; i z<5VS!s(8z$ZPuIap5x{;DM>jg?QVlh2`k9MG>3M*+1(t{)9z8zJft<7gjDI>l2N)s)qIG5v9^(qqbUvXkX`lw1_igD!_mt3ox{Q8n8N3O&9;Qsw?b8T_Bh;IEd!e^ds4t_=RQGI&QBd}5inJyu5lHsBr{#c4Hw z8;e2k7jR4#wW4pj5`L8eiF6eQ;T{^?Nc$BLzXT=xKCOSN#Vs*i>`RA zE!-hmLLKooFwGIOEA(VcCnt$530eD=fM@c7)?05f62Rl>Fdp6$iHo*KQ^?yD_1-DgtXsRXK5&Qkj=Rk4 zVl#J#cL^ft#7~_m=fqt{Q9H^Q-3y(2P^B=Ru< z9k1rQXGF%6m!;q-nfH6e3ZK5H>UbW|I0lDIX`iBeKWF~z{R*dhB~KNEWGpzzIAtyP zBnCmxTW~$(q%?2AXIS*7`4n>vh;EVuJQkdy$!V@nuR11E@f`7t-4_feP z7QB+JM4%FZN(3qqs6^oZBLYU^T#b>c{>1`J>HE`hXJOb#yi)VBSyW-k+YlAzyo0m* z1|M?7(^HtpWeP}henvbkNpi!Ie}i}@@oCAwPCPA@az`Y8ig;R*vjCfj#Dc~_0(dE;c>Wt{xre#7ya@y}P|*TF%xc2HBuw773rHEQ2`?^_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z#db$kF95Hge1q}@N+P(sKnC3XSm{FhN#ziDQ4ITikF*Wmz}R1Ma+~s>wLv564y21I)Xvsx`nW;8x%r zUq#BRF^v|W*F7K-lAWk zDy}V`-=gOd3{`#SU9jHlkX-Aj${y73){g?uJ;#J5I!M1MSDBgE6~q-BM5IS0g- z3Xk}xi$`9(fbp`0J)ogNH}9pJg;^GmHIaj#y_nATcz_h?c($zdrDXQKv&Gw6ij^H z#j_DbICNR(-EZqxc?d!)FTDkII xsiC?OuaJY)mG<)getch()); self::assertEquals(71, $g->getch()); } + + public function setPeek() + { + $g = new Getch(); + $g->ungetch('q'); + $peek = $g->peek(); + $getch = $g->getch(); + self::assertEquals($peek, $getch); + self::assertEquals(113, $peek); + } } -- 2.39.5 From aa72be226d31406ed969fa87411659133da3e3c0 Mon Sep 17 00:00:00 2001 From: "R. Eric Wheeler" Date: Mon, 1 Mar 2021 10:46:07 -0800 Subject: [PATCH 08/13] Updated constants to match C declarations --- src/Console/Getch.php | 51 ++++++++++++++++-------------- src/Console/Resources/getch.c | 50 ++++++++++++----------------- src/Console/Resources/libgetch.so | Bin 17032 -> 17536 bytes 3 files changed, 48 insertions(+), 53 deletions(-) diff --git a/src/Console/Getch.php b/src/Console/Getch.php index dbcc7d8..240f9e1 100644 --- a/src/Console/Getch.php +++ b/src/Console/Getch.php @@ -20,29 +20,34 @@ use RuntimeException; final class Getch { // Special key codes - public const GETCH_SPECIAL = 0; - public const GETCH_F1 = 59; - public const GETCH_F2 = 60; - public const GETCH_F3 = 61; - public const GETCH_F4 = 62; - public const GETCH_F5 = 63; - public const GETCH_F6 = 64; - public const GETCH_F7 = 65; - public const GETCH_F8 = 66; - public const GETCH_F9 = 67; - public const GETCH_F10 = 68; - public const GETCH_F11 = 87; - public const GETCH_F12 = 88; - public const GETCH_UP_ARROW = 72; - public const GETCH_LEFT_ARROW = 75; - public const GETCH_RIGHT_ARROW = 77; - public const GETCH_DOWN_ARROW = 80; - public const GETCH_DELETE = 83; - public const GETCH_HOME = 102; - public const GETCH_PGUP = 104; - public const GETCH_END = 107; - public const GETCH_PGDN = 109; - public const GETCH_INSERT = 110; + // Extended scan code used to indicate special keyboard functions + public const KEY_RESERVED = 0; + public const KEY_E0 = 0; + public const KEY_E1 = 224; + + // Supported scan scodes. + public const KEY_F1 = 59; + public const KEY_F2 = 60; + public const KEY_F3 = 61; + public const KEY_F4 = 62; + public const KEY_F5 = 63; + public const KEY_F6 = 64; + public const KEY_F7 = 65; + public const KEY_F8 = 66; + public const KEY_F9 = 67; + public const KEY_F10 = 68; + public const KEY_F11 = 87; + public const KEY_F12 = 88; + public const KEY_UP = 72; + public const KEY_LEFT = 75; + public const KEY_RIGHT = 77; + public const KEY_DOWN = 80; + public const KEY_DELETE = 83; + public const KEY_HOME = 71; + public const KEY_PAGEUP = 73; + public const KEY_END = 79; + public const KEY_PAGEDOWN = 81; + public const KEY_INSERT = 82; private const LINUX_LIBRARY = __DIR__.'/Resources/libgetch.so'; private const WINDOWS_LIBRARY = 'ucrtbase.dll'; diff --git a/src/Console/Resources/getch.c b/src/Console/Resources/getch.c index b39122a..398b063 100644 --- a/src/Console/Resources/getch.c +++ b/src/Console/Resources/getch.c @@ -13,10 +13,16 @@ #include #include +#define EVENT_DEVICE_GLOB "/dev/input/by-path/*-event-kbd" + #define FKEY(k) ((k) >= KEY_F1 && (k) <= KEY_F10) || (k) == KEY_F12 || (k) == KEY_F11 #define NOTNUMPAD(k) ((k) >= KEY_HOME && (k) <= KEY_DELETE) - -#define EVENT_DEVICE_GLOB "/dev/input/by-path/*-event-kbd" +#define XOR_SWAP(a,b) do\ + {\ + (a) ^= (b);\ + (b) ^= (a);\ + (a) ^= (b);\ + } while (0) static struct termios oldTermAttributes; @@ -26,24 +32,12 @@ inline static void reverseString(char * str) { char * end = str + strlen(str) - 1; - // swap the values in the two given variables - // XXX: fails when a and b refer to same memory location -# define XOR_SWAP(a,b) do\ - {\ - (a) ^= (b);\ - (b) ^= (a);\ - (a) ^= (b);\ - } while (0) - - // walk inwards from both ends of the string, - // swapping until we get to the middle while (str < end) { XOR_SWAP(*str, *end); str++; end--; } -# undef XOR_SWAP } } @@ -103,7 +97,7 @@ static int getEventDevice(char ** device) static unsigned short getScanCode() { - struct input_event inputEvent[40]; + struct input_event inputEvent[5]; int eventDevice; char *device; @@ -129,12 +123,7 @@ static unsigned short getScanCode() close(eventDevice); - // for(int i = 0;i<39;i++) { - // printf("Type %d, Code %d, Value %d\r\n", inputEvent[i].type, inputEvent[i].code, inputEvent[i].value); - // } - - for(int i = 0;i<40;i++) { - //printf("Type %d, Code %d\n", inputEvent[i].type, inputEvent[i].code); + for(int i = 0;i<5;i++) { if(inputEvent[i].type == EV_KEY && inputEvent[i].code != KEY_ENTER) { return inputEvent[i].code; } @@ -212,17 +201,12 @@ static int readKey(void) { case KEY_KP6: // RIGHT case KEY_KP7: // HOME case KEY_KP8: // UP - //getchar(); - //getchar(); discardBytes = 2; break; case KEY_KP0: // INSERT case KEY_KPDOT: // DELETE case KEY_KP9: // PAGEUP case KEY_KP3: // PAGEDOWN - /*getchar(); - getchar(); - getchar(); */ discardBytes = 3; break; case KEY_F5: @@ -233,10 +217,6 @@ static int readKey(void) { case KEY_F10: case KEY_F11: case KEY_F12: - /* getchar(); - getchar(); - getchar(); - getchar(); */ discardBytes = 4; break; @@ -269,11 +249,21 @@ int _getch(void) { return key; } +int getch(void) +{ + return _getch(); +} + int _ungetch(int ch) { return ungetc(ch, stdin); } +int ungetch(int ch) +{ + return _ungetch(ch); +} + int *cinPeekCount(ushort count) { char buffer[count]; diff --git a/src/Console/Resources/libgetch.so b/src/Console/Resources/libgetch.so index 0556d8526aff1e03b0bea98d1a5876d1955af808..ef879489ce5da81b569d395a90ff0799c57fdb14 100755 GIT binary patch delta 4155 zcmZu!4Nz3q6~1?2VHf#ZV0p`*upkO(z{LottSr_gFP%{bQ>SEtS&^T_M1I7jqcyr1 zf^la<3!Z7JEw+-_cFe>Mm6>W=v8YLmQ`2BOwxmY8rcJYq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NJ6#8RZ2R$JjebYr z&-qLeQtGrJ)ZmS=eSMz%^JaXgH}3Yzk*f&jB5E2kc^Wv1dL8wzs9E49fo9;&hiVu4 z|E+d|=hd+9xUX;U2Erzyas#6pgE<<`naBJ%{~gXmt^9|o_5i!Csp<%D-8eQ8cmZg| z2j%8JRdpV)9(h>-WZ0u00A~Yt0c(K=fVY630JncNS5+^gu?iE~aV&NK=K=QvR{$$< z>wg3s26oU6-=mhDS5?jVd_c$JoA zWWHjmO;0udmf5FS#j{})bb_8QDrCDU0r?sogq%$$Ab&wuAZsYSxR9-+mBlWb7uHF5 zs;5M8q2)`ol60upV@W|wrF|!hE7Gu!b+(ZHM35-UA2207RO4Tt<+WfiN~#7@B^~lt zmrd}vP;xbp_>+MbLxF6N;iWPr<*8e|>2n`4q11luI!HZFr*(D8Th!|&s6 zoqza!{I(eTzL2Fto)Gd2s$b+{^x%l+&=J`m&r<>0f9S;lZCv{fj&LHY|C=yt~TF7LczhkX;EK zF9s?m`fioqX51Aoy0^z)r+!?%W2>QqkYxe z*+%k(0=72&A5R;t2~}hn|9=eh)80@Z%{WuIZ+{QH!gkT7Wr3^~pBAlwd3}4ARr6bZ zwkBXphBRf8+_lwgnAX%*TZT))VZ(E%x3d32?AuI*HXP)H8)Ew3 Date: Mon, 1 Mar 2021 10:48:18 -0800 Subject: [PATCH 09/13] removed function ungetchString --- functions.php | 9 --------- src/Console/Getch.php | 19 ++----------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/functions.php b/functions.php index bf6a4bd..64443ca 100644 --- a/functions.php +++ b/functions.php @@ -31,12 +31,3 @@ if (!function_exists('ungetch')) { return $g->ungetch($char); } } - -if (!function_exists('ungetchString')) { - function ungetchString(string $string, string $linuxLibrary = null): bool - { - $g = new Getch($linuxLibrary); - - return $g->ungetchString($string); - } -} diff --git a/src/Console/Getch.php b/src/Console/Getch.php index 240f9e1..5a8f6c3 100644 --- a/src/Console/Getch.php +++ b/src/Console/Getch.php @@ -88,8 +88,8 @@ final class Getch public function peek(): int { - if(PHP_OS_FAMILY === 'Windows') { - if($ffi->_kbhit()) { + if (PHP_OS_FAMILY === 'Windows') { + if ($ffi->_kbhit()) { $result = $ffi->_getch(); $ffi->_ungetch($result); return $result; @@ -98,21 +98,6 @@ final class Getch } return $ffi->cinPeek(); } -/* public function keyCode(string $device): array - { - - $arrayType = \FFI::arrayType(self::$ffi->type('int'), [3]); - $res = \FFI::new($arrayType); - - $arrayType = self::$ffi->keyCode($device); - - return [ - 'type' => $arrayType[0], - 'code' => $arrayType[1], - 'value' => $arrayType[2], - 'keyCode' => $arrayType[3], - ]; - }*/ public function getch(): int { -- 2.39.5 From 6405f1c7b9d35a10c74e4f37742990db14b54a46 Mon Sep 17 00:00:00 2001 From: "R. Eric Wheeler" Date: Tue, 10 May 2022 22:28:54 -0700 Subject: [PATCH 10/13] Update dependencies --- composer.lock | 947 ++++++++++++++++++++++++------------------ src/Console/Getch.php | 7 +- 2 files changed, 553 insertions(+), 401 deletions(-) diff --git a/composer.lock b/composer.lock index b0b2ea0..5962d7a 100644 --- a/composer.lock +++ b/composer.lock @@ -8,24 +8,95 @@ "packages": [], "packages-dev": [ { - "name": "composer/semver", - "version": "3.2.4", + "name": "composer/pcre", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "a02fdf930a3c1c3ed3a49b5f63859c0c20e10464" + "url": "https://github.com/composer/pcre.git", + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/a02fdf930a3c1c3ed3a49b5f63859c0c20e10464", - "reference": "a02fdf930a3c1c3ed3a49b5f63859c0c20e10464", + "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.54", + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/1.0.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-01-21T20:24:37+00:00" + }, + { + "name": "composer/semver", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.4", "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", @@ -70,7 +141,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.2.4" + "source": "https://github.com/composer/semver/tree/3.3.2" }, "funding": [ { @@ -86,28 +157,31 @@ "type": "tidelift" } ], - "time": "2020-11-13T08:59:24+00:00" + "time": "2022-04-01T19:23:25+00:00" }, { "name": "composer/xdebug-handler", - "version": "1.4.5", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "f28d44c286812c714741478d968104c5e604a1d4" + "reference": "9e36aeed4616366d2b690bdce11f71e9178c579a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/f28d44c286812c714741478d968104c5e604a1d4", - "reference": "f28d44c286812c714741478d968104c5e604a1d4", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/9e36aeed4616366d2b690bdce11f71e9178c579a", + "reference": "9e36aeed4616366d2b690bdce11f71e9178c579a", "shasum": "" }, "require": { + "composer/pcre": "^1", "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" + "psr/log": "^1 || ^2 || ^3" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0" }, "type": "library", "autoload": { @@ -133,7 +207,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/1.4.5" + "source": "https://github.com/composer/xdebug-handler/tree/2.0.5" }, "funding": [ { @@ -149,39 +223,36 @@ "type": "tidelift" } ], - "time": "2020-11-13T08:04:11+00:00" + "time": "2022-02-24T20:20:32+00:00" }, { "name": "doctrine/annotations", - "version": "1.11.1", + "version": "1.13.2", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "ce77a7ba1770462cd705a91a151b6c3746f9c6ad" + "reference": "5b668aef16090008790395c02c893b1ba13f7e08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/ce77a7ba1770462cd705a91a151b6c3746f9c6ad", - "reference": "ce77a7ba1770462cd705a91a151b6c3746f9c6ad", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08", + "reference": "5b668aef16090008790395c02c893b1ba13f7e08", "shasum": "" }, "require": { "doctrine/lexer": "1.*", "ext-tokenizer": "*", - "php": "^7.1 || ^8.0" + "php": "^7.1 || ^8.0", + "psr/cache": "^1 || ^2 || ^3" }, "require-dev": { - "doctrine/cache": "1.*", + "doctrine/cache": "^1.11 || ^2.0", "doctrine/coding-standard": "^6.0 || ^8.1", "phpstan/phpstan": "^0.12.20", - "phpunit/phpunit": "^7.5 || ^9.1.5" + "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", + "symfony/cache": "^4.4 || ^5.2" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.11.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" @@ -222,35 +293,36 @@ ], "support": { "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.11.1" + "source": "https://github.com/doctrine/annotations/tree/1.13.2" }, - "time": "2020-10-26T10:28:16+00:00" + "time": "2021-08-05T19:00:23+00:00" }, { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { @@ -277,7 +349,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" }, "funding": [ { @@ -293,36 +365,32 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-03-03T08:28:38+00:00" }, { "name": "doctrine/lexer", - "version": "1.2.1", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^8.2" + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.11" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" @@ -357,7 +425,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.1" + "source": "https://github.com/doctrine/lexer/tree/1.2.3" }, "funding": [ { @@ -373,25 +441,25 @@ "type": "tidelift" } ], - "time": "2020-05-25T17:44:05+00:00" + "time": "2022-02-28T11:07:21+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.18.2", + "version": "v2.19.3", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "18f8c9d184ba777380794a389fabc179896ba913" + "reference": "75ac86f33fab4714ea5a39a396784d83ae3b5ed8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/18f8c9d184ba777380794a389fabc179896ba913", - "reference": "18f8c9d184ba777380794a389fabc179896ba913", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/75ac86f33fab4714ea5a39a396784d83ae3b5ed8", + "reference": "75ac86f33fab4714ea5a39a396784d83ae3b5ed8", "shasum": "" }, "require": { "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^1.2", + "composer/xdebug-handler": "^1.2 || ^2.0", "doctrine/annotations": "^1.2", "ext-json": "*", "ext-tokenizer": "*", @@ -434,6 +502,11 @@ "php-cs-fixer" ], "type": "application", + "extra": { + "branch-alias": { + "dev-master": "2.19-dev" + } + }, "autoload": { "psr-4": { "PhpCsFixer\\": "src/" @@ -448,6 +521,7 @@ "tests/Test/IntegrationCaseFactoryInterface.php", "tests/Test/InternalIntegrationCaseFactory.php", "tests/Test/IsIdenticalConstraint.php", + "tests/Test/TokensWithObservedTransformers.php", "tests/TestCase.php" ] }, @@ -468,7 +542,7 @@ "description": "A tool to automatically fix PHP code style", "support": { "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", - "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.18.2" + "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.19.3" }, "funding": [ { @@ -476,7 +550,7 @@ "type": "github" } ], - "time": "2021-01-26T00:22:21+00:00" + "time": "2021-11-15T17:17:55+00:00" }, { "name": "jetbrains/phpstorm-stubs", @@ -484,15 +558,16 @@ "source": { "type": "git", "url": "https://github.com/JetBrains/phpstorm-stubs.git", - "reference": "b8cf707c050f775cdb7693afa6099bd227b383f4" + "reference": "4e756892120c49b2b9781b762a942c6e59248abe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/b8cf707c050f775cdb7693afa6099bd227b383f4", - "reference": "b8cf707c050f775cdb7693afa6099bd227b383f4", + "url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/4e756892120c49b2b9781b762a942c6e59248abe", + "reference": "4e756892120c49b2b9781b762a942c6e59248abe", "shasum": "" }, "require-dev": { + "friendsofphp/php-cs-fixer": "@stable", "nikic/php-parser": "@stable", "php": "^8.0", "phpdocumentor/reflection-docblock": "@stable", @@ -524,41 +599,42 @@ "support": { "source": "https://github.com/JetBrains/phpstorm-stubs/tree/master" }, - "time": "2021-02-15T11:11:55+00:00" + "time": "2022-05-06T19:57:35+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -574,7 +650,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, "funding": [ { @@ -582,20 +658,20 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { "name": "nikic/php-parser", - "version": "v4.10.4", + "version": "v4.13.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { @@ -636,22 +712,22 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" }, - "time": "2020-12-20T10:01:03+00:00" + "time": "2021-11-30T19:35:32+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.1", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { @@ -696,22 +772,22 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" + "source": "https://github.com/phar-io/manifest/tree/2.0.3" }, - "time": "2020-06-27T14:33:11+00:00" + "time": "2021-07-20T11:28:43+00:00" }, { "name": "phar-io/version", - "version": "3.0.4", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "e4782611070e50613683d2b9a57730e9a3ba5451" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451", - "reference": "e4782611070e50613683d2b9a57730e9a3ba5451", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { @@ -747,9 +823,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.0.4" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2020-12-13T23:18:30+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "php-cs-fixer/diff", @@ -861,16 +937,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { @@ -881,7 +957,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -911,22 +988,22 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2020-09-03T19:13:55+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "77a32518733312af16a44300404e945338981de3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", + "reference": "77a32518733312af16a44300404e945338981de3", "shasum": "" }, "require": { @@ -934,7 +1011,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -960,39 +1038,39 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" }, - "time": "2020-09-17T18:55:26+00:00" + "time": "2022-03-15T21:29:03+00:00" }, { "name": "phpspec/prophecy", - "version": "1.12.2", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "245710e971a030f42e08f4912863805570f23d39" + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", - "reference": "245710e971a030f42e08f4912863805570f23d39", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "php": "^7.2 || ~8.0, <8.2", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -1027,29 +1105,29 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.12.2" + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" }, - "time": "2020-12-19T10:15:11+00:00" + "time": "2021-12-08T12:19:24+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.5", + "version": "9.2.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1" + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f3e026641cc91909d421802dd3ac7827ebfd97e1", - "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.10.2", + "nikic/php-parser": "^4.13.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -1098,7 +1176,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.5" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" }, "funding": [ { @@ -1106,20 +1184,20 @@ "type": "github" } ], - "time": "2020-11-28T06:44:49+00:00" + "time": "2022-03-07T09:28:20+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { @@ -1158,7 +1236,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, "funding": [ { @@ -1166,7 +1244,7 @@ "type": "github" } ], - "time": "2020-09-28T05:57:25+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { "name": "phpunit/php-invoker", @@ -1351,16 +1429,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.2", + "version": "9.5.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4" + "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f661659747f2f87f9e72095bb207bceb0f151cb4", - "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/12bc8879fb65aef2138b26fc633cb1e3620cffba", + "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba", "shasum": "" }, "require": { @@ -1372,11 +1450,11 @@ "ext-xml": "*", "ext-xmlwriter": "*", "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.1", + "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -1390,7 +1468,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3", + "sebastian/type": "^3.0", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -1411,11 +1489,11 @@ } }, "autoload": { - "classmap": [ - "src/" - ], "files": [ "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1438,11 +1516,11 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.2" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.20" }, "funding": [ { - "url": "https://phpunit.de/donate.html", + "url": "https://phpunit.de/sponsors.html", "type": "custom" }, { @@ -1450,24 +1528,24 @@ "type": "github" } ], - "time": "2021-02-02T14:45:58+00:00" + "time": "2022-04-01T12:37:26+00:00" }, { - "name": "psr/container", - "version": "1.0.0", + "name": "psr/cache", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { @@ -1475,6 +1553,55 @@ "dev-master": "1.0.x-dev" } }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/3.0.0" + }, + "time": "2021-02-03T23:26:27+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -1487,7 +1614,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common Container Interface (PHP FIG PSR-11)", @@ -1501,9 +1628,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/master" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2017-02-14T16:28:37+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "psr/event-dispatcher", @@ -1557,30 +1684,30 @@ }, { "name": "psr/log", - "version": "1.1.3", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1590,7 +1717,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -1601,9 +1728,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.3" + "source": "https://github.com/php-fig/log/tree/2.0.0" }, - "time": "2020-03-23T09:12:05+00:00" + "time": "2021-07-14T16:41:46+00:00" }, { "name": "sebastian/cli-parser", @@ -1971,16 +2098,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.3", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", "shasum": "" }, "require": { @@ -2022,7 +2149,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" }, "funding": [ { @@ -2030,20 +2157,20 @@ "type": "github" } ], - "time": "2020-09-28T05:52:38+00:00" + "time": "2022-04-03T09:37:03+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "shasum": "" }, "require": { @@ -2092,14 +2219,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" }, "funding": [ { @@ -2107,20 +2234,20 @@ "type": "github" } ], - "time": "2020-09-28T05:24:23+00:00" + "time": "2021-11-11T14:18:36+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.2", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { @@ -2163,7 +2290,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" }, "funding": [ { @@ -2171,7 +2298,7 @@ "type": "github" } ], - "time": "2020-10-26T15:55:19+00:00" + "time": "2022-02-14T08:28:10+00:00" }, { "name": "sebastian/lines-of-code", @@ -2462,28 +2589,28 @@ }, { "name": "sebastian/type", - "version": "2.3.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2" + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", "shasum": "" }, "require": { "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2506,7 +2633,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.1" + "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" }, "funding": [ { @@ -2514,7 +2641,7 @@ "type": "github" } ], - "time": "2020-10-26T13:18:59+00:00" + "time": "2022-03-15T09:54:48+00:00" }, { "name": "sebastian/version", @@ -2571,27 +2698,29 @@ }, { "name": "symfony/console", - "version": "v5.2.3", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "89d4b176d12a2946a1ae4e34906a025b7b6b135a" + "reference": "ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/89d4b176d12a2946a1ae4e34906a025b7b6b135a", - "reference": "89d4b176d12a2946a1ae4e34906a025b7b6b135a", + "url": "https://api.github.com/repos/symfony/console/zipball/ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b", + "reference": "ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b", "shasum": "" }, "require": { "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.15", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { + "psr/log": ">=3", "symfony/dependency-injection": "<4.4", "symfony/dotenv": "<5.1", "symfony/event-dispatcher": "<4.4", @@ -2599,16 +2728,16 @@ "symfony/process": "<4.4" }, "provide": { - "psr/log-implementation": "1.0" + "psr/log-implementation": "1.0|2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -2648,7 +2777,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.2.3" + "source": "https://github.com/symfony/console/tree/v5.4.8" }, "funding": [ { @@ -2664,29 +2793,29 @@ "type": "tidelift" } ], - "time": "2021-01-28T22:06:19+00:00" + "time": "2022-04-12T16:02:29+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.2.0", + "version": "v3.0.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665" + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5fa56b4074d1ae755beb55617ddafe6f5d78f665", - "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -2715,7 +2844,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/master" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.1" }, "funding": [ { @@ -2731,27 +2860,27 @@ "type": "tidelift" } ], - "time": "2020-09-07T11:33:47+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.2.3", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "4f9760f8074978ad82e2ce854dff79a71fe45367" + "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4f9760f8074978ad82e2ce854dff79a71fe45367", - "reference": "4f9760f8074978ad82e2ce854dff79a71fe45367", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/dec8a9f58d20df252b9cd89f1c6c1530f747685d", + "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/event-dispatcher-contracts": "^2", - "symfony/polyfill-php80": "^1.15" + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^2|^3", + "symfony/polyfill-php80": "^1.16" }, "conflict": { "symfony/dependency-injection": "<4.4" @@ -2761,14 +2890,14 @@ "symfony/event-dispatcher-implementation": "2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/error-handler": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^4.4|^5.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/dependency-injection": "", @@ -2800,7 +2929,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.2.3" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.3" }, "funding": [ { @@ -2816,24 +2945,24 @@ "type": "tidelift" } ], - "time": "2021-01-27T10:36:42+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.2.0", + "version": "v3.0.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "0ba7d54483095a198fa51781bc608d17e84dffa2" + "reference": "7bc61cc2db649b4637d331240c5346dcc7708051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/0ba7d54483095a198fa51781bc608d17e84dffa2", - "reference": "0ba7d54483095a198fa51781bc608d17e84dffa2", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7bc61cc2db649b4637d331240c5346dcc7708051", + "reference": "7bc61cc2db649b4637d331240c5346dcc7708051", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "psr/event-dispatcher": "^1" }, "suggest": { @@ -2842,7 +2971,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -2879,7 +3008,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.2.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.1" }, "funding": [ { @@ -2895,25 +3024,27 @@ "type": "tidelift" } ], - "time": "2020-09-07T11:33:47+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/filesystem", - "version": "v5.2.3", + "version": "v5.4.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "262d033b57c73e8b59cd6e68a45c528318b15038" + "reference": "3a4442138d80c9f7b600fb297534ac718b61d37f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/262d033b57c73e8b59cd6e68a45c528318b15038", - "reference": "262d033b57c73e8b59cd6e68a45c528318b15038", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/3a4442138d80c9f7b600fb297534ac718b61d37f", + "reference": "3a4442138d80c9f7b600fb297534ac718b61d37f", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/polyfill-ctype": "~1.8" + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -2941,7 +3072,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.2.3" + "source": "https://github.com/symfony/filesystem/tree/v5.4.7" }, "funding": [ { @@ -2957,24 +3088,26 @@ "type": "tidelift" } ], - "time": "2021-01-27T10:01:46+00:00" + "time": "2022-04-01T12:33:59+00:00" }, { "name": "symfony/finder", - "version": "v5.2.3", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "4adc8d172d602008c204c2e16956f99257248e03" + "reference": "9b630f3427f3ebe7cd346c277a1408b00249dad9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/4adc8d172d602008c204c2e16956f99257248e03", - "reference": "4adc8d172d602008c204c2e16956f99257248e03", + "url": "https://api.github.com/repos/symfony/finder/zipball/9b630f3427f3ebe7cd346c277a1408b00249dad9", + "reference": "9b630f3427f3ebe7cd346c277a1408b00249dad9", "shasum": "" }, "require": { - "php": ">=7.2.5" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -3002,7 +3135,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.2.3" + "source": "https://github.com/symfony/finder/tree/v5.4.8" }, "funding": [ { @@ -3018,27 +3151,27 @@ "type": "tidelift" } ], - "time": "2021-01-28T22:06:19+00:00" + "time": "2022-04-15T08:07:45+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.2.3", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce" + "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce", - "reference": "5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/cc1147cb11af1b43f503ac18f31aa3bec213aba8", + "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-php73": "~1.0", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -3071,7 +3204,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.2.3" + "source": "https://github.com/symfony/options-resolver/tree/v5.4.3" }, "funding": [ { @@ -3087,32 +3220,35 @@ "type": "tidelift" } ], - "time": "2021-01-27T12:56:27+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.22.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3120,12 +3256,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3150,7 +3286,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" }, "funding": [ { @@ -3166,20 +3302,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.22.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "267a9adeb8ecb8071040a740930e077cdfb987af" + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/267a9adeb8ecb8071040a740930e077cdfb987af", - "reference": "267a9adeb8ecb8071040a740930e077cdfb987af", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", "shasum": "" }, "require": { @@ -3191,7 +3327,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3199,12 +3335,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3231,7 +3367,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0" }, "funding": [ { @@ -3247,20 +3383,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-11-23T21:10:46+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.22.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "6e971c891537eb617a00bb07a43d182a6915faba" + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/6e971c891537eb617a00bb07a43d182a6915faba", - "reference": "6e971c891537eb617a00bb07a43d182a6915faba", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", "shasum": "" }, "require": { @@ -3272,7 +3408,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3280,12 +3416,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -3315,7 +3451,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0" }, "funding": [ { @@ -3331,32 +3467,35 @@ "type": "tidelift" } ], - "time": "2021-01-07T17:09:11+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.22.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13" + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", - "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, "suggest": { "ext-mbstring": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3364,12 +3503,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3395,7 +3534,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" }, "funding": [ { @@ -3411,7 +3550,7 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-11-30T18:21:41+00:00" }, { "name": "symfony/polyfill-php70", @@ -3483,16 +3622,16 @@ }, { "name": "symfony/polyfill-php72", - "version": "v1.22.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9" + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9", - "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", "shasum": "" }, "require": { @@ -3501,7 +3640,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3509,12 +3648,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3539,7 +3678,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.25.0" }, "funding": [ { @@ -3555,20 +3694,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-05-27T09:17:38+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.22.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2" + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", - "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", "shasum": "" }, "require": { @@ -3577,7 +3716,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3585,12 +3724,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -3618,7 +3757,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0" }, "funding": [ { @@ -3634,20 +3773,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-06-05T21:20:04+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.22.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", - "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", "shasum": "" }, "require": { @@ -3656,7 +3795,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3664,12 +3803,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -3701,7 +3840,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" }, "funding": [ { @@ -3717,25 +3856,25 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2022-03-04T08:16:47+00:00" }, { "name": "symfony/process", - "version": "v5.2.3", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "313a38f09c77fbcdc1d223e57d368cea76a2fd2f" + "reference": "597f3fff8e3e91836bb0bd38f5718b56ddbde2f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/313a38f09c77fbcdc1d223e57d368cea76a2fd2f", - "reference": "313a38f09c77fbcdc1d223e57d368cea76a2fd2f", + "url": "https://api.github.com/repos/symfony/process/zipball/597f3fff8e3e91836bb0bd38f5718b56ddbde2f3", + "reference": "597f3fff8e3e91836bb0bd38f5718b56ddbde2f3", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -3763,7 +3902,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.2.3" + "source": "https://github.com/symfony/process/tree/v5.4.8" }, "funding": [ { @@ -3779,25 +3918,28 @@ "type": "tidelift" } ], - "time": "2021-01-27T10:15:41+00:00" + "time": "2022-04-08T05:07:18+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.2.0", + "version": "v3.0.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" + "reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", - "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e517458f278c2131ca9f262f8fbaf01410f2c65c", + "reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.0" + "php": ">=8.0.2", + "psr/container": "^2.0" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -3805,7 +3947,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -3842,7 +3984,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/master" + "source": "https://github.com/symfony/service-contracts/tree/v3.0.1" }, "funding": [ { @@ -3858,25 +4000,25 @@ "type": "tidelift" } ], - "time": "2020-09-07T11:33:47+00:00" + "time": "2022-03-13T20:10:05+00:00" }, { "name": "symfony/stopwatch", - "version": "v5.2.3", + "version": "v5.4.5", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "b12274acfab9d9850c52583d136a24398cdf1a0c" + "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/b12274acfab9d9850c52583d136a24398cdf1a0c", - "reference": "b12274acfab9d9850c52583d136a24398cdf1a0c", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", + "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/service-contracts": "^1.0|^2" + "symfony/service-contracts": "^1|^2|^3" }, "type": "library", "autoload": { @@ -3904,7 +4046,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.2.3" + "source": "https://github.com/symfony/stopwatch/tree/v5.4.5" }, "funding": [ { @@ -3920,44 +4062,46 @@ "type": "tidelift" } ], - "time": "2021-01-27T10:15:41+00:00" + "time": "2022-02-18T16:06:09+00:00" }, { "name": "symfony/string", - "version": "v5.2.3", + "version": "v6.0.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "c95468897f408dd0aca2ff582074423dd0455122" + "reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/c95468897f408dd0aca2ff582074423dd0455122", - "reference": "c95468897f408dd0aca2ff582074423dd0455122", + "url": "https://api.github.com/repos/symfony/string/zipball/ac0aa5c2282e0de624c175b68d13f2c8f2e2649d", + "reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.0" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, "files": [ "Resources/functions.php" ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] @@ -3987,7 +4131,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.2.3" + "source": "https://github.com/symfony/string/tree/v6.0.8" }, "funding": [ { @@ -4003,20 +4147,20 @@ "type": "tidelift" } ], - "time": "2021-01-25T15:14:59+00:00" + "time": "2022-04-22T08:18:02+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { @@ -4045,7 +4189,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/master" + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" }, "funding": [ { @@ -4053,34 +4197,39 @@ "type": "github" } ], - "time": "2020-07-12T23:59:07+00:00" + "time": "2021-07-28T10:34:58+00:00" }, { "name": "webmozart/assert", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", + "php": "^7.2 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" + "vimeo/psalm": "<4.6.1 || 4.6.2" }, "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "phpunit/phpunit": "^8.5.13" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -4104,9 +4253,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.9.1" + "source": "https://github.com/webmozarts/assert/tree/1.10.0" }, - "time": "2020-07-08T17:02:28+00:00" + "time": "2021-03-09T10:59:23+00:00" } ], "aliases": [], @@ -4121,5 +4270,5 @@ "ext-ffi": "*" }, "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.3.0" } diff --git a/src/Console/Getch.php b/src/Console/Getch.php index 5a8f6c3..10f672b 100644 --- a/src/Console/Getch.php +++ b/src/Console/Getch.php @@ -72,13 +72,13 @@ final class Getch if (null === self::$ffi) { $osFamily = PHP_OS_FAMILY; if ('Windows' === $osFamily) { - $declarations = self::DECLARATIONS . ' int _kbhit();'; + $declarations = self::DECLARATIONS.' int _kbhit();'; self::$ffi = FFI::cdef($declarations, self::WINDOWS_LIBRARY); } elseif ('Linux' === $osFamily) { if (!file_exists($linuxLibrary)) { throw new RuntimeException(sprintf('Could not find library file %s.', $linuxLibrary)); } - $declarations = self::DECLARATIONS . ' int cinPeek();'; + $declarations = self::DECLARATIONS.' int cinPeek();'; self::$ffi = FFI::cdef($declarations, $linuxLibrary); } else { throw new RuntimeException(sprintf('Sorry, %s is not supported yet.', $osFamily)); @@ -92,10 +92,13 @@ final class Getch if ($ffi->_kbhit()) { $result = $ffi->_getch(); $ffi->_ungetch($result); + return $result; } + return -1; } + return $ffi->cinPeek(); } -- 2.39.5 From d12cd38456437aba043da809aea448056cb1b345 Mon Sep 17 00:00:00 2001 From: "R. Eric Wheeler" Date: Tue, 17 May 2022 09:47:34 -0700 Subject: [PATCH 11/13] Move to new namespace --- composer.json | 7 +- composer.lock | 184 ++++++++++++---------------------- functions.php | 2 +- src/Console/Getch.php | 2 +- tests/Getch/GetchTest.php | 4 +- tests/Ungetch/UngetchTest.php | 4 +- 6 files changed, 74 insertions(+), 129 deletions(-) diff --git a/composer.json b/composer.json index 8e6d21c..f36c1b0 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "sikofitt/getch", + "name": "olivebbs/getch", "description": "Implements _getch and _ungetch for windows and linux using ffi", "type": "library", "require": { @@ -8,12 +8,11 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.18", - "jetbrains/phpstorm-stubs": "dev-master", "phpunit/phpunit": "^9.5" }, "autoload": { "psr-4": { - "Sikofitt\\Console\\": "src/Console/" + "Olive\\Console\\": "src/Console/" }, "files": [ "functions.php" @@ -21,7 +20,7 @@ }, "autoload-dev": { "psr-4": { - "Sikofitt\\Tests\\Console\\": "tests/" + "Olive\\Tests\\Console\\": "tests/" } }, "license": "MPL-2.0", diff --git a/composer.lock b/composer.lock index 5962d7a..5bf2b88 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bb5128ff3c57a9cb46fa7c4697fcc0bb", + "content-hash": "a9f24f3e6bdfb946f6671416016d7e76", "packages": [], "packages-dev": [ { @@ -552,55 +552,6 @@ ], "time": "2021-11-15T17:17:55+00:00" }, - { - "name": "jetbrains/phpstorm-stubs", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/JetBrains/phpstorm-stubs.git", - "reference": "4e756892120c49b2b9781b762a942c6e59248abe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/4e756892120c49b2b9781b762a942c6e59248abe", - "reference": "4e756892120c49b2b9781b762a942c6e59248abe", - "shasum": "" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "@stable", - "nikic/php-parser": "@stable", - "php": "^8.0", - "phpdocumentor/reflection-docblock": "@stable", - "phpunit/phpunit": "@stable" - }, - "default-branch": true, - "type": "library", - "autoload": { - "files": [ - "PhpStormStubsMap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "PHP runtime & extensions header files for PhpStorm", - "homepage": "https://www.jetbrains.com/phpstorm", - "keywords": [ - "autocomplete", - "code", - "inference", - "inspection", - "jetbrains", - "phpstorm", - "stubs", - "type" - ], - "support": { - "source": "https://github.com/JetBrains/phpstorm-stubs/tree/master" - }, - "time": "2022-05-06T19:57:35+00:00" - }, { "name": "myclabs/deep-copy", "version": "1.11.0", @@ -1532,20 +1483,20 @@ }, { "name": "psr/cache", - "version": "3.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", "shasum": "" }, "require": { - "php": ">=8.0.0" + "php": ">=5.3.0" }, "type": "library", "extra": { @@ -1565,7 +1516,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "homepage": "http://www.php-fig.org/" } ], "description": "Common interface for caching libraries", @@ -1575,33 +1526,28 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/3.0.0" + "source": "https://github.com/php-fig/cache/tree/master" }, - "time": "2021-02-03T23:26:27+00:00" + "time": "2016-08-06T20:24:11+00:00" }, { "name": "psr/container", - "version": "2.0.2", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { "php": ">=7.4.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -1628,9 +1574,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/2.0.2" + "source": "https://github.com/php-fig/container/tree/1.1.2" }, - "time": "2021-11-05T16:47:00+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { "name": "psr/event-dispatcher", @@ -1684,30 +1630,30 @@ }, { "name": "psr/log", - "version": "2.0.0", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", - "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { - "php": ">=8.0.0" + "php": ">=5.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "src" + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1728,9 +1674,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/2.0.0" + "source": "https://github.com/php-fig/log/tree/1.1.4" }, - "time": "2021-07-14T16:41:46+00:00" + "time": "2021-05-03T11:20:27+00:00" }, { "name": "sebastian/cli-parser", @@ -2797,25 +2743,25 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.0.1", + "version": "v2.5.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -2844,7 +2790,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1" }, "funding": [ { @@ -2860,7 +2806,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/event-dispatcher", @@ -2949,20 +2895,20 @@ }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.0.1", + "version": "v2.5.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "7bc61cc2db649b4637d331240c5346dcc7708051" + "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7bc61cc2db649b4637d331240c5346dcc7708051", - "reference": "7bc61cc2db649b4637d331240c5346dcc7708051", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/f98b54df6ad059855739db6fcbc2d36995283fe1", + "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=7.2.5", "psr/event-dispatcher": "^1" }, "suggest": { @@ -2971,7 +2917,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3008,7 +2954,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.1" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.1" }, "funding": [ { @@ -3024,7 +2970,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/filesystem", @@ -3922,21 +3868,22 @@ }, { "name": "symfony/service-contracts", - "version": "v3.0.1", + "version": "v2.5.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c" + "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e517458f278c2131ca9f262f8fbaf01410f2c65c", - "reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c", + "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c", "shasum": "" }, "require": { - "php": ">=8.0.2", - "psr/container": "^2.0" + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" }, "conflict": { "ext-psr": "<1.1|>=2" @@ -3947,7 +3894,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3984,7 +3931,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.0.1" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.1" }, "funding": [ { @@ -4000,7 +3947,7 @@ "type": "tidelift" } ], - "time": "2022-03-13T20:10:05+00:00" + "time": "2022-03-13T20:07:29+00:00" }, { "name": "symfony/stopwatch", @@ -4066,33 +4013,34 @@ }, { "name": "symfony/string", - "version": "v6.0.8", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d" + "reference": "3c061a76bff6d6ea427d85e12ad1bb8ed8cd43e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ac0aa5c2282e0de624c175b68d13f2c8f2e2649d", - "reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d", + "url": "https://api.github.com/repos/symfony/string/zipball/3c061a76bff6d6ea427d85e12ad1bb8ed8cd43e8", + "reference": "3c061a76bff6d6ea427d85e12ad1bb8ed8cd43e8", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=7.2.5", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0" + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" }, "conflict": { - "symfony/translation-contracts": "<2.0" + "symfony/translation-contracts": ">=3.0" }, "require-dev": { - "symfony/error-handler": "^5.4|^6.0", - "symfony/http-client": "^5.4|^6.0", - "symfony/translation-contracts": "^2.0|^3.0", - "symfony/var-exporter": "^5.4|^6.0" + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0|^6.0" }, "type": "library", "autoload": { @@ -4131,7 +4079,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.0.8" + "source": "https://github.com/symfony/string/tree/v5.4.8" }, "funding": [ { @@ -4147,7 +4095,7 @@ "type": "tidelift" } ], - "time": "2022-04-22T08:18:02+00:00" + "time": "2022-04-19T10:40:37+00:00" }, { "name": "theseer/tokenizer", @@ -4260,9 +4208,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "jetbrains/phpstorm-stubs": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/functions.php b/functions.php index 64443ca..68c81b3 100644 --- a/functions.php +++ b/functions.php @@ -12,7 +12,7 @@ declare(strict_types=1); * You can obtain one at https://mozilla.org/MPL/2.0/. */ -use Sikofitt\Console\Getch; +use Olive\Console\Getch; if (!function_exists('getch')) { function getch(string $linuxLibrary = null): int diff --git a/src/Console/Getch.php b/src/Console/Getch.php index 10f672b..9fb78bc 100644 --- a/src/Console/Getch.php +++ b/src/Console/Getch.php @@ -12,7 +12,7 @@ declare(strict_types=1); * You can obtain one at https://mozilla.org/MPL/2.0/. */ -namespace Sikofitt\Console; +namespace Olive\Console; use FFI; use RuntimeException; diff --git a/tests/Getch/GetchTest.php b/tests/Getch/GetchTest.php index ee6e859..8ee6ca2 100644 --- a/tests/Getch/GetchTest.php +++ b/tests/Getch/GetchTest.php @@ -1,9 +1,9 @@ Date: Tue, 17 May 2022 09:53:07 -0700 Subject: [PATCH 12/13] Update readme --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3c4c622..743d538 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,15 @@ This simply uses the FFI extension to enable _getch and _ungetch in Windows and linux. -[![pipeline status](https://repos.bgemi.net/sikofitt/getch/badges/1.x/pipeline.svg)](https://repos.bgemi.net/sikofitt/getch/-/commits/1.x) -[![coverage report](https://repos.bgemi.net/sikofitt/getch/badges/1.x/coverage.svg)](https://repos.bgemi.net/sikofitt/getch/-/commits/1.x) +[![pipeline status](https://repos.bgemi.net/olive/PHP/getch/badges/1.x/pipeline.svg)](https://repos.bgemi.net/sikofitt/getch/-/commits/1.x) +[![coverage report](https://repos.bgemi.net/olive/PHP/getch/badges/1.x/coverage.svg)](https://repos.bgemi.net/sikofitt/getch/-/commits/1.x) ```shell script -$ composer require sikofitt/getch:dev-master +$ composer require olivebbs/getch ``` ```php - use Sikofitt\Console\Getch; + use Olive\Console\Getch; $g = new Getch($linuxLibrary = null); // can also be a library that implements a function called _getch; // by default uses the bundled Resources/libgetch.so // on windows uses the built in _getch function. @@ -45,7 +45,7 @@ Note that if you want to put a word into the STDIN stack, you need to do it in r There are also helper functions called getch() and ungetch(); ```php -use function Sikofitt\Console\getch; +use function Olive\Console\getch; $ord = getch($linuxLibrary = null); print \chr($ord); -- 2.39.5 From 1b01ff78f28bc49b399212902fab52a5ce61f7c0 Mon Sep 17 00:00:00 2001 From: "R. Eric Wheeler" Date: Tue, 17 May 2022 10:04:07 -0700 Subject: [PATCH 13/13] Fix readme --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 743d538..e75408e 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ This simply uses the FFI extension to enable _getch and _ungetch in Windows and linux. -[![pipeline status](https://repos.bgemi.net/olive/PHP/getch/badges/1.x/pipeline.svg)](https://repos.bgemi.net/sikofitt/getch/-/commits/1.x) -[![coverage report](https://repos.bgemi.net/olive/PHP/getch/badges/1.x/coverage.svg)](https://repos.bgemi.net/sikofitt/getch/-/commits/1.x) +[![Pipeline status](https://code.bgemi.net/olive/PHP/getch/badges/1.x/pipeline.svg)](https://code.bgemi.net/olive/PHP/getch/-/commits/1.x) +[![Coverage report](https://code.bgemi.net/olive/PHP/getch/badges/1.x/coverage.svg)](https://code.bgemi.net/olive/PHP/getch/-/commits/1.x) +[![Latest Release](https://code.bgemi.net/olive/PHP/getch/-/badges/release.svg)](https://code.bgemi.net/olive/PHP/getch/-/releases) ```shell script $ composer require olivebbs/getch -- 2.39.5