Replace psalm with larastan (#1755)

* Use larastan instead of psalm

* Fix cs

* Fix baseline
This commit is contained in:
Barry vd. Heuvel
2026-02-07 14:32:53 +01:00
committed by GitHub
parent d87ec5835d
commit cff155b0d3
21 changed files with 118 additions and 164 deletions
+1 -1
View File
@@ -25,4 +25,4 @@ jobs:
run: composer install --prefer-dist --no-progress --no-suggest run: composer install --prefer-dist --no-progress --no-suggest
- name: Analyze - name: Analyze
run: composer analyze run: vendor/bin/phpstan --no-progress --error-format=github
+1 -1
View File
@@ -1,5 +1,5 @@
.phpunit.result.cache .phpunit.result.cache
/build
/.idea /.idea
/.php-cs-fixer.cache /.php-cs-fixer.cache
/.php-cs-fixer.php /.php-cs-fixer.php
+1 -1
View File
@@ -3,7 +3,7 @@ require __DIR__ . '/vendor/autoload.php';
$finder = PhpCsFixer\Finder::create() $finder = PhpCsFixer\Finder::create()
->in(__DIR__) ->in(__DIR__)
->exclude('tests'); ->exclude(['tests', 'build']);
$config = require __DIR__ . '/.php-cs-fixer.common.php'; $config = require __DIR__ . '/.php-cs-fixer.common.php';
+4 -3
View File
@@ -35,11 +35,12 @@
"friendsofphp/php-cs-fixer": "^3", "friendsofphp/php-cs-fixer": "^3",
"illuminate/config": "^11.15 || ^12", "illuminate/config": "^11.15 || ^12",
"illuminate/view": "^11.15 || ^12", "illuminate/view": "^11.15 || ^12",
"larastan/larastan": "^3.1",
"mockery/mockery": "^1.4", "mockery/mockery": "^1.4",
"orchestra/testbench": "^9.2 || ^10", "orchestra/testbench": "^9.2 || ^10",
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^10.5 || ^11.5.3", "phpunit/phpunit": "^10.5 || ^11.5.3",
"spatie/phpunit-snapshot-assertions": "^4 || ^5", "spatie/phpunit-snapshot-assertions": "^4 || ^5",
"vimeo/psalm": "^5.4",
"vlucas/phpdotenv": "^5" "vlucas/phpdotenv": "^5"
}, },
"suggest": { "suggest": {
@@ -74,7 +75,7 @@
} }
}, },
"scripts": { "scripts": {
"analyze": "psalm", "analyze": "phpstan",
"check-style": [ "check-style": [
"php-cs-fixer fix --diff --diff-format=udiff --dry-run", "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" "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",
"php-cs-fixer fix --config=.php-cs-fixer.tests.php" "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": "phpunit",
"test-ci": "phpunit -d --without-creating-snapshots", "test-ci": "phpunit -d --without-creating-snapshots",
"test-regenerate": "phpunit -d --update-snapshots" "test-regenerate": "phpunit -d --update-snapshots"
-14
View File
@@ -47,20 +47,6 @@ return [
'include_fluent' => false, '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 | Write model magic methods
+67
View File
@@ -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
+11
View File
@@ -0,0 +1,11 @@
includes:
- phpstan-baseline.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
parameters:
level: 2
paths:
- src
- resources/views
excludePaths:
-24
View File
@@ -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>
-16
View File
@@ -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>
+1 -9
View File
@@ -3,6 +3,7 @@
/** /**
* @var Barryvdh\LaravelIdeHelper\Alias[][] $namespaces_by_alias_ns * @var Barryvdh\LaravelIdeHelper\Alias[][] $namespaces_by_alias_ns
* @var Barryvdh\LaravelIdeHelper\Alias[][] $namespaces_by_extends_ns * @var Barryvdh\LaravelIdeHelper\Alias[][] $namespaces_by_extends_ns
* @var string[] $real_time_facades
* @var bool $include_fluent * @var bool $include_fluent
* @var string $helpers * @var string $helpers
*/ */
@@ -119,12 +120,3 @@ namespace Illuminate\Support {
} }
<?php endif ?> <?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
View File
@@ -1,4 +1,16 @@
<?= '<?php' ?> <?= '<?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 */ /* @noinspection ALL */
// @formatter:off // @formatter:off
@@ -35,15 +47,6 @@ namespace PHPSTORM_META {
])); ]));
<?php endforeach; ?> <?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::mock(0), map(["" => "@&\Mockery\MockInterface"]));
override(\Illuminate\Foundation\Testing\Concerns\InteractsWithContainer::partialMock(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)); override(\Illuminate\Foundation\Testing\Concerns\InteractsWithContainer::instance(0), type(1));
@@ -79,7 +82,7 @@ namespace PHPSTORM_META {
override(\tap(0), type(0)); override(\tap(0), type(0));
override(\optional(0), type(0)); override(\optional(0), type(0));
<?php if (isset($expectedArgumentSets)): ?> <?php if ($expectedArgumentSets): ?>
<?php foreach ($expectedArgumentSets as $name => $argumentsList) : ?> <?php foreach ($expectedArgumentSets as $name => $argumentsList) : ?>
registerArgumentsSet('<?= $name ?>', <?php foreach ($argumentsList as $i => $arg) : ?><?php if ($i % 5 == 0) { registerArgumentsSet('<?= $name ?>', <?php foreach ($argumentsList as $i => $arg) : ?><?php if ($i % 5 == 0) {
echo "\n"; echo "\n";
@@ -87,7 +90,7 @@ namespace PHPSTORM_META {
<?php endforeach; ?> <?php endforeach; ?>
<?php endif ?> <?php endif ?>
<?php if (isset($expectedArguments)) : ?> <?php if ($expectedArguments) : ?>
<?php foreach ($expectedArguments as $arguments) : ?> <?php foreach ($expectedArguments as $arguments) : ?>
<?php <?php
$classes = isset($arguments['class']) ? (array) $arguments['class'] : [null]; $classes = isset($arguments['class']) ? (array) $arguments['class'] : [null];
+1 -6
View File
@@ -325,9 +325,8 @@ class Alias
/** /**
* Get the real root of a facade * Get the real root of a facade
* *
* @return bool|string
*/ */
protected function detectRoot() protected function detectRoot(): void
{ {
$facade = $this->facade; $facade = $this->facade;
@@ -386,7 +385,6 @@ class Alias
if ($class !== $this->root) { if ($class !== $this->root) {
$this->methods[] = new Method( $this->methods[] = new Method(
$method, $method,
$this->alias,
$class, $class,
$magic, $magic,
$this->interfaces, $this->interfaces,
@@ -403,7 +401,6 @@ class Alias
/** /**
* Get the methods for one or multiple classes. * Get the methods for one or multiple classes.
* *
* @return string
*/ */
protected function detectMethods() protected function detectMethods()
{ {
@@ -419,7 +416,6 @@ class Alias
if ($this->extends !== $class && substr($method->name, 0, 2) !== '__') { if ($this->extends !== $class && substr($method->name, 0, 2) !== '__') {
$this->methods[] = new Method( $this->methods[] = new Method(
$method, $method,
$this->alias,
$reflection, $reflection,
$method->name, $method->name,
$this->interfaces, $this->interfaces,
@@ -449,7 +445,6 @@ class Alias
// Add macros // Add macros
$this->methods[] = new Macro( $this->methods[] = new Macro(
$method, $method,
$this->alias,
$reflection, $reflection,
$macro_name, $macro_name,
$this->interfaces, $this->interfaces,
-5
View File
@@ -11,7 +11,6 @@
namespace Barryvdh\LaravelIdeHelper\Console; namespace Barryvdh\LaravelIdeHelper\Console;
use Barryvdh\LaravelIdeHelper\Factories;
use Dotenv\Parser\Entry; use Dotenv\Parser\Entry;
use Dotenv\Parser\Parser; use Dotenv\Parser\Parser;
use Illuminate\Console\Command; use Illuminate\Console\Command;
@@ -108,9 +107,6 @@ class MetaCommand extends Command
*/ */
public function handle() 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(); $ourAutoloader = $this->registerClassAutoloadExceptions();
$bindings = []; $bindings = [];
@@ -149,7 +145,6 @@ class MetaCommand extends Command
$content = $this->view->make('ide-helper::meta', [ $content = $this->view->make('ide-helper::meta', [
'bindings' => $bindings, 'bindings' => $bindings,
'methods' => $this->methods, 'methods' => $this->methods,
'factories' => $factories,
'configMethods' => $this->configMethods, 'configMethods' => $this->configMethods,
'configValues' => $configValues, 'configValues' => $configValues,
'expectedArgumentSets' => $this->getExpectedArgumentSets(), 'expectedArgumentSets' => $this->getExpectedArgumentSets(),
+2 -1
View File
@@ -1133,6 +1133,7 @@ class ModelsCommand extends Command
$serializer = new DocBlockSerializer(); $serializer = new DocBlockSerializer();
$docComment = $serializer->getDocComment($phpdoc); $docComment = $serializer->getDocComment($phpdoc);
$mixinClassName = null;
if ($this->write_mixin) { if ($this->write_mixin) {
$phpdocMixin = new DocBlock($reflection, new Context($namespace)); $phpdocMixin = new DocBlock($reflection, new Context($namespace));
@@ -1680,7 +1681,7 @@ class ModelsCommand extends Command
preg_match( preg_match(
'/@param ((?:(?:[\w?|\\\\<>])+(?:\[])?)+)/', '/@param ((?:(?:[\w?|\\\\<>])+(?:\[])?)+)/',
$docComment ?? '', $docComment,
$matches $matches
); );
$type = $matches[1] ?? ''; $type = $matches[1] ?? '';
-35
View File
@@ -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
View File
@@ -74,7 +74,7 @@ class Generator
/** /**
* Generate the helper file contents; * Generate the helper file contents;
* *
* @return string; * @return string
*/ */
public function generate() public function generate()
{ {
@@ -85,7 +85,6 @@ class Generator
->with('real_time_facades', $this->getRealTimeFacades()) ->with('real_time_facades', $this->getRealTimeFacades())
->with('helpers', $this->detectHelpers()) ->with('helpers', $this->detectHelpers())
->with('include_fluent', $this->config->get('ide-helper.include_fluent', true)) ->with('include_fluent', $this->config->get('ide-helper.include_fluent', true))
->with('factories', $this->config->get('ide-helper.include_factory_builders') ? Factories::all() : [])
->render(); ->render();
} }
+2 -4
View File
@@ -15,7 +15,6 @@ class Macro extends Method
* Macro constructor. * Macro constructor.
* *
* @param \ReflectionFunctionAbstract $method * @param \ReflectionFunctionAbstract $method
* @param string $alias
* @param \ReflectionClass $class * @param \ReflectionClass $class
* @param null $methodName * @param null $methodName
* @param array $interfaces * @param array $interfaces
@@ -24,14 +23,13 @@ class Macro extends Method
*/ */
public function __construct( public function __construct(
$method, $method,
$alias,
$class, $class,
$methodName = null, $methodName = null,
$interfaces = [], $interfaces = [],
$classAliases = [], $classAliases = [],
$returnTypeNormalizers = [] $returnTypeNormalizers = []
) { ) {
parent::__construct($method, $alias, $class, $methodName, $interfaces, $classAliases, $returnTypeNormalizers); parent::__construct($method, $class, $methodName, $interfaces, $classAliases, $returnTypeNormalizers);
} }
public static function setDefaultReturnTypes(array $map = []) public static function setDefaultReturnTypes(array $map = [])
@@ -75,8 +73,8 @@ class Macro extends Method
$type = $this->concatReflectionTypes($return); $type = $this->concatReflectionTypes($return);
/** @psalm-suppress UndefinedClass */
if (!$return instanceof \ReflectionUnionType) { if (!$return instanceof \ReflectionUnionType) {
/** @phpstan-ignore method.notFound */
$type .= $this->root === "\\{$builder}" && $return->getName() === $builder ? '|static' : ''; $type .= $this->root === "\\{$builder}" && $return->getName() === $builder ? '|static' : '';
$type .= $return->allowsNull() ? '|null' : ''; $type .= $return->allowsNull() ? '|null' : '';
} }
+1 -2
View File
@@ -44,7 +44,6 @@ class Method
/** /**
* @param \ReflectionMethod|\ReflectionFunctionAbstract $method * @param \ReflectionMethod|\ReflectionFunctionAbstract $method
* @param string $alias
* @param \ReflectionClass $class * @param \ReflectionClass $class
* @param string|null $methodName * @param string|null $methodName
* @param array $interfaces * @param array $interfaces
@@ -52,7 +51,7 @@ class Method
* @param array $returnTypeNormalizers * @param array $returnTypeNormalizers
* @param string[] $templateNames * @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->method = $method;
$this->interfaces = $interfaces; $this->interfaces = $interfaces;
-18
View File
@@ -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
View File
@@ -284,7 +284,7 @@ class MacroTest extends TestCase
{ {
$reflectionMethod = new \ReflectionMethod(UrlGeneratorMacroClass::class, '__invoke'); $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); $this->assertInstanceOf(Macro::class, $macro);
} }
@@ -296,7 +296,7 @@ class MacroTest extends TestCase
{ {
$reflectionMethod = new \ReflectionMethod(UrlGeneratorMacroClass::class, '__invoke'); $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' $output = <<<'DOC'
/** /**
* @param string $foo * @param string $foo
@@ -331,7 +331,7 @@ class MacroMock extends Macro
public function getPhpDoc(ReflectionFunctionAbstract $method, ?ReflectionClass $class = null): DocBlock 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;
} }
} }
+8 -8
View File
@@ -19,7 +19,7 @@ class MethodTest extends TestCase
$reflectionClass = new \ReflectionClass(ExampleClass::class); $reflectionClass = new \ReflectionClass(ExampleClass::class);
$reflectionMethod = $reflectionClass->getMethod('setName'); $reflectionMethod = $reflectionClass->getMethod('setName');
$method = new Method($reflectionMethod, 'Example', $reflectionClass); $method = new Method($reflectionMethod, $reflectionClass);
$this->assertInstanceOf(Method::class, $method); $this->assertInstanceOf(Method::class, $method);
} }
@@ -32,7 +32,7 @@ class MethodTest extends TestCase
$reflectionClass = new \ReflectionClass(ExampleClass::class); $reflectionClass = new \ReflectionClass(ExampleClass::class);
$reflectionMethod = $reflectionClass->getMethod('setName'); $reflectionMethod = $reflectionClass->getMethod('setName');
$method = new Method($reflectionMethod, 'Example', $reflectionClass); $method = new Method($reflectionMethod, $reflectionClass);
$output = <<<'DOC' $output = <<<'DOC'
/** /**
@@ -60,7 +60,7 @@ DOC;
$reflectionClass = new \ReflectionClass(EloquentBuilder::class); $reflectionClass = new \ReflectionClass(EloquentBuilder::class);
$reflectionMethod = $reflectionClass->getMethod('upsert'); $reflectionMethod = $reflectionClass->getMethod('upsert');
$method = new Method($reflectionMethod, 'Builder', $reflectionClass); $method = new Method($reflectionMethod, $reflectionClass);
$output = <<<'DOC' $output = <<<'DOC'
/** /**
@@ -92,7 +92,7 @@ DOC;
$reflectionClass = new \ReflectionClass(EloquentBuilder::class); $reflectionClass = new \ReflectionClass(EloquentBuilder::class);
$reflectionMethod = $reflectionClass->getMethod('where'); $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' $output = <<<'DOC'
/** /**
@@ -123,7 +123,7 @@ DOC;
$reflectionClass = new \ReflectionClass(QueryBuilder::class); $reflectionClass = new \ReflectionClass(QueryBuilder::class);
$reflectionMethod = $reflectionClass->getMethod('whereNull'); $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' $output = <<<'DOC'
/** /**
@@ -154,7 +154,7 @@ DOC;
$reflectionClass = new \ReflectionClass(ExampleClass::class); $reflectionClass = new \ReflectionClass(ExampleClass::class);
$reflectionMethod = $reflectionClass->getMethod('setSpecialChars'); $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(true));
$this->assertSame(['$chars'], $method->getParams(false)); $this->assertSame(['$chars'], $method->getParams(false));
$this->assertSame('$chars = \'$\\\'\\\\\'', $method->getParamsWithDefault(true)); $this->assertSame('$chars = \'$\\\'\\\\\'', $method->getParamsWithDefault(true));
@@ -169,7 +169,7 @@ DOC;
$reflectionClass = new \ReflectionClass(ExampleClass::class); $reflectionClass = new \ReflectionClass(ExampleClass::class);
$reflectionMethod = $reflectionClass->getMethod('getApplication'); $reflectionMethod = $reflectionClass->getMethod('getApplication');
$method = new Method($reflectionMethod, 'Example', $reflectionClass, null, [], [ $method = new Method($reflectionMethod, $reflectionClass, null, [], [
'Application' => '\\Illuminate\\Foundation\\Application', 'Application' => '\\Illuminate\\Foundation\\Application',
]); ]);
@@ -195,7 +195,7 @@ DOC;
$reflectionClass = new \ReflectionClass(EloquentBuilder::class); $reflectionClass = new \ReflectionClass(EloquentBuilder::class);
$reflectionMethod = $reflectionClass->getMethod('firstOr'); $reflectionMethod = $reflectionClass->getMethod('firstOr');
$method = new Method($reflectionMethod, 'Builder', $reflectionClass, null, [], [], [], ['TModel']); $method = new Method($reflectionMethod, $reflectionClass, null, [], [], [], ['TModel']);
$output = <<<'DOC' $output = <<<'DOC'
/** /**