Skip to content
This repository was archived by the owner on Mar 6, 2022. It is now read-only.

Change ExtractMethod return value to TextDocumentEdits - #48

Merged
dantleech merged 8 commits into
phpactor:masterfrom
BladeMF:extract-method-text-edits
May 14, 2021
Merged

dantleech merged 8 commits into
phpactor:masterfrom
BladeMF:extract-method-text-edits

Conversation

@BladeMF

@BladeMF BladeMF commented May 3, 2021

Copy link
Copy Markdown
Contributor

No description provided.

@BladeMF
BladeMF force-pushed the extract-method-text-edits branch from 2067bcf to f219349 Compare May 11, 2021 06:13
}

if ($stmt === false) {
dump($startNode->getStart(), $startNode->getEndPosition(), $offsetStart);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diump

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shoudl this return false?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what should this do, should it return false

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I was trying to see when does this case occur. The point of the validation is to ensure that the start and end offsets are in the same code block:

{
  ...
  <>
  ...
  <>
  ...
}

and there are multiple cases related to that depending on where the selection starts and ends. That case concerns the case "empty block", e.g.:

if {
  <>
}

The the start statement is the block itself. It's a valid statement to be extracted, so it doesn't need to return false.

@dantleech
dantleech merged commit 36803c7 into phpactor:master May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants