laravel-async icon indicating copy to clipboard operation
laravel-async copied to clipboard

Non-static method 'run' should not be called statically error

Open saulob opened this issue 3 years ago • 10 comments

I'm unable to execute the first code from the readme, it says that I cannot execute the run method

Check the screenshot above

image

I'm using Laravel 8 and PHP 7

saulob avatar Aug 04 '21 21:08 saulob

Have you import Async fadecade?

<?php

use Async;

vuongxuongminh avatar Aug 05 '21 14:08 vuongxuongminh

Yeah, did that, did the publish config, everything.

And still same error.

saulob avatar Aug 05 '21 16:08 saulob

Look like you are using VXM\Async\Async, could you show me first few lines of your PHP file?

vuongxuongminh avatar Aug 06 '21 03:08 vuongxuongminh

Same issue for me. I included use Async, but it didn't fine the Async class. Have you found a solution @saulob?

CheeseTastisch avatar Sep 13 '21 19:09 CheeseTastisch

Sorry @CheeseTastisch, no luck here. I removed it, stopped using it :(

saulob avatar Sep 15 '21 12:09 saulob

Hey @saulob. For me it worked fine, as i installed the ide-helper package and execute the command php artisan ide:helper:generate. I hope this can fix it for you as well.

CheeseTastisch avatar Sep 15 '21 13:09 CheeseTastisch

I was able to register it manually (since it was being registered automatically):

$app->register(VXM\Async\AsyncServiceProvider::class);

That resolved this issue, only to throw another error Call to undefined function VXM\\Asyn= c\\config_path(). I can't think of a way where registering it like that would cause this error.

parsasi avatar Oct 29 '21 16:10 parsasi

Any updates on this issue?

lukasmedia avatar Oct 31 '21 18:10 lukasmedia

@parsasi @lukasmedia As i said in the answer before, it's working perfect, if you install ide-helper and run php artisan ide-helper:generate.

Than import the Async Trait (not use VXM\Async\Async but use Async).

CheeseTastisch avatar Nov 13 '21 11:11 CheeseTastisch

Hi @vuongxuongminh this is my code already implemented and followed your documentation step by step, but I experienced some errors at code editor.

Are you able to guide me, please? on how to use the function with use Async

Screenshot: Screen Shot 2022-08-27 at 5 39 28 PM

ramanaptr avatar Aug 27 '22 09:08 ramanaptr

Use VXM\Async\AsyncFacade as Async; instead.

vuongxuongminh avatar Jan 27 '23 06:01 vuongxuongminh