versatile-collections
versatile-collections copied to clipboard
A collections package for various use cases (supports strict typing)
Edit psalm.xml and set **errorLevel="1"** and run psalm repeatedly until all the level 1 errors are fixed.
* Improve type hints by using **Union Types** or **mixed** where appropriate in the code base. * Run **./vendor/bin/psalm --show-info=true** to get suggestions for where more type-hints are needed *...
Sweep through the package and look into type hinting on the **iterable** pseudo-type instead of **array**, this would allow users of this package to be able to use arrays or...
* Create a Versatile Collections Macros Repo / Package containing various callables and static methods which can be added to collection instances via one of addMethod, addMethodForAllInstances or addStaticMethod *...
In a PHP 7.2+ version, go through all methods and remove type checking code (e.g. is_int checks) and replace with appropriately type-hinted params. Also add return types to the interface.
Make sure exception messages use late static binding or get_class() to deduce the collection class name so that when custom collection classes throw exceptions, the messaging makes sense for these...
For consistency sake, wherever possible always have a **me** or **my** version of each method where possible: like **makeAllKeysNumeric** and **makeAllMyKeysNumeric**. Some already exist like **mergeWith** and **mergeMeWith**. - The...
Look into re-writing this package as a php extension (for optimal run-time performance), using Zephir (https://zephir-lang.com/en), once this package's API is stabilized. This extension should target the PHP 7.2+ future...
For now filterAll can accomplish the same task with the right callback. See laravel collection's: where whereStrict whereIn whereInStrict whereInstanceOf whereNotIn whereNotInStrict
See https://laravel.com/docs/5.6/collections#method-reject The same thing can currently be accomplished in versatile collection by using filterAll with a callback containing the opposite of the rejection logic, i.e. the acceptance logic.