Menu

← Back to backtick.*

Error Identifier: backtick.deprecated

Every error reported by PHPStan has an error identifier. Here’s a list of all error identifiers. In PHPStan Pro you can see the error identifier next to each error and filter errors by their identifiers.

Code example #

<?php declare(strict_types = 1);

$output = `ls -la`;

Why is it reported? #

The backtick operator (`) is deprecated in PHP 8.5. It is equivalent to shell_exec(), but its syntax makes it easy to confuse with single quotes and harder to spot in code. PHP 8.5 deprecates this operator in favour of the explicit shell_exec() function call.

How to fix it #

Replace the backtick operator with a shell_exec() call:

 <?php declare(strict_types = 1);
 
-$output = `ls -la`;
+$output = shell_exec('ls -la');

How to ignore this error #

You can use the identifier backtick.deprecated to ignore this error using a comment:

// @phpstan-ignore backtick.deprecated
codeThatProducesTheError();

You can also use only the identifier key to ignore all errors of the same type in your configuration file in the ignoreErrors parameter:

parameters:
	ignoreErrors:
		-
			identifier: backtick.deprecated

Rules that report this error #

  • PHPStan\Rules\Operators\BacktickRule [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.