Fixing PSR2 standards violations reported by PHP_CodeSniffer

This commit is contained in:
Ben Ramsey
2014-11-08 14:53:12 -05:00
parent cd2d09c356
commit 90fd1531d0
10 changed files with 37 additions and 16 deletions
+1
View File
@@ -27,6 +27,7 @@
"symfony/console": "~2.3",
"doctrine/dbal": ">=2.3",
"phpunit/phpunit": "~4.1",
"squizlabs/php_codesniffer": "2.0.0RC4",
"satooshi/php-coveralls": "~0.6"
},
"bin": ["bin/uuid"],
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<ruleset name="Rhumsaa\Uuid Standard">
<description>Coding standard rules for Rhumsaa\Uuid</description>
<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<arg name="extensions" value="php"/>
<arg value="p"/>
<rule ref="PSR2"/>
</ruleset>
+1 -2
View File
@@ -66,8 +66,7 @@ class DecodeCommand extends Command
$table->addRows(array(
array('decode:', 'variant:', 'Not an RFC 4122 UUID'),
));
}
else {
} else {
$this->dumpUuid($table, $uuid);
}
+4 -2
View File
@@ -159,9 +159,11 @@ class GenerateCommand extends Command
return $namespace;
}
throw new Exception('Invalid namespace. '
throw new Exception(
'Invalid namespace. '
. 'May be either a UUID in string representation or an identifier '
. 'for internally pre-defined namespace UUIDs (currently known '
. 'are "ns:DNS", "ns:URL", "ns:OID", and "ns:X500").');
. 'are "ns:DNS", "ns:URL", "ns:OID", and "ns:X500").'
);
}
}
+1 -1
View File
@@ -7,4 +7,4 @@ interface NumberConverterInterface
public function fromHex($hex);
public function toHex($integer);
}
}
+5 -4
View File
@@ -22,7 +22,8 @@ class DegradedUuid extends Uuid
*
* @return \DateTime A PHP DateTime representation of the date
* @throws Exception\UnsupportedOperationException If this UUID is not a version 1 UUID
* @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system and Moontoast\Math\BigNumber is not present
* @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system and
* Moontoast\Math\BigNumber is not present
*/
public function getDateTime()
{
@@ -63,9 +64,9 @@ class DegradedUuid extends Uuid
public function getFields()
{
throw new Exception\UnsatisfiedDependencyException(
'Cannot call ' . __METHOD__ . ' on a 32-bit system, since some '
. 'values overflow the system max integer value'
. '; consider calling getFieldsHex instead'
'Cannot call ' . __METHOD__ . ' on a 32-bit system, since some '
. 'values overflow the system max integer value'
. '; consider calling getFieldsHex instead'
);
}
+7 -4
View File
@@ -45,8 +45,12 @@ class FeatureSet
private $timeProvider;
public function __construct($useGuids = false, $force32Bit = false, $forceNoBigNumber = false, $ignoreSystemNode = false)
{
public function __construct(
$useGuids = false,
$force32Bit = false,
$forceNoBigNumber = false,
$ignoreSystemNode = false
) {
$this->disableBigNumber = $forceNoBigNumber;
$this->disable64Bit = $force32Bit;
$this->ignoreSystemNode = $ignoreSystemNode;
@@ -134,8 +138,7 @@ class FeatureSet
{
if ($this->is64BitSystem()) {
return new PhpTimeConverter();
}
elseif ($this->hasBigNumber()) {
} elseif ($this->hasBigNumber()) {
return new BigNumberTimeConverter();
}
+1 -1
View File
@@ -9,5 +9,5 @@ interface RandomGenerator
*
* @return string
*/
function generate($length);
public function generate($length);
}
+2 -1
View File
@@ -319,7 +319,8 @@ class Uuid implements UuidInterface, \JsonSerializable
*
* @return \DateTime A PHP DateTime representation of the date
* @throws Exception\UnsupportedOperationException If this UUID is not a version 1 UUID
* @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system and Moontoast\Math\BigNumber is not present
* @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system and
* Moontoast\Math\BigNumber is not present
*/
public function getDateTime()
{
-1
View File
@@ -108,5 +108,4 @@ interface UuidInterface
* @return string
*/
public function toString();
}