Skip to content

Conversation

walmir-silva
Copy link
Contributor

This commit addresses a series of issues identified by PHPStan, enhancing the overall type safety and robustness of the data structures.

  • BinaryHeap: Corrected type inference by specifying the heap property as a list, which eliminates the need for explicit integer casting when removing elements.
  • TreeMap/TreeMapNode: Fixed a potential null pointer exception in balanceAfterInsertion by adding a safety check for the grandparent node.
  • HashMap: Refactored to use a consistent internal key handling mechanism, resolving type errors and adding proper support for object keys.
  • ArrayList: Fixed a Cannot cast mixed to string error by explicitly handling the resource type.
  • phpstan.neon: Cleaned up the configuration by removing obsolete ignored error patterns.

This commit addresses a series of issues identified by PHPStan, enhancing the overall type safety and robustness of the data structures.

- **BinaryHeap:** Corrected type inference by specifying the heap property as a `list`, which eliminates the need for explicit integer casting when removing elements.
- **TreeMap/TreeMapNode:** Fixed a potential null pointer exception in `balanceAfterInsertion` by adding a safety check for the grandparent node.
- **HashMap:** Refactored to use a consistent internal key handling mechanism, resolving type errors and adding proper support for object keys.
- **ArrayList:** Fixed a `Cannot cast mixed to string` error by explicitly handling the `resource` type.
- **phpstan.neon:** Cleaned up the configuration by removing obsolete ignored error patterns.
@walmir-silva walmir-silva merged commit 1fc9068 into main Jul 31, 2025
2 checks passed
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