chore(deps): bump glob-parent from 3.1.0 to 5.1.2 in /extensions/emoji/js (#3345)

* chore(deps): bump glob-parent in /extensions/emoji/js

Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 3.1.0 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply fixes from StyleCI

[ci skip] [skip ci]

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
This commit is contained in:
dependabot[bot] 2022-03-11 18:11:20 -05:00 committed by GitHub
parent 379c06332a
commit 37a882118a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
128 changed files with 9645 additions and 11730 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,10 @@
<?php
/*
* This file is part of flarum/nickname.
* This file is part of Flarum.
*
* Copyright (c) 2020 Flarum.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Nicknames;
@ -21,12 +19,12 @@ use Flarum\User\UserValidator;
return [
(new Extend\Frontend('forum'))
->js(__DIR__ . '/js/dist/forum.js'),
->js(__DIR__.'/js/dist/forum.js'),
(new Extend\Frontend('admin'))
->js(__DIR__ . '/js/dist/admin.js'),
->js(__DIR__.'/js/dist/admin.js'),
new Extend\Locales(__DIR__ . '/locale'),
new Extend\Locales(__DIR__.'/locale'),
(new Extend\User())
->displayNameDriver('nickname', NicknameDriver::class),

View File

@ -1,18 +1,25 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;
return [
'up' => function(Builder $schema) {
if (!$schema->hasColumn('users', 'nickname')) {
$schema->table('users', function (Blueprint $table) use ($schema) {
'up' => function (Builder $schema) {
if (! $schema->hasColumn('users', 'nickname')) {
$schema->table('users', function (Blueprint $table) {
$table->string('nickname', 150)->after('username')->index()->nullable();
});
}
},
'down' => function(Builder $schema) {
$schema->table('users', function (Blueprint $table) use ($schema) {
'down' => function (Builder $schema) {
$schema->table('users', function (Blueprint $table) {
$table->dropColumn('nickname');
});
}

View File

@ -1,5 +1,12 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;

View File

@ -32,11 +32,11 @@ class UserPolicy extends AbstractPolicy
*/
public function editNickname(User $actor, User $user)
{
if ($actor->isGuest() && !$user->exists && $this->settings->get('flarum-nicknames.set_on_registration')) {
if ($actor->isGuest() && ! $user->exists && $this->settings->get('flarum-nicknames.set_on_registration')) {
return $this->allow();
} else if ($actor->id === $user->id && $actor->hasPermission('user.editOwnNickname')) {
} elseif ($actor->id === $user->id && $actor->hasPermission('user.editOwnNickname')) {
return $this->allow();
} else if ($actor->can('edit', $user)) {
} elseif ($actor->can('edit', $user)) {
return $this->allow();
}
}

View File

@ -1,5 +1,11 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Nicknames;
@ -19,7 +25,6 @@ class AddNicknameValidation
*/
protected $translator;
public function __construct(SettingsRepositoryInterface $settings, TranslatorInterface $translator)
{
$this->settings = $settings;
@ -34,12 +39,12 @@ class AddNicknameValidation
$rules['nickname'] = [
function ($attribute, $value, $fail) {
$regex = $this->settings->get('flarum-nicknames.regex');
if ($regex && !preg_match_all("/$regex/", $value)) {
if ($regex && ! preg_match_all("/$regex/", $value)) {
$this->translator->trans('flarum-nicknames.api.invalid_nickname_message');
}
},
'min:' . $this->settings->get('flarum-nicknames.min'),
'max:' . $this->settings->get('flarum-nicknames.max'),
'min:'.$this->settings->get('flarum-nicknames.min'),
'max:'.$this->settings->get('flarum-nicknames.max'),
'nullable'
];

View File

@ -1,12 +1,19 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Nicknames;
use Flarum\User\DisplayName\DriverInterface;
use Flarum\User\User;
class NicknameDriver implements DriverInterface {
class NicknameDriver implements DriverInterface
{
public function displayName(User $user): string
{
return $user->nickname ? $user->nickname : $user->username;

View File

@ -1,5 +1,11 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Nicknames;
@ -14,7 +20,6 @@ use Flarum\Search\GambitInterface;
use Flarum\Search\SearchState;
use Flarum\User\UserRepository;
class NicknameFullTextGambit implements GambitInterface
{
/**
@ -40,7 +45,7 @@ class NicknameFullTextGambit implements GambitInterface
->query()
->select('id')
->where('username', 'like', "{$searchValue}%")
->orWhere('nickname', 'like',"{$searchValue}%");
->orWhere('nickname', 'like', "{$searchValue}%");
}
/**

View File

@ -1,19 +1,27 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Nicknames;
use Flarum\Settings\SettingsRepositoryInterface;
use Flarum\User\Event\Saving;
use Flarum\User\Exception\PermissionDeniedException;
use Illuminate\Support\Arr;
class SaveNicknameToDatabase {
class SaveNicknameToDatabase
{
/**
* @var SettingsRepositoryInterface
*/
protected $settings;
public function __construct(SettingsRepositoryInterface $settings) {
public function __construct(SettingsRepositoryInterface $settings)
{
$this->settings = $settings;
}

View File

@ -13,9 +13,9 @@ use Flarum\Extend;
use Flarum\Foundation\Paths;
use Flarum\Frontend\Document;
use Flarum\PackageManager\Exception\ComposerCommandFailedException;
use Flarum\PackageManager\Exception\ExceptionHandler;
use Flarum\PackageManager\Exception\ComposerRequireFailedException;
use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use Flarum\PackageManager\Exception\ExceptionHandler;
use Flarum\PackageManager\Exception\MajorUpdateFailedException;
use Flarum\PackageManager\Settings\LastUpdateCheck;
use Flarum\PackageManager\Settings\LastUpdateRun;
@ -32,8 +32,8 @@ return [
->post('/package-manager/global-update', 'package-manager.global-update', Api\Controller\GlobalUpdateController::class),
(new Extend\Frontend('admin'))
->css(__DIR__ . '/less/admin.less')
->js(__DIR__ . '/js/dist/admin.js')
->css(__DIR__.'/less/admin.less')
->js(__DIR__.'/js/dist/admin.js')
->content(function (Document $document) {
$paths = resolve(Paths::class);
@ -43,7 +43,7 @@ return [
&& is_writable($paths->base.'/composer.lock');
}),
new Extend\Locales(__DIR__ . '/locale'),
new Extend\Locales(__DIR__.'/locale'),
(new Extend\Settings())
->default(LastUpdateCheck::key(), json_encode(LastUpdateCheck::default()))

View File

@ -1,5 +1,12 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
use Flarum\Database\Migration;
use Illuminate\Database\Schema\Blueprint;

View File

@ -10,13 +10,12 @@
namespace Flarum\PackageManager\Api\Controller;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Command\CheckForUpdates;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Flarum\PackageManager\Command\CheckForUpdates;
class CheckForUpdatesController implements RequestHandlerInterface
{

View File

@ -11,11 +11,11 @@ namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Command\GlobalUpdate;
use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ServerRequestInterface;
use Flarum\PackageManager\Command\GlobalUpdate;
use Psr\Http\Server\RequestHandlerInterface;
class GlobalUpdateController implements RequestHandlerInterface
{

View File

@ -9,10 +9,10 @@
namespace Flarum\PackageManager\Api\Controller;
use Flarum\Api\Controller\AbstractListController;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Api\Serializer\TaskSerializer;
use Flarum\PackageManager\Task;
use Flarum\Api\Controller\AbstractListController;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;

View File

@ -11,12 +11,12 @@ namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Command\MajorUpdate;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Illuminate\Support\Arr;
use Psr\Http\Message\ServerRequestInterface;
use Flarum\PackageManager\Command\MajorUpdate;
use Psr\Http\Server\RequestHandlerInterface;
class MajorUpdateController implements RequestHandlerInterface
{

View File

@ -11,11 +11,11 @@ namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Command\MinorUpdate;
use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ServerRequestInterface;
use Flarum\PackageManager\Command\MinorUpdate;
use Psr\Http\Server\RequestHandlerInterface;
class MinorUpdateController implements RequestHandlerInterface
{

View File

@ -11,11 +11,11 @@ namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Command\RemoveExtension;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Flarum\PackageManager\Command\RemoveExtension;
use Psr\Http\Server\RequestHandlerInterface;
class RemoveExtensionController implements RequestHandlerInterface

View File

@ -10,17 +10,13 @@
namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Command\RequireExtension;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Flarum\PackageManager\Api\Serializer\ExtensionSerializer;
use Flarum\PackageManager\Command\RequireExtension;
use Flarum\PackageManager\Extension\ExtensionUtils;
use Flarum\Api\Controller\AbstractCreateController;
use Flarum\Http\RequestUtil;
use Illuminate\Support\Arr;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;
use Psr\Http\Server\RequestHandlerInterface;
class RequireExtensionController implements RequestHandlerInterface
{

View File

@ -11,12 +11,12 @@ namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Command\UpdateExtension;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Illuminate\Support\Arr;
use Psr\Http\Message\ServerRequestInterface;
use Flarum\PackageManager\Command\UpdateExtension;
use Psr\Http\Server\RequestHandlerInterface;
class UpdateExtensionController implements RequestHandlerInterface
{

View File

@ -15,8 +15,8 @@ use Flarum\PackageManager\Command\WhyNot;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
class WhyNotController implements RequestHandlerInterface
{

View File

@ -33,7 +33,7 @@ class CheckForUpdatesHandler
}
/**
* We run two commands here
* We run two commands here.
*
* `composer outdated -D --format json`
* This queries latest versions for all direct packages, so it can include major updates,

View File

@ -11,9 +11,9 @@ namespace Flarum\PackageManager\Command;
use Flarum\Bus\Dispatcher as FlarumDispatcher;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Input\StringInput;
class GlobalUpdateHandler
@ -48,7 +48,7 @@ class GlobalUpdateHandler
$command->actor->assertAdmin();
$output = $this->composer->run(
new StringInput("update --prefer-dist --no-dev -a --with-all-dependencies")
new StringInput('update --prefer-dist --no-dev -a --with-all-dependencies')
);
if ($output->getExitCode() !== 0) {

View File

@ -11,11 +11,11 @@ namespace Flarum\PackageManager\Command;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Flarum\PackageManager\Composer\ComposerJson;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Exception\MajorUpdateFailedException;
use Flarum\PackageManager\Exception\NoNewMajorVersionException;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Settings\LastUpdateCheck;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Input\ArrayInput;
class MajorUpdateHandler

View File

@ -11,10 +11,10 @@ namespace Flarum\PackageManager\Command;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Flarum\PackageManager\Composer\ComposerJson;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use Flarum\PackageManager\Settings\LastUpdateCheck;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Input\StringInput;
class MinorUpdateHandler
@ -61,7 +61,7 @@ class MinorUpdateHandler
$this->composerJson->require('flarum/core', $coreRequirement);
$output = $this->composer->run(
new StringInput("update --prefer-dist --no-dev -a --with-all-dependencies")
new StringInput('update --prefer-dist --no-dev -a --with-all-dependencies')
);
if ($output->getExitCode() !== 0) {

View File

@ -11,10 +11,10 @@ namespace Flarum\PackageManager\Command;
use Flarum\Extension\ExtensionManager;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\PackageManager\Exception\ComposerCommandFailedException;
use Flarum\PackageManager\Exception\ExtensionNotInstalledException;
use Flarum\PackageManager\Extension\Event\Removed;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Input\StringInput;
class RemoveExtensionHandler

View File

@ -11,12 +11,12 @@ namespace Flarum\PackageManager\Command;
use Flarum\Extension\ExtensionManager;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\PackageManager\Exception\ComposerRequireFailedException;
use Flarum\PackageManager\Exception\ExtensionAlreadyInstalledException;
use Flarum\PackageManager\Extension\Event\Installed;
use Flarum\PackageManager\Extension\ExtensionUtils;
use Flarum\PackageManager\RequirePackageValidator;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Input\StringInput;
class RequireExtensionHandler
@ -70,7 +70,7 @@ class RequireExtensionHandler
// Auto append :* if not requiring a specific version.
if (strpos($packageName, ':') === false) {
$packageName .= ":*";
$packageName .= ':*';
}
$output = $this->composer->run(

View File

@ -11,12 +11,12 @@ namespace Flarum\PackageManager\Command;
use Flarum\Extension\ExtensionManager;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use Flarum\PackageManager\Exception\ExtensionNotInstalledException;
use Flarum\PackageManager\Extension\Event\Updated;
use Flarum\PackageManager\UpdateExtensionValidator;
use Flarum\PackageManager\Settings\LastUpdateCheck;
use Flarum\PackageManager\UpdateExtensionValidator;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Input\StringInput;
class UpdateExtensionHandler
@ -51,7 +51,8 @@ class UpdateExtensionHandler
ExtensionManager $extensions,
UpdateExtensionValidator $validator,
LastUpdateCheck $lastUpdateCheck,
Dispatcher $events)
Dispatcher $events
)
{
$this->composer = $composer;
$this->extensions = $extensions;

View File

@ -10,9 +10,9 @@
namespace Flarum\PackageManager\Command;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\PackageManager\Exception\ComposerRequireFailedException;
use Flarum\PackageManager\WhyNotValidator;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Input\StringInput;
class WhyNotHandler

View File

@ -66,7 +66,7 @@ class ComposerJson
protected function getComposerJsonPath(): string
{
return $this->paths->base . '/composer.json';
return $this->paths->base.'/composer.json';
}
/**

View File

@ -16,7 +16,7 @@ class NoNewMajorVersionException extends Exception implements KnownError
{
public function __construct()
{
parent::__construct("No new major version known of. Try checking for updates first.");
parent::__construct('No new major version known of. Try checking for updates first.');
}
public function getType(): string

View File

@ -17,15 +17,15 @@ use Flarum\Foundation\Paths;
use Flarum\Frontend\RecompileFrontendAssets;
use Flarum\Locale\LocaleManager;
use Flarum\PackageManager\Composer\ComposerAdapter;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Extension\Event\Updated;
use Flarum\PackageManager\Listener\ClearCacheAfterUpdate;
use Flarum\PackageManager\Listener\ReCheckForUpdates;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Events\Dispatcher;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Extension\Event\Updated;
use Flarum\PackageManager\Listener\ClearCacheAfterUpdate;
class PackageManagerServiceProvider extends AbstractServiceProvider
{
@ -42,7 +42,7 @@ class PackageManagerServiceProvider extends AbstractServiceProvider
putenv("COMPOSER_HOME={$paths->storage}/.composer");
putenv("COMPOSER={$paths->base}/composer.json");
putenv("COMPOSER_DISABLE_XDEBUG_WARN=1");
putenv('COMPOSER_DISABLE_XDEBUG_WARN=1');
Config::$defaultConfig['vendor-dir'] = $paths->vendor;
// When running simple require, update and remove commands on packages,

View File

@ -12,7 +12,6 @@ namespace Flarum\PackageManager\Settings;
use Carbon\Carbon;
use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
class LastUpdateCheck implements JsonSetting
{

View File

@ -39,7 +39,7 @@ class LastUpdateRun implements JsonSetting
public function for(string $update): self
{
if (! in_array($update, [FlarumUpdated::MAJOR, FlarumUpdated::MINOR, FlarumUpdated::GLOBAL])) {
throw new \InvalidArgumentException("Last update runs can only be for one of: minor, major, global");
throw new \InvalidArgumentException('Last update runs can only be for one of: minor, major, global');
}
$this->activeUpdate = $update;

View File

@ -1,5 +1,12 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PackageManager\Tests\integration;
trait ChangeComposerConfig

View File

@ -9,19 +9,17 @@
namespace Flarum\PackageManager\Tests\integration;
use Flarum\Foundation\Paths;
trait DummyExtensions
{
protected function makeDummyExtensionCompatibleWith(string $name, string $coreVersions): void
{
$dirName = $this->tmpDir() . "/packages/" . str_replace('/', '-', $name);
$dirName = $this->tmpDir().'/packages/'.str_replace('/', '-', $name);
if (! file_exists($dirName)) {
mkdir($dirName);
}
file_put_contents($dirName."/composer.json", json_encode([
file_put_contents($dirName.'/composer.json', json_encode([
'name' => $name,
'version' => '1.0.0',
'require' => [

View File

@ -37,8 +37,8 @@ trait RefreshComposerSetup
$it = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);
$files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
foreach($files as $file) {
if ($file->isDir()){
foreach ($files as $file) {
if ($file->isDir()) {
rmdir($file->getRealPath());
} else {
unlink($file->getRealPath());

View File

@ -16,7 +16,8 @@ use Illuminate\Support\Arr;
class CheckForUpdatesTest extends TestCase
{
use RefreshComposerSetup, ChangeComposerConfig;
use RefreshComposerSetup;
use ChangeComposerConfig;
/**
* @test

View File

@ -16,14 +16,16 @@ use Flarum\PackageManager\Tests\integration\TestCase;
class MajorUpdateTest extends TestCase
{
use RefreshComposerSetup, ChangeComposerConfig, DummyExtensions;
use RefreshComposerSetup;
use ChangeComposerConfig;
use DummyExtensions;
/**
* @test
*/
public function cannot_update_when_no_update_check_ran()
{
$this->makeDummyExtensionCompatibleWith("flarum/dummy-incompatible-extension", ">=0.1.0-beta.15 <=0.1.0-beta.16");
$this->makeDummyExtensionCompatibleWith('flarum/dummy-incompatible-extension', '>=0.1.0-beta.15 <=0.1.0-beta.16');
$this->setComposerConfig([
'require' => [
'flarum/core' => '^0.1.0-beta.15',
@ -48,7 +50,7 @@ class MajorUpdateTest extends TestCase
*/
public function can_update_when_major_update_available()
{
$this->makeDummyExtensionCompatibleWith("flarum/dummy-compatible-extension", "^0.1.0-beta.15 | ^1.0.0");
$this->makeDummyExtensionCompatibleWith('flarum/dummy-compatible-extension', '^0.1.0-beta.15 | ^1.0.0');
$this->setComposerConfig([
'require' => [
'flarum/core' => '^0.1.0-beta.15',
@ -80,9 +82,9 @@ class MajorUpdateTest extends TestCase
)[0]['latest-major'];
$this->assertEquals(200, $response->getStatusCode());
$this->assertPackageVersion("flarum/core", str_replace('v', '^', $newMinorCoreVersion));
$this->assertPackageVersion("flarum/tags", "*");
$this->assertPackageVersion("flarum/dummy-compatible-extension", "*");
$this->assertPackageVersion('flarum/core', str_replace('v', '^', $newMinorCoreVersion));
$this->assertPackageVersion('flarum/tags', '*');
$this->assertPackageVersion('flarum/dummy-compatible-extension', '*');
}
/**
@ -90,9 +92,9 @@ class MajorUpdateTest extends TestCase
*/
public function cannot_update_with_incompatible_extensions()
{
$this->makeDummyExtensionCompatibleWith("flarum/dummy-incompatible-extension-a", ">=0.1.0-beta.16 <0.1.0-beta.17");
$this->makeDummyExtensionCompatibleWith("flarum/dummy-incompatible-extension-b", ">=0.1.0-beta.16 <=0.1.0-beta.17");
$this->makeDummyExtensionCompatibleWith("flarum/dummy-incompatible-extension-c", "0.1.0-beta.16");
$this->makeDummyExtensionCompatibleWith('flarum/dummy-incompatible-extension-a', '>=0.1.0-beta.16 <0.1.0-beta.17');
$this->makeDummyExtensionCompatibleWith('flarum/dummy-incompatible-extension-b', '>=0.1.0-beta.16 <=0.1.0-beta.17');
$this->makeDummyExtensionCompatibleWith('flarum/dummy-incompatible-extension-c', '0.1.0-beta.16');
$this->setComposerConfig([
'require' => [
'flarum/core' => '^0.1.0-beta.16',

View File

@ -18,14 +18,16 @@ use Flarum\PackageManager\Tests\integration\TestCase;
class MinorUpdateTest extends TestCase
{
use RefreshComposerSetup, ChangeComposerConfig, DummyExtensions;
use RefreshComposerSetup;
use ChangeComposerConfig;
use DummyExtensions;
/**
* @test--
*/
public function can_update_to_next_minor_version()
{
$this->makeDummyExtensionCompatibleWith("flarum/dummy-compatible-extension", "^1.0.0");
$this->makeDummyExtensionCompatibleWith('flarum/dummy-compatible-extension', '^1.0.0');
$this->setComposerConfig([
'require' => [
// The only reason we don't set this to `^1.0.0` and let it update to latest minor,
@ -56,7 +58,7 @@ class MinorUpdateTest extends TestCase
*/
public function can_update_with_latest_ext_incompatible_with_latest_core()
{
$this->makeDummyExtensionCompatibleWith("flarum/dummy-extension", "1.0.0");
$this->makeDummyExtensionCompatibleWith('flarum/dummy-extension', '1.0.0');
$this->setComposerConfig([
'require' => [
'flarum/core' => '>=1.0.0 <=1.1.0',
@ -84,8 +86,8 @@ class MinorUpdateTest extends TestCase
$lastUpdateRun = $this->app()->getContainer()->make(LastUpdateRun::class);
$this->assertEquals(200, $response->getStatusCode());
$this->assertPackageVersion("flarum/tags", "*");
$this->assertPackageVersion("flarum/dummy-extension", "*");
$this->assertPackageVersion('flarum/tags', '*');
$this->assertPackageVersion('flarum/dummy-extension', '*');
$this->assertEquals([
'flarum/core',
'flarum/lang-english',

View File

@ -7,8 +7,8 @@
* LICENSE file that was distributed with this source code.
*/
use Flarum\Testing\integration\Setup\SetupScript;
use Flarum\PackageManager\Tests\integration\SetupComposer;
use Flarum\Testing\integration\Setup\SetupScript;
require __DIR__.'/../../vendor/autoload.php';

View File

@ -3,10 +3,8 @@
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
use Flarum\Extend;

View File

@ -3,10 +3,8 @@
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Statistics;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Concerns;
use Illuminate\Container\Container;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Concerns;
use Illuminate\Config\Repository as ConfigRepository;

View File

@ -1,11 +1,10 @@
<?php
/*
* This file is part of PhpStorm.
* This file is part of Flarum.
*
* (c) Nuno Maduro <enunomaduro@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Contracts\Methods;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Contracts\Methods\Pipes;
use Closure;

View File

@ -1,11 +1,10 @@
<?php
/*
* This file is part of PhpStorm.
* This file is part of Flarum.
*
* (c) Nuno Maduro <enunomaduro@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Contracts\Types;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Contracts\Types\Pipes;
use Closure;

View File

@ -2,15 +2,22 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Support\Str;
use Flarum\PHPStan\Reflection\AnnotationScopeMethodParameterReflection;
use Flarum\PHPStan\Reflection\AnnotationScopeMethodReflection;
use Flarum\PHPStan\Reflection\DynamicWhereParameterReflection;
use Flarum\PHPStan\Reflection\EloquentBuilderMethodReflection;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Support\Str;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\MissingMethodFromReflectionException;
@ -83,7 +90,10 @@ class BuilderHelper
$finder = substr($methodName, 5);
$segments = preg_split(
'/(And|Or)(?=[A-Z])/', $finder, -1, PREG_SPLIT_DELIM_CAPTURE
'/(And|Or)(?=[A-Z])/',
$finder,
-1,
PREG_SPLIT_DELIM_CAPTURE
);
if ($segments !== false) {

View File

@ -2,12 +2,19 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods;
use Flarum\PHPStan\Reflection\EloquentBuilderMethodReflection;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Flarum\PHPStan\Reflection\EloquentBuilderMethodReflection;
use PHPStan\Analyser\OutOfClassScope;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\MethodReflection;
@ -131,7 +138,8 @@ final class EloquentBuilderForwardsCallsExtension implements MethodsClassReflect
$returnType = $parametersAcceptor->getReturnType();
return new EloquentBuilderMethodReflection(
$methodName, $classReflection,
$methodName,
$classReflection,
$ref,
$parametersAcceptor->getParameters(),
$returnType,
@ -142,7 +150,8 @@ final class EloquentBuilderForwardsCallsExtension implements MethodsClassReflect
// Returning custom reflection
// to ensure return type is always `EloquentBuilder<Model>`
return new EloquentBuilderMethodReflection(
$methodName, $classReflection,
$methodName,
$classReflection,
$ref,
$parametersAcceptor->getParameters(),
new GenericObjectType($classReflection->getName(), [$modelType]),

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods;
use Illuminate\Database\Eloquent\Model;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods;
use Flarum\PHPStan\Support\HigherOrderCollectionProxyHelper;
@ -39,8 +46,7 @@ final class HigherOrderCollectionProxyExtension implements MethodsClassReflectio
$returnType = HigherOrderCollectionProxyHelper::determineReturnType($methodType->getValue(), $valueType, $modelMethodReturnType);
return new class($classReflection, $methodName, $modelMethodReflection, $returnType) implements MethodReflection
{
return new class($classReflection, $methodName, $modelMethodReflection, $returnType) implements MethodReflection {
/** @var ClassReflection */
private $classReflection;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods;
use Illuminate\Support\HigherOrderTapProxy;

View File

@ -2,11 +2,18 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods;
use Illuminate\Pipeline\Pipeline;
use Flarum\PHPStan\Concerns;
use Flarum\PHPStan\Contracts\Methods\PassableContract;
use Illuminate\Pipeline\Pipeline;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\Php\PhpMethodReflectionFactory;
use PHPStan\Reflection\ReflectionProvider;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods;
use function array_map;
@ -151,8 +158,7 @@ final class Macro implements MethodReflection
public function getParameters(): array
{
return array_map(function (ReflectionParameter $reflection): ParameterReflection {
return new class($reflection) implements ParameterReflection
{
return new class($reflection) implements ParameterReflection {
/**
* @var ReflectionParameter
*/

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods;
use Illuminate\Database\Eloquent\Factories\Factory;
@ -56,8 +63,7 @@ class ModelFactoryMethodsClassReflectionExtension implements MethodsClassReflect
ClassReflection $classReflection,
string $methodName
): MethodReflection {
return new class($classReflection, $methodName) implements MethodReflection
{
return new class($classReflection, $methodName) implements MethodReflection {
/** @var ClassReflection */
private $classReflection;

View File

@ -2,11 +2,18 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods;
use Flarum\PHPStan\Reflection\EloquentBuilderMethodReflection;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Flarum\PHPStan\Reflection\EloquentBuilderMethodReflection;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\MethodsClassReflectionExtension;
@ -88,8 +95,7 @@ final class ModelForwardsCallsExtension implements MethodsClassReflectionExtensi
if (in_array($methodName, ['increment', 'decrement'], true)) {
$methodReflection = $classReflection->getNativeMethod($methodName);
return new class($classReflection, $methodName, $methodReflection) implements MethodReflection
{
return new class($classReflection, $methodName, $methodReflection) implements MethodReflection {
/** @var ClassReflection */
private $classReflection;
@ -195,7 +201,8 @@ final class ModelForwardsCallsExtension implements MethodsClassReflectionExtensi
});
return new EloquentBuilderMethodReflection(
$methodName, $classReflection,
$methodName,
$classReflection,
$reflection,
$parametersAcceptor->getParameters(),
$returnType,

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods;
use Illuminate\Database\Eloquent\Model;

View File

@ -2,13 +2,20 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods;
use Flarum\PHPStan\Concerns;
use Flarum\PHPStan\Contracts\Methods\PassableContract;
use Illuminate\Contracts\Pipeline\Pipeline;
use LogicException;
use Mockery;
use Flarum\PHPStan\Concerns;
use Flarum\PHPStan\Contracts\Methods\PassableContract;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\Php\PhpMethodReflection;

View File

@ -2,16 +2,23 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods\Pipes;
use Closure;
use Flarum\PHPStan\Concerns;
use Flarum\PHPStan\Contracts\Methods\PassableContract;
use Flarum\PHPStan\Contracts\Methods\Pipes\PipeContract;
use Illuminate\Contracts\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Contracts\Auth\CanResetPassword;
use function in_array;
use Flarum\PHPStan\Concerns;
use Flarum\PHPStan\Contracts\Methods\PassableContract;
use Flarum\PHPStan\Contracts\Methods\Pipes\PipeContract;
/**
* @internal

View File

@ -2,14 +2,21 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods\Pipes;
use Closure;
use function get_class;
use Illuminate\Support\Str;
use Flarum\PHPStan\Concerns;
use Flarum\PHPStan\Contracts\Methods\PassableContract;
use Flarum\PHPStan\Contracts\Methods\Pipes\PipeContract;
use function get_class;
use Illuminate\Support\Str;
use PHPStan\Reflection\ClassReflection;
/**

View File

@ -2,13 +2,20 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods\Pipes;
use Closure;
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\Str;
use Flarum\PHPStan\Contracts\Methods\PassableContract;
use Flarum\PHPStan\Contracts\Methods\Pipes\PipeContract;
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\Str;
/**
* @internal

View File

@ -2,17 +2,24 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods\Pipes;
use Carbon\Traits\Macro as CarbonMacro;
use Closure;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Str;
use Illuminate\Support\Traits\Macroable;
use Flarum\PHPStan\Concerns;
use Flarum\PHPStan\Contracts\Methods\PassableContract;
use Flarum\PHPStan\Contracts\Methods\Pipes\PipeContract;
use Flarum\PHPStan\Methods\Macro;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Str;
use Illuminate\Support\Traits\Macroable;
use PHPStan\Reflection\ClassReflection;
/**
@ -80,7 +87,9 @@ final class Macros implements PipeContract
$reflectionFunction = new \ReflectionFunction($refProperty->getValue()[$passable->getMethodName()]);
$methodReflection = new Macro(
$classReflection, $passable->getMethodName(), $reflectionFunction
$classReflection,
$passable->getMethodName(),
$reflectionFunction
);
$methodReflection->setIsStatic(true);

View File

@ -2,14 +2,21 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods\Pipes;
use Closure;
use Illuminate\Support\Manager;
use InvalidArgumentException;
use Flarum\PHPStan\Concerns;
use Flarum\PHPStan\Contracts\Methods\PassableContract;
use Flarum\PHPStan\Contracts\Methods\Pipes\PipeContract;
use Illuminate\Support\Manager;
use InvalidArgumentException;
/**
* @internal

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods\Pipes;
use Closure;

View File

@ -2,13 +2,20 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods;
use Flarum\PHPStan\Reflection\EloquentBuilderMethodReflection;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\Relation;
use Flarum\PHPStan\Reflection\EloquentBuilderMethodReflection;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\MethodsClassReflectionExtension;
@ -122,16 +129,20 @@ final class RelationForwardsCallsExtension implements MethodsClassReflectionExte
if ((new ObjectType(Builder::class))->isSuperTypeOf($returnType)->yes()) {
return new EloquentBuilderMethodReflection(
$methodName, $classReflection,
$reflection, $parametersAcceptor->getParameters(),
$methodName,
$classReflection,
$reflection,
$parametersAcceptor->getParameters(),
new GenericObjectType($classReflection->getName(), $types),
$parametersAcceptor->isVariadic()
);
}
return new EloquentBuilderMethodReflection(
$methodName, $classReflection,
$reflection, $parametersAcceptor->getParameters(),
$methodName,
$classReflection,
$reflection,
$parametersAcceptor->getParameters(),
$returnType,
$parametersAcceptor->isVariadic()
);

View File

@ -2,12 +2,19 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Methods;
use Flarum\PHPStan\Reflection\StaticMethodReflection;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Filesystem\FilesystemManager;
use Illuminate\Support\Facades\Storage;
use Flarum\PHPStan\Reflection\StaticMethodReflection;
use PHPStan\Analyser\OutOfClassScope;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\MethodReflection;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Properties;
use Flarum\PHPStan\Support\HigherOrderCollectionProxyHelper;
@ -35,8 +42,7 @@ final class HigherOrderCollectionProxyPropertyExtension implements PropertiesCla
$returnType = HigherOrderCollectionProxyHelper::determineReturnType($methodType->getValue(), $modelType, $propertyType);
return new class($classReflection, $returnType) implements PropertyReflection
{
return new class($classReflection, $returnType) implements PropertyReflection {
/** @var ClassReflection */
private $classReflection;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Properties;
use PHPStan\File\FileHelper;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Properties;
use Illuminate\Database\Eloquent\Model;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Properties;
use PHPStan\Reflection\ClassReflection;

View File

@ -2,12 +2,19 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Properties;
use ArrayObject;
use Flarum\PHPStan\Reflection\ReflectionHelper;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use Flarum\PHPStan\Reflection\ReflectionHelper;
use PHPStan\PhpDoc\TypeStringResolver;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\PropertiesClassReflectionExtension;
@ -119,7 +126,8 @@ final class ModelPropertyExtension implements PropertiesClassReflectionExtension
}
if (
(! array_key_exists($tableName, $this->tables)
(
! array_key_exists($tableName, $this->tables)
|| ! array_key_exists($propertyName, $this->tables[$tableName]->columns)
)
&& $propertyName === 'id'

View File

@ -2,15 +2,22 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Properties;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Str;
use Flarum\PHPStan\Concerns;
use Flarum\PHPStan\Methods\BuilderHelper;
use Flarum\PHPStan\Reflection\ReflectionHelper;
use Flarum\PHPStan\Types\RelationParserHelper;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Str;
use PHPStan\Analyser\OutOfClassScope;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\ParametersAcceptorSelector;
@ -38,7 +45,8 @@ final class ModelRelationsExtension implements PropertiesClassReflectionExtensio
public function __construct(
RelationParserHelper $relationParserHelper,
BuilderHelper $builderHelper)
BuilderHelper $builderHelper
)
{
$this->relationParserHelper = $relationParserHelper;
$this->builderHelper = $builderHelper;
@ -97,7 +105,8 @@ final class ModelRelationsExtension implements PropertiesClassReflectionExtensio
return new ModelProperty(
$classReflection,
new GenericObjectType($collectionClass, [$relatedModel]),
new NeverType(), false
new NeverType(),
false
);
}

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Properties;
use ReflectionNamedType;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Properties;
use Illuminate\Support\Str;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Properties;
/**

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Properties;
/**

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Reflection;
use PHPStan\Reflection\ParameterReflection;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Reflection;
use PHPStan\Reflection\ClassMemberReflection;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Reflection;
use PHPStan\Reflection\ParameterReflection;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Reflection;
use Illuminate\Database\Eloquent\Builder;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Reflection;
use PHPStan\Reflection\ClassMemberReflection;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Reflection;
use PHPStan\Reflection\ClassReflection;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\Reflection;
use PHPStan\Reflection\ClassMemberReflection;

View File

@ -2,14 +2,21 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes;
use Flarum\PHPStan\Methods\BuilderHelper;
use Flarum\PHPStan\Methods\ModelTypeHelper;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Support\Str;
use Flarum\PHPStan\Methods\BuilderHelper;
use Flarum\PHPStan\Methods\ModelTypeHelper;
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\MethodReflection;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes;
use Illuminate\Database\Eloquent\Collection;

View File

@ -2,10 +2,17 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes;
use Illuminate\Support\Collection;
use Flarum\PHPStan\Support\CollectionHelper;
use Illuminate\Support\Collection;
use PhpParser\Node\Expr\StaticCall;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\MethodReflection;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes;
use Flarum\PHPStan\Concerns\HasContainer;

View File

@ -2,12 +2,19 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes;
use Flarum\PHPStan\Methods\BuilderHelper;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Str;
use Flarum\PHPStan\Methods\BuilderHelper;
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\MethodReflection;

View File

@ -2,10 +2,17 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes\Helpers;
use Illuminate\Foundation\Application;
use Flarum\PHPStan\Concerns\HasContainer;
use Illuminate\Foundation\Application;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Expr\FuncCall;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes\Helpers;
use Flarum\PHPStan\Support\CollectionHelper;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes\Helpers;
use Illuminate\Support\HigherOrderTapProxy;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes\Helpers;
use PhpParser\Node\Expr\FuncCall;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes\Helpers;
use function count;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes\Helpers;
use function count;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes;
use Illuminate\Support\HigherOrderTapProxy;

View File

@ -2,13 +2,20 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes;
use Flarum\PHPStan\Methods\BuilderHelper;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Flarum\PHPStan\Methods\BuilderHelper;
use PhpParser\Node\Expr\StaticCall;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\MethodReflection;

View File

@ -2,6 +2,13 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes;
use Illuminate\Database\Eloquent\Model;

View File

@ -2,14 +2,21 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes;
use Flarum\PHPStan\Methods\BuilderHelper;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Support\Str;
use Flarum\PHPStan\Methods\BuilderHelper;
use PhpParser\Node\Expr\StaticCall;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\MethodReflection;

View File

@ -2,12 +2,19 @@
declare(strict_types=1);
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PHPStan\ReturnTypes;
use Flarum\PHPStan\Methods\BuilderHelper;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Str;
use Flarum\PHPStan\Methods\BuilderHelper;
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\MethodReflection;

Some files were not shown because too many files have changed in this diff Show More