Skip to content

Latest commit

 

History

History
62 lines (41 loc) · 1.17 KB

single_quote.rst

File metadata and controls

62 lines (41 loc) · 1.17 KB

Rule single_quote

Convert double quotes to single quotes for simple strings.

Configuration

strings_containing_single_quote_chars

Whether to fix double-quoted strings that contains single-quotes.

Allowed types: bool

Default value: false

Examples

Example #1

Default configuration.

--- Original
+++ New
 <?php

-$a = "sample";
+$a = 'sample';
 $b = "sample with 'single-quotes'";

Example #2

With configuration: ['strings_containing_single_quote_chars' => true].

--- Original
+++ New
 <?php

-$a = "sample";
-$b = "sample with 'single-quotes'";
+$a = 'sample';
+$b = 'sample with \'single-quotes\'';

Rule sets

The rule is part of the following rule sets:

@PhpCsFixer
Using the @PhpCsFixer rule set will enable the single_quote rule with the default config.
@Symfony
Using the @Symfony rule set will enable the single_quote rule with the default config.