Problem/Motivation

There are three new PHPStan deprecations, added during 30 April.

Call to deprecated function node_access_needs_rebuild() in drupal:11.4.0 and is removed from drupal:13.0.0. Use                
\Drupal::service('\Drupal\node\NodeAccessRebuild')->setNeedsRebuild()  and
\Drupal::service('\Drupal\node\NodeAccessRebuild')->needsRebuild() instead.

30 April 14:20 PHPStan Next Minor is greeen with no problems
https://git.drupalcode.org/project/scheduler/-/jobs/9608056#L52

30 April 20:07 PHPStan - has 3 problems
https://git.drupalcode.org/project/scheduler/-/jobs/9613308#L51

Proposed resolution

Use the replacements as specified

Remaining tasks

Issue fork scheduler-3588037

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jonathan1055 created an issue. See original summary.

jonathan1055’s picture

Issue summary: View changes

The Change Record is https://www.drupal.org/node/3534610
This was not given in the deprecation message.

jonathan1055’s picture

The old functions still need to be called, to continue test coverage for core 11.3 and earlier, hence we have the conditional check on whether the service exists.

// The NodeAccessRebuild service was introduecd in core version 11.4
if (\Drupal::hasService('\Drupal\node\NodeAccessRebuild')) {
  \Drupal::service('\Drupal\node\NodeAccessRebuild')->rebuild();
}
else {
  node_access_rebuild();
}

This also means that PHPStan has to be told to ignore the old functions, hence the addition to phpstan-baseline.neon.

The PHPStan jobs at 'current' (11.3), 'Max PHP' and 'Next Minor' (11.4) all end green. PHPStan at Core 12.x has other deprecations such as missing classes on Drupal\migrate_drupal\Plugin, Drupal\Tests\migrate_drupal\Kernel, Drupal\rules\Core\RulesConditionBase, Drupal\rules\Context\ContextConfig but those are for a separate issue.

jonathan1055’s picture

Status: Active » Fixed

Done

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jonathan1055’s picture

Version: 2.x-dev » 8.x-1.x-dev
Component: Code » Deprecations
Status: Closed (fixed) » Needs work

This should also be fixed in 8.x-1.x