ideas
ideas copied to clipboard
Add methods to Statamic's various interfaces
Bug description
When executing queries on Statamic content repositories, tools like PHP Intelephense and Larastan report errors like Undefined method ‘where’.
The code above works, but quality checks and autocomplete do not. Is there a reason for this? Is it intentional?
How to reproduce
Some examples from a fresh Statamic installation:
Entry::query()->where('collection', 'pages')->get();
Entry::query()->orderBy('updated_at', 'desc')->limit(10)->get();
User::current()->can('view pages entries');
The where(), orderBy() and can() methods are marked as undefined.
Logs
No response
Environment
Environment
Application Name: Statamic
Laravel Version: 10.48.9
PHP Version: 8.2.18
Composer Version: 2.7.1
Environment: local
Debug Mode: ENABLED
URL: test.test
Maintenance Mode: OFF
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED
Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file
Statamic
Addons: 0
Antlers: runtime
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.57.2 Solo
Installation
Fresh statamic/statamic site via CLI
Antlers Parser
None
Additional details
No response
This will likely be because most of our interfaces are empty or don't include all of the methods, like this one.
We can fix this by adding the methods to the interfaces.
Yea, makes sense. It's not really an issue but a improvement suggestion. Being able to use tools like PHPStan would definitely be very nice.
I've moved this to the statamic/ideas repository since this is more of a feature request/improvement, than a bug.