Skip to content

Commit e8e2c9f

Browse files
committed
Fix rector changes
1 parent d59cf6e commit e8e2c9f

File tree

7 files changed

+7
-21
lines changed

7 files changed

+7
-21
lines changed

rector.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
3737
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
3838
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
39-
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
4039
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
4140
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
4241
use Rector\PHPUnit\Set\PHPUnitSetList;
@@ -152,7 +151,6 @@
152151
__DIR__ . '/system/Security/Security.php',
153152
__DIR__ . '/system/Session/Session.php',
154153
],
155-
MixedTypeRector::class,
156154

157155
ReturnNeverTypeRector::class => [
158156
__DIR__ . '/system/Cache/Handlers/BaseHandler.php',

system/Session/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function start()
248248
if (! isset($_SESSION['__ci_last_regenerate'])) {
249249
$_SESSION['__ci_last_regenerate'] = Time::now()->getTimestamp();
250250
} elseif ($_SESSION['__ci_last_regenerate'] < (Time::now()->getTimestamp() - $regenerateTime)) {
251-
$this->regenerate((bool) $this->config->regenerateDestroy);
251+
$this->regenerate($this->config->regenerateDestroy);
252252
}
253253
}
254254
// Another work-around ... PHP doesn't seem to send the session cookie

tests/system/Debug/ExceptionsTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,10 @@ public function testDeprecationsOnPhp81DoNotThrow(): void
6666
$this->exception = new Exceptions($config);
6767
$this->exception->initialize();
6868

69-
// this is only needed for IDEs not to complain that strlen does not accept explicit null
70-
$maybeNull = PHP_VERSION_ID >= 80100 ? null : 'random string';
71-
7269
try {
73-
// We test DEPRECATED error, so cannot set `declare(strict_types=1)` in this file.
74-
strlen($maybeNull);
75-
$this->assertLogContains('error', '[DEPRECATED] strlen(): ');
76-
} catch (ErrorException $e) {
70+
$result = str_contains('foobar', null); // @phpstan-ignore argument.type (Needed for testing)
71+
$this->assertLogContains('error', '[DEPRECATED] str_contains(): ');
72+
} catch (ErrorException) {
7773
$this->fail('The catch block should not be reached.');
7874
} finally {
7975
restore_error_handler();

utils/phpstan-baseline/function.resultUnused.neon

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

utils/phpstan-baseline/loader.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ includes:
2626
- function.alreadyNarrowedType.neon
2727
- function.inner.neon
2828
- function.notFound.neon
29-
- function.resultUnused.neon
3029
- generator.returnType.neon
3130
- generator.valueType.neon
3231
- greaterOrEqual.invalid.neon

utils/src/Rector/RemoveErrorSuppressInTryCatchStmtsRector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace Utils\Rector;
1515

1616
use PhpParser\Node;
17+
use PhpParser\Node\Expr;
1718
use PhpParser\Node\Expr\ErrorSuppress;
1819
use PhpParser\Node\Stmt\Class_;
1920
use PhpParser\Node\Stmt\Function_;
@@ -60,7 +61,7 @@ public function refactor(Node $node): ?Node
6061

6162
$this->traverseNodesWithCallable(
6263
$node->stmts,
63-
static function (Node $subNode) use (&$hasChanged) {
64+
static function (Node $subNode) use (&$hasChanged): int|Expr|null {
6465
if ($subNode instanceof Class_ || $subNode instanceof Function_) {
6566
return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
6667
}

utils/src/Rector/UnderscoreToCamelCaseVariableNameRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private function updateDocblock(string $variableName, string $camelCaseName, ?Fu
169169
}
170170

171171
$docComment = $functionLike->getDocComment();
172-
if ($docComment === null) {
172+
if (! $docComment instanceof Doc) {
173173
return;
174174
}
175175

0 commit comments

Comments
 (0)