mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-17 17:47:13 +00:00
Replace psalm with larastan (#1755)
* Use larastan instead of psalm * Fix cs * Fix baseline
This commit is contained in:
@@ -25,4 +25,4 @@ jobs:
|
||||
run: composer install --prefer-dist --no-progress --no-suggest
|
||||
|
||||
- name: Analyze
|
||||
run: composer analyze
|
||||
run: vendor/bin/phpstan --no-progress --error-format=github
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
.phpunit.result.cache
|
||||
|
||||
/build
|
||||
/.idea
|
||||
/.php-cs-fixer.cache
|
||||
/.php-cs-fixer.php
|
||||
|
||||
@@ -3,7 +3,7 @@ require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->in(__DIR__)
|
||||
->exclude('tests');
|
||||
->exclude(['tests', 'build']);
|
||||
|
||||
$config = require __DIR__ . '/.php-cs-fixer.common.php';
|
||||
|
||||
|
||||
+4
-3
@@ -35,11 +35,12 @@
|
||||
"friendsofphp/php-cs-fixer": "^3",
|
||||
"illuminate/config": "^11.15 || ^12",
|
||||
"illuminate/view": "^11.15 || ^12",
|
||||
"larastan/larastan": "^3.1",
|
||||
"mockery/mockery": "^1.4",
|
||||
"orchestra/testbench": "^9.2 || ^10",
|
||||
"phpstan/phpstan-phpunit": "^2.0",
|
||||
"phpunit/phpunit": "^10.5 || ^11.5.3",
|
||||
"spatie/phpunit-snapshot-assertions": "^4 || ^5",
|
||||
"vimeo/psalm": "^5.4",
|
||||
"vlucas/phpdotenv": "^5"
|
||||
},
|
||||
"suggest": {
|
||||
@@ -74,7 +75,7 @@
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"analyze": "psalm",
|
||||
"analyze": "phpstan",
|
||||
"check-style": [
|
||||
"php-cs-fixer fix --diff --diff-format=udiff --dry-run",
|
||||
"php-cs-fixer fix --diff --diff-format=udiff --dry-run --config=.php_cs.tests.php"
|
||||
@@ -83,7 +84,7 @@
|
||||
"php-cs-fixer fix",
|
||||
"php-cs-fixer fix --config=.php-cs-fixer.tests.php"
|
||||
],
|
||||
"psalm-set-baseline": "psalm --set-baseline=psalm-baseline.xml",
|
||||
"analyze-set-baseline": "phpstan --generate-baseline",
|
||||
"test": "phpunit",
|
||||
"test-ci": "phpunit -d --without-creating-snapshots",
|
||||
"test-regenerate": "phpunit -d --update-snapshots"
|
||||
|
||||
@@ -47,20 +47,6 @@ return [
|
||||
|
||||
'include_fluent' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Factory builders
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set to true to generate factory generators for better factory()
|
||||
| method auto-completion.
|
||||
|
|
||||
| Deprecated for Laravel 8 or latest.
|
||||
|
|
||||
*/
|
||||
|
||||
'include_factory_builders' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Write model magic methods
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
parameters:
|
||||
ignoreErrors:
|
||||
-
|
||||
message: '#^File ends with a trailing whitespace\. This may cause problems when running the code in the web browser\. Remove the closing \?\> mark or remove the whitespace\.$#'
|
||||
identifier: whitespace.fileEnd
|
||||
count: 1
|
||||
path: resources/views/helper.php
|
||||
|
||||
-
|
||||
message: '#^Call to an undefined method Illuminate\\Contracts\\Filesystem\\Filesystem\:\:requireOnce\(\)\.$#'
|
||||
identifier: method.notFound
|
||||
count: 1
|
||||
path: src/Console/MetaCommand.php
|
||||
|
||||
-
|
||||
message: '#^Call to an undefined method Illuminate\\Contracts\\Foundation\\Application\:\:getBindings\(\)\.$#'
|
||||
identifier: method.notFound
|
||||
count: 1
|
||||
path: src/Console/MetaCommand.php
|
||||
|
||||
-
|
||||
message: '#^Call to an undefined method Barryvdh\\Reflection\\DocBlock\\Tag\:\:getMethodName\(\)\.$#'
|
||||
identifier: method.notFound
|
||||
count: 1
|
||||
path: src/Console/ModelsCommand.php
|
||||
|
||||
-
|
||||
message: '#^Call to an undefined method Barryvdh\\Reflection\\DocBlock\\Tag\:\:getType\(\)\.$#'
|
||||
identifier: method.notFound
|
||||
count: 1
|
||||
path: src/Console/ModelsCommand.php
|
||||
|
||||
-
|
||||
message: '#^Call to an undefined method Barryvdh\\Reflection\\DocBlock\\Tag\:\:getVariableName\(\)\.$#'
|
||||
identifier: method.notFound
|
||||
count: 1
|
||||
path: src/Console/ModelsCommand.php
|
||||
|
||||
-
|
||||
message: '#^Call to an undefined method Illuminate\\Support\\Optional\:\:getNumberOfParameters\(\)\.$#'
|
||||
identifier: method.notFound
|
||||
count: 1
|
||||
path: src/Console/ModelsCommand.php
|
||||
|
||||
-
|
||||
message: '#^Call to an undefined method Illuminate\\Support\\Optional\:\:getParameters\(\)\.$#'
|
||||
identifier: method.notFound
|
||||
count: 1
|
||||
path: src/Console/ModelsCommand.php
|
||||
|
||||
-
|
||||
message: '#^Call to an undefined method Illuminate\\Support\\Optional\:\:getReturnType\(\)\.$#'
|
||||
identifier: method.notFound
|
||||
count: 1
|
||||
path: src/Console/ModelsCommand.php
|
||||
|
||||
-
|
||||
message: '#^Call to an undefined static method Illuminate\\Database\\Eloquent\\Model\:\:newFactory\(\)\.$#'
|
||||
identifier: staticMethod.notFound
|
||||
count: 2
|
||||
path: src/Console/ModelsCommand.php
|
||||
|
||||
-
|
||||
message: '#^Call to an undefined method ReflectionFunctionAbstract\:\:getDeclaringClass\(\)\.$#'
|
||||
identifier: method.notFound
|
||||
count: 1
|
||||
path: src/Method.php
|
||||
@@ -0,0 +1,11 @@
|
||||
includes:
|
||||
- phpstan-baseline.neon
|
||||
- vendor/phpstan/phpstan-phpunit/extension.neon
|
||||
|
||||
parameters:
|
||||
level: 2
|
||||
paths:
|
||||
- src
|
||||
- resources/views
|
||||
excludePaths:
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<files psalm-version="5.4.0@62db5d4f6a7ae0a20f7cc5a4952d730272fc0863">
|
||||
<file src="src/Factories.php">
|
||||
<UndefinedClass occurrences="2">
|
||||
<code>Factory</code>
|
||||
<code>Factory</code>
|
||||
</UndefinedClass>
|
||||
</file>
|
||||
<file src="src/Generator.php">
|
||||
<UndefinedClass occurrences="6">
|
||||
<code>\Auth</code>
|
||||
<code>\Cache</code>
|
||||
<code>\Cache</code>
|
||||
<code>\DB</code>
|
||||
<code>\Queue</code>
|
||||
<code>\Storage</code>
|
||||
</UndefinedClass>
|
||||
</file>
|
||||
<file src="src/Console/ModelsCommand.php">
|
||||
<UndefinedClass occurrences="1">
|
||||
<code>\UnitEnum</code>
|
||||
</UndefinedClass>
|
||||
</file>
|
||||
</files>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
errorLevel="7"
|
||||
resolveFromConfigFile="true"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://getpsalm.org/schema/config"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
errorBaseline="psalm-baseline.xml"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="src" />
|
||||
<ignoreFiles>
|
||||
<directory name="vendor" />
|
||||
</ignoreFiles>
|
||||
</projectFiles>
|
||||
</psalm>
|
||||
@@ -3,6 +3,7 @@
|
||||
/**
|
||||
* @var Barryvdh\LaravelIdeHelper\Alias[][] $namespaces_by_alias_ns
|
||||
* @var Barryvdh\LaravelIdeHelper\Alias[][] $namespaces_by_extends_ns
|
||||
* @var string[] $real_time_facades
|
||||
* @var bool $include_fluent
|
||||
* @var string $helpers
|
||||
*/
|
||||
@@ -119,12 +120,3 @@ namespace Illuminate\Support {
|
||||
}
|
||||
<?php endif ?>
|
||||
|
||||
<?php foreach ($factories as $factory) : ?>
|
||||
namespace <?=$factory->getNamespaceName()?> {
|
||||
/**
|
||||
* @method \Illuminate\Database\Eloquent\Collection|<?=$factory->getShortName()?>[]|<?=$factory->getShortName()?> create($attributes = [])
|
||||
* @method \Illuminate\Database\Eloquent\Collection|<?=$factory->getShortName()?>[]|<?=$factory->getShortName()?> make($attributes = [])
|
||||
*/
|
||||
class <?=$factory->getShortName()?>FactoryBuilder extends \Illuminate\Database\Eloquent\FactoryBuilder {}
|
||||
}
|
||||
<?php endforeach; ?>
|
||||
|
||||
+14
-11
@@ -1,4 +1,16 @@
|
||||
<?= '<?php' ?>
|
||||
<?php
|
||||
/**
|
||||
* @var array $bindings
|
||||
* @var string[] $methods
|
||||
* @var string[] $configMethods
|
||||
* @var Illuminate\Support\Collection $configValues
|
||||
* @var array<string, array> $expectedArgumentSets
|
||||
* @var array $expectedArguments
|
||||
* @var string[] $userMethods
|
||||
* @var string $userModel/
|
||||
* */
|
||||
?>
|
||||
|
||||
/* @noinspection ALL */
|
||||
// @formatter:off
|
||||
@@ -35,15 +47,6 @@ namespace PHPSTORM_META {
|
||||
]));
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if (count($factories)) : ?>
|
||||
override(\factory(0), map([
|
||||
'' => '@FactoryBuilder',
|
||||
<?php foreach ($factories as $factory) : ?>
|
||||
'<?= $factory->getName() ?>' => \<?= $factory->getName() ?>FactoryBuilder::class,
|
||||
<?php endforeach; ?>
|
||||
]));
|
||||
<?php endif; ?>
|
||||
|
||||
override(\Illuminate\Foundation\Testing\Concerns\InteractsWithContainer::mock(0), map(["" => "@&\Mockery\MockInterface"]));
|
||||
override(\Illuminate\Foundation\Testing\Concerns\InteractsWithContainer::partialMock(0), map(["" => "@&\Mockery\MockInterface"]));
|
||||
override(\Illuminate\Foundation\Testing\Concerns\InteractsWithContainer::instance(0), type(1));
|
||||
@@ -79,7 +82,7 @@ namespace PHPSTORM_META {
|
||||
override(\tap(0), type(0));
|
||||
override(\optional(0), type(0));
|
||||
|
||||
<?php if (isset($expectedArgumentSets)): ?>
|
||||
<?php if ($expectedArgumentSets): ?>
|
||||
<?php foreach ($expectedArgumentSets as $name => $argumentsList) : ?>
|
||||
registerArgumentsSet('<?= $name ?>', <?php foreach ($argumentsList as $i => $arg) : ?><?php if ($i % 5 == 0) {
|
||||
echo "\n";
|
||||
@@ -87,7 +90,7 @@ namespace PHPSTORM_META {
|
||||
<?php endforeach; ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (isset($expectedArguments)) : ?>
|
||||
<?php if ($expectedArguments) : ?>
|
||||
<?php foreach ($expectedArguments as $arguments) : ?>
|
||||
<?php
|
||||
$classes = isset($arguments['class']) ? (array) $arguments['class'] : [null];
|
||||
|
||||
+1
-6
@@ -325,9 +325,8 @@ class Alias
|
||||
/**
|
||||
* Get the real root of a facade
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
protected function detectRoot()
|
||||
protected function detectRoot(): void
|
||||
{
|
||||
$facade = $this->facade;
|
||||
|
||||
@@ -386,7 +385,6 @@ class Alias
|
||||
if ($class !== $this->root) {
|
||||
$this->methods[] = new Method(
|
||||
$method,
|
||||
$this->alias,
|
||||
$class,
|
||||
$magic,
|
||||
$this->interfaces,
|
||||
@@ -403,7 +401,6 @@ class Alias
|
||||
/**
|
||||
* Get the methods for one or multiple classes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function detectMethods()
|
||||
{
|
||||
@@ -419,7 +416,6 @@ class Alias
|
||||
if ($this->extends !== $class && substr($method->name, 0, 2) !== '__') {
|
||||
$this->methods[] = new Method(
|
||||
$method,
|
||||
$this->alias,
|
||||
$reflection,
|
||||
$method->name,
|
||||
$this->interfaces,
|
||||
@@ -449,7 +445,6 @@ class Alias
|
||||
// Add macros
|
||||
$this->methods[] = new Macro(
|
||||
$method,
|
||||
$this->alias,
|
||||
$reflection,
|
||||
$macro_name,
|
||||
$this->interfaces,
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Console;
|
||||
|
||||
use Barryvdh\LaravelIdeHelper\Factories;
|
||||
use Dotenv\Parser\Entry;
|
||||
use Dotenv\Parser\Parser;
|
||||
use Illuminate\Console\Command;
|
||||
@@ -108,9 +107,6 @@ class MetaCommand extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
// Needs to run before exception handler is registered
|
||||
$factories = $this->config->get('ide-helper.include_factory_builders') ? Factories::all() : [];
|
||||
|
||||
$ourAutoloader = $this->registerClassAutoloadExceptions();
|
||||
|
||||
$bindings = [];
|
||||
@@ -149,7 +145,6 @@ class MetaCommand extends Command
|
||||
$content = $this->view->make('ide-helper::meta', [
|
||||
'bindings' => $bindings,
|
||||
'methods' => $this->methods,
|
||||
'factories' => $factories,
|
||||
'configMethods' => $this->configMethods,
|
||||
'configValues' => $configValues,
|
||||
'expectedArgumentSets' => $this->getExpectedArgumentSets(),
|
||||
|
||||
@@ -1133,6 +1133,7 @@ class ModelsCommand extends Command
|
||||
|
||||
$serializer = new DocBlockSerializer();
|
||||
$docComment = $serializer->getDocComment($phpdoc);
|
||||
$mixinClassName = null;
|
||||
|
||||
if ($this->write_mixin) {
|
||||
$phpdocMixin = new DocBlock($reflection, new Context($namespace));
|
||||
@@ -1680,7 +1681,7 @@ class ModelsCommand extends Command
|
||||
|
||||
preg_match(
|
||||
'/@param ((?:(?:[\w?|\\\\<>])+(?:\[])?)+)/',
|
||||
$docComment ?? '',
|
||||
$docComment,
|
||||
$matches
|
||||
);
|
||||
$type = $matches[1] ?? '';
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
use ReflectionClass;
|
||||
|
||||
class Factories
|
||||
{
|
||||
public static function all()
|
||||
{
|
||||
$factories = [];
|
||||
|
||||
if (static::isLaravelSevenOrLower()) {
|
||||
$factory = app(Factory::class);
|
||||
|
||||
$definitions = (new ReflectionClass(Factory::class))->getProperty('definitions');
|
||||
|
||||
foreach ($definitions->getValue($factory) as $factory_target => $config) {
|
||||
try {
|
||||
$factories[] = new ReflectionClass($factory_target);
|
||||
} catch (Exception $exception) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $factories;
|
||||
}
|
||||
|
||||
protected static function isLaravelSevenOrLower()
|
||||
{
|
||||
return class_exists('Illuminate\Database\Eloquent\Factory');
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -74,7 +74,7 @@ class Generator
|
||||
/**
|
||||
* Generate the helper file contents;
|
||||
*
|
||||
* @return string;
|
||||
* @return string
|
||||
*/
|
||||
public function generate()
|
||||
{
|
||||
@@ -85,7 +85,6 @@ class Generator
|
||||
->with('real_time_facades', $this->getRealTimeFacades())
|
||||
->with('helpers', $this->detectHelpers())
|
||||
->with('include_fluent', $this->config->get('ide-helper.include_fluent', true))
|
||||
->with('factories', $this->config->get('ide-helper.include_factory_builders') ? Factories::all() : [])
|
||||
->render();
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -15,7 +15,6 @@ class Macro extends Method
|
||||
* Macro constructor.
|
||||
*
|
||||
* @param \ReflectionFunctionAbstract $method
|
||||
* @param string $alias
|
||||
* @param \ReflectionClass $class
|
||||
* @param null $methodName
|
||||
* @param array $interfaces
|
||||
@@ -24,14 +23,13 @@ class Macro extends Method
|
||||
*/
|
||||
public function __construct(
|
||||
$method,
|
||||
$alias,
|
||||
$class,
|
||||
$methodName = null,
|
||||
$interfaces = [],
|
||||
$classAliases = [],
|
||||
$returnTypeNormalizers = []
|
||||
) {
|
||||
parent::__construct($method, $alias, $class, $methodName, $interfaces, $classAliases, $returnTypeNormalizers);
|
||||
parent::__construct($method, $class, $methodName, $interfaces, $classAliases, $returnTypeNormalizers);
|
||||
}
|
||||
|
||||
public static function setDefaultReturnTypes(array $map = [])
|
||||
@@ -75,8 +73,8 @@ class Macro extends Method
|
||||
|
||||
$type = $this->concatReflectionTypes($return);
|
||||
|
||||
/** @psalm-suppress UndefinedClass */
|
||||
if (!$return instanceof \ReflectionUnionType) {
|
||||
/** @phpstan-ignore method.notFound */
|
||||
$type .= $this->root === "\\{$builder}" && $return->getName() === $builder ? '|static' : '';
|
||||
$type .= $return->allowsNull() ? '|null' : '';
|
||||
}
|
||||
|
||||
+1
-2
@@ -44,7 +44,6 @@ class Method
|
||||
|
||||
/**
|
||||
* @param \ReflectionMethod|\ReflectionFunctionAbstract $method
|
||||
* @param string $alias
|
||||
* @param \ReflectionClass $class
|
||||
* @param string|null $methodName
|
||||
* @param array $interfaces
|
||||
@@ -52,7 +51,7 @@ class Method
|
||||
* @param array $returnTypeNormalizers
|
||||
* @param string[] $templateNames
|
||||
*/
|
||||
public function __construct($method, $alias, $class, $methodName = null, $interfaces = [], array $classAliases = [], array $returnTypeNormalizers = [], array $templateNames = [])
|
||||
public function __construct($method, $class, $methodName = null, $interfaces = [], array $classAliases = [], array $returnTypeNormalizers = [], array $templateNames = [])
|
||||
{
|
||||
$this->method = $method;
|
||||
$this->interfaces = $interfaces;
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Factories;
|
||||
|
||||
use Barryvdh\LaravelIdeHelper\Factories;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class AllTest extends TestCase
|
||||
{
|
||||
public function testAll(): void
|
||||
{
|
||||
$factories = Factories::all();
|
||||
|
||||
self::assertEmpty($factories);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -284,7 +284,7 @@ class MacroTest extends TestCase
|
||||
{
|
||||
$reflectionMethod = new \ReflectionMethod(UrlGeneratorMacroClass::class, '__invoke');
|
||||
|
||||
$macro = new Macro($reflectionMethod, UrlGenerator::class, new ReflectionClass(UrlGenerator::class), 'macroName');
|
||||
$macro = new Macro($reflectionMethod, new ReflectionClass(UrlGenerator::class), 'macroName');
|
||||
|
||||
$this->assertInstanceOf(Macro::class, $macro);
|
||||
}
|
||||
@@ -296,7 +296,7 @@ class MacroTest extends TestCase
|
||||
{
|
||||
$reflectionMethod = new \ReflectionMethod(UrlGeneratorMacroClass::class, '__invoke');
|
||||
|
||||
$macro = new Macro($reflectionMethod, 'URL', new ReflectionClass(UrlGenerator::class), 'macroName');
|
||||
$macro = new Macro($reflectionMethod, new ReflectionClass(UrlGenerator::class), 'macroName');
|
||||
$output = <<<'DOC'
|
||||
/**
|
||||
* @param string $foo
|
||||
@@ -331,7 +331,7 @@ class MacroMock extends Macro
|
||||
|
||||
public function getPhpDoc(ReflectionFunctionAbstract $method, ?ReflectionClass $class = null): DocBlock
|
||||
{
|
||||
return (new Macro($method, '', $class ?? $method->getClosureScopeClass()))->phpdoc;
|
||||
return (new Macro($method, $class ?? $method->getClosureScopeClass()))->phpdoc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class MethodTest extends TestCase
|
||||
$reflectionClass = new \ReflectionClass(ExampleClass::class);
|
||||
$reflectionMethod = $reflectionClass->getMethod('setName');
|
||||
|
||||
$method = new Method($reflectionMethod, 'Example', $reflectionClass);
|
||||
$method = new Method($reflectionMethod, $reflectionClass);
|
||||
|
||||
$this->assertInstanceOf(Method::class, $method);
|
||||
}
|
||||
@@ -32,7 +32,7 @@ class MethodTest extends TestCase
|
||||
$reflectionClass = new \ReflectionClass(ExampleClass::class);
|
||||
$reflectionMethod = $reflectionClass->getMethod('setName');
|
||||
|
||||
$method = new Method($reflectionMethod, 'Example', $reflectionClass);
|
||||
$method = new Method($reflectionMethod, $reflectionClass);
|
||||
|
||||
$output = <<<'DOC'
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ DOC;
|
||||
$reflectionClass = new \ReflectionClass(EloquentBuilder::class);
|
||||
$reflectionMethod = $reflectionClass->getMethod('upsert');
|
||||
|
||||
$method = new Method($reflectionMethod, 'Builder', $reflectionClass);
|
||||
$method = new Method($reflectionMethod, $reflectionClass);
|
||||
|
||||
$output = <<<'DOC'
|
||||
/**
|
||||
@@ -92,7 +92,7 @@ DOC;
|
||||
$reflectionClass = new \ReflectionClass(EloquentBuilder::class);
|
||||
$reflectionMethod = $reflectionClass->getMethod('where');
|
||||
|
||||
$method = new Method($reflectionMethod, 'Builder', $reflectionClass, null, [], [], ['$this' => '\\' . EloquentBuilder::class . '<static>']);
|
||||
$method = new Method($reflectionMethod, $reflectionClass, null, [], [], ['$this' => '\\' . EloquentBuilder::class . '<static>']);
|
||||
|
||||
$output = <<<'DOC'
|
||||
/**
|
||||
@@ -123,7 +123,7 @@ DOC;
|
||||
$reflectionClass = new \ReflectionClass(QueryBuilder::class);
|
||||
$reflectionMethod = $reflectionClass->getMethod('whereNull');
|
||||
|
||||
$method = new Method($reflectionMethod, 'Builder', $reflectionClass, null, [], [], ['$this' => '\\' . EloquentBuilder::class . '<static>']);
|
||||
$method = new Method($reflectionMethod, $reflectionClass, null, [], [], ['$this' => '\\' . EloquentBuilder::class . '<static>']);
|
||||
|
||||
$output = <<<'DOC'
|
||||
/**
|
||||
@@ -154,7 +154,7 @@ DOC;
|
||||
$reflectionClass = new \ReflectionClass(ExampleClass::class);
|
||||
$reflectionMethod = $reflectionClass->getMethod('setSpecialChars');
|
||||
|
||||
$method = new Method($reflectionMethod, 'Example', $reflectionClass);
|
||||
$method = new Method($reflectionMethod, $reflectionClass);
|
||||
$this->assertSame('$chars', $method->getParams(true));
|
||||
$this->assertSame(['$chars'], $method->getParams(false));
|
||||
$this->assertSame('$chars = \'$\\\'\\\\\'', $method->getParamsWithDefault(true));
|
||||
@@ -169,7 +169,7 @@ DOC;
|
||||
$reflectionClass = new \ReflectionClass(ExampleClass::class);
|
||||
$reflectionMethod = $reflectionClass->getMethod('getApplication');
|
||||
|
||||
$method = new Method($reflectionMethod, 'Example', $reflectionClass, null, [], [
|
||||
$method = new Method($reflectionMethod, $reflectionClass, null, [], [
|
||||
'Application' => '\\Illuminate\\Foundation\\Application',
|
||||
]);
|
||||
|
||||
@@ -195,7 +195,7 @@ DOC;
|
||||
$reflectionClass = new \ReflectionClass(EloquentBuilder::class);
|
||||
$reflectionMethod = $reflectionClass->getMethod('firstOr');
|
||||
|
||||
$method = new Method($reflectionMethod, 'Builder', $reflectionClass, null, [], [], [], ['TModel']);
|
||||
$method = new Method($reflectionMethod, $reflectionClass, null, [], [], [], ['TModel']);
|
||||
|
||||
$output = <<<'DOC'
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user