Download the PHP package lipemat/phpstan-wordpress without Composer

On this page you can find all versions of the php package lipemat/phpstan-wordpress. 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 phpstan-wordpress

PHPStan for WordPress

package version php version Packagist

Usage

Install via composer

Included Stubs

  1. The semi-official phpstan-wordpress stubs.
  2. Custom stubs
    1. wp.php some additional stubs for WordPress

Optional Stubs

  1. WP-CLI stubs.
  2. WP-CLI Tools Stubs.
  3. CMB2 stubs
  4. Genesis stubs
  5. VIP stubs some stubs for WP VIP environments.

These may be selectively added to your phpstan.neon or phpstan.neon.dist like so:

When using library as a global install

When using library as composer dependency

Alternatively, you may replace %rootDir%/../../ with the relative path to your vendor directory.

Example wp-content/plugins/core/vendor/lipemat/phpstan-wordpress/stubs/cmb2/cmb2-3.10.php

Utility Types

\AtLeast<T, U>

Mark a set of array shape keys as required while making the rest optional.

\Exclude<T, K>

Exclude the specified keys from an array shape.

\Partial<T>

Mark either all or specified keys in an array shape as optional.

\Pick<T, K>

Pick only the specified keys from an array shape.

\Required<T>

Mark either all or specified keys in an array shape as required.

\Sarcastic<T>

Mark a type as an unpredictable random value.

This utility is extremely useful in everyday projects.

\Union<T, U, ...X>

Combine two or more array shapes as if you were using array_merge with the second array overwriting the first.

Optional Included Rules

As we move toward a world where we use composition over inheritance, we need to be more strict about how we write our code. These optional rules do not get us all the way there, but they are a step in the right direction while still being viable for a WordPress project.

Enable in your phpstan.neon or phpstan.neon.dist like so:

  1. Prevent using the compact function.
  2. Require all classes to be either abstract or final.
  3. Require a declare(strict_types=1) statement in every non-empty file.
  4. Prevent using default values in class constructors.
  5. Prevent declaring a method protected in a final class in favor of private.
  6. Prevent using the switch statement in favor of match.
  7. Require any concrete methods in abstract classes to be private or final.
  8. Prevent child classes from skipping parent parameter types.
  9. Prevent calls to methods on unknown classes.
  10. Prefer returning null over false unless boolean is expected.
  11. Prohibit using ArrayAccess to access class data.
  12. Require instance of instead of isset for object verification.

Distributed plugins or themes

Some rules assume you are working on a private project which will not be distributed to the community. If your project will be distributed, you may add the nonDistributed parameter to the lipemat parameter.

The nonDistributed set to false parameter will disable the following rules:

  1. Require all classes to be either abstract or final.
  2. Require a declare(strict_types=1) statement in every non-empty file.
  3. Require any concrete methods in abstract classes to be private or final.

Prevent any inheritance

Adding the noExtends parameter to the lipemat parameter will prevent having or extending any unlisted abstract classes.

You may omit the allowedToBeExtended parameter to prevent extending any abstract classes.


All versions of phpstan-wordpress with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
php-stubs/wp-cli-stubs Version ^2.6.0
phpstan/extension-installer Version ^1.1.0
phpstan/phpstan Version ^1.10.38
szepeviktor/phpstan-wordpress Version ^1.1.2
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 lipemat/phpstan-wordpress contains the following files

Loading the files please wait ....