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:
Jesper Noordsij
2025-12-10 10:10:09 +01:00
committed by GitHub
parent 12a0d7d54c
commit e9283c40a2
3 changed files with 0 additions and 8 deletions
-1
View File
@@ -124,7 +124,6 @@ $reflection = new ReflectionClass($loader);
$property = $reflection->hasProperty('paths')
? $reflection->getProperty('paths')
: $reflection->getProperty('path');
$property->setAccessible(true);
$paths = Illuminate\Support\Arr::wrap($property->getValue($loader));
-6
View File
@@ -887,7 +887,6 @@ class ModelsCommand extends Command
if (in_array($relation, ['hasOne', 'hasOneThrough', 'morphOne'], true)) {
$defaultProp = $reflectionObj->getProperty('withDefault');
$defaultProp->setAccessible(true);
return !$defaultProp->getValue($relationObj);
}
@@ -897,7 +896,6 @@ class ModelsCommand extends Command
}
$fkProp = $reflectionObj->getProperty('foreignKey');
$fkProp->setAccessible(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->setAccessible(true);
foreach (Arr::wrap($fkProp->getValue($relationObj)) as $foreignKey) {
if (isset($this->nullableColumns[$foreignKey])) {
@@ -1283,9 +1280,6 @@ class ModelsCommand extends Command
*/
protected function getAttributeTypes(Model $model, \ReflectionMethod $reflectionMethod): Collection
{
// Private/protected ReflectionMethods require setAccessible prior to PHP 8.1
$reflectionMethod->setAccessible(true);
/** @var Attribute $attribute */
$attribute = $reflectionMethod->invoke($model);
-1
View File
@@ -16,7 +16,6 @@ class Factories
$factory = app(Factory::class);
$definitions = (new ReflectionClass(Factory::class))->getProperty('definitions');
$definitions->setAccessible(true);
foreach ($definitions->getValue($factory) as $factory_target => $config) {
try {