Skip to content

[develop regressio] Generate accessor in same file fails #694

Closed

Description

@dantleech

Re-opened as the same happens when generating an accessor from a property, possibly other places where we now depend on the SourceCode path.

--

[2019-01-01 18:54:56] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\Variable [] []                                   
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Phpactor\Extension\Rpc\Response\UpdateFileSourceResponse::fromPathOldAndNewSource() must be of the type string, null given, called in /home/daniel/www/phpactor/phpactor/lib/Extension/CodeTransformExtra/Rpc/GenerateAccessorHandler.php on line 56 and defined in /home/daniel/www/phpactor/phpactor/vendor/phpactor/rpc-extension/lib/Response/UpdateFileSourceResponse.php:40
Stack trace:
#0 /home/daniel/www/phpactor/phpactor/lib/Extension/CodeTransformExtra/Rpc/GenerateAccessorHandler.php(56): Phpactor\Extension\Rpc\Response\UpdateFileSourceResponse::fromPathOldAndNewSource(NULL, '<?php\n\nnamespac...', '<?php\n\nnamespac...')                          
#1 /home/daniel/www/phpactor/phpactor/vendor/phpactor/rpc-extension/lib/RequestHandler/RequestHandler.php(33): Phpactor\Extension\CodeTransformExtra\Rpc\GenerateAccessorHandler->handle(Array)
#2 /home/daniel/www/phpactor/phpactor/vendor/phpactor/rpc-extension/lib/RequestHandler/ExceptionCatchingHandler.php(25): Phpactor\Extension\Rpc\RequestHandler\Reque in /home/daniel/www/phpactor/phpactor/vendor/phpactor/rpc-extension/lib/Response/UpdateFileSourceResponse.php on line 40

Can be temporarily fixed by reverting to the given PATH in the generate access handler when the source path is null, but would be better to ensure that the path was set.

Activity

  1. dantleech commented on Jan 8, 2019

    @dantleech
    CollaboratorAuthor

    Reopening as the same happens with generate accessor.

  2. changed the title [-][develop regression?] Generate method in same file fails[/-] [+][develop regressio] Generate accessor in same file fails[/+] on Jan 8, 2019
  3. dantleech commented on Jan 13, 2019

    @dantleech
    CollaboratorAuthor

    Also error if the method already exists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions