-
-
Notifications
You must be signed in to change notification settings - Fork 93
1.0.0 Migration Guide
Some namespaces where in plural which is indeed a design error since the very first day. Some plural names are still there as they are reserverd keywords by PHP (such as list). However, the following namespaces have been changed:
- doganoo\PHPAlgorithms\Datastructure\Lists{ArrayLists => ArrayList}\ArrayList
- doganoo\PHPAlgorithms\Datastructure\Lists{ArrayLists => ArrayList}\StringBuilder
- doganoo\PHPAlgorithms\Datastructure\Lists{LinkedLists => LinkedList}\DoublyLinkedList
- doganoo\PHPAlgorithms\Datastructure\Lists{LinkedLists => LinkedList}\SinglyLinkedList
- doganoo\PHPAlgorithms\Datastructure{Maps => Map}\HashMap
- doganoo\PHPAlgorithms\Datastructure{Maps => Map}\IntegerVector
- doganoo\PHPAlgorithms\Datastructure{Maps => Map}\Map
- doganoo\PHPAlgorithms\Datastructure{Sets => Set}\HashSet
- doganoo\PHPAlgorithms{Maps => Map}\HashMapTest
- doganoo\PHPAlgorithms{Maps => Map}\NodeTest
- doganoo\PHPAlgorithms{Sets => Set}\HashSetTest
Following namespace left in plural names:
- doganoo\PHPAlgorithms\Datastructure\Lists
- doganoo\PHPAlgorithms\Common\Abstracts
- doganoo\PHPAlgorithms\Common\Interfaces
These namespaces cannot be renamed to singular form, because list, abstract and interfaceare reserved words in PHP
The following classes are removed and replaced by:
- doganoo\PHPAlgorithms\Datastructure\Maps\HashMap -> doganoo\PHPAlgorithms\Datastructure\Table\HashTable
- doganoo\PHPAlgorithms\Common\Interfaces\Comparable -> doganoo\PHPAlgorithms\Common\Interfaces\IComparable
- doganoo\PHPAlgorithms\Datastructure\Maps\IntegerVector -> doganoo\PHPAlgorithms\Datastructure\Vector\IntegerVector
Make sure to replace all deprecated classes when updating.
doganoo\PHPAlgorithms\Datastructure\Table\HashTable has used object serialization for creating unique object hashes in order to use them as the key for the HashTable. Version 1.0.0 changes this to PHP’s core method spl_object_hash(). Make sure you do not have hardcoded hash keys and change them when updating.
All classes (including tests) have now a strict types declaration set to 1. Make sure that you do not use any runtime casts (such as “1” instead of 1 or 0 where false is expected).
If you like our work, please consider a donation 😊