Skip to content

Commit

Permalink
Merge pull request #1 from Slickdeals/fix-7.3-build
Browse files Browse the repository at this point in the history
Upgrade psalm and fix errors to fix 7.3 psalm
  • Loading branch information
bfeaver authored Mar 13, 2021
2 parents 75157c1 + 4166d38 commit e44b710
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"require-dev": {
"phpunit/phpunit": "^9",
"flyeralarm/php-code-validator": "^3.2",
"vimeo/psalm": "^3.4"
"vimeo/psalm": "^4.6"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 0 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
<MissingReturnType errorLevel="info" />
<MissingPropertyType errorLevel="info" />
<InvalidDocblock errorLevel="info" />
<MisplacedRequiredParam errorLevel="info" />

<PropertyNotSetInConstructor errorLevel="info" />
<MissingConstructor errorLevel="info" />
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private function send(string $key, $value, string $type, float $sampleRate, arra
*/
public function setNamespace(string $namespace): void
{
$this->namespace = (string) $namespace;
$this->namespace = $namespace;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Connection/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
class File implements Connection
{
/**
* @var null|resource|closed-resource
* @psalm-suppress PossiblyInvalidArgument
* @var null|resource
*/
private $handle;

Expand Down Expand Up @@ -60,6 +61,7 @@ public function sendMessages(array $messages): void
public function close(): void
{
if (is_resource($this->handle)) {
/** @psalm-suppress InvalidPropertyAssignmentValue */
fclose($this->handle);
}

Expand Down
6 changes: 4 additions & 2 deletions src/Connection/InetSocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __construct(
$this->host = $host;
$this->port = $port;
$this->persistent = $persistent;
$this->maxPayloadSize = (int) $mtu -
$this->maxPayloadSize = $mtu -
self::IP_HEADER_SIZE -
$this->getProtocolHeaderSize() -
strlen(self::LINE_DELIMITER);
Expand Down Expand Up @@ -144,7 +144,9 @@ private function cutIntoMtuSizedPackets(array $messages): array
if ($this->allowFragmentation()) {
$message = join(self::LINE_DELIMITER, $messages) . self::LINE_DELIMITER;

return str_split($message, $this->maxPayloadSize);
$result = str_split($message, $this->maxPayloadSize);

return $result ?: [];
}

$delimiterLen = strlen(self::LINE_DELIMITER);
Expand Down

0 comments on commit e44b710

Please sign in to comment.