Download the PHP package techno-artisan/phpstan-strict-rules without Composer

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

techno-artisan/phpstan-strict-rules

Latest Version on Packagist Total Downloads PHP Version PHPStan CI

Uncompromising, purely-syntactic PHPStan rules — because loose semantics hide bugs.

A small set of additional, deliberately strict rules for PHPStan. Every line below passes vanilla PHPStan at level: max — and is reported here:

Why this package?

Relationship to phpstan/phpstan-strict-rules

phpstan/phpstan-strict-rules is broader and excellent — if you don't already use it, you probably should. Three of the four rules here overlap with rules it enables by default:

Construct phpstan-strict-rules this package
empty() bans all (DisallowedEmptyRule) bans all
== / != / <> bans all (DisallowedLooseComparisonRule) bans all
in_array / array_search / array_keys w/o $strict type-aware, plus base64_decode (StrictFunctionCallsRule) purely syntactic — requires the literal true
Untyped class constants — (no equivalent) TypedClassConstantRule

What this package adds on top:

The empty() and == rules are included so this package stands on its own. If you run both packages, those two report the same lines twice — disable them on one side:

(or ignore the technoArtisan.* identifiers from this package instead).

Installation

Usage

If you use phpstan/extension-installer, the rules are registered automatically — nothing else to do.

Otherwise, include the rule set manually in your phpstan.neon:

Rules

Rule Reports Identifier
TypedClassConstantRule Class constants declared without a native type technoArtisan.typedClassConstant
DisallowEmptyConstructRule The empty() language construct technoArtisan.disallowedEmpty
DisallowLooseInArrayRule in_array() / array_search() / array_keys() without $strict technoArtisan.looseInArray
DisallowLooseComparisonRule The ==, != and <> operators technoArtisan.looseComparison

Typed class constants — TypedClassConstantRule

A class constant without a native type leaves its type implicit. Declare it.

Identifier: technoArtisan.typedClassConstant

Loose empty() — DisallowEmptyConstructRule

empty() treats 0, 0.0, "0", "", [], null and false alike, so it silently swallows values you may care about. Use an explicit strict check.

Identifier: technoArtisan.disallowedEmpty

Loose array search — DisallowLooseInArrayRule

in_array(), array_search() and array_keys() compare loosely unless you pass true as the $strict argument, so they coerce types and hide bugs.

Identifier: technoArtisan.looseInArray

Loose comparison — DisallowLooseComparisonRule

==, != and <> coerce their operands' types and hide bugs. Use === / !==.

Identifier: technoArtisan.looseComparison

Ignoring a rule

Every error carries a stable identifier (shown above), so you can suppress a single occurrence with an ignore comment:

…or ignore it project-wide via ignoreErrors in phpstan.neon or a generated baseline. Because the rules are uncompromising by design, prefer fixing the code over ignoring it.

Requirements

Quality

This package is strict with itself. Every release is gated in CI:

These same gates run locally — see Development.

Development

License

MIT — see LICENSE.


All versions of phpstan-strict-rules with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
phpstan/phpstan Version ^2.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 techno-artisan/phpstan-strict-rules contains the following files

Loading the files please wait ...