From e4fa8b8e427dff7bbb7c8009e0a26620d681958b Mon Sep 17 00:00:00 2001 From: lubiana Date: Sat, 30 Apr 2022 21:24:25 +0200 Subject: [PATCH] some more typo and readability fixes --- 03-error-handler.md | 2 +- 04-development-helpers.md | 19 +++++++++---------- 06-router.md | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/03-error-handler.md b/03-error-handler.md index 60465d0..d1d7c06 100644 --- a/03-error-handler.md +++ b/03-error-handler.md @@ -58,7 +58,7 @@ $environment = getenv('ENVIRONMENT') ?: 'dev'; error_reporting(E_ALL); $whoops = new Run; -if ($environment == 'dev') { +if ($environment === 'dev') { $whoops->pushHandler(new PrettyPageHandler); } else { $whoops->pushHandler(function (\Throwable $e) { diff --git a/04-development-helpers.md b/04-development-helpers.md index 2dd943e..4469d69 100644 --- a/04-development-helpers.md +++ b/04-development-helpers.md @@ -47,7 +47,7 @@ Line Bootstrap.php The second error is something that "declare strict-types" already catches for us, but the first error is something that we usually would not discover easily without speccially looking for this errortype. -We can add a simple configfile called phpstan.neon to our project so that we do not have to specify the errorlevel and +We can add a simple configfile called `phpstan.neon` to our project so that we do not have to specify the errorlevel and path everytime we want to check our code for errors: ```yaml @@ -90,16 +90,15 @@ on an old legacy codebase and wanted to add static analysis to it but cant becau everytime we use phpstan, we could add all those errors to a list and tell phpstan to only bother us about new errors we are adding to our code. -In order to use that we have to add an empty file 'phpstan-baseline.neon' to our project, include that in the -phpstan.neon file and run phpstan with the -'--generate-baseline' option: +In order to use that we have to add an empty file `phpstan-baseline.neon` to our project, include that in the +`phpstan.neon` file and run phpstan with the `--generate-baseline` option: ```yaml includes: - phpstan-baseline.neon parameters: - level: 9 + level: max paths: - src ``` @@ -127,7 +126,7 @@ directory. You can read more about its usage and possible rulesets in the [documentation](https://github.com/FriendsOfPHP/PHP-CS-Fixer#documentation) personally i like to have a more opiniated version with some rules added to the psr-12 standard and have therefore setup -a configuration file that i use in all my projects .php-cs-fixer.php: +a configuration file that i use in all my projects `.php-cs-fixer.php`: ```php @@ -233,8 +232,8 @@ you could just write dd($whoops) somewhere in your bootstrap.php to check how th #### Composer scripts -now we have a few commands that are available on the command line. i personally do not like to type complex commands -with lots of parameters by hand all the time, so i added a few lines to my composer.json: +now we have a few commands that are available on the command line. I personally do not like to type complex commands +with lots of parameters by hand all the time, so I added a few lines to my `composer.json`: ```json "scripts": { diff --git a/06-router.md b/06-router.md index 6c39ae5..10a0c93 100644 --- a/06-router.md +++ b/06-router.md @@ -86,7 +86,7 @@ return function(\FastRoute\RouteCollector $r) { }; ``` -Now let's rewrite the route dispatcher part to use the `Routes.php` file. +Now let's rewrite the route dispatcher part to use the `routes.php` file. ```php $routeDefinitionCallback = require __DIR__ . '/../config/routes.php';