diff --git a/docs/index.md b/docs/index.md index 63cbabff..656c20a5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,2 +1,4 @@ * [Overview](overview.md) * [Updating from v1 to v2](v1-to-v2-update.md) +* [Updating from v2 to v3](v2-to-v3-update.md) +* [Updating from v3 to v4](v3-to-v4-update.md) diff --git a/docs/v2-to-v3-update.md b/docs/v2-to-v3-update.md new file mode 100644 index 00000000..1e9ea89c --- /dev/null +++ b/docs/v2-to-v3-update.md @@ -0,0 +1,7 @@ +## Updating from v2 to v3 + +The following changes were made to the Application package between v1 and v2. + +### Minimum supported PHP version raised + +All Framework packages now require PHP 8.1 or newer. diff --git a/docs/v3-to-v4-update.md b/docs/v3-to-v4-update.md new file mode 100644 index 00000000..18dfbb4b --- /dev/null +++ b/docs/v3-to-v4-update.md @@ -0,0 +1,19 @@ +## Updating from v3 to v4 + +The following changes were made to the Application package between v3 and v4. + +### Access to input data + +Accessing the input data in the input attribute of the application can now only be done via the `getInput()`. + +```php +// Old +$app->input->getInt(); + +// New +$app->getInput()->getInt(); +``` + +### Status on redirect + +When calling `$app->redirect()`, you can not hand over a boolean value for the status, but always have to use an integer representing the HTTP status code. diff --git a/src/AbstractWebApplication.php b/src/AbstractWebApplication.php index 0f325601..d14e103e 100644 --- a/src/AbstractWebApplication.php +++ b/src/AbstractWebApplication.php @@ -213,46 +213,6 @@ public function __construct( $this->loadSystemUris(); } - /** - * Magic method to access properties of the application. - * - * @param string $name The name of the property. - * - * @return Input|null A value if the property name is valid, null otherwise. - * - * @since 2.0.0 - * @deprecated 3.0 This is a B/C proxy for deprecated read accesses - */ - public function __get($name) - { - switch ($name) { - case 'input': - \trigger_deprecation( - 'joomla/application', - '2.0.0', - 'Accessing the input property of %s is deprecated, use the %s::getInput() method instead.', - self::class, - self::class - ); - - return $this->getInput(); - - default: - $trace = \debug_backtrace(); - \trigger_error( - \sprintf( - 'Undefined property via __get(): %1$s in %2$s on line %3$s', - $name, - $trace[0]['file'], - $trace[0]['line'] - ), - E_USER_NOTICE - ); - - return null; - } - } - /** * Execute the application. * @@ -423,8 +383,8 @@ public function getInput(): Input * Other" code in the header pointing to the new location. If the headers have already been sent this will be * accomplished using a JavaScript statement. * - * @param string $url The URL to redirect to. Can only be http/https URL - * @param integer|boolean $status The HTTP status code to be provided. 303 is assumed by default. + * @param string $url The URL to redirect to. Can only be http/https URL + * @param integer $status The HTTP status code to be provided. 303 is assumed by default. * * @return void * @@ -478,20 +438,6 @@ public function redirect($url, $status = 303) echo $html; } else { - // Check if we have a boolean for the status variable for compatibility with v1 of the framework - // @deprecated 3.0 - if (\is_bool($status)) { - \trigger_deprecation( - 'joomla/application', - '2.0.0', - 'Passing a boolean value for the $status argument in %s() is deprecated,' - . ' an integer should be passed instead.', - __METHOD__ - ); - - $status = $status ? 301 : 303; - } - if (!\is_int($status) && !$this->isRedirectState($status)) { throw new \InvalidArgumentException('You have not supplied a valid HTTP status code'); } diff --git a/src/WebApplicationInterface.php b/src/WebApplicationInterface.php index 5fcd11a2..837b59b0 100644 --- a/src/WebApplicationInterface.php +++ b/src/WebApplicationInterface.php @@ -34,8 +34,8 @@ public function getInput(): Input; * If the headers have not been sent the redirect will be accomplished using a "301 Moved Permanently" or "303 See Other" code in the header * pointing to the new location. If the headers have already been sent this will be accomplished using a JavaScript statement. * - * @param string $url The URL to redirect to. Can only be http/https URL - * @param integer|boolean $status The HTTP status code to be provided. 303 is assumed by default. + * @param string $url The URL to redirect to. Can only be http/https URL + * @param integer $status The HTTP status code to be provided. 303 is assumed by default. * * @return void *