Skip to content

Commit b4386c6

Browse files
committed
Bump to phpstan 2.0
1 parent ceb2130 commit b4386c6

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

composer.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"require": {
2525
"php": "^8.1",
2626
"codeigniter4/framework": "^4.4",
27-
"phpstan/phpstan": "^1.10"
27+
"phpstan/phpstan": "^2.0"
2828
},
2929
"require-dev": {
3030
"codeigniter/coding-standard": "^1.7",
@@ -33,11 +33,11 @@
3333
"nexusphp/cs-config": "^3.12",
3434
"php-parallel-lint/php-parallel-lint": "^1.3",
3535
"phpstan/extension-installer": "^1.3",
36-
"phpstan/phpstan-deprecation-rules": "^1.1",
37-
"phpstan/phpstan-phpunit": "^1.3",
38-
"phpstan/phpstan-strict-rules": "^1.5",
36+
"phpstan/phpstan-deprecation-rules": "^2.0",
37+
"phpstan/phpstan-phpunit": "^2.0",
38+
"phpstan/phpstan-strict-rules": "^2.0",
3939
"phpunit/phpunit": "^10.2 || ^11.4",
40-
"rector/rector": "^1.0.0"
40+
"rector/rector": "^2.0"
4141
},
4242
"conflict": {
4343
"codeigniter/framework": "*"

src/Type/FactoriesReturnTypeHelper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ public function check(Type $type, string $function): Type
6363
return $traverse($type);
6464
}
6565

66-
if ($type->isClassStringType()->yes()) {
66+
if ($type->isClassString()->yes()) {
6767
return $type->getClassStringObjectType();
6868
}
6969

7070
foreach ($type->getConstantStrings() as $constantStringType) {
71-
if ($constantStringType->isClassStringType()->yes()) {
71+
if ($constantStringType->isClassString()->yes()) {
7272
return $constantStringType->getClassStringObjectType();
7373
}
7474

src/Type/ModelFindReturnTypeExtension.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,12 @@ private function getTypeFromFindAll(MethodCall $methodCall, Scope $scope): Type
104104
{
105105
$classReflection = $this->getClassReflection($methodCall, $scope);
106106

107-
return AccessoryArrayListType::intersectWith(
107+
return TypeCombinator::intersect(
108108
new ArrayType(
109109
new IntegerType(),
110110
$this->modelFetchedReturnTypeHelper->getFetchedReturnType($classReflection, $methodCall, $scope)
111-
)
111+
),
112+
new AccessoryArrayListType()
112113
);
113114
}
114115
}

tests/Type/data/model-find.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function bar(null|int|string $id): void
3535
{
3636
$model = model(UserModel::class);
3737

38-
assertType('list<CodeIgniter\Shield\Entities\User>|CodeIgniter\Shield\Entities\User|null', $model->find($id));
38+
assertType('CodeIgniter\Shield\Entities\User|list<CodeIgniter\Shield\Entities\User>|null', $model->find($id));
3939
}
4040

4141
function foo(): void

tests/extension-test.neon

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
parameters:
2-
featureToggles:
3-
listType: true
42
bootstrapFiles:
53
- ../bootstrap.php
64
codeigniter:

0 commit comments

Comments
 (0)