Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to set or overwrite a method. #152

Closed
kosciuk opened this issue Jan 27, 2024 · 2 comments
Closed

Option to set or overwrite a method. #152

kosciuk opened this issue Jan 27, 2024 · 2 comments

Comments

@kosciuk
Copy link

kosciuk commented Jan 27, 2024

hello, if I try to edit a file, I have no way to keep a method and overwrite others, as there is "setMethods" which does a $methods = [].

I think there may be a setMethod() or overwriteMethod() that allows to add without deleting everything.

// copied from addMethod
public function setMethod(Method $method): static
{
	$lower = strtolower($method->getName());
	if (isset($this->methods[$lower])) {
		throw new Nette\InvalidStateException("Cannot add method '$name', because it already exists.");
	}
	if (!$this->isInterface()) {
		$method->setPublic();
	}

	return $this->methods[$lower] = $method;
}

This problem arose when doing a diff between the methods of a class.

I think it is important to have automatically generated files that can be edited by the programmer and the generator without losing data.

@kosciuk
Copy link
Author

kosciuk commented Jan 27, 2024

update.php.txt
the problem is in line 47, when I delete a method to insert it again with the changes.

@dg dg closed this as completed in 8674ce8 Feb 8, 2024
@kosciuk
Copy link
Author

kosciuk commented Feb 9, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant