1

I have an github action script that executes composer install and returns this error:

Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover PHP Fatal error: Uncaught ErrorException: Method ReflectionParameter::getClass() is deprecated in /home/runner/work/projsiteWebApp/projsiteWebApp/vendor/laravel/framework/src/Illuminate/Container/Container.php:853

This is so weried cause this worked just the other day and i have made no changes at all.

I use laravel 5.6 and php 7.1.2 when i do composer install locally it workes fine

first i got this error message back from my github action

Generating optimized autoload files Illuminate\Foundation\ComposerScripts::postAutoloadDump Carbon 1 is deprecated, see how to migrate to Carbon 2. https://carbon.nesbot.com/docs/#api-carbon-2 You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it. @php artisan package:discover PHP Fatal error: Uncaught ErrorException: Method ReflectionParameter::getClass() is deprecated in /home/runner/work/projsiteWebApp/projsiteWebApp/vendor/laravel/framework/src/Illuminate/Container/Container.php:826

then i ran vendor/bin/upgrade-carbon to i got carbon 2.0 now. And with this comand it upgraded laravel to 5.8 so now i have laravel 5.8 and now the error message is as at the top. Only complaining about the depricated getclass method in container.php

this is the yml file that executes the composer install

name: PR WorkFlow

on:
  pull_request:
    branches:
      - master
      - staging

jobs:
  app-tests:
    runs-on: ubuntu-16.04
    steps:
      - uses: actions/checkout@v1
      - name: Copy .env
        run: php -r "file_exists('.env') || copy('.env.example', '.env');"
      - name: Install Composer Dependencies
        run: composer install
      - name: Install NPM Dependencies
         run: npm install
      - name: Generate key
        run: php artisan key:generate
Rob
  • 147
  • 2
  • 11
  • what is the php version on your server? – Muhammad Dyas Yaskur Dec 29 '20 at 15:08
  • Does your php cli is the 7.1.2 version? – Rob Dec 29 '20 at 15:12
  • 1
    Probably you're using **PHP 8**? Check it on terminal `php --version` – STA Dec 29 '20 at 15:13
  • 1
    ReflectionParameter::getClass() got deprecated after PHP 8.0. Be sure that your cli version of php is not using PHP 8.0 – Rob Dec 29 '20 at 15:13
  • 2
    @Rob I just confused to see the same username here, lolzz – STA Dec 29 '20 at 15:14
  • My php version on the server is 7.1.25. It is on the github server it is crashing though. I have specified on my composer.lock file that the platform is php 7.1.25 so it is restricted to that php version. Plus it worked fined the other day – Rob Dec 29 '20 at 15:19
  • Locally i have php version 7.4.9 but again sense i have specified on the composer.lock that nothing that is not compatible with 7.1.25(php version on server) should not be downloaded i should be good @MuhammadDyasYaskur – Rob Dec 29 '20 at 15:22
  • again locally composer install is doing fine – Rob Dec 29 '20 at 15:23
  • when you say php cli is it the same as php version? – Rob Dec 29 '20 at 15:24
  • _"It is on the github server it is crashing"_ - Github server? What do you mean by "The github server"? Github's servers don't run PHP at all. – M. Eriksson Dec 29 '20 at 15:39
  • i mean when i run composer install from github actions yml script – Rob Dec 29 '20 at 15:42

1 Answers1

4

I got some help from the php chat. Come to found out the github was running php 8.0 when executing composer install based of my yml file.

I added i a setup php step like this before my composer install step

  - name: Setup PHP
    uses: shivammathur/setup-php@master
    with:
      php-version: 7.1.25 

And it worked!

Rob
  • 147
  • 2
  • 11