In Magento2.1, I see almost all API use the fully qualified namespaces in the function param and PHPDoc, instead of using importing and aliases, like PageRepositoryInterface and BlockRepositoryInterface in the vendor\magento\module-cms\Api directory.
I forgot where I saw it, but I remember someone said Magento2 API must use fully qualified namespaces, is that true? If it is true, what is the reason?
For Example
<?php
namespace Magento\Cms\Api;
interface PageRepositoryInterface
{
/**
* Save page.
*
* @param \Magento\Cms\Api\Data\PageInterface $page
* @return \Magento\Cms\Api\Data\PageInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function save(\Magento\Cms\Api\Data\PageInterface $page);
}
Can it rewrite to below?
<?php
namespace Magento\Cms\Api;
use Magento\Cms\Api\Data\PageInterface;
interface PageRepositoryInterface
{
/**
* Save page.
*
* @param PageInterface $page
* @return PageInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function save(PageInterface $page);
}