Skip to content
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

PHP features for NB21 #6819

Merged
merged 39 commits into from
Dec 8, 2023
Merged

PHP features for NB21 #6819

merged 39 commits into from
Dec 8, 2023

Conversation

junichi11
Copy link
Member

@junichi11 junichi11 commented Dec 8, 2023

These already have been reviewed.

junichi11 and others added 30 commits October 20, 2023 11:16
- #4725
- https://wiki.php.net/rfc/dnf_types
- Fix DNF parameter types for the navigator
- The following cases are incorrect syntax for `@method` tag
```
@method int i() i($a = array()) Comment 10
```
- See: https://docs.phpdoc.org/3.0/guide/references/phpdoc/tags/method.html#method
- So, disable `PHPCodeCompletion201870Test` and `PHPCodeCompletion203294Test`
- #4725
- https://wiki.php.net/rfc/dnf_types
- Fix code completion for return, field, `@method`, `@property`, and `@var` DNF types
- Fix the lexer to recognize DNF types of vardoc (`/** @var X|(Y&Z) $var */`)
- Add unit tests
- #4725
- https://wiki.php.net/rfc/dnf_types
- Fix code completion for parameter DNF types
- Add unit tests
- #4725
- https://wiki.php.net/rfc/dnf_types
- Fix documentation of code completion for parameter DNF types
- Add unit tests
- Increment the spec version to 2.27.0
- #4725
- https://wiki.php.net/rfc/dnf_types
- Fix the formatter(Prevent adding `WHITESPACE_BEFORE_METHOD_DEC_PAREN` twice)
```php
// e.g. the following case has "(("
function example((X&Y)|Z $param): void {}
```
- Add a unit test
- #4725
- https://wiki.php.net/rfc/dnf_types
- Fix the code completion, the code generator, and the `ImplementAbstractMethodsHintError` for overriding/implementing methods
- Add unit tests
- #4725
- https://wiki.php.net/rfc/dnf_types
- Fix the mark occurrences and the go to declaration features
- Add unit tests
PHP 8.2 Support: Disjunctive Normal Form Types #4725
PHP 8.2 Support: Disjunctive Normal Form Types #4725
- #4725
- https://wiki.php.net/rfc/constants_in_traits
- Add the `hasConstantsInTraits()` method to `PhpVersion`
- Fix `ConstantRedeclarationHintError` and `IntroduceSuggestion`
- Add unit tests
- Increment spec versions
- PhpDoc may have separators(":")
- e.g. `@param (callable(CacheItemInterface,bool):T)|(callable(ItemInterface,bool):T)|CallbackInterface<T>`
- Fix/Add unit tests
- #3933
- #6634
- Don't add empty type names to avoid getting types from an index using them
…urn_type

PHP: Implemented correct return type guessing for a function that returns an array
- #6706
- We can get "[" as PHP_ENCAPSED_AND_WHITESPACE token e.g. `$x = "[$y example]";`
- So, check also token ids
- Add unit tests
…acket

Handle brackets other than string correctly when "]" is typed #6706
…lescing operator #5380

- #5380
- Add whitespaces after `UNBREAKABLE_SEQUENCE_END` token
- Check whether there is a whitespace token before an indent token
- Add unit tests
Fix the formatting for a method invocation with a ternary or null-coalescing operator #5380
- #6731
- When a multi-line parameter of a function/method invocation has a string with a variable(e.g. `"example {$example}"`), ignore the variable within the string(i.e. {$example}) to avoid adding extra indentations

Example:
```php
$x = test(
    "test {$test}"
);// enter key here
```

Before:
```php
$x = test(
    "test {$test}"
);
    // one indentation is added
```

After:
```php
$x = test(
    "test {$test}"
);
// no indentation
```
…decl

PHP: Improve the performance for Go to Declaration
- #6701
- https://wiki.php.net/rfc/dynamic_class_constant_fetch
- Fix the grammar file (parser)
- Add the `PHP83UnhandledError`
- Add/Fix unit tests for the parser

Example:
```php
class Example {
    const CONSTANT = 'constant';
}
$constant = 'CONSTANT';
echo Example::{$constant};
```
- #6701
- https://wiki.php.net/rfc/dynamic_class_constant_fetch
- Fix the `SemanticAnalysis`
- Fix the mark occurrences and the go to declaration features
- Add unit tests
- #6701
- https://wiki.php.net/rfc/dynamic_class_constant_fetch
- Fix the formatter
  - Add the option of the around spaces for the scope resolution operator (`::`)
  - Don't add spaces within braces (`{}`) e.g. {$example}
- Add unit tests
- #6701
- https://wiki.php.net/rfc/dynamic_class_constant_fetch
- Fix the code completion feature
- Add unit tests for the code completion and brace matching features
- #6701
- https://wiki.php.net/rfc/dynamic_class_constant_fetch
- Fix the `IntroduceSuggestion` and `PHP55UnhandledError`
- Add unit tests
…fetch

PHP 8.3 Support: Dynamic class constant fetch #6701
- #6701
- https://wiki.php.net/rfc/typed_class_constants
- Fix the grammar file (parser)
- Fix the `PHP83UnhandledError`
- Add/Fix unit tests for the parser
- Increment the spec version

Example:
```php
class Example {
    public const string CONSTANT1 = 'constant';
    public const ?int CONSTANT2 = 1;
    public const int|string CONSTANT3 = 1;
}
```
- #6701
- https://wiki.php.net/rfc/typed_class_constants
- Index class constant types
- Fix the navigator
- Add/Fix unit tests for the indexer and the navigator
- Increment the spec version
- #6701
- https://wiki.php.net/rfc/typed_class_constants
- Fix the context sensitive lexer (Reserved keywords can be used as constant names)
- Get the constant names as the `PHP_STRING` token
- Add unit tests

Example:
```php
class Example {
    public const string|array array = [1, 2, 3], string = "example";
}
```
- #6701
- https://wiki.php.net/rfc/typed_class_constants
- Fix the mark occurences and the go to declaration features
- Add unit tests
- #6701
- https://wiki.php.net/rfc/typed_class_constants
- Fix the Code Completion feature
- Add templates for constant statements
- Add unit tests
- #6701
- https://wiki.php.net/rfc/typed_class_constants
- Fix the formatter (don't add spaces within parens of DNF types)
- Fix the `UnusableTypeHintError`
- Add unit tests
@junichi11 junichi11 added the PHP [ci] enable extra PHP tests (php/php.editor) label Dec 8, 2023
@junichi11 junichi11 added this to the NB21 milestone Dec 8, 2023
@junichi11 junichi11 requested a review from tmysik December 8, 2023 11:32
Copy link
Member

@tmysik tmysik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

@junichi11 junichi11 merged commit 120f212 into master Dec 8, 2023
72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PHP [ci] enable extra PHP tests (php/php.editor)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants