diff --git a/README.md b/README.md index d4eb109dd..3803c8e51 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,22 @@ [![Build Status](https://github.com/laminas/laminas-view/workflows/Continuous%20Integration/badge.svg)](https://github.com/laminas/laminas-view/actions?query=workflow%3A"Continuous+Integration") +> ## πŸ‡·πŸ‡Ί Русским Π³Ρ€Π°ΠΆΠ΄Π°Π½Π°ΠΌ +> +> ΠœΡ‹, участники Laminas, Ρ€ΠΎΠ΄ΠΈΠ»ΠΈΡΡŒ ΠΈ ΠΆΠΈΠ²Π΅ΠΌ Π² Ρ€Π°Π·Π½Ρ‹Ρ… странах. Π£ ΠΌΠ½ΠΎΠ³ΠΈΡ… ΠΈΠ· нас Π΅ΡΡ‚ΡŒ Π΄Ρ€ΡƒΠ·ΡŒΡ, родствСнники ΠΈ ΠΊΠΎΠ»Π»Π΅Π³ΠΈ ΠΊΠ°ΠΊ Π² России, Ρ‚Π°ΠΊ ΠΈ Π² Π£ΠΊΡ€Π°ΠΈΠ½Π΅. НСкоторыС ΠΈΠ· нас Ρ€ΠΎΠ΄ΠΈΠ»ΠΈΡΡŒ Π² России. НСкоторыС ΠΈΠ· нас ΠΆΠΈΠ²ΡƒΡ‚ Π² России. Π£ Π½Π΅ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Ρ… Π±Π°Π±ΡƒΡˆΠΊΠΈ ΠΈ Π΄Π΅Π΄ΡƒΡˆΠΊΠΈ ΡΡ€Π°ΠΆΠ°Π»ΠΈΡΡŒ с Ρ„Π°ΡˆΠΈΡΡ‚Π°ΠΌΠΈ Π²ΠΎ Π’Ρ‚ΠΎΡ€ΠΎΠΉ ΠΌΠΈΡ€ΠΎΠ²ΠΎΠΉ Π²ΠΎΠΉΠ½Π΅. Π—Π΄Π΅ΡΡŒ Π½ΠΈΠΊΡ‚ΠΎ Π½Π΅ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΈΠ²Π°Π΅Ρ‚ Ρ„Π°ΡˆΠΈΠ·ΠΌ. +> +> Π£ ΠΎΠ΄Π½ΠΎΠ³ΠΎ ΠΈΠ· нас Π΅ΡΡ‚ΡŒ украинская родствСнница, которая спаслась ΠΈΠ· Π΄ΠΎΠΌΠ° вмСстС с сыном. ПоСзд задСрТался ΠΈΠ·-Π·Π° Π±ΠΎΠΌΠ±Π΅ΠΆΠΊΠΈ Π½Π° Π΄ΠΎΡ€ΠΎΠ³Π΅ Π²ΠΏΠ΅Ρ€Π΅Π΄ΠΈ. Π£ нас Π΅ΡΡ‚ΡŒ Π΄Ρ€ΡƒΠ·ΡŒΡ, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ прячутся Π² Π±ΠΎΠΌΠ±ΠΎΡƒΠ±Π΅ΠΆΠΈΡ‰Π°Ρ…. ΠœΡ‹ с Ρ‚Ρ€Π΅Π²ΠΎΠ³ΠΎΠΉ ΠΆΠ΄Π΅ΠΌ вСсточки ΠΎΡ‚ Π½ΠΈΡ… послС Π²ΠΎΠ·Π΄ΡƒΡˆΠ½Ρ‹Ρ… Π½Π°Π»Π΅Ρ‚ΠΎΠ², ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ бСспорядочно наносят ΡƒΠ΄Π°Ρ€Ρ‹ ΠΈ ΠΏΠΎΠΏΠ°Π΄Π°ΡŽΡ‚ ΠΏΠΎ Π±ΠΎΠ»ΡŒΠ½ΠΈΡ†Π°ΠΌ, школам, дСтским садам ΠΈ Π΄ΠΎΠΌΠ°ΠΌ. ΠœΡ‹ Π½Π΅ Π±Π΅Ρ€Π΅ΠΌ это ΠΈΠ· ΠΊΠ°ΠΊΠΈΡ…-Π»ΠΈΠ±ΠΎ БМИ. ΠœΡ‹ наблюдаСм это Π½Π°ΠΏΡ€ΡΠΌΡƒΡŽ. +> +> Π’Ρ‹ довСряСтС Π½Π°ΠΌ достаточно, Ρ‡Ρ‚ΠΎΠ± ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ наши ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΡ‹, ΠΈ ΠΌΡ‹ просим вас Π΄ΠΎΠ²Π΅Ρ€ΠΈΡ‚ΡŒΡΡ Π½Π°ΠΌ вновь. ΠœΡ‹ нуТдаСмся Π² ΠΏΠΎΠΌΠΎΡ‰ΠΈ. Π’Ρ‹Ρ…ΠΎΠ΄ΠΈΡ‚Π΅ ΠΈ протСстуйтС ΠΏΡ€ΠΎΡ‚ΠΈΠ² этой бСсполСзной Π²ΠΎΠΉΠ½Ρ‹. ΠžΡΡ‚Π°Π½ΠΎΠ²ΠΈΡ‚Π΅ ΠΊΡ€ΠΎΠ²ΠΎΠΏΡ€ΠΎΠ»ΠΈΡ‚ΠΈΠ΅. Π‘ΠΊΠ°ΠΆΠΈΡ‚Π΅ "НСт Π²ΠΎΠΉΠ½Π΅!" +> +> ## πŸ‡ΊπŸ‡Έ To Citizens of Russia +> +> We at Laminas come from all over the world. Many of us have friends, family and colleagues in both Russia and Ukraine. Some of us were born in Russia. Some of us currently live in Russia. Some have grandparents who fought Nazis in World War II. Nobody here supports fascism. +> +> One team member has a Ukrainian relative who fled her home with her son. The train was delayed due to bombing on the road ahead. We have friends who are hiding in bomb shelters. We anxiously follow up on them after the air raids, which indiscriminately fire at hospitals, schools, kindergartens and houses. We're not taking this from any media. These are our actual experiences. +> +> You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say "stop the war!" + laminas-view provides the β€œView” layer of the Laminas MVC system. It is a multi-tiered system allowing a variety of mechanisms for extension, substitution, and more. diff --git a/composer.json b/composer.json index 329269f7c..a3acaf609 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "php": "8.1.99" }, "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true + "dealerdirect/phpcodesniffer-composer-installer": true, + "composer/package-versions-deprecated": true } }, "require": { @@ -46,7 +47,6 @@ "laminas/laminas-modulemanager": "^2.14", "laminas/laminas-mvc": "^3.6.1", "laminas/laminas-mvc-i18n": "^1.7", - "laminas/laminas-mvc-plugin-flashmessenger": "^1.9", "laminas/laminas-navigation": "^2.18.1", "laminas/laminas-paginator": "^2.17", "laminas/laminas-permissions-acl": "^2.15", diff --git a/composer.lock b/composer.lock index be7ee73f8..01d04bac4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,37 +4,37 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e06dd7d89c9aea20629a02cddefedab3", + "content-hash": "6f4f1dcd9aabd89a90c6f0ad6d25cc20", "packages": [ { "name": "laminas/laminas-escaper", - "version": "2.13.0", + "version": "2.12.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-escaper.git", - "reference": "af459883f4018d0f8a0c69c7a209daef3bf973ba" + "reference": "ee7a4c37bf3d0e8c03635d5bddb5bb3184ead490" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-escaper/zipball/af459883f4018d0f8a0c69c7a209daef3bf973ba", - "reference": "af459883f4018d0f8a0c69c7a209daef3bf973ba", + "url": "https://api.github.com/repos/laminas/laminas-escaper/zipball/ee7a4c37bf3d0e8c03635d5bddb5bb3184ead490", + "reference": "ee7a4c37bf3d0e8c03635d5bddb5bb3184ead490", "shasum": "" }, "require": { "ext-ctype": "*", "ext-mbstring": "*", - "php": "~8.1.0 || ~8.2.0 || ~8.3.0" + "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0" }, "conflict": { "zendframework/zend-escaper": "*" }, "require-dev": { - "infection/infection": "^0.27.0", - "laminas/laminas-coding-standard": "~2.5.0", + "infection/infection": "^0.26.6", + "laminas/laminas-coding-standard": "~2.4.0", "maglnet/composer-require-checker": "^3.8.0", - "phpunit/phpunit": "^9.6.7", - "psalm/plugin-phpunit": "^0.18.4", - "vimeo/psalm": "^5.9" + "phpunit/phpunit": "^9.5.18", + "psalm/plugin-phpunit": "^0.17.0", + "vimeo/psalm": "^4.22.0" }, "type": "library", "autoload": { @@ -66,24 +66,24 @@ "type": "community_bridge" } ], - "time": "2023-10-10T08:35:13+00:00" + "time": "2022-10-10T10:11:09+00:00" }, { "name": "laminas/laminas-eventmanager", - "version": "3.11.0", + "version": "3.10.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-eventmanager.git", - "reference": "9cfa79ce247c567f05ce4b7c975c6bdf9698c5dd" + "reference": "5a5114ab2d3fa4424faa46a2fb0a4e49a61f6eba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-eventmanager/zipball/9cfa79ce247c567f05ce4b7c975c6bdf9698c5dd", - "reference": "9cfa79ce247c567f05ce4b7c975c6bdf9698c5dd", + "url": "https://api.github.com/repos/laminas/laminas-eventmanager/zipball/5a5114ab2d3fa4424faa46a2fb0a4e49a61f6eba", + "reference": "5a5114ab2d3fa4424faa46a2fb0a4e49a61f6eba", "shasum": "" }, "require": { - "php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0" + "php": "~8.0.0 || ~8.1.0 || ~8.2.0" }, "conflict": { "container-interop/container-interop": "<1.2", @@ -134,7 +134,7 @@ "type": "community_bridge" } ], - "time": "2023-10-10T08:29:58+00:00" + "time": "2023-01-11T19:52:45+00:00" }, { "name": "laminas/laminas-json", @@ -199,21 +199,21 @@ }, { "name": "laminas/laminas-servicemanager", - "version": "3.22.0", + "version": "3.21.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-servicemanager.git", - "reference": "b4f547078af2ac3173cbe4a64e8fdfbd626c77ae" + "reference": "625f2aa3bc6dd02688b2da5155b3a69870812bda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/b4f547078af2ac3173cbe4a64e8fdfbd626c77ae", - "reference": "b4f547078af2ac3173cbe4a64e8fdfbd626c77ae", + "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/625f2aa3bc6dd02688b2da5155b3a69870812bda", + "reference": "625f2aa3bc6dd02688b2da5155b3a69870812bda", "shasum": "" }, "require": { "laminas/laminas-stdlib": "^3.17", - "php": "~8.1.0 || ~8.2.0 || ~8.3.0", + "php": "~8.1.0 || ~8.2.0", "psr/container": "^1.0" }, "conflict": { @@ -234,9 +234,10 @@ "laminas/laminas-code": "^4.10.0", "laminas/laminas-coding-standard": "~2.5.0", "laminas/laminas-container-config-test": "^0.8", + "laminas/laminas-dependency-plugin": "^2.2", "mikey179/vfsstream": "^1.6.11", "phpbench/phpbench": "^1.2.9", - "phpunit/phpunit": "^10.4", + "phpunit/phpunit": "^10.0.17", "psalm/plugin-phpunit": "^0.18.4", "vimeo/psalm": "^5.8.0" }, @@ -285,34 +286,34 @@ "type": "community_bridge" } ], - "time": "2023-10-10T21:23:36+00:00" + "time": "2023-05-14T12:24:54+00:00" }, { "name": "laminas/laminas-stdlib", - "version": "3.18.0", + "version": "3.17.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-stdlib.git", - "reference": "e85b29076c6216e7fc98e72b42dbe1bbc3b95ecf" + "reference": "dd35c868075bad80b6718959740913e178eb4274" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/e85b29076c6216e7fc98e72b42dbe1bbc3b95ecf", - "reference": "e85b29076c6216e7fc98e72b42dbe1bbc3b95ecf", + "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/dd35c868075bad80b6718959740913e178eb4274", + "reference": "dd35c868075bad80b6718959740913e178eb4274", "shasum": "" }, "require": { - "php": "~8.1.0 || ~8.2.0 || ~8.3.0" + "php": "~8.1.0 || ~8.2.0" }, "conflict": { "zendframework/zend-stdlib": "*" }, "require-dev": { "laminas/laminas-coding-standard": "^2.5", - "phpbench/phpbench": "^1.2.14", - "phpunit/phpunit": "^10.3.3", + "phpbench/phpbench": "^1.2.9", + "phpunit/phpunit": "^10.0.16", "psalm/plugin-phpunit": "^0.18.4", - "vimeo/psalm": "^5.15.0" + "vimeo/psalm": "^5.8" }, "type": "library", "autoload": { @@ -344,7 +345,7 @@ "type": "community_bridge" } ], - "time": "2023-09-19T10:15:21+00:00" + "time": "2023-03-20T13:51:37+00:00" }, { "name": "psr/container", @@ -686,16 +687,16 @@ }, { "name": "composer/pcre", - "version": "3.1.1", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9" + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9", - "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", "shasum": "" }, "require": { @@ -737,7 +738,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.1" + "source": "https://github.com/composer/pcre/tree/3.1.0" }, "funding": [ { @@ -753,20 +754,20 @@ "type": "tidelift" } ], - "time": "2023-10-11T07:11:09+00:00" + "time": "2022-11-17T09:50:14+00:00" }, { "name": "composer/semver", - "version": "3.4.0", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", + "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", "shasum": "" }, "require": { @@ -816,9 +817,9 @@ "versioning" ], "support": { - "irc": "ircs://irc.libera.chat:6697/composer", + "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.4.0" + "source": "https://github.com/composer/semver/tree/3.3.2" }, "funding": [ { @@ -834,7 +835,7 @@ "type": "tidelift" } ], - "time": "2023-08-31T09:50:34+00:00" + "time": "2022-04-01T19:23:25+00:00" }, { "name": "composer/xdebug-handler", @@ -1310,22 +1311,22 @@ }, { "name": "laminas/laminas-config", - "version": "3.9.0", + "version": "3.8.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-config.git", - "reference": "e53717277f6c22b1c697a46473b9a5ec9a438efa" + "reference": "46baad58d0b12cf98539e04334eff40a1fdfb9a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-config/zipball/e53717277f6c22b1c697a46473b9a5ec9a438efa", - "reference": "e53717277f6c22b1c697a46473b9a5ec9a438efa", + "url": "https://api.github.com/repos/laminas/laminas-config/zipball/46baad58d0b12cf98539e04334eff40a1fdfb9a0", + "reference": "46baad58d0b12cf98539e04334eff40a1fdfb9a0", "shasum": "" }, "require": { "ext-json": "*", "laminas/laminas-stdlib": "^3.6", - "php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", + "php": "~8.0.0 || ~8.1.0 || ~8.2.0", "psr/container": "^1.0" }, "conflict": { @@ -1374,20 +1375,20 @@ "type": "community_bridge" } ], - "time": "2023-09-19T12:02:54+00:00" + "time": "2022-10-16T14:21:22+00:00" }, { "name": "laminas/laminas-feed", - "version": "2.22.0", + "version": "2.21.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-feed.git", - "reference": "669792b819fca7274698147ad7a2ecc1b0a9b141" + "reference": "52918789a417bc292ccd6fbb4b91bd78a65d50ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-feed/zipball/669792b819fca7274698147ad7a2ecc1b0a9b141", - "reference": "669792b819fca7274698147ad7a2ecc1b0a9b141", + "url": "https://api.github.com/repos/laminas/laminas-feed/zipball/52918789a417bc292ccd6fbb4b91bd78a65d50ab", + "reference": "52918789a417bc292ccd6fbb4b91bd78a65d50ab", "shasum": "" }, "require": { @@ -1395,24 +1396,24 @@ "ext-libxml": "*", "laminas/laminas-escaper": "^2.9", "laminas/laminas-stdlib": "^3.6", - "php": "~8.1.0 || ~8.2.0 || ~8.3.0" + "php": "~8.1.0 || ~8.2.0" }, "conflict": { "laminas/laminas-servicemanager": "<3.3", "zendframework/zend-feed": "*" }, "require-dev": { - "laminas/laminas-cache": "^2.13.2 || ^3.11", + "laminas/laminas-cache": "^2.13.2 || ^3.10.1", "laminas/laminas-cache-storage-adapter-memory": "^1.1.0 || ^2.2", "laminas/laminas-coding-standard": "~2.5.0", "laminas/laminas-db": "^2.18", "laminas/laminas-http": "^2.18", "laminas/laminas-servicemanager": "^3.21.0", - "laminas/laminas-validator": "^2.38", - "phpunit/phpunit": "^10.3.1", + "laminas/laminas-validator": "^2.30.1", + "phpunit/phpunit": "^10.2.6", "psalm/plugin-phpunit": "^0.18.4", "psr/http-message": "^2.0", - "vimeo/psalm": "^5.14.1" + "vimeo/psalm": "^5.13.1" }, "suggest": { "laminas/laminas-cache": "Laminas\\Cache component, for optionally caching feeds between requests", @@ -1454,7 +1455,7 @@ "type": "community_bridge" } ], - "time": "2023-10-11T20:16:37+00:00" + "time": "2023-07-24T09:21:16+00:00" }, { "name": "laminas/laminas-filter", @@ -1601,16 +1602,16 @@ }, { "name": "laminas/laminas-i18n", - "version": "2.23.1", + "version": "2.23.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-i18n.git", - "reference": "970a2775732d56b89434ec283577096887e68167" + "reference": "bb844a1141bb6e65d8889f5a08383f761a8270b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-i18n/zipball/970a2775732d56b89434ec283577096887e68167", - "reference": "970a2775732d56b89434ec283577096887e68167", + "url": "https://api.github.com/repos/laminas/laminas-i18n/zipball/bb844a1141bb6e65d8889f5a08383f761a8270b2", + "reference": "bb844a1141bb6e65d8889f5a08383f761a8270b2", "shasum": "" }, "require": { @@ -1682,7 +1683,7 @@ "type": "community_bridge" } ], - "time": "2023-10-09T12:00:55+00:00" + "time": "2023-05-16T23:22:24+00:00" }, { "name": "laminas/laminas-loader", @@ -1971,75 +1972,6 @@ ], "time": "2022-12-02T15:45:50+00:00" }, - { - "name": "laminas/laminas-mvc-plugin-flashmessenger", - "version": "1.9.0", - "source": { - "type": "git", - "url": "https://github.com/laminas/laminas-mvc-plugin-flashmessenger.git", - "reference": "dc73bb6b56a0d74f9fdc0d24ec55a5f8c87c4cfa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-mvc-plugin-flashmessenger/zipball/dc73bb6b56a0d74f9fdc0d24ec55a5f8c87c4cfa", - "reference": "dc73bb6b56a0d74f9fdc0d24ec55a5f8c87c4cfa", - "shasum": "" - }, - "require": { - "laminas/laminas-mvc": "^3.3", - "laminas/laminas-session": "^2.12.0", - "laminas/laminas-stdlib": "^3.6.4", - "laminas/laminas-view": "^2.13.1", - "php": "~8.0.0 || ~8.1.0 || ~8.2.0" - }, - "conflict": { - "laminas/laminas-mvc": "<3.0.0", - "zendframework/zend-mvc-plugin-flashmessenger": "*" - }, - "require-dev": { - "laminas/laminas-coding-standard": "~2.4.0", - "laminas/laminas-i18n": "^2.19.0", - "phpunit/phpunit": "^9.5.25", - "psalm/plugin-phpunit": "^0.17.0", - "vimeo/psalm": "^4.29.0" - }, - "type": "library", - "extra": { - "laminas": { - "component": "Laminas\\Mvc\\Plugin\\FlashMessenger" - } - }, - "autoload": { - "psr-4": { - "Laminas\\Mvc\\Plugin\\FlashMessenger\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Plugin for creating and exposing flash messages via laminas-mvc controllers", - "homepage": "https://laminas.dev", - "keywords": [ - "laminas", - "mvc" - ], - "support": { - "chat": "https://laminas.dev/chat", - "docs": "https://docs.laminas.dev/laminas-mvc-plugin-flashmessenger/", - "forum": "https://discourse.laminas.dev", - "issues": "https://github.com/laminas/laminas-mvc-plugin-flashmessenger/issues", - "rss": "https://github.com/laminas/laminas-mvc-plugin-flashmessenger/releases.atom", - "source": "https://github.com/laminas/laminas-mvc-plugin-flashmessenger" - }, - "funding": [ - { - "url": "https://funding.communitybridge.org/projects/laminas-project", - "type": "community_bridge" - } - ], - "time": "2022-10-22T12:47:30+00:00" - }, { "name": "laminas/laminas-navigation", "version": "2.18.1", @@ -2335,87 +2267,6 @@ ], "time": "2022-12-29T14:47:23+00:00" }, - { - "name": "laminas/laminas-session", - "version": "2.16.0", - "source": { - "type": "git", - "url": "https://github.com/laminas/laminas-session.git", - "reference": "9c845a0361625d5775cad6f043716196201ad41f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-session/zipball/9c845a0361625d5775cad6f043716196201ad41f", - "reference": "9c845a0361625d5775cad6f043716196201ad41f", - "shasum": "" - }, - "require": { - "laminas/laminas-eventmanager": "^3.5", - "laminas/laminas-servicemanager": "^3.15.1", - "laminas/laminas-stdlib": "^3.10.1", - "php": "~8.0.0 || ~8.1.0 || ~8.2.0" - }, - "conflict": { - "zendframework/zend-session": "*" - }, - "require-dev": { - "laminas/laminas-cache": "^3.8", - "laminas/laminas-cache-storage-adapter-memory": "^2.2", - "laminas/laminas-coding-standard": "~2.4.0", - "laminas/laminas-db": "^2.15", - "laminas/laminas-http": "^2.17.1", - "laminas/laminas-validator": "^2.28", - "mongodb/mongodb": "~1.13.0", - "phpunit/phpunit": "^9.5.26", - "psalm/plugin-phpunit": "^0.18.0", - "vimeo/psalm": "^5.0" - }, - "suggest": { - "laminas/laminas-cache": "Laminas\\Cache component", - "laminas/laminas-db": "Laminas\\Db component", - "laminas/laminas-http": "Laminas\\Http component", - "laminas/laminas-servicemanager": "Laminas\\ServiceManager component", - "laminas/laminas-validator": "Laminas\\Validator component", - "mongodb/mongodb": "If you want to use the MongoDB session save handler" - }, - "type": "library", - "extra": { - "laminas": { - "component": "Laminas\\Session", - "config-provider": "Laminas\\Session\\ConfigProvider" - } - }, - "autoload": { - "psr-4": { - "Laminas\\Session\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Object-oriented interface to PHP sessions and storage", - "homepage": "https://laminas.dev", - "keywords": [ - "laminas", - "session" - ], - "support": { - "chat": "https://laminas.dev/chat", - "docs": "https://docs.laminas.dev/laminas-session/", - "forum": "https://discourse.laminas.dev", - "issues": "https://github.com/laminas/laminas-session/issues", - "rss": "https://github.com/laminas/laminas-session/releases.atom", - "source": "https://github.com/laminas/laminas-session" - }, - "funding": [ - { - "url": "https://funding.communitybridge.org/projects/laminas-project", - "type": "community_bridge" - } - ], - "time": "2022-12-04T11:15:36+00:00" - }, { "name": "laminas/laminas-uri", "version": "2.10.0", @@ -2476,22 +2327,22 @@ }, { "name": "laminas/laminas-validator", - "version": "2.39.0", + "version": "2.35.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-validator.git", - "reference": "cec22e6f55fa68ec24e21c4f021fc1b2c3783c49" + "reference": "7a4a30f6c526a518ba9af50e037c2f97cb595958" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/cec22e6f55fa68ec24e21c4f021fc1b2c3783c49", - "reference": "cec22e6f55fa68ec24e21c4f021fc1b2c3783c49", + "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/7a4a30f6c526a518ba9af50e037c2f97cb595958", + "reference": "7a4a30f6c526a518ba9af50e037c2f97cb595958", "shasum": "" }, "require": { "laminas/laminas-servicemanager": "^3.21.0", "laminas/laminas-stdlib": "^3.13", - "php": "~8.1.0 || ~8.2.0 || ~8.3.0", + "php": "~8.1.0 || ~8.2.0", "psr/http-message": "^1.0.1 || ^2.0.0" }, "conflict": { @@ -2504,11 +2355,11 @@ "laminas/laminas-i18n": "^2.23", "laminas/laminas-session": "^2.16", "laminas/laminas-uri": "^2.10.0", - "phpunit/phpunit": "^10.3.3", + "phpunit/phpunit": "^10.1.3", "psalm/plugin-phpunit": "^0.18.4", "psr/http-client": "^1.0.2", "psr/http-factory": "^1.0.2", - "vimeo/psalm": "^5.15" + "vimeo/psalm": "^5.12" }, "suggest": { "laminas/laminas-db": "Laminas\\Db component, required by the (No)RecordExists validator", @@ -2556,7 +2407,7 @@ "type": "community_bridge" } ], - "time": "2023-09-06T20:51:34+00:00" + "time": "2023-07-10T07:32:01+00:00" }, { "name": "myclabs/deep-copy", @@ -2670,16 +2521,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.17.1", + "version": "v4.16.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + "reference": "19526a33fb561ef417e822e85f08a00db4059c17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/19526a33fb561ef417e822e85f08a00db4059c17", + "reference": "19526a33fb561ef417e822e85f08a00db4059c17", "shasum": "" }, "require": { @@ -2720,9 +2571,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.16.0" }, - "time": "2023-08-13T19:53:39+00:00" + "time": "2023-06-25T14:52:30+00:00" }, { "name": "phar-io/manifest", @@ -3046,16 +2897,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.7", + "version": "10.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "355324ca4980b8916c18b9db29f3ef484078f26e" + "reference": "be1fe461fdc917de2a29a452ccf2657d325b443d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/355324ca4980b8916c18b9db29f3ef484078f26e", - "reference": "355324ca4980b8916c18b9db29f3ef484078f26e", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/be1fe461fdc917de2a29a452ccf2657d325b443d", + "reference": "be1fe461fdc917de2a29a452ccf2657d325b443d", "shasum": "" }, "require": { @@ -3112,7 +2963,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.7" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.3" }, "funding": [ { @@ -3120,20 +2971,20 @@ "type": "github" } ], - "time": "2023-10-04T15:34:17+00:00" + "time": "2023-07-26T13:45:28+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "4.1.0", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" + "reference": "5647d65443818959172645e7ed999217360654b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", - "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/5647d65443818959172645e7ed999217360654b6", + "reference": "5647d65443818959172645e7ed999217360654b6", "shasum": "" }, "require": { @@ -3173,7 +3024,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.0.2" }, "funding": [ { @@ -3181,7 +3032,7 @@ "type": "github" } ], - "time": "2023-08-31T06:24:48+00:00" + "time": "2023-05-07T09:13:23+00:00" }, { "name": "phpunit/php-invoker", @@ -3248,16 +3099,16 @@ }, { "name": "phpunit/php-text-template", - "version": "3.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" + "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", - "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/9f3d3709577a527025f55bcf0f7ab8052c8bb37d", + "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d", "shasum": "" }, "require": { @@ -3295,8 +3146,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.0" }, "funding": [ { @@ -3304,7 +3154,7 @@ "type": "github" } ], - "time": "2023-08-31T14:07:24+00:00" + "time": "2023-02-03T06:56:46+00:00" }, { "name": "phpunit/php-timer", @@ -3367,16 +3217,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.4.1", + "version": "10.2.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "62bd7af13d282deeb95650077d28ba3600ca321c" + "reference": "1c17815c129f133f3019cc18e8d0c8622e6d9bcd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/62bd7af13d282deeb95650077d28ba3600ca321c", - "reference": "62bd7af13d282deeb95650077d28ba3600ca321c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1c17815c129f133f3019cc18e8d0c8622e6d9bcd", + "reference": "1c17815c129f133f3019cc18e8d0c8622e6d9bcd", "shasum": "" }, "require": { @@ -3390,7 +3240,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=8.1", - "phpunit/php-code-coverage": "^10.1.5", + "phpunit/php-code-coverage": "^10.1.1", "phpunit/php-file-iterator": "^4.0", "phpunit/php-invoker": "^4.0", "phpunit/php-text-template": "^3.0", @@ -3400,8 +3250,8 @@ "sebastian/comparator": "^5.0", "sebastian/diff": "^5.0", "sebastian/environment": "^6.0", - "sebastian/exporter": "^5.1", - "sebastian/global-state": "^6.0.1", + "sebastian/exporter": "^5.0", + "sebastian/global-state": "^6.0", "sebastian/object-enumerator": "^5.0", "sebastian/recursion-context": "^5.0", "sebastian/type": "^4.0", @@ -3416,7 +3266,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.4-dev" + "dev-main": "10.2-dev" } }, "autoload": { @@ -3448,7 +3298,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.4.1" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.6" }, "funding": [ { @@ -3464,7 +3314,7 @@ "type": "tidelift" } ], - "time": "2023-10-08T05:01:11+00:00" + "time": "2023-07-17T12:08:28+00:00" }, { "name": "psalm/plugin-phpunit", @@ -3798,16 +3648,16 @@ }, { "name": "sebastian/comparator", - "version": "5.0.1", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2db5010a484d53ebf536087a70b4a5423c102372" + "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", - "reference": "2db5010a484d53ebf536087a70b4a5423c102372", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/72f01e6586e0caf6af81297897bd112eb7e9627c", + "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c", "shasum": "" }, "require": { @@ -3818,7 +3668,7 @@ "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^10.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { @@ -3862,8 +3712,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.0" }, "funding": [ { @@ -3871,20 +3720,20 @@ "type": "github" } ], - "time": "2023-08-14T13:18:12+00:00" + "time": "2023-02-03T07:07:16+00:00" }, { "name": "sebastian/complexity", - "version": "3.1.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "68cfb347a44871f01e33ab0ef8215966432f6957" + "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68cfb347a44871f01e33ab0ef8215966432f6957", - "reference": "68cfb347a44871f01e33ab0ef8215966432f6957", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/e67d240970c9dc7ea7b2123a6d520e334dd61dc6", + "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6", "shasum": "" }, "require": { @@ -3897,7 +3746,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.1-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -3920,8 +3769,7 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "security": "https://github.com/sebastianbergmann/complexity/security/policy", - "source": "https://github.com/sebastianbergmann/complexity/tree/3.1.0" + "source": "https://github.com/sebastianbergmann/complexity/tree/3.0.0" }, "funding": [ { @@ -3929,7 +3777,7 @@ "type": "github" } ], - "time": "2023-09-28T11:50:59+00:00" + "time": "2023-02-03T06:59:47+00:00" }, { "name": "sebastian/diff", @@ -4064,16 +3912,16 @@ }, { "name": "sebastian/exporter", - "version": "5.1.1", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc" + "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/64f51654862e0f5e318db7e9dcc2292c63cdbddc", - "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", + "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", "shasum": "" }, "require": { @@ -4087,7 +3935,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "5.1-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -4129,8 +3977,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.1" + "source": "https://github.com/sebastianbergmann/exporter/tree/5.0.0" }, "funding": [ { @@ -4138,7 +3985,7 @@ "type": "github" } ], - "time": "2023-09-24T13:22:09+00:00" + "time": "2023-02-03T07:06:49+00:00" }, { "name": "sebastian/global-state", @@ -4204,16 +4051,16 @@ }, { "name": "sebastian/lines-of-code", - "version": "2.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d" + "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/649e40d279e243d985aa8fb6e74dd5bb28dc185d", - "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/17c4d940ecafb3d15d2cf916f4108f664e28b130", + "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130", "shasum": "" }, "require": { @@ -4249,8 +4096,7 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.1" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.0" }, "funding": [ { @@ -4258,7 +4104,7 @@ "type": "github" } ], - "time": "2023-08-31T09:25:50+00:00" + "time": "2023-02-03T07:08:02+00:00" }, { "name": "sebastian/object-enumerator", @@ -4727,16 +4573,16 @@ }, { "name": "symfony/console", - "version": "v6.3.4", + "version": "v6.3.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "eca495f2ee845130855ddf1cf18460c38966c8b6" + "reference": "aa5d64ad3f63f2e48964fc81ee45cb318a723898" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/eca495f2ee845130855ddf1cf18460c38966c8b6", - "reference": "eca495f2ee845130855ddf1cf18460c38966c8b6", + "url": "https://api.github.com/repos/symfony/console/zipball/aa5d64ad3f63f2e48964fc81ee45cb318a723898", + "reference": "aa5d64ad3f63f2e48964fc81ee45cb318a723898", "shasum": "" }, "require": { @@ -4797,7 +4643,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.3.4" + "source": "https://github.com/symfony/console/tree/v6.3.2" }, "funding": [ { @@ -4813,7 +4659,7 @@ "type": "tidelift" } ], - "time": "2023-08-16T10:10:12+00:00" + "time": "2023-07-19T20:17:28+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4947,16 +4793,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.28.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", "shasum": "" }, "require": { @@ -4971,7 +4817,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.28-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5009,7 +4855,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" }, "funding": [ { @@ -5025,20 +4871,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.28.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "875e90aeea2777b6f135677f618529449334a612" + "reference": "511a08c03c1960e08a883f4cffcacd219b758354" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", - "reference": "875e90aeea2777b6f135677f618529449334a612", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354", "shasum": "" }, "require": { @@ -5050,7 +4896,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.28-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5090,7 +4936,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" }, "funding": [ { @@ -5106,20 +4952,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.28.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", "shasum": "" }, "require": { @@ -5131,7 +4977,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.28-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5174,7 +5020,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" }, "funding": [ { @@ -5190,20 +5036,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", "shasum": "" }, "require": { @@ -5218,7 +5064,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.28-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5257,7 +5103,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" }, "funding": [ { @@ -5273,7 +5119,7 @@ "type": "tidelift" } ], - "time": "2023-07-28T09:04:16+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/service-contracts", @@ -5360,16 +5206,16 @@ }, { "name": "symfony/string", - "version": "v6.3.5", + "version": "v6.3.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339" + "reference": "53d1a83225002635bca3482fcbf963001313fb68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/13d76d0fb049051ed12a04bef4f9de8715bea339", - "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339", + "url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68", + "reference": "53d1a83225002635bca3482fcbf963001313fb68", "shasum": "" }, "require": { @@ -5426,7 +5272,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.3.5" + "source": "https://github.com/symfony/string/tree/v6.3.2" }, "funding": [ { @@ -5442,7 +5288,7 @@ "type": "tidelift" } ], - "time": "2023-09-18T10:38:32+00:00" + "time": "2023-07-05T08:41:27+00:00" }, { "name": "theseer/tokenizer", @@ -5496,16 +5342,16 @@ }, { "name": "vimeo/psalm", - "version": "5.15.0", + "version": "5.14.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "5c774aca4746caf3d239d9c8cadb9f882ca29352" + "reference": "b2942cefed8443002bd3f245c4cd0a54193716d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/5c774aca4746caf3d239d9c8cadb9f882ca29352", - "reference": "5c774aca4746caf3d239d9c8cadb9f882ca29352", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/b2942cefed8443002bd3f245c4cd0a54193716d8", + "reference": "b2942cefed8443002bd3f245c4cd0a54193716d8", "shasum": "" }, "require": { @@ -5533,9 +5379,6 @@ "symfony/console": "^4.1.6 || ^5.0 || ^6.0", "symfony/filesystem": "^5.4 || ^6.0" }, - "conflict": { - "nikic/php-parser": "4.17.0" - }, "provide": { "psalm/psalm": "self.version" }, @@ -5599,9 +5442,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.15.0" + "source": "https://github.com/vimeo/psalm/tree/5.14.0" }, - "time": "2023-08-20T23:07:30+00:00" + "time": "2023-07-30T20:18:56+00:00" }, { "name": "webimpress/coding-standard", @@ -5791,5 +5634,5 @@ "platform-overrides": { "php": "8.1.99" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/docs/book/v2/helpers/flash-messenger.md b/docs/book/v2/helpers/flash-messenger.md deleted file mode 100644 index 95a21fb99..000000000 --- a/docs/book/v2/helpers/flash-messenger.md +++ /dev/null @@ -1,146 +0,0 @@ -# FlashMessenger - -The `FlashMessenger` helper is used to render the messages of the -[FlashMessenger MVC plugin](https://docs.laminas.dev/laminas-mvc-plugin-flashmessenger/). - -## Basic Usage - -When only using the default `namespace` for the `FlashMessenger`, you can do the -following: - -```php -// Usable in any of your .phtml files -echo $this->flashMessenger()->render(); -``` - -The first argument of the `render()` function is the `namespace`. If no -`namespace` is defined, the default -`Laminas\Mvc\Controller\Plugin\FlashMessenger::NAMESPACE_DEFAULT` will be used, -which translates to `default`. - -```php -// Usable in any of your .phtml files -echo $this->flashMessenger()->render('error'); - -// Alternatively use one of the pre-defined namespaces -// (aka: use Laminas\Mvc\Controller\Plugin\FlashMessenger;) -echo $this->flashMessenger()->render(FlashMessenger::NAMESPACE_SUCCESS); -``` - -## CSS Layout - -The `FlashMessenger` default rendering adds a CSS class to the generated HTML, -that matches the defined `namespace` that should be rendered. While it may work -well for the default cases, every so often you may want to add specific CSS -classes to the HTML output. This can be done while making use of the second -parameter of the `render()` function. - -```php -// Usable in any of your .phtml files -echo $this->flashMessenger()->render('error', ['alert', 'alert-danger']); -``` - -The output of this example, using the default HTML rendering settings, would -look like this: - -```html - -``` - -## HTML Layout - -Aside from modifying the rendered CSS classes of the `FlashMessenger`, you are -furthermore able to modify the generated HTML as a whole to create even more -distinct visuals for your flash messages. The default output format is defined -within the source code of the `FlashMessenger` view helper itself. - -```php -// Laminas/View/Helper/FlashMessenger.php#L41-L43 -protected $messageCloseString = ''; -protected $messageOpenFormat = '
  • '; -protected $messageSeparatorString = '
  • '; -``` - -These defaults exactly match what we're trying to do. The placeholder `%s` will -be filled with the CSS classes output. - -To change this, all we need to do is call the respective setter methods of these -variables and give them new strings; for example: - -```php -// In any of your .phtml files: -echo $this->flashMessenger() - ->setMessageOpenFormat('

    ') - ->setMessageSeparatorString('

    ') - ->setMessageCloseString('

    ') - ->render('success'); -``` - -The above code sample then would then generate the following output: - -```html -
    -

    Some FlashMessenger Content

    -

    You, who's reading the docs, are AWESOME!

    -
    -``` - -## Sample Modification for Twitter Bootstrap 3 - -Taking all the above knowledge into account, we can create a nice, highly usable -and user-friendly rendering strategy using the -[Bootstrap front-end framework](http://getbootstrap.com/) version 3 layouts: - -```php -// In any of your .phtml files: -$flash = $this->flashMessenger(); -$flash->setMessageOpenFormat(' - -
    • ') - ->setMessageSeparatorString('
    • ') - ->setMessageCloseString('
    '); - -echo $flash->render('error', ['alert', 'alert-dismissible', 'alert-danger']); -echo $flash->render('info', ['alert', 'alert-dismissible', 'alert-info']); -echo $flash->render('default', ['alert', 'alert-dismissible', 'alert-warning']); -echo $flash->render('success', ['alert', 'alert-dismissible', 'alert-success']); -``` - -The output of the above example would create dismissable `FlashMessages` with -the following HTML markup. The example only covers one type of `FlashMessenger` -output; if you would have several `FlashMessages` available in each of the -rendered `namespaces`, then you would receive the same output multiple times -only having different CSS classes applied. - -```html -
    - -
      -
    • Some FlashMessenger Content
    • -
    • You, who's reading the docs, are AWESOME!
    • -
    -
    -``` - -## Alternative Configuration of the ViewHelper Layout - -`Laminas\View\Helper\Service\FlashMessengerFactory` checks the application -configuration, making it possible to set up the `FlashMessenger` strings through -your `module.config.php`, too. The next example will set up the output to be -identical with the above Twitter Bootstrap 3 Example - -```php -'view_helper_config' => [ - 'flashmessenger' => [ - 'message_open_format' => '
    • ', - 'message_close_string' => '
    ', - 'message_separator_string' => '
  • ', - ], -], -``` diff --git a/docs/book/v2/helpers/html-object.md b/docs/book/v2/helpers/html-object.md index 276a4a076..ba1ecfa18 100644 --- a/docs/book/v2/helpers/html-object.md +++ b/docs/book/v2/helpers/html-object.md @@ -2,12 +2,10 @@ The [HTML `` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object) is used for embedding external media in web pages. The object view helpers take care of embedding media with minimum effort. -There are four initial Object helpers: +There are two initial Object helpers: - `htmlObject()` Generates markup for embedding a custom Object. - `htmlPage()` Generates markup for embedding other (X)HTML pages. -- `htmlFlash()` Generates markup for embedding Flash files. _**Deprecated**_ -- `htmlQuicktime()` Generates markup for embedding QuickTime files. _**Deprecated**_ All of these helpers share a similar interface. For this reason, this documentation will only contain examples of two of these helpers. diff --git a/docs/book/v2/helpers/intro.md b/docs/book/v2/helpers/intro.md index 772b80990..1aa4a08f1 100644 --- a/docs/book/v2/helpers/intro.md +++ b/docs/book/v2/helpers/intro.md @@ -60,7 +60,6 @@ for, and rendering, the various HTML `` tags, such as `HeadTitle`, - [BasePath](base-path.md) - [Cycle](cycle.md) - [Doctype](doctype.md) -- [FlashMessenger](flash-messenger.md) - [Gravatar](gravatar.md) *(Deprecated)* - [GravatarImage](gravatar-image.md) - [HeadLink](head-link.md) @@ -110,6 +109,12 @@ for, and rendering, the various HTML `` tags, such as `HeadTitle`, > [Paginator Usage](https://docs.laminas.dev/laminas-paginator/usage/#rendering-pages-with-view-scripts) > documentation. +> ### FlashMessenger helper +> +> View helper related to **Flash Messenger** is documented in the +> [FLash Messenger View Helper](https://docs.laminas.dev/laminas-mvc-plugin-flashmessenger/view-helper/) +> documentation. + > ### Custom Helpers > > For documentation on writing **custom view helpers** see the diff --git a/docs/book/v2/helpers/json.md b/docs/book/v2/helpers/json.md index 4a4056a02..655a9f788 100644 --- a/docs/book/v2/helpers/json.md +++ b/docs/book/v2/helpers/json.md @@ -19,29 +19,3 @@ determine how to handle the content. ```php json($this->data) ?> ``` - -> WARNING: **Deprecated** -> -> ### Enabling encoding using Laminas\Json\Expr -> -> **This feature of the Json view helper has been deprecated in version 2.16 and will be removed in version 3.0.** -> -> The JSON helper accepts an array of options that will be passed to `Laminas\Json\Json::encode()` and -> used internally to encode data. -> `Laminas\Json\Json::encode` allows the encoding of native JSON expressions using `Laminas\Json\Expr` -> objects. This option is disabled by default. To enable this option, pass a boolean `true` to the -> `enableJsonExprFinder` key of the options array: -> -> ```php -> json($this->data, ['enableJsonExprFinder' => true]) ?> -> `` -> -> The JSON helper accepts an array of options that will be passed to `Laminas\Json\Json::encode()` and -> used internally to encode data. -> `Laminas\Json\Json::encode` allows the encoding of native JSON expressions using `Laminas\Json\Expr` -> objects. This option is disabled by default. To enable this option, pass a boolean `true` to the -> `enableJsonExprFinder` key of the options array: -> -> ```php -> json($this->data, ['enableJsonExprFinder' => true]) ?> -> ``` diff --git a/mkdocs.yml b/mkdocs.yml index 85fb0cfc0..0cc03866c 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -15,7 +15,6 @@ nav: - Cycle: v2/helpers/cycle.md - Doctype: v2/helpers/doctype.md - Escape: v2/helpers/escape.md - - FlashMessenger: v2/helpers/flash-messenger.md - Gravatar: v2/helpers/gravatar.md - HeadLink: v2/helpers/head-link.md - HeadMeta: v2/helpers/head-meta.md diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 8e1e77db4..54e709c03 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,23 @@ - + + + + $templatePath + + + $file + getExtension()]]> + $templatePath + + + $file + $files[] + + + getExtension + getPathname + + $closingBracket @@ -128,46 +146,6 @@ $value[$k] - - - pluginFlashMessenger]]> - - - $item - - - $escapeHtmlHelper - $pluginFlashMessenger - - - $item - $messagesToPrint - - - $classes - $classes - - - $messagesToPrint[] - $messagesToPrint[] - - - $classes - $classes - $messagesToPrint[] - $messagesToPrint[] - escapeHtmlHelper]]> - - - (bool) $autoEscape - (string) $messageCloseString - (string) $messageOpenFormat - (string) $messageSeparatorString - - - escapeHtmlHelper]]> - - $flag === null @@ -398,26 +376,6 @@ is_string($content) - - - $htmlObject - - - $htmlObject($data, self::TYPE, $attribs, $params, $content) - - - string - - - $htmlObject($data, self::TYPE, $attribs, $params, $content) - - - plugin - - - plugin - - is_array($content) @@ -450,26 +408,6 @@ plugin - - - $htmlObject - - - $htmlObject($data, self::TYPE, $attribs, $params, $content) - - - string - - - $htmlObject($data, self::TYPE, $attribs, $params, $content) - - - plugin - - - plugin - - $value @@ -487,17 +425,6 @@ (bool) $useNamespaces - - - $response - - - null - - - response instanceof Response]]> - - plugin @@ -1071,7 +998,6 @@ (string) $key (string) $key (string) $key - (string) $name containerClass($value)]]> @@ -1131,9 +1057,6 @@ - - null === static::$instance - containerClass($value)]]> @@ -1156,9 +1079,6 @@ (string) $key (string) $key - - new static() - @@ -1166,12 +1086,18 @@ $viewModelHelper + $childModel viewModelHelper]]> ViewModel + false|Model + + captureTo + + $childModel viewModelHelper]]> @@ -1232,11 +1158,6 @@ - - - $cName - - @@ -1249,50 +1170,7 @@ $config - - - FlashMessenger - FlashMessenger - new FlashMessenger() - - - FlashMessengerFactory - - - - - - $flashMessenger - - - - - - - - - - $config - $configHelper - $controllerPluginManager - $flashMessenger - - - get - - - $container - - - $requestedName - - - - $this - $this - $this - (bool) $enabled @@ -1379,17 +1257,6 @@ clearVariables - - - int - - - options['errorLevel']]]> - - - $captureTo - - type]]> @@ -1417,6 +1284,11 @@ $captureTo + + + IteratorAggregate + + gettype($variables) @@ -1428,9 +1300,29 @@ $key + + $children[] + + $child + $children + $children[] $value + + array + + + captureTo + getChildrenByCaptureTo + + + getChildrenByCaptureTo($capture)]]> + + + $children + $children + $variables[$name] @@ -1448,25 +1340,6 @@ is_object($variables) - - - $values - - - $setting - $value - - - $setting - getFilterChain()->filter($values['result'])]]> - - - $model - - - $values - - @@ -1482,21 +1355,27 @@ - - void - $jsonpCallback + $child $nameOrModel $child + + $values[$captureTo] + + $captureTo + $child $value + + captureTo + $childValues $children @@ -1519,15 +1398,9 @@ gettype($helpers) gettype($variables) - - __templateResolver->resolve($name, $this)]]> - $values - - string|Resolver - $__vars __template]]> @@ -1564,6 +1437,7 @@ string + string|Resolver getArrayCopy @@ -1574,6 +1448,7 @@ __filterChain->filter($this->__content)]]> + __templateResolver->resolve($name, $this)]]> __templateResolver]]> @@ -1609,56 +1484,57 @@ - - lastLookupFailure]]> - lastLookupFailure]]> + + IteratorAggregate + + + $resolver + $resource lastLookupFailure]]> lastLookupFailure]]> lastSuccessfulResolver]]> - lastSuccessfulResolver]]> - lastSuccessfulResolver]]> - + + + false|string + + + resolve + + + $resource + + + null + + + $lastSuccessfulResolver + - - resolve - - - (string) $prefix - + + $prefix + + + $result + - is_iterable($map) - is_iterable($map) + + + is_string($nameOrMap) - - map, $map)]]> - - - - is_string($path) - + + IteratorAggregate + + + false|string + + + map[$name]]]> + - - static::FAILURE_NOT_FOUND - static::FAILURE_NO_PATHS - - - setUseStreamWrapper - - - lastLookupFailure]]> - lastLookupFailure]]> - lastLookupFailure]]> - lastLookupFailure]]> - useStreamWrapper]]> - useStreamWrapper]]> - useViewStream]]> - useViewStream]]> - useViewStream]]> - is_string($path) @@ -1667,11 +1543,19 @@ false - - - - + $value + $value + $value + $value + + lastLookupFailure]]> + lastLookupFailure]]> + $value + + + paths]]> + (bool) $flag (bool) $flag @@ -1729,34 +1613,6 @@ plugin - - - $data - $stat - - - $mode - $offset - $opened_path - $options - $whence - - - pos]]> - pos]]> - pos]]> - - - $offset - $offset - $offset - - - break; - break; - break; - - Variables @@ -1796,9 +1652,17 @@ $request $response + + $child + + $child $oldResult + + setOption + terminate + $oldResult @@ -1904,75 +1768,6 @@ $test - - - $plugin - $plugin - mvcPluginClass]]> - - - FlashMessenger - [ - 'config' => $config, - ], - 'factories' => [ - 'ControllerPluginManager' => fn(ContainerInterface $services) => new PluginManager($services, [ - 'invokables' => [ - 'flashmessenger' => $this->mvcPluginClass, - ], - ]), - 'ViewHelperManager' => static fn(ContainerInterface $services) - => new HelperPluginManager($services), - ], - ])]]> - new FlashMessenger() - new FlashMessenger() - new FlashMessenger() - new FlashMessenger() - new FlashMessenger() - new FlashMessenger() - - - $displayInfo - $displayInfo - $displayInfo - $displayInfo - $helper - $helper - $helper - $helper - $helperPluginManager - $helperPluginManager - $helperPluginManager - $helperPluginManager - - - get - get - get - get - render - render - renderCurrent - renderCurrent - - - hasCurrentErrorMessages - hasCurrentInfoMessages - hasCurrentMessages - hasCurrentSuccessMessages - hasErrorMessages - hasInfoMessages - hasMessages - hasSuccessMessages - hasWarningMessages - render - render - renderCurrent - renderCurrent - - $value @@ -2070,11 +1865,6 @@ offsetSetName - - - HtmlFlash - - $escape($value) @@ -2763,16 +2553,11 @@ $model - - - assertNull - - - - - TemplatePathStack::FAILURE_NOT_FOUND - TemplatePathStack::FAILURE_NO_PATHS - + + + $test + $test + diff --git a/src/Helper/AbstractHtmlElement.php b/src/Helper/AbstractHtmlElement.php index e14a39ef0..cfa18d2bc 100644 --- a/src/Helper/AbstractHtmlElement.php +++ b/src/Helper/AbstractHtmlElement.php @@ -11,17 +11,8 @@ use function substr; use function trim; -use const PHP_EOL; - abstract class AbstractHtmlElement extends AbstractHelper { - /** - * EOL character - * - * @deprecated just use PHP_EOL - */ - public const EOL = PHP_EOL; - /** * The tag closing bracket * diff --git a/src/Helper/Asset.php b/src/Helper/Asset.php index 34deac7a0..86471f7fc 100644 --- a/src/Helper/Asset.php +++ b/src/Helper/Asset.php @@ -11,15 +11,11 @@ /** * View helper plugin to fetch asset from resource map. - * - * @final */ -class Asset extends AbstractHelper +final class Asset { - use DeprecatedAbstractHelperHierarchyTrait; - /** @var array */ - protected $resourceMap = []; + private array $resourceMap; /** * @param array $resourceMap @@ -34,7 +30,7 @@ public function __construct(array $resourceMap = []) * @return non-empty-string * @throws Exception\InvalidArgumentException */ - public function __invoke($asset) + public function __invoke(string $asset): string { if (! array_key_exists($asset, $this->resourceMap)) { throw new Exception\InvalidArgumentException(sprintf( @@ -45,29 +41,4 @@ public function __invoke($asset) return $this->resourceMap[$asset]; } - - /** - * @deprecated since 2.20.0, this method will be removed in version 3.0.0 of this component. - * The Resource map should be provided to the constructor from version 3.0 - * - * @param array $resourceMap - * @return $this - */ - public function setResourceMap(array $resourceMap) - { - $this->resourceMap = $resourceMap; - - return $this; - } - - /** - * @deprecated since 2.20.0, this method will be removed in version 3.0.0 of this component. - * Runtime retrieval of the resource map from the view will be removed without replacement. - * - * @return array - */ - public function getResourceMap() - { - return $this->resourceMap; - } } diff --git a/src/Helper/FlashMessenger.php b/src/Helper/FlashMessenger.php deleted file mode 100644 index 73d83f89a..000000000 --- a/src/Helper/FlashMessenger.php +++ /dev/null @@ -1,353 +0,0 @@ - 'info', - 'error' => 'error', - 'success' => 'success', - 'default' => 'default', - 'warning' => 'warning', - ]; - - /** - * Templates for the open/close/separators for message tags - * - * @var string - */ - protected $messageCloseString = ''; - /** @var string */ - protected $messageOpenFormat = '
  • '; - /** @var string */ - protected $messageSeparatorString = '
  • '; - - /** - * Flag whether to escape messages - * - * @var bool - */ - protected $autoEscape = true; - - /** - * Html escape helper - * - * @var EscapeHtml - */ - protected $escapeHtmlHelper; - - /** - * Flash messenger plugin - * - * @var PluginFlashMessenger - */ - protected $pluginFlashMessenger; - - /** - * Returns the flash messenger plugin controller - * - * @param string|null $namespace - * @return array|static - */ - public function __invoke($namespace = null) - { - if (null === $namespace) { - return $this; - } - $flashMessenger = $this->getPluginFlashMessenger(); - - return $flashMessenger->getMessagesFromNamespace($namespace); - } - - /** - * Proxy the flash messenger plugin controller - * - * @param string $method - * @param array $argv - * @return mixed - */ - public function __call($method, $argv) - { - $flashMessenger = $this->getPluginFlashMessenger(); - return call_user_func_array([$flashMessenger, $method], $argv); - } - - /** - * Render Messages - * - * @param string $namespace - * @param array $classes - * @param null|bool $autoEscape - * @return string - */ - public function render($namespace = 'default', array $classes = [], $autoEscape = null) - { - $flashMessenger = $this->getPluginFlashMessenger(); - $messages = $flashMessenger->getMessagesFromNamespace($namespace); - return $this->renderMessages($namespace, $messages, $classes, $autoEscape); - } - - /** - * Render Current Messages - * - * @param string $namespace - * @param array $classes - * @param bool|null $autoEscape - * @return string - */ - public function renderCurrent($namespace = 'default', array $classes = [], $autoEscape = null) - { - $flashMessenger = $this->getPluginFlashMessenger(); - $messages = $flashMessenger->getCurrentMessagesFromNamespace($namespace); - return $this->renderMessages($namespace, $messages, $classes, $autoEscape); - } - - /** - * Render Messages - * - * @param string $namespace - * @param array $messages - * @param array $classes - * @param bool|null $autoEscape - * @return string - */ - protected function renderMessages( - $namespace = 'default', - array $messages = [], - array $classes = [], - $autoEscape = null - ) { - if (empty($messages)) { - return ''; - } - - // Prepare classes for opening tag - if (empty($classes)) { - if (isset($this->classMessages[$namespace])) { - $classes = $this->classMessages[$namespace]; - } else { - $classes = $this->classMessages['default']; - } - $classes = [$classes]; - } - - if (null === $autoEscape) { - $autoEscape = $this->getAutoEscape(); - } - - // Flatten message array - $escapeHtml = $this->getEscapeHtmlHelper(); - $messagesToPrint = []; - $translator = $this->getTranslator(); - $translatorTextDomain = $this->getTranslatorTextDomain(); - array_walk_recursive( - $messages, - function ($item) use (&$messagesToPrint, $escapeHtml, $autoEscape, $translator, $translatorTextDomain) { - if ($translator !== null) { - $item = $translator->translate( - $item, - $translatorTextDomain - ); - } - - if ($autoEscape) { - $messagesToPrint[] = $escapeHtml($item); - return; - } - - $messagesToPrint[] = $item; - } - ); - - if (empty($messagesToPrint)) { - return ''; - } - - // Generate markup - $markup = sprintf($this->getMessageOpenFormat(), ' class="' . implode(' ', $classes) . '"'); - $markup .= implode( - sprintf($this->getMessageSeparatorString(), ' class="' . implode(' ', $classes) . '"'), - $messagesToPrint - ); - $markup .= $this->getMessageCloseString(); - return $markup; - } - - /** - * Set whether or not auto escaping should be used - * - * @param bool $autoEscape - * @return self - */ - public function setAutoEscape($autoEscape = true) - { - $this->autoEscape = (bool) $autoEscape; - return $this; - } - - /** - * Return whether auto escaping is enabled or disabled - * - * @return bool - */ - public function getAutoEscape() - { - return $this->autoEscape; - } - - /** - * Set the string used to close message representation - * - * @param string $messageCloseString - * @return FlashMessenger - */ - public function setMessageCloseString($messageCloseString) - { - $this->messageCloseString = (string) $messageCloseString; - return $this; - } - - /** - * Get the string used to close message representation - * - * @return string - */ - public function getMessageCloseString() - { - return $this->messageCloseString; - } - - /** - * Set the formatted string used to open message representation - * - * @param string $messageOpenFormat - * @return FlashMessenger - */ - public function setMessageOpenFormat($messageOpenFormat) - { - $this->messageOpenFormat = (string) $messageOpenFormat; - return $this; - } - - /** - * Get the formatted string used to open message representation - * - * @return string - */ - public function getMessageOpenFormat() - { - return $this->messageOpenFormat; - } - - /** - * Set the string used to separate messages - * - * @param string $messageSeparatorString - * @return FlashMessenger - */ - public function setMessageSeparatorString($messageSeparatorString) - { - $this->messageSeparatorString = (string) $messageSeparatorString; - return $this; - } - - /** - * Get the string used to separate messages - * - * @return string - */ - public function getMessageSeparatorString() - { - return $this->messageSeparatorString; - } - - /** - * Set the flash messenger plugin - * - * @param PluginFlashMessenger $pluginFlashMessenger - * @return FlashMessenger - * @throws InvalidArgumentException For an invalid $pluginFlashMessenger. - * @psalm-suppress RedundantConditionGivenDocblockType, DocblockTypeContradiction - */ - public function setPluginFlashMessenger($pluginFlashMessenger) - { - if (! $pluginFlashMessenger instanceof PluginFlashMessenger) { - throw new InvalidArgumentException(sprintf( - '%s expects a %s instance; received %s', - __METHOD__, - PluginFlashMessenger::class, - is_object($pluginFlashMessenger) ? $pluginFlashMessenger::class : gettype($pluginFlashMessenger) - )); - } - - $this->pluginFlashMessenger = $pluginFlashMessenger; - return $this; - } - - /** - * Get the flash messenger plugin - * - * @return PluginFlashMessenger - */ - public function getPluginFlashMessenger() - { - if (null === $this->pluginFlashMessenger) { - $this->setPluginFlashMessenger(new PluginFlashMessenger()); - } - - return $this->pluginFlashMessenger; - } - - /** - * Retrieve the escapeHtml helper - * - * @return EscapeHtml - */ - protected function getEscapeHtmlHelper() - { - if ($this->escapeHtmlHelper) { - return $this->escapeHtmlHelper; - } - - if (null !== $this->view && method_exists($this->view, 'plugin')) { - $this->escapeHtmlHelper = $this->view->plugin('escapehtml'); - } - - if (! $this->escapeHtmlHelper instanceof EscapeHtml) { - $this->escapeHtmlHelper = new EscapeHtml(); - } - - return $this->escapeHtmlHelper; - } -} diff --git a/src/Helper/Gravatar.php b/src/Helper/Gravatar.php index f06dedfce..fde428fc0 100644 --- a/src/Helper/Gravatar.php +++ b/src/Helper/Gravatar.php @@ -12,13 +12,10 @@ use function sprintf; use function str_replace; use function strtolower; -use function trigger_error; use function trim; use function ucwords; use function urlencode; -use const E_USER_DEPRECATED; - /** * Helper for retrieving avatars from gravatar.com * @@ -198,26 +195,6 @@ public function setAttributes(array $attributes) return $this; } - /** - * Set attribs for image tag - * - * @deprecated Please use Laminas\View\Helper\Gravatar::setAttributes - * - * @param array $attribs - * @return Gravatar - */ - public function setAttribs(array $attribs) - { - trigger_error(sprintf( - '%s is deprecated; please use %s::setAttributes', - __METHOD__, - self::class - ), E_USER_DEPRECATED); - - $this->setAttributes($attribs); - return $this; - } - /** * Get attributes of image * @@ -233,29 +210,6 @@ public function getAttributes() return $this->attributes; } - /** - * Get attribs of image - * - * Warning! - * If you set src attrib, you get it, but this value will be overwritten in - * protected method setSrcAttribForImg(). And finally your get other src - * value! - * - * @deprecated Please use Laminas\View\Helper\Gravatar::getAttributes - * - * @return array - */ - public function getAttribs() - { - trigger_error(sprintf( - '%s is deprecated; please use %s::getAttributes', - __METHOD__, - self::class - ), E_USER_DEPRECATED); - - return $this->getAttributes(); - } - /** * Set default img * diff --git a/src/Helper/HtmlFlash.php b/src/Helper/HtmlFlash.php deleted file mode 100644 index 0354a28b6..000000000 --- a/src/Helper/HtmlFlash.php +++ /dev/null @@ -1,33 +0,0 @@ - $data, 'quality' => 'high'], $params); - - $htmlObject = $this->getView()->plugin('htmlObject'); - return $htmlObject($data, self::TYPE, $attribs, $params, $content); - } -} diff --git a/src/Helper/HtmlQuicktime.php b/src/Helper/HtmlQuicktime.php deleted file mode 100644 index b33aa8d2c..000000000 --- a/src/Helper/HtmlQuicktime.php +++ /dev/null @@ -1,54 +0,0 @@ - self::ATTRIB_CLASSID, 'codebase' => self::ATTRIB_CODEBASE]; - - /** - * Output a quicktime movie object tag - * - * @param string $data The quicktime file - * @param array $attribs Attribs for the object tag - * @param array $params Params for in the object tag - * @param string $content Alternative content - * @return string - */ - public function __invoke($data, array $attribs = [], array $params = [], $content = null) - { - // Attrs - $attribs = array_merge($this->attribs, $attribs); - - // Params - $params = array_merge(['src' => $data], $params); - - $htmlObject = $this->getView()->plugin('htmlObject'); - return $htmlObject($data, self::TYPE, $attribs, $params, $content); - } -} diff --git a/src/Helper/Identity.php b/src/Helper/Identity.php index fde997743..6a5ed5150 100644 --- a/src/Helper/Identity.php +++ b/src/Helper/Identity.php @@ -10,12 +10,9 @@ /** * View helper plugin to fetch the authenticated identity. */ -class Identity extends AbstractHelper +final class Identity { - use DeprecatedAbstractHelperHierarchyTrait; - - /** @var AuthenticationServiceInterface|null */ - protected $authenticationService; + private ?AuthenticationServiceInterface $authenticationService; public function __construct(?AuthenticationServiceInterface $authenticationService = null) { @@ -28,6 +25,7 @@ public function __construct(?AuthenticationServiceInterface $authenticationServi * If none available, returns null. * * @return mixed|null + * @throws RuntimeException If the helper was not configured with an Authentication Service. */ public function __invoke() { @@ -40,32 +38,4 @@ public function __invoke() ? $service->getIdentity() : null; } - - /** - * Set AuthenticationService instance - * - * @deprecated since >= 2.20.0. The authentication service should be provided to the constructor. This method will - * be removed in version 3.0 of this component - * - * @return $this - */ - public function setAuthenticationService(AuthenticationServiceInterface $authenticationService) - { - $this->authenticationService = $authenticationService; - - return $this; - } - - /** - * Get AuthenticationService instance - * - * @deprecated since >= 2.20.0. The authentication service should be provided to the constructor. This method will - * be removed in version 3.0 of this component - * - * @return null|object - */ - public function getAuthenticationService() - { - return $this->authenticationService; - } } diff --git a/src/Helper/Json.php b/src/Helper/Json.php index e54a66fe8..542119922 100644 --- a/src/Helper/Json.php +++ b/src/Helper/Json.php @@ -5,11 +5,11 @@ namespace Laminas\View\Helper; use Laminas\Http\Response; -use Laminas\Json\Json as JsonFormatter; -use function trigger_error; +use function json_encode; -use const E_USER_DEPRECATED; +use const JSON_PRETTY_PRINT; +use const JSON_THROW_ON_ERROR; /** * Helper for simplifying JSON responses @@ -24,7 +24,7 @@ class Json extends AbstractHelper /** * @deprecated since >= 2.20.0 * - * @var Response + * @var Response|null */ protected $response; @@ -32,19 +32,12 @@ class Json extends AbstractHelper * Encode data as JSON and set response header * * @param mixed $data - * @param array $jsonOptions Options to pass to JsonFormatter::encode() - * @return string|void + * @param array{prettyPrint?: bool} $jsonOptions Options to pass to JsonFormatter::encode() + * @return string */ public function __invoke($data, array $jsonOptions = []) { - if (isset($jsonOptions['enableJsonExprFinder']) && $jsonOptions['enableJsonExprFinder'] === true) { - trigger_error( - 'Json Expression functionality is deprecated and will be removed in laminas-view 3.0', - E_USER_DEPRECATED - ); - } - - $data = JsonFormatter::encode($data, null, $jsonOptions); + $data = json_encode($data, $this->optionsToFlags($jsonOptions)); if ($this->response instanceof Response) { $headers = $this->response->getHeaders(); @@ -54,6 +47,16 @@ public function __invoke($data, array $jsonOptions = []) return $data; } + /** @param array{prettyPrint?: bool} $options */ + private function optionsToFlags(array $options = []): int + { + $prettyPrint = $options['prettyPrint'] ?? false; + $flags = JSON_THROW_ON_ERROR; + $flags |= $prettyPrint ? 0 : JSON_PRETTY_PRINT; + + return $flags; + } + /** * Set the response object * diff --git a/src/Helper/Navigation/PluginManager.php b/src/Helper/Navigation/PluginManager.php index a4f4a2a6c..d24c3d8ea 100644 --- a/src/Helper/Navigation/PluginManager.php +++ b/src/Helper/Navigation/PluginManager.php @@ -35,18 +35,6 @@ class PluginManager extends HelperPluginManager 'links' => Links::class, 'menu' => Menu::class, 'sitemap' => Sitemap::class, - - // Legacy Zend Framework aliases - 'Zend\View\Helper\Navigation\Breadcrumbs' => Breadcrumbs::class, - 'Zend\View\Helper\Navigation\Links' => Links::class, // phpcs:ignore - 'Zend\View\Helper\Navigation\Menu' => Menu::class, - 'Zend\View\Helper\Navigation\Sitemap' => Sitemap::class, - - // v2 normalized FQCNs - 'zendviewhelpernavigationbreadcrumbs' => Breadcrumbs::class, - 'zendviewhelpernavigationlinks' => Links::class, - 'zendviewhelpernavigationmenu' => Menu::class, - 'zendviewhelpernavigationsitemap' => Sitemap::class, ]; /** diff --git a/src/Helper/Placeholder.php b/src/Helper/Placeholder.php index a747668c8..4adec763f 100644 --- a/src/Helper/Placeholder.php +++ b/src/Helper/Placeholder.php @@ -37,14 +37,15 @@ class Placeholder extends AbstractHelper * * @param string $name * @throws InvalidArgumentException - * @return AbstractContainer + * @return AbstractContainer|self + * @psalm-template T of string|null + * @psalm-param T $name + * @psalm-return (T is null ? self : AbstractContainer) */ public function __invoke($name = null) { if ($name === null) { - throw new InvalidArgumentException( - 'Placeholder: missing argument. $name is required by placeholder($name)' - ); + return $this; } return $this->getContainer((string) $name); diff --git a/src/Helper/Placeholder/Registry.php b/src/Helper/Placeholder/Registry.php index 4180fdacb..cbd7cc303 100644 --- a/src/Helper/Placeholder/Registry.php +++ b/src/Helper/Placeholder/Registry.php @@ -12,9 +12,6 @@ use function class_parents; use function in_array; use function sprintf; -use function trigger_error; - -use const E_USER_DEPRECATED; /** * Registry for placeholder containers @@ -45,34 +42,6 @@ class Registry */ protected $items = []; - /** - * Retrieve or create registry instance - * - * @return Registry - */ - public static function getRegistry() - { - trigger_error('Placeholder view helpers should no longer use a singleton registry', E_USER_DEPRECATED); - if (null === static::$instance) { - static::$instance = new static(); - } - - return static::$instance; - } - - /** - * Unset the singleton - * - * Primarily useful for testing purposes; sets {@link $instance} to null. - * - * @return void - */ - public static function unsetRegistry() - { - trigger_error('Placeholder view helpers should no longer use a singleton registry', E_USER_DEPRECATED); - static::$instance = null; - } - /** * Set the container for an item in the registry * diff --git a/src/Helper/Service/AssetFactory.php b/src/Helper/Service/AssetFactory.php index aecd3eb7a..99658c8a1 100644 --- a/src/Helper/Service/AssetFactory.php +++ b/src/Helper/Service/AssetFactory.php @@ -4,11 +4,9 @@ namespace Laminas\View\Helper\Service; -use Interop\Container\ContainerInterface; // phpcs:ignore -use Laminas\ServiceManager\FactoryInterface; -use Laminas\ServiceManager\ServiceLocatorInterface; -use Laminas\View\Exception; +use Laminas\View\Exception\RuntimeException; use Laminas\View\Helper\Asset; +use Psr\Container\ContainerInterface; use Traversable; use function gettype; @@ -16,19 +14,12 @@ use function iterator_to_array; use function sprintf; -/** - * @final - * @psalm-suppress DeprecatedInterface Compatibility with Service Manager 2 should be removed in version 3.0. - */ -class AssetFactory implements FactoryInterface +final class AssetFactory { /** - * @param string $name - * @param null|array $options - * @return Asset - * @throws Exception\RuntimeException + * @throws RuntimeException */ - public function __invoke(ContainerInterface $container, $name, ?array $options = null) + public function __invoke(ContainerInterface $container): Asset { /** @psalm-var mixed $config */ $config = $container->get('config'); @@ -44,21 +35,6 @@ public function __invoke(ContainerInterface $container, $name, ?array $options = return new Asset($resourceMap); } - /** - * Create service - * - * @deprecated since 2.20.0, this method will be removed in version 3.0.0 of this component. - * Compatibility with the 2.x series of Laminas\ServiceManager is no longer supported. - * - * @param string|null $rName - * @param string|null $cName - * @return Asset - */ - public function createService(ServiceLocatorInterface $serviceLocator, $rName = null, $cName = null) - { - return $this($serviceLocator, $cName); - } - /** * @param array $array * @return array @@ -67,7 +43,7 @@ private function assertArray(string $key, array $array): array { $value = $array[$key] ?? []; if (! is_array($value)) { - throw new Exception\RuntimeException(sprintf( + throw new RuntimeException(sprintf( 'Invalid resource map configuration. ' . 'Expected the key "%s" to contain an array value but received "%s"', $key, diff --git a/src/Helper/Service/FlashMessengerFactory.php b/src/Helper/Service/FlashMessengerFactory.php deleted file mode 100644 index 2ca9b88e4..000000000 --- a/src/Helper/Service/FlashMessengerFactory.php +++ /dev/null @@ -1,57 +0,0 @@ -get('ControllerPluginManager'); - $flashMessenger = $controllerPluginManager->get('flashmessenger'); - - $helper->setPluginFlashMessenger($flashMessenger); - - $config = $container->get('config'); - if (isset($config['view_helper_config']['flashmessenger'])) { - $configHelper = $config['view_helper_config']['flashmessenger']; - if (isset($configHelper['message_open_format'])) { - $helper->setMessageOpenFormat($configHelper['message_open_format']); - } - if (isset($configHelper['message_separator_string'])) { - $helper->setMessageSeparatorString($configHelper['message_separator_string']); - } - if (isset($configHelper['message_close_string'])) { - $helper->setMessageCloseString($configHelper['message_close_string']); - } - } - - return $helper; - } - - /** - * Create service (v2) - * - * @param string $normalizedName - * @param string $requestedName - * @return FlashMessenger - */ - public function createService(ServiceLocatorInterface $container, $normalizedName = null, $requestedName = null) - { - return $this($container, $requestedName); - } -} diff --git a/src/Helper/Service/IdentityFactory.php b/src/Helper/Service/IdentityFactory.php index f45645423..6962fbae4 100644 --- a/src/Helper/Service/IdentityFactory.php +++ b/src/Helper/Service/IdentityFactory.php @@ -4,62 +4,34 @@ namespace Laminas\View\Helper\Service; -use Interop\Container\ContainerInterface; // phpcs:ignore use Laminas\Authentication\AuthenticationService; use Laminas\Authentication\AuthenticationServiceInterface; -use Laminas\ServiceManager\FactoryInterface; -use Laminas\ServiceManager\ServiceLocatorInterface; use Laminas\View\Helper\Identity; +use Psr\Container\ContainerInterface; -/** - * @psalm-suppress DeprecatedInterface - */ -class IdentityFactory implements FactoryInterface +use function assert; + +final class IdentityFactory { - /** - * @param string|null $name - * @param array|null $options - * @return Identity - */ - public function __invoke(ContainerInterface $container, $name, ?array $options = null) + public function __invoke(ContainerInterface $container): Identity { return new Identity($this->discoverAuthenticationService($container)); } - /** - * Create service - * - * @param string|null $rName - * @param string|null $cName - * @return Identity - */ - public function createService(ServiceLocatorInterface $serviceLocator, $rName = null, $cName = null) - { - return $this($serviceLocator, $cName); - } - private function discoverAuthenticationService(ContainerInterface $container): ?AuthenticationServiceInterface { - // phpcs:disable WebimpressCodingStandard.Formatting.StringClassReference - $search = [ - AuthenticationService::class, - AuthenticationServiceInterface::class, - 'Zend\Authentication\AuthenticationService', - 'Zend\Authentication\AuthenticationServiceInterface', - ]; - // phpcs:enable + if ($container->has(AuthenticationService::class)) { + $service1 = $container->get(AuthenticationService::class); + assert($service1 instanceof AuthenticationServiceInterface); - foreach ($search as $id) { - if (! $container->has($id)) { - continue; - } + return $service1; + } - $service = $container->get($id); - if (! $service instanceof AuthenticationServiceInterface) { - continue; - } + if ($container->has(AuthenticationServiceInterface::class)) { + $service2 = $container->get(AuthenticationServiceInterface::class); + assert($service2 instanceof AuthenticationServiceInterface); - return $service; + return $service2; } return null; diff --git a/src/HelperPluginManager.php b/src/HelperPluginManager.php index 607b2f546..3d9b09469 100644 --- a/src/HelperPluginManager.php +++ b/src/HelperPluginManager.php @@ -73,9 +73,6 @@ class HelperPluginManager extends AbstractPluginManager 'escapeUrl' => Helper\EscapeUrl::class, 'EscapeUrl' => Helper\EscapeUrl::class, 'escapeurl' => Helper\EscapeUrl::class, - 'flashmessenger' => Helper\FlashMessenger::class, - 'flashMessenger' => Helper\FlashMessenger::class, - 'FlashMessenger' => Helper\FlashMessenger::class, 'Gravatar' => Helper\Gravatar::class, 'gravatar' => Helper\Gravatar::class, 'gravatarImage' => Helper\GravatarImage::class, @@ -97,9 +94,6 @@ class HelperPluginManager extends AbstractPluginManager 'htmlattributes' => Helper\HtmlAttributes::class, 'htmlAttributes' => Helper\HtmlAttributes::class, 'HtmlAttributes' => Helper\HtmlAttributes::class, - 'htmlflash' => Helper\HtmlFlash::class, - 'htmlFlash' => Helper\HtmlFlash::class, - 'HtmlFlash' => Helper\HtmlFlash::class, 'htmllist' => Helper\HtmlList::class, 'htmlList' => Helper\HtmlList::class, 'HtmlList' => Helper\HtmlList::class, @@ -109,9 +103,6 @@ class HelperPluginManager extends AbstractPluginManager 'htmlpage' => Helper\HtmlPage::class, 'htmlPage' => Helper\HtmlPage::class, 'HtmlPage' => Helper\HtmlPage::class, - 'htmlquicktime' => Helper\HtmlQuicktime::class, - 'htmlQuicktime' => Helper\HtmlQuicktime::class, - 'HtmlQuicktime' => Helper\HtmlQuicktime::class, 'htmltag' => Helper\HtmlTag::class, 'htmlTag' => Helper\HtmlTag::class, 'HtmlTag' => Helper\HtmlTag::class, @@ -150,88 +141,6 @@ class HelperPluginManager extends AbstractPluginManager 'viewmodel' => Helper\ViewModel::class, 'viewModel' => Helper\ViewModel::class, 'ViewModel' => Helper\ViewModel::class, - - /** - * Legacy Zend Framework aliases - * - * @psalm-suppress DeprecatedClass - * @codingStandardsIgnoreStart - **/ - 'Zend\View\Helper\Asset' => Helper\Asset::class, - 'Zend\View\Helper\FlashMessenger' => Helper\FlashMessenger::class, - 'Zend\View\Helper\Identity' => Helper\Identity::class, - 'Zend\View\Helper\BasePath' => Helper\BasePath::class, - 'Zend\View\Helper\Cycle' => Helper\Cycle::class, - 'Zend\View\Helper\DeclareVars' => Helper\DeclareVars::class, - 'Zend\View\Helper\Doctype' => Helper\Doctype::class, - 'Zend\View\Helper\EscapeHtml' => Helper\EscapeHtml::class, - 'Zend\View\Helper\EscapeHtmlAttr' => Helper\EscapeHtmlAttr::class, - 'Zend\View\Helper\EscapeJs' => Helper\EscapeJs::class, - 'Zend\View\Helper\EscapeCss' => Helper\EscapeCss::class, - 'Zend\View\Helper\EscapeUrl' => Helper\EscapeUrl::class, - 'Zend\View\Helper\Gravatar' => Helper\Gravatar::class, - 'Zend\View\Helper\HtmlTag' => Helper\HtmlTag::class, - 'Zend\View\Helper\HeadLink' => Helper\HeadLink::class, - 'Zend\View\Helper\HeadMeta' => Helper\HeadMeta::class, - 'Zend\View\Helper\HeadScript' => Helper\HeadScript::class, - 'Zend\View\Helper\HeadStyle' => Helper\HeadStyle::class, - 'Zend\View\Helper\HeadTitle' => Helper\HeadTitle::class, - 'Zend\View\Helper\HtmlFlash' => Helper\HtmlFlash::class, - 'Zend\View\Helper\HtmlList' => Helper\HtmlList::class, - 'Zend\View\Helper\HtmlObject' => Helper\HtmlObject::class, - 'Zend\View\Helper\HtmlPage' => Helper\HtmlPage::class, - 'Zend\View\Helper\HtmlQuicktime' => Helper\HtmlQuicktime::class, - 'Zend\View\Helper\InlineScript' => Helper\InlineScript::class, - 'Zend\View\Helper\Json' => Helper\Json::class, - 'Zend\View\Helper\Layout' => Helper\Layout::class, - 'Zend\View\Helper\PaginationControl' => Helper\PaginationControl::class, - 'Zend\View\Helper\PartialLoop' => Helper\PartialLoop::class, - 'Zend\View\Helper\Partial' => Helper\Partial::class, - 'Zend\View\Helper\Placeholder' => Helper\Placeholder::class, - 'Zend\View\Helper\RenderChildModel' => Helper\RenderChildModel::class, - 'Zend\View\Helper\RenderToPlaceholder' => Helper\RenderToPlaceholder::class, - 'Zend\View\Helper\ServerUrl' => Helper\ServerUrl::class, - 'Zend\View\Helper\Url' => Helper\Url::class, - 'Zend\View\Helper\ViewModel' => Helper\ViewModel::class, - // @codingStandardsIgnoreEnd - - // v2 normalized FQCNs - 'zendviewhelperasset' => Helper\Asset::class, - 'zendviewhelperflashmessenger' => Helper\FlashMessenger::class, - 'zendviewhelperidentity' => Helper\Identity::class, - 'zendviewhelperbasepath' => Helper\BasePath::class, - 'zendviewhelpercycle' => Helper\Cycle::class, - 'zendviewhelperdeclarevars' => Helper\DeclareVars::class, - 'zendviewhelperdoctype' => Helper\Doctype::class, - 'zendviewhelperescapehtml' => Helper\EscapeHtml::class, - 'zendviewhelperescapehtmlattr' => Helper\EscapeHtmlAttr::class, - 'zendviewhelperescapejs' => Helper\EscapeJs::class, - 'zendviewhelperescapecss' => Helper\EscapeCss::class, - 'zendviewhelperescapeurl' => Helper\EscapeUrl::class, - 'zendviewhelpergravatar' => Helper\Gravatar::class, - 'zendviewhelperhtmltag' => Helper\HtmlTag::class, - 'zendviewhelperheadlink' => Helper\HeadLink::class, - 'zendviewhelperheadmeta' => Helper\HeadMeta::class, - 'zendviewhelperheadscript' => Helper\HeadScript::class, - 'zendviewhelperheadstyle' => Helper\HeadStyle::class, - 'zendviewhelperheadtitle' => Helper\HeadTitle::class, - 'zendviewhelperhtmlflash' => Helper\HtmlFlash::class, - 'zendviewhelperhtmllist' => Helper\HtmlList::class, - 'zendviewhelperhtmlobject' => Helper\HtmlObject::class, - 'zendviewhelperhtmlpage' => Helper\HtmlPage::class, - 'zendviewhelperhtmlquicktime' => Helper\HtmlQuicktime::class, - 'zendviewhelperinlinescript' => Helper\InlineScript::class, - 'zendviewhelperjson' => Helper\Json::class, - 'zendviewhelperlayout' => Helper\Layout::class, - 'zendviewhelperpaginationcontrol' => Helper\PaginationControl::class, - 'zendviewhelperpartialloop' => Helper\PartialLoop::class, - 'zendviewhelperpartial' => Helper\Partial::class, - 'zendviewhelperplaceholder' => Helper\Placeholder::class, - 'zendviewhelperrenderchildmodel' => Helper\RenderChildModel::class, - 'zendviewhelperrendertoplaceholder' => Helper\RenderToPlaceholder::class, - 'zendviewhelperserverurl' => Helper\ServerUrl::class, - 'zendviewhelperurl' => Helper\Url::class, - 'zendviewhelperviewmodel' => Helper\ViewModel::class, ]; /** @@ -249,7 +158,6 @@ class HelperPluginManager extends AbstractPluginManager protected $factories = [ Helper\Asset::class => Helper\Service\AssetFactory::class, Helper\HtmlAttributes::class => Helper\Service\HtmlAttributesFactory::class, - Helper\FlashMessenger::class => Helper\Service\FlashMessengerFactory::class, Helper\Identity::class => Helper\Service\IdentityFactory::class, Helper\BasePath::class => Helper\Service\BasePathFactory::class, Helper\Cycle::class => InvokableFactory::class, @@ -269,11 +177,9 @@ class HelperPluginManager extends AbstractPluginManager Helper\HeadScript::class => InvokableFactory::class, Helper\HeadStyle::class => InvokableFactory::class, Helper\HeadTitle::class => InvokableFactory::class, - Helper\HtmlFlash::class => InvokableFactory::class, Helper\HtmlList::class => InvokableFactory::class, Helper\HtmlObject::class => InvokableFactory::class, Helper\HtmlPage::class => InvokableFactory::class, - Helper\HtmlQuicktime::class => InvokableFactory::class, Helper\InlineScript::class => InvokableFactory::class, Helper\Json::class => InvokableFactory::class, Helper\Layout::class => InvokableFactory::class, @@ -290,7 +196,6 @@ class HelperPluginManager extends AbstractPluginManager // v2 canonical FQCNs 'laminasviewhelperasset' => Helper\Service\AssetFactory::class, 'laminasviewhelperattributes' => InvokableFactory::class, - 'laminasviewhelperflashmessenger' => Helper\Service\FlashMessengerFactory::class, 'laminasviewhelperidentity' => Helper\Service\IdentityFactory::class, 'laminasviewhelperbasepath' => InvokableFactory::class, 'laminasviewhelpercycle' => InvokableFactory::class, @@ -308,11 +213,9 @@ class HelperPluginManager extends AbstractPluginManager 'laminasviewhelperheadscript' => InvokableFactory::class, 'laminasviewhelperheadstyle' => InvokableFactory::class, 'laminasviewhelperheadtitle' => InvokableFactory::class, - 'laminasviewhelperhtmlflash' => InvokableFactory::class, 'laminasviewhelperhtmllist' => InvokableFactory::class, 'laminasviewhelperhtmlobject' => InvokableFactory::class, 'laminasviewhelperhtmlpage' => InvokableFactory::class, - 'laminasviewhelperhtmlquicktime' => InvokableFactory::class, 'laminasviewhelperinlinescript' => InvokableFactory::class, 'laminasviewhelperjson' => InvokableFactory::class, 'laminasviewhelperlayout' => InvokableFactory::class, diff --git a/src/Model/ConsoleModel.php b/src/Model/ConsoleModel.php deleted file mode 100644 index 4edfc1b09..000000000 --- a/src/Model/ConsoleModel.php +++ /dev/null @@ -1,73 +0,0 @@ -options['errorLevel'] = $errorLevel; - return $this; - } - - /** - * @return int - */ - public function getErrorLevel() - { - if (array_key_exists('errorLevel', $this->options)) { - return $this->options['errorLevel']; - } - } - - /** - * Set result text. - * - * @param string $text - * @return ConsoleModel - */ - public function setResult($text) - { - $this->setVariable(self::RESULT, $text); - return $this; - } - - /** - * Get result text. - * - * @return mixed - */ - public function getResult() - { - return $this->getVariable(self::RESULT); - } -} diff --git a/src/Model/JsonModel.php b/src/Model/JsonModel.php index 186942003..365a8e770 100644 --- a/src/Model/JsonModel.php +++ b/src/Model/JsonModel.php @@ -4,10 +4,16 @@ namespace Laminas\View\Model; -use Laminas\Json\Json; +use JsonException; use Laminas\Stdlib\ArrayUtils; +use Laminas\View\Exception\DomainException; use Traversable; +use function json_encode; + +use const JSON_PRETTY_PRINT; +use const JSON_THROW_ON_ERROR; + class JsonModel extends ViewModel { /** @@ -56,13 +62,21 @@ public function serialize() $variables = ArrayUtils::iteratorToArray($variables); } - $options = [ - 'prettyPrint' => $this->getOption('prettyPrint'), - ]; + $options = (bool) $this->getOption('prettyPrint', false) ? JSON_PRETTY_PRINT : 0; if (null !== $this->jsonpCallback) { - return $this->jsonpCallback . '(' . Json::encode($variables, false, $options) . ');'; + return $this->jsonpCallback . '(' . $this->jsonEncode($variables, $options) . ');'; + } + return $this->jsonEncode($variables, $options); + } + + /** @param mixed $data */ + private function jsonEncode($data, int $options): string + { + try { + return json_encode($data, $options | JSON_THROW_ON_ERROR); + } catch (JsonException $e) { + throw new DomainException('Failed to encode Json', $e->getCode(), $e); } - return Json::encode($variables, false, $options); } } diff --git a/src/Renderer/ConsoleRenderer.php b/src/Renderer/ConsoleRenderer.php deleted file mode 100644 index da4eb946b..000000000 --- a/src/Renderer/ConsoleRenderer.php +++ /dev/null @@ -1,145 +0,0 @@ -init(); - } - - /** @return $this */ - public function setResolver(ResolverInterface $resolver) - { - return $this; - } - - /** - * Return the template engine object - * - * Returns the object instance, as it is its own template engine - * - * @return ConsoleRenderer - */ - public function getEngine() - { - return $this; - } - - /** - * Allow custom object initialization when extending ConsoleRenderer - * - * Triggered by {@link __construct() the constructor} as its final action. - * - * @return void - */ - public function init() - { - } - - /** - * Set filter chain - * - * @return ConsoleRenderer - */ - public function setFilterChain(FilterChain $filters) - { - $this->__filterChain = $filters; - return $this; - } - - /** - * Retrieve filter chain for post-filtering script content - * - * @return FilterChain - */ - public function getFilterChain() - { - if (null === $this->__filterChain) { - $this->__filterChain = new FilterChain(); - } - return $this->__filterChain; - } - - /** - * Recursively processes all ViewModels and returns output. - * - * @param string|ModelInterface $model A ViewModel instance. - * @param null|array|Traversable $values Values to use when rendering. If none - * provided, uses those in the composed - * variables container. - * @return string Console output. - */ - public function render($model, $values = null) - { - if (! $model instanceof ModelInterface) { - return ''; - } - - $result = ''; - $options = $model->getOptions(); - foreach ($options as $setting => $value) { - $method = 'set' . $setting; - if (method_exists($this, $method)) { - $this->$method($value); - } - unset($method, $setting, $value); - } - unset($options); - - $values = $model->getVariables(); - - if (isset($values['result'])) { - // filter and append the result - $result .= $this->getFilterChain()->filter($values['result']); - } - - if ($model->hasChildren()) { - // recursively render all children - foreach ($model->getChildren() as $child) { - $result .= $this->render($child, $values); - } - } - - return $result; - } - - /** - * @see \Laminas\View\Renderer\TreeRendererInterface - * - * @return bool - */ - public function canRenderTrees() - { - return true; - } -} diff --git a/src/Renderer/JsonRenderer.php b/src/Renderer/JsonRenderer.php index ecc9b115f..a55bd4767 100644 --- a/src/Renderer/JsonRenderer.php +++ b/src/Renderer/JsonRenderer.php @@ -5,8 +5,8 @@ namespace Laminas\View\Renderer; use ArrayAccess; +use JsonException; use JsonSerializable; -use Laminas\Json\Json; use Laminas\Stdlib\ArrayUtils; use Laminas\View\Exception; use Laminas\View\Model\JsonModel; @@ -18,8 +18,11 @@ use function array_replace_recursive; use function get_object_vars; use function is_object; +use function json_encode; use function sprintf; +use const JSON_THROW_ON_ERROR; + /** * JSON renderer */ @@ -60,11 +63,13 @@ public function getEngine() * Set the resolver used to map a template name to a resource the renderer may consume. * * @todo Determine use case for resolvers when rendering JSON - * @return void + * @return self */ public function setResolver(Resolver $resolver) { $this->resolver = $resolver; + + return $this; } /** @@ -131,28 +136,27 @@ public function render($nameOrModel, $values = null) if ($nameOrModel instanceof JsonModel) { $children = $this->recurseModel($nameOrModel, false); $this->injectChildren($nameOrModel, $children); - $values = $nameOrModel->serialize(); + $output = $nameOrModel->serialize(); } else { - $values = $this->recurseModel($nameOrModel); - $values = Json::encode($values); + $output = $this->recurseModel($nameOrModel); + $output = $this->jsonEncode($output); } if ($this->hasJsonpCallback()) { - $values = $this->jsonpCallback . '(' . $values . ');'; + $output = $this->jsonpCallback . '(' . $output . ');'; } - return $values; + return $output; } // use case 2: $nameOrModel is populated, $values is not // Serialize $nameOrModel if (null === $values) { if (! is_object($nameOrModel) || $nameOrModel instanceof JsonSerializable) { - $return = Json::encode($nameOrModel); + $return = $this->jsonEncode($nameOrModel); } elseif ($nameOrModel instanceof Traversable) { - $nameOrModel = ArrayUtils::iteratorToArray($nameOrModel); - $return = Json::encode($nameOrModel); + $return = $this->jsonEncode(ArrayUtils::iteratorToArray($nameOrModel)); } else { - $return = Json::encode(get_object_vars($nameOrModel)); + $return = $this->jsonEncode(get_object_vars($nameOrModel)); } if ($this->hasJsonpCallback()) { @@ -237,4 +241,14 @@ protected function injectChildren(Model $model, array $children): void $model->setVariable($child, $value); } } + + /** @param mixed $data */ + private function jsonEncode($data): string + { + try { + return json_encode($data, JSON_THROW_ON_ERROR); + } catch (JsonException $e) { + throw new Exception\DomainException('Json encoding failed', $e->getCode(), $e); + } + } } diff --git a/src/Renderer/PhpRenderer.php b/src/Renderer/PhpRenderer.php index b328b9a75..336a0d586 100644 --- a/src/Renderer/PhpRenderer.php +++ b/src/Renderer/PhpRenderer.php @@ -55,7 +55,6 @@ * @method mixed escapeHtmlAttr($value, $recurse = \Laminas\View\Helper\Escaper\AbstractHelper::RECURSE_NONE) * @method mixed escapeJs($value, $recurse = \Laminas\View\Helper\Escaper\AbstractHelper::RECURSE_NONE) * @method mixed escapeUrl($value, $recurse = \Laminas\View\Helper\Escaper\AbstractHelper::RECURSE_NONE) - * @method \Laminas\View\Helper\FlashMessenger flashMessenger($namespace = null) * @method \Laminas\View\Helper\Gravatar gravatar($email = "", $options = array(), $attribs = array()) * @method \Laminas\View\Helper\HeadLink headLink(array $attributes = null, $placement = \Laminas\View\Helper\Placeholder\Container\AbstractContainer::APPEND) * @method \Laminas\View\Helper\HeadMeta headMeta($content = null, $keyValue = null, $keyType = 'name', $modifiers = array(), $placement = \Laminas\View\Helper\Placeholder\Container\AbstractContainer::APPEND) @@ -63,11 +62,9 @@ * @method \Laminas\View\Helper\HeadStyle headStyle($content = null, $placement = 'APPEND', $attributes = array()) * @method \Laminas\View\Helper\HeadTitle headTitle($title = null, $setType = null) * @method \Laminas\View\HtmlAttributesSet htmlAttributes(iterable $attributes = []) - * @method string htmlFlash($data, array $attribs = array(), array $params = array(), $content = null) * @method string htmlList(array $items, $ordered = false, $attribs = false, $escape = true) * @method string htmlObject($data = null, $type = null, array $attribs = array(), array $params = array(), $content = null) * @method string htmlPage($data, array $attribs = array(), array $params = array(), $content = null) - * @method string htmlQuicktime($data, array $attribs = array(), array $params = array(), $content = null) * @method mixed|null identity() * @method \Laminas\View\Helper\InlineScript inlineScript($mode = \Laminas\View\Helper\HeadScript::FILE, $spec = null, $placement = 'APPEND', array $attrs = array(), $type = 'text/javascript') * @method string|void json($data, array $jsonOptions = array()) diff --git a/src/Resolver/TemplatePathStack.php b/src/Resolver/TemplatePathStack.php index 6ddeb1f06..7a7e64ebb 100644 --- a/src/Resolver/TemplatePathStack.php +++ b/src/Resolver/TemplatePathStack.php @@ -8,7 +8,6 @@ use Laminas\Stdlib\SplStack; use Laminas\View\Exception; use Laminas\View\Renderer\RendererInterface as Renderer; -use Laminas\View\Stream; use SplFileInfo; use Traversable; @@ -16,8 +15,6 @@ use function count; use function file_exists; use function gettype; -use function in_array; -use function ini_get; use function is_array; use function is_object; use function is_string; @@ -26,8 +23,6 @@ use function preg_match; use function rtrim; use function sprintf; -use function stream_get_wrappers; -use function stream_wrapper_register; use function strpos; use const DIRECTORY_SEPARATOR; @@ -80,36 +75,11 @@ class TemplatePathStack implements ResolverInterface */ protected $lfiProtectionOn = true; - /**@+ - * Flags used to determine if a stream wrapper should be used for enabling short tags - */ - - /** - * @deprecated Stream wrapper functionality will be removed in version 3.0 of this component - * - * @var bool - */ - protected $useViewStream = false; - /** - * @deprecated Stream wrapper functionality will be removed in version 3.0 of this component - * - * @var bool - */ - protected $useStreamWrapper = false; - /**@-*/ /** @param null|Options|Traversable $options */ public function __construct($options = null) { - $this->useViewStream = (bool) ini_get('short_open_tag'); - if ($this->useViewStream) { - if (! in_array('laminas.view', stream_get_wrappers())) { - /** @psalm-suppress DeprecatedClass */ - stream_wrapper_register('laminas.view', Stream::class); - } - } - /** @psalm-var PathStack $paths */ $paths = new SplStack(); $this->paths = $paths; @@ -146,10 +116,6 @@ public function setOptions($options) $this->addPaths($options['script_paths']); } - if (isset($options['use_stream_wrapper'])) { - $this->setUseStreamWrapper($options['use_stream_wrapper']); - } - if (isset($options['default_suffix'])) { $this->setDefaultSuffix($options['default_suffix']); } @@ -297,35 +263,6 @@ public function isLfiProtectionOn() return $this->lfiProtectionOn; } - /** - * Set flag indicating if stream wrapper should be used if short_open_tag is off - * - * @deprecated will be removed in version 3 - * - * @param bool $flag - * @return TemplatePathStack - */ - public function setUseStreamWrapper($flag) - { - $this->useStreamWrapper = (bool) $flag; - return $this; - } - - /** - * Should the stream wrapper be used if short_open_tag is off? - * - * Returns true if the use_stream_wrapper flag is set, and if short_open_tag - * is disabled. - * - * @deprecated will be removed in version 3 - * - * @return bool - */ - public function useStreamWrapper() - { - return $this->useViewStream && $this->useStreamWrapper; - } - /** * Retrieve the filesystem path to a view script * @@ -366,11 +303,7 @@ public function resolve($name, ?Renderer $renderer = null) break; } } - /** @psalm-suppress DeprecatedMethod */ - if ($this->useStreamWrapper()) { - // If using a stream wrapper, prepend the spec to the path - $filePath = 'laminas.view://' . $filePath; - } + return $filePath; } } diff --git a/src/Stream.php b/src/Stream.php deleted file mode 100644 index b0829c232..000000000 --- a/src/Stream.php +++ /dev/null @@ -1,204 +0,0 @@ - and ) should be used - */ -class Stream -{ - /** - * Current stream position. - * - * @var int - */ - protected $pos = 0; - - /** - * Data for streaming. - * - * @var string - */ - protected $data; - - /** - * Stream stats. - * - * @var array - */ - protected $stat; - - /** - * Opens the script file and converts markup. - * - * @param string $path - * @param $mode - * @param $options - * @param $opened_path - * @return bool - */ - // @codingStandardsIgnoreStart - public function stream_open($path, $mode, $options, &$opened_path) - { - // @codingStandardsIgnoreEnd - // get the view script source - $path = str_replace('laminas.view://', '', $path); - $this->data = file_get_contents($path); - - /** - * If reading the file failed, update our local stat store - * to reflect the real stat of the file, then return on failure - */ - if ($this->data === false) { - $this->stat = stat($path); - return false; - } - - /** - * Convert to long-form and to - */ - $this->data = preg_replace('/\<\?\=/', "data); - $this->data = preg_replace('/<\?(?!xml|php)/s', 'data); - - /** - * file_get_contents() won't update PHP's stat cache, so we grab a stat - * of the file to prevent additional reads should the script be - * requested again, which will make include() happy. - */ - $this->stat = stat($path); - - return true; - } - - /** - * Included so that __FILE__ returns the appropriate info - * - * @return array - */ - // @codingStandardsIgnoreStart - public function url_stat() - { - // @codingStandardsIgnoreEnd - return $this->stat; - } - - /** - * Reads from the stream. - * - * @param int $count - * @return string - */ - // @codingStandardsIgnoreStart - public function stream_read($count) - { - // @codingStandardsIgnoreEnd - $ret = substr($this->data, $this->pos, $count); - $this->pos += strlen($ret); - return $ret; - } - - /** - * Tells the current position in the stream. - * - * @return int - */ - // @codingStandardsIgnoreStart - public function stream_tell() - { - // @codingStandardsIgnoreEnd - return $this->pos; - } - - /** - * Tells if we are at the end of the stream. - * - * @return bool - */ - // @codingStandardsIgnoreStart - public function stream_eof() - { - // @codingStandardsIgnoreEnd - return $this->pos >= strlen($this->data); - } - - /** - * Stream statistics. - * - * @return array - */ - // @codingStandardsIgnoreStart - public function stream_stat() - { - // @codingStandardsIgnoreEnd - return $this->stat; - } - - /** - * Seek to a specific point in the stream. - * - * @param $offset - * @param $whence - * @return bool - */ - // @codingStandardsIgnoreStart - public function stream_seek($offset, $whence) - { - // @codingStandardsIgnoreEnd - switch ($whence) { - case SEEK_SET: - if ($offset < strlen($this->data) && $offset >= 0) { - $this->pos = $offset; - return true; - } else { - return false; - } - break; - - case SEEK_CUR: - if ($offset >= 0) { - $this->pos += $offset; - return true; - } else { - return false; - } - break; - - case SEEK_END: - if (strlen($this->data) + $offset >= 0) { - $this->pos = strlen($this->data) + $offset; - return true; - } else { - return false; - } - break; - - default: - return false; - } - } -} diff --git a/test/Helper/FlashMessengerTest.php b/test/Helper/FlashMessengerTest.php deleted file mode 100644 index 453a957a3..000000000 --- a/test/Helper/FlashMessengerTest.php +++ /dev/null @@ -1,536 +0,0 @@ -mvcPluginClass = V3PluginFlashMessenger::class; - /** @psalm-suppress DeprecatedClass */ - $this->helper = new FlashMessenger(); - $this->plugin = $this->helper->getPluginFlashMessenger(); - } - - public function seedMessages(): void - { - /** @psalm-suppress DeprecatedClass */ - $helper = new FlashMessenger(); - $helper->addMessage('foo'); - $helper->addMessage('bar'); - $helper->addInfoMessage('bar-info'); - $helper->addSuccessMessage('bar-success'); - $helper->addWarningMessage('bar-warning'); - $helper->addErrorMessage('bar-error'); - unset($helper); - } - - public function seedCurrentMessages(): void - { - /** @psalm-suppress DeprecatedClass */ - $helper = new FlashMessenger(); - $helper->addMessage('foo'); - $helper->addMessage('bar'); - $helper->addInfoMessage('bar-info'); - $helper->addSuccessMessage('bar-success'); - $helper->addErrorMessage('bar-error'); - } - - public function createServiceManager(array $config = []): ServiceManager - { - $config = new Config([ - 'services' => [ - 'config' => $config, - ], - 'factories' => [ - 'ControllerPluginManager' => fn(ContainerInterface $services) => new PluginManager($services, [ - 'invokables' => [ - 'flashmessenger' => $this->mvcPluginClass, - ], - ]), - 'ViewHelperManager' => static fn(ContainerInterface $services) - => new HelperPluginManager($services), - ], - ]); - $sm = new ServiceManager(); - $config->configureServiceManager($sm); - return $sm; - } - - public function testCanAssertPluginClass(): void - { - $this->assertEquals($this->mvcPluginClass, get_class($this->plugin)); - $this->assertEquals($this->mvcPluginClass, get_class($this->helper->getPluginFlashMessenger())); - $this->assertSame($this->plugin, $this->helper->getPluginFlashMessenger()); - } - - public function testCanRetrieveMessages(): void - { - $helper = $this->helper; - - $this->assertFalse($helper()->hasMessages()); - $this->assertFalse($helper()->hasInfoMessages()); - $this->assertFalse($helper()->hasSuccessMessages()); - $this->assertFalse($helper()->hasWarningMessages()); - $this->assertFalse($helper()->hasErrorMessages()); - - $this->seedMessages(); - - $this->assertNotEmpty($helper('default')); - $this->assertNotEmpty($helper('info')); - $this->assertNotEmpty($helper('success')); - $this->assertNotEmpty($helper('warning')); - $this->assertNotEmpty($helper('error')); - - $this->assertTrue($this->plugin->hasMessages()); - $this->assertTrue($this->plugin->hasInfoMessages()); - $this->assertTrue($this->plugin->hasSuccessMessages()); - $this->assertTrue($this->plugin->hasWarningMessages()); - $this->assertTrue($this->plugin->hasErrorMessages()); - } - - public function testCanRetrieveCurrentMessages(): void - { - $helper = $this->helper; - - $this->assertFalse($helper()->hasCurrentMessages()); - $this->assertFalse($helper()->hasCurrentInfoMessages()); - $this->assertFalse($helper()->hasCurrentSuccessMessages()); - $this->assertFalse($helper()->hasCurrentErrorMessages()); - - $this->seedCurrentMessages(); - - $this->assertNotEmpty($helper('default')); - $this->assertNotEmpty($helper('info')); - $this->assertNotEmpty($helper('success')); - $this->assertNotEmpty($helper('error')); - - $this->assertFalse($this->plugin->hasCurrentMessages()); - $this->assertFalse($this->plugin->hasCurrentInfoMessages()); - $this->assertFalse($this->plugin->hasCurrentSuccessMessages()); - $this->assertFalse($this->plugin->hasCurrentErrorMessages()); - } - - public function testCanProxyAndRetrieveMessagesFromPluginController(): void - { - $this->assertFalse($this->helper->hasMessages()); - $this->assertFalse($this->helper->hasInfoMessages()); - $this->assertFalse($this->helper->hasSuccessMessages()); - $this->assertFalse($this->helper->hasWarningMessages()); - $this->assertFalse($this->helper->hasErrorMessages()); - - $this->seedMessages(); - - $this->assertTrue($this->helper->hasMessages()); - $this->assertTrue($this->helper->hasInfoMessages()); - $this->assertTrue($this->helper->hasSuccessMessages()); - $this->assertTrue($this->helper->hasWarningMessages()); - $this->assertTrue($this->helper->hasErrorMessages()); - } - - public function testCanProxyAndRetrieveCurrentMessagesFromPluginController(): void - { - $this->assertFalse($this->helper->hasCurrentMessages()); - $this->assertFalse($this->helper->hasCurrentInfoMessages()); - $this->assertFalse($this->helper->hasCurrentSuccessMessages()); - $this->assertFalse($this->helper->hasCurrentErrorMessages()); - - $this->seedCurrentMessages(); - - $this->assertTrue($this->helper->hasCurrentMessages()); - $this->assertTrue($this->helper->hasCurrentInfoMessages()); - $this->assertTrue($this->helper->hasCurrentSuccessMessages()); - $this->assertTrue($this->helper->hasCurrentErrorMessages()); - } - - public function testCanDisplayListOfMessages(): void - { - $plugin = $this->createMock($this->mvcPluginClass); - $plugin->expects(self::once()) - ->method('getMessagesFromNamespace') - ->with('info') - ->willReturn(['bar-info']); - - $plugin->expects(self::once()) - ->method('addInfoMessage') - ->with('bar-info'); - - $this->helper->setPluginFlashMessenger($plugin); - - $helper = new FlashMessenger(); - $helper->setPluginFlashMessenger($plugin); - $helper->addInfoMessage('bar-info'); - unset($helper); - - $displayInfoAssertion = '
    • bar-info
    '; - $displayInfo = $this->helper->render('info'); - $this->assertEquals($displayInfoAssertion, $displayInfo); - } - - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testCanDisplayListOfCurrentMessages(): void - { - $displayInfoAssertion = ''; - $displayInfo = $this->helper->renderCurrent('info'); - $this->assertEquals($displayInfoAssertion, $displayInfo); - - $this->seedCurrentMessages(); - - $displayInfoAssertion = '
    • bar-info
    '; - $displayInfo = $this->helper->renderCurrent('info'); - $this->assertEquals($displayInfoAssertion, $displayInfo); - } - - public function testCanDisplayListOfMessagesByDefaultParameters(): void - { - $helper = $this->helper; - $this->seedMessages(); - - $displayInfoAssertion = '
    • foo
    • bar
    '; - $displayInfo = $helper()->render(); - $this->assertEquals($displayInfoAssertion, $displayInfo); - } - - public function testCanDisplayListOfMessagesByDefaultCurrentParameters(): void - { - $helper = $this->helper; - $this->seedCurrentMessages(); - - $displayInfoAssertion = '
    • foo
    • bar
    '; - $displayInfo = $helper()->renderCurrent(); - $this->assertEquals($displayInfoAssertion, $displayInfo); - } - - public function testCanDisplayListOfMessagesByInvoke(): void - { - $helper = $this->helper; - $this->seedMessages(); - - $displayInfoAssertion = '
    • bar-info
    '; - $displayInfo = $helper()->render('info'); - $this->assertEquals($displayInfoAssertion, $displayInfo); - } - - public function testCanDisplayListOfCurrentMessagesByInvoke(): void - { - $helper = $this->helper; - $this->seedCurrentMessages(); - - $displayInfoAssertion = '
    • bar-info
    '; - $displayInfo = $helper()->renderCurrent('info'); - $this->assertEquals($displayInfoAssertion, $displayInfo); - } - - public function testCanDisplayListOfMessagesCustomised(): void - { - $this->seedMessages(); - - $displayInfoAssertion = '

    bar-info

    '; - $displayInfo = $this->helper - ->setMessageOpenFormat('

    ') - ->setMessageSeparatorString('

    ') - ->setMessageCloseString('

    ') - ->render('info', ['foo-baz', 'foo-bar']); - $this->assertEquals($displayInfoAssertion, $displayInfo); - } - - public function testCanDisplayListOfCurrentMessagesCustomised(): void - { - $this->seedCurrentMessages(); - - $displayInfoAssertion = '

    bar-info

    '; - $displayInfo = $this->helper - ->setMessageOpenFormat('

    ') - ->setMessageSeparatorString('

    ') - ->setMessageCloseString('

    ') - ->renderCurrent('info', ['foo-baz', 'foo-bar']); - $this->assertEquals($displayInfoAssertion, $displayInfo); - } - - public function testCanDisplayListOfMessagesCustomisedSeparator(): void - { - $this->seedMessages(); - - $displayInfoAssertion = '

    foo

    bar

    '; - $displayInfo = $this->helper - ->setMessageOpenFormat('
    ') - ->setMessageSeparatorString('

    ') - ->setMessageCloseString('

    ') - ->render('default', ['foo-baz', 'foo-bar']); - $this->assertEquals($displayInfoAssertion, $displayInfo); - } - - public function testCanDisplayListOfCurrentMessagesCustomisedSeparator(): void - { - $this->seedCurrentMessages(); - - $displayInfoAssertion = '

    foo

    bar

    '; - $displayInfo = $this->helper - ->setMessageOpenFormat('
    ') - ->setMessageSeparatorString('

    ') - ->setMessageCloseString('

    ') - ->renderCurrent('default', ['foo-baz', 'foo-bar']); - $this->assertEquals($displayInfoAssertion, $displayInfo); - } - - public function testCanDisplayListOfMessagesCustomisedByConfig(): void - { - $this->seedMessages(); - - $config = [ - 'view_helper_config' => [ - 'flashmessenger' => [ - 'message_open_format' => '
    • ', - 'message_separator_string' => '
    • ', - 'message_close_string' => '
    ', - ], - ], - ]; - - $services = $this->createServiceManager($config); - $helperPluginManager = $services->get('ViewHelperManager'); - $helper = $helperPluginManager->get('flashmessenger'); - - $displayInfoAssertion = '
    • bar-info
    '; - $displayInfo = $helper->render('info'); - $this->assertEquals($displayInfoAssertion, $displayInfo); - } - - public function testCanDisplayListOfCurrentMessagesCustomisedByConfig(): void - { - $this->seedCurrentMessages(); - $config = [ - 'view_helper_config' => [ - 'flashmessenger' => [ - 'message_open_format' => '
    • ', - 'message_separator_string' => '
    • ', - 'message_close_string' => '
    ', - ], - ], - ]; - $services = $this->createServiceManager($config); - $helperPluginManager = $services->get('ViewHelperManager'); - $helper = $helperPluginManager->get('flashmessenger'); - - $displayInfoAssertion = '
    • bar-info
    '; - $displayInfo = $helper->renderCurrent('info'); - $this->assertEquals($displayInfoAssertion, $displayInfo); - } - - public function testCanDisplayListOfMessagesCustomisedByConfigSeparator(): void - { - $this->seedMessages(); - - $config = [ - 'view_helper_config' => [ - 'flashmessenger' => [ - 'message_open_format' => '
      ', - 'message_separator_string' => '', - 'message_close_string' => '
    ', - ], - ], - ]; - $services = $this->createServiceManager($config); - $helperPluginManager = $services->get('ViewHelperManager'); - $helper = $helperPluginManager->get('flashmessenger'); - - // @codingStandardsIgnoreStart - $displayInfoAssertion = '
    • foo
    • bar
    '; - // @codingStandardsIgnoreEnd - $displayInfo = $helper->render('default', ['foo-baz', 'foo-bar']); - $this->assertEquals($displayInfoAssertion, $displayInfo); - } - - public function testCanDisplayListOfCurrentMessagesCustomisedByConfigSeparator(): void - { - $this->seedCurrentMessages(); - - $config = [ - 'view_helper_config' => [ - 'flashmessenger' => [ - 'message_open_format' => '
      ', - 'message_separator_string' => '', - 'message_close_string' => '
    ', - ], - ], - ]; - $services = $this->createServiceManager($config); - $helperPluginManager = $services->get('ViewHelperManager'); - $helper = $helperPluginManager->get('flashmessenger'); - - // @codingStandardsIgnoreStart - $displayInfoAssertion = '
    • foo
    • bar
    '; - // @codingStandardsIgnoreEnd - $displayInfo = $helper->renderCurrent('default', ['foo-baz', 'foo-bar']); - $this->assertEquals($displayInfoAssertion, $displayInfo); - } - - public function testCanTranslateMessages(): void - { - $mockTranslator = $this->createMock(Translator::class); - $mockTranslator->expects(self::once()) - ->method('translate') - ->with('bar-info', 'default') - ->willReturn('translated message'); - - $this->helper->setTranslator($mockTranslator); - $this->assertTrue($this->helper->hasTranslator()); - - $this->seedMessages(); - - $displayAssertion = '
    • translated message
    '; - $display = $this->helper->render('info'); - $this->assertEquals($displayAssertion, $display); - } - - public function testCanTranslateCurrentMessages(): void - { - $mockTranslator = $this->createMock(Translator::class); - $mockTranslator->expects(self::once()) - ->method('translate') - ->with('bar-info', 'default') - ->willReturn('translated message'); - - $this->helper->setTranslator($mockTranslator); - $this->assertTrue($this->helper->hasTranslator()); - - $this->seedCurrentMessages(); - - $displayAssertion = '
    • translated message
    '; - $display = $this->helper->renderCurrent('info'); - $this->assertEquals($displayAssertion, $display); - } - - public function testAutoEscapeDefaultsToTrue(): void - { - $this->assertTrue($this->helper->getAutoEscape()); - } - - public function testCanSetAutoEscape(): void - { - $this->helper->setAutoEscape(false); - $this->assertFalse($this->helper->getAutoEscape()); - - $this->helper->setAutoEscape(true); - $this->assertTrue($this->helper->getAutoEscape()); - } - - public function testMessageIsEscapedByDefault(): void - { - $helper = new FlashMessenger(); - $helper->addMessage('Foo
    bar'); - unset($helper); - - $displayAssertion = '
    • Foo<br />bar
    '; - $display = $this->helper->render('default'); - $this->assertSame($displayAssertion, $display); - } - - public function testMessageIsNotEscapedWhenAutoEscapeIsFalse(): void - { - $helper = new FlashMessenger(); - $helper->addMessage('Foo
    bar'); - unset($helper); - - $displayAssertion = '
    • Foo
      bar
    '; - $display = $this->helper->setAutoEscape(false) - ->render('default'); - $this->assertSame($displayAssertion, $display); - } - - public function testCanSetAutoEscapeOnRender(): void - { - $helper = new FlashMessenger(); - $helper->addMessage('Foo
    bar'); - unset($helper); - - $displayAssertion = '
    • Foo
      bar
    '; - $display = $this->helper->render('default', [], false); - $this->assertSame($displayAssertion, $display); - } - - public function testRenderUsesCurrentAutoEscapeByDefault(): void - { - $helper = new FlashMessenger(); - $helper->addMessage('Foo
    bar'); - unset($helper); - - $this->helper->setAutoEscape(false); - $displayAssertion = '
    • Foo
      bar
    '; - $display = $this->helper->render('default'); - $this->assertSame($displayAssertion, $display); - - $helper = new FlashMessenger(); - $helper->addMessage('Foo
    bar'); - unset($helper); - - $this->helper->setAutoEscape(true); - $displayAssertion = '
    • Foo<br />bar
    '; - $display = $this->helper->render('default'); - $this->assertSame($displayAssertion, $display); - } - - public function testCurrentMessageIsEscapedByDefault(): void - { - $this->helper->addMessage('Foo
    bar'); - - $displayAssertion = '
    • Foo<br />bar
    '; - $display = $this->helper->renderCurrent('default'); - $this->assertSame($displayAssertion, $display); - } - - public function testCurrentMessageIsNotEscapedWhenAutoEscapeIsFalse(): void - { - $this->helper->addMessage('Foo
    bar'); - - $displayAssertion = '
    • Foo
      bar
    '; - $display = $this->helper->setAutoEscape(false) - ->renderCurrent('default'); - $this->assertSame($displayAssertion, $display); - } - - public function testCanSetAutoEscapeOnRenderCurrent(): void - { - $this->helper->addMessage('Foo
    bar'); - - $displayAssertion = '
    • Foo
      bar
    '; - $display = $this->helper->renderCurrent('default', [], false); - $this->assertSame($displayAssertion, $display); - } - - public function testRenderCurrentUsesCurrentAutoEscapeByDefault(): void - { - $this->helper->addMessage('Foo
    bar'); - - $this->helper->setAutoEscape(false); - $displayAssertion = '
    • Foo
      bar
    '; - $display = $this->helper->renderCurrent('default'); - $this->assertSame($displayAssertion, $display); - - $this->helper->setAutoEscape(true); - $displayAssertion = '
    • Foo<br />bar
    '; - $display = $this->helper->renderCurrent('default'); - $this->assertSame($displayAssertion, $display); - } -} diff --git a/test/Helper/GravatarTest.php b/test/Helper/GravatarTest.php index 6e912614c..2a6a9421d 100644 --- a/test/Helper/GravatarTest.php +++ b/test/Helper/GravatarTest.php @@ -8,16 +8,11 @@ use Laminas\View\Helper\Gravatar; use Laminas\View\Renderer\PhpRenderer as View; use PHPUnit\Framework\TestCase; -use ReflectionMethod; use function method_exists; -use function restore_error_handler; -use function set_error_handler; use function strtoupper; use function urlencode; -use const E_USER_DEPRECATED; - /** @psalm-suppress DeprecatedClass */ class GravatarTest extends TestCase { @@ -275,50 +270,4 @@ public function testEmailIsProperlyNormalized(): void $this->helper->__invoke('Example@Example.com ')->getEmail() ); } - - public function testSetAttribsIsDeprecated(): void - { - set_error_handler(function ($code, $error) { - throw new Exception\RuntimeException($error, $code); - }, E_USER_DEPRECATED); - try { - $this->helper->setAttribs([]); - $this->fail('An exception was not thrown'); - } catch (Exception\RuntimeException $e) { - self::assertStringContainsString('setAttribs is deprecated', $e->getMessage()); - } finally { - restore_error_handler(); - } - } - - public function testSetAttribsDocCommentHasDeprecated(): void - { - $method = new ReflectionMethod($this->helper, 'setAttribs'); - $comment = $method->getDocComment(); - - $this->assertStringContainsString('@deprecated', $comment); - } - - public function testGetAttribsIsDeprecated(): void - { - set_error_handler(function ($code, $error) { - throw new Exception\RuntimeException($error, $code); - }, E_USER_DEPRECATED); - try { - $this->helper->getAttribs(); - $this->fail('An exception was not thrown'); - } catch (Exception\RuntimeException $e) { - self::assertStringContainsString('getAttribs is deprecated', $e->getMessage()); - } finally { - restore_error_handler(); - } - } - - public function testGetAttribsDocCommentHasDeprecated(): void - { - $method = new ReflectionMethod($this->helper, 'getAttribs'); - $comment = $method->getDocComment(); - - $this->assertStringContainsString('@deprecated', $comment); - } } diff --git a/test/Helper/HtmlFlashTest.php b/test/Helper/HtmlFlashTest.php deleted file mode 100644 index 67f3d7a6d..000000000 --- a/test/Helper/HtmlFlashTest.php +++ /dev/null @@ -1,42 +0,0 @@ -view = new View(); - /** @psalm-suppress DeprecatedClass */ - $this->helper = new HtmlFlash(); - $this->helper->setView($this->view); - } - - public function testMakeHtmlFlash(): void - { - $htmlFlash = $this->helper->__invoke('/path/to/flash.swf'); - - // @codingStandardsIgnoreStart - $objectStartElement = ''; - // @codingStandardsIgnoreEnd - - $this->assertStringContainsString($objectStartElement, $htmlFlash); - $this->assertStringContainsString('', $htmlFlash); - } -} diff --git a/test/Helper/HtmlQuicktimeTest.php b/test/Helper/HtmlQuicktimeTest.php deleted file mode 100644 index f99559d90..000000000 --- a/test/Helper/HtmlQuicktimeTest.php +++ /dev/null @@ -1,46 +0,0 @@ -view = new View(); - /** @psalm-suppress DeprecatedClass */ - $this->helper = new HtmlQuicktime(); - $this->helper->setView($this->view); - } - - public function testMakeHtmlQuicktime(): void - { - $htmlQuicktime = $this->helper->__invoke('/path/to/quicktime.mov'); - - $objectStartElement = ''; - - $this->assertStringContainsString($objectStartElement, $htmlQuicktime); - $this->assertStringContainsString('', $htmlQuicktime); - } -} diff --git a/test/Helper/JsonTest.php b/test/Helper/JsonTest.php index 99f4f7e94..b829abf73 100644 --- a/test/Helper/JsonTest.php +++ b/test/Helper/JsonTest.php @@ -6,15 +6,12 @@ use Laminas\Http\Header\HeaderInterface; use Laminas\Http\Response; -use Laminas\Json\Json as JsonFormatter; -use Laminas\View\Exception\RuntimeException; use Laminas\View\Helper\Json as JsonHelper; use PHPUnit\Framework\TestCase; -use function restore_error_handler; -use function set_error_handler; +use function json_encode; -use const E_USER_DEPRECATED; +use const JSON_THROW_ON_ERROR; class JsonTest extends TestCase { @@ -32,7 +29,7 @@ protected function setUp(): void $this->helper->setResponse($this->response); } - public function verifyJsonHeader(): void + private function verifyJsonHeader(): void { $headers = $this->response->getHeaders(); $this->assertTrue($headers->has('Content-Type')); @@ -49,29 +46,11 @@ public function testJsonHelperSetsResponseHeader(): void public function testJsonHelperReturnsJsonEncodedString(): void { - $data = $this->helper->__invoke('foobar'); - $this->assertIsString($data); - $this->assertEquals('foobar', JsonFormatter::decode($data)); - } - - public function testThatADeprecationErrorIsTriggeredWhenExpressionFinderOptionIsUsed(): void - { - set_error_handler(function ($code, $error) { - throw new RuntimeException($error, $code); - }, E_USER_DEPRECATED); - try { - $this->helper->__invoke(['foo'], ['enableJsonExprFinder' => true]); - $this->fail('An exception was not thrown'); - } catch (RuntimeException $e) { - self::assertStringContainsString('Json Expression functionality is deprecated', $e->getMessage()); - } finally { - restore_error_handler(); - } - } - - public function testThatADeprecationErrorIsNotTriggeredWhenExpressionFinderOptionIsNotUsed(): void - { - $this->expectNotToPerformAssertions(); - $this->helper->__invoke(['foo'], ['enableJsonExprFinder' => 'anything other than true']); + $input = [ + 'dory' => 'blue', + 'nemo' => 'orange', + ]; + $expect = json_encode($input, JSON_THROW_ON_ERROR); + self::assertJsonStringEqualsJsonString($expect, ($this->helper)($input)); } } diff --git a/test/Helper/PlaceholderTest.php b/test/Helper/PlaceholderTest.php index 8295b5533..ff5b98ffd 100644 --- a/test/Helper/PlaceholderTest.php +++ b/test/Helper/PlaceholderTest.php @@ -4,15 +4,14 @@ namespace LaminasTest\View\Helper; -use Laminas\View\Helper; +use Laminas\View\Helper\Placeholder; use Laminas\View\Helper\Placeholder\Container\AbstractContainer; use Laminas\View\Renderer\PhpRenderer as View; use PHPUnit\Framework\TestCase; class PlaceholderTest extends TestCase { - /** @var Helper\Placeholder */ - public $placeholder; + public Placeholder $placeholder; /** * Sets up the fixture, for example, open a network connection. @@ -20,7 +19,7 @@ class PlaceholderTest extends TestCase */ protected function setUp(): void { - $this->placeholder = new Helper\Placeholder(); + $this->placeholder = new Placeholder(); } public function testSetView(): void @@ -30,12 +29,26 @@ public function testSetView(): void $this->assertSame($view, $this->placeholder->getView()); } + public function testContainerExists(): void + { + $this->placeholder->__invoke('foo'); + $containerExists = $this->placeholder->__invoke()->containerExists('foo'); + + $this->assertTrue($containerExists); + } + public function testPlaceholderRetrievesContainer(): void { $container = $this->placeholder->__invoke('foo'); $this->assertInstanceOf(AbstractContainer::class, $container); } + public function testPlaceholderRetrievesItself(): void + { + $container = $this->placeholder->__invoke(); + $this->assertSame($container, $this->placeholder); + } + public function testPlaceholderRetrievesSameContainerOnSubsequentCalls(): void { $container1 = $this->placeholder->__invoke('foo'); @@ -67,4 +80,12 @@ public function testClearContainersRemovesAllContainers(): void $this->assertFalse($this->placeholder->containerExists('foo')); $this->assertFalse($this->placeholder->containerExists('bar')); } + + public function testGetContainerRetrievesTheCorrectContainer(): void + { + $container1 = $this->placeholder->__invoke('foo'); + $container2 = $this->placeholder->__invoke()->getContainer('foo'); + + $this->assertSame($container1, $container2); + } } diff --git a/test/Helper/Service/AssetFactoryTest.php b/test/Helper/Service/AssetFactoryTest.php index 807d0c19d..307e2d81f 100644 --- a/test/Helper/Service/AssetFactoryTest.php +++ b/test/Helper/Service/AssetFactoryTest.php @@ -4,62 +4,25 @@ namespace LaminasTest\View\Helper\Service; -use Laminas\ServiceManager\ServiceManager; -use Laminas\View\Exception; +use Laminas\View\Exception\RuntimeException; use Laminas\View\Helper\Asset; use Laminas\View\Helper\Service\AssetFactory; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; +use Psr\Container\ContainerInterface; class AssetFactoryTest extends TestCase { - /** - * @deprecated for removal in 3.0 - */ - public function testAssetFactoryCreateServiceCreatesAssetInstance(): void - { - $services = $this->getServices(); - - $assetFactory = new AssetFactory(); - $asset = $assetFactory->createService($services); - - $this->assertInstanceOf(Asset::class, $asset); - } - public function testAssetFactoryInvokableCreatesAssetInstance(): void { $services = $this->getServices(); $assetFactory = new AssetFactory(); - $asset = $assetFactory($services, ''); + $asset = $assetFactory($services); $this->assertInstanceOf(Asset::class, $asset); } - /** - * @deprecated for removal in 3.0 - */ - public function testValidConfiguration(): void - { - $config = [ - 'view_helper_config' => [ - 'asset' => [ - 'resource_map' => [ - 'css/style.css' => 'css/style-3a97ff4ee3.css', - 'js/vendor.js' => 'js/vendor-a507086eba.js', - ], - ], - ], - ]; - - $services = $this->getServices($config); - $assetFactory = new AssetFactory(); - - $asset = $assetFactory($services, ''); - - $this->assertEquals($config['view_helper_config']['asset']['resource_map'], $asset->getResourceMap()); - } - public function testThatAnExceptionWillBeThrownWhenTheResourceMapIsSetToANonArray(): void { $container = $this->getServices([ @@ -70,12 +33,12 @@ public function testThatAnExceptionWillBeThrownWhenTheResourceMapIsSetToANonArra ], ]); - $this->expectException(Exception\RuntimeException::class); + $this->expectException(RuntimeException::class); $this->expectExceptionMessage( 'Invalid resource map configuration. Expected the key ' . '"resource_map" to contain an array value but received "string"' ); - (new AssetFactory())($container, ''); + (new AssetFactory())($container); } /** @@ -128,14 +91,14 @@ public static function validConfigProvider(): array public function testThatAnExceptionWillNotBeThrownWhenGivenUnsetOrEmptyArrayConfiguration(array $config): void { $container = $this->getServices($config); - (new AssetFactory())($container, 'foo'); + (new AssetFactory())($container); self::assertTrue(true); } /** @param array $config */ - private function getServices(array $config = []): ServiceManager + private function getServices(array $config = []): ContainerInterface { - $services = $this->createMock(ServiceManager::class); + $services = $this->createMock(ContainerInterface::class); $services->expects(self::once()) ->method('get') ->with('config') diff --git a/test/Helper/Service/IdentityFactoryTest.php b/test/Helper/Service/IdentityFactoryTest.php index 400d31d5a..27c782ea0 100644 --- a/test/Helper/Service/IdentityFactoryTest.php +++ b/test/Helper/Service/IdentityFactoryTest.php @@ -4,66 +4,94 @@ namespace LaminasTest\View\Helper\Service; +use Interop\Container\ContainerInterface; // phpcs:ignore use Laminas\Authentication\AuthenticationService; use Laminas\Authentication\AuthenticationServiceInterface; -use Laminas\ServiceManager\ServiceManager; +use Laminas\View\Exception\RuntimeException; use Laminas\View\Helper\Identity; use Laminas\View\Helper\Service\IdentityFactory; -use LaminasTest\View\Helper\TestAsset\AuthenticationServiceStub; -use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class IdentityFactoryTest extends TestCase { - public function testThatAHelperCanBeCreatedWhenThereAreNoAuthenticationServicesFound(): void + /** @var MockObject&ContainerInterface */ + private ContainerInterface $services; + + protected function setUp(): void { - $container = $this->createMock(ServiceManager::class); - $container->expects(self::exactly(4)) + $this->services = $this->createMock(ContainerInterface::class); + } + + public function testFactoryReturnsEmptyIdentityIfNoAuthenticationServicePresent(): void + { + $this->services->expects(self::exactly(2)) ->method('has') - ->willReturn(false); + ->with(self::callback(static function (string $serviceName): bool { + self::assertTrue( + $serviceName === AuthenticationService::class + || + $serviceName === AuthenticationServiceInterface::class + ); - $container->expects(self::never())->method('get'); + return true; + }))->willReturn(false); $factory = new IdentityFactory(); - $helper = $factory($container, null); - self::assertInstanceOf(Identity::class, $helper); - } - /** @return array */ - public static function serviceNameProvider(): array - { - // phpcs:disable WebimpressCodingStandard.Formatting.StringClassReference - return [ - [AuthenticationService::class], - [AuthenticationServiceInterface::class], - ['Zend\Authentication\AuthenticationService'], - ['Zend\Authentication\AuthenticationServiceInterface'], - ]; - // phpcs:enable + $plugin = $factory($this->services); + + $this->assertInstanceOf(Identity::class, $plugin); + $this->expectException(RuntimeException::class); + $plugin(); } - private function authService(?string $id): AuthenticationServiceStub + public function testFactoryReturnsIdentityWithConfiguredAuthenticationServiceWhenPresent(): void { - return new AuthenticationServiceStub($id); + $authService = $this->createMock(AuthenticationServiceInterface::class); + $authService->expects(self::once()) + ->method('hasIdentity') + ->willReturn(false); + + $this->services->expects(self::once()) + ->method('has') + ->with(AuthenticationService::class) + ->willReturn(true); + + $this->services->expects(self::once()) + ->method('get') + ->with(AuthenticationService::class) + ->willReturn($authService); + + $factory = new IdentityFactory(); + + $plugin = $factory($this->services); + + $this->assertInstanceOf(Identity::class, $plugin); + $this->assertNull($plugin()); } - #[DataProvider('serviceNameProvider')] - public function testThatAFoundAuthenticationServiceWillBeUsed(string $serviceId): void + public function testFactoryReturnsIdentityWithConfiguredAuthenticationServiceInterfaceWhenPresent(): void { - $service = $this->authService('james bond'); + $authService = $this->createMock(AuthenticationServiceInterface::class); + $authService->expects(self::once()) + ->method('hasIdentity') + ->willReturn(false); - $container = $this->createMock(ServiceManager::class); - $container->expects(self::atLeast(1)) + $this->services->expects(self::exactly(2)) ->method('has') - ->willReturnCallback(static fn (string $argument): bool => $argument === $serviceId); + ->willReturnOnConsecutiveCalls(false, true); - $container->expects(self::once()) + $this->services->expects(self::once()) ->method('get') - ->with($serviceId) - ->willReturn($service); + ->with(AuthenticationServiceInterface::class) + ->willReturn($authService); $factory = new IdentityFactory(); - $helper = $factory($container, null); - self::assertEquals('james bond', $helper()); + + $plugin = $factory($this->services); + + $this->assertInstanceOf(Identity::class, $plugin); + $this->assertNull($plugin()); } } diff --git a/test/HelperPluginManagerCompatibilityTest.php b/test/HelperPluginManagerCompatibilityTest.php index c2ae2b425..41917aefa 100644 --- a/test/HelperPluginManagerCompatibilityTest.php +++ b/test/HelperPluginManagerCompatibilityTest.php @@ -6,7 +6,6 @@ use Generator; use Laminas\Mvc\Controller\PluginManager as ControllerPluginManager; -use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger; use Laminas\ServiceManager\Config; use Laminas\ServiceManager\ServiceManager; use Laminas\ServiceManager\Test\CommonPluginManagerTrait; @@ -30,9 +29,7 @@ protected static function getPluginManager(): HelperPluginManager if (class_exists(ControllerPluginManager::class)) { // @codingStandardsIgnoreLine $factories['ControllerPluginManager'] = static fn(ContainerInterface $services): ControllerPluginManager => new ControllerPluginManager($services, [ - 'invokables' => [ - 'flashmessenger' => FlashMessenger::class, - ], + 'invokables' => [], ]); } @@ -64,11 +61,6 @@ public static function aliasProvider(): Generator foreach ($aliases as $alias => $target) { self::assertIsString($target); - // Skipping conditionally since it depends on laminas-mvc - if (! class_exists(ControllerPluginManager::class) && strpos($target, '\\FlashMessenger')) { - continue; - } - // Skipping conditionally since it depends on laminas-mvc if (! class_exists(ControllerPluginManager::class) && strpos($target, '\\Url')) { continue; diff --git a/test/Model/ConsoleModelTest.php b/test/Model/ConsoleModelTest.php deleted file mode 100644 index 0d38876f4..000000000 --- a/test/Model/ConsoleModelTest.php +++ /dev/null @@ -1,30 +0,0 @@ -assertInstanceOf(ModelInterface::class, $model); - } - - /** - * @see https://github.com/zendframework/zend-view/issues/152 - */ - public function testSetErrorLevelImplementsFluentInterface(): void - { - /** @psalm-suppress DeprecatedClass */ - $model = new ConsoleModel(); - $actual = $model->setErrorLevel(0); - $this->assertSame($model, $actual); - } -} diff --git a/test/Model/JsonModelTest.php b/test/Model/JsonModelTest.php index 4319b799a..41b7e64ef 100644 --- a/test/Model/JsonModelTest.php +++ b/test/Model/JsonModelTest.php @@ -4,11 +4,17 @@ namespace LaminasTest\View\Model; -use Laminas\Json\Json; +use Laminas\View\Exception\DomainException; use Laminas\View\Model\JsonModel; use Laminas\View\Variables; use PHPUnit\Framework\TestCase; +use function json_encode; +use function sprintf; + +use const JSON_PRETTY_PRINT; +use const JSON_THROW_ON_ERROR; + class JsonModelTest extends TestCase { public function testAllowsEmptyConstructor(): void @@ -23,7 +29,7 @@ public function testCanSerializeVariablesToJson(): void $array = ['foo' => 'bar']; $model = new JsonModel($array); $this->assertEquals($array, $model->getVariables()); - $this->assertEquals(Json::encode($array), $model->serialize()); + $this->assertJsonStringEqualsJsonString(json_encode($array, JSON_THROW_ON_ERROR), $model->serialize()); } public function testCanSerializeWithJsonpCallback(): void @@ -31,12 +37,16 @@ public function testCanSerializeWithJsonpCallback(): void $array = ['foo' => 'bar']; $model = new JsonModel($array); $model->setJsonpCallback('callback'); - $this->assertEquals('callback(' . Json::encode($array) . ');', $model->serialize()); + $expect = sprintf( + 'callback(%s);', + json_encode($array, JSON_THROW_ON_ERROR) + ); + $this->assertEquals($expect, $model->serialize()); } public function testPrettyPrint(): void { - $array = [ + $array = [ 'simple' => 'simple test string', 'stringwithjsonchars' => '\"[1,2]', 'complex' => [ @@ -44,7 +54,18 @@ public function testPrettyPrint(): void 'far' => 'boo', ], ]; - $model = new JsonModel($array, ['prettyPrint' => true]); - $this->assertEquals(Json::encode($array, false, ['prettyPrint' => true]), $model->serialize()); + $model = new JsonModel($array, ['prettyPrint' => true]); + $expect = json_encode($array, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT); + $this->assertEquals($expect, $model->serialize()); + } + + public function testThatAnExceptionIsThrownIfItIsNotPossibleToEncodeThePayload(): void + { + $malformedUtf8 = [ + 'string' => "\x92", + ]; + $this->expectException(DomainException::class); + $this->expectExceptionMessage('Failed to encode Json'); + (new JsonModel($malformedUtf8))->serialize(); } } diff --git a/test/Resolver/TemplatePathStackTest.php b/test/Resolver/TemplatePathStackTest.php index f62100fdc..1e9277ddd 100644 --- a/test/Resolver/TemplatePathStackTest.php +++ b/test/Resolver/TemplatePathStackTest.php @@ -13,7 +13,6 @@ use function array_reverse; use function array_unshift; -use function ini_get; use function realpath; use const DIRECTORY_SEPARATOR; @@ -106,24 +105,6 @@ public function testMayDisableLfiProtection(): void $this->assertFalse($this->stack->isLfiProtectionOn()); } - public function testStreamWrapperDisabledByDefault(): void - { - /** @psalm-suppress DeprecatedMethod */ - $this->assertFalse($this->stack->useStreamWrapper()); - } - - public function testMayEnableStreamWrapper(): void - { - $flag = (bool) ini_get('short_open_tag'); - if (! $flag) { - $this->markTestSkipped('Short tags are disabled; cannot test'); - } - /** @psalm-suppress DeprecatedMethod */ - $this->stack->setUseStreamWrapper(true); - /** @psalm-suppress DeprecatedMethod */ - $this->assertTrue($this->stack->useStreamWrapper()); - } - public function testDoesNotAllowParentDirectoryTraversalByDefault(): void { $this->stack->addPath($this->baseDir . '/_templates'); @@ -163,20 +144,6 @@ public function testReturnsFullPathNameWhenAbleToResolveScriptPath(): void $this->assertEquals($expected, $test); } - public function testReturnsPathWithStreamProtocolWhenStreamWrapperEnabled(): void - { - $flag = (bool) ini_get('short_open_tag'); - if (! $flag) { - $this->markTestSkipped('Short tags are disabled; cannot test'); - } - /** @psalm-suppress DeprecatedMethod */ - $this->stack->setUseStreamWrapper(true) - ->addPath($this->baseDir . '/_templates'); - $expected = 'laminas.view://' . realpath($this->baseDir . '/_templates/test.phtml'); - $test = $this->stack->resolve('test.phtml'); - $this->assertEquals($expected, $test); - } - /** * @psalm-return array */ @@ -205,9 +172,8 @@ public function testSettingOptionsWithInvalidArgumentRaisesException(mixed $opti public static function validOptions(): array { $options = [ - 'lfi_protection' => false, - 'use_stream_wrapper' => true, - 'default_suffix' => 'php', + 'lfi_protection' => false, + 'default_suffix' => 'php', ]; return [ [$options], @@ -225,11 +191,7 @@ public function testAllowsSettingOptions($options): void $this->stack->setOptions($options); $this->assertFalse($this->stack->isLfiProtectionOn()); - $expected = (bool) ini_get('short_open_tag'); - /** @psalm-suppress DeprecatedMethod */ - $this->assertSame($expected, $this->stack->useStreamWrapper()); - - $this->assertSame($options['default_suffix'] ?? null, $this->stack->getDefaultSuffix()); + $this->assertSame($options['default_suffix'], $this->stack->getDefaultSuffix()); $this->assertEquals(array_reverse($this->paths), $this->stack->getPaths()->toArray()); } @@ -244,10 +206,6 @@ public function testAllowsPassingOptionsToConstructor($options): void $stack = new TemplatePathStack($options); $this->assertFalse($stack->isLfiProtectionOn()); - $expected = (bool) ini_get('short_open_tag'); - /** @psalm-suppress DeprecatedMethod */ - $this->assertSame($expected, $stack->useStreamWrapper()); - $this->assertEquals(array_reverse($this->paths), $stack->getPaths()->toArray()); }