diff --git a/app/config/container.php b/app/config/container.php index 0fe26ac..19b6900 100644 --- a/app/config/container.php +++ b/app/config/container.php @@ -23,14 +23,12 @@ return [ 'app_files' => ['app', 'index.php', '.env', '.env.example', '.hidden'], /** Array of application middlewares */ - 'middlewares' => function (): array { - return [ - Middlewares\WhoopsMiddleware::class, - Middlewares\PruneCacheMiddleware::class, - Middlewares\CacheControlMiddleware::class, - Middlewares\RegisterGlobalsMiddleware::class, - ]; - }, + 'middlewares' => fn (): array => [ + Middlewares\WhoopsMiddleware::class, + Middlewares\PruneCacheMiddleware::class, + Middlewares\CacheControlMiddleware::class, + Middlewares\RegisterGlobalsMiddleware::class, + ], /** Array of sort options mapped to their respective classes */ 'sort_methods' => [ diff --git a/app/src/Bootstrap/AppManager.php b/app/src/Bootstrap/AppManager.php index 63d3da3..6b9eece 100644 --- a/app/src/Bootstrap/AppManager.php +++ b/app/src/Bootstrap/AppManager.php @@ -8,13 +8,10 @@ use Slim\App; class AppManager { - /** @var Container The applicaiton container */ - protected $container; - /** Create a new AppManager object. */ - public function __construct(Container $container) - { - $this->container = $container; + public function __construct( + private Container $container + ) { } /** Setup and configure the application. */ diff --git a/app/src/Bootstrap/ExceptionManager.php b/app/src/Bootstrap/ExceptionManager.php index d50ee1a..8375b2f 100644 --- a/app/src/Bootstrap/ExceptionManager.php +++ b/app/src/Bootstrap/ExceptionManager.php @@ -8,17 +8,11 @@ use Slim\App; class ExceptionManager { - /** @var App The application */ - protected $app; - - /** @var Config The application configuration */ - protected $config; - /** Create a new ExceptionManager object. */ - public function __construct(App $app, Config $config) - { - $this->app = $app; - $this->config = $config; + public function __construct( + private App $app, + private Config $config + ) { } /** Set up and configure exception handling. */ diff --git a/app/src/Bootstrap/MiddlewareManager.php b/app/src/Bootstrap/MiddlewareManager.php index 05eec57..dee0967 100644 --- a/app/src/Bootstrap/MiddlewareManager.php +++ b/app/src/Bootstrap/MiddlewareManager.php @@ -7,17 +7,11 @@ use Slim\App; class MiddlewareManager { - /** @var App The application */ - protected $app; - - /** @var Config The application configuration */ - protected $config; - /** Create a new MiddlwareManager object. */ - public function __construct(App $app, Config $config) - { - $this->app = $app; - $this->config = $config; + public function __construct( + private App $app, + private Config $config + ) { } /** Register application middlewares. */ diff --git a/app/src/Bootstrap/RouteManager.php b/app/src/Bootstrap/RouteManager.php index 909f5cc..def74ee 100644 --- a/app/src/Bootstrap/RouteManager.php +++ b/app/src/Bootstrap/RouteManager.php @@ -7,13 +7,10 @@ use Slim\App; class RouteManager { - /** @var App The application */ - protected $app; - /** Create a new RouteManager object. */ - public function __construct(App $app) - { - $this->app = $app; + public function __construct( + private App $app + ) { } /** Register the application routes. */ diff --git a/app/src/Config.php b/app/src/Config.php index 643bf43..d454828 100644 --- a/app/src/Config.php +++ b/app/src/Config.php @@ -7,13 +7,10 @@ use DI\NotFoundException; class Config { - /** @var Container The application container */ - protected $container; - /** Create a new Config object. */ - public function __construct(Container $container) - { - $this->container = $container; + public function __construct( + private Container $container + ) { } /** diff --git a/app/src/Controllers/DirectoryController.php b/app/src/Controllers/DirectoryController.php index d01b9d7..b82993d 100644 --- a/app/src/Controllers/DirectoryController.php +++ b/app/src/Controllers/DirectoryController.php @@ -14,29 +14,13 @@ use Symfony\Contracts\Translation\TranslatorInterface; class DirectoryController { - /** @var Config The application configuration */ - protected $config; - - /** @var Finder File finder component */ - protected $finder; - - /** @var Twig Twig templating component */ - protected $view; - - /** @var TranslatorInterface Translator component */ - protected $translator; - /** Create a new IndexController object. */ public function __construct( - Config $config, - Finder $finder, - Twig $view, - TranslatorInterface $translator + private Config $config, + private Finder $finder, + private Twig $view, + private TranslatorInterface $translator ) { - $this->config = $config; - $this->finder = $finder; - $this->view = $view; - $this->translator = $translator; } /** Invoke the IndexController. */ diff --git a/app/src/Controllers/FileInfoController.php b/app/src/Controllers/FileInfoController.php index eb28532..25e5bb8 100644 --- a/app/src/Controllers/FileInfoController.php +++ b/app/src/Controllers/FileInfoController.php @@ -12,24 +12,12 @@ use Symfony\Contracts\Translation\TranslatorInterface; class FileInfoController { - /** @var Config The application configuration */ - protected $config; - - /** @var CacheInterface The application cache */ - protected $cache; - - /** @var TranslatorInterface Translator component */ - protected $translator; - /** Create a new FileInfoHandler object. */ public function __construct( - Config $config, - CacheInterface $cache, - TranslatorInterface $translator + private Config $config, + private CacheInterface $cache, + private TranslatorInterface $translator ) { - $this->config = $config; - $this->cache = $cache; - $this->translator = $translator; } /** Invoke the FileInfoHandler. */ diff --git a/app/src/Controllers/IndexController.php b/app/src/Controllers/IndexController.php index 2789f1f..dbbe658 100644 --- a/app/src/Controllers/IndexController.php +++ b/app/src/Controllers/IndexController.php @@ -9,13 +9,10 @@ use Slim\Psr7\Response; class IndexController { - /** @var Container Application container */ - protected $container; - /** Create a new IndexController object. */ - public function __construct(Container $container) - { - $this->container = $container; + public function __construct( + private Container $container + ) { } /** Invoke the IndexController. */ diff --git a/app/src/Controllers/SearchController.php b/app/src/Controllers/SearchController.php index 46ea15f..750d85d 100644 --- a/app/src/Controllers/SearchController.php +++ b/app/src/Controllers/SearchController.php @@ -11,21 +11,12 @@ use Symfony\Contracts\Translation\TranslatorInterface; class SearchController { - /** @var Finder File finder component */ - protected $finder; - - /** @var Twig Twig templating component */ - protected $view; - - /** @var TranslatorInterface Translator component */ - protected $translator; - /** Create a new SearchHandler object. */ - public function __construct(Finder $finder, Twig $view, TranslatorInterface $translator) - { - $this->finder = $finder; - $this->view = $view; - $this->translator = $translator; + public function __construct( + private Finder $finder, + private Twig $view, + private TranslatorInterface $translator + ) { } /** Invoke the SearchHandler. */ diff --git a/app/src/Controllers/ZipController.php b/app/src/Controllers/ZipController.php index 8e7638e..2c1de33 100644 --- a/app/src/Controllers/ZipController.php +++ b/app/src/Controllers/ZipController.php @@ -16,29 +16,13 @@ use ZipArchive; class ZipController { - /** @var Config The application configuration */ - protected $config; - - /** @var CacheInterface The application cache */ - protected $cache; - - /** @var Finder The Finder Component */ - protected $finder; - - /** @var TranslatorInterface Translator component */ - protected $translator; - /** Create a new ZipHandler object. */ public function __construct( - Config $config, - CacheInterface $cache, - Finder $finder, - TranslatorInterface $translator + private Config $config, + private CacheInterface $cache, + private Finder $finder, + private TranslatorInterface $translator ) { - $this->config = $config; - $this->cache = $cache; - $this->finder = $finder; - $this->translator = $translator; } /** Invoke the ZipHandler. */ diff --git a/app/src/Exceptions/ErrorHandler.php b/app/src/Exceptions/ErrorHandler.php index 353b6b8..9d0da3e 100644 --- a/app/src/Exceptions/ErrorHandler.php +++ b/app/src/Exceptions/ErrorHandler.php @@ -12,17 +12,11 @@ use Throwable; class ErrorHandler implements ErrorHandlerInterface { - /** @var Twig Twig templating component */ - protected $view; - - /** @var TranslatorInterface Translation component */ - protected $translator; - /** Create a new ErrorHandler object. */ - public function __construct(Twig $view, TranslatorInterface $translator) - { - $this->view = $view; - $this->translator = $translator; + public function __construct( + private Twig $view, + private TranslatorInterface $translator + ) { } /** Invoke the ErrorHandler class. */ diff --git a/app/src/Factories/CacheFactory.php b/app/src/Factories/CacheFactory.php index 95743d1..9dcdd35 100644 --- a/app/src/Factories/CacheFactory.php +++ b/app/src/Factories/CacheFactory.php @@ -23,17 +23,11 @@ class CacheFactory /** @const Namespace for internal cache drivers */ protected const NAMESPACE_INTERNAL = 'app'; - /** @var Container The application container */ - protected $container; - - /** @var Config The application configuration */ - protected $config; - /** Create a new CacheFactory object. */ - public function __construct(Container $container, Config $config) - { - $this->container = $container; - $this->config = $config; + public function __construct( + private Container $container, + private Config $config + ) { } /** Initialize and return a CacheInterface. */ diff --git a/app/src/Factories/FinderFactory.php b/app/src/Factories/FinderFactory.php index 7a1a19c..08d5ea3 100644 --- a/app/src/Factories/FinderFactory.php +++ b/app/src/Factories/FinderFactory.php @@ -14,27 +14,15 @@ use Symfony\Component\Finder\SplFileInfo; class FinderFactory { - /** @var Container The application container */ - protected $container; - - /** @var HiddenFiles Collection of hidden files */ - protected $hiddenFiles; - - /** @var Pattern|null Hidden files pattern cache */ - protected $pattern; - - /** @var Config The application configuration */ - protected $config; + /** @var ?Pattern Hidden files pattern cache */ + private ?Pattern $pattern = null; /** Create a new FinderFactory object. */ public function __construct( - Container $container, - Config $config, - HiddenFiles $hiddenFiles + private Container $container, + private Config $config, + private HiddenFiles $hiddenFiles ) { - $this->container = $container; - $this->config = $config; - $this->hiddenFiles = $hiddenFiles; } /** Initialize and return the Finder component. */ diff --git a/app/src/Factories/TranslationFactory.php b/app/src/Factories/TranslationFactory.php index f8be6e6..78d43bc 100644 --- a/app/src/Factories/TranslationFactory.php +++ b/app/src/Factories/TranslationFactory.php @@ -13,17 +13,11 @@ use Symfony\Contracts\Translation\TranslatorInterface; class TranslationFactory { - /** @var Config The applicaiton configuration */ - protected $config; - - /** @var CacheInterface The application cache */ - protected $cache; - /** Create a new TranslationFactory object. */ - public function __construct(Config $config, CacheInterface $cache) - { - $this->config = $config; - $this->cache = $cache; + public function __construct( + private Config $config, + private CacheInterface $cache + ) { } /** Initialize and return the translation component. */ diff --git a/app/src/Factories/TwigFactory.php b/app/src/Factories/TwigFactory.php index 7646a23..00f8c81 100644 --- a/app/src/Factories/TwigFactory.php +++ b/app/src/Factories/TwigFactory.php @@ -12,19 +12,11 @@ use Twig\TwigFunction; class TwigFactory { - /** @var Config The application configuration */ - protected $config; - - /** @var CallableResolver The callable resolver */ - protected $callableResolver; - /** Create a new TwigFactory object. */ public function __construct( - Config $config, - CallableResolver $callableResolver + private Config $config, + private CallableResolver $callableResolver ) { - $this->config = $config; - $this->callableResolver = $callableResolver; } /** Initialize and return the Twig component. */ diff --git a/app/src/HiddenFiles.php b/app/src/HiddenFiles.php index 241762f..227ea4d 100644 --- a/app/src/HiddenFiles.php +++ b/app/src/HiddenFiles.php @@ -7,13 +7,11 @@ use Tightenco\Collect\Support\Collection; class HiddenFiles extends Collection { - /** @inheritdoc */ protected function __construct($items = []) { parent::__construct($items); } - /** {@inheritdoc} */ public static function make($items = []) { throw new BadMethodCallException('Method not implemented'); diff --git a/app/src/Middlewares/CacheControlMiddleware.php b/app/src/Middlewares/CacheControlMiddleware.php index 6327c6f..a1e6fd1 100644 --- a/app/src/Middlewares/CacheControlMiddleware.php +++ b/app/src/Middlewares/CacheControlMiddleware.php @@ -9,13 +9,10 @@ use Psr\Http\Server\RequestHandlerInterface as RequestHandler; class CacheControlMiddleware { - /** @var Config The application configuration */ - protected $config; - /** Create a new CacheControlMiddleware object. */ - public function __construct(Config $config) - { - $this->config = $config; + public function __construct( + private Config $config + ) { } /** Invoke the CacheControlMiddleware class. */ diff --git a/app/src/Middlewares/PruneCacheMiddleware.php b/app/src/Middlewares/PruneCacheMiddleware.php index 5731a88..cadb1e9 100644 --- a/app/src/Middlewares/PruneCacheMiddleware.php +++ b/app/src/Middlewares/PruneCacheMiddleware.php @@ -11,17 +11,11 @@ use Symfony\Contracts\Cache\CacheInterface; class PruneCacheMiddleware { - /** @var Config The application configuration */ - protected $config; - - /** @var CacheInterface The application cache */ - protected $cache; - /** Create a new CachePruneMiddleware object. */ - public function __construct(Config $config, CacheInterface $cache) - { - $this->config = $config; - $this->cache = $cache; + public function __construct( + private Config $config, + private CacheInterface $cache + ) { } /** Invoke the CachePruneMiddleware class. */ diff --git a/app/src/Middlewares/RegisterGlobalsMiddleware.php b/app/src/Middlewares/RegisterGlobalsMiddleware.php index 2a6550a..57a67b3 100644 --- a/app/src/Middlewares/RegisterGlobalsMiddleware.php +++ b/app/src/Middlewares/RegisterGlobalsMiddleware.php @@ -12,12 +12,9 @@ class RegisterGlobalsMiddleware /** Array of valid theme strings. */ private const VALID_THEMES = ['dark', 'light']; - /** @var Twig Twig templating component */ - protected $view; - - public function __construct(Twig $view) - { - $this->view = $view; + public function __construct( + private Twig $view + ) { } /** Invoke the RegisterGlobalsMiddleware class. */ diff --git a/app/src/Middlewares/WhoopsMiddleware.php b/app/src/Middlewares/WhoopsMiddleware.php index d90d0be..7e8c5a4 100644 --- a/app/src/Middlewares/WhoopsMiddleware.php +++ b/app/src/Middlewares/WhoopsMiddleware.php @@ -11,24 +11,12 @@ use Whoops\RunInterface; class WhoopsMiddleware { - /** @var RunInterface The Whoops component */ - protected $whoops; - - /** @var PrettyPageHandler The pretty page handler */ - protected $pageHandler; - - /** @var JsonResponseHandler The JSON response handler */ - protected $jsonHandler; - /** Create a new WhoopseMiddleware object. */ public function __construct( - RunInterface $whoops, - PrettyPageHandler $pageHandler, - JsonResponseHandler $jsonHandler + private RunInterface $whoops, + private PrettyPageHandler $pageHandler, + private JsonResponseHandler $jsonHandler ) { - $this->whoops = $whoops; - $this->pageHandler = $pageHandler; - $this->jsonHandler = $jsonHandler; } /** Invoke the WhoopseMiddleware class. */ diff --git a/app/src/TemporaryFile.php b/app/src/TemporaryFile.php index ce2390f..dfb85e7 100644 --- a/app/src/TemporaryFile.php +++ b/app/src/TemporaryFile.php @@ -5,7 +5,7 @@ namespace App; class TemporaryFile { /** @var string Path to the temporary file */ - protected $path; + private string $path; /** Create a new TemporaryFile object. */ public function __construct(string $dir, string $prefix = '') diff --git a/app/src/ViewFunctions/Asset.php b/app/src/ViewFunctions/Asset.php index 8216dba..989080e 100644 --- a/app/src/ViewFunctions/Asset.php +++ b/app/src/ViewFunctions/Asset.php @@ -7,16 +7,12 @@ use Tightenco\Collect\Support\Collection; class Asset extends ViewFunction { - /** @var string The function name */ - protected $name = 'asset'; - - /** @var Config The application configuration */ - protected $config; + protected string $name = 'asset'; /** Create a new Asset object. */ - public function __construct(Config $container) - { - $this->config = $container; + public function __construct( + private Config $config + ) { } /** Return the path to an asset. */ diff --git a/app/src/ViewFunctions/Breadcrumbs.php b/app/src/ViewFunctions/Breadcrumbs.php index d4f123c..becf646 100644 --- a/app/src/ViewFunctions/Breadcrumbs.php +++ b/app/src/ViewFunctions/Breadcrumbs.php @@ -8,22 +8,13 @@ use Tightenco\Collect\Support\Collection; class Breadcrumbs extends ViewFunction { - /** @var string The function name */ - protected $name = 'breadcrumbs'; - - /** @var Config The application configuration */ - protected $config; - - /** @var string The directory separator */ - protected $directorySeparator; + protected string $name = 'breadcrumbs'; /** Create a new Breadcrumbs object. */ public function __construct( - Config $config, - string $directorySeparator = DIRECTORY_SEPARATOR + private Config $config, + private string $directorySeparator = DIRECTORY_SEPARATOR ) { - $this->config = $config; - $this->directorySeparator = $directorySeparator; } /** Build a collection of breadcrumbs for a given path. */ diff --git a/app/src/ViewFunctions/Config.php b/app/src/ViewFunctions/Config.php index daf8de4..bb385ea 100644 --- a/app/src/ViewFunctions/Config.php +++ b/app/src/ViewFunctions/Config.php @@ -6,16 +6,12 @@ use App\Config as AppConfig; class Config extends ViewFunction { - /** @var string The function name */ - protected $name = 'config'; - - /** @var AppConfig The application configuration */ - protected $config; + protected string $name = 'config'; /** Create a new Config object. */ - public function __construct(AppConfig $config) - { - $this->config = $config; + public function __construct( + private AppConfig $config + ) { } /** diff --git a/app/src/ViewFunctions/FileUrl.php b/app/src/ViewFunctions/FileUrl.php index f42a9dc..1569de6 100644 --- a/app/src/ViewFunctions/FileUrl.php +++ b/app/src/ViewFunctions/FileUrl.php @@ -4,8 +4,7 @@ namespace App\ViewFunctions; class FileUrl extends Url { - /** @var string The function name */ - protected $name = 'file_url'; + protected string $name = 'file_url'; /** Return the URL for a given path and action. */ public function __invoke(string $path = '/'): string diff --git a/app/src/ViewFunctions/Icon.php b/app/src/ViewFunctions/Icon.php index e2dd586..b8abea5 100644 --- a/app/src/ViewFunctions/Icon.php +++ b/app/src/ViewFunctions/Icon.php @@ -7,16 +7,12 @@ use Symfony\Component\Finder\SplFileInfo; class Icon extends ViewFunction { - /** @var string The function name */ - protected $name = 'icon'; - - /** @var Config The application configuration */ - protected $config; + protected string $name = 'icon'; /** Create a new Config object. */ - public function __construct(Config $config) - { - $this->config = $config; + public function __construct( + private Config $config + ) { } /** Retrieve the icon markup for a file. */ diff --git a/app/src/ViewFunctions/Markdown.php b/app/src/ViewFunctions/Markdown.php index 0b62b33..a194fe4 100644 --- a/app/src/ViewFunctions/Markdown.php +++ b/app/src/ViewFunctions/Markdown.php @@ -7,19 +7,12 @@ use Symfony\Contracts\Cache\CacheInterface; class Markdown extends ViewFunction { - /** @var string The function name */ - protected $name = 'markdown'; + protected string $name = 'markdown'; - /** @var ParsedownExtra The markdown parser */ - protected $parser; - - /** @var CacheInterface */ - protected $cache; - - public function __construct(ParsedownExtra $parser, CacheInterface $cache) - { - $this->parser = $parser; - $this->cache = $cache; + public function __construct( + private ParsedownExtra $parser, + private CacheInterface $cache + ) { } /** Parses a string of markdown into HTML. */ diff --git a/app/src/ViewFunctions/ModifiedTime.php b/app/src/ViewFunctions/ModifiedTime.php index 1c8d2d2..8a117e0 100644 --- a/app/src/ViewFunctions/ModifiedTime.php +++ b/app/src/ViewFunctions/ModifiedTime.php @@ -8,15 +8,11 @@ use Symfony\Component\Finder\SplFileInfo; class ModifiedTime extends ViewFunction { - /** @var string The function name */ - protected $name = 'modified_time'; + protected string $name = 'modified_time'; - /** @var Config The application config */ - private $config; - - public function __construct(Config $config) - { - $this->config = $config; + public function __construct( + private Config $config + ) { } /** Get the modified time from a file object. */ diff --git a/app/src/ViewFunctions/ParentUrl.php b/app/src/ViewFunctions/ParentUrl.php index 2add788..d65b209 100644 --- a/app/src/ViewFunctions/ParentUrl.php +++ b/app/src/ViewFunctions/ParentUrl.php @@ -6,16 +6,12 @@ use App\Support\Str; class ParentUrl extends ViewFunction { - /** @var string The function name */ - protected $name = 'parent_url'; - - /** @var string The directory separator */ - protected $directorySeparator; + protected string $name = 'parent_url'; /** Create a new ParentUrl object. */ - public function __construct(string $directorySeparator = DIRECTORY_SEPARATOR) - { - $this->directorySeparator = $directorySeparator; + public function __construct( + private string $directorySeparator = DIRECTORY_SEPARATOR + ) { } /** Get the parent directory for a given path. */ diff --git a/app/src/ViewFunctions/SizeForHumans.php b/app/src/ViewFunctions/SizeForHumans.php index c818e6e..f417615 100644 --- a/app/src/ViewFunctions/SizeForHumans.php +++ b/app/src/ViewFunctions/SizeForHumans.php @@ -7,8 +7,7 @@ use Symfony\Component\Finder\SplFileInfo; class SizeForHumans extends ViewFunction { - /** @var string The function name */ - protected $name = 'size_for_humans'; + protected string $name = 'size_for_humans'; /** Get the human readable file size from a file object. */ public function __invoke(SplFileInfo $file): string diff --git a/app/src/ViewFunctions/Translate.php b/app/src/ViewFunctions/Translate.php index e5322ae..17d96fa 100644 --- a/app/src/ViewFunctions/Translate.php +++ b/app/src/ViewFunctions/Translate.php @@ -6,16 +6,12 @@ use Symfony\Contracts\Translation\TranslatorInterface; class Translate extends ViewFunction { - /** @var string The function name */ - protected $name = 'translate'; - - /** @var TranslatorInterface The application translator */ - protected $translator; + protected string $name = 'translate'; /** Create a new Translate object. */ - public function __construct(TranslatorInterface $translator) - { - $this->translator = $translator; + public function __construct( + private TranslatorInterface $translator + ) { } /** Retrieve a translated string by ID. */ diff --git a/app/src/ViewFunctions/Url.php b/app/src/ViewFunctions/Url.php index 73c8711..f255f15 100644 --- a/app/src/ViewFunctions/Url.php +++ b/app/src/ViewFunctions/Url.php @@ -6,16 +6,12 @@ use App\Support\Str; class Url extends ViewFunction { - /** @var string The function name */ - protected $name = 'url'; - - /** @var string The directory separator */ - protected $directorySeparator; + protected string $name = 'url'; /** Create a new Url object. */ - public function __construct(string $directorySeparator = DIRECTORY_SEPARATOR) - { - $this->directorySeparator = $directorySeparator; + public function __construct( + private string $directorySeparator = DIRECTORY_SEPARATOR + ) { } /** Return the URL for a given path. */ diff --git a/app/src/ViewFunctions/ViewFunction.php b/app/src/ViewFunctions/ViewFunction.php index 39535fc..7aad00c 100644 --- a/app/src/ViewFunctions/ViewFunction.php +++ b/app/src/ViewFunctions/ViewFunction.php @@ -5,7 +5,7 @@ namespace App\ViewFunctions; abstract class ViewFunction { /** @var string The function name */ - protected $name = ''; + protected string $name = ''; /** Get the function name. */ public function name(): string diff --git a/app/src/ViewFunctions/ZipUrl.php b/app/src/ViewFunctions/ZipUrl.php index 9763369..a13b2a8 100644 --- a/app/src/ViewFunctions/ZipUrl.php +++ b/app/src/ViewFunctions/ZipUrl.php @@ -4,8 +4,7 @@ namespace App\ViewFunctions; class ZipUrl extends Url { - /** @var string The function name */ - protected $name = 'zip_url'; + protected string $name = 'zip_url'; /** Return the URL for a given path and action. */ public function __invoke(string $path = '/'): string diff --git a/tests/ViewFunctions/ViewFunctionTest.php b/tests/ViewFunctions/ViewFunctionTest.php index 0a8c125..a13ddec 100644 --- a/tests/ViewFunctions/ViewFunctionTest.php +++ b/tests/ViewFunctions/ViewFunctionTest.php @@ -11,7 +11,7 @@ class ViewFunctionTest extends TestCase public function test_it_can_be_extended(): void { $viewFunction = new class extends ViewFunction { - protected $name = 'foo'; + protected string $name = 'foo'; }; $this->assertInstanceOf(ViewFunction::class, $viewFunction);