Skip to content

Commit

Permalink
Merge branch '4.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Oct 16, 2022
2 parents a3e69ca + 67a491d commit f926695
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ install:
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.2-base bin all update

phpunit:
@rm -f bootstrap/cache/*.php && docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.2-cli
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.2-cli

phpstan-analyze-src:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.2-cli analyze src -c phpstan.src.neon.dist
Expand Down
6 changes: 4 additions & 2 deletions src/Parser/Lines.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,17 @@ public static function process(array $lines)
*/
private static function multilineProcess(bool $multiline, string $line, array $buffer)
{
$startsOnCurrentLine = $multiline ? false : self::looksLikeMultilineStart($line);

// check if $line can be multiline variable
if ($started = self::looksLikeMultilineStart($line)) {
if ($startsOnCurrentLine) {
$multiline = true;
}

if ($multiline) {
\array_push($buffer, $line);

if (self::looksLikeMultilineStop($line, $started)) {
if (self::looksLikeMultilineStop($line, $startsOnCurrentLine)) {
$multiline = false;
$line = \implode("\n", $buffer);
$buffer = [];
Expand Down
1 change: 1 addition & 0 deletions tests/Dotenv/Parser/LinesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function testProcessQuotes()
'TEST_NS=\'test\\ntest\'',
'TEST_EQD="https://vision.googleapis.com/v1/images:annotate?key="',
'TEST_EQS=\'https://vision.googleapis.com/v1/images:annotate?key=\'',
"BASE64_ENCODED_MULTILINE=\"qS1zCzMVVUJWQShokv6YVYi+ruKSC/bHV7GmEiyVkLaBWJHNVHCHsgTksEBsy8wJ\nuwycAvR07ZyOJJed4XTRMKnKp1/v+6UATpWzkIjZXytK+pD+XlZimUHTx3uiDcmU\njhQX1wWSxHDqrSWxeIJiTD+BuUyId8FzmXQ3TcBydJ474tmOU2F492ubk3LAiZ18\nmhiRGoshXAOSbS/P3+RZi4bDeNE/No4=\"",
];

self::assertSame($expected, Lines::process($result->success()->get()));
Expand Down
5 changes: 5 additions & 0 deletions tests/fixtures/env/multiline.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ TEST_NS='test\ntest'

TEST_EQD="https://vision.googleapis.com/v1/images:annotate?key="
TEST_EQS='https://vision.googleapis.com/v1/images:annotate?key='

BASE64_ENCODED_MULTILINE="qS1zCzMVVUJWQShokv6YVYi+ruKSC/bHV7GmEiyVkLaBWJHNVHCHsgTksEBsy8wJ
uwycAvR07ZyOJJed4XTRMKnKp1/v+6UATpWzkIjZXytK+pD+XlZimUHTx3uiDcmU
jhQX1wWSxHDqrSWxeIJiTD+BuUyId8FzmXQ3TcBydJ474tmOU2F492ubk3LAiZ18
mhiRGoshXAOSbS/P3+RZi4bDeNE/No4="

0 comments on commit f926695

Please sign in to comment.