Skip to content

Conversation

@derickr
Copy link
Member

@derickr derickr commented Aug 15, 2024

No description provided.

@brzuchal
Copy link
Contributor

Has there been any other syntax considered other than collection(Dict) Articles<string => Article>?
Could there be an alternative syntax proposed like an evaluation of how baked enums are declared?

collection Articles:dict<string => Article>

Going into potential generics implementation in the future that'd allow template declaration like:

interface Vehicle {}

collection Vehicles<T of Vehicle>:dict<string => T>

class Car implements Vehicle {}
class Truck implements Vehicle {}

$trucks = new Vehicles<Truck>(['VIN' => new Truck()]);
$trucks->set('VIN2', new Car()); // triggers error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants