Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.

Commit

Permalink
or operator warning
Browse files Browse the repository at this point in the history
  • Loading branch information
abdumu committed Apr 26, 2019
1 parent 57750b0 commit 9e7add8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Analyze.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ protected function detectWarnings()
}
}

if (version_compare($laravelVersion, '5.7', '>=')) {
if (
preg_match('/@?{{(\s*((?!}}).?)*\s*)or\s*.+?\s*}}(\r?\n)?/s', $this->code) ||
preg_match('/@?{{{(\s*((?!}}}).?)*\s*)or\s*.+?\s*}}}(\r?\n)?/s', $this->code) ||
preg_match('/@?{\!\!(\s*((?!\!\!}).?)*\s*)or\s*.+?\s*\!\!}(\r?\n)?/s', $this->code)
) {
$this->warnings->push(['or_operator', 'The "or" operator has been removed in favor of ?? as in {{ $var ?? "" }}']);
}
}

//execution time
$executionStartTime = microtime(true);
$this->compiler->compileString($this->code);
Expand Down

0 comments on commit 9e7add8

Please sign in to comment.