View zf2.txt
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
Running with a single standard will allow sniffs in that standard to add metrics about the source code. | |
This is a good way to get a feel for how a code base is deviating from a standard and ways you can | |
tweak the standard to more closely match what the majority of developers are doing. | |
The report output is still very rough, so read output like this: | |
Function openning brace placement: new line [10431/10598, 98.42%] | |
same line => 167 (1.58%) | |
as this: | |
The majority of function openning braces are placed on a new line (98.42%). |
View 21-Feb-2014.json
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
{ | |
"Arrays":{ | |
"Array keyword case":{ | |
"sniffs":{ | |
"0":"Squiz.Arrays.ArrayDeclaration" | |
}, | |
"total":94079, | |
"values":{ | |
"lower":94077, | |
"upper":2 |
View mystandard.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
<?xml version="1.0"?> | |
<ruleset name="PSR2"> | |
<description>The PSR-2 coding standard.</description> | |
<!-- PHP code MUST use the long <?php ?> tags or the short-echo <?= ?> tags; it MUST NOT use the other tag variations. --> | |
<rule ref="Generic.PHP.DisallowShortOpenTag.EchoFound"> | |
<severity>0</severity> | |
</rule> | |
<!-- PHP code MUST use only UTF-8 without BOM. --> |
View temp.php
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
<?php | |
namespace I18nMessages\Test\I18n; | |
use Cake\TestSuite\TestCase; | |
use I18nMessages\I18n\DbMessagesLoader; | |
/** | |
* Tests for DbMessagesLoader | |
*/ | |
class DbMessagesLoaderTest extends TestCase |
View SearchStringSniff.php
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
<?php | |
/** | |
* Generic_Sniffs_Strings_SearchStringSniff. | |
* | |
* PHP version 5 | |
* | |
* @category PHP | |
* @package PHP_CodeSniffer | |
* @author Greg Sherwood <gsherwood@squiz.net> | |
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600) |
View after.php
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
<?php | |
if ($foo) { | |
echo 'foo'; | |
} elseif ($bar) { | |
echo 'bar'; | |
} else { | |
echo 'else'; | |
} |
View output
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
$ cat temp.php | |
<?php | |
class Client extends GuzzleClient implements ClientInterface { | |
/** | |
* {@inheritdoc} | |
*/ | |
public function authenticatedRequest($method = 'GET', $url = null, UserInterface $user, $options = []) { | |
$duration = isset($options['timeout']) ? $options['timeout'] : NULL; | |
$options['query']['token'] = $user->acquireToken($duration); |
View gist:6773172
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
$ php scripts/phpcs ../zf2/library/Zend/ --standard=PSR2 -p --report=source -ns | |
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY | |
-------------------------------------------------------------------------------- | |
SOURCE COUNT | |
-------------------------------------------------------------------------------- | |
[x] PSR2.Methods.FunctionCallSignature.Indent 328 | |
[ ] PSR2.Methods.FunctionCallSignature.MultipleArguments 276 | |
[x] PSR2.Methods.FunctionCallSignature.CloseBracketLine 248 | |
[x] Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore 230 |
View gist:8275236
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
$ git diff | |
diff --git a/CodeSniffer/File.php b/CodeSniffer/File.php | |
index f45e307..e629fed 100644 | |
--- a/CodeSniffer/File.php | |
+++ b/CodeSniffer/File.php | |
@@ -1446,7 +1446,7 @@ class PHP_CodeSniffer_File | |
if (PHP_CODESNIFFER_VERBOSITY > 1) { | |
$type = $tokens[$i]['type']; | |
$content = str_replace($eolChar, '\n', $tokens[$i]['content']); | |
- echo "\tStart scope map at $i: $type => $content".PHP_EOL; |
View JSTokenizer.php
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
<?php | |
namespace MyCustomProject; | |
use PHP_CodeSniffer\Runner; | |
use PHP_CodeSniffer\Config; | |
use PHP_CodeSniffer\Files\DummyFile; | |
// Include the PHPCS autoloader, however you need to. | |
require_once __DIR__.'/autoload.php'; |
OlderNewer