Download the PHP package php-static-analysis/rector-rule without Composer

On this page you can find all versions of the php package php-static-analysis/rector-rule. 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 rector-rule

PHP Static Analysis RectorPHP Rule

Continuous Integration Latest Stable Version License Total Downloads

Since the release of PHP 8.0 more and more libraries, frameworks and tools have been updated to use attributes instead of annotations in PHPDocs.

However, static analysis tools like PHPStan have not made this transition to attributes and they still rely on annotations in PHPDocs for a lot of their functionality.

This is a set of RectorPHP rules that allows us to convert standard PHP static analysis annotations into a new set of attributes that replace these annotations. These attributes are defined in this repository

Example

In order to show how code would look with these attributes, we can look at the following example. This is how a class looks like with the current annotations:

And this is how it would look like using the new attributes:

Installation

First of all, to make the attributes available for your codebase use:

To use these rules, install this package:

Using the rules

To replace all the annotations that this package covers, use the set provided by it:

(We recommend that you add the withImportNames() option so that attributes are not added with their fully qualified name)

If you only want to replace some annotations and leave the others as they are, use the rule configured with the annotations that you need. For example, if you only want to replace the @return and @param annotations, use this configuration:

If you want to replace most annotations but exclude a few, you can use the excludeAnnotations config parameter like this:

That would convert all annotations except @throws and @deprecated

These are the available attributes and their corresponding PHPDoc annotations:

Attribute PHPDoc Annotations
Assert @assert
AssertIfFalse @assert-if-false
AssertIfTrue @assert-if-true
DefineType @type
Deprecated @deprecated
Immmutable @immmutable
ImportType @import-type
Impure @impure
Internal @internal
IsReadOnly @readonly
Method @method
Mixin @mixin
Param @param
ParamOut @param-out
Property @property @var
PropertyRead @property-read
PropertyWrite @property-write
Pure @pure
RequireExtends @require-extends
RequireImplements @require-implements
Returns @return
SelfOut @self-out @this-out
Template @template
TemplateContravariant @template-contravariant
TemplateCovariant @template-covariant
TemplateExtends @extends @template-extends
TemplateImplements @implements @template-implements
TemplateUse @use @template-use
Throws @throws
Type @var @return

Location of Param and ParamOut attributes

By default Param and ParamOut attributes are added on the method/function where the @param or @param-out annotation was located. It is possible to instead add them on the corresponding parameter in the function. To activate this option, add this code to your configuration:

Location of Assert, AssertIfFalse and AssertIfTrue attributes

By default Assert, AssertIfFalse and AssertIfTrue attributes are added on the method/function where the @assert, @assert-if-false or @assert-if-true annotation was located. It is possible to instead add them on the corresponding parameter in the function. To activate this option, add this code to your configuration:

Attribute to use for the return type of methods and functions

By default Returns attributes are added to define the return type of methods/functions. It is possible to use the Type attribute instead. To activate this option, add this code to your configuration:

Attribute to use for the type of class properties

By default Type attributes are added to define the type of class properties. It is possible to use the Property attribute instead. To activate this option, add this code to your configuration:

Attribute to use for the definition of types for classes

By default DefineType attributes are added to define a type for a class. It is possible to use the Type attribute instead. To activate this option, add this code to your configuration:

Sponsor this project

If you would like to support the development of this project, please consider sponsoring me


All versions of rector-rule with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
php-static-analysis/attributes Version ^0.3.1 || dev-main
php-static-analysis/node-visitor Version ^0.3.1 || dev-main
rector/rector Version ^0.19 || ^1.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 php-static-analysis/rector-rule contains the following files

Loading the files please wait ....