mirror of
https://github.com/phpmon/website
synced 2025-08-07 14:50:09 +02:00
Add Rector & various upgrades
This commit is contained in:
@ -3,9 +3,9 @@
|
|||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
|
|
||||||
class RetrieveGitHubData extends Command
|
class RetrieveGitHubData extends Command
|
||||||
{
|
{
|
||||||
|
@ -7,11 +7,13 @@
|
|||||||
|
|
||||||
class Kernel extends ConsoleKernel
|
class Kernel extends ConsoleKernel
|
||||||
{
|
{
|
||||||
|
#[\Override]
|
||||||
protected function schedule(Schedule $schedule)
|
protected function schedule(Schedule $schedule)
|
||||||
{
|
{
|
||||||
$schedule->command('github:fetch')->everySixHours();
|
$schedule->command('github:fetch')->everySixHours();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\Override]
|
||||||
protected function commands()
|
protected function commands()
|
||||||
{
|
{
|
||||||
$this->load(__DIR__.'/Commands');
|
$this->load(__DIR__.'/Commands');
|
||||||
|
@ -41,6 +41,7 @@ class Handler extends ExceptionHandler
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
#[\Override]
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
$this->reportable(function (Throwable $e) {
|
$this->reportable(function (Throwable $e) {
|
||||||
|
@ -19,7 +19,7 @@ class Kernel extends HttpKernel
|
|||||||
'web' => [\Illuminate\Routing\Middleware\SubstituteBindings::class],
|
'web' => [\Illuminate\Routing\Middleware\SubstituteBindings::class],
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $routeMiddleware = [
|
protected $middlewareAliases = [
|
||||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||||
|
@ -11,6 +11,7 @@ class TrustHosts extends Middleware
|
|||||||
*
|
*
|
||||||
* @return array<int, string|null>
|
* @return array<int, string|null>
|
||||||
*/
|
*/
|
||||||
|
#[\Override]
|
||||||
public function hosts()
|
public function hosts()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -8,9 +8,11 @@ public function __construct(
|
|||||||
public readonly string $url,
|
public readonly string $url,
|
||||||
public readonly string $target,
|
public readonly string $target,
|
||||||
public readonly string $name
|
public readonly string $name
|
||||||
) {}
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
public static function named($name, $url, $target): Redirection {
|
public static function named($name, $url, $target): Redirection
|
||||||
return new Redirection($url, $target,$name);
|
{
|
||||||
|
return new Redirection($url, $target, $name);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,6 +11,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
#[\Override]
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
class RouteServiceProvider extends ServiceProvider
|
class RouteServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
#[\Override]
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
$this->routes(function () {
|
$this->routes(function () {
|
||||||
|
@ -4,21 +4,23 @@
|
|||||||
"description": "The PHP Monitor website.",
|
"description": "The PHP Monitor website.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.2",
|
"php": "^8.3",
|
||||||
"guzzlehttp/guzzle": "^7.7",
|
"guzzlehttp/guzzle": "^7.8.1",
|
||||||
"laravel/framework": "^10.12",
|
"laravel/framework": "^10.43",
|
||||||
"laravel/sanctum": "^3.2.5",
|
"laravel/sanctum": "^3.3.3",
|
||||||
"laravel/tinker": "^2.8.1",
|
"laravel/tinker": "^2.9.0",
|
||||||
"league/commonmark": "^2.4"
|
"league/commonmark": "^2.4.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fakerphp/faker": "^1.22",
|
"driftingly/rector-laravel": "^1.0",
|
||||||
"laravel/pint": "^1.10",
|
"fakerphp/faker": "^1.23.1",
|
||||||
"laravel/sail": "^1.22",
|
"laravel/pint": "^1.13.10",
|
||||||
"mockery/mockery": "^1.5.1",
|
"laravel/sail": "^1.27.3",
|
||||||
"nunomaduro/collision": "^7.1",
|
"mockery/mockery": "^1.6.7",
|
||||||
"phpunit/phpunit": "^9.6.8",
|
"nunomaduro/collision": "^7.10",
|
||||||
"spatie/laravel-ignition": "^2.1.3"
|
"phpunit/phpunit": "^10.0",
|
||||||
|
"rector/rector": "^1.0",
|
||||||
|
"spatie/laravel-ignition": "^2.4.2"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
@ -43,6 +45,16 @@
|
|||||||
],
|
],
|
||||||
"post-create-project-cmd": [
|
"post-create-project-cmd": [
|
||||||
"@php artisan key:generate --ansi"
|
"@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": {
|
"extra": {
|
||||||
@ -52,7 +64,7 @@
|
|||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "8.2"
|
"php": "8.3"
|
||||||
},
|
},
|
||||||
"optimize-autoloader": true,
|
"optimize-autoloader": true,
|
||||||
"preferred-install": "dist",
|
"preferred-install": "dist",
|
||||||
|
2416
composer.lock
generated
2416
composer.lock
generated
File diff suppressed because it is too large
Load Diff
16
phpunit.xml
16
phpunit.xml
@ -1,19 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<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">
|
||||||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
|
||||||
bootstrap="vendor/autoload.php"
|
|
||||||
colors="true"
|
|
||||||
>
|
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Feature">
|
<testsuite name="Feature">
|
||||||
<directory suffix="Test.php">./tests/Feature</directory>
|
<directory suffix="Test.php">./tests/Feature</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
<coverage processUncoveredFiles="true">
|
|
||||||
<include>
|
|
||||||
<directory suffix=".php">./app</directory>
|
|
||||||
</include>
|
|
||||||
</coverage>
|
|
||||||
<php>
|
<php>
|
||||||
<env name="APP_ENV" value="testing"/>
|
<env name="APP_ENV" value="testing"/>
|
||||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||||
@ -25,4 +16,9 @@
|
|||||||
<env name="SESSION_DRIVER" value="array"/>
|
<env name="SESSION_DRIVER" value="array"/>
|
||||||
<env name="TELESCOPE_ENABLED" value="false"/>
|
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||||
</php>
|
</php>
|
||||||
|
<source>
|
||||||
|
<include>
|
||||||
|
<directory suffix=".php">./app</directory>
|
||||||
|
</include>
|
||||||
|
</source>
|
||||||
</phpunit>
|
</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
|
<?php
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
|
||||||
use App\Http\Redirection;
|
use App\Http\Redirection;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
use League\CommonMark\CommonMarkConverter;
|
use League\CommonMark\CommonMarkConverter;
|
||||||
|
|
||||||
Route::get('/', fn () => view('homepage'));
|
Route::get('/', fn () => view('homepage'));
|
||||||
@ -11,7 +11,7 @@
|
|||||||
if (file_exists($path)) {
|
if (file_exists($path)) {
|
||||||
return view('changelog', [
|
return view('changelog', [
|
||||||
'content' => (new CommonMarkConverter())
|
'content' => (new CommonMarkConverter())
|
||||||
->convert(file_get_contents($path))
|
->convert(file_get_contents($path)),
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
abort(404);
|
abort(404);
|
||||||
@ -24,7 +24,7 @@
|
|||||||
Redirection::named('faq', '/faq', 'https://github.com/nicoverbruggen/phpmon#%EF%B8%8F-faq--troubleshooting'),
|
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', '/sponsor', 'https://nicoverbruggen.be/sponsor'),
|
||||||
Redirection::named('sponsor.now', '/sponsor/now', 'https://nicoverbruggen.be/sponsor#pay-now'),
|
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) {
|
])->each(function (Redirection $r) {
|
||||||
Route::get($r->url, fn () => redirect()->to($r->target))->name($r->name);
|
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