Formatting, syntax, typehint and namespace fixes, cleanups

This commit is contained in:
Igor Scheller 2020-04-19 20:41:38 +02:00 committed by msquare
parent 055586cb8f
commit 93ae2442f6
26 changed files with 37 additions and 37 deletions

View File

@ -83,11 +83,11 @@ check-style:
stage: test
before_script:
- curl -sS https://getcomposer.org/installer | php -- --no-ansi --install-dir /usr/local/bin/ --filename composer
- cp -R tests/ "${DOCROOT}"
- cp -R tests/ .phpcs.xml "${DOCROOT}"
- cd "${DOCROOT}"
- composer --no-ansi install
script:
- ./vendor/bin/phpcs --no-colors --basepath="$PWD" -p --standard=PSR12 config/ db/ public/index.php src/ tests/
- composer phpcs -- --no-colors --basepath="$PWD"
release-image:
<<: *docker_definition

View File

@ -2,7 +2,6 @@
namespace Engelsystem\Mail;
use Engelsystem\Renderer\Renderer;
use Swift_Mailer as SwiftMailer;
use Swift_Message as SwiftMessage;
@ -11,9 +10,6 @@ class Mailer
/** @var SwiftMailer */
protected $mailer;
/** @var Renderer|null */
protected $view;
/** @var string */
protected $fromAddress = '';

View File

@ -8,6 +8,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Throwable;
class ExceptionHandler implements MiddlewareInterface
{
@ -37,7 +38,7 @@ class ExceptionHandler implements MiddlewareInterface
): ResponseInterface {
try {
return $handler->handle($request);
} catch (\Throwable $e) {
} catch (Throwable $e) {
/** @var ExceptionsHandler $handler */
$handler = $this->container->get('error.handler');
$content = $handler->exceptionHandler($e, true);

View File

@ -8,6 +8,8 @@ use FastRoute\Dispatcher as FastRouteDispatcher;
use FastRoute\RouteCollector;
use Psr\Http\Server\MiddlewareInterface;
use function FastRoute\cachedDispatcher as FRCashedDispatcher;
class RouteDispatcherServiceProvider extends ServiceProvider
{
public function register()
@ -57,7 +59,7 @@ class RouteDispatcherServiceProvider extends ServiceProvider
unlink($routesCacheFile);
}
return \FastRoute\cachedDispatcher(function (RouteCollector $route) {
return FRCashedDispatcher(function (RouteCollector $route) {
require config_path('routes.php');
}, $options);
}

View File

@ -6,6 +6,7 @@ use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Support\Collection as SupportCollection;
/**
* @property int $id
@ -38,7 +39,7 @@ class LogEntry extends BaseModel
/**
* @param $keyword
* @return Builder[]|Collection|LogEntry[]
* @return Builder[]|Collection|SupportCollection|LogEntry[]
*/
public static function filter($keyword = null)
{

View File

@ -13,9 +13,9 @@ use Illuminate\Support\Carbon;
/**
* This class represents a message send trough the system.
*
* @property integer $id
* @property integer $receiver_id
* @property boolean $read
* @property int $id
* @property int $receiver_id
* @property bool $read
* @property string $text
* @property Carbon|null $created_at
* @property Carbon|null $updated_at

View File

@ -8,12 +8,13 @@ use Engelsystem\Models\User\User;
use Engelsystem\Models\User\UsesUserModel;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Query\Builder as QueryBuilder;
/**
* @property integer $id
* @property int $id
* @property string $text
* @property string $answer
* @property integer $answerer_id
* @property int $answerer_id
* @property-read User $answerer
* @method static Builder|Question whereAnswer($value)
* @method static Builder|Question whereAnswererId($value)
@ -55,7 +56,7 @@ class Question extends BaseModel
}
/**
* @return Builder
* @return Builder|QueryBuilder
*/
public static function answered(): Builder
{

View File

@ -14,7 +14,7 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Query\Builder as QueryBuilder;
/**
* @property integer $id
* @property int $id
* @property string $name
* @property string $email
* @property string $password
@ -157,7 +157,7 @@ class User extends BaseModel
}
/**
* @return HasMany
* @return HasMany|QueryBuilder
*/
public function messagesReceived(): HasMany
{

View File

@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Query\Builder as QueryBuilder;
/**
* @property integer $user_id
* @property int $user_id
*
* @property-read QueryBuilder|User $user
*

View File

@ -31,7 +31,7 @@ class LoggerTest extends ApplicationFeatureTest
}
/**
* @return string[]
* @return string[][]
*/
public function provideLogLevels()
{
@ -80,7 +80,7 @@ class LoggerTest extends ApplicationFeatureTest
}
/**
* @return string[]
* @return mixed[][]
*/
public function provideContextReplaceValues()
{

View File

@ -28,7 +28,7 @@ class RoomModelTest extends ApplicationFeatureTest
$this->assertNotEmpty($room);
$this->assertNotNull($room);
$this->assertEquals($room['Name'], 'test');
$this->assertEquals('test', $room['Name']);
$this->assertEmpty(Room(-1));
}

View File

@ -173,11 +173,9 @@ class ApplicationTest extends TestCase
*/
protected function mockServiceProvider(Application $app, $methods = [])
{
$serviceProvider = $this->getMockBuilder(ServiceProvider::class)
return $this->getMockBuilder(ServiceProvider::class)
->setConstructorArgs([$app])
->onlyMethods($methods)
->getMockForAbstractClass();
return $serviceProvider;
}
}

View File

@ -229,6 +229,7 @@ class PasswordResetControllerTest extends TestCase
$controller->setValidator(new Validator());
if ($view) {
/** @var array|mixed[] $args */
$args = [$view];
if ($data) {
$args[] = $data;

View File

@ -1,6 +1,6 @@
<?php
namespace Engelsystem\Test\Unit\Database;
namespace Engelsystem\Test\Unit\Database\Migration;
use Engelsystem\Application;
use Engelsystem\Database\Migration\Migrate;

View File

@ -1,6 +1,6 @@
<?php
namespace Engelsystem\Test\Unit\Database;
namespace Engelsystem\Test\Unit\Database\Migration;
use Engelsystem\Migrations\AnotherStuff;
use Illuminate\Database\Schema\Builder as SchemaBuilder;

View File

@ -1,6 +1,6 @@
<?php
namespace Engelsystem\Test\Unit\Exceptions\handlers;
namespace Engelsystem\Test\Unit\Exceptions\Handlers;
use Engelsystem\Exceptions\Handlers\LegacyDevelopment;
use Engelsystem\Http\Request;

View File

@ -1,6 +1,6 @@
<?php
namespace Engelsystem\Test\Unit\Exceptions\handlers;
namespace Engelsystem\Test\Unit\Exceptions\Handlers;
use Engelsystem\Exceptions\Handlers\Legacy;
use Engelsystem\Http\Request;

View File

@ -1,6 +1,6 @@
<?php
namespace Engelsystem\Test\Unit\Exceptions\handlers;
namespace Engelsystem\Test\Unit\Exceptions\Handlers;
use Engelsystem\Application;
use Engelsystem\Exceptions\Handlers\Whoops;

View File

@ -1,6 +1,6 @@
<?php
namespace Engelsystem\Test\Unit\Http;
namespace Engelsystem\Test\Unit\Http\Exceptions;
use Engelsystem\Http\Exceptions\HttpPermanentRedirect;
use Engelsystem\Http\Exceptions\HttpRedirect;

View File

@ -1,6 +1,6 @@
<?php
namespace Engelsystem\Test\Unit\Http;
namespace Engelsystem\Test\Unit\Http\Exceptions;
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
use Engelsystem\Http\Exceptions\HttpRedirect;

View File

@ -1,6 +1,6 @@
<?php
namespace Engelsystem\Test\Unit\Http;
namespace Engelsystem\Test\Unit\Http\Exceptions;
use Engelsystem\Http\Exceptions\HttpRedirect;
use Engelsystem\Http\Exceptions\HttpTemporaryRedirect;

View File

@ -1,6 +1,6 @@
<?php
namespace Engelsystem\Test\Unit\Middleware;
namespace Engelsystem\Test\Unit\Mail;
use Engelsystem\Application;
use Engelsystem\Config\Config;

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Unit\Models;
namespace Engelsystem\Test\Unit\Models;
use Engelsystem\Models\Question;
use Engelsystem\Models\User\User;

View File

@ -1,6 +1,6 @@
<?php
namespace Engelsystem\Test\Unit\Models;
namespace Engelsystem\Test\Unit\Models\User;
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
use Engelsystem\Models\BaseModel;

View File

@ -1,6 +1,6 @@
<?php
namespace Engelsystem\Test\Unit\Models;
namespace Engelsystem\Test\Unit\Models\User;
use Engelsystem\Models\BaseModel;
use Engelsystem\Models\User\UsesUserModel;

View File

@ -6,8 +6,8 @@ use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
use Exception;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Twig\TwigFunction;
use Twig\Node\Node as TwigNode;
use Twig\TwigFunction;
abstract class ExtensionTest extends TestCase
{