-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
70 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package checkers | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/VKCOM/noverify/src/linttest" | ||
) | ||
|
||
func TestPhpAliases(t *testing.T) { | ||
test := linttest.NewSuite(t) | ||
test.AddFile(`<?php | ||
declare(strict_types = "1") | ||
$_ = join("", []); | ||
`) | ||
test.Expect = []string{ | ||
`Call to undefined function join`, | ||
`Use implode instead of 'join'`, | ||
} | ||
test.RunAndMatch() | ||
} | ||
|
||
func TestPhpAliasesFunctionCall(t *testing.T) { | ||
test := linttest.NewSuite(t) | ||
test.AddFile(`<?php | ||
declare(strict_types = "1") | ||
$_ = join("", []); | ||
function test($d){ | ||
ocicollmax(); | ||
} | ||
test(join("", [])); | ||
`) | ||
test.Expect = []string{ | ||
`Use OCICollection::max instead of 'ocicollmax'`, | ||
`Call to undefined function ocicollmax`, | ||
`Use implode instead of 'join'`, | ||
`Call to undefined function join`, | ||
`Use implode instead of 'join'`, | ||
`Call to undefined function join`, | ||
} | ||
test.RunAndMatch() | ||
} |
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,9 @@ | ||
<?php | ||
declare(strict_types = "1") | ||
$_ = join("", []); | ||
|
||
function test($d){ | ||
ocicollmax(); | ||
} | ||
|
||
test(join("", [])); |
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,9 @@ | ||
<?php | ||
declare(strict_types = "1") | ||
$_ = implode("", []); | ||
|
||
function test($d){ | ||
OCICollection::max(); | ||
} | ||
|
||
test(implode("", [])); |
9 changes: 9 additions & 0 deletions
9
src/tests/golden/testdata/quickfix/phpAliases.php.fix.expected
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,9 @@ | ||
<?php | ||
declare(strict_types = "1") | ||
$_ = implode("", []); | ||
|
||
function test($d){ | ||
OCICollection::max(); | ||
} | ||
|
||
test(implode("", [])); |