Skip to content

Commit a888a76

Browse files
authored
Merge pull request #43 from php-school/AydinHassan-patch-1
PHP 8.2
2 parents 03958f5 + 7949f69 commit a888a76

File tree

4 files changed

+33
-32
lines changed

4 files changed

+33
-32
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
php: [8.0, 8.1]
15+
php: [8.0, 8.1, 8.2]
1616

1717
name: PHP ${{ matrix.php }}
1818
steps:

composer.lock

Lines changed: 26 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
parameters:
22
treatPhpDocTypesAsCertain: false
33
ignoreErrors:
4-
- '#Cannot access property \$args on PhpParser\\Node\|null#'
54
- '#Call to an undefined method PhpParser\\Node\\Expr\|PhpParser\\Node\\Name\:\:toString\(\)#'
65
- '#Parameter \#1 \$array of function array_flip expects array<int\|string>, array<int, int\|string>\|int\|string given.#'
76
-

src/Exercise/HaveTheLastSay.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,37 +119,38 @@ public function check(Input $input): ResultInterface
119119
return $result;
120120
}
121121

122+
/** @var FuncCall $funcCall */
122123
$funcCall = (new NodeFinder())->findFirst(
123124
$statements,
124125
fn ($node) => $node instanceof FuncCall && $node->name->toString() === 'fgetcsv'
125126
);
126127

127-
if ($funcCall->args[0]->name !== null) {
128+
if ($funcCall->getArgs()[0]->name !== null) {
128129
return Failure::fromNameAndReason(
129130
$this->getName(),
130131
'The stream argument must be specified using a positional parameter'
131132
);
132133
}
133134

134-
if (count($funcCall->args) > 2) {
135+
if (count($funcCall->getArgs()) > 2) {
135136
return Failure::fromNameAndReason(
136137
$this->getName(),
137138
'You should only specify the stream and separator arguments, no others'
138139
);
139140
}
140141

141-
if (!isset($funcCall->args[1])) {
142+
if (!isset($funcCall->getArgs()[1])) {
142143
return Failure::fromNameAndReason($this->getName(), 'The separator argument has not been specified');
143144
}
144145

145-
if (!$funcCall->args[1]->name) {
146+
if (!$funcCall->getArgs()[1]->name) {
146147
return Failure::fromNameAndReason(
147148
$this->getName(),
148149
'The second positional argument should not be specified'
149150
);
150151
}
151152

152-
if ($funcCall->args[1]->name->name !== 'separator') {
153+
if ($funcCall->getArgs()[1]->name->name !== 'separator') {
153154
return Failure::fromNameAndReason(
154155
$this->getName(),
155156
'A named argument has been used, but not for the separator argument'

0 commit comments

Comments
 (0)