Skip to content

Commit b48a14d

Browse files
authored
Add types to ViewInterface::setParameter() and ViewInterface::addToParameter() parameters (#261)
1 parent e454355 commit b48a14d

6 files changed

Lines changed: 34 additions & 6 deletions

File tree

.github/workflows/static.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
os: >-
3030
['ubuntu-latest']
3131
php: >-
32-
['8.1', '8.2', '8.3']
32+
['8.1', '8.2']
3333
psalm80:
3434
uses: yiisoft/actions/.github/workflows/psalm.yml@master
3535
with:
@@ -38,3 +38,11 @@ jobs:
3838
['ubuntu-latest']
3939
php: >-
4040
['8.0']
41+
psalm83:
42+
uses: yiisoft/actions/.github/workflows/psalm.yml@master
43+
with:
44+
psalm-config: psalm83.xml
45+
os: >-
46+
['ubuntu-latest']
47+
php: >-
48+
['8.3']

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- New #242: Add `View::getLocale()` and `WebView::getLocale()` methods (@Tigrov)
1414
- Enh #250: Make event dispatcher in `View` and `WebView` optional (@vjik)
1515
- Enh #251: Make base path in `View` and `WebView` optional (@vjik)
16+
- Enh #248: Add types to `ViewInterface::setParameter()` and `ViewInterface::addToParameter()` parameters (@vjik)
1617

1718
## 8.0.0 February 16, 2023
1819

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"require-dev": {
4040
"maglnet/composer-require-checker": "^4.2",
4141
"phpunit/phpunit": "^9.5",
42-
"rector/rector": "^1.0",
42+
"rector/rector": "1.0.*",
4343
"roave/infection-static-analysis-plugin": "^1.25",
4444
"spatie/phpunit-watcher": "^1.23",
4545
"vimeo/psalm": "^4.30|^5.20",

psalm83.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="1"
4+
findUnusedBaselineEntry="true"
5+
findUnusedCode="false"
6+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7+
xmlns="https://getpsalm.org/schema/config"
8+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
9+
>
10+
<projectFiles>
11+
<directory name="src" />
12+
<ignoreFiles>
13+
<directory name="vendor" />
14+
</ignoreFiles>
15+
</projectFiles>
16+
<issueHandlers>
17+
<MixedAssignment errorLevel="suppress" />
18+
<RiskyTruthyFalsyComparison errorLevel="suppress" />
19+
<MissingClassConstType errorLevel="suppress" />
20+
</issueHandlers>
21+
</psalm>

rector.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
66
use Rector\Config\RectorConfig;
77
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
8-
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
98
use Rector\Set\ValueObject\LevelSetList;
109

1110
return static function (RectorConfig $rectorConfig): void {
@@ -23,7 +22,6 @@
2322
]);
2423

2524
$rectorConfig->skip([
26-
MixedTypeRector::class,
2725
RemoveExtraParametersRector::class => [__DIR__ . '/src/PhpTemplateRenderer.php'],
2826
]);
2927
};

src/ViewInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function setParameters(array $parameters): static;
156156
* @param string $id The unique identifier of the parameter.
157157
* @param mixed $value The value of the parameter.
158158
*/
159-
public function setParameter(string $id, $value): static;
159+
public function setParameter(string $id, mixed $value): static;
160160

161161
/**
162162
* Add values to end of common array parameter. If specified parameter does not exist or him is not array,
@@ -167,7 +167,7 @@ public function setParameter(string $id, $value): static;
167167
*
168168
* @throws InvalidArgumentException When specified parameter already exists and is not an array.
169169
*/
170-
public function addToParameter(string $id, ...$value): static;
170+
public function addToParameter(string $id, mixed ...$value): static;
171171

172172
/**
173173
* Removes a common parameter.

0 commit comments

Comments
 (0)