Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.

Commit c23fe47

Browse files
Require PHP files to only contain PHP (#24)
* Require PHP files to only contain PHP * Update for PHP_CodeSniffer 3.4 * Don't need to upgrade * Duplicate * Changed my mind
1 parent 4213479 commit c23fe47

File tree

6 files changed

+52
-5
lines changed

6 files changed

+52
-5
lines changed

src/Libero/ruleset.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
</rule>
1212

1313
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
14+
<rule ref="Generic.Files.InlineHTML"/>
1415
<rule ref="Generic.Formatting.SpaceAfterCast"/>
1516
<rule ref="Generic.PHP.BacktickOperator"/>
17+
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
1618
<rule ref="Generic.PHP.LowerCaseType"/>
1719
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent"/>
1820
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility">

tests/cases/php/bom

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ declare(strict_types=1);
99

1010
---MESSAGES---
1111
1:1 Generic.Files.ByteOrderMark.Found
12+
---IGNORE-MESSAGES---
13+
1:1 Generic.Files.InlineHTML.Found
14+
1:2 Generic.PHP.CharacterBeforePHPOpeningTag.Found
1215
---

tests/cases/php/closing-tag

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---DESCRIPTION---
2-
No closing PHP tags at the end of files
2+
No closing PHP tags
33
---CONTENTS---
44
<?php
55

@@ -9,11 +9,10 @@ $foo = 'bar';
99

1010
?>
1111

12-
---FIXED---
1312
<?php
1413

15-
declare(strict_types=1);
16-
17-
$foo = 'bar';
14+
$baz = 'qux';
1815

16+
---MESSAGES---
17+
8:1 Generic.Files.InlineHTML.Found
1918
---

tests/cases/php/closing-tag-end

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---DESCRIPTION---
2+
No closing PHP tags at the end of files
3+
---CONTENTS---
4+
<?php
5+
6+
declare(strict_types=1);
7+
8+
$foo = 'bar';
9+
10+
?>
11+
12+
---FIXED---
13+
<?php
14+
15+
declare(strict_types=1);
16+
17+
$foo = 'bar';
18+
19+
---

tests/cases/php/opening-tag

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---DESCRIPTION---
2+
No content before the opening PHP tag
3+
---CONTENTS---
4+
foo<?php
5+
6+
declare(strict_types=1);
7+
8+
---MESSAGES---
9+
1:1 Generic.Files.InlineHTML.Found
10+
1:4 Generic.PHP.CharacterBeforePHPOpeningTag.Found
11+
---

tests/cases/whitespace/opening-tag

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---DESCRIPTION---
2+
No whitespace before the opening PHP tag
3+
---CONTENTS---
4+
<?php
5+
6+
declare(strict_types=1);
7+
8+
---FIXED---
9+
<?php
10+
11+
declare(strict_types=1);
12+
13+
---

0 commit comments

Comments
 (0)