thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.78k stars 2.67k forks source link

Can not install the latest version (1.4) on Laravel 8.17.2 #5200

Closed mrself closed 3 years ago

mrself commented 3 years ago

Version information

Description

Can not install the latest version (1.4) on Laravel 8.17.2

Steps To Reproduce

Steps to reproduce the behavior:

  1. composer require tcg/voyager:1.4.*

Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover --ansi
PHP Fatal error: Type of TCG\Voyager\Models\DataType::$table must be string (as in class I lluminate\Database\Eloquent\Model) in /home/vagrant/proposals/vendor/tcg/voyager/src/Models /DataType.php on line 12
PHP Fatal error: Uncaught ErrorException: Function must be enabled in php.ini by setting ' xdebug.mode' to 'develop' in /home/vagrant/proposals/vendor/symfony/error-handler/Error/Fat alError.php:37
Stack trace:

0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()

1 /home/vagrant/proposals/vendor/symfony/error-handler/Error/FatalError.php(37): xdebug_ge

t_function_stack()

2 /home/vagrant/proposals/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/Han

dleExceptions.php(143): Symfony\Component\ErrorHandler\Error\FatalError->__construct()

3 /home/vagrant/proposals/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/Han

dleExceptions.php(130): Illuminate\Foundation\Bootstrap\HandleExceptions->fatalErrorFromPhp Error()

4 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()

5 {main}

thrown in /home/vagrant/proposals/vendor/symfony/error-handler/Error/FatalError.php on li ne 37
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

Expected behavior

Expect no errors

fletch3555 commented 3 years ago

The error says that DataType::$table must be a string, which it is: https://github.com/the-control-group/voyager/blob/v1.4.2/src/Models/DataType.php#L18

My only guess is you changed something (likely inadvertently).

mrself commented 3 years ago

Sorry, maybe I do not understand something. Here it is what I see:

image

As you can see, there is no type hint for the $table. And this causes an error. Because the parent class (Illuminate\Database\Eloquent\Model) has a type hint for this property:

image

I am not sure, but looks like my version of php does not allow such a case. Any class should follow property declaration of the parent one. However, I found on the docs, that php 7.4 is supported:

https://voyager-docs.devdojo.com/getting-started/prerequisites

Additionally Voyager requires you to use PHP 7.3 or newer.

MrCrayon commented 3 years ago

That's strange, I don't see any type hint in source code https://github.com/illuminate/database/blob/v8.17.2/Eloquent/Model.php#L46

MrCrayon commented 3 years ago

Are you using PhpStorm as IDE?

mrself commented 3 years ago

Yes, you are right. This was caused by PhpStorm. I just removed the vendor folder and reinstalled all packages. And it worked. Thank you.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.