Fork me on GitHub
a Sensio Labs Product

I ate three cookies 🍪 (v3.40.2) 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
 {}

Source class

PhpCsFixer\Fixer\Whitespace\CompactNullableTypehintFixer