diff --git a/composer.lock b/composer.lock index a25cddd..bd1b8e8 100644 --- a/composer.lock +++ b/composer.lock @@ -6,54 +6,6 @@ ], "content-hash": "861a3809372ea7552bbd417ed292aff9", "packages": [ - { - "name": "aydin-hassan/cli-md-renderer", - "version": "2.4.0", - "source": { - "type": "git", - "url": "https://github.com/AydinHassan/cli-md-renderer.git", - "reference": "de5677b37be91d3d0f6cef5ddd25bc158139990b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/AydinHassan/cli-md-renderer/zipball/de5677b37be91d3d0f6cef5ddd25bc158139990b", - "reference": "de5677b37be91d3d0f6cef5ddd25bc158139990b", - "shasum": "" - }, - "require": { - "kevinlebrun/colors.php": "^1.0", - "league/commonmark": "^1.5.6", - "php": ">=7.1", - "php-school/keylighter": "^0.8.4" - }, - "require-dev": { - "phpstan/phpstan": "^0.12.50", - "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", - "squizlabs/php_codesniffer": "^3.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "AydinHassan\\CliMdRenderer\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Aydin Hassan", - "email": "aydin@hotmail.co.uk" - } - ], - "description": "A CLI Markdown Render for league/commonmark compatibile AST", - "support": { - "issues": "https://github.com/AydinHassan/cli-md-renderer/issues", - "source": "https://github.com/AydinHassan/cli-md-renderer/tree/2.4.0" - }, - "time": "2020-11-01T14:34:39+00:00" - }, { "name": "beberlei/assert", "version": "v3.3.2", @@ -577,16 +529,16 @@ }, { "name": "laravel/serializable-closure", - "version": "v1.2.2", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "47afb7fae28ed29057fdca37e16a84f90cc62fae" + "reference": "f23fe9d4e95255dacee1bf3525e0810d1a1b0f37" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/47afb7fae28ed29057fdca37e16a84f90cc62fae", - "reference": "47afb7fae28ed29057fdca37e16a84f90cc62fae", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/f23fe9d4e95255dacee1bf3525e0810d1a1b0f37", + "reference": "f23fe9d4e95255dacee1bf3525e0810d1a1b0f37", "shasum": "" }, "require": { @@ -633,7 +585,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2022-09-08T13:45:54+00:00" + "time": "2023-01-30T18:31:20+00:00" }, { "name": "league/commonmark", @@ -793,16 +745,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.2", + "version": "v4.15.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", "shasum": "" }, "require": { @@ -843,9 +795,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" }, - "time": "2022-11-12T15:38:23+00:00" + "time": "2023-01-16T22:05:37+00:00" }, { "name": "php-di/invoker", @@ -1020,6 +972,53 @@ }, "time": "2020-10-12T12:39:22+00:00" }, + { + "name": "php-school/cli-md-renderer", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-school/cli-md-renderer.git", + "reference": "70b7d1da7142c90c99299018da4b770f681fcfc8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-school/cli-md-renderer/zipball/70b7d1da7142c90c99299018da4b770f681fcfc8", + "reference": "70b7d1da7142c90c99299018da4b770f681fcfc8", + "shasum": "" + }, + "require": { + "kevinlebrun/colors.php": "^1.0", + "league/commonmark": "^1.5.6", + "php": ">=7.1", + "php-school/keylighter": "^0.8.4" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.50", + "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", + "squizlabs/php_codesniffer": "^3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpSchool\\CliMdRenderer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aydin Hassan", + "email": "aydin@hotmail.co.uk" + } + ], + "description": "A CLI Markdown Render for league/commonmark compatible AST", + "support": { + "source": "https://github.com/php-school/cli-md-renderer/tree/1.0.0" + }, + "time": "2022-11-21T21:02:26+00:00" + }, { "name": "php-school/cli-menu", "version": "4.3.0", @@ -1142,16 +1141,15 @@ "source": { "type": "git", "url": "https://github.com/php-school/php-workshop.git", - "reference": "839688e5f514c9fabcaca6e4c4c18c2ba307bed6" + "reference": "3863f22441907b8437d1af14e605122013f3e244" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-school/php-workshop/zipball/839688e5f514c9fabcaca6e4c4c18c2ba307bed6", - "reference": "839688e5f514c9fabcaca6e4c4c18c2ba307bed6", + "url": "https://api.github.com/repos/php-school/php-workshop/zipball/3863f22441907b8437d1af14e605122013f3e244", + "reference": "3863f22441907b8437d1af14e605122013f3e244", "shasum": "" }, "require": { - "aydin-hassan/cli-md-renderer": "^2.4", "ext-json": "*", "ext-pdo": "*", "ext-pdo_sqlite": "*", @@ -1161,6 +1159,7 @@ "nikic/php-parser": "^4.0", "php": ">=7.2", "php-di/php-di": "^6.0", + "php-school/cli-md-renderer": "^1.0", "php-school/cli-menu": "^4.1", "php-school/keylighter": "^0.8.4", "psr/container": "^1.0", @@ -1218,7 +1217,7 @@ "issues": "https://github.com/php-school/php-workshop/issues", "source": "https://github.com/php-school/php-workshop/tree/master" }, - "time": "2022-12-13T19:49:15+00:00" + "time": "2023-02-09T20:48:31+00:00" }, { "name": "php-school/terminal", @@ -1648,16 +1647,16 @@ }, { "name": "symfony/filesystem", - "version": "v6.2.0", + "version": "v6.2.5", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "50b2523c874605cf3d4acf7a9e2b30b6a440a016" + "reference": "e59e8a4006afd7f5654786a83b4fcb8da98f4593" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/50b2523c874605cf3d4acf7a9e2b30b6a440a016", - "reference": "50b2523c874605cf3d4acf7a9e2b30b6a440a016", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/e59e8a4006afd7f5654786a83b4fcb8da98f4593", + "reference": "e59e8a4006afd7f5654786a83b4fcb8da98f4593", "shasum": "" }, "require": { @@ -1691,7 +1690,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.2.0" + "source": "https://github.com/symfony/filesystem/tree/v6.2.5" }, "funding": [ { @@ -1707,7 +1706,7 @@ "type": "tidelift" } ], - "time": "2022-11-20T13:01:27+00:00" + "time": "2023-01-20T17:45:48+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1876,16 +1875,16 @@ }, { "name": "symfony/process", - "version": "v6.2.0", + "version": "v6.2.5", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "ba6e55359f8f755fe996c58a81e00eaa67a35877" + "reference": "9ead139f63dfa38c4e4a9049cc64a8b2748c83b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/ba6e55359f8f755fe996c58a81e00eaa67a35877", - "reference": "ba6e55359f8f755fe996c58a81e00eaa67a35877", + "url": "https://api.github.com/repos/symfony/process/zipball/9ead139f63dfa38c4e4a9049cc64a8b2748c83b7", + "reference": "9ead139f63dfa38c4e4a9049cc64a8b2748c83b7", "shasum": "" }, "require": { @@ -1917,7 +1916,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.2.0" + "source": "https://github.com/symfony/process/tree/v6.2.5" }, "funding": [ { @@ -1933,36 +1932,36 @@ "type": "tidelift" } ], - "time": "2022-11-02T09:08:04+00:00" + "time": "2023-01-01T08:38:09+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.4.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "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" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", "autoload": { @@ -1989,7 +1988,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -2005,7 +2004,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T08:28:38+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "myclabs/deep-copy", @@ -2179,16 +2178,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.3", + "version": "1.9.17", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "709999b91448d4f2bb07daffffedc889b33e461c" + "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/709999b91448d4f2bb07daffffedc889b33e461c", - "reference": "709999b91448d4f2bb07daffffedc889b33e461c", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/204e459e7822f2c586463029f5ecec31bb45a1f2", + "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2", "shasum": "" }, "require": { @@ -2218,7 +2217,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.3" + "source": "https://github.com/phpstan/phpstan/tree/1.9.17" }, "funding": [ { @@ -2234,20 +2233,20 @@ "type": "tidelift" } ], - "time": "2022-12-13T10:28:10+00:00" + "time": "2023-02-08T12:25:00+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.21", + "version": "9.2.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "3f893e19712bb0c8bc86665d1562e9fd509c4ef0" + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/3f893e19712bb0c8bc86665d1562e9fd509c4ef0", - "reference": "3f893e19712bb0c8bc86665d1562e9fd509c4ef0", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", "shasum": "" }, "require": { @@ -2303,7 +2302,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.21" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" }, "funding": [ { @@ -2311,7 +2310,7 @@ "type": "github" } ], - "time": "2022-12-14T13:26:54+00:00" + "time": "2023-01-26T08:26:55+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2556,20 +2555,20 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.27", + "version": "9.6.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38" + "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38", - "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7b1615e3e887d6c719121c6d4a44b0ab9645555", + "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", + "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -2607,7 +2606,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.5-dev" + "dev-master": "9.6-dev" } }, "autoload": { @@ -2638,7 +2637,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.3" }, "funding": [ { @@ -2654,7 +2653,7 @@ "type": "tidelift" } ], - "time": "2022-12-09T07:31:23+00:00" + "time": "2023-02-04T13:37:15+00:00" }, { "name": "sebastian/cli-parser", @@ -3022,16 +3021,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.4", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { @@ -3073,7 +3072,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" }, "funding": [ { @@ -3081,7 +3080,7 @@ "type": "github" } ], - "time": "2022-04-03T09:37:03+00:00" + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", @@ -3395,16 +3394,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { @@ -3443,10 +3442,10 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { @@ -3454,7 +3453,7 @@ "type": "github" } ], - "time": "2020-10-26T13:17:30+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", @@ -3513,16 +3512,16 @@ }, { "name": "sebastian/type", - "version": "3.2.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { @@ -3557,7 +3556,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, "funding": [ { @@ -3565,7 +3564,7 @@ "type": "github" } ], - "time": "2022-09-12T14:47:03+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { "name": "sebastian/version", diff --git a/exercises/a-match-made-in-heaven/problem/problem.md b/exercises/a-match-made-in-heaven/problem/problem.md index 9980e10..2c56b16 100644 --- a/exercises/a-match-made-in-heaven/problem/problem.md +++ b/exercises/a-match-made-in-heaven/problem/problem.md @@ -1,4 +1,4 @@ -You have been given a piece of code (look for `a-match-made-in-heaven.php` in your working directory) which is full of bugs. +You have been given a piece of code (look for `a-match-made-in-heaven.php` in {{context cli 'your working directory'}} {{context cloud 'the editor'}}) which is full of bugs. The code has been implemented badly, using a `switch` statement. Your job is to fix the code, by using the newly introduced `match` expression in PHP 8. The piece of code is supposed to take a string representing a keyboard keypress and convert it to its equivalent ANSI decimal code. @@ -20,8 +20,7 @@ The key presses will be provided as strings via command line arguments. Only one ---------------------------------------------------------------------- ## HINTS -Documentation on the `match` expression can be found by pointing your browser here: -[https://www.php.net/manual/en/control-structures.match.php]() +{{ doc match en control-structures.match.php }} Remember the first argument will be a randomly picked supported keypress. diff --git a/exercises/a-safe-space-for-nulls/problem/problem.md b/exercises/a-safe-space-for-nulls/problem/problem.md index 4b9c965..42aa20a 100644 --- a/exercises/a-safe-space-for-nulls/problem/problem.md +++ b/exercises/a-safe-space-for-nulls/problem/problem.md @@ -63,8 +63,8 @@ And finally, the most important part, all properties which may be `NULL` should Remember your program will be passed no arguments. There will be a `User` object populated for you under the variable `$user`. It is available at the beginning of your script. -Documentation on the Null Safe Operator can be found by pointing your browser here: -[https://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.nullsafe]() +{{ doc 'Null Safe Operator' en language.oop5.basic.php#language.oop5.basic.nullsafe }} + ---------------------------------------------------------------------- ## EXTRA diff --git a/exercises/all-mixed-up/problem/problem.md b/exercises/all-mixed-up/problem/problem.md index 521e49e..58299a4 100644 --- a/exercises/all-mixed-up/problem/problem.md +++ b/exercises/all-mixed-up/problem/problem.md @@ -40,11 +40,9 @@ We will call your function automatically with a bunch of different types to make We will specifically check that you used the `mixed` type. Omitting the type will not pass. -Documentation on the `mixed` type can be found by pointing your browser here: -[https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.mixed]() +{{ doc 'mixed' en language.types.declarations.php#language.types.declarations.mixed }} -Documentation on `get_debug_type` can be found by pointing your browser here: -[https://www.php.net/manual/en/function.get-debug-type.php]() +{{ doc 'get_debug_type' en function.get-debug-type.php }} ---------------------------------------------------------------------- ## EXTRA diff --git a/exercises/caution-with-catches/problem/problem.md b/exercises/caution-with-catches/problem/problem.md index 00784dc..dd24416 100644 --- a/exercises/caution-with-catches/problem/problem.md +++ b/exercises/caution-with-catches/problem/problem.md @@ -13,7 +13,7 @@ For this exercise this function will always throw an exception but unfortunately To pass this exercise you will need to call the `verify_password` function with the password provided, handle the exception and output `"Given password is invalid, please try again"`. -PHP 8 allows you to handle the exception without capturing the exception itself which will ensure this message is not leaked further. +PHP 8 allows you to handle the exception without capturing the exception itself in to a variable, which will ensure this message is not leaked further. ### The advantages of non capturing catches @@ -24,5 +24,5 @@ PHP 8 allows you to handle the exception without capturing the exception itself ---------------------------------------------------------------------- ## HINTS -Documentation on the non-capturing catches feature is sparse without examples, so the RFC has the most amount of detail: -[https://wiki.php.net/rfc/non-capturing_catches]() +Documentation on the non-capturing catches feature is sparse and without examples, so the RFC has the most amount of detail: +[https://wiki.php.net/rfc/non-capturing_catches](https://wiki.php.net/rfc/non-capturing_catches) diff --git a/exercises/have-the-last-say/problem/problem.md b/exercises/have-the-last-say/problem/problem.md index eb27680..3835739 100644 --- a/exercises/have-the-last-say/problem/problem.md +++ b/exercises/have-the-last-say/problem/problem.md @@ -27,7 +27,7 @@ htmlspecialchars($string, ENT_COMPAT | ENT_HTML, 'UTF-8', false); We only want to change the last argument (double_encode) of the function to false (the default is true). However, we are forced to specify all the other arguments, even though they have not changed from the defaults. -Named arguments allows to write the same, but in a more succinct fashion: +Named arguments allows us to write the same, but in a more succinct fashion: ```php htmlspecialchars($string, double_encode: false); @@ -51,14 +51,11 @@ You will most likely need a loop to process all the data in the file. You will need to keep reading from the file until it has been fully read. `feof` is your friend here and will inform you whether there is any data left to read. -Documentation on the `fopen` function can be found by pointing your browser here: -[https://www.php.net/manual/en/function.fopen.php]() +{{ doc 'fopen' en function.fopen.php }} -Documentation on the `fgetcsv` function can be found by pointing your browser here: -[https://www.php.net/manual/en/function.fgetcsv.php]() +{{ doc 'fgetcsv' en function.fgetcsv.php }} -Documentation on the `feof` function can be found by pointing your browser here: -[https://www.php.net/manual/en/function.feof.php]() +{{ doc 'feof' en function.feof.php }} ---------------------------------------------------------------------- ## EXTRA diff --git a/exercises/infinite-divisions/problem/problem.md b/exercises/infinite-divisions/problem/problem.md index 7e753e7..333ad9c 100644 --- a/exercises/infinite-divisions/problem/problem.md +++ b/exercises/infinite-divisions/problem/problem.md @@ -24,6 +24,6 @@ Based on those values you should print a specific message followed by a new line ---------------------------------------------------------------------- ## HINTS -Documentation on the fdiv function can be found by pointing your browser here: -[https://www.php.net/manual/en/function.fdiv.php]() +{{ doc 'fdiv' en function.fdiv.php }} + diff --git a/exercises/lord-of-the-strings/problem/problem.md b/exercises/lord-of-the-strings/problem/problem.md index ccceeb6..4988452 100644 --- a/exercises/lord-of-the-strings/problem/problem.md +++ b/exercises/lord-of-the-strings/problem/problem.md @@ -44,17 +44,23 @@ The result column should be `true` or `false` based on the result of the corresp ---------------------------------------------------------------------- ## HINTS +{{ cli }} Point your browser to [https://getcomposer.org/doc/00-intro.md](https://getcomposer.org/doc/00-intro.md) which will walk you through **Installing Composer** if you haven't already! Use `composer init` to create your `composer.json` file with interactive search. +{{ cli }} + +{{ cloud }} +Composer is installed and ready to go on cloud, use the `Composer Deps` button in the editor to search for and install your dependencies. While you should read the documentation for [Composer](https://getcomposer.org/doc/00-intro.md), it's important to note that the way we manage dependencies on PHP School cloud, is not how you would manage them in your own projects. We abstract away the `composer.json` file to keep it simple. +{{ cloud }} For more details look at the docs for... -**Composer** - [https://getcomposer.org/doc/01-basic-usage.md](https://getcomposer.org/doc/01-basic-usage.md) -**Symfony Console** - [https://symfony.com/doc/current/components/console.html](https://symfony.com/doc/current/components/console.html) -**str_contains** - [https://www.php.net/manual/en/function.str-contains.php](https://www.php.net/manual/en/function.str-contains.php) -**str_starts_with** - [https://www.php.net/manual/en/function.str-starts-with.php](https://www.php.net/manual/en/function.str-starts-with.php) -**str_ends_with** - [https://www.php.net/manual/en/function.str-ends-with.php](https://www.php.net/manual/en/function.str-ends-with.php) +* **Composer** - [https://getcomposer.org/doc/01-basic-usage.md](https://getcomposer.org/doc/01-basic-usage.md) +* **Symfony Console** - [https://symfony.com/doc/current/components/console.html](https://symfony.com/doc/current/components/console.html) +* **str_contains** - [https://www.php.net/manual/en/function.str-contains.php](https://www.php.net/manual/en/function.str-contains.php) +* **str_starts_with** - [https://www.php.net/manual/en/function.str-starts-with.php](https://www.php.net/manual/en/function.str-starts-with.php) +* **str_ends_with** - [https://www.php.net/manual/en/function.str-ends-with.php](https://www.php.net/manual/en/function.str-ends-with.php) For Symfony Console you will want to look specifically for the Table Helper. diff --git a/exercises/php-gets-a-promotion/problem/problem.md b/exercises/php-gets-a-promotion/problem/problem.md index d17e0bc..cd2d681 100644 --- a/exercises/php-gets-a-promotion/problem/problem.md +++ b/exercises/php-gets-a-promotion/problem/problem.md @@ -1,4 +1,4 @@ -You have been given a piece of code (look for `php-gets-a-promotion.php` in your working directory) which provides a class written for PHP 7. +You have been given a piece of code (look for `php-gets-a-promotion.php` in {{context cli 'your working directory'}} {{context cloud 'the editor'}}) which provides a class written for PHP 7. The code itself works well, assigning constructor arguments to the class properties. @@ -18,12 +18,11 @@ Focus on converting the constructor to a terse format using constructor property ---------------------------------------------------------------------- ## HINTS -Documentation on the constructor property promotion feature can be found by pointing your browser here: -[https://www.php.net/manual/en/language.oop5.decon.php#language.oop5.decon.constructor.promotion]() +{{ doc 'Constructor Property Promotion' en language.oop5.decon.php#language.oop5.decon.constructor.promotion }} -Remember to keep the same visibility for the properties +Remember to keep the same visibility for the properties. -You will be expected to make use of the constructor property promotion feature +You will be expected to make use of the constructor property promotion feature. -You should have less code than the provided initial code +You should have less code than the provided initial code. diff --git a/exercises/stringify-to-demystify/problem/problem.md b/exercises/stringify-to-demystify/problem/problem.md index 7d96de9..a0eb095 100644 --- a/exercises/stringify-to-demystify/problem/problem.md +++ b/exercises/stringify-to-demystify/problem/problem.md @@ -1,6 +1,6 @@ `__toString()` is a magic class method long-standing in PHP but never truly something you could rely on unless you rolled your own interface. All that has changed with the simple introduction of the `Stringable` interface in PHP 8. -`Stringable` is a simple interface that requires the implementation of `__toString(): string` +`Stringable` is a simple interface that requires the implementation of the method `__toString(): string` ---------------------------------------------------------------------- @@ -35,13 +35,11 @@ Your program may also receive successful payloads, which you should ignore for t To easily read the request body you can use `file_get_contents('php://input')` -For more details look at the docs for... +{{ doc 'Stringable' en class.stringable.php }} -**Stringable** - [https://www.php.net/manual/en/class.stringable.php]() - -Note that while the `Stringable` interface isn't required to pass the type hint check, however, it should be used if not only to show intent. +Note that while the `Stringable` interface isn't required to pass the type hint check (simply implementing the method `__toString` is enough), it should be used if not only to signal intent. Oh, and don't forget about the basics for classes and interfaces :) -**class** - [https://www.php.net/manual/en/language.oop5.basic.php]() -**interfaces** - [https://www.php.net/manual/en/language.oop5.interfaces.php]() +* **class** - [https://www.php.net/manual/en/language.oop5.basic.php](https://www.php.net/manual/en/language.oop5.basic.php) +* **interfaces** - [https://www.php.net/manual/en/language.oop5.interfaces.php](https://www.php.net/manual/en/language.oop5.interfaces.php) diff --git a/exercises/the-attributes-of-success/problem/problem.md b/exercises/the-attributes-of-success/problem/problem.md index 6a2e644..ac7dfbb 100644 --- a/exercises/the-attributes-of-success/problem/problem.md +++ b/exercises/the-attributes-of-success/problem/problem.md @@ -1,15 +1,17 @@ -You have been given a few pieces of code (look for `attributes.php`, `deserialize.php` & `the-attributes-of-success.php` in your working directory). +You have been given a few pieces of code (look for `attributes.php`, `deserialize.php` & `the-attributes-of-success.php` in {{context cli 'your working directory'}} {{context cloud 'the editor'}}). Your entry point is `the-attributes-of-success.php`. This is the file you should edit and work on. The other files should not be modified. However, they are included by `the-attributes-of-success.php`. +{{ cli }} You can run and verify your program like so: ```sh $ {appname} run the-attributes-of-success.php $ {appname} verify the-attributes-of-success.php ``` +{{ cli }} -Your task is split into two sections. The overall task is to write a class using properties and attributes which describe how to map data to an instance of the class. +Your task is split in to two sections. The overall task is to write a class using properties and attributes which describe how to map data to an instance of the class. The data will be passed to you in a JSON encoded string via the first command line argument. @@ -68,6 +70,7 @@ Use the `Skip` attribute on the `id` property of our `Review` class to tell our By now you should be able to call the `deserialize` function with the `JSON` data and your class name. +{{ cli }} When executing your program with ```sh @@ -75,6 +78,11 @@ $ {appname} run the-attributes-of-success.php ``` You should see a dump of your `Review` instance. +{{ cli }} + +{{ cloud }} +When you execute your program by pressing `Run` you should see a dump of your `Review` instance. +{{ cloud }} Here comes our problem: The reviewers name is not anonymous. We have to comply with strict privacy laws, we cannot display this data without the reviewer's permission. @@ -126,8 +134,7 @@ The last task is to dump your object instance out using the PHP function `var_du ---------------------------------------------------------------------- ## HINTS -Documentation on the Attributes feature can be found by pointing your browser here: -[https://www.php.net/manual/en/language.attributes.overview.php]() +{{ doc 'Attributes' en language.attributes.overview.php }} Remember, do not edit `attributes.php` or `deserialize.php` - verification will fail if you do. Feel free to read the files to get a better understanding of the deserialization process. @@ -135,10 +142,10 @@ You must call the `deserialize` function and you must use the `var_dump` functio If you want to see the `JSON` data - use `var_dump` to dump it out. -For verification purposes, the order the properties defined in your `Review` class is important. Define them in the same order they are described to you. +For verification purposes, the order the properties are defined in your `Review` class is important. Define them in the same order they are described to you. ## Extra -If you're not sure how to access command line arguments - you should maybe try a different workshop which covers that topic. Try `learnyouphp`. +If you're not sure how to access command line arguments - you should maybe try a different workshop which covers that topic. Try the Learn you PHP workshop. `json_decode` can fail if it is passed a malformed string. Wrap the decode in a `try\catch` statement and pass the `JSON_THROW_ON_ERROR` flag to `json_decode`'s fourth parameter. \ No newline at end of file diff --git a/exercises/the-return-of-static/problem/problem.md b/exercises/the-return-of-static/problem/problem.md index 3b65337..e4b1eef 100644 --- a/exercises/the-return-of-static/problem/problem.md +++ b/exercises/the-return-of-static/problem/problem.md @@ -1,8 +1,14 @@ -You have been given a piece of code (look for `the-return-of-static.php` in your working directory) which is using static return types. +You have been given a piece of code (look for `the-return-of-static.php` in {{context cli 'your working directory'}} {{context cloud 'the editor'}}) which is using static return types. You will find two classes. `File`, a base class, and `Image` a class extending and adding behavior to `File`. We instantiate `Image`, set some properties using a fluent interface and then dump the object using `var_dump`. +{{ cli }} If you run the code using `{appname} run the-return-of-static.php` you will see it is broken. +{{ cli }} + +{{ cloud }} +If you run the code by clicking the `Run` button in the editor you will see it is broken. +{{ cloud }} Locate and fix the issue! @@ -14,8 +20,8 @@ Locate and fix the issue! ---------------------------------------------------------------------- ## HINTS -(Brief) Documentation on the static return type feature can be found by pointing your browser here: -[https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.static]() +(Brief) documentation on the static return type feature can be found by pointing your browser here: +[https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.static](https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.static) The static return type enforces methods to return an instance of the class that the method was called from, rather than the one it was defined in. diff --git a/exercises/throw-an-expression/problem/problem.md b/exercises/throw-an-expression/problem/problem.md index 09332de..b8f5832 100644 --- a/exercises/throw-an-expression/problem/problem.md +++ b/exercises/throw-an-expression/problem/problem.md @@ -1,16 +1,16 @@ -You have been given a piece of code (look for `throw-an-expression.php` in your working directory) which is checking the requested URL and throwing an exception when a secret area of the website is accessed. +You have been given a piece of code (look for `throw-an-expression.php` in {{context cli 'your working directory'}} {{context cloud 'the editor'}}) which is checking the requested URL and throwing an exception when a secret area of the website is accessed. If the request is allowed, `Welcome!` is printed out. Traditionally, pre PHP 8, an exception throw has been a statement. There are certain places where statements cannot be used, and only expressions can be used. For example, in ternaries and short closures, only expressions can be used. -Now with PHP 8, throw statements are expressions making them available to use in pretty much all locations. +Now with PHP 8, throw statements are expressions, making them available to use in pretty much all locations. ---------------------------------------------------------------------- Your task is to convert the `if` statement to one line of code, using the ternary operator. -### The advantages of throwing being an exception +### The advantages of throw being an exception * It is possible to throw an exception in a short closure * It is possible to throw an exception in a ternary or coalesce operation @@ -18,6 +18,5 @@ Your task is to convert the `if` statement to one line of code, using the ternar ---------------------------------------------------------------------- ## HINTS -Documentation on throwing exception can be found by pointing your browser here: -[https://www.php.net/manual/en/language.exceptions.php]() +{{ doc 'throwing exceptions' en language.exceptions.php }} diff --git a/exercises/unite-the-types/problem/problem.md b/exercises/unite-the-types/problem/problem.md index 5995f71..7db8c2b 100644 --- a/exercises/unite-the-types/problem/problem.md +++ b/exercises/unite-the-types/problem/problem.md @@ -30,8 +30,7 @@ The function you implement must be called `adder`. It is up to you to pass the numbers to your function. -Documentation on union types can be found by pointing your browser here: -[https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.union]() +{{ doc 'union types' en language.types.declarations.php#language.types.declarations.union }} ---------------------------------------------------------------------- ## EXTRA diff --git a/test/Exercise/LordOfTheStringsTest.php b/test/Exercise/LordOfTheStringsTest.php index 57cba60..e4d671c 100644 --- a/test/Exercise/LordOfTheStringsTest.php +++ b/test/Exercise/LordOfTheStringsTest.php @@ -4,6 +4,7 @@ use PhpSchool\PHP8Appreciate\Exercise\LordOfTheStrings; use PhpSchool\PhpWorkshop\Application; +use PhpSchool\PhpWorkshop\Result\ComposerFailure; use PhpSchool\PhpWorkshop\Result\Failure; use PhpSchool\PhpWorkshop\Result\FunctionRequirementsFailure; use PhpSchool\PhpWorkshop\TestUtils\WorkshopExerciseTest; @@ -25,7 +26,12 @@ public function testWithNoComposerFile(): void $this->runExercise('solution-no-code.php'); $this->assertVerifyWasNotSuccessful(); - $this->assertResultsHasFailure(Failure::class, 'No composer.json file found'); + $this->assertResultsHasFailureAndMatches(ComposerFailure::class, function (ComposerFailure $composerFailure) { + self::assertTrue($composerFailure->isMissingComponent()); + self::assertEquals('composer.json', $composerFailure->getMissingComponent()); + + return true; + }); } public function testWithNoCode(): void