PHP code example of ekino / phpstan-banned-code

1. Go to this page and download the library: Download ekino/phpstan-banned-code library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ekino / phpstan-banned-code example snippets


parameters:
	banned_code:
		nodes:
			# enable detection of echo
			-
				type: Stmt_Echo
				functions: null

			# enable detection of eval
			-
				type: Expr_Eval
				functions: null

			# enable detection of die/exit
			-
				type: Expr_Exit
				functions: null

			# enable detection of a set of functions
			-
				type: Expr_FuncCall
				functions:
					- dd
					- debug_backtrace
					- dump
					- exec
					- passthru
					- phpinfo
					- print_r
					- proc_open
					- shell_exec
					- system
					- var_dump

			# enable detection of print statements
			-
				type: Expr_Print
				functions: null

			# enable detection of shell execution by backticks
			-
				type: Expr_ShellExec
				functions: null

		# enable detection of `use Tests\Foo\Bar` in a non-test file
		use_from_tests: true