Download the PHP package steevanb/phpstan-rules without Composer

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

steevanb/phpstan-rules

PHPStan rules:

Rule Identifier(s) Purpose
DisallowUnnecessaryNamedArgumentsRule steevanb.unnecessaryNamedArguments A named argument that could be passed positionally is reported
CoverageTargetRule steevanb.singleCoverageTarget, steevanb.mirroredCoverageTarget A test class covers a single class or trait, the one it mirrors
DisallowConstantsInTestsExtension steevanb.disallowConstantsInTests A TestCase uses literal values, not constants of the tested code

Installation

With phpstan/extension-installer, the rules are registered automatically. Otherwise, include extension.neon in your PHPStan configuration:

Configuration

Every parameter is optional:

Rules

DisallowUnnecessaryNamedArgumentsRule

Named arguments are only useful to skip optional parameters. When the named arguments of a call could be passed positionally (they directly follow the positional arguments, in the order of the parameters), they are reported.

Method calls, nullsafe method calls, static calls, function calls, new and attributes are checked. Calls using argument unpacking (...$arguments), first-class callables and calls whose callee can't be resolved are ignored.

CoverageTargetRule

A class declaring several #[CoversClass] / #[CoversTrait] attributes is reported: a test class covers a single class or a single trait.

When testNamespacePrefixes and targetNamespacePrefixes are configured, the covered class must be the one the test class mirrors: with the configuration above, App\Tests\Unit\Foo\BarTest must cover App\Tests\Foo\Bar or App\Foo\Bar. Classes outside of testNamespacePrefixes or without the Test suffix are not checked.

DisallowConstantsInTestsExtension

Inside a PHPUnit\Framework\TestCase subclass, using a class constant of the tested code is reported: a test asserts literal values, so that changing the value of a constant breaks the test.

Enum cases and constants declared in testsDirectories stay allowed.

Development

All the tooling runs inside a single Docker container (ghcr.io/steevanb/phpstan-rules:ci, built from docker/ci/), through the Python wrappers of steevanb/python-devops in bin/. Each wrapper re-runs itself in a docker run of this image, so the host needs only Python 3.10+ and Docker.

steevanb/python-devops is a private repository, declared as a vcs entry in composer.json. Composer needs a GitHub token (classic, repo scope) in ~/.config/composer/auth.json to install it:

composer.lock is not committed, so bin/ci/start.py mounts this file in the container to install the dependencies.

CI

The GitHub Actions workflow (.github/workflows/ci.yml) runs bin/ci/start.py then bin/ci/validate.py on every push. It needs a GHCR_TOKEN Actions secret, a classic token with the read:packages (pull ghcr.io/steevanb/phpstan-rules:ci) and repo (install steevanb/python-devops) scopes:

https://github.com/steevanb/phpstan-rules/settings/secrets/actions


All versions of phpstan-rules with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
phpstan/phpstan Version ^2.1.13
steevanb/php-collection Version ^6.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 steevanb/phpstan-rules contains the following files

Loading the files please wait ...