Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Conversation

KapitanOczywisty
Copy link
Contributor

@KapitanOczywisty KapitanOczywisty commented Aug 14, 2020

This is bigger update since all of these changes are done on the same parts of code and they are dependent on each other, so it's hard to separate them to individual PRs.

Don't be overwhelmed by long change list (I'm a bit pedantic), many points are the result of one fix/change, but code changes are rather straight forward.

Description of the Change

added

  • mixed type (PHP 8.0)
  • static type in method's return (PHP 8.0)
  • added union types (PHP 8.0)
  • meta.function.parameter.variadic.php since this is unique parameter without default value, token could be more useful than removed array variant
  • constructor property promotion (PHP 8.0)

fixed

changed

  • type hints are now single separate rule
  • for consistency, boundary spaces are not a part of the parameter nor the variable token

removed

test spec

  • trailing comma (already supported; PHP 8.0)
    • use namespace
    • function parameters
    • closure parameters, use inheritance
  • basic method (missing tests)
  • union types (with false)
  • mixed type
  • static return type in methods
  • constructor property promotion
  • constructor illegal return type declaration

Alternate Designs

  • We may want to add meta.function.parameter.type.php and meta.function.return.type.php (type/typehint) for whole type hint (union, nullable). Could be useful, but feedback is needed.
  • parent, self, static probably should be changed from storage.type.php to support.class.parent.php or keyword.other.parent.php or something like this.
  • Methods are tokenized as meta.function.php, maybe this should be changed to meta.function.method.php or meta.method.php
  • parameter-default-types can be changed to $self, but more tests are needed.

Possible Drawbacks

This update will break PR #389, but at the same time fixes original problem making mentioned PR not needed anymore.

There may be some coloring changes, but all should be improvements, rather than degradation.

Applicable Issues

PHP 8.0 update log: #395

fix #363 fix #387 fix microsoft/vscode#95029
closes #389
partially #390 (point 2)

@KapitanOczywisty KapitanOczywisty mentioned this pull request Aug 14, 2020
12 tasks
@KapitanOczywisty KapitanOczywisty marked this pull request as ready for review August 15, 2020 16:07
@bakerkretzmar
Copy link

@KapitanOczywisty @Ingramz is there anything I can do to help this PR or #389 get merged soon? Thanks.

@KapitanOczywisty
Copy link
Contributor Author

KapitanOczywisty commented Nov 26, 2020

@bakerkretzmar As I said in #389 it's probably better to go standard way and just fix classes, what I did here.

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