2023/06/24: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 35: | Line 35: | ||
** The list comes from <syntaxhighlight lang=php inline>$this->getPageList()</syntaxhighlight> | ** The list comes from <syntaxhighlight lang=php inline>$this->getPageList()</syntaxhighlight> | ||
** ...and how that list is generated is... Complicated. | ** ...and how that list is generated is... Complicated. | ||
** ...but there's a wide variety of examples, when CORE_LIST is defined near the top of the class, of what the array entries are supposed to look like. | |||
** '''Q1a''': So, somehow our SpecialPage class gets added to the list as just a string. Where does that happen? Presumably in [[SpecialPage]]'s constructor... | |||
*** Nope, not there; that just initializes the SpecialPage object's members. Presumably the class is registered by whatever reads the <tt>extension.json</tt> file. | |||
*** '''Q1a1''': How are extension pages loaded? | |||
* '''Q2''': What is it ''supposed'' to be, if it's not a class name? | * '''Q2''': What is it ''supposed'' to be, if it's not a class name? | ||
Revision as of 00:09, 25 June 2023
|
Saturday, June 24, 2023 (#175)
|
Notes
the problem flows like this: in if ( is_array( $rec ) || is_string( $rec ) || is_callable( $rec ) ) {
$page = $this->objectFactory->createObject( $rec, [ 'allowClassName' => true,'allowCallable' => true ]);
}
...which implies that it should be perfectly okay to call createObject() with a string, but then we have if ( is_string( $spec ) && class_exists( $spec ) ) {
if ( empty( $options['allowClassName'] ) ) {
throw new InvalidArgumentException('Passing a raw class name is not allowed here. Use [ \'class\' => $classname ] instead.');
}
return [ 'class' => $spec ];
}
if ( !is_array( $spec ) ) {
throw new InvalidArgumentException( 'Provided specification is not an array.' );
}
...so I think what I'm getting from that is that it's only okay to call So then we have the questions:
|