-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from jaxwilko/wip/env-lexer
Fixes #1
- Loading branch information
Showing
11 changed files
with
363 additions
and
142 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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
parameters: | ||
level: 6 | ||
reportUnmatchedIgnoredErrors: false | ||
level: 5 | ||
paths: | ||
- src | ||
ignoreErrors: | ||
- message: '#Access to an undefined property.*?\$expr#' | ||
path: src/ArrayFile.php |
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,20 @@ | ||
<?php | ||
|
||
namespace Winter\LaravelConfigWriter\Contracts; | ||
|
||
interface DataFileLexerInterface | ||
{ | ||
public const T_ENV = 'T_ENV'; | ||
public const T_VALUE = 'T_VALUE'; | ||
public const T_QUOTED_VALUE = 'T_QUOTED_VALUE'; | ||
public const T_WHITESPACE = 'T_WHITESPACE'; | ||
public const T_COMMENT = 'T_COMMENT'; | ||
|
||
/** | ||
* Get the ast from array of src lines | ||
* | ||
* @param string $string | ||
* @return array<int, array> | ||
*/ | ||
public function parse(string $string): array; | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace Winter\LaravelConfigWriter\Contracts; | ||
|
||
interface DataFilePrinterInterface | ||
{ | ||
/** | ||
* Transform the ast back to a src file string | ||
* @param array<int, array> $ast | ||
* @return string | ||
*/ | ||
public function render(array $ast): string; | ||
} |
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,25 @@ | ||
<?php | ||
|
||
namespace Winter\LaravelConfigWriter; | ||
|
||
use Winter\LaravelConfigWriter\Contracts\DataFileInterface; | ||
|
||
abstract class DataFile implements DataFileInterface | ||
{ | ||
/** | ||
* Abstract syntax tree | ||
* | ||
* @var mixed | ||
*/ | ||
protected $ast = []; | ||
|
||
/** | ||
* Get currently loaded AST | ||
* | ||
* @return \PhpParser\Node\Stmt[]|array|null | ||
*/ | ||
public function getAst() | ||
{ | ||
return $this->ast; | ||
} | ||
} |
Oops, something went wrong.