Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Support nullable types #85

Open
Ocramius opened this issue Jul 24, 2016 · 6 comments
Open

Support nullable types #85

Ocramius opened this issue Jul 24, 2016 · 6 comments

Comments

@Ocramius
Copy link
Member

As per PHP 7.1, it is possible to define nullability of a type by adding a ? in front of it ( https://wiki.php.net/rfc/nullable_types ).

A few heads-up:

  • careful about ?Foo $bar = null vs ?Foo $bar vs Foo $bar = null
  • need to eventually patch the TypeGenerator to include the ? in it (not sure yet)
@djmattyg007
Copy link
Contributor

Surely resolving the fact that Zend\Code\Scanner\MethodScanner doesn't properly handle scalar type declarations should come before supporting nullable types? #56 still hasn't received any acknowledgement.

@Ocramius
Copy link
Member Author

@djmattyg007 I reported the issue completely independently from other issues.

@djmattyg007
Copy link
Contributor

My point was that PHP 7.0 compatibility should be targeted before PHP 7.1 compatibility.

@Ocramius
Copy link
Member Author

Ah yes, that is because the codegen part of this component is already 7.0 compatible. I hardly ever use the scanner, as it is not AST-based (which makes it very unstable)

@djmattyg007
Copy link
Contributor

If no one is maintaining the scanning code, shouldn't it be removed?

perajovic added a commit to perajovic/framework-bundle that referenced this issue Nov 12, 2016
This method signature should be compatible with 7.1 nullable types `?string $firstname, ?string $lastname`.

ATM (12.11.2016.) there are bugs in two projects:
1. zendframework/zend-code#85
2. Ocramius/ProxyManager#327

These are blockers for 7.1 syntax.
@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-code; a new issue has been opened at laminas/laminas-code#19.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants