PHP code example of phpstan / phpstan-deprecation-rules

1. Go to this page and download the library: Download phpstan/phpstan-deprecation-rules 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/ */

    

phpstan / phpstan-deprecation-rules example snippets


/** @deprecated */
function doFoo(): void
{
    // not reported:
    anotherDeprecatedFunction();
}

class GroupLegacyScopeResolver implements DeprecatedScopeResolver
{

	public function isScopeDeprecated(Scope $scope): bool
	{
		$function = $scope->getFunction();
		return $function !== null
			&& $function->getDocComment() !== null
			&& strpos($function->getDocComment(), '@group legacy') !== false;
	}

}