Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: force strict type declaration below file docblock #16

Merged
merged 3 commits into from Jan 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/LaminasCodingStandard/ruleset.xml
Expand Up @@ -104,7 +104,14 @@

<!-- The declare(strict_types=1) directive MUST be declared and be the
first statement in a file. -->
<rule ref="Generic.PHP.RequireStrictTypes"/>
<rule ref="WebimpressCodingStandard.Files.DeclareStrictTypes">
<properties>
<property name="containsTags" type="array">
<element value="@copyright"/>
<element value="@license"/>
</property>
</properties>
</rule>

<!-- 2.3 Lines -->

Expand Down
16 changes: 8 additions & 8 deletions test/expected-report.txt
Expand Up @@ -3,16 +3,16 @@ PHP CODE SNIFFER REPORT SUMMARY
----------------------------------------------------------------------
FILE ERRORS WARNINGS
----------------------------------------------------------------------
test/fixable/2.1.BasicCodingStandard.php 59 1
test/fixable/2.2.Files.php 4 0
test/fixable/2.1.BasicCodingStandard.php 48 1
test/fixable/2.2.Files.php 6 0
test/fixable/2.3.Lines.php 35 0
test/fixable/2.4.IndentingAndSpacing.php 46 0
test/fixable/2.5.KeywordsAndTypes.php 13 0
test/fixable/2.6.Variables.php 3 0
test/fixable/2.7.Arrays.php 9 0
test/fixable/3.DeclareNamespaceAndImport.php 15 0
test/fixable/3.DeclareNamespaceAndImport.php 11 0
test/fixable/4.1.ExtendsAndImplements.php 5 0
test/fixable/4.2.UsingTraits.php 5 0
test/fixable/4.2.UsingTraits.php 4 0
test/fixable/4.3.PropertiesAndConstants.php 5 0
test/fixable/4.4.MethodsAndFunctions.php 26 0
test/fixable/4.5.MethodAndFunctionArguments.php 66 0
Expand All @@ -23,7 +23,7 @@ test/fixable/5.1.IfElseifElse.php 15 1
test/fixable/5.2.SwitchCase.php 11 0
test/fixable/5.3.WhileAndDoWhile.php 12 0
test/fixable/5.4.ForStructure.php 7 0
test/fixable/5.5.ForEachStructure.php 12 0
test/fixable/5.5.ForEachStructure.php 10 0
test/fixable/5.6.TryCatchFinally.php 9 0
test/fixable/5.ControlStructures.php 4 0
test/fixable/6.1.UnaryOperators.php 6 0
Expand All @@ -32,11 +32,11 @@ test/fixable/6.3.TernaryOperators.php 13 0
test/fixable/6.Operators.php 97 0
test/fixable/7.Closures.php 2 0
test/fixable/8.AnonymousClasses.php 1 0
test/fixable/9.CommentingAndDocBlocks.php 22 0
test/fixable/9.CommentingAndDocBlocks.php 21 0
----------------------------------------------------------------------
A TOTAL OF 584 ERRORS AND 2 WARNINGS WERE FOUND IN 30 FILES
A TOTAL OF 567 ERRORS AND 2 WARNINGS WERE FOUND IN 30 FILES
----------------------------------------------------------------------
PHPCBF CAN FIX 494 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
PHPCBF CAN FIX 487 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


6 changes: 6 additions & 0 deletions test/fixable/2.2.Files.php
Expand Up @@ -2,6 +2,12 @@

declare(strict_types=1);

/**
* @see https://github.com/laminas/laminas-coding-standard for the canonical source repository
* @copyright https://github.com/laminas/laminas-coding-standard/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-coding-standard/blob/master/LICENSE.md New BSD License
*/

namespace LaminasCodingStandardTest\fixed;

class Files
Expand Down
4 changes: 3 additions & 1 deletion test/fixable/3.DeclareNamespaceAndImport.php
@@ -1,7 +1,9 @@
<?php

/**
* This file contains an example of coding styles.
* @see https://github.com/laminas/laminas-coding-standard for the canonical source repository
* @copyright https://github.com/laminas/laminas-coding-standard/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-coding-standard/blob/master/LICENSE.md New BSD License
*/

declare(strict_types=1);
Expand Down
6 changes: 6 additions & 0 deletions test/fixed/2.2.Files.php
@@ -1,5 +1,11 @@
<?php

/**
* @see https://github.com/laminas/laminas-coding-standard for the canonical source repository
* @copyright https://github.com/laminas/laminas-coding-standard/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-coding-standard/blob/master/LICENSE.md New BSD License
*/

declare(strict_types=1);

namespace LaminasCodingStandardTest\fixed;
Expand Down
4 changes: 3 additions & 1 deletion test/fixed/3.DeclareNamespaceAndImport.php
@@ -1,7 +1,9 @@
<?php

/**
* This file contains an example of coding styles.
* @see https://github.com/laminas/laminas-coding-standard for the canonical source repository
* @copyright https://github.com/laminas/laminas-coding-standard/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-coding-standard/blob/master/LICENSE.md New BSD License
*/

declare(strict_types=1);
Expand Down