Skip to content

Commit 590c606

Browse files
mjansenDatabayrfalkenstein
authored andcommitted
[FIX] Remove setAccessible(true) "Reflection API" calls from codebase
1 parent bbfe255 commit 590c606

8 files changed

Lines changed: 0 additions & 11 deletions

File tree

components/ILIAS/AdvancedMetaData/tests/record/ilAdvancedMDRecordObjectOrderingsTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public function testConstruct(): void
3838
public function testGlobalRecordSorting(): void
3939
{
4040
$record_id_reflection = new ReflectionMethod(ilAdvancedMDRecord::class, 'setRecordId');
41-
$record_id_reflection->setAccessible(true);
4241

4342
$ids = [1, 2, 3, 4, 5];
4443
$positions = array_reverse($ids);

components/ILIAS/Chatroom/tests/ilObjChatroomAccessTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ protected function setUp(): void
211211

212212
$settingsReflection = new ReflectionClass(ilSetting::class);
213213
$cache = $settingsReflection->getProperty('settings_cache');
214-
$cache->setAccessible(true);
215214
$cache->setValue($settingsReflection, []);
216215

217216
$this->access = new ilObjChatroomAccess();

components/ILIAS/File/classes/Versions/class.ilObjFileVersion.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public function getArrayCopy(): array
4141
$a = [];
4242
$r = new ReflectionClass($this);
4343
foreach ($r->getProperties() as $p) {
44-
$p->setAccessible(true);
4544
$a[$p->getName()] = $p->getValue($this);
4645
}
4746
return $a;

components/ILIAS/File/tests/ilModulesFileTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ public function testAppendStream(): void
138138

139139
$r = new ReflectionClass(ilObjFile::class);
140140
$property = $r->getProperty('just_notified');
141-
$property->setAccessible(true);
142141
$property->setValue($file, true);
143142
$file->setMode(ilObjFile::MODE_FILELIST);
144143
$this->db_mock

components/ILIAS/Mail/tests/ilMailAddressTypesTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ private function getWrappedAddressType(ilMailAddressType $type): ilMailAddressTy
5959
if ($type instanceof ilMailCachedAddressType) {
6060
$refl = new ReflectionObject($type);
6161
$inner = $refl->getProperty('inner');
62-
$inner->setAccessible(true);
6362

6463
return $inner->getValue($type);
6564
}

components/ILIAS/Test/tests/ilTestSkillLevelThresholdImportListTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public function testAddOriginalSkillTitle(): void
4646
$this->testObj->addOriginalSkillTitle($skillBaseId, $skillTrefId, $originalSkillTitle);
4747

4848
$reflProp = new ReflectionProperty($this->testObj, 'originalSkillTitles');
49-
$reflProp->setAccessible(true);
5049

5150
$this->assertEquals(["$skillBaseId:$skillTrefId" => $originalSkillTitle], $reflProp->getValue($this->testObj));
5251
}
@@ -59,7 +58,6 @@ public function testAddOriginalSkillPath(): void
5958
$this->testObj->addOriginalSkillPath($skillBaseId, $skillTrefId, $originalSkillPath);
6059

6160
$reflProp = new ReflectionProperty($this->testObj, 'originalSkillPaths');
62-
$reflProp->setAccessible(true);
6361

6462
$this->assertEquals(["$skillBaseId:$skillTrefId" => $originalSkillPath], $reflProp->getValue($this->testObj));
6563
}
@@ -70,7 +68,6 @@ public function testAddSkillLevelThreshold(): void
7068
$this->testObj->addSkillLevelThreshold($testSkillLevelThresholdImport);
7169

7270
$reflProp = new ReflectionProperty($this->testObj, 'importedSkillLevelThresholds');
73-
$reflProp->setAccessible(true);
7471

7572
$this->assertEquals([$testSkillLevelThresholdImport], $reflProp->getValue($this->testObj));
7673
}

components/ILIAS/TestQuestionPool/tests/assLongMenuTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ protected static function getMethod($name): ReflectionMethod
3232
{
3333
$class = new ReflectionClass(assLongMenu::class);
3434
$method = $class->getMethod($name);
35-
$method->setAccessible(true);
3635
return $method;
3736
}
3837

components/ILIAS/Tree/tests/ilRepositoryTreeTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public function testInitLanguage(): void
5555
$tree = new ilTree(1);
5656
$tree->initLangCode();
5757
$tree_reflection = new ReflectionProperty($tree, 'lang_code');
58-
$tree_reflection->setAccessible(true);
5958
$this->assertEquals('en', $tree_reflection->getValue($tree));
6059

6160
// user getCurrentLanguage() from session is empty
@@ -69,7 +68,6 @@ public function testInitLanguage(): void
6968
$this->setGlobalVariable('ilUser', $user);
7069
$tree->initLangCode();
7170
$tree_reflection = new ReflectionProperty($tree, 'lang_code');
72-
$tree_reflection->setAccessible(true);
7371
$this->assertEquals('en', $tree_reflection->getValue($tree));
7472
}
7573

0 commit comments

Comments
 (0)