Skip to content

Conversation

@withinboredom
Copy link
Member

https://wiki.php.net/rfc/typed-aliases

Known issues:

  • including types just includes the file then tosses it away -- could be cached
  • Path must be literal string: include types 'types.php' works, but these don't:
    include types $path; Variable - won't work
    include types __DIR__ . '/types.php'; Expression - won't work
  • Opcache interaction: Need to verify include types works correctly with opcache. The types file itself won't be opcached in the traditional sense.

Todos:

  • Caching mechanism for include types: Store compiled type ASTs to avoid re-parsing
  • Test coverage needed:
  • Namespace scoping (curly brace, multiple unscoped, etc.)
  • Nested include types (types file includes another types file?)
  • Circular include detection
  • Complex DNF types
  • Interaction with class/function/const imports of same name
  • Validate implementation matches RFC scoping: Verify FC(imports_type) is reset at namespace boundaries like other imports
  • What happens with include types inside a function? (Should error?)
  • Self-referential aliases: use type Foo|int as Foo; (Should error)
  • Alias referencing undefined alias

Signed-off-by: Robert Landers <landers.robert@gmail.com>
Signed-off-by: Robert Landers <landers.robert@gmail.com>
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.

1 participant