Skip to content

Commit 8c752e4

Browse files
committed
[BCB] Remove ConstantArrayType::removeLast()
1 parent 42bb08a commit 8c752e4

File tree

2 files changed

+1
-36
lines changed

2 files changed

+1
-36
lines changed

UPGRADING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ Instead of `PHPStanTestCase::createBroker()`, call `PHPStanTestCase::createRefle
252252
* Use `getFirstIterable*Type` and `getLastIterable*Type` instead
253253
* Remove `ConstantArrayType::generalizeToArray()`
254254
* Remove `ConstantArrayType::findTypeAndMethodName()`, use `findTypeAndMethodNames()` instead
255+
* Remove `ConstantArrayType::removeLast()`, use [`Type::popArray()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_popArray) instead
255256
* Made `TypeUtils` thinner by removing methods:
256257
* Remove `TypeUtils::getArrays()` and `getAnyArrays()`, use [`Type::getArrays()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_getArrays) instead
257258
* Remove `TypeUtils::getConstantArrays()` and `getOldConstantArrays()`, use [`Type::getConstantArrays()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_getConstantArrays) instead

src/Type/Constant/ConstantArrayType.php

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -489,36 +489,6 @@ private function getClassOrObjectAndMethods(): array
489489
return [$classOrObject, $method];
490490
}
491491

492-
/** @deprecated Use findTypeAndMethodNames() instead */
493-
public function findTypeAndMethodName(): ?ConstantArrayTypeAndMethod
494-
{
495-
$callableArray = $this->getClassOrObjectAndMethods();
496-
if ($callableArray === []) {
497-
return null;
498-
}
499-
500-
[$classOrObject, $method] = $callableArray;
501-
if (!$method instanceof ConstantStringType) {
502-
return ConstantArrayTypeAndMethod::createUnknown();
503-
}
504-
505-
$type = $classOrObject->getObjectTypeOrClassStringObjectType();
506-
if (!$type->isObject()->yes()) {
507-
return ConstantArrayTypeAndMethod::createUnknown();
508-
}
509-
510-
$has = $type->hasMethod($method->getValue());
511-
if (!$has->no()) {
512-
if ($this->isOptionalKey(0) || $this->isOptionalKey(1)) {
513-
$has = $has->and(TrinaryLogic::createMaybe());
514-
}
515-
516-
return ConstantArrayTypeAndMethod::createConcrete($type, $method->getValue(), $has);
517-
}
518-
519-
return null;
520-
}
521-
522492
/** @return ConstantArrayTypeAndMethod[] */
523493
public function findTypeAndMethodNames(): array
524494
{
@@ -1010,12 +980,6 @@ public function isList(): TrinaryLogic
1010980
return $this->isList;
1011981
}
1012982

1013-
/** @deprecated Use popArray() instead */
1014-
public function removeLast(): self
1015-
{
1016-
return $this->removeLastElements(1);
1017-
}
1018-
1019983
/** @param positive-int $length */
1020984
private function removeLastElements(int $length): self
1021985
{

0 commit comments

Comments
 (0)