Formatting, syntax, typehint and namespace fixes, cleanups
This commit is contained in:
parent
055586cb8f
commit
93ae2442f6
|
@ -83,11 +83,11 @@ check-style:
|
||||||
stage: test
|
stage: test
|
||||||
before_script:
|
before_script:
|
||||||
- curl -sS https://getcomposer.org/installer | php -- --no-ansi --install-dir /usr/local/bin/ --filename composer
|
- 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}"
|
- cd "${DOCROOT}"
|
||||||
- composer --no-ansi install
|
- composer --no-ansi install
|
||||||
script:
|
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:
|
release-image:
|
||||||
<<: *docker_definition
|
<<: *docker_definition
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Engelsystem\Mail;
|
namespace Engelsystem\Mail;
|
||||||
|
|
||||||
use Engelsystem\Renderer\Renderer;
|
|
||||||
use Swift_Mailer as SwiftMailer;
|
use Swift_Mailer as SwiftMailer;
|
||||||
use Swift_Message as SwiftMessage;
|
use Swift_Message as SwiftMessage;
|
||||||
|
|
||||||
|
@ -11,9 +10,6 @@ class Mailer
|
||||||
/** @var SwiftMailer */
|
/** @var SwiftMailer */
|
||||||
protected $mailer;
|
protected $mailer;
|
||||||
|
|
||||||
/** @var Renderer|null */
|
|
||||||
protected $view;
|
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $fromAddress = '';
|
protected $fromAddress = '';
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ use Psr\Http\Message\ResponseInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Psr\Http\Server\MiddlewareInterface;
|
use Psr\Http\Server\MiddlewareInterface;
|
||||||
use Psr\Http\Server\RequestHandlerInterface;
|
use Psr\Http\Server\RequestHandlerInterface;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
class ExceptionHandler implements MiddlewareInterface
|
class ExceptionHandler implements MiddlewareInterface
|
||||||
{
|
{
|
||||||
|
@ -37,7 +38,7 @@ class ExceptionHandler implements MiddlewareInterface
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
try {
|
try {
|
||||||
return $handler->handle($request);
|
return $handler->handle($request);
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
/** @var ExceptionsHandler $handler */
|
/** @var ExceptionsHandler $handler */
|
||||||
$handler = $this->container->get('error.handler');
|
$handler = $this->container->get('error.handler');
|
||||||
$content = $handler->exceptionHandler($e, true);
|
$content = $handler->exceptionHandler($e, true);
|
||||||
|
|
|
@ -8,6 +8,8 @@ use FastRoute\Dispatcher as FastRouteDispatcher;
|
||||||
use FastRoute\RouteCollector;
|
use FastRoute\RouteCollector;
|
||||||
use Psr\Http\Server\MiddlewareInterface;
|
use Psr\Http\Server\MiddlewareInterface;
|
||||||
|
|
||||||
|
use function FastRoute\cachedDispatcher as FRCashedDispatcher;
|
||||||
|
|
||||||
class RouteDispatcherServiceProvider extends ServiceProvider
|
class RouteDispatcherServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
public function register()
|
public function register()
|
||||||
|
@ -57,7 +59,7 @@ class RouteDispatcherServiceProvider extends ServiceProvider
|
||||||
unlink($routesCacheFile);
|
unlink($routesCacheFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return \FastRoute\cachedDispatcher(function (RouteCollector $route) {
|
return FRCashedDispatcher(function (RouteCollector $route) {
|
||||||
require config_path('routes.php');
|
require config_path('routes.php');
|
||||||
}, $options);
|
}, $options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Query\Builder as QueryBuilder;
|
use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||||
|
use Illuminate\Support\Collection as SupportCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
|
@ -38,7 +39,7 @@ class LogEntry extends BaseModel
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $keyword
|
* @param $keyword
|
||||||
* @return Builder[]|Collection|LogEntry[]
|
* @return Builder[]|Collection|SupportCollection|LogEntry[]
|
||||||
*/
|
*/
|
||||||
public static function filter($keyword = null)
|
public static function filter($keyword = null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,9 +13,9 @@ use Illuminate\Support\Carbon;
|
||||||
/**
|
/**
|
||||||
* This class represents a message send trough the system.
|
* This class represents a message send trough the system.
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property int $id
|
||||||
* @property integer $receiver_id
|
* @property int $receiver_id
|
||||||
* @property boolean $read
|
* @property bool $read
|
||||||
* @property string $text
|
* @property string $text
|
||||||
* @property Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
|
|
|
@ -8,12 +8,13 @@ use Engelsystem\Models\User\User;
|
||||||
use Engelsystem\Models\User\UsesUserModel;
|
use Engelsystem\Models\User\UsesUserModel;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property integer $id
|
* @property int $id
|
||||||
* @property string $text
|
* @property string $text
|
||||||
* @property string $answer
|
* @property string $answer
|
||||||
* @property integer $answerer_id
|
* @property int $answerer_id
|
||||||
* @property-read User $answerer
|
* @property-read User $answerer
|
||||||
* @method static Builder|Question whereAnswer($value)
|
* @method static Builder|Question whereAnswer($value)
|
||||||
* @method static Builder|Question whereAnswererId($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
|
public static function answered(): Builder
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
use Illuminate\Database\Query\Builder as QueryBuilder;
|
use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property integer $id
|
* @property int $id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $email
|
* @property string $email
|
||||||
* @property string $password
|
* @property string $password
|
||||||
|
@ -157,7 +157,7 @@ class User extends BaseModel
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return HasMany
|
* @return HasMany|QueryBuilder
|
||||||
*/
|
*/
|
||||||
public function messagesReceived(): HasMany
|
public function messagesReceived(): HasMany
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Query\Builder as QueryBuilder;
|
use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property integer $user_id
|
* @property int $user_id
|
||||||
*
|
*
|
||||||
* @property-read QueryBuilder|User $user
|
* @property-read QueryBuilder|User $user
|
||||||
*
|
*
|
||||||
|
|
|
@ -31,7 +31,7 @@ class LoggerTest extends ApplicationFeatureTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string[]
|
* @return string[][]
|
||||||
*/
|
*/
|
||||||
public function provideLogLevels()
|
public function provideLogLevels()
|
||||||
{
|
{
|
||||||
|
@ -80,7 +80,7 @@ class LoggerTest extends ApplicationFeatureTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string[]
|
* @return mixed[][]
|
||||||
*/
|
*/
|
||||||
public function provideContextReplaceValues()
|
public function provideContextReplaceValues()
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,7 @@ class RoomModelTest extends ApplicationFeatureTest
|
||||||
|
|
||||||
$this->assertNotEmpty($room);
|
$this->assertNotEmpty($room);
|
||||||
$this->assertNotNull($room);
|
$this->assertNotNull($room);
|
||||||
$this->assertEquals($room['Name'], 'test');
|
$this->assertEquals('test', $room['Name']);
|
||||||
|
|
||||||
$this->assertEmpty(Room(-1));
|
$this->assertEmpty(Room(-1));
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,11 +173,9 @@ class ApplicationTest extends TestCase
|
||||||
*/
|
*/
|
||||||
protected function mockServiceProvider(Application $app, $methods = [])
|
protected function mockServiceProvider(Application $app, $methods = [])
|
||||||
{
|
{
|
||||||
$serviceProvider = $this->getMockBuilder(ServiceProvider::class)
|
return $this->getMockBuilder(ServiceProvider::class)
|
||||||
->setConstructorArgs([$app])
|
->setConstructorArgs([$app])
|
||||||
->onlyMethods($methods)
|
->onlyMethods($methods)
|
||||||
->getMockForAbstractClass();
|
->getMockForAbstractClass();
|
||||||
|
|
||||||
return $serviceProvider;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,6 +229,7 @@ class PasswordResetControllerTest extends TestCase
|
||||||
$controller->setValidator(new Validator());
|
$controller->setValidator(new Validator());
|
||||||
|
|
||||||
if ($view) {
|
if ($view) {
|
||||||
|
/** @var array|mixed[] $args */
|
||||||
$args = [$view];
|
$args = [$view];
|
||||||
if ($data) {
|
if ($data) {
|
||||||
$args[] = $data;
|
$args[] = $data;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Engelsystem\Test\Unit\Database;
|
namespace Engelsystem\Test\Unit\Database\Migration;
|
||||||
|
|
||||||
use Engelsystem\Application;
|
use Engelsystem\Application;
|
||||||
use Engelsystem\Database\Migration\Migrate;
|
use Engelsystem\Database\Migration\Migrate;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Engelsystem\Test\Unit\Database;
|
namespace Engelsystem\Test\Unit\Database\Migration;
|
||||||
|
|
||||||
use Engelsystem\Migrations\AnotherStuff;
|
use Engelsystem\Migrations\AnotherStuff;
|
||||||
use Illuminate\Database\Schema\Builder as SchemaBuilder;
|
use Illuminate\Database\Schema\Builder as SchemaBuilder;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Engelsystem\Test\Unit\Exceptions\handlers;
|
namespace Engelsystem\Test\Unit\Exceptions\Handlers;
|
||||||
|
|
||||||
use Engelsystem\Exceptions\Handlers\LegacyDevelopment;
|
use Engelsystem\Exceptions\Handlers\LegacyDevelopment;
|
||||||
use Engelsystem\Http\Request;
|
use Engelsystem\Http\Request;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Engelsystem\Test\Unit\Exceptions\handlers;
|
namespace Engelsystem\Test\Unit\Exceptions\Handlers;
|
||||||
|
|
||||||
use Engelsystem\Exceptions\Handlers\Legacy;
|
use Engelsystem\Exceptions\Handlers\Legacy;
|
||||||
use Engelsystem\Http\Request;
|
use Engelsystem\Http\Request;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Engelsystem\Test\Unit\Exceptions\handlers;
|
namespace Engelsystem\Test\Unit\Exceptions\Handlers;
|
||||||
|
|
||||||
use Engelsystem\Application;
|
use Engelsystem\Application;
|
||||||
use Engelsystem\Exceptions\Handlers\Whoops;
|
use Engelsystem\Exceptions\Handlers\Whoops;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Engelsystem\Test\Unit\Http;
|
namespace Engelsystem\Test\Unit\Http\Exceptions;
|
||||||
|
|
||||||
use Engelsystem\Http\Exceptions\HttpPermanentRedirect;
|
use Engelsystem\Http\Exceptions\HttpPermanentRedirect;
|
||||||
use Engelsystem\Http\Exceptions\HttpRedirect;
|
use Engelsystem\Http\Exceptions\HttpRedirect;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Engelsystem\Test\Unit\Http;
|
namespace Engelsystem\Test\Unit\Http\Exceptions;
|
||||||
|
|
||||||
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
|
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
|
||||||
use Engelsystem\Http\Exceptions\HttpRedirect;
|
use Engelsystem\Http\Exceptions\HttpRedirect;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Engelsystem\Test\Unit\Http;
|
namespace Engelsystem\Test\Unit\Http\Exceptions;
|
||||||
|
|
||||||
use Engelsystem\Http\Exceptions\HttpRedirect;
|
use Engelsystem\Http\Exceptions\HttpRedirect;
|
||||||
use Engelsystem\Http\Exceptions\HttpTemporaryRedirect;
|
use Engelsystem\Http\Exceptions\HttpTemporaryRedirect;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Engelsystem\Test\Unit\Middleware;
|
namespace Engelsystem\Test\Unit\Mail;
|
||||||
|
|
||||||
use Engelsystem\Application;
|
use Engelsystem\Application;
|
||||||
use Engelsystem\Config\Config;
|
use Engelsystem\Config\Config;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Unit\Models;
|
namespace Engelsystem\Test\Unit\Models;
|
||||||
|
|
||||||
use Engelsystem\Models\Question;
|
use Engelsystem\Models\Question;
|
||||||
use Engelsystem\Models\User\User;
|
use Engelsystem\Models\User\User;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Engelsystem\Test\Unit\Models;
|
namespace Engelsystem\Test\Unit\Models\User;
|
||||||
|
|
||||||
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
|
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
|
||||||
use Engelsystem\Models\BaseModel;
|
use Engelsystem\Models\BaseModel;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Engelsystem\Test\Unit\Models;
|
namespace Engelsystem\Test\Unit\Models\User;
|
||||||
|
|
||||||
use Engelsystem\Models\BaseModel;
|
use Engelsystem\Models\BaseModel;
|
||||||
use Engelsystem\Models\User\UsesUserModel;
|
use Engelsystem\Models\User\UsesUserModel;
|
||||||
|
|
|
@ -6,8 +6,8 @@ use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
|
||||||
use Exception;
|
use Exception;
|
||||||
use PHPUnit\Framework\MockObject\MockObject;
|
use PHPUnit\Framework\MockObject\MockObject;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Twig\TwigFunction;
|
|
||||||
use Twig\Node\Node as TwigNode;
|
use Twig\Node\Node as TwigNode;
|
||||||
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
abstract class ExtensionTest extends TestCase
|
abstract class ExtensionTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue