Skip to content

Collections #15429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 48 commits into
base: master
Choose a base branch
from
Draft

Collections #15429

wants to merge 48 commits into from

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