Skip to content
Open
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
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
rector:
vendor/bin/rector process src

rector-dry:
vendor/bin/rector process src --dry-run
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"require-dev": {
"phpstan/phpstan": "^1.5",
"phpunit/phpunit": "^8.5.23",
"rector/rector": "^0.17.1",
"vimeo/psalm": "^4.0|^5.0"
},
"suggest": {
Expand Down
22 changes: 22 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);

// register a single rule
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);

// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_72
]);
};
2 changes: 1 addition & 1 deletion src/Exception/SnelstartApiErrorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class SnelstartApiErrorException extends \RuntimeException
public static function handleError(array $body): self
{
if (isset($body["modelState"])) {
$errorMessages = [ sprintf("%d validation failures occurred.", \count($body["modelState"])) ];
$errorMessages = [ sprintf("%d validation failures occurred.", is_array($body["modelState"]) || $body["modelState"] instanceof \Countable ? \count($body["modelState"]) : 0) ];

foreach ($body["modelState"] as $field => $modelStateErrors) {
$errorMessages[] = $field . ": ";
Expand Down
6 changes: 2 additions & 4 deletions src/Request/ODataRequestData.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ final class ODataRequestData implements ODataRequestDataInterface
/**
* @var int
*/
private $top;
private $top = Snelstart::MAX_RESULTS;

/**
* @var int
*/
private $skip;
private $skip = 0;

/**
* @var string
Expand All @@ -48,8 +48,6 @@ final class ODataRequestData implements ODataRequestDataInterface

public function __construct()
{
$this->top = Snelstart::MAX_RESULTS;
$this->skip = 0;
}

public function getFilter(): array
Expand Down
2 changes: 1 addition & 1 deletion src/Secure/CachedAccessTokenConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ public function getToken(?BearerTokenInterface $bearerToken = null): AccessToken

protected function getItemKey(): string
{
return self::CACHE_ITEM_PREFIX . \spl_object_hash($this) . mt_rand(0, 99);
return self::CACHE_ITEM_PREFIX . \spl_object_hash($this) . random_int(0, 99);
}
}