diff -u b/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php --- b/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -1227,6 +1227,11 @@ $original = $this->original; $this->original = &$original; + // Ensure the original property is actually cloned by overwriting the + // original reference with one pointing to a copy of it. + $original = $this->original; + $this->original = &$original; + $fields = $this->fields; $this->fields = &$fields; diff -u b/core/lib/Drupal/Core/FileTransfer/FileTransfer.php b/core/lib/Drupal/Core/FileTransfer/FileTransfer.php --- b/core/lib/Drupal/Core/FileTransfer/FileTransfer.php +++ b/core/lib/Drupal/Core/FileTransfer/FileTransfer.php @@ -40,12 +40,6 @@ * @var int */ protected $port; - - /** - * Full path to directory where file-transfer is restricted to. - * - * @var string - */ protected $jail; /** diff -u b/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php --- b/core/modules/user/src/Entity/User.php +++ b/core/modules/user/src/Entity/User.php @@ -74,6 +74,8 @@ * @var \Drupal\user\UserInterface */ protected static $anonymousUser; + // phpcs:disable Drupal.Classes.PropertyDeclaration + public $_skipProtectedUserFieldConstraint; /** * {@inheritdoc} diff -u b/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php --- b/core/modules/views_ui/src/ViewUI.php +++ b/core/modules/views_ui/src/ViewUI.php @@ -86,6 +86,13 @@ public $live_preview; public $renderPreview = FALSE; + public $displays; + public $actions; + + /** + * Drupal\Tests\views_ui\Functional\FilterUITest::testFiltersUI(). + */ + public $form_cache; /** * The View storage object. only in patch2: unchanged: --- a/core/lib/Drupal/Component/Diff/Engine/DiffEngine.php +++ b/core/lib/Drupal/Component/Diff/Engine/DiffEngine.php @@ -31,6 +31,16 @@ class DiffEngine { const MAX_XREF_LENGTH = 10000; + private array $xchanged; + private array $ychanged; + private array $xv; + private array $yv; + private array $xind; + private array $yind; + private ?array $seq; + private ?array $in_seq; + private ?int $lcs; + public function diff($from_lines, $to_lines) { $n_from = sizeof($from_lines); only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Query/Condition.php +++ b/core/lib/Drupal/Core/Database/Query/Condition.php @@ -10,6 +10,11 @@ */ class Condition implements ConditionInterface, \Countable { + /** + * @var \Drupal\Core\Database\Query\SelectInterface + */ + public $sqlQuery; + /** * Provides a map of condition operators to condition operator options. */ only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php +++ b/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php @@ -42,6 +42,7 @@ class EntityFormDisplay extends EntityDisplayBase implements EntityFormDisplayIn * {@inheritdoc} */ protected $displayContext = 'form'; + protected $widgets; /** * Returns the entity_form_display object used to build an entity form. only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php +++ b/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php @@ -41,6 +41,7 @@ class EntityViewDisplay extends EntityDisplayBase implements EntityViewDisplayIn * {@inheritdoc} */ protected $displayContext = 'view'; + protected $formatters; /** * Returns the display objects used to render a set of entities. only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php @@ -114,6 +114,13 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl */ protected $renderer; + /** + * Stores serializable keys which is used in __sleep()/__wakeup(). + * + * @var string[] + */ + protected $serializedKeys; + /** * {@inheritdoc} */ @@ -542,8 +549,8 @@ public function __sleep() { // Keep track of the serialized keys, to avoid calling toArray() again in // __wakeup(). Because of the way __sleep() works, the data has to be // present in the object to be included in the serialized values. - $keys[] = '_serializedKeys'; - $this->_serializedKeys = $keys; + $keys[] = 'serializedKeys'; + $this->serializedKeys = $keys; return $keys; } @@ -553,8 +560,8 @@ public function __sleep() { public function __wakeup() { // Determine what were the properties from toArray() that were saved in // __sleep(). - $keys = $this->_serializedKeys; - unset($this->_serializedKeys); + $keys = $this->serializedKeys; + unset($this->serializedKeys); $values = array_intersect_key(get_object_vars($this), array_flip($keys)); // Run those values through the __construct(), as if they came from a // regular entity load. only in patch2: unchanged: --- a/core/lib/Drupal/Core/Session/UserSession.php +++ b/core/lib/Drupal/Core/Session/UserSession.php @@ -66,6 +66,23 @@ class UserSession implements AccountInterface { * @var string */ protected $timezone; + protected $langcode; + protected $pass; + protected $status; + protected $created; + protected $changed; + protected $login; + protected $init; + protected $default_langcode; + protected $content_translation_source; + protected $content_translation_outdated; + protected $content_translation_uid; + protected $content_translation_status; + protected $content_translation_created; + protected $rest_test_validation; + public $pass_raw; + public $passRaw; + public $sessionId; /** * Constructs a new user session. only in patch2: unchanged: --- a/core/modules/block/src/Entity/Block.php +++ b/core/modules/block/src/Entity/Block.php @@ -137,6 +137,7 @@ class Block extends ConfigEntityBase implements BlockInterface, EntityWithPlugin * @var string */ protected $theme; + protected $provider; /** * {@inheritdoc} only in patch2: unchanged: --- a/core/modules/contact/tests/src/Unit/MailHandlerTest.php +++ b/core/modules/contact/tests/src/Unit/MailHandlerTest.php @@ -9,6 +9,7 @@ use Drupal\Core\Language\Language; use Drupal\Core\Session\AccountInterface; use Drupal\Tests\UnitTestCase; +use Drupal\user\Entity\User; /** * @coversDefaultClass \Drupal\contact\MailHandler @@ -292,7 +293,7 @@ public function getSendMailMessages() { * Mock sender for testing. */ protected function getMockSender($anonymous = TRUE, $mail_address = 'anonymous@drupal.org') { - $sender = $this->createMock('\Drupal\Core\Session\AccountInterface'); + $sender = $this->createMock(User::class); $sender->expects($this->once()) ->method('isAnonymous') ->willReturn($anonymous); only in patch2: unchanged: --- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDefaultFormatter.php +++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDefaultFormatter.php @@ -22,6 +22,15 @@ */ class TestFieldDefaultFormatter extends FormatterBase { + /** + * Custom property to serialize in test. + * + * @see \Drupal\Tests\field_ui\Kernel\EntityDisplayTest::testFieldComponent() + * + * @var string + */ + public $randomValue; + /** * {@inheritdoc} */ only in patch2: unchanged: --- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidget.php +++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidget.php @@ -23,6 +23,11 @@ */ class TestFieldWidget extends WidgetBase { + /** + * \Drupal\Tests\field_ui\Kernel\EntityFormDisplayTest. + */ + public $randomValue; + /** * {@inheritdoc} */ only in patch2: unchanged: --- a/core/modules/migrate/src/Plugin/Migration.php +++ b/core/modules/migrate/src/Plugin/Migration.php @@ -327,6 +327,19 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn self::STATUS_DISABLED => 'Disabled', ]; + protected $class; + // phpcs:disable Drupal.Classes.PropertyDeclaration + protected $_discovered_file_path; + protected $deriver; + protected $target_types; + protected $field_plugin_method; + + /** + * Drupal\Tests\migrate\Kernel\MigrateSkipRowTest. + */ + protected $load; + public $provider; + /** * Constructs a Migration. * only in patch2: unchanged: --- a/core/modules/migrate_drupal/src/Plugin/migrate/FieldMigration.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/FieldMigration.php @@ -21,6 +21,7 @@ class FieldMigration extends Migration implements ContainerFactoryPluginInterfac * @var bool */ protected $init = FALSE; + protected $field_plugin_method; /** * The migration field discovery service. only in patch2: unchanged: --- a/core/modules/node/tests/src/Unit/NodeOperationAccessTest.php +++ b/core/modules/node/tests/src/Unit/NodeOperationAccessTest.php @@ -11,9 +11,9 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\node\Entity\Node; use Drupal\node\NodeAccessControlHandler; use Drupal\node\NodeGrantDatabaseStorageInterface; -use Drupal\node\NodeInterface; use Drupal\node\NodeStorageInterface; use Drupal\Tests\UnitTestCase; @@ -74,7 +74,7 @@ public function testRevisionOperations($operation, array $hasPermissionMap, $ass $nid = 333; /** @var \Drupal\node\NodeInterface|\PHPUnit\Framework\MockObject\MockObject $node */ - $node = $this->createMock(NodeInterface::class); + $node = $this->createMock(Node::class); $node->expects($this->any()) ->method('language') ->willReturn($language); only in patch2: unchanged: --- a/core/modules/system/src/Entity/Action.php +++ b/core/modules/system/src/Entity/Action.php @@ -79,6 +79,12 @@ class Action extends ConfigEntityBase implements ActionConfigEntityInterface, En * @var \Drupal\Core\Action\ActionPluginCollection */ protected $pluginCollection; + protected $url; + protected $submit; + protected $form_build_id; + protected $form_token; + protected $form_id; + protected $confirm; /** * Encapsulates the creation of the action's LazyPluginCollection. only in patch2: unchanged: --- a/core/modules/system/tests/modules/entity_test/src/TypedData/ComputedString.php +++ b/core/modules/system/tests/modules/entity_test/src/TypedData/ComputedString.php @@ -11,6 +11,11 @@ */ class ComputedString extends TypedData implements CacheableDependencyInterface { + /** + * Drupal\Tests\jsonapi\Kernel\Normalizer\FieldItemNormalizerTest. + */ + protected $value; + /** * {@inheritdoc} */ only in patch2: unchanged: --- a/core/modules/system/tests/src/Functional/Database/FakeRecord.php +++ b/core/modules/system/tests/src/Functional/Database/FakeRecord.php @@ -17,6 +17,8 @@ class FakeRecord { * @var int */ public $fakeArg; + public $name; + public $job; /** * Constructs a FakeRecord object with an optional constructor argument. only in patch2: unchanged: --- a/core/modules/views/src/ManyToOneHelper.php +++ b/core/modules/views/src/ManyToOneHelper.php @@ -21,6 +21,15 @@ */ class ManyToOneHelper { + /** + * Should the field to use formula or alias. + * + * @see \Drupal\views\ManyToOneHelper::getField() + * + * @var bool + */ + public $formula = FALSE; + /** * The handler. */ only in patch2: unchanged: --- a/core/modules/views/src/ViewExecutable.php +++ b/core/modules/views/src/ViewExecutable.php @@ -413,6 +413,27 @@ class ViewExecutable { ], '#cache' => [], ]; + public $default_display; + public $execute_time; + public $live_preview; + + /** + * Drupal\Tests\views\Unit\Plugin\display\PathPluginBaseTest. + * + * @see \Drupal\views\Plugin\views\display\DisplayPluginBase::initDisplay() + */ + public $editing; + + /** + * Drupal\Tests\taxonomy\Functional\Views\RelationshipRepresentativeNodeTest. + */ + public $namespace; + + /** + * Drupal\Tests\views\Functional\Plugin\ContextualFiltersStringTest. + */ + public $many_to_one_count; + public $many_to_one_aliases; /** * The current user. only in patch2: unchanged: --- a/core/modules/views/src/Views.php +++ b/core/modules/views/src/Views.php @@ -308,7 +308,7 @@ public static function getViewsAsOptions($views_only = FALSE, $filter = 'all', $ case 'disabled': case 'enabled': $filter = ucfirst($filter); - $views = call_user_func("static::get{$filter}Views"); + $views = call_user_func(static::class . "::get{$filter}Views"); break; default: only in patch2: unchanged: --- a/core/phpstan-baseline.neon +++ b/core/phpstan-baseline.neon @@ -15,51 +15,6 @@ parameters: count: 1 path: includes/update.inc - - - message: "#^Access to an undefined property Drupal\\\\Component\\\\Diff\\\\Engine\\\\DiffEngine\\:\\:\\$in_seq\\.$#" - count: 3 - path: lib/Drupal/Component/Diff/Engine/DiffEngine.php - - - - message: "#^Access to an undefined property Drupal\\\\Component\\\\Diff\\\\Engine\\\\DiffEngine\\:\\:\\$lcs\\.$#" - count: 4 - path: lib/Drupal/Component/Diff/Engine/DiffEngine.php - - - - message: "#^Access to an undefined property Drupal\\\\Component\\\\Diff\\\\Engine\\\\DiffEngine\\:\\:\\$seq\\.$#" - count: 7 - path: lib/Drupal/Component/Diff/Engine/DiffEngine.php - - - - message: "#^Access to an undefined property Drupal\\\\Component\\\\Diff\\\\Engine\\\\DiffEngine\\:\\:\\$xchanged\\.$#" - count: 2 - path: lib/Drupal/Component/Diff/Engine/DiffEngine.php - - - - message: "#^Access to an undefined property Drupal\\\\Component\\\\Diff\\\\Engine\\\\DiffEngine\\:\\:\\$xind\\.$#" - count: 2 - path: lib/Drupal/Component/Diff/Engine/DiffEngine.php - - - - message: "#^Access to an undefined property Drupal\\\\Component\\\\Diff\\\\Engine\\\\DiffEngine\\:\\:\\$xv\\.$#" - count: 5 - path: lib/Drupal/Component/Diff/Engine/DiffEngine.php - - - - message: "#^Access to an undefined property Drupal\\\\Component\\\\Diff\\\\Engine\\\\DiffEngine\\:\\:\\$ychanged\\.$#" - count: 2 - path: lib/Drupal/Component/Diff/Engine/DiffEngine.php - - - - message: "#^Access to an undefined property Drupal\\\\Component\\\\Diff\\\\Engine\\\\DiffEngine\\:\\:\\$yind\\.$#" - count: 2 - path: lib/Drupal/Component/Diff/Engine/DiffEngine.php - - - - message: "#^Access to an undefined property Drupal\\\\Component\\\\Diff\\\\Engine\\\\DiffEngine\\:\\:\\$yv\\.$#" - count: 5 - path: lib/Drupal/Component/Diff/Engine/DiffEngine.php - - message: "#^Method Drupal\\\\Component\\\\Gettext\\\\PoMemoryWriter\\:\\:getHeader\\(\\) should return Drupal\\\\Component\\\\Gettext\\\\PoHeader but return statement is missing\\.$#" count: 1 @@ -220,11 +175,6 @@ parameters: count: 1 path: lib/Drupal/Core/Entity/EntityConfirmFormBase.php - - - message: "#^Access to an undefined property Drupal\\\\Core\\\\Entity\\\\EntityDisplayBase\\:\\:\\$_serializedKeys\\.$#" - count: 2 - path: lib/Drupal/Core/Entity/EntityDisplayBase.php - - message: "#^Method Drupal\\\\Core\\\\Entity\\\\KeyValueStore\\\\KeyValueContentEntityStorage\\:\\:createTranslation\\(\\) should return Drupal\\\\Core\\\\Entity\\\\ContentEntityInterface but return statement is missing\\.$#" count: 1 only in patch2: unchanged: --- a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php @@ -168,7 +168,7 @@ public function testGet() { $this->assertEquals($some_parameter, $service->getSomeParameter(), '%some_config% was injected via constructor.'); $this->assertEquals($this->container, $service->getContainer(), 'Container was injected via setter injection.'); $this->assertEquals($some_other_parameter, $service->getSomeOtherParameter(), '%some_other_config% was injected via setter injection.'); - $this->assertEquals('foo', $service->_someProperty, 'Service has added properties.'); + $this->assertEquals('foo', $service->someProperty, 'Service has added properties.'); } /** @@ -741,7 +741,7 @@ protected function getMockContainerDefinition() { $this->getServiceCall('other.service'), $this->getParameterCall('some_config'), ]), - 'properties' => $this->getCollection(['_someProperty' => 'foo']), + 'properties' => $this->getCollection(['someProperty' => 'foo']), 'calls' => [ [ 'setContainer', @@ -1103,6 +1103,11 @@ class MockService { */ protected $someOtherParameter; + /** + * @var string + */ + public $someProperty; + /** * Constructs a MockService object. * only in patch2: unchanged: --- a/core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php +++ b/core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php @@ -555,6 +555,7 @@ class TestEventListener { public $preFooInvoked = FALSE; public $postFooInvoked = FALSE; + public $name; /** * Listener methods. only in patch2: unchanged: --- a/core/tests/Drupal/Tests/Component/Utility/VariableTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/VariableTest.php @@ -101,7 +101,7 @@ public function testCallableToString($callable, string $expected_name): void { * - The variable to export. */ public function providerTestExport() { - return [ + $result = [ // Array. [ 'array()', @@ -161,12 +161,22 @@ public function providerTestExport() { '(object) array()', new \stdClass(), ], - [ + ]; + if (version_compare(PHP_VERSION, '8.2', '>=')) { + $result[] = [ + // A not-stdClass object. + "\Drupal\Tests\Component\Utility\StubVariableTestClass::__set_state(array(\n))", + new StubVariableTestClass(), + ]; + } + else { + $result[] = [ // A not-stdClass object. "Drupal\Tests\Component\Utility\StubVariableTestClass::__set_state(array(\n))", new StubVariableTestClass(), - ], - ]; + ]; + } + return $result; } /** only in patch2: unchanged: --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php @@ -514,14 +514,15 @@ public function testSort() { ->will($this->returnValue([ 'entity_keys' => [ 'label' => 'label', + 'weight' => 'weight', ], ])); - $entity_a = $this->createMock('\Drupal\Core\Config\Entity\ConfigEntityInterface'); + $entity_a = $this->createMock('\Drupal\Core\Config\Entity\ConfigEntityBase'); $entity_a->expects($this->atLeastOnce()) ->method('label') ->willReturn('foo'); - $entity_b = $this->createMock('\Drupal\Core\Config\Entity\ConfigEntityInterface'); + $entity_b = $this->createMock('\Drupal\Core\Config\Entity\ConfigEntityBase'); $entity_b->expects($this->atLeastOnce()) ->method('label') ->willReturn('bar'); @@ -648,6 +649,8 @@ class TestConfigEntityWithPluginCollections extends ConfigEntityBaseWithPluginCo protected $pluginManager; + protected $the_plugin_collection_config; + public function setPluginManager(PluginManagerInterface $plugin_manager) { $this->pluginManager = $plugin_manager; } only in patch2: unchanged: --- a/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php @@ -2,6 +2,7 @@ namespace Drupal\Tests\Core\Entity; +use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Language\Language; @@ -93,7 +94,7 @@ public function testToLink($entity_label, $link_text, $expected_text, $link_rel ->will($this->returnValue($entity_type)); /** @var \Drupal\Core\Entity\Entity $entity */ - $entity = $this->getMockForAbstractClass('Drupal\Core\Entity\EntityBase', [ + $entity = $this->getMockForAbstractClass(ConfigEntityBase::class, [ ['id' => $entity_id, 'label' => $entity_label, 'langcode' => 'es'], $entity_type_id, ]); only in patch2: unchanged: --- a/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php @@ -2,6 +2,7 @@ namespace Drupal\Tests\Core\Form; +use Drupal\Core\Form\ConfigFormBaseTrait; use Drupal\Tests\UnitTestCase; /** @@ -15,7 +16,7 @@ class ConfigFormBaseTraitTest extends UnitTestCase { */ public function testConfig() { - $trait = $this->getMockForTrait('Drupal\Core\Form\ConfigFormBaseTrait'); + $trait = $this->createPartialMock(ConfiguredTrait::class, ['getEditableConfigNames']); // Set up some configuration in a mocked config factory. $trait->configFactory = $this->getConfigFactoryStub([ 'editable.config' => [], @@ -58,7 +59,6 @@ public function testConfigFactoryException() { */ public function testConfigFactoryExceptionInvalidProperty() { $trait = $this->getMockForTrait('Drupal\Core\Form\ConfigFormBaseTrait'); - $trait->configFactory = TRUE; $config_method = new \ReflectionMethod($trait, 'config'); $config_method->setAccessible(TRUE); @@ -69,3 +69,11 @@ public function testConfigFactoryExceptionInvalidProperty() { } } + +class ConfiguredTrait { + use ConfigFormBaseTrait; + public $configFactory; + + protected function getEditableConfigNames() {} + +} only in patch2: unchanged: --- a/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php @@ -188,7 +188,8 @@ public function providerTestGetMatchingContexts() { public function testFilterPluginDefinitionsByContexts($has_context, $definitions, $expected) { if ($has_context) { $context = $this->createMock('Drupal\Core\Plugin\Context\ContextInterface'); - $expected_context_definition = (new ContextDefinition('string'))->setConstraints(['Blank' => []]); + $expected_context_definition = new ContextDefinition('string'); + $expected_context_definition->setConstraints(['Blank' => []]); $context->expects($this->atLeastOnce()) ->method('getContextDefinition') ->will($this->returnValue($expected_context_definition));