-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #257 from PHPCSStandards/develop
Release PHPCSExtra 1.1.0
- Loading branch information
Showing
82 changed files
with
6,306 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0"?> | ||
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" | ||
title="No Echo Sprintf" | ||
> | ||
<standard> | ||
<![CDATA[ | ||
Detects use of `echo [v]sprintf(...);`. Use `[v]printf()` instead. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: using [v]printf() or echo with anything but [v]sprintf()."> | ||
<![CDATA[ | ||
<em>printf</em>('text %s text', $var); | ||
<em>echo callMe</em>('text %s text', $var); | ||
]]> | ||
</code> | ||
<code title="Invalid: using echo [v]sprintf()."> | ||
<![CDATA[ | ||
<em>echo sprintf</em>('text %s text', $var); | ||
<em>echo vsprintf</em>('text %s text', [$var]); | ||
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |
42 changes: 42 additions & 0 deletions
42
Universal/Docs/FunctionDeclarations/NoLongClosuresStandard.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0"?> | ||
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" | ||
title="No Long Closures" | ||
> | ||
<standard> | ||
<![CDATA[ | ||
Forbids the use of long closures and recommends using named functions instead. | ||
By default a closure is considered "longish" (warning) when it contains more than 5 lines of code and too long (error) when it contains more than 8 lines of code. | ||
Also, by default only code lines are counted and blank lines and comment lines are ignored. | ||
Each of these settings can be changed via the sniff configuration. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: Short closure."> | ||
<![CDATA[ | ||
$closure = function() { | ||
line1(); | ||
line2(); | ||
line3(); | ||
}; | ||
]]> | ||
</code> | ||
<code title="Invalid: Long closure."> | ||
<![CDATA[ | ||
$closure = function() { | ||
line1(); | ||
line2(); | ||
line3(); | ||
line4(); | ||
line5(); | ||
line6(); | ||
line7(); | ||
line8(); | ||
line9(); | ||
line10(); | ||
}; | ||
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |
33 changes: 33 additions & 0 deletions
33
Universal/Docs/FunctionDeclarations/RequireFinalMethodsInTraitsStandard.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0"?> | ||
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" | ||
title="Require Final Methods in Traits" | ||
> | ||
<standard> | ||
<![CDATA[ | ||
Requires the use of the `final` keyword for non-abstract, non-private methods in traits. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: Final methods in a trait."> | ||
<![CDATA[ | ||
trait Foo { | ||
<em>final</em> public function bar() {} | ||
<em>final</em> public static function baz() {} | ||
// Also valid (out of scope): | ||
protected abstract function overload() {} | ||
private function okay() {} | ||
} | ||
]]> | ||
</code> | ||
<code title="Invalid: Non-final methods in a trait."> | ||
<![CDATA[ | ||
trait Foo { | ||
<em>public function</em> bar() {} | ||
<em>protected static function</em> baz() {} | ||
} | ||
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |
Oops, something went wrong.