Skip to content

Preview/phpstan #60

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
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
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

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix the typo in the class name.

There's a typo in the parameter type. DateTimeImutable should be DateTimeImmutable (missing 'm').

-    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
🧰 Tools
🪛 PHPStan (2.1.17)

5-5: Parameter $date of method HelloWorld::sayHello() has invalid type DateTimeImutable.

(class.notFound)

🤖 Prompt for AI Agents
In test.php at line 5, correct the typo in the parameter type from
DateTimeImutable to DateTimeImmutable by adding the missing 'm' to fix the class
name.

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