foundry
foundry copied to clipboard
Make `Story::get()` static (implies `Story::load()->get()`)
Instead of calling MyStory::load()->get('some-state'), can call MyStory::get('some-state'). This deprecates calling ->get() instance method.
@wouterj, what do you think about this? There is now no longer a way to access story state items without loading the story. Do you think this is a problem?
@wouterj, what do you think about this? There is now no longer a way to access story state items without loading the story. Do you think this is a problem?
I would ask this question the other way (and I'm sure you did already and know the answer, but I'm missing some context): What does this change solve?
Having a $story->get('countries') method with proper PHP declaration (and thus SA and auto completion) seems better than $story->countries() to me personally.
What does this change solve?
This PR is purely a quality of life improvement:
- MyStory::load()->get('countries');
+ MyStory::get('countries');
Having a $story->get('countries') method with proper PHP declaration (and thus SA and auto completion) seems better than $story->countries() to me personally.
This PR doesn't change this ability. The idea is you'd add @method annotations to your story to help with autocompletion.