openswoole / ide-helper

Open Swoole IDE Helper for VScode etc IDE [READ ONLY]
https://packagist.org/packages/openswoole/ide-helper
50 stars 8 forks source link

Inconsistencies with documentation and with PECL extension #32

Closed kirkmadera closed 4 months ago

kirkmadera commented 4 months ago

The docs frequently state the use of OpenSwoole\Coroutine::run. See https://openswoole.com/docs/modules/swoole-coroutine. Yet, I don't see it as part of this package. Is this an oversight? Are the docs just out of date for v22? The function runs in PHP, but is not part of autocomplete.

Similarly, the docs make use of \OpenSwoole\Process::name (example), which does not exist, but exists in this package.

echo phpversion('openswoole') . "\n";
$process = new \OpenSwoole\Process(function(\OpenSwoole\Process $worker){
    echo "the pid of child process is " . $worker->pid . "\n";
    echo "the file descriptor of pipe is " . $worker->pipe . "\n";

    $res = $worker->write("Hello main process\n");
    var_dump(strlen("Hello main process\n"));
    var_dump($res);

    $worker->name("php child process");
}, FALSE);

$process->start();

usleep(100);

echo $process->read();

Results in:

22.1.2
the pid of child process is 15932
the file descriptor of pipe is 5
Hello main process
int(19)
int(19)

Fatal error: Uncaught Error: Call to undefined method OpenSwoole\Process::name() in /var/www/myapp/src/Sandbox/src/Console/TestCommand.php:63

I have very minimal confidence in using this ide helper. Is there any other reference where we can see what the code is supposed to be? Otherwise, I am just guessing between this library, the documentation, and what actually runs from the installed PECL module.

github-actions[bot] commented 4 months ago

@kirkmadera this repo is read only. Please post your issues or PR at https://github.com/openswoole/openswoole

rela589n commented 3 weeks ago

https://github.com/openswoole/openswoole/issues/89