Hey i'm currently checking if snippets work as expected:
.text.html.basic
Actual:
Expected:
Body:
<?php echo ${1:\\$var} ?>$0
Solution:
<?php echo ${1:\$var} ?>$0
Actual:
<?php echo htmlentities(\$var, ENT_QUOTES, 'utf-8') ?>
Expected:
<?php echo htmlentities($var, ENT_QUOTES, 'utf-8') ?>
Body:
<?php echo htmlentities(${1:\\$var}, ENT_QUOTES, \'utf-8\') ?>$0
Solution:
<?php echo htmlentities(${1:\$var}, ENT_QUOTES, \'utf-8\') ?>$0
Actual:
<?php foreach (\$variable as \$key => \$value): ?>
${0}
<?php endforeach ?>
Expected:
<?php foreach ($variable as $key => $value): ?>
# code
<?php endforeach ?>
Body:
<?php foreach (\\$${1:variable} as \\$${2:key}${3: => \\$${4:value}}): ?>\n\t${0}\n<?php endforeach ?>
Solution:
<?php foreach (\$${1:variable} as \$${2:key}${3: => \$${4:value}}): ?>\n\t${0:# code}\n<?php endforeach ?>
.text.html.php:
Actual:
\$GLOBALS['variable'] = something;
Expected:
$GLOBALS['variable'] = something;
Body:
\\$GLOBALS[\'${1:variable}\']${2: = }${3:something}${4:;}$0
Solution:
\$GLOBALS[\'${1:variable}\']${2: = }${3:something}${4:;}$0
Actual:
function __construct(\$foo = null) {
${2/.+/$this-> = \$;/}
}```
Expected:
```php
function __construct($foo = null) {
$this-> = ;
}```
Body:
```php
function __construct(${1:\\$${2:foo}${3: = ${4:null}}}) {\n\t${2/.+/$this->$0 = \\$$0;/}$0\n}
Actual:
/**
* undocumented class variable
*
* @var string
**/
var \$;
Expected:
/**
* undocumented class variable
*
* @var string
**/
var $;
Body:
/**\n * ${3:undocumented class variable}\n *\n * @var ${4:string}\n **/\n${1:var} \\$$2;$0
Solution:
/**\n * ${3:undocumented class variable}\n *\n * @var ${4:string}\n **/\n${1:var} \$$2;$0
Actual:
Expected:
Body:
Solution:
// Replace the prefix to defd maybe
use : defined(\'$1\')$0
Actual:
Expected:
Body:
Solution:
Actual:
for (\$i=0; \$i < ; \$i++) {
# code...
}
Expected:
for ($i=0; $i < ; $i++) {
# code...
}
Body:
for (\\$${1:i}=${2:0}; \\$${1:i} < $3; \\$${1:i}++) { \n\t${0:# code...}\n}
Solution:
Actual:
foreach (\$variable as \$key => \$value) {
# code...
}
Expected:
foreach ($variable as $key => $value) {
# code...
}
Body:
foreach (\\$${1:variable} as \\$${2:key}${3: => \\$${4:value}}) {\n\t${0:# code...}\n}
Solution:
foreach (\$${1:variable} as \$${2:key}${3: => \$${4:value}}) {\n\t${0:# code...}\n}
Actual:
public function FunctionName(\$value='')
{
# code...
}
Expected:
public function FunctionName($value='')
{
# code...
}
Body:
${1:public }function ${2:FunctionName}(${3:\\$${4:value}${5:=\'\'}})\n{\n\t${0:# code...}\n}
Solution:
${1:public }function ${2:FunctionName}(${3:\$${4:value}${5:=\'\'}})\n{\n\t${0:# code...}\n}
Actual:
Expected:
$retVal = (condition) ? a : b;
Body:
\\$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b} ;
Solution:
Actual:
\$arrayName = array('' => , );
Expected:
$arrayName = array('' => , );
Body:
\\$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b} ;
Solution:
\$${1:arrayName} = array(\'$2\' => $3${4:,} $0);