mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Fix integration tests by fixing a PHP 8.1+ deprecation warnings in ReflectionClass (#1351)
* gha: get more insights when/if logs exist * Better handle cases when we can receive a concrete instance The problem with `null` being passed to `ReflectionClass` was always there but in PHP 8.1+ it triggers a deprecation warnings. Since having `null` in `$concrete` doesn't make sense to reflect anything anyway, we just throw a custom exception (which gets caught a couple lines below) and just carry on. When using `-v` this can be seen, example: ``` $ ./artisan ide-helper:meta -v Cannot make 'Faker\Generator': Class 'Faker\Provider\en_US\Barcode' not found. Cannot make 'Illuminate\Contracts\Auth\Authenticatable': Class does not exist Cannot make 'cache.psr6': Class 'Symfony\Component\Cache\Adapter\Psr16Adapter' not found. Cannot make 'csp-nonce': Class 'Wza3Mf4CXIvCkcp9K3boMUGJoK6S9maO' not found. Cannot make 'env': Class 'local' not found. Cannot make 'filesystem.cloud': Disk [s3] does not have a configured driver. Cannot make 'redis.connection': Redis connection [default] not configured. A new meta file was written to .phpstorm.meta.php ``` * gha: make sure to run meta with -v to see all output Helps when debugging things * Add CHANGELOG.md entry
This commit is contained in:
@@ -57,16 +57,22 @@ jobs:
|
|||||||
- name: Execute meta run
|
- name: Execute meta run
|
||||||
run: |
|
run: |
|
||||||
cd sample
|
cd sample
|
||||||
php artisan ide-helper:meta
|
php artisan ide-helper:meta -v
|
||||||
|
|
||||||
- name: Check file existence
|
- name: Check file existence
|
||||||
run: |
|
run: |
|
||||||
ls sample/_ide_helper.php
|
ls sample/_ide_helper.php
|
||||||
ls sample/.phpstorm.meta.php
|
ls sample/.phpstorm.meta.php
|
||||||
|
|
||||||
- name: Check file count in logs
|
- name: Check logs
|
||||||
run: |
|
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:
|
php-laravel-integration-tests:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
@@ -115,13 +121,20 @@ jobs:
|
|||||||
- name: Execute meta run
|
- name: Execute meta run
|
||||||
run: |
|
run: |
|
||||||
cd sample
|
cd sample
|
||||||
php artisan ide-helper:meta
|
php artisan ide-helper:meta -v
|
||||||
|
|
||||||
- name: Check file existence
|
- name: Check file existence
|
||||||
run: |
|
run: |
|
||||||
ls sample/_ide_helper.php
|
ls sample/_ide_helper.php
|
||||||
ls sample/.phpstorm.meta.php
|
ls sample/.phpstorm.meta.php
|
||||||
|
|
||||||
- name: Check file count in logs
|
|
||||||
|
- name: Check logs
|
||||||
run: |
|
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
|
||||||
|
|||||||
@@ -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)
|
[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
|
2022-03-06, 2.12.3
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace Barryvdh\LaravelIdeHelper\Console;
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Factories;
|
use Barryvdh\LaravelIdeHelper\Factories;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use RuntimeException;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
@@ -95,6 +96,11 @@ class MetaCommand extends Command
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$concrete = $this->laravel->make($abstract);
|
$concrete = $this->laravel->make($abstract);
|
||||||
|
|
||||||
|
if ($concrete === null) {
|
||||||
|
throw new RuntimeException("Cannot create instance for '$abstract', received 'null'");
|
||||||
|
}
|
||||||
|
|
||||||
$reflectionClass = new \ReflectionClass($concrete);
|
$reflectionClass = new \ReflectionClass($concrete);
|
||||||
if (is_object($concrete) && !$reflectionClass->isAnonymous()) {
|
if (is_object($concrete) && !$reflectionClass->isAnonymous()) {
|
||||||
$bindings[$abstract] = get_class($concrete);
|
$bindings[$abstract] = get_class($concrete);
|
||||||
|
|||||||
Reference in New Issue
Block a user