Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/soyhuce/phpstan-extension

Extra rules for phpstan analysis
https://github.com/soyhuce/phpstan-extension

hacktoberfest laravel phpstan

Last synced: 2 months ago
JSON representation

Extra rules for phpstan analysis

Awesome Lists containing this project

README

        

# Extra rules for phpstan analysis

[![Latest Version on Packagist](https://img.shields.io/packagist/v/soyhuce/phpstan-extension.svg?style=flat-square)](https://packagist.org/packages/soyhuce/phpstan-extension)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/soyhuce/phpstan-extension/run-tests?label=tests)](https://github.com/soyhuce/phpstan-extension/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/soyhuce/phpstan-extension/Check%20&%20fix%20styling?label=code%20style)](https://github.com/soyhuce/phpstan-extension/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![GitHub PHPStan Action Status](https://img.shields.io/github/workflow/status/soyhuce/phpstan-extension/PHPStan?label=phpstan)](https://github.com/soyhuce/phpstan-extension/actions?query=workflow%3APHPStan+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/soyhuce/phpstan-extension.svg?style=flat-square)](https://packagist.org/packages/soyhuce/phpstan-extension)

Strict rules for PHPStan and helpers for Laravel

## Installation

You can install the package via composer:

```bash
composer require --dev soyhuce/phpstan-extension
```

If you use `phpstan/extension-installer`, the extension is automatically installed and you're all set.

Otherwise, you need to add the extension in your `phpstan.neon` file:

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

If you want only a subset of the rules, check the `/vendor/soyhuce/phpstan-extension/extension.neon` file and copy the
rules you want to use.

## Rules

### CarbonCopyRule

Forbids usage of `\Carbon\CarbonInterface::copy()` because it is probably linked to usage of a mutable DateTime.

```php
copy()->addDay(); // ko
$datetime->addDay(); // ok
```

### NoAliasUseRule

Forbids usage of Laravel aliases and suggests to use the real class name instead.

```php
date('published_at'); // CarbonImmutable|null
```

## Testing

```bash
composer test
```

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Contributing

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

## Security Vulnerabilities

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

## Credits

- [Bastien Philippe](https://github.com/bastien-phi)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.