Laravel 5.6 updates

Travis config update

Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
Manish Verma
2018-08-06 20:08:55 +05:30
parent 126fbb0255
commit 1ac0f42a58
2464 changed files with 65239 additions and 46734 deletions

View File

@@ -12,6 +12,7 @@ class BladeCompiler extends Compiler implements CompilerInterface
Concerns\CompilesComponents,
Concerns\CompilesConditionals,
Concerns\CompilesEchos,
Concerns\CompilesHelpers,
Concerns\CompilesIncludes,
Concerns\CompilesInjections,
Concerns\CompilesJson,
@@ -395,13 +396,13 @@ class BladeCompiler extends Compiler implements CompilerInterface
$this->conditions[$name] = $callback;
$this->directive($name, function ($expression) use ($name) {
return $expression
return $expression !== ''
? "<?php if (\Illuminate\Support\Facades\Blade::check('{$name}', {$expression})): ?>"
: "<?php if (\Illuminate\Support\Facades\Blade::check('{$name}')): ?>";
});
$this->directive('else'.$name, function ($expression) use ($name) {
return $expression
return $expression !== ''
? "<?php elseif (\Illuminate\Support\Facades\Blade::check('{$name}', {$expression})): ?>"
: "<?php elseif (\Illuminate\Support\Facades\Blade::check('{$name}')): ?>";
});
@@ -423,6 +424,46 @@ class BladeCompiler extends Compiler implements CompilerInterface
return call_user_func($this->conditions[$name], ...$parameters);
}
/**
* Register a component alias directive.
*
* @param string $path
* @param string $alias
* @return void
*/
public function component($path, $alias = null)
{
$alias = $alias ?: array_last(explode('.', $path));
$this->directive($alias, function ($expression) use ($path) {
return $expression
? "<?php \$__env->startComponent('{$path}', {$expression}); ?>"
: "<?php \$__env->startComponent('{$path}'); ?>";
});
$this->directive('end'.$alias, function ($expression) {
return '<?php echo $__env->renderComponent(); ?>';
});
}
/**
* Register an include alias directive.
*
* @param string $path
* @param string $alias
* @return void
*/
public function include($path, $alias = null)
{
$alias = $alias ?: array_last(explode('.', $path));
$this->directive($alias, function ($expression) use ($path) {
$expression = $this->stripParentheses($expression) ?: '[]';
return "<?php echo \$__env->make('{$path}', {$expression}, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>";
});
}
/**
* Register a handler for custom directives.
*
@@ -457,12 +498,22 @@ class BladeCompiler extends Compiler implements CompilerInterface
}
/**
* Set the echo format to double encode entities.
* Set the "echo" format to double encode entities.
*
* @return void
*/
public function doubleEncode()
public function withDoubleEncoding()
{
$this->setEchoFormat('e(%s, true)');
}
/**
* Set the "echo" format to not double encode entities.
*
* @return void
*/
public function withoutDoubleEncoding()
{
$this->setEchoFormat('e(%s, false)');
}
}

View File

@@ -26,6 +26,17 @@ trait CompilesAuthorizations
return "<?php if (app(\Illuminate\\Contracts\\Auth\\Access\\Gate::class)->denies{$expression}): ?>";
}
/**
* Compile the canany statements into valid PHP.
*
* @param string $expression
* @return string
*/
protected function compileCanany($expression)
{
return "<?php if (app(\Illuminate\\Contracts\\Auth\\Access\\Gate::class)->any{$expression}): ?>";
}
/**
* Compile the else-can statements into valid PHP.
*
@@ -48,6 +59,17 @@ trait CompilesAuthorizations
return "<?php elseif (app(\Illuminate\\Contracts\\Auth\\Access\\Gate::class)->denies{$expression}): ?>";
}
/**
* Compile the else-canany statements into valid PHP.
*
* @param string $expression
* @return string
*/
protected function compileElsecanany($expression)
{
return "<?php elseif (app(\Illuminate\\Contracts\\Auth\\Access\\Gate::class)->any{$expression}): ?>";
}
/**
* Compile the end-can statements into valid PHP.
*
@@ -67,4 +89,14 @@ trait CompilesAuthorizations
{
return '<?php endif; ?>';
}
/**
* Compile the end-canany statements into valid PHP.
*
* @return string
*/
protected function compileEndcanany()
{
return '<?php endif; ?>';
}
}

View File

@@ -11,7 +11,7 @@ trait CompilesConditionals
*/
protected $firstCaseInSwitch = true;
/*
/**
* Compile the if-auth statements into valid PHP.
*
* @param string|null $guard
@@ -24,6 +24,19 @@ trait CompilesConditionals
return "<?php if(auth()->guard{$guard}->check()): ?>";
}
/**
* Compile the else-auth statements into valid PHP.
*
* @param string|null $guard
* @return string
*/
protected function compileElseAuth($guard = null)
{
$guard = is_null($guard) ? '()' : $guard;
return "<?php elseif(auth()->guard{$guard}->check()): ?>";
}
/**
* Compile the end-auth statements into valid PHP.
*
@@ -47,6 +60,19 @@ trait CompilesConditionals
return "<?php if(auth()->guard{$guard}->guest()): ?>";
}
/**
* Compile the else-guest statements into valid PHP.
*
* @param string|null $guard
* @return string
*/
protected function compileElseGuest($guard = null)
{
$guard = is_null($guard) ? '()' : $guard;
return "<?php elseif(auth()->guard{$guard}->guest()): ?>";
}
/**
* Compile the end-guest statements into valid PHP.
*

View File

@@ -0,0 +1,49 @@
<?php
namespace Illuminate\View\Compilers\Concerns;
trait CompilesHelpers
{
/**
* Compile the CSRF statements into valid PHP.
*
* @return string
*/
protected function compileCsrf()
{
return '<?php echo csrf_field(); ?>';
}
/**
* Compile the "dd" statements into valid PHP.
*
* @param string $arguments
* @return string
*/
protected function compileDd($arguments)
{
return "<?php dd{$arguments}; ?>";
}
/**
* Compile the "dump" statements into valid PHP.
*
* @param string $arguments
* @return string
*/
protected function compileDump($arguments)
{
return "<?php dump{$arguments}; ?>";
}
/**
* Compile the method statements into valid PHP.
*
* @param string $method
* @return string
*/
protected function compileMethod($method)
{
return "<?php echo method_field{$method}; ?>";
}
}

View File

@@ -88,7 +88,7 @@ trait ManagesComponents
*/
public function slot($name, $content = null)
{
if (count(func_get_args()) == 2) {
if (func_num_args() === 2) {
$this->slots[$this->currentComponent()][$name] = $content;
} else {
if (ob_start()) {

View File

@@ -54,6 +54,6 @@ class EngineResolver
return $this->resolved[$engine] = call_user_func($this->resolvers[$engine]);
}
throw new InvalidArgumentException("Engine $engine not found.");
throw new InvalidArgumentException("Engine [{$engine}] not found.");
}
}

View File

@@ -145,10 +145,12 @@ class Factory implements FactoryContract
* @param array $data
* @param array $mergeData
* @return \Illuminate\Contracts\View\View
*
* @throws \InvalidArgumentException
*/
public function first(array $views, $data = [], $mergeData = [])
{
$view = collect($views)->first(function ($view) {
$view = Arr::first($views, function ($view) {
return $this->exists($view);
});
@@ -276,7 +278,7 @@ class Factory implements FactoryContract
public function getEngineFromPath($path)
{
if (! $extension = $this->getExtension($path)) {
throw new InvalidArgumentException("Unrecognized extension in file: $path");
throw new InvalidArgumentException("Unrecognized extension in file: {$path}");
}
$engine = $this->extensions[$extension];

View File

@@ -104,8 +104,8 @@ class FileViewFinder implements ViewFinderInterface
{
$segments = explode(static::HINT_PATH_DELIMITER, $name);
if (count($segments) != 2) {
throw new InvalidArgumentException("View [$name] has an invalid name.");
if (count($segments) !== 2) {
throw new InvalidArgumentException("View [{$name}] has an invalid name.");
}
if (! isset($this->hints[$segments[0]])) {
@@ -134,7 +134,7 @@ class FileViewFinder implements ViewFinderInterface
}
}
throw new InvalidArgumentException("View [$name] not found.");
throw new InvalidArgumentException("View [{$name}] not found.");
}
/**

View File

@@ -9,6 +9,7 @@ use BadMethodCallException;
use Illuminate\Support\Str;
use Illuminate\Support\MessageBag;
use Illuminate\Contracts\View\Engine;
use Illuminate\Support\Traits\Macroable;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Contracts\Support\MessageProvider;
@@ -16,6 +17,10 @@ use Illuminate\Contracts\View\View as ViewContract;
class View implements ArrayAccess, ViewContract
{
use Macroable {
__call as macroCall;
}
/**
* The view factory instance.
*
@@ -395,8 +400,14 @@ class View implements ArrayAccess, ViewContract
*/
public function __call($method, $parameters)
{
if (static::hasMacro($method)) {
return $this->macroCall($method, $parameters);
}
if (! Str::startsWith($method, 'with')) {
throw new BadMethodCallException("Method [$method] does not exist on view.");
throw new BadMethodCallException(sprintf(
'Method %s::%s does not exist.', static::class, $method
));
}
return $this->with(Str::camel(substr($method, 4)), $parameters[0]);

View File

@@ -14,13 +14,13 @@
}
],
"require": {
"php": ">=7.0",
"illuminate/container": "5.5.*",
"illuminate/contracts": "5.5.*",
"illuminate/events": "5.5.*",
"illuminate/filesystem": "5.5.*",
"illuminate/support": "5.5.*",
"symfony/debug": "~3.3"
"php": "^7.1.3",
"illuminate/container": "5.6.*",
"illuminate/contracts": "5.6.*",
"illuminate/events": "5.6.*",
"illuminate/filesystem": "5.6.*",
"illuminate/support": "5.6.*",
"symfony/debug": "~4.0"
},
"autoload": {
"psr-4": {
@@ -29,7 +29,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "5.5-dev"
"dev-master": "5.6-dev"
}
},
"config": {