Merge branch 'master' into php5

* master:
  Only install composer dependencies in PHP 5.5 environment.
  Run code sniffer on PHP 5.5 environment on Travis CI.
  Add ruleset for phpseclib coding standard.
  Install composer dependencies on Travis CI.
  Add composer.lock file.
  Add CodeSniffer as composer development dependency.
This commit is contained in:
Andreas Fischer 2013-11-26 20:09:35 +01:00
commit 7500eedfd6
4 changed files with 146 additions and 0 deletions

View File

@ -15,8 +15,10 @@ env:
before_script:
- git clone git://github.com/zenovich/runkit.git && cd runkit && phpize && ./configure && make && make install && cd ..
- echo "extension=runkit.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' ]; then composer install --dev --no-interaction; fi"
script:
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' ]; then vendor/bin/phpcs -s --extensions=php --standard=tests/code_sniffer_ruleset.xml phpseclib/; fi"
- phpunit --verbose --coverage-text --coverage-html code_coverage/
after_success:

View File

@ -33,6 +33,9 @@
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "1.*"
},
"suggest": {
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a wide variety of cryptographic operations.",
"ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations."

96
composer.lock generated Normal file
View File

@ -0,0 +1,96 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "e692359d277b10176319a11c2aef51aa",
"packages": [
],
"packages-dev": [
{
"name": "squizlabs/php_codesniffer",
"version": "1.4.7",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "df764a1604607ea61c4eeea5410666e27cb37a8b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/df764a1604607ea61c4eeea5410666e27cb37a8b",
"reference": "df764a1604607ea61c4eeea5410666e27cb37a8b",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.1.2"
},
"suggest": {
"phpunit/php-timer": "dev-master"
},
"bin": [
"scripts/phpcs"
],
"type": "library",
"autoload": {
"classmap": [
"CodeSniffer.php",
"CodeSniffer/CLI.php",
"CodeSniffer/Exception.php",
"CodeSniffer/File.php",
"CodeSniffer/MultiFileSniff.php",
"CodeSniffer/Report.php",
"CodeSniffer/Reporting.php",
"CodeSniffer/Sniff.php",
"CodeSniffer/Tokens.php",
"CodeSniffer/Reports/",
"CodeSniffer/CommentParser/",
"CodeSniffer/Tokenizers/",
"CodeSniffer/DocGenerators/",
"CodeSniffer/Standards/AbstractPatternSniff.php",
"CodeSniffer/Standards/AbstractScopeSniff.php",
"CodeSniffer/Standards/AbstractVariableSniff.php",
"CodeSniffer/Standards/IncorrectPatternException.php",
"CodeSniffer/Standards/Generic/Sniffs/",
"CodeSniffer/Standards/MySource/Sniffs/",
"CodeSniffer/Standards/PEAR/Sniffs/",
"CodeSniffer/Standards/PSR1/Sniffs/",
"CodeSniffer/Standards/PSR2/Sniffs/",
"CodeSniffer/Standards/Squiz/Sniffs/",
"CodeSniffer/Standards/Zend/Sniffs/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Greg Sherwood",
"role": "lead"
}
],
"description": "PHP_CodeSniffer tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "http://www.squizlabs.com/php-codesniffer",
"keywords": [
"phpcs",
"standards"
],
"time": "2013-09-26 00:08:21"
}
],
"aliases": [
],
"minimum-stability": "stable",
"stability-flags": [
],
"platform": {
"php": ">=5.0.0"
},
"platform-dev": [
]
}

View File

@ -0,0 +1,45 @@
<?xml version="1.0"?>
<ruleset name="phpseclib Standard">
<description>phpseclib coding standard</description>
<!-- "for (; bar; )" should be "while (bar)" instead -->
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" />
<!-- A method MUST not only call its parent -->
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod" />
<!-- All code files MUST use only UTF-8 without BOM. -->
<rule ref="Generic.Files.ByteOrderMark" />
<!-- All code files MUST use the Unix LF (linefeed) line ending. -->
<rule ref="Generic.Files.LineEndings" />
<!-- Class constants MUST be declared in all upper case with underscore separators. -->
<rule ref="Generic.NamingConventions.UpperCaseConstantName" />
<!-- Only <?php, no short tags. -->
<rule ref="Generic.PHP.DisallowShortOpenTag.EchoFound" />
<!-- PHP keywords MUST be in lower case. -->
<rule ref="Generic.PHP.LowerCaseKeyword" />
<!-- Spaces MUST be used for indentation -->
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />
<!-- Method arguments with default values MUST go at the end of the argument list. -->
<rule ref="PEAR.Functions.ValidDefaultValue" />
<!-- In the argument list, there MUST NOT be a space before each comma,
and there MUST be one space after each comma. -->
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1"/>
</properties>
</rule>
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint" />
<!-- The ?> closing tag MUST be omitted from files containing only PHP. -->
<rule ref="Zend.Files.ClosingTag" />
</ruleset>