Skip to content

Commit 25877ed

Browse files
authored
[TASK] Add thecodingmachine/safe (#1453) (#1366)
Safe-PHP https://github.com/thecodingmachine/safe provides rewrites of PHP functions to throw an exception instead of returning `false` when an error is encountered. This will allow us to drop out custom `preg_*` wrapper class and to increase type safety in our codebase. Also drop the PHP-CS-Fixer rule that adds a trailing backslash to calls to native PHP functions (as this would change the Safe-PHP calls back to their unsafe versions). The actual code changes will come in subsequent commits. Part of #1168
1 parent 5c23dc7 commit 25877ed

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ updates:
2121
- dependency-name: "phpunit/phpunit"
2222
versions: [ ">= 9.0.0" ]
2323
- dependency-name: "rector/rector"
24+
- dependency-name: "thecodingmachine/safe"
2425
versioning-strategy: "increase"
2526
commit-message:
2627
prefix: "[Dependabot] "

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"homepage": "https://www.sabberworm.com/blog/2010/6/10/php-css-parser",
2525
"require": {
2626
"php": "^7.2.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
27-
"ext-iconv": "*"
27+
"ext-iconv": "*",
28+
"thecodingmachine/safe": "^1.3 || ^2.5 || ^3.3"
2829
},
2930
"require-dev": {
3031
"php-parallel-lint/php-parallel-lint": "1.4.0",

config/php-cs-fixer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
4141

4242
// function notation
43-
'native_function_invocation' => ['include' => ['@all']],
4443
'nullable_type_declaration_for_default_null_value' => true,
4544

4645
// import

0 commit comments

Comments
 (0)