Updating Your Templates in PhpStorm
In the recent What’s New video for PhpStorm 2016.3, I noticed I was always adding PHP 7’s strict type declaration `declare(strict_types=1)` to every new file I created.
I commented at the time that I should update my default templates to include this by default and was asked at the time how to do that. I said I’d record a video, but I’ve realised it’s such a simple task that this blog post covers it.
So, to update your default templates, open your settings pane and navigate to Editor then File and Code Templates and in my case PHP File, PHP Class, PHP Interface, PHP Trait and PHP Unit Test. You can then update the new file template in the right-hand pane — I’m adding the declaration for strict types.
If you want to edit anything that’s included, you can use the Includes tab — the Code tab has the templates that are used when you use code generation, when you create Getters and Setters for example.
I hope this helps, sorry for the delay!
– Gary and the PhpStorm Team
Subscribe to Blog updates
Thanks, we've got you!
Laravel Best Practices: How to Automate Your Routine
5 useful tips to make your experience with the Laravel framework more productive
How the Pest PhpStorm Plugin Will Improve Your Testing Workflow
Perhaps you’ve already heard of Pest. It is a new PHP testing framework with a focus on simplicity. The Pest PhpStorm plugin is a new addition to PhpStorm’s growing ecosystem. With this plugin, testing your code in your favorite IDE is even simpler and faster! The source code behind the plugin is…
HTTP Client in PhpStorm Overview
When developing a web service, you would usually test it by sending all kinds of HTTP requests to it and examining what’s returned. In PhpStorm, you can do this directly in the code editor. In this post, we’ll use the github.com/JetBrains/phpstorm-http-client-tutorial example project to demonstra…
Quickstart with Docker in PhpStorm
So, you’ve decided to try something new today and started a project from scratch. Your first step will be to set up a development environment: at the bare minimum, you’d want to run a web server and a PHP interpreter (preferably – with the debugging engine installed). With Docker, you can star…