Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Phpstan test2 #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alexcoderabbitai wants to merge 4 commits into main from phpstan-test2
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions phpstan.neon
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
parameters:
level: 0
paths:
- .
excludePaths:
- vendor/*
- node_modules/*
- .git/*

9 changes: 9 additions & 0 deletions test.php
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php declare(strict_types = 1);

class HelloWorld
{
public function sayHello(DateTimeImutable $date): void
Copy link

@coderabbitai coderabbitai bot Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Typo in typehint: DateTimeImutable → DateTimeImmutable (double "m").

This will result in a fatal TypeError at call time.

- public function sayHello(DateTimeImutable $date): void
+ public function sayHello(DateTimeImmutable $date): void

Run:


🏁 Script executed:

#!/bin/bash
php -l test.php
rg -n 'DateTimeImutable|DateTimeImmutable' -S test.php

Length of output: 98


🏁 Script executed:

#!/bin/bash
# Search entire repository for custom definitions or imports of the misspelled or correct class
rg -nP 'class\s+DateTimeImutable' .
rg -nP 'use\s+.*DateTimeImutable' .
rg -nP 'class\s+DateTimeImmutable' .
rg -nP 'use\s+.*DateTimeImmutable' .

Length of output: 0


Correct typehint typo: use DateTimeImmutable instead of DateTimeImutable to reference the built-in class and prevent a fatal error at call time.

- public function sayHello(DateTimeImutable $date): void
+ public function sayHello(DateTimeImmutable $date): void
📝 Committable suggestion

!!️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public function sayHello(DateTimeImutable $date): void
public function sayHello(DateTimeImmutable $date): void
🤖 Prompt for AI Agents
In test.php around line 5, the typehint `DateTimeImutable` is misspelled and
should be `DateTimeImmutable`; update the function signature to use the correct
built-in class name `DateTimeImmutable` so the typehint resolves correctly and
avoids runtime fatal errors.

{
echo 'Hello, ' . $date->format('j. n. Y');
}
}

AltStyle によって変換されたページ (->オリジナル) /