I encountered an issue with the following code:
This code cannot be reproduces as a standalone. You need laravel + phpstan as the problem is related with /vendor/nesbot/carbon/extension.neon
I post this here because I am unable to find the location of the repo containing that file and I think carbon is at fault, and not phpstan (my other macros works). If this needs to be deleted and moved, please tell me
namespace App\Macros;
use Closure;
class Carbon
{
public function createWithoutTime(): Closure
{
return fn (string $date) => \now()
->setDateFrom($date)
->setHour(0)
->setMinute(0)
->setSecond(0)
->setMillisecond(0);
}
}
Carbon version: 2.67.0
PHP version: 8.1.20
The problem:
My macro is attached as it should via
Carbon::mixin(new MacrosCarbon());
Now, this works, I can call my function as I need to. Now, if I don't include
- ./vendor/nesbot/carbon/extension.neon
inside my phpstan.neon file I get
Call to an undefined static method Illuminate\Support\Carbon::createWithoutTime().
Which makes sense (I think). Now, adding that line of text inside phpstan.neon, I get (verbose output)
Hello,
I encountered an issue with the following code: This code cannot be reproduces as a standalone. You need laravel + phpstan as the problem is related with /vendor/nesbot/carbon/extension.neon I post this here because I am unable to find the location of the repo containing that file and I think carbon is at fault, and not phpstan (my other macros works). If this needs to be deleted and moved, please tell me
Carbon version: 2.67.0 PHP version: 8.1.20
The problem: My macro is attached as it should via
Now, this works, I can call my function as I need to. Now, if I don't include
inside my phpstan.neon file I get
Which makes sense (I think). Now, adding that line of text inside phpstan.neon, I get (verbose output)