This repository has been archived by the owner on Apr 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd: added initial support of PHP 8 (#19)
At the moment we are correctly parsing all PHP 8 and 8.1 except intersection types. A nullsafe method call is treated like a normal method call and creates a link. PHP 8 is now by default. In order to parse the project as PHP 7, added the `--php7` flag.
- Loading branch information
Showing
10 changed files
with
134 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package tests | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/vkcom/nocolor/internal/linttest" | ||
) | ||
|
||
func TestPHP8NullsafeMethodCall(t *testing.T) { | ||
suite := linttest.NewSuite(t) | ||
|
||
suite.Palette = defaultPalette | ||
suite.AddFile(`<?php | ||
class Foo { | ||
/** | ||
* @color red | ||
*/ | ||
public function f() {} | ||
} | ||
/** | ||
* @color green | ||
*/ | ||
function f($cond) { | ||
$a = new Foo; | ||
if ($cond) { | ||
$a = null; | ||
} | ||
$a?->f(); | ||
} | ||
`) | ||
|
||
suite.Expect = []string{ | ||
` | ||
green red => calling red from green is prohibited | ||
This color rule is broken, call chain: | ||
f@green -> Foo::f@red | ||
`, | ||
} | ||
|
||
suite.RunAndMatch() | ||
} |