PHPStan: Fixed larastan loading and address some level2 issues
This commit is contained in:
parent
45ce7a7126
commit
c13fd2a9e6
9 changed files with 14 additions and 10 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -29,4 +29,5 @@ webpack-stats.json
|
|||
.phpunit.result.cache
|
||||
.DS_Store
|
||||
phpstan.neon
|
||||
esbuild-meta.json
|
||||
esbuild-meta.json
|
||||
.phpactor.json
|
||||
|
|
|
@ -9,6 +9,7 @@ use BookStack\Users\Models\User;
|
|||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,6 +62,7 @@ class PageContent
|
|||
|
||||
// Get all img elements with image data blobs
|
||||
$imageNodes = $doc->queryXPath('//img[contains(@src, \'data:image\')]');
|
||||
/** @var DOMElement $imageNode */
|
||||
foreach ($imageNodes as $imageNode) {
|
||||
$imageSrc = $imageNode->getAttribute('src');
|
||||
$newUrl = $this->base64ImageUriToUploadedImageUrl($imageSrc, $updater);
|
||||
|
|
|
@ -72,8 +72,8 @@ class PageIncludeParser
|
|||
$includeTags = [];
|
||||
|
||||
/** @var DOMNode $node */
|
||||
/** @var DOMNode $childNode */
|
||||
foreach ($includeHosts as $node) {
|
||||
/** @var DOMNode $childNode */
|
||||
foreach ($node->childNodes as $childNode) {
|
||||
if ($childNode->nodeName === '#text') {
|
||||
array_push($includeTags, ...$this->splitTextNodesAtTags($childNode));
|
||||
|
@ -174,8 +174,8 @@ class PageIncludeParser
|
|||
$parentNode->parentNode->insertBefore($parentClone, $parentNode);
|
||||
$parentClone->removeAttribute('id');
|
||||
|
||||
/** @var DOMNode $child */
|
||||
for ($i = 0; $i < $splitPos; $i++) {
|
||||
/** @var DOMNode $child */
|
||||
$child = $children[$i];
|
||||
$parentClone->appendChild($child);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
|||
use Illuminate\Http\Exceptions\PostTooLargeException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Symfony\Component\ErrorHandler\Error\FatalError;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
||||
|
@ -42,7 +43,7 @@ class Handler extends ExceptionHandler
|
|||
* If it returns a response, that will be provided back to the request
|
||||
* upon an out of memory event.
|
||||
*
|
||||
* @var ?callable<?\Illuminate\Http\Response>
|
||||
* @var ?callable(): ?Response
|
||||
*/
|
||||
protected $onOutOfMemory = null;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class PermissionApplicator
|
|||
/**
|
||||
* Checks if an entity has a restriction set upon it.
|
||||
*
|
||||
* @param HasCreatorAndUpdater|HasOwner $ownable
|
||||
* @param Model&(HasCreatorAndUpdater|HasOwner) $ownable
|
||||
*/
|
||||
public function checkOwnableUserAccess(Model $ownable, string $permission): bool
|
||||
{
|
||||
|
@ -160,10 +160,9 @@ class PermissionApplicator
|
|||
|
||||
$joinQuery = function ($query) use ($entityProvider) {
|
||||
$first = true;
|
||||
/** @var Builder $query */
|
||||
foreach ($entityProvider->all() as $entity) {
|
||||
/** @var Builder $query */
|
||||
$entityQuery = function ($query) use ($entity) {
|
||||
/** @var Builder $query */
|
||||
$query->select(['id', 'deleted_at'])
|
||||
->selectRaw("'{$entity->getMorphClass()}' as type")
|
||||
->from($entity->getTable())
|
||||
|
|
|
@ -42,6 +42,7 @@ class ReferenceUpdater
|
|||
$chapters = $entity->chapters()->get(['id']);
|
||||
$children = $pages->concat($chapters);
|
||||
foreach ($children as $bookChild) {
|
||||
/** @var Reference[] $childRefs */
|
||||
$childRefs = $this->referenceFetcher->getPageReferencesToEntity($bookChild)->values()->all();
|
||||
array_push($references, ...$childRefs);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class ThemeEvents
|
|||
* Called when standard web (browser/non-api) app routes are registered.
|
||||
* Provides an app router, so you can register your own web routes.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
*/
|
||||
const ROUTES_REGISTER_WEB = 'routes_register_web';
|
||||
|
||||
|
@ -111,7 +111,7 @@ class ThemeEvents
|
|||
* These are routes that typically require login to access (unless the instance is made public).
|
||||
* Provides an app router, so you can register your own web routes.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
*/
|
||||
const ROUTES_REGISTER_WEB_AUTH = 'routes_register_web_auth';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
includes:
|
||||
- ./vendor/nunomaduro/larastan/extension.neon
|
||||
- ./vendor/larastan/larastan/extension.neon
|
||||
|
||||
parameters:
|
||||
|
||||
|
|
Loading…
Reference in a new issue