diff --git a/core/modules/rest/src/CacheableResourceResponse.php b/core/modules/rest/src/CacheableResourceResponse.php index 897022d..9f58244 100644 --- a/core/modules/rest/src/CacheableResourceResponse.php +++ b/core/modules/rest/src/CacheableResourceResponse.php @@ -11,7 +11,6 @@ use Drupal\Core\Cache\CacheableResponseTrait; use Symfony\Component\HttpFoundation\Response; - class CacheableResourceResponse extends Response implements CacheableResponseInterface, ResourceResponseInterface { use CacheableResponseTrait; diff --git a/core/modules/rest/src/Plugin/rest/resource/UserRegistrationResource.php b/core/modules/rest/src/Plugin/rest/resource/UserRegistrationResource.php index 4ee9df2..545516a 100644 --- a/core/modules/rest/src/Plugin/rest/resource/UserRegistrationResource.php +++ b/core/modules/rest/src/Plugin/rest/resource/UserRegistrationResource.php @@ -102,7 +102,7 @@ public function post(UserInterface $account = NULL) { // POSTed user accounts must not have an ID set, because we always // want to create new entities here. if (!$account->isNew()) { - throw new BadRequestHttpException('Only new user accounts can be registered.'); + throw new BadRequestHttpException('An ID has been set and only new user accounts can be registered.'); } // The current resource only allows anonymous users to register users. @@ -120,9 +120,9 @@ public function post(UserInterface $account = NULL) { $account->block(); } - // Only check 'edit' permissions for fields that were actually - // submitted by the user. Field access makes no difference between 'create' - // and 'update', so the 'edit' operation is used here. + // Only check 'edit' permissions for fields that were actually submitted by + // the user. Field access makes no difference between 'create'and 'update', + // so the 'edit' operation is used here. foreach ($account->_restSubmittedFields as $key => $field_name) { if (!$account->get($field_name)->access('edit')) { throw new AccessDeniedHttpException("Access denied on creating field '$field_name'."); @@ -135,7 +135,7 @@ public function post(UserInterface $account = NULL) { $account->save(); $register = $this->userSettings->get('register'); - // No email verification is required. Activating the user. + // No E-mail verification is required. Activating the user. if ($register == 'visitors') { if (!$this->userSettings->get('verify_mail')) { // Notification will be sent if activated. @@ -167,9 +167,9 @@ public function routes() { $route = $this->getBaseRoute('/entity/user/register', 'POST'); - // Restrict the incoming HTTP Content-type header to the known - // serialization formats. - $route->addRequirements(array('_content_type_format' => implode('|', $this->serializerFormats))); + // Restrict the incoming HTTP Content-type header to the known serialization + // formats. + $route->addRequirements(['_content_type_format' => implode('|', $this->serializerFormats)])); $collection->add("$this->pluginId", $route); return $collection; diff --git a/core/modules/rest/src/UncacheableResourceResponse.php b/core/modules/rest/src/UncacheableResourceResponse.php index 0c4eb9b..308275d 100644 --- a/core/modules/rest/src/UncacheableResourceResponse.php +++ b/core/modules/rest/src/UncacheableResourceResponse.php @@ -23,8 +23,8 @@ class UncacheableResourceResponse extends Response implements ResourceResponseIn * @param array $headers * An array of response headers. */ - public function __construct($data = NULL, $status = 200, $headers = array()) { + public function __construct($data = NULL, $status = 200, $headers = []) { $this->responseData = $data; parent::__construct('', $status, $headers); } -} \ No newline at end of file +} diff --git a/core/modules/rest/tests/src/Unit/UserRegistrationResourceTest.php b/core/modules/rest/tests/src/Unit/UserRegistrationResourceTest.php index 778b534..2facc31 100644 --- a/core/modules/rest/tests/src/Unit/UserRegistrationResourceTest.php +++ b/core/modules/rest/tests/src/Unit/UserRegistrationResourceTest.php @@ -145,7 +145,7 @@ public function testValidate() { $method = $this->getProtectedMethod('validate'); // No exception is thrown. - $method->invokeArgs($this->testClass, array($entity)); + $method->invokeArgs($this->testClass, [$entity]); } /**