diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index 1ddd591..a7632bc 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -57,16 +57,22 @@ jobs: - name: Execute meta run run: | cd sample - php artisan ide-helper:meta + php artisan ide-helper:meta -v - name: Check file existence run: | ls sample/_ide_helper.php ls sample/.phpstorm.meta.php - - name: Check file count in logs + - name: Check logs run: | - if [ `ls -1q "sample/storage/logs/" | wc -l` -gt 0 ];then exit 1;fi + if [ `ls -1q "sample/storage/logs/" | wc -l` -gt 0 ]; then + for logfile in sample/storage/logs/*; do + echo "-- $logfile --" + cat $logfile + done + exit 1 + fi php-laravel-integration-tests: runs-on: ubuntu-20.04 @@ -115,13 +121,20 @@ jobs: - name: Execute meta run run: | cd sample - php artisan ide-helper:meta + php artisan ide-helper:meta -v - name: Check file existence run: | ls sample/_ide_helper.php ls sample/.phpstorm.meta.php - - name: Check file count in logs + + - name: Check logs run: | - if [ `ls -1q "sample/storage/logs/" | wc -l` -gt 0 ];then exit 1;fi + if [ `ls -1q "sample/storage/logs/" | wc -l` -gt 0 ]; then + for logfile in sample/storage/logs/*; do + echo "-- $logfile --" + cat $logfile + done + exit 1 + fi diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b1d2df..a2f51d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. [Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.12.3...master) -------------- +### Fixes +- Handle PHP 8.1 deprecation warnings when passing `null` to `new \ReflectionClass` [#1351 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1351) + 2022-03-06, 2.12.3 ------------------ diff --git a/src/Console/MetaCommand.php b/src/Console/MetaCommand.php index f9dfbe7..a80c5d2 100644 --- a/src/Console/MetaCommand.php +++ b/src/Console/MetaCommand.php @@ -13,6 +13,7 @@ namespace Barryvdh\LaravelIdeHelper\Console; use Barryvdh\LaravelIdeHelper\Factories; use Illuminate\Console\Command; +use RuntimeException; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -95,6 +96,11 @@ class MetaCommand extends Command try { $concrete = $this->laravel->make($abstract); + + if ($concrete === null) { + throw new RuntimeException("Cannot create instance for '$abstract', received 'null'"); + } + $reflectionClass = new \ReflectionClass($concrete); if (is_object($concrete) && !$reflectionClass->isAnonymous()) { $bindings[$abstract] = get_class($concrete);