From 9aa38de317f51c64c03f86d0e9799853005a1297 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 22 Apr 2017 09:25:55 -0700 Subject: [PATCH] Remove leading backslash in use statements While it is acceptable syntax, it is unnecessary and not recommended by the PHP documentation: https://secure.php.net/manual/en/language.namespaces.importing.php#language.namespaces.importing > Note that for namespaced names (fully qualified namespace names > containing namespace separator, such as Foo\Bar as opposed to global > names that do not, such as FooBar), the leading backslash is > unnecessary and not recommended, as import names must be fully > qualified, and are not processed relative to the current namespace. --- Readme.md | 8 ++++---- Readme.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Readme.md b/Readme.md index 63e8c1e..44a1978 100644 --- a/Readme.md +++ b/Readme.md @@ -55,19 +55,19 @@ autoloading, see below.) With class autoloading in place, putting the 'Michelf' folder in your include path should be enough for this to work: - use \Michelf\Markdown; + use Michelf\Markdown; $my_html = Markdown::defaultTransform($my_text); Markdown Extra syntax is also available the same way: - use \Michelf\MarkdownExtra; + use Michelf\MarkdownExtra; $my_html = MarkdownExtra::defaultTransform($my_text); If you wish to use PHP Markdown with another text filter function built to parse HTML, you should filter the text *after* the `transform` function call. This is an example with [PHP SmartyPants][psp]: - use \Michelf\Markdown, \Michelf\SmartyPants; + use Michelf\Markdown, Michelf\SmartyPants; $my_html = Markdown::defaultTransform($my_text); $my_html = SmartyPants::defaultTransform($my_html); @@ -76,7 +76,7 @@ found inside the parser class. If you want to customize the parser configuration, you can also instantiate it directly and change some configuration variables: - use \Michelf\MarkdownExtra; + use Michelf\MarkdownExtra; $parser = new MarkdownExtra; $parser->fn_id_prefix = "post22-"; $my_html = $parser->transform($my_text); diff --git a/Readme.php b/Readme.php index 89449de..cbd86c7 100644 --- a/Readme.php +++ b/Readme.php @@ -10,7 +10,7 @@ spl_autoload_register(function($class){ }); // Get Markdown class -use \Michelf\Markdown; +use Michelf\Markdown; // Read file and pass content through the Markdown parser $text = file_get_contents('Readme.md');