Skip to content

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Aug 22, 2024

No description provided.

@herndlm herndlm changed the base branch from 1.12.x to 1.11.x August 22, 2024 20:44
@herndlm herndlm force-pushed the array-reverse-list branch from a365a7e to 87daf25 Compare August 22, 2024 20:45
Comment on lines +49 to +55
// Remove list
$newArrayType = new ArrayType($type->getIterableKeyType(), $type->getIterableValueType());
if ($type->isIterableAtLeastOnce()->yes()) {
$newArrayType = TypeCombinator::intersect($newArrayType, new NonEmptyArrayType());
}

return $newArrayType;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An almost identical construct exists already somewhere. And I might add it another time somewhere else. I was wondering if it makes sense to re-use this somehow somewhere..

Copy link
Contributor Author

@herndlm herndlm Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the cleaner alternative of course would be a refactor that moves reverse() to Type (arrayReverse()?). The more I think about it, the more I like it 😊

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, moving this to type fixes like at least 3 other edge cases as well....

@herndlm herndlm force-pushed the array-reverse-list branch from 87daf25 to 6f217f1 Compare August 22, 2024 20:58
@herndlm herndlm closed this Aug 23, 2024
@herndlm herndlm deleted the array-reverse-list branch August 23, 2024 09:40
@herndlm
Copy link
Contributor Author

herndlm commented Aug 23, 2024

Superseded by #3344

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant