PHPackages                             prestashop/phpstan-prestashop - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. prestashop/phpstan-prestashop

ActivePhpstan-extension[Testing &amp; Quality](/categories/testing)

prestashop/phpstan-prestashop
=============================

PrestaShop extension for PHPStan

2.0.0(4y ago)61.9M↓12.8%2[5 issues](https://github.com/PrestaShop/phpstan-prestashop/issues)MITPHPPHP ^7.2|^8.0

Since Jan 7Pushed 4y ago9 watchersCompare

[ Source](https://github.com/PrestaShop/phpstan-prestashop)[ Packagist](https://packagist.org/packages/prestashop/phpstan-prestashop)[ RSS](/packages/prestashop-phpstan-prestashop/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (4)Dependencies (6)Versions (5)Used By (0)

PrestaShop PHPStan extension
============================

[](#prestashop-phpstan-extension)

[![PHP tests](https://github.com/prestashop/phpstan-prestashop/workflows/PHP%20tests/badge.svg)](https://github.com/prestashop/phpstan-prestashop/workflows/PHP%20tests/badge.svg)[![Static Analysis](https://github.com/PrestaShop/phpstan-prestashop/workflows/Static%20Analysis/badge.svg)](https://github.com/PrestaShop/phpstan-prestashop/workflows/Static%20Analysis/badge.svg)[![GitHub release](https://camo.githubusercontent.com/be58e4cc2981a14e78129f41036b7b8e60dbf38adfd03a620b0b6e65ebe63146/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f70726573746173686f702f7068707374616e2d70726573746173686f70)](https://github.com/PrestaShop/phpstan-prestashop)[![GitHub license](https://camo.githubusercontent.com/293e40ca3c8c7b2118ed5e0a8149f24005715c528d8dce825cb81adde4682f31/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f50726573746153686f702f7068707374616e2d70726573746173686f70)](https://github.com/PrestaShop/phpstan-prestashop/LICENSE.md)

- [PHPStan](https://phpstan.org/)
- [PrestaShop](https://github.com/prestashop/prestashop)

Content
-------

[](#content)

This PHPStan extension adds custom rules to PHPStan:

- ClassConstantsMustHaveVisibilityRule
- UseStrictTypesForNewClassesRule
- UseTypeHintForNewMethodsRule
- UseTypedReturnForNewMethodsRule

Installation
------------

[](#installation)

Install the dependencies with [Composer](https://getcomposer.org/):

```
composer install
```

Tests
-----

[](#tests)

Install the dev dependencies with [Composer](https://getcomposer.org/):

```
composer install --dev
```

Run tests using PHPUnit:

```
vendor/bin/phpunit -c tests/phpunit.xml tests
```

Rules are tested using PHPStan [RuleTestCase](https://github.com/phpstan/phpstan-src/blob/master/src/Testing/RuleTestCase.php).

Run static analysis with PHPStan:

```
vendor/bin/phpstan analyse src tests/Rules -l 5
```

Extension is validated using a real PHPStan phar

```
bash tests/Acceptance/run.sh
```

Use in a project
----------------

[](#use-in-a-project)

To use this extension, first require it in [Composer](https://getcomposer.org/):

```
composer require --dev prestashop/phpstan-prestashop
```

Then you need to include extension.neon in your project's PHPStan config:

```
includes:
    - vendor/prestashop/phpstan-prestashop/extension.neon
```

### Required settings

[](#required-settings)

#### UseStrictTypesForNewClassesRule

[](#usestricttypesfornewclassesrule)

Rule `UseStrictTypesForNewClassesRule` requires loading of a configuration asset.

You need to provide a service that is an instance of `PHPStanForPrestaShop\PHPConfigurationLoader\ConfigurationLoaderInterface`, named `@strictTypesForNewClassesRuleConfigurationFileLoader`. It should load an array of classes for which the `UseStrictTypesForNewClassesRule` should not be applied.

There is two available implementations: `PHPStanForPrestaShop\PHPConfigurationLoader\ArrayConfigurationLoader`and `PHPStanForPrestaShop\PHPConfigurationLoader\PHPConfigurationFileLoader`.

Example with `PHPConfigurationFileLoader`:

```
services:
    strictTypesForNewClassesRuleConfigurationFileLoader:
        class: PHPStanForPrestaShop\PHPConfigurationLoader\PHPConfigurationFileLoader
        arguments:
            - .github/workflows/phpstan/exclude-class-list.php
```

#### UseTypedReturnForNewMethodsRule

[](#usetypedreturnfornewmethodsrule)

Rule `UseTypedReturnForNewMethodsRule` requires loading of a configuration asset.

You need to provide a service that is an instance of `PHPStanForPrestaShop\PHPConfigurationLoader\ConfigurationLoaderInterface`, named `@returnTypesForNewMethodsRuleConfigurationFileLoader`. It should load an array of class methods for which the `UseTypedReturnForNewMethodsRule` should not be applied.

There is two available implementations: `PHPStanForPrestaShop\PHPConfigurationLoader\ArrayConfigurationLoader`and `PHPStanForPrestaShop\PHPConfigurationLoader\PHPConfigurationFileLoader`.

Example with `PHPConfigurationFileLoader`:

```
services:
    returnTypesForNewMethodsRuleConfigurationFileLoader:
        class: PHPStanForPrestaShop\PHPConfigurationLoader\PHPConfigurationFileLoader
        arguments:
            - .github/workflows/phpstan/exclude-return-functions-list.php
```

#### UseTypeHintForNewMethodsRule

[](#usetypehintfornewmethodsrule)

Similarly to `UseTypedReturnForNewMethodsRule`, rule `UseTypeHintForNewMethodsRule` requires loading of an instance of `PHPStanForPrestaShop\PHPConfigurationLoader\ConfigurationLoaderInterface`, named `@typeHintsForNewMethodsRuleConfigurationFileLoader`. It should load an array of class methods for which the `UseTypeHintForNewMethodsRule` should not be applied.

There is two available implementations: `PHPStanForPrestaShop\PHPConfigurationLoader\ArrayConfigurationLoader`and `PHPStanForPrestaShop\PHPConfigurationLoader\PHPConfigurationFileLoader`.

Example with `PHPConfigurationFileLoader`:

```
services:
    typeHintsForNewMethodsRuleConfigurationFileLoader:
        class: PHPStanForPrestaShop\PHPConfigurationLoader\PHPConfigurationFileLoader
        arguments:
            - .github/workflows/phpstan/exclude-typehint-functions-list.php
```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance3

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 81.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~106 days

Total

4

Last Release

1684d ago

Major Versions

1.1.1 → 2.0.02021-11-23

PHP version history (2 changes)1.0.0PHP ^7.1

2.0.0PHP ^7.2|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15106407?v=4)[Jarvis](/maintainers/ps-jarvis)[@ps-jarvis](https://github.com/ps-jarvis)

---

Top Contributors

[![matks](https://avatars.githubusercontent.com/u/3830050?v=4)](https://github.com/matks "matks (58 commits)")[![PierreRambaud](https://avatars.githubusercontent.com/u/1462701?v=4)](https://github.com/PierreRambaud "PierreRambaud (11 commits)")[![atomiix](https://avatars.githubusercontent.com/u/2168836?v=4)](https://github.com/atomiix "atomiix (1 commits)")[![kpodemski](https://avatars.githubusercontent.com/u/2137763?v=4)](https://github.com/kpodemski "kpodemski (1 commits)")

---

Tags

hacktoberfestphpstanprestashop

###  Code Quality

TestsPHPUnit

Type Coverage Yes

### Embed Badge

![Health badge](/badges/prestashop-phpstan-prestashop/health.svg)

```
[![Health](https://phpackages.com/badges/prestashop-phpstan-prestashop/health.svg)](https://phpackages.com/packages/prestashop-phpstan-prestashop)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.5k55.4M8.4k](/packages/larastan-larastan)[phpstan/phpstan-symfony

Symfony Framework extensions and rules for PHPStan

79475.7M2.2k](/packages/phpstan-phpstan-symfony)[phpstan/phpstan-doctrine

Doctrine extensions for PHPStan

67272.8M1.4k](/packages/phpstan-phpstan-doctrine)[shipmonk/dead-code-detector

Dead code detector to find unused PHP code via PHPStan extension. Can automatically remove dead PHP code. Supports libraries like Symfony, Doctrine, PHPUnit etc. Detects dead cycles. Can detect dead code that is tested.

4853.5M91](/packages/shipmonk-dead-code-detector)[spaze/phpstan-disallowed-calls

PHPStan rules to detect disallowed method &amp; function calls, constant, namespace, attribute, property &amp; superglobal usages, with powerful rules to re-allow a call or a usage in places where it should be allowed.

33422.6M551](/packages/spaze-phpstan-disallowed-calls)[tomasvotruba/cognitive-complexity

PHPStan rules to measure cognitive complexity of your classes and methods

1635.6M288](/packages/tomasvotruba-cognitive-complexity)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
