Skip to content

Commit

Permalink
Merge pull request #714 from slimphp/update-4.14-blog
Browse files Browse the repository at this point in the history
Add information about type-hinting to 4.14.0 post
  • Loading branch information
akrabat committed Jun 14, 2024
2 parents 509b3ad + e06cc5d commit c12eeda
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion _posts/2024-06-13-slim-4.14.0-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ layout: post
We are pleased to have released Slim 4.14.0. As a mature release, there aren't many changes and all are minor and
can be seen [here](https://github.com/slimphp/Slim/releases/tag/4.14.0).

Slim's docs are located [here](http://www.slimframework.com/docs/v4).
## Type hinting with template generics

This release introduces of [template generic docblocks](https://phpstan.org/blog/generics-in-php-using-phpdocs) into Slim. If you type-hint `Slim\App` instance variable using `/** @var \Slim\App $app */`, then you will need to change it to either:

* `/** @var \Slim\App<null> $app */` if you are not using a DI container, or
* `/** @var \Slim\App<\Psr\Container\ContainerInterface> $app */` if you are.

You can also type-hint to the concrete instance of the container you are using too. For example, if you are using [PHP-DI](https://php-di.org), then you can use: `/** @var \Slim\App<DI\Container> $app */`.

0 comments on commit c12eeda

Please sign in to comment.