|
| 1 | +Upgrading from 1.x to 2.0 |
| 2 | +========================= |
| 3 | + |
| 4 | +## BC breaking changes |
| 5 | + |
| 6 | +Native parameter and return types were added. |
| 7 | +As a consequence, some signatures were changed and will have to be adjusted in sub-classes. |
| 8 | + |
| 9 | +Note that in order to keep compatibility with both 1.x and 2.x versions, extending code would have to omit the added parameter types and add the return types. This would only work in PHP 7.2+ which is the first version featuring [parameter widening](https://wiki.php.net/rfc/parameter-no-type-variance). |
| 10 | + |
| 11 | +You can find a list of major changes to public API below. |
| 12 | + |
| 13 | +#### Doctrine\Common\Collections\Collection |
| 14 | + |
| 15 | +| before | after | |
| 16 | +|-------------------------------:|:-----------------------------------------------| |
| 17 | +| add($element) | add($element): bool | |
| 18 | +| clear() | clear(): void | |
| 19 | +| contains($element) | contains($element): bool | |
| 20 | +| isEmpty() | isEmpty(): bool | |
| 21 | +| removeElement($element) | removeElement($element): bool | |
| 22 | +| containsKey($key) | containsKey($key): bool | |
| 23 | +| getKeys() | getKeys(): array | |
| 24 | +| getValues() | getValues(): array | |
| 25 | +| set($key, $value) | set($key, $value): void | |
| 26 | +| toArray() | toArray(): array | |
| 27 | +| exists(Closure $p) | exists(Closure $p): bool | |
| 28 | +| filter(Closure $p) | filter(Closure $p): self | |
| 29 | +| forAll(Closure $p) | forAll(Closure $p): bool | |
| 30 | +| map(Closure $func) | map(Closure $func): self | |
| 31 | +| partition(Closure $p) | partition(Closure $p): array | |
| 32 | +| slice($offset, $length = null) | slice(int $offset, ?int $length = null): array | |
| 33 | +| count() | count(): int | |
| 34 | +| getIterator() | getIterator(): \Traversable | |
| 35 | +| offsetSet($offset, $value) | offsetSet($offset, $value): void | |
| 36 | +| offsetUnset($offset) | offsetUnset($offset): void | |
| 37 | +| offsetExists($offset) | offsetExists($offset): bool | |
| 38 | + |
| 39 | +#### Doctrine\Common\Collections\AbstractLazyCollection |
| 40 | + |
| 41 | +| before | after | |
| 42 | +|----------------:|:----------------------| |
| 43 | +| isInitialized() | isInitialized(): bool | |
| 44 | +| initialize() | initialize(): void | |
| 45 | +| doInitialize() | doInitialize(): void | |
| 46 | + |
| 47 | +#### Doctrine\Common\Collections\ArrayCollection |
| 48 | + |
| 49 | +| before | after | |
| 50 | +|----------------------------:|:----------------------------------| |
| 51 | +| createFrom(array $elements) | createFrom(array $elements): self | |
| 52 | +| __toString() | __toString(): string | |
| 53 | + |
| 54 | +#### Doctrine\Common\Collections\Selectable |
| 55 | + |
| 56 | +| before | after | |
| 57 | +|-----------------------------:|:-----------------------------------------| |
| 58 | +| matching(Criteria $criteria) | matching(Criteria $criteria): Collection | |
0 commit comments