Skip to content

Commit dc71251

Browse files
nidendependabot[bot]raicabogdan
authored
T16778 helper xhtml (phalcon#698)
* docblock corrections * Bump friendsofphp/php-cs-fixer from 3.89.0 to 3.89.1 Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.89.0 to 3.89.1. - [Release notes](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases) - [Changelog](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/CHANGELOG.md) - [Commits](PHP-CS-Fixer/PHP-CS-Fixer@v3.89.0...v3.89.1) --- updated-dependencies: - dependency-name: friendsofphp/php-cs-fixer dependency-version: 3.89.1 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump phpbench/phpbench from 1.4.1 to 1.4.2 Bumps [phpbench/phpbench](https://github.com/phpbench/phpbench) from 1.4.1 to 1.4.2. - [Release notes](https://github.com/phpbench/phpbench/releases) - [Changelog](https://github.com/phpbench/phpbench/blob/master/CHANGELOG.md) - [Commits](phpbench/phpbench@1.4.1...1.4.2) --- updated-dependencies: - dependency-name: phpbench/phpbench dependency-version: 1.4.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump phpbench/phpbench from 1.4.2 to 1.4.3 Bumps [phpbench/phpbench](https://github.com/phpbench/phpbench) from 1.4.2 to 1.4.3. - [Release notes](https://github.com/phpbench/phpbench/releases) - [Changelog](https://github.com/phpbench/phpbench/blob/master/CHANGELOG.md) - [Commits](phpbench/phpbench@1.4.2...1.4.3) --- updated-dependencies: - dependency-name: phpbench/phpbench dependency-version: 1.4.3 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump friendsofphp/php-cs-fixer from 3.89.1 to 3.89.2 Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.89.1 to 3.89.2. - [Release notes](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases) - [Changelog](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/CHANGELOG.md) - [Commits](PHP-CS-Fixer/PHP-CS-Fixer@v3.89.1...v3.89.2) --- updated-dependencies: - dependency-name: friendsofphp/php-cs-fixer dependency-version: 3.89.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump friendsofphp/php-cs-fixer from 3.89.2 to 3.90.0 Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.89.2 to 3.90.0. - [Release notes](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases) - [Changelog](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/CHANGELOG.md) - [Commits](PHP-CS-Fixer/PHP-CS-Fixer@v3.89.2...v3.90.0) --- updated-dependencies: - dependency-name: friendsofphp/php-cs-fixer dependency-version: 3.90.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump squizlabs/php_codesniffer from 4.0.0 to 4.0.1 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 4.0.0 to 4.0.1. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/4.x/CHANGELOG-4.x.md) - [Commits](PHPCSStandards/PHP_CodeSniffer@4.0.0...4.0.1) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-version: 4.0.1 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump phpstan/phpstan from 2.1.31 to 2.1.32 --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-version: 2.1.32 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Fix method checkCipherHashIsAvailable() * Fix test * Bump friendsofphp/php-cs-fixer from 3.90.0 to 3.91.0 Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.90.0 to 3.91.0. - [Release notes](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases) - [Changelog](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/CHANGELOG.md) - [Commits](PHP-CS-Fixer/PHP-CS-Fixer@v3.90.0...v3.91.0) --- updated-dependencies: - dependency-name: friendsofphp/php-cs-fixer dependency-version: 3.91.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump predis/predis from 3.2.0 to 3.3.0 Bumps [predis/predis](https://github.com/predis/predis) from 3.2.0 to 3.3.0. - [Release notes](https://github.com/predis/predis/releases) - [Changelog](https://github.com/predis/predis/blob/main/CHANGELOG.md) - [Commits](predis/predis@v3.2.0...v3.3.0) --- updated-dependencies: - dependency-name: predis/predis dependency-version: 3.3.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump friendsofphp/php-cs-fixer from 3.91.0 to 3.91.3 Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.91.0 to 3.91.3. - [Release notes](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases) - [Changelog](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/CHANGELOG.md) - [Commits](PHP-CS-Fixer/PHP-CS-Fixer@v3.91.0...v3.91.3) --- updated-dependencies: - dependency-name: friendsofphp/php-cs-fixer dependency-version: 3.91.3 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump phpstan/phpstan from 2.1.32 to 2.1.33 --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-version: 2.1.33 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump friendsofphp/php-cs-fixer from 3.91.3 to 3.92.0 Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.91.3 to 3.92.0. - [Release notes](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases) - [Changelog](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/CHANGELOG.md) - [Commits](PHP-CS-Fixer/PHP-CS-Fixer@v3.91.3...v3.92.0) --- updated-dependencies: - dependency-name: friendsofphp/php-cs-fixer dependency-version: 3.92.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * updating docker packages * updating dockerfile * removing parser references for symbol tables * adjusted html input elements to use the docblock properties for generation * phpcs * adjusting tests * adjusting tests --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Vasile Bogdan Raica <[email protected]>
1 parent ab18c45 commit dc71251

File tree

19 files changed

+228
-110
lines changed

19 files changed

+228
-110
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"analyze": "vendor/bin/phpstan analyse -c phpstan.neon --memory-limit 1024M",
8181
"cs": "vendor/bin/phpcs --standard=phpcs.xml",
8282
"cs-fix": "vendor/bin/phpcbf --standard=phpcs.xml",
83-
"test-unit": "vendor/bin/phpunit -c phpunit.xml.dist",
83+
"test-unit": "vendor/bin/phpunit -c phpunit.xml.dist --fail-on-all-issues",
8484
"test-unit-coverage": "vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover tests/_output/coverage.xml",
8585
"test-unit-coverage-html": "vendor/bin/phpunit -c phpunit.xml.dist --coverage-html tests/_output/coverage/",
8686
"test-db-mysql": "vendor/bin/phpunit -c phpunit.mysql.xml",

docker-compose.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ services:
7777

7878
postgres:
7979
container_name: phalcon-postgres
80-
image: postgres:15-alpine
80+
image: postgres:18-alpine
8181
environment:
8282
- POSTGRES_PASSWORD=secret
8383
- POSTGRES_USER=phalcon
@@ -87,13 +87,13 @@ services:
8787

8888
redis:
8989
container_name: phalcon-redis
90-
image: redis:6-alpine
90+
image: redis:8-alpine
9191
extra_hosts:
9292
- "host.docker.internal:host-gateway"
9393

9494
redis-node-0:
9595
container_name: phalcon-redis-node-0
96-
image: docker.io/bitnami/redis-cluster:7.2
96+
image: docker.io/bitnamilegacy/redis-cluster:8.2
9797
environment:
9898
- 'REDIS_PASSWORD=bitnami'
9999
- 'REDIS_NODES=phalcon-redis-node-0 phalcon-redis-node-1 phalcon-redis-node-2 phalcon-redis-node-3 phalcon-redis-node-4 phalcon-redis-node-5'
@@ -102,7 +102,7 @@ services:
102102

103103
redis-node-1:
104104
container_name: phalcon-redis-node-1
105-
image: docker.io/bitnami/redis-cluster:7.2
105+
image: docker.io/bitnamilegacy/redis-cluster:8.2
106106
environment:
107107
- 'REDIS_PASSWORD=bitnami'
108108
- 'REDIS_NODES=phalcon-redis-node-0 phalcon-redis-node-1 phalcon-redis-node-2 phalcon-redis-node-3 phalcon-redis-node-4 phalcon-redis-node-5'
@@ -111,7 +111,7 @@ services:
111111

112112
redis-node-2:
113113
container_name: phalcon-redis-node-2
114-
image: docker.io/bitnami/redis-cluster:7.2
114+
image: docker.io/bitnamilegacy/redis-cluster:8.2
115115
environment:
116116
- 'REDIS_PASSWORD=bitnami'
117117
- 'REDIS_NODES=phalcon-redis-node-0 phalcon-redis-node-1 phalcon-redis-node-2 phalcon-redis-node-3 phalcon-redis-node-4 phalcon-redis-node-5'
@@ -120,7 +120,7 @@ services:
120120

121121
redis-node-3:
122122
container_name: phalcon-redis-node-3
123-
image: docker.io/bitnami/redis-cluster:7.2
123+
image: docker.io/bitnamilegacy/redis-cluster:8.2
124124
environment:
125125
- 'REDIS_PASSWORD=bitnami'
126126
- 'REDIS_NODES=phalcon-redis-node-0 phalcon-redis-node-1 phalcon-redis-node-2 phalcon-redis-node-3 phalcon-redis-node-4 phalcon-redis-node-5'
@@ -129,7 +129,7 @@ services:
129129

130130
redis-node-4:
131131
container_name: phalcon-redis-node-4
132-
image: docker.io/bitnami/redis-cluster:7.2
132+
image: docker.io/bitnamilegacy/redis-cluster:8.2
133133
environment:
134134
- 'REDIS_PASSWORD=bitnami'
135135
- 'REDIS_NODES=phalcon-redis-node-0 phalcon-redis-node-1 phalcon-redis-node-2 phalcon-redis-node-3 phalcon-redis-node-4 phalcon-redis-node-5'
@@ -138,7 +138,7 @@ services:
138138

139139
redis-node-5:
140140
container_name: phalcon-redis-node-5
141-
image: docker.io/bitnami/redis-cluster:7.2
141+
image: docker.io/bitnamilegacy/redis-cluster:8.2
142142
depends_on:
143143
- redis-node-0
144144
- redis-node-1

resources/docker/develop/Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ ARG USER=phalcon
1212
ARG GROUP=phalcon
1313

1414
RUN set -eux \
15-
# Add user and group
15+
# Add user and group \
1616
&& groupadd -g "${GID}" "${GROUP}" \
1717
&& useradd -l -m -u "${UID}" -g "${GID}" "${USER}" \
1818
&& usermod -s /bin/bash "${USER}" \
1919
&& mkdir /app \
2020
&& chown "${USER}":"${GROUP}" /app \
2121
&& chmod 0770 /app \
22-
# Install needed packages
22+
# Install needed packages \
2323
&& apt update -y \
2424
&& apt install -yq --no-install-recommends \
2525
apt-utils \
@@ -48,7 +48,7 @@ RUN set -eux \
4848
&& sed -i -e 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/' /etc/locale.gen \
4949
&& dpkg-reconfigure --frontend=noninteractive locales \
5050
&& update-locale LANG=en_US.UTF-8 \
51-
# Install base extensions
51+
# Install base extensions \
5252
&& pecl install \
5353
igbinary \
5454
msgpack \
@@ -58,13 +58,13 @@ RUN set -eux \
5858
memcached \
5959
xdebug \
6060
redis \
61-
# Configure GD
61+
# Configure GD \
6262
&& docker-php-ext-configure gd --with-freetype \
6363
--with-jpeg=/usr/include/ \
6464
--with-xpm \
6565
--with-webp \
6666
--enable-gd \
67-
## Install extensions
67+
## Install extensions \
6868
&& docker-php-ext-install \
6969
gd \
7070
gettext \
@@ -73,7 +73,7 @@ RUN set -eux \
7373
pdo_mysql \
7474
pdo_pgsql \
7575
zip \
76-
# Install PHP extensions
76+
# Install PHP extensions \
7777
&& docker-php-ext-enable \
7878
redis \
7979
igbinary \
@@ -85,27 +85,27 @@ RUN set -eux \
8585
xdebug \
8686
# Copy ini file \
8787
&& mv /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini \
88-
# Set correct pid file location and permissions
88+
# Set correct pid file location and permissions \
8989
&& mkdir -p /run/php \
9090
&& chown "${USER}":"${GROUP}" /run/php \
9191
&& chmod 0770 /run/php \
92-
# Cleanup
92+
# Cleanup \
9393
&& apt-get autoremove --purge -y \
9494
&& apt-get autoclean -y \
9595
&& apt-get clean -y \
9696
&& rm -rf /tmp/* /var/tmp/* \
9797
&& find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
9898
&& find /var/cache -type f -delete \
9999
&& find /var/log -type f -delete \
100-
# Setup the phalcon-module
100+
# Setup the phalcon-module \
101101
&& cd /tmp \
102102
&& git clone https://github.com/niden/phalcon-module \
103103
&& cd phalcon-module/ext \
104104
&& ./install \
105105
&& echo "extension=phalcon" > /usr/local/etc/php/conf.d/phalcon.ini
106106

107107
# hadolint ignore=DL3022
108-
COPY --from=composer/composer:2 --chown=${USER}:${GROUP} --chmod=0660 /usr/bin/composer /usr/bin/composer
108+
COPY --from=composer/composer:2 --chown=${USER}:${GROUP} --chmod=0770 /usr/bin/composer /usr/bin/composer
109109
COPY resources/docker/develop/.bashrc /home/${USER}/.bashrc
110110
COPY resources/docker/develop/extra.ini /usr/local/etc/php/conf.d/
111111

@@ -118,4 +118,4 @@ SHELL [ "/bin/bash", "--rcfile", "/home/${USER}/.bashrc", "-o", "pipefail", "-c"
118118

119119
WORKDIR /app
120120

121-
USER ${USER}
121+
#USER ${USER}

src/DataMapper/Pdo/Connection/AbstractConnection.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ public function isConnected(): bool
184184
* @param array<string, mixed> $values
185185
*
186186
* @return PDOStatement
187-
* @throws Exception
188187
*/
189188
public function perform(
190189
string $statement,
@@ -305,9 +304,7 @@ protected function profileFinish(
305304
string | null $statement = null,
306305
array $values = []
307306
): void {
308-
if ($this->profiler) {
309-
$this->profiler->finish($statement, $values);
310-
}
307+
$this->profiler?->finish($statement, $values);
311308
}
312309

313310
/**
@@ -317,8 +314,6 @@ protected function profileFinish(
317314
*/
318315
protected function profileStart(string $method): void
319316
{
320-
if ($this->profiler) {
321-
$this->profiler->start($method);
322-
}
317+
$this->profiler?->start($method);
323318
}
324319
}

src/DataMapper/Pdo/Connection/Traits/FetchTrait.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ trait FetchTrait
3838
* @param array $values
3939
*
4040
* @return int
41-
* @throws Exception
4241
*/
4342
public function fetchAffected(string $statement, array $values = []): int
4443
{
@@ -55,7 +54,6 @@ public function fetchAffected(string $statement, array $values = []): int
5554
* @param array $values
5655
*
5756
* @return array
58-
* @throws Exception
5957
*/
6058
public function fetchAll(string $statement, array $values = []): array
6159
{
@@ -77,7 +75,6 @@ public function fetchAll(string $statement, array $values = []): array
7775
* @param array $values
7876
*
7977
* @return array
80-
* @throws Exception
8178
*/
8279
public function fetchAssoc(string $statement, array $values = []): array
8380
{
@@ -102,7 +99,6 @@ public function fetchAssoc(string $statement, array $values = []): array
10299
* @param int $column
103100
*
104101
* @return array<array-key, string>
105-
* @throws Exception
106102
*/
107103
public function fetchColumn(
108104
string $statement,
@@ -124,7 +120,6 @@ public function fetchColumn(
124120
* @param int $flags
125121
*
126122
* @return array
127-
* @throws Exception
128123
*/
129124
public function fetchGroup(
130125
string $statement,
@@ -151,7 +146,6 @@ public function fetchGroup(
151146
* @param array $arguments
152147
*
153148
* @return object
154-
* @throws Exception
155149
*/
156150
public function fetchObject(
157151
string $statement,
@@ -180,7 +174,6 @@ public function fetchObject(
180174
* @param array $arguments
181175
*
182176
* @return array
183-
* @throws Exception
184177
*/
185178
public function fetchObjects(
186179
string $statement,
@@ -200,7 +193,6 @@ public function fetchObjects(
200193
* @param array $values
201194
*
202195
* @return array
203-
* @throws Exception
204196
*/
205197
public function fetchOne(string $statement, array $values = []): array
206198
{
@@ -218,7 +210,6 @@ public function fetchOne(string $statement, array $values = []): array
218210
* @param array $values
219211
*
220212
* @return array
221-
* @throws Exception
222213
*/
223214
public function fetchPairs(string $statement, array $values = []): array
224215
{
@@ -235,7 +226,6 @@ public function fetchPairs(string $statement, array $values = []): array
235226
* @param array $values
236227
*
237228
* @return array
238-
* @throws Exception
239229
*/
240230
public function fetchUnique(string $statement, array $values = []): array
241231
{
@@ -252,7 +242,6 @@ public function fetchUnique(string $statement, array $values = []): array
252242
* @param int $column
253243
*
254244
* @return mixed
255-
* @throws Exception
256245
*/
257246
public function fetchValue(
258247
string $statement,

src/Html/Helper/AbstractHelper.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ abstract class AbstractHelper
3838
*/
3939
protected string $delimiter = PHP_EOL;
4040

41-
/**
42-
* @var EscaperInterface
43-
*/
44-
protected EscaperInterface $escaper;
45-
4641
/**
4742
* @var string
4843
*/
@@ -58,9 +53,10 @@ abstract class AbstractHelper
5853
*
5954
* @param EscaperInterface $escaper
6055
*/
61-
public function __construct(EscaperInterface $escaper)
62-
{
63-
$this->escaper = $escaper;
56+
public function __construct(
57+
protected EscaperInterface $escaper,
58+
protected ?Doctype $doctype = null
59+
) {
6460
}
6561

6662
/**

src/Html/Helper/Doctype.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ class Doctype
3838
/**
3939
* @var int
4040
*/
41-
private int $flag = self::HTML5;
41+
private int $type = self::HTML5;
4242

4343
/**
4444
* Produce a <doctype> tag
4545
*
46-
* @param int $flag
46+
* @param int $type
4747
* @param string $delimiter
4848
*
4949
* @return static
5050
*/
5151
public function __invoke(
52-
int $flag = self::HTML5,
52+
int $type = self::HTML5,
5353
string $delimiter = PHP_EOL
5454
): static {
55-
$this->flag = $flag;
55+
$this->type = $type;
5656
$this->delimiter = $delimiter;
5757

5858
return $this;
@@ -88,6 +88,14 @@ public function __toString(): string
8888
/**
8989
* Default is HTML5
9090
*/
91-
return $map[$this->flag] ?? "<!DOCTYPE html>" . $dlm;
91+
return $map[$this->type] ?? "<!DOCTYPE html>" . $dlm;
92+
}
93+
94+
/**
95+
* @return int
96+
*/
97+
public function getType(): int
98+
{
99+
return $this->type;
92100
}
93101
}

src/Html/Helper/Input/AbstractInput.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Phalcon\Html\Helper\Input;
1313

1414
use Phalcon\Html\Helper\AbstractHelper;
15+
use Phalcon\Html\Helper\Doctype;
1516

1617
use function array_merge;
1718

@@ -70,10 +71,15 @@ public function __invoke(
7071
*/
7172
public function __toString()
7273
{
74+
$closeTag = '';
75+
if ($this->doctype->getType() > Doctype::HTML5) {
76+
$closeTag = '/';
77+
}
78+
7379
$output = $this->renderTag(
7480
'input',
7581
$this->attributes,
76-
'/'
82+
$closeTag
7783
);
7884

7985
$this->attributes = [];

0 commit comments

Comments
 (0)