getkirby.com icon indicating copy to clipboard operation
getkirby.com copied to clipboard

Annotate methods that change content files

Open nilshoerrmann opened this issue 5 years ago • 2 comments

Taking the Config class as an example, it would be helpful if the reference noted if a setter will just virtually apply a value during runtime or if it actually writes data to the file system.

This is also interesting for interactions with pages.

nilshoerrmann avatar Jun 05 '19 08:06 nilshoerrmann

Why that specific focus on whether something is written to the filesystem or not?

distantnative avatar Jun 05 '19 08:06 distantnative

Some use cases:

  1. In a plugin I'd like to change a configuration setting on the fly but don't want the changes to be stored in the config or vice versa. It's important to know if I actually manipulate the config file or not.
  2. When using something like $page->clone() it's important to know if I create a duplicate page in memory or in the file system.
  3. When using something like $page->changeTitle() I would like to know if this just changes the title "virtually" in memory (and if I have to run a save() command to actually write the change to disk) or not.

All of this might be unambiguous when you are experienced with the system (and the specific classes and methods) but it's not when you are a beginner as I know from experience of learning things the hard way.

nilshoerrmann avatar Jun 05 '19 09:06 nilshoerrmann