You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TestCase
PHP Notice: Uninitialized string offset: 1 in /home/user/tmp/vim-test-envs/dist/coc+phpactor+user+pack/pack/bundle/start/phpactor/vendor/phpactor/class-to-file/lib/Adapter/Simple/ClassScanner.php on line 62
PHP Notice: Uninitialized string offset: 1 in /home/user/tmp/vim-test-envs/dist/coc+phpactor+user+pack/pack/bundle/start/phpactor/vendor/phpactor/class-to-file/lib/Adapter/Simple/ClassScanner.php on line 62
usePHPUnitGoodPractices\Traits\ProphecyOverMockObjectTrait;
usePHPUnitGoodPractices\Traits\ProphesizeOnlyInterfaceTrait;
if (trait_exists(ProphesizeOnlyInterfaceTrait::class)) {
Two tokens after ProphesizeOnlyInterfaceTrait::class there is no class name.
I do not know whether it has cause any bug in RPC communication (displaying context menu). Is possible that notices from PHP can pollute the response? They are displayed in stderr.
The example in a README file of that project has several typos.
Error detected while processing function phpactor#ContextMenu[1]..phpactor#rpc:
line 13:
E605: Exception not caught: Could not parse response from Phpactor: Vim(let):E474: Unidentified byte: PHP Notice: Uninitialized string offset: 1 in /home/tmp/vim-test-
envs/dist/min2/pack/bundle/start/phpactor/vendor/phpactor/class-to-file/lib/Adapter/Simple/ClassScanner.php on line 62^@PHP Notice: Uninitialized string offset: 1 in /home/tmp/vim-test-envs/dist/min2/pack/bundle/start/phpactor/vendor/phpactor/class-to-file/lib/Adapter/Simple/ClassScanner.php on line 62^@{"version":"1.0.0","action":"input_callback","parameters":{"inputs":[{"name":"action","type":"choice","parameters":{"default":null,"label":"Method \"setUp\":","choices":{"cycle_visibility":"cycle_visibility","find_references":"find_references","generate_method":"generate_method","goto_definition":"goto_definition","replace_references":"replace_references","hover":"hover"},"keyMap":{"cycle_visibility":"v","find_references":"f","generate_method":"m","goto_definition":"g","replace_references":"r","hover":null}}}],"callback":{"action":"co
when I tried to open the context menu on pack/bundle/start/phpactor/vendor/phpactor/worse-reflection/tests/Unit/Core/SourceCodeLocator/ChainSourceLocatorTest.php inside setUp().
I did not inspect this vim code yet but at the first look it seems that we can use jobstart (job_start) which can handle stdin and stderr separately instead of obsolete system.
Yes I started a similar topic to add Async support to the VIM plugin (have since decided it's better to get this working on the LS at least initially):
I think I am running into the same issue with Pimcore, but not absolutely sure what causes it... I get either this error:
Phpactor returned an error: PHP Fatal error: Uncaught TypeError: Phpactor\ClassFileConverter\Domain\ClassName::fromString(): Argument #1 ($string) must be of type string, null given, called in /Users/danielrotter/.local/share/nvim/plugged/p
hpactor/vendor/phpactor/class-to-file/lib/Adapter/Simple/SimpleClassToFile.php on line 46 and defined in /Users/danielrotter/.local/share/nvim/plugged/phpactor/vendor/phpactor/class-to-file/lib/Domain/ClassName.php:22
Or the same as above, just with a different line (guess it changed since the creation of that issue):
Phpactor returned an error: PHP Warning: Uninitialized string offset 1 in /Users/danielrotter/.local/share/nvim/plugged/phpactor/vendor/phpactor/class-to-file/lib/Adapter/Simple/ClassScanner.php on line 59
It's certainly possible that PHP pollutes the response:
@dantleech What exactly do you mean by that? Are you talking about PHP Warnings etc.?
one thing to note is that it's using the "simple" class-to-file converter, which basically brute forces your files to determine where classes are kept - it's not performant. It uses this if there is no composer.json in the directory Phpactor is running in, which is often the directory in which you initially opened VIM.
you might also want to look into using the Language Server for most Phpactor features, including completion as that will use an indexer and bypass all this messy business.
I've updated to fix the issue referenced by @danrot and currently cannot reproduce the original issue with the given example, so closing this ticket now. Please reopen if it's still an issue :)
Activity
przepompownia commentedon Mar 15, 2020
Error from vim:
when I tried to open the context menu on
pack/bundle/start/phpactor/vendor/phpactor/worse-reflection/tests/Unit/Core/SourceCodeLocator/ChainSourceLocatorTest.phpinsidesetUp().dantleech commentedon Mar 15, 2020
It's certainly possible that PHP pollutes the response:
The vimscript is:
So if we can find a solution for both vim+neovim there that would be good.
But otherwise it would be better to convert all errors/warnings/notices to exceptions so that they are handled.
przepompownia commentedon Mar 15, 2020
Conversion to exceptions seems to be good idea.
I did not inspect this vim code yet but at the first look it seems that we can use
jobstart(job_start) which can handle stdin and stderr separately instead of obsoletesystem.dantleech commentedon Mar 16, 2020
Yes I started a similar topic to add Async support to the VIM plugin (have since decided it's better to get this working on the LS at least initially):
https://github.com/phpactor/phpactor/pull/890/files#diff-a977b9cdd05b02c5ec29fbc68a7b6adfR17
The annoying thing is the API may be different in VIM
danrot commentedon Oct 6, 2022
I think I am running into the same issue with Pimcore, but not absolutely sure what causes it... I get either this error:
Or the same as above, just with a different line (guess it changed since the creation of that issue):
@dantleech What exactly do you mean by that? Are you talking about PHP Warnings etc.?
dantleech commentedon Oct 6, 2022
yes, that error was more about VIM parsing the RPC JSON response but getting a warning instead.
The error you hav looks much more like an issue with f.e. the parser returning NULL where it is not expected. Can you provide a stack trace?
dantleech commentedon Oct 6, 2022
but almost certainly 2 different sources of an error, possibly due to an incomplete class/trait/enum/interface definiiton?
danrot commentedon Oct 6, 2022
Of course I can!
danrot commentedon Oct 6, 2022
Hard to tell 🙈 The error doesn't say anything and the codebase is quite big (and not mine).
danrot commentedon Oct 6, 2022
Any ideas how I can find out which file causes this?
dantleech commentedon Oct 6, 2022
You could work around/investigate by hacking the code, I can try and have a look tomorrow
danrot commentedon Oct 7, 2022
Okay, would like to do so, but I feel like I know way too less about the internals of vim plugins to be able to do so 🙈
dantleech commentedon Oct 7, 2022
one thing to note is that it's using the "simple" class-to-file converter, which basically brute forces your files to determine where classes are kept - it's not performant. It uses this if there is no composer.json in the directory Phpactor is running in, which is often the directory in which you initially opened VIM.
you might also want to look into using the Language Server for most Phpactor features, including completion as that will use an indexer and bypass all this messy business.
dantleech commentedon Oct 8, 2022
I've updated to fix the issue referenced by @danrot and currently cannot reproduce the original issue with the given example, so closing this ticket now. Please reopen if it's still an issue :)