Skip to content

Commit

Permalink
Merge pull request #535 from pinkary-project/feat/adding-bleeding-edge
Browse files Browse the repository at this point in the history
Feat: adding bleeding edge in PHPStan
  • Loading branch information
nunomaduro authored Aug 31, 2024
2 parents 28bd258 + 39c67c5 commit e7136d7
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/PerformDatabaseBackupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function handle(): void

File::copy(database_path('database.sqlite'), database_path('backups/'.$filename));

$glob = type(File::glob(database_path('backups/*.sql')))->asArray();
$glob = File::glob(database_path('backups/*.sql'));

collect($glob)->sort()->reverse()->slice(20)->each(
fn (string $backup): bool => File::delete($backup),
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/QuestionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use App\Jobs\IncrementViews;
use App\Models\Question;
use App\Models\User;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Gate;
use Illuminate\View\View;

Expand All @@ -16,7 +15,7 @@
/**
* Display the question.
*/
public function show(User $user, Question $question): Response|View
public function show(User $user, Question $question): View
{
Gate::authorize('view', $question);

Expand Down
6 changes: 4 additions & 2 deletions app/Livewire/Concerns/ConfirmsPasswords.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ protected function ensurePasswordIsConfirmed(string $idToConfirm, ?int $maximumS
*/
protected function passwordIsConfirmed(?int $maximumSecondsSinceConfirmation = null): bool
{
$maximumSecondsSinceConfirmation = $maximumSecondsSinceConfirmation !== null && $maximumSecondsSinceConfirmation !== 0 ? $maximumSecondsSinceConfirmation : config('auth.password_timeout', 900);
$maximumSecondsSinceConfirmation = $maximumSecondsSinceConfirmation !== null && $maximumSecondsSinceConfirmation !== 0 ? $maximumSecondsSinceConfirmation : config()->integer('auth.password_timeout', 900);

return (time() - session('auth.password_confirmed_at', 0)) < $maximumSecondsSinceConfirmation;
$confidedAt = is_int(session('auth.password_confirmed_at')) ? session('auth.password_confirmed_at') : 0;

return (time() - $confidedAt) < $maximumSecondsSinceConfirmation;
}
}
2 changes: 1 addition & 1 deletion app/Models/Question.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function mentions(): Collection
}

preg_match_all("/@([^\s,.?!\/@<]+)/i", type($this->content)->asString(), $contentMatches);
preg_match_all("/@([^\s,.?!\/@<]+)/i", type($this->answer)->asString(), $answerMatches);
preg_match_all("/@([^\s,.?!\/@<]+)/i", $this->answer, $answerMatches);

$mentions = array_unique(array_merge($contentMatches[1], $answerMatches[1]));

Expand Down
2 changes: 1 addition & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ final class User extends Authenticatable implements FilamentUser, MustVerifyEmai
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
* @var list<string>
*/
protected $hidden = [
'password',
Expand Down
1 change: 1 addition & 0 deletions app/Services/GitHub.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ private function getSponsorships(string $username): array
));
}

/** @var array<int, array{monthlyPriceInDollars: int}>|bool|null */
$body = $response->json('data.user.sponsorshipForViewerAsSponsorable');

return is_array($body) ? $body : [];
Expand Down
2 changes: 1 addition & 1 deletion app/Services/ParsableContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function parse(string $content): string
{
return (string) collect($this->providers)
->reduce(function (string $parsed, string $provider): string {
$provider = type(new $provider())->as(ParsableContentProvider::class);
$provider = new $provider();

return $provider->parse($parsed);
}, $content);
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
includes:
- vendor/larastan/larastan/extension.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon

parameters:
checkMissingIterableValueType: true
Expand Down

0 comments on commit e7136d7

Please sign in to comment.