Programmer - an organism that turns coffee into software.
staat de return type wel goed bij JFactory::getDocument();? Want dit hoort gewoon te werken.
JFactory is onderdeel van het Framework van Joomla. Dus ik heb daar weinig controle over.twiekert schreef op zondag 20 april 2008 @ 13:58:
staat de return type wel goed bij JFactory::getDocument();? Want dit hoort gewoon te werken.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
| function &getDocument()
{
static $instance;
if (!is_object( $instance )) {
$instance = JFactory::_createDocument();
}
return $instance;
}
/**
* Create a document object
*
* @access private
* @return object JDocument
* @since 1.5
*/
function &_createDocument()
{
jimport('joomla.document.document');
$lang =& JFactory::getLanguage();
//Keep backwards compatibility with Joomla! 1.0
$raw = JRequest::getBool('no_html');
$type = JRequest::getWord('format', $raw ? 'raw' : 'html');
$attributes = array (
'charset' => 'utf-8',
'lineend' => 'unix',
'tab' => ' ',
'language' => $lang->getTag(),
'direction' => $lang->isRTL() ? 'rtl' : 'ltr'
);
$doc =& JDocument::getInstance($type, $attributes);
//
// Hier word $doc wel herkent als een JDocument. En de intellisense werkt dan wel goed.
return $doc;
} |
Programmer - an organism that turns coffee into software.
Je kunt hiervoor een speciale comment - type hint - gebruiken.
Dan weet Zend dat $document van het type JDocument is.
PHP:
1
| /* @var $document JDocument */ |
Dan weet Zend dat $document van het type JDocument is.
[ Voor 59% gewijzigd door frickY op 20-04-2008 15:19 ]
Yes!!!frickY schreef op zondag 20 april 2008 @ 15:09:
Je kunt hiervoor een speciale comment - type hint - gebruiken.
PHP:
1/* @var $document JDocument */
Dan weet Zend dat $document van het type JDocument is.
Dat werkt perfect. Het commentaar moet wel na de JFactory oproep staan.
code:
1
2
3
| // dit werkt niet! /* @var $document JDocument */ $document = JFactory:getDocument(); |
code:
1
2
3
| // dit werkt wel! $document = JFactory:getDocument(); /* @var $document JDocument */ |
thx.
Programmer - an organism that turns coffee into software.
Verwijderd
Zo te zien is die doc van die JFactory ook fout; die
@return object JDocument
moet zijn:
@return JDocument
Misschien wel netjes om even door te geven aan de auteur.
@return object JDocument
moet zijn:
@return JDocument
Misschien wel netjes om even door te geven aan de auteur.
Pagina: 1