Fork me on GitHub
a Sensio Labs Product

Persian Successor (v3.65.0) edition

Rule compact_nullable_typehint

Remove extra spaces in a nullable typehint.

Description

Rule is applied only in a PHP 7.1+ environment.

Warning

This rule is deprecated and will be removed in the next major version

You should use compact_nullable_type_declaration instead.

Examples

Example #1

--- Original
+++ New
 <?php
-function sample(? string $str): ? string
+function sample(?string $str): ?string
 {}

References

The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.