mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-14 15:56:48 +03:00
Fixing PSR2 standards violations reported by PHP_CodeSniffer
This commit is contained in:
@@ -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"],
|
||||
|
||||
@@ -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>
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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").'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,4 @@ interface NumberConverterInterface
|
||||
public function fromHex($hex);
|
||||
|
||||
public function toHex($integer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,5 +9,5 @@ interface RandomGenerator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function generate($length);
|
||||
public function generate($length);
|
||||
}
|
||||
|
||||
+2
-1
@@ -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()
|
||||
{
|
||||
|
||||
@@ -108,5 +108,4 @@ interface UuidInterface
|
||||
* @return string
|
||||
*/
|
||||
public function toString();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user