Skip to content

Conversation

@jordikroon
Copy link

Since resource is a special variable, it should also be listed as a reserved class.
This is an improvement to the earlier additions of array and closure #16665

The "resource" type keyword should be treated as a reserved class name to prevent it from being used as a class name, consistent with other built-in type keywords like "mixed", "object", and "iterable".
Add regression test to verify that class_alias() rejects 'resource' as
a class alias name since it is a reserved keyword in PHP.
@ndossche
Copy link
Member

resource is not a type, nor a special variable

@iluuu1994
Copy link
Member

Right. resource is intentionally missing from this list, and adding it would be an unnecessary BC break, given resources are planned to be fully replaced by objects at some point. I would suggest closing this, or otherwise opening a discussion on the internals mailing list. https://www.php.net/mailing-lists.php

@jordikroon jordikroon closed this Dec 25, 2025
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