Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Feb 10, 2021
1 parent f79be08 commit f1d0255
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ Export the current value of each `use()` variable as expression inside the expor
You can use the 3rd argument of `VarExporter::export()` to control the indentation level.
This is useful when you want to use the generated code string to replace a placeholder in a template used to generate code files.

So using output of `VarExporter::export(['foo' => 'bar'], 0, 1)` in the template below to replace `{{exported}}`
So using output of `VarExporter::export(['foo' => 'bar'], indentLevel: 1)` in the template below to replace `{{exported}}`

```
public foo()
Expand Down
2 changes: 1 addition & 1 deletion src/VarExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ final class VarExporter
* @param mixed $var The variable to export.
* @param int $options A bitmask of options. Possible values are `VarExporter::*` constants.
* Combine multiple options with a bitwise OR `|` operator.
* @param int $indentLevel Indentation level.
* @param int $indentLevel The base output indentation level.
*
* @return string
*
Expand Down
12 changes: 6 additions & 6 deletions tests/VarExporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public function testExportObjectWithCircularReference()
public function testExportIndented($var, $expected, $options)
{
$template = <<<'TPL'
public foo ()
public function foo()
{
$data = {{exported}};
}
Expand All @@ -311,7 +311,7 @@ public function providerExportIndented()
// Array
$var = ['one' => ['hello', true], 'two' => 2];
$expected = <<<'PHP'
public foo ()
public function foo()
{
$data = [
'one' => [
Expand All @@ -327,7 +327,7 @@ public function providerExportIndented()
// Null
$var = null;
$expected = <<<'PHP'
public foo ()
public function foo()
{
$data = null;
}
Expand All @@ -339,7 +339,7 @@ public function providerExportIndented()
return 'Hello, world!';
};
$expected = <<<'PHP'
public foo ()
public function foo()
{
$data = function () {
return 'Hello, world!';
Expand All @@ -357,7 +357,7 @@ public function providerExportIndented()
};

$expected = <<<'PHP'
public foo ()
public function foo()
{
$data = function () {
$sub = function () {
Expand Down Expand Up @@ -388,7 +388,7 @@ public function providerExportIndented()
};

$expected = <<<'PHP'
public foo ()
public function foo()
{
$data = function () {
$a = 'Hello,
Expand Down

0 comments on commit f1d0255

Please sign in to comment.