mirror of
https://github.com/phpmon/website
synced 2025-08-06 06:20:07 +02:00
Add Rector & various upgrades
This commit is contained in:
@ -3,9 +3,9 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class RetrieveGitHubData extends Command
|
||||
{
|
||||
|
@ -7,11 +7,13 @@
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
#[\Override]
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('github:fetch')->everySixHours();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
@ -41,6 +41,7 @@ class Handler extends ExceptionHandler
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[\Override]
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
|
@ -19,7 +19,7 @@ class Kernel extends HttpKernel
|
||||
'web' => [\Illuminate\Routing\Middleware\SubstituteBindings::class],
|
||||
];
|
||||
|
||||
protected $routeMiddleware = [
|
||||
protected $middlewareAliases = [
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
|
@ -11,6 +11,7 @@ class TrustHosts extends Middleware
|
||||
*
|
||||
* @return array<int, string|null>
|
||||
*/
|
||||
#[\Override]
|
||||
public function hosts()
|
||||
{
|
||||
return [
|
||||
|
@ -8,9 +8,11 @@ public function __construct(
|
||||
public readonly string $url,
|
||||
public readonly string $target,
|
||||
public readonly string $name
|
||||
) {}
|
||||
|
||||
public static function named($name, $url, $target): Redirection {
|
||||
return new Redirection($url, $target,$name);
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
public static function named($name, $url, $target): Redirection
|
||||
{
|
||||
return new Redirection($url, $target, $name);
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[\Override]
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
#[\Override]
|
||||
public function boot()
|
||||
{
|
||||
$this->routes(function () {
|
||||
|
@ -4,21 +4,23 @@
|
||||
"description": "The PHP Monitor website.",
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"guzzlehttp/guzzle": "^7.7",
|
||||
"laravel/framework": "^10.12",
|
||||
"laravel/sanctum": "^3.2.5",
|
||||
"laravel/tinker": "^2.8.1",
|
||||
"league/commonmark": "^2.4"
|
||||
"php": "^8.3",
|
||||
"guzzlehttp/guzzle": "^7.8.1",
|
||||
"laravel/framework": "^10.43",
|
||||
"laravel/sanctum": "^3.3.3",
|
||||
"laravel/tinker": "^2.9.0",
|
||||
"league/commonmark": "^2.4.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.22",
|
||||
"laravel/pint": "^1.10",
|
||||
"laravel/sail": "^1.22",
|
||||
"mockery/mockery": "^1.5.1",
|
||||
"nunomaduro/collision": "^7.1",
|
||||
"phpunit/phpunit": "^9.6.8",
|
||||
"spatie/laravel-ignition": "^2.1.3"
|
||||
"driftingly/rector-laravel": "^1.0",
|
||||
"fakerphp/faker": "^1.23.1",
|
||||
"laravel/pint": "^1.13.10",
|
||||
"laravel/sail": "^1.27.3",
|
||||
"mockery/mockery": "^1.6.7",
|
||||
"nunomaduro/collision": "^7.10",
|
||||
"phpunit/phpunit": "^10.0",
|
||||
"rector/rector": "^1.0",
|
||||
"spatie/laravel-ignition": "^2.4.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@ -43,6 +45,16 @@
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi"
|
||||
],
|
||||
"pint": "./vendor/bin/pint -v",
|
||||
"rector-dry-run": "./vendor/bin/rector process --dry-run",
|
||||
"rector": "./vendor/bin/rector process",
|
||||
"test": "php artisan test",
|
||||
"coverage": "php artisan test --coverage",
|
||||
"verify": [
|
||||
"@rector",
|
||||
"@pint",
|
||||
"@test"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
@ -52,7 +64,7 @@
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "8.2"
|
||||
"php": "8.3"
|
||||
},
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
|
2416
composer.lock
generated
2416
composer.lock
generated
File diff suppressed because it is too large
Load Diff
48
phpunit.xml
48
phpunit.xml
@ -1,28 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Feature">
|
||||
<directory suffix="Test.php">./tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<coverage processUncoveredFiles="true">
|
||||
<include>
|
||||
<directory suffix=".php">./app</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
|
||||
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||
</php>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" cacheDirectory=".phpunit.cache">
|
||||
<testsuites>
|
||||
<testsuite name="Feature">
|
||||
<directory suffix="Test.php">./tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
|
||||
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||
</php>
|
||||
<source>
|
||||
<include>
|
||||
<directory suffix=".php">./app</directory>
|
||||
</include>
|
||||
</source>
|
||||
</phpunit>
|
||||
|
26
rector.php
Normal file
26
rector.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNativeCallRector;
|
||||
use RectorLaravel\Set\LaravelSetList;
|
||||
|
||||
return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->paths([
|
||||
__DIR__.'/app',
|
||||
__DIR__.'/tests',
|
||||
]);
|
||||
|
||||
$rectorConfig->rules([
|
||||
ReturnTypeFromStrictNativeCallRector::class,
|
||||
]);
|
||||
|
||||
$rectorConfig->sets([
|
||||
SetList::CODE_QUALITY,
|
||||
LevelSetList::UP_TO_PHP_83,
|
||||
LaravelSetList::LARAVEL_100,
|
||||
]);
|
||||
};
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Redirection;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
|
||||
Route::get('/', fn () => view('homepage'));
|
||||
@ -11,7 +11,7 @@
|
||||
if (file_exists($path)) {
|
||||
return view('changelog', [
|
||||
'content' => (new CommonMarkConverter())
|
||||
->convert(file_get_contents($path))
|
||||
->convert(file_get_contents($path)),
|
||||
]);
|
||||
} else {
|
||||
abort(404);
|
||||
@ -24,7 +24,7 @@
|
||||
Redirection::named('faq', '/faq', 'https://github.com/nicoverbruggen/phpmon#%EF%B8%8F-faq--troubleshooting'),
|
||||
Redirection::named('sponsor', '/sponsor', 'https://nicoverbruggen.be/sponsor'),
|
||||
Redirection::named('sponsor.now', '/sponsor/now', 'https://nicoverbruggen.be/sponsor#pay-now'),
|
||||
Redirection::named('wiki.pre-release', '/prerelease-php', 'https://github.com/nicoverbruggen/phpmon/wiki/Supporting-pre-release-versions-of-PHP')
|
||||
Redirection::named('wiki.pre-release', '/prerelease-php', 'https://github.com/nicoverbruggen/phpmon/wiki/Supporting-pre-release-versions-of-PHP'),
|
||||
])->each(function (Redirection $r) {
|
||||
Route::get($r->url, fn () => redirect()->to($r->target))->name($r->name);
|
||||
});
|
||||
});
|
||||
|
15
tests/Feature/ReleaseNotesReachabilityTest.php
Normal file
15
tests/Feature/ReleaseNotesReachabilityTest.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
class ReleaseNotesReachabilityTest extends TestCase
|
||||
{
|
||||
public function test_release_notes_is_reachable()
|
||||
{
|
||||
$response = $this->get('/early-access/release-notes');
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user