Download the PHP package webgriffe/psalm-plugin-magento2 without Composer

On this page you can find all versions of the php package webgriffe/psalm-plugin-magento2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package psalm-plugin-magento2

psalm-plugin-magento2

Stops Psalm's UnusedClass / UnusedMethod / PossiblyUnusedMethod checks from false-positiving on Magento 2 classes that the framework only ever instantiates reflectively — by class name in routes.xml, layout XML, crontab.xml or di.xml — never via a direct new X() or a type-hint Psalm's static analysis can trace back to a caller.

With Psalm's findUnusedCode on by default (Psalm ≥5), a class like this:

gets flagged UnusedClass: Class ... is never used even though Magento's front controller invokes it on every request to its route — Psalm just has no way to see routes.xml wiring a URL to this class name.

What it covers

Matched by contract, wherever Magento provides one (interface or common base class) — works regardless of which module or folder the class lives in:

Category Matched by
Controllers extends/implements Magento\Framework\App\ActionInterface, Action, AbstractAction, or \Magento\Customer\Controller\AbstractAccount
Blocks extends Magento\Framework\View\Element\AbstractBlock or Template
Observers implements Magento\Framework\Event\ObserverInterface
Setup patches implements DataPatchInterface / SchemaPatchInterface
Console commands extends Symfony\Component\Console\Command\Command

Cron jobs and Plugins (interceptors) have no common Magento interface/base class — crontab.xml/di.xml reference a bare class name + method by convention only. Those two fall back to a namespace segment check (FQCN contains \Cron\ or \Plugin\) — the one convention-based (not contract-based) rule here.

Known limitation

Only directly declared extends/parent class and directly implemented interfaces are inspected, not multi-level-inherited ones. A project-specific AbstractController implements ActionInterface, with real controllers extending that instead of a Magento class directly, won't be picked up. Open an issue/PR if this bites you.

Install

Then wire it into psalm.xml:

Why not just findUnusedCode="false"?

That silences dead-code detection for the entire codebase — including genuinely dead Helper/Model/Service/Repository classes, which is exactly the kind of thing Psalm's unused-code detection is useful for. This plugin only exempts the specific categories Magento wires outside PHP's own reference graph, so the rest of the codebase keeps real dead-code detection.

Compatibility note for phar-based Psalm distributions

Some Psalm distributions (e.g. tools that bundle Psalm as a single phar with its dependencies scoped under a private namespace prefix, to avoid colliding with the host project's own Composer dependencies) rewrite nikic/php-parser's classes under a prefix like PsalmPhar\PhpParser\.... An instanceof \PhpParser\Node\Stmt\Class_ check silently never matches in that case, even though the visited node's shape is identical. This plugin matches on the resolved Psalm\Storage\ClassLikeStorage data (parent_class, class_implements) and a class-name suffix check instead, which works under both plain Composer-installed Psalm and phar-scoped distributions.

License

MIT


All versions of psalm-plugin-magento2 with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package webgriffe/psalm-plugin-magento2 contains the following files

Loading the files please wait ...