Skip to content

Commit 73dab31

Browse files
authored
Improve RevisionableStorageInterface stub (#596)
* Improve RevisionableStorageInterface stub * Fix when inferred as ContentEntityStorageBase * caching and ordering is silly * document madness * fix union types * track actual error * error is 10.1.0+
1 parent 93fd7a6 commit 73dab31

14 files changed

+130
-2
lines changed

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ parameters:
88
- drupal-autoloader.php
99
- tests/src
1010
excludePaths:
11+
- tests/src/data/*.php
1112
- tests/src/Type/data/*.php
1213
- tests/src/Rules/data/*.php
1314
dynamicConstantNames:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Drupal\Core\Entity;
4+
5+
interface BundleEntityStorageInterface {
6+
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Drupal\Core\Entity;
4+
5+
abstract class ContentEntityStorageBase extends EntityStorageBase implements ContentEntityStorageInterface, DynamicallyFieldableEntityStorageInterface, BundleEntityStorageInterface {
6+
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Drupal\Core\Entity;
4+
5+
// Remove extension of `EntityStorageInterface` so that `TranslatableRevisionableStorageInterface`
6+
// is properly processed.
7+
interface ContentEntityStorageInterface extends TranslatableRevisionableStorageInterface {
8+
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Drupal\Core\Entity;
4+
5+
interface DynamicallyFieldableEntityStorageInterface extends FieldableEntityStorageInterface, FieldStorageDefinitionListenerInterface, FieldDefinitionListenerInterface {
6+
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Drupal\Core\Entity;
4+
5+
abstract class EntityHandlerBase {
6+
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Drupal\Core\Entity;
4+
5+
interface EntityHandlerInterface {
6+
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Drupal\Core\Entity;
4+
5+
abstract class EntityStorageBase extends EntityHandlerBase implements EntityStorageInterface, EntityHandlerInterface {
6+
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Drupal\Core\Entity;
4+
5+
6+
interface FieldableEntityStorageInterface extends EntityStorageInterface {
7+
}

stubs/Drupal/Core/Entity/RevisionableStorageInterface.stub

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ interface RevisionableStorageInterface extends EntityStorageInterface {
77
/**
88
* @param int|numeric-string $revision_id
99
* @return \Drupal\Core\Entity\RevisionableInterface|null
10-
* @not-deprecated
1110
*/
1211
public function loadRevision($revision_id);
1312

1413
/**
1514
* @param int|numeric-string $revision_id
16-
* @not-deprecated
1715
*/
1816
public function deleteRevision($revision_id): void;
1917

0 commit comments

Comments
 (0)