These are contributions that we need to make to improve PHP8 compatibility detection.
parameters:
phpVersion: 80000
level: 5
reportUnmatchedIgnoredErrors: false
ignoreErrors:
- '#\\Drupal calls should be avoided in classes, use dependency injection instead#'
- '#Call to function [a-zA-Z0-9\\\\_\\(\\)]+ on a separate line has no effect.#'
- '#Expression \\"\\$[a-zA-Z0-9\\\\_\\[\\]\\"]+\\" on a separate line does not do anything.#'
match
is now a reserved keyword.function match() {
// reserved in PHP 8
}
function match()
definition causes a syntax error when phpVersion: 80000
------ ------------------------------------------------------------------------
Line upgrade_status_test_contrib_error.module
------ ------------------------------------------------------------------------
19 Syntax error, unexpected T_MATCH, expecting T_STRING or '(' on line 19
------ ------------------------------------------------------------------------
<?php declare(strict_types=1);
final class Foo {
private string $bar;
public function Foo(string $bar) {
$this->bar = $bar;
}
public function getBar(): string {
return $this->bar;
}
}
No error returned for Foo
and no __construct
function ability_to_call_non_static_methods() {
// Should error
$result1 = is_callable([FormBuilder::class, 'buildForm']);
// Should not
$result2 = is_callable([FormBuilder::class, 'trustedCallbacks']);
}