Compare commits

...

88 Commits

Author SHA1 Message Date
Andy Miller
a15fe29f43
update version #
Signed-off-by: Andy Miller <rhuk@mac.com>
2024-11-21 12:46:31 -07:00
Andy Miller
3126fa8388
updated changelog
Signed-off-by: Andy Miller <rhuk@mac.com>
2024-11-21 12:43:32 -07:00
Andy Miller
b0c339c9eb
moved to stable version of clockwork (v5.3.1)
Signed-off-by: Andy Miller <rhuk@mac.com>
2024-11-21 12:41:56 -07:00
Andy Miller
f812ee8555
more compoer updates
Signed-off-by: Andy Miller <rhuk@mac.com>
2024-11-18 16:13:08 -07:00
Andy Miller
8c6388bb74
package update 2024-10-30 19:26:04 -06:00
Andy Miller
d7aaef986e
updated version 2024-10-28 11:43:14 +00:00
Andy Miller
ab9363c478
Merge branch 'develop' into 1.8 2024-10-28 11:32:43 +00:00
Andy Miller
7f2da96c0b
update vendor libs 2024-10-28 11:31:20 +00:00
Andy Miller
b16db4b9c0
typo 2024-10-27 12:21:00 +00:00
Andy Miller
42c0682dd8
Merge branch '1.8' of github.com:getgrav/grav into 1.8 2024-10-26 15:25:11 +01:00
Andy Miller
1969ec1876
monolog2 support 2024-10-26 15:25:00 +01:00
Jeremy Gonyea
c30661736c
Fix for #3164. Adds aliases as possible commands during lookup (#3863) 2024-10-26 15:18:43 +01:00
Andy Miller
3d2dfa2faf
Updated changelog 2024-10-25 20:18:33 +01:00
Andy Miller
f06bbfc563
Missing RocketTheme\Toolbox\Event\EventSubscriberInterface 2024-10-25 20:17:41 +01:00
Andy Miller
37e5526a4f
updated changelog 2024-10-25 18:21:23 +01:00
Andy Miller
85c4b8279e
fixes for PHP 8.4 - Implicitly nullable parameter declarations deprecated 2024-10-25 18:20:41 +01:00
Andy Miller
46736ce256
upgrade to doctrine/collectons 2.2 2024-10-25 17:53:51 +01:00
Andy Miller
800b2e1ecb
updated changelog 2024-10-25 17:39:34 +01:00
Andy Miller
4f065b95a7
updated composer to latest version 2024-10-25 17:33:47 +01:00
Andy Miller
b59a3adc80
avif support via getgrav/image updates 2024-10-25 15:29:16 +01:00
Andy Miller
4ec9a3a489
Merge branch 'develop' into 1.8 2024-10-25 10:49:38 +01:00
Andy Miller
173d08243a
use dev-master of Clockwork to support Monolog2/3 2024-10-24 11:58:04 +01:00
Andy Miller
62c60b8ba1
Fixed a couple of monolog deprecations 2024-10-23 17:17:51 +01:00
Andy Miller
59031a8711
use BUILD_SCRIPT_URL_18 in build 2024-10-23 17:07:10 +01:00
Andy Miller
5cd859865f
use build-grav-18.sh build script 2024-10-23 16:44:49 +01:00
Andy Miller
16eafbbb04
udpate build.yaml 2024-10-23 14:37:45 +01:00
Andy Miller
3947bb03aa
set version properly 2024-10-23 13:14:26 +01:00
Andy Miller
ee55d097f2
set testing true 2024-10-23 13:08:34 +01:00
Andy Miller
ae567469b7
prepare for beta release 2024-10-23 13:08:06 +01:00
Andy Miller
f6decaab15
Merge branch 'develop' into 1.8 2024-10-23 13:04:01 +01:00
Andy Miller
10d36a10bc
updated composer.lock 2024-10-23 12:16:29 +01:00
Andy Miller
574a430a10
more composer updates 2024-10-23 12:14:45 +01:00
Andy Miller
302f02ca5d
revert schema 2024-10-22 18:01:41 +01:00
Andy Miller
c334479e4c
Merge branch 'develop' into feature/v1.8 2024-10-22 15:47:58 +01:00
Andy Miller
b96483c49a
Fix tests for latest Codeception version 2024-10-22 13:24:35 +01:00
Andy Miller
cccce836f6
Merge branch 'develop' into feature/v1.8 2024-10-22 12:09:26 +01:00
Andy Miller
bdcb77d429
Merge branch 'develop' into feature/v1.8 2024-10-21 14:20:23 +01:00
Andy Miller
e15cc86716
toAscii() should be static 2024-10-21 14:19:45 +01:00
Andy Miller
dcfbd73d43
twig compatibility stuff 2024-10-14 20:53:07 +01:00
Andy Miller
1967910789
upgrade to latest symfony 6.4 + PHP 8.2 2024-10-14 19:27:43 +01:00
Andy Miller
4f1f9a7755
Merge branch 'develop' into feature/v1.8
# Conflicts:
#	CHANGELOG.md
#	composer.lock
2024-10-14 19:25:17 +01:00
Andy Miller
e4f483998d
composer lock file 2023-05-12 13:50:50 -06:00
Andy Miller
7a393101ee
Merge branch 'develop' into feature/v1.8
# Conflicts:
#	CHANGELOG.md
#	composer.json
#	composer.lock
#	system/blueprints/config/system.yaml
#	system/src/Grav/Common/Twig/WriteCacheFileTrait.php
2023-05-12 13:44:07 -06:00
Matias Griese
10b15bedf2 Composer update 2022-08-18 13:27:58 +03:00
Matias Griese
8c14a9907e Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8
 Conflicts:
	composer.lock
2022-08-18 13:27:06 +03:00
Matias Griese
f490d9a7e1 Fix phpstan error 2022-06-29 13:16:56 +03:00
Matias Griese
81ca0c2e25 Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8
 Conflicts:
	CHANGELOG.md
	composer.json
	composer.lock
2022-06-29 13:14:06 +03:00
Matias Griese
fbfac9f8f4 Composer update 2022-06-29 13:12:11 +03:00
Matias Griese
d6e72708bf Composer update 2022-06-15 14:41:05 +03:00
Matias Griese
2aff274c31 Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8
 Conflicts:
	composer.lock
	system/src/Grav/Common/GPM/Remote/AbstractPackageCollection.php
2022-06-15 14:39:38 +03:00
Matias Griese
74c1dfa433 Composer update 2022-05-20 16:48:41 +03:00
Matias Griese
f51a9d9d87 Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8
 Conflicts:
	CHANGELOG.md
	composer.lock
2022-05-20 16:45:54 +03:00
Matias Griese
e5498f58e6 Composer update 2022-04-19 11:05:19 +03:00
Matias Griese
8f58a4494c Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8
 Conflicts:
	composer.lock
2022-04-19 11:04:33 +03:00
Matias Griese
5bfd43256d Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8 2022-03-31 11:31:04 +03:00
Matias Griese
69bc3f7f25 Composer update 2022-03-31 11:27:39 +03:00
Matias Griese
782ceada80 Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8
 Conflicts:
	CHANGELOG.md
	composer.lock
2022-03-31 11:26:37 +03:00
Matias Griese
36392acbea Composer update 2022-03-23 13:00:19 +02:00
Matias Griese
4b564df38f Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8
 Conflicts:
	CHANGELOG.md
2022-03-23 12:58:48 +02:00
Matias Griese
9d179e5b2a Composer update 2022-03-09 12:33:20 +02:00
Matias Griese
6032bd07dc Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8
 Conflicts:
	composer.json
	composer.lock
2022-03-09 12:32:31 +02:00
Matias Griese
9a87a509b0 Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8 2022-02-22 11:35:29 +02:00
Matias Griese
46f2a81b21 Phpstan fixes 2022-02-19 15:20:06 +02:00
Matias Griese
f5e21645f6 Support phpstan level 6 in Framework classes 2022-02-19 14:17:02 +02:00
Matias Griese
12c8cf9c40 Phpstan fixes 2022-02-19 13:47:29 +02:00
Matias Griese
93bb929b38 Phpstan updates 2022-02-19 13:17:34 +02:00
Matias Griese
85eaf308d5 Fixed FlexDirectory::getCache() after converting to Symfony Cache 2022-02-19 13:17:19 +02:00
Matias Griese
d9ede28b99 Composer update 2022-02-19 12:18:40 +02:00
Matias Griese
2e65b0eea4 Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8
 Conflicts:
	composer.lock
2022-02-19 12:18:00 +02:00
Matias Griese
7660a80ef7 Use older monolog due to clockwork incompatibility 2022-02-16 09:51:09 +02:00
Matias Griese
6d0a436834 Changelog update (pt 2) 2022-02-12 16:58:07 +02:00
Matias Griese
176fd8f1d8 Changelog update 2022-02-12 16:52:25 +02:00
Matias Griese
2f85fe9c99 Move unmaintained/unused vendor dependencies to the end of the list 2022-02-12 16:49:09 +02:00
Matias Griese
d93d297dc4 Updated to **Monolog 2.3** 2022-02-12 16:36:58 +02:00
Matias Griese
fcd9093f84 Use **Symfony Cache** instead of unmaintaided **Doctrine Cache** (with backward compatibility layer) 2022-02-12 15:33:38 +02:00
Matias Griese
58b54a70bd Removed system.umask_fix setting for security reasons 2022-02-12 13:49:30 +02:00
Matias Griese
9daa0a9041 Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8
 Conflicts:
	composer.lock
2022-02-12 13:08:23 +02:00
Matias Griese
965e03daf2 Update dependencies so that everything works again 2022-02-07 14:14:11 +02:00
Matias Griese
b6c3db082a Update composer dependencies 2022-02-07 14:03:05 +02:00
Matias Griese
26b68953c4 Composer update 2022-02-07 13:48:47 +02:00
Matias Griese
fba015c5d9 Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8
 Conflicts:
	composer.json
	composer.lock
2022-02-07 13:47:41 +02:00
Matias Griese
7223c177c4 Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8
 Conflicts:
	composer.json
	composer.lock
2021-12-08 10:08:34 +02:00
Matias Griese
a68bdd2b75 Fixed Toolbox Event 2021-11-25 14:17:13 +02:00
Matias Griese
38e4624506 Composer update 2021-11-25 11:51:40 +02:00
Matias Griese
ad9287ee0f Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8
 Conflicts:
	composer.json
	composer.lock
2021-11-25 11:46:21 +02:00
Matias Griese
777ac119de Update all libraries (WIP) 2021-10-20 20:33:05 +03:00
Matias Griese
076c64841e Merge branch 'develop' of github.com:getgrav/grav into feature/v1.8 2021-10-20 20:28:50 +03:00
Matias Griese
62cb40fef5 Composer update 2021-10-20 20:28:24 +03:00
164 changed files with 4566 additions and 3279 deletions

View File

@ -11,7 +11,7 @@ jobs:
permissions:
contents: write # for release creation (svenstaro/upload-release-action)
if: "!github.event.release.prerelease"
#if: "!github.event.release.prerelease"
runs-on: ubuntu-latest
steps:
@ -23,7 +23,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
php-version: 8.2
extensions: opcache, gd
tools: composer:v2
coverage: none
@ -38,10 +38,10 @@ jobs:
- name: Retrieval of Builder Scripts
run: |
# Real Grav URL
curl --silent -H "Authorization: token ${{ secrets.GLOBAL_TOKEN }}" -H "Accept: application/vnd.github.v3.raw" ${{ secrets.BUILD_SCRIPT_URL }} --output build-grav.sh
curl --silent -H "Authorization: token ${{ secrets.GLOBAL_TOKEN }}" -H "Accept: application/vnd.github.v3.raw" ${{ secrets.BUILD_SCRIPT_URL_18 }} --output build-grav.sh
# Development Local URL
# curl ${{ secrets.BUILD_SCRIPT_URL }} --output build-grav.sh
# curl ${{ secrets.BUILD_SCRIPT_URL_18 }} --output build-grav.sh
- name: Grav Builder
run: |

View File

@ -1,3 +1,39 @@
# v1.8.0-beta.3
## 11/21/2024
1. [](#improved)
* Updated composer libraries to latest versions for compatibility fixes
# v1.8.0-beta.2
## 10/28/2024
1. [](#new)
* Use `dev-master` branch of Clockwork to support Monolog2 / Monolog3
* `AVIF` image support via updates to `getgrav/Image` library
* Upgraded to **Doctrine Collection 2.2**
1. [](#improved)
* Updated composer libraries
* Updated composer.php binary to `v2.8.1`
* Fixes for PHP 8.4 - Implicitly nullable parameter declarations deprecated
* Added back Missing `RocketTheme\Toolbox\Event\EventSubscriberInterface` for Gantry5
1. [](#bugfix)
* Various fixes to use `$log->debug()`, `$log->info()`, `$log->warning()` and `$log->error()` For Monolog2 support
# v1.8.0-beta.1
## 10/23/2024
1. [](#new)
* Set minimum requirements to **PHP 8.2**
* Updated to **Twig 2.14**
* Updated to **Symfony 6.4**
* Updated to **Monolog 2.3**
* Updated to **RocketTheme/Toolbox 2.0**
* Updated to **Composer/Semver 3.2**
* Use **Symfony Cache** instead of unmaintained **Doctrine Cache**
* Removed unsupported **APC**, **WinCache**, **XCache** and **Memcache**, use apcu or memcached instead
* Removed `system.umask_fix` setting for security reasons
* Support phpstan level 6 in Framework classes
# v1.7.48
## 10/28/2024
@ -12,18 +48,18 @@
## 10/23/2024
1. [](#new)
* New `Utils::toAscii()` method
* Added support for Clockwork Debugger to allow web UI (requires new `clockwork-web` plugin)
* New `Utils::toAscii()` method
* Added support for Clockwork Debugger to allow web UI (requires new `clockwork-web` plugin)
1. [](#improved)
* Include modular sub-pages in last-modification date computation [#3562](https://github.com/getgrav/grav/pull/3562)
* Updated vendor libs to latest versions
* Updated JQuery to `3.7.1` [#3787](https://github.com/getgrav/grav/pull/3827)
* Updated vendor libraries to latest versions
* Support for Fediverse Creator meta tag [#3844](https://github.com/getgrav/grav/pull/3844)
* Include modular sub-pages in last-modification date computation [#3562](https://github.com/getgrav/grav/pull/3562)
* Updated vendor libs to latest versions
* Updated JQuery to `3.7.1` [#3787](https://github.com/getgrav/grav/pull/3827)
* Updated vendor libraries to latest versions
* Support for Fediverse Creator meta tag [#3844](https://github.com/getgrav/grav/pull/3844)
1. [](#bugfix)
* Fixes deprecated for return type in Filesystem with PHP 8.3.6 [#3831](https://github.com/getgrav/grav/issues/3831)
* Fix for `exif_imagtetype()` throwing an exception when file doesn't exist
* Fix JSON output comments check with content type [#3859](https://github.com/getgrav/grav/pull/3859)
* Fixes deprecated for return type in Filesystem with PHP 8.3.6 [#3831](https://github.com/getgrav/grav/issues/3831)
* Fix for `exif_imagtetype()` throwing an exception when file doesn't exist
* Fix JSON output comments check with content type [#3859](https://github.com/getgrav/grav/pull/3859)
# v1.7.46
## 05/15/2024

View File

@ -89,9 +89,10 @@ $ bin/gpm update
## Upgrading from older version
* [Upgrading to Grav 1.8](https://learn.getgrav.org/16/advanced/grav-development/grav-18-upgrade-guide)
* [Upgrading to Grav 1.7](https://learn.getgrav.org/16/advanced/grav-development/grav-17-upgrade-guide)
* [Upgrading to Grav 1.6](https://learn.getgrav.org/16/advanced/grav-development/grav-16-upgrade-guide)
* [Upgrading from Grav <1.6](https://learn.getgrav.org/16/advanced/grav-development/grav-15-upgrade-guide)
* [Upgrading from Grav before 1.6](https://learn.getgrav.org/16/advanced/grav-development/grav-15-upgrade-guide)
# Contributing
We appreciate any contribution to Grav, whether it is related to bugs, grammar, or simply a suggestion or improvement! Please refer to the [Contributing guide](CONTRIBUTING.md) for more guidance on this topic.

Binary file not shown.

View File

@ -2,7 +2,7 @@ actor: Tester
bootstrap: _bootstrap.php
paths:
tests: tests
log: tests/_output
output: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs

View File

@ -12,7 +12,7 @@
"homepage": "https://getgrav.org",
"license": "MIT",
"require": {
"php": "^7.3.6 || ^8.0",
"php": "^8.2",
"ext-json": "*",
"ext-openssl": "*",
"ext-curl": "*",
@ -20,61 +20,71 @@
"ext-dom": "*",
"ext-libxml": "*",
"ext-gd": "*",
"symfony/polyfill-mbstring": "~1.23",
"symfony/polyfill-iconv": "^1.23",
"symfony/polyfill-php74": "^1.23",
"symfony/polyfill-php80": "^1.23",
"symfony/polyfill-php81": "^1.23",
"symfony/polyfill-mbstring": "^1.24",
"symfony/polyfill-iconv": "^1.24",
"symfony/polyfill-php80": "^1.24",
"symfony/polyfill-php81": "^1.24",
"psr/simple-cache": "^1.0",
"psr/http-message": "^1.0",
"psr/http-message": "^1.1",
"psr/http-server-middleware": "^1.0",
"psr/container": "~1.1.0",
"nyholm/psr7-server": "^1.0",
"nyholm/psr7": "^1.3",
"twig/twig": "~v1.44",
"psr/container": "^1.1",
"psr/log": "^1.1",
"symfony/cache": "^6.4",
"symfony/yaml": "^6.4",
"symfony/console": "^6.4",
"symfony/event-dispatcher": "^6.4",
"symfony/var-exporter": "^6.4",
"symfony/var-dumper": "^6.4",
"symfony/process": "^6.4",
"symfony/http-client": "^6.4",
"twig/twig": "^2.1",
"monolog/monolog": "^2.0",
"doctrine/cache": "^2.2",
"doctrine/collections": "^2.2",
"pimple/pimple": "~3.5.0",
"nyholm/psr7-server": "^1.1",
"nyholm/psr7": "^1.8",
"erusev/parsedown": "^1.7",
"erusev/parsedown-extra": "~0.8",
"symfony/contracts": "~1.1",
"symfony/yaml": "~4.4",
"symfony/console": "~4.4",
"symfony/event-dispatcher": "~4.4",
"symfony/var-dumper": "~4.4",
"symfony/process": "~4.4",
"doctrine/cache": "^1.10",
"doctrine/collections": "^1.6",
"guzzlehttp/psr7": "^1.7",
"filp/whoops": "~2.9",
"matthiasmullie/minify": "^1.3",
"monolog/monolog": "~1.25",
"getgrav/image": "^3.0",
"getgrav/cache": "^2.0",
"donatj/phpuseragentparser": "~1.1",
"pimple/pimple": "~3.5.0",
"rockettheme/toolbox": "~1.5",
"maximebf/debugbar": "~1.16",
"league/climate": "^3.6",
"miljar/php-exif": "^0.6",
"composer/ca-bundle": "^1.2",
"dragonmantank/cron-expression": "^1.2",
"willdurand/negotiation": "^3.0",
"itsgoingd/clockwork": "^5.0",
"symfony/http-client": "^4.4",
"composer/semver": "^1.4",
"rockettheme/toolbox": "v2.x-dev",
"composer/ca-bundle": "^1.5",
"composer/semver": "^3.4",
"dragonmantank/cron-expression": "^3.0",
"willdurand/negotiation": "^3.1",
"rhukster/dom-sanitizer": "^1.0",
"matthiasmullie/minify": "^1.3",
"donatj/phpuseragentparser": "~1.9",
"guzzlehttp/psr7": "^2.7",
"filp/whoops": "~2.16",
"itsgoingd/clockwork": "^5.3",
"maximebf/debugbar": "~1.23",
"getgrav/image": "^4.0",
"getgrav/cache": "^2.0",
"antoligy/dom-string-iterators": "^1.0",
"miljar/php-exif": "^0.6",
"league/climate": "^3.8",
"multiavatar/multiavatar-php": "^1.0"
},
"require-dev": {
"codeception/codeception": "^4.1",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-deprecation-rules": "^1.0",
"codeception/codeception": "^5.1",
"phpstan/phpstan": "^1.12",
"phpstan/phpstan-deprecation-rules": "^1.2",
"phpunit/php-code-coverage": "~9.2",
"getgrav/markdowndocs": "^2.0",
"codeception/module-asserts": "^1.3",
"codeception/module-phpbrowser": "^1.0"
"codeception/module-asserts": "*",
"codeception/module-phpbrowser": "*",
"rector/rector": "^1.2"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/rockettheme/toolbox"
}
],
"replace": {
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*"
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*"
},
"suggest": {
"ext-mbstring": "Recommended for better performance",
@ -89,12 +99,14 @@
"config": {
"apcu-autoloader": true,
"platform": {
"php": "7.3.6"
"php": "8.2"
}
},
"autoload": {
"psr-4": {
"Grav\\": "system/src/Grav",
"Doctrine\\": "system/src/Doctrine",
"RocketTheme\\": "system/src/RocketTheme",
"Twig\\": "system/src/Twig"
},
"files": [
@ -117,7 +129,7 @@
"api-17": "vendor/bin/phpdoc-md generate system/src > user/pages/14.api/default.17.md",
"post-create-project-cmd": "bin/grav install",
"phpstan": "vendor/bin/phpstan analyse -l 2 -c ./tests/phpstan/phpstan.neon --memory-limit=720M system/src",
"phpstan-framework": "vendor/bin/phpstan analyse -l 5 -c ./tests/phpstan/phpstan.neon --memory-limit=480M system/src/Grav/Framework system/src/Grav/Events system/src/Grav/Installer",
"phpstan-framework": "vendor/bin/phpstan analyse -l 6 -c ./tests/phpstan/phpstan.neon --memory-limit=480M system/src/Grav/Framework system/src/Grav/Events system/src/Grav/Installer",
"phpstan-plugins": "vendor/bin/phpstan analyse -l 1 -c ./tests/phpstan/plugins.neon --memory-limit=400M user/plugins",
"test": "vendor/bin/codecept run unit",
"test-windows": "vendor\\bin\\codecept run unit"

2510
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@
namespace Grav;
\define('GRAV_REQUEST_TIME', microtime(true));
\define('GRAV_PHP_MIN', '7.3.6');
\define('GRAV_PHP_MIN', '8.2.0');
if (PHP_SAPI === 'cli-server') {
$symfony_server = stripos(getenv('_'), 'symfony') !== false || stripos($_SERVER['SERVER_SOFTWARE'] ?? '', 'symfony') !== false || stripos($_ENV['SERVER_SOFTWARE'] ?? '', 'symfony') !== false;

View File

@ -619,11 +619,9 @@ form:
options:
auto: Auto detect
file: File
apc: APC
apcu: APCu
memcache: Memcache
memcached: Memcached
wincache: WinCache
redis: Redis
cache.prefix:
@ -707,20 +705,6 @@ form:
validate:
type: bool
cache.memcache.server:
type: text
size: medium
label: PLUGIN_ADMIN.MEMCACHE_SERVER
help: PLUGIN_ADMIN.MEMCACHE_SERVER_HELP
placeholder: "localhost"
cache.memcache.port:
type: text
size: small
label: PLUGIN_ADMIN.MEMCACHE_PORT
help: PLUGIN_ADMIN.MEMCACHE_PORT_HELP
placeholder: "11211"
cache.memcached.server:
type: text
size: medium
@ -884,17 +868,6 @@ form:
validate:
type: bool
twig.umask_fix:
type: toggle
label: PLUGIN_ADMIN.TWIG_UMASK_FIX
help: PLUGIN_ADMIN.TWIG_UMASK_FIX_HELP
highlight: 0
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool
assets:
type: tab
title: PLUGIN_ADMIN.ASSETS

File diff suppressed because it is too large Load Diff

View File

@ -93,13 +93,13 @@ cache:
enabled: true # Set to true to enable caching
check:
method: file # Method to check for updates in pages: file|folder|hash|none
driver: auto # One of: auto|file|apcu|memcache|wincache
driver: auto # One of: auto|file|apcu|memcached|redis
prefix: 'g' # Cache prefix string (prevents cache conflicts)
purge_at: '0 4 * * *' # How often to purge old file cache (using new scheduler)
clear_at: '0 3 * * *' # How often to clear cache (using new scheduler)
clear_job_type: 'standard' # Type to clear when processing the scheduled clear job `standard`|`all`
clear_images_by_default: false # By default grav does not include processed images in cache clear, this can be enabled
cli_compatibility: false # Ensures only non-volatile drivers are used (file, redis, memcache, etc.)
cli_compatibility: false # Ensures only non-volatile drivers are used (file, redis, memcached, etc.)
lifetime: 604800 # Lifetime of cached data in seconds (0 = infinite)
gzip: false # GZip compress the page output
allow_webserver_gzip: false # If true, `content-encoding: identity` but connection isn't closed before `onShutDown()` event
@ -117,7 +117,6 @@ twig:
undefined_filters: true # Allow undefined filters
safe_functions: [] # List of PHP functions which are allowed to be used as Twig functions
safe_filters: [] # List of PHP functions which are allowed to be used as Twig filters
umask_fix: false # By default Twig creates cached files as 755, fix switches this to 775
assets: # Configuration for Assets Manager (JS, CSS)
css_pipeline: false # The CSS pipeline is the unification of multiple CSS resources into one file

View File

@ -9,13 +9,13 @@
// Some standard defines
define('GRAV', true);
define('GRAV_VERSION', '1.7.48');
define('GRAV_VERSION', '1.8.0-beta.3');
define('GRAV_SCHEMA', '1.7.0_2020-11-20_1');
define('GRAV_TESTING', false);
define('GRAV_TESTING', true);
// PHP minimum requirement
if (!defined('GRAV_PHP_MIN')) {
define('GRAV_PHP_MIN', '7.3.6');
define('GRAV_PHP_MIN', '8.2.0');
}
// Directory separator

View File

@ -0,0 +1,93 @@
<?php
namespace Doctrine\Common\Cache;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
/**
* Filesystem cache driver (backwards compatibility).
*/
class FilesystemCache extends CacheProvider
{
public const EXTENSION = '.doctrinecache.data';
/** @var FilesystemAdapter */
private $pool;
/**
* {@inheritdoc}
*/
public function __construct($directory, $extension = self::EXTENSION, $umask = 0002)
{
user_error(__CLASS__ . ' is deprecated since Grav 1.8, use Symfony cache instead', E_USER_DEPRECATED);
$this->pool = new FilesystemAdapter('', 0, $directory);
}
/**
* {@inheritdoc}
*/
protected function doFetch($id)
{
$item = $this->pool->getItem(rawurlencode($id));
return $item->isHit() ? $item->get() : false;
}
/**
* {@inheritdoc}
*
* @return bool
*/
protected function doContains($id)
{
return $this->pool->hasItem(rawurlencode($id));
}
/**
* {@inheritdoc}
*
* @return bool
*/
protected function doSave($id, $data, $lifeTime = 0)
{
$item = $this->pool->getItem(rawurlencode($id));
if (0 < $lifeTime) {
$item->expiresAfter($lifeTime);
}
return $this->pool->save($item->set($data));
}
/**
* {@inheritdoc}
*
* @return bool
*/
protected function doDelete($id)
{
return $this->pool->deleteItem(rawurlencode($id));
}
/**
* {@inheritdoc}
*
* @return bool
*/
protected function doFlush()
{
return $this->pool->clear();
}
/**
* {@inheritdoc}
*
* @return array|null
*/
protected function doGetStats()
{
return null;
}
}

View File

@ -194,7 +194,7 @@ class Backups
* @param callable|null $status
* @return string|null
*/
public static function backup($id = 0, callable $status = null)
public static function backup($id = 0, ?callable $status = null)
{
$grav = Grav::instance();

View File

@ -10,7 +10,8 @@
namespace Grav\Common;
use DirectoryIterator;
use \Doctrine\Common\Cache as DoctrineCache;
use Doctrine\Common\Cache\CacheProvider;
use Doctrine\Common\Cache\Psr6\DoctrineProvider;
use Exception;
use Grav\Common\Config\Config;
use Grav\Common\Filesystem\Folder;
@ -18,6 +19,12 @@ use Grav\Common\Scheduler\Scheduler;
use LogicException;
use Psr\SimpleCache\CacheInterface;
use RocketTheme\Toolbox\Event\Event;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\Cache\Adapter\ApcuAdapter;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\MemcachedAdapter;
use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\Cache\Psr16Cache;
use Symfony\Component\EventDispatcher\EventDispatcher;
use function dirname;
use function extension_loaded;
@ -27,12 +34,11 @@ use function is_array;
/**
* The GravCache object is used throughout Grav to store and retrieve cached data.
* It uses DoctrineCache library and supports a variety of caching mechanisms. Those include:
* It uses Symfony library (adding backward compatibility to Doctrine Cache) and supports a variety of caching mechanisms. Those include:
*
* APCu
* RedisCache
* MemCache
* MemCacheD
* MemCached
* FileSystem
*/
class Cache extends Getters
@ -49,7 +55,10 @@ class Cache extends Getters
/** @var Config $config */
protected $config;
/** @var DoctrineCache\CacheProvider */
/** @var AdapterInterface */
protected $adapter;
/** @var CacheProvider */
protected $driver;
/** @var CacheInterface */
@ -70,6 +79,7 @@ class Cache extends Getters
protected static $standard_remove = [
'cache://twig/',
'cache://doctrine/',
'cache://grav/',
'cache://compiled/',
'cache://clockwork/',
'cache://validated-',
@ -80,6 +90,7 @@ class Cache extends Getters
protected static $standard_remove_no_images = [
'cache://twig/',
'cache://doctrine/',
'cache://grav/',
'cache://compiled/',
'cache://clockwork/',
'cache://validated-',
@ -142,10 +153,10 @@ class Cache extends Getters
// Cache key allows us to invalidate all cache on configuration changes.
$this->key = ($prefix ?: 'g') . '-' . $uniqueness;
$this->cache_dir = $grav['locator']->findResource('cache://doctrine/' . $uniqueness, true, true);
$this->cache_dir = $grav['locator']->findResource('cache://grav/' . $uniqueness, true, true);
$this->driver_setting = $this->config->get('system.cache.driver');
$this->driver = $this->getCacheDriver();
$this->driver->setNamespace($this->key);
$this->adapter = $this->getCacheAdapter();
$this->driver = $this->getCacheDriver($this->adapter);
/** @var EventDispatcher $dispatcher */
$dispatcher = Grav::instance()['events'];
@ -158,12 +169,7 @@ class Cache extends Getters
public function getSimpleCache()
{
if (null === $this->simpleCache) {
$cache = new \Grav\Framework\Cache\Adapter\DoctrineCache($this->driver, '', $this->getLifetime());
// Disable cache key validation.
$cache->setValidation(false);
$this->simpleCache = $cache;
$this->simpleCache = new Psr16Cache($this->adapter);
}
return $this->simpleCache;
@ -229,53 +235,42 @@ class Cache extends Getters
* If there is no config option for $driver in the config, or it's set to 'auto', it will
* pick the best option based on which cache extensions are installed.
*
* @return DoctrineCache\CacheProvider The cache driver to use
* @param string|null $namespace
* @param int|null $defaultLifetime
* @return AdapterInterface The cache driver to use
* @throws \RedisException
* @throws \Symfony\Component\Cache\Exception\CacheException
*/
public function getCacheDriver()
public function getCacheAdapter(?string $namespace = null, ?int $defaultLifetime = null): AdapterInterface
{
$setting = $this->driver_setting;
$setting = $this->driver_setting ?? 'auto';
$driver_name = 'file';
if (in_array($setting, ['apc', 'xcache', 'wincache', 'memcache'], true)) {
throw new LogicException(sprintf('Cache driver for %s has been removed, use auto, file, apcu or memcached instead!', $setting));
}
// CLI compatibility requires a non-volatile cache driver
if ($this->config->get('system.cache.cli_compatibility') && (
$setting === 'auto' || $this->isVolatileDriver($setting))) {
if ($this->config->get('system.cache.cli_compatibility') && ($setting === 'auto' || $this->isVolatileDriver($setting))) {
$setting = $driver_name;
}
if (!$setting || $setting === 'auto') {
if ($setting === 'auto' || $this->isVolatileDriver($setting)) {
if (extension_loaded('apcu')) {
$driver_name = 'apcu';
} elseif (extension_loaded('wincache')) {
$driver_name = 'wincache';
}
} else {
$driver_name = $setting;
}
$this->driver_name = $driver_name;
$namespace = $namespace ?? $this->key;
$defaultLifetime = $defaultLifetime ?? 0;
switch ($driver_name) {
case 'apc':
case 'apcu':
$driver = new DoctrineCache\ApcuCache();
break;
case 'wincache':
$driver = new DoctrineCache\WinCacheCache();
break;
case 'memcache':
if (extension_loaded('memcache')) {
$memcache = new \Memcache();
$memcache->connect(
$this->config->get('system.cache.memcache.server', 'localhost'),
$this->config->get('system.cache.memcache.port', 11211)
);
$driver = new DoctrineCache\MemcacheCache();
$driver->setMemcache($memcache);
} else {
throw new LogicException('Memcache PHP extension has not been installed');
}
$adapter = new ApcuAdapter($namespace, $defaultLifetime);
break;
case 'memcached':
@ -285,8 +280,7 @@ class Cache extends Getters
$this->config->get('system.cache.memcached.server', 'localhost'),
$this->config->get('system.cache.memcached.port', 11211)
);
$driver = new DoctrineCache\MemcachedCache();
$driver->setMemcached($memcached);
$adapter = new MemcachedAdapter($memcached, $namespace, $defaultLifetime);
} else {
throw new LogicException('Memcached PHP extension has not been installed');
}
@ -318,19 +312,39 @@ class Cache extends Getters
throw new \RedisException('Could not select alternate Redis database ID');
}
$driver = new DoctrineCache\RedisCache();
$driver->setRedis($redis);
$adapter = new RedisAdapter($redis, $namespace, $defaultLifetime);
} else {
throw new LogicException('Redis PHP extension has not been installed');
}
break;
default:
$driver = new DoctrineCache\FilesystemCache($this->cache_dir);
$adapter = new FilesystemAdapter($namespace, $defaultLifetime, $this->cache_dir);
break;
}
return $driver;
return $adapter;
}
/**
* Automatically picks the cache mechanism to use. If you pick one manually it will use that
* If there is no config option for $driver in the config, or it's set to 'auto', it will
* pick the best option based on which cache extensions are installed.
*
* @return CacheProvider The cache driver to use
*/
public function getCacheDriver(?AdapterInterface $adapter = null)
{
if (null === $adapter) {
$adapter = $this->getCacheAdapter();
}
$cache = DoctrineProvider::wrap($adapter);
if (!$cache instanceof CacheProvider) {
throw new \RuntimeException('Internal error');
}
return $cache;
}
/**
@ -618,7 +632,7 @@ class Cache extends Getters
*/
public function isVolatileDriver($setting)
{
return in_array($setting, ['apc', 'apcu', 'xcache', 'wincache'], true);
return $setting === 'apcu';
}
/**

View File

@ -323,7 +323,7 @@ class Data implements DataInterface, ArrayAccess, \Countable, JsonSerializable,
* @param FileInterface|null $storage Optionally enter a new storage.
* @return FileInterface|null
*/
public function file(FileInterface $storage = null)
public function file(?FileInterface $storage = null)
{
if ($storage) {
$this->storage = $storage;

View File

@ -80,5 +80,5 @@ interface DataInterface
* @param FileInterface|null $storage Optionally enter a new storage.
* @return FileInterface
*/
public function file(FileInterface $storage = null);
public function file(?FileInterface $storage = null);
}

View File

@ -162,7 +162,7 @@ class Validation
* @param UserInterface|null $user
* @return bool
*/
public static function authorize($action, UserInterface $user = null)
public static function authorize($action, ?UserInterface $user = null)
{
if (!$user) {
return false;

View File

@ -544,7 +544,7 @@ class Debugger
* @param string|null $message
* @return mixed
*/
public function profile(callable $callable, string $message = null)
public function profile(callable $callable, ?string $message = null)
{
$this->startProfiling();
$response = $callable();
@ -585,7 +585,7 @@ class Debugger
* @param string|null $message
* @return array|null
*/
public function stopProfiling(string $message = null): ?array
public function stopProfiling(?string $message = null): ?array
{
$timings = null;
if ($this->enabled && extension_loaded('tideways_xhprof')) {
@ -776,7 +776,7 @@ class Debugger
* @param float|null $time
* @return $this
*/
public function addEvent(string $name, $event, EventDispatcherInterface $dispatcher, float $time = null)
public function addEvent(string $name, $event, EventDispatcherInterface $dispatcher, ?float $time = null)
{
if ($this->enabled && $this->clockwork) {
$time = $time ?? microtime(true);

View File

@ -70,7 +70,7 @@ class Errors
$logger = $grav['log'];
$whoops->pushHandler(function ($exception, $inspector, $run) use ($logger) {
try {
$logger->addCritical($exception->getMessage() . ' - Trace: ' . $exception->getTraceAsString());
$logger->critical($exception->getMessage() . ' - Trace: ' . $exception->getTraceAsString());
} catch (Exception $e) {
echo $e;
}

View File

@ -75,21 +75,21 @@ abstract class Archiver
* @param callable|null $status
* @return $this
*/
abstract public function compress($folder, callable $status = null);
abstract public function compress($folder, ?callable $status = null);
/**
* @param string $destination
* @param callable|null $status
* @return $this
*/
abstract public function extract($destination, callable $status = null);
abstract public function extract($destination, ?callable $status = null);
/**
* @param array $folders
* @param callable|null $status
* @return $this
*/
abstract public function addEmptyFolders($folders, callable $status = null);
abstract public function addEmptyFolders($folders, ?callable $status = null);
/**
* @param string $rootPath

View File

@ -26,7 +26,7 @@ class ZipArchiver extends Archiver
* @param callable|null $status
* @return $this
*/
public function extract($destination, callable $status = null)
public function extract($destination, ?callable $status = null)
{
$zip = new ZipArchive();
$archive = $zip->open($this->archive_file);
@ -51,7 +51,7 @@ class ZipArchiver extends Archiver
* @param callable|null $status
* @return $this
*/
public function compress($source, callable $status = null)
public function compress($source, ?callable $status = null)
{
if (!extension_loaded('zip')) {
throw new InvalidArgumentException('ZipArchiver: Zip PHP module not installed...');
@ -105,7 +105,7 @@ class ZipArchiver extends Archiver
* @param callable|null $status
* @return $this
*/
public function addEmptyFolders($folders, callable $status = null)
public function addEmptyFolders($folders, ?callable $status = null)
{
if (!extension_loaded('zip')) {
throw new InvalidArgumentException('ZipArchiver: Zip PHP module not installed...');

View File

@ -32,7 +32,7 @@ abstract class FlexObject extends \Grav\Framework\Flex\FlexObject implements Med
* {@inheritdoc}
* @see FlexObjectInterface::getFormValue()
*/
public function getFormValue(string $name, $default = null, string $separator = null)
public function getFormValue(string $name, $default = null, ?string $separator = null)
{
$value = $this->getNestedProperty($name, null, $separator);

View File

@ -766,7 +766,7 @@ class PageCollection extends FlexPageCollection implements PageCollectionInterfa
* @return static
* @phpstan-return static<T>
*/
public function withTranslation(bool $bool = true, string $languageCode = null, bool $fallback = null)
public function withTranslation(bool $bool = true, ?string $languageCode = null, ?bool $fallback = null)
{
$list = array_keys(array_filter($this->call('hasTranslation', [$languageCode, $fallback])));
@ -778,7 +778,7 @@ class PageCollection extends FlexPageCollection implements PageCollectionInterfa
* @param bool|null $fallback
* @return PageIndex
*/
public function withTranslated(string $languageCode = null, bool $fallback = null)
public function withTranslated(?string $languageCode = null, ?bool $fallback = null)
{
return $this->getIndex()->withTranslated($languageCode, $fallback);
}

View File

@ -57,7 +57,7 @@ class PageIndex extends FlexPageIndex implements PageCollectionInterface
public const ORDER_LIST_REGEX = '/(\/\d+)\.[^\/]+/u';
public const PAGE_ROUTE_REGEX = '/\/\d+\./u';
/** @var PageObject|array */
/** @var T|array */
protected $_root;
/** @var array|null */
protected $_params;
@ -66,7 +66,7 @@ class PageIndex extends FlexPageIndex implements PageCollectionInterface
* @param array $entries
* @param FlexDirectory|null $directory
*/
public function __construct(array $entries = [], FlexDirectory $directory = null)
public function __construct(array $entries = [], ?FlexDirectory $directory = null)
{
// Remove root if it's taken.
if (isset($entries[''])) {
@ -181,7 +181,7 @@ class PageIndex extends FlexPageIndex implements PageCollectionInterface
* @return static
* @phpstan-return static<T,C>
*/
public function withTranslated(string $languageCode = null, bool $fallback = null)
public function withTranslated(?string $languageCode = null, ?bool $fallback = null)
{
if (null === $languageCode) {
return $this;
@ -413,7 +413,7 @@ class PageIndex extends FlexPageIndex implements PageCollectionInterface
* @return static
* @phpstan-return static<T,C>
*/
protected function createFrom(array $entries, string $keyField = null)
protected function createFrom(array $entries, ?string $keyField = null)
{
/** @var static $index */
$index = parent::createFrom($entries, $keyField);
@ -428,7 +428,7 @@ class PageIndex extends FlexPageIndex implements PageCollectionInterface
* @param bool|null $fallback
* @return array
*/
protected function translateEntries(array $entries, string $lang, bool $fallback = null): array
protected function translateEntries(array $entries, string $lang, ?bool $fallback = null): array
{
$languages = $this->getFallbackLanguages($lang, $fallback);
foreach ($entries as $key => &$entry) {
@ -493,7 +493,7 @@ class PageIndex extends FlexPageIndex implements PageCollectionInterface
* @param bool|null $fallback
* @return array
*/
protected function getFallbackLanguages(string $languageCode = null, bool $fallback = null): array
protected function getFallbackLanguages(?string $languageCode = null, ?bool $fallback = null): array
{
$fallback = $fallback ?? true;
if (!$fallback && null !== $languageCode) {
@ -781,7 +781,7 @@ class PageIndex extends FlexPageIndex implements PageCollectionInterface
* @param int|null $timestamp
* @return string|null
*/
private function jsDate(int $timestamp = null): ?string
private function jsDate(?int $timestamp = null): ?string
{
if (!$timestamp) {
return null;

View File

@ -129,7 +129,7 @@ class PageObject extends FlexPageObject
/**
* @inheritdoc PageInterface
*/
public function getFormValue(string $name, $default = null, string $separator = null)
public function getFormValue(string $name, $default = null, ?string $separator = null)
{
$test = new stdClass();
@ -261,7 +261,7 @@ class PageObject extends FlexPageObject
/**
* @param UserInterface|null $user
*/
public function check(UserInterface $user = null): void
public function check(?UserInterface $user = null): void
{
parent::check($user);

View File

@ -32,7 +32,7 @@ trait PageRoutableTrait
* @return PageInterface|null the parent page object if it exists.
*/
public function parent(PageInterface $var = null)
public function parent(?PageInterface $var = null)
{
if (Utils::isAdminPlugin()) {
return parent::parent();

View File

@ -38,7 +38,7 @@ class UserGroupCollection extends FlexCollection
* @param string|null $scope
* @return bool|null
*/
public function authorize(string $action, string $scope = null): ?bool
public function authorize(string $action, ?string $scope = null): ?bool
{
$authorized = null;
/** @var UserGroupObject $object */

View File

@ -57,7 +57,7 @@ class UserGroupObject extends FlexObject implements UserGroupInterface
* @param string|null $scope
* @return bool|null
*/
public function authorize(string $action, string $scope = null): ?bool
public function authorize(string $action, ?string $scope = null): ?bool
{
if ($scope === 'test') {
$scope = null;

View File

@ -23,7 +23,7 @@ class UserFileStorage extends FileStorage
* {@inheritdoc}
* @see FlexStorageInterface::getMediaPath()
*/
public function getMediaPath(string $key = null): ?string
public function getMediaPath(?string $key = null): ?string
{
// There is no media support for file storage (fallback to common location).
return null;

View File

@ -197,7 +197,7 @@ class UserIndex extends FlexIndex implements UserCollectionInterface
/** @var Logger $logger */
$logger = $grav['log'];
$logger->addDebug($message);
$logger->debug($message);
/** @var Debugger $debugger */
$debugger = $grav['debugger'];

View File

@ -92,9 +92,9 @@ class UserObject extends FlexObject implements UserInterface, Countable
protected $_uploads_original;
/** @var FileInterface|null */
protected $_storage;
/** @var UserGroupIndex */
/** @var UserGroupIndex|null */
protected $_groups;
/** @var Access */
/** @var Access|null */
protected $_access;
/** @var array|null */
protected $access;
@ -270,7 +270,7 @@ class UserObject extends FlexObject implements UserInterface, Countable
* @param string|null $scope
* @return bool|null
*/
public function authorize(string $action, string $scope = null): ?bool
public function authorize(string $action, ?string $scope = null): ?bool
{
if ($scope === 'test') {
// Special scope to test user permissions.
@ -557,7 +557,7 @@ class UserObject extends FlexObject implements UserInterface, Countable
* @param FileInterface|null $storage Optionally enter a new storage.
* @return FileInterface|null
*/
public function file(FileInterface $storage = null)
public function file(?FileInterface $storage = null)
{
if (null !== $storage) {
$this->_storage = $storage;

View File

@ -12,7 +12,7 @@ namespace Grav\Common\GPM\Remote;
use Grav\Common\Grav;
use Grav\Common\HTTP\Response;
use Grav\Common\GPM\Common\AbstractPackageCollection as BaseCollection;
use \Doctrine\Common\Cache\FilesystemCache;
use Doctrine\Common\Cache\FilesystemCache;
use RuntimeException;
/**

View File

@ -200,7 +200,7 @@ class Grav extends Container
* @param string|null $environment
* @return $this
*/
public function setup(string $environment = null)
public function setup(?string $environment = null)
{
if (isset($this->initialized['setup'])) {
return $this;
@ -522,7 +522,7 @@ class Grav extends Container
* @param ResponseInterface|null $response
* @return void
*/
public function header(ResponseInterface $response = null): void
public function header(?ResponseInterface $response = null): void
{
if (null === $response) {
/** @var PageInterface $page */
@ -585,7 +585,7 @@ class Grav extends Container
* @param Event|null $event
* @return Event
*/
public function fireEvent($eventName, Event $event = null)
public function fireEvent($eventName, ?Event $event = null)
{
/** @var EventDispatcherInterface $events */
$events = $this['events'];

View File

@ -25,7 +25,7 @@ class Client
'User-Agent' => 'Grav CMS'
];
public static function getClient(array $overrides = [], int $connections = 6, callable $callback = null): HttpClientInterface
public static function getClient(array $overrides = [], int $connections = 6, ?callable $callback = null): HttpClientInterface
{
$config = Grav::instance()['config'];
$options = static::getOptions();

View File

@ -41,7 +41,7 @@ class Response
* @return string
* @throws TransportExceptionInterface|RedirectionExceptionInterface|ServerExceptionInterface|TransportExceptionInterface|ClientExceptionInterface
*/
public static function get(string $uri = '', array $overrides = [], callable $callback = null): string
public static function get(string $uri = '', array $overrides = [], ?callable $callback = null): string
{
$response = static::request('GET', $uri, $overrides, $callback);
return $response->getContent();
@ -58,7 +58,7 @@ class Response
* @return ResponseInterface
* @throws TransportExceptionInterface
*/
public static function request(string $method, string $uri, array $overrides = [], callable $callback = null): ResponseInterface
public static function request(string $method, string $uri, array $overrides = [], ?callable $callback = null): ResponseInterface
{
if (empty($method)) {
throw new TransportException('missing method (GET, PUT, etc.)');

View File

@ -30,7 +30,7 @@ class Excerpts
* @param PageInterface|null $page Page, defaults to the current page object
* @return string Returns final HTML string
*/
public static function processImageHtml($html, PageInterface $page = null)
public static function processImageHtml($html, ?PageInterface $page = null)
{
$excerpt = static::getExcerptFromHtml($html, 'img');
if (null === $excerpt) {
@ -61,7 +61,7 @@ class Excerpts
* @param PageInterface|null $page Page, defaults to the current page object
* @return string Returns final HTML string
*/
public static function processLinkHtml($html, PageInterface $page = null)
public static function processLinkHtml($html, ?PageInterface $page = null)
{
$excerpt = static::getExcerptFromHtml($html, 'a');
if (null === $excerpt) {
@ -158,7 +158,7 @@ class Excerpts
* @param string $type
* @return mixed
*/
public static function processLinkExcerpt($excerpt, PageInterface $page = null, $type = 'link')
public static function processLinkExcerpt($excerpt, ?PageInterface $page = null, $type = 'link')
{
$excerpts = new ExcerptsObject($page);
@ -172,7 +172,7 @@ class Excerpts
* @param PageInterface|null $page Page, defaults to the current page object
* @return array
*/
public static function processImageExcerpt(array $excerpt, PageInterface $page = null)
public static function processImageExcerpt(array $excerpt, ?PageInterface $page = null)
{
$excerpts = new ExcerptsObject($page);
@ -187,7 +187,7 @@ class Excerpts
* @param PageInterface|null $page Page, defaults to the current page object
* @return Medium|Link
*/
public static function processMediaActions($medium, $url, PageInterface $page = null)
public static function processMediaActions($medium, $url, ?PageInterface $page = null)
{
$excerpts = new ExcerptsObject($page);

View File

@ -29,7 +29,7 @@ class YamlLinter
* @param string|null $folder
* @return array
*/
public static function lint(string $folder = null)
public static function lint(?string $folder = null)
{
if (null !== $folder) {
$folder = $folder ?: GRAV_ROOT;

View File

@ -230,7 +230,7 @@ class Iterator implements \ArrayAccess, \Iterator, \Countable, \Serializable
*
* @return $this
*/
public function filter(callable $callback = null)
public function filter(?callable $callback = null)
{
foreach ($this->items as $key => $value) {
if ((!$callback && !(bool)$value) || ($callback && !$callback($value, $key))) {
@ -250,7 +250,7 @@ class Iterator implements \ArrayAccess, \Iterator, \Countable, \Serializable
* @return $this|array
*
*/
public function sort(callable $callback = null, $desc = false)
public function sort(?callable $callback = null, $desc = false)
{
if (!$callback || !is_callable($callback)) {
return $this;

View File

@ -358,7 +358,7 @@ class Language
* @param bool $assoc Return values in ['en' => '.en.md', ...] format.
* @return array Key is the language code, value is the file extension to be used.
*/
public function getFallbackPageExtensions(string $fileExtension = null, string $languageCode = null, bool $assoc = false)
public function getFallbackPageExtensions(?string $fileExtension = null, ?string $languageCode = null, bool $assoc = false)
{
$fileExtension = $fileExtension ?: CONTENT_EXT;
$key = $fileExtension . '-' . ($languageCode ?? 'default') . '-' . (int)$assoc;
@ -411,7 +411,7 @@ class Language
* @param bool $includeDefault If true, list contains '', which can be used for default
* @return array
*/
public function getFallbackLanguages(string $languageCode = null, bool $includeDefault = false)
public function getFallbackLanguages(?string $languageCode = null, bool $includeDefault = false)
{
// Handle default.
if ($languageCode === '' || !$this->enabled()) {
@ -489,7 +489,7 @@ class Language
* @param bool $html_out
* @return string|string[]
*/
public function translate($args, array $languages = null, $array_support = false, $html_out = false)
public function translate($args, ?array $languages = null, $array_support = false, $html_out = false)
{
if (is_array($args)) {
$lookup = array_shift($args);

View File

@ -105,7 +105,7 @@ interface MediaCollectionInterface extends \Grav\Framework\Media\Interfaces\Medi
* @param Blueprint|null $blueprint
* @return Medium|null
*/
public function createFromArray(array $items = [], Blueprint $blueprint = null);
public function createFromArray(array $items = [], ?Blueprint $blueprint = null);
/**
* @param MediaObjectInterface $mediaObject

View File

@ -32,7 +32,7 @@ interface MediaUploadInterface
* @return string
* @throws RuntimeException
*/
public function checkUploadedFile(UploadedFileInterface $uploadedFile, string $filename = null, array $settings = null): string;
public function checkUploadedFile(UploadedFileInterface $uploadedFile, ?string $filename = null, ?array $settings = null): string;
/**
* Copy uploaded file to the media collection.
@ -51,7 +51,7 @@ interface MediaUploadInterface
* @return void
* @throws RuntimeException
*/
public function copyUploadedFile(UploadedFileInterface $uploadedFile, string $filename, array $settings = null): void;
public function copyUploadedFile(UploadedFileInterface $uploadedFile, string $filename, ?array $settings = null): void;
/**
* Delete real file from the media collection.
@ -60,7 +60,7 @@ interface MediaUploadInterface
* @param array|null $settings
* @return void
*/
public function deleteFile(string $filename, array $settings = null): void;
public function deleteFile(string $filename, ?array $settings = null): void;
/**
* Rename file inside the media collection.
@ -69,5 +69,5 @@ interface MediaUploadInterface
* @param string $to
* @param array|null $settings
*/
public function renameFile(string $from, string $to, array $settings = null): void;
public function renameFile(string $from, string $to, ?array $settings = null): void;
}

View File

@ -71,7 +71,7 @@ trait MediaUploadTrait
* @return string
* @throws RuntimeException
*/
public function checkUploadedFile(UploadedFileInterface $uploadedFile, string $filename = null, array $settings = null): string
public function checkUploadedFile(UploadedFileInterface $uploadedFile, ?string $filename = null, ?array $settings = null): string
{
// Check if there is an upload error.
switch ($uploadedFile->getError()) {
@ -115,7 +115,7 @@ trait MediaUploadTrait
* @return string
* @throws RuntimeException
*/
public function checkFileMetadata(array $metadata, string $filename = null, array $settings = null): string
public function checkFileMetadata(array $metadata, ?string $filename = null, ?array $settings = null): string
{
// Add the defaults to the settings.
$settings = $this->getUploadSettings($settings);
@ -252,7 +252,7 @@ trait MediaUploadTrait
* @return void
* @throws RuntimeException
*/
public function copyUploadedFile(UploadedFileInterface $uploadedFile, string $filename, array $settings = null): void
public function copyUploadedFile(UploadedFileInterface $uploadedFile, string $filename, ?array $settings = null): void
{
// Add the defaults to the settings.
$settings = $this->getUploadSettings($settings);
@ -329,7 +329,7 @@ trait MediaUploadTrait
* @return void
* @throws RuntimeException
*/
public function deleteFile(string $filename, array $settings = null): void
public function deleteFile(string $filename, ?array $settings = null): void
{
// Add the defaults to the settings.
$settings = $this->getUploadSettings($settings);
@ -371,7 +371,7 @@ trait MediaUploadTrait
* @param string $to
* @param array|null $settings
*/
public function renameFile(string $from, string $to, array $settings = null): void
public function renameFile(string $from, string $to, ?array $settings = null): void
{
// Add the defaults to the settings.
$settings = $this->getUploadSettings($settings);

View File

@ -43,7 +43,7 @@ class Collection extends Iterator implements PageCollectionInterface
* @param array $params
* @param Pages|null $pages
*/
public function __construct($items = [], array $params = [], Pages $pages = null)
public function __construct($items = [], array $params = [], ?Pages $pages = null)
{
parent::__construct($items);

View File

@ -46,7 +46,7 @@ interface PageCollectionInterface extends Traversable, ArrayAccess, Countable, S
* Add a single page to a collection
*
* @param PageInterface $page
* @return $this
* @return $this|PageCollectionInterface<TKey,T>
*/
public function addPage(PageInterface $page);
@ -63,7 +63,7 @@ interface PageCollectionInterface extends Traversable, ArrayAccess, Countable, S
*
* Create a copy of this collection
*
* @return static
* @return static<TKey,T>
*/
public function copy();

View File

@ -133,7 +133,7 @@ interface PageRoutableInterface
* @param PageInterface|null $var the parent page object
* @return PageInterface|null the parent page object if it exists.
*/
public function parent(PageInterface $var = null);
public function parent(?PageInterface $var = null);
/**
* Gets the top parent object for this page. Can return page itself.

View File

@ -52,5 +52,5 @@ interface PagesSourceInterface // extends \Iterator
* @param array|null $options
* @return array
*/
public function getChildren(string $route, array $options = null): array;
public function getChildren(string $route, ?array $options = null): array;
}

View File

@ -42,7 +42,7 @@ class Excerpts
* @param PageInterface|null $page
* @param array|null $config
*/
public function __construct(PageInterface $page = null, array $config = null)
public function __construct(?PageInterface $page = null, ?array $config = null)
{
$this->page = $page ?? Grav::instance()['page'] ?? null;

View File

@ -38,7 +38,7 @@ class Media extends AbstractMedia
* @param array|null $media_order
* @param bool $load
*/
public function __construct($path, array $media_order = null, $load = true)
public function __construct($path, ?array $media_order = null, $load = true)
{
$this->setPath($path);
$this->media_order = $media_order;

View File

@ -229,7 +229,7 @@ abstract class AbstractMedia implements ExportInterface, MediaCollectionInterfac
* @param Blueprint|null $blueprint
* @return Medium|null
*/
public function createFromArray(array $items = [], Blueprint $blueprint = null)
public function createFromArray(array $items = [], ?Blueprint $blueprint = null)
{
return MediumFactory::fromArray($items, $blueprint);
}

View File

@ -46,7 +46,7 @@ class ImageMedium extends Medium implements ImageMediaInterface, ImageManipulate
* @param array $items
* @param Blueprint|null $blueprint
*/
public function __construct($items = [], Blueprint $blueprint = null)
public function __construct($items = [], ?Blueprint $blueprint = null)
{
parent::__construct($items, $blueprint);

View File

@ -43,7 +43,7 @@ class Medium extends Data implements RenderableInterface, MediaFileInterface
* @param array $items
* @param Blueprint|null $blueprint
*/
public function __construct($items = [], Blueprint $blueprint = null)
public function __construct($items = [], ?Blueprint $blueprint = null)
{
parent::__construct($items, $blueprint);

View File

@ -150,7 +150,7 @@ class MediumFactory
* @param Blueprint|null $blueprint
* @return Medium
*/
public static function fromArray(array $items = [], Blueprint $blueprint = null)
public static function fromArray(array $items = [], ?Blueprint $blueprint = null)
{
$type = $items['type'] ?? null;

View File

@ -24,7 +24,7 @@ class VectorImageMedium extends StaticImageMedium
* @param array $items
* @param Blueprint|null $blueprint
*/
public function __construct($items = [], Blueprint $blueprint = null)
public function __construct($items = [], ?Blueprint $blueprint = null)
{
parent::__construct($items, $blueprint);

View File

@ -2395,7 +2395,7 @@ class Page implements PageInterface
* @param PageInterface|null $var the parent page object
* @return PageInterface|null the parent page object if it exists.
*/
public function parent(PageInterface $var = null)
public function parent(?PageInterface $var = null)
{
if ($var) {
$this->parent = $var->path();

View File

@ -645,7 +645,7 @@ class Pages
* @param PageInterface|null $self
* @return Collection
*/
protected function evaluate($value, PageInterface $self = null)
protected function evaluate($value, ?PageInterface $self = null)
{
// Parse command.
if (is_string($value)) {
@ -757,6 +757,10 @@ class Pages
break;
}
if (!$collection instanceof Collection) {
$collection = new Collection($collection->toArray());
}
return $collection;
}
@ -1156,7 +1160,7 @@ class Pages
* @param PageInterface|null $current
* @return Collection
*/
public function all(PageInterface $current = null)
public function all(?PageInterface $current = null)
{
$all = new Collection();
@ -1230,7 +1234,7 @@ class Pages
* @param bool $limitLevels
* @return array
*/
public function getList(PageInterface $current = null, $level = 0, $rawRoutes = false, $showAll = true, $showFullpath = false, $showSlug = false, $showModular = false, $limitLevels = false)
public function getList(?PageInterface $current = null, $level = 0, $rawRoutes = false, $showAll = true, $showFullpath = false, $showSlug = false, $showModular = false, $limitLevels = false)
{
if (!$current) {
if ($level) {
@ -1818,7 +1822,7 @@ class Pages
* @throws RuntimeException
* @internal
*/
protected function recurse(string $directory, PageInterface $parent = null)
protected function recurse(string $directory, ?PageInterface $parent = null)
{
$directory = rtrim($directory, DS);
$page = new Page;

View File

@ -72,7 +72,7 @@ class Plugin implements EventSubscriberInterface, ArrayAccess
* @param Grav $grav
* @param Config|null $config
*/
public function __construct($name, Grav $grav, Config $config = null)
public function __construct($name, Grav $grav, ?Config $config = null)
{
$this->name = $name;
$this->grav = $grav;
@ -414,7 +414,7 @@ class Plugin implements EventSubscriberInterface, ArrayAccess
return true;
}
public static function inheritedConfigOption(string $plugin, string $var, PageInterface $page = null, $default = null)
public static function inheritedConfigOption(string $plugin, string $var, ?PageInterface $page = null, $default = null)
{
if (Utils::isAdminPlugin()) {
$page = Grav::instance()['admin']->page() ?? null;

View File

@ -320,7 +320,7 @@ class Plugins extends Iterator
// Log a warning if plugin cannot be found.
if (null === $class) {
$grav['log']->addWarning(
$grav['log']->warning(
sprintf("Plugin '%s' enabled but not found! Try clearing cache with `bin/grav clearcache`", $name)
);
}

View File

@ -415,7 +415,7 @@ class InitializeProcessor extends ProcessorBase
$this->stopTimer('_init_uri');
}
protected function handleRedirectRequest(RequestInterface $request, int $code = null): ?ResponseInterface
protected function handleRedirectRequest(RequestInterface $request, ?int $code = null): ?ResponseInterface
{
if (!in_array($request->getMethod(), ['GET', 'HEAD'])) {
return null;

View File

@ -188,7 +188,7 @@ class Job
* @param DateTime|null $date
* @return bool
*/
public function isDue(DateTime $date = null)
public function isDue(?DateTime $date = null)
{
// The execution time is being defaulted if not defined
if (!$this->executionTime) {
@ -259,7 +259,7 @@ class Job
* @param callable|null $whenOverlapping A callback to ignore job overlapping
* @return self
*/
public function onlyOne($tempDir = null, callable $whenOverlapping = null)
public function onlyOne($tempDir = null, ?callable $whenOverlapping = null)
{
if ($tempDir === null || !is_dir($tempDir)) {
$tempDir = $this->tempDir;

View File

@ -188,7 +188,7 @@ class Scheduler
* @param DateTime|null $runTime Optional, run at specific moment
* @param bool $force force run even if not due
*/
public function run(DateTime $runTime = null, $force = false)
public function run(?DateTime $runTime = null, $force = false)
{
$this->loadSavedJobs();

View File

@ -30,7 +30,7 @@ class Security
* @param array|null $options
* @return string|null
*/
public static function detectXssFromSvgFile(string $filepath, array $options = null): ?string
public static function detectXssFromSvgFile(string $filepath, ?array $options = null): ?string
{
if (file_exists($filepath) && Grav::instance()['config']->get('security.sanitize_svg')) {
$content = file_get_contents($filepath);
@ -95,7 +95,7 @@ class Security
* @param callable|null $status
* @return array
*/
public static function detectXssFromPages(Pages $pages, $route = true, callable $status = null)
public static function detectXssFromPages(Pages $pages, $route = true, ?callable $status = null)
{
$routes = $pages->getList(null, 0, true);
@ -145,7 +145,7 @@ class Security
* @param string $prefix Prefix for returned values.
* @return array Returns flatten list of potentially dangerous input values, such as 'data.content'.
*/
public static function detectXssFromArray(array $array, string $prefix = '', array $options = null)
public static function detectXssFromArray(array $array, string $prefix = '', ?array $options = null)
{
if (null === $options) {
$options = static::getXssDefaults();
@ -176,7 +176,7 @@ class Security
*
* Copies the code from: https://github.com/symphonycms/xssfilter/blob/master/extension.driver.php#L138
*/
public static function detectXss($string, array $options = null): ?string
public static function detectXss($string, ?array $options = null): ?string
{
// Skip any null or non string values
if (null === $string || !is_string($string) || empty($string)) {

View File

@ -932,7 +932,7 @@ class GravExtension extends AbstractExtension implements GlobalsInterface
* @param bool $html_out
* @return string
*/
public function translateLanguage($args, array $languages = null, $array_support = false, $html_out = false)
public function translateLanguage($args, ?array $languages = null, $array_support = false, $html_out = false)
{
/** @var Language $language */
$language = $this->grav['language'];

View File

@ -26,7 +26,7 @@ class TwigNodeSwitch extends Node
* @param int $lineno
* @param string|null $tag
*/
public function __construct(Node $value, Node $cases, Node $default = null, $lineno = 0, $tag = null)
public function __construct(Node $value, Node $cases, ?Node $default = null, $lineno = 0, $tag = null)
{
$nodes = ['value' => $value, 'cases' => $cases, 'default' => $default];
$nodes = array_filter($nodes);

View File

@ -26,7 +26,7 @@ class TwigNodeTryCatch extends Node
* @param int $lineno
* @param string|null $tag
*/
public function __construct(Node $try, Node $catch = null, $lineno = 0, $tag = null)
public function __construct(Node $try, ?Node $catch = null, $lineno = 0, $tag = null)
{
$nodes = ['try' => $try, 'catch' => $catch];
$nodes = array_filter($nodes);

View File

@ -43,6 +43,17 @@ use function function_exists;
use function in_array;
use function is_array;
// Twig3 compatibility
if (!class_exists('Twig_SimpleFunction')) {
class_alias('\Twig\TwigFunction', 'Twig_SimpleFunction');
}
if (!class_exists('Twig_SimpleFilter')) {
class_alias('\Twig\TwigFilter', 'Twig_SimpleFilter');
}
if (!class_exists('Twig_Extension')) {
class_alias('\Twig\Extension\AbstractExtension', 'Twig_Extension');
}
/**
* Class Twig
* @package Grav\Common\Twig

View File

@ -22,10 +22,10 @@ use Twig\TemplateWrapper;
*/
class TwigEnvironment extends Environment
{
use WriteCacheFileTrait;
/**
* @inheritDoc
*
* TODO: Needed for Twig 1 compatibility.
*/
public function resolveTemplate($names)
{

View File

@ -22,5 +22,5 @@ interface AuthorizeInterface
* @param string|null $scope
* @return bool|null
*/
public function authorize(string $action, string $scope = null): ?bool;
public function authorize(string $action, ?string $scope = null): ?bool;
}

View File

@ -76,7 +76,7 @@ trait UserTrait
* @param string|null $scope
* @return bool|null
*/
public function authorize(string $action, string $scope = null): ?bool
public function authorize(string $action, ?string $scope = null): ?bool
{
// User needs to be enabled.
if ($this->get('state', 'enabled') !== 'enabled') {

View File

@ -1005,7 +1005,7 @@ abstract class Utils
* @param int|null $flags
* @return array|string
*/
public static function pathinfo($path, int $flags = null)
public static function pathinfo($path, ?int $flags = null)
{
$path = str_replace(['%2F', '%5C'], ['/', '\\'], rawurlencode($path));
@ -1618,7 +1618,7 @@ abstract class Utils
* @return string
* @throws RuntimeException
*/
public static function getPagePathFromToken($path, PageInterface $page = null)
public static function getPagePathFromToken($path, ?PageInterface $page = null)
{
return static::getPathFromToken($path, $page);
}
@ -1947,7 +1947,7 @@ abstract class Utils
* @param array|null $defaults
* @return array
*/
public static function getSupportPageTypes(array $defaults = null)
public static function getSupportPageTypes(?array $defaults = null)
{
$types = Grav::instance()['config']->get('system.pages.types', $defaults);
if (!is_array($types)) {

View File

@ -65,7 +65,7 @@ class PluginApplication extends Application
* @return int
* @throws Throwable
*/
public function run(InputInterface $input = null, OutputInterface $output = null): int
public function run(?InputInterface $input = null, ?OutputInterface $output = null): int
{
if (null === $input) {
$argv = $_SERVER['argv'] ?? [];

View File

@ -173,7 +173,7 @@ class InstallCommand extends GravCommand
* @param string|null $type
* @return int
*/
private function symlink(string $name = null, string $type = null): int
private function symlink(?string $name = null, ?string $type = null): int
{
$io = $this->getIO();

View File

@ -86,7 +86,7 @@ trait ConsoleTrait
* @return $this
* @throws InvalidArgumentException If option mode is invalid or incompatible
*/
public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
public function addOption(string $name, array|string|null $shortcut = null, ?int $mode = null, string $description = '', mixed $default = null): static
{
if ($name !== 'env' && $name !== 'lang') {
parent::addOption($name, $shortcut, $mode, $description, $default);
@ -140,7 +140,7 @@ trait ConsoleTrait
* @param string|null $code
* @return $this
*/
final protected function setLanguage(string $code = null)
final protected function setLanguage(?string $code = null)
{
$this->initializeGrav();

View File

@ -573,7 +573,7 @@ class InstallCommand extends GpmCommand
* @param string|null $license
* @return string|null
*/
private function downloadPackage(Package $package, string $license = null)
private function downloadPackage(Package $package, ?string $license = null)
{
$io = $this->getIO();

View File

@ -45,7 +45,7 @@ class Access implements JsonSerializable, IteratorAggregate, Countable
* @param array|null $rules
* @param string $name
*/
public function __construct($acl = null, array $rules = null, string $name = '')
public function __construct($acl = null, ?array $rules = null, string $name = '')
{
$this->name = $name;
$this->rules = $rules ?? [];
@ -70,7 +70,7 @@ class Access implements JsonSerializable, IteratorAggregate, Countable
* @param string|null $name
* @return void
*/
public function inherit(Access $parent, string $name = null)
public function inherit(Access $parent, ?string $name = null)
{
// Remove cached null actions from acl.
$acl = $this->getAllActions();
@ -88,7 +88,7 @@ class Access implements JsonSerializable, IteratorAggregate, Countable
* @param string|null $scope
* @return bool|null
*/
public function authorize(string $action, string $scope = null): ?bool
public function authorize(string $action, ?string $scope = null): ?bool
{
if (null !== $scope) {
$action = $scope !== 'test' ? "{$scope}.{$action}" : $action;

View File

@ -156,7 +156,7 @@ class Permissions implements ArrayAccess, Countable, IteratorAggregate
* @param array|null $access
* @return Access
*/
public function getAccess(array $access = null): Access
public function getAccess(?array $access = null): Access
{
return new Access($access ?? []);
}

View File

@ -551,14 +551,14 @@ abstract class AbstractIndexCollection implements CollectionInterface
* @return array
* @phpstan-return array<TKey,T>
*/
abstract protected function loadElements(array $entries = null): array;
abstract protected function loadElements(?array $entries = null): array;
/**
* @param array|null $entries
* @return CollectionInterface
* @phpstan-return C
*/
abstract protected function loadCollection(array $entries = null): CollectionInterface;
abstract protected function loadCollection(?array $entries = null): CollectionInterface;
/**
* @param mixed $value

View File

@ -66,7 +66,7 @@ class FileCollection extends AbstractFileCollection
* @param callable|null $filterFunction
* @return $this
*/
public function setFilter(callable $filterFunction = null)
public function setFilter(?callable $filterFunction = null)
{
$this->filterFunction = $filterFunction;
@ -88,7 +88,7 @@ class FileCollection extends AbstractFileCollection
* @param callable|null $objectFunction
* @return $this
*/
public function setObjectBuilder(callable $objectFunction = null)
public function setObjectBuilder(?callable $objectFunction = null)
{
$this->createObjectFunction = $objectFunction ?: [$this, 'createObject'];

View File

@ -53,7 +53,7 @@ interface RelationshipInterface extends Countable, IteratorAggregate, JsonSerial
* @return bool
* @phpstan-pure
*/
public function has(string $id, string $type = null): bool;
public function has(string $id, ?string $type = null): bool;
/**
* @param T $identifier
@ -72,7 +72,7 @@ interface RelationshipInterface extends Countable, IteratorAggregate, JsonSerial
* @param T|null $identifier
* @return bool
*/
public function removeIdentifier(IdentifierInterface $identifier = null): bool;
public function removeIdentifier(?IdentifierInterface $identifier = null): bool;
/**
* @return iterable<T>

View File

@ -25,7 +25,7 @@ interface ToManyRelationshipInterface extends RelationshipInterface
* @return T|null
* @phpstan-pure
*/
public function getIdentifier(string $id, string $type = null): ?IdentifierInterface;
public function getIdentifier(string $id, ?string $type = null): ?IdentifierInterface;
/**
* @param string $id
@ -33,7 +33,7 @@ interface ToManyRelationshipInterface extends RelationshipInterface
* @return T|null
* @phpstan-pure
*/
public function getObject(string $id, string $type = null): ?object;
public function getObject(string $id, ?string $type = null): ?object;
/**
* @param iterable<T> $identifiers

View File

@ -19,7 +19,7 @@ interface ToOneRelationshipInterface extends RelationshipInterface
* @return T|null
* @phpstan-pure
*/
public function getIdentifier(string $id = null, string $type = null): ?IdentifierInterface;
public function getIdentifier(?string $id = null, ?string $type = null): ?IdentifierInterface;
/**
* @param string|null $id
@ -27,11 +27,11 @@ interface ToOneRelationshipInterface extends RelationshipInterface
* @return T|null
* @phpstan-pure
*/
public function getObject(string $id = null, string $type = null): ?object;
public function getObject(?string $id = null, ?string $type = null): ?object;
/**
* @param T|null $identifier
* @return bool
*/
public function replaceIdentifier(IdentifierInterface $identifier = null): bool;
public function replaceIdentifier(?IdentifierInterface $identifier = null): bool;
}

View File

@ -49,7 +49,7 @@ trait ControllerResponseTrait
* @param array|null $headers
* @return Response
*/
protected function createHtmlResponse(string $content, int $code = null, array $headers = null): ResponseInterface
protected function createHtmlResponse(string $content, ?int $code = null, ?array $headers = null): ResponseInterface
{
$code = $code ?? 200;
if ($code < 100 || $code > 599) {
@ -66,7 +66,7 @@ trait ControllerResponseTrait
* @param array|null $headers
* @return Response
*/
protected function createJsonResponse(array $content, int $code = null, array $headers = null): ResponseInterface
protected function createJsonResponse(array $content, ?int $code = null, ?array $headers = null): ResponseInterface
{
$code = $code ?? $content['code'] ?? 200;
if (null === $code || $code < 100 || $code > 599) {
@ -87,7 +87,7 @@ trait ControllerResponseTrait
* @param array|null $options
* @return ResponseInterface
*/
protected function createDownloadResponse(string $filename, $resource, array $headers = null, array $options = null): ResponseInterface
protected function createDownloadResponse(string $filename, $resource, ?array $headers = null, ?array $options = null): ResponseInterface
{
// Required for IE, otherwise Content-Disposition may be ignored
if (ini_get('zlib.output_compression')) {
@ -134,7 +134,7 @@ trait ControllerResponseTrait
* @param int|null $code
* @return Response
*/
protected function createRedirectResponse(string $url, int $code = null): ResponseInterface
protected function createRedirectResponse(string $url, ?int $code = null): ResponseInterface
{
if (null === $code || $code < 301 || $code > 307) {
$code = (int)$this->getConfig()->get('system.pages.redirect_default_code', 302);

View File

@ -46,7 +46,7 @@ class AbstractFile implements FileInterface
* @param string $filepath
* @param Filesystem|null $filesystem
*/
public function __construct(string $filepath, Filesystem $filesystem = null)
public function __construct(string $filepath, ?Filesystem $filesystem = null)
{
$this->filesystem = $filesystem ?? Filesystem::getInstance();
$this->setFilepath($filepath);

View File

@ -106,7 +106,7 @@ abstract class AbstractFormatter implements FileFormatterInterface
* @param string|null $name Configuration option (optional)
* @return mixed
*/
protected function getConfig(string $name = null)
protected function getConfig(?string $name = null)
{
if (null !== $name) {
return $this->config[$name] ?? null;

View File

@ -23,7 +23,7 @@ class MarkdownFormatter extends AbstractFormatter
/** @var FileFormatterInterface */
private $headerFormatter;
public function __construct(array $config = [], FileFormatterInterface $headerFormatter = null)
public function __construct(array $config = [], ?FileFormatterInterface $headerFormatter = null)
{
$config += [
'file_extension' => '.md',

View File

@ -40,7 +40,7 @@ class Filesystem implements FilesystemInterface
* @param bool|null $normalize See $this->setNormalization()
* @return Filesystem
*/
public static function getInstance(bool $normalize = null): Filesystem
public static function getInstance(?bool $normalize = null): Filesystem
{
if ($normalize === true) {
$instance = &static::$safe;
@ -63,7 +63,7 @@ class Filesystem implements FilesystemInterface
* @param bool|null $normalize
* @internal
*/
protected function __construct(bool $normalize = null)
protected function __construct(?bool $normalize = null)
{
$this->normalize = $normalize;
}
@ -78,7 +78,7 @@ class Filesystem implements FilesystemInterface
* @param bool|null $normalize
* @return Filesystem
*/
public function setNormalization(bool $normalize = null): self
public function setNormalization(?bool $normalize = null): self
{
return static::getInstance($normalize);
}

View File

@ -94,7 +94,7 @@ class Flex implements FlexInterface
* @param bool $keepMissing
* @return array<FlexDirectory|null>
*/
public function getDirectories(array $types = null, bool $keepMissing = false): array
public function getDirectories(?array $types = null, bool $keepMissing = false): array
{
if ($types === null) {
return $this->types;
@ -125,7 +125,7 @@ class Flex implements FlexInterface
* @return FlexCollectionInterface|null
* @phpstan-return FlexCollectionInterface<FlexObjectInterface>|null
*/
public function getCollection(string $type, array $keys = null, string $keyField = null): ?FlexCollectionInterface
public function getCollection(string $type, ?array $keys = null, ?string $keyField = null): ?FlexCollectionInterface
{
$directory = $type ? $this->getDirectory($type) : null;
@ -271,7 +271,7 @@ class Flex implements FlexInterface
* @param string|null $keyField
* @return FlexObjectInterface|null
*/
public function getObject(string $key, string $type = null, string $keyField = null): ?FlexObjectInterface
public function getObject(string $key, ?string $type = null, ?string $keyField = null): ?FlexObjectInterface
{
if (null === $type && null === $keyField) {
// Special handling for quick Flex key lookups.
@ -303,7 +303,7 @@ class Flex implements FlexInterface
* @param string|null $type
* @return array
*/
protected function resolveKeyAndType(string $flexKey, string $type = null): array
protected function resolveKeyAndType(string $flexKey, ?string $type = null): array
{
$guess = false;
if (strpos($flexKey, ':') !== false) {
@ -323,7 +323,7 @@ class Flex implements FlexInterface
* @param string|null $type
* @return string
*/
protected function resolveType(string $type = null): string
protected function resolveType(?string $type = null): string
{
if (null !== $type && strpos($type, '.') !== false) {
return preg_replace('|\.obj$|', '', $type) ?? $type;

View File

@ -84,7 +84,7 @@ class FlexCollection extends ObjectCollection implements FlexCollectionInterface
* {@inheritdoc}
* @see FlexCollectionInterface::createFromArray()
*/
public static function createFromArray(array $entries, FlexDirectory $directory, string $keyField = null)
public static function createFromArray(array $entries, FlexDirectory $directory, ?string $keyField = null)
{
$instance = new static($entries, $directory);
$instance->setKeyField($keyField);
@ -96,7 +96,7 @@ class FlexCollection extends ObjectCollection implements FlexCollectionInterface
* {@inheritdoc}
* @see FlexCollectionInterface::__construct()
*/
public function __construct(array $entries = [], FlexDirectory $directory = null)
public function __construct(array $entries = [], ?FlexDirectory $directory = null)
{
// @phpstan-ignore-next-line
if (get_class($this) === __CLASS__) {
@ -145,7 +145,7 @@ class FlexCollection extends ObjectCollection implements FlexCollectionInterface
* {@inheritdoc}
* @see FlexCollectionInterface::search()
*/
public function search(string $search, $properties = null, array $options = null)
public function search(string $search, $properties = null, ?array $options = null)
{
$directory = $this->getFlexDirectory();
$properties = $directory->getSearchProperties($properties);
@ -298,7 +298,7 @@ class FlexCollection extends ObjectCollection implements FlexCollectionInterface
* @param string|null $separator Separator, defaults to '.'
* @return array
*/
public function getDistinctValues(string $property, string $separator = null): array
public function getDistinctValues(string $property, ?string $separator = null): array
{
$list = [];
@ -320,7 +320,7 @@ class FlexCollection extends ObjectCollection implements FlexCollectionInterface
* {@inheritdoc}
* @see FlexCollectionInterface::withKeyField()
*/
public function withKeyField(string $keyField = null)
public function withKeyField(?string $keyField = null)
{
$keyField = $keyField ?: 'key';
if ($keyField === $this->getKeyField()) {
@ -366,7 +366,7 @@ class FlexCollection extends ObjectCollection implements FlexCollectionInterface
* {@inheritdoc}
* @see FlexCollectionInterface::render()
*/
public function render(string $layout = null, array $context = [])
public function render(?string $layout = null, array $context = [])
{
if (!$layout) {
$config = $this->getTemplateConfig();
@ -485,7 +485,7 @@ class FlexCollection extends ObjectCollection implements FlexCollectionInterface
* @param string|null $namespace
* @return CacheInterface
*/
public function getCache(string $namespace = null)
public function getCache(?string $namespace = null)
{
return $this->_flexDirectory->getCache($namespace);
}
@ -505,7 +505,7 @@ class FlexCollection extends ObjectCollection implements FlexCollectionInterface
* @return static
* @phpstan-return static<T>
*/
public function isAuthorized(string $action, string $scope = null, UserInterface $user = null)
public function isAuthorized(string $action, ?string $scope = null, ?UserInterface $user = null)
{
$list = $this->call('isAuthorized', [$action, $scope, $user]);
$list = array_filter($list);

View File

@ -34,6 +34,7 @@ use Psr\SimpleCache\InvalidArgumentException;
use RocketTheme\Toolbox\File\YamlFile;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
use RuntimeException;
use Symfony\Component\Cache\Psr16Cache;
use function call_user_func_array;
use function count;
use function is_array;
@ -155,7 +156,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @param mixed $default
* @return mixed
*/
public function getConfig(string $name = null, $default = null)
public function getConfig(?string $name = null, $default = null)
{
if (null === $this->config) {
$config = $this->getBlueprintInternal()->get('config', []);
@ -197,7 +198,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @param array|null $options
* @return array
*/
public function getSearchOptions(array $options = null): array
public function getSearchOptions(?array $options = null): array
{
if (empty($options['merge'])) {
return $options ?? (array)$this->getConfig('data.search.options');
@ -214,7 +215,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @return FlexFormInterface
* @internal
*/
public function getDirectoryForm(string $name = null, array $options = [])
public function getDirectoryForm(?string $name = null, array $options = [])
{
$name = $name ?: $this->getConfig('admin.views.configure.form', '') ?: $this->getConfig('admin.configure.form', '');
@ -311,7 +312,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @param string|null $name
* @return string
*/
public function getDirectoryConfigUri(string $name = null): string
public function getDirectoryConfigUri(?string $name = null): string
{
$name = $name ?: $this->getFlexType();
$blueprint = $this->getBlueprint();
@ -323,7 +324,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @param string|null $name
* @return array
*/
protected function getDirectoryConfig(string $name = null): array
protected function getDirectoryConfig(?string $name = null): array
{
$grav = Grav::instance();
@ -372,7 +373,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @return FlexCollectionInterface
* @phpstan-return FlexCollectionInterface<FlexObjectInterface>
*/
public function getCollection(array $keys = null, string $keyField = null): FlexCollectionInterface
public function getCollection(?array $keys = null, ?string $keyField = null): FlexCollectionInterface
{
// Get all selected entries.
$index = $this->getIndex($keys, $keyField);
@ -399,7 +400,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @return FlexIndexInterface
* @phpstan-return FlexIndexInterface<FlexObjectInterface>
*/
public function getIndex(array $keys = null, string $keyField = null): FlexIndexInterface
public function getIndex(?array $keys = null, ?string $keyField = null): FlexIndexInterface
{
$keyField = $keyField ?? '';
$index = $this->indexes[$keyField] ?? $this->loadIndex($keyField);
@ -422,7 +423,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @param string|null $keyField Field to be used as the key.
* @return FlexObjectInterface|null
*/
public function getObject($key = null, string $keyField = null): ?FlexObjectInterface
public function getObject($key = null, ?string $keyField = null): ?FlexObjectInterface
{
if (null === $key) {
return $this->createObject([], '');
@ -438,7 +439,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @param string|null $namespace
* @return CacheInterface
*/
public function getCache(string $namespace = null)
public function getCache(?string $namespace = null)
{
$namespace = $namespace ?: 'index';
$cache = $this->cache[$namespace] ?? null;
@ -452,6 +453,7 @@ class FlexDirectory implements FlexDirectoryInterface
$config = $this->getConfig('object.cache.' . $namespace);
if (empty($config['enabled'])) {
$cache = new MemoryCache('flex-objects-' . $this->getFlexType());
$cache->setValidation(false);
} else {
$lifetime = $config['lifetime'] ?? 60;
@ -459,7 +461,8 @@ class FlexDirectory implements FlexDirectoryInterface
if (Utils::isAdminPlugin()) {
$key = substr($key, 0, -1);
}
$cache = new DoctrineCache($gravCache->getCacheDriver(), 'flex-objects-' . $this->getFlexType() . $key, $lifetime);
$cache = new Psr16Cache($gravCache->getCacheAdapter('flex-objects-' . $this->getFlexType() . $key, $lifetime));
}
} catch (Exception $e) {
/** @var Debugger $debugger */
@ -467,10 +470,9 @@ class FlexDirectory implements FlexDirectoryInterface
$debugger->addException($e);
$cache = new MemoryCache('flex-objects-' . $this->getFlexType());
$cache->setValidation(false);
}
// Disable cache key validation.
$cache->setValidation(false);
$this->cache[$namespace] = $cache;
}
@ -506,7 +508,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @param string|null $key
* @return string|null
*/
public function getStorageFolder(string $key = null): ?string
public function getStorageFolder(?string $key = null): ?string
{
return $this->getStorage()->getStoragePath($key);
}
@ -515,7 +517,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @param string|null $key
* @return string|null
*/
public function getMediaFolder(string $key = null): ?string
public function getMediaFolder(?string $key = null): ?string
{
return $this->getStorage()->getMediaPath($key);
}
@ -555,7 +557,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @return FlexCollectionInterface
* @phpstan-return FlexCollectionInterface<FlexObjectInterface>
*/
public function createCollection(array $entries, string $keyField = null): FlexCollectionInterface
public function createCollection(array $entries, ?string $keyField = null): FlexCollectionInterface
{
/** phpstan-var class-string $className */
$className = $this->collectionClassName ?: $this->getCollectionClass();
@ -572,7 +574,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @return FlexIndexInterface
* @phpstan-return FlexIndexInterface<FlexObjectInterface>
*/
public function createIndex(array $entries, string $keyField = null): FlexIndexInterface
public function createIndex(array $entries, ?string $keyField = null): FlexIndexInterface
{
/** @phpstan-var class-string $className */
$className = $this->indexClassName ?: $this->getIndexClass();
@ -626,7 +628,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @return FlexCollectionInterface
* @phpstan-return FlexCollectionInterface<FlexObjectInterface>
*/
public function loadCollection(array $entries, string $keyField = null): FlexCollectionInterface
public function loadCollection(array $entries, ?string $keyField = null): FlexCollectionInterface
{
return $this->createCollection($this->loadObjects($entries), $keyField);
}
@ -1120,7 +1122,7 @@ class FlexDirectory implements FlexDirectoryInterface
* @return FlexObjectInterface
* @deprecated 1.7 Use $object->update()->save() instead.
*/
public function update(array $data, string $key = null): FlexObjectInterface
public function update(array $data, ?string $key = null): FlexObjectInterface
{
user_error(__CLASS__ . '::' . __FUNCTION__ . '() should not be used anymore: use $object->update()->save() instead.', E_USER_DEPRECATED);

View File

@ -83,7 +83,7 @@ class FlexDirectoryForm implements FlexDirectoryFormInterface, JsonSerializable
* @param FlexDirectory $directory
* @param array|null $options
*/
public function __construct(string $name, FlexDirectory $directory, array $options = null)
public function __construct(string $name, FlexDirectory $directory, ?array $options = null)
{
$this->name = $name;
$this->setDirectory($directory);
@ -350,7 +350,7 @@ class FlexDirectoryForm implements FlexDirectoryFormInterface, JsonSerializable
* @param string|null $extension
* @return string
*/
public function getMediaTaskRoute(array $params = [], string $extension = null): string
public function getMediaTaskRoute(array $params = [], ?string $extension = null): string
{
return '';
}

View File

@ -100,7 +100,7 @@ class FlexForm implements FlexObjectFormInterface, JsonSerializable
* @param FlexObjectInterface $object
* @param array|null $options
*/
public function __construct(string $name, FlexObjectInterface $object, array $options = null)
public function __construct(string $name, FlexObjectInterface $object, ?array $options = null)
{
$this->name = $name;
$this->setObject($object);
@ -428,7 +428,7 @@ class FlexForm implements FlexObjectFormInterface, JsonSerializable
* @param string|null $extension
* @return string
*/
public function getMediaTaskRoute(array $params = [], string $extension = null): string
public function getMediaTaskRoute(array $params = [], ?string $extension = null): string
{
$grav = Grav::instance();
/** @var Flex $flex */

View File

@ -9,6 +9,7 @@
namespace Grav\Framework\Flex;
use Closure;
use Exception;
use Grav\Common\Debugger;
use Grav\Common\File\CompiledJsonFile;
@ -65,7 +66,7 @@ class FlexIndex extends ObjectIndex implements FlexIndexInterface
* {@inheritdoc}
* @see FlexCollectionInterface::createFromArray()
*/
public static function createFromArray(array $entries, FlexDirectory $directory, string $keyField = null)
public static function createFromArray(array $entries, FlexDirectory $directory, ?string $keyField = null)
{
$instance = new static($entries, $directory);
$instance->setKeyField($keyField);
@ -105,7 +106,7 @@ class FlexIndex extends ObjectIndex implements FlexIndexInterface
* @param array $entries
* @param FlexDirectory|null $directory
*/
public function __construct(array $entries = [], FlexDirectory $directory = null)
public function __construct(array $entries = [], ?FlexDirectory $directory = null)
{
// @phpstan-ignore-next-line
if (get_class($this) === __CLASS__) {
@ -160,7 +161,7 @@ class FlexIndex extends ObjectIndex implements FlexIndexInterface
* {@inheritdoc}
* @see FlexCollectionInterface::search()
*/
public function search(string $search, $properties = null, array $options = null)
public function search(string $search, $properties = null, ?array $options = null)
{
$directory = $this->getFlexDirectory();
$properties = $directory->getSearchProperties($properties);
@ -282,7 +283,7 @@ class FlexIndex extends ObjectIndex implements FlexIndexInterface
* {@inheritdoc}
* @see FlexIndexInterface::withKeyField()
*/
public function withKeyField(string $keyField = null)
public function withKeyField(?string $keyField = null)
{
$keyField = $keyField ?: 'key';
if ($keyField === $this->getKeyField()) {
@ -328,7 +329,7 @@ class FlexIndex extends ObjectIndex implements FlexIndexInterface
* {@inheritdoc}
* @see FlexCollectionInterface::render()
*/
public function render(string $layout = null, array $context = [])
public function render(?string $layout = null, array $context = [])
{
return $this->__call('render', [$layout, $context]);
}
@ -337,7 +338,7 @@ class FlexIndex extends ObjectIndex implements FlexIndexInterface
* {@inheritdoc}
* @see FlexIndexInterface::getFlexKeys()
*/
public function getIndexMap(string $indexKey = null)
public function getIndexMap(?string $indexKey = null)
{
if (null === $indexKey) {
return $this->getEntries();
@ -373,7 +374,7 @@ class FlexIndex extends ObjectIndex implements FlexIndexInterface
* @param string|null $namespace
* @return CacheInterface
*/
public function getCache(string $namespace = null)
public function getCache(?string $namespace = null)
{
return $this->getFlexDirectory()->getCache($namespace);
}
@ -557,7 +558,7 @@ class FlexIndex extends ObjectIndex implements FlexIndexInterface
* @return static
* @phpstan-return static<T,C>
*/
protected function createFrom(array $entries, string $keyField = null)
protected function createFrom(array $entries, ?string $keyField = null)
{
/** @phpstan-var static<T,C> $index */
$index = new static($entries, $this->getFlexDirectory());
@ -570,7 +571,7 @@ class FlexIndex extends ObjectIndex implements FlexIndexInterface
* @param string|null $keyField
* @return void
*/
protected function setKeyField(string $keyField = null)
protected function setKeyField(?string $keyField = null)
{
$this->_keyField = $keyField ?? 'storage_key';
}
@ -641,7 +642,7 @@ class FlexIndex extends ObjectIndex implements FlexIndexInterface
* @return ObjectInterface[]
* @phpstan-return T[]
*/
protected function loadElements(array $entries = null): array
protected function loadElements(?array $entries = null): array
{
/** @phpstan-var T[] $objects */
$objects = $this->getFlexDirectory()->loadObjects($entries ?? $this->getEntries());
@ -654,7 +655,7 @@ class FlexIndex extends ObjectIndex implements FlexIndexInterface
* @return CollectionInterface
* @phpstan-return C
*/
protected function loadCollection(array $entries = null): CollectionInterface
protected function loadCollection(?array $entries = null): CollectionInterface
{
/** @var C $collection */
$collection = $this->getFlexDirectory()->loadCollection($entries ?? $this->getEntries(), $this->_keyField);
@ -880,7 +881,7 @@ class FlexIndex extends ObjectIndex implements FlexIndexInterface
/** @var Logger $logger */
$logger = $grav['log'];
$logger->addAlert($e->getMessage());
$logger->alert($e->getMessage());
/** @var Debugger $debugger */
$debugger = $grav['debugger'];
@ -927,4 +928,15 @@ class FlexIndex extends ObjectIndex implements FlexIndexInterface
return $type . $this->getFlexType();
}
public function findFirst(Closure $p)
{
// TODO: Implement findFirst() method.
}
public function reduce(Closure $func, mixed $initial = null)
{
// TODO: Implement reduce() method.
}
}

View File

@ -285,7 +285,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
* {@inheritdoc}
* @see FlexObjectInterface::search()
*/
public function search(string $search, $properties = null, array $options = null): float
public function search(string $search, $properties = null, ?array $options = null): float
{
$directory = $this->getFlexDirectory();
$properties = $directory->getSearchProperties($properties);
@ -362,7 +362,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
* @param array|null $options
* @return float
*/
public function searchProperty(string $property, string $search, array $options = null): float
public function searchProperty(string $property, string $search, ?array $options = null): float
{
$options = $options ?? (array)$this->getFlexDirectory()->getConfig('data.search.options');
$value = $this->getProperty($property);
@ -376,7 +376,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
* @param array|null $options
* @return float
*/
public function searchNestedProperty(string $property, string $search, array $options = null): float
public function searchNestedProperty(string $property, string $search, ?array $options = null): float
{
$options = $options ?? (array)$this->getFlexDirectory()->getConfig('data.search.options');
if ($property === 'key') {
@ -395,7 +395,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
* @param array|null $options
* @return float
*/
protected function searchValue(string $name, $value, string $search, array $options = null): float
protected function searchValue(string $name, $value, string $search, ?array $options = null): float
{
$options = $options ?? [];
@ -515,7 +515,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
* @param string|null $namespace
* @return CacheInterface
*/
public function getCache(string $namespace = null)
public function getCache(?string $namespace = null)
{
return $this->_flexDirectory->getCache($namespace);
}
@ -546,7 +546,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
* {@inheritdoc}
* @see FlexObjectInterface::render()
*/
public function render(string $layout = null, array $context = [])
public function render(?string $layout = null, array $context = [])
{
if (!$layout) {
$config = $this->getTemplateConfig();
@ -714,7 +714,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
* {@inheritdoc}
* @see FlexObjectInterface::create()
*/
public function create(string $key = null)
public function create(?string $key = null)
{
if ($key) {
$this->setStorageKey($key);
@ -731,7 +731,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
* @param string|null $key
* @return FlexObject|FlexObjectInterface
*/
public function createCopy(string $key = null)
public function createCopy(?string $key = null)
{
$this->markAsCopy();
@ -741,7 +741,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
/**
* @param UserInterface|null $user
*/
public function check(UserInterface $user = null): void
public function check(?UserInterface $user = null): void
{
// If user has been provided, check if the user has permissions to save this object.
if ($user && !$this->isAuthorized('save', null, $user)) {
@ -865,7 +865,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
* {@inheritdoc}
* @see FlexObjectInterface::getForm()
*/
public function getForm(string $name = '', array $options = null)
public function getForm(string $name = '', ?array $options = null)
{
$hash = $name . '-' . md5(json_encode($options, JSON_THROW_ON_ERROR));
if (!isset($this->_forms[$hash])) {
@ -879,7 +879,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
* {@inheritdoc}
* @see FlexObjectInterface::getDefaultValue()
*/
public function getDefaultValue(string $name, string $separator = null)
public function getDefaultValue(string $name, ?string $separator = null)
{
$separator = $separator ?: '.';
$path = explode($separator, $name);
@ -920,7 +920,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
* {@inheritdoc}
* @see FlexObjectInterface::getFormValue()
*/
public function getFormValue(string $name, $default = null, string $separator = null)
public function getFormValue(string $name, $default = null, ?string $separator = null)
{
if ($name === 'storage_key') {
return $this->getStorageKey();
@ -1018,7 +1018,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
* @param FlexDirectory|null $directory
* @return void
*/
protected function doUnserialize(array $serialized, FlexDirectory $directory = null): void
protected function doUnserialize(array $serialized, ?FlexDirectory $directory = null): void
{
$type = $serialized['type'] ?? 'unknown';
@ -1106,7 +1106,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
* @param array|null $options Form optiosn
* @return FlexFormInterface
*/
protected function createFormObject(string $name, array $options = null)
protected function createFormObject(string $name, ?array $options = null)
{
return new FlexForm($name, $this, $options);
}

View File

@ -29,5 +29,5 @@ interface FlexAuthorizeInterface
* @param UserInterface|null $user
* @return bool|null
*/
public function isAuthorized(string $action, string $scope = null, UserInterface $user = null): ?bool;
public function isAuthorized(string $action, ?string $scope = null, ?UserInterface $user = null): ?bool;
}

View File

@ -37,7 +37,7 @@ interface FlexCollectionInterface extends FlexCommonInterface, ObjectCollectionI
* @param string|null $keyField Key field used to index the collection.
* @return static Returns a new Flex Collection.
*/
public static function createFromArray(array $entries, FlexDirectory $directory, string $keyField = null);
public static function createFromArray(array $entries, FlexDirectory $directory, ?string $keyField = null);
/**
* Creates a new Flex Collection.
@ -48,7 +48,7 @@ interface FlexCollectionInterface extends FlexCommonInterface, ObjectCollectionI
* @param FlexDirectory|null $directory Flex Directory where all the objects belong into.
* @throws InvalidArgumentException
*/
public function __construct(array $entries = [], FlexDirectory $directory = null);
public function __construct(array $entries = [], ?FlexDirectory $directory = null);
/**
* Search a string from the collection.
@ -60,7 +60,7 @@ interface FlexCollectionInterface extends FlexCommonInterface, ObjectCollectionI
* @phpstan-return static<T>
* @api
*/
public function search(string $search, $properties = null, array $options = null);
public function search(string $search, $properties = null, ?array $options = null);
/**
* Sort the collection.
@ -116,7 +116,7 @@ interface FlexCollectionInterface extends FlexCommonInterface, ObjectCollectionI
* @phpstan-return static<T>
* @api
*/
public function withKeyField(string $keyField = null);
public function withKeyField(?string $keyField = null);
/**
* Get Flex Index from the Flex Collection.

View File

@ -49,7 +49,7 @@ interface FlexDirectoryInterface extends FlexAuthorizeInterface
* @param mixed $default
* @return mixed
*/
public function getConfig(string $name = null, $default = null);
public function getConfig(?string $name = null, $default = null);
/**
* @param string|null $name
@ -57,7 +57,7 @@ interface FlexDirectoryInterface extends FlexAuthorizeInterface
* @return FlexFormInterface
* @internal
*/
public function getDirectoryForm(string $name = null, array $options = []);
public function getDirectoryForm(?string $name = null, array $options = []);
/**
* @return Blueprint
@ -78,7 +78,7 @@ interface FlexDirectoryInterface extends FlexAuthorizeInterface
* @param string|null $name
* @return string
*/
public function getDirectoryConfigUri(string $name = null): string;
public function getDirectoryConfigUri(?string $name = null): string;
/**
* Returns a new uninitialized instance of blueprint.
@ -107,7 +107,7 @@ interface FlexDirectoryInterface extends FlexAuthorizeInterface
* @return FlexCollectionInterface
* @phpstan-return FlexCollectionInterface<FlexObjectInterface>
*/
public function getCollection(array $keys = null, string $keyField = null): FlexCollectionInterface;
public function getCollection(?array $keys = null, ?string $keyField = null): FlexCollectionInterface;
/**
* Get the full collection of all stored objects.
@ -119,7 +119,7 @@ interface FlexDirectoryInterface extends FlexAuthorizeInterface
* @return FlexIndexInterface
* @phpstan-return FlexIndexInterface<FlexObjectInterface>
*/
public function getIndex(array $keys = null, string $keyField = null): FlexIndexInterface;
public function getIndex(?array $keys = null, ?string $keyField = null): FlexIndexInterface;
/**
* Returns an object if it exists. If no arguments are passed (or both of them are null), method creates a new empty object.
@ -130,13 +130,13 @@ interface FlexDirectoryInterface extends FlexAuthorizeInterface
* @param string|null $keyField Field to be used as the key.
* @return FlexObjectInterface|null
*/
public function getObject($key = null, string $keyField = null): ?FlexObjectInterface;
public function getObject($key = null, ?string $keyField = null): ?FlexObjectInterface;
/**
* @param string|null $namespace
* @return CacheInterface
*/
public function getCache(string $namespace = null);
public function getCache(?string $namespace = null);
/**
* @return $this
@ -147,13 +147,13 @@ interface FlexDirectoryInterface extends FlexAuthorizeInterface
* @param string|null $key
* @return string|null
*/
public function getStorageFolder(string $key = null): ?string;
public function getStorageFolder(?string $key = null): ?string;
/**
* @param string|null $key
* @return string|null
*/
public function getMediaFolder(string $key = null): ?string;
public function getMediaFolder(?string $key = null): ?string;
/**
* @return FlexStorageInterface
@ -174,7 +174,7 @@ interface FlexDirectoryInterface extends FlexAuthorizeInterface
* @return FlexCollectionInterface
* @phpstan-return FlexCollectionInterface<FlexObjectInterface>
*/
public function createCollection(array $entries, string $keyField = null): FlexCollectionInterface;
public function createCollection(array $entries, ?string $keyField = null): FlexCollectionInterface;
/**
* @param array $entries
@ -182,7 +182,7 @@ interface FlexDirectoryInterface extends FlexAuthorizeInterface
* @return FlexIndexInterface
* @phpstan-return FlexIndexInterface<FlexObjectInterface>
*/
public function createIndex(array $entries, string $keyField = null): FlexIndexInterface;
public function createIndex(array $entries, ?string $keyField = null): FlexIndexInterface;
/**
* @return string
@ -205,7 +205,7 @@ interface FlexDirectoryInterface extends FlexAuthorizeInterface
* @return FlexCollectionInterface
* @phpstan-return FlexCollectionInterface<FlexObjectInterface>
*/
public function loadCollection(array $entries, string $keyField = null): FlexCollectionInterface;
public function loadCollection(array $entries, ?string $keyField = null): FlexCollectionInterface;
/**
* @param array $entries

View File

@ -54,11 +54,11 @@ interface FlexIndexInterface extends FlexCollectionInterface
* @phpstan-return static<T>
* @api
*/
public function withKeyField(string $keyField = null);
public function withKeyField(?string $keyField = null);
/**
* @param string|null $indexKey
* @return array
*/
public function getIndexMap(string $indexKey = null);
public function getIndexMap(?string $indexKey = null);
}

View File

@ -46,7 +46,7 @@ interface FlexInterface extends Countable
* @param bool $keepMissing
* @return array<FlexDirectory|null>
*/
public function getDirectories(array $types = null, bool $keepMissing = false): array;
public function getDirectories(?array $types = null, bool $keepMissing = false): array;
/**
* @param string $type
@ -61,7 +61,7 @@ interface FlexInterface extends Countable
* @return FlexCollectionInterface|null
* @phpstan-return FlexCollectionInterface<FlexObjectInterface>|null
*/
public function getCollection(string $type, array $keys = null, string $keyField = null): ?FlexCollectionInterface;
public function getCollection(string $type, ?array $keys = null, ?string $keyField = null): ?FlexCollectionInterface;
/**
* @param array $keys
@ -91,7 +91,7 @@ interface FlexInterface extends Countable
* @param string|null $keyField
* @return FlexObjectInterface|null
*/
public function getObject(string $key, string $type = null, string $keyField = null): ?FlexObjectInterface;
public function getObject(string $key, ?string $type = null, ?string $keyField = null): ?FlexObjectInterface;
/**
* @return int

View File

@ -55,7 +55,7 @@ interface FlexObjectInterface extends FlexCommonInterface, NestedObjectInterface
* @return float Returns a weight between 0 and 1.
* @api
*/
public function search(string $search, $properties = null, array $options = null): float;
public function search(string $search, $properties = null, ?array $options = null): float;
/**
* Returns true if object has a key.
@ -136,7 +136,7 @@ interface FlexObjectInterface extends FlexCommonInterface, NestedObjectInterface
* @throws RuntimeException if object already exists.
* @api
*/
public function create(string $key = null);
public function create(?string $key = null);
/**
* Save object into the storage.
@ -175,7 +175,7 @@ interface FlexObjectInterface extends FlexCommonInterface, NestedObjectInterface
* @return FlexFormInterface Returns a Form.
* @api
*/
public function getForm(string $name = '', array $options = null);
public function getForm(string $name = '', ?array $options = null);
/**
* Returns default value suitable to be used in a form for the given property.
@ -186,7 +186,7 @@ interface FlexObjectInterface extends FlexCommonInterface, NestedObjectInterface
* @param string|null $separator Optional nested property separator.
* @return mixed|null Returns default value of the field, null if there is no default value.
*/
public function getDefaultValue(string $name, string $separator = null);
public function getDefaultValue(string $name, ?string $separator = null);
/**
* Returns default values suitable to be used in a form for the given property.
@ -207,5 +207,5 @@ interface FlexObjectInterface extends FlexCommonInterface, NestedObjectInterface
* @param string|null $separator Optional nested property separator.
* @return mixed Returns value of the field.
*/
public function getFormValue(string $name, $default = null, string $separator = null);
public function getFormValue(string $name, $default = null, ?string $separator = null);
}

View File

@ -78,7 +78,7 @@ interface FlexStorageInterface
* @param array|null $fetched Optional reference to store only fetched items.
* @return array Returns rows. Note that non-existing rows will have `null` as their value.
*/
public function readRows(array $rows, array &$fetched = null): array;
public function readRows(array $rows, ?array &$fetched = null): array;
/**
* Update existing rows in the storage.
@ -126,7 +126,7 @@ interface FlexStorageInterface
* @param string|null $key Optional storage key.
* @return string|null Path in the filesystem. Can be URI or null if storage is not filesystem based.
*/
public function getStoragePath(string $key = null): ?string;
public function getStoragePath(?string $key = null): ?string;
/**
* Get filesystem path for the collection or object media.
@ -134,5 +134,5 @@ interface FlexStorageInterface
* @param string|null $key Optional storage key.
* @return string|null Path in the filesystem. Can be URI or null if media isn't supported.
*/
public function getMediaPath(string $key = null): ?string;
public function getMediaPath(?string $key = null): ?string;
}

Some files were not shown because too many files have changed in this diff Show More