Skip to content

Phoxite 0.12.0

Choose a tag to compare

@github-actions github-actions released this 22 Nov 23:04
· 15 commits to main since this release
  • Joomla. In a Joomla site (libraries/src/Version.php) or an extension opened on
    its own (a manifest at its top), the manifests, the language files, access.xml,
    config.xml, the forms, joomla.asset.json and the SQL scripts are read, once and
    again only when one changes. Joomla 6 is the target; 4 and 5 share its layout.
    • The names PHP strings write are references, each with completion, Go to
      Definition, hover and Find References: language constants (Text::_('COM_X_Y')),
      layouts (LayoutHelper::render('joomla.content.tags'), a template's override
      first), HTML helpers (HTMLHelper::_('behavior.core')), web assets
      (useScript('com_x.cart')), extensions (bootComponent('com_content')), events
      and the methods handling them (getSubscribedEvents()), ACL actions
      (authorise('core.edit')), forms and their fields (loadForm(),
      $form->getValue('title')), parameters ($params->get('show_title')), tables
      ('#__content'), a view's sub-templates (loadTemplate('links')) and the parts of
      a URL (Route::_('index.php?option=com_content&view=article')).
    • A language constant is renamed in PHP, in the language files and in the XML.
    • Types: Factory::getApplication(), bootComponent('com_x'), what the MVC factory
      and a controller's getModel() make, a view's get('Items'), a container's
      get(Foo::class); $this in a view's template (its protected properties too), in
      a layout and in a site template; a module template's variables; and an event
      handler's parameter, from the event it subscribes to.
    • The XML files, the language files and joomla.asset.json are documents: a label's
      constant, a field's type (its class, by addfieldprefix), a layout, an ACL action
      and an asset have Go to Definition, hover, Find References and completion.
    • Inspections: PhpUndefinedJoomlaLanguage (a constant of the file's own extension
      that no language file has) and PhpUndefinedJoomlaLayout.
    • A class file moved inside an extension gets the namespace its manifest gives the
      folder.
  • Magento 2. In a Magento project (app/etc/di.xml, Composer installing
    magento/framework, or a module opened alone) the modules' XML is read: di.xml,
    events.xml, acl.xml, system.xml, config.xml, extension_attributes.xml and
    the layout files, of the modules under app/code and vendor and of the themes. It
    is read once and again only when an XML file changes.
    • The names PHP strings write are references, each with completion, Go to Definition
      into the XML, hover and Find References (the XML declarations are listed): events
      (dispatch('checkout_cart_add_product_complete')), configuration paths
      (getValue('wishlist/general/active')), ACL resources
      (isAllowed('Magento_Wishlist::config_wishlist'), const ADMIN_RESOURCE),
      templates (setTemplate('Vendor_Module::cart.phtml'), a block's $_template; a
      theme's version first), layout handles (addHandle()), blocks by name or alias
      (getBlock('customer.wishlist'), getChildHtml('items')) and modules
      (isEnabled('Vendor_Module')).
    • The classes Magento generates are known without a generated/ folder:
      FooFactory (create() returns Foo), Foo\Proxy, Foo\Interceptor, and the
      FooExtensionInterface of extension_attributes.xml, with a typed getter and
      setter per attribute. They are no longer reported as undefined classes.
    • Types: $objectManager->get(Foo::class) and create(), a virtual type's name
      among them; a data object's setFoo() returns the object and hasFoo() a bool;
      in a .phtml template $block is the block class the layout XML gives the
      template, with $escaper, $secureRenderer, $this and the block's view model
      ($block->getViewModel(), getData('view_model')).
    • A plugin's beforeSave(), afterSave() and aroundSave() go to the save() they
      intercept.
    • Inspections: PhpUndefinedMagentoTemplate, PhpUndefinedMagentoAcl,
      PhpUndefinedMagentoModule and PhpUndefinedMagentoPluginMethod. Events and
      configuration paths are never reported: both are used without being declared.
    • The XML files are documents too: in di.xml, events.xml, a layout file,
      system.xml, webapi.xml and the others, a class, a method, a virtual type, an
      event, an ACL resource, a template, a block or a handle has Go to Definition, hover
      (a class with its preference for the file's area and its plugins), Find References,
      completion and rename. A class that doesn't exist and a template whose file isn't
      there are reported (MagentoXmlUndefinedClass, MagentoXmlUndefinedTemplate).
    • Find References on a class lists the XML naming it; renaming the class or moving
      its file updates the XML and the GraphQL schemas. Find References on a method lists
      the plugin methods intercepting it, and its hover names them.
    • Renames across PHP and XML: an event, a block's name, an ACL resource, a template
      (its file moves, in the module and in the themes).
    • Three more names: URL paths (getUrl('wishlist/index/add') goes to the action's
      class, by routes.xml), tables and columns of db_schema.xml
      (getTableName('wishlist'), _init('wishlist', 'wishlist_id')).
    • An area's di.xml wins over the global one where the area is known, and a
      template is looked for in a theme before the themes it inherits from.
  • Laminas MVC and Mezzio. In a Laminas or a Mezzio application (Composer installs
    laminas/laminas-mvc or mezzio/mezzio) the configuration is read where it is
    written: each module's module.config.php, config/autoload/, the ConfigProvider
    classes config/config.php aggregates, and Mezzio's config/routes.php. The names its
    strings write are references: routes ($this->url('home'),
    redirect()->toRoute('blog/post'), UrlHelper::generate('api.ping'); a child route is
    parent/child), templates (setTemplate('application/index/list'),
    partial('partial/row'), render('app::home-page'), the keys of template_map),
    services ($container->get('mailer')), controller plugins and view helpers
    (plugin('greet')), actions ('action' => 'show' ↔ showAction() of the controller
    beside it or of its route) and configuration keys
    ($container->get('config')['db']['host']). Each completes, goes to what it names and
    has a hover and Find References.
    • Types: $container->get('mailer') is what the configuration makes: an alias is
      followed, an invokable is its class, a factory is what its __invoke() returns;
      $this->greet() in a controller and $this->price() in a template are the
      configured plugin and helper (what calling them returns), Laminas's own among them;
      $this in a .phtml template is the renderer. Plugins and helpers complete as
      methods.
    • A template has the variables its action gives its view model
      (new ViewModel(['post' => $post]), setVariable()), a Mezzio template what
      render() passes, a partial what partial() passes, with their types.
    • Inspections for a name that names nothing: PhpUndefinedLaminasRoute,
      PhpUndefinedLaminasTemplate, PhpUndefinedLaminasService and
      PhpUndefinedLaminasAction.
    • More of an application is followed: the form element, validator, filter, hydrator
      and input filter plugin managers ('validators' => [['name' => 'StringLength']],
      $form->add(['type' => 'text']), $validators->get('Isbn')), delegators and
      factories written as closures, a Module's getServiceConfig() and its kin, a
      configuration held in a variable ($config['db']['host']), a route's parameters
      (url('post', ['id' => 1])), navigation containers, the layout's variables
      ($this->layout()->setVariable()) and a child view model's, and the variables of
      a Twig template in Mezzio. Zend Framework 2 and 3 and Zend Expressive projects are
      read the same under their old class names.
  • CakePHP 4 and 5. In a CakePHP application (Composer installs cakephp/cakephp, or
    the project has bin/cake) the names its strings write are references: tables
    (fetchTable('Articles'), belongsTo('Authors'), 'className' => 'Blog.Tags' ↔
    ArticlesTable), components (loadComponent('Flash')), helpers (loadHelper('Form'),
    $helpers), behaviours (addBehavior('Timestamp')), associations
    (contain(['Authors', 'Comments.Users'])), templates (render('edit'),
    setTemplate()), layouts (setLayout('admin')), elements (element('sidebar')),
    cells (cell('Inbox::expanded')), configuration keys (Configure::read('App.encoding')
    ↔ config/app.php), named routes ('_name' => 'login') and route arrays
    (['controller' => 'Articles', 'action' => 'view'], 'Articles::view' ↔
    ArticlesController::view(), under the prefix and in the plugin beside them).
    Plugin dot notation everywhere. Each completes, goes to what it names and has a hover
    and Find References.
    • Types: fetchTable('Articles') and $this->Articles in ArticlesController are
      ArticlesTable; its get(), newEmptyEntity(), save() and find()->first() are
      an Article (the entity of the table's name, or what setEntityClass() names),
      find()->toArray() and paginate() hold them; $this->Articles->Authors is the
      association and AuthorsTable; $article->author is an Author or null and
      $article->comments a list; $this->Flash is the component the controller or
      AppController loads; $this->Html in a template is the helper. They complete as
      members and go to where they are loaded. CakePHP 5's own generics are kept where
      they already say the class.
    • A template has the variables its action sets (set('article', $article),
      set(compact('article'))), with their types, and what beforeRender() of
      AppController sets; a cell's template and an element have theirs. $this in a
      template is the application's AppView.
    • Inspections for a name that names nothing: PhpUndefinedCakeTemplate,
      PhpUndefinedCakeLayout, PhpUndefinedCakeElement, PhpUndefinedCakeComponent,
      PhpUndefinedCakeHelper, PhpUndefinedCakeBehavior and PhpUndefinedCakeAction
      (a controller without that method).
    • An entity's fields come from the project's migrations (config/Migrations:
      $this->table('articles')->addColumn('views', 'integer'), renameColumn(),
      removeColumn(), changeColumn(), read in the order of the files, without running
      them): $article->views has the column's type (a datetime is CakePHP's
      DateTime), completes and goes to the migration.
    • Translations are names: __('Saved') and __d('shop', 'Cart') go to the message in
      resources/locales/<language>/default.po (or shop.po), complete, and show their
      translations on hover.
    • Templates are found where the code puts them: in a theme (setTheme('Modern')),
      in a template path (setTemplatePath('Common')) and a layout path. The arrays of
      contain(['Comments' => ['Users']]) are followed. In a CakePHP 3 project, names find
      the .ctp templates of src/Template.
  • A view's variables could come back empty. Two requests asking for the variables of
    the same view at the same moment (a CodeIgniter, a Yii or a CakePHP view) could leave
    one of them with none, until the next edit.
  • Yii 2. In a Yii application (Composer installs yiisoft/yii2, or the project has a
    yii script) the names its strings write are references: views (render('index') of a
    controller, a view or a widget, found as Yii finds them: beside the view,
    views/<controller>, // and / paths, aliases), layouts ($layout), mail views
    (compose('welcome')), routes (Url::to(['post/view']), redirect([...]),
    Html::a($text, [...]), 'url' => [...] ↔ PostController::actionView(), an action
    of the controller asking, a module's), components and modules
    (Yii::$app->get('cache') ↔ the configuration), parameters
    (Yii::$app->params['adminEmail']), path aliases (Yii::getAlias('@app/runtime')),
    message categories and messages (Yii::t('app', 'Hello') ↔ messages/<language>/app.php)
    and a model's attributes (in rules(), attributeLabels(), scenarios(),
    getAttributeLabel(), addError()…). Each completes, goes to what it names and has a
    hover and Find References.
    • Types: Yii::$app->mailer and Yii::$app->get('mailer') are the class the
      configuration gives the component, Yii::$app->user->identity the identityClass;
      Yii::createObject(Foo::class) and Yii::$container->get(Foo::class) are a Foo;
      Post::find()->where(…)->one() is a Post or null and all() a list of them; a
      relation ($post->author, from getAuthor() with hasOne() or hasMany()) is the
      related model or a list; any property read through a getter ($catalog->size ↔
      getSize()) has the getter's type. Components and getters complete as properties.
    • A view has the variables render() passes it, with their types, and they aren't
      reported as undefined; $this in a view is the view object.
    • Inspections for a name that names nothing: PhpUndefinedYiiView,
      PhpUndefinedYiiLayout, PhpUndefinedYiiRoute (a controller without that action),
      PhpUnknownYiiAttribute (a form model without that property).
    • The configuration is read as Yii's templates write it: return $config; with what
      the file adds to $config afterwards, require __DIR__ . '/params.php',
      array_merge(); the basic template's config/web.php and the advanced template's
      common, frontend and backend, each with its own controllers, views and
      parameters.
    • A record's columns come from the project's migrations (createTable(),
      addColumn(), dropColumn(), renameColumn(), alterColumn(), renameTable(),
      read in the order of the files, without running them): $post->title has the
      column's type, completes, goes to the migration, and is an attribute in rules().
      The table is what tableName() returns, else Yii's name for the class.
    • More of the configuration is followed: controllerMap, the actions actions()
      lists (site/captcha goes to its key), the routes of the URL manager's rules
      and of a filter's only, except and actions; parameters below another
      (Yii::$app->params['mail']['from']); a viewPath, a layoutPath, the mailer's
      viewPath and themes; the aliases of the installed extensions and of
      Yii::setAlias() in the entry scripts; gettext catalogues (.po);
      Yii::createObject(['class' => Foo::class]).
  • Symfony: PHP configuration. config/services.php, config/routes.php and the PHP
    files of config/packages are read where they return an array (return [...],
    return App::config([...])): their services, parameters and routes beside the YAML
    files', with '@service' and '%parameter%' in them as usages. PHP translation
    catalogues (translations/messages.en.php) are read beside YAML, XLIFF and JSON.
  • A name in a view after a variable the view is passed is a name:
    $model->where('title', …) in a CodeIgniter view, $form->getAttributeLabel('email')
    in a Yii one.