From 0728dee85fd521ba48b0281ca947439fcb5d6c3b Mon Sep 17 00:00:00 2001 From: Rob Allen Date: Fri, 14 Jun 2024 09:43:50 +0100 Subject: [PATCH] Typo fixes --- _posts/2024-06-13-slim-4.14.0-release.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_posts/2024-06-13-slim-4.14.0-release.md b/_posts/2024-06-13-slim-4.14.0-release.md index ffe62dd2..ee920cf1 100644 --- a/_posts/2024-06-13-slim-4.14.0-release.md +++ b/_posts/2024-06-13-slim-4.14.0-release.md @@ -11,7 +11,7 @@ can be seen [here](https://github.com/slimphp/Slim/releases/tag/4.14.0). This release introduces of [template generic docblocks](https://phpstan.org/blog/generics-in-php-using-phpdocs) into Slim. -As Slim\App has a getContainer(): ?ContainerInterface method, the generics docblock enables you to specify what type is actually returned when this method is called. +As Slim\App has a getContainer(): ?ContainerInterface method, the generics docblock enables you to specify what type is actually returned when this method is called. i.e. consider that you are using [PHP-DI](https://php-di.org) and have this code: ``` @@ -19,14 +19,14 @@ $container = $this->app->getContainer(); $entries = $container->getKnownEntryNames(); ``` -[PHPStan](https://phpstan.org/) has no way of knowing that $container is an instance ofDI\Container which has a getKnownEntryNames() method and so will complain. +[PHPStan](https://phpstan.org/) has no way of knowing that $container is an instance of DI\Container which has a getKnownEntryNames() method and so will complain. -To inform PHPStan that we create Slim\App with PHP-DI, we change: /** @var \Slim\App $app */ to /** @var \Slim\App $app */ and now PHPStan knows that getKnownEntryNames() is a valid method call on $container. +To inform PHPStan that we created Slim\App with PHP-DI, we change: /** @var \Slim\App $app */ to /** @var \Slim\App $app */ and now PHPStan knows that getKnownEntryNames() is a valid method call on $container. ### Update your type hints -For your codebase, if you type hint Slim\App instance variable using /** @var \Slim\App $app */, then you will need to change it to either: +For your codebase, if you type hint Slim\App instance variables using /** @var \Slim\App $app */, then you will need to change it to either: * /** @var \Slim\App $app */ if you are not using a DI container, or * /** @var \Slim\App<\Psr\Container\ContainerInterface> $app */ if you are.