Commit 997d798
committed
fix(style-code): Resolve static analysis errors and improve type safety
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.1 parent e12252b commit 997d798
File tree
10 files changed
+774
-458
lines changed- src
- Collection
- Heap
- Map
- Set
- Tree
10 files changed
+774
-458
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
152 | 174 | | |
153 | 175 | | |
154 | 176 | | |
| |||
171 | 193 | | |
172 | 194 | | |
173 | 195 | | |
174 | | - | |
| 196 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
0 commit comments