2

I have created a custom class in laravel 10 located in:

App\Helpers\CompletedOrders

The class contain this code:

<?
namespace App\Helpers\CompletedOrders;

class DeliverOrdersByMail
{

    public static function DeliverOrdersToCustomerMail($OrderID)
    {
        return "mail ok ". $OrderID;
    }

}

When I try to call the class on a file:

use App\Helpers\CompletedOrders\DeliverOrdersByMail;

Route::get('test', function(){
    DeliverOrdersByMail::DeliverOrdersToCustomerMail("fgzefef");
});

I'm getting an error that the class is not found!

Class "App\Helpers\CompletedOrders\DeliverOrdersByMail" not found

Any solution please?

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
Cod3rMax
  • 23
  • 4

1 Answers1

0

PHP short_open_tag(<?) depricated.So you have use <?php instead of <?

In PHP 7.4 short_open_tag remains enabled by default: Changing the default could result in code leaks during upgrades, if people rely on the default value rather than explicitly enabling them. Instead:

  • If short_open_tag is enabled and <? is used, a single deprecation notice is emitted.
  • If short_open_tag is enabled, but <? is never used, no deprecation notice is emitted (as before).
  • If short_open_tag is disabled, <? has no special meaning and is interpreted as plain text (as before).

In PHP 8.0 the deprecation notice is converted into a parse error:

  • If short_open_tag is enabled, the use of <? is a parse error.
  • If short_open_tag is disabled, <? has no special meaning (as before).

In PHP 9.0 support for short_open_tag is dropped entirely:

  • .<? never has special meaning, it is always interpreted as plain text.

Ref: https://wiki.php.net/rfc/deprecate_php_short_tags_v2

John Lobo
  • 14,355
  • 2
  • 10
  • 20
  • wow, this didn't come in my mind at all that something like that would cause this problem. Thank you for saving me after 2 hours of trying lol – Cod3rMax Aug 15 '23 at 16:15