Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.x phpstan #210

Merged
merged 13 commits into from
Jul 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
"phpunit": "phpunit --verbose --colors=always",
"phpcs": "phpcs src tests --standard=psr2 -sp --colors",
"phpstan": [
"phpstan analyse -c phpstan.neon src --level 2 --no-progress",
"phpstan analyse -c phpstan-tests.neon tests --level 2 --no-progress"
"phpstan analyse -c phpstan.neon src --level max --no-progress",
"phpstan analyse -c phpstan-tests.neon tests --level 4 --no-progress"
],
"test": [
"@lint",
Expand Down
2 changes: 1 addition & 1 deletion phpstan-tests.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ parameters:
ignoreErrors:
- '#Function uuid_create not found#'
- '#Function uuid_parse not found#'

- '#Constant UUID_TYPE_TIME not found#'
- '#Constant UUID_TYPE_RANDOM not found#'
- '#does not accept PHPUnit_Framework_MockObject_MockObject#'
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ parameters:
- '#Function Sodium\\randombytes_buf not found#'
- '#Constant UUID_TYPE_TIME not found#'
- '#Constant UUID_TYPE_RANDOM not found#'
- '#Moontoast\\Math\\BigNumber::convertFromBase10\(\) expects int\|string, Moontoast\\Math\\BigNumber given.#'
4 changes: 2 additions & 2 deletions src/Generator/DefaultTimeGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function generate($node = null, $clockSeq = null)
// Create a 60-bit time value as a count of 100-nanosecond intervals
// since 00:00:00.00, 15 October 1582
$timeOfDay = $this->timeProvider->currentTime();
$uuidTime = $this->timeConverter->calculateTime($timeOfDay['sec'], $timeOfDay['usec']);
$uuidTime = $this->timeConverter->calculateTime((string) $timeOfDay['sec'], (string) $timeOfDay['usec']);

$timeHi = BinaryUtils::applyVersion($uuidTime['hi'], 1);
$clockSeqHi = BinaryUtils::applyVariant($clockSeq >> 8);
Expand All @@ -109,7 +109,7 @@ public function generate($node = null, $clockSeq = null)
* Uses the node provider given when constructing this instance to get
* the node ID (usually a MAC address)
*
* @param string|int $node A node value that may be used to override the node provider
* @param string|int|null $node A node value that may be used to override the node provider
* @return string Hexadecimal representation of the node ID
*/
protected function getValidNode($node)
Expand Down
8 changes: 4 additions & 4 deletions src/Generator/RandomLibAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ class RandomLibAdapter implements RandomGeneratorInterface
*/
public function __construct(Generator $generator = null)
{
$this->generator = $generator;

if ($this->generator === null) {
if ($generator === null) {
$factory = new Factory();

$this->generator = $factory->getMediumStrengthGenerator();
$generator = $factory->getMediumStrengthGenerator();
}

$this->generator = $generator;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/Node/FallbackNodeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(array $providers)
* Returns the system node ID by iterating over an array of node providers
* and returning the first non-empty value found
*
* @return string System node ID as a hexadecimal string
* @return string|null System node ID as a hexadecimal string
*/
public function getNode()
{
Expand Down
4 changes: 1 addition & 3 deletions tests/Codec/GuidStringCodecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ protected function setUp()
protected function tearDown()
{
parent::tearDown();
$this->builder = null;
$this->fields = null;
$this->uuid = null;
unset($this->builder, $this->fields, $this->uuid);
}

public function testEncodeUsesFieldsArray()
Expand Down
4 changes: 1 addition & 3 deletions tests/Codec/OrderedTimeCodecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ protected function setUp()
protected function tearDown()
{
parent::tearDown();
$this->builder = null;
$this->uuid = null;
$this->fields = null;
unset($this->builder, $this->uuid, $this->fields);
}

public function testEncodeUsesFieldsArray()
Expand Down
4 changes: 1 addition & 3 deletions tests/Codec/StringCodecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ protected function setUp()
protected function tearDown()
{
parent::tearDown();
$this->builder = null;
$this->uuid = null;
$this->fields = null;
unset($this->builder, $this->uuid, $this->fields);
}

public function testEncodeUsesFieldsArray()
Expand Down
4 changes: 1 addition & 3 deletions tests/Generator/DefaultTimeGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ protected function setUp()
protected function tearDown()
{
parent::tearDown();
$this->timeProvider = null;
$this->nodeProvider = null;
$this->timeConverter = null;
unset($this->timeProvider, $this->nodeProvider, $this->timeConverter);
Mockery::close();
AspectMock::clean();
}
Expand Down