This is the phpstorm version I'm using, and the issue still exists. PhpStorm 2018.1.6 Build #PS-181.5281.35, built on June 14, 2018 Licensed to Curve Dental / Hung Nguyen Subscription is active until February 22, 2019 JRE: 1.8.0152-release-1136-b39 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 4.4.0-31-generic. OpenAPI (Swagger) specification support (via plugin) Starting with 2020.2, PhpStorm supports the OpenAPI Specifications plugin. This is a free plugin developed by JetBrains which provides completion, navigation, and validation in OpenAPI spec files.
- Install Php annotations plugin for PhpStorm (Preferences → Plugins → Browse repositories → PHP Annotation → Install Plugin) Install swagger-php (composer require zircote/swagger-php=2.@dev) Write annotations (Swagger-php getting started) Convert annotations to swagger.json (./vendor/bin/swagger.o./swagger.json) 2.
- I tried to update the plugin, but failed. Only manual updates are possible, as it seems. Then I found another variant to install Symfony Plugin and then PHP annotations on Annotations in PHPStorm by Symfony2 plugin college term papers but the article how to code faster Symfony Applications in PHPStorm cannot be found.
Kubernetes is a container orchestration engine for the deployment, scaling, and management of containerized applications. Install and enable the Kubernetes plugin for PhpStorm to add the following features for managing your Kubernetes cluster:
Coding assistance for Kubernetes resource configuration files.
Coding assistance for Helm charts and templates.
Validation of custom resources with custom resource definition (CRD) specifications.
Coding assistance for Kustomize files: field and local file path completion, quick documentation, and navigation between Kustomize files and patches. The list of related Kustomize files appears in the editor at the top of the open Kustomize patch.
Interaction with the cluster from PhpStorm: use the Services tool window to see all resources of the Kubernetes cluster in the current context, jump to relevant resource definitions, view logs for containers running on pods, and much more.
The Kubernetes plugin is not bundled with PhpStorm, and should be installed from the JetBrains plugin repository. For more information, see Manage plugins.
Resource configuration files
The Kubernetes plugin supports Kubernetes API starting from version 1.5. It provides rich support for resource configuration files in YAML, and only basic support for the JSON format.
Feature | YAML | JSON |
---|---|---|
Auto-completion | Supported | Supported |
Quick documentation | Supported | Supported |
Inspections and quick fixes |
|
|
Live templates | Predefined templates for common configuration kinds:
| No predefined live templates |
Smart completion | Supported | Not supported |
Custom resource definitions | Supported | Not supported |
Label definitions and selectors | Navigation using gutter icons, find usages, and renaming | Not supported |
Enhancements of the original Kubernetes model | Enums instead of plain strings where applicable | None |
PhpStorm recognizes Kubernetes resource configuration files using the following mandatory fields:
apiVersion
: identifies the versioned schema of the object representationkind
: identifies the object kind (for example,Service
,Pod
,Deployment
, and so on)
If both of the previous fields are present in a YAML or JSON file, PhpStorm will mark the file with the corresponding Kubernetes icon and enable all available features:
For YAML files, you can also use predefined Live Templates to create the necessary type of configuration:
kcm
: Kubernetes ConfigMapkdep
: Kubernetes Deploymentkpod
: Kubernetes Podkres
: Kubernetes Generic Resourcekser
: Kubernetes Service
To see all available live templates for Kubernetes resource configuration files and create new ones, open the Settings/Preferences dialog Ctrl+Alt+S, select Editor | Live Templates, and expand the Kubernetes group in the list.
Configure the Kubernetes API version
PhpStorm provides completion for configuration key values, navigation to relevant selectors and definitions via gutter icons, specialized inspections that check for deprecated values and required keys, and other assistance features. These depend on the version of the API you are using. By default, PhpStorm sets it to the latest version. However, if your resources use an earlier version of the API, you can change it.
In the Settings/Preferences dialog Ctrl+Alt+S, select Languages & Frameworks | Kubernetes.
Change the Kubernetes API version and Kustomize version options as necessary.
Helm support
Helm is a tool for managing Kubernetes applications. Helm charts are packages of pre-configured resource definitions that you run inside a Kubernetes cluster. A chart contains a description of the package Chart.yaml and one or more templates used to generate Kubernetes manifest files.
The Go Template plugin is required for Helm template syntax support.
Coding assistance for Helm charts and templates includes code completion, refactorings, inspections, quick fixes, and quick documentation. Also, it is possible to use gutter icons for navigating between label definitions and label selectors, and between overridden and overriding values. Code completion includes values of dependencies from the specified repository (by default, from Helm Hub ).
By default, Go template directives are rendered as the actual values in Helm templates. You can click the value to expand and show the directive. This functionality is implemented using code folding. Press Ctrl+NumPad + and Ctrl+NumPad - to toggle between values and directives.
Right-click any directory in the Project tool window, point to Kubernetes, and click Helm Chart.
This runs the helm create command, which adds all the basic files required to get started:
.helmignore: Patterns to ignore when building packages
Chart.yaml: A basic chart description with metadata
values.yaml: Default values for chart templates
charts/: Directory for sub-charts
templates/: Directory for chart definitions
_helpers.tpl: Partials and functions for your templates
NOTES.txt: Information that is printed out after a chart is deployed
deployment.yaml: Example Kubernetes deployment definition
ingress.yaml: Example Kubernetes ingress definition
service.yaml: Example Kubernetes service definition
Right-click the template file, point to Kubernetes, and click Helm Template.
This runs the helm template command that renders a chart template. The rendered preview opens inside the diff viewer dialog to compare it with the original template file.
Right-click the chart, point to Kubernetes, and click Helm Dependency Update.
This runs the helm dependency update command.
In Helm 2, dependencies should be specified in the requirements.yaml file. This action also generates or updates requirements.lock.
In Helm 3, dependencies should be specified in the Chart.yaml file. If you specify the dependencies in the wrong file, PhpStorm provides an inspection with a quick-fix to move them.
Right-click the chart, point to Kubernetes, and click Helm Lint.
This runs the helm lint command that executes a series of tests to discover possible problems without actually installing the chart.
Custom resource definitions support
If your Kubernetes cluster is extended with custom resources, PhpStorm can validate them with custom resource definition (CRD) specifcations.
Specify the path to CRD specifications
In the Settings/Preferences dialog Ctrl+Alt+S, select Languages & Frameworks | Kubernetes.
Click and either select a local CRD file or specify a URL. Then click OK.
Use and to rearrange the list of CRD files. This defines the priority for conflicting definitions: the lowest one is used if it is defined in more than one file.
By default, CRDs are applied to the current project only. Change the Scope: option to IDE
if you want a certain CRD to be available for any project that you open with this IDE instance.
When you apply changes, newly added CRDs from URLs are automatically downloaded. Other modified CRDs will be downloaded only as the model reloads, which happens whenever you open the project or change other Kubernetes settings (for example, the order of CRDs) and it has been more than three hours since the last model reload. If it has been less than three hours since the last model reload, you can force a reload on the current model using the Re-read current configuration button.
To load the CRD from the running Kubernetes cluster, enable Use API schema from the active cluster if available.
You can view CRDs for the current cluster, including all their applied resources, under the Kubernetes node of the Services tool window.
The Kubernetes plugin supports CRD files of the following types:
The following example shows a simple CustomResourceDefinition specification for a custom resource stable.example.com/v1
of the kind CronTab
. Obligatory fields to identify the resource are metadata.name
, spec.group
, spec.versions
, and spec.names
.
Currently, not all fields from the OpenAPI schema can be used for validation (see pattern
, minimum
, and maximum
fields under validation.openAPIV3Schema
in the example). For more information, see CRD validation restrictions.
The following example shows a simple OpenAPI v2.0 schema with a CRD specification for a custom resource sample/v1
of the kind Config
. The root definition of the custom resource must contain the x-kubernetes-group-version-kind
field with the specified group, version, and kind. In the example, the root.Definition
object uses a build
property to reference the some.Definition
object.
CRD validation restrictions
The following OpenAPI v3 schema features are not supported:
multipleOf
maximum
exclusiveMaximum
minimum
exclusiveMinimum
maxLength
minLength
pattern
maxItems
minItems
uniqueItems
maxProperties
minProperties
allOf
oneOf
anyOf
not
format
default
nullable
readOnly
writeOnly
xml
externalDocs
example
deprecated
Productivity tips
If you use the features described here frequently, the following tips may be helpful:
Assign shortcuts
You can assign a keyboard shortcut for Kubernetes actions.
In the Settings/Preferences dialog Ctrl+Alt+S, select Keymap.
Type
kubernetes
in the search field, then double-click an action to set a shortcut for it.
Alternatively, you can use the Find Action dialog Ctrl+Shift+A, type kubernetes
, select the necessary action, and press Alt+Enter.
Configure code folding
By default, PhpStorm uses code folding to render value references in Helm templates and definitions in Kubernetes configuration files as the actual values. You can click the value to expand it or press Ctrl+NumPad + and Ctrl+NumPad - to toggle folding. If you want to see the references and defintions expanded by default, do the following:
In the Settings/Preferences dialog Ctrl+Alt+S, select Editor | General | Code Folding.
On the Code Folding page, clear the necessary checkboxes:
- Kubernetes: value references in Helm templates
- Kubernetes: EnvVar definitions in YAML files
- Kubernetes: ExecAction definitions in YAML files
Use multiple Kubernetes configuration files
PhpStorm detects the default
kubeconfig
file. To use a different configuration file, open Settings/Preferences, select Build, Execution, Deployment | Kubernetes, and set the necessary path. If you want to use different configuration files in different projects, select Set this path only for the current project.
PHP 8 Union Types
We have started rolling out support for PHP 8 with support for Union Types. In PHP 8.0 it will be possible to declare more than one type for properties, arguments, and return types. PhpStorm already fully supports this feature and can help you migrate effectively.
Convert PHPDoc to native union types
Union types used to be provided via PHPDoc, and now PhpStorm highlights such occurrences.
With the Alt+Enter quick-fix, they can now be converted into native union types.
This works anywhere that union types are applicable, including function arguments, return types, and properties. For properties, it takes into account default values, too.
Switch Language Level to PHP 8
To enable the PHP 8 related features, switch the language level to PHP 8 in any of the following ways:
- Use the Alt+Enter quick-fix directly in the code editor.
- Go to Preferences | Languages & Frameworks | PHP and use the PHP language level list.
- Specify the PHP version requirement in
composer.json
, and PhpStorm will pick it up automatically.
Perform type validation
PhpStorm analyzes calls, calculates possible types, and highlights problem areas relating to union types.
The checks work on all levels: properties, arguments, and return values.
Phpstorm Swagger Download
In complex code bases, it helps you see the problems at first glance. PhpStorm will highlight places that require attention even before the code is run.
Detect duplicate and redundant types
There are many type combinations that are forbidden or redundant. For example:
bool|false
Foo|Foo
object|User
iterable|array
oriterable|Traversable
All of them are highlighted by PhpStorm as invalid.
Work with nullable types
When there is a single nullable type, it is allowed to use either ?Type
notation or Type|null
in PHP 8.
But when there are multiple types combined with null, using ?Type1|Type2
is forbidden as ambiguous.
PhpStorm highlights these violations and provides an Alt+Enter quick-fix to convert them.
Follow variance rules
During inheritance, PHP allows you to modify types if you follow these basic rules:
- Parameter types are contravariant, i.e. can be extended.
- Return types are covariant, i.e. can only be narrowed down.
- Property types have to evaluate to the same type.
Luckily, with PhpStorm there is no need to remember these rules as it will check the code and highlight any violations.
Use pseudotype false
In PHP 8 there will be a special false
pseudotype that can be used only in union type declarations.
It is widely used in the standard library, see strpos()
or array_search()
, for example, and can be applied elsewhere to indicate a negative result.
PhpStorm highlights incorrect usages and takes type inference into account.
Remove redundant PHPDoc
After adding a native union type declaration, a PHPDoc may become unnecessary because it does not provide any extra information.
You can now remove it with a quick-fix Alt+Enter.
New Control Flow Engine
Condition always true
PhpStorm can now analyze complex code paths and detect if the condition in an if-else
block makes sense or is redundant.
Result of ‘instanceof’ is always true
Similar to conditions, PhpStorm is able to detect when instanceof
checks are appropriate, or if they always evaluate to true because of the inferred type in the type hierarchy.
New action: Type Info
Phpstorm Swagger 2
The new action lets you see the inferred type of any selected expression.
When coding, you can select an expression and check its type by using the shortcut Ctrl+Shift+P or View | Type Info menu.
Expression is always ‘null’
Free internet explorer 9 download for mac. PhpStorm can detect when the variable is guaranteed to be null
only. In this case, the IDE suggests simplifying the expression to make it clearer.
Quality Tools Improvements
- It is now possible to run quality tools via Docker Compose.
To do this, go to Preferences/Settings | Languages & Frameworks | PHP, and add a new remote interpreter based on Docker Compose. - Reformat action for PHP-CS-Fixer and PHPCBF can now be run through a remote interpreter too.
- If PHP_CodeSniffer’s
ruleset.xml
has an'exclude-pattern'
section, PhpStorm will now take this into account and not analyze files under the specified path.
Composer Improvements
Managing Composer dependencies can be done in the editor directly inside the composer.json file.
Support for custom Satis/Packagist packages
If there are custom sources specified in the “repositories”
section, you will get completion for custom packages.
There is now a gutter icon showing the current state of the caching of custom repositories.
Completion for multiple versions
Can you download netflix to a macbook pro. When a package has multiple versions separated with a comma or pipes (||
), PhpStorm provides completion with all available versions for this package.
It used to be that completion was lost after typing ~
, ^
, or >=
, but now it works as expected with any of these range constraints in composer.json.
Quick access to settings of tools added as dependencies
PhpStorm provides many integrations with third-party tools. Now, if a supported tool is declared in composer.json, there will be a wrench icon in the gutter beside it. You can click it to go straight to the corresponding section of preferences.
Extract Class Refactoring
If a class gets cluttered and burdened with a lot of additional responsibilities, it is now possible to refactor it by moving methods and properties to a new class with the Extract Class refactoring.
Select a function, a method, or a property you’d like to move and press Ctrl+T and select Extract class.
The refactoring will create a new file, instantiate an object of the class in the constructor, and adjust the usages automatically.
Command Line Tools Improvements
Support for remote interpreters is now available for PHP Command Line Tools.
Under Preferences/Settings | Tools | Command Line Tool Support, add a new tool entry and choose one of the configured remote interpreters.
Laravel Artisan will now be detected automatically! It means that when you open a Laravel project, you can press Ctrl-Ctrl and start typing a command. PhpStorm will provide completion and suggest available commands.
New Inspections
Array used only with write access
If there is an array declared and updated somewhere in the code, but it is never read, it means that the array is very likely redundant and adds noise to the code.
The inspection detects such cases and prompts you to remove the array to make the code cleaner.
Typed property might be unassigned
If a typed property does not have a default value, it is considered uninitialized. Reading uninitialized properties will generate a TypeError
(unless magic __get()
is defined).
PhpStorm detects uninitialized properties and highlights code that attempts to read them.
Full Support for GitHub Pull Requests
The entire Pull Request workflow can now be done in PhpStorm, and there is no longer any need to switch to a browser. You can manage pull requests; view the timeline and inline comments; add comments and reviews; and accept changes.
To start working with GitHub pull requests, open the Pull Requests tool window either from the toolbar or from the main menu VCS | Git | View Pull Requests.
Then select a pull request in the list to view all its details: the message, branch names, author, and so on.
From here, you can start the review process by checking the changed files and commenting on the changes – on both the commit level and line level.
Merging pull requests without leaving the IDE is also possible. There’s no need to create a local branch from a pull request, it all works out of the box.
OpenAPI Support
PhpStorm 2020.2 supports the OpenAPI Specifications plugin. This is a free plugin developed by JetBrains that provides completion, navigation, and validation in the OpenAPI spec files (openapi.yaml/openapi.json and swagger.yaml/swagger.json).
The plugin also provides:
- Swagger UI Integration.
- Code generation.
- Built-in structure Diff between OpenAPI specifications.
- Gutter icons to create HTTP Client requests from specification.
- Autocompletion for endpoints in HTTP Client.
New Inspections Widget and Problems View
In the top right-hand corner of the editor, you’ll see the brand new Inspections Widget with a summary of the problems in the current file.
- Click arrows to jump between issues (or use shortcuts F2 / Shift+F2).
- Click on the widget to see a list of all issues in the file in the Problems tool window.
- Hover over the widget to see the settings popup and choose which issues to highlight.
Web Technologies
All the new features and improvements of WebStorm 2020.2 are available in PhpStorm 2020.2, either out of the box or with free plugins available in the plugin repository.
Prettier as the default formatter in JavaScript projects
Want to use Prettier instead of the built-in formatter to tidy up your code? With this update, it has become even easier than before. Just tick the new On code reformat checkbox and the IDE will use Prettier whenever you reformat your .js, .ts, .jsx, and .tsx files. Other file types can be easily added, too.
Best-in-class Vue.js support
Nuxt.js support, Vue-specific code style settings, improvements around Vue in TypeScript projects, and a lot of other things were added in the past year. Vue support in PhpStorm has never been so advanced!
Save some time with new features for JavaScript
New smart Alt+Enter intentions will help you perform some actions faster. For example, you can now quickly convert a for loop with a numeric index into a forEach
array method. Looking through documentation comments in JavaScript and TypeScript files has also become easier as you can now render them right in the editor, minimizing distractions.
Phpstorm Swagger Server
Version Control
Support for Git installed in WSL 2
PhpStorm 2020.2 supports Git installed in WSL 2 for working with projects located in Linux and Windows file systems.
The IDE can switch between Git executables depending on the project location. When a project is opened from WSL (via wsl$
path), the IDE will automatically switch to Git from WSL, and it will also provide you with the ability to use all the Git-related features in the IDE.
New UI to compare branches
When you want to compare two branches to see which commits do not belong to one another, PhpStorm 2020.2 will show the logs in the editor instead of the Git tool window. This will ensure that there is enough space to display all the information.
Choose the Compare with Current action from the Git Branches popup menu VCS | Branches.
Drop commit action
You can now easily remove redundant local commits by selecting them in the Log tab of the Git tool window and choosing Drop Commit from the context menu.
Squash local commits
It is also possible to combine several local commits into one single commit, for example to clean up history before pushing.
In the Git tool window, select commits and choose Squash Commits… from the context menu.
The IDE will run an interactive rebase behind the scenes.
Database Tools
Take a look at What’s new in DataGrip 2020.2 – all these features are available in PhpStorm too.
Separate editor for cell values
Now if you have a huge value in your cell, it can be viewed or edited in a separate panel. You can also toggle soft wrap mode using the right-hand toolbar. Use all the power of our code editor for your data.
Google BigQuery dialect
We’ve added a new SQL dialect: Google BigQuery. Full support for BigQuery is not here yet, but all things must begin somewhere. So far, PhpStorm can correctly highlight and provide coding assistance for your queries if you use Google BigQuery.
Php Swagger Phpstorm
DML preview
You can review the query that represents your changes in the data editor. There is a DML button that is active if there are pending changes. This query is not the exact SQL that will be run to modify your data, because PhpStorm uses a JDBC driver to update tables, but most of the time it will be the same.
Phpstorm Swagger Annotations
Other Improvements
Phpstorm Swagger Free
- Customizing getters and setters
- Resolve for multiple projects in one window
- New action: Add Carets to Ends of Selected Lines