File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,3 +16,4 @@ parameters:
1616 reportNestedTooWideType : false # tmp
1717 assignToByRefForeachExpr : true
1818 curlSetOptArrayTypes : true
19+ checkDateIntervalConstructor : true
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ conditionalTags:
1010 phpstan.rules.rule : %featureToggles.checkParameterCastableToNumberFunctions%
1111 PHPStan\Rules\Functions\PrintfParameterTypeRule :
1212 phpstan.rules.rule : %featureToggles.checkPrintfParameterTypes%
13+ PHPStan\Rules\DateIntervalInstantiationRule :
14+ phpstan.rules.rule : %featureToggles.checkDateIntervalConstructor%
1315
1416autowiredAttributeServices :
1517 # registers rules with #[RegisteredRule] attribute
@@ -22,3 +24,5 @@ services:
2224 class : PHPStan\Rules\Functions\PrintfParameterTypeRule
2325 arguments :
2426 checkStrictPrintfPlaceholderTypes : %checkStrictPrintfPlaceholderTypes%
27+ -
28+ class : PHPStan\Rules\DateIntervalInstantiationRule
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ parameters:
4343 reportNestedTooWideType : false
4444 assignToByRefForeachExpr : false
4545 curlSetOptArrayTypes : false
46+ checkDateIntervalConstructor : false
4647 fileExtensions :
4748 - php
4849 checkAdvancedIsset : false
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ parametersSchema:
4545 reportNestedTooWideType : bool ()
4646 assignToByRefForeachExpr : bool ()
4747 curlSetOptArrayTypes : bool ()
48+ checkDateIntervalConstructor : bool ()
4849 ])
4950 fileExtensions : listOf (string ())
5051 checkAdvancedIsset : bool ()
Original file line number Diff line number Diff line change 66use PhpParser \Node ;
77use PhpParser \Node \Expr \New_ ;
88use PHPStan \Analyser \Scope ;
9- use PHPStan \DependencyInjection \RegisteredRule ;
109use Throwable ;
1110use function count ;
1211use function sprintf ;
1514/**
1615 * @implements Rule<Node\Expr\New_>
1716 */
18- #[RegisteredRule(level: 5 )]
1917final class DateIntervalInstantiationRule implements Rule
2018{
2119
You can’t perform that action at this time.
0 commit comments