mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-17 17:47:13 +00:00
Remove calls to PHP 8.5-deprecated setAccessible (#1744)
These are no-op as of PHP 8.1 and thus no longer needed See also https://wiki.php.net/rfc/make-reflection-setaccessible-no-op
This commit is contained in:
@@ -124,7 +124,6 @@ $reflection = new ReflectionClass($loader);
|
|||||||
$property = $reflection->hasProperty('paths')
|
$property = $reflection->hasProperty('paths')
|
||||||
? $reflection->getProperty('paths')
|
? $reflection->getProperty('paths')
|
||||||
: $reflection->getProperty('path');
|
: $reflection->getProperty('path');
|
||||||
$property->setAccessible(true);
|
|
||||||
|
|
||||||
$paths = Illuminate\Support\Arr::wrap($property->getValue($loader));
|
$paths = Illuminate\Support\Arr::wrap($property->getValue($loader));
|
||||||
|
|
||||||
|
|||||||
@@ -887,7 +887,6 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
if (in_array($relation, ['hasOne', 'hasOneThrough', 'morphOne'], true)) {
|
if (in_array($relation, ['hasOne', 'hasOneThrough', 'morphOne'], true)) {
|
||||||
$defaultProp = $reflectionObj->getProperty('withDefault');
|
$defaultProp = $reflectionObj->getProperty('withDefault');
|
||||||
$defaultProp->setAccessible(true);
|
|
||||||
|
|
||||||
return !$defaultProp->getValue($relationObj);
|
return !$defaultProp->getValue($relationObj);
|
||||||
}
|
}
|
||||||
@@ -897,7 +896,6 @@ class ModelsCommand extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$fkProp = $reflectionObj->getProperty('foreignKey');
|
$fkProp = $reflectionObj->getProperty('foreignKey');
|
||||||
$fkProp->setAccessible(true);
|
|
||||||
|
|
||||||
$enforceNullableRelation = $this->laravel['config']->get('ide-helper.enforce_nullable_relationships', true);
|
$enforceNullableRelation = $this->laravel['config']->get('ide-helper.enforce_nullable_relationships', true);
|
||||||
|
|
||||||
@@ -930,7 +928,6 @@ class ModelsCommand extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$fkProp = $reflectionObj->getProperty('foreignKey');
|
$fkProp = $reflectionObj->getProperty('foreignKey');
|
||||||
$fkProp->setAccessible(true);
|
|
||||||
|
|
||||||
foreach (Arr::wrap($fkProp->getValue($relationObj)) as $foreignKey) {
|
foreach (Arr::wrap($fkProp->getValue($relationObj)) as $foreignKey) {
|
||||||
if (isset($this->nullableColumns[$foreignKey])) {
|
if (isset($this->nullableColumns[$foreignKey])) {
|
||||||
@@ -1283,9 +1280,6 @@ class ModelsCommand extends Command
|
|||||||
*/
|
*/
|
||||||
protected function getAttributeTypes(Model $model, \ReflectionMethod $reflectionMethod): Collection
|
protected function getAttributeTypes(Model $model, \ReflectionMethod $reflectionMethod): Collection
|
||||||
{
|
{
|
||||||
// Private/protected ReflectionMethods require setAccessible prior to PHP 8.1
|
|
||||||
$reflectionMethod->setAccessible(true);
|
|
||||||
|
|
||||||
/** @var Attribute $attribute */
|
/** @var Attribute $attribute */
|
||||||
$attribute = $reflectionMethod->invoke($model);
|
$attribute = $reflectionMethod->invoke($model);
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ class Factories
|
|||||||
$factory = app(Factory::class);
|
$factory = app(Factory::class);
|
||||||
|
|
||||||
$definitions = (new ReflectionClass(Factory::class))->getProperty('definitions');
|
$definitions = (new ReflectionClass(Factory::class))->getProperty('definitions');
|
||||||
$definitions->setAccessible(true);
|
|
||||||
|
|
||||||
foreach ($definitions->getValue($factory) as $factory_target => $config) {
|
foreach ($definitions->getValue($factory) as $factory_target => $config) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user