Download the PHP package symplify/phpstan-rules without Composer

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

PHPStan Rules

Downloads

Set of rules for PHPStan used by Symplify projects


Install

Note: Make sure you use phpstan/extension-installer to load necessary service configs.


1. Add Prepared Sets

Sets are bunch of rules grouped by a common area, e.g. improve naming. You can pick from 5 sets:

Add sets one by one, fix what you find useful and ignore the rest.


Do you write custom Rector rules? Add rules for them too:


2. Cherry-pick Configurable Rules

There is one set with pre-configured configurable rules. Include it and see what is errors are found:


Would you like to tailor it to fit your taste? Pick one PHPStan rule and configure it manually ↓


3. Register Particular Rules


30 Rules Overview

AnnotateRegexClassConstWithRegexLinkRule

Add regex101.com link to that shows the regex in practise, so it will be easier to maintain in case of bug/extension in the future

:x:


:+1:


CheckClassNamespaceFollowPsr4Rule

Class like namespace "%s" does not follow PSR-4 configuration in composer.json

:x:


:+1:


CheckRequiredInterfaceInContractNamespaceRule

Interface must be located in "Contract" or "Contracts" namespace

:x:


:+1:


ClassNameRespectsParentSuffixRule

Class should have suffix "%s" to respect parent type

:wrench: configure it!

:x:


:+1:


ExplicitClassPrefixSuffixRule

Interface have suffix of "Interface", trait have "Trait" suffix exclusively

:x:


:+1:


ForbiddenArrayMethodCallRule

Array method calls [$this, "method"] are not allowed. Use explicit method instead to help PhpStorm, PHPStan and Rector understand your code

:x:


:+1:


ForbiddenExtendOfNonAbstractClassRule

Only abstract classes can be extended

:x:


:+1:


ForbiddenFuncCallRule

Function "%s()" cannot be used/left in the code

:wrench: configure it!

:x:


:+1:


:x:


:+1:


ForbiddenMultipleClassLikeInOneFileRule

Multiple class/interface/trait is not allowed in single file

:x:


:+1:


ForbiddenNodeRule

"%s" is forbidden to use

:wrench: configure it!

:x:


:+1:


ForbiddenStaticClassConstFetchRule

Avoid static access of constants, as they can change value. Use interface and contract method instead

:x:


:+1:


NoDynamicNameRule

Use explicit names over dynamic ones

:x:


:+1:


NoEntityOutsideEntityNamespaceRule

Class with #[Entity] attribute must be located in "Entity" namespace to be loaded by Doctrine

:x:


:+1:


NoGlobalConstRule

Global constants are forbidden. Use enum-like class list instead

:x:


:+1:


NoInlineStringRegexRule

Use local named constant instead of inline string for regex to explain meaning by constant name

:x:


:+1:


NoReferenceRule

Use explicit return value over magic &reference

:x:


:+1:


NoReturnArrayVariableListRule

Use value object over return of values

:x:


:+1:


NoReturnSetterMethodRule

Setter method cannot return anything, only set value

:x:


:+1:


NoSingleInterfaceImplementerRule

Interface "%s" has only single implementer. Consider using the class directly as there is no point in using the interface.

:x:


:+1:


NoTestMocksRule

Mocking "%s" class is forbidden. Use direct/anonymous class instead for better static analysis

:x:


:+1:


PreferredClassRule

Instead of "%s" class/interface use "%s"

:wrench: configure it!

:x:


:+1:


PreventParentMethodVisibilityOverrideRule

Change "%s()" method visibility to "%s" to respect parent method visibility.

:x:


:+1:


RegexSuffixInRegexConstantRule

Name your constant with "_REGEX" suffix, instead of "%s"

:x:


:+1:


RequireAttributeNameRule

Attribute must have all names explicitly defined

:x:


:+1:


RequireAttributeNamespaceRule

Attribute must be located in "Attribute" namespace

:x:


:+1:


RequireExceptionNamespaceRule

Exception must be located in "Exception" namespace

:x:


:+1:


RequireInvokableControllerRule

Use invokable controller with __invoke() method instead of named action method

:x:


:+1:


RequireUniqueEnumConstantRule

Enum constants "%s" are duplicated. Make them unique instead

:x:


:+1:


SeeAnnotationToTestRule

Class "%s" is missing @see annotation with test case class reference

:wrench: configure it!

:x:


:+1:


UppercaseConstantRule

Constant "%s" must be uppercase

:x:


:+1:



Happy coding!


All versions of phpstan-rules with dependencies

PHP Build Version
Package Version
Requires webmozart/assert Version ^1.11
phpstan/phpstan Version ^2.0
nette/utils Version ^3.2|^4.0
php Version ^7.4|^8.0
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 symplify/phpstan-rules contains the following files

Loading the files please wait ....