mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat(php): php 8.4 support (#6741)
* chore(php): update maintainers * feat(php): update php rules, highlight imported functions/consts * feat(php): indent inside property hooks * chore: update php and php_only revision
This commit is contained in:
parent
24ddf60d68
commit
ec8776ed9e
9 changed files with 85 additions and 13 deletions
13
tests/indent/php/property-hooks.php
Normal file
13
tests/indent/php/property-hooks.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
class Foo
|
||||
{
|
||||
private string $_baz;
|
||||
|
||||
public string $baz {
|
||||
&get => $this->_baz;
|
||||
set {
|
||||
$this->_baz = strtoupper($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -67,5 +67,10 @@ describe("indent PHP:", function()
|
|||
run:new_line("issue-6888.php", { on_line = 6, text = "$a;", indent = 0 })
|
||||
run:new_line("issue-6888.php", { on_line = 8, text = "$a;", indent = 4 })
|
||||
run:new_line("issue-6888.php", { on_line = 11, text = "$a;", indent = 0 })
|
||||
run:new_line("property-hooks.php", { on_line = 7, text = "get;", indent = 8 })
|
||||
run:new_line("property-hooks.php", { on_line = 8, text = "set;", indent = 8 })
|
||||
run:new_line("property-hooks.php", { on_line = 9, text = "$a;", indent = 12 })
|
||||
run:new_line("property-hooks.php", { on_line = 11, text = "get;", indent = 8 })
|
||||
run:new_line("property-hooks.php", { on_line = 12, text = "get;", indent = 4 })
|
||||
end)
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Foo\Bar;
|
||||
//^^^^^^^ @keyword.type
|
||||
// ^^^ @module
|
||||
// ^^^ @module
|
||||
|
||||
use Foo\Baz as Baaz;
|
||||
//^ @keyword.import
|
||||
// ^^^ @module
|
||||
// ^^^ @type
|
||||
// ^^ @keyword.operator
|
||||
// ^^^^ @type.definition
|
||||
|
||||
use function Foo\foo as fooo;
|
||||
// ^^^^^^^^ @keyword.function
|
||||
// ^^^ @function
|
||||
// ^^^^ @function
|
||||
|
||||
use const Foo\FOO as FOOO;
|
||||
// ^^^^^ @keyword.modifier
|
||||
// ^^^ @constant
|
||||
// ^^^^ @constant
|
||||
|
||||
use Foo\Baz\{
|
||||
// ^^^ @module
|
||||
// ^^^ @module
|
||||
Bar,
|
||||
//^^^ @type
|
||||
function foo,
|
||||
//^^^^^^^^ @keyword.function
|
||||
// ^^^ @function
|
||||
const FOO,
|
||||
//^^^^^ @keyword.modifier
|
||||
// ^^^ @constant
|
||||
};
|
||||
|
||||
abstract class A
|
||||
{
|
||||
protected readonly static $a;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue