You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An extension for PHPStan to allow it to reason about SilverStripe functionality.
10
12
11
13
**Features:**
12
14
13
15
- Support for `DataObject::get()`, ie. it understands you have a DataList of iterable SiteTree records.
14
16
- 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.
15
17
- 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
16
19
17
20
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.
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.
34
29
35
30
## Requirements
36
31
37
-
* SilverStripe 3.1+
32
+
* SilverStripe 4.3+
38
33
39
34
## Documentation
40
35
@@ -45,8 +40,3 @@ version. From 0.12, the 'shim' install is the dfeault.
45
40
## Known Limitations
46
41
47
42
* 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
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
12
12
```
13
13
14
14
3. Visit the [PHPStan Github](https://github.com/phpstan/phpstan) for additional information. Try adjusting the `--level`, lower = less strict, higher = more strict.
0 commit comments