Skip to content
Snippets Groups Projects
Commit db927ce2 authored by Alexey Korepov's avatar Alexey Korepov
Browse files

Issue #3424298 by Murz, stomusic: PHP 8.2: Creation of dynamic property is deprecated

parent d5090fbb
No related branches found
No related tags found
1 merge request!86Issue #3424298 by Murz, stomusic: PHP 8.2: Creation of dynamic property is deprecated
Pipeline #141693 passed with warnings
......@@ -38,7 +38,7 @@ class TestHelpersExampleControllerKernelClassicTest extends FieldKernelTestBase
DateFormat::load('medium')->setPattern('d.m.Y')->save();
$user1 = User::create(['name' => 'Alice']);
$user1->save();
NodeType::create(['type' => 'article'])->save();
NodeType::create(['type' => 'article', 'name' => 'Article'])->save();
// Putting coding standards ignore flag to suppress warnings until the
// https://www.drupal.org/project/coder/issues/3185082 is fixed.
// @codingStandardsIgnoreStart
......
......@@ -29,6 +29,13 @@ class EntityQueryServiceStub implements QueryFactoryInterface {
*/
protected array $namespaces;
/**
* A list of execute functions per entity type.
*
* @var array
*/
protected array $executeFunctions;
/**
* {@inheritdoc}
*/
......@@ -154,7 +161,6 @@ class EntityQueryServiceStub implements QueryFactoryInterface {
* The entity type to attach, all entity types by default.
*/
public function stubSetExecuteHandler(callable $function, string $entityTypeId = 'all') {
// @phpstan-ignore-next-line `$this` will be available in the runtime.
$this->executeFunctions[$entityTypeId] = $function;
}
......
......@@ -222,16 +222,31 @@ class EntityStorageStubFactory {
$this->entityTypeId = $this->entityType->id();
// @phpstan-ignore-next-line `$this` will be available in the runtime.
$this->baseEntityClass = $this->entityType->getClass();
if (property_exists($this, 'baseEntityClass')) {
// @phpstan-ignore-next-line `$this` will be available in the runtime.
$this->baseEntityClass = $this->entityType->getClass();
}
// @phpstan-ignore-next-line `$this` will be available in the runtime.
$this->entityTypeBundleInfo = TestHelpers::service('entity_type.bundle.info');
if (property_exists($this, 'entityTypeBundleInfo')) {
// @phpstan-ignore-next-line `$this` will be available in the runtime.
$this->entityTypeBundleInfo = TestHelpers::service('entity_type.bundle.info');
}
// @phpstan-ignore-next-line `$this` will be available in the runtime.
$this->database = TestHelpers::service('database');
if (property_exists($this, 'database')) {
// @phpstan-ignore-next-line `$this` will be available in the runtime.
$this->database = TestHelpers::service('database');
}
// @phpstan-ignore-next-line `$this` will be available in the runtime.
$this->memoryCache = TestHelpers::service('cache.backend.memory')->get('entity_storage_stub.memory_cache.' . $this->entityTypeId);
if (property_exists($this, 'memoryCache')) {
// @phpstan-ignore-next-line `$this` will be available in the runtime.
$this->memoryCache = TestHelpers::service('cache.backend.memory')->get('entity_storage_stub.memory_cache.' . $this->entityTypeId);
}
// @phpstan-ignore-next-line `$this` will be available in the runtime.
$this->cacheBackend = TestHelpers::service('cache.backend.memory')->get('entity_storage_stub.cache.' . $this->entityTypeId);
if (property_exists($this, 'cacheBackend')) {
// @phpstan-ignore-next-line `$this` will be available in the runtime.
$this->cacheBackend = TestHelpers::service('cache.backend.memory')->get('entity_storage_stub.cache.' . $this->entityTypeId);
}
}, $entityStorage, 'stubInit'
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment