Formatting, syntax, typehint and namespace fixes, cleanups

main
Igor Scheller 5 years ago committed by msquare
parent 055586cb8f
commit 93ae2442f6

@ -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

@ -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 = '';

@ -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);

@ -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);
}

@ -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)
{

@ -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

@ -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
{

@ -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
{

@ -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
*

@ -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()
{

@ -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));
}

@ -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;
}
}

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

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

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

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

@ -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;

@ -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;

@ -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;

@ -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
{

Loading…
Cancel
Save