diff --git a/composer.json b/composer.json index ec22aef..e4a6d46 100644 --- a/composer.json +++ b/composer.json @@ -2,6 +2,7 @@ "name": "react-parallel/stubs", "description": "\ud83e\udecf Stubs (for PHPstan)", "license": "MIT", + "type": "phpstan-extension", "authors": [ { "name": "Cees-Jan Kiewiet", @@ -28,6 +29,13 @@ }, "sort-packages": true }, + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, "scripts": { "post-install-cmd": [ "composer normalize" diff --git a/composer.lock b/composer.lock index 124cebc..77c0699 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "56ae7d81123870be93be396f5e50f59e", + "content-hash": "592a214dff3265542af78d7bfb7c02ed", "packages": [], "packages-dev": [ { diff --git a/extension.neon b/extension.neon new file mode 100644 index 0000000..3d7cd60 --- /dev/null +++ b/extension.neon @@ -0,0 +1,6 @@ +parameters: + stubFiles: + - stubs/Channel.stub + - stubs/Event.stub + - stubs/functions.stub + - stubs/Future.stub diff --git a/stubs/Channel.stub b/stubs/Channel.stub index 832375c..184e27a 100644 --- a/stubs/Channel.stub +++ b/stubs/Channel.stub @@ -1,10 +1,10 @@ * * @throws Channel\Error\Existence if channel already exists. */ - public static function make(string $name, int|null $capacity = null): Channel - { - } + public static function make(string $name, ?int $capacity = null): Channel {} /** * Shall open the channel with the given name * + * @param string $name * @return Channel * * @throws Channel\Error\Existence if channel does not exist. */ - public static function open(string $name): Channel - { - } + public static function open(string $name): Channel {} /* Sharing */ /** * Shall send the given value on this channel - * * @param T $value * * @throws Channel\Error\Closed if channel is closed. * @throws Channel\Error\IllegalValue if value is illegal. */ - public function send($value): void - { - } + public function send($value): void {} /** * Shall recv a value from this channel - * * @return T * * @throws Channel\Error\Closed if channel is closed. */ - public function recv() - { - } + public function recv() {} /* Closing */ /** * Shall close this channel - * * @throws Channel\Error\Closed if channel is closed. */ - public function close(): void - { - } + public function close(): void {} /** * Returns name of channel + * @return string */ - public function __toString(): string - { - } + public function __toString(): string {} } diff --git a/stubs/Event.stub b/stubs/Event.stub index 469de0c..364149a 100644 --- a/stubs/Event.stub +++ b/stubs/Event.stub @@ -1,35 +1,35 @@ |Channel */ - public Future|Channel $object; + public $object; /** * Shall be set for Read/Error events - * * @var T */ public $value; diff --git a/stubs/Future.stub b/stubs/Future.stub index 888c31a..b8f96df 100644 --- a/stubs/Future.stub +++ b/stubs/Future.stub @@ -1,12 +1,12 @@