Skip to content

Commit f05a901

Browse files
authored
Add a magic getter for the app input property (#46000)
1 parent 0aac541 commit f05a901

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

libraries/src/Application/WebApplication.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,4 +459,42 @@ public function getConfig()
459459
{
460460
return $this->config;
461461
}
462+
463+
/**
464+
* Proxy to the input property.
465+
*
466+
* @return Input | null
467+
*
468+
* @since __DEPLOY_VERSION__
469+
* @deprecated 4.0 will be removed in 8.0 use $this->getInput() instead
470+
*/
471+
public function __get($name)
472+
{
473+
switch ($name) {
474+
case 'input':
475+
trigger_deprecation(
476+
'cms/application',
477+
'6.0',
478+
'Accessing the input property of %s is deprecated, use the %s::getInput() method instead.',
479+
self::class,
480+
self::class
481+
);
482+
483+
return $this->getInput();
484+
485+
default:
486+
$trace = debug_backtrace();
487+
trigger_error(
488+
\sprintf(
489+
'Undefined property via __get(): %1$s in %2$s on line %3$s',
490+
$name,
491+
$trace[0]['file'],
492+
$trace[0]['line']
493+
),
494+
E_USER_NOTICE
495+
);
496+
497+
return null;
498+
}
499+
}
462500
}

0 commit comments

Comments
 (0)