Issue #3359001 by Spokje, smustgrave, catch: Fix PHPStan L1 errors "Function \Foo\Bar\baz invoked with X parameters, 0 required."

merge-requests/5009/merge
Dave Long 2023-10-27 23:05:09 +01:00
parent 71f949cb0b
commit 6fd51ee86a
No known key found for this signature in database
GPG Key ID: ED52AE211E142771
7 changed files with 7 additions and 31 deletions

View File

@ -198,7 +198,7 @@ class CommentLinkBuilder implements CommentLinkBuilderInterface {
$entity_links['comment__' . $field_name]['#attached']['library'][] = 'comment/drupal.node-new-comments-link';
// Embed the metadata for the "X new comments" link (if any) on this
// entity.
$entity_links['comment__' . $field_name]['#attached']['drupalSettings']['history']['lastReadTimestamps'][$entity->id()] = (int) history_read($entity->id());
$entity_links['comment__' . $field_name]['#attached']['drupalSettings']['history']['lastReadTimestamps'][$entity->id()] = history_read($entity->id());
$new_comments = $this->commentManager->getCountNewComments($entity);
if ($new_comments > 0) {
$page_number = $this->entityTypeManager

View File

@ -325,7 +325,7 @@ namespace Drupal\comment;
if (!function_exists('history_read')) {
function history_read() {
function history_read($nid) {
return 0;
}

View File

@ -48,7 +48,8 @@ class BatchUserAction extends ActionBase {
/**
* {@inheritdoc}
*/
public function execute(ContentEntityInterface $entity = NULL) {
public function execute($entity = NULL) {
assert($entity instanceof ContentEntityInterface);
$this->executeMultiple([$entity]);
}

View File

@ -205,7 +205,7 @@ namespace Drupal\views\Plugin\Block;
if (!function_exists('views_add_contextual_links')) {
function views_add_contextual_links() {
function views_add_contextual_links(&$render_element, $location, $display_id, array $view_element = NULL) {
}
}

View File

@ -188,7 +188,7 @@ namespace Drupal\views\Routing;
if (!function_exists('views_add_contextual_links')) {
function views_add_contextual_links() {
function views_add_contextual_links(&$render_element, $location, $display_id, array $view_element = NULL) {
}
}

View File

@ -68,11 +68,6 @@ parameters:
count: 1
path: lib/Drupal/Component/Datetime/DateTimePlus.php
-
message: "#^Function Drupal\\\\Component\\\\Datetime\\\\microtime invoked with 1 parameter, 0 required\\.$#"
count: 1
path: lib/Drupal/Component/Datetime/Time.php
-
message: """
#^Usage of deprecated trait Drupal\\\\Component\\\\DependencyInjection\\\\ServiceIdHashTrait in class Drupal\\\\Component\\\\DependencyInjection\\\\Container\\:
@ -984,16 +979,6 @@ parameters:
count: 1
path: modules/comment/src/CommentForm.php
-
message: "#^Function Drupal\\\\comment\\\\history_read invoked with 1 parameter, 0 required\\.$#"
count: 1
path: modules/comment/src/CommentLinkBuilder.php
-
message: "#^Function Drupal\\\\comment\\\\history_read invoked with 1 parameter, 0 required\\.$#"
count: 1
path: modules/comment/src/CommentManager.php
-
message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#"
count: 2
@ -2345,11 +2330,6 @@ parameters:
count: 1
path: modules/views/src/Form/ViewsFormMainForm.php
-
message: "#^Function Drupal\\\\views\\\\Plugin\\\\Block\\\\views_add_contextual_links invoked with 3 parameters, 0 required\\.$#"
count: 1
path: modules/views/src/Plugin/Block/ViewsBlockBase.php
-
message: "#^Variable \\$display in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
@ -2600,11 +2580,6 @@ parameters:
count: 1
path: modules/views/src/Plugin/views/wizard/WizardPluginBase.php
-
message: "#^Function Drupal\\\\views\\\\Routing\\\\views_add_contextual_links invoked with 4 parameters, 0 required\\.$#"
count: 1
path: modules/views/src/Routing/ViewPageController.php
-
message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#"
count: 1

View File

@ -141,6 +141,6 @@ function time() {
*
* @return float
*/
function microtime() {
function microtime(bool $as_float = FALSE) {
return 1234567.89;
}