Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions system/src/Grav/Common/Grav.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,38 @@
/**
* Grav container is the heart of Grav.
*
* Core Services:
* @property-read \Grav\Common\User\Interfaces\UserCollectionInterface $accounts
* @property-read \Grav\Common\Assets $assets
* @property-read \Grav\Common\Backup\Backups $backups
* @property-read \Grav\Common\Browser $browser
* @property-read \Grav\Common\Cache $cache
* @property-read \Grav\Common\Config\Config $config
* @property-read \Grav\Common\Config\Languages $languages
* @property-read \Grav\Common\Config\Setup $setup
* @property-read \Grav\Common\Debugger $debugger
* @property-read \Grav\Common\Errors\Errors $errors
* @property-read \Grav\Common\Inflector $inflector
* @property-read \Grav\Common\Language\Language $language
* @property-read \Grav\Common\Page\Pages $pages
* @property-read \Grav\Common\Page\Interfaces\PageInterface $page
* @property-read \Grav\Common\Scheduler\Scheduler $scheduler
* @property-read \Grav\Common\Taxonomy $taxonomy
* @property-read \Grav\Common\Themes $themes
* @property-read \Grav\Common\Twig\Twig $twig
* @property-read \Grav\Common\Uri $uri
* @property-read \Grav\Common\User\User $user
* @property-read \Grav\Framework\Filesystem\Filesystem $filesystem
* @property-read \Grav\Framework\Flex\Flex $flex
* @property-read \Grav\Framework\Session\Messages $messages
* @property-read \Grav\Framework\Session\Session $session
* @property-read \Monolog\Logger $log
* @property-read \RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator $locator
* @property-read \Symfony\Component\EventDispatcher\EventDispatcher $events
*
* Popular Plugin Services:
* @property-read \Grav\Plugin\Admin\Admin $admin
*
* @package Grav\Common
*/
class Grav extends Container
Expand Down
17 changes: 17 additions & 0 deletions system/src/Grav/Framework/DI/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,21 @@ public function has($id): bool
{
return $this->offsetExists($id);
}

/**
* Magic property access — bridges `$container->service` to `$container['service']`.
* Enables IDE autocomplete via `@property-read` annotations on subclasses.
*
* @noinspection MagicMethodsValidityInspection
*/
public function __get(string $id): mixed
{
return $this->get($id);
}

/** @noinspection MagicMethodsValidityInspection */
public function __isset(string $id): bool
{
return $this->has($id);
}
}
Loading