Skip to content

Commit

Permalink
code quality improvements
Browse files Browse the repository at this point in the history
Code quality improvements at level 4 of PHPStan (part II)
  • Loading branch information
deminy committed Dec 9, 2023
1 parent 0bad3d0 commit 436d600
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
parameters:
reportUnmatchedIgnoredErrors: false
level: 4
paths:
- ./src
excludePaths:
- src/core/Curl/Handler.php
ignoreErrors:
- '#Call to an undefined static method Swoole\\Coroutine\\Socket::import\(\).#'
- '#Access to an undefined property Swoole\\Coroutine\\Socket::\$__ext_sockets_timeout.#'
- '#Access to an undefined property Swoole\\Coroutine\\Socket::\$__ext_sockets_nonblock.#'
- '#Property Swoole\\Coroutine\\FastCGI\\Client::\$socket \(Swoole\\Coroutine\\Socket\) does not accept null.#'
- '#Access to an undefined property Swoole\\Coroutine\\Http\\ClientProxy::\$errCode.#'
- '#Property Swoole\\Server::\$admin_server \(Swoole\\Coroutine\\Http\\Server\) does not accept null.#'
- '#Return type \(Swoole\\StringObject\) of method Swoole\\ArrayObject::serialize\(\) should be compatible with return type \(string\|null\) of method Serializable::serialize\(\)#'
- '#Property Swoole\\ConnectionPool::\$pool \(Swoole\\Coroutine\\Channel\) does not accept null.#'
- '#Argument of an invalid type Swoole\\Curl\\Handler supplied for foreach, only iterables are supported.#'
4 changes: 2 additions & 2 deletions src/core/ArrayObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -592,10 +592,10 @@ public function usort(callable $value_compare_func): self
protected static function detectType(mixed $value)
{
if (is_string($value)) {
return static::detectStringType($value); // @phpstan-ignore new.static
return static::detectStringType($value);
}
if (is_array($value)) {
return static::detectArrayType($value); // @phpstan-ignore new.static
return static::detectArrayType($value);
}
return $value;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/Coroutine/FastCGI/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function __construct(string $host, int $port = 0, bool $ssl = false)
*/
public function execute(Request $request, float $timeout = -1): Response
{
if (!$this->socket) {
if (!isset($this->socket)) {
$this->socket = $socket = new Socket($this->af, SOCK_STREAM, IPPROTO_IP);
$socket->setProtocol([
'open_ssl' => $this->ssl,
Expand Down

0 comments on commit 436d600

Please sign in to comment.