Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Use modern string functions #1917

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).

### Changed

- Use modern string functions (#1917)
- Require Fluid >= 2.7.4 (#1906)
- Require at least version 12.4.15 for TYPO3 12LTS (#1897)
- Require TYPO3 >= 11.5.37 (#1889)
Expand Down
2 changes: 1 addition & 1 deletion Classes/Mapper/AbstractDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ private function saveOneToManyRelationRecords(AbstractModel $model): void
);
}

if (\strncmp($foreignField, 'tx_', 3) === 0) {
if (str_starts_with($foreignField, 'tx_')) {
$foreignKey = \ucfirst((string)\preg_replace('/tx_[a-z]+_/', '', $foreignField));
} else {
$foreignKey = \ucfirst($foreignField);
Expand Down
4 changes: 2 additions & 2 deletions Classes/Templating/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private function extractSubparts(string $templateCode): void
// If there are no HTML comments in the template code, there cannot be
// any subparts. So there's no need to use an expensive regular
// expression to find any subparts in that case.
if (strpos($templateCode, '<!--') === false) {
if (!str_contains($templateCode, '<!--')) {
return;
}

Expand Down Expand Up @@ -140,7 +140,7 @@ private function findMarkers(): void

foreach (\array_unique($matches[1]) as $markerName) {
/** @var non-empty-string $markerName */
if (\strncmp($markerName, 'LABEL_', 6) === 0) {
if (str_starts_with($markerName, 'LABEL_')) {
$this->labelMarkerNames[] = \strtolower($markerName);
}
}
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"ext-zip": "*",
"doctrine/dbal": "^2.13.8 || ^3.9",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"symfony/polyfill-php80": "^1.31.0",
"typo3/cms-core": "^11.5.37 || ^12.4.15",
"typo3/cms-extbase": "^11.5.37 || ^12.4.15",
"typo3/cms-fluid": "^11.5.37 || ^12.4.15",
Expand Down