PHPackages                             icanhazstring/phpstan-readonly-property - 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. icanhazstring/phpstan-readonly-property

AbandonedArchivedLibrary[Testing &amp; Quality](/categories/testing)

icanhazstring/phpstan-readonly-property
=======================================

Support #\[IsReadonly\] promoted constructor properties for PHPStan

0.2.0(4y ago)414.9k↓33.3%MITPHPPHP ^8.0

Since Jul 14Pushed 4y ago1 watchersCompare

[ Source](https://github.com/icanhazstring/phpstan-readonly-property)[ Packagist](https://packagist.org/packages/icanhazstring/phpstan-readonly-property)[ RSS](/packages/icanhazstring-phpstan-readonly-property/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (8)Used By (0)

icanhazstring/phpstan-readonly-property
=======================================

[](#icanhazstringphpstan-readonly-property)

Support `#[IsReadonly]` class properties for PHPStan. This library is used to have a transition from PHP 8.0 to 8.1 until `readonly`keyword will be introduced.

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

[](#installation)

```
composer require --dev icanhazstring/phpstan-readonly-property
```

Then use PHPStan Extension Installer using

```
composer require --dev phpstan/extension-installer
```

or manually add `vendor/icanhazstring/phpstan-readonly-property/rules.neon` into your `phpstan.neon` configuration.

```
# phpstan.neon

includes:
    - vendor/icanhazstring/phpstan-readonly-property/rules.neon
```

Usage
-----

[](#usage)

Add `#[IsReadonly]` to the property you want to have readonly only.

```
