Skip to content

Commit 50777d3

Browse files
authored
add: support for silverstripe 5 (#19)
1 parent 8e68751 commit 50777d3

File tree

9 files changed

+11
-158
lines changed

9 files changed

+11
-158
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ This PHPStan module is able to reason about extensions installed specific to you
2121

2222
## Composer Install
2323

24-
SilverStripe 4.X
24+
SilverStripe 5.X
2525
```
2626
composer require --dev syntro/silverstripe-phpstan
2727
```
2828

2929

3030
## Requirements
3131

32-
* SilverStripe 4.3+
32+
* SilverStripe 5.0+
3333

3434
## Documentation
3535

@@ -42,7 +42,7 @@ composer require --dev syntro/silverstripe-phpstan
4242
* PHPStan checks if properties are actually initialized, read and written. This
4343
however does not apply to Silverstripes [configuration properties](https://docs.silverstripe.org/en/4/developer_guides/configuration/configuration/#configuration-properties).
4444
In order to tell PHPStan which of your properties are configuration values, you have
45-
to use the [`@config` docblock](https://docs.silverstripe.org/en/4/developer_guides/configuration/configuration/#configuration-properties).
45+
to use the [`@config` docblock](https://docs.silverstripe.org/en/5/developer_guides/configuration/configuration/#configuration-properties).
4646
* 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)
4747

4848
## Credits

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
}
2323
],
2424
"require": {
25-
"php": "~7.1 || ~8.0",
26-
"silverstripe/framework": "~4.3",
27-
"silverstripe/vendor-plugin": "^1.0",
28-
"phpstan/phpstan": "^1.5"
25+
"php": "~8.0",
26+
"silverstripe/framework": "~5.0",
27+
"phpstan/phpstan": "^1.5",
28+
"silverstripe/versioned": "^2.0@RC",
29+
"silverstripe/cms": "^5.0@RC"
2930
},
3031
"require-dev": {
3132
"squizlabs/php_codesniffer": "^3.0",

phpstan.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ parameters:
1414
excludePaths:
1515
- silverstripe-cache
1616
services:
17-
# This rule will throw an error if you `return false` from a RequestFilter::preRequest() method
18-
# as in SilverStripe 3.X, this throws an uncaught exception in the site.
19-
-
20-
class: Syntro\SilverstripePHPStan\Rule\RequestFilterPreRequestRule
21-
tags:
22-
- phpstan.rules.rule
2317
# This adds additional methods from SilverStripe extensions, as well as determining proper
2418
# types when has_one() magic methods.
2519
-

src/ClassHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ClassHelper
2929

3030
// Controller
3131
const ContentController = \SilverStripe\CMS\Controllers\ContentController::class;
32-
const RequestFilter = \SilverStripe\Control\RequestFilter::class;
32+
const HTTPMiddleware = \SilverStripe\Control\Middleware\HTTPMiddleware::class;
3333

3434
// FormField
3535
const DBField = \SilverStripe\ORM\FieldType\DBField::class;

src/Rule/RequestFilterPreRequestRule.php

Lines changed: 0 additions & 55 deletions
This file was deleted.

tests/Rule/Data/RequestFilterBad.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

tests/Rule/Data/RequestFilterGood.php

Lines changed: 0 additions & 35 deletions
This file was deleted.

tests/Rule/RequestFilterPreRequestRuleTest.php

Lines changed: 0 additions & 31 deletions
This file was deleted.

tests/Type/data/injector-dynamic-method-return-types.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function doFoo()
2727
);
2828
assertType(
2929
MySQLDatabase::class,
30-
Injector::inst()->get("MySQLPDODatabase")
30+
Injector::inst()->get("MySQLDatabase")
3131
);
3232

3333
assertType(
@@ -40,7 +40,7 @@ public function doFoo()
4040
);
4141
assertType(
4242
MySQLDatabase::class,
43-
singleton("MySQLPDODatabase")
43+
singleton("MySQLDatabase")
4444
);
4545
die;
4646
}

0 commit comments

Comments
 (0)