Skip to content
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

Laravel 7x (php 7.3) : Laravel Lang not working #99

Closed
visualight opened this issue Sep 9, 2023 · 2 comments
Closed

Laravel 7x (php 7.3) : Laravel Lang not working #99

visualight opened this issue Sep 9, 2023 · 2 comments

Comments

@visualight
Copy link

Environment

  • Laravel-Lang Common Version: 1.0.0
  • Laravel Version: 7.30.6
  • PHP Version: 7.3.28

I installed Laravel Lang without any problem but the command : php artisan lang:add fr (or other lang) return the following error :

 ParseError 

  syntax error, unexpected 'static' (T_STATIC)

  at vendor/dragon-code/contracts/src/Pretty/Arr/Caseable.php:17
    13|     public const PASCAL_CASE = 4;
    14| 
    15|     public const SNAKE_CASE = 2;
    16| 
  > 17|     public function setCase(int $type = self::NO_CASE): static;
    18| }

Issue description

$ composer require --dev laravel-lang/common

Info from https://repo.packagist.org: #StandWithUkraine
Using version ^1.0 for laravel-lang/common
./composer.json has been updated
Running composer update laravel-lang/common
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Lock file operations: 8 installs, 0 updates, 0 removals
  - Locking dragon-code/contracts (v2.20.0)
  - Locking dragon-code/pretty-array (v3.0.0)
  - Locking dragon-code/support (v5.8.1)
  - Locking laravel-lang/attributes (v1.1.3)
  - Locking laravel-lang/common (v1.0.0)
  - Locking laravel-lang/http-statuses (v2.1.3)
  - Locking laravel-lang/lang (10.9.5)
  - Locking laravel-lang/publisher (v12.2.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 8 installs, 0 updates, 0 removals
  - Installing dragon-code/contracts (v2.20.0): Extracting archive
  - Installing dragon-code/support (v5.8.1): Extracting archive
  - Installing dragon-code/pretty-array (v3.0.0): Extracting archive
  - Installing laravel-lang/publisher (v12.2.1): Extracting archive
  - Installing laravel-lang/lang (10.9.5): Extracting archive
  - Installing laravel-lang/http-statuses (v2.1.3): Extracting archive
  - Installing laravel-lang/attributes (v1.1.3): Extracting archive
  - Installing laravel-lang/common (v1.0.0): Extracting archive
5 package suggestions were added by new dependencies, use `composer suggest` to see details.
$ php artisan lang:add fr
    
Processing LaravelLang\Attributes\Provider...
Processing LaravelLang\HttpStatuses\Provider...
Processing LaravelLang\Lang\Provider...
Saving changes...

   ParseError 

  syntax error, unexpected 'static' (T_STATIC)

  at vendor/dragon-code/contracts/src/Pretty/Arr/Caseable.php:17
    13|     public const PASCAL_CASE = 4;
    14| 
    15|     public const SNAKE_CASE = 2;
    16| 
  > 17|     public function setCase(int $type = self::NO_CASE): static;
    18| }
    19| 

      +1 vendor frames 
  2   [internal]:0
      Composer\Autoload\ClassLoader::loadClass("DragonCode\Contracts\Pretty\Arr\Caseable")

      +3 vendor frames 
  6   [internal]:0
      Composer\Autoload\ClassLoader::loadClass("DragonCode\PrettyArray\Services\Formatter")

Steps to reproduce

  1. Install Laravel ^7
  2. Install Laravel Lang
  3. Gen a language
  4. See error
@andrey-helldar
Copy link
Member

andrey-helldar commented Sep 9, 2023

To solve this problem you need to install a specific version of the dependency:

composer require dragon-code/contracts:2.19.1 --dev

Contracts version 2.20 includes changes that cause this error.

@andrey-helldar
Copy link
Member

Since you are not the first person to encounter a similar error on older versions of Laravel, which are not supported by us or the Laravel team, I still released a fix for the 1st version.

You can simply run the composer update command and everything you need will be installed automatically.

Thank you for your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants