Skip to content

Commit 05e593b

Browse files
authored
Merge pull request #267 from simPod/heredoc
feat: require nowdoc syntax instead of heredoc when possible
2 parents 94d69cd + eb43dd9 commit 05e593b

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

lib/Doctrine/ruleset.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,8 @@
448448
<rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable"/>
449449
<!-- Forbid useless variables -->
450450
<rule ref="SlevomatCodingStandard.Variables.UselessVariable"/>
451+
<!-- Require nowdoc syntax instead of heredoc when possible -->
452+
<rule ref="SlevomatCodingStandard.PHP.RequireNowdoc" />
451453
<!-- Forbid spaces around square brackets -->
452454
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
453455
<!-- Force array declaration structure -->

tests/fixed/strings.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Strings;
6+
7+
$doc = <<<'TEXT'
8+
text without special chars
9+
TEXT;

tests/input/strings.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Strings;
6+
7+
$doc = <<<TEXT
8+
text without special chars
9+
TEXT;

tests/php74-compatibility.patch

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/tests/expected_report.txt b/tests/expected_report.txt
2-
index c644926..1854dbb 100644
2+
index c644926..7d122d2 100644
33
--- a/tests/expected_report.txt
44
+++ b/tests/expected_report.txt
55
@@ -15,7 +15,7 @@ tests/input/ControlStructures.php 28 0
@@ -23,7 +23,12 @@ index c644926..1854dbb 100644
2323
tests/input/null_coalesce_operator.php 3 0
2424
tests/input/optimized-functions.php 1 0
2525
tests/input/PropertyTypeHintSpacing.php 6 0
26-
@@ -39,15 +39,15 @@ tests/input/superfluous-naming.php 11 0
26+
@@ -35,19 +35,20 @@ tests/input/semicolon_spacing.php 3 0
27+
tests/input/single-line-array-spacing.php 5 0
28+
tests/input/spread-operator.php 6 0
29+
tests/input/static-closures.php 1 0
30+
+tests/input/strings.php 1 0
31+
tests/input/superfluous-naming.php 11 0
2732
tests/input/test-case.php 8 0
2833
tests/input/trailing_comma_on_array.php 1 0
2934
tests/input/traits-uses.php 11 0
@@ -35,10 +40,10 @@ index c644926..1854dbb 100644
3540
tests/input/UselessConditions.php 20 0
3641
----------------------------------------------------------------------
3742
-A TOTAL OF 377 ERRORS AND 0 WARNINGS WERE FOUND IN 41 FILES
38-
+A TOTAL OF 389 ERRORS AND 0 WARNINGS WERE FOUND IN 41 FILES
43+
+A TOTAL OF 390 ERRORS AND 0 WARNINGS WERE FOUND IN 42 FILES
3944
----------------------------------------------------------------------
4045
-PHPCBF CAN FIX 313 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
41-
+PHPCBF CAN FIX 323 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
46+
+PHPCBF CAN FIX 324 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
4247
----------------------------------------------------------------------
4348

4449

0 commit comments

Comments
 (0)