Skip to content

Commit 0f7be4e

Browse files
author
Matthias Leutenegger
committed
change: update readme & docs
1 parent d2b9ae2 commit 0f7be4e

File tree

3 files changed

+16
-27
lines changed

3 files changed

+16
-27
lines changed

README.md

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,35 @@
11
# PHPStan for Silverstripe
22

3-
[![Build Status](https://travis-ci.org/symbiote/silverstripe-phpstan.svg?branch=master)](https://travis-ci.org/symbiote/silverstripe-phpstan)
4-
[![Latest Stable Version](https://poser.pugx.org/symbiote/silverstripe-phpstan/version.svg)](https://github.com/symbiote/silverstripe-phpstan/releases)
5-
[![Latest Unstable Version](https://poser.pugx.org/symbiote/silverstripe-phpstan/v/unstable.svg)](https://packagist.org/packages/symbiote/silverstripe-phpstan)
6-
[![Total Downloads](https://poser.pugx.org/symbiote/silverstripe-phpstan/downloads.svg)](https://packagist.org/packages/symbiote/silverstripe-phpstan)
7-
[![License](https://poser.pugx.org/symbiote/silverstripe-phpstan/license.svg)](https://github.com/symbiote/silverstripe-phpstan/blob/master/LICENSE.md)
3+
A module allowing PHPStan to work with Silverstripe
4+
5+
[![🎭 Tests](https://github.com/syntro-opensource/silverstripe-phpstan/workflows/%F0%9F%8E%AD%20Tests/badge.svg)](https://github.com/syntro-opensource/silverstripe-phpstan/actions?query=workflow%3A%22%F0%9F%8E%AD+Tests%22+branch%3A%22master%22)
6+
[![codecov](https://codecov.io/gh/syntro-opensource/silverstripe-phpstan/branch/master/graph/badge.svg)](https://codecov.io/gh/syntro-opensource/silverstripe-phpstan)
7+
![Dependabot](https://img.shields.io/badge/dependabot-active-brightgreen?logo=dependabot)
8+
[![phpstan](https://img.shields.io/badge/PHPStan-enabled-success)](https://github.com/phpstan/phpstan)
9+
[![composer](https://img.shields.io/packagist/dt/syntro/silverstripe-phpstan?color=success&logo=composer)](https://packagist.org/packages/syntro/silverstripe-phpstan)
10+
[![Packagist Version](https://img.shields.io/packagist/v/syntro/silverstripe-phpstan?label=stable&logo=composer)](https://packagist.org/packages/syntro/silverstripe-phpstan)
811

9-
An extension for PHPStan to allow it to reason about SilverStripe functionality.
1012

1113
**Features:**
1214

1315
- Support for `DataObject::get()`, ie. it understands you have a DataList of iterable SiteTree records.
1416
- Support for DataObject `db`, `has_one`, `has_many` and `many_many` magic properties and methods, ie. it knows SiteTree::Title is a string, that SiteTree::ParentID is an integer and that SiteTree::Parent() is a SiteTree record.
1517
- Support for `singleton('SiteTree')` and `Injector::inst()->get('SiteTree')`, ie. it knows these will return "SiteTree". If you override these with the injector, it'll also know what class you're actually using.
18+
- Support for config properties
1619

1720
This PHPStan module is able to reason about extensions installed specific to your project as it bootstraps the SilverStripe config system. So if you've added an extension to your `Page` object that adds an additional `db` field, PHPStan will be able to reason about it.
1821

1922
## Composer Install
2023

21-
SilverStripe 3.X
22-
```
23-
composer require --dev symbiote/silverstripe-phpstan:1.0.0 phpstan/phpstan-shim:0.9.2
24-
```
25-
2624
SilverStripe 4.X
2725
```
28-
composer require --dev symbiote/silverstripe-phpstan
26+
composer require --dev syntro/silverstripe-phpstan
2927
```
3028

31-
NOTE: Versions of PHPStan less than 0.12, we recommend installing the phpstan-shim as currently in SilverStripe 3.X,
32-
the QueuedJobs module's dependence on superclosure forces the PHP-Parser dependency of PHPStan to be at a very outdated
33-
version. From 0.12, the 'shim' install is the dfeault.
3429

3530
## Requirements
3631

37-
* SilverStripe 3.1+
32+
* SilverStripe 4.3+
3833

3934
## Documentation
4035

@@ -45,8 +40,3 @@ version. From 0.12, the 'shim' install is the dfeault.
4540
## Known Limitations
4641

4742
* The type of the `owner` property can't be reasoned about for extensions. You must use `getOwner()`. Related Issues: [#1043](https://github.com/phpstan/phpstan/issues/1043) and [#1044](https://github.com/phpstan/phpstan/issues/1044)
48-
49-
## Credits
50-
51-
* [Ondřej Mirtes](https://github.com/ondrejmirtes) for his amazing work on the PHPStan library
52-
* [Grant Lucas](https://github.com/symbiote/silverstripe-phpstan/pull/8) for his contribution to this library by upgrading it to PHPStan 0.9

docs/en/advanced-usage.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ parameters:
77
ignoreErrors:
88
# Most QueuedJobs don't call the parent::__construct() method
99
- '#does not call parent constructor from AbstractQueuedJob#'
10-
10+
1111
# SS_List is basically ArrayList and DataList. Consider filter/sort/etc supported.
1212
- '#Call to an undefined method SS_List::#'
1313
includes:
@@ -26,12 +26,12 @@ NOTE: The '.' in the above command means it'll output the files in the current d
2626

2727
3) Execute the following from the project directory to run tests:
2828
```
29-
vendor/bin/phpunit -c vendor/symbiote/silverstripe-phpstan/tests/phpunit.xml vendor/symbiote/silverstripe-phpstan/tests/
29+
vendor/bin/phpunit -c vendor/syntro/silverstripe-phpstan/tests/phpunit.xml vendor/symbiote/silverstripe-phpstan/tests/
3030
```
3131

3232
# Debugging
3333

3434
By adding --debug to the list of parameters, you can make PHPStan crash when it hits an error.
3535
This is incredibly useful for PRs or helping raise issues.
3636

37-
`./vendor/bin/phpstan.phar.bat analyse ptv-mpw/src -c "phpstan.neon" -a "vendor/symbiote/silverstripe-phpstan/bootstrap.php" --level 2 --debug`
37+
`./vendor/bin/phpstan.phar.bat analyse ptv-mpw/src -c "phpstan.neon" -a "vendor/symbiote/silverstripe-phpstan/bootstrap.php" --level 2 --debug`

docs/en/quick-start.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
1. Create "phpstan.neon" in project directory. For more configuration options, see [Advanced Usage](/docs/en/advanced-usage.md).
44
```
55
includes:
6-
- vendor/symbiote/silverstripe-phpstan/phpstan.neon
6+
- vendor/syntro/silverstripe-phpstan/phpstan.neon
77
```
88

99
2. Execute from project dir:
1010
```
11-
vendor/bin/phpstan analyse mysite/code -c phpstan.neon -a vendor/symbiote/silverstripe-phpstan/bootstrap.php --level 2
11+
vendor/bin/phpstan analyse app/src -c phpstan.neon -a vendor/symbiote/silverstripe-phpstan/bootstrap.php --level 4
1212
```
1313

1414
3. Visit the [PHPStan Github](https://github.com/phpstan/phpstan) for additional information. Try adjusting the `--level`, lower = less strict, higher = more strict.
15-

0 commit comments

Comments
 (0)