Version Description
Download this release
Release Info
Developer | sstoqnov |
Plugin | SG Optimizer |
Version | 5.4.1 |
Comparing to | |
See all releases |
Code changes from version 5.4.0 to 5.4.1
- core/Analysis/Analysis.php +4 -2
- core/Images_Optimizer/Images_Optimizer_Webp.php +37 -14
- core/Php_Checker/Php_Checker.php +6 -1
- helpers/sg-cachepress-react-strings.php +209 -0
- languages/json/sg-cachepress-es_ES.json +1 -1
- languages/json/sg-cachepress-it_IT.json +1 -1
- languages/sg-cachepress-es_ES.mo +0 -0
- languages/sg-cachepress-es_ES.po +287 -245
- languages/sg-cachepress-it_IT.mo +0 -0
- languages/sg-cachepress-it_IT.po +289 -249
- readme.txt +6 -0
- sg-cachepress.php +2 -2
- vendor/autoload.php +1 -1
- vendor/composer/autoload_psr4.php +0 -1
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +9 -8
- vendor/composer/installed.json +135 -27
- vendor/phar-io/manifest/composer.lock +0 -69
- vendor/phpcompatibility/php-compatibility/CHANGELOG.md +914 -445
- vendor/phpcompatibility/php-compatibility/PHPCSAliases.php +14 -14
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractComplexVersionSniff.php +27 -12
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractFunctionCallParameterSniff.php +42 -26
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractNewFeatureSniff.php +19 -12
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractRemovedFeatureSniff.php +23 -15
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/ComplexVersionInterface.php +20 -13
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/PHPCSHelper.php +172 -67
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniff.php +689 -264
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/ForbiddenAbstractPrivateMethodsSniff.php +90 -0
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Classes}/NewAnonymousClassesSniff.php +28 -25
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Classes}/NewClassesSniff.php +161 -66
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Classes}/NewConstVisibilitySniff.php +23 -22
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/LateStaticBindingSniff.php → Classes/NewLateStaticBindingSniff.php} +30 -23
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewTypedPropertiesSniff.php +132 -0
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/RemovedOrphanedParentSniff.php +115 -0
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Constants}/NewConstantsSniff.php +764 -20
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Constants}/NewMagicClassConstantSniff.php +24 -17
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Constants}/RemovedConstantsSniff.php +249 -18
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → ControlStructures}/DiscouragedSwitchContinueSniff.php +33 -30
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → ControlStructures}/ForbiddenBreakContinueOutsideLoopSniff.php +34 -29
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → ControlStructures}/ForbiddenBreakContinueVariableArgumentsSniff.php +33 -25
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → ControlStructures}/ForbiddenSwitchWithMultipleDefaultBlocksSniff.php +22 -21
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → ControlStructures}/NewExecutionDirectivesSniff.php +77 -35
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewForeachExpressionReferencingSniff.php +99 -0
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewListInForeachSniff.php +84 -0
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → ControlStructures}/NewMultiCatchSniff.php +22 -21
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Extensions}/RemovedExtensionsSniff.php +72 -38
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/ParameterShadowSuperGlobalsSniff.php → FunctionDeclarations/ForbiddenParameterShadowSuperGlobalsSniff.php} +22 -21
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/ForbiddenFunctionParametersWithSameNameSniff.php → FunctionDeclarations/ForbiddenParametersWithSameNameSniff.php} +26 -26
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenToStringParametersSniff.php +99 -0
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/ForbiddenClosureUseVariableNamesSniff.php → FunctionDeclarations/ForbiddenVariableNamesInClosureUseSniff.php} +33 -30
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionDeclarations}/NewClosureSniff.php +57 -31
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewExceptionsFromToStringSniff.php +171 -0
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionDeclarations}/NewNullableTypesSniff.php +44 -38
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/NewScalarTypeDeclarationsSniff.php → FunctionDeclarations/NewParamTypeDeclarationsSniff.php} +60 -19
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionDeclarations}/NewReturnTypeDeclarationsSniff.php +46 -26
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionDeclarations}/NonStaticMagicMethodsSniff.php +62 -32
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionNameRestrictions}/NewMagicMethodsSniff.php +54 -20
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/DeprecatedMagicAutoloadSniff.php → FunctionNameRestrictions/RemovedMagicAutoloadSniff.php} +32 -20
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedNamespacedAssertSniff.php +101 -0
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedPHP4StyleConstructorsSniff.php +158 -0
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/ReservedFunctionNamesSniff.php +205 -0
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/ArgumentFunctionsReportCurrentValueSniff.php +455 -0
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionUse}/ArgumentFunctionsUsageSniff.php +36 -30
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionUse}/NewFunctionParametersSniff.php +145 -27
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionUse}/NewFunctionsSniff.php +222 -30
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/OptionalRequiredFunctionParametersSniff.php → FunctionUse/OptionalToRequiredFunctionParametersSniff.php} +31 -20
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionUse}/RemovedFunctionParametersSniff.php +102 -24
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/DeprecatedFunctionsSniff.php → FunctionUse/RemovedFunctionsSniff.php} +407 -207
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/RequiredOptionalFunctionParametersSniff.php → FunctionUse/RequiredToOptionalFunctionParametersSniff.php} +138 -31
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Generators/NewGeneratorReturnSniff.php +158 -0
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → IniDirectives}/NewIniDirectivesSniff.php +254 -26
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/DeprecatedIniDirectivesSniff.php → IniDirectives/RemovedIniDirectivesSniff.php} +115 -29
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/ConstantArraysUsingConstSniff.php → InitialValue/NewConstantArraysUsingConstSniff.php} +25 -20
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantArraysUsingDefineSniff.php +101 -0
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → InitialValue}/NewConstantScalarExpressionsSniff.php +107 -116
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/NewHeredocInitializeSniff.php → InitialValue/NewHeredocSniff.php} +29 -17
- vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Interfaces}/InternalInterfacesSniff.php +26 -16
core/Analysis/Analysis.php
CHANGED
@@ -331,7 +331,7 @@ class Analysis {
|
|
331 |
'score' => $score,
|
332 |
'class_name' => 'placeholder-without-svg placeholder-top',
|
333 |
'title' => __( 'Awesome! You have worked hard.', 'sg-cachepress' ),
|
334 |
-
'message' => __( '
|
335 |
);
|
336 |
}
|
337 |
|
@@ -347,7 +347,6 @@ class Analysis {
|
|
347 |
* @return array The analisys result.
|
348 |
*/
|
349 |
public function run_analysis( $url, $device = 'desktop', $counter = 0 ) {
|
350 |
-
|
351 |
// Try to get the analysis 3 times and then bail.
|
352 |
if ( 3 === $counter ) {
|
353 |
wp_send_json_error();
|
@@ -355,6 +354,9 @@ class Analysis {
|
|
355 |
|
356 |
$full_url = home_url( '/' ) . trim( $url, '/' );
|
357 |
|
|
|
|
|
|
|
358 |
// Make the request.
|
359 |
$response = wp_remote_get(
|
360 |
'https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=' . $full_url . '&locale=' . get_locale() . '&strategy=' . $device,
|
331 |
'score' => $score,
|
332 |
'class_name' => 'placeholder-without-svg placeholder-top',
|
333 |
'title' => __( 'Awesome! You have worked hard.', 'sg-cachepress' ),
|
334 |
+
'message' => __( 'Your site is loading super fast!', 'sg-cachepress' ),
|
335 |
);
|
336 |
}
|
337 |
|
347 |
* @return array The analisys result.
|
348 |
*/
|
349 |
public function run_analysis( $url, $device = 'desktop', $counter = 0 ) {
|
|
|
350 |
// Try to get the analysis 3 times and then bail.
|
351 |
if ( 3 === $counter ) {
|
352 |
wp_send_json_error();
|
354 |
|
355 |
$full_url = home_url( '/' ) . trim( $url, '/' );
|
356 |
|
357 |
+
// Hit the url, so it can be cached, when Google Api make the request.
|
358 |
+
wp_remote_get( $full );
|
359 |
+
|
360 |
// Make the request.
|
361 |
$response = wp_remote_get(
|
362 |
'https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=' . $full_url . '&locale=' . get_locale() . '&strategy=' . $device,
|
core/Images_Optimizer/Images_Optimizer_Webp.php
CHANGED
@@ -41,7 +41,7 @@ class Images_Optimizer_Webp {
|
|
41 |
|
42 |
// Optimize newly uploaded images.
|
43 |
if (
|
44 |
-
Options::is_enabled( '
|
45 |
0 === Helper::is_cron_disabled()
|
46 |
) {
|
47 |
add_action( 'wp_generate_attachment_metadata', array( $this, 'optimize_new_image' ), 10, 2 );
|
@@ -235,15 +235,17 @@ class Images_Optimizer_Webp {
|
|
235 |
return false;
|
236 |
}
|
237 |
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
|
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
|
|
247 |
}
|
248 |
}
|
249 |
|
@@ -277,7 +279,7 @@ class Images_Optimizer_Webp {
|
|
277 |
break;
|
278 |
|
279 |
case IMAGETYPE_JPEG:
|
280 |
-
$placeholder = 'cwebp -q 50
|
281 |
break;
|
282 |
|
283 |
case IMAGETYPE_PNG:
|
@@ -287,7 +289,7 @@ class Images_Optimizer_Webp {
|
|
287 |
if ( filesize( $filepath ) > self::PNGS_SIZE_LIMIT ) {
|
288 |
return true;
|
289 |
}
|
290 |
-
$placeholder = 'cwebp -q 50
|
291 |
break;
|
292 |
|
293 |
default:
|
@@ -404,6 +406,13 @@ class Images_Optimizer_Webp {
|
|
404 |
);
|
405 |
}
|
406 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
public function delete_webp_files() {
|
408 |
$upload_dir = wp_upload_dir();
|
409 |
$basedir = $upload_dir['basedir'];
|
@@ -414,7 +423,14 @@ class Images_Optimizer_Webp {
|
|
414 |
return $result;
|
415 |
}
|
416 |
|
417 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
$main_image = get_attached_file( $id );
|
419 |
$metadata = wp_get_attachment_metadata( $id );
|
420 |
|
@@ -429,10 +445,17 @@ class Images_Optimizer_Webp {
|
|
429 |
exec( 'rm ' . implode( ' ', $sizes ) );
|
430 |
}
|
431 |
|
432 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
$this->delete_webp_copy( $id );
|
434 |
$metadata = wp_get_attachment_metadata( $id );
|
435 |
|
436 |
-
$this->
|
437 |
}
|
438 |
}
|
41 |
|
42 |
// Optimize newly uploaded images.
|
43 |
if (
|
44 |
+
Options::is_enabled( 'siteground_optimizer_webp_support' ) &&
|
45 |
0 === Helper::is_cron_disabled()
|
46 |
) {
|
47 |
add_action( 'wp_generate_attachment_metadata', array( $this, 'optimize_new_image' ), 10, 2 );
|
235 |
return false;
|
236 |
}
|
237 |
|
238 |
+
if ( ! empty( $metadata['sizes'] ) ) {
|
239 |
+
// Loop through all image sizes and optimize them as well.
|
240 |
+
foreach ( $metadata['sizes'] as $size ) {
|
241 |
+
// Replace main image with the cropped image and run the conversion command.
|
242 |
+
$status = $this->generate_webp_file( str_replace( $basename, $size['file'], $main_image ) );
|
243 |
|
244 |
+
// conversion failed.
|
245 |
+
if ( true === boolval( $status ) ) {
|
246 |
+
update_post_meta( $id, 'siteground_optimizer_webp_conversion_failed', 1 );
|
247 |
+
return false;
|
248 |
+
}
|
249 |
}
|
250 |
}
|
251 |
|
279 |
break;
|
280 |
|
281 |
case IMAGETYPE_JPEG:
|
282 |
+
$placeholder = 'cwebp -q 50 %1$s -o %1$s.webp 2>&1';
|
283 |
break;
|
284 |
|
285 |
case IMAGETYPE_PNG:
|
289 |
if ( filesize( $filepath ) > self::PNGS_SIZE_LIMIT ) {
|
290 |
return true;
|
291 |
}
|
292 |
+
$placeholder = 'cwebp -q 50 %1$s -o %1$s.webp 2>&1';
|
293 |
break;
|
294 |
|
295 |
default:
|
406 |
);
|
407 |
}
|
408 |
|
409 |
+
/**
|
410 |
+
* Delete all Webp files.
|
411 |
+
*
|
412 |
+
* @since 5.4.0
|
413 |
+
*
|
414 |
+
* @return bool Tru on success, false on failure.
|
415 |
+
*/
|
416 |
public function delete_webp_files() {
|
417 |
$upload_dir = wp_upload_dir();
|
418 |
$basedir = $upload_dir['basedir'];
|
423 |
return $result;
|
424 |
}
|
425 |
|
426 |
+
/**
|
427 |
+
* Delete a webp copy, when the original image is deleted.
|
428 |
+
*
|
429 |
+
* @since 5.4.0
|
430 |
+
*
|
431 |
+
* @param int $id The attachment ID.
|
432 |
+
*/
|
433 |
+
public function delete_webp_copy( $id ) {
|
434 |
$main_image = get_attached_file( $id );
|
435 |
$metadata = wp_get_attachment_metadata( $id );
|
436 |
|
445 |
exec( 'rm ' . implode( ' ', $sizes ) );
|
446 |
}
|
447 |
|
448 |
+
/**
|
449 |
+
* Regenerate the webp copies, when the original images is edited.
|
450 |
+
*
|
451 |
+
* @since 5.4.0
|
452 |
+
*
|
453 |
+
* @param int $id The attachment id.
|
454 |
+
*/
|
455 |
+
public function regenerate_webp_copy( $id ) {
|
456 |
$this->delete_webp_copy( $id );
|
457 |
$metadata = wp_get_attachment_metadata( $id );
|
458 |
|
459 |
+
$this->convert_to_webp( $id, $metadata );
|
460 |
}
|
461 |
}
|
core/Php_Checker/Php_Checker.php
CHANGED
@@ -3,6 +3,7 @@ namespace SiteGround_Optimizer\Php_Checker;
|
|
3 |
|
4 |
use SiteGround_Optimizer\SiteGround_Optimizer;
|
5 |
use SiteGround_Optimizer\Rest\Rest;
|
|
|
6 |
/**
|
7 |
* Handle PHP compatibility checks.
|
8 |
*/
|
@@ -426,7 +427,11 @@ class Php_Checker {
|
|
426 |
* @return string $report The plugin compatibility report.
|
427 |
*/
|
428 |
public function process_dir( $dir, $php_version ) {
|
429 |
-
|
|
|
|
|
|
|
|
|
430 |
|
431 |
$codesniffer_cli = new \PHP_CodeSniffer_CLI();
|
432 |
|
3 |
|
4 |
use SiteGround_Optimizer\SiteGround_Optimizer;
|
5 |
use SiteGround_Optimizer\Rest\Rest;
|
6 |
+
|
7 |
/**
|
8 |
* Handle PHP compatibility checks.
|
9 |
*/
|
427 |
* @return string $report The plugin compatibility report.
|
428 |
*/
|
429 |
public function process_dir( $dir, $php_version ) {
|
430 |
+
if ( class_exists( 'PHPCompatibility\PHPCSHelper' ) ) {
|
431 |
+
call_user_func( array( 'PHPCompatibility\PHPCSHelper', 'setConfigData' ), 'testVersion', $php_version, true );
|
432 |
+
} else {
|
433 |
+
\PHP_CodeSniffer::setConfigData( 'testVersion', $php_version, true );
|
434 |
+
}
|
435 |
|
436 |
$codesniffer_cli = new \PHP_CodeSniffer_CLI();
|
437 |
|
helpers/sg-cachepress-react-strings.php
ADDED
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */
|
3 |
+
$sg_cachepress_strings = array(
|
4 |
+
__( "Confirm", "sg-cachepress" ), // src-js/components/dialogs/async-dialog.tsx:18
|
5 |
+
__( "Defering render-blocking JavaScript may cause issues with scripts that require certain order of execution. This is why we advise you to check the frontend of your website after you enable this optimization.", "sg-cachepress" ), // src-js/components/dialogs/async-dialog.tsx:29
|
6 |
+
__( "If you notice issues with certain functionality, use the Exclude functionality to keep those scripts loading in a render-blocking manner.", "sg-cachepress" ), // src-js/components/dialogs/async-dialog.tsx:39
|
7 |
+
__( "Close", "sg-cachepress" ), // src-js/components/dialogs/cache-dialog.tsx:17
|
8 |
+
__( "Purge your installation's entire Dynamic Cache or select parts in order to achieve the best hit-to-cache ratio for your account. Here are the plugin's purge rules:", "sg-cachepress" ), // src-js/components/dialogs/cache-dialog.tsx:29
|
9 |
+
__( "Full Purge on page, posts, and category deletion, plugin and theme activation, deactivation, or update, and on WordPress core updates.", "sg-cachepress" ), // src-js/components/dialogs/cache-dialog.tsx:38
|
10 |
+
__( "Specific URL Purge on comment actions and page, post, and category updates.", "sg-cachepress" ), // src-js/components/dialogs/cache-dialog.tsx:48
|
11 |
+
__( "Cancel", "sg-cachepress" ), // src-js/components/dialogs/delete-webp-dialog.tsx:17
|
12 |
+
__( "Confirm", "sg-cachepress" ), // src-js/components/dialogs/delete-webp-dialog.tsx:23
|
13 |
+
__( "This will delete all WebP files in your uploads folder! In case you need them, you will have to regenerate them again or restore that folder from a backup.", "sg-cachepress" ), // src-js/components/dialogs/delete-webp-dialog.tsx:34
|
14 |
+
__( "Cancel", "sg-cachepress" ), // src-js/components/dialogs/php-dialog.tsx:17
|
15 |
+
__( "Confirm", "sg-cachepress" ), // src-js/components/dialogs/php-dialog.tsx:23
|
16 |
+
__( "You’re switching to PHP %(version)s manually and you will stay on that version until you change it to a newer one. In case you experience any issues after the update, switch back the PHP version from your {{strong}}cPanel{{/strong}} > {{strong}}PHP Version Manager{{/strong}} tool.", "sg-cachepress" ), // src-js/components/dialogs/php-dialog.tsx:37
|
17 |
+
__( "You’re about to switch to Managed PHP service. This means that SiteGround will automatically update your PHP version once we are sure there’s a better, safer and more stable version.", "sg-cachepress" ), // src-js/components/dialogs/php-dialog.tsx:50
|
18 |
+
__( "Cancel", "sg-cachepress" ), // src-js/components/dialogs/regenerate-webp-dialog.tsx:17
|
19 |
+
__( "Confirm", "sg-cachepress" ), // src-js/components/dialogs/regenerate-webp-dialog.tsx:23
|
20 |
+
__( "Doing this will delete all WebP files in your uploads folder and generate them anew!", "sg-cachepress" ), // src-js/components/dialogs/regenerate-webp-dialog.tsx:34
|
21 |
+
__( "Cancel", "sg-cachepress" ), // src-js/components/dialogs/ssl-dialog.tsx:17
|
22 |
+
__( "Confirm", "sg-cachepress" ), // src-js/components/dialogs/ssl-dialog.tsx:23
|
23 |
+
__( "In order to force HTTPS on your site, we will automatically update your database replacing all insecure links. In addition to that, we will add a rule in your .htaccess file, forcing all requests to go through encrypted connection.", "sg-cachepress" ), // src-js/components/dialogs/ssl-dialog.tsx:35
|
24 |
+
__( "Close", "sg-cachepress" ), // src-js/components/dialogs/urls-dialog.tsx:17
|
25 |
+
__( "You can exclude full or partial URLs using \"*\" as a wildcard. For example:", "sg-cachepress" ), // src-js/components/dialogs/urls-dialog.tsx:29
|
26 |
+
__( "{{strong}}www.site.com/parent-page/sub-page{{/strong}} will exclude only that single URL.", "sg-cachepress" ), // src-js/components/dialogs/urls-dialog.tsx:38
|
27 |
+
__( "{{strong}}www.site.com/parent-page/*{{/strong}} will exclude all sub-pages of \"parent-page\".", "sg-cachepress" ), // src-js/components/dialogs/urls-dialog.tsx:54
|
28 |
+
__( "Test URLs for Cache Status", "sg-cachepress" ), // src-js/components/cache-tester/index.tsx:56
|
29 |
+
__( "Check if the Dynamic Cache is working on a certain URL. Especially useful to make sure your Exclude list is working the way it should.", "sg-cachepress" ), // src-js/components/cache-tester/index.tsx:59
|
30 |
+
__( "Test", "sg-cachepress" ), // src-js/components/cache-tester/index.tsx:87
|
31 |
+
__( "This item already exists in exclude list.", "sg-cachepress" ), // src-js/components/exclude/simple-exclude.tsx:46
|
32 |
+
__( "You must input a class name.", "sg-cachepress" ), // src-js/components/exclude/simple-exclude.tsx:56
|
33 |
+
__( "Exclude", "sg-cachepress" ), // src-js/components/exclude/simple-exclude.tsx:131
|
34 |
+
__( "This URL already exists in exclude list.", "sg-cachepress" ), // src-js/components/exclude/urls-exclude.tsx:55
|
35 |
+
__( "Exclude", "sg-cachepress" ), // src-js/components/exclude/urls-exclude.tsx:142
|
36 |
+
__( "Please be patient, this process may take some time", "sg-cachepress" ), // src-js/components/loaders/image-loader.tsx:31
|
37 |
+
__( "Optimized %(optimized)s of %(total)s images", "sg-cachepress" ), // src-js/components/loaders/image-loader.tsx:35
|
38 |
+
__( "Pause", "sg-cachepress" ), // src-js/components/loaders/image-loader.tsx:59
|
39 |
+
__( "Please be patient, this process may take some time", "sg-cachepress" ), // src-js/components/loaders/webp-loader.tsx:27
|
40 |
+
__( "Generated %(optimized)s of %(total)s webp copies", "sg-cachepress" ), // src-js/components/loaders/webp-loader.tsx:31
|
41 |
+
__( "Pause", "sg-cachepress" ), // src-js/components/loaders/webp-loader.tsx:55
|
42 |
+
__( "Generate WebP Copies of New Images", "sg-cachepress" ), // src-js/components/webp/webp.tsx:118
|
43 |
+
__( "WebP is a next generation image format supported by modern browers which greatly reduces the size of your images.", "sg-cachepress" ), // src-js/components/webp/webp.tsx:122
|
44 |
+
__( "Manage WebP Copies for Existing Images", "sg-cachepress" ), // src-js/components/webp/webp.tsx:139
|
45 |
+
__( "Generate or delete a WebP copy of your existing media library.", "sg-cachepress" ), // src-js/components/webp/webp.tsx:142
|
46 |
+
__( "Delete all WebP Files", "sg-cachepress" ), // src-js/components/webp/webp.tsx:160
|
47 |
+
__( "Bulk Generate WebP Files", "sg-cachepress" ), // src-js/components/webp/webp.tsx:176
|
48 |
+
__( "All WebP copies of your files have been generated successfully! Force {{link}}re-generation{{/link}} of your images.", "sg-cachepress" ), // src-js/components/webp/webp.tsx:201
|
49 |
+
__( "Browser Caching", "sg-cachepress" ), // src-js/components/modules/browser-cache/index.tsx:12
|
50 |
+
__( "Adds rules to store in your visitors browser cache to keep static content longer for better site performance.", "sg-cachepress" ), // src-js/components/modules/browser-cache/index.tsx:16
|
51 |
+
__( "Browser Caching", "sg-cachepress" ), // src-js/components/modules/browser-cache/index.tsx:33
|
52 |
+
__( "YOU HAVE A SITE TOOLS ACCOUNT", "sg-cachepress" ), // src-js/components/modules/browser-cache/index.tsx:38
|
53 |
+
__( "NGINX Direct Delivery takes care of your static resources including proper expiration dates for your browser caching.", "sg-cachepress" ), // src-js/components/modules/browser-cache/index.tsx:39
|
54 |
+
__( "Dynamic Caching", "sg-cachepress" ), // src-js/components/modules/dynamic-cache/index.tsx:61
|
55 |
+
__( "Store your content in the server’s memory for a faster access with this full-page caching solution powered by NGINX.", "sg-cachepress" ), // src-js/components/modules/dynamic-cache/index.tsx:65
|
56 |
+
__( "Manual Cache Purge", "sg-cachepress" ), // src-js/components/modules/dynamic-cache/index.tsx:93
|
57 |
+
__( "Clear the Dynamic Cache for your entire website.", "sg-cachepress" ), // src-js/components/modules/dynamic-cache/index.tsx:96
|
58 |
+
__( "Purge Cache", "sg-cachepress" ), // src-js/components/modules/dynamic-cache/index.tsx:109
|
59 |
+
__( "Purging ...", "sg-cachepress" ), // src-js/components/modules/dynamic-cache/index.tsx:109
|
60 |
+
__( "Automatic Cache Purge", "sg-cachepress" ), // src-js/components/modules/dynamic-cache/index.tsx:117
|
61 |
+
__( "Automatically perform a smart cache purge after every content modification.", "sg-cachepress" ), // src-js/components/modules/dynamic-cache/index.tsx:122
|
62 |
+
__( "See rules", "sg-cachepress" ), // src-js/components/modules/dynamic-cache/index.tsx:125
|
63 |
+
__( "Browser-Specific Caching", "sg-cachepress" ), // src-js/components/modules/dynamic-cache/index.tsx:131
|
64 |
+
__( "We recommend you to enable this feature {{strong}}only{{/strong}} if you’re experiencing issues with plugins, generating mobile version of your site or similar functionality. Once enabled, the cache has to be generated separately for different browsers which lowers its efficiency.", "sg-cachepress" ), // src-js/components/modules/dynamic-cache/index.tsx:136
|
65 |
+
__( "Excluding URLs", "sg-cachepress" ), // src-js/components/modules/dynamic-cache/index.tsx:148
|
66 |
+
__( "Use this feature if you want to exclude certain parts of your website from being cached and keep them dynamic.", "sg-cachepress" ), // src-js/components/modules/dynamic-cache/index.tsx:150
|
67 |
+
__( "See examples", "sg-cachepress" ), // src-js/components/modules/dynamic-cache/index.tsx:153
|
68 |
+
__( "Memcached Stopped. Please, enable it in your SiteGround control panel.", "sg-cachepress" ), // src-js/components/modules/memcached/index.tsx:29
|
69 |
+
__( "Memcached Stopped. Please, enable it in your SiteGround control panel.", "sg-cachepress" ), // src-js/components/modules/memcached/index.tsx:44
|
70 |
+
__( "Memcached", "sg-cachepress" ), // src-js/components/modules/memcached/index.tsx:59
|
71 |
+
__( "Powerful object caching for your site. It stores frequently executed queries to your databases and reuses them for better performance.", "sg-cachepress" ), // src-js/components/modules/memcached/index.tsx:63
|
72 |
+
__( "GZIP Compression", "sg-cachepress" ), // src-js/components/modules/gzip/index.tsx:13
|
73 |
+
__( "Enables a compression of the content that's delivered to your visitors browsers improving the network loading times of your site.", "sg-cachepress" ), // src-js/components/modules/gzip/index.tsx:17
|
74 |
+
__( "GZIP Compression", "sg-cachepress" ), // src-js/components/modules/gzip/index.tsx:34
|
75 |
+
__( "YOU HAVE A SITE TOOLS ACCOUNT", "sg-cachepress" ), // src-js/components/modules/gzip/index.tsx:39
|
76 |
+
__( "GZIP Compression is enabled by default automatically saving you bandwidth and improving the loading speeds of your pages.", "sg-cachepress" ), // src-js/components/modules/gzip/index.tsx:40
|
77 |
+
__( "Score Check", "sg-cachepress" ), // src-js/components/tabs/analytics/index.tsx:122
|
78 |
+
__( "Test how optimized your website is. Our performance check is powered by Google PageSpeed.", "sg-cachepress" ), // src-js/components/tabs/analytics/index.tsx:125
|
79 |
+
__( "Device Type", "sg-cachepress" ), // src-js/components/tabs/analytics/index.tsx:156
|
80 |
+
__( "URL", "sg-cachepress" ), // src-js/components/tabs/analytics/index.tsx:164
|
81 |
+
__( "Analyze", "sg-cachepress" ), // src-js/components/tabs/analytics/index.tsx:180
|
82 |
+
__( "Please Wait, We Are Performing a Google PageSpeed Test on Your Page", "sg-cachepress" ), // src-js/components/tabs/analytics/index.tsx:187
|
83 |
+
__( "There is nothing here yet", "sg-cachepress" ), // src-js/components/tabs/analytics/index.tsx:233
|
84 |
+
__( "Enable HTTPS", "sg-cachepress" ), // src-js/components/tabs/environment-optimization/index.tsx:97
|
85 |
+
__( "Configures your site to work correctly via HTTPS and forces a secure connection to your site.", "sg-cachepress" ), // src-js/components/tabs/environment-optimization/index.tsx:100
|
86 |
+
__( "Fix Insecure Content", "sg-cachepress" ), // src-js/components/tabs/environment-optimization/index.tsx:142
|
87 |
+
__( "Enable this option in case you’re getting insecure content errors on your website. We will dynamically rewrite insecure requests for resources coming from your site", "sg-cachepress" ), // src-js/components/tabs/environment-optimization/index.tsx:145
|
88 |
+
__( "Minify the HTML Output", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:92
|
89 |
+
__( "Removes unnecessary characters from your HTML output saving data and improving your site speed. ", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:97
|
90 |
+
__( "Exclude URLs from HTML Minification", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:102
|
91 |
+
__( "Exclude URLs from HTML Minification", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:122
|
92 |
+
__( "With this functionality, you can exclude different pages from HTML minification.", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:123
|
93 |
+
__( "Minify JavaScript Files", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:139
|
94 |
+
__( "Minify your JavaScript files in order to reduce their size and reduce the number of requests to the server. ", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:144
|
95 |
+
__( "Exclude from JavaScript Minification", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:149
|
96 |
+
__( "Defer Render-blocking JS", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:181
|
97 |
+
__( "Defer loading of render-blocking JavaScript files for faster initial site load. ", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:186
|
98 |
+
__( "Exclude from Loading JS Files Asynchronously", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:191
|
99 |
+
__( "Minify CSS Files", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:223
|
100 |
+
__( "Minify your CSS files in order to reduce their size and reduce the number of requests to the server. ", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:228
|
101 |
+
__( "Exclude From CSS Minification", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:233
|
102 |
+
__( "Combine CSS Files", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:265
|
103 |
+
__( "Combine multiple CSS files into one to lower the number of requests your site generates. ", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:270
|
104 |
+
__( "Exclude from CSS Combination", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:275
|
105 |
+
__( "Optimize Loading of Google Fonts", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:307
|
106 |
+
__( "Combine the loading of Google fonts reducing the number of HTTP requests.", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:312
|
107 |
+
__( "Remove Query Strings From Static Resources", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:318
|
108 |
+
__( "Removes version query strings from your static resources improving the caching of those resources.", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:323
|
109 |
+
__( "Disable Emojis", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:329
|
110 |
+
__( "Enable to prevent WordPress from automatically detecting and generating emojis in your pages.", "sg-cachepress" ), // src-js/components/tabs/frontend-optimization/index.tsx:334
|
111 |
+
__( "New Images Optimization", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:84
|
112 |
+
__( "We will automatically optimize all new images that you upload to your Media Library.", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:88
|
113 |
+
__( "Existing Images Optimization", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:104
|
114 |
+
__( "We will optimize all your existing images with minimal or no loss in quality. Note, that this will overwrite your original images.", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:107
|
115 |
+
__( "Resume Optimization", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:125
|
116 |
+
__( "Start Optimization", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:125
|
117 |
+
__( "We've detected that the WordPress cronjob functionality is not working. Please, enable it following the instructions in {{link}}this article{{/link}} and refresh this page. If you’re using a real cron job, you can {{link2}}ignore this message{{/link2}} at your own risk. Note, that in this case, those operations may take longer than usual to complete.", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:140
|
118 |
+
__( "https://www.siteground.com/kb/disable-enable-wordpress-cron/", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:144
|
119 |
+
__( "All images in your Media Library have been optimized successfully! Force {{link}}re-optimization{{/link}} of your images.", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:177
|
120 |
+
__( "Lazy Load Images", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:199
|
121 |
+
__( "Load images only when they are visible in the browser", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:203
|
122 |
+
__( "Lazy Load Gravatars", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:220
|
123 |
+
__( "When users comment under your posts, WordPress tries to load their avatars from gravatar.com. We recommend lazy-loading them as your users scroll down through your page if you have a high number of comments. ", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:224
|
124 |
+
__( "Lazy Load Thumbnails", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:232
|
125 |
+
__( "Enable if you want to lazy-load the thumbnail sizes of your original images.", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:236
|
126 |
+
__( "Lazy Load Responsive Images", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:244
|
127 |
+
__( "Certain plugins and themes generate multiple images from a single upload to work better on different devices. Enable if you want to lazy-load these too.", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:248
|
128 |
+
__( "Lazy Load Widgets", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:256
|
129 |
+
__( "Enable this option if you want the images in your widget areas to load only when users reach them. ", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:260
|
130 |
+
__( "Lazy Load for Mobile", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:268
|
131 |
+
__( "Enable if you want to use lazy-loading features for mobile requests to your site.", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:272
|
132 |
+
__( "Lazy Load Product Images", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:282
|
133 |
+
__( "Enable if you want to enable lazy-load images in your store, product and other WooCommerce pages.", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:286
|
134 |
+
__( "Exclude from Lazy Load", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:297
|
135 |
+
__( "In order to exclude images from lazy loading, please add their CSS classes to the exclusion list. Add each CSS class on a separate line.", "sg-cachepress" ), // src-js/components/tabs/image-optimization/index.tsx:298
|
136 |
+
__( "Site Admin Permissions", "sg-cachepress" ), // src-js/components/tabs/multisite-control/index.tsx:85
|
137 |
+
__( "In this section, set the access permission for admins of separate sites.", "sg-cachepress" ), // src-js/components/tabs/multisite-control/index.tsx:88
|
138 |
+
__( "SuperCacher Settings", "sg-cachepress" ), // src-js/components/tabs/multisite-control/index.tsx:115
|
139 |
+
__( "Select whether site admins can access and make changes within the SiteGround Optimizer's SuperCacher tab.", "sg-cachepress" ), // src-js/components/tabs/multisite-control/index.tsx:118
|
140 |
+
__( "Frontend Optimizations", "sg-cachepress" ), // src-js/components/tabs/multisite-control/index.tsx:147
|
141 |
+
__( "Select whether site admins can access and make changes within the SiteGround Optimizer's Frontend Optmization tab.", "sg-cachepress" ), // src-js/components/tabs/multisite-control/index.tsx:150
|
142 |
+
__( "Image Optimizations", "sg-cachepress" ), // src-js/components/tabs/multisite-control/index.tsx:177
|
143 |
+
__( "Select whether site admins can access and make changes within the SiteGround Optimizer's Image Optimization tab.", "sg-cachepress" ), // src-js/components/tabs/multisite-control/index.tsx:180
|
144 |
+
__( "Environment Optimizations", "sg-cachepress" ), // src-js/components/tabs/multisite-control/index.tsx:207
|
145 |
+
__( "Select whether site admins can access and make changes within the SiteGround Optimizer's Environment Optimization tab.", "sg-cachepress" ), // src-js/components/tabs/multisite-control/index.tsx:210
|
146 |
+
__( "SUPERCACHER SETTINGS", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:37
|
147 |
+
__( "Dynamic Caching", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:54
|
148 |
+
__( "Select whether new sites should have the Dynamic Caching enabled for them or not.", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:57
|
149 |
+
__( "Automatic Cache Purge", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:100
|
150 |
+
__( "Automatically perform a smart cache purge after every content modification.", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:103
|
151 |
+
__( "ENVIRONMENT OPTIMIZATION", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:139
|
152 |
+
__( "Enable HTTPS", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:160
|
153 |
+
__( "Configures your site to work correctly via HTTPS and forces a secure connection to your site.", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:163
|
154 |
+
__( "Fix Insecure Content", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:205
|
155 |
+
__( "Enable this option in case you’re getting insecure content errors on your website. We will dynamically rewrite insecure requests for resources coming from your site", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:208
|
156 |
+
__( "FRONTEND OPTIMIZATION", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:243
|
157 |
+
__( "Minify the HTML Output", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:260
|
158 |
+
__( "Removes unnecessary characters from your HTML output saving data and improving your site speed.", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:263
|
159 |
+
__( "Minify JavaScript Files", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:293
|
160 |
+
__( "Combine and minify your JavaScript files in order to reduce their size, improve cachability, and reduce the number of requests to the server.", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:296
|
161 |
+
__( "Load Render-blocking JavaScript Files Asynchronously", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:326
|
162 |
+
__( "Add async parameter to the JavaScript files loaded in the header section of your site so they don’t block your page rendering.", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:329
|
163 |
+
__( "Minify CSS Files", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:359
|
164 |
+
__( "Combine and minify your CSS files in order to reduce their size, improve cachability, and reduce the number of requests to the server.", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:362
|
165 |
+
__( "Combine CSS Files", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:392
|
166 |
+
__( "Combine multiple CSS files into one to lower the number of requests your site generates.", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:395
|
167 |
+
__( "Remove Query Strings From Static Resources", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:425
|
168 |
+
__( "Removes version query strings from your static resources improving the caching of those resources.", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:428
|
169 |
+
__( "Disable Emojis", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:458
|
170 |
+
__( "Enable to prevent WordPress from automatically detecting and generating emojis in your pages.", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:461
|
171 |
+
__( "IMAGE OPTIMIZATION", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:491
|
172 |
+
__( "Image Optimization", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:508
|
173 |
+
__( "We will optimize all your existing images with minimal or no loss in quality. Note, that this will overwrite your original images.", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:511
|
174 |
+
__( "Lazy Load Images", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:542
|
175 |
+
__( "Load images only when they are visible in the browser", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:545
|
176 |
+
__( "Lazy Load Gravatars", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:586
|
177 |
+
__( "When users comment under your posts, WordPress tries to load their avatars from gravatar.com. We recommend lazy-loading them as your users scroll down through your page if you have a high number of comments. ", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:589
|
178 |
+
__( "Lazy Load Thumbnails", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:620
|
179 |
+
__( "Enable if you want to lazy-load the thumbnail sizes of your original images.", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:623
|
180 |
+
__( "Lazy Load Responsive Images", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:654
|
181 |
+
__( "Certain plugins and themes generate multiple images from a single upload to work better on different devices. Enable if you want to lazy-load these too.", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:657
|
182 |
+
__( "Lazy Load Widgets", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:689
|
183 |
+
__( "Enable this option if you want the images in your widget areas to load only when users reach them. ", "sg-cachepress" ), // src-js/components/tabs/sites-control/index.tsx:692
|
184 |
+
__( "SG Optimizer", "sg-cachepress" ), // src-js/containers/main/index.tsx:43
|
185 |
+
__( "Get the best performance for your WordPress website with our optimization plugin. It handles caching, system settings, and all the necessary configurations for a blazing-fast website. With the SiteGround Optimizer enabled, you're getting the very best from your hosting environment!", "sg-cachepress" ), // src-js/containers/main/index.tsx:44
|
186 |
+
__( "Old PHP Version", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:171
|
187 |
+
__( "You are using our Managed PHP service, which means that SiteGround will automatically update your PHP once we are sure there is a newer stable one, which comes with the latest security and performance enhancements. Alternatively, you can choose to manually set your PHP version, in which case the system will hardcode that version to your WordPress instance until you manually change it again.", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:195
|
188 |
+
__( "Your site will keep using that version until you manually change it from this interface or until you switch to \"Managed PHP\" service. If you choose to take advantage of our Managed PHP service, SiteGround will automatically update your PHP once we are sure there is a newer stable one, which comes with the latest security and performance enhancements.", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:200
|
189 |
+
__( "As a SiteGround client you may change your PHP version per site manually. However, we strongly recommend you to take advantage of our Managed PHP service, which means that SiteGround will automatically update your PHP once we are sure there is a newer, stable and safe version, which will give you the latest security and performance enhancements. Alternatively, if you choose to manually set your PHP version, the system will hardcode that version to your WordPress instance until you manually change it again.", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:205
|
190 |
+
__( "Set your PHP version", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:228
|
191 |
+
__( "You are currently running on PHP %(version)s.", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:233
|
192 |
+
__( "PHP Management Method", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:245
|
193 |
+
__( "Please select method", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:246
|
194 |
+
__( "Please select management type", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:251
|
195 |
+
__( "PHP Version", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:261
|
196 |
+
__( "Please select PHP version", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:262
|
197 |
+
__( "Please select PHP version", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:267
|
198 |
+
__( "Save", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:289
|
199 |
+
__( "We currently recommend you to use PHP %(version)s. You can check the compatibility with the recommended version before you switch. {{link}}Check Compatibility{{/link}}", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:305
|
200 |
+
__( "All your plugins are compatible with PHP %(version)s. You may safely switch to “Managed PHP” service and we’ll upgrade it automatically, or set it manually. {{link}}Check Again{{/link}}", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:329
|
201 |
+
__( "Checking PHP 7.1 Compatibility...", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:350
|
202 |
+
__( "Unfortunately some of your plugins or theme are not compatible with our recommended version. {{link}}Check Again{{/link}}", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:371
|
203 |
+
__( "We've detected that the WordPress cronjob functionality is not working. Please, enable it following the instructions in {{link}}this article{{/link}} and refresh this page. If you’re using a real cron job, you can {{link2}}ignore this message{{/link2}} at your own risk. Note, that in this case, those operations may take longer than usual to complete.", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:399
|
204 |
+
__( "https://www.siteground.com/kb/disable-enable-wordpress-cron/", "sg-cachepress" ), // src-js/containers/php-checker/index.tsx:403
|
205 |
+
__( "Thanks for using SG Optimizer to make your site faster!", "sg-cachepress" ), // src-js/containers/rating/index.tsx:61
|
206 |
+
__( "Help more people optimize their sites by rating our plugin.", "sg-cachepress" ), // src-js/containers/rating/index.tsx:68
|
207 |
+
__( "Don’t Show This Again", "sg-cachepress" ), // src-js/containers/rating/index.tsx:78
|
208 |
+
);
|
209 |
+
/* THIS IS THE END OF THE GENERATED FILE */
|
languages/json/sg-cachepress-es_ES.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"":{"domain":"sg-cachepress","plural_forms":"nplurals=2; plural=n != 1;","lang":"es_ES"},"Test URLs for Cache Status":["Prueba las URLs para saber el estado de la caché"],"Check if the Dynamic Cache is working on a certain URL. Especially useful to make sure your Exclude list is working the way it should.":["Comprueba si la caché dinámica funciona en una determinada URL. Especialmente útil para asegurar que tu lista de exclusión funciona de forma correcta."],"Test":["Probar"],"Confirm":["Confirmar"],"Defering render-blocking JavaScript may cause issues with scripts that require certain order of execution. This is why we advise you to check the frontend of your website after you enable this optimization.":["La Carga diferida del bloqueador de visualización JS puede causar incidencias con los scripts que requieren un cierto orden para ejecutarse. Es por esto que te recomendamos revisar el frontend de tu web antes de activar esta optimización."],"If you notice issues with certain functionality, use the Exclude functionality to keep those scripts loading in a render-blocking manner.":["Si notas alguna incidencia con alguna funcionalidad, utiliza la funcionalidad Excluir para mantener la carga de esos scripts incluso con el bloqueador de visualización."],"Close":["Cerrar"],"Purge your installation's entire Dynamic Cache or select parts in order to achieve the best hit-to-cache ratio for your account. Here are the plugin's purge rules:":["Purga la cache dinámica de tu instalación o selecciona partes para obtener el mejor ratio de peticiones de caché para tu cuenta. Aquí tienes las reglas de vaciado del plugin:"],"Full Purge on page, posts, and category deletion, plugin and theme activation, deactivation, or update, and on WordPress core updates.":["Vaciado completo en la página, entradas y categorías eliminadas, activación de plugins y temas, desactivación o actualización, y en las actualizaciones principales de WordPress."],"Specific URL Purge on comment actions and page, post, and category updates.":["Vaciado de una URL específica en acciones y páginas sugeridas, publicaciones y categorías actualizadas."],"Cancel":["Cancelar"],"This will delete all WebP files in your uploads folder! In case you need them, you will have to regenerate them again or restore that folder from a backup.":["¡Esto eliminara todos los archivos WebP del directorio de subidas! En caso de que los necesitaras, tendrías que regenerarlos nuevamente o restaurar el directorio desde una copia de seguridad."],"You’re switching to PHP %(version)s manually and you will stay on that version until you change it to a newer one. In case you experience any issues after the update, switch back the PHP version from your {{strong}}cPanel{{/strong}} > {{strong}}PHP Version Manager{{/strong}} tool.":["Estas cambiando manualmente a PHP %(version)s y se utilizará esta versión hasta que sea cambiada manualmente a una nueva. En caso de que haya incidencias después del cambio, vuelve a la versión PHP anterior desde tu {{strong}}cPanel{{/strong}} > {{strong}}PHP Version Manager{{/strong}}."],"You’re about to switch to Managed PHP service. This means that SiteGround will automatically update your PHP version once we are sure there’s a better, safer and more stable version.":["Estas a punto de cambiar al servicio PHP gestionado. permitiendo que SiteGround automáticamente actualice tu versión PHP una vez estemos seguros que hay una versión nueva, segura y estable."],"Doing this will delete all WebP files in your uploads folder and generate them anew!":["Esto eliminará todos los archivos WebP en tus directorio y los generará nuevamente."],"In order to force HTTPS on your site, we will automatically update your database replacing all insecure links. In addition to that, we will add a rule in your .htaccess file, forcing all requests to go through encrypted connection.":["Para forzar HTTPS en tu página actualizaremos automáticamente tu base de datos reemplazando todos los enlaces inseguros. Además de esto, añadiremos una regla en tu archivo .htaccess, forzando todas las peticiones a través de una conexión cifrada."],"You can exclude full or partial URLs using \"*\" as a wildcard. For example:":["Puedes excluir de forma parcial o total la URL usando «*» como comodín. Por ejemplo:"],"{{strong}}www.site.com/parent-page/sub-page{{/strong}} will exclude only that single URL.":["{{strong}}www.sitio.com/pagina-superior/sub-pagina{{/strong}} excluirá solo esa URL."],"{{strong}}www.site.com/parent-page/*{{/strong}} will exclude all sub-pages of \"parent-page\".":["{{strong}}www.sitio.com/pagina-superior/*{{/strong}} se excluirá de todas las sub-paginas de la «pagina-superior»."],"This item already exists in exclude list.":["Este objeto ya existe en la lista de excluídos."],"You must input a class name.":["Es necesario que introduzcas una nombre de clase."],"Exclude":["Excluir"],"This URL already exists in exclude list.":["Esta URL ya existe en la lista de exclusión."],"Please be patient, this process may take some time":["Por favor, se paciente, el proceso puede llevar un tiempo"],"Optimized %(optimized)s of %(total)s images":["Imágenes optimizadas %(optimized)s de %(total)s"],"Pause":["Pausar"],"Generated %(optimized)s of %(total)s webp copies":["Copias WebP generadas %(optimized)s de %(total)s"],"Generate WebP Copies of New Images":["Genera copias WebP de nuevas imágenes"],"WebP is a next generation image format supported by modern browers which greatly reduces the size of your images.":["WebP es la siguiente generación de formato de imágenes que es soportado por los navegadores modernos y que reduce en gran parte el tamaño de tus imágenes."],"Manage WebP Copies for Existing Images":["Administra las copias WebP para imágenes existentes"],"Generate or delete a WebP copy of your existing media library.":["Genera o elimina una copia WebP de tu librería de medios."],"Delete all WebP Files":["Elimina todos los archivos WebP"],"Bulk Generate WebP Files":["Generación masiva de archivos WebP."],"All WebP copies of your files have been generated successfully! Force {{link}}re-generation{{/link}} of your images.":["Todas las copias WebP de tus archivos han sido generadas correctamente. Fuerza la {{link}}regeneración{{/link}} de tus imágenes."],"Browser Caching":["Caché del navegador"],"Adds rules to store in your visitors browser cache to keep static content longer for better site performance.":["Agrega reglas de almacenamiento en la caché del navegador de los visitantes para mantener el contenido estático un período más largo para un mejor rendimiento de la web."],"YOU HAVE A SITE TOOLS ACCOUNT":["TIENES UNA CUENTA DE SITE TOOLS"],"NGINX Direct Delivery takes care of your static resources including proper expiration dates for your browser caching.":["NGINX Direct Delivery se encarga de los recursos estáticos incluyendo la correcta fecha de expiración para la cache de tu navegador."],"Dynamic Caching":["Caché dinámica"],"Store your content in the server’s memory for a faster access with this full-page caching solution powered by NGINX.":["Almacena tu contenido en la memoria del servidor para un acceso más rápido con esta solución de página completa de caché por NGINX."],"Manual Cache Purge":["Vaciado manual de caché"],"Clear the Dynamic Cache for your entire website.":["Vacía la caché dinámica de toda tu web."],"Purge Cache":["Vaciar caché"],"Purging ...":["Vaciando ..."],"Automatic Cache Purge":["Vaciado automático de la caché"],"Automatically perform a smart cache purge after every content modification.":["Lleva a cabo un vaciado inteligente de la caché después de cada modificación de contenido."],"See rules":["Ver reglas"],"Browser-Specific Caching":["Almacenamiento en caché específico del navegador"],"We recommend you to enable this feature {{strong}}only{{/strong}} if you’re experiencing issues with plugins, generating mobile version of your site or similar functionality. Once enabled, the cache has to be generated separately for different browsers which lowers its efficiency.":["Recomendamos habilitar esta función {{strong}}solo{{/strong}} si se experimentan problemas con plugins, generando la versión móvil de su página web o alguna funcionalidad similar. Una vez habilitado, el caché debe generarse por separado para diferentes navegadores, lo que reduce su eficiencia."],"Excluding URLs":["Excluir URLs"],"Use this feature if you want to exclude certain parts of your website from being cached and keep them dynamic.":["Usa esta característica si quieres que ciertas partes de tu web queden excluidas de la caché y así mantenerlas dinámicas."],"See examples":["Ver ejemplos"],"Memcached Stopped. Please, enable it in your SiteGround control panel.":["Memcached detenido. Por favor, habilítalo en tu panel de control de SiteGround."],"Memcached":["Memcached"],"Powerful object caching for your site. It stores frequently executed queries to your databases and reuses them for better performance.":["Herramienta de cache de objetos para tu sitio. Almacena las consultas ejecutadas con frecuencia en tu base de datos y las reutiliza para un mejor rendimiento."],"GZIP Compression":["Compresión GZIP"],"Enables a compression of the content that's delivered to your visitors browsers improving the network loading times of your site.":["Activa la compresión del contenido que se envía a los navegadores de los visitantes ,mejorando los tiempo de carga de tu sitio."],"GZIP Compression is enabled by default automatically saving you bandwidth and improving the loading speeds of your pages.":["La compresión GZIP está habilitada de forma predeterminada, lo que te ahorra ancho de banda y mejora la velocidad de carga de tus páginas."],"Score Check":["Revisar resultado"],"Test how optimized your website is. Our performance check is powered by Google PageSpeed.":["Revisa cuán optimizado esta tu web. Nuestro test de rendimiento se basa en Google PageSpeed."],"Device Type":["Tipo de dispositiv"],"URL":["URL"],"Analyze":["Analizar"],"Please Wait, We Are Performing a Google PageSpeed Test on Your Page":["Espera, por favor, estamos realizando un test con Google PageSpeed en tu web"],"There is nothing here yet":["No nada aquí todavía"],"Enable HTTPS":["Activar HTTPS"],"Configures your site to work correctly via HTTPS and forces a secure connection to your site.":["Configura tu sitio para que funcione de forma correcta a través de HTTPS y fuerza una conexión segura en tu sitio."],"Fix Insecure Content":["Corregir contenido inseguro"],"Enable this option in case you’re getting insecure content errors on your website. We will dynamically rewrite insecure requests for resources coming from your site":["Activa esta opción en caso de que estés recibiendo errores de contenido inseguro en tu web. Nosotros reescribiremos dinámicamente las peticiones inseguras de los recursos de tu sitio"],"Minify the HTML Output":["Minimizar la salida HTML"],"Removes unnecessary characters from your HTML output saving data and improving your site speed. ":["Elimina los caracteres innecesarios de tu código HTML de salida y mejora la velocidad de tu sitio."],"Exclude URLs from HTML Minification":["Excluir las direcciones URL de la minificación de HTML"],"With this functionality, you can exclude different pages from HTML minification.":["Con esta funcionalidad puedes excluir diferentes páginas de minificación de HTML."],"Minify JavaScript Files":["Minimizar archivos JavaScript"],"Minify your JavaScript files in order to reduce their size and reduce the number of requests to the server. ":["Minificar los archivos de JavaScript con el fin de reducir su tamaño y reducir el número de peticiones al servidor."],"Exclude from JavaScript Minification":["Excluir de la minificación de JavaScript"],"Defer Render-blocking JS":["Carga diferida del bloqueador de visualización JS"],"Defer loading of render-blocking JavaScript files for faster initial site load. ":["Carga diferida de archivos JavaScript que bloquean el procesamiento para una carga inicial más rápida del sitio."],"Exclude from Loading JS Files Asynchronously":["Excluir de carga de archivos JS de forma asíncrona"],"Minify CSS Files":["Minimizar archivos CSS"],"Minify your CSS files in order to reduce their size and reduce the number of requests to the server. ":["Minificar tus archivos CSS con el fin de reducir su tamaño y reducir el número de peticiones al servidor."],"Exclude From CSS Minification":["Excluir de la minificación de CSS"],"Combine CSS Files":["Combinar archivos CSS"],"Combine multiple CSS files into one to lower the number of requests your site generates. ":["Combinar varios archivos CSS en uno sola para reducir el número de solicitudes que genera tu sitio."],"Exclude from CSS Combination":["Excluir de la combinación de CSS"],"Optimize Loading of Google Fonts":["Optimiza la carga de las fuentes de Google"],"Combine the loading of Google fonts reducing the number of HTTP requests.":["Combina la carga de las fuentes de Google reduciendo el número de peticiones HTTP."],"Remove Query Strings From Static Resources":["Eliminar cadenas de petición de recursos estáticos"],"Removes version query strings from your static resources improving the caching of those resources.":["Elimina la cadena de peticiones the tus recursos estáticos para mejorar la caché de esos recursos."],"Disable Emojis":["Desactivar Emojis"],"Enable to prevent WordPress from automatically detecting and generating emojis in your pages.":["Activar para impedir que WordPress detecte y genere automáticamente emojis en tus páginas."],"Site Admin Permissions":["Permisos de administrador del sitio"],"In this section, set the access permission for admins of separate sites.":["En esta sección, configura los permisos para los administrador de distintas webs."],"SuperCacher Settings":["Ajustes de SuperCacher"],"Select whether site admins can access and make changes within the SiteGround Optimizer's SuperCacher tab.":["Selecciona si los administradores pueden acceder y hacer cambios en la pestaña SuperCacher de SiteGround Optimizer."],"Frontend Optimizations":["Optimizaciones en portada"],"Select whether site admins can access and make changes within the SiteGround Optimizer's Frontend Optmization tab.":["Selecciona si los administradores pueden acceder y hacer cambios en la pestaña de optimización en portada de SiteGround Optimizer."],"Image Optimizations":["Optimizaciones de imágenes"],"Select whether site admins can access and make changes within the SiteGround Optimizer's Image Optimization tab.":["Selecciona si los administradores pueden acceder y hacer cambios en la pestaña de optimización de imágenes de SiteGround Optimizer."],"Environment Optimizations":["Optimización del entorno"],"Select whether site admins can access and make changes within the SiteGround Optimizer's Environment Optimization tab.":["Selecciona si los administradores de la página pueden acceder y hacer cambios dentro de la pestaña de optimización del entorno de SiteGround Optimizer."],"New Images Optimization":["Optimización de nuevas imágenes"],"We will automatically optimize all new images that you upload to your Media Library.":["Optimizaremos automáticamente todas las nuevas imágenes que se suban a tu biblioteca de medios."],"Existing Images Optimization":["Optimización de imágenes existentes"],"We will optimize all your existing images with minimal or no loss in quality. Note, that this will overwrite your original images.":["Optimizaremos todas tus imágenes con un perdida mínima o nula de calidad. Ten en cuenta que esto sobreescribirá tus imágenes originales."],"Resume Optimization":["Reanudar optimización"],"Start Optimization":["Comenzar optimización"],"We've detected that the WordPress cronjob functionality is not working. Please, enable it following the instructions in {{link}}this article{{/link}} and refresh this page. If you’re using a real cron job, you can {{link2}}ignore this message{{/link2}} at your own risk. Note, that in this case, those operations may take longer than usual to complete.":["Hemos detectado que la funcionalidad cronjob de WordPress no funciona. Por favor, actívala siguiendo las instrucciones de {{link}}este artículo{{/link}} y actualiza esta página. Si estás utilizando una tarea cron real, puedes {{link2}}ignorar este mensaje{{/link2}} bajo tu propio riesgo. Ten en cuenta que, en este caso, estas operaciones pueden tardar más de lo habitual en completarse."],"https://www.siteground.com/kb/disable-enable-wordpress-cron/":["https://www.siteground.es/kb/administrar-wordpress-cron/"],"All images in your Media Library have been optimized successfully! Force {{link}}re-optimization{{/link}} of your images.":["¡Todas las imágenes guardadas en la biblioteca de medios han sido optimizadas correctamente! Forzar la {{link}}re-optimización{{/link}} de tus imágenes."],"Lazy Load Images":["Carga diferida de imágenes"],"Load images only when they are visible in the browser":["Carga las imágenes solo cuando son visibles en el navegador"],"Lazy Load Gravatars":["Carga diferida de Gravatars"],"When users comment under your posts, WordPress tries to load their avatars from gravatar.com. We recommend lazy-loading them as your users scroll down through your page if you have a high number of comments. ":["Cuando los usuarios comentan en tus publicaciones, WordPress intenta cargar sus avatares desde gravatar.com. Recomendamos una carga diferida mientras los usuarios se desplazan por tu página cuando tienes un número elevado de comentarios. "],"Lazy Load Thumbnails":["Carga diferida de miniaturas"],"Enable if you want to lazy-load the thumbnail sizes of your original images.":["Actívalo si quieres una carga diferida de las miniaturas de tus imágenes originales."],"Lazy Load Responsive Images":["Carga diferida de imágenes adaptables"],"Certain plugins and themes generate multiple images from a single upload to work better on different devices. Enable if you want to lazy-load these too.":["Algunos plugins y temas generan múltiples imágenes desde una sola subida para trabajar mejor en diferentes dispositivos. Actívalo si deseas cargar estas de forma diferida."],"Lazy Load Widgets":["Carga diferida de widgets"],"Enable this option if you want the images in your widget areas to load only when users reach them. ":["Activa esta opción si quieres las imágenes en tus widgets se carguen solo cuando los usuarios accedan a ellas. "],"Lazy Load for Mobile":["Lazy Load para móviles"],"Enable if you want to use lazy-loading features for mobile requests to your site.":["Habilite si desea utilizar funciones de carga diferida (lazy load) para peticiones a su sitio desde móviles."],"Lazy Load Product Images":["Carga diferida de imágenes de producto"],"Enable if you want to enable lazy-load images in your store, product and other WooCommerce pages.":["Activa la carga diferida de imágenes en tu tienda, productos y otras páginas de WooCommerce."],"Exclude from Lazy Load":["Excluir de carga de imágenes asíncrona"],"In order to exclude images from lazy loading, please add their CSS classes to the exclusion list. Add each CSS class on a separate line.":["Con el fin de excluir las imágenes de carga asíncrona, por favor agrega tus clases CSS a la lista de exclusión. Añade cada clase CSS en una línea separada."],"SUPERCACHER SETTINGS":["AJUSTES DE SUPERCACHER"],"Select whether new sites should have the Dynamic Caching enabled for them or not.":["Seleccionar si las nuevas páginas deberían tener la caché dinámica activada o no."],"ENVIRONMENT OPTIMIZATION":["OPTIMIZACIÓN DEL ENTORNO"],"FRONTEND OPTIMIZATION":["OPTIMIZACIÓN DE PORTADA"],"Removes unnecessary characters from your HTML output saving data and improving your site speed.":["Elimina caracteres innecesarios de tu HTML, guardando los datos y mejorando la velocidad de tu sitio."],"Combine and minify your JavaScript files in order to reduce their size, improve cachability, and reduce the number of requests to the server.":["Combina y minimiza tus archivos JavaScript para reducir su tamaño, mejorar la caché y reducir el número de peticiones al servidor."],"Load Render-blocking JavaScript Files Asynchronously":["Carga asíncrona de los archivos JavaScript que bloquean la visualización"],"Add async parameter to the JavaScript files loaded in the header section of your site so they don’t block your page rendering.":["Añade el parámetro async a los archivos JavaScript cargados en la sección de cabecera de tu sitio para que no bloqueen la visualización de tu página."],"Combine and minify your CSS files in order to reduce their size, improve cachability, and reduce the number of requests to the server.":["Combina y minimiza tus archivos CSS para reducir su tamaño, mejorar la caché y reducir el número de peticiones al servidor."],"Combine multiple CSS files into one to lower the number of requests your site generates.":["Combina varios archivos CSS en uno para reducir el número de peticiones que genera tu sitio."],"IMAGE OPTIMIZATION":["OPTIMIZACIÓN DE IMÁGENES"],"Image Optimization":["Optimización de imágenes"],"SG Optimizer":["SG Optimizer"],"Get the best performance for your WordPress website with our optimization plugin. It handles caching, system settings, and all the necessary configurations for a blazing-fast website. With the SiteGround Optimizer enabled, you're getting the very best from your hosting environment!":["Obtén el mejor rendimiento de tu web WordPress con nuestro plugin de optimización. Gestiona la caché, ajustes de sistema y todas las configuraciones necesarias para tener una web rápida como el rayo. ¡Con SiteGround Optimizer activado obtienes el mejor rendimiento de tu entorno de alojamiento!"],"Old PHP Version":["Antigua versión PHP"],"You are using our Managed PHP service, which means that SiteGround will automatically update your PHP once we are sure there is a newer stable one, which comes with the latest security and performance enhancements. Alternatively, you can choose to manually set your PHP version, in which case the system will hardcode that version to your WordPress instance until you manually change it again.":["Estas utilizando el servicio PHP gestionado, permitiendo que SiteGround automáticamente actualice tu versión PHP una vez estemos seguros que hay una versión nueva, segura y estable, lo que te ofrecerá las últimas ventajas en seguridad y rendimiento. Alternativamente, si eliges la versión de PHP de forma manual, el sistema aplicará esta versión en tu WordPress hasta que manualmente se vuelva a realizar el cambio."],"Your site will keep using that version until you manually change it from this interface or until you switch to \"Managed PHP\" service. If you choose to take advantage of our Managed PHP service, SiteGround will automatically update your PHP once we are sure there is a newer stable one, which comes with the latest security and performance enhancements.":["Tu sitio web seguirá utilizando la versión hasta que manualmente se realice el cambio desde esta interfaz o hasta que selecciones el servicio PHP gestionado. Si eliges tomar ventaja del servicio PHP gestionado, SiteGround automáticamente actualizará tu versión PHP una vez estemos seguros que hay una versión nueva, segura y estable, lo que te ofrecerá las últimas ventajas en seguridad y rendimiento."],"As a SiteGround client you may change your PHP version per site manually. However, we strongly recommend you to take advantage of our Managed PHP service, which means that SiteGround will automatically update your PHP once we are sure there is a newer, stable and safe version, which will give you the latest security and performance enhancements. Alternatively, if you choose to manually set your PHP version, the system will hardcode that version to your WordPress instance until you manually change it again.":["Como cliente de SiteGround tienes la posibilidad de cambiar la versión de PHP para cada web de forma manual. Sin embargo, nosotros te recomendamos aprovechar el servicio PHP gestionado, permitiendo que SiteGround automáticamente actualice tu versión PHP una vez estemos seguros que hay una versión nueva, segura y estable, lo que te ofrecerá las últimas ventajas en seguridad y rendimiento. Alternativamente, si eliges la versión de PHP de forma manual, el sistema aplicará esta versión en tu WordPress hasta que manualmente se vuelva a realizar el cambio."],"Set your PHP version":["Configurar tu versión PHP"],"You are currently running on PHP %(version)s.":["Actualmente estas utilizando PHP %(version)s."],"PHP Management Method":["PHP Gestionado"],"Please select method":["Por favor, selecciona el método"],"Please select management type":["Por favor, selecciona el tipo de configuración"],"PHP Version":["Versión PHP"],"Please select PHP version":["Por favor, selecciona la versión PHP"],"Save":["Guardar"],"We currently recommend you to use PHP %(version)s. You can check the compatibility with the recommended version before you switch. {{link}}Check Compatibility{{/link}}":["En estos momentos recomendamos usar la PHP %(version)s. Puedes revisar la compatibilidad con la versión recomendada antes de cambiar. {{link}}Revisar compatibilidad{{/link}}"],"All your plugins are compatible with PHP %(version)s. You may safely switch to “Managed PHP” service and we’ll upgrade it automatically, or set it manually. {{link}}Check Again{{/link}}":["Todos tus plugins son compatibles con PHP %(version)s. Puedes utilizar el servicio PHP gestionado y nosotros realizaremos la actualización de manera automática, o lo puedes hacer de forma manual. {{link}}Revisar de nuevo{{/link}} "],"Checking PHP 7.1 Compatibility...":["Revisando compatibilidad con PHP %(version)s..."],"Unfortunately some of your plugins or theme are not compatible with our recommended version. {{link}}Check Again{{/link}}":["Desafortunadamente, algunos de tus plugins o temas no son compatibles con la versión recomendada. {{link}}Revisar de nuevo{{/link}}"],"Thanks for using SG Optimizer to make your site faster!":["¡Gracias por usar SG Optimizer para hacer tu sitio más rápido!"],"Help more people optimize their sites by rating our plugin.":["Ayuda a más personas a optimizar sus sitios valorando nuestro plugin."],"Don’t Show This Again":["No mostrar esto de nuevo"]}
|
1 |
+
{"":{"domain":"sg-cachepress","plural_forms":"nplurals=2; plural=n != 1;","lang":"es_ES"},"Test URLs for Cache Status":["Prueba las URLs para saber el estado de la caché"],"Check if the Dynamic Cache is working on a certain URL. Especially useful to make sure your Exclude list is working the way it should.":["Comprueba si la caché dinámica funciona en una determinada URL. Especialmente útil para asegurar que tu lista de exclusión funciona de forma correcta."],"Test":["Probar"],"This item already exists in exclude list.":["Este objeto ya existe en la lista de excluídos."],"You must input a class name.":["Es necesario que introduzcas una nombre de clase."],"Exclude":["Excluir"],"This URL already exists in exclude list.":["Esta URL ya existe en la lista de exclusión."],"Confirm":["Confirmar"],"Defering render-blocking JavaScript may cause issues with scripts that require certain order of execution. This is why we advise you to check the frontend of your website after you enable this optimization.":["La Carga diferida del bloqueador de visualización JS puede causar incidencias con los scripts que requieren un cierto orden para ejecutarse. Es por esto que te recomendamos revisar el frontend de tu web antes de activar esta optimización."],"If you notice issues with certain functionality, use the Exclude functionality to keep those scripts loading in a render-blocking manner.":["Si notas alguna incidencia con alguna funcionalidad, utiliza la funcionalidad Excluir para mantener la carga de esos scripts incluso con el bloqueador de visualización."],"Close":["Cerrar"],"Purge your installation's entire Dynamic Cache or select parts in order to achieve the best hit-to-cache ratio for your account. Here are the plugin's purge rules:":["Purga la cache dinámica de tu instalación o selecciona partes para obtener el mejor ratio de peticiones de caché para tu cuenta. Aquí tienes las reglas de vaciado del plugin:"],"Full Purge on page, posts, and category deletion, plugin and theme activation, deactivation, or update, and on WordPress core updates.":["Vaciado completo en la página, entradas y categorías eliminadas, activación de plugins y temas, desactivación o actualización, y en las actualizaciones principales de WordPress."],"Specific URL Purge on comment actions and page, post, and category updates.":["Vaciado de una URL específica en acciones y páginas sugeridas, publicaciones y categorías actualizadas."],"Cancel":["Cancelar"],"This will delete all WebP files in your uploads folder! In case you need them, you will have to regenerate them again or restore that folder from a backup.":["¡Esto eliminara todos los archivos WebP del directorio de subidas! En caso de que los necesitaras, tendrías que regenerarlos nuevamente o restaurar el directorio desde una copia de seguridad."],"You’re switching to PHP %(version)s manually and you will stay on that version until you change it to a newer one. In case you experience any issues after the update, switch back the PHP version from your {{strong}}cPanel{{/strong}} > {{strong}}PHP Version Manager{{/strong}} tool.":["Estas cambiando manualmente a PHP %(version)s y se utilizará esta versión hasta que sea cambiada manualmente a una nueva. En caso de que haya incidencias después del cambio, vuelve a la versión PHP anterior desde tu {{strong}}cPanel{{/strong}} > {{strong}}PHP Version Manager{{/strong}}."],"You’re about to switch to Managed PHP service. This means that SiteGround will automatically update your PHP version once we are sure there’s a better, safer and more stable version.":["Estas a punto de cambiar al servicio PHP gestionado. permitiendo que SiteGround automáticamente actualice tu versión PHP una vez estemos seguros que hay una versión nueva, segura y estable."],"Doing this will delete all WebP files in your uploads folder and generate them anew!":["Esto eliminará todos los archivos WebP en tus directorio y los generará nuevamente."],"In order to force HTTPS on your site, we will automatically update your database replacing all insecure links. In addition to that, we will add a rule in your .htaccess file, forcing all requests to go through encrypted connection.":["Para forzar HTTPS en tu página actualizaremos automáticamente tu base de datos reemplazando todos los enlaces inseguros. Además de esto, añadiremos una regla en tu archivo .htaccess, forzando todas las peticiones a través de una conexión cifrada."],"You can exclude full or partial URLs using \"*\" as a wildcard. For example:":["Puedes excluir de forma parcial o total la URL usando «*» como comodín. Por ejemplo:"],"{{strong}}www.site.com/parent-page/sub-page{{/strong}} will exclude only that single URL.":["{{strong}}www.sitio.com/pagina-superior/sub-pagina{{/strong}} excluirá solo esa URL."],"{{strong}}www.site.com/parent-page/*{{/strong}} will exclude all sub-pages of \"parent-page\".":["{{strong}}www.sitio.com/pagina-superior/*{{/strong}} se excluirá de todas las sub-paginas de la «pagina-superior»."],"Please be patient, this process may take some time":["Por favor, se paciente, el proceso puede llevar un tiempo"],"Optimized %(optimized)s of %(total)s images":["Imágenes optimizadas %(optimized)s de %(total)s"],"Pause":["Pausar"],"Generated %(optimized)s of %(total)s webp copies":["Copias WebP generadas %(optimized)s de %(total)s"],"Generate WebP Copies of New Images":["Genera copias WebP de nuevas imágenes"],"WebP is a next generation image format supported by modern browers which greatly reduces the size of your images.":["WebP es la siguiente generación de formato de imágenes que es soportado por los navegadores modernos y que reduce en gran parte el tamaño de tus imágenes."],"Manage WebP Copies for Existing Images":["Administra las copias WebP para imágenes existentes"],"Generate or delete a WebP copy of your existing media library.":["Genera o elimina una copia WebP de tu librería de medios."],"Delete all WebP Files":["Elimina todos los archivos WebP"],"Bulk Generate WebP Files":["Generación masiva de archivos WebP."],"All WebP copies of your files have been generated successfully! Force {{link}}re-generation{{/link}} of your images.":["Todas las copias WebP de tus archivos han sido generadas correctamente. Fuerza la {{link}}regeneración{{/link}} de tus imágenes."],"Browser Caching":["Caché del navegador"],"Adds rules to store in your visitors browser cache to keep static content longer for better site performance.":["Agrega reglas de almacenamiento en la caché del navegador de los visitantes para mantener el contenido estático un período más largo para un mejor rendimiento de la web."],"YOU HAVE A SITE TOOLS ACCOUNT":["TIENES UNA CUENTA DE SITE TOOLS"],"NGINX Direct Delivery takes care of your static resources including proper expiration dates for your browser caching.":["NGINX Direct Delivery se encarga de los recursos estáticos incluyendo la correcta fecha de expiración para la cache de tu navegador."],"Dynamic Caching":["Caché dinámica"],"Store your content in the server’s memory for a faster access with this full-page caching solution powered by NGINX.":["Almacena tu contenido en la memoria del servidor para un acceso más rápido con esta solución de página completa de caché por NGINX."],"Manual Cache Purge":["Vaciado manual de caché"],"Clear the Dynamic Cache for your entire website.":["Vacía la caché dinámica de toda tu web."],"Purge Cache":["Vaciar caché"],"Purging ...":["Vaciando ..."],"Automatic Cache Purge":["Vaciado automático de la caché"],"Automatically perform a smart cache purge after every content modification.":["Lleva a cabo un vaciado inteligente de la caché después de cada modificación de contenido."],"See rules":["Ver reglas"],"Browser-Specific Caching":["Almacenamiento en caché específico del navegador"],"We recommend you to enable this feature {{strong}}only{{/strong}} if you’re experiencing issues with plugins, generating mobile version of your site or similar functionality. Once enabled, the cache has to be generated separately for different browsers which lowers its efficiency.":["Recomendamos habilitar esta función {{strong}}solo{{/strong}} si se experimentan problemas con plugins, generando la versión móvil de su página web o alguna funcionalidad similar. Una vez habilitado, el caché debe generarse por separado para diferentes navegadores, lo que reduce su eficiencia."],"Excluding URLs":["Excluir URLs"],"Use this feature if you want to exclude certain parts of your website from being cached and keep them dynamic.":["Usa esta característica si quieres que ciertas partes de tu web queden excluidas de la caché y así mantenerlas dinámicas."],"See examples":["Ver ejemplos"],"GZIP Compression":["Compresión GZIP"],"Enables a compression of the content that's delivered to your visitors browsers improving the network loading times of your site.":["Activa la compresión del contenido que se envía a los navegadores de los visitantes ,mejorando los tiempo de carga de tu sitio."],"GZIP Compression is enabled by default automatically saving you bandwidth and improving the loading speeds of your pages.":["La compresión GZIP está habilitada de forma predeterminada, lo que te ahorra ancho de banda y mejora la velocidad de carga de tus páginas."],"Memcached Stopped. Please, enable it in your SiteGround control panel.":["Memcached detenido. Por favor, habilítalo en tu panel de control de SiteGround."],"Memcached":["Memcached"],"Powerful object caching for your site. It stores frequently executed queries to your databases and reuses them for better performance.":["Herramienta de cache de objetos para tu sitio. Almacena las consultas ejecutadas con frecuencia en tu base de datos y las reutiliza para un mejor rendimiento."],"Score Check":["Revisar resultado"],"Test how optimized your website is. Our performance check is powered by Google PageSpeed.":["Revisa cuán optimizado esta tu web. Nuestro test de rendimiento se basa en Google PageSpeed."],"Device Type":["Tipo de dispositiv"],"URL":["URL"],"Analyze":["Analizar"],"Please Wait, We Are Performing a Google PageSpeed Test on Your Page":["Espera, por favor, estamos realizando un test con Google PageSpeed en tu web"],"There is nothing here yet":["No nada aquí todavía"],"Enable HTTPS":["Activar HTTPS"],"Configures your site to work correctly via HTTPS and forces a secure connection to your site.":["Configura tu sitio para que funcione de forma correcta a través de HTTPS y fuerza una conexión segura en tu sitio."],"Fix Insecure Content":["Corregir contenido inseguro"],"Enable this option in case you’re getting insecure content errors on your website. We will dynamically rewrite insecure requests for resources coming from your site":["Activa esta opción en caso de que estés recibiendo errores de contenido inseguro en tu web. Nosotros reescribiremos dinámicamente las peticiones inseguras de los recursos de tu sitio"],"Minify the HTML Output":["Minimizar la salida HTML"],"Removes unnecessary characters from your HTML output saving data and improving your site speed. ":["Elimina los caracteres innecesarios de tu código HTML de salida y mejora la velocidad de tu sitio."],"Exclude URLs from HTML Minification":["Excluir las direcciones URL de la minificación de HTML"],"With this functionality, you can exclude different pages from HTML minification.":["Con esta funcionalidad puedes excluir diferentes páginas de minificación de HTML."],"Minify JavaScript Files":["Minimizar archivos JavaScript"],"Minify your JavaScript files in order to reduce their size and reduce the number of requests to the server. ":["Minificar los archivos de JavaScript con el fin de reducir su tamaño y reducir el número de peticiones al servidor."],"Exclude from JavaScript Minification":["Excluir de la minificación de JavaScript"],"Defer Render-blocking JS":["Carga diferida del bloqueador de visualización JS"],"Defer loading of render-blocking JavaScript files for faster initial site load. ":["Carga diferida de archivos JavaScript que bloquean el procesamiento para una carga inicial más rápida del sitio."],"Exclude from Loading JS Files Asynchronously":["Excluir de carga de archivos JS de forma asíncrona"],"Minify CSS Files":["Minimizar archivos CSS"],"Minify your CSS files in order to reduce their size and reduce the number of requests to the server. ":["Minificar tus archivos CSS con el fin de reducir su tamaño y reducir el número de peticiones al servidor."],"Exclude From CSS Minification":["Excluir de la minificación de CSS"],"Combine CSS Files":["Combinar archivos CSS"],"Combine multiple CSS files into one to lower the number of requests your site generates. ":["Combinar varios archivos CSS en uno sola para reducir el número de solicitudes que genera tu sitio."],"Exclude from CSS Combination":["Excluir de la combinación de CSS"],"Optimize Loading of Google Fonts":["Optimiza la carga de las fuentes de Google"],"Combine the loading of Google fonts reducing the number of HTTP requests.":["Combina la carga de las fuentes de Google reduciendo el número de peticiones HTTP."],"Remove Query Strings From Static Resources":["Eliminar cadenas de petición de recursos estáticos"],"Removes version query strings from your static resources improving the caching of those resources.":["Elimina la cadena de peticiones the tus recursos estáticos para mejorar la caché de esos recursos."],"Disable Emojis":["Desactivar Emojis"],"Enable to prevent WordPress from automatically detecting and generating emojis in your pages.":["Activar para impedir que WordPress detecte y genere automáticamente emojis en tus páginas."],"New Images Optimization":["Optimización de nuevas imágenes"],"We will automatically optimize all new images that you upload to your Media Library.":["Optimizaremos automáticamente todas las nuevas imágenes que se suban a tu biblioteca de medios."],"Existing Images Optimization":["Optimización de imágenes existentes"],"We will optimize all your existing images with minimal or no loss in quality. Note, that this will overwrite your original images.":["Optimizaremos todas tus imágenes con un perdida mínima o nula de calidad. Ten en cuenta que esto sobreescribirá tus imágenes originales."],"Resume Optimization":["Reanudar optimización"],"Start Optimization":["Comenzar optimización"],"We've detected that the WordPress cronjob functionality is not working. Please, enable it following the instructions in {{link}}this article{{/link}} and refresh this page. If you’re using a real cron job, you can {{link2}}ignore this message{{/link2}} at your own risk. Note, that in this case, those operations may take longer than usual to complete.":["Hemos detectado que la funcionalidad cronjob de WordPress no funciona. Por favor, actívala siguiendo las instrucciones de {{link}}este artículo{{/link}} y actualiza esta página. Si estás utilizando una tarea cron real, puedes {{link2}}ignorar este mensaje{{/link2}} bajo tu propio riesgo. Ten en cuenta que, en este caso, estas operaciones pueden tardar más de lo habitual en completarse."],"https://www.siteground.com/kb/disable-enable-wordpress-cron/":["https://www.siteground.es/kb/administrar-wordpress-cron/"],"All images in your Media Library have been optimized successfully! Force {{link}}re-optimization{{/link}} of your images.":["¡Todas las imágenes guardadas en la biblioteca de medios han sido optimizadas correctamente! Forzar la {{link}}re-optimización{{/link}} de tus imágenes."],"Lazy Load Images":["Carga diferida de imágenes"],"Load images only when they are visible in the browser":["Carga las imágenes solo cuando son visibles en el navegador"],"Lazy Load Gravatars":["Carga diferida de Gravatars"],"When users comment under your posts, WordPress tries to load their avatars from gravatar.com. We recommend lazy-loading them as your users scroll down through your page if you have a high number of comments. ":["Cuando los usuarios comentan en tus publicaciones, WordPress intenta cargar sus avatares desde gravatar.com. Recomendamos una carga diferida mientras los usuarios se desplazan por tu página cuando tienes un número elevado de comentarios. "],"Lazy Load Thumbnails":["Carga diferida de miniaturas"],"Enable if you want to lazy-load the thumbnail sizes of your original images.":["Actívalo si quieres una carga diferida de las miniaturas de tus imágenes originales."],"Lazy Load Responsive Images":["Carga diferida de imágenes adaptables"],"Certain plugins and themes generate multiple images from a single upload to work better on different devices. Enable if you want to lazy-load these too.":["Algunos plugins y temas generan múltiples imágenes desde una sola subida para trabajar mejor en diferentes dispositivos. Actívalo si deseas cargar estas de forma diferida."],"Lazy Load Widgets":["Carga diferida de widgets"],"Enable this option if you want the images in your widget areas to load only when users reach them. ":["Activa esta opción si quieres las imágenes en tus widgets se carguen solo cuando los usuarios accedan a ellas. "],"Lazy Load for Mobile":["Lazy Load para móviles"],"Enable if you want to use lazy-loading features for mobile requests to your site.":["Habilite si desea utilizar funciones de carga diferida (lazy load) para peticiones a su sitio desde móviles."],"Lazy Load Product Images":["Carga diferida de imágenes de producto"],"Enable if you want to enable lazy-load images in your store, product and other WooCommerce pages.":["Activa la carga diferida de imágenes en tu tienda, productos y otras páginas de WooCommerce."],"Exclude from Lazy Load":["Excluir de carga de imágenes asíncrona"],"In order to exclude images from lazy loading, please add their CSS classes to the exclusion list. Add each CSS class on a separate line.":["Con el fin de excluir las imágenes de carga asíncrona, por favor agrega tus clases CSS a la lista de exclusión. Añade cada clase CSS en una línea separada."],"Site Admin Permissions":["Permisos de administrador del sitio"],"In this section, set the access permission for admins of separate sites.":["En esta sección, configura los permisos para los administrador de distintas webs."],"SuperCacher Settings":["Ajustes de SuperCacher"],"Select whether site admins can access and make changes within the SiteGround Optimizer's SuperCacher tab.":["Selecciona si los administradores pueden acceder y hacer cambios en la pestaña SuperCacher de SiteGround Optimizer."],"Frontend Optimizations":["Optimizaciones en portada"],"Select whether site admins can access and make changes within the SiteGround Optimizer's Frontend Optmization tab.":["Selecciona si los administradores pueden acceder y hacer cambios en la pestaña de optimización en portada de SiteGround Optimizer."],"Image Optimizations":["Optimizaciones de imágenes"],"Select whether site admins can access and make changes within the SiteGround Optimizer's Image Optimization tab.":["Selecciona si los administradores pueden acceder y hacer cambios en la pestaña de optimización de imágenes de SiteGround Optimizer."],"Environment Optimizations":["Optimización del entorno"],"Select whether site admins can access and make changes within the SiteGround Optimizer's Environment Optimization tab.":["Selecciona si los administradores de la página pueden acceder y hacer cambios dentro de la pestaña de optimización del entorno de SiteGround Optimizer."],"SUPERCACHER SETTINGS":["AJUSTES DE SUPERCACHER"],"Select whether new sites should have the Dynamic Caching enabled for them or not.":["Seleccionar si las nuevas páginas deberían tener la caché dinámica activada o no."],"ENVIRONMENT OPTIMIZATION":["OPTIMIZACIÓN DEL ENTORNO"],"FRONTEND OPTIMIZATION":["OPTIMIZACIÓN DE PORTADA"],"Removes unnecessary characters from your HTML output saving data and improving your site speed.":["Elimina caracteres innecesarios de tu HTML, guardando los datos y mejorando la velocidad de tu sitio."],"Combine and minify your JavaScript files in order to reduce their size, improve cachability, and reduce the number of requests to the server.":["Combina y minimiza tus archivos JavaScript para reducir su tamaño, mejorar la caché y reducir el número de peticiones al servidor."],"Load Render-blocking JavaScript Files Asynchronously":["Carga asíncrona de los archivos JavaScript que bloquean la visualización"],"Add async parameter to the JavaScript files loaded in the header section of your site so they don’t block your page rendering.":["Añade el parámetro async a los archivos JavaScript cargados en la sección de cabecera de tu sitio para que no bloqueen la visualización de tu página."],"Combine and minify your CSS files in order to reduce their size, improve cachability, and reduce the number of requests to the server.":["Combina y minimiza tus archivos CSS para reducir su tamaño, mejorar la caché y reducir el número de peticiones al servidor."],"Combine multiple CSS files into one to lower the number of requests your site generates.":["Combina varios archivos CSS en uno para reducir el número de peticiones que genera tu sitio."],"IMAGE OPTIMIZATION":["OPTIMIZACIÓN DE IMÁGENES"],"Image Optimization":["Optimización de imágenes"],"SG Optimizer":["SG Optimizer"],"Get the best performance for your WordPress website with our optimization plugin. It handles caching, system settings, and all the necessary configurations for a blazing-fast website. With the SiteGround Optimizer enabled, you're getting the very best from your hosting environment!":["Obtén el mejor rendimiento de tu web WordPress con nuestro plugin de optimización. Gestiona la caché, ajustes de sistema y todas las configuraciones necesarias para tener una web rápida como el rayo. ¡Con SiteGround Optimizer activado obtienes el mejor rendimiento de tu entorno de alojamiento!"],"Old PHP Version":["Antigua versión PHP"],"You are using our Managed PHP service, which means that SiteGround will automatically update your PHP once we are sure there is a newer stable one, which comes with the latest security and performance enhancements. Alternatively, you can choose to manually set your PHP version, in which case the system will hardcode that version to your WordPress instance until you manually change it again.":["Estas utilizando el servicio PHP gestionado, permitiendo que SiteGround automáticamente actualice tu versión PHP una vez estemos seguros que hay una versión nueva, segura y estable, lo que te ofrecerá las últimas ventajas en seguridad y rendimiento. Alternativamente, si eliges la versión de PHP de forma manual, el sistema aplicará esta versión en tu WordPress hasta que manualmente se vuelva a realizar el cambio."],"Your site will keep using that version until you manually change it from this interface or until you switch to \"Managed PHP\" service. If you choose to take advantage of our Managed PHP service, SiteGround will automatically update your PHP once we are sure there is a newer stable one, which comes with the latest security and performance enhancements.":["Tu sitio web seguirá utilizando la versión hasta que manualmente se realice el cambio desde esta interfaz o hasta que selecciones el servicio PHP gestionado. Si eliges tomar ventaja del servicio PHP gestionado, SiteGround automáticamente actualizará tu versión PHP una vez estemos seguros que hay una versión nueva, segura y estable, lo que te ofrecerá las últimas ventajas en seguridad y rendimiento."],"As a SiteGround client you may change your PHP version per site manually. However, we strongly recommend you to take advantage of our Managed PHP service, which means that SiteGround will automatically update your PHP once we are sure there is a newer, stable and safe version, which will give you the latest security and performance enhancements. Alternatively, if you choose to manually set your PHP version, the system will hardcode that version to your WordPress instance until you manually change it again.":["Como cliente de SiteGround tienes la posibilidad de cambiar la versión de PHP para cada web de forma manual. Sin embargo, nosotros te recomendamos aprovechar el servicio PHP gestionado, permitiendo que SiteGround automáticamente actualice tu versión PHP una vez estemos seguros que hay una versión nueva, segura y estable, lo que te ofrecerá las últimas ventajas en seguridad y rendimiento. Alternativamente, si eliges la versión de PHP de forma manual, el sistema aplicará esta versión en tu WordPress hasta que manualmente se vuelva a realizar el cambio."],"Set your PHP version":["Configurar tu versión PHP"],"You are currently running on PHP %(version)s.":["Actualmente estas utilizando PHP %(version)s."],"PHP Management Method":["PHP Gestionado"],"Please select method":["Por favor, selecciona el método"],"Please select management type":["Por favor, selecciona el tipo de configuración"],"PHP Version":["Versión PHP"],"Please select PHP version":["Por favor, selecciona la versión PHP"],"Save":["Guardar"],"We currently recommend you to use PHP %(version)s. You can check the compatibility with the recommended version before you switch. {{link}}Check Compatibility{{/link}}":["En estos momentos recomendamos usar la PHP %(version)s. Puedes revisar la compatibilidad con la versión recomendada antes de cambiar. {{link}}Revisar compatibilidad{{/link}}"],"All your plugins are compatible with PHP %(version)s. You may safely switch to “Managed PHP” service and we’ll upgrade it automatically, or set it manually. {{link}}Check Again{{/link}}":["Todos tus plugins son compatibles con PHP %(version)s. Puedes utilizar el servicio PHP gestionado y nosotros realizaremos la actualización de manera automática, o lo puedes hacer de forma manual. {{link}}Revisar de nuevo{{/link}} "],"Checking PHP 7.1 Compatibility...":["Revisando compatibilidad con PHP %(version)s..."],"Unfortunately some of your plugins or theme are not compatible with our recommended version. {{link}}Check Again{{/link}}":["Desafortunadamente, algunos de tus plugins o temas no son compatibles con la versión recomendada. {{link}}Revisar de nuevo{{/link}}"],"Thanks for using SG Optimizer to make your site faster!":["¡Gracias por usar SG Optimizer para hacer tu sitio más rápido!"],"Help more people optimize their sites by rating our plugin.":["Ayuda a más personas a optimizar sus sitios valorando nuestro plugin."],"Don’t Show This Again":["No mostrar esto de nuevo"]}
|
languages/json/sg-cachepress-it_IT.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"":{"domain":"sg-cachepress","plural_forms":"nplurals=2; plural=n != 1;","lang":"it_IT"},"Test URLs for Cache Status":["Verifica gli URL per lo stato della Cache"],"Check if the Dynamic Cache is working on a certain URL. Especially useful to make sure your Exclude list is working the way it should.":["Controlla se la Cache Dinamica funziona su un determinato URL. Particolarmente utile per assicurarti che la tua lista di esclusione funzioni come dovrebbe."],"Test":["Verifica"],"Confirm":["Conferma"],"Defering render-blocking JavaScript may cause issues with scripts that require certain order of execution. This is why we advise you to check the frontend of your website after you enable this optimization.":["Il rinvio del blocco di visualizzazione JS può causare problemi con gli script che richiedono un determinato ordine di esecuzione. Questo è il motivo per cui ti consigliamo di controllare il frontend del tuo sito dopo aver abilitato questa ottimizzazione."],"If you notice issues with certain functionality, use the Exclude functionality to keep those scripts loading in a render-blocking manner.":["Se noti problemi con determinate funzionalità, usa la funzionalità Escludi per mantenere il caricamento di quegli script mantenendo il blocco di visualizzazione."],"Close":["Chiudi"],"Purge your installation's entire Dynamic Cache or select parts in order to achieve the best hit-to-cache ratio for your account. Here are the plugin's purge rules:":["Pulisci l'intera Cache Dinamica della tua installazione o seleziona le parti da pulire, per ottimizzare l'efficienza dei risultati salvati in cache per il tuo account. Ecco le regole di pulizia cache del plugin:"],"Full Purge on page, posts, and category deletion, plugin and theme activation, deactivation, or update, and on WordPress core updates.":["Pulizia completa su cancellazione pagine, post e categorie, attivazione, disattivazione e aggiornamento di plugin e temi e aggiornamenti del core di WordPress."],"Specific URL Purge on comment actions and page, post, and category updates.":["Pulizia URL specifica su azioni commenti e aggiornamenti di pagine, post e categorie."],"Cancel":["Annulla"],"This will delete all WebP files in your uploads folder! In case you need them, you will have to regenerate them again or restore that folder from a backup.":["Questo eliminerà tutti i file WebP nella tua cartella dei caricamenti! Se ne hai bisogno, dovrai rigenerarli di nuovo o ripristinare la cartella da un backup."],"You’re switching to PHP %(version)s manually and you will stay on that version until you change it to a newer one. In case you experience any issues after the update, switch back the PHP version from your {{strong}}cPanel{{/strong}} > {{strong}}PHP Version Manager{{/strong}} tool.":["Stai passando a PHP %(version)s manualmente e manterrai questa versione finché non la cambierai nuovamente a mano. In caso di problemi dopo l'aggiornamento, ripristina la versione di PHP dallo strumento {{strong}}cPanel{{/strong}} > {{strong}}Gestione versione PHP{{/strong}}."],"You’re about to switch to Managed PHP service. This means that SiteGround will automatically update your PHP version once we are sure there’s a better, safer and more stable version.":["Stai per passare al servizio PHP Gestito. Ciò significa che SiteGround aggiornerà automaticamente la tua versione PHP ogni volta che siamo sicuri sia disponibile una nuova versione più sicura e stabile."],"Doing this will delete all WebP files in your uploads folder and generate them anew!":["In questo modo verranno eliminati tutti i file WebP nella cartella dei caricamenti e generati di nuovo!"],"In order to force HTTPS on your site, we will automatically update your database replacing all insecure links. In addition to that, we will add a rule in your .htaccess file, forcing all requests to go through encrypted connection.":["Per forzare HTTPS sul tuo sito, aggiorneremo automaticamente il tuo database sostituendo tutti i link non sicuri. In aggiunta a ciò, aggiungeremo una regola nel tuo file .htaccess, forzando tutte le richieste a passare attraverso la connessione crittografata."],"You can exclude full or partial URLs using \"*\" as a wildcard. For example:":["Puoi escludere URL completi o parziali utilizzando \"*\" come carattere jolly. Per esempio:"],"{{strong}}www.site.com/parent-page/sub-page{{/strong}} will exclude only that single URL.":["{{strong}}www.site.com/parent-page/sub-page{{/strong}} escluderà solo quel singolo URL."],"{{strong}}www.site.com/parent-page/*{{/strong}} will exclude all sub-pages of \"parent-page\".":["{{strong}}www.site.com/parent-page/*{{/strong}} escluderà tutte le sottopagine della \"parent page\"."],"This item already exists in exclude list.":["Questo elemento esiste già nell'elenco di esclusione."],"You must input a class name.":["Devi introdurre un nome di classe."],"Exclude":["Escludi"],"This URL already exists in exclude list.":["Questo URL esiste già nell'elenco di esclusione."],"Please be patient, this process may take some time":["Ti preghiamo di attendere, questo processo potrebbe richiedere del tempo"],"Optimized %(optimized)s of %(total)s images":["%(optimized)s immagini su %(total)s sono state ottimizzate"],"Pause":["Pausa"],"Generated %(optimized)s of %(total)s webp copies":["Genera %(optimized)s di %(total)s copie WebP"],"Generate WebP Copies of New Images":["Genera copie WebP delle nuove immagini"],"WebP is a next generation image format supported by modern browers which greatly reduces the size of your images.":["WebP è un formato di immagine di nuova generazione supportato da browser moderni che riduce notevolmente le dimensioni delle immagini."],"Manage WebP Copies for Existing Images":["Gestisci copie WebP per le immagini esistenti"],"Generate or delete a WebP copy of your existing media library.":["Genera o elimina una copia WebP della tua libreria multimediale."],"Delete all WebP Files":["Elimina tutti i file WebP"],"Bulk Generate WebP Files":["Genera file WebP in blocco"],"All WebP copies of your files have been generated successfully! Force {{link}}re-generation{{/link}} of your images.":["Tutte le copie WebP dei tuoi file sono state generate correttamente! Forza la {{link}}ri-generazione{{/link}} delle tue immagini."],"Browser Caching":["Cache del browser"],"Adds rules to store in your visitors browser cache to keep static content longer for better site performance.":["Aggiunge regole per l'archiviazione nella cache del browser dei tuoi visitatori, per mantenere più a lungo i contenuti statici e migliorare le prestazioni del sito."],"YOU HAVE A SITE TOOLS ACCOUNT":["HAI UN ACCOUNT SITE TOOLS"],"NGINX Direct Delivery takes care of your static resources including proper expiration dates for your browser caching.":["NGINX Direct Delivery si occupa delle risorse statiche, comprese le date di scadenza per la cache del browser."],"Dynamic Caching":["Caching Dinamico"],"Store your content in the server’s memory for a faster access with this full-page caching solution powered by NGINX.":["Archivia i tuoi contenuti nella memoria del server per un accesso più rapido, con questa soluzione di caching full-page di NGINX."],"Manual Cache Purge":["Pulizia manuale della Cache"],"Clear the Dynamic Cache for your entire website.":["Pulisce la Cache Dinamica di tutto il sito."],"Purge Cache":["Svuotare cache"],"Purging ...":["Svuotamento ..."],"Automatic Cache Purge":["Pulizia automatica della cache"],"Automatically perform a smart cache purge after every content modification.":["Esegui automaticamente una pulizia intelligente della cache dopo ogni modifica del contenuto."],"See rules":["Vedi le regole"],"Browser-Specific Caching":["Cache specifica per il browser"],"We recommend you to enable this feature {{strong}}only{{/strong}} if you’re experiencing issues with plugins, generating mobile version of your site or similar functionality. Once enabled, the cache has to be generated separately for different browsers which lowers its efficiency.":["Ti consigliamo di abilitare questa funzione {{strong}}solo{{/strong}} se riscontri problemi con i plugin che generano la versione mobile del tuo sito o con funzionalità simili. Una volta abilitata, la cache deve essere generata separatamente per diversi browser, il che ne riduce l'efficienza."],"Excluding URLs":["Escludo gli URL"],"Use this feature if you want to exclude certain parts of your website from being cached and keep them dynamic.":["Utilizza questa funzione se desideri escludere alcune parti del tuo sito web dalla cache e mantenerle dinamiche."],"See examples":["Vedi gli esempi"],"Memcached Stopped. Please, enable it in your SiteGround control panel.":["Memcached bloccato. Attivalo nel pannello di controllo di SiteGround."],"Memcached":["Memcached"],"Powerful object caching for your site. It stores frequently executed queries to your databases and reuses them for better performance.":["Una cache degli oggetti potente per il tuo sito. Memorizza le query eseguite frequentemente sui tuoi database e li riutilizza per prestazioni migliori."],"GZIP Compression":["Compressione GZIP"],"Enables a compression of the content that's delivered to your visitors browsers improving the network loading times of your site.":["Consente una compressione del contenuto che viene consegnato ai browser dei visitatori, migliorando i tempi di caricamento della rete del tuo sito."],"GZIP Compression is enabled by default automatically saving you bandwidth and improving the loading speeds of your pages.":["La compressione GZIP è attiva di default per salvare automaticamente la larghezza di banda e migliorare la velocità di caricamento delle tue pagine."],"Score Check":["Verifica del punteggio"],"Test how optimized your website is. Our performance check is powered by Google PageSpeed.":["Verifica quanto è ottimizzato il tuo sito web. Il nostro controllo delle prestazioni è basato su Google Page Speed."],"Device Type":["Tipo di dispositivo"],"URL":["URL"],"Analyze":["Analizza"],"Please Wait, We Are Performing a Google PageSpeed Test on Your Page":["Ti preghiamo di attendere, stiamo eseguendo un test di Google PageSpeed sulla tua pagina"],"There is nothing here yet":["Non c'è ancora niente qui"],"Enable HTTPS":["Abilita HTTPS"],"Configures your site to work correctly via HTTPS and forces a secure connection to your site.":["Configura il tuo sito per funzionare correttamente tramite HTTPS e forza una connessione sicura al tuo sito."],"Fix Insecure Content":["Sistema i contenuti non sicuri"],"Enable this option in case you’re getting insecure content errors on your website. We will dynamically rewrite insecure requests for resources coming from your site":["Abilita questa opzione se ricevi errori di elementi non sicuri sul sito. Riscriveremo dinamicamente le richieste insicure per tutti gli elementi inerenti al tuo sito"],"Minify the HTML Output":["Minifica l'output HTML"],"Removes unnecessary characters from your HTML output saving data and improving your site speed. ":["Rimuove i caratteri non necessari dall'output HTML salvando i dati e migliorando la velocità del sito."],"Exclude URLs from HTML Minification":["Escludi gli URL dalla minificazione HTML"],"With this functionality, you can exclude different pages from HTML minification.":["Con questa funzionalità è possibile escludere pagine diverse dalla minificazione HTML."],"Minify JavaScript Files":["Minifica i file JavaScript"],"Minify your JavaScript files in order to reduce their size and reduce the number of requests to the server. ":["Minifica i tuoi file JavaScript per ridurre le dimensioni e il numero di richieste al server."],"Exclude from JavaScript Minification":["Escludi dalla minimizzazione JavaScript"],"Defer Render-blocking JS":["Rinvia il blocco di visualizzazione JS"],"Defer loading of render-blocking JavaScript files for faster initial site load. ":["Rinvia il caricamento di file JavaScript che bloccano la visualizzazione, per veocizzare il caricamento inziale del sito."],"Exclude from Loading JS Files Asynchronously":["Escludi dal caricamento asincrono dei file JS"],"Minify CSS Files":["Minifica i file CSS"],"Minify your CSS files in order to reduce their size and reduce the number of requests to the server. ":["Minifica i tuoi file CSS per ridurre le dimensioni e il numero di richieste al server."],"Exclude From CSS Minification":["Escludi dalla minificazione CSS"],"Combine CSS Files":["Unisci i file CSS"],"Combine multiple CSS files into one to lower the number of requests your site generates. ":["Combina più file CSS in uno per ridurre il numero di richieste generate dal tuo sito."],"Exclude from CSS Combination":["Escludi dalla combinazione CSS"],"Optimize Loading of Google Fonts":["Ottimizza il caricamento dei font Google"],"Combine the loading of Google fonts reducing the number of HTTP requests.":["Combina il caricamento dei font Google riducendo il numero di richieste HTTP.\n"],"Remove Query Strings From Static Resources":["Rimuovi le stringhe di ricerca dalle risorse statiche"],"Removes version query strings from your static resources improving the caching of those resources.":["Rimuove le stringhe di ricerca dalle risorse statiche migliorando la memorizzazione nella cache di tali risorse."],"Disable Emojis":["Disabilita Emoji"],"Enable to prevent WordPress from automatically detecting and generating emojis in your pages.":["Abilita per impedire a WordPress di rilevare e generare automaticamente emoji nelle tue pagine."],"Site Admin Permissions":["Autorizzazioni dell'admin del sito"],"In this section, set the access permission for admins of separate sites.":["In questa sezione imposta i permessi di accesso per gli amministratori di siti diversi."],"SuperCacher Settings":["Impostazioni SuperCacher"],"Select whether site admins can access and make changes within the SiteGround Optimizer's SuperCacher tab.":["Seleziona se gli amministratori del sito possono accedere e apportare modifiche all'interno della sezione SuperCacher di SiteGround Optimizer."],"Frontend Optimizations":["Ottimizzazioni del frontend"],"Select whether site admins can access and make changes within the SiteGround Optimizer's Frontend Optmization tab.":["Seleziona se gli amministratori del sito possono accedere e apportare modifiche all'interno della sezione Ottimizzazione Frontend di SiteGround Optimizer."],"Image Optimizations":["Ottimizzazioni immagine"],"Select whether site admins can access and make changes within the SiteGround Optimizer's Image Optimization tab.":["Seleziona se gli amministratori del sito possono accedere e apportare modifiche all'interno della sezione Ottimizzazione Immagine di SiteGround Optimizer."],"Environment Optimizations":["Ottimizzazioni dell'ambiente"],"Select whether site admins can access and make changes within the SiteGround Optimizer's Environment Optimization tab.":["Seleziona se gli amministratori del sito possono accedere e apportare modifiche nella sezione di Ottimizzazione Ambiente di SiteGround Optimizer."],"New Images Optimization":["Ottimizzazione nuove immagini"],"We will automatically optimize all new images that you upload to your Media Library.":["Ottimizzeremo automaticamente tutte le nuove immagini che caricherai dalla Media Library."],"Existing Images Optimization":["Ottimizzazione immagini esistenti"],"We will optimize all your existing images with minimal or no loss in quality. Note, that this will overwrite your original images.":["Ottimizzeremo tutte le tue immagini con una perdita di qualità minima o nulla. Tieni presente che questo sovrascriverà le tue immagini originali."],"Resume Optimization":["Riprendi l’ottimizzazione"],"Start Optimization":["Inizio Ottimizzazione"],"We've detected that the WordPress cronjob functionality is not working. Please, enable it following the instructions in {{link}}this article{{/link}} and refresh this page. If you’re using a real cron job, you can {{link2}}ignore this message{{/link2}} at your own risk. Note, that in this case, those operations may take longer than usual to complete.":["Abbiamo rilevato che la funzionalità cronjob di WordPress non sta funzionando. Per favore, abilitala seguendo le istruzioni in {{link}} questo articolo {{/ link}} e aggiorna questa pagina. Se stai utilizzando un vero cronjob, puoi {{link2}} ignorare questo messaggio {{/ link2}} a tuo rischio. Tieni presente che, in questo caso, le operazioni potrebbero richiedere più tempo del solito per essere completate."],"https://www.siteground.com/kb/disable-enable-wordpress-cron/":["https://it.siteground.com/kb/come-disattivare-abilitare-il-wordpress-cron/"],"All images in your Media Library have been optimized successfully! Force {{link}}re-optimization{{/link}} of your images.":["Tutte le immagini nella tua libreria multimediale sono state ottimizzate con successo! Forza la {{link}}ri-ottimizzazione{{/link}} delle tue immagini."],"Lazy Load Images":["Lazy Load delle immagini"],"Load images only when they are visible in the browser":["Carica le immagini solo quando sono visibili nel browser"],"Lazy Load Gravatars":["Lazy Load dei Gravatar"],"When users comment under your posts, WordPress tries to load their avatars from gravatar.com. We recommend lazy-loading them as your users scroll down through your page if you have a high number of comments. ":["Quando gli utenti commentano i tuoi post, WordPress prova a caricare i loro avatar da gravatar.com. Ti consigliamo il lazy-load per essi perché, se hai un numero elevato di commenti, i tuoi utenti faranno uno scroll-down della tua pagina."],"Lazy Load Thumbnails":["Lazy Load delle Thumbnail"],"Enable if you want to lazy-load the thumbnail sizes of your original images.":["Abilita se desideri attivare il lazy-load per le dimensioni delle thumbnail delle immagini originali."],"Lazy Load Responsive Images":["Lazy Load delle immagini resposive"],"Certain plugins and themes generate multiple images from a single upload to work better on different devices. Enable if you want to lazy-load these too.":["Alcuni plugin e temi generano più immagini da un singolo upload per funzionare meglio su diversi device. Abilita, se vuoi attivare il lazy-load anche per questi."],"Lazy Load Widgets":["Lazy Load dei widget"],"Enable this option if you want the images in your widget areas to load only when users reach them. ":["Abilita questa opzione se desideri che le immagini nell'area dei widget vengano caricate solo quando gli utenti le raggiungono."],"Lazy Load for Mobile":["Lazy Load per mobile"],"Enable if you want to use lazy-loading features for mobile requests to your site.":["Abilita se vuoi usare la funzione di lazy load per le richieste mobile sul tuo sito."],"Lazy Load Product Images":["LazyLoad immagini prodotto"],"Enable if you want to enable lazy-load images in your store, product and other WooCommerce pages.":["Attiva il lazy-load delle immagini nello store, nella pagina prodotto e nelle altre pagine WooCommerce."],"Exclude from Lazy Load":["Escludi da Lazy Load"],"In order to exclude images from lazy loading, please add their CSS classes to the exclusion list. Add each CSS class on a separate line.":["Per escludere le immagini dal Lazy Load, aggiungi le loro classi CSS all'elenco di esclusione. Aggiungi ogni classe CSS su una riga separata."],"SUPERCACHER SETTINGS":["IMPOSTAZIONI SUPERCACHER"],"Select whether new sites should have the Dynamic Caching enabled for them or not.":["Seleziona se i nuovi siti devono avere abilitata o meno la Cache Dinamica."],"ENVIRONMENT OPTIMIZATION":["OTTIMIZZAZIONE DELL’AMBIENTE"],"FRONTEND OPTIMIZATION":["OTTIMIZZAZIONE FRONTEND"],"Removes unnecessary characters from your HTML output saving data and improving your site speed.":["Rimuove i caratteri non necessari dall'output HTML salvando i dati e migliorando la velocità del tuo sito."],"Combine and minify your JavaScript files in order to reduce their size, improve cachability, and reduce the number of requests to the server.":["Combina e ridimensiona i tuoi file JavaScript per ridurne le dimensioni, migliorare il caching e ridurre il numero di richieste al server."],"Load Render-blocking JavaScript Files Asynchronously":["Carica in modo asincrono i file JavaScript che bloccano il rendering"],"Add async parameter to the JavaScript files loaded in the header section of your site so they don’t block your page rendering.":["Aggiungi un parametro asincrono ai file JavaScript caricati nell’header del tuo sito, in modo che non blocchino il rendering della pagina."],"Combine and minify your CSS files in order to reduce their size, improve cachability, and reduce the number of requests to the server.":["Combina e ridimensiona i file CSS per ridurne le dimensioni, migliorare il caching e diminuire il numero di richieste al server."],"Combine multiple CSS files into one to lower the number of requests your site generates.":["Unisci più file CSS in uno per ridurre il numero di richieste generate dal tuo sito."],"IMAGE OPTIMIZATION":["OTTIMIZZAZIONE IMMAGINI"],"Image Optimization":["Ottimizzazione Immagini"],"SG Optimizer":["SG Optimizer"],"Get the best performance for your WordPress website with our optimization plugin. It handles caching, system settings, and all the necessary configurations for a blazing-fast website. With the SiteGround Optimizer enabled, you're getting the very best from your hosting environment!":["Ottieni le massime prestazioni dal tuo sito WordPress con il nostro plugin di ottimizzazione. Gestisce il caching, le impostazioni di sistema e tutte le configurazioni necessarie per un sito web ad alte performance. Con SiteGround Optimizer abilitato otterrai il meglio dal tuo ambiente di hosting!"],"Old PHP Version":["Versione PHP precedente"],"You are using our Managed PHP service, which means that SiteGround will automatically update your PHP once we are sure there is a newer stable one, which comes with the latest security and performance enhancements. Alternatively, you can choose to manually set your PHP version, in which case the system will hardcode that version to your WordPress instance until you manually change it again.":["Stai utilizzando il nostro servizio PHP Gestito, il che significa che SiteGround aggiornerà automaticamente il tuo PHP ogni volta che siamo sicuri sia disponibile una versione più recente, stabile e sicura, capace di migliorare sicurezza e prestazioni. In alternativa, puoi scegliere di impostare manualmente la tua versione PHP e il sistema manterrà quella versione sulla tua istanza WordPress fino a quando non la cambierai di nuovo manualmente."],"Your site will keep using that version until you manually change it from this interface or until you switch to \"Managed PHP\" service. If you choose to take advantage of our Managed PHP service, SiteGround will automatically update your PHP once we are sure there is a newer stable one, which comes with the latest security and performance enhancements.":["Il tuo sito continuerà a utilizzare questa versione fino a quando non la cambierai manualmente da questa interfaccia o finché non passerai al servizio \"PHP Gestito\". Se scegli di utilizzare PHP Gestito, SiteGround aggiornerà automaticamente il tuo PHP ogni volta che siamo sicuri sia disponibile una versione più recente, stabile e sicura, capace di migliorare sicurezza e prestazioni."],"As a SiteGround client you may change your PHP version per site manually. However, we strongly recommend you to take advantage of our Managed PHP service, which means that SiteGround will automatically update your PHP once we are sure there is a newer, stable and safe version, which will give you the latest security and performance enhancements. Alternatively, if you choose to manually set your PHP version, the system will hardcode that version to your WordPress instance until you manually change it again.":["Come cliente SiteGround è possibile modificare manualmente la versione PHP del sito. Tuttavia, ti consigliamo vivamente di approfittare del nostro servizio PHP Gestito, attraverso il quale SiteGround aggiornerà automaticamente il tuo PHP ogni volta che siamo sicuri sia disponibile una versione più recente, stabile e sicura, capace di migliorare sicurezza e prestazioni. In alternativa, se si sceglie di impostare manualmente la propria versione PHP, il sistema manterrà quella versione sulla tua istanza WordPress fino a quando non la cambierai di nuovo manualmente."],"Set your PHP version":["Imposta la tua versione di PHP"],"You are currently running on PHP %(version)s.":["Attualmente stai utilizzando PHP %(version)s."],"PHP Management Method":["PHP Gestito"],"Please select method":["Seleziona il metodo"],"Please select management type":["Seleziona il tipo di gestione"],"PHP Version":["Versione PHP"],"Please select PHP version":["Seleziona la versione PHP"],"Save":["Salva"],"We currently recommend you to use PHP %(version)s. You can check the compatibility with the recommended version before you switch. {{link}}Check Compatibility{{/link}}":["Al momento ti consigliamo di utilizzare PHP %(version)s. Prima di selezionarla, è possibile verificare la compatibilità con la versione raccomandata. {{link}}Verifica compatibilità{{/link}}"],"All your plugins are compatible with PHP %(version)s. You may safely switch to “Managed PHP” service and we’ll upgrade it automatically, or set it manually. {{link}}Check Again{{/link}}":["Todos tus plugins son compatibles con PHP %(version)s. Puedes utilizar el servicio PHP gestionado y nosotros realizaremos la actualización de manera automática, o lo puedes hacer de forma manual. {{link}}Controlla ancora{{/link}}"],"Checking PHP 7.1 Compatibility...":["erifica in corso della compatibilità con PHP %(version)s..."],"Unfortunately some of your plugins or theme are not compatible with our recommended version. {{link}}Check Again{{/link}}":["Purtroppo alcuni dei tuoi plugin o temi non sono compatibili con la versione raccomandata. {{link}}Controlla ancora{{/link}}"],"Thanks for using SG Optimizer to make your site faster!":["Grazie per utilizzare SG Optimizer per rendere il tuo sito più veloce!"],"Help more people optimize their sites by rating our plugin.":["Aiuta più persone a ottimizzare i loro siti, vota il nostro plugin."],"Don’t Show This Again":["Non mostrare più"]}
|
1 |
+
{"":{"domain":"sg-cachepress","plural_forms":"nplurals=2; plural=n != 1;","lang":"it_IT"},"Test URLs for Cache Status":["Verifica gli URL per lo stato della Cache"],"Check if the Dynamic Cache is working on a certain URL. Especially useful to make sure your Exclude list is working the way it should.":["Controlla se la Cache Dinamica funziona su un determinato URL. Particolarmente utile per assicurarti che la tua lista di esclusione funzioni come dovrebbe."],"Test":["Verifica"],"This item already exists in exclude list.":["Questo elemento esiste già nell'elenco di esclusione."],"You must input a class name.":["Devi introdurre un nome di classe."],"Exclude":["Escludi"],"This URL already exists in exclude list.":["Questo URL esiste già nell'elenco di esclusione."],"Confirm":["Conferma"],"Defering render-blocking JavaScript may cause issues with scripts that require certain order of execution. This is why we advise you to check the frontend of your website after you enable this optimization.":["Il rinvio del blocco di visualizzazione JS può causare problemi con gli script che richiedono un determinato ordine di esecuzione. Questo è il motivo per cui ti consigliamo di controllare il frontend del tuo sito dopo aver abilitato questa ottimizzazione."],"If you notice issues with certain functionality, use the Exclude functionality to keep those scripts loading in a render-blocking manner.":["Se noti problemi con determinate funzionalità, usa la funzionalità Escludi per mantenere il caricamento di quegli script mantenendo il blocco di visualizzazione."],"Close":["Chiudi"],"Purge your installation's entire Dynamic Cache or select parts in order to achieve the best hit-to-cache ratio for your account. Here are the plugin's purge rules:":["Pulisci l'intera Cache Dinamica della tua installazione o seleziona le parti da pulire, per ottimizzare l'efficienza dei risultati salvati in cache per il tuo account. Ecco le regole di pulizia cache del plugin:"],"Full Purge on page, posts, and category deletion, plugin and theme activation, deactivation, or update, and on WordPress core updates.":["Pulizia completa su cancellazione pagine, post e categorie, attivazione, disattivazione e aggiornamento di plugin e temi e aggiornamenti del core di WordPress."],"Specific URL Purge on comment actions and page, post, and category updates.":["Pulizia URL specifica su azioni commenti e aggiornamenti di pagine, post e categorie."],"Cancel":["Annulla"],"This will delete all WebP files in your uploads folder! In case you need them, you will have to regenerate them again or restore that folder from a backup.":["Questo eliminerà tutti i file WebP nella tua cartella dei caricamenti! Se ne hai bisogno, dovrai rigenerarli di nuovo o ripristinare la cartella da un backup."],"You’re switching to PHP %(version)s manually and you will stay on that version until you change it to a newer one. In case you experience any issues after the update, switch back the PHP version from your {{strong}}cPanel{{/strong}} > {{strong}}PHP Version Manager{{/strong}} tool.":["Stai passando a PHP %(version)s manualmente e manterrai questa versione finché non la cambierai nuovamente a mano. In caso di problemi dopo l'aggiornamento, ripristina la versione di PHP dallo strumento {{strong}}cPanel{{/strong}} > {{strong}}Gestione versione PHP{{/strong}}."],"You’re about to switch to Managed PHP service. This means that SiteGround will automatically update your PHP version once we are sure there’s a better, safer and more stable version.":["Stai per passare al servizio PHP Gestito. Ciò significa che SiteGround aggiornerà automaticamente la tua versione PHP ogni volta che siamo sicuri sia disponibile una nuova versione più sicura e stabile."],"Doing this will delete all WebP files in your uploads folder and generate them anew!":["In questo modo verranno eliminati tutti i file WebP nella cartella dei caricamenti e generati di nuovo!"],"In order to force HTTPS on your site, we will automatically update your database replacing all insecure links. In addition to that, we will add a rule in your .htaccess file, forcing all requests to go through encrypted connection.":["Per forzare HTTPS sul tuo sito, aggiorneremo automaticamente il tuo database sostituendo tutti i link non sicuri. In aggiunta a ciò, aggiungeremo una regola nel tuo file .htaccess, forzando tutte le richieste a passare attraverso la connessione crittografata."],"You can exclude full or partial URLs using \"*\" as a wildcard. For example:":["Puoi escludere URL completi o parziali utilizzando \"*\" come carattere jolly. Per esempio:"],"{{strong}}www.site.com/parent-page/sub-page{{/strong}} will exclude only that single URL.":["{{strong}}www.site.com/parent-page/sub-page{{/strong}} escluderà solo quel singolo URL."],"{{strong}}www.site.com/parent-page/*{{/strong}} will exclude all sub-pages of \"parent-page\".":["{{strong}}www.site.com/parent-page/*{{/strong}} escluderà tutte le sottopagine della \"parent page\"."],"Please be patient, this process may take some time":["Ti preghiamo di attendere, questo processo potrebbe richiedere del tempo"],"Optimized %(optimized)s of %(total)s images":["%(optimized)s immagini su %(total)s sono state ottimizzate"],"Pause":["Pausa"],"Generated %(optimized)s of %(total)s webp copies":["Genera %(optimized)s di %(total)s copie WebP"],"Generate WebP Copies of New Images":["Genera copie WebP delle nuove immagini"],"WebP is a next generation image format supported by modern browers which greatly reduces the size of your images.":["WebP è un formato di immagine di nuova generazione supportato da browser moderni che riduce notevolmente le dimensioni delle immagini."],"Manage WebP Copies for Existing Images":["Gestisci copie WebP per le immagini esistenti"],"Generate or delete a WebP copy of your existing media library.":["Genera o elimina una copia WebP della tua libreria multimediale."],"Delete all WebP Files":["Elimina tutti i file WebP"],"Bulk Generate WebP Files":["Genera file WebP in blocco"],"All WebP copies of your files have been generated successfully! Force {{link}}re-generation{{/link}} of your images.":["Tutte le copie WebP dei tuoi file sono state generate correttamente! Forza la {{link}}ri-generazione{{/link}} delle tue immagini."],"Browser Caching":["Cache del browser"],"Adds rules to store in your visitors browser cache to keep static content longer for better site performance.":["Aggiunge regole per l'archiviazione nella cache del browser dei tuoi visitatori, per mantenere più a lungo i contenuti statici e migliorare le prestazioni del sito."],"YOU HAVE A SITE TOOLS ACCOUNT":["HAI UN ACCOUNT SITE TOOLS"],"NGINX Direct Delivery takes care of your static resources including proper expiration dates for your browser caching.":["NGINX Direct Delivery si occupa delle risorse statiche, comprese le date di scadenza per la cache del browser."],"Dynamic Caching":["Caching Dinamico"],"Store your content in the server’s memory for a faster access with this full-page caching solution powered by NGINX.":["Archivia i tuoi contenuti nella memoria del server per un accesso più rapido, con questa soluzione di caching full-page di NGINX."],"Manual Cache Purge":["Pulizia manuale della Cache"],"Clear the Dynamic Cache for your entire website.":["Pulisce la Cache Dinamica di tutto il sito."],"Purge Cache":["Svuotare cache"],"Purging ...":["Svuotamento ..."],"Automatic Cache Purge":["Pulizia automatica della cache"],"Automatically perform a smart cache purge after every content modification.":["Esegui automaticamente una pulizia intelligente della cache dopo ogni modifica del contenuto."],"See rules":["Vedi le regole"],"Browser-Specific Caching":["Cache specifica per il browser"],"We recommend you to enable this feature {{strong}}only{{/strong}} if you’re experiencing issues with plugins, generating mobile version of your site or similar functionality. Once enabled, the cache has to be generated separately for different browsers which lowers its efficiency.":["Ti consigliamo di abilitare questa funzione {{strong}}solo{{/strong}} se riscontri problemi con i plugin che generano la versione mobile del tuo sito o con funzionalità simili. Una volta abilitata, la cache deve essere generata separatamente per diversi browser, il che ne riduce l'efficienza."],"Excluding URLs":["Escludo gli URL"],"Use this feature if you want to exclude certain parts of your website from being cached and keep them dynamic.":["Utilizza questa funzione se desideri escludere alcune parti del tuo sito web dalla cache e mantenerle dinamiche."],"See examples":["Vedi gli esempi"],"GZIP Compression":["Compressione GZIP"],"Enables a compression of the content that's delivered to your visitors browsers improving the network loading times of your site.":["Consente una compressione del contenuto che viene consegnato ai browser dei visitatori, migliorando i tempi di caricamento della rete del tuo sito."],"GZIP Compression is enabled by default automatically saving you bandwidth and improving the loading speeds of your pages.":["La compressione GZIP è attiva di default per salvare automaticamente la larghezza di banda e migliorare la velocità di caricamento delle tue pagine."],"Memcached Stopped. Please, enable it in your SiteGround control panel.":["Memcached bloccato. Attivalo nel pannello di controllo di SiteGround."],"Memcached":["Memcached"],"Powerful object caching for your site. It stores frequently executed queries to your databases and reuses them for better performance.":["Una cache degli oggetti potente per il tuo sito. Memorizza le query eseguite frequentemente sui tuoi database e li riutilizza per prestazioni migliori."],"Score Check":["Verifica del punteggio"],"Test how optimized your website is. Our performance check is powered by Google PageSpeed.":["Verifica quanto è ottimizzato il tuo sito web. Il nostro controllo delle prestazioni è basato su Google Page Speed."],"Device Type":["Tipo di dispositivo"],"URL":["URL"],"Analyze":["Analizza"],"Please Wait, We Are Performing a Google PageSpeed Test on Your Page":["Ti preghiamo di attendere, stiamo eseguendo un test di Google PageSpeed sulla tua pagina"],"There is nothing here yet":["Non c'è ancora niente qui"],"Enable HTTPS":["Abilita HTTPS"],"Configures your site to work correctly via HTTPS and forces a secure connection to your site.":["Configura il tuo sito per funzionare correttamente tramite HTTPS e forza una connessione sicura al tuo sito."],"Fix Insecure Content":["Sistema i contenuti non sicuri"],"Enable this option in case you’re getting insecure content errors on your website. We will dynamically rewrite insecure requests for resources coming from your site":["Abilita questa opzione se ricevi errori di elementi non sicuri sul sito. Riscriveremo dinamicamente le richieste insicure per tutti gli elementi inerenti al tuo sito"],"Minify the HTML Output":["Minifica l'output HTML"],"Removes unnecessary characters from your HTML output saving data and improving your site speed. ":["Rimuove i caratteri non necessari dall'output HTML salvando i dati e migliorando la velocità del sito."],"Exclude URLs from HTML Minification":["Escludi gli URL dalla minificazione HTML"],"With this functionality, you can exclude different pages from HTML minification.":["Con questa funzionalità è possibile escludere pagine diverse dalla minificazione HTML."],"Minify JavaScript Files":["Minifica i file JavaScript"],"Minify your JavaScript files in order to reduce their size and reduce the number of requests to the server. ":["Minifica i tuoi file JavaScript per ridurre le dimensioni e il numero di richieste al server."],"Exclude from JavaScript Minification":["Escludi dalla minimizzazione JavaScript"],"Defer Render-blocking JS":["Rinvia il blocco di visualizzazione JS"],"Defer loading of render-blocking JavaScript files for faster initial site load. ":["Rinvia il caricamento di file JavaScript che bloccano la visualizzazione, per veocizzare il caricamento inziale del sito."],"Exclude from Loading JS Files Asynchronously":["Escludi dal caricamento asincrono dei file JS"],"Minify CSS Files":["Minifica i file CSS"],"Minify your CSS files in order to reduce their size and reduce the number of requests to the server. ":["Minifica i tuoi file CSS per ridurre le dimensioni e il numero di richieste al server."],"Exclude From CSS Minification":["Escludi dalla minificazione CSS"],"Combine CSS Files":["Unisci i file CSS"],"Combine multiple CSS files into one to lower the number of requests your site generates. ":["Combina più file CSS in uno per ridurre il numero di richieste generate dal tuo sito."],"Exclude from CSS Combination":["Escludi dalla combinazione CSS"],"Optimize Loading of Google Fonts":["Ottimizza il caricamento dei font Google"],"Combine the loading of Google fonts reducing the number of HTTP requests.":["Combina il caricamento dei font Google riducendo il numero di richieste HTTP.\n"],"Remove Query Strings From Static Resources":["Rimuovi le stringhe di ricerca dalle risorse statiche"],"Removes version query strings from your static resources improving the caching of those resources.":["Rimuove le stringhe di ricerca dalle risorse statiche migliorando la memorizzazione nella cache di tali risorse."],"Disable Emojis":["Disabilita Emoji"],"Enable to prevent WordPress from automatically detecting and generating emojis in your pages.":["Abilita per impedire a WordPress di rilevare e generare automaticamente emoji nelle tue pagine."],"New Images Optimization":["Ottimizzazione nuove immagini"],"We will automatically optimize all new images that you upload to your Media Library.":["Ottimizzeremo automaticamente tutte le nuove immagini che caricherai dalla Media Library."],"Existing Images Optimization":["Ottimizzazione immagini esistenti"],"We will optimize all your existing images with minimal or no loss in quality. Note, that this will overwrite your original images.":["Ottimizzeremo tutte le tue immagini con una perdita di qualità minima o nulla. Tieni presente che questo sovrascriverà le tue immagini originali."],"Resume Optimization":["Riprendi l’ottimizzazione"],"Start Optimization":["Inizio Ottimizzazione"],"We've detected that the WordPress cronjob functionality is not working. Please, enable it following the instructions in {{link}}this article{{/link}} and refresh this page. If you’re using a real cron job, you can {{link2}}ignore this message{{/link2}} at your own risk. Note, that in this case, those operations may take longer than usual to complete.":["Abbiamo rilevato che la funzionalità cronjob di WordPress non sta funzionando. Per favore, abilitala seguendo le istruzioni in {{link}} questo articolo {{/ link}} e aggiorna questa pagina. Se stai utilizzando un vero cronjob, puoi {{link2}} ignorare questo messaggio {{/ link2}} a tuo rischio. Tieni presente che, in questo caso, le operazioni potrebbero richiedere più tempo del solito per essere completate."],"https://www.siteground.com/kb/disable-enable-wordpress-cron/":["https://it.siteground.com/kb/come-disattivare-abilitare-il-wordpress-cron/"],"All images in your Media Library have been optimized successfully! Force {{link}}re-optimization{{/link}} of your images.":["Tutte le immagini nella tua libreria multimediale sono state ottimizzate con successo! Forza la {{link}}ri-ottimizzazione{{/link}} delle tue immagini."],"Lazy Load Images":["Lazy Load delle immagini"],"Load images only when they are visible in the browser":["Carica le immagini solo quando sono visibili nel browser"],"Lazy Load Gravatars":["Lazy Load dei Gravatar"],"When users comment under your posts, WordPress tries to load their avatars from gravatar.com. We recommend lazy-loading them as your users scroll down through your page if you have a high number of comments. ":["Quando gli utenti commentano i tuoi post, WordPress prova a caricare i loro avatar da gravatar.com. Ti consigliamo il lazy-load per essi perché, se hai un numero elevato di commenti, i tuoi utenti faranno uno scroll-down della tua pagina."],"Lazy Load Thumbnails":["Lazy Load delle Thumbnail"],"Enable if you want to lazy-load the thumbnail sizes of your original images.":["Abilita se desideri attivare il lazy-load per le dimensioni delle thumbnail delle immagini originali."],"Lazy Load Responsive Images":["Lazy Load delle immagini resposive"],"Certain plugins and themes generate multiple images from a single upload to work better on different devices. Enable if you want to lazy-load these too.":["Alcuni plugin e temi generano più immagini da un singolo upload per funzionare meglio su diversi device. Abilita, se vuoi attivare il lazy-load anche per questi."],"Lazy Load Widgets":["Lazy Load dei widget"],"Enable this option if you want the images in your widget areas to load only when users reach them. ":["Abilita questa opzione se desideri che le immagini nell'area dei widget vengano caricate solo quando gli utenti le raggiungono."],"Lazy Load for Mobile":["Lazy Load per mobile"],"Enable if you want to use lazy-loading features for mobile requests to your site.":["Abilita se vuoi usare la funzione di lazy load per le richieste mobile sul tuo sito."],"Lazy Load Product Images":["LazyLoad immagini prodotto"],"Enable if you want to enable lazy-load images in your store, product and other WooCommerce pages.":["Attiva il lazy-load delle immagini nello store, nella pagina prodotto e nelle altre pagine WooCommerce."],"Exclude from Lazy Load":["Escludi da Lazy Load"],"In order to exclude images from lazy loading, please add their CSS classes to the exclusion list. Add each CSS class on a separate line.":["Per escludere le immagini dal Lazy Load, aggiungi le loro classi CSS all'elenco di esclusione. Aggiungi ogni classe CSS su una riga separata."],"Site Admin Permissions":["Autorizzazioni dell'admin del sito"],"In this section, set the access permission for admins of separate sites.":["In questa sezione imposta i permessi di accesso per gli amministratori di siti diversi."],"SuperCacher Settings":["Impostazioni SuperCacher"],"Select whether site admins can access and make changes within the SiteGround Optimizer's SuperCacher tab.":["Seleziona se gli amministratori del sito possono accedere e apportare modifiche all'interno della sezione SuperCacher di SiteGround Optimizer."],"Frontend Optimizations":["Ottimizzazioni del frontend"],"Select whether site admins can access and make changes within the SiteGround Optimizer's Frontend Optmization tab.":["Seleziona se gli amministratori del sito possono accedere e apportare modifiche all'interno della sezione Ottimizzazione Frontend di SiteGround Optimizer."],"Image Optimizations":["Ottimizzazioni immagine"],"Select whether site admins can access and make changes within the SiteGround Optimizer's Image Optimization tab.":["Seleziona se gli amministratori del sito possono accedere e apportare modifiche all'interno della sezione Ottimizzazione Immagine di SiteGround Optimizer."],"Environment Optimizations":["Ottimizzazioni dell'ambiente"],"Select whether site admins can access and make changes within the SiteGround Optimizer's Environment Optimization tab.":["Seleziona se gli amministratori del sito possono accedere e apportare modifiche nella sezione di Ottimizzazione Ambiente di SiteGround Optimizer."],"SUPERCACHER SETTINGS":["IMPOSTAZIONI SUPERCACHER"],"Select whether new sites should have the Dynamic Caching enabled for them or not.":["Seleziona se i nuovi siti devono avere abilitata o meno la Cache Dinamica."],"ENVIRONMENT OPTIMIZATION":["OTTIMIZZAZIONE DELL’AMBIENTE"],"FRONTEND OPTIMIZATION":["OTTIMIZZAZIONE FRONTEND"],"Removes unnecessary characters from your HTML output saving data and improving your site speed.":["Rimuove i caratteri non necessari dall'output HTML salvando i dati e migliorando la velocità del tuo sito."],"Combine and minify your JavaScript files in order to reduce their size, improve cachability, and reduce the number of requests to the server.":["Combina e ridimensiona i tuoi file JavaScript per ridurne le dimensioni, migliorare il caching e ridurre il numero di richieste al server."],"Load Render-blocking JavaScript Files Asynchronously":["Carica in modo asincrono i file JavaScript che bloccano il rendering"],"Add async parameter to the JavaScript files loaded in the header section of your site so they don’t block your page rendering.":["Aggiungi un parametro asincrono ai file JavaScript caricati nell’header del tuo sito, in modo che non blocchino il rendering della pagina."],"Combine and minify your CSS files in order to reduce their size, improve cachability, and reduce the number of requests to the server.":["Combina e ridimensiona i file CSS per ridurne le dimensioni, migliorare il caching e diminuire il numero di richieste al server."],"Combine multiple CSS files into one to lower the number of requests your site generates.":["Unisci più file CSS in uno per ridurre il numero di richieste generate dal tuo sito."],"IMAGE OPTIMIZATION":["OTTIMIZZAZIONE IMMAGINI"],"Image Optimization":["Ottimizzazione Immagini"],"SG Optimizer":["SG Optimizer"],"Get the best performance for your WordPress website with our optimization plugin. It handles caching, system settings, and all the necessary configurations for a blazing-fast website. With the SiteGround Optimizer enabled, you're getting the very best from your hosting environment!":["Ottieni le massime prestazioni dal tuo sito WordPress con il nostro plugin di ottimizzazione. Gestisce il caching, le impostazioni di sistema e tutte le configurazioni necessarie per un sito web ad alte performance. Con SiteGround Optimizer abilitato otterrai il meglio dal tuo ambiente di hosting!"],"Old PHP Version":["Versione PHP precedente"],"You are using our Managed PHP service, which means that SiteGround will automatically update your PHP once we are sure there is a newer stable one, which comes with the latest security and performance enhancements. Alternatively, you can choose to manually set your PHP version, in which case the system will hardcode that version to your WordPress instance until you manually change it again.":["Stai utilizzando il nostro servizio PHP Gestito, il che significa che SiteGround aggiornerà automaticamente il tuo PHP ogni volta che siamo sicuri sia disponibile una versione più recente, stabile e sicura, capace di migliorare sicurezza e prestazioni. In alternativa, puoi scegliere di impostare manualmente la tua versione PHP e il sistema manterrà quella versione sulla tua istanza WordPress fino a quando non la cambierai di nuovo manualmente."],"Your site will keep using that version until you manually change it from this interface or until you switch to \"Managed PHP\" service. If you choose to take advantage of our Managed PHP service, SiteGround will automatically update your PHP once we are sure there is a newer stable one, which comes with the latest security and performance enhancements.":["Il tuo sito continuerà a utilizzare questa versione fino a quando non la cambierai manualmente da questa interfaccia o finché non passerai al servizio \"PHP Gestito\". Se scegli di utilizzare PHP Gestito, SiteGround aggiornerà automaticamente il tuo PHP ogni volta che siamo sicuri sia disponibile una versione più recente, stabile e sicura, capace di migliorare sicurezza e prestazioni."],"As a SiteGround client you may change your PHP version per site manually. However, we strongly recommend you to take advantage of our Managed PHP service, which means that SiteGround will automatically update your PHP once we are sure there is a newer, stable and safe version, which will give you the latest security and performance enhancements. Alternatively, if you choose to manually set your PHP version, the system will hardcode that version to your WordPress instance until you manually change it again.":["Come cliente SiteGround è possibile modificare manualmente la versione PHP del sito. Tuttavia, ti consigliamo vivamente di approfittare del nostro servizio PHP Gestito, attraverso il quale SiteGround aggiornerà automaticamente il tuo PHP ogni volta che siamo sicuri sia disponibile una versione più recente, stabile e sicura, capace di migliorare sicurezza e prestazioni. In alternativa, se si sceglie di impostare manualmente la propria versione PHP, il sistema manterrà quella versione sulla tua istanza WordPress fino a quando non la cambierai di nuovo manualmente."],"Set your PHP version":["Imposta la tua versione di PHP"],"You are currently running on PHP %(version)s.":["Attualmente stai utilizzando PHP %(version)s."],"PHP Management Method":["PHP Gestito"],"Please select method":["Seleziona il metodo"],"Please select management type":["Seleziona il tipo di gestione"],"PHP Version":["Versione PHP"],"Please select PHP version":["Seleziona la versione PHP"],"Save":["Salva"],"We currently recommend you to use PHP %(version)s. You can check the compatibility with the recommended version before you switch. {{link}}Check Compatibility{{/link}}":["Al momento ti consigliamo di utilizzare PHP %(version)s. Prima di selezionarla, è possibile verificare la compatibilità con la versione raccomandata. {{link}}Verifica compatibilità{{/link}}"],"All your plugins are compatible with PHP %(version)s. You may safely switch to “Managed PHP” service and we’ll upgrade it automatically, or set it manually. {{link}}Check Again{{/link}}":["Todos tus plugins son compatibles con PHP %(version)s. Puedes utilizar el servicio PHP gestionado y nosotros realizaremos la actualización de manera automática, o lo puedes hacer de forma manual. {{link}}Controlla ancora{{/link}}"],"Checking PHP 7.1 Compatibility...":["erifica in corso della compatibilità con PHP %(version)s..."],"Unfortunately some of your plugins or theme are not compatible with our recommended version. {{link}}Check Again{{/link}}":["Purtroppo alcuni dei tuoi plugin o temi non sono compatibili con la versione raccomandata. {{link}}Controlla ancora{{/link}}"],"Thanks for using SG Optimizer to make your site faster!":["Grazie per utilizzare SG Optimizer per rendere il tuo sito più veloce!"],"Help more people optimize their sites by rating our plugin.":["Aiuta più persone a ottimizzare i loro siti, vota il nostro plugin."],"Don’t Show This Again":["Non mostrare più"]}
|
languages/sg-cachepress-es_ES.mo
CHANGED
Binary file
|
languages/sg-cachepress-es_ES.po
CHANGED
@@ -2,8 +2,8 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: SG Optimizer\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2020-01-
|
6 |
-
"PO-Revision-Date: 2020-01-
|
7 |
"Last-Translator: admin <nobody@exmaple.com>\n"
|
8 |
"Language-Team: Spanish (Spain)\n"
|
9 |
"Language: es_ES\n"
|
@@ -14,37 +14,19 @@ msgstr ""
|
|
14 |
"X-Generator: Loco https://localise.biz/\n"
|
15 |
"X-Loco-Version: 2.3.0; wp-5.3"
|
16 |
|
17 |
-
#. src-js/components/tabs/supercacher/index.jsx:364
|
18 |
-
#: src-js/sg-cachepress-strings.php:4
|
19 |
-
msgid "Test URLs for Cache Status"
|
20 |
-
msgstr "Prueba las URLs para saber el estado de la caché"
|
21 |
-
|
22 |
-
#. src-js/components/tabs/supercacher/index.jsx:396
|
23 |
-
#: src-js/sg-cachepress-strings.php:5
|
24 |
-
msgid ""
|
25 |
-
"Check if the Dynamic Cache is working on a certain URL. Especially useful to "
|
26 |
-
"make sure your Exclude list is working the way it should."
|
27 |
-
msgstr ""
|
28 |
-
"Comprueba si la caché dinámica funciona en una determinada URL. "
|
29 |
-
"Especialmente útil para asegurar que tu lista de exclusión funciona de forma "
|
30 |
-
"correcta."
|
31 |
-
|
32 |
-
#. src-js/components/tabs/supercacher/index.jsx:399
|
33 |
-
#: src-js/sg-cachepress-strings.php:6
|
34 |
-
msgid "Test"
|
35 |
-
msgstr "Probar"
|
36 |
-
|
37 |
#. src-js/components/dialogs/images-dialog.jsx:17
|
38 |
#. src-js/components/dialogs/php-dialog.jsx:17
|
39 |
#. src-js/components/dialogs/ssl-dialog.jsx:17
|
40 |
-
#:
|
41 |
-
#:
|
42 |
-
#:
|
|
|
|
|
43 |
msgid "Confirm"
|
44 |
msgstr "Confirmar"
|
45 |
|
46 |
#. src-js/components/dialogs/async-dialog.tsx:18
|
47 |
-
#:
|
48 |
msgid ""
|
49 |
"Defering render-blocking JavaScript may cause issues with scripts that "
|
50 |
"require certain order of execution. This is why we advise you to check the "
|
@@ -56,7 +38,7 @@ msgstr ""
|
|
56 |
"activar esta optimización."
|
57 |
|
58 |
#. src-js/components/dialogs/async-dialog.tsx:29
|
59 |
-
#:
|
60 |
msgid ""
|
61 |
"If you notice issues with certain functionality, use the Exclude "
|
62 |
"functionality to keep those scripts loading in a render-blocking manner."
|
@@ -66,12 +48,13 @@ msgstr ""
|
|
66 |
"bloqueador de visualización."
|
67 |
|
68 |
#. src-js/components/dialogs/ssl-dialog.jsx:35
|
69 |
-
#:
|
|
|
70 |
msgid "Close"
|
71 |
msgstr "Cerrar"
|
72 |
|
73 |
#. src-js/components/dialogs/cache-dialog.jsx:17
|
74 |
-
#:
|
75 |
msgid ""
|
76 |
"Purge your installation's entire Dynamic Cache or select parts in order to "
|
77 |
"achieve the best hit-to-cache ratio for your account. Here are the plugin's "
|
@@ -82,7 +65,7 @@ msgstr ""
|
|
82 |
"de vaciado del plugin:"
|
83 |
|
84 |
#. src-js/components/dialogs/cache-dialog.jsx:29
|
85 |
-
#:
|
86 |
msgid ""
|
87 |
"Full Purge on page, posts, and category deletion, plugin and theme "
|
88 |
"activation, deactivation, or update, and on WordPress core updates."
|
@@ -92,7 +75,7 @@ msgstr ""
|
|
92 |
"principales de WordPress."
|
93 |
|
94 |
#. src-js/components/dialogs/cache-dialog.jsx:38
|
95 |
-
#:
|
96 |
msgid ""
|
97 |
"Specific URL Purge on comment actions and page, post, and category updates."
|
98 |
msgstr ""
|
@@ -102,13 +85,15 @@ msgstr ""
|
|
102 |
#. src-js/components/dialogs/cache-dialog.jsx:48
|
103 |
#. src-js/components/dialogs/images-dialog.jsx:35
|
104 |
#. src-js/components/dialogs/php-dialog.jsx:36
|
105 |
-
#:
|
106 |
-
#:
|
|
|
|
|
107 |
msgid "Cancel"
|
108 |
msgstr "Cancelar"
|
109 |
|
110 |
#. src-js/components/dialogs/delete-webp-dialog.tsx:23
|
111 |
-
#:
|
112 |
msgid ""
|
113 |
"This will delete all WebP files in your uploads folder! In case you need "
|
114 |
"them, you will have to regenerate them again or restore that folder from a "
|
@@ -119,7 +104,7 @@ msgstr ""
|
|
119 |
"directorio desde una copia de seguridad."
|
120 |
|
121 |
#. src-js/components/dialogs/php-dialog.jsx:23
|
122 |
-
#:
|
123 |
msgid ""
|
124 |
"You’re switching to PHP %(version)s manually and you will stay on that "
|
125 |
"version until you change it to a newer one. In case you experience any "
|
@@ -132,7 +117,7 @@ msgstr ""
|
|
132 |
"{{strong}}cPanel{{/strong}} > {{strong}}PHP Version Manager{{/strong}}."
|
133 |
|
134 |
#. src-js/components/dialogs/php-dialog.jsx:37
|
135 |
-
#:
|
136 |
msgid ""
|
137 |
"You’re about to switch to Managed PHP service. This means that SiteGround "
|
138 |
"will automatically update your PHP version once we are sure there’s a better,"
|
@@ -143,7 +128,7 @@ msgstr ""
|
|
143 |
"que hay una versión nueva, segura y estable."
|
144 |
|
145 |
#. src-js/components/dialogs/regenerate-webp-dialog.tsx:23
|
146 |
-
#:
|
147 |
msgid ""
|
148 |
"Doing this will delete all WebP files in your uploads folder and generate "
|
149 |
"them anew!"
|
@@ -152,7 +137,7 @@ msgstr ""
|
|
152 |
"nuevamente."
|
153 |
|
154 |
#. src-js/components/dialogs/ssl-dialog.jsx:23
|
155 |
-
#:
|
156 |
msgid ""
|
157 |
"In order to force HTTPS on your site, we will automatically update your "
|
158 |
"database replacing all insecure links. In addition to that, we will add a "
|
@@ -165,7 +150,7 @@ msgstr ""
|
|
165 |
"una conexión cifrada."
|
166 |
|
167 |
#. src-js/components/dialogs/urls-dialog.jsx:17
|
168 |
-
#:
|
169 |
msgid ""
|
170 |
"You can exclude full or partial URLs using \"*\" as a wildcard. For example:"
|
171 |
msgstr ""
|
@@ -173,7 +158,7 @@ msgstr ""
|
|
173 |
"ejemplo:"
|
174 |
|
175 |
#. src-js/components/dialogs/urls-dialog.jsx:29
|
176 |
-
#:
|
177 |
msgid ""
|
178 |
"{{strong}}www.site.com/parent-page/sub-page{{/strong}} will exclude only "
|
179 |
"that single URL."
|
@@ -182,7 +167,7 @@ msgstr ""
|
|
182 |
"esa URL."
|
183 |
|
184 |
#. src-js/components/dialogs/urls-dialog.jsx:38
|
185 |
-
#:
|
186 |
msgid ""
|
187 |
"{{strong}}www.site.com/parent-page/*{{/strong}} will exclude all sub-pages "
|
188 |
"of \"parent-page\"."
|
@@ -190,55 +175,78 @@ msgstr ""
|
|
190 |
"{{strong}}www.sitio.com/pagina-superior/*{{/strong}} se excluirá de todas "
|
191 |
"las sub-paginas de la «pagina-superior»."
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
#. src-js/components/exclude/index.jsx:142
|
194 |
-
#:
|
195 |
msgid "This item already exists in exclude list."
|
196 |
msgstr "Este objeto ya existe en la lista de excluídos."
|
197 |
|
198 |
#. src-js/components/exclude/simple-exclude.jsx:44
|
199 |
-
#:
|
200 |
msgid "You must input a class name."
|
201 |
msgstr "Es necesario que introduzcas una nombre de clase."
|
202 |
|
203 |
#. src-js/components/tabs/supercacher/index.jsx:338
|
204 |
-
#:
|
|
|
205 |
msgid "Exclude"
|
206 |
msgstr "Excluir"
|
207 |
|
208 |
#. src-js/components/tabs/image-optimization/index.jsx:318
|
209 |
-
#:
|
210 |
msgid "This URL already exists in exclude list."
|
211 |
msgstr "Esta URL ya existe en la lista de exclusión."
|
212 |
|
213 |
#. src-js/components/dialogs/urls-dialog.tsx:54
|
214 |
#. src-js/components/loaders/image-loader.tsx:59
|
215 |
-
#:
|
|
|
216 |
msgid "Please be patient, this process may take some time"
|
217 |
msgstr "Por favor, se paciente, el proceso puede llevar un tiempo"
|
218 |
|
219 |
#. src-js/components/loaders/image-loader.tsx:31
|
220 |
-
#:
|
221 |
msgid "Optimized %(optimized)s of %(total)s images"
|
222 |
msgstr "Imágenes optimizadas %(optimized)s de %(total)s"
|
223 |
|
224 |
#. src-js/components/loaders/image-loader.tsx:35
|
225 |
#. src-js/components/loaders/webp-loader.tsx:31
|
226 |
-
#:
|
|
|
227 |
msgid "Pause"
|
228 |
msgstr "Pausar"
|
229 |
|
230 |
#. src-js/components/loaders/webp-loader.tsx:27
|
231 |
-
#:
|
232 |
msgid "Generated %(optimized)s of %(total)s webp copies"
|
233 |
msgstr "Copias WebP generadas %(optimized)s de %(total)s"
|
234 |
|
235 |
#. src-js/components/loaders/webp-loader.tsx:55
|
236 |
-
#:
|
237 |
msgid "Generate WebP Copies of New Images"
|
238 |
msgstr "Genera copias WebP de nuevas imágenes"
|
239 |
|
240 |
#. src-js/components/webp/webp.tsx:118
|
241 |
-
#:
|
242 |
msgid ""
|
243 |
"WebP is a next generation image format supported by modern browers which "
|
244 |
"greatly reduces the size of your images."
|
@@ -248,27 +256,27 @@ msgstr ""
|
|
248 |
"imágenes."
|
249 |
|
250 |
#. src-js/components/webp/webp.tsx:122
|
251 |
-
#:
|
252 |
msgid "Manage WebP Copies for Existing Images"
|
253 |
msgstr "Administra las copias WebP para imágenes existentes"
|
254 |
|
255 |
#. src-js/components/webp/webp.tsx:139
|
256 |
-
#:
|
257 |
msgid "Generate or delete a WebP copy of your existing media library."
|
258 |
msgstr "Genera o elimina una copia WebP de tu librería de medios."
|
259 |
|
260 |
#. src-js/components/webp/webp.tsx:142
|
261 |
-
#:
|
262 |
msgid "Delete all WebP Files"
|
263 |
msgstr "Elimina todos los archivos WebP"
|
264 |
|
265 |
#. src-js/components/webp/webp.tsx:160
|
266 |
-
#:
|
267 |
msgid "Bulk Generate WebP Files"
|
268 |
msgstr "Generación masiva de archivos WebP."
|
269 |
|
270 |
#. src-js/components/webp/webp.tsx:176
|
271 |
-
#:
|
272 |
msgid ""
|
273 |
"All WebP copies of your files have been generated successfully! Force {{link}"
|
274 |
"}re-generation{{/link}} of your images."
|
@@ -277,13 +285,13 @@ msgstr ""
|
|
277 |
"Fuerza la {{link}}regeneración{{/link}} de tus imágenes."
|
278 |
|
279 |
#. src-js/components/tabs/environment-optimization/index.jsx:216
|
280 |
-
#:
|
281 |
-
#: core/Options/Options.php:385
|
282 |
msgid "Browser Caching"
|
283 |
msgstr "Caché del navegador"
|
284 |
|
285 |
#. src-js/components/tabs/environment-optimization/index.jsx:246
|
286 |
-
#:
|
287 |
msgid ""
|
288 |
"Adds rules to store in your visitors browser cache to keep static content "
|
289 |
"longer for better site performance."
|
@@ -293,12 +301,13 @@ msgstr ""
|
|
293 |
"rendimiento de la web."
|
294 |
|
295 |
#. src-js/components/modules/gzip/index.jsx:35
|
296 |
-
#:
|
|
|
297 |
msgid "YOU HAVE A SITE TOOLS ACCOUNT"
|
298 |
msgstr "TIENES UNA CUENTA DE SITE TOOLS"
|
299 |
|
300 |
#. src-js/components/modules/browser-cache/index.tsx:38
|
301 |
-
#:
|
302 |
msgid ""
|
303 |
"NGINX Direct Delivery takes care of your static resources including proper "
|
304 |
"expiration dates for your browser caching."
|
@@ -308,12 +317,13 @@ msgstr ""
|
|
308 |
|
309 |
#. src-js/components/tabs/multisite-control/index.jsx:277
|
310 |
#. src-js/components/tabs/supercacher/index.jsx:160
|
311 |
-
#:
|
|
|
312 |
msgid "Dynamic Caching"
|
313 |
msgstr "Caché dinámica"
|
314 |
|
315 |
#. src-js/components/tabs/supercacher/index.jsx:218
|
316 |
-
#:
|
317 |
msgid ""
|
318 |
"Store your content in the server’s memory for a faster access with this full-"
|
319 |
"page caching solution powered by NGINX."
|
@@ -322,32 +332,34 @@ msgstr ""
|
|
322 |
"con esta solución de página completa de caché por NGINX."
|
323 |
|
324 |
#. src-js/components/tabs/supercacher/index.jsx:221
|
325 |
-
#:
|
326 |
msgid "Manual Cache Purge"
|
327 |
msgstr "Vaciado manual de caché"
|
328 |
|
329 |
#. src-js/components/tabs/supercacher/index.jsx:264
|
330 |
-
#:
|
331 |
msgid "Clear the Dynamic Cache for your entire website."
|
332 |
msgstr "Vacía la caché dinámica de toda tu web."
|
333 |
|
334 |
#. src-js/components/modules/dynamic-cache/index.jsx:234
|
335 |
-
#:
|
336 |
msgid "Purge Cache"
|
337 |
msgstr "Vaciar caché"
|
338 |
|
339 |
#. src-js/components/modules/dynamic-cache/index.jsx:247
|
340 |
-
#:
|
341 |
msgid "Purging ..."
|
342 |
msgstr "Vaciando ..."
|
343 |
|
344 |
#. src-js/components/tabs/supercacher/index.jsx:267
|
345 |
-
#:
|
|
|
346 |
msgid "Automatic Cache Purge"
|
347 |
msgstr "Vaciado automático de la caché"
|
348 |
|
349 |
#. src-js/components/tabs/supercacher/index.jsx:299
|
350 |
-
#:
|
|
|
351 |
msgid ""
|
352 |
"Automatically perform a smart cache purge after every content modification."
|
353 |
msgstr ""
|
@@ -355,17 +367,17 @@ msgstr ""
|
|
355 |
"de contenido."
|
356 |
|
357 |
#. src-js/components/tabs/supercacher/index.jsx:302
|
358 |
-
#:
|
359 |
msgid "See rules"
|
360 |
msgstr "Ver reglas"
|
361 |
|
362 |
#. src-js/components/modules/dynamic-cache/index.jsx:127
|
363 |
-
#:
|
364 |
msgid "Browser-Specific Caching"
|
365 |
msgstr "Almacenamiento en caché específico del navegador"
|
366 |
|
367 |
#. src-js/components/modules/dynamic-cache/index.jsx:133
|
368 |
-
#:
|
369 |
msgid ""
|
370 |
"We recommend you to enable this feature {{strong}}only{{/strong}} if you’re "
|
371 |
"experiencing issues with plugins, generating mobile version of your site or "
|
@@ -379,12 +391,12 @@ msgstr ""
|
|
379 |
"eficiencia."
|
380 |
|
381 |
#. src-js/components/tabs/supercacher/index.jsx:305
|
382 |
-
#:
|
383 |
msgid "Excluding URLs"
|
384 |
msgstr "Excluir URLs"
|
385 |
|
386 |
#. src-js/components/tabs/supercacher/index.jsx:332
|
387 |
-
#:
|
388 |
msgid ""
|
389 |
"Use this feature if you want to exclude certain parts of your website from "
|
390 |
"being cached and keep them dynamic."
|
@@ -393,24 +405,25 @@ msgstr ""
|
|
393 |
"excluidas de la caché y así mantenerlas dinámicas."
|
394 |
|
395 |
#. src-js/components/tabs/supercacher/index.jsx:335
|
396 |
-
#:
|
397 |
msgid "See examples"
|
398 |
msgstr "Ver ejemplos"
|
399 |
|
400 |
#. src-js/components/modules/gzip/index.jsx:12
|
401 |
-
#:
|
|
|
402 |
msgid "Memcached Stopped. Please, enable it in your SiteGround control panel."
|
403 |
msgstr ""
|
404 |
"Memcached detenido. Por favor, habilítalo en tu panel de control de "
|
405 |
"SiteGround."
|
406 |
|
407 |
#. src-js/components/tabs/supercacher/index.jsx:426
|
408 |
-
#:
|
409 |
msgid "Memcached"
|
410 |
msgstr "Memcached"
|
411 |
|
412 |
#. src-js/components/tabs/supercacher/index.jsx:454
|
413 |
-
#:
|
414 |
msgid ""
|
415 |
"Powerful object caching for your site. It stores frequently executed queries "
|
416 |
"to your databases and reuses them for better performance."
|
@@ -420,13 +433,13 @@ msgstr ""
|
|
420 |
"rendimiento."
|
421 |
|
422 |
#. src-js/components/tabs/environment-optimization/index.jsx:157
|
423 |
-
#:
|
424 |
-
#: core/Options/Options.php:384
|
425 |
msgid "GZIP Compression"
|
426 |
msgstr "Compresión GZIP"
|
427 |
|
428 |
#. src-js/components/tabs/environment-optimization/index.jsx:213
|
429 |
-
#:
|
430 |
msgid ""
|
431 |
"Enables a compression of the content that's delivered to your visitors "
|
432 |
"browsers improving the network loading times of your site."
|
@@ -435,7 +448,7 @@ msgstr ""
|
|
435 |
"visitantes ,mejorando los tiempo de carga de tu sitio."
|
436 |
|
437 |
#. src-js/components/modules/gzip/index.jsx:40
|
438 |
-
#:
|
439 |
msgid ""
|
440 |
"GZIP Compression is enabled by default automatically saving you bandwidth "
|
441 |
"and improving the loading speeds of your pages."
|
@@ -444,12 +457,12 @@ msgstr ""
|
|
444 |
"ancho de banda y mejora la velocidad de carga de tus páginas."
|
445 |
|
446 |
#. src-js/components/modules/memcached/index.tsx:63
|
447 |
-
#:
|
448 |
msgid "Score Check"
|
449 |
msgstr "Revisar resultado"
|
450 |
|
451 |
#. src-js/components/tabs/analytics/index.tsx:122
|
452 |
-
#:
|
453 |
msgid ""
|
454 |
"Test how optimized your website is. Our performance check is powered by "
|
455 |
"Google PageSpeed."
|
@@ -458,39 +471,41 @@ msgstr ""
|
|
458 |
"Google PageSpeed."
|
459 |
|
460 |
#. src-js/components/tabs/analytics/index.tsx:125
|
461 |
-
#:
|
462 |
msgid "Device Type"
|
463 |
msgstr "Tipo de dispositiv"
|
464 |
|
465 |
#. src-js/components/tabs/analytics/index.tsx:156
|
466 |
-
#:
|
467 |
msgid "URL"
|
468 |
msgstr "URL"
|
469 |
|
470 |
#. src-js/components/tabs/analytics/index.jsx:31
|
471 |
-
#:
|
472 |
msgid "Analyze"
|
473 |
msgstr "Analizar"
|
474 |
|
475 |
#. src-js/components/tabs/analytics/index.tsx:180
|
476 |
-
#:
|
477 |
msgid "Please Wait, We Are Performing a Google PageSpeed Test on Your Page"
|
478 |
msgstr ""
|
479 |
"Espera, por favor, estamos realizando un test con Google PageSpeed en tu web"
|
480 |
|
481 |
#. src-js/components/tabs/analytics/index.tsx:187
|
482 |
-
#:
|
483 |
msgid "There is nothing here yet"
|
484 |
msgstr "No nada aquí todavía"
|
485 |
|
486 |
#. src-js/components/php-checker/index.jsx:341
|
487 |
#. src-js/components/tabs/multisite-control/index.jsx:226
|
488 |
-
#:
|
|
|
489 |
msgid "Enable HTTPS"
|
490 |
msgstr "Activar HTTPS"
|
491 |
|
492 |
#. src-js/components/tabs/environment-optimization/index.jsx:109
|
493 |
-
#:
|
|
|
494 |
msgid ""
|
495 |
"Configures your site to work correctly via HTTPS and forces a secure "
|
496 |
"connection to your site."
|
@@ -499,12 +514,14 @@ msgstr ""
|
|
499 |
"fuerza una conexión segura en tu sitio."
|
500 |
|
501 |
#. src-js/components/tabs/environment-optimization/index.jsx:112
|
502 |
-
#:
|
|
|
503 |
msgid "Fix Insecure Content"
|
504 |
msgstr "Corregir contenido inseguro"
|
505 |
|
506 |
#. src-js/components/tabs/environment-optimization/index.jsx:154
|
507 |
-
#:
|
|
|
508 |
msgid ""
|
509 |
"Enable this option in case you’re getting insecure content errors on your "
|
510 |
"website. We will dynamically rewrite insecure requests for resources coming "
|
@@ -515,12 +532,13 @@ msgstr ""
|
|
515 |
"inseguras de los recursos de tu sitio"
|
516 |
|
517 |
#. src-js/components/tabs/environment-optimization/index.jsx:249
|
518 |
-
#:
|
|
|
519 |
msgid "Minify the HTML Output"
|
520 |
msgstr "Minimizar la salida HTML"
|
521 |
|
522 |
#. src-js/components/tabs/frontend-optimization/index.jsx:71
|
523 |
-
#:
|
524 |
msgid ""
|
525 |
"Removes unnecessary characters from your HTML output saving data and "
|
526 |
"improving your site speed. "
|
@@ -530,12 +548,13 @@ msgstr ""
|
|
530 |
|
531 |
#. src-js/components/tabs/frontend-optimization/index.jsx:76
|
532 |
#. src-js/components/tabs/frontend-optimization/index.jsx:81
|
533 |
-
#:
|
|
|
534 |
msgid "Exclude URLs from HTML Minification"
|
535 |
msgstr "Excluir las direcciones URL de la minificación de HTML"
|
536 |
|
537 |
#. src-js/components/tabs/frontend-optimization/index.jsx:101
|
538 |
-
#:
|
539 |
msgid ""
|
540 |
"With this functionality, you can exclude different pages from HTML "
|
541 |
"minification."
|
@@ -544,12 +563,13 @@ msgstr ""
|
|
544 |
"HTML."
|
545 |
|
546 |
#. src-js/components/tabs/frontend-optimization/index.jsx:35
|
547 |
-
#:
|
|
|
548 |
msgid "Minify JavaScript Files"
|
549 |
msgstr "Minimizar archivos JavaScript"
|
550 |
|
551 |
#. src-js/components/tabs/frontend-optimization/index.jsx:118
|
552 |
-
#:
|
553 |
msgid ""
|
554 |
"Minify your JavaScript files in order to reduce their size and reduce the "
|
555 |
"number of requests to the server. "
|
@@ -558,17 +578,17 @@ msgstr ""
|
|
558 |
"reducir el número de peticiones al servidor."
|
559 |
|
560 |
#. src-js/components/tabs/frontend-optimization/index.jsx:123
|
561 |
-
#:
|
562 |
msgid "Exclude from JavaScript Minification"
|
563 |
msgstr "Excluir de la minificación de JavaScript"
|
564 |
|
565 |
#. src-js/components/tabs/frontend-optimization/index.jsx:128
|
566 |
-
#:
|
567 |
msgid "Defer Render-blocking JS"
|
568 |
msgstr "Carga diferida del bloqueador de visualización JS"
|
569 |
|
570 |
#. src-js/components/tabs/frontend-optimization/index.jsx:160
|
571 |
-
#:
|
572 |
msgid ""
|
573 |
"Defer loading of render-blocking JavaScript files for faster initial site "
|
574 |
"load. "
|
@@ -577,17 +597,18 @@ msgstr ""
|
|
577 |
"carga inicial más rápida del sitio."
|
578 |
|
579 |
#. src-js/components/tabs/frontend-optimization/index.jsx:165
|
580 |
-
#:
|
581 |
msgid "Exclude from Loading JS Files Asynchronously"
|
582 |
msgstr "Excluir de carga de archivos JS de forma asíncrona"
|
583 |
|
584 |
#. src-js/components/tabs/frontend-optimization/index.jsx:68
|
585 |
-
#:
|
|
|
586 |
msgid "Minify CSS Files"
|
587 |
msgstr "Minimizar archivos CSS"
|
588 |
|
589 |
#. src-js/components/tabs/frontend-optimization/index.jsx:202
|
590 |
-
#:
|
591 |
msgid ""
|
592 |
"Minify your CSS files in order to reduce their size and reduce the number of "
|
593 |
"requests to the server. "
|
@@ -596,18 +617,19 @@ msgstr ""
|
|
596 |
"número de peticiones al servidor."
|
597 |
|
598 |
#. src-js/components/tabs/frontend-optimization/index.jsx:207
|
599 |
-
#:
|
600 |
msgid "Exclude From CSS Minification"
|
601 |
msgstr "Excluir de la minificación de CSS"
|
602 |
|
603 |
#. src-js/components/tabs/frontend-optimization/index.jsx:149
|
604 |
#. src-js/components/tabs/sites-control/index.jsx:362
|
605 |
-
#:
|
|
|
606 |
msgid "Combine CSS Files"
|
607 |
msgstr "Combinar archivos CSS"
|
608 |
|
609 |
#. src-js/components/tabs/frontend-optimization/index.jsx:244
|
610 |
-
#:
|
611 |
msgid ""
|
612 |
"Combine multiple CSS files into one to lower the number of requests your "
|
613 |
"site generates. "
|
@@ -616,17 +638,17 @@ msgstr ""
|
|
616 |
"solicitudes que genera tu sitio."
|
617 |
|
618 |
#. src-js/components/tabs/frontend-optimization/index.jsx:249
|
619 |
-
#:
|
620 |
msgid "Exclude from CSS Combination"
|
621 |
msgstr "Excluir de la combinación de CSS"
|
622 |
|
623 |
#. src-js/components/tabs/frontend-optimization/index.jsx:254
|
624 |
-
#:
|
625 |
msgid "Optimize Loading of Google Fonts"
|
626 |
msgstr "Optimiza la carga de las fuentes de Google"
|
627 |
|
628 |
#. src-js/components/tabs/frontend-optimization/index.jsx:286
|
629 |
-
#:
|
630 |
msgid ""
|
631 |
"Combine the loading of Google fonts reducing the number of HTTP requests."
|
632 |
msgstr ""
|
@@ -634,12 +656,14 @@ msgstr ""
|
|
634 |
"HTTP."
|
635 |
|
636 |
#. src-js/components/tabs/frontend-optimization/index.jsx:102
|
637 |
-
#:
|
|
|
638 |
msgid "Remove Query Strings From Static Resources"
|
639 |
msgstr "Eliminar cadenas de petición de recursos estáticos"
|
640 |
|
641 |
#. src-js/components/tabs/frontend-optimization/index.jsx:132
|
642 |
-
#:
|
|
|
643 |
msgid ""
|
644 |
"Removes version query strings from your static resources improving the "
|
645 |
"caching of those resources."
|
@@ -648,12 +672,14 @@ msgstr ""
|
|
648 |
"caché de esos recursos."
|
649 |
|
650 |
#. src-js/components/tabs/frontend-optimization/index.jsx:135
|
651 |
-
#:
|
|
|
652 |
msgid "Disable Emojis"
|
653 |
msgstr "Desactivar Emojis"
|
654 |
|
655 |
#. src-js/components/tabs/frontend-optimization/index.jsx:165
|
656 |
-
#:
|
|
|
657 |
msgid ""
|
658 |
"Enable to prevent WordPress from automatically detecting and generating "
|
659 |
"emojis in your pages."
|
@@ -661,83 +687,13 @@ msgstr ""
|
|
661 |
"Activar para impedir que WordPress detecte y genere automáticamente emojis "
|
662 |
"en tus páginas."
|
663 |
|
664 |
-
#. src-js/components/tabs/multisite-control/index.jsx:339
|
665 |
-
#: src-js/sg-cachepress-strings.php:111
|
666 |
-
msgid "Site Admin Permissions"
|
667 |
-
msgstr "Permisos de administrador del sitio"
|
668 |
-
|
669 |
-
#. src-js/components/tabs/multisite-control/index.jsx:372
|
670 |
-
#: src-js/sg-cachepress-strings.php:112
|
671 |
-
msgid ""
|
672 |
-
"In this section, set the access permission for admins of separate sites."
|
673 |
-
msgstr ""
|
674 |
-
"En esta sección, configura los permisos para los administrador de distintas "
|
675 |
-
"webs."
|
676 |
-
|
677 |
-
#. src-js/components/tabs/multisite-control/index.jsx:87
|
678 |
-
#: src-js/sg-cachepress-strings.php:113 helpers/manual-translations.php:2
|
679 |
-
msgid "SuperCacher Settings"
|
680 |
-
msgstr "Ajustes de SuperCacher"
|
681 |
-
|
682 |
-
#. src-js/components/tabs/multisite-control/index.jsx:402
|
683 |
-
#: src-js/sg-cachepress-strings.php:114
|
684 |
-
msgid ""
|
685 |
-
"Select whether site admins can access and make changes within the SiteGround "
|
686 |
-
"Optimizer's SuperCacher tab."
|
687 |
-
msgstr ""
|
688 |
-
"Selecciona si los administradores pueden acceder y hacer cambios en la "
|
689 |
-
"pestaña SuperCacher de SiteGround Optimizer."
|
690 |
-
|
691 |
-
#. src-js/components/tabs/multisite-control/index.jsx:405
|
692 |
-
#: src-js/sg-cachepress-strings.php:115
|
693 |
-
msgid "Frontend Optimizations"
|
694 |
-
msgstr "Optimizaciones en portada"
|
695 |
-
|
696 |
-
#. src-js/components/tabs/multisite-control/index.jsx:434
|
697 |
-
#: src-js/sg-cachepress-strings.php:116
|
698 |
-
msgid ""
|
699 |
-
"Select whether site admins can access and make changes within the SiteGround "
|
700 |
-
"Optimizer's Frontend Optmization tab."
|
701 |
-
msgstr ""
|
702 |
-
"Selecciona si los administradores pueden acceder y hacer cambios en la "
|
703 |
-
"pestaña de optimización en portada de SiteGround Optimizer."
|
704 |
-
|
705 |
-
#. src-js/components/tabs/multisite-control/index.jsx:437
|
706 |
-
#: src-js/sg-cachepress-strings.php:117
|
707 |
-
msgid "Image Optimizations"
|
708 |
-
msgstr "Optimizaciones de imágenes"
|
709 |
-
|
710 |
-
#. src-js/components/tabs/multisite-control/index.jsx:464
|
711 |
-
#: src-js/sg-cachepress-strings.php:118
|
712 |
-
msgid ""
|
713 |
-
"Select whether site admins can access and make changes within the SiteGround "
|
714 |
-
"Optimizer's Image Optimization tab."
|
715 |
-
msgstr ""
|
716 |
-
"Selecciona si los administradores pueden acceder y hacer cambios en la "
|
717 |
-
"pestaña de optimización de imágenes de SiteGround Optimizer."
|
718 |
-
|
719 |
-
#. src-js/components/tabs/multisite-control/index.jsx:467
|
720 |
-
#: src-js/sg-cachepress-strings.php:119
|
721 |
-
msgid "Environment Optimizations"
|
722 |
-
msgstr "Optimización del entorno"
|
723 |
-
|
724 |
-
#. src-js/components/tabs/multisite-control/index.jsx:494
|
725 |
-
#: src-js/sg-cachepress-strings.php:120
|
726 |
-
msgid ""
|
727 |
-
"Select whether site admins can access and make changes within the SiteGround "
|
728 |
-
"Optimizer's Environment Optimization tab."
|
729 |
-
msgstr ""
|
730 |
-
"Selecciona si los administradores de la página pueden acceder y hacer "
|
731 |
-
"cambios dentro de la pestaña de optimización del entorno de SiteGround "
|
732 |
-
"Optimizer."
|
733 |
-
|
734 |
#. src-js/components/tabs/frontend-optimization/index.jsx:191
|
735 |
-
#:
|
736 |
msgid "New Images Optimization"
|
737 |
msgstr "Optimización de nuevas imágenes"
|
738 |
|
739 |
#. src-js/components/tabs/image-optimization/index.jsx:68
|
740 |
-
#:
|
741 |
msgid ""
|
742 |
"We will automatically optimize all new images that you upload to your Media "
|
743 |
"Library."
|
@@ -746,12 +702,13 @@ msgstr ""
|
|
746 |
"biblioteca de medios."
|
747 |
|
748 |
#. src-js/components/tabs/image-optimization/index.jsx:71
|
749 |
-
#:
|
750 |
msgid "Existing Images Optimization"
|
751 |
msgstr "Optimización de imágenes existentes"
|
752 |
|
753 |
#. src-js/components/tabs/image-optimization/index.jsx:80
|
754 |
-
#:
|
|
|
755 |
msgid ""
|
756 |
"We will optimize all your existing images with minimal or no loss in quality."
|
757 |
" Note, that this will overwrite your original images."
|
@@ -760,18 +717,19 @@ msgstr ""
|
|
760 |
"Ten en cuenta que esto sobreescribirá tus imágenes originales."
|
761 |
|
762 |
#. src-js/components/tabs/frontend-optimization/index.jsx:191
|
763 |
-
#:
|
764 |
msgid "Resume Optimization"
|
765 |
msgstr "Reanudar optimización"
|
766 |
|
767 |
#. src-js/components/tabs/image-optimization/index.jsx:105
|
768 |
-
#:
|
769 |
msgid "Start Optimization"
|
770 |
msgstr "Comenzar optimización"
|
771 |
|
772 |
#. src-js/components/tabs/image-optimization/index.jsx:131
|
773 |
#. src-js/containers/php-checker/index.jsx:212
|
774 |
-
#:
|
|
|
775 |
msgid ""
|
776 |
"We've detected that the WordPress cronjob functionality is not working. "
|
777 |
"Please, enable it following the instructions in {{link}}this article{{/link}}"
|
@@ -789,12 +747,13 @@ msgstr ""
|
|
789 |
#. src-js/components/php-checker/index.jsx:223
|
790 |
#. src-js/components/tabs/multisite-control/index.jsx:547
|
791 |
#. src-js/components/tabs/image-optimization/index.jsx:111
|
792 |
-
#:
|
|
|
793 |
msgid "https://www.siteground.com/kb/disable-enable-wordpress-cron/"
|
794 |
msgstr "https://www.siteground.es/kb/administrar-wordpress-cron/"
|
795 |
|
796 |
#. src-js/components/tabs/image-optimization/index.jsx:159
|
797 |
-
#:
|
798 |
msgid ""
|
799 |
"All images in your Media Library have been optimized successfully! Force "
|
800 |
"{{link}}re-optimization{{/link}} of your images."
|
@@ -804,22 +763,26 @@ msgstr ""
|
|
804 |
"imágenes."
|
805 |
|
806 |
#. src-js/components/tabs/image-optimization/index.jsx:148
|
807 |
-
#:
|
|
|
808 |
msgid "Lazy Load Images"
|
809 |
msgstr "Carga diferida de imágenes"
|
810 |
|
811 |
#. src-js/components/tabs/image-optimization/index.jsx:168
|
812 |
-
#:
|
|
|
813 |
msgid "Load images only when they are visible in the browser"
|
814 |
msgstr "Carga las imágenes solo cuando son visibles en el navegador"
|
815 |
|
816 |
#. src-js/components/tabs/image-optimization/index.jsx:171
|
817 |
-
#:
|
|
|
818 |
msgid "Lazy Load Gravatars"
|
819 |
msgstr "Carga diferida de Gravatars"
|
820 |
|
821 |
#. src-js/components/tabs/image-optimization/index.jsx:212
|
822 |
-
#:
|
|
|
823 |
msgid ""
|
824 |
"When users comment under your posts, WordPress tries to load their avatars "
|
825 |
"from gravatar.com. We recommend lazy-loading them as your users scroll down "
|
@@ -831,12 +794,14 @@ msgstr ""
|
|
831 |
"comentarios. "
|
832 |
|
833 |
#. src-js/components/tabs/image-optimization/index.jsx:215
|
834 |
-
#:
|
|
|
835 |
msgid "Lazy Load Thumbnails"
|
836 |
msgstr "Carga diferida de miniaturas"
|
837 |
|
838 |
#. src-js/components/tabs/image-optimization/index.jsx:246
|
839 |
-
#:
|
|
|
840 |
msgid ""
|
841 |
"Enable if you want to lazy-load the thumbnail sizes of your original images."
|
842 |
msgstr ""
|
@@ -844,12 +809,14 @@ msgstr ""
|
|
844 |
"originales."
|
845 |
|
846 |
#. src-js/components/tabs/image-optimization/index.jsx:249
|
847 |
-
#:
|
|
|
848 |
msgid "Lazy Load Responsive Images"
|
849 |
msgstr "Carga diferida de imágenes adaptables"
|
850 |
|
851 |
#. src-js/components/tabs/image-optimization/index.jsx:280
|
852 |
-
#:
|
|
|
853 |
msgid ""
|
854 |
"Certain plugins and themes generate multiple images from a single upload to "
|
855 |
"work better on different devices. Enable if you want to lazy-load these too."
|
@@ -859,12 +826,14 @@ msgstr ""
|
|
859 |
"estas de forma diferida."
|
860 |
|
861 |
#. src-js/components/tabs/image-optimization/index.jsx:283
|
862 |
-
#:
|
|
|
863 |
msgid "Lazy Load Widgets"
|
864 |
msgstr "Carga diferida de widgets"
|
865 |
|
866 |
#. src-js/components/tabs/image-optimization/index.jsx:315
|
867 |
-
#:
|
|
|
868 |
msgid ""
|
869 |
"Enable this option if you want the images in your widget areas to load only "
|
870 |
"when users reach them. "
|
@@ -873,12 +842,12 @@ msgstr ""
|
|
873 |
"cuando los usuarios accedan a ellas. "
|
874 |
|
875 |
#. src-js/components/tabs/image-optimization/index.jsx:257
|
876 |
-
#:
|
877 |
msgid "Lazy Load for Mobile"
|
878 |
msgstr "Lazy Load para móviles"
|
879 |
|
880 |
#. src-js/components/tabs/image-optimization/index.jsx:263
|
881 |
-
#:
|
882 |
msgid ""
|
883 |
"Enable if you want to use lazy-loading features for mobile requests to your "
|
884 |
"site."
|
@@ -887,12 +856,12 @@ msgstr ""
|
|
887 |
"peticiones a su sitio desde móviles."
|
888 |
|
889 |
#. src-js/components/tabs/image-optimization/index.jsx:377
|
890 |
-
#:
|
891 |
msgid "Lazy Load Product Images"
|
892 |
msgstr "Carga diferida de imágenes de producto"
|
893 |
|
894 |
#. src-js/components/tabs/image-optimization/index.jsx:410
|
895 |
-
#:
|
896 |
msgid ""
|
897 |
"Enable if you want to enable lazy-load images in your store, product and "
|
898 |
"other WooCommerce pages."
|
@@ -901,12 +870,12 @@ msgstr ""
|
|
901 |
"de WooCommerce."
|
902 |
|
903 |
#. src-js/components/tabs/image-optimization/index.jsx:279
|
904 |
-
#:
|
905 |
msgid "Exclude from Lazy Load"
|
906 |
msgstr "Excluir de carga de imágenes asíncrona"
|
907 |
|
908 |
#. src-js/components/tabs/image-optimization/index.jsx:288
|
909 |
-
#:
|
910 |
msgid ""
|
911 |
"In order to exclude images from lazy loading, please add their CSS classes "
|
912 |
"to the exclusion list. Add each CSS class on a separate line."
|
@@ -915,13 +884,84 @@ msgstr ""
|
|
915 |
"clases CSS a la lista de exclusión. Añade cada clase CSS en una línea "
|
916 |
"separada."
|
917 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
918 |
#. src-js/components/tabs/multisite-control/index.jsx:209
|
919 |
-
#:
|
920 |
msgid "SUPERCACHER SETTINGS"
|
921 |
msgstr "AJUSTES DE SUPERCACHER"
|
922 |
|
923 |
#. src-js/components/tabs/multisite-control/index.jsx:304
|
924 |
-
#:
|
925 |
msgid ""
|
926 |
"Select whether new sites should have the Dynamic Caching enabled for them or "
|
927 |
"not."
|
@@ -930,17 +970,17 @@ msgstr ""
|
|
930 |
"o no."
|
931 |
|
932 |
#. src-js/components/tabs/sites-control/index.jsx:103
|
933 |
-
#:
|
934 |
msgid "ENVIRONMENT OPTIMIZATION"
|
935 |
msgstr "OPTIMIZACIÓN DEL ENTORNO"
|
936 |
|
937 |
#. src-js/components/tabs/sites-control/index.jsx:208
|
938 |
-
#:
|
939 |
msgid "FRONTEND OPTIMIZATION"
|
940 |
msgstr "OPTIMIZACIÓN DE PORTADA"
|
941 |
|
942 |
#. src-js/components/tabs/frontend-optimization/index.jsx:32
|
943 |
-
#:
|
944 |
msgid ""
|
945 |
"Removes unnecessary characters from your HTML output saving data and "
|
946 |
"improving your site speed."
|
@@ -949,7 +989,7 @@ msgstr ""
|
|
949 |
"la velocidad de tu sitio."
|
950 |
|
951 |
#. src-js/components/tabs/frontend-optimization/index.jsx:65
|
952 |
-
#:
|
953 |
msgid ""
|
954 |
"Combine and minify your JavaScript files in order to reduce their size, "
|
955 |
"improve cachability, and reduce the number of requests to the server."
|
@@ -959,14 +999,14 @@ msgstr ""
|
|
959 |
|
960 |
#. src-js/components/tabs/frontend-optimization/index.jsx:77
|
961 |
#. src-js/components/tabs/sites-control/index.jsx:296
|
962 |
-
#:
|
963 |
msgid "Load Render-blocking JavaScript Files Asynchronously"
|
964 |
msgstr ""
|
965 |
"Carga asíncrona de los archivos JavaScript que bloquean la visualización"
|
966 |
|
967 |
#. src-js/components/tabs/frontend-optimization/index.jsx:107
|
968 |
#. src-js/components/tabs/sites-control/index.jsx:326
|
969 |
-
#:
|
970 |
msgid ""
|
971 |
"Add async parameter to the JavaScript files loaded in the header section of "
|
972 |
"your site so they don’t block your page rendering."
|
@@ -975,7 +1015,7 @@ msgstr ""
|
|
975 |
"cabecera de tu sitio para que no bloqueen la visualización de tu página."
|
976 |
|
977 |
#. src-js/components/tabs/frontend-optimization/index.jsx:99
|
978 |
-
#:
|
979 |
msgid ""
|
980 |
"Combine and minify your CSS files in order to reduce their size, improve "
|
981 |
"cachability, and reduce the number of requests to the server."
|
@@ -985,7 +1025,7 @@ msgstr ""
|
|
985 |
|
986 |
#. src-js/components/tabs/frontend-optimization/index.jsx:179
|
987 |
#. src-js/components/tabs/sites-control/index.jsx:392
|
988 |
-
#:
|
989 |
msgid ""
|
990 |
"Combine multiple CSS files into one to lower the number of requests your "
|
991 |
"site generates."
|
@@ -994,24 +1034,25 @@ msgstr ""
|
|
994 |
"genera tu sitio."
|
995 |
|
996 |
#. src-js/components/tabs/sites-control/index.jsx:395
|
997 |
-
#:
|
998 |
msgid "IMAGE OPTIMIZATION"
|
999 |
msgstr "OPTIMIZACIÓN DE IMÁGENES"
|
1000 |
|
1001 |
#. src-js/components/tabs/sites-control/index.jsx:425
|
1002 |
-
#:
|
|
|
1003 |
msgid "Image Optimization"
|
1004 |
msgstr "Optimización de imágenes"
|
1005 |
|
1006 |
#. Page title.
|
1007 |
#. Name of the plugin
|
1008 |
-
#:
|
1009 |
#: core/Admin/Admin.php:240
|
1010 |
msgid "SG Optimizer"
|
1011 |
msgstr "SG Optimizer"
|
1012 |
|
1013 |
#. src-js/containers/main/index.jsx:136
|
1014 |
-
#:
|
1015 |
msgid ""
|
1016 |
"Get the best performance for your WordPress website with our optimization "
|
1017 |
"plugin. It handles caching, system settings, and all the necessary "
|
@@ -1025,12 +1066,12 @@ msgstr ""
|
|
1025 |
"alojamiento!"
|
1026 |
|
1027 |
#. src-js/containers/main/index.jsx:38
|
1028 |
-
#:
|
1029 |
msgid "Old PHP Version"
|
1030 |
msgstr "Antigua versión PHP"
|
1031 |
|
1032 |
#. src-js/containers/php-checker/index.jsx:167
|
1033 |
-
#:
|
1034 |
msgid ""
|
1035 |
"You are using our Managed PHP service, which means that SiteGround will "
|
1036 |
"automatically update your PHP once we are sure there is a newer stable one, "
|
@@ -1047,7 +1088,7 @@ msgstr ""
|
|
1047 |
"manualmente se vuelva a realizar el cambio."
|
1048 |
|
1049 |
#. src-js/containers/php-checker/index.jsx:143
|
1050 |
-
#:
|
1051 |
msgid ""
|
1052 |
"Your site will keep using that version until you manually change it from "
|
1053 |
"this interface or until you switch to \"Managed PHP\" service. If you choose "
|
@@ -1063,7 +1104,7 @@ msgstr ""
|
|
1063 |
"en seguridad y rendimiento."
|
1064 |
|
1065 |
#. src-js/containers/php-checker/index.jsx:179
|
1066 |
-
#:
|
1067 |
msgid ""
|
1068 |
"As a SiteGround client you may change your PHP version per site manually. "
|
1069 |
"However, we strongly recommend you to take advantage of our Managed PHP "
|
@@ -1083,48 +1124,49 @@ msgstr ""
|
|
1083 |
"manualmente se vuelva a realizar el cambio."
|
1084 |
|
1085 |
#. src-js/containers/php-checker/index.jsx:184
|
1086 |
-
#:
|
1087 |
msgid "Set your PHP version"
|
1088 |
msgstr "Configurar tu versión PHP"
|
1089 |
|
1090 |
#. src-js/containers/php-checker/index.jsx:205
|
1091 |
-
#:
|
1092 |
msgid "You are currently running on PHP %(version)s."
|
1093 |
msgstr "Actualmente estas utilizando PHP %(version)s."
|
1094 |
|
1095 |
#. src-js/containers/php-checker/index.jsx:210
|
1096 |
-
#:
|
1097 |
msgid "PHP Management Method"
|
1098 |
msgstr "PHP Gestionado"
|
1099 |
|
1100 |
#. src-js/containers/php-checker/index.jsx:226
|
1101 |
-
#:
|
1102 |
msgid "Please select method"
|
1103 |
msgstr "Por favor, selecciona el método"
|
1104 |
|
1105 |
#. src-js/containers/php-checker/index.jsx:227
|
1106 |
-
#:
|
1107 |
msgid "Please select management type"
|
1108 |
msgstr "Por favor, selecciona el tipo de configuración"
|
1109 |
|
1110 |
#. src-js/containers/php-checker/index.jsx:222
|
1111 |
-
#:
|
1112 |
msgid "PHP Version"
|
1113 |
msgstr "Versión PHP"
|
1114 |
|
1115 |
#. src-js/containers/php-checker/index.jsx:242
|
1116 |
#. src-js/containers/php-checker/index.jsx:243
|
1117 |
-
#:
|
|
|
1118 |
msgid "Please select PHP version"
|
1119 |
msgstr "Por favor, selecciona la versión PHP"
|
1120 |
|
1121 |
#. src-js/containers/php-checker/index.jsx:248
|
1122 |
-
#:
|
1123 |
msgid "Save"
|
1124 |
msgstr "Guardar"
|
1125 |
|
1126 |
#. src-js/containers/php-checker/index.jsx:262
|
1127 |
-
#:
|
1128 |
msgid ""
|
1129 |
"We currently recommend you to use PHP %(version)s. You can check the "
|
1130 |
"compatibility with the recommended version before you switch. {{link}}Check "
|
@@ -1135,7 +1177,7 @@ msgstr ""
|
|
1135 |
"compatibilidad{{/link}}"
|
1136 |
|
1137 |
#. src-js/containers/php-checker/index.jsx:286
|
1138 |
-
#:
|
1139 |
msgid ""
|
1140 |
"All your plugins are compatible with PHP %(version)s. You may safely switch "
|
1141 |
"to “Managed PHP” service and we’ll upgrade it automatically, or set it "
|
@@ -1147,12 +1189,12 @@ msgstr ""
|
|
1147 |
"nuevo{{/link}} "
|
1148 |
|
1149 |
#. src-js/containers/php-checker/index.jsx:302
|
1150 |
-
#:
|
1151 |
msgid "Checking PHP 7.1 Compatibility..."
|
1152 |
msgstr "Revisando compatibilidad con PHP %(version)s..."
|
1153 |
|
1154 |
#. src-js/containers/php-checker/index.jsx:322
|
1155 |
-
#:
|
1156 |
msgid ""
|
1157 |
"Unfortunately some of your plugins or theme are not compatible with our "
|
1158 |
"recommended version. {{link}}Check Again{{/link}}"
|
@@ -1161,17 +1203,17 @@ msgstr ""
|
|
1161 |
"versión recomendada. {{link}}Revisar de nuevo{{/link}}"
|
1162 |
|
1163 |
#. src-js/containers/php-checker/index.jsx:352
|
1164 |
-
#:
|
1165 |
msgid "Thanks for using SG Optimizer to make your site faster!"
|
1166 |
msgstr "¡Gracias por usar SG Optimizer para hacer tu sitio más rápido!"
|
1167 |
|
1168 |
#. src-js/containers/rating/index.jsx:53
|
1169 |
-
#:
|
1170 |
msgid "Help more people optimize their sites by rating our plugin."
|
1171 |
msgstr "Ayuda a más personas a optimizar sus sitios valorando nuestro plugin."
|
1172 |
|
1173 |
#. src-js/containers/rating/index.jsx:60
|
1174 |
-
#:
|
1175 |
msgid "Don’t Show This Again"
|
1176 |
msgstr "No mostrar esto de nuevo"
|
1177 |
|
@@ -1603,8 +1645,8 @@ msgid "Awesome! You have worked hard."
|
|
1603 |
msgstr "¡Genial! Has trabajado duro."
|
1604 |
|
1605 |
#: core/Analysis/Analysis.php:334
|
1606 |
-
msgid "
|
1607 |
-
msgstr "
|
1608 |
|
1609 |
#: core/Admin/Admin_Bar.php:33 core/Admin/Admin.php:303
|
1610 |
msgid "Purge SG Cache"
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: SG Optimizer\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2020-01-16 13:10+0000\n"
|
6 |
+
"PO-Revision-Date: 2020-01-16 13:11+0000\n"
|
7 |
"Last-Translator: admin <nobody@exmaple.com>\n"
|
8 |
"Language-Team: Spanish (Spain)\n"
|
9 |
"Language: es_ES\n"
|
14 |
"X-Generator: Loco https://localise.biz/\n"
|
15 |
"X-Loco-Version: 2.3.0; wp-5.3"
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
#. src-js/components/dialogs/images-dialog.jsx:17
|
18 |
#. src-js/components/dialogs/php-dialog.jsx:17
|
19 |
#. src-js/components/dialogs/ssl-dialog.jsx:17
|
20 |
+
#: helpers/sg-cachepress-react-strings.php:4
|
21 |
+
#: helpers/sg-cachepress-react-strings.php:12
|
22 |
+
#: helpers/sg-cachepress-react-strings.php:15
|
23 |
+
#: helpers/sg-cachepress-react-strings.php:19
|
24 |
+
#: helpers/sg-cachepress-react-strings.php:22
|
25 |
msgid "Confirm"
|
26 |
msgstr "Confirmar"
|
27 |
|
28 |
#. src-js/components/dialogs/async-dialog.tsx:18
|
29 |
+
#: helpers/sg-cachepress-react-strings.php:5
|
30 |
msgid ""
|
31 |
"Defering render-blocking JavaScript may cause issues with scripts that "
|
32 |
"require certain order of execution. This is why we advise you to check the "
|
38 |
"activar esta optimización."
|
39 |
|
40 |
#. src-js/components/dialogs/async-dialog.tsx:29
|
41 |
+
#: helpers/sg-cachepress-react-strings.php:6
|
42 |
msgid ""
|
43 |
"If you notice issues with certain functionality, use the Exclude "
|
44 |
"functionality to keep those scripts loading in a render-blocking manner."
|
48 |
"bloqueador de visualización."
|
49 |
|
50 |
#. src-js/components/dialogs/ssl-dialog.jsx:35
|
51 |
+
#: helpers/sg-cachepress-react-strings.php:7
|
52 |
+
#: helpers/sg-cachepress-react-strings.php:24
|
53 |
msgid "Close"
|
54 |
msgstr "Cerrar"
|
55 |
|
56 |
#. src-js/components/dialogs/cache-dialog.jsx:17
|
57 |
+
#: helpers/sg-cachepress-react-strings.php:8
|
58 |
msgid ""
|
59 |
"Purge your installation's entire Dynamic Cache or select parts in order to "
|
60 |
"achieve the best hit-to-cache ratio for your account. Here are the plugin's "
|
65 |
"de vaciado del plugin:"
|
66 |
|
67 |
#. src-js/components/dialogs/cache-dialog.jsx:29
|
68 |
+
#: helpers/sg-cachepress-react-strings.php:9
|
69 |
msgid ""
|
70 |
"Full Purge on page, posts, and category deletion, plugin and theme "
|
71 |
"activation, deactivation, or update, and on WordPress core updates."
|
75 |
"principales de WordPress."
|
76 |
|
77 |
#. src-js/components/dialogs/cache-dialog.jsx:38
|
78 |
+
#: helpers/sg-cachepress-react-strings.php:10
|
79 |
msgid ""
|
80 |
"Specific URL Purge on comment actions and page, post, and category updates."
|
81 |
msgstr ""
|
85 |
#. src-js/components/dialogs/cache-dialog.jsx:48
|
86 |
#. src-js/components/dialogs/images-dialog.jsx:35
|
87 |
#. src-js/components/dialogs/php-dialog.jsx:36
|
88 |
+
#: helpers/sg-cachepress-react-strings.php:11
|
89 |
+
#: helpers/sg-cachepress-react-strings.php:14
|
90 |
+
#: helpers/sg-cachepress-react-strings.php:18
|
91 |
+
#: helpers/sg-cachepress-react-strings.php:21
|
92 |
msgid "Cancel"
|
93 |
msgstr "Cancelar"
|
94 |
|
95 |
#. src-js/components/dialogs/delete-webp-dialog.tsx:23
|
96 |
+
#: helpers/sg-cachepress-react-strings.php:13
|
97 |
msgid ""
|
98 |
"This will delete all WebP files in your uploads folder! In case you need "
|
99 |
"them, you will have to regenerate them again or restore that folder from a "
|
104 |
"directorio desde una copia de seguridad."
|
105 |
|
106 |
#. src-js/components/dialogs/php-dialog.jsx:23
|
107 |
+
#: helpers/sg-cachepress-react-strings.php:16
|
108 |
msgid ""
|
109 |
"You’re switching to PHP %(version)s manually and you will stay on that "
|
110 |
"version until you change it to a newer one. In case you experience any "
|
117 |
"{{strong}}cPanel{{/strong}} > {{strong}}PHP Version Manager{{/strong}}."
|
118 |
|
119 |
#. src-js/components/dialogs/php-dialog.jsx:37
|
120 |
+
#: helpers/sg-cachepress-react-strings.php:17
|
121 |
msgid ""
|
122 |
"You’re about to switch to Managed PHP service. This means that SiteGround "
|
123 |
"will automatically update your PHP version once we are sure there’s a better,"
|
128 |
"que hay una versión nueva, segura y estable."
|
129 |
|
130 |
#. src-js/components/dialogs/regenerate-webp-dialog.tsx:23
|
131 |
+
#: helpers/sg-cachepress-react-strings.php:20
|
132 |
msgid ""
|
133 |
"Doing this will delete all WebP files in your uploads folder and generate "
|
134 |
"them anew!"
|
137 |
"nuevamente."
|
138 |
|
139 |
#. src-js/components/dialogs/ssl-dialog.jsx:23
|
140 |
+
#: helpers/sg-cachepress-react-strings.php:23
|
141 |
msgid ""
|
142 |
"In order to force HTTPS on your site, we will automatically update your "
|
143 |
"database replacing all insecure links. In addition to that, we will add a "
|
150 |
"una conexión cifrada."
|
151 |
|
152 |
#. src-js/components/dialogs/urls-dialog.jsx:17
|
153 |
+
#: helpers/sg-cachepress-react-strings.php:25
|
154 |
msgid ""
|
155 |
"You can exclude full or partial URLs using \"*\" as a wildcard. For example:"
|
156 |
msgstr ""
|
158 |
"ejemplo:"
|
159 |
|
160 |
#. src-js/components/dialogs/urls-dialog.jsx:29
|
161 |
+
#: helpers/sg-cachepress-react-strings.php:26
|
162 |
msgid ""
|
163 |
"{{strong}}www.site.com/parent-page/sub-page{{/strong}} will exclude only "
|
164 |
"that single URL."
|
167 |
"esa URL."
|
168 |
|
169 |
#. src-js/components/dialogs/urls-dialog.jsx:38
|
170 |
+
#: helpers/sg-cachepress-react-strings.php:27
|
171 |
msgid ""
|
172 |
"{{strong}}www.site.com/parent-page/*{{/strong}} will exclude all sub-pages "
|
173 |
"of \"parent-page\"."
|
175 |
"{{strong}}www.sitio.com/pagina-superior/*{{/strong}} se excluirá de todas "
|
176 |
"las sub-paginas de la «pagina-superior»."
|
177 |
|
178 |
+
#. src-js/components/tabs/supercacher/index.jsx:364
|
179 |
+
#: helpers/sg-cachepress-react-strings.php:28
|
180 |
+
msgid "Test URLs for Cache Status"
|
181 |
+
msgstr "Prueba las URLs para saber el estado de la caché"
|
182 |
+
|
183 |
+
#. src-js/components/tabs/supercacher/index.jsx:396
|
184 |
+
#: helpers/sg-cachepress-react-strings.php:29
|
185 |
+
msgid ""
|
186 |
+
"Check if the Dynamic Cache is working on a certain URL. Especially useful to "
|
187 |
+
"make sure your Exclude list is working the way it should."
|
188 |
+
msgstr ""
|
189 |
+
"Comprueba si la caché dinámica funciona en una determinada URL. "
|
190 |
+
"Especialmente útil para asegurar que tu lista de exclusión funciona de forma "
|
191 |
+
"correcta."
|
192 |
+
|
193 |
+
#. src-js/components/tabs/supercacher/index.jsx:399
|
194 |
+
#: helpers/sg-cachepress-react-strings.php:30
|
195 |
+
msgid "Test"
|
196 |
+
msgstr "Probar"
|
197 |
+
|
198 |
#. src-js/components/exclude/index.jsx:142
|
199 |
+
#: helpers/sg-cachepress-react-strings.php:31
|
200 |
msgid "This item already exists in exclude list."
|
201 |
msgstr "Este objeto ya existe en la lista de excluídos."
|
202 |
|
203 |
#. src-js/components/exclude/simple-exclude.jsx:44
|
204 |
+
#: helpers/sg-cachepress-react-strings.php:32
|
205 |
msgid "You must input a class name."
|
206 |
msgstr "Es necesario que introduzcas una nombre de clase."
|
207 |
|
208 |
#. src-js/components/tabs/supercacher/index.jsx:338
|
209 |
+
#: helpers/sg-cachepress-react-strings.php:33
|
210 |
+
#: helpers/sg-cachepress-react-strings.php:35
|
211 |
msgid "Exclude"
|
212 |
msgstr "Excluir"
|
213 |
|
214 |
#. src-js/components/tabs/image-optimization/index.jsx:318
|
215 |
+
#: helpers/sg-cachepress-react-strings.php:34
|
216 |
msgid "This URL already exists in exclude list."
|
217 |
msgstr "Esta URL ya existe en la lista de exclusión."
|
218 |
|
219 |
#. src-js/components/dialogs/urls-dialog.tsx:54
|
220 |
#. src-js/components/loaders/image-loader.tsx:59
|
221 |
+
#: helpers/sg-cachepress-react-strings.php:36
|
222 |
+
#: helpers/sg-cachepress-react-strings.php:39
|
223 |
msgid "Please be patient, this process may take some time"
|
224 |
msgstr "Por favor, se paciente, el proceso puede llevar un tiempo"
|
225 |
|
226 |
#. src-js/components/loaders/image-loader.tsx:31
|
227 |
+
#: helpers/sg-cachepress-react-strings.php:37
|
228 |
msgid "Optimized %(optimized)s of %(total)s images"
|
229 |
msgstr "Imágenes optimizadas %(optimized)s de %(total)s"
|
230 |
|
231 |
#. src-js/components/loaders/image-loader.tsx:35
|
232 |
#. src-js/components/loaders/webp-loader.tsx:31
|
233 |
+
#: helpers/sg-cachepress-react-strings.php:38
|
234 |
+
#: helpers/sg-cachepress-react-strings.php:41
|
235 |
msgid "Pause"
|
236 |
msgstr "Pausar"
|
237 |
|
238 |
#. src-js/components/loaders/webp-loader.tsx:27
|
239 |
+
#: helpers/sg-cachepress-react-strings.php:40
|
240 |
msgid "Generated %(optimized)s of %(total)s webp copies"
|
241 |
msgstr "Copias WebP generadas %(optimized)s de %(total)s"
|
242 |
|
243 |
#. src-js/components/loaders/webp-loader.tsx:55
|
244 |
+
#: helpers/sg-cachepress-react-strings.php:42
|
245 |
msgid "Generate WebP Copies of New Images"
|
246 |
msgstr "Genera copias WebP de nuevas imágenes"
|
247 |
|
248 |
#. src-js/components/webp/webp.tsx:118
|
249 |
+
#: helpers/sg-cachepress-react-strings.php:43
|
250 |
msgid ""
|
251 |
"WebP is a next generation image format supported by modern browers which "
|
252 |
"greatly reduces the size of your images."
|
256 |
"imágenes."
|
257 |
|
258 |
#. src-js/components/webp/webp.tsx:122
|
259 |
+
#: helpers/sg-cachepress-react-strings.php:44
|
260 |
msgid "Manage WebP Copies for Existing Images"
|
261 |
msgstr "Administra las copias WebP para imágenes existentes"
|
262 |
|
263 |
#. src-js/components/webp/webp.tsx:139
|
264 |
+
#: helpers/sg-cachepress-react-strings.php:45
|
265 |
msgid "Generate or delete a WebP copy of your existing media library."
|
266 |
msgstr "Genera o elimina una copia WebP de tu librería de medios."
|
267 |
|
268 |
#. src-js/components/webp/webp.tsx:142
|
269 |
+
#: helpers/sg-cachepress-react-strings.php:46
|
270 |
msgid "Delete all WebP Files"
|
271 |
msgstr "Elimina todos los archivos WebP"
|
272 |
|
273 |
#. src-js/components/webp/webp.tsx:160
|
274 |
+
#: helpers/sg-cachepress-react-strings.php:47
|
275 |
msgid "Bulk Generate WebP Files"
|
276 |
msgstr "Generación masiva de archivos WebP."
|
277 |
|
278 |
#. src-js/components/webp/webp.tsx:176
|
279 |
+
#: helpers/sg-cachepress-react-strings.php:48
|
280 |
msgid ""
|
281 |
"All WebP copies of your files have been generated successfully! Force {{link}"
|
282 |
"}re-generation{{/link}} of your images."
|
285 |
"Fuerza la {{link}}regeneración{{/link}} de tus imágenes."
|
286 |
|
287 |
#. src-js/components/tabs/environment-optimization/index.jsx:216
|
288 |
+
#: helpers/sg-cachepress-react-strings.php:49
|
289 |
+
#: helpers/sg-cachepress-react-strings.php:51 core/Options/Options.php:385
|
290 |
msgid "Browser Caching"
|
291 |
msgstr "Caché del navegador"
|
292 |
|
293 |
#. src-js/components/tabs/environment-optimization/index.jsx:246
|
294 |
+
#: helpers/sg-cachepress-react-strings.php:50
|
295 |
msgid ""
|
296 |
"Adds rules to store in your visitors browser cache to keep static content "
|
297 |
"longer for better site performance."
|
301 |
"rendimiento de la web."
|
302 |
|
303 |
#. src-js/components/modules/gzip/index.jsx:35
|
304 |
+
#: helpers/sg-cachepress-react-strings.php:52
|
305 |
+
#: helpers/sg-cachepress-react-strings.php:75
|
306 |
msgid "YOU HAVE A SITE TOOLS ACCOUNT"
|
307 |
msgstr "TIENES UNA CUENTA DE SITE TOOLS"
|
308 |
|
309 |
#. src-js/components/modules/browser-cache/index.tsx:38
|
310 |
+
#: helpers/sg-cachepress-react-strings.php:53
|
311 |
msgid ""
|
312 |
"NGINX Direct Delivery takes care of your static resources including proper "
|
313 |
"expiration dates for your browser caching."
|
317 |
|
318 |
#. src-js/components/tabs/multisite-control/index.jsx:277
|
319 |
#. src-js/components/tabs/supercacher/index.jsx:160
|
320 |
+
#: helpers/sg-cachepress-react-strings.php:54
|
321 |
+
#: helpers/sg-cachepress-react-strings.php:147
|
322 |
msgid "Dynamic Caching"
|
323 |
msgstr "Caché dinámica"
|
324 |
|
325 |
#. src-js/components/tabs/supercacher/index.jsx:218
|
326 |
+
#: helpers/sg-cachepress-react-strings.php:55
|
327 |
msgid ""
|
328 |
"Store your content in the server’s memory for a faster access with this full-"
|
329 |
"page caching solution powered by NGINX."
|
332 |
"con esta solución de página completa de caché por NGINX."
|
333 |
|
334 |
#. src-js/components/tabs/supercacher/index.jsx:221
|
335 |
+
#: helpers/sg-cachepress-react-strings.php:56
|
336 |
msgid "Manual Cache Purge"
|
337 |
msgstr "Vaciado manual de caché"
|
338 |
|
339 |
#. src-js/components/tabs/supercacher/index.jsx:264
|
340 |
+
#: helpers/sg-cachepress-react-strings.php:57
|
341 |
msgid "Clear the Dynamic Cache for your entire website."
|
342 |
msgstr "Vacía la caché dinámica de toda tu web."
|
343 |
|
344 |
#. src-js/components/modules/dynamic-cache/index.jsx:234
|
345 |
+
#: helpers/sg-cachepress-react-strings.php:58
|
346 |
msgid "Purge Cache"
|
347 |
msgstr "Vaciar caché"
|
348 |
|
349 |
#. src-js/components/modules/dynamic-cache/index.jsx:247
|
350 |
+
#: helpers/sg-cachepress-react-strings.php:59
|
351 |
msgid "Purging ..."
|
352 |
msgstr "Vaciando ..."
|
353 |
|
354 |
#. src-js/components/tabs/supercacher/index.jsx:267
|
355 |
+
#: helpers/sg-cachepress-react-strings.php:60
|
356 |
+
#: helpers/sg-cachepress-react-strings.php:149
|
357 |
msgid "Automatic Cache Purge"
|
358 |
msgstr "Vaciado automático de la caché"
|
359 |
|
360 |
#. src-js/components/tabs/supercacher/index.jsx:299
|
361 |
+
#: helpers/sg-cachepress-react-strings.php:61
|
362 |
+
#: helpers/sg-cachepress-react-strings.php:150
|
363 |
msgid ""
|
364 |
"Automatically perform a smart cache purge after every content modification."
|
365 |
msgstr ""
|
367 |
"de contenido."
|
368 |
|
369 |
#. src-js/components/tabs/supercacher/index.jsx:302
|
370 |
+
#: helpers/sg-cachepress-react-strings.php:62
|
371 |
msgid "See rules"
|
372 |
msgstr "Ver reglas"
|
373 |
|
374 |
#. src-js/components/modules/dynamic-cache/index.jsx:127
|
375 |
+
#: helpers/sg-cachepress-react-strings.php:63 core/Options/Options.php:380
|
376 |
msgid "Browser-Specific Caching"
|
377 |
msgstr "Almacenamiento en caché específico del navegador"
|
378 |
|
379 |
#. src-js/components/modules/dynamic-cache/index.jsx:133
|
380 |
+
#: helpers/sg-cachepress-react-strings.php:64
|
381 |
msgid ""
|
382 |
"We recommend you to enable this feature {{strong}}only{{/strong}} if you’re "
|
383 |
"experiencing issues with plugins, generating mobile version of your site or "
|
391 |
"eficiencia."
|
392 |
|
393 |
#. src-js/components/tabs/supercacher/index.jsx:305
|
394 |
+
#: helpers/sg-cachepress-react-strings.php:65
|
395 |
msgid "Excluding URLs"
|
396 |
msgstr "Excluir URLs"
|
397 |
|
398 |
#. src-js/components/tabs/supercacher/index.jsx:332
|
399 |
+
#: helpers/sg-cachepress-react-strings.php:66
|
400 |
msgid ""
|
401 |
"Use this feature if you want to exclude certain parts of your website from "
|
402 |
"being cached and keep them dynamic."
|
405 |
"excluidas de la caché y así mantenerlas dinámicas."
|
406 |
|
407 |
#. src-js/components/tabs/supercacher/index.jsx:335
|
408 |
+
#: helpers/sg-cachepress-react-strings.php:67
|
409 |
msgid "See examples"
|
410 |
msgstr "Ver ejemplos"
|
411 |
|
412 |
#. src-js/components/modules/gzip/index.jsx:12
|
413 |
+
#: helpers/sg-cachepress-react-strings.php:68
|
414 |
+
#: helpers/sg-cachepress-react-strings.php:69
|
415 |
msgid "Memcached Stopped. Please, enable it in your SiteGround control panel."
|
416 |
msgstr ""
|
417 |
"Memcached detenido. Por favor, habilítalo en tu panel de control de "
|
418 |
"SiteGround."
|
419 |
|
420 |
#. src-js/components/tabs/supercacher/index.jsx:426
|
421 |
+
#: helpers/sg-cachepress-react-strings.php:70
|
422 |
msgid "Memcached"
|
423 |
msgstr "Memcached"
|
424 |
|
425 |
#. src-js/components/tabs/supercacher/index.jsx:454
|
426 |
+
#: helpers/sg-cachepress-react-strings.php:71
|
427 |
msgid ""
|
428 |
"Powerful object caching for your site. It stores frequently executed queries "
|
429 |
"to your databases and reuses them for better performance."
|
433 |
"rendimiento."
|
434 |
|
435 |
#. src-js/components/tabs/environment-optimization/index.jsx:157
|
436 |
+
#: helpers/sg-cachepress-react-strings.php:72
|
437 |
+
#: helpers/sg-cachepress-react-strings.php:74 core/Options/Options.php:384
|
438 |
msgid "GZIP Compression"
|
439 |
msgstr "Compresión GZIP"
|
440 |
|
441 |
#. src-js/components/tabs/environment-optimization/index.jsx:213
|
442 |
+
#: helpers/sg-cachepress-react-strings.php:73
|
443 |
msgid ""
|
444 |
"Enables a compression of the content that's delivered to your visitors "
|
445 |
"browsers improving the network loading times of your site."
|
448 |
"visitantes ,mejorando los tiempo de carga de tu sitio."
|
449 |
|
450 |
#. src-js/components/modules/gzip/index.jsx:40
|
451 |
+
#: helpers/sg-cachepress-react-strings.php:76
|
452 |
msgid ""
|
453 |
"GZIP Compression is enabled by default automatically saving you bandwidth "
|
454 |
"and improving the loading speeds of your pages."
|
457 |
"ancho de banda y mejora la velocidad de carga de tus páginas."
|
458 |
|
459 |
#. src-js/components/modules/memcached/index.tsx:63
|
460 |
+
#: helpers/sg-cachepress-react-strings.php:77
|
461 |
msgid "Score Check"
|
462 |
msgstr "Revisar resultado"
|
463 |
|
464 |
#. src-js/components/tabs/analytics/index.tsx:122
|
465 |
+
#: helpers/sg-cachepress-react-strings.php:78
|
466 |
msgid ""
|
467 |
"Test how optimized your website is. Our performance check is powered by "
|
468 |
"Google PageSpeed."
|
471 |
"Google PageSpeed."
|
472 |
|
473 |
#. src-js/components/tabs/analytics/index.tsx:125
|
474 |
+
#: helpers/sg-cachepress-react-strings.php:79
|
475 |
msgid "Device Type"
|
476 |
msgstr "Tipo de dispositiv"
|
477 |
|
478 |
#. src-js/components/tabs/analytics/index.tsx:156
|
479 |
+
#: helpers/sg-cachepress-react-strings.php:80
|
480 |
msgid "URL"
|
481 |
msgstr "URL"
|
482 |
|
483 |
#. src-js/components/tabs/analytics/index.jsx:31
|
484 |
+
#: helpers/sg-cachepress-react-strings.php:81
|
485 |
msgid "Analyze"
|
486 |
msgstr "Analizar"
|
487 |
|
488 |
#. src-js/components/tabs/analytics/index.tsx:180
|
489 |
+
#: helpers/sg-cachepress-react-strings.php:82
|
490 |
msgid "Please Wait, We Are Performing a Google PageSpeed Test on Your Page"
|
491 |
msgstr ""
|
492 |
"Espera, por favor, estamos realizando un test con Google PageSpeed en tu web"
|
493 |
|
494 |
#. src-js/components/tabs/analytics/index.tsx:187
|
495 |
+
#: helpers/sg-cachepress-react-strings.php:83
|
496 |
msgid "There is nothing here yet"
|
497 |
msgstr "No nada aquí todavía"
|
498 |
|
499 |
#. src-js/components/php-checker/index.jsx:341
|
500 |
#. src-js/components/tabs/multisite-control/index.jsx:226
|
501 |
+
#: helpers/sg-cachepress-react-strings.php:84
|
502 |
+
#: helpers/sg-cachepress-react-strings.php:152
|
503 |
msgid "Enable HTTPS"
|
504 |
msgstr "Activar HTTPS"
|
505 |
|
506 |
#. src-js/components/tabs/environment-optimization/index.jsx:109
|
507 |
+
#: helpers/sg-cachepress-react-strings.php:85
|
508 |
+
#: helpers/sg-cachepress-react-strings.php:153
|
509 |
msgid ""
|
510 |
"Configures your site to work correctly via HTTPS and forces a secure "
|
511 |
"connection to your site."
|
514 |
"fuerza una conexión segura en tu sitio."
|
515 |
|
516 |
#. src-js/components/tabs/environment-optimization/index.jsx:112
|
517 |
+
#: helpers/sg-cachepress-react-strings.php:86
|
518 |
+
#: helpers/sg-cachepress-react-strings.php:154
|
519 |
msgid "Fix Insecure Content"
|
520 |
msgstr "Corregir contenido inseguro"
|
521 |
|
522 |
#. src-js/components/tabs/environment-optimization/index.jsx:154
|
523 |
+
#: helpers/sg-cachepress-react-strings.php:87
|
524 |
+
#: helpers/sg-cachepress-react-strings.php:155
|
525 |
msgid ""
|
526 |
"Enable this option in case you’re getting insecure content errors on your "
|
527 |
"website. We will dynamically rewrite insecure requests for resources coming "
|
532 |
"inseguras de los recursos de tu sitio"
|
533 |
|
534 |
#. src-js/components/tabs/environment-optimization/index.jsx:249
|
535 |
+
#: helpers/sg-cachepress-react-strings.php:88
|
536 |
+
#: helpers/sg-cachepress-react-strings.php:157
|
537 |
msgid "Minify the HTML Output"
|
538 |
msgstr "Minimizar la salida HTML"
|
539 |
|
540 |
#. src-js/components/tabs/frontend-optimization/index.jsx:71
|
541 |
+
#: helpers/sg-cachepress-react-strings.php:89
|
542 |
msgid ""
|
543 |
"Removes unnecessary characters from your HTML output saving data and "
|
544 |
"improving your site speed. "
|
548 |
|
549 |
#. src-js/components/tabs/frontend-optimization/index.jsx:76
|
550 |
#. src-js/components/tabs/frontend-optimization/index.jsx:81
|
551 |
+
#: helpers/sg-cachepress-react-strings.php:90
|
552 |
+
#: helpers/sg-cachepress-react-strings.php:91
|
553 |
msgid "Exclude URLs from HTML Minification"
|
554 |
msgstr "Excluir las direcciones URL de la minificación de HTML"
|
555 |
|
556 |
#. src-js/components/tabs/frontend-optimization/index.jsx:101
|
557 |
+
#: helpers/sg-cachepress-react-strings.php:92
|
558 |
msgid ""
|
559 |
"With this functionality, you can exclude different pages from HTML "
|
560 |
"minification."
|
563 |
"HTML."
|
564 |
|
565 |
#. src-js/components/tabs/frontend-optimization/index.jsx:35
|
566 |
+
#: helpers/sg-cachepress-react-strings.php:93
|
567 |
+
#: helpers/sg-cachepress-react-strings.php:159
|
568 |
msgid "Minify JavaScript Files"
|
569 |
msgstr "Minimizar archivos JavaScript"
|
570 |
|
571 |
#. src-js/components/tabs/frontend-optimization/index.jsx:118
|
572 |
+
#: helpers/sg-cachepress-react-strings.php:94
|
573 |
msgid ""
|
574 |
"Minify your JavaScript files in order to reduce their size and reduce the "
|
575 |
"number of requests to the server. "
|
578 |
"reducir el número de peticiones al servidor."
|
579 |
|
580 |
#. src-js/components/tabs/frontend-optimization/index.jsx:123
|
581 |
+
#: helpers/sg-cachepress-react-strings.php:95
|
582 |
msgid "Exclude from JavaScript Minification"
|
583 |
msgstr "Excluir de la minificación de JavaScript"
|
584 |
|
585 |
#. src-js/components/tabs/frontend-optimization/index.jsx:128
|
586 |
+
#: helpers/sg-cachepress-react-strings.php:96 core/Options/Options.php:388
|
587 |
msgid "Defer Render-blocking JS"
|
588 |
msgstr "Carga diferida del bloqueador de visualización JS"
|
589 |
|
590 |
#. src-js/components/tabs/frontend-optimization/index.jsx:160
|
591 |
+
#: helpers/sg-cachepress-react-strings.php:97
|
592 |
msgid ""
|
593 |
"Defer loading of render-blocking JavaScript files for faster initial site "
|
594 |
"load. "
|
597 |
"carga inicial más rápida del sitio."
|
598 |
|
599 |
#. src-js/components/tabs/frontend-optimization/index.jsx:165
|
600 |
+
#: helpers/sg-cachepress-react-strings.php:98
|
601 |
msgid "Exclude from Loading JS Files Asynchronously"
|
602 |
msgstr "Excluir de carga de archivos JS de forma asíncrona"
|
603 |
|
604 |
#. src-js/components/tabs/frontend-optimization/index.jsx:68
|
605 |
+
#: helpers/sg-cachepress-react-strings.php:99
|
606 |
+
#: helpers/sg-cachepress-react-strings.php:163
|
607 |
msgid "Minify CSS Files"
|
608 |
msgstr "Minimizar archivos CSS"
|
609 |
|
610 |
#. src-js/components/tabs/frontend-optimization/index.jsx:202
|
611 |
+
#: helpers/sg-cachepress-react-strings.php:100
|
612 |
msgid ""
|
613 |
"Minify your CSS files in order to reduce their size and reduce the number of "
|
614 |
"requests to the server. "
|
617 |
"número de peticiones al servidor."
|
618 |
|
619 |
#. src-js/components/tabs/frontend-optimization/index.jsx:207
|
620 |
+
#: helpers/sg-cachepress-react-strings.php:101
|
621 |
msgid "Exclude From CSS Minification"
|
622 |
msgstr "Excluir de la minificación de CSS"
|
623 |
|
624 |
#. src-js/components/tabs/frontend-optimization/index.jsx:149
|
625 |
#. src-js/components/tabs/sites-control/index.jsx:362
|
626 |
+
#: helpers/sg-cachepress-react-strings.php:102
|
627 |
+
#: helpers/sg-cachepress-react-strings.php:165
|
628 |
msgid "Combine CSS Files"
|
629 |
msgstr "Combinar archivos CSS"
|
630 |
|
631 |
#. src-js/components/tabs/frontend-optimization/index.jsx:244
|
632 |
+
#: helpers/sg-cachepress-react-strings.php:103
|
633 |
msgid ""
|
634 |
"Combine multiple CSS files into one to lower the number of requests your "
|
635 |
"site generates. "
|
638 |
"solicitudes que genera tu sitio."
|
639 |
|
640 |
#. src-js/components/tabs/frontend-optimization/index.jsx:249
|
641 |
+
#: helpers/sg-cachepress-react-strings.php:104
|
642 |
msgid "Exclude from CSS Combination"
|
643 |
msgstr "Excluir de la combinación de CSS"
|
644 |
|
645 |
#. src-js/components/tabs/frontend-optimization/index.jsx:254
|
646 |
+
#: helpers/sg-cachepress-react-strings.php:105
|
647 |
msgid "Optimize Loading of Google Fonts"
|
648 |
msgstr "Optimiza la carga de las fuentes de Google"
|
649 |
|
650 |
#. src-js/components/tabs/frontend-optimization/index.jsx:286
|
651 |
+
#: helpers/sg-cachepress-react-strings.php:106
|
652 |
msgid ""
|
653 |
"Combine the loading of Google fonts reducing the number of HTTP requests."
|
654 |
msgstr ""
|
656 |
"HTTP."
|
657 |
|
658 |
#. src-js/components/tabs/frontend-optimization/index.jsx:102
|
659 |
+
#: helpers/sg-cachepress-react-strings.php:107
|
660 |
+
#: helpers/sg-cachepress-react-strings.php:167
|
661 |
msgid "Remove Query Strings From Static Resources"
|
662 |
msgstr "Eliminar cadenas de petición de recursos estáticos"
|
663 |
|
664 |
#. src-js/components/tabs/frontend-optimization/index.jsx:132
|
665 |
+
#: helpers/sg-cachepress-react-strings.php:108
|
666 |
+
#: helpers/sg-cachepress-react-strings.php:168
|
667 |
msgid ""
|
668 |
"Removes version query strings from your static resources improving the "
|
669 |
"caching of those resources."
|
672 |
"caché de esos recursos."
|
673 |
|
674 |
#. src-js/components/tabs/frontend-optimization/index.jsx:135
|
675 |
+
#: helpers/sg-cachepress-react-strings.php:109
|
676 |
+
#: helpers/sg-cachepress-react-strings.php:169
|
677 |
msgid "Disable Emojis"
|
678 |
msgstr "Desactivar Emojis"
|
679 |
|
680 |
#. src-js/components/tabs/frontend-optimization/index.jsx:165
|
681 |
+
#: helpers/sg-cachepress-react-strings.php:110
|
682 |
+
#: helpers/sg-cachepress-react-strings.php:170
|
683 |
msgid ""
|
684 |
"Enable to prevent WordPress from automatically detecting and generating "
|
685 |
"emojis in your pages."
|
687 |
"Activar para impedir que WordPress detecte y genere automáticamente emojis "
|
688 |
"en tus páginas."
|
689 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
690 |
#. src-js/components/tabs/frontend-optimization/index.jsx:191
|
691 |
+
#: helpers/sg-cachepress-react-strings.php:111 core/Options/Options.php:394
|
692 |
msgid "New Images Optimization"
|
693 |
msgstr "Optimización de nuevas imágenes"
|
694 |
|
695 |
#. src-js/components/tabs/image-optimization/index.jsx:68
|
696 |
+
#: helpers/sg-cachepress-react-strings.php:112
|
697 |
msgid ""
|
698 |
"We will automatically optimize all new images that you upload to your Media "
|
699 |
"Library."
|
702 |
"biblioteca de medios."
|
703 |
|
704 |
#. src-js/components/tabs/image-optimization/index.jsx:71
|
705 |
+
#: helpers/sg-cachepress-react-strings.php:113
|
706 |
msgid "Existing Images Optimization"
|
707 |
msgstr "Optimización de imágenes existentes"
|
708 |
|
709 |
#. src-js/components/tabs/image-optimization/index.jsx:80
|
710 |
+
#: helpers/sg-cachepress-react-strings.php:114
|
711 |
+
#: helpers/sg-cachepress-react-strings.php:173
|
712 |
msgid ""
|
713 |
"We will optimize all your existing images with minimal or no loss in quality."
|
714 |
" Note, that this will overwrite your original images."
|
717 |
"Ten en cuenta que esto sobreescribirá tus imágenes originales."
|
718 |
|
719 |
#. src-js/components/tabs/frontend-optimization/index.jsx:191
|
720 |
+
#: helpers/sg-cachepress-react-strings.php:115
|
721 |
msgid "Resume Optimization"
|
722 |
msgstr "Reanudar optimización"
|
723 |
|
724 |
#. src-js/components/tabs/image-optimization/index.jsx:105
|
725 |
+
#: helpers/sg-cachepress-react-strings.php:116
|
726 |
msgid "Start Optimization"
|
727 |
msgstr "Comenzar optimización"
|
728 |
|
729 |
#. src-js/components/tabs/image-optimization/index.jsx:131
|
730 |
#. src-js/containers/php-checker/index.jsx:212
|
731 |
+
#: helpers/sg-cachepress-react-strings.php:117
|
732 |
+
#: helpers/sg-cachepress-react-strings.php:203
|
733 |
msgid ""
|
734 |
"We've detected that the WordPress cronjob functionality is not working. "
|
735 |
"Please, enable it following the instructions in {{link}}this article{{/link}}"
|
747 |
#. src-js/components/php-checker/index.jsx:223
|
748 |
#. src-js/components/tabs/multisite-control/index.jsx:547
|
749 |
#. src-js/components/tabs/image-optimization/index.jsx:111
|
750 |
+
#: helpers/sg-cachepress-react-strings.php:118
|
751 |
+
#: helpers/sg-cachepress-react-strings.php:204
|
752 |
msgid "https://www.siteground.com/kb/disable-enable-wordpress-cron/"
|
753 |
msgstr "https://www.siteground.es/kb/administrar-wordpress-cron/"
|
754 |
|
755 |
#. src-js/components/tabs/image-optimization/index.jsx:159
|
756 |
+
#: helpers/sg-cachepress-react-strings.php:119
|
757 |
msgid ""
|
758 |
"All images in your Media Library have been optimized successfully! Force "
|
759 |
"{{link}}re-optimization{{/link}} of your images."
|
763 |
"imágenes."
|
764 |
|
765 |
#. src-js/components/tabs/image-optimization/index.jsx:148
|
766 |
+
#: helpers/sg-cachepress-react-strings.php:120
|
767 |
+
#: helpers/sg-cachepress-react-strings.php:174
|
768 |
msgid "Lazy Load Images"
|
769 |
msgstr "Carga diferida de imágenes"
|
770 |
|
771 |
#. src-js/components/tabs/image-optimization/index.jsx:168
|
772 |
+
#: helpers/sg-cachepress-react-strings.php:121
|
773 |
+
#: helpers/sg-cachepress-react-strings.php:175
|
774 |
msgid "Load images only when they are visible in the browser"
|
775 |
msgstr "Carga las imágenes solo cuando son visibles en el navegador"
|
776 |
|
777 |
#. src-js/components/tabs/image-optimization/index.jsx:171
|
778 |
+
#: helpers/sg-cachepress-react-strings.php:122
|
779 |
+
#: helpers/sg-cachepress-react-strings.php:176
|
780 |
msgid "Lazy Load Gravatars"
|
781 |
msgstr "Carga diferida de Gravatars"
|
782 |
|
783 |
#. src-js/components/tabs/image-optimization/index.jsx:212
|
784 |
+
#: helpers/sg-cachepress-react-strings.php:123
|
785 |
+
#: helpers/sg-cachepress-react-strings.php:177
|
786 |
msgid ""
|
787 |
"When users comment under your posts, WordPress tries to load their avatars "
|
788 |
"from gravatar.com. We recommend lazy-loading them as your users scroll down "
|
794 |
"comentarios. "
|
795 |
|
796 |
#. src-js/components/tabs/image-optimization/index.jsx:215
|
797 |
+
#: helpers/sg-cachepress-react-strings.php:124
|
798 |
+
#: helpers/sg-cachepress-react-strings.php:178
|
799 |
msgid "Lazy Load Thumbnails"
|
800 |
msgstr "Carga diferida de miniaturas"
|
801 |
|
802 |
#. src-js/components/tabs/image-optimization/index.jsx:246
|
803 |
+
#: helpers/sg-cachepress-react-strings.php:125
|
804 |
+
#: helpers/sg-cachepress-react-strings.php:179
|
805 |
msgid ""
|
806 |
"Enable if you want to lazy-load the thumbnail sizes of your original images."
|
807 |
msgstr ""
|
809 |
"originales."
|
810 |
|
811 |
#. src-js/components/tabs/image-optimization/index.jsx:249
|
812 |
+
#: helpers/sg-cachepress-react-strings.php:126
|
813 |
+
#: helpers/sg-cachepress-react-strings.php:180
|
814 |
msgid "Lazy Load Responsive Images"
|
815 |
msgstr "Carga diferida de imágenes adaptables"
|
816 |
|
817 |
#. src-js/components/tabs/image-optimization/index.jsx:280
|
818 |
+
#: helpers/sg-cachepress-react-strings.php:127
|
819 |
+
#: helpers/sg-cachepress-react-strings.php:181
|
820 |
msgid ""
|
821 |
"Certain plugins and themes generate multiple images from a single upload to "
|
822 |
"work better on different devices. Enable if you want to lazy-load these too."
|
826 |
"estas de forma diferida."
|
827 |
|
828 |
#. src-js/components/tabs/image-optimization/index.jsx:283
|
829 |
+
#: helpers/sg-cachepress-react-strings.php:128
|
830 |
+
#: helpers/sg-cachepress-react-strings.php:182
|
831 |
msgid "Lazy Load Widgets"
|
832 |
msgstr "Carga diferida de widgets"
|
833 |
|
834 |
#. src-js/components/tabs/image-optimization/index.jsx:315
|
835 |
+
#: helpers/sg-cachepress-react-strings.php:129
|
836 |
+
#: helpers/sg-cachepress-react-strings.php:183
|
837 |
msgid ""
|
838 |
"Enable this option if you want the images in your widget areas to load only "
|
839 |
"when users reach them. "
|
842 |
"cuando los usuarios accedan a ellas. "
|
843 |
|
844 |
#. src-js/components/tabs/image-optimization/index.jsx:257
|
845 |
+
#: helpers/sg-cachepress-react-strings.php:130 core/Options/Options.php:401
|
846 |
msgid "Lazy Load for Mobile"
|
847 |
msgstr "Lazy Load para móviles"
|
848 |
|
849 |
#. src-js/components/tabs/image-optimization/index.jsx:263
|
850 |
+
#: helpers/sg-cachepress-react-strings.php:131
|
851 |
msgid ""
|
852 |
"Enable if you want to use lazy-loading features for mobile requests to your "
|
853 |
"site."
|
856 |
"peticiones a su sitio desde móviles."
|
857 |
|
858 |
#. src-js/components/tabs/image-optimization/index.jsx:377
|
859 |
+
#: helpers/sg-cachepress-react-strings.php:132
|
860 |
msgid "Lazy Load Product Images"
|
861 |
msgstr "Carga diferida de imágenes de producto"
|
862 |
|
863 |
#. src-js/components/tabs/image-optimization/index.jsx:410
|
864 |
+
#: helpers/sg-cachepress-react-strings.php:133
|
865 |
msgid ""
|
866 |
"Enable if you want to enable lazy-load images in your store, product and "
|
867 |
"other WooCommerce pages."
|
870 |
"de WooCommerce."
|
871 |
|
872 |
#. src-js/components/tabs/image-optimization/index.jsx:279
|
873 |
+
#: helpers/sg-cachepress-react-strings.php:134
|
874 |
msgid "Exclude from Lazy Load"
|
875 |
msgstr "Excluir de carga de imágenes asíncrona"
|
876 |
|
877 |
#. src-js/components/tabs/image-optimization/index.jsx:288
|
878 |
+
#: helpers/sg-cachepress-react-strings.php:135
|
879 |
msgid ""
|
880 |
"In order to exclude images from lazy loading, please add their CSS classes "
|
881 |
"to the exclusion list. Add each CSS class on a separate line."
|
884 |
"clases CSS a la lista de exclusión. Añade cada clase CSS en una línea "
|
885 |
"separada."
|
886 |
|
887 |
+
#. src-js/components/tabs/multisite-control/index.jsx:339
|
888 |
+
#: helpers/sg-cachepress-react-strings.php:136
|
889 |
+
msgid "Site Admin Permissions"
|
890 |
+
msgstr "Permisos de administrador del sitio"
|
891 |
+
|
892 |
+
#. src-js/components/tabs/multisite-control/index.jsx:372
|
893 |
+
#: helpers/sg-cachepress-react-strings.php:137
|
894 |
+
msgid ""
|
895 |
+
"In this section, set the access permission for admins of separate sites."
|
896 |
+
msgstr ""
|
897 |
+
"En esta sección, configura los permisos para los administrador de distintas "
|
898 |
+
"webs."
|
899 |
+
|
900 |
+
#. src-js/components/tabs/multisite-control/index.jsx:87
|
901 |
+
#: helpers/sg-cachepress-react-strings.php:138
|
902 |
+
#: helpers/manual-translations.php:2
|
903 |
+
msgid "SuperCacher Settings"
|
904 |
+
msgstr "Ajustes de SuperCacher"
|
905 |
+
|
906 |
+
#. src-js/components/tabs/multisite-control/index.jsx:402
|
907 |
+
#: helpers/sg-cachepress-react-strings.php:139
|
908 |
+
msgid ""
|
909 |
+
"Select whether site admins can access and make changes within the SiteGround "
|
910 |
+
"Optimizer's SuperCacher tab."
|
911 |
+
msgstr ""
|
912 |
+
"Selecciona si los administradores pueden acceder y hacer cambios en la "
|
913 |
+
"pestaña SuperCacher de SiteGround Optimizer."
|
914 |
+
|
915 |
+
#. src-js/components/tabs/multisite-control/index.jsx:405
|
916 |
+
#: helpers/sg-cachepress-react-strings.php:140
|
917 |
+
msgid "Frontend Optimizations"
|
918 |
+
msgstr "Optimizaciones en portada"
|
919 |
+
|
920 |
+
#. src-js/components/tabs/multisite-control/index.jsx:434
|
921 |
+
#: helpers/sg-cachepress-react-strings.php:141
|
922 |
+
msgid ""
|
923 |
+
"Select whether site admins can access and make changes within the SiteGround "
|
924 |
+
"Optimizer's Frontend Optmization tab."
|
925 |
+
msgstr ""
|
926 |
+
"Selecciona si los administradores pueden acceder y hacer cambios en la "
|
927 |
+
"pestaña de optimización en portada de SiteGround Optimizer."
|
928 |
+
|
929 |
+
#. src-js/components/tabs/multisite-control/index.jsx:437
|
930 |
+
#: helpers/sg-cachepress-react-strings.php:142
|
931 |
+
msgid "Image Optimizations"
|
932 |
+
msgstr "Optimizaciones de imágenes"
|
933 |
+
|
934 |
+
#. src-js/components/tabs/multisite-control/index.jsx:464
|
935 |
+
#: helpers/sg-cachepress-react-strings.php:143
|
936 |
+
msgid ""
|
937 |
+
"Select whether site admins can access and make changes within the SiteGround "
|
938 |
+
"Optimizer's Image Optimization tab."
|
939 |
+
msgstr ""
|
940 |
+
"Selecciona si los administradores pueden acceder y hacer cambios en la "
|
941 |
+
"pestaña de optimización de imágenes de SiteGround Optimizer."
|
942 |
+
|
943 |
+
#. src-js/components/tabs/multisite-control/index.jsx:467
|
944 |
+
#: helpers/sg-cachepress-react-strings.php:144
|
945 |
+
msgid "Environment Optimizations"
|
946 |
+
msgstr "Optimización del entorno"
|
947 |
+
|
948 |
+
#. src-js/components/tabs/multisite-control/index.jsx:494
|
949 |
+
#: helpers/sg-cachepress-react-strings.php:145
|
950 |
+
msgid ""
|
951 |
+
"Select whether site admins can access and make changes within the SiteGround "
|
952 |
+
"Optimizer's Environment Optimization tab."
|
953 |
+
msgstr ""
|
954 |
+
"Selecciona si los administradores de la página pueden acceder y hacer "
|
955 |
+
"cambios dentro de la pestaña de optimización del entorno de SiteGround "
|
956 |
+
"Optimizer."
|
957 |
+
|
958 |
#. src-js/components/tabs/multisite-control/index.jsx:209
|
959 |
+
#: helpers/sg-cachepress-react-strings.php:146
|
960 |
msgid "SUPERCACHER SETTINGS"
|
961 |
msgstr "AJUSTES DE SUPERCACHER"
|
962 |
|
963 |
#. src-js/components/tabs/multisite-control/index.jsx:304
|
964 |
+
#: helpers/sg-cachepress-react-strings.php:148
|
965 |
msgid ""
|
966 |
"Select whether new sites should have the Dynamic Caching enabled for them or "
|
967 |
"not."
|
970 |
"o no."
|
971 |
|
972 |
#. src-js/components/tabs/sites-control/index.jsx:103
|
973 |
+
#: helpers/sg-cachepress-react-strings.php:151
|
974 |
msgid "ENVIRONMENT OPTIMIZATION"
|
975 |
msgstr "OPTIMIZACIÓN DEL ENTORNO"
|
976 |
|
977 |
#. src-js/components/tabs/sites-control/index.jsx:208
|
978 |
+
#: helpers/sg-cachepress-react-strings.php:156
|
979 |
msgid "FRONTEND OPTIMIZATION"
|
980 |
msgstr "OPTIMIZACIÓN DE PORTADA"
|
981 |
|
982 |
#. src-js/components/tabs/frontend-optimization/index.jsx:32
|
983 |
+
#: helpers/sg-cachepress-react-strings.php:158
|
984 |
msgid ""
|
985 |
"Removes unnecessary characters from your HTML output saving data and "
|
986 |
"improving your site speed."
|
989 |
"la velocidad de tu sitio."
|
990 |
|
991 |
#. src-js/components/tabs/frontend-optimization/index.jsx:65
|
992 |
+
#: helpers/sg-cachepress-react-strings.php:160
|
993 |
msgid ""
|
994 |
"Combine and minify your JavaScript files in order to reduce their size, "
|
995 |
"improve cachability, and reduce the number of requests to the server."
|
999 |
|
1000 |
#. src-js/components/tabs/frontend-optimization/index.jsx:77
|
1001 |
#. src-js/components/tabs/sites-control/index.jsx:296
|
1002 |
+
#: helpers/sg-cachepress-react-strings.php:161
|
1003 |
msgid "Load Render-blocking JavaScript Files Asynchronously"
|
1004 |
msgstr ""
|
1005 |
"Carga asíncrona de los archivos JavaScript que bloquean la visualización"
|
1006 |
|
1007 |
#. src-js/components/tabs/frontend-optimization/index.jsx:107
|
1008 |
#. src-js/components/tabs/sites-control/index.jsx:326
|
1009 |
+
#: helpers/sg-cachepress-react-strings.php:162
|
1010 |
msgid ""
|
1011 |
"Add async parameter to the JavaScript files loaded in the header section of "
|
1012 |
"your site so they don’t block your page rendering."
|
1015 |
"cabecera de tu sitio para que no bloqueen la visualización de tu página."
|
1016 |
|
1017 |
#. src-js/components/tabs/frontend-optimization/index.jsx:99
|
1018 |
+
#: helpers/sg-cachepress-react-strings.php:164
|
1019 |
msgid ""
|
1020 |
"Combine and minify your CSS files in order to reduce their size, improve "
|
1021 |
"cachability, and reduce the number of requests to the server."
|
1025 |
|
1026 |
#. src-js/components/tabs/frontend-optimization/index.jsx:179
|
1027 |
#. src-js/components/tabs/sites-control/index.jsx:392
|
1028 |
+
#: helpers/sg-cachepress-react-strings.php:166
|
1029 |
msgid ""
|
1030 |
"Combine multiple CSS files into one to lower the number of requests your "
|
1031 |
"site generates."
|
1034 |
"genera tu sitio."
|
1035 |
|
1036 |
#. src-js/components/tabs/sites-control/index.jsx:395
|
1037 |
+
#: helpers/sg-cachepress-react-strings.php:171
|
1038 |
msgid "IMAGE OPTIMIZATION"
|
1039 |
msgstr "OPTIMIZACIÓN DE IMÁGENES"
|
1040 |
|
1041 |
#. src-js/components/tabs/sites-control/index.jsx:425
|
1042 |
+
#: helpers/sg-cachepress-react-strings.php:172
|
1043 |
+
#: helpers/manual-translations.php:5
|
1044 |
msgid "Image Optimization"
|
1045 |
msgstr "Optimización de imágenes"
|
1046 |
|
1047 |
#. Page title.
|
1048 |
#. Name of the plugin
|
1049 |
+
#: helpers/sg-cachepress-react-strings.php:184 core/Admin/Admin.php:239
|
1050 |
#: core/Admin/Admin.php:240
|
1051 |
msgid "SG Optimizer"
|
1052 |
msgstr "SG Optimizer"
|
1053 |
|
1054 |
#. src-js/containers/main/index.jsx:136
|
1055 |
+
#: helpers/sg-cachepress-react-strings.php:185
|
1056 |
msgid ""
|
1057 |
"Get the best performance for your WordPress website with our optimization "
|
1058 |
"plugin. It handles caching, system settings, and all the necessary "
|
1066 |
"alojamiento!"
|
1067 |
|
1068 |
#. src-js/containers/main/index.jsx:38
|
1069 |
+
#: helpers/sg-cachepress-react-strings.php:186
|
1070 |
msgid "Old PHP Version"
|
1071 |
msgstr "Antigua versión PHP"
|
1072 |
|
1073 |
#. src-js/containers/php-checker/index.jsx:167
|
1074 |
+
#: helpers/sg-cachepress-react-strings.php:187
|
1075 |
msgid ""
|
1076 |
"You are using our Managed PHP service, which means that SiteGround will "
|
1077 |
"automatically update your PHP once we are sure there is a newer stable one, "
|
1088 |
"manualmente se vuelva a realizar el cambio."
|
1089 |
|
1090 |
#. src-js/containers/php-checker/index.jsx:143
|
1091 |
+
#: helpers/sg-cachepress-react-strings.php:188
|
1092 |
msgid ""
|
1093 |
"Your site will keep using that version until you manually change it from "
|
1094 |
"this interface or until you switch to \"Managed PHP\" service. If you choose "
|
1104 |
"en seguridad y rendimiento."
|
1105 |
|
1106 |
#. src-js/containers/php-checker/index.jsx:179
|
1107 |
+
#: helpers/sg-cachepress-react-strings.php:189
|
1108 |
msgid ""
|
1109 |
"As a SiteGround client you may change your PHP version per site manually. "
|
1110 |
"However, we strongly recommend you to take advantage of our Managed PHP "
|
1124 |
"manualmente se vuelva a realizar el cambio."
|
1125 |
|
1126 |
#. src-js/containers/php-checker/index.jsx:184
|
1127 |
+
#: helpers/sg-cachepress-react-strings.php:190
|
1128 |
msgid "Set your PHP version"
|
1129 |
msgstr "Configurar tu versión PHP"
|
1130 |
|
1131 |
#. src-js/containers/php-checker/index.jsx:205
|
1132 |
+
#: helpers/sg-cachepress-react-strings.php:191
|
1133 |
msgid "You are currently running on PHP %(version)s."
|
1134 |
msgstr "Actualmente estas utilizando PHP %(version)s."
|
1135 |
|
1136 |
#. src-js/containers/php-checker/index.jsx:210
|
1137 |
+
#: helpers/sg-cachepress-react-strings.php:192
|
1138 |
msgid "PHP Management Method"
|
1139 |
msgstr "PHP Gestionado"
|
1140 |
|
1141 |
#. src-js/containers/php-checker/index.jsx:226
|
1142 |
+
#: helpers/sg-cachepress-react-strings.php:193
|
1143 |
msgid "Please select method"
|
1144 |
msgstr "Por favor, selecciona el método"
|
1145 |
|
1146 |
#. src-js/containers/php-checker/index.jsx:227
|
1147 |
+
#: helpers/sg-cachepress-react-strings.php:194
|
1148 |
msgid "Please select management type"
|
1149 |
msgstr "Por favor, selecciona el tipo de configuración"
|
1150 |
|
1151 |
#. src-js/containers/php-checker/index.jsx:222
|
1152 |
+
#: helpers/sg-cachepress-react-strings.php:195
|
1153 |
msgid "PHP Version"
|
1154 |
msgstr "Versión PHP"
|
1155 |
|
1156 |
#. src-js/containers/php-checker/index.jsx:242
|
1157 |
#. src-js/containers/php-checker/index.jsx:243
|
1158 |
+
#: helpers/sg-cachepress-react-strings.php:196
|
1159 |
+
#: helpers/sg-cachepress-react-strings.php:197
|
1160 |
msgid "Please select PHP version"
|
1161 |
msgstr "Por favor, selecciona la versión PHP"
|
1162 |
|
1163 |
#. src-js/containers/php-checker/index.jsx:248
|
1164 |
+
#: helpers/sg-cachepress-react-strings.php:198
|
1165 |
msgid "Save"
|
1166 |
msgstr "Guardar"
|
1167 |
|
1168 |
#. src-js/containers/php-checker/index.jsx:262
|
1169 |
+
#: helpers/sg-cachepress-react-strings.php:199
|
1170 |
msgid ""
|
1171 |
"We currently recommend you to use PHP %(version)s. You can check the "
|
1172 |
"compatibility with the recommended version before you switch. {{link}}Check "
|
1177 |
"compatibilidad{{/link}}"
|
1178 |
|
1179 |
#. src-js/containers/php-checker/index.jsx:286
|
1180 |
+
#: helpers/sg-cachepress-react-strings.php:200
|
1181 |
msgid ""
|
1182 |
"All your plugins are compatible with PHP %(version)s. You may safely switch "
|
1183 |
"to “Managed PHP” service and we’ll upgrade it automatically, or set it "
|
1189 |
"nuevo{{/link}} "
|
1190 |
|
1191 |
#. src-js/containers/php-checker/index.jsx:302
|
1192 |
+
#: helpers/sg-cachepress-react-strings.php:201
|
1193 |
msgid "Checking PHP 7.1 Compatibility..."
|
1194 |
msgstr "Revisando compatibilidad con PHP %(version)s..."
|
1195 |
|
1196 |
#. src-js/containers/php-checker/index.jsx:322
|
1197 |
+
#: helpers/sg-cachepress-react-strings.php:202
|
1198 |
msgid ""
|
1199 |
"Unfortunately some of your plugins or theme are not compatible with our "
|
1200 |
"recommended version. {{link}}Check Again{{/link}}"
|
1203 |
"versión recomendada. {{link}}Revisar de nuevo{{/link}}"
|
1204 |
|
1205 |
#. src-js/containers/php-checker/index.jsx:352
|
1206 |
+
#: helpers/sg-cachepress-react-strings.php:205
|
1207 |
msgid "Thanks for using SG Optimizer to make your site faster!"
|
1208 |
msgstr "¡Gracias por usar SG Optimizer para hacer tu sitio más rápido!"
|
1209 |
|
1210 |
#. src-js/containers/rating/index.jsx:53
|
1211 |
+
#: helpers/sg-cachepress-react-strings.php:206
|
1212 |
msgid "Help more people optimize their sites by rating our plugin."
|
1213 |
msgstr "Ayuda a más personas a optimizar sus sitios valorando nuestro plugin."
|
1214 |
|
1215 |
#. src-js/containers/rating/index.jsx:60
|
1216 |
+
#: helpers/sg-cachepress-react-strings.php:207
|
1217 |
msgid "Don’t Show This Again"
|
1218 |
msgstr "No mostrar esto de nuevo"
|
1219 |
|
1645 |
msgstr "¡Genial! Has trabajado duro."
|
1646 |
|
1647 |
#: core/Analysis/Analysis.php:334
|
1648 |
+
msgid "Your site is loading super fast!"
|
1649 |
+
msgstr "¡Tu web está cargando super rápido!"
|
1650 |
|
1651 |
#: core/Admin/Admin_Bar.php:33 core/Admin/Admin.php:303
|
1652 |
msgid "Purge SG Cache"
|
languages/sg-cachepress-it_IT.mo
CHANGED
Binary file
|
languages/sg-cachepress-it_IT.po
CHANGED
@@ -2,10 +2,10 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: SG Optimizer\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2020-01-
|
6 |
-
"PO-Revision-Date: 2020-01-
|
7 |
"Last-Translator: admin <nobody@exmaple.com>\n"
|
8 |
-
"Language-Team:
|
9 |
"Language: it_IT\n"
|
10 |
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
11 |
"MIME-Version: 1.0\n"
|
@@ -16,37 +16,19 @@ msgstr ""
|
|
16 |
"X-Loco-Parser: loco_parse_po\n"
|
17 |
"X-Loco-Version: 2.3.0; wp-5.3"
|
18 |
|
19 |
-
#. src-js/components/tabs/supercacher/index.jsx:364
|
20 |
-
#: src-js/sg-cachepress-strings.php:4
|
21 |
-
msgid "Test URLs for Cache Status"
|
22 |
-
msgstr "Verifica gli URL per lo stato della Cache"
|
23 |
-
|
24 |
-
#. src-js/components/tabs/supercacher/index.jsx:396
|
25 |
-
#: src-js/sg-cachepress-strings.php:5
|
26 |
-
msgid ""
|
27 |
-
"Check if the Dynamic Cache is working on a certain URL. Especially useful to "
|
28 |
-
"make sure your Exclude list is working the way it should."
|
29 |
-
msgstr ""
|
30 |
-
"Controlla se la Cache Dinamica funziona su un determinato URL. "
|
31 |
-
"Particolarmente utile per assicurarti che la tua lista di esclusione "
|
32 |
-
"funzioni come dovrebbe."
|
33 |
-
|
34 |
-
#. src-js/components/tabs/supercacher/index.jsx:399
|
35 |
-
#: src-js/sg-cachepress-strings.php:6
|
36 |
-
msgid "Test"
|
37 |
-
msgstr "Verifica"
|
38 |
-
|
39 |
#. src-js/components/dialogs/images-dialog.jsx:17
|
40 |
#. src-js/components/dialogs/php-dialog.jsx:17
|
41 |
#. src-js/components/dialogs/ssl-dialog.jsx:17
|
42 |
-
#:
|
43 |
-
#:
|
44 |
-
#:
|
|
|
|
|
45 |
msgid "Confirm"
|
46 |
msgstr "Conferma"
|
47 |
|
48 |
#. src-js/components/dialogs/async-dialog.tsx:18
|
49 |
-
#:
|
50 |
msgid ""
|
51 |
"Defering render-blocking JavaScript may cause issues with scripts that "
|
52 |
"require certain order of execution. This is why we advise you to check the "
|
@@ -58,7 +40,7 @@ msgstr ""
|
|
58 |
"aver abilitato questa ottimizzazione."
|
59 |
|
60 |
#. src-js/components/dialogs/async-dialog.tsx:29
|
61 |
-
#:
|
62 |
msgid ""
|
63 |
"If you notice issues with certain functionality, use the Exclude "
|
64 |
"functionality to keep those scripts loading in a render-blocking manner."
|
@@ -68,12 +50,13 @@ msgstr ""
|
|
68 |
"visualizzazione."
|
69 |
|
70 |
#. src-js/components/dialogs/ssl-dialog.jsx:35
|
71 |
-
#:
|
|
|
72 |
msgid "Close"
|
73 |
msgstr "Chiudi"
|
74 |
|
75 |
#. src-js/components/dialogs/cache-dialog.jsx:17
|
76 |
-
#:
|
77 |
msgid ""
|
78 |
"Purge your installation's entire Dynamic Cache or select parts in order to "
|
79 |
"achieve the best hit-to-cache ratio for your account. Here are the plugin's "
|
@@ -84,7 +67,7 @@ msgstr ""
|
|
84 |
"il tuo account. Ecco le regole di pulizia cache del plugin:"
|
85 |
|
86 |
#. src-js/components/dialogs/cache-dialog.jsx:29
|
87 |
-
#:
|
88 |
msgid ""
|
89 |
"Full Purge on page, posts, and category deletion, plugin and theme "
|
90 |
"activation, deactivation, or update, and on WordPress core updates."
|
@@ -94,7 +77,7 @@ msgstr ""
|
|
94 |
"WordPress."
|
95 |
|
96 |
#. src-js/components/dialogs/cache-dialog.jsx:38
|
97 |
-
#:
|
98 |
msgid ""
|
99 |
"Specific URL Purge on comment actions and page, post, and category updates."
|
100 |
msgstr ""
|
@@ -104,13 +87,15 @@ msgstr ""
|
|
104 |
#. src-js/components/dialogs/cache-dialog.jsx:48
|
105 |
#. src-js/components/dialogs/images-dialog.jsx:35
|
106 |
#. src-js/components/dialogs/php-dialog.jsx:36
|
107 |
-
#:
|
108 |
-
#:
|
|
|
|
|
109 |
msgid "Cancel"
|
110 |
msgstr "Annulla"
|
111 |
|
112 |
#. src-js/components/dialogs/delete-webp-dialog.tsx:23
|
113 |
-
#:
|
114 |
msgid ""
|
115 |
"This will delete all WebP files in your uploads folder! In case you need "
|
116 |
"them, you will have to regenerate them again or restore that folder from a "
|
@@ -121,7 +106,7 @@ msgstr ""
|
|
121 |
"backup."
|
122 |
|
123 |
#. src-js/components/dialogs/php-dialog.jsx:23
|
124 |
-
#:
|
125 |
msgid ""
|
126 |
"You’re switching to PHP %(version)s manually and you will stay on that "
|
127 |
"version until you change it to a newer one. In case you experience any "
|
@@ -134,7 +119,7 @@ msgstr ""
|
|
134 |
"cPanel{{/strong}} > {{strong}}Gestione versione PHP{{/strong}}."
|
135 |
|
136 |
#. src-js/components/dialogs/php-dialog.jsx:37
|
137 |
-
#:
|
138 |
msgid ""
|
139 |
"You’re about to switch to Managed PHP service. This means that SiteGround "
|
140 |
"will automatically update your PHP version once we are sure there’s a better,"
|
@@ -145,7 +130,7 @@ msgstr ""
|
|
145 |
"sia disponibile una nuova versione più sicura e stabile."
|
146 |
|
147 |
#. src-js/components/dialogs/regenerate-webp-dialog.tsx:23
|
148 |
-
#:
|
149 |
msgid ""
|
150 |
"Doing this will delete all WebP files in your uploads folder and generate "
|
151 |
"them anew!"
|
@@ -154,7 +139,7 @@ msgstr ""
|
|
154 |
"caricamenti e generati di nuovo!"
|
155 |
|
156 |
#. src-js/components/dialogs/ssl-dialog.jsx:23
|
157 |
-
#:
|
158 |
msgid ""
|
159 |
"In order to force HTTPS on your site, we will automatically update your "
|
160 |
"database replacing all insecure links. In addition to that, we will add a "
|
@@ -167,7 +152,7 @@ msgstr ""
|
|
167 |
"attraverso la connessione crittografata."
|
168 |
|
169 |
#. src-js/components/dialogs/urls-dialog.jsx:17
|
170 |
-
#:
|
171 |
msgid ""
|
172 |
"You can exclude full or partial URLs using \"*\" as a wildcard. For example:"
|
173 |
msgstr ""
|
@@ -175,7 +160,7 @@ msgstr ""
|
|
175 |
"jolly. Per esempio:"
|
176 |
|
177 |
#. src-js/components/dialogs/urls-dialog.jsx:29
|
178 |
-
#:
|
179 |
msgid ""
|
180 |
"{{strong}}www.site.com/parent-page/sub-page{{/strong}} will exclude only "
|
181 |
"that single URL."
|
@@ -184,7 +169,7 @@ msgstr ""
|
|
184 |
"singolo URL."
|
185 |
|
186 |
#. src-js/components/dialogs/urls-dialog.jsx:38
|
187 |
-
#:
|
188 |
msgid ""
|
189 |
"{{strong}}www.site.com/parent-page/*{{/strong}} will exclude all sub-pages "
|
190 |
"of \"parent-page\"."
|
@@ -192,56 +177,79 @@ msgstr ""
|
|
192 |
"{{strong}}www.site.com/parent-page/*{{/strong}} escluderà tutte le "
|
193 |
"sottopagine della \"parent page\"."
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
#. src-js/components/exclude/index.jsx:142
|
196 |
-
#:
|
197 |
msgid "This item already exists in exclude list."
|
198 |
msgstr "Questo elemento esiste già nell'elenco di esclusione."
|
199 |
|
200 |
#. src-js/components/exclude/simple-exclude.jsx:44
|
201 |
-
#:
|
202 |
msgid "You must input a class name."
|
203 |
msgstr "Devi introdurre un nome di classe."
|
204 |
|
205 |
#. src-js/components/tabs/supercacher/index.jsx:338
|
206 |
-
#:
|
|
|
207 |
msgid "Exclude"
|
208 |
msgstr "Escludi"
|
209 |
|
210 |
#. src-js/components/tabs/image-optimization/index.jsx:318
|
211 |
-
#:
|
212 |
msgid "This URL already exists in exclude list."
|
213 |
msgstr "Questo URL esiste già nell'elenco di esclusione."
|
214 |
|
215 |
#. src-js/components/dialogs/urls-dialog.tsx:54
|
216 |
#. src-js/components/loaders/image-loader.tsx:59
|
217 |
-
#:
|
|
|
218 |
msgid "Please be patient, this process may take some time"
|
219 |
msgstr ""
|
220 |
"Ti preghiamo di attendere, questo processo potrebbe richiedere del tempo"
|
221 |
|
222 |
#. src-js/components/loaders/image-loader.tsx:31
|
223 |
-
#:
|
224 |
msgid "Optimized %(optimized)s of %(total)s images"
|
225 |
msgstr "%(optimized)s immagini su %(total)s sono state ottimizzate"
|
226 |
|
227 |
#. src-js/components/loaders/image-loader.tsx:35
|
228 |
#. src-js/components/loaders/webp-loader.tsx:31
|
229 |
-
#:
|
|
|
230 |
msgid "Pause"
|
231 |
msgstr "Pausa"
|
232 |
|
233 |
#. src-js/components/loaders/webp-loader.tsx:27
|
234 |
-
#:
|
235 |
msgid "Generated %(optimized)s of %(total)s webp copies"
|
236 |
msgstr "Genera %(optimized)s di %(total)s copie WebP"
|
237 |
|
238 |
#. src-js/components/loaders/webp-loader.tsx:55
|
239 |
-
#:
|
240 |
msgid "Generate WebP Copies of New Images"
|
241 |
msgstr "Genera copie WebP delle nuove immagini"
|
242 |
|
243 |
#. src-js/components/webp/webp.tsx:118
|
244 |
-
#:
|
245 |
msgid ""
|
246 |
"WebP is a next generation image format supported by modern browers which "
|
247 |
"greatly reduces the size of your images."
|
@@ -250,27 +258,27 @@ msgstr ""
|
|
250 |
"moderni che riduce notevolmente le dimensioni delle immagini."
|
251 |
|
252 |
#. src-js/components/webp/webp.tsx:122
|
253 |
-
#:
|
254 |
msgid "Manage WebP Copies for Existing Images"
|
255 |
msgstr "Gestisci copie WebP per le immagini esistenti"
|
256 |
|
257 |
#. src-js/components/webp/webp.tsx:139
|
258 |
-
#:
|
259 |
msgid "Generate or delete a WebP copy of your existing media library."
|
260 |
msgstr "Genera o elimina una copia WebP della tua libreria multimediale."
|
261 |
|
262 |
#. src-js/components/webp/webp.tsx:142
|
263 |
-
#:
|
264 |
msgid "Delete all WebP Files"
|
265 |
msgstr "Elimina tutti i file WebP"
|
266 |
|
267 |
#. src-js/components/webp/webp.tsx:160
|
268 |
-
#:
|
269 |
msgid "Bulk Generate WebP Files"
|
270 |
msgstr "Genera file WebP in blocco"
|
271 |
|
272 |
#. src-js/components/webp/webp.tsx:176
|
273 |
-
#:
|
274 |
msgid ""
|
275 |
"All WebP copies of your files have been generated successfully! Force {{link}"
|
276 |
"}re-generation{{/link}} of your images."
|
@@ -279,13 +287,13 @@ msgstr ""
|
|
279 |
"la {{link}}ri-generazione{{/link}} delle tue immagini."
|
280 |
|
281 |
#. src-js/components/tabs/environment-optimization/index.jsx:216
|
282 |
-
#:
|
283 |
-
#: core/Options/Options.php:385
|
284 |
msgid "Browser Caching"
|
285 |
msgstr "Cache del browser"
|
286 |
|
287 |
#. src-js/components/tabs/environment-optimization/index.jsx:246
|
288 |
-
#:
|
289 |
msgid ""
|
290 |
"Adds rules to store in your visitors browser cache to keep static content "
|
291 |
"longer for better site performance."
|
@@ -295,12 +303,13 @@ msgstr ""
|
|
295 |
"prestazioni del sito."
|
296 |
|
297 |
#. src-js/components/modules/gzip/index.jsx:35
|
298 |
-
#:
|
|
|
299 |
msgid "YOU HAVE A SITE TOOLS ACCOUNT"
|
300 |
msgstr "HAI UN ACCOUNT SITE TOOLS"
|
301 |
|
302 |
#. src-js/components/modules/browser-cache/index.tsx:38
|
303 |
-
#:
|
304 |
msgid ""
|
305 |
"NGINX Direct Delivery takes care of your static resources including proper "
|
306 |
"expiration dates for your browser caching."
|
@@ -310,12 +319,13 @@ msgstr ""
|
|
310 |
|
311 |
#. src-js/components/tabs/multisite-control/index.jsx:277
|
312 |
#. src-js/components/tabs/supercacher/index.jsx:160
|
313 |
-
#:
|
|
|
314 |
msgid "Dynamic Caching"
|
315 |
msgstr "Caching Dinamico"
|
316 |
|
317 |
#. src-js/components/tabs/supercacher/index.jsx:218
|
318 |
-
#:
|
319 |
msgid ""
|
320 |
"Store your content in the server’s memory for a faster access with this full-"
|
321 |
"page caching solution powered by NGINX."
|
@@ -324,32 +334,34 @@ msgstr ""
|
|
324 |
" con questa soluzione di caching full-page di NGINX."
|
325 |
|
326 |
#. src-js/components/tabs/supercacher/index.jsx:221
|
327 |
-
#:
|
328 |
msgid "Manual Cache Purge"
|
329 |
msgstr "Pulizia manuale della Cache"
|
330 |
|
331 |
#. src-js/components/tabs/supercacher/index.jsx:264
|
332 |
-
#:
|
333 |
msgid "Clear the Dynamic Cache for your entire website."
|
334 |
msgstr "Pulisce la Cache Dinamica di tutto il sito."
|
335 |
|
336 |
#. src-js/components/modules/dynamic-cache/index.jsx:234
|
337 |
-
#:
|
338 |
msgid "Purge Cache"
|
339 |
msgstr "Svuotare cache"
|
340 |
|
341 |
#. src-js/components/modules/dynamic-cache/index.jsx:247
|
342 |
-
#:
|
343 |
msgid "Purging ..."
|
344 |
msgstr "Svuotamento ..."
|
345 |
|
346 |
#. src-js/components/tabs/supercacher/index.jsx:267
|
347 |
-
#:
|
|
|
348 |
msgid "Automatic Cache Purge"
|
349 |
msgstr "Pulizia automatica della cache"
|
350 |
|
351 |
#. src-js/components/tabs/supercacher/index.jsx:299
|
352 |
-
#:
|
|
|
353 |
msgid ""
|
354 |
"Automatically perform a smart cache purge after every content modification."
|
355 |
msgstr ""
|
@@ -357,16 +369,16 @@ msgstr ""
|
|
357 |
"modifica del contenuto."
|
358 |
|
359 |
#. src-js/components/tabs/supercacher/index.jsx:302
|
360 |
-
#:
|
361 |
msgid "See rules"
|
362 |
msgstr "Vedi le regole"
|
363 |
|
364 |
-
#:
|
365 |
msgid "Browser-Specific Caching"
|
366 |
msgstr "Cache specifica per il browser"
|
367 |
|
368 |
#. src-js/components/modules/dynamic-cache/index.jsx:133
|
369 |
-
#:
|
370 |
msgid ""
|
371 |
"We recommend you to enable this feature {{strong}}only{{/strong}} if you’re "
|
372 |
"experiencing issues with plugins, generating mobile version of your site or "
|
@@ -379,12 +391,12 @@ msgstr ""
|
|
379 |
"generata separatamente per diversi browser, il che ne riduce l'efficienza."
|
380 |
|
381 |
#. src-js/components/tabs/supercacher/index.jsx:305
|
382 |
-
#:
|
383 |
msgid "Excluding URLs"
|
384 |
msgstr "Escludo gli URL"
|
385 |
|
386 |
#. src-js/components/tabs/supercacher/index.jsx:332
|
387 |
-
#:
|
388 |
msgid ""
|
389 |
"Use this feature if you want to exclude certain parts of your website from "
|
390 |
"being cached and keep them dynamic."
|
@@ -393,22 +405,23 @@ msgstr ""
|
|
393 |
"dalla cache e mantenerle dinamiche."
|
394 |
|
395 |
#. src-js/components/tabs/supercacher/index.jsx:335
|
396 |
-
#:
|
397 |
msgid "See examples"
|
398 |
msgstr "Vedi gli esempi"
|
399 |
|
400 |
#. src-js/components/modules/gzip/index.jsx:12
|
401 |
-
#:
|
|
|
402 |
msgid "Memcached Stopped. Please, enable it in your SiteGround control panel."
|
403 |
msgstr "Memcached bloccato. Attivalo nel pannello di controllo di SiteGround."
|
404 |
|
405 |
#. src-js/components/tabs/supercacher/index.jsx:426
|
406 |
-
#:
|
407 |
msgid "Memcached"
|
408 |
msgstr "Memcached"
|
409 |
|
410 |
#. src-js/components/tabs/supercacher/index.jsx:454
|
411 |
-
#:
|
412 |
msgid ""
|
413 |
"Powerful object caching for your site. It stores frequently executed queries "
|
414 |
"to your databases and reuses them for better performance."
|
@@ -417,13 +430,13 @@ msgstr ""
|
|
417 |
"frequentemente sui tuoi database e li riutilizza per prestazioni migliori."
|
418 |
|
419 |
#. src-js/components/tabs/environment-optimization/index.jsx:157
|
420 |
-
#:
|
421 |
-
#: core/Options/Options.php:384
|
422 |
msgid "GZIP Compression"
|
423 |
msgstr "Compressione GZIP"
|
424 |
|
425 |
#. src-js/components/tabs/environment-optimization/index.jsx:213
|
426 |
-
#:
|
427 |
msgid ""
|
428 |
"Enables a compression of the content that's delivered to your visitors "
|
429 |
"browsers improving the network loading times of your site."
|
@@ -432,7 +445,7 @@ msgstr ""
|
|
432 |
"visitatori, migliorando i tempi di caricamento della rete del tuo sito."
|
433 |
|
434 |
#. src-js/components/modules/gzip/index.jsx:40
|
435 |
-
#:
|
436 |
msgid ""
|
437 |
"GZIP Compression is enabled by default automatically saving you bandwidth "
|
438 |
"and improving the loading speeds of your pages."
|
@@ -441,12 +454,12 @@ msgstr ""
|
|
441 |
"larghezza di banda e migliorare la velocità di caricamento delle tue pagine."
|
442 |
|
443 |
#. src-js/components/modules/memcached/index.tsx:63
|
444 |
-
#:
|
445 |
msgid "Score Check"
|
446 |
msgstr "Verifica del punteggio"
|
447 |
|
448 |
#. src-js/components/tabs/analytics/index.tsx:122
|
449 |
-
#:
|
450 |
msgid ""
|
451 |
"Test how optimized your website is. Our performance check is powered by "
|
452 |
"Google PageSpeed."
|
@@ -455,40 +468,42 @@ msgstr ""
|
|
455 |
"prestazioni è basato su Google Page Speed."
|
456 |
|
457 |
#. src-js/components/tabs/analytics/index.tsx:125
|
458 |
-
#:
|
459 |
msgid "Device Type"
|
460 |
msgstr "Tipo di dispositivo"
|
461 |
|
462 |
#. src-js/components/tabs/analytics/index.tsx:156
|
463 |
-
#:
|
464 |
msgid "URL"
|
465 |
msgstr "URL"
|
466 |
|
467 |
#. src-js/components/tabs/analytics/index.jsx:31
|
468 |
-
#:
|
469 |
msgid "Analyze"
|
470 |
msgstr "Analizza"
|
471 |
|
472 |
#. src-js/components/tabs/analytics/index.tsx:180
|
473 |
-
#:
|
474 |
msgid "Please Wait, We Are Performing a Google PageSpeed Test on Your Page"
|
475 |
msgstr ""
|
476 |
"Ti preghiamo di attendere, stiamo eseguendo un test di Google PageSpeed "
|
477 |
"sulla tua pagina"
|
478 |
|
479 |
#. src-js/components/tabs/analytics/index.tsx:187
|
480 |
-
#:
|
481 |
msgid "There is nothing here yet"
|
482 |
msgstr "Non c'è ancora niente qui"
|
483 |
|
484 |
#. src-js/components/php-checker/index.jsx:341
|
485 |
#. src-js/components/tabs/multisite-control/index.jsx:226
|
486 |
-
#:
|
|
|
487 |
msgid "Enable HTTPS"
|
488 |
msgstr "Abilita HTTPS"
|
489 |
|
490 |
#. src-js/components/tabs/environment-optimization/index.jsx:109
|
491 |
-
#:
|
|
|
492 |
msgid ""
|
493 |
"Configures your site to work correctly via HTTPS and forces a secure "
|
494 |
"connection to your site."
|
@@ -497,12 +512,14 @@ msgstr ""
|
|
497 |
"connessione sicura al tuo sito."
|
498 |
|
499 |
#. src-js/components/tabs/environment-optimization/index.jsx:112
|
500 |
-
#:
|
|
|
501 |
msgid "Fix Insecure Content"
|
502 |
msgstr "Sistema i contenuti non sicuri"
|
503 |
|
504 |
#. src-js/components/tabs/environment-optimization/index.jsx:154
|
505 |
-
#:
|
|
|
506 |
msgid ""
|
507 |
"Enable this option in case you’re getting insecure content errors on your "
|
508 |
"website. We will dynamically rewrite insecure requests for resources coming "
|
@@ -513,12 +530,13 @@ msgstr ""
|
|
513 |
"inerenti al tuo sito"
|
514 |
|
515 |
#. src-js/components/tabs/environment-optimization/index.jsx:249
|
516 |
-
#:
|
|
|
517 |
msgid "Minify the HTML Output"
|
518 |
msgstr "Minifica l'output HTML"
|
519 |
|
520 |
#. src-js/components/tabs/frontend-optimization/index.jsx:71
|
521 |
-
#:
|
522 |
msgid ""
|
523 |
"Removes unnecessary characters from your HTML output saving data and "
|
524 |
"improving your site speed. "
|
@@ -528,12 +546,13 @@ msgstr ""
|
|
528 |
|
529 |
#. src-js/components/tabs/frontend-optimization/index.jsx:76
|
530 |
#. src-js/components/tabs/frontend-optimization/index.jsx:81
|
531 |
-
#:
|
|
|
532 |
msgid "Exclude URLs from HTML Minification"
|
533 |
msgstr "Escludi gli URL dalla minificazione HTML"
|
534 |
|
535 |
#. src-js/components/tabs/frontend-optimization/index.jsx:101
|
536 |
-
#:
|
537 |
msgid ""
|
538 |
"With this functionality, you can exclude different pages from HTML "
|
539 |
"minification."
|
@@ -542,12 +561,13 @@ msgstr ""
|
|
542 |
"minificazione HTML."
|
543 |
|
544 |
#. src-js/components/tabs/frontend-optimization/index.jsx:35
|
545 |
-
#:
|
|
|
546 |
msgid "Minify JavaScript Files"
|
547 |
msgstr "Minifica i file JavaScript"
|
548 |
|
549 |
#. src-js/components/tabs/frontend-optimization/index.jsx:118
|
550 |
-
#:
|
551 |
msgid ""
|
552 |
"Minify your JavaScript files in order to reduce their size and reduce the "
|
553 |
"number of requests to the server. "
|
@@ -556,17 +576,17 @@ msgstr ""
|
|
556 |
"richieste al server."
|
557 |
|
558 |
#. src-js/components/tabs/frontend-optimization/index.jsx:123
|
559 |
-
#:
|
560 |
msgid "Exclude from JavaScript Minification"
|
561 |
msgstr "Escludi dalla minimizzazione JavaScript"
|
562 |
|
563 |
#. src-js/components/tabs/frontend-optimization/index.jsx:128
|
564 |
-
#:
|
565 |
msgid "Defer Render-blocking JS"
|
566 |
msgstr "Rinvia il blocco di visualizzazione JS"
|
567 |
|
568 |
#. src-js/components/tabs/frontend-optimization/index.jsx:160
|
569 |
-
#:
|
570 |
msgid ""
|
571 |
"Defer loading of render-blocking JavaScript files for faster initial site "
|
572 |
"load. "
|
@@ -575,17 +595,18 @@ msgstr ""
|
|
575 |
"per veocizzare il caricamento inziale del sito."
|
576 |
|
577 |
#. src-js/components/tabs/frontend-optimization/index.jsx:165
|
578 |
-
#:
|
579 |
msgid "Exclude from Loading JS Files Asynchronously"
|
580 |
msgstr "Escludi dal caricamento asincrono dei file JS"
|
581 |
|
582 |
#. src-js/components/tabs/frontend-optimization/index.jsx:68
|
583 |
-
#:
|
|
|
584 |
msgid "Minify CSS Files"
|
585 |
msgstr "Minifica i file CSS"
|
586 |
|
587 |
#. src-js/components/tabs/frontend-optimization/index.jsx:202
|
588 |
-
#:
|
589 |
msgid ""
|
590 |
"Minify your CSS files in order to reduce their size and reduce the number of "
|
591 |
"requests to the server. "
|
@@ -594,18 +615,19 @@ msgstr ""
|
|
594 |
"al server."
|
595 |
|
596 |
#. src-js/components/tabs/frontend-optimization/index.jsx:207
|
597 |
-
#:
|
598 |
msgid "Exclude From CSS Minification"
|
599 |
msgstr "Escludi dalla minificazione CSS"
|
600 |
|
601 |
#. src-js/components/tabs/frontend-optimization/index.jsx:149
|
602 |
#. src-js/components/tabs/sites-control/index.jsx:362
|
603 |
-
#:
|
|
|
604 |
msgid "Combine CSS Files"
|
605 |
msgstr "Unisci i file CSS"
|
606 |
|
607 |
#. src-js/components/tabs/frontend-optimization/index.jsx:244
|
608 |
-
#:
|
609 |
msgid ""
|
610 |
"Combine multiple CSS files into one to lower the number of requests your "
|
611 |
"site generates. "
|
@@ -614,17 +636,17 @@ msgstr ""
|
|
614 |
"tuo sito."
|
615 |
|
616 |
#. src-js/components/tabs/frontend-optimization/index.jsx:249
|
617 |
-
#:
|
618 |
msgid "Exclude from CSS Combination"
|
619 |
msgstr "Escludi dalla combinazione CSS"
|
620 |
|
621 |
#. src-js/components/tabs/frontend-optimization/index.jsx:254
|
622 |
-
#:
|
623 |
msgid "Optimize Loading of Google Fonts"
|
624 |
msgstr "Ottimizza il caricamento dei font Google"
|
625 |
|
626 |
#. src-js/components/tabs/frontend-optimization/index.jsx:286
|
627 |
-
#:
|
628 |
msgid ""
|
629 |
"Combine the loading of Google fonts reducing the number of HTTP requests."
|
630 |
msgstr ""
|
@@ -632,12 +654,14 @@ msgstr ""
|
|
632 |
"\n"
|
633 |
|
634 |
#. src-js/components/tabs/frontend-optimization/index.jsx:102
|
635 |
-
#:
|
|
|
636 |
msgid "Remove Query Strings From Static Resources"
|
637 |
msgstr "Rimuovi le stringhe di ricerca dalle risorse statiche"
|
638 |
|
639 |
#. src-js/components/tabs/frontend-optimization/index.jsx:132
|
640 |
-
#:
|
|
|
641 |
msgid ""
|
642 |
"Removes version query strings from your static resources improving the "
|
643 |
"caching of those resources."
|
@@ -646,12 +670,14 @@ msgstr ""
|
|
646 |
"memorizzazione nella cache di tali risorse."
|
647 |
|
648 |
#. src-js/components/tabs/frontend-optimization/index.jsx:135
|
649 |
-
#:
|
|
|
650 |
msgid "Disable Emojis"
|
651 |
msgstr "Disabilita Emoji"
|
652 |
|
653 |
#. src-js/components/tabs/frontend-optimization/index.jsx:165
|
654 |
-
#:
|
|
|
655 |
msgid ""
|
656 |
"Enable to prevent WordPress from automatically detecting and generating "
|
657 |
"emojis in your pages."
|
@@ -659,84 +685,13 @@ msgstr ""
|
|
659 |
"Abilita per impedire a WordPress di rilevare e generare automaticamente "
|
660 |
"emoji nelle tue pagine."
|
661 |
|
662 |
-
#. src-js/components/tabs/multisite-control/index.jsx:339
|
663 |
-
#: src-js/sg-cachepress-strings.php:111
|
664 |
-
msgid "Site Admin Permissions"
|
665 |
-
msgstr "Autorizzazioni dell'admin del sito"
|
666 |
-
|
667 |
-
#. src-js/components/tabs/multisite-control/index.jsx:372
|
668 |
-
#: src-js/sg-cachepress-strings.php:112
|
669 |
-
msgid ""
|
670 |
-
"In this section, set the access permission for admins of separate sites."
|
671 |
-
msgstr ""
|
672 |
-
"In questa sezione imposta i permessi di accesso per gli amministratori di "
|
673 |
-
"siti diversi."
|
674 |
-
|
675 |
-
#. src-js/components/tabs/multisite-control/index.jsx:87
|
676 |
-
#: src-js/sg-cachepress-strings.php:113 helpers/manual-translations.php:2
|
677 |
-
msgid "SuperCacher Settings"
|
678 |
-
msgstr "Impostazioni SuperCacher"
|
679 |
-
|
680 |
-
#. src-js/components/tabs/multisite-control/index.jsx:402
|
681 |
-
#: src-js/sg-cachepress-strings.php:114
|
682 |
-
msgid ""
|
683 |
-
"Select whether site admins can access and make changes within the SiteGround "
|
684 |
-
"Optimizer's SuperCacher tab."
|
685 |
-
msgstr ""
|
686 |
-
"Seleziona se gli amministratori del sito possono accedere e apportare "
|
687 |
-
"modifiche all'interno della sezione SuperCacher di SiteGround Optimizer."
|
688 |
-
|
689 |
-
#. src-js/components/tabs/multisite-control/index.jsx:405
|
690 |
-
#: src-js/sg-cachepress-strings.php:115
|
691 |
-
msgid "Frontend Optimizations"
|
692 |
-
msgstr "Ottimizzazioni del frontend"
|
693 |
-
|
694 |
-
#. src-js/components/tabs/multisite-control/index.jsx:434
|
695 |
-
#: src-js/sg-cachepress-strings.php:116
|
696 |
-
msgid ""
|
697 |
-
"Select whether site admins can access and make changes within the SiteGround "
|
698 |
-
"Optimizer's Frontend Optmization tab."
|
699 |
-
msgstr ""
|
700 |
-
"Seleziona se gli amministratori del sito possono accedere e apportare "
|
701 |
-
"modifiche all'interno della sezione Ottimizzazione Frontend di SiteGround "
|
702 |
-
"Optimizer."
|
703 |
-
|
704 |
-
#. src-js/components/tabs/multisite-control/index.jsx:437
|
705 |
-
#: src-js/sg-cachepress-strings.php:117
|
706 |
-
msgid "Image Optimizations"
|
707 |
-
msgstr "Ottimizzazioni immagine"
|
708 |
-
|
709 |
-
#. src-js/components/tabs/multisite-control/index.jsx:464
|
710 |
-
#: src-js/sg-cachepress-strings.php:118
|
711 |
-
msgid ""
|
712 |
-
"Select whether site admins can access and make changes within the SiteGround "
|
713 |
-
"Optimizer's Image Optimization tab."
|
714 |
-
msgstr ""
|
715 |
-
"Seleziona se gli amministratori del sito possono accedere e apportare "
|
716 |
-
"modifiche all'interno della sezione Ottimizzazione Immagine di SiteGround "
|
717 |
-
"Optimizer."
|
718 |
-
|
719 |
-
#. src-js/components/tabs/multisite-control/index.jsx:467
|
720 |
-
#: src-js/sg-cachepress-strings.php:119
|
721 |
-
msgid "Environment Optimizations"
|
722 |
-
msgstr "Ottimizzazioni dell'ambiente"
|
723 |
-
|
724 |
-
#. src-js/components/tabs/multisite-control/index.jsx:494
|
725 |
-
#: src-js/sg-cachepress-strings.php:120
|
726 |
-
msgid ""
|
727 |
-
"Select whether site admins can access and make changes within the SiteGround "
|
728 |
-
"Optimizer's Environment Optimization tab."
|
729 |
-
msgstr ""
|
730 |
-
"Seleziona se gli amministratori del sito possono accedere e apportare "
|
731 |
-
"modifiche nella sezione di Ottimizzazione Ambiente di SiteGround Optimizer."
|
732 |
-
|
733 |
#. src-js/components/tabs/frontend-optimization/index.jsx:191
|
734 |
-
#:
|
735 |
msgid "New Images Optimization"
|
736 |
msgstr "Ottimizzazione nuove immagini"
|
737 |
|
738 |
#. src-js/components/tabs/image-optimization/index.jsx:68
|
739 |
-
#:
|
740 |
msgid ""
|
741 |
"We will automatically optimize all new images that you upload to your Media "
|
742 |
"Library."
|
@@ -745,12 +700,13 @@ msgstr ""
|
|
745 |
"Media Library."
|
746 |
|
747 |
#. src-js/components/tabs/image-optimization/index.jsx:71
|
748 |
-
#:
|
749 |
msgid "Existing Images Optimization"
|
750 |
msgstr "Ottimizzazione immagini esistenti"
|
751 |
|
752 |
#. src-js/components/tabs/image-optimization/index.jsx:80
|
753 |
-
#:
|
|
|
754 |
msgid ""
|
755 |
"We will optimize all your existing images with minimal or no loss in quality."
|
756 |
" Note, that this will overwrite your original images."
|
@@ -759,18 +715,19 @@ msgstr ""
|
|
759 |
"nulla. Tieni presente che questo sovrascriverà le tue immagini originali."
|
760 |
|
761 |
#. src-js/components/tabs/frontend-optimization/index.jsx:191
|
762 |
-
#:
|
763 |
msgid "Resume Optimization"
|
764 |
msgstr "Riprendi l’ottimizzazione"
|
765 |
|
766 |
#. src-js/components/tabs/image-optimization/index.jsx:105
|
767 |
-
#:
|
768 |
msgid "Start Optimization"
|
769 |
msgstr "Inizio Ottimizzazione"
|
770 |
|
771 |
#. src-js/components/tabs/image-optimization/index.jsx:131
|
772 |
#. src-js/containers/php-checker/index.jsx:212
|
773 |
-
#:
|
|
|
774 |
msgid ""
|
775 |
"We've detected that the WordPress cronjob functionality is not working. "
|
776 |
"Please, enable it following the instructions in {{link}}this article{{/link}}"
|
@@ -788,13 +745,14 @@ msgstr ""
|
|
788 |
#. src-js/components/php-checker/index.jsx:223
|
789 |
#. src-js/components/tabs/multisite-control/index.jsx:547
|
790 |
#. src-js/components/tabs/image-optimization/index.jsx:111
|
791 |
-
#:
|
|
|
792 |
msgid "https://www.siteground.com/kb/disable-enable-wordpress-cron/"
|
793 |
msgstr ""
|
794 |
"https://it.siteground.com/kb/come-disattivare-abilitare-il-wordpress-cron/"
|
795 |
|
796 |
#. src-js/components/tabs/image-optimization/index.jsx:159
|
797 |
-
#:
|
798 |
msgid ""
|
799 |
"All images in your Media Library have been optimized successfully! Force "
|
800 |
"{{link}}re-optimization{{/link}} of your images."
|
@@ -803,22 +761,26 @@ msgstr ""
|
|
803 |
"successo! Forza la {{link}}ri-ottimizzazione{{/link}} delle tue immagini."
|
804 |
|
805 |
#. src-js/components/tabs/image-optimization/index.jsx:148
|
806 |
-
#:
|
|
|
807 |
msgid "Lazy Load Images"
|
808 |
msgstr "Lazy Load delle immagini"
|
809 |
|
810 |
#. src-js/components/tabs/image-optimization/index.jsx:168
|
811 |
-
#:
|
|
|
812 |
msgid "Load images only when they are visible in the browser"
|
813 |
msgstr "Carica le immagini solo quando sono visibili nel browser"
|
814 |
|
815 |
#. src-js/components/tabs/image-optimization/index.jsx:171
|
816 |
-
#:
|
|
|
817 |
msgid "Lazy Load Gravatars"
|
818 |
msgstr "Lazy Load dei Gravatar"
|
819 |
|
820 |
#. src-js/components/tabs/image-optimization/index.jsx:212
|
821 |
-
#:
|
|
|
822 |
msgid ""
|
823 |
"When users comment under your posts, WordPress tries to load their avatars "
|
824 |
"from gravatar.com. We recommend lazy-loading them as your users scroll down "
|
@@ -830,12 +792,14 @@ msgstr ""
|
|
830 |
"tua pagina."
|
831 |
|
832 |
#. src-js/components/tabs/image-optimization/index.jsx:215
|
833 |
-
#:
|
|
|
834 |
msgid "Lazy Load Thumbnails"
|
835 |
msgstr "Lazy Load delle Thumbnail"
|
836 |
|
837 |
#. src-js/components/tabs/image-optimization/index.jsx:246
|
838 |
-
#:
|
|
|
839 |
msgid ""
|
840 |
"Enable if you want to lazy-load the thumbnail sizes of your original images."
|
841 |
msgstr ""
|
@@ -843,12 +807,14 @@ msgstr ""
|
|
843 |
"delle immagini originali."
|
844 |
|
845 |
#. src-js/components/tabs/image-optimization/index.jsx:249
|
846 |
-
#:
|
|
|
847 |
msgid "Lazy Load Responsive Images"
|
848 |
msgstr "Lazy Load delle immagini resposive"
|
849 |
|
850 |
#. src-js/components/tabs/image-optimization/index.jsx:280
|
851 |
-
#:
|
|
|
852 |
msgid ""
|
853 |
"Certain plugins and themes generate multiple images from a single upload to "
|
854 |
"work better on different devices. Enable if you want to lazy-load these too."
|
@@ -858,12 +824,14 @@ msgstr ""
|
|
858 |
"anche per questi."
|
859 |
|
860 |
#. src-js/components/tabs/image-optimization/index.jsx:283
|
861 |
-
#:
|
|
|
862 |
msgid "Lazy Load Widgets"
|
863 |
msgstr "Lazy Load dei widget"
|
864 |
|
865 |
#. src-js/components/tabs/image-optimization/index.jsx:315
|
866 |
-
#:
|
|
|
867 |
msgid ""
|
868 |
"Enable this option if you want the images in your widget areas to load only "
|
869 |
"when users reach them. "
|
@@ -871,12 +839,12 @@ msgstr ""
|
|
871 |
"Abilita questa opzione se desideri che le immagini nell'area dei widget "
|
872 |
"vengano caricate solo quando gli utenti le raggiungono."
|
873 |
|
874 |
-
#:
|
875 |
msgid "Lazy Load for Mobile"
|
876 |
msgstr "Lazy Load per mobile"
|
877 |
|
878 |
#. src-js/components/tabs/image-optimization/index.jsx:263
|
879 |
-
#:
|
880 |
msgid ""
|
881 |
"Enable if you want to use lazy-loading features for mobile requests to your "
|
882 |
"site."
|
@@ -885,12 +853,12 @@ msgstr ""
|
|
885 |
"tuo sito."
|
886 |
|
887 |
#. src-js/components/tabs/image-optimization/index.jsx:377
|
888 |
-
#:
|
889 |
msgid "Lazy Load Product Images"
|
890 |
msgstr "LazyLoad immagini prodotto"
|
891 |
|
892 |
#. src-js/components/tabs/image-optimization/index.jsx:410
|
893 |
-
#:
|
894 |
msgid ""
|
895 |
"Enable if you want to enable lazy-load images in your store, product and "
|
896 |
"other WooCommerce pages."
|
@@ -899,12 +867,12 @@ msgstr ""
|
|
899 |
"nelle altre pagine WooCommerce."
|
900 |
|
901 |
#. src-js/components/tabs/image-optimization/index.jsx:279
|
902 |
-
#:
|
903 |
msgid "Exclude from Lazy Load"
|
904 |
msgstr "Escludi da Lazy Load"
|
905 |
|
906 |
#. src-js/components/tabs/image-optimization/index.jsx:288
|
907 |
-
#:
|
908 |
msgid ""
|
909 |
"In order to exclude images from lazy loading, please add their CSS classes "
|
910 |
"to the exclusion list. Add each CSS class on a separate line."
|
@@ -912,13 +880,85 @@ msgstr ""
|
|
912 |
"Per escludere le immagini dal Lazy Load, aggiungi le loro classi CSS "
|
913 |
"all'elenco di esclusione. Aggiungi ogni classe CSS su una riga separata."
|
914 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
915 |
#. src-js/components/tabs/multisite-control/index.jsx:209
|
916 |
-
#:
|
917 |
msgid "SUPERCACHER SETTINGS"
|
918 |
msgstr "IMPOSTAZIONI SUPERCACHER"
|
919 |
|
920 |
#. src-js/components/tabs/multisite-control/index.jsx:304
|
921 |
-
#:
|
922 |
msgid ""
|
923 |
"Select whether new sites should have the Dynamic Caching enabled for them or "
|
924 |
"not."
|
@@ -926,17 +966,17 @@ msgstr ""
|
|
926 |
"Seleziona se i nuovi siti devono avere abilitata o meno la Cache Dinamica."
|
927 |
|
928 |
#. src-js/components/tabs/sites-control/index.jsx:103
|
929 |
-
#:
|
930 |
msgid "ENVIRONMENT OPTIMIZATION"
|
931 |
msgstr "OTTIMIZZAZIONE DELL’AMBIENTE"
|
932 |
|
933 |
#. src-js/components/tabs/sites-control/index.jsx:208
|
934 |
-
#:
|
935 |
msgid "FRONTEND OPTIMIZATION"
|
936 |
msgstr "OTTIMIZZAZIONE FRONTEND"
|
937 |
|
938 |
#. src-js/components/tabs/frontend-optimization/index.jsx:32
|
939 |
-
#:
|
940 |
msgid ""
|
941 |
"Removes unnecessary characters from your HTML output saving data and "
|
942 |
"improving your site speed."
|
@@ -945,7 +985,7 @@ msgstr ""
|
|
945 |
"migliorando la velocità del tuo sito."
|
946 |
|
947 |
#. src-js/components/tabs/frontend-optimization/index.jsx:65
|
948 |
-
#:
|
949 |
msgid ""
|
950 |
"Combine and minify your JavaScript files in order to reduce their size, "
|
951 |
"improve cachability, and reduce the number of requests to the server."
|
@@ -955,13 +995,13 @@ msgstr ""
|
|
955 |
|
956 |
#. src-js/components/tabs/frontend-optimization/index.jsx:77
|
957 |
#. src-js/components/tabs/sites-control/index.jsx:296
|
958 |
-
#:
|
959 |
msgid "Load Render-blocking JavaScript Files Asynchronously"
|
960 |
msgstr "Carica in modo asincrono i file JavaScript che bloccano il rendering"
|
961 |
|
962 |
#. src-js/components/tabs/frontend-optimization/index.jsx:107
|
963 |
#. src-js/components/tabs/sites-control/index.jsx:326
|
964 |
-
#:
|
965 |
msgid ""
|
966 |
"Add async parameter to the JavaScript files loaded in the header section of "
|
967 |
"your site so they don’t block your page rendering."
|
@@ -970,7 +1010,7 @@ msgstr ""
|
|
970 |
"tuo sito, in modo che non blocchino il rendering della pagina."
|
971 |
|
972 |
#. src-js/components/tabs/frontend-optimization/index.jsx:99
|
973 |
-
#:
|
974 |
msgid ""
|
975 |
"Combine and minify your CSS files in order to reduce their size, improve "
|
976 |
"cachability, and reduce the number of requests to the server."
|
@@ -980,7 +1020,7 @@ msgstr ""
|
|
980 |
|
981 |
#. src-js/components/tabs/frontend-optimization/index.jsx:179
|
982 |
#. src-js/components/tabs/sites-control/index.jsx:392
|
983 |
-
#:
|
984 |
msgid ""
|
985 |
"Combine multiple CSS files into one to lower the number of requests your "
|
986 |
"site generates."
|
@@ -989,24 +1029,25 @@ msgstr ""
|
|
989 |
"tuo sito."
|
990 |
|
991 |
#. src-js/components/tabs/sites-control/index.jsx:395
|
992 |
-
#:
|
993 |
msgid "IMAGE OPTIMIZATION"
|
994 |
msgstr "OTTIMIZZAZIONE IMMAGINI"
|
995 |
|
996 |
#. src-js/components/tabs/sites-control/index.jsx:425
|
997 |
-
#:
|
|
|
998 |
msgid "Image Optimization"
|
999 |
msgstr "Ottimizzazione Immagini"
|
1000 |
|
1001 |
#. Page title.
|
1002 |
#. Name of the plugin
|
1003 |
-
#:
|
1004 |
#: core/Admin/Admin.php:240
|
1005 |
msgid "SG Optimizer"
|
1006 |
msgstr "SG Optimizer"
|
1007 |
|
1008 |
#. src-js/containers/main/index.jsx:136
|
1009 |
-
#:
|
1010 |
msgid ""
|
1011 |
"Get the best performance for your WordPress website with our optimization "
|
1012 |
"plugin. It handles caching, system settings, and all the necessary "
|
@@ -1020,12 +1061,12 @@ msgstr ""
|
|
1020 |
"hosting!"
|
1021 |
|
1022 |
#. src-js/containers/main/index.jsx:38
|
1023 |
-
#:
|
1024 |
msgid "Old PHP Version"
|
1025 |
msgstr "Versione PHP precedente"
|
1026 |
|
1027 |
#. src-js/containers/php-checker/index.jsx:167
|
1028 |
-
#:
|
1029 |
msgid ""
|
1030 |
"You are using our Managed PHP service, which means that SiteGround will "
|
1031 |
"automatically update your PHP once we are sure there is a newer stable one, "
|
@@ -1043,7 +1084,7 @@ msgstr ""
|
|
1043 |
"manualmente."
|
1044 |
|
1045 |
#. src-js/containers/php-checker/index.jsx:143
|
1046 |
-
#:
|
1047 |
msgid ""
|
1048 |
"Your site will keep using that version until you manually change it from "
|
1049 |
"this interface or until you switch to \"Managed PHP\" service. If you choose "
|
@@ -1059,7 +1100,7 @@ msgstr ""
|
|
1059 |
"sicurezza e prestazioni."
|
1060 |
|
1061 |
#. src-js/containers/php-checker/index.jsx:179
|
1062 |
-
#:
|
1063 |
msgid ""
|
1064 |
"As a SiteGround client you may change your PHP version per site manually. "
|
1065 |
"However, we strongly recommend you to take advantage of our Managed PHP "
|
@@ -1079,48 +1120,49 @@ msgstr ""
|
|
1079 |
"WordPress fino a quando non la cambierai di nuovo manualmente."
|
1080 |
|
1081 |
#. src-js/containers/php-checker/index.jsx:184
|
1082 |
-
#:
|
1083 |
msgid "Set your PHP version"
|
1084 |
msgstr "Imposta la tua versione di PHP"
|
1085 |
|
1086 |
#. src-js/containers/php-checker/index.jsx:205
|
1087 |
-
#:
|
1088 |
msgid "You are currently running on PHP %(version)s."
|
1089 |
msgstr "Attualmente stai utilizzando PHP %(version)s."
|
1090 |
|
1091 |
#. src-js/containers/php-checker/index.jsx:210
|
1092 |
-
#:
|
1093 |
msgid "PHP Management Method"
|
1094 |
msgstr "PHP Gestito"
|
1095 |
|
1096 |
#. src-js/containers/php-checker/index.jsx:226
|
1097 |
-
#:
|
1098 |
msgid "Please select method"
|
1099 |
msgstr "Seleziona il metodo"
|
1100 |
|
1101 |
#. src-js/containers/php-checker/index.jsx:227
|
1102 |
-
#:
|
1103 |
msgid "Please select management type"
|
1104 |
msgstr "Seleziona il tipo di gestione"
|
1105 |
|
1106 |
#. src-js/containers/php-checker/index.jsx:222
|
1107 |
-
#:
|
1108 |
msgid "PHP Version"
|
1109 |
msgstr "Versione PHP"
|
1110 |
|
1111 |
#. src-js/containers/php-checker/index.jsx:242
|
1112 |
#. src-js/containers/php-checker/index.jsx:243
|
1113 |
-
#:
|
|
|
1114 |
msgid "Please select PHP version"
|
1115 |
msgstr "Seleziona la versione PHP"
|
1116 |
|
1117 |
#. src-js/containers/php-checker/index.jsx:248
|
1118 |
-
#:
|
1119 |
msgid "Save"
|
1120 |
msgstr "Salva"
|
1121 |
|
1122 |
#. src-js/containers/php-checker/index.jsx:262
|
1123 |
-
#:
|
1124 |
msgid ""
|
1125 |
"We currently recommend you to use PHP %(version)s. You can check the "
|
1126 |
"compatibility with the recommended version before you switch. {{link}}Check "
|
@@ -1131,7 +1173,7 @@ msgstr ""
|
|
1131 |
"raccomandata. {{link}}Verifica compatibilità{{/link}}"
|
1132 |
|
1133 |
#. src-js/containers/php-checker/index.jsx:286
|
1134 |
-
#:
|
1135 |
msgid ""
|
1136 |
"All your plugins are compatible with PHP %(version)s. You may safely switch "
|
1137 |
"to “Managed PHP” service and we’ll upgrade it automatically, or set it "
|
@@ -1143,12 +1185,12 @@ msgstr ""
|
|
1143 |
"ancora{{/link}}"
|
1144 |
|
1145 |
#. src-js/containers/php-checker/index.jsx:302
|
1146 |
-
#:
|
1147 |
msgid "Checking PHP 7.1 Compatibility..."
|
1148 |
msgstr "erifica in corso della compatibilità con PHP %(version)s..."
|
1149 |
|
1150 |
#. src-js/containers/php-checker/index.jsx:322
|
1151 |
-
#:
|
1152 |
msgid ""
|
1153 |
"Unfortunately some of your plugins or theme are not compatible with our "
|
1154 |
"recommended version. {{link}}Check Again{{/link}}"
|
@@ -1157,17 +1199,17 @@ msgstr ""
|
|
1157 |
"raccomandata. {{link}}Controlla ancora{{/link}}"
|
1158 |
|
1159 |
#. src-js/containers/php-checker/index.jsx:352
|
1160 |
-
#:
|
1161 |
msgid "Thanks for using SG Optimizer to make your site faster!"
|
1162 |
msgstr "Grazie per utilizzare SG Optimizer per rendere il tuo sito più veloce!"
|
1163 |
|
1164 |
#. src-js/containers/rating/index.jsx:53
|
1165 |
-
#:
|
1166 |
msgid "Help more people optimize their sites by rating our plugin."
|
1167 |
msgstr "Aiuta più persone a ottimizzare i loro siti, vota il nostro plugin."
|
1168 |
|
1169 |
#. src-js/containers/rating/index.jsx:60
|
1170 |
-
#:
|
1171 |
msgid "Don’t Show This Again"
|
1172 |
msgstr "Non mostrare più"
|
1173 |
|
@@ -1600,10 +1642,8 @@ msgid "Awesome! You have worked hard."
|
|
1600 |
msgstr "Fantastico! Hai lavorato bene."
|
1601 |
|
1602 |
#: core/Analysis/Analysis.php:334
|
1603 |
-
msgid "
|
1604 |
-
msgstr ""
|
1605 |
-
"Stai andando davvero bene, ma ti suggeriamo di vedere i nostri consigli qui "
|
1606 |
-
"sotto."
|
1607 |
|
1608 |
#: core/Admin/Admin_Bar.php:33 core/Admin/Admin.php:303
|
1609 |
msgid "Purge SG Cache"
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: SG Optimizer\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2020-01-16 13:10+0000\n"
|
6 |
+
"PO-Revision-Date: 2020-01-16 13:10+0000\n"
|
7 |
"Last-Translator: admin <nobody@exmaple.com>\n"
|
8 |
+
"Language-Team: Italian\n"
|
9 |
"Language: it_IT\n"
|
10 |
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
11 |
"MIME-Version: 1.0\n"
|
16 |
"X-Loco-Parser: loco_parse_po\n"
|
17 |
"X-Loco-Version: 2.3.0; wp-5.3"
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
#. src-js/components/dialogs/images-dialog.jsx:17
|
20 |
#. src-js/components/dialogs/php-dialog.jsx:17
|
21 |
#. src-js/components/dialogs/ssl-dialog.jsx:17
|
22 |
+
#: helpers/sg-cachepress-react-strings.php:4
|
23 |
+
#: helpers/sg-cachepress-react-strings.php:12
|
24 |
+
#: helpers/sg-cachepress-react-strings.php:15
|
25 |
+
#: helpers/sg-cachepress-react-strings.php:19
|
26 |
+
#: helpers/sg-cachepress-react-strings.php:22
|
27 |
msgid "Confirm"
|
28 |
msgstr "Conferma"
|
29 |
|
30 |
#. src-js/components/dialogs/async-dialog.tsx:18
|
31 |
+
#: helpers/sg-cachepress-react-strings.php:5
|
32 |
msgid ""
|
33 |
"Defering render-blocking JavaScript may cause issues with scripts that "
|
34 |
"require certain order of execution. This is why we advise you to check the "
|
40 |
"aver abilitato questa ottimizzazione."
|
41 |
|
42 |
#. src-js/components/dialogs/async-dialog.tsx:29
|
43 |
+
#: helpers/sg-cachepress-react-strings.php:6
|
44 |
msgid ""
|
45 |
"If you notice issues with certain functionality, use the Exclude "
|
46 |
"functionality to keep those scripts loading in a render-blocking manner."
|
50 |
"visualizzazione."
|
51 |
|
52 |
#. src-js/components/dialogs/ssl-dialog.jsx:35
|
53 |
+
#: helpers/sg-cachepress-react-strings.php:7
|
54 |
+
#: helpers/sg-cachepress-react-strings.php:24
|
55 |
msgid "Close"
|
56 |
msgstr "Chiudi"
|
57 |
|
58 |
#. src-js/components/dialogs/cache-dialog.jsx:17
|
59 |
+
#: helpers/sg-cachepress-react-strings.php:8
|
60 |
msgid ""
|
61 |
"Purge your installation's entire Dynamic Cache or select parts in order to "
|
62 |
"achieve the best hit-to-cache ratio for your account. Here are the plugin's "
|
67 |
"il tuo account. Ecco le regole di pulizia cache del plugin:"
|
68 |
|
69 |
#. src-js/components/dialogs/cache-dialog.jsx:29
|
70 |
+
#: helpers/sg-cachepress-react-strings.php:9
|
71 |
msgid ""
|
72 |
"Full Purge on page, posts, and category deletion, plugin and theme "
|
73 |
"activation, deactivation, or update, and on WordPress core updates."
|
77 |
"WordPress."
|
78 |
|
79 |
#. src-js/components/dialogs/cache-dialog.jsx:38
|
80 |
+
#: helpers/sg-cachepress-react-strings.php:10
|
81 |
msgid ""
|
82 |
"Specific URL Purge on comment actions and page, post, and category updates."
|
83 |
msgstr ""
|
87 |
#. src-js/components/dialogs/cache-dialog.jsx:48
|
88 |
#. src-js/components/dialogs/images-dialog.jsx:35
|
89 |
#. src-js/components/dialogs/php-dialog.jsx:36
|
90 |
+
#: helpers/sg-cachepress-react-strings.php:11
|
91 |
+
#: helpers/sg-cachepress-react-strings.php:14
|
92 |
+
#: helpers/sg-cachepress-react-strings.php:18
|
93 |
+
#: helpers/sg-cachepress-react-strings.php:21
|
94 |
msgid "Cancel"
|
95 |
msgstr "Annulla"
|
96 |
|
97 |
#. src-js/components/dialogs/delete-webp-dialog.tsx:23
|
98 |
+
#: helpers/sg-cachepress-react-strings.php:13
|
99 |
msgid ""
|
100 |
"This will delete all WebP files in your uploads folder! In case you need "
|
101 |
"them, you will have to regenerate them again or restore that folder from a "
|
106 |
"backup."
|
107 |
|
108 |
#. src-js/components/dialogs/php-dialog.jsx:23
|
109 |
+
#: helpers/sg-cachepress-react-strings.php:16
|
110 |
msgid ""
|
111 |
"You’re switching to PHP %(version)s manually and you will stay on that "
|
112 |
"version until you change it to a newer one. In case you experience any "
|
119 |
"cPanel{{/strong}} > {{strong}}Gestione versione PHP{{/strong}}."
|
120 |
|
121 |
#. src-js/components/dialogs/php-dialog.jsx:37
|
122 |
+
#: helpers/sg-cachepress-react-strings.php:17
|
123 |
msgid ""
|
124 |
"You’re about to switch to Managed PHP service. This means that SiteGround "
|
125 |
"will automatically update your PHP version once we are sure there’s a better,"
|
130 |
"sia disponibile una nuova versione più sicura e stabile."
|
131 |
|
132 |
#. src-js/components/dialogs/regenerate-webp-dialog.tsx:23
|
133 |
+
#: helpers/sg-cachepress-react-strings.php:20
|
134 |
msgid ""
|
135 |
"Doing this will delete all WebP files in your uploads folder and generate "
|
136 |
"them anew!"
|
139 |
"caricamenti e generati di nuovo!"
|
140 |
|
141 |
#. src-js/components/dialogs/ssl-dialog.jsx:23
|
142 |
+
#: helpers/sg-cachepress-react-strings.php:23
|
143 |
msgid ""
|
144 |
"In order to force HTTPS on your site, we will automatically update your "
|
145 |
"database replacing all insecure links. In addition to that, we will add a "
|
152 |
"attraverso la connessione crittografata."
|
153 |
|
154 |
#. src-js/components/dialogs/urls-dialog.jsx:17
|
155 |
+
#: helpers/sg-cachepress-react-strings.php:25
|
156 |
msgid ""
|
157 |
"You can exclude full or partial URLs using \"*\" as a wildcard. For example:"
|
158 |
msgstr ""
|
160 |
"jolly. Per esempio:"
|
161 |
|
162 |
#. src-js/components/dialogs/urls-dialog.jsx:29
|
163 |
+
#: helpers/sg-cachepress-react-strings.php:26
|
164 |
msgid ""
|
165 |
"{{strong}}www.site.com/parent-page/sub-page{{/strong}} will exclude only "
|
166 |
"that single URL."
|
169 |
"singolo URL."
|
170 |
|
171 |
#. src-js/components/dialogs/urls-dialog.jsx:38
|
172 |
+
#: helpers/sg-cachepress-react-strings.php:27
|
173 |
msgid ""
|
174 |
"{{strong}}www.site.com/parent-page/*{{/strong}} will exclude all sub-pages "
|
175 |
"of \"parent-page\"."
|
177 |
"{{strong}}www.site.com/parent-page/*{{/strong}} escluderà tutte le "
|
178 |
"sottopagine della \"parent page\"."
|
179 |
|
180 |
+
#. src-js/components/tabs/supercacher/index.jsx:364
|
181 |
+
#: helpers/sg-cachepress-react-strings.php:28
|
182 |
+
msgid "Test URLs for Cache Status"
|
183 |
+
msgstr "Verifica gli URL per lo stato della Cache"
|
184 |
+
|
185 |
+
#. src-js/components/tabs/supercacher/index.jsx:396
|
186 |
+
#: helpers/sg-cachepress-react-strings.php:29
|
187 |
+
msgid ""
|
188 |
+
"Check if the Dynamic Cache is working on a certain URL. Especially useful to "
|
189 |
+
"make sure your Exclude list is working the way it should."
|
190 |
+
msgstr ""
|
191 |
+
"Controlla se la Cache Dinamica funziona su un determinato URL. "
|
192 |
+
"Particolarmente utile per assicurarti che la tua lista di esclusione "
|
193 |
+
"funzioni come dovrebbe."
|
194 |
+
|
195 |
+
#. src-js/components/tabs/supercacher/index.jsx:399
|
196 |
+
#: helpers/sg-cachepress-react-strings.php:30
|
197 |
+
msgid "Test"
|
198 |
+
msgstr "Verifica"
|
199 |
+
|
200 |
#. src-js/components/exclude/index.jsx:142
|
201 |
+
#: helpers/sg-cachepress-react-strings.php:31
|
202 |
msgid "This item already exists in exclude list."
|
203 |
msgstr "Questo elemento esiste già nell'elenco di esclusione."
|
204 |
|
205 |
#. src-js/components/exclude/simple-exclude.jsx:44
|
206 |
+
#: helpers/sg-cachepress-react-strings.php:32
|
207 |
msgid "You must input a class name."
|
208 |
msgstr "Devi introdurre un nome di classe."
|
209 |
|
210 |
#. src-js/components/tabs/supercacher/index.jsx:338
|
211 |
+
#: helpers/sg-cachepress-react-strings.php:33
|
212 |
+
#: helpers/sg-cachepress-react-strings.php:35
|
213 |
msgid "Exclude"
|
214 |
msgstr "Escludi"
|
215 |
|
216 |
#. src-js/components/tabs/image-optimization/index.jsx:318
|
217 |
+
#: helpers/sg-cachepress-react-strings.php:34
|
218 |
msgid "This URL already exists in exclude list."
|
219 |
msgstr "Questo URL esiste già nell'elenco di esclusione."
|
220 |
|
221 |
#. src-js/components/dialogs/urls-dialog.tsx:54
|
222 |
#. src-js/components/loaders/image-loader.tsx:59
|
223 |
+
#: helpers/sg-cachepress-react-strings.php:36
|
224 |
+
#: helpers/sg-cachepress-react-strings.php:39
|
225 |
msgid "Please be patient, this process may take some time"
|
226 |
msgstr ""
|
227 |
"Ti preghiamo di attendere, questo processo potrebbe richiedere del tempo"
|
228 |
|
229 |
#. src-js/components/loaders/image-loader.tsx:31
|
230 |
+
#: helpers/sg-cachepress-react-strings.php:37
|
231 |
msgid "Optimized %(optimized)s of %(total)s images"
|
232 |
msgstr "%(optimized)s immagini su %(total)s sono state ottimizzate"
|
233 |
|
234 |
#. src-js/components/loaders/image-loader.tsx:35
|
235 |
#. src-js/components/loaders/webp-loader.tsx:31
|
236 |
+
#: helpers/sg-cachepress-react-strings.php:38
|
237 |
+
#: helpers/sg-cachepress-react-strings.php:41
|
238 |
msgid "Pause"
|
239 |
msgstr "Pausa"
|
240 |
|
241 |
#. src-js/components/loaders/webp-loader.tsx:27
|
242 |
+
#: helpers/sg-cachepress-react-strings.php:40
|
243 |
msgid "Generated %(optimized)s of %(total)s webp copies"
|
244 |
msgstr "Genera %(optimized)s di %(total)s copie WebP"
|
245 |
|
246 |
#. src-js/components/loaders/webp-loader.tsx:55
|
247 |
+
#: helpers/sg-cachepress-react-strings.php:42
|
248 |
msgid "Generate WebP Copies of New Images"
|
249 |
msgstr "Genera copie WebP delle nuove immagini"
|
250 |
|
251 |
#. src-js/components/webp/webp.tsx:118
|
252 |
+
#: helpers/sg-cachepress-react-strings.php:43
|
253 |
msgid ""
|
254 |
"WebP is a next generation image format supported by modern browers which "
|
255 |
"greatly reduces the size of your images."
|
258 |
"moderni che riduce notevolmente le dimensioni delle immagini."
|
259 |
|
260 |
#. src-js/components/webp/webp.tsx:122
|
261 |
+
#: helpers/sg-cachepress-react-strings.php:44
|
262 |
msgid "Manage WebP Copies for Existing Images"
|
263 |
msgstr "Gestisci copie WebP per le immagini esistenti"
|
264 |
|
265 |
#. src-js/components/webp/webp.tsx:139
|
266 |
+
#: helpers/sg-cachepress-react-strings.php:45
|
267 |
msgid "Generate or delete a WebP copy of your existing media library."
|
268 |
msgstr "Genera o elimina una copia WebP della tua libreria multimediale."
|
269 |
|
270 |
#. src-js/components/webp/webp.tsx:142
|
271 |
+
#: helpers/sg-cachepress-react-strings.php:46
|
272 |
msgid "Delete all WebP Files"
|
273 |
msgstr "Elimina tutti i file WebP"
|
274 |
|
275 |
#. src-js/components/webp/webp.tsx:160
|
276 |
+
#: helpers/sg-cachepress-react-strings.php:47
|
277 |
msgid "Bulk Generate WebP Files"
|
278 |
msgstr "Genera file WebP in blocco"
|
279 |
|
280 |
#. src-js/components/webp/webp.tsx:176
|
281 |
+
#: helpers/sg-cachepress-react-strings.php:48
|
282 |
msgid ""
|
283 |
"All WebP copies of your files have been generated successfully! Force {{link}"
|
284 |
"}re-generation{{/link}} of your images."
|
287 |
"la {{link}}ri-generazione{{/link}} delle tue immagini."
|
288 |
|
289 |
#. src-js/components/tabs/environment-optimization/index.jsx:216
|
290 |
+
#: helpers/sg-cachepress-react-strings.php:49
|
291 |
+
#: helpers/sg-cachepress-react-strings.php:51 core/Options/Options.php:385
|
292 |
msgid "Browser Caching"
|
293 |
msgstr "Cache del browser"
|
294 |
|
295 |
#. src-js/components/tabs/environment-optimization/index.jsx:246
|
296 |
+
#: helpers/sg-cachepress-react-strings.php:50
|
297 |
msgid ""
|
298 |
"Adds rules to store in your visitors browser cache to keep static content "
|
299 |
"longer for better site performance."
|
303 |
"prestazioni del sito."
|
304 |
|
305 |
#. src-js/components/modules/gzip/index.jsx:35
|
306 |
+
#: helpers/sg-cachepress-react-strings.php:52
|
307 |
+
#: helpers/sg-cachepress-react-strings.php:75
|
308 |
msgid "YOU HAVE A SITE TOOLS ACCOUNT"
|
309 |
msgstr "HAI UN ACCOUNT SITE TOOLS"
|
310 |
|
311 |
#. src-js/components/modules/browser-cache/index.tsx:38
|
312 |
+
#: helpers/sg-cachepress-react-strings.php:53
|
313 |
msgid ""
|
314 |
"NGINX Direct Delivery takes care of your static resources including proper "
|
315 |
"expiration dates for your browser caching."
|
319 |
|
320 |
#. src-js/components/tabs/multisite-control/index.jsx:277
|
321 |
#. src-js/components/tabs/supercacher/index.jsx:160
|
322 |
+
#: helpers/sg-cachepress-react-strings.php:54
|
323 |
+
#: helpers/sg-cachepress-react-strings.php:147
|
324 |
msgid "Dynamic Caching"
|
325 |
msgstr "Caching Dinamico"
|
326 |
|
327 |
#. src-js/components/tabs/supercacher/index.jsx:218
|
328 |
+
#: helpers/sg-cachepress-react-strings.php:55
|
329 |
msgid ""
|
330 |
"Store your content in the server’s memory for a faster access with this full-"
|
331 |
"page caching solution powered by NGINX."
|
334 |
" con questa soluzione di caching full-page di NGINX."
|
335 |
|
336 |
#. src-js/components/tabs/supercacher/index.jsx:221
|
337 |
+
#: helpers/sg-cachepress-react-strings.php:56
|
338 |
msgid "Manual Cache Purge"
|
339 |
msgstr "Pulizia manuale della Cache"
|
340 |
|
341 |
#. src-js/components/tabs/supercacher/index.jsx:264
|
342 |
+
#: helpers/sg-cachepress-react-strings.php:57
|
343 |
msgid "Clear the Dynamic Cache for your entire website."
|
344 |
msgstr "Pulisce la Cache Dinamica di tutto il sito."
|
345 |
|
346 |
#. src-js/components/modules/dynamic-cache/index.jsx:234
|
347 |
+
#: helpers/sg-cachepress-react-strings.php:58
|
348 |
msgid "Purge Cache"
|
349 |
msgstr "Svuotare cache"
|
350 |
|
351 |
#. src-js/components/modules/dynamic-cache/index.jsx:247
|
352 |
+
#: helpers/sg-cachepress-react-strings.php:59
|
353 |
msgid "Purging ..."
|
354 |
msgstr "Svuotamento ..."
|
355 |
|
356 |
#. src-js/components/tabs/supercacher/index.jsx:267
|
357 |
+
#: helpers/sg-cachepress-react-strings.php:60
|
358 |
+
#: helpers/sg-cachepress-react-strings.php:149
|
359 |
msgid "Automatic Cache Purge"
|
360 |
msgstr "Pulizia automatica della cache"
|
361 |
|
362 |
#. src-js/components/tabs/supercacher/index.jsx:299
|
363 |
+
#: helpers/sg-cachepress-react-strings.php:61
|
364 |
+
#: helpers/sg-cachepress-react-strings.php:150
|
365 |
msgid ""
|
366 |
"Automatically perform a smart cache purge after every content modification."
|
367 |
msgstr ""
|
369 |
"modifica del contenuto."
|
370 |
|
371 |
#. src-js/components/tabs/supercacher/index.jsx:302
|
372 |
+
#: helpers/sg-cachepress-react-strings.php:62
|
373 |
msgid "See rules"
|
374 |
msgstr "Vedi le regole"
|
375 |
|
376 |
+
#: helpers/sg-cachepress-react-strings.php:63 core/Options/Options.php:380
|
377 |
msgid "Browser-Specific Caching"
|
378 |
msgstr "Cache specifica per il browser"
|
379 |
|
380 |
#. src-js/components/modules/dynamic-cache/index.jsx:133
|
381 |
+
#: helpers/sg-cachepress-react-strings.php:64
|
382 |
msgid ""
|
383 |
"We recommend you to enable this feature {{strong}}only{{/strong}} if you’re "
|
384 |
"experiencing issues with plugins, generating mobile version of your site or "
|
391 |
"generata separatamente per diversi browser, il che ne riduce l'efficienza."
|
392 |
|
393 |
#. src-js/components/tabs/supercacher/index.jsx:305
|
394 |
+
#: helpers/sg-cachepress-react-strings.php:65
|
395 |
msgid "Excluding URLs"
|
396 |
msgstr "Escludo gli URL"
|
397 |
|
398 |
#. src-js/components/tabs/supercacher/index.jsx:332
|
399 |
+
#: helpers/sg-cachepress-react-strings.php:66
|
400 |
msgid ""
|
401 |
"Use this feature if you want to exclude certain parts of your website from "
|
402 |
"being cached and keep them dynamic."
|
405 |
"dalla cache e mantenerle dinamiche."
|
406 |
|
407 |
#. src-js/components/tabs/supercacher/index.jsx:335
|
408 |
+
#: helpers/sg-cachepress-react-strings.php:67
|
409 |
msgid "See examples"
|
410 |
msgstr "Vedi gli esempi"
|
411 |
|
412 |
#. src-js/components/modules/gzip/index.jsx:12
|
413 |
+
#: helpers/sg-cachepress-react-strings.php:68
|
414 |
+
#: helpers/sg-cachepress-react-strings.php:69
|
415 |
msgid "Memcached Stopped. Please, enable it in your SiteGround control panel."
|
416 |
msgstr "Memcached bloccato. Attivalo nel pannello di controllo di SiteGround."
|
417 |
|
418 |
#. src-js/components/tabs/supercacher/index.jsx:426
|
419 |
+
#: helpers/sg-cachepress-react-strings.php:70
|
420 |
msgid "Memcached"
|
421 |
msgstr "Memcached"
|
422 |
|
423 |
#. src-js/components/tabs/supercacher/index.jsx:454
|
424 |
+
#: helpers/sg-cachepress-react-strings.php:71
|
425 |
msgid ""
|
426 |
"Powerful object caching for your site. It stores frequently executed queries "
|
427 |
"to your databases and reuses them for better performance."
|
430 |
"frequentemente sui tuoi database e li riutilizza per prestazioni migliori."
|
431 |
|
432 |
#. src-js/components/tabs/environment-optimization/index.jsx:157
|
433 |
+
#: helpers/sg-cachepress-react-strings.php:72
|
434 |
+
#: helpers/sg-cachepress-react-strings.php:74 core/Options/Options.php:384
|
435 |
msgid "GZIP Compression"
|
436 |
msgstr "Compressione GZIP"
|
437 |
|
438 |
#. src-js/components/tabs/environment-optimization/index.jsx:213
|
439 |
+
#: helpers/sg-cachepress-react-strings.php:73
|
440 |
msgid ""
|
441 |
"Enables a compression of the content that's delivered to your visitors "
|
442 |
"browsers improving the network loading times of your site."
|
445 |
"visitatori, migliorando i tempi di caricamento della rete del tuo sito."
|
446 |
|
447 |
#. src-js/components/modules/gzip/index.jsx:40
|
448 |
+
#: helpers/sg-cachepress-react-strings.php:76
|
449 |
msgid ""
|
450 |
"GZIP Compression is enabled by default automatically saving you bandwidth "
|
451 |
"and improving the loading speeds of your pages."
|
454 |
"larghezza di banda e migliorare la velocità di caricamento delle tue pagine."
|
455 |
|
456 |
#. src-js/components/modules/memcached/index.tsx:63
|
457 |
+
#: helpers/sg-cachepress-react-strings.php:77
|
458 |
msgid "Score Check"
|
459 |
msgstr "Verifica del punteggio"
|
460 |
|
461 |
#. src-js/components/tabs/analytics/index.tsx:122
|
462 |
+
#: helpers/sg-cachepress-react-strings.php:78
|
463 |
msgid ""
|
464 |
"Test how optimized your website is. Our performance check is powered by "
|
465 |
"Google PageSpeed."
|
468 |
"prestazioni è basato su Google Page Speed."
|
469 |
|
470 |
#. src-js/components/tabs/analytics/index.tsx:125
|
471 |
+
#: helpers/sg-cachepress-react-strings.php:79
|
472 |
msgid "Device Type"
|
473 |
msgstr "Tipo di dispositivo"
|
474 |
|
475 |
#. src-js/components/tabs/analytics/index.tsx:156
|
476 |
+
#: helpers/sg-cachepress-react-strings.php:80
|
477 |
msgid "URL"
|
478 |
msgstr "URL"
|
479 |
|
480 |
#. src-js/components/tabs/analytics/index.jsx:31
|
481 |
+
#: helpers/sg-cachepress-react-strings.php:81
|
482 |
msgid "Analyze"
|
483 |
msgstr "Analizza"
|
484 |
|
485 |
#. src-js/components/tabs/analytics/index.tsx:180
|
486 |
+
#: helpers/sg-cachepress-react-strings.php:82
|
487 |
msgid "Please Wait, We Are Performing a Google PageSpeed Test on Your Page"
|
488 |
msgstr ""
|
489 |
"Ti preghiamo di attendere, stiamo eseguendo un test di Google PageSpeed "
|
490 |
"sulla tua pagina"
|
491 |
|
492 |
#. src-js/components/tabs/analytics/index.tsx:187
|
493 |
+
#: helpers/sg-cachepress-react-strings.php:83
|
494 |
msgid "There is nothing here yet"
|
495 |
msgstr "Non c'è ancora niente qui"
|
496 |
|
497 |
#. src-js/components/php-checker/index.jsx:341
|
498 |
#. src-js/components/tabs/multisite-control/index.jsx:226
|
499 |
+
#: helpers/sg-cachepress-react-strings.php:84
|
500 |
+
#: helpers/sg-cachepress-react-strings.php:152
|
501 |
msgid "Enable HTTPS"
|
502 |
msgstr "Abilita HTTPS"
|
503 |
|
504 |
#. src-js/components/tabs/environment-optimization/index.jsx:109
|
505 |
+
#: helpers/sg-cachepress-react-strings.php:85
|
506 |
+
#: helpers/sg-cachepress-react-strings.php:153
|
507 |
msgid ""
|
508 |
"Configures your site to work correctly via HTTPS and forces a secure "
|
509 |
"connection to your site."
|
512 |
"connessione sicura al tuo sito."
|
513 |
|
514 |
#. src-js/components/tabs/environment-optimization/index.jsx:112
|
515 |
+
#: helpers/sg-cachepress-react-strings.php:86
|
516 |
+
#: helpers/sg-cachepress-react-strings.php:154
|
517 |
msgid "Fix Insecure Content"
|
518 |
msgstr "Sistema i contenuti non sicuri"
|
519 |
|
520 |
#. src-js/components/tabs/environment-optimization/index.jsx:154
|
521 |
+
#: helpers/sg-cachepress-react-strings.php:87
|
522 |
+
#: helpers/sg-cachepress-react-strings.php:155
|
523 |
msgid ""
|
524 |
"Enable this option in case you’re getting insecure content errors on your "
|
525 |
"website. We will dynamically rewrite insecure requests for resources coming "
|
530 |
"inerenti al tuo sito"
|
531 |
|
532 |
#. src-js/components/tabs/environment-optimization/index.jsx:249
|
533 |
+
#: helpers/sg-cachepress-react-strings.php:88
|
534 |
+
#: helpers/sg-cachepress-react-strings.php:157
|
535 |
msgid "Minify the HTML Output"
|
536 |
msgstr "Minifica l'output HTML"
|
537 |
|
538 |
#. src-js/components/tabs/frontend-optimization/index.jsx:71
|
539 |
+
#: helpers/sg-cachepress-react-strings.php:89
|
540 |
msgid ""
|
541 |
"Removes unnecessary characters from your HTML output saving data and "
|
542 |
"improving your site speed. "
|
546 |
|
547 |
#. src-js/components/tabs/frontend-optimization/index.jsx:76
|
548 |
#. src-js/components/tabs/frontend-optimization/index.jsx:81
|
549 |
+
#: helpers/sg-cachepress-react-strings.php:90
|
550 |
+
#: helpers/sg-cachepress-react-strings.php:91
|
551 |
msgid "Exclude URLs from HTML Minification"
|
552 |
msgstr "Escludi gli URL dalla minificazione HTML"
|
553 |
|
554 |
#. src-js/components/tabs/frontend-optimization/index.jsx:101
|
555 |
+
#: helpers/sg-cachepress-react-strings.php:92
|
556 |
msgid ""
|
557 |
"With this functionality, you can exclude different pages from HTML "
|
558 |
"minification."
|
561 |
"minificazione HTML."
|
562 |
|
563 |
#. src-js/components/tabs/frontend-optimization/index.jsx:35
|
564 |
+
#: helpers/sg-cachepress-react-strings.php:93
|
565 |
+
#: helpers/sg-cachepress-react-strings.php:159
|
566 |
msgid "Minify JavaScript Files"
|
567 |
msgstr "Minifica i file JavaScript"
|
568 |
|
569 |
#. src-js/components/tabs/frontend-optimization/index.jsx:118
|
570 |
+
#: helpers/sg-cachepress-react-strings.php:94
|
571 |
msgid ""
|
572 |
"Minify your JavaScript files in order to reduce their size and reduce the "
|
573 |
"number of requests to the server. "
|
576 |
"richieste al server."
|
577 |
|
578 |
#. src-js/components/tabs/frontend-optimization/index.jsx:123
|
579 |
+
#: helpers/sg-cachepress-react-strings.php:95
|
580 |
msgid "Exclude from JavaScript Minification"
|
581 |
msgstr "Escludi dalla minimizzazione JavaScript"
|
582 |
|
583 |
#. src-js/components/tabs/frontend-optimization/index.jsx:128
|
584 |
+
#: helpers/sg-cachepress-react-strings.php:96 core/Options/Options.php:388
|
585 |
msgid "Defer Render-blocking JS"
|
586 |
msgstr "Rinvia il blocco di visualizzazione JS"
|
587 |
|
588 |
#. src-js/components/tabs/frontend-optimization/index.jsx:160
|
589 |
+
#: helpers/sg-cachepress-react-strings.php:97
|
590 |
msgid ""
|
591 |
"Defer loading of render-blocking JavaScript files for faster initial site "
|
592 |
"load. "
|
595 |
"per veocizzare il caricamento inziale del sito."
|
596 |
|
597 |
#. src-js/components/tabs/frontend-optimization/index.jsx:165
|
598 |
+
#: helpers/sg-cachepress-react-strings.php:98
|
599 |
msgid "Exclude from Loading JS Files Asynchronously"
|
600 |
msgstr "Escludi dal caricamento asincrono dei file JS"
|
601 |
|
602 |
#. src-js/components/tabs/frontend-optimization/index.jsx:68
|
603 |
+
#: helpers/sg-cachepress-react-strings.php:99
|
604 |
+
#: helpers/sg-cachepress-react-strings.php:163
|
605 |
msgid "Minify CSS Files"
|
606 |
msgstr "Minifica i file CSS"
|
607 |
|
608 |
#. src-js/components/tabs/frontend-optimization/index.jsx:202
|
609 |
+
#: helpers/sg-cachepress-react-strings.php:100
|
610 |
msgid ""
|
611 |
"Minify your CSS files in order to reduce their size and reduce the number of "
|
612 |
"requests to the server. "
|
615 |
"al server."
|
616 |
|
617 |
#. src-js/components/tabs/frontend-optimization/index.jsx:207
|
618 |
+
#: helpers/sg-cachepress-react-strings.php:101
|
619 |
msgid "Exclude From CSS Minification"
|
620 |
msgstr "Escludi dalla minificazione CSS"
|
621 |
|
622 |
#. src-js/components/tabs/frontend-optimization/index.jsx:149
|
623 |
#. src-js/components/tabs/sites-control/index.jsx:362
|
624 |
+
#: helpers/sg-cachepress-react-strings.php:102
|
625 |
+
#: helpers/sg-cachepress-react-strings.php:165
|
626 |
msgid "Combine CSS Files"
|
627 |
msgstr "Unisci i file CSS"
|
628 |
|
629 |
#. src-js/components/tabs/frontend-optimization/index.jsx:244
|
630 |
+
#: helpers/sg-cachepress-react-strings.php:103
|
631 |
msgid ""
|
632 |
"Combine multiple CSS files into one to lower the number of requests your "
|
633 |
"site generates. "
|
636 |
"tuo sito."
|
637 |
|
638 |
#. src-js/components/tabs/frontend-optimization/index.jsx:249
|
639 |
+
#: helpers/sg-cachepress-react-strings.php:104
|
640 |
msgid "Exclude from CSS Combination"
|
641 |
msgstr "Escludi dalla combinazione CSS"
|
642 |
|
643 |
#. src-js/components/tabs/frontend-optimization/index.jsx:254
|
644 |
+
#: helpers/sg-cachepress-react-strings.php:105
|
645 |
msgid "Optimize Loading of Google Fonts"
|
646 |
msgstr "Ottimizza il caricamento dei font Google"
|
647 |
|
648 |
#. src-js/components/tabs/frontend-optimization/index.jsx:286
|
649 |
+
#: helpers/sg-cachepress-react-strings.php:106
|
650 |
msgid ""
|
651 |
"Combine the loading of Google fonts reducing the number of HTTP requests."
|
652 |
msgstr ""
|
654 |
"\n"
|
655 |
|
656 |
#. src-js/components/tabs/frontend-optimization/index.jsx:102
|
657 |
+
#: helpers/sg-cachepress-react-strings.php:107
|
658 |
+
#: helpers/sg-cachepress-react-strings.php:167
|
659 |
msgid "Remove Query Strings From Static Resources"
|
660 |
msgstr "Rimuovi le stringhe di ricerca dalle risorse statiche"
|
661 |
|
662 |
#. src-js/components/tabs/frontend-optimization/index.jsx:132
|
663 |
+
#: helpers/sg-cachepress-react-strings.php:108
|
664 |
+
#: helpers/sg-cachepress-react-strings.php:168
|
665 |
msgid ""
|
666 |
"Removes version query strings from your static resources improving the "
|
667 |
"caching of those resources."
|
670 |
"memorizzazione nella cache di tali risorse."
|
671 |
|
672 |
#. src-js/components/tabs/frontend-optimization/index.jsx:135
|
673 |
+
#: helpers/sg-cachepress-react-strings.php:109
|
674 |
+
#: helpers/sg-cachepress-react-strings.php:169
|
675 |
msgid "Disable Emojis"
|
676 |
msgstr "Disabilita Emoji"
|
677 |
|
678 |
#. src-js/components/tabs/frontend-optimization/index.jsx:165
|
679 |
+
#: helpers/sg-cachepress-react-strings.php:110
|
680 |
+
#: helpers/sg-cachepress-react-strings.php:170
|
681 |
msgid ""
|
682 |
"Enable to prevent WordPress from automatically detecting and generating "
|
683 |
"emojis in your pages."
|
685 |
"Abilita per impedire a WordPress di rilevare e generare automaticamente "
|
686 |
"emoji nelle tue pagine."
|
687 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
688 |
#. src-js/components/tabs/frontend-optimization/index.jsx:191
|
689 |
+
#: helpers/sg-cachepress-react-strings.php:111 core/Options/Options.php:394
|
690 |
msgid "New Images Optimization"
|
691 |
msgstr "Ottimizzazione nuove immagini"
|
692 |
|
693 |
#. src-js/components/tabs/image-optimization/index.jsx:68
|
694 |
+
#: helpers/sg-cachepress-react-strings.php:112
|
695 |
msgid ""
|
696 |
"We will automatically optimize all new images that you upload to your Media "
|
697 |
"Library."
|
700 |
"Media Library."
|
701 |
|
702 |
#. src-js/components/tabs/image-optimization/index.jsx:71
|
703 |
+
#: helpers/sg-cachepress-react-strings.php:113
|
704 |
msgid "Existing Images Optimization"
|
705 |
msgstr "Ottimizzazione immagini esistenti"
|
706 |
|
707 |
#. src-js/components/tabs/image-optimization/index.jsx:80
|
708 |
+
#: helpers/sg-cachepress-react-strings.php:114
|
709 |
+
#: helpers/sg-cachepress-react-strings.php:173
|
710 |
msgid ""
|
711 |
"We will optimize all your existing images with minimal or no loss in quality."
|
712 |
" Note, that this will overwrite your original images."
|
715 |
"nulla. Tieni presente che questo sovrascriverà le tue immagini originali."
|
716 |
|
717 |
#. src-js/components/tabs/frontend-optimization/index.jsx:191
|
718 |
+
#: helpers/sg-cachepress-react-strings.php:115
|
719 |
msgid "Resume Optimization"
|
720 |
msgstr "Riprendi l’ottimizzazione"
|
721 |
|
722 |
#. src-js/components/tabs/image-optimization/index.jsx:105
|
723 |
+
#: helpers/sg-cachepress-react-strings.php:116
|
724 |
msgid "Start Optimization"
|
725 |
msgstr "Inizio Ottimizzazione"
|
726 |
|
727 |
#. src-js/components/tabs/image-optimization/index.jsx:131
|
728 |
#. src-js/containers/php-checker/index.jsx:212
|
729 |
+
#: helpers/sg-cachepress-react-strings.php:117
|
730 |
+
#: helpers/sg-cachepress-react-strings.php:203
|
731 |
msgid ""
|
732 |
"We've detected that the WordPress cronjob functionality is not working. "
|
733 |
"Please, enable it following the instructions in {{link}}this article{{/link}}"
|
745 |
#. src-js/components/php-checker/index.jsx:223
|
746 |
#. src-js/components/tabs/multisite-control/index.jsx:547
|
747 |
#. src-js/components/tabs/image-optimization/index.jsx:111
|
748 |
+
#: helpers/sg-cachepress-react-strings.php:118
|
749 |
+
#: helpers/sg-cachepress-react-strings.php:204
|
750 |
msgid "https://www.siteground.com/kb/disable-enable-wordpress-cron/"
|
751 |
msgstr ""
|
752 |
"https://it.siteground.com/kb/come-disattivare-abilitare-il-wordpress-cron/"
|
753 |
|
754 |
#. src-js/components/tabs/image-optimization/index.jsx:159
|
755 |
+
#: helpers/sg-cachepress-react-strings.php:119
|
756 |
msgid ""
|
757 |
"All images in your Media Library have been optimized successfully! Force "
|
758 |
"{{link}}re-optimization{{/link}} of your images."
|
761 |
"successo! Forza la {{link}}ri-ottimizzazione{{/link}} delle tue immagini."
|
762 |
|
763 |
#. src-js/components/tabs/image-optimization/index.jsx:148
|
764 |
+
#: helpers/sg-cachepress-react-strings.php:120
|
765 |
+
#: helpers/sg-cachepress-react-strings.php:174
|
766 |
msgid "Lazy Load Images"
|
767 |
msgstr "Lazy Load delle immagini"
|
768 |
|
769 |
#. src-js/components/tabs/image-optimization/index.jsx:168
|
770 |
+
#: helpers/sg-cachepress-react-strings.php:121
|
771 |
+
#: helpers/sg-cachepress-react-strings.php:175
|
772 |
msgid "Load images only when they are visible in the browser"
|
773 |
msgstr "Carica le immagini solo quando sono visibili nel browser"
|
774 |
|
775 |
#. src-js/components/tabs/image-optimization/index.jsx:171
|
776 |
+
#: helpers/sg-cachepress-react-strings.php:122
|
777 |
+
#: helpers/sg-cachepress-react-strings.php:176
|
778 |
msgid "Lazy Load Gravatars"
|
779 |
msgstr "Lazy Load dei Gravatar"
|
780 |
|
781 |
#. src-js/components/tabs/image-optimization/index.jsx:212
|
782 |
+
#: helpers/sg-cachepress-react-strings.php:123
|
783 |
+
#: helpers/sg-cachepress-react-strings.php:177
|
784 |
msgid ""
|
785 |
"When users comment under your posts, WordPress tries to load their avatars "
|
786 |
"from gravatar.com. We recommend lazy-loading them as your users scroll down "
|
792 |
"tua pagina."
|
793 |
|
794 |
#. src-js/components/tabs/image-optimization/index.jsx:215
|
795 |
+
#: helpers/sg-cachepress-react-strings.php:124
|
796 |
+
#: helpers/sg-cachepress-react-strings.php:178
|
797 |
msgid "Lazy Load Thumbnails"
|
798 |
msgstr "Lazy Load delle Thumbnail"
|
799 |
|
800 |
#. src-js/components/tabs/image-optimization/index.jsx:246
|
801 |
+
#: helpers/sg-cachepress-react-strings.php:125
|
802 |
+
#: helpers/sg-cachepress-react-strings.php:179
|
803 |
msgid ""
|
804 |
"Enable if you want to lazy-load the thumbnail sizes of your original images."
|
805 |
msgstr ""
|
807 |
"delle immagini originali."
|
808 |
|
809 |
#. src-js/components/tabs/image-optimization/index.jsx:249
|
810 |
+
#: helpers/sg-cachepress-react-strings.php:126
|
811 |
+
#: helpers/sg-cachepress-react-strings.php:180
|
812 |
msgid "Lazy Load Responsive Images"
|
813 |
msgstr "Lazy Load delle immagini resposive"
|
814 |
|
815 |
#. src-js/components/tabs/image-optimization/index.jsx:280
|
816 |
+
#: helpers/sg-cachepress-react-strings.php:127
|
817 |
+
#: helpers/sg-cachepress-react-strings.php:181
|
818 |
msgid ""
|
819 |
"Certain plugins and themes generate multiple images from a single upload to "
|
820 |
"work better on different devices. Enable if you want to lazy-load these too."
|
824 |
"anche per questi."
|
825 |
|
826 |
#. src-js/components/tabs/image-optimization/index.jsx:283
|
827 |
+
#: helpers/sg-cachepress-react-strings.php:128
|
828 |
+
#: helpers/sg-cachepress-react-strings.php:182
|
829 |
msgid "Lazy Load Widgets"
|
830 |
msgstr "Lazy Load dei widget"
|
831 |
|
832 |
#. src-js/components/tabs/image-optimization/index.jsx:315
|
833 |
+
#: helpers/sg-cachepress-react-strings.php:129
|
834 |
+
#: helpers/sg-cachepress-react-strings.php:183
|
835 |
msgid ""
|
836 |
"Enable this option if you want the images in your widget areas to load only "
|
837 |
"when users reach them. "
|
839 |
"Abilita questa opzione se desideri che le immagini nell'area dei widget "
|
840 |
"vengano caricate solo quando gli utenti le raggiungono."
|
841 |
|
842 |
+
#: helpers/sg-cachepress-react-strings.php:130 core/Options/Options.php:401
|
843 |
msgid "Lazy Load for Mobile"
|
844 |
msgstr "Lazy Load per mobile"
|
845 |
|
846 |
#. src-js/components/tabs/image-optimization/index.jsx:263
|
847 |
+
#: helpers/sg-cachepress-react-strings.php:131
|
848 |
msgid ""
|
849 |
"Enable if you want to use lazy-loading features for mobile requests to your "
|
850 |
"site."
|
853 |
"tuo sito."
|
854 |
|
855 |
#. src-js/components/tabs/image-optimization/index.jsx:377
|
856 |
+
#: helpers/sg-cachepress-react-strings.php:132
|
857 |
msgid "Lazy Load Product Images"
|
858 |
msgstr "LazyLoad immagini prodotto"
|
859 |
|
860 |
#. src-js/components/tabs/image-optimization/index.jsx:410
|
861 |
+
#: helpers/sg-cachepress-react-strings.php:133
|
862 |
msgid ""
|
863 |
"Enable if you want to enable lazy-load images in your store, product and "
|
864 |
"other WooCommerce pages."
|
867 |
"nelle altre pagine WooCommerce."
|
868 |
|
869 |
#. src-js/components/tabs/image-optimization/index.jsx:279
|
870 |
+
#: helpers/sg-cachepress-react-strings.php:134
|
871 |
msgid "Exclude from Lazy Load"
|
872 |
msgstr "Escludi da Lazy Load"
|
873 |
|
874 |
#. src-js/components/tabs/image-optimization/index.jsx:288
|
875 |
+
#: helpers/sg-cachepress-react-strings.php:135
|
876 |
msgid ""
|
877 |
"In order to exclude images from lazy loading, please add their CSS classes "
|
878 |
"to the exclusion list. Add each CSS class on a separate line."
|
880 |
"Per escludere le immagini dal Lazy Load, aggiungi le loro classi CSS "
|
881 |
"all'elenco di esclusione. Aggiungi ogni classe CSS su una riga separata."
|
882 |
|
883 |
+
#. src-js/components/tabs/multisite-control/index.jsx:339
|
884 |
+
#: helpers/sg-cachepress-react-strings.php:136
|
885 |
+
msgid "Site Admin Permissions"
|
886 |
+
msgstr "Autorizzazioni dell'admin del sito"
|
887 |
+
|
888 |
+
#. src-js/components/tabs/multisite-control/index.jsx:372
|
889 |
+
#: helpers/sg-cachepress-react-strings.php:137
|
890 |
+
msgid ""
|
891 |
+
"In this section, set the access permission for admins of separate sites."
|
892 |
+
msgstr ""
|
893 |
+
"In questa sezione imposta i permessi di accesso per gli amministratori di "
|
894 |
+
"siti diversi."
|
895 |
+
|
896 |
+
#. src-js/components/tabs/multisite-control/index.jsx:87
|
897 |
+
#: helpers/sg-cachepress-react-strings.php:138
|
898 |
+
#: helpers/manual-translations.php:2
|
899 |
+
msgid "SuperCacher Settings"
|
900 |
+
msgstr "Impostazioni SuperCacher"
|
901 |
+
|
902 |
+
#. src-js/components/tabs/multisite-control/index.jsx:402
|
903 |
+
#: helpers/sg-cachepress-react-strings.php:139
|
904 |
+
msgid ""
|
905 |
+
"Select whether site admins can access and make changes within the SiteGround "
|
906 |
+
"Optimizer's SuperCacher tab."
|
907 |
+
msgstr ""
|
908 |
+
"Seleziona se gli amministratori del sito possono accedere e apportare "
|
909 |
+
"modifiche all'interno della sezione SuperCacher di SiteGround Optimizer."
|
910 |
+
|
911 |
+
#. src-js/components/tabs/multisite-control/index.jsx:405
|
912 |
+
#: helpers/sg-cachepress-react-strings.php:140
|
913 |
+
msgid "Frontend Optimizations"
|
914 |
+
msgstr "Ottimizzazioni del frontend"
|
915 |
+
|
916 |
+
#. src-js/components/tabs/multisite-control/index.jsx:434
|
917 |
+
#: helpers/sg-cachepress-react-strings.php:141
|
918 |
+
msgid ""
|
919 |
+
"Select whether site admins can access and make changes within the SiteGround "
|
920 |
+
"Optimizer's Frontend Optmization tab."
|
921 |
+
msgstr ""
|
922 |
+
"Seleziona se gli amministratori del sito possono accedere e apportare "
|
923 |
+
"modifiche all'interno della sezione Ottimizzazione Frontend di SiteGround "
|
924 |
+
"Optimizer."
|
925 |
+
|
926 |
+
#. src-js/components/tabs/multisite-control/index.jsx:437
|
927 |
+
#: helpers/sg-cachepress-react-strings.php:142
|
928 |
+
msgid "Image Optimizations"
|
929 |
+
msgstr "Ottimizzazioni immagine"
|
930 |
+
|
931 |
+
#. src-js/components/tabs/multisite-control/index.jsx:464
|
932 |
+
#: helpers/sg-cachepress-react-strings.php:143
|
933 |
+
msgid ""
|
934 |
+
"Select whether site admins can access and make changes within the SiteGround "
|
935 |
+
"Optimizer's Image Optimization tab."
|
936 |
+
msgstr ""
|
937 |
+
"Seleziona se gli amministratori del sito possono accedere e apportare "
|
938 |
+
"modifiche all'interno della sezione Ottimizzazione Immagine di SiteGround "
|
939 |
+
"Optimizer."
|
940 |
+
|
941 |
+
#. src-js/components/tabs/multisite-control/index.jsx:467
|
942 |
+
#: helpers/sg-cachepress-react-strings.php:144
|
943 |
+
msgid "Environment Optimizations"
|
944 |
+
msgstr "Ottimizzazioni dell'ambiente"
|
945 |
+
|
946 |
+
#. src-js/components/tabs/multisite-control/index.jsx:494
|
947 |
+
#: helpers/sg-cachepress-react-strings.php:145
|
948 |
+
msgid ""
|
949 |
+
"Select whether site admins can access and make changes within the SiteGround "
|
950 |
+
"Optimizer's Environment Optimization tab."
|
951 |
+
msgstr ""
|
952 |
+
"Seleziona se gli amministratori del sito possono accedere e apportare "
|
953 |
+
"modifiche nella sezione di Ottimizzazione Ambiente di SiteGround Optimizer."
|
954 |
+
|
955 |
#. src-js/components/tabs/multisite-control/index.jsx:209
|
956 |
+
#: helpers/sg-cachepress-react-strings.php:146
|
957 |
msgid "SUPERCACHER SETTINGS"
|
958 |
msgstr "IMPOSTAZIONI SUPERCACHER"
|
959 |
|
960 |
#. src-js/components/tabs/multisite-control/index.jsx:304
|
961 |
+
#: helpers/sg-cachepress-react-strings.php:148
|
962 |
msgid ""
|
963 |
"Select whether new sites should have the Dynamic Caching enabled for them or "
|
964 |
"not."
|
966 |
"Seleziona se i nuovi siti devono avere abilitata o meno la Cache Dinamica."
|
967 |
|
968 |
#. src-js/components/tabs/sites-control/index.jsx:103
|
969 |
+
#: helpers/sg-cachepress-react-strings.php:151
|
970 |
msgid "ENVIRONMENT OPTIMIZATION"
|
971 |
msgstr "OTTIMIZZAZIONE DELL’AMBIENTE"
|
972 |
|
973 |
#. src-js/components/tabs/sites-control/index.jsx:208
|
974 |
+
#: helpers/sg-cachepress-react-strings.php:156
|
975 |
msgid "FRONTEND OPTIMIZATION"
|
976 |
msgstr "OTTIMIZZAZIONE FRONTEND"
|
977 |
|
978 |
#. src-js/components/tabs/frontend-optimization/index.jsx:32
|
979 |
+
#: helpers/sg-cachepress-react-strings.php:158
|
980 |
msgid ""
|
981 |
"Removes unnecessary characters from your HTML output saving data and "
|
982 |
"improving your site speed."
|
985 |
"migliorando la velocità del tuo sito."
|
986 |
|
987 |
#. src-js/components/tabs/frontend-optimization/index.jsx:65
|
988 |
+
#: helpers/sg-cachepress-react-strings.php:160
|
989 |
msgid ""
|
990 |
"Combine and minify your JavaScript files in order to reduce their size, "
|
991 |
"improve cachability, and reduce the number of requests to the server."
|
995 |
|
996 |
#. src-js/components/tabs/frontend-optimization/index.jsx:77
|
997 |
#. src-js/components/tabs/sites-control/index.jsx:296
|
998 |
+
#: helpers/sg-cachepress-react-strings.php:161
|
999 |
msgid "Load Render-blocking JavaScript Files Asynchronously"
|
1000 |
msgstr "Carica in modo asincrono i file JavaScript che bloccano il rendering"
|
1001 |
|
1002 |
#. src-js/components/tabs/frontend-optimization/index.jsx:107
|
1003 |
#. src-js/components/tabs/sites-control/index.jsx:326
|
1004 |
+
#: helpers/sg-cachepress-react-strings.php:162
|
1005 |
msgid ""
|
1006 |
"Add async parameter to the JavaScript files loaded in the header section of "
|
1007 |
"your site so they don’t block your page rendering."
|
1010 |
"tuo sito, in modo che non blocchino il rendering della pagina."
|
1011 |
|
1012 |
#. src-js/components/tabs/frontend-optimization/index.jsx:99
|
1013 |
+
#: helpers/sg-cachepress-react-strings.php:164
|
1014 |
msgid ""
|
1015 |
"Combine and minify your CSS files in order to reduce their size, improve "
|
1016 |
"cachability, and reduce the number of requests to the server."
|
1020 |
|
1021 |
#. src-js/components/tabs/frontend-optimization/index.jsx:179
|
1022 |
#. src-js/components/tabs/sites-control/index.jsx:392
|
1023 |
+
#: helpers/sg-cachepress-react-strings.php:166
|
1024 |
msgid ""
|
1025 |
"Combine multiple CSS files into one to lower the number of requests your "
|
1026 |
"site generates."
|
1029 |
"tuo sito."
|
1030 |
|
1031 |
#. src-js/components/tabs/sites-control/index.jsx:395
|
1032 |
+
#: helpers/sg-cachepress-react-strings.php:171
|
1033 |
msgid "IMAGE OPTIMIZATION"
|
1034 |
msgstr "OTTIMIZZAZIONE IMMAGINI"
|
1035 |
|
1036 |
#. src-js/components/tabs/sites-control/index.jsx:425
|
1037 |
+
#: helpers/sg-cachepress-react-strings.php:172
|
1038 |
+
#: helpers/manual-translations.php:5
|
1039 |
msgid "Image Optimization"
|
1040 |
msgstr "Ottimizzazione Immagini"
|
1041 |
|
1042 |
#. Page title.
|
1043 |
#. Name of the plugin
|
1044 |
+
#: helpers/sg-cachepress-react-strings.php:184 core/Admin/Admin.php:239
|
1045 |
#: core/Admin/Admin.php:240
|
1046 |
msgid "SG Optimizer"
|
1047 |
msgstr "SG Optimizer"
|
1048 |
|
1049 |
#. src-js/containers/main/index.jsx:136
|
1050 |
+
#: helpers/sg-cachepress-react-strings.php:185
|
1051 |
msgid ""
|
1052 |
"Get the best performance for your WordPress website with our optimization "
|
1053 |
"plugin. It handles caching, system settings, and all the necessary "
|
1061 |
"hosting!"
|
1062 |
|
1063 |
#. src-js/containers/main/index.jsx:38
|
1064 |
+
#: helpers/sg-cachepress-react-strings.php:186
|
1065 |
msgid "Old PHP Version"
|
1066 |
msgstr "Versione PHP precedente"
|
1067 |
|
1068 |
#. src-js/containers/php-checker/index.jsx:167
|
1069 |
+
#: helpers/sg-cachepress-react-strings.php:187
|
1070 |
msgid ""
|
1071 |
"You are using our Managed PHP service, which means that SiteGround will "
|
1072 |
"automatically update your PHP once we are sure there is a newer stable one, "
|
1084 |
"manualmente."
|
1085 |
|
1086 |
#. src-js/containers/php-checker/index.jsx:143
|
1087 |
+
#: helpers/sg-cachepress-react-strings.php:188
|
1088 |
msgid ""
|
1089 |
"Your site will keep using that version until you manually change it from "
|
1090 |
"this interface or until you switch to \"Managed PHP\" service. If you choose "
|
1100 |
"sicurezza e prestazioni."
|
1101 |
|
1102 |
#. src-js/containers/php-checker/index.jsx:179
|
1103 |
+
#: helpers/sg-cachepress-react-strings.php:189
|
1104 |
msgid ""
|
1105 |
"As a SiteGround client you may change your PHP version per site manually. "
|
1106 |
"However, we strongly recommend you to take advantage of our Managed PHP "
|
1120 |
"WordPress fino a quando non la cambierai di nuovo manualmente."
|
1121 |
|
1122 |
#. src-js/containers/php-checker/index.jsx:184
|
1123 |
+
#: helpers/sg-cachepress-react-strings.php:190
|
1124 |
msgid "Set your PHP version"
|
1125 |
msgstr "Imposta la tua versione di PHP"
|
1126 |
|
1127 |
#. src-js/containers/php-checker/index.jsx:205
|
1128 |
+
#: helpers/sg-cachepress-react-strings.php:191
|
1129 |
msgid "You are currently running on PHP %(version)s."
|
1130 |
msgstr "Attualmente stai utilizzando PHP %(version)s."
|
1131 |
|
1132 |
#. src-js/containers/php-checker/index.jsx:210
|
1133 |
+
#: helpers/sg-cachepress-react-strings.php:192
|
1134 |
msgid "PHP Management Method"
|
1135 |
msgstr "PHP Gestito"
|
1136 |
|
1137 |
#. src-js/containers/php-checker/index.jsx:226
|
1138 |
+
#: helpers/sg-cachepress-react-strings.php:193
|
1139 |
msgid "Please select method"
|
1140 |
msgstr "Seleziona il metodo"
|
1141 |
|
1142 |
#. src-js/containers/php-checker/index.jsx:227
|
1143 |
+
#: helpers/sg-cachepress-react-strings.php:194
|
1144 |
msgid "Please select management type"
|
1145 |
msgstr "Seleziona il tipo di gestione"
|
1146 |
|
1147 |
#. src-js/containers/php-checker/index.jsx:222
|
1148 |
+
#: helpers/sg-cachepress-react-strings.php:195
|
1149 |
msgid "PHP Version"
|
1150 |
msgstr "Versione PHP"
|
1151 |
|
1152 |
#. src-js/containers/php-checker/index.jsx:242
|
1153 |
#. src-js/containers/php-checker/index.jsx:243
|
1154 |
+
#: helpers/sg-cachepress-react-strings.php:196
|
1155 |
+
#: helpers/sg-cachepress-react-strings.php:197
|
1156 |
msgid "Please select PHP version"
|
1157 |
msgstr "Seleziona la versione PHP"
|
1158 |
|
1159 |
#. src-js/containers/php-checker/index.jsx:248
|
1160 |
+
#: helpers/sg-cachepress-react-strings.php:198
|
1161 |
msgid "Save"
|
1162 |
msgstr "Salva"
|
1163 |
|
1164 |
#. src-js/containers/php-checker/index.jsx:262
|
1165 |
+
#: helpers/sg-cachepress-react-strings.php:199
|
1166 |
msgid ""
|
1167 |
"We currently recommend you to use PHP %(version)s. You can check the "
|
1168 |
"compatibility with the recommended version before you switch. {{link}}Check "
|
1173 |
"raccomandata. {{link}}Verifica compatibilità{{/link}}"
|
1174 |
|
1175 |
#. src-js/containers/php-checker/index.jsx:286
|
1176 |
+
#: helpers/sg-cachepress-react-strings.php:200
|
1177 |
msgid ""
|
1178 |
"All your plugins are compatible with PHP %(version)s. You may safely switch "
|
1179 |
"to “Managed PHP” service and we’ll upgrade it automatically, or set it "
|
1185 |
"ancora{{/link}}"
|
1186 |
|
1187 |
#. src-js/containers/php-checker/index.jsx:302
|
1188 |
+
#: helpers/sg-cachepress-react-strings.php:201
|
1189 |
msgid "Checking PHP 7.1 Compatibility..."
|
1190 |
msgstr "erifica in corso della compatibilità con PHP %(version)s..."
|
1191 |
|
1192 |
#. src-js/containers/php-checker/index.jsx:322
|
1193 |
+
#: helpers/sg-cachepress-react-strings.php:202
|
1194 |
msgid ""
|
1195 |
"Unfortunately some of your plugins or theme are not compatible with our "
|
1196 |
"recommended version. {{link}}Check Again{{/link}}"
|
1199 |
"raccomandata. {{link}}Controlla ancora{{/link}}"
|
1200 |
|
1201 |
#. src-js/containers/php-checker/index.jsx:352
|
1202 |
+
#: helpers/sg-cachepress-react-strings.php:205
|
1203 |
msgid "Thanks for using SG Optimizer to make your site faster!"
|
1204 |
msgstr "Grazie per utilizzare SG Optimizer per rendere il tuo sito più veloce!"
|
1205 |
|
1206 |
#. src-js/containers/rating/index.jsx:53
|
1207 |
+
#: helpers/sg-cachepress-react-strings.php:206
|
1208 |
msgid "Help more people optimize their sites by rating our plugin."
|
1209 |
msgstr "Aiuta più persone a ottimizzare i loro siti, vota il nostro plugin."
|
1210 |
|
1211 |
#. src-js/containers/rating/index.jsx:60
|
1212 |
+
#: helpers/sg-cachepress-react-strings.php:207
|
1213 |
msgid "Don’t Show This Again"
|
1214 |
msgstr "Non mostrare più"
|
1215 |
|
1642 |
msgstr "Fantastico! Hai lavorato bene."
|
1643 |
|
1644 |
#: core/Analysis/Analysis.php:334
|
1645 |
+
msgid "Your site is loading super fast!"
|
1646 |
+
msgstr "Il tuo sito si carica in modo super veloce!"
|
|
|
|
|
1647 |
|
1648 |
#: core/Admin/Admin_Bar.php:33 core/Admin/Admin.php:303
|
1649 |
msgid "Purge SG Cache"
|
readme.txt
CHANGED
@@ -171,6 +171,12 @@ Our plugin uses a cookie in order to function properly. It does not store person
|
|
171 |
|
172 |
== Changelog ==
|
173 |
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
= Version 5.4.0 =
|
175 |
* Added WebP Support on All Accounts on Site Tools
|
176 |
* Added Google PageSpeed Test
|
171 |
|
172 |
== Changelog ==
|
173 |
|
174 |
+
= Version 5.4.1 =
|
175 |
+
* Added PHP 7.4 support for PHP Compatibility Checker
|
176 |
+
* Improved WebP Conversion
|
177 |
+
* Fixed bug with WebP image regeneration on image edit
|
178 |
+
* Improved plugin localization
|
179 |
+
|
180 |
= Version 5.4.0 =
|
181 |
* Added WebP Support on All Accounts on Site Tools
|
182 |
* Added Google PageSpeed Test
|
sg-cachepress.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
* Plugin Name: SG Optimizer
|
11 |
* Plugin URI: https://siteground.com
|
12 |
* Description: This plugin will link your WordPress application with all the performance optimizations provided by SiteGround
|
13 |
-
* Version: 5.4.
|
14 |
* Author: SiteGround
|
15 |
* Author URI: https://www.siteground.com
|
16 |
* Text Domain: sg-cachepress
|
@@ -31,7 +31,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
31 |
|
32 |
// Define version constant.
|
33 |
if ( ! defined( __NAMESPACE__ . '\VERSION' ) ) {
|
34 |
-
define( __NAMESPACE__ . '\VERSION', '5.4.
|
35 |
}
|
36 |
|
37 |
// Define slug constant.
|
10 |
* Plugin Name: SG Optimizer
|
11 |
* Plugin URI: https://siteground.com
|
12 |
* Description: This plugin will link your WordPress application with all the performance optimizations provided by SiteGround
|
13 |
+
* Version: 5.4.1
|
14 |
* Author: SiteGround
|
15 |
* Author URI: https://www.siteground.com
|
16 |
* Text Domain: sg-cachepress
|
31 |
|
32 |
// Define version constant.
|
33 |
if ( ! defined( __NAMESPACE__ . '\VERSION' ) ) {
|
34 |
+
define( __NAMESPACE__ . '\VERSION', '5.4.1' );
|
35 |
}
|
36 |
|
37 |
// Define slug constant.
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInitc338f7fbd7d73a58c836a6fc15bad979::getLoader();
|
vendor/composer/autoload_psr4.php
CHANGED
@@ -7,6 +7,5 @@ $baseDir = dirname($vendorDir);
|
|
7 |
|
8 |
return array(
|
9 |
'SiteGround_Optimizer\\' => array($baseDir . '/core'),
|
10 |
-
'PHPCompatibility\\' => array($vendorDir . '/phpcompatibility/php-compatibility/PHPCompatibility'),
|
11 |
'Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => array($vendorDir . '/dealerdirect/phpcodesniffer-composer-installer/src'),
|
12 |
);
|
7 |
|
8 |
return array(
|
9 |
'SiteGround_Optimizer\\' => array($baseDir . '/core'),
|
|
|
10 |
'Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => array($vendorDir . '/dealerdirect/phpcodesniffer-composer-installer/src'),
|
11 |
);
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit829c927c15bb8ea4cf151bb66d546a08
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit829c927c15bb8ea4cf151bb66d546a08
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInitc338f7fbd7d73a58c836a6fc15bad979
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitc338f7fbd7d73a58c836a6fc15bad979', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitc338f7fbd7d73a58c836a6fc15bad979', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitc338f7fbd7d73a58c836a6fc15bad979::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
+
$includeFiles = Composer\Autoload\ComposerStaticInitc338f7fbd7d73a58c836a6fc15bad979::$files;
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequirec338f7fbd7d73a58c836a6fc15bad979($fileIdentifier, $file);
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function composerRequirec338f7fbd7d73a58c836a6fc15bad979($fileIdentifier, $file)
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'0d5072bb3af3f8dc141e158c7699adf2' => __DIR__ . '/../..' . '/helpers/helpers.php',
|
@@ -15,14 +15,15 @@ class ComposerStaticInit829c927c15bb8ea4cf151bb66d546a08
|
|
15 |
array (
|
16 |
'SiteGround_Optimizer\\' => 21,
|
17 |
),
|
18 |
-
'P' =>
|
19 |
-
array (
|
20 |
-
'PHPCompatibility\\' => 17,
|
21 |
-
),
|
22 |
'D' =>
|
23 |
array (
|
24 |
'Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => 55,
|
25 |
),
|
|
|
|
|
|
|
|
|
|
|
26 |
);
|
27 |
|
28 |
public static $prefixDirsPsr4 = array (
|
@@ -298,9 +299,9 @@ class ComposerStaticInit829c927c15bb8ea4cf151bb66d546a08
|
|
298 |
public static function getInitializer(ClassLoader $loader)
|
299 |
{
|
300 |
return \Closure::bind(function () use ($loader) {
|
301 |
-
$loader->prefixLengthsPsr4 =
|
302 |
-
$loader->prefixDirsPsr4 =
|
303 |
-
$loader->classMap =
|
304 |
|
305 |
}, null, ClassLoader::class);
|
306 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInitc338f7fbd7d73a58c836a6fc15bad979
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'0d5072bb3af3f8dc141e158c7699adf2' => __DIR__ . '/../..' . '/helpers/helpers.php',
|
15 |
array (
|
16 |
'SiteGround_Optimizer\\' => 21,
|
17 |
),
|
|
|
|
|
|
|
|
|
18 |
'D' =>
|
19 |
array (
|
20 |
'Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => 55,
|
21 |
),
|
22 |
+
'P' =>
|
23 |
+
array (
|
24 |
+
'PHPCompatibility\\' => 17,
|
25 |
+
),
|
26 |
+
|
27 |
);
|
28 |
|
29 |
public static $prefixDirsPsr4 = array (
|
299 |
public static function getInitializer(ClassLoader $loader)
|
300 |
{
|
301 |
return \Closure::bind(function () use ($loader) {
|
302 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInitc338f7fbd7d73a58c836a6fc15bad979::$prefixLengthsPsr4;
|
303 |
+
$loader->prefixDirsPsr4 = ComposerStaticInitc338f7fbd7d73a58c836a6fc15bad979::$prefixDirsPsr4;
|
304 |
+
$loader->classMap = ComposerStaticInitc338f7fbd7d73a58c836a6fc15bad979::$classMap;
|
305 |
|
306 |
}, null, ClassLoader::class);
|
307 |
}
|
vendor/composer/installed.json
CHANGED
@@ -71,17 +71,17 @@
|
|
71 |
},
|
72 |
{
|
73 |
"name": "phpcompatibility/php-compatibility",
|
74 |
-
"version": "
|
75 |
-
"version_normalized": "
|
76 |
"source": {
|
77 |
"type": "git",
|
78 |
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
|
79 |
-
"reference": "
|
80 |
},
|
81 |
"dist": {
|
82 |
"type": "zip",
|
83 |
-
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/
|
84 |
-
"reference": "
|
85 |
"shasum": ""
|
86 |
},
|
87 |
"require": {
|
@@ -95,17 +95,70 @@
|
|
95 |
"phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
|
96 |
},
|
97 |
"suggest": {
|
98 |
-
"dealerdirect/phpcodesniffer-composer-installer": "^0.
|
99 |
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
100 |
},
|
101 |
-
"time": "
|
102 |
"type": "phpcodesniffer-standard",
|
103 |
"installation-source": "dist",
|
104 |
-
"
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
"notification-url": "https://packagist.org/downloads/",
|
110 |
"license": [
|
111 |
"LGPL-3.0-or-later"
|
@@ -114,39 +167,49 @@
|
|
114 |
{
|
115 |
"name": "Wim Godden",
|
116 |
"role": "lead"
|
|
|
|
|
|
|
|
|
117 |
}
|
118 |
],
|
119 |
-
"description": "A set of
|
120 |
-
"homepage": "http://
|
121 |
"keywords": [
|
122 |
"compatibility",
|
|
|
123 |
"phpcs",
|
|
|
124 |
"standards"
|
125 |
]
|
126 |
},
|
127 |
{
|
128 |
"name": "phpcompatibility/phpcompatibility-wp",
|
129 |
-
"version": "1.0
|
130 |
-
"version_normalized": "1.0.0
|
131 |
"source": {
|
132 |
"type": "git",
|
133 |
"url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
|
134 |
-
"reference": "
|
135 |
},
|
136 |
"dist": {
|
137 |
"type": "zip",
|
138 |
-
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/
|
139 |
-
"reference": "
|
140 |
"shasum": ""
|
141 |
},
|
142 |
"require": {
|
143 |
-
"phpcompatibility/php-compatibility": "^
|
|
|
|
|
|
|
|
|
144 |
},
|
145 |
"suggest": {
|
146 |
-
"dealerdirect/phpcodesniffer-composer-installer": "^0.
|
147 |
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
148 |
},
|
149 |
-
"time": "
|
150 |
"type": "phpcodesniffer-standard",
|
151 |
"installation-source": "dist",
|
152 |
"notification-url": "https://packagist.org/downloads/",
|
@@ -163,7 +226,7 @@
|
|
163 |
"role": "lead"
|
164 |
}
|
165 |
],
|
166 |
-
"description": "A
|
167 |
"homepage": "http://phpcompatibility.com/",
|
168 |
"keywords": [
|
169 |
"compatibility",
|
@@ -174,17 +237,17 @@
|
|
174 |
},
|
175 |
{
|
176 |
"name": "squizlabs/php_codesniffer",
|
177 |
-
"version": "2.9.
|
178 |
-
"version_normalized": "2.9.
|
179 |
"source": {
|
180 |
"type": "git",
|
181 |
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
182 |
-
"reference": "
|
183 |
},
|
184 |
"dist": {
|
185 |
"type": "zip",
|
186 |
-
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/
|
187 |
-
"reference": "
|
188 |
"shasum": ""
|
189 |
},
|
190 |
"require": {
|
@@ -196,7 +259,7 @@
|
|
196 |
"require-dev": {
|
197 |
"phpunit/phpunit": "~4.0"
|
198 |
},
|
199 |
-
"time": "
|
200 |
"bin": [
|
201 |
"scripts/phpcs",
|
202 |
"scripts/phpcbf"
|
@@ -251,5 +314,50 @@
|
|
251 |
"phpcs",
|
252 |
"standards"
|
253 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
}
|
255 |
]
|
71 |
},
|
72 |
{
|
73 |
"name": "phpcompatibility/php-compatibility",
|
74 |
+
"version": "9.3.5",
|
75 |
+
"version_normalized": "9.3.5.0",
|
76 |
"source": {
|
77 |
"type": "git",
|
78 |
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
|
79 |
+
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
|
80 |
},
|
81 |
"dist": {
|
82 |
"type": "zip",
|
83 |
+
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
|
84 |
+
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
|
85 |
"shasum": ""
|
86 |
},
|
87 |
"require": {
|
95 |
"phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
|
96 |
},
|
97 |
"suggest": {
|
98 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
|
99 |
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
100 |
},
|
101 |
+
"time": "2019-12-27T09:44:58+00:00",
|
102 |
"type": "phpcodesniffer-standard",
|
103 |
"installation-source": "dist",
|
104 |
+
"notification-url": "https://packagist.org/downloads/",
|
105 |
+
"license": [
|
106 |
+
"LGPL-3.0-or-later"
|
107 |
+
],
|
108 |
+
"authors": [
|
109 |
+
{
|
110 |
+
"name": "Wim Godden",
|
111 |
+
"homepage": "https://github.com/wimg",
|
112 |
+
"role": "lead"
|
113 |
+
},
|
114 |
+
{
|
115 |
+
"name": "Juliette Reinders Folmer",
|
116 |
+
"homepage": "https://github.com/jrfnl",
|
117 |
+
"role": "lead"
|
118 |
+
},
|
119 |
+
{
|
120 |
+
"name": "Contributors",
|
121 |
+
"homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
|
122 |
}
|
123 |
+
],
|
124 |
+
"description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
|
125 |
+
"homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
|
126 |
+
"keywords": [
|
127 |
+
"compatibility",
|
128 |
+
"phpcs",
|
129 |
+
"standards"
|
130 |
+
]
|
131 |
+
},
|
132 |
+
{
|
133 |
+
"name": "phpcompatibility/phpcompatibility-paragonie",
|
134 |
+
"version": "1.3.0",
|
135 |
+
"version_normalized": "1.3.0.0",
|
136 |
+
"source": {
|
137 |
+
"type": "git",
|
138 |
+
"url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
|
139 |
+
"reference": "b862bc32f7e860d0b164b199bd995e690b4b191c"
|
140 |
+
},
|
141 |
+
"dist": {
|
142 |
+
"type": "zip",
|
143 |
+
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/b862bc32f7e860d0b164b199bd995e690b4b191c",
|
144 |
+
"reference": "b862bc32f7e860d0b164b199bd995e690b4b191c",
|
145 |
+
"shasum": ""
|
146 |
+
},
|
147 |
+
"require": {
|
148 |
+
"phpcompatibility/php-compatibility": "^9.0"
|
149 |
+
},
|
150 |
+
"require-dev": {
|
151 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5",
|
152 |
+
"paragonie/random_compat": "dev-master",
|
153 |
+
"paragonie/sodium_compat": "dev-master"
|
154 |
},
|
155 |
+
"suggest": {
|
156 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
|
157 |
+
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
158 |
+
},
|
159 |
+
"time": "2019-11-04T15:17:54+00:00",
|
160 |
+
"type": "phpcodesniffer-standard",
|
161 |
+
"installation-source": "dist",
|
162 |
"notification-url": "https://packagist.org/downloads/",
|
163 |
"license": [
|
164 |
"LGPL-3.0-or-later"
|
167 |
{
|
168 |
"name": "Wim Godden",
|
169 |
"role": "lead"
|
170 |
+
},
|
171 |
+
{
|
172 |
+
"name": "Juliette Reinders Folmer",
|
173 |
+
"role": "lead"
|
174 |
}
|
175 |
],
|
176 |
+
"description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
|
177 |
+
"homepage": "http://phpcompatibility.com/",
|
178 |
"keywords": [
|
179 |
"compatibility",
|
180 |
+
"paragonie",
|
181 |
"phpcs",
|
182 |
+
"polyfill",
|
183 |
"standards"
|
184 |
]
|
185 |
},
|
186 |
{
|
187 |
"name": "phpcompatibility/phpcompatibility-wp",
|
188 |
+
"version": "2.1.0",
|
189 |
+
"version_normalized": "2.1.0.0",
|
190 |
"source": {
|
191 |
"type": "git",
|
192 |
"url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
|
193 |
+
"reference": "41bef18ba688af638b7310666db28e1ea9158b2f"
|
194 |
},
|
195 |
"dist": {
|
196 |
"type": "zip",
|
197 |
+
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/41bef18ba688af638b7310666db28e1ea9158b2f",
|
198 |
+
"reference": "41bef18ba688af638b7310666db28e1ea9158b2f",
|
199 |
"shasum": ""
|
200 |
},
|
201 |
"require": {
|
202 |
+
"phpcompatibility/php-compatibility": "^9.0",
|
203 |
+
"phpcompatibility/phpcompatibility-paragonie": "^1.0"
|
204 |
+
},
|
205 |
+
"require-dev": {
|
206 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5"
|
207 |
},
|
208 |
"suggest": {
|
209 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
|
210 |
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
211 |
},
|
212 |
+
"time": "2019-08-28T14:22:28+00:00",
|
213 |
"type": "phpcodesniffer-standard",
|
214 |
"installation-source": "dist",
|
215 |
"notification-url": "https://packagist.org/downloads/",
|
226 |
"role": "lead"
|
227 |
}
|
228 |
],
|
229 |
+
"description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
|
230 |
"homepage": "http://phpcompatibility.com/",
|
231 |
"keywords": [
|
232 |
"compatibility",
|
237 |
},
|
238 |
{
|
239 |
"name": "squizlabs/php_codesniffer",
|
240 |
+
"version": "2.9.2",
|
241 |
+
"version_normalized": "2.9.2.0",
|
242 |
"source": {
|
243 |
"type": "git",
|
244 |
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
245 |
+
"reference": "2acf168de78487db620ab4bc524135a13cfe6745"
|
246 |
},
|
247 |
"dist": {
|
248 |
"type": "zip",
|
249 |
+
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/2acf168de78487db620ab4bc524135a13cfe6745",
|
250 |
+
"reference": "2acf168de78487db620ab4bc524135a13cfe6745",
|
251 |
"shasum": ""
|
252 |
},
|
253 |
"require": {
|
259 |
"require-dev": {
|
260 |
"phpunit/phpunit": "~4.0"
|
261 |
},
|
262 |
+
"time": "2018-11-07T22:31:41+00:00",
|
263 |
"bin": [
|
264 |
"scripts/phpcs",
|
265 |
"scripts/phpcbf"
|
314 |
"phpcs",
|
315 |
"standards"
|
316 |
]
|
317 |
+
},
|
318 |
+
{
|
319 |
+
"name": "wp-coding-standards/wpcs",
|
320 |
+
"version": "1.2.1",
|
321 |
+
"version_normalized": "1.2.1.0",
|
322 |
+
"source": {
|
323 |
+
"type": "git",
|
324 |
+
"url": "https://github.com/WordPress/WordPress-Coding-Standards.git",
|
325 |
+
"reference": "f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c"
|
326 |
+
},
|
327 |
+
"dist": {
|
328 |
+
"type": "zip",
|
329 |
+
"url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c",
|
330 |
+
"reference": "f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c",
|
331 |
+
"shasum": ""
|
332 |
+
},
|
333 |
+
"require": {
|
334 |
+
"php": ">=5.3",
|
335 |
+
"squizlabs/php_codesniffer": "^2.9.0 || ^3.0.2"
|
336 |
+
},
|
337 |
+
"require-dev": {
|
338 |
+
"phpcompatibility/php-compatibility": "^9.0"
|
339 |
+
},
|
340 |
+
"suggest": {
|
341 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
|
342 |
+
},
|
343 |
+
"time": "2018-12-18T09:43:51+00:00",
|
344 |
+
"type": "phpcodesniffer-standard",
|
345 |
+
"installation-source": "dist",
|
346 |
+
"notification-url": "https://packagist.org/downloads/",
|
347 |
+
"license": [
|
348 |
+
"MIT"
|
349 |
+
],
|
350 |
+
"authors": [
|
351 |
+
{
|
352 |
+
"name": "Contributors",
|
353 |
+
"homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors"
|
354 |
+
}
|
355 |
+
],
|
356 |
+
"description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
|
357 |
+
"keywords": [
|
358 |
+
"phpcs",
|
359 |
+
"standards",
|
360 |
+
"wordpress"
|
361 |
+
]
|
362 |
}
|
363 |
]
|
vendor/phar-io/manifest/composer.lock
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"_readme": [
|
3 |
-
"This file locks the dependencies of your project to a known state",
|
4 |
-
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
5 |
-
"This file is @generated automatically"
|
6 |
-
],
|
7 |
-
"content-hash": "f00846dde236d314a19d00d268d737dd",
|
8 |
-
"packages": [
|
9 |
-
{
|
10 |
-
"name": "phar-io/version",
|
11 |
-
"version": "2.0.1",
|
12 |
-
"source": {
|
13 |
-
"type": "git",
|
14 |
-
"url": "https://github.com/phar-io/version.git",
|
15 |
-
"reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6"
|
16 |
-
},
|
17 |
-
"dist": {
|
18 |
-
"type": "zip",
|
19 |
-
"url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6",
|
20 |
-
"reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6",
|
21 |
-
"shasum": ""
|
22 |
-
},
|
23 |
-
"require": {
|
24 |
-
"php": "^5.6 || ^7.0"
|
25 |
-
},
|
26 |
-
"type": "library",
|
27 |
-
"autoload": {
|
28 |
-
"classmap": [
|
29 |
-
"src/"
|
30 |
-
]
|
31 |
-
},
|
32 |
-
"notification-url": "https://packagist.org/downloads/",
|
33 |
-
"license": [
|
34 |
-
"BSD-3-Clause"
|
35 |
-
],
|
36 |
-
"authors": [
|
37 |
-
{
|
38 |
-
"name": "Arne Blankerts",
|
39 |
-
"email": "arne@blankerts.de",
|
40 |
-
"role": "Developer"
|
41 |
-
},
|
42 |
-
{
|
43 |
-
"name": "Sebastian Heuer",
|
44 |
-
"email": "sebastian@phpeople.de",
|
45 |
-
"role": "Developer"
|
46 |
-
},
|
47 |
-
{
|
48 |
-
"name": "Sebastian Bergmann",
|
49 |
-
"email": "sebastian@phpunit.de",
|
50 |
-
"role": "Developer"
|
51 |
-
}
|
52 |
-
],
|
53 |
-
"description": "Library for handling version information and constraints",
|
54 |
-
"time": "2018-07-08T19:19:57+00:00"
|
55 |
-
}
|
56 |
-
],
|
57 |
-
"packages-dev": [],
|
58 |
-
"aliases": [],
|
59 |
-
"minimum-stability": "stable",
|
60 |
-
"stability-flags": [],
|
61 |
-
"prefer-stable": false,
|
62 |
-
"prefer-lowest": false,
|
63 |
-
"platform": {
|
64 |
-
"php": "^5.6 || ^7.0",
|
65 |
-
"ext-dom": "*",
|
66 |
-
"ext-phar": "*"
|
67 |
-
},
|
68 |
-
"platform-dev": []
|
69 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/phpcompatibility/php-compatibility/CHANGELOG.md
CHANGED
@@ -7,8 +7,6 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/).
|
|
7 |
Up to version 8.0.0, the `major.minor` version numbers were based on the PHP version for which compatibility check support was added, with `patch` version numbers being specific to this library.
|
8 |
From version 8.0.0 onwards, [Semantic Versioning](http://semver.org/) is used.
|
9 |
|
10 |
-
**IMPORTANT**: The 8.0.0 release contains a **breaking change**. Please read the v [8.0.0 changelog](CHANGELOG.md#800---2017-08-03) carefully before upgrading.
|
11 |
-
|
12 |
<!-- Legend to the icons used: https://github.com/PHPCompatibility/PHPCompatibility/pull/506#discussion_r131650488 -->
|
13 |
|
14 |
|
@@ -16,6 +14,451 @@ From version 8.0.0 onwards, [Semantic Versioning](http://semver.org/) is used.
|
|
16 |
|
17 |
_Nothing yet._
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
## [8.2.0] - 2018-07-17
|
20 |
|
21 |
See all related issues and PRs in the [8.2.0 milestone].
|
@@ -137,41 +580,41 @@ Thanks go out to [Michael Babker] and [Juliette Reinders Folmer] for their contr
|
|
137 |
See all related issues and PRs in the [8.1.0 milestone].
|
138 |
|
139 |
### Added
|
140 |
-
- :star2: New `NewConstants` and `RemovedConstants` sniffs to detect usage of new/removed PHP constants for all PHP versions from PHP 5 up. [#526](https://github.com/
|
141 |
-
- :star2: New `MagicAutoloadDeprecation` sniff to detect deprecated `__autoload()` functions as deprecated in PHP 7.2. [#540](https://github.com/
|
142 |
-
- :star2: New `OptionalRequiredFunctionParameter` sniff to check for missing function call parameters which were required and only became optional in a later PHP version. [#524](https://github.com/
|
143 |
-
- :star2: New `DynamicAccessToStatic` sniff to detect dynamic access to static methods and properties, as well as class constants, prior to PHP 5.3. [#535](https://github.com/
|
144 |
-
- :star: `DeprecatedFunctions` sniff: recognize yet more PHP 7.2 deprecated functions. [#561](https://github.com/
|
145 |
-
- :star: `DeprecatedIniDirectives` sniff: recognize the last of the PHP 7.2 deprecated ini directives. [#566](https://github.com/
|
146 |
-
- :star: `NewFunctions` : detection of all new PHP 7.2 functions added. [#522](https://github.com/
|
147 |
-
- :star: `RemovedExtensions` : report on usage of the `mcrypt` extension which has been removed in PHP 7.2. [#566](https://github.com/
|
148 |
-
- :star: `RemovedGlobalVariables` : detection of the use of `$php_errormsg` with `track_errors` which has been deprecated in PHP 7.2. [#528](https://github.com/
|
149 |
-
- :books: Documentation : added reporting usage instructions. [#533](https://github.com/
|
150 |
|
151 |
### Changed
|
152 |
-
- :pushpin: `NewClosures` : downgraded "$this found in closure outside class" to warning. [#536](https://github.com/
|
153 |
-
- :pushpin: `ForbiddenGlobalVariableVariable` : the sniff will now throw an error for each variable in a `global` statement which is no longer supported and show the variable found to make it easier to fix this. Previously only one error would be thrown per `global` statement. [#564](https://github.com/
|
154 |
-
- :pushpin: `ForbiddenGlobalVariableVariable` : the sniff will now throw `warning`s for non-bare variables used in a `global` statement as those are discouraged since PHP 7.0. [#564](https://github.com/
|
155 |
-
- :rewind: `NewLanguageConstructs` : updated the version number for `T_COALESCE_EQUAL`. [#523](https://github.com/
|
156 |
-
- :pencil2: `Sniff::getTestVersion()` : simplified regex logic. [#520](https://github.com/
|
157 |
-
- :green_heart: Travis : build tests are now being run against PHP 7.2 as well. [#511](https://github.com/
|
158 |
-
- :wrench: Improved check for superfluous whitespaces in files. [#542](https://github.com/
|
159 |
-
- :wrench: Build/PHPCS : stabilized the exclude patterns. [#529](https://github.com/
|
160 |
-
- :wrench: Build/PHPCS : added array indentation check. [#538](https://github.com/
|
161 |
-
- :white_check_mark: PHPCS cross-version compatibility : sync `FindExtendedClassname()` method with upstream. [#507](https://github.com/
|
162 |
-
- :wrench: The minimum version for the recommended `DealerDirect/phpcodesniffer-composer-installer` Composer plugin has been upped to `0.4.3`. [#548](https://github.com/
|
163 |
|
164 |
### Fixed
|
165 |
-
- :bug: `ForbiddenCallTimePassByReference` : a false positive was being thrown when a global constant was followed by a _bitwise and_. [#562](https://github.com/
|
166 |
-
- :bug: `ForbiddenGlobalVariableVariable` : the sniff was overzealous and would also report on `global` in combination with variable variables which are still supported. [#564](https://github.com/
|
167 |
-
- :bug: `ForbiddenGlobalVariableVariable` : variables interspersed with whitespace and/or comments were not being reported. [#564](https://github.com/
|
168 |
-
- :rewind: `ForbiddenNamesAsInvokedFunctions` : improved recognition of function invocations using forbidden words and prevent warnings for keywords which are no longer forbidden as method names in PHP 7.0+. [#516](https://github.com/
|
169 |
-
- :bug: `VariableVariables` : variables interspersed with whitespace and/or comments were not being reported. [#563](https://github.com/
|
170 |
-
- :umbrella: Fixed some unintentional syntax errors in test files. [#539](https://github.com/
|
171 |
-
- :umbrella: Tests : fixed case numbering error. [#525](https://github.com/
|
172 |
-
- :books: Tests : added missing test skip explanation. [#521](https://github.com/
|
173 |
-
- :wrench: Fixed PHPCS whitespaces. [#543](https://github.com/
|
174 |
-
- :wrench: Fixed code test coverage verification. [#550](https://github.com/
|
175 |
|
176 |
### Credits
|
177 |
Thanks go out to [Juliette Reinders Folmer] and [Jonathan Van Belle] for their contributions to this version. :clap:
|
@@ -182,20 +625,20 @@ Thanks go out to [Juliette Reinders Folmer] and [Jonathan Van Belle] for their c
|
|
182 |
See all related issues and PRs in the [8.0.1 milestone].
|
183 |
|
184 |
### Added
|
185 |
-
- :star2: New `DeprecatedTypeCasts` sniff to detect deprecated and removed type casts, such as the `(unset)` type cast as deprecated in PHP 7.2. [#498](https://github.com/
|
186 |
-
- :star2: New `NewTypeCasts` sniff to detect type casts not present in older PHP versions such as the `(binary)` type cast as added in PHP 5.2.1. [#497](https://github.com/
|
187 |
-
- :star: `NewGroupUseDeclaration`: Detection of PHP 7.2 trailing comma's in group use statements. [#504](https://github.com/
|
188 |
-
- :star: `DeprecatedFunctions` sniff: recognize some more PHP 7.2 deprecated functions. [#501](https://github.com/
|
189 |
-
- :star: `DeprecatedIniDirectives` sniff: recognize more PHP 7.2 deprecated ini directives. [#500](https://github.com/
|
190 |
-
- :star: `ForbiddenNames` sniff: recognize `object` as a forbidden keyword since PHP 7.2. [#499](https://github.com/
|
191 |
-
- :star: `NewReturnTypeDeclarations` sniff: recognize generic `parent`, PHP 7.1 `iterable` and PHP 7.2 `object` return type declarations. [#505](https://github.com/
|
192 |
-
- :star: `NewScalarTypeDeclarations` sniff: recognize PHP 7.2 `object` type declarion. [#499](https://github.com/
|
193 |
|
194 |
### Changed
|
195 |
-
:pencil2: Improved clarity of the deprecated functions alternative in the error message. [#502](https://github.com/
|
196 |
|
197 |
### Fixed
|
198 |
-
:fire_engine: Temporary hotfix for installed_paths (pending [upstream fix](https://github.com/squizlabs/PHP_CodeSniffer/issues/1591).) [#503](https://github.com/
|
199 |
|
200 |
### Credits
|
201 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
@@ -312,24 +755,24 @@ If you run PHPCompatibility against your code as part of your Travis build:
|
|
312 |
See all related issues and PRs in the [8.0.0 milestone].
|
313 |
|
314 |
### Added
|
315 |
-
- :two_hearts: Support for PHP CodeSniffer 3.x. [#482](https://github.com/
|
316 |
|
317 |
### Changed
|
318 |
- :gift: As of this version PHPCompatibility will use semantic versioning.
|
319 |
-
- :fire: The directory structure of the repository has changed for better compatibility with installation via Composer. [#446](https://github.com/
|
320 |
-
- :pencil2: The custom `functionWhitelist` property for the `PHPCompatibility.PHP.RemovedExtensions` sniff is now only supported in combination with PHP CodeSniffer 2.6.0 or higher (due to an upstream bug which was fixed in PHPCS 2.6.0). [#482](https://github.com/
|
321 |
-
- :wrench: Improved the information provided to Composer from the `composer.json` file. [#446](https://github.com/
|
322 |
-
- :wrench: Release archives will no longer contain the unit tests and other typical development files. You can still get these by using Composer with `--prefer-source` or by checking out a git clone of the repository. [#494](https://github.com/
|
323 |
-
- :wrench: A variety of minor improvements to the build process. [#485](https://github.com/
|
324 |
-
- :wrench: Some files for use by contributors have been renamed to use `.dist` extensions or moved for easier access. [#478](https://github.com/
|
325 |
-
- :books: The installation instructions in the Readme. [#496](https://github.com/
|
326 |
-
- :books: The unit test instructions in the Contributing file. [#496](https://github.com/
|
327 |
-
- :books: Improved the example code in the Readme. [#490](https://github.com/
|
328 |
|
329 |
### Removed
|
330 |
- :no_entry_sign: Support for PHP 5.1 and 5.2.
|
331 |
|
332 |
-
The sniffs can now only be run on PHP 5.3 or higher in combination with PHPCS 1.5.6 or 2.x and on PHP 5.4 or higher in combination with PHPCS 3.x. [#484](https://github.com/
|
333 |
|
334 |
### Credits
|
335 |
Thanks go out to [Gary Jones] and [Juliette Reinders Folmer] for their contributions to this version. :clap:
|
@@ -340,32 +783,32 @@ Thanks go out to [Gary Jones] and [Juliette Reinders Folmer] for their contribut
|
|
340 |
See all related issues and PRs in the [7.1.5 milestone].
|
341 |
|
342 |
### Added
|
343 |
-
- :star: The `NewKeywords` sniff will now also sniff for `yield from` which was introduced in PHP 7.0. [#477](https://github.com/
|
344 |
-
- :books: The LGPL-3.0 license. [#447](https://github.com/
|
345 |
|
346 |
### Changed
|
347 |
-
- :rewind: The `NewExecutionDirectives` sniff will now also report on execution directives when used in combination with PHPCS 2.0.0-2.3.3. [#451](https://github.com/
|
348 |
-
- :rewind: The `getMethodParameters()` utility method will no longer break when used with PHPCS 1.5.x < 1.5.6. This affected a number of sniffs. [#452](https://github.com/
|
349 |
-
- :rewind: The `inUseScope()` utility method will no longer break when used with PHPCS 2.0.0 - 2.2.0. This affected a number of sniffs. [#454](https://github.com/
|
350 |
-
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#443](https://github.com/
|
351 |
-
- :pencil2: Renamed a test file for consistency. [#453](https://github.com/
|
352 |
-
- :wrench: Code style clean up. [#429](https://github.com/
|
353 |
-
- :wrench: Prevent Composer installing PHPCS 3.x. **_PHPCS 3.x is not (yet) supported by the PHPCompatibility standard, but will be in the near future._** [#444](https://github.com/
|
354 |
-
- :green_heart: The code base will now be checked for consistent code style during build testing. [#429](https://github.com/
|
355 |
-
- :green_heart: The sniffs are now also tested against HHVM for consistent results. _Note: the sniffs do not contain any HHVM specific checks nor is there any intention to add them at this time._ [#450](https://github.com/
|
356 |
-
- :books: Made it explicit that - at this moment - PHPCS 3.x is not (yet) supported. [#444](https://github.com/
|
357 |
-
- :books: Minor improvements to the Readme. [#448](https://github.com/
|
358 |
-
- :books: Minor improvements to the Contributing guidelines. [#467](https://github.com/
|
359 |
|
360 |
### Removed
|
361 |
-
- :no_entry_sign: The `DefaultTimeZoneRequired` sniff. This sniff was checking server settings rather than code. [#458](https://github.com/
|
362 |
-
- :no_entry_sign: The `NewMagicClassConstant` sniff as introduced in v 7.1.4 contained two additional checks for not strictly compatibility related issues. One of these was plainly wrong, the other opinionated. Both have been removed. [#442](https://github.com/
|
363 |
|
364 |
### Fixed
|
365 |
-
- :bug: `NewClass` sniff: was reporting an incorrect introduction version number for a few of the Exception classes. [#441](https://github.com/
|
366 |
-
- :bug: `ForbiddenBreakContinueVariableArguments` sniff: was incorrectly reporting an error if the `break` or `continue` was followed by a PHP closing tag (breaking out of PHP). [#462](https://github.com/
|
367 |
-
- :bug: `ForbiddenGlobalVariableVariable` sniff: was incorrectly reporting an error if the `global` statement was followed by a PHP closing tag (breaking out of PHP). [#463](https://github.com/
|
368 |
-
- :bug: `DeprecatedFunctions` sniff: was reporting false positives for classes using the same name as a deprecated function. [#465](https://github.com/
|
369 |
|
370 |
### Credits
|
371 |
Thanks go out to [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap:
|
@@ -376,55 +819,55 @@ Thanks go out to [Juliette Reinders Folmer] and [Mark Clements] for their contri
|
|
376 |
See all related issues and PRs in the [7.1.4 milestone].
|
377 |
|
378 |
### Added
|
379 |
-
- :star2: New `CaseSensitiveKeywords` sniff to detect use of non-lowercase `self`, `static` and `parent` keywords which could cause compatibility issues pre-PHP 5.5. [#382](https://github.com/
|
380 |
-
- :star2: New `ConstantArraysUsingConst` sniff to detect constants defined using the `const` keyword being assigned an array value which was not supported prior to PHP 5.6. [#397](https://github.com/
|
381 |
-
- :star2: New `ForbiddenClosureUseVariableNames` sniff to detect PHP 7.1 forbidden variable names in closure use statements. [#386](https://github.com/
|
382 |
-
- :star2: New `NewArrayStringDereferencing` sniff to detect array and string literal dereferencing as introduced in PHP 5.5. [#388](https://github.com/
|
383 |
-
- :star2: New `NewHeredocInitialize` sniff to detect initialization of static variables and class properties/constants using the heredoc syntax which is supported since PHP 5.3. [#391](https://github.com/
|
384 |
-
- :star2: New `NewMagicClassConstant` sniff to detect use of the magic `::class` constant as introduced in PHP 5.5. [#403](https://github.com/
|
385 |
-
- :star2: New `NewUseConstFunction` sniff to detect use statements importing constants and functions as introduced in PHP 5.6. [#401](https://github.com/
|
386 |
-
- :star: `DeprecatedFunctions` sniff: recognize PHP 7.2 deprecated GD functions. [#392](https://github.com/
|
387 |
-
- :star: `DeprecatedIniDirectives` sniff: recognize PHP 7.2 deprecated `mbstring.func_overload` directive. [#377](https://github.com/
|
388 |
-
- :star: `NewClasses` sniff: check for the PHP 5.1 `libXMLError` class. [#412](https://github.com/
|
389 |
-
- :star: `NewClasses` sniff: recognize all native PHP Exception classes. [#418](https://github.com/
|
390 |
-
- :star: `
|
391 |
-
- :star: `NewFunctionParameters` sniff: recognize new `exclude_disabled` parameter for the `get_defined_functions()` function as introduced in PHP 7.0.15. [#375](https://github.com/
|
392 |
-
- :star: `NewFunctions` sniff: recognize new PHP 7.2 socket related functions. [#376](https://github.com/
|
393 |
-
- :star: `NewInterfaces` sniff: check for some more PHP native interfaces. [#411](https://github.com/
|
394 |
-
- :star: New `isClassProperty()`, `isClassConstant()` and `validDirectScope()` utility methods to the `PHPCompatibility_Sniff` class. [#393](https://github.com/
|
395 |
-
- :star: New `getTypeHintsFromFunctionDeclaration()` utility method to the `PHPCompatibility_Sniff` class. [#414](https://github.com/
|
396 |
-
- :umbrella: Unit tests against false positives for the `NewMagicMethods` sniff. [#381](https://github.com/
|
397 |
-
- :umbrella: More unit tests for the `getTestVersion()` utility method. [#405](https://github.com/
|
398 |
-
- :green_heart: The XML of the ruleset will now be validated and checked for consistent code style during the build testing by Travis. [#433](https://github.com/
|
399 |
-
- :books: Readme: information about setting `installed_paths` via a custom ruleset. [#407](https://github.com/
|
400 |
-
- :books: `Changelog.md` file containing a record of notable changes since the first tagged release. [#421](https://github.com/
|
401 |
|
402 |
### Changed
|
403 |
-
- :pushpin: The `ForbiddenNamesAsDeclared` sniff will now emit `warning`s for soft reserved keywords. [#406](https://github.com/
|
404 |
-
- :pushpin: The `ForbiddenNames` sniff will now allow for the more liberal rules for usage of reserved keywords as of PHP 7.0. [#417](https://github.com/
|
405 |
-
- :pushpin: The `InternalInterfaces`, `NewClasses`, `NewConstVisibility`, `NewInterfaces`, `NewMagicMethods`, `NonStaticMagicMethods` and `RemovedGlobalVariables` sniffs will now also sniff for and correctly report violations in combination with anonymous classes. [#378](https://github.com/
|
406 |
-
- :pushpin: The `NewClasses` and `NewInterfaces` sniffs will now also report on new classes/interfaces when used as type hints. [#414](https://github.com/
|
407 |
-
- :pushpin: The `NewClasses` sniff will now also report on Exception classes when used in (multi-)`catch` statements. [#418](https://github.com/
|
408 |
-
- :pushpin: The `NewScalarTypeDeclarations` sniff will now report on new type hints even when the type hint is nullable. [#379](https://github.com/
|
409 |
-
- :twisted_rightwards_arrows: The `NewNowdoc` sniff has been renamed to `NewNowdocQuotedHeredoc` and will now also check for double quoted heredoc identifiers as introduced in PHP 5.3. [#390](https://github.com/
|
410 |
-
- :rewind: The `NewClasses` sniff will now also report anonymous classes which `extend` a new sniff when used in combination with PHPCS 2.4.0-2.8.0. [#432](https://github.com/
|
411 |
-
- :pencil2: `NewFunctionParameter` sniff: version number precision for two parameters. [#384](https://github.com/
|
412 |
-
- :umbrella: Skipping two unit tests for the `ForbiddenClosureUseVariable` sniff when run on PHPCS 2.5.1 as these cause an infinite loop due to an upstream bug. [#408](https://github.com/
|
413 |
-
- :umbrella: Skipping unit tests involving `trait`s in combination with PHP < 5.4 and PHPCS < 2.4.0 as `trait`s are not recognized in those circumstances. [#431](https://github.com/
|
414 |
-
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#385](https://github.com/
|
415 |
-
- :recycle: Minor simplification of the PHPUnit 6 compatibility layer and other test code. [#426](https://github.com/
|
416 |
-
- General housekeeping. [#398](https://github.com/
|
417 |
-
- :wrench: Minor tweaks to the Travis build script. [#409](https://github.com/
|
418 |
-
- :green_heart: The sniffs are now also tested against PHP nightly for consistent results. [#380](https://github.com/
|
419 |
|
420 |
### Fixed
|
421 |
-
- :fire: Using unbounded ranges in `testVersion` resulted in unreported errors when used with sniffs using the `supportsBelow()` method. This affected the results of approximately half the sniffs. [#430](https://github.com/
|
422 |
-
- :bug: The `ForbiddenNames` sniff would throw false positives for `use` statements with the `final` modifier in traits. [#402](https://github.com/
|
423 |
-
- :bug: The `ForbiddenNames` sniff would fail to report on functions declared to return by reference using a reserved keyword as the function name. [#413](https://github.com/
|
424 |
-
- :bug: The `ForbiddenNames` sniff would only examine the first part of a namespace and not report on reserved keywords used in subsequent parts of a nested namespace. [#419](https://github.com/
|
425 |
-
- :bug: The `ForbiddenNames` sniff would not always correctly report on use statements importing constants or functions using reserved keywords. [#420](https://github.com/
|
426 |
-
- :bug: The `NewKeywords` sniff would sometimes fail to report on the `const` keyword when used in a class, but not for a class constant. [#424](https://github.com/
|
427 |
-
- :green_heart: PHPCS has released version 3.0 and updated the `master` branch to reflect this. This was causing the builds to fail. [#422](https://github.com/
|
428 |
|
429 |
### Credits
|
430 |
Thanks go out to [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap:
|
@@ -438,35 +881,35 @@ See all related issues and PRs in the [7.1.3 milestone].
|
|
438 |
- :zap: The `testVersion` config parameter now allows for specifying unbounded ranges.
|
439 |
For example: specifying `-5.6` means: check for compatibility with all PHP versions up to and including PHP 5.6;
|
440 |
Specifying `7.0-` means: check for compatibility with all PHP versions from PHP 7.0 upwards.
|
441 |
-
For more information about setting the `testVersion`, see [Using the compatibility sniffs](https://github.com/
|
442 |
-
- :umbrella: Unit test for multi-line short arrays for the `ShortArray` sniff. [#347](https://github.com/
|
443 |
-
- :umbrella: Various additional unit tests against false positives. [#345](https://github.com/
|
444 |
-
- :umbrella: Unit tests for the `supportsBelow()`, `supportsAbove()` and `getTestVersion()` utility methods. [#363](https://github.com/
|
445 |
-
- :books: Readme: information about installation of the standard using git check-out. [#349](https://github.com/
|
446 |
-
- :books: `Contributing.md` file with information about reporting bugs, requesting features, making pull requests and running the unit tests. [#350](https://github.com/
|
447 |
|
448 |
### Changed
|
449 |
-
- :pushpin: The `ForbiddenFunctionParametersWithSameName`, `NewScalarTypeDeclarations`, `ParameterShadowSuperGlobals` sniff will now also sniff for and report violations in closures. [#331](https://github.com/
|
450 |
-
- :twisted_rightwards_arrows: :rewind: The check for the PHP 5.3 `nowdoc` structure has been moved from the `NewKeywords` sniff to a new stand-alone `NewNowdoc` sniff which will now also recognize this structure when the sniffs are run on PHP 5.2. [#335](https://github.com/
|
451 |
-
- :rewind: The `ForbiddenNames` sniff will now also correctly recognize reserved keywords used in a declared namespace when run on PHP 5.2. [#362](https://github.com/
|
452 |
-
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#360](https://github.com/
|
453 |
- :recycle: The unit tests would previously run each test case file against all PHPCompatibility sniffs. Now, they will only be tested against the sniff which the test case file is intended to test. This allows for more test cases to be tested, more precise testing in combination with `testVersion` settings and makes the unit tests run ~6 x faster.
|
454 |
-
Relevant additional unit tests have been added and others adjusted. [#369](https://github.com/
|
455 |
-
- :recycle: Refactoring/tidying up of some unit test code. [#343](https://github.com/
|
456 |
-
- General housekeeping. [#346](https://github.com/
|
457 |
-
- :books: Readme: Clarify minimum requirements and influence on the results. [#348](https://github.com/
|
458 |
|
459 |
### Removed
|
460 |
-
- :twisted_rightwards_arrows: Removed the `LongArrays` sniff. The checks it contained have been moved into the `RemovedGlobalVariables` sniff. Both sniffs essentially did the same thing, just for different PHP native superglobals. [#354](https://github.com/
|
461 |
|
462 |
### Fixed
|
463 |
-
- :bug: The `PregReplaceEModifier` sniff would throw a false positive if a quote character was used as the regex delimiter. [#357](https://github.com/
|
464 |
-
- :bug: `RemovedGlobalVariables` sniff would report false positives for class properties shadowing the removed `$HTTP_RAW_POST_DATA` variables. [#354](https://github.com/
|
465 |
-
- :bug: The `getFQClassNameFromNewToken()` utility function could go into an infinite loop causing PHP to run out of memory when examining unfinished code (examination during live coding). [#338](https://github.com/
|
466 |
-
- :bug: The `determineNamespace()` utility method would in certain cases not break out a loop. [#358](https://github.com/
|
467 |
-
- :wrench: Travis script: Minor tweak for PHP 5.2 compatibility. [#341](https://github.com/
|
468 |
-
- :wrench: The unit test suite is now also compatible with PHPUnit 6. [#365](https://github.com/
|
469 |
-
- :books: Readme: Typo in the composer instructions. [#344](https://github.com/
|
470 |
|
471 |
### Credits
|
472 |
Thanks go out to [Arthur Edamov], [Juliette Reinders Folmer], [Mark Clements] and [Tadas Juozapaitis] for their contributions to this version. :clap:
|
@@ -477,42 +920,42 @@ Thanks go out to [Arthur Edamov], [Juliette Reinders Folmer], [Mark Clements] an
|
|
477 |
See all related issues and PRs in the [7.1.2 milestone].
|
478 |
|
479 |
### Added
|
480 |
-
- :star2: New `VariableVariables` sniff to detect variables variables for which the behaviour has changed in PHP 7.0. [#310](https://github.com/
|
481 |
-
- :star: The `NewReturnTypeDeclarations` sniff will now also sniff for non-scalar return type declarations, i.e. `array`, `callable`, `self` or a class name. [#323](https://github.com/
|
482 |
-
- :star: The `NewLanguageConstructs` sniff will now also sniff for the null coalesce equal operator `??=`. This operator is slated to be introduced in PHP 7.2 and PHPCS already accounts for it. [#340](https://github.com/
|
483 |
-
- :star: New `getReturnTypeHintToken()` utility method to the `PHPCompatibility_Sniff` class to retrieve return type hints from function declarations in a cross-PHPCS-version compatible way. [#323](https://github.com/
|
484 |
-
- :star: New `stripVariables()` utility method to the `PHPCompatibility_Sniff` class to strip variables from interpolated text strings. [#341](https://github.com/
|
485 |
-
- :umbrella: Additional unit tests covering previously uncovered code. [#308](https://github.com/
|
486 |
|
487 |
### Changed
|
488 |
-
- :pushpin: The `MbstringReplaceEModifier`, `PregReplaceEModifier` and `NewExecutionDirectives` sniffs will now also correctly interpret double quoted text strings with interpolated variables. [#341](https://github.com/
|
489 |
-
- :pushpin: The `NewNullableTypes` sniff will now also report on nullable (return) type hints when used with closures. [#323](https://github.com/
|
490 |
-
- :pushpin: The `NewReturnTypeDeclarations` sniff will now also report on return type hints when used with closures. [#323](https://github.com/
|
491 |
-
- :pushpin: Allow for anonymous classes in the `inClassScope()` utility method. [#315](https://github.com/
|
492 |
-
- :pushpin: The function call parameter related utility functions can now also be used to get the individual items from an array declaration. [#300](https://github.com/
|
493 |
-
- :twisted_rightwards_arrows: The `NewScalarReturnTypeDeclarations` sniff has been renamed to `NewReturnTypeDeclarations`. [#323](https://github.com/
|
494 |
-
- :rewind: The `ForbiddenNames` sniff will now also correctly ignore anonymous classes when used in combination with PHPCS < 2.3.4. [#319](https://github.com/
|
495 |
-
- :rewind: The `NewAnonymousClasses` sniff will now correctly recognize and report on anonymous classes when used in combination with PHPCS < 2.5.2. [#325](https://github.com/
|
496 |
-
- :rewind: The `NewGroupUseDeclarations` sniff will now correctly recognize and report on group use statements when used in combination with PHPCS < 2.6.0. [#320](https://github.com/
|
497 |
-
- :rewind: The `NewNullableTypes` sniff will now correctly recognize and report on nullable return types when used in combination with PHPCS < 2.6.0. [#323](https://github.com/
|
498 |
-
- :rewind: The `NewReturnTypeDeclarations` sniff will now correctly recognize and report on new return types when used in combination with PHPCS < 2.6.0. [#323](https://github.com/
|
499 |
-
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#317](https://github.com/
|
500 |
-
- :recycle: Defer to upstream `hasCondition()` utility method where appropriate. [#315](https://github.com/
|
501 |
-
- :recycle: Minor refactoring of some unit test code. [#304](https://github.com/
|
502 |
-
- :wrench: All unit tests now have appropriate `@group` annotations allowing for quicker/easier testing of a select group of tests/sniffs. [#305](https://github.com/
|
503 |
-
- :wrench: All unit tests now have appropriate `@covers` annotations to improve code coverage reporting and remove bleed through of accidental coverage. [#307](https://github.com/
|
504 |
-
- :wrench: Minor tweaks to the travis script. [#322](https://github.com/
|
505 |
-
- :green_heart: The PHPCompatibility code base itself will now be checked for cross-version compatibility during build testing. [#322](https://github.com/
|
506 |
|
507 |
### Fixed
|
508 |
-
- :bug: The `ConstantArraysUsingDefine` sniff would throw false positives if the value of the `define()` was retrieved via a function call and an array parameter was passed. [#327](https://github.com/
|
509 |
-
- :bug: The `ForbiddenCallTimePassByReference` sniff would throw false positives on assign by reference within function calls or conditions. [#302](https://github.com/
|
510 |
-
- :bug: The `ForbiddenGlobalVariableVariableSniff` sniff would only examine the first variable in a `global ...` statement causing unreported issues if subsequent variables were variable variables. [#316](https://github.com/
|
511 |
-
- :bug: The `NewKeywords` sniff would throw a false positive for the `const` keyword when encountered in an interface. [#312](https://github.com/
|
512 |
-
- :bug: The `NewNullableTypes` sniff would not report on nullable return types for namespaced classnames used as a type hint. [#323](https://github.com/
|
513 |
-
- :bug: The `PregReplaceEModifier` sniff would always consider the first parameter passed as a single regex, while it could also be an array of regexes. This led to false positives and potentially unreported use of the `e` modifier when an array of regexes was passed. [#300](https://github.com/
|
514 |
-
- :bug: The `PregReplaceEModifier` sniff could misidentify the regex delimiter when the regex to be examined was concatenated together from various text strings taken from a compound parameter leading to false positives. [#300](https://github.com/
|
515 |
-
- :white_check_mark: Compatibility with PHPCS 2.7.x. Deal with changed behaviour of the upstream PHP tokenizer and utility function(s). [#313](https://github.com/
|
516 |
|
517 |
### Credits
|
518 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
@@ -523,10 +966,10 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
|
|
523 |
See all related issues and PRs in the [7.1.1 milestone].
|
524 |
|
525 |
### Added
|
526 |
-
- :star: `ForbiddenNamesAsDeclared` sniff: detection of the PHP 7.1 `iterable` and `void` reserved keywords when used to name classes, interfaces or traits. [#298](https://github.com/
|
527 |
|
528 |
### Fixed
|
529 |
-
- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would incorrectly throw an error if the `clone` keyword was used with parenthesis. [#299](https://github.com/
|
530 |
|
531 |
### Credits
|
532 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
@@ -537,14 +980,14 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
|
|
537 |
See all related issues and PRs in the [7.1.0 milestone].
|
538 |
|
539 |
### Added
|
540 |
-
- :star: New `stringToErrorCode()`, `arrayKeysToLowercase()` and `addMessage()` utility methods to the `PHPCompatibility_Sniff` class. [#291](https://github.com/
|
541 |
|
542 |
### Changed
|
543 |
-
- :pushpin: All sniff error messages now have modular error codes allowing for selectively disabling individual checks - and even selectively disabling individual sniff for specific files - without disabling the complete sniff. [#291](https://github.com/
|
544 |
-
- :pencil2: Minor changes to some of the error message texts for consistency across sniffs. [#291](https://github.com/
|
545 |
-
- :recycle: Refactored the complex version sniffs to reduce code duplication. [#291](https://github.com/
|
546 |
-
- :recycle: Miscellaneous other refactoring for improved performance and sniff accuracy. [#291](https://github.com/
|
547 |
-
- :umbrella: The unit tests for the `RemovedExtensions` sniff now verify that the correct alternative extension is being suggested. [#291](https://github.com/
|
548 |
|
549 |
### Credits
|
550 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
@@ -555,28 +998,28 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
|
|
555 |
See all related issues and PRs in the [7.0.8 milestone].
|
556 |
|
557 |
### Added
|
558 |
-
- :star2: New `ForbiddenNamesAsDeclared` sniff: detection of the [other reserved keywords](http://php.net/manual/en/reserved.other-reserved-words.php) which are reserved as of PHP 7.0 (or higher). [#287](https://github.com/
|
559 |
These were previously sniffed for by the `ForbiddenNames` and `ForbiddenNamesAsInvokedFunctions` sniffs causing false positives as the rules for their reservation are different from the rules for "normal" [reserved keywords](http://php.net/manual/en/reserved.keywords.php).
|
560 |
-
- :star: New `inUseScope()` utility method to the `PHPCompatibility_Sniff` class which handles PHPCS cross-version compatibility when determining the scope of a `use` statement. [#271](https://github.com/
|
561 |
-
- :umbrella: More unit tests for the `ForbiddenNames` sniff. [#271](https://github.com/
|
562 |
|
563 |
### Changed
|
564 |
-
- :pushpin: _Deprecated_ functionality should throw a `warning`. _Removed_ or otherwise unavailable functionality should throw an `error`. This distinction was previously not consistently applied everywhere. [#286](https://github.com/
|
565 |
This change affects the following sniffs:
|
566 |
* `DeprecatedPHP4StyleConstructors` will now throw a `warning` instead of an `error` for deprecated PHP4 style class constructors.
|
567 |
* `ForbiddenCallTimePassByReference` will now throw a `warning` if the `testVersion` is `5.3` and an `error` if the `testVersion` if `5.4` or higher.
|
568 |
* `MbstringReplaceEModifier` will now throw a `warning` instead of an `error` for usage of the deprecated `e` modifier.
|
569 |
-
* `PregReplaceEModifier` will now throw a `warning` if the `testVersion` is `5.5` or `5.6` and an `error` if the `testVersion` if `7.0` or higher. Fixes [#290](https://github.com/
|
570 |
* `TernaryOperators` will now throw an `error` when the `testVersion` < `5.3` and the middle part has been omitted.
|
571 |
* `ValidIntegers` will now throw a `warning` when an invalid binary integer is detected.
|
572 |
-
- :pencil2: `DeprecatedFunctions` and `DeprecatedIniDirectives` sniffs: minor change in the sniff error message text. Use _"removed"_ rather than the ominous _"forbidden"_. [#285](https://github.com/
|
573 |
Also updated relevant internal variable names and documentation to match.
|
574 |
|
575 |
### Fixed
|
576 |
-
- :bug: `ForbiddenNames` sniff would throw false positives for `use` statements which changed the visibility of methods in traits. [#271](https://github.com/
|
577 |
-
- :bug: `ForbiddenNames` sniff would not report reserved keywords when used in combination with `use function` or `use const`. [#271](https://github.com/
|
578 |
-
- :bug: `ForbiddenNames` sniff would potentially - unintentionally - skip over tokens, thereby - potentially - not reporting all errors. [#271](https://github.com/
|
579 |
-
- :wrench: Composer config: `prefer-stable` should be a root element of the json file. Fixes [#277](https://github.com/
|
580 |
|
581 |
### Credits
|
582 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
@@ -587,39 +1030,39 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
|
|
587 |
See all related issues and PRs in the [7.0.7 milestone].
|
588 |
|
589 |
### Added
|
590 |
-
- :star2: New `ForbiddenBreakContinueOutsideLoop` sniff: verify that `break`/`continue` is not used outside of a loop structure. This will cause fatal errors since PHP 7.0. [#278](https://github.com/
|
591 |
-
- :star2: New `NewConstVisibility` sniff: detect visibility indicators for `class` and `interface` constants as introduced in PHP 7.1. [#280](https://github.com/
|
592 |
-
- :star2: New `NewHashAlgorithms` sniff to check used hash algorithms against the PHP version in which they were introduced. [#242](https://github.com/
|
593 |
-
- :star2: New `NewMultiCatch` sniff: detect catch statements catching multiple Exceptions as introduced in PHP 7.1. [#281](https://github.com/
|
594 |
-
- :star2: New `NewNullableTypes` sniff: detect nullable parameter and return type hints (only supported in PHPCS >= 2.3.4) as introduced in PHP 7.1. [#282](https://github.com/
|
595 |
-
- :star: `DeprecatedIniDirectives` sniff: recognize PHP 7.1 removed `session` ini directives. [#256](https://github.com/
|
596 |
-
- :star: `NewFunctions` sniff: recognize new `socket_export_stream()` function as introduced in PHP 7.0.7. [#264](https://github.com/
|
597 |
-
- :star: `NewFunctions` sniff: recognize new `curl_...()`, `is_iterable()`, `pcntl_async_signals()`, `session_create_id()`, `session_gc()` functions as introduced in PHP 7.1. [#273](https://github.com/
|
598 |
-
- :star: `NewFunctionParameters` sniff: recognize new OpenSSL function parameters as introduced in PHP 7.1. [#258](https://github.com/
|
599 |
-
- :star: `NewIniDirectives` sniff: recognize new `session` ini directives as introduced in PHP 7.1. [#259](https://github.com/
|
600 |
-
- :star: `NewScalarReturnTypeDeclarations` sniff: recognize PHP 7.1 `void` return type hint. [#250](https://github.com/
|
601 |
-
- :star: `NewScalarTypeDeclarations` sniff: recognize PHP 7.1 `iterable` type hint. [#255](https://github.com/
|
602 |
-
- :star: Recognize the PHP 7.1 deprecated `mcrypt` functionality in the `RemovedExtensions`, `DeprecatedFunctions` and `DeprecatedIniDirectives` sniffs. [#257](https://github.com/
|
603 |
|
604 |
### Changed
|
605 |
-
- :pushpin: `LongArrays` sniff used to only throw `warning`s. It will now throw `error`s for PHP versions in which the long superglobals have been removed. [#270](https://github.com/
|
606 |
-
- :pushpin: The `NewIniDirectives` sniff used to always throw an `warning`. Now it will throw an `error` when a new ini directive is used in combination with `ini_set()`. [#246](https://github.com/
|
607 |
-
- :pushpin: `RemovedHashAlgorithms` sniff: also recognize removed algorithms when used with the PHP 5.5+ `hash_pbkdf2()` function. [#240](https://github.com/
|
608 |
-
- :pushpin: Properly recognize nullable type hints in the `getMethodParameters()` utility method. [#282](https://github.com/
|
609 |
-
- :pencil2: `DeprecatedPHP4StyleConstructors` sniff: minor error message text fix. [#236](https://github.com/
|
610 |
-
- :pencil2: `NewIniDirectives` sniff: improved precision for the introduction version numbers being reported. [#246](https://github.com/
|
611 |
-
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#238](https://github.com/
|
612 |
-
- :umbrella: Re-activate the unit tests for the `NewScalarReturnTypeDeclarations` sniff. [#250](https://github.com/
|
613 |
|
614 |
### Fixed
|
615 |
-
- :bug: The `DeprecatedPHP4StyleConstructors` sniff would not report errors when the case of the class name and the PHP4 constructor function name did not match. [#236](https://github.com/
|
616 |
-
- :bug: `LongArrays` sniff would report false positives for class properties shadowing removed PHP superglobals. [#270](https://github.com/
|
617 |
-
- :bug: The `NewClasses` sniff would not report errors when the case of the class name used and "official" class name did not match. [#237](https://github.com/
|
618 |
-
- :bug: The `NewIniDirectives` sniff would report violations against the PHP version in which the ini directive was introduced. This should be the version below it. [#246](https://github.com/
|
619 |
-
- :bug: `PregReplaceEModifier` sniff would report false positives for compound regex parameters with different quote types. [#266](https://github.com/
|
620 |
-
- :bug: `RemovedGlobalVariables` sniff would report false positives for lowercase/mixed cased variables shadowing superglobals. [#245](https://github.com/
|
621 |
-
- :bug: The `RemovedHashAlgorithms` sniff would not report errors when the case of the hash function name used and "official" class name did not match. [#240](https://github.com/
|
622 |
-
- :bug: The `ShortArray` sniff would report all violations on the line of the PHP open tag, not on the lines of the short array open/close tags. [#238](https://github.com/
|
623 |
|
624 |
### Credits
|
625 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
@@ -630,27 +1073,27 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
|
|
630 |
See all related issues and PRs in the [7.0.6 milestone].
|
631 |
|
632 |
### Added
|
633 |
-
- :star: New `stripQuotes()` utility method in the `PHPCompatibility_Sniff` base class to strip quotes which surround text strings in a consistent manner. [#224](https://github.com/
|
634 |
-
- :books: Readme: Add _PHP Version Support_ section. [#225](https://github.com/
|
635 |
|
636 |
### Changed
|
637 |
-
- :pushpin: The `ForbiddenCallTimePassByReference` sniff will now also report the deprecation as of PHP 5.3, not just its removal as of PHP 5.4. [#203](https://github.com/
|
638 |
-
- :pushpin: The `NewFunctionArrayDereferencing` sniff will now also check _method_ calls for array dereferencing, not just function calls. [#229](https://github.com/
|
639 |
-
- :pencil2: The `NewExecutionDirectives` sniff will now throw `warning`s instead of `error`s for invalid values encountered in execution directives. [#223](https://github.com/
|
640 |
-
- :pencil2: Minor miscellaneous fixes. [#231](https://github.com/
|
641 |
-
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#219](https://github.com/
|
642 |
-
- :recycle: Defer to upstream `findImplementedInterfaceNames()` utility method when it exists. [#222](https://github.com/
|
643 |
-
- :wrench: Exclude the test files from analysis by Scrutinizer CI. [#230](https://github.com/
|
644 |
|
645 |
### Removed
|
646 |
-
- :no_entry_sign: Some redundant code. [#232](https://github.com/
|
647 |
|
648 |
### Fixed
|
649 |
-
- :bug: The `EmptyNonVariable` sniff would throw false positives for variable variables and for array access with a (partially) variable array index. [#212](https://github.com/
|
650 |
-
- :bug: The `NewFunctionArrayDereferencing` sniff would throw false positives for lines of code containing both a function call as well as square brackets, even when they were unrelated. [#228](https://github.com/
|
651 |
-
- :bug: `ParameterShadowSuperGlobals` sniff would report false positives for lowercase/mixed cased variables shadowing superglobals. [#218](https://github.com/
|
652 |
-
- :bug: The `determineNamespace()` utility method now accounts properly for namespaces within scoped `declare()` statements. [#221](https://github.com/
|
653 |
-
- :books: Readme: Logo alignment in the Credits section. [#233](https://github.com/
|
654 |
|
655 |
### Credits
|
656 |
Thanks go out to [Jason Stallings], [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap:
|
@@ -661,36 +1104,36 @@ Thanks go out to [Jason Stallings], [Juliette Reinders Folmer] and [Mark Clement
|
|
661 |
See all related issues and PRs in the [7.0.5 milestone].
|
662 |
|
663 |
### Added
|
664 |
-
- :star2: New `MbstringReplaceEModifier` sniff to detect the use of the PHP 7.1 deprecated `e` modifier in Mbstring regex functions. [#202](https://github.com/
|
665 |
-
- :star: The `ForbiddenBreakContinueVariableArguments` sniff will now also report on `break 0`/`continue 0` which is not allowed since PHP 5.4. [#209](https://github.com/
|
666 |
-
- :star: New `getFunctionCallParameters()`, `getFunctionCallParameter()` utility methods in the `PHPCompatibility_Sniff` base class. [#170](https://github.com/
|
667 |
-
- :star: New `tokenHasScope()` utility method in the `PHPCompatibility_Sniff` base class. [#189](https://github.com/
|
668 |
-
- :umbrella: Unit test for `goto` and `callable` detection and some other miscellanous extra unit tests for the `NewKeywords` sniff. [#189](https://github.com/
|
669 |
-
- :books: Readme: Information for sniff developers about running unit tests for _other_ sniff libraries using the PHPCS native test framework without running into conflicts with the PHPCompatibility specific unit test framework. [#217](https://github.com/
|
670 |
|
671 |
### Changed
|
672 |
-
- :pushpin: The `ForbiddenNames` sniff will now also check interface declarations for usage of reserved keywords. [#200](https://github.com/
|
673 |
-
- :pushpin: `PregReplaceEModifier` sniff: improved handling of regexes build up of a combination of variables, function calls and/or text strings. [#201](https://github.com/
|
674 |
-
- :rewind: The `NewKeywords` sniff will now also correctly recognize new keywords when used in combination with older PHPCS versions and/or run on older PHP versions. [#189](https://github.com/
|
675 |
-
- :pencil2: `PregReplaceEModifier` sniff: minor improvement to the error message text. [#201](https://github.com/
|
676 |
-
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#170](https://github.com/
|
677 |
-
- :wrench: The unit tests for the utility methods have been moved to their own subdirectory within `Tests`. [#215](https://github.com/
|
678 |
-
- :green_heart: The sniffs are now also tested against PHP 7.1 for consistent results. [#216](https://github.com/
|
679 |
|
680 |
### Removed
|
681 |
-
- :no_entry_sign: Some redundant code. [26d0b6](https://github.com/
|
682 |
|
683 |
### Fixed
|
684 |
-
- :bug: `ConstantArraysUsingDefine` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#199](https://github.com/
|
685 |
-
- :bug: The `DeprecatedIniDirectives` and `NewIniDirectives` sniffs could potentially trigger on the ini value instead of the ini directive name. [#170](https://github.com/
|
686 |
-
- :bug: `ForbiddenNames` sniff: Reserved keywords when used as the name of a constant declared using `define()` would always be reported independently of the `testVersion` set. [#200](https://github.com/
|
687 |
-
- :bug: `PregReplaceEModifier` sniff would not report errors when the function name used was not in lowercase. [#201](https://github.com/
|
688 |
-
- :bug: `TernaryOperators` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#188](https://github.com/
|
689 |
-
- :bug: The `getFQClassNameFromNewToken()` and `getFQClassNameFromDoubleColonToken()` utility methods would get confused when the class name was a variable instead of being hard-coded, resulting in a PHP warning being thown. [#206](https://github.com/
|
690 |
-
- :bug: The `getFunctionCallParameters()` utility method would incorrectly identify an extra parameter if the last parameter passed to a function would have an - unnecessary - comma after it. The `getFunctionCallParameters()` utility method also did not handle parameters passed as short arrays correctly. [#213](https://github.com/
|
691 |
-
- :umbrella: Unit tests for the `NewFunctionArrayDereferencing` sniff were not being run due to a naming error. [#208](https://github.com/
|
692 |
-
- :books: Readme: Information about setting the `testVersion` from a custom ruleset was incorrect. [#204](https://github.com/
|
693 |
-
- :wrench: Path to PHPCS in the unit tests breaking for non-Composer installs. [#198](https://github.com/
|
694 |
|
695 |
### Credits
|
696 |
Thanks go out to [Juliette Reinders Folmer] and [Yoshiaki Yoshida] for their contributions to this version. :clap:
|
@@ -701,32 +1144,32 @@ Thanks go out to [Juliette Reinders Folmer] and [Yoshiaki Yoshida] for their con
|
|
701 |
See all related issues and PRs in the [7.0.4 milestone].
|
702 |
|
703 |
### Added
|
704 |
-
- :star2: New `EmptyNonVariable` sniff: detection of empty being used on non-variables for PHP < 5.5. [#187](https://github.com/
|
705 |
-
- :star2: New `NewMagicMethods` sniff: detection of declaration of magic methods before the method became "magic". Includes a check for the changed behaviour for the `__toString()` magic method in PHP 5.2. [#176](https://github.com/
|
706 |
-
- :star2: New `RemovedAlternativePHPTags` sniff: detection of ASP and script open tags for which support was removed in PHP 7.0. [#184](https://github.com/
|
707 |
- :star: `NonStaticMagicMethods` sniff: detection of the `__callStatic()`, `__sleep()`, `__toString()` and `__set_state()` magic methods.
|
708 |
-
- :green_heart: Lint all non-test case files for syntax errors during the build testing by Travis. [#192](https://github.com/
|
709 |
|
710 |
### Changed
|
711 |
-
- :pushpin: `NonStaticMagicMethods` sniff: will now also sniff `trait`s for magic methods. [#174](https://github.com/
|
712 |
-
- :pushpin: `NonStaticMagicMethods` sniff: will now also check for magic methods which should be declared as `static`. [#174](https://github.com/
|
713 |
-
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#178](https://github.com/
|
714 |
-
- :recycle: The unit test suite now internally caches PHPCS run results in combination with a set `testVersion` to speed up the running of the unit tests. These are now ~3 x faster. [#148](https://github.com/
|
715 |
- :books: Readme: Minor clarification of the minimum requirements.
|
716 |
- :books: Readme: Advise to use the latest stable version of this repository.
|
717 |
-
- :wrench: The unit tests can now be run with PHPCS installed in an arbitrary location by passing the location through an environment option. [#191](https://github.com/
|
718 |
-
- :wrench: Improved coveralls configuration and compatibility. [#194](https://github.com/
|
719 |
-
- :green_heart: The sniffs are now also tested against PHP 5.2 for consistent results. Except for namespace, trait and group use related errors, most sniffs work as intended on PHP 5.2. [#196](https://github.com/
|
720 |
|
721 |
### Fixed
|
722 |
-
- :bug: The `ForbiddenBreakContinueVariableArguments` sniff would not report on `break`/`continue` with a closure as an argument. [#171](https://github.com/
|
723 |
-
- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would not report on reserved keywords which were not lowercase. [#186](https://github.com/
|
724 |
-
- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would not report on the `goto` and `namespace` keywords when run on PHP 5.2. [#193](https://github.com/
|
725 |
-
- :bug: `NewAnonymousClasses` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#195](https://github.com/
|
726 |
-
- :bug: `NewGroupUseDeclarations` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#190](https://github.com/
|
727 |
-
- :bug: The `NonStaticMagicMethods` sniff would not report on magic methods when the function name as declared was not in the same case as used in the PHP manual. [#174](https://github.com/
|
728 |
-
- :wrench: The unit tests would exit with `0` if PHPCS could not be found. [#191](https://github.com/
|
729 |
-
- :green_heart: The PHPCompatibility library itself was not fully compatible with PHP 5.2. [#193](https://github.com/
|
730 |
|
731 |
### Credits
|
732 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
@@ -737,65 +1180,65 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
|
|
737 |
See all related issues and PRs in the [7.0.3 milestone].
|
738 |
|
739 |
### Added
|
740 |
-
- :star2: New `InternalInterfaces` sniff: detection of internal PHP interfaces being which should not be implemented by user land classes. [#144](https://github.com/
|
741 |
-
- :star2: New `LateStaticBinding` sniff: detection of PHP 5.3 late static binding. [#177](https://github.com/
|
742 |
-
- :star2: New `NewExecutionDirectives` sniff: verify execution directives set with `declare()`. [#169](https://github.com/
|
743 |
-
- :star2: New `NewInterfaces` sniff: detection of the use of newly introduced PHP native interfaces. This sniff will also detect unsupported methods when a class implements the `Serializable` interface. [#144](https://github.com/
|
744 |
-
- :star2: New `RequiredOptionalFunctionParameters` sniff: detection of missing function parameters which were required in earlier PHP versions only to become optional in later versions. [#165](https://github.com/
|
745 |
-
- :star2: New `ValidIntegers` sniff: detection of binary integers for PHP < 5.4, detection of hexademical numeric strings for which recognition as hex integers was removed in PHP 7.0, detection of invalid binary and octal integers. [#160](https://github.com/
|
746 |
-
- :star: `DeprecatedExtensions` sniff: detect removal of the `ereg` extension in PHP 7. [#149](https://github.com/
|
747 |
-
- :star: `DeprecatedFunctions` sniff: detection of the PHP 5.0.5 deprecated `php_check_syntax()` and PHP 5.4 deprecated `mysqli_get_cache_stats()` functions. [#155](https://github.com/
|
748 |
-
- :star: `DeprecatedFunctions` sniff: detect deprecation of a number of the `mysqli` functions in PHP 5.3. [#149](https://github.com/
|
749 |
-
- :star: `DeprecatedFunctions` sniff: detect removal of the `call_user_method()`, `ldap_sort()`, `ereg_*()` and `mysql_*()` functions in PHP 7.0. [#149](https://github.com/
|
750 |
-
- :star: `DeprecatedIniDirectives` sniff: detection of a _lot_ more deprecated/removed ini directives. [#146](https://github.com/
|
751 |
-
- :star: `NewFunctionParameters` sniff: detection of a _lot_ more new function parameters. [#164](https://github.com/
|
752 |
-
- :star: `NewFunctions` sniff: detection of numerous extra new functions. [#161](https://github.com/
|
753 |
-
- :star: `NewIniDirectives` sniff: detection of a _lot_ more new ini directives. [#146](https://github.com/
|
754 |
-
- :star: `NewLanguageConstructs` sniff: detection of the PHP 5.6 ellipsis `...` construct. [#175](https://github.com/
|
755 |
-
- :star: `NewScalarTypeDeclarations` sniff: detection of PHP 5.1 `array` and PHP 5.4 `callable` type hints. [#168](https://github.com/
|
756 |
-
- :star: `RemovedFunctionParameters` sniff: detection of a few extra removed function parameters. [#163](https://github.com/
|
757 |
-
- :star: Detection of functions and methods with a double underscore prefix as these are reserved by PHP for future use. The existing upstream `Generic.NamingConventions.CamelCapsFunctionName` sniff is re-used for this with some customization. [#173](https://github.com/
|
758 |
-
- :star: New `getFQClassNameFromNewToken()`, `getFQExtendedClassName()`, `getFQClassNameFromDoubleColonToken()`, `getFQName()`, `isNamespaced()`, `determineNamespace()` and `getDeclaredNamespaceName()` utility methods in the `PHPCompatibility_Sniff` base class for namespace determination. [#162](https://github.com/
|
759 |
-
- :recycle: New `inClassScope()` utility method in the `PHPCompatibility_Sniff` base class. [#168](https://github.com/
|
760 |
-
- :recycle: New `doesFunctionCallHaveParameters()` and `getFunctionCallParameterCount()` utility methods in the `PHPCompatibility_Sniff` base class. [#153](https://github.com/
|
761 |
- :umbrella: Unit test for `__halt_compiler()` detection by the `NewKeywords` sniff.
|
762 |
-
- :umbrella: Unit tests for the `NewFunctions` sniff. [#161](https://github.com/
|
763 |
-
- :umbrella: Unit tests for the `ParameterShadowSuperGlobals` sniff. [#180](https://github.com/
|
764 |
-
- :wrench: Minimal config for Scrutinizer CI. [#145](https://github.com/
|
765 |
|
766 |
### Changed
|
767 |
-
- :pushpin: The `DeprecatedIniDirectives` and the `NewIniDirectives` sniffs will now indicate an alternative ini directive in case the directive has been renamed. [#146](https://github.com/
|
768 |
-
- :pushpin: The `NewClasses` sniff will now also report on new classes being extended by child classes. [#140](https://github.com/
|
769 |
-
- :pushpin: The `NewClasses` sniff will now also report on static use of new classes. [#162](https://github.com/
|
770 |
-
- :pushpin: The `NewScalarTypeDeclarations` sniff will now throw an error on use of type hints pre-PHP 5.0. [#168](https://github.com/
|
771 |
-
- :pushpin: The `NewScalarTypeDeclarations` sniff will now verify type hints used against typical mistakes. [#168](https://github.com/
|
772 |
-
- :pushpin: The `ParameterShadowSuperGlobals` sniff will now do a case-insensitive variable name compare. [#180](https://github.com/
|
773 |
-
- :pushpin: The `RemovedFunctionParameters` sniff will now also report `warning`s on deprecation of function parameters. [#163](https://github.com/
|
774 |
-
- :twisted_rightwards_arrows: The check for `JsonSerializable` has been moved from the `NewClasses` sniff to the `NewInterfaces` sniff. [#162](https://github.com/
|
775 |
-
- :rewind: The `NewLanguageConstructs` sniff will now also recognize new language constructs when used in combination with PHPCS 1.5.x. [#175](https://github.com/
|
776 |
-
- :pencil2: `NewFunctionParameters` sniff: use correct name for the new parameter for the `dirname()` function. [#164](https://github.com/
|
777 |
-
- :pencil2: `NewScalarTypeDeclarations` sniff: minor change in the sniff error message text. [#168](https://github.com/
|
778 |
-
- :pencil2: `RemovedFunctionParameters` sniff: minor change in the sniff error message text. [#163](https://github.com/
|
779 |
-
- :pencil2: The `ParameterShadowSuperGlobals` sniff now extends the `PHPCompatibility_Sniff` class. [#180](https://github.com/
|
780 |
-
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#181](https://github.com/
|
781 |
-
- :recycle: Various refactoring to remove code duplication in the unit tests and add proper test skip notifications where relevant. [#139](https://github.com/
|
782 |
|
783 |
### Fixed
|
784 |
-
- :bug: The `DeprecatedFunctions` sniff was reporting an incorrect deprecation/removal version number for a few functions. [#149](https://github.com/
|
785 |
-
- :bug: The `DeprecatedIniDirectives` sniff was in select cases reporting deprecation of an ini directive prior to removal, while the ini directive was never deprecated prior to its removal. [#146](https://github.com/
|
786 |
-
- :bug: The `DeprecatedPHP4StyleConstructors` sniff would cause false positives for methods with the same name as the class in namespaced classes. [#167](https://github.com/
|
787 |
-
- :bug: The `ForbiddenEmptyListAssignment` sniff did not report errors when there were only comments or parentheses between the list parentheses. [#166](https://github.com/
|
788 |
-
- :bug: The `ForbiddenEmptyListAssignment` sniff will no longer cause false positives during live coding. [#166](https://github.com/
|
789 |
-
- :bug: The `NewClasses` sniff would potentially misidentify namespaced classes as PHP native classes. [#161](https://github.com/
|
790 |
-
- :bug: The `NewFunctions` sniff would fail to identify called functions when the function call was not lowercase. [#161](https://github.com/
|
791 |
-
- :bug: The `NewFunctions` sniff would potentially misidentify namespaced userland functions as new functions. [#161](https://github.com/
|
792 |
-
- :bug: The `NewIniDirectives` sniff was reporting an incorrect introduction version number for a few ini directives. [#146](https://github.com/
|
793 |
-
- :bug: `NewKeywords` sniff: the use of the `const` keyword should only be reported when used outside of a class for PHP < 5.3. [#147](https://github.com/
|
794 |
-
- :bug: The `RemovedExtensions` sniff was incorrectly reporting a number of extensions as being removed in PHP 5.3 while they were actually removed in PHP 5.1. [#156](https://github.com/
|
795 |
-
- :bug: :recycle: The `NewFunctionParameters` and `RemovedFunctionParameters` now use the new `doesFunctionCallHaveParameters()` and `getFunctionCallParameterCount()` utility methods for improved accuracy in identifying function parameters. This fixes several false positives. [#153](https://github.com/
|
796 |
-
- :bug: A number of sniffs would return `false` if the examined construct was not found. This could potentially cause race conditions/infinite sniff loops. [#138](https://github.com/
|
797 |
-
- :wrench: The unit tests would fail to run when used in combination with a PEAR install of PHPCS. [#157](https://github.com/
|
798 |
-
- :green_heart: Unit tests failing against PHPCS 2.6.1. [#158](https://github.com/
|
799 |
The unit tests *will* still fail against PHPCS 2.6.2 due to a bug in PHPCS itself. This bug does not affect the running of the sniffs outside of a unit test context.
|
800 |
|
801 |
### Credits
|
@@ -807,13 +1250,13 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
|
|
807 |
See all related issues and PRs in the [7.0.2 milestone].
|
808 |
|
809 |
### Added
|
810 |
-
- :star: `RemovedExtensions` sniff: ability to whitelist userland functions for which the function prefix overlaps with a prefix of a deprecated/removed extension. [#130](https://github.com/
|
811 |
-
To use this feature, add the `functionWhitelist` property in your custom ruleset. For more information, see the [README](https://github.com/
|
812 |
|
813 |
### Changed
|
814 |
-
- :pencil2: A number of sniffs contained `public` class properties. Within PHPCS, `public` properties can be overruled via a custom ruleset. This was not the intention, so the visibility of these properties has been changed to `protected`. [#135](https://github.com/
|
815 |
- :wrench: Composer config: Stable packages are preferred over unstable/dev.
|
816 |
-
- :pencil2: Ruleset name. [#134](https://github.com/
|
817 |
|
818 |
### Credits
|
819 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
@@ -824,18 +1267,18 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
|
|
824 |
See all related issues and PRs in the [7.0.1 milestone].
|
825 |
|
826 |
### Changed
|
827 |
-
- :pushpin: The `DeprecatedIniDirectives` sniff used to throw an `error` when a deprecated ini directive was used in combination with `ini_get()`. It will now throw a `warning` instead. [#122](https://github.com/
|
828 |
Usage of deprecated ini directives in combination with `ini_set()` will still throw an `error`.
|
829 |
-
- :pushpin: The `PregReplaceEModifier` sniff now also detects the `e` modifier when used with the `preg_filter()` function. While this is undocumented, the `e` modifier was supported by the `preg_filter()` function as well. [#128](https://github.com/
|
830 |
-
- :pencil2: The `RemovedExtensions` sniff contained superfluous deprecation information in the error message. [#131](https://github.com/
|
831 |
|
832 |
### Removed
|
833 |
-
- :wrench: Duplicate builds from the Travis CI build matrix. [#132](https://github.com/
|
834 |
|
835 |
### Fixed
|
836 |
-
- :bug: The `ForbiddenNames` sniff did not allow for the PHP 5.6 `use function ...` and `use const ...` syntax. [#126](https://github.com/
|
837 |
-
- :bug: The `NewClasses` sniff failed to detect new classes when the class was instantiated without parenthesis, i.e. `new NewClass;`. [#121](https://github.com/
|
838 |
-
- :bug: The `PregReplaceEModifier` sniff failed to detect the `e` modifier when using bracket delimiters for the regex other than the `{}` brackets. [#128](https://github.com/
|
839 |
- :green_heart: Unit tests failing against PHPCS 2.6.1.
|
840 |
|
841 |
### Credits
|
@@ -847,57 +1290,58 @@ Thanks go out to [Jason Stallings], [Juliette Reinders Folmer] and [Ryan Neufeld
|
|
847 |
See all related issues and PRs in the [7.0 milestone].
|
848 |
|
849 |
### Added
|
850 |
-
- :zap: Ability to specify a range of PHP versions against which to test your code base for compatibility, i.e. `--runtime-set testVersion 5.0-5.4` will now test your code for compatibility with PHP 5.0 up to PHP 5.4. [#99](https://github.com/
|
851 |
-
- :star2: New `NewFunctionArrayDereferencing` sniff to detect function array dereferencing as introduced in PHP 5.4. Fixes [#52](https://github.com/
|
852 |
-
- :star2: New `ShortArray` sniff to detect short array syntax as introduced in PHP 5.4. [#97](https://github.com/
|
853 |
-
- :star2: New `TernaryOperators` sniff to detect ternaries without the middle part (`elvis` operator) as introduced in PHP 5.3. [#101](https://github.com/
|
854 |
-
- :star2: New `ConstantArraysUsingDefine` sniff to detect constants declared using `define()` being assigned an `array` value which was not allowed prior to PHP 7.0. [#110](https://github.com/
|
855 |
-
- :star2: New `DeprecatedPHP4StyleConstructors` sniff to detect PHP 4 style class constructor methods which are deprecated as of PHP 7. [#109](https://github.com/
|
856 |
-
- :star2: New `ForbiddenEmptyListAssignment` sniff to detect empty list() assignments which have been removed in PHP 7.0. [#110](https://github.com/
|
857 |
-
- :star2: New `ForbiddenFunctionParametersWithSameName` sniff to detect functions declared with multiple same-named parameters which is no longer accepted since PHP 7.0. [#110](https://github.com/
|
858 |
-
- :star2: New `ForbiddenGlobalVariableVariable` sniff to detect variable variables being made `global` which is not allowed since PHP 7.0. [#110](https://github.com/
|
859 |
-
- :star2: New `ForbiddenNegativeBitshift` sniff to detect bitwise shifts by negative number which will throw an ArithmeticError in PHP 7.0. [#110](https://github.com/
|
860 |
-
- :star2: New `ForbiddenSwitchWithMultipleDefaultBlocks` sniff to detect switch statements with multiple default blocks which is not allowed since PHP 7.0. [#110](https://github.com/
|
861 |
-
- :star2: New `NewAnonymousClasses` sniff to detect anonymous classes as introduced in PHP 7.0. [#110](https://github.com/
|
862 |
-
- :star2: New `
|
863 |
-
- :star2: New `
|
864 |
-
- :star2: New `
|
865 |
-
- :star2: New `
|
866 |
-
- :star2: New `
|
867 |
-
- :star2: New `
|
868 |
-
- :
|
869 |
-
- :star: `
|
870 |
-
- :star: `
|
871 |
-
- :star: `NewKeywords` sniff: detection of the PHP 5.
|
872 |
-
- :star: `NewKeywords` sniff: detection of the
|
873 |
-
- :star: `
|
874 |
-
- :star: `
|
875 |
-
- :star: `
|
876 |
-
- :star: `
|
877 |
-
- :star: `
|
878 |
-
- :star: `
|
879 |
-
- :star: `
|
880 |
-
- :
|
|
|
881 |
- :books: Readme: New section containing information about the use of the `testVersion` config variable.
|
882 |
- :books: Readme: Sponsor credits.
|
883 |
|
884 |
### Changed
|
885 |
-
- :pushpin: The `DeprecatedIniDirectives` sniff used to always throw an `warning`. Now it will throw an `error` when a removed ini directive is used. [#110](https://github.com/
|
886 |
-
- :pushpin: The `DeprecatedNewReference` sniff will now throw an error when the `testVersion` includes PHP 7.0 or higher. [#110](https://github.com/
|
887 |
-
- :pushpin: The `ForbiddenNames` sniff now supports detection of reserved keywords when used in combination with PHP 7 anonymous classes. [#108](https://github.com/
|
888 |
-
- :pushpin: The `PregReplaceEModifier` sniff will now throw an error when the `testVersion` includes PHP 7.0 or higher. [#110](https://github.com/
|
889 |
-
- :pencil2: `NewKeywords` sniff: clarified the error message text for the `use` keyword. Fixes [#46](https://github.com/
|
890 |
-
- :recycle: Minor refactor of the `testVersion` related utility functions. [#98](https://github.com/
|
891 |
-
- :wrench: Add autoload to the `composer.json` file. [#96](https://github.com/
|
892 |
-
- :wrench: Minor other updates to the `composer.json` file. [#75](https://github.com/
|
893 |
- :wrench: Improved creation of the code coverage reports needed by coveralls via Travis.
|
894 |
- :green_heart: The sniffs are now also tested against PHP 7.0 for consistent results.
|
895 |
|
896 |
### Fixed
|
897 |
-
- :bug: The `ForbiddenCallTimePassByReference` sniff was throwing `Undefined index` notices when used in combination with PHPCS 2.2.0. [#100](https://github.com/
|
898 |
-
- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would incorrectly throw an error if the `throw` keyword was used with parenthesis. Fixes [#118](https://github.com/
|
899 |
-
- :bug: The `PregReplaceEModifier` sniff incorrectly identified `e`'s in the pattern as the `e` modifier when using `{}` bracket delimiters for the regex. [#94](https://github.com/
|
900 |
-
- :bug: The `RemovedExtensions` sniff was throwing an `error` instead of a `warning` for deprecated, but not (yet) removed extensions. Fixes [#62](https://github.com/
|
901 |
|
902 |
### Credits
|
903 |
Thanks go out to AlexMiroshnikov, [Chris Abernethy], [dgudgeon], [djaenecke], [Eugene Maslovich], [Ken Guest], Koen Eelen, [Komarov Alexey], [Mark Clements] and [Remko van Bezooijen] for their contributions to this version. :clap:
|
@@ -908,32 +1352,32 @@ Thanks go out to AlexMiroshnikov, [Chris Abernethy], [dgudgeon], [djaenecke], [E
|
|
908 |
See all related issues and PRs in the [5.6 milestone].
|
909 |
|
910 |
### Added
|
911 |
-
- :star2: New: `NewLanguageConstructs` sniff. The initial version of this sniff checks for the PHP 5.6 `**` power operator and the `**=` power assignment operator. [#87](https://github.com/
|
912 |
-
- :star2: New: `ParameterShadowSuperGlobals` sniff which covers the PHP 5.4 change _Parameter names that shadow super globals now cause a fatal error.`_. [#74](https://github.com/
|
913 |
-
- :star2: New: `PregReplaceEModifier` sniff which detects usage of the `e` modifier in literal regular expressions used with `preg_replace()`. The `e` modifier will not (yet) be detected when the regex passed is a variable or constant. [#81](https://github.com/
|
914 |
- :star: `DeprecatedIniDirectives` sniff: PHP 5.6 deprecated ini directives.
|
915 |
-
- :star: `NewKeywords` sniff: detection of the `goto` keyword introduced in PHP 5.3 and the `callable` keyword introduced in PHP 5.4. [#57](https://github.com/
|
916 |
-
- :recycle: `PHPCompatibility_Sniff` base class initially containing the `supportsAbove()` and `supportsBelow()` utility methods. (Nearly) All sniffs now extend this base class and use these methods to determine whether or not violations should be reported for a set `testVersion`. [#77](https://github.com/
|
917 |
-
- :books: Readme: Composer installation instructions. [#32](https://github.com/
|
918 |
-
- :wrench: `.gitignore` to ignore vendor and IDE related directories. [#78](https://github.com/
|
919 |
- :green_heart: Code coverage checking via coveralls.
|
920 |
|
921 |
### Changed
|
922 |
-
- :twisted_rightwards_arrows: The check for the `\` namespace separator has been moved from the `NewKeywords` sniff to the `NewLanguageConstructs` sniff. [#88](https://github.com/
|
923 |
- :pencil2: `DeprecatedIniDirectives` sniff: minor change in the sniff error message text.
|
924 |
- :pencil2: `DeprecatedFunctions` sniff: minor change in the sniff error message text.
|
925 |
-
- :wrench: Minor updates to the `composer.json` file. [#31](https://github.com/
|
926 |
- :wrench: Tests: The unit tests can now be run without configuration.
|
927 |
-
- :wrench: Tests: Skipped unit tests will now be annotated as such. [#85](https://github.com/
|
928 |
- :green_heart: The sniffs are now also tested against PHP 5.6 for consistent results.
|
929 |
- :green_heart: The sniffs are now also tested against PHPCS 2.0+.
|
930 |
-
- :green_heart: The sniffs are now tested using the new container-based infrastructure in Travis CI. [#37](https://github.com/
|
931 |
|
932 |
### Fixed
|
933 |
-
- :bug: The `ForbiddenCallTimePassByReference` sniff was throwing false positives when a bitwise and `&` was used in combination with class constants and class properties within function calls. [#44](https://github.com/
|
934 |
-
- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff was throwing false positives in certain cases when a comment separated a `try` from the `catch` block. [#29](https://github.com/
|
935 |
-
- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff was incorrectly reporting `instanceof` as being introduced in PHP 5.4 while it has been around since PHP 5.0. [#80](https://github.com/
|
936 |
-
- :white_check_mark: Compatibility with PHPCS 2.0 - 2.3. [#63](https://github.com/
|
937 |
|
938 |
### Credits
|
939 |
Thanks go out to Daniel Jänecke, [Declan Kelly], [Dominic], [Jaap van Otterdijk], [Marin Crnkovic], [Mark Clements], [Nick Pack], [Oliver Klee], [Rowan Collins] and [Sam Van der Borght] for their contributions to this version. :clap:
|
@@ -947,49 +1391,69 @@ See all related issues and PRs in the [5.5 milestone].
|
|
947 |
|
948 |
|
949 |
|
950 |
-
[Unreleased]: https://github.com/
|
951 |
-
[
|
952 |
-
[
|
953 |
-
[
|
954 |
-
[
|
955 |
-
[
|
956 |
-
[
|
957 |
-
[
|
958 |
-
[
|
959 |
-
[
|
960 |
-
[
|
961 |
-
[
|
962 |
-
[
|
963 |
-
[
|
964 |
-
[
|
965 |
-
[7.
|
966 |
-
[7.
|
967 |
-
[7.
|
968 |
-
[7.
|
969 |
-
[7.
|
970 |
-
[
|
971 |
-
|
972 |
-
[
|
973 |
-
[
|
974 |
-
[
|
975 |
-
[
|
976 |
-
[7.
|
977 |
-
[7.
|
978 |
-
[7.1
|
979 |
-
[7.
|
980 |
-
[
|
981 |
-
|
982 |
-
[
|
983 |
-
[
|
984 |
-
[
|
985 |
-
[
|
986 |
-
[
|
987 |
-
[
|
988 |
-
[
|
989 |
-
[
|
990 |
-
[
|
991 |
-
[
|
992 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
993 |
|
994 |
[Arthur Edamov]: https://github.com/edamov
|
995 |
[Chris Abernethy]: https://github.com/cabernet-zerve
|
@@ -1001,6 +1465,7 @@ See all related issues and PRs in the [5.5 milestone].
|
|
1001 |
[Gary Jones]: https://github.com/GaryJones
|
1002 |
[Jaap van Otterdijk]: https://github.com/jaapio
|
1003 |
[Jason Stallings]: https://github.com/octalmage
|
|
|
1004 |
[Jonathan Van Belle]: https://github.com/Grummfy
|
1005 |
[Juliette Reinders Folmer]: https://github.com/jrfnl
|
1006 |
[Ken Guest]: https://github.com/kenguest
|
@@ -1009,11 +1474,15 @@ See all related issues and PRs in the [5.5 milestone].
|
|
1009 |
[Mark Clements]: https://github.com/MarkMaldaba
|
1010 |
[Michael Babker]: https://github.com/mbabker
|
1011 |
[Nick Pack]: https://github.com/nickpack
|
|
|
1012 |
[Oliver Klee]: https://github.com/oliverklee
|
1013 |
[Remko van Bezooijen]: https://github.com/emkookmer
|
1014 |
[Rowan Collins]: https://github.com/IMSoP
|
1015 |
[Ryan Neufeld]: https://github.com/ryanneufeld
|
1016 |
[Sam Van der Borght]: https://github.com/samvdb
|
|
|
1017 |
[Tadas Juozapaitis]: https://github.com/kasp3r
|
|
|
|
|
|
|
1018 |
[Yoshiaki Yoshida]: https://github.com/kakakakakku
|
1019 |
-
|
7 |
Up to version 8.0.0, the `major.minor` version numbers were based on the PHP version for which compatibility check support was added, with `patch` version numbers being specific to this library.
|
8 |
From version 8.0.0 onwards, [Semantic Versioning](http://semver.org/) is used.
|
9 |
|
|
|
|
|
10 |
<!-- Legend to the icons used: https://github.com/PHPCompatibility/PHPCompatibility/pull/506#discussion_r131650488 -->
|
11 |
|
12 |
|
14 |
|
15 |
_Nothing yet._
|
16 |
|
17 |
+
## [9.3.5] - 2019-12-27
|
18 |
+
|
19 |
+
See all related issues and PRs in the [9.3.5 milestone].
|
20 |
+
|
21 |
+
### Added
|
22 |
+
- :star: `PHPCompatibility.Classes.NewClasses` sniff: recognize the new `FFI` extension related classes as introduced in PHP 7.4. [#949](https://github.com/PHPCompatibility/PHPCompatibility/pull/949)
|
23 |
+
- :star: `PHPCompatibility.IniDirectives.NewIniDirectives` sniff: detect use of the new `FFI` extension related ini directives as introduced in PHP 7.4. [#949](https://github.com/PHPCompatibility/PHPCompatibility/pull/949)
|
24 |
+
|
25 |
+
### Changed
|
26 |
+
- :pencil: `PHPCompatibility.Syntax.NewShortArray`: improved clarity of the error message and made it consistent with other error messages in this standard. [#934](https://github.com/PHPCompatibility/PHPCompatibility/pull/934)
|
27 |
+
- :pencil: `PHPCompatibility.Interfaces.NewInterfaces`: updated the URL which is mentioned in select error messages. [#942](https://github.com/PHPCompatibility/PHPCompatibility/pull/942)
|
28 |
+
- :recycle: Another slew of code documentation fixes. [#937](https://github.com/PHPCompatibility/PHPCompatibility/pull/937), [#939](https://github.com/PHPCompatibility/PHPCompatibility/pull/939), [#940](https://github.com/PHPCompatibility/PHPCompatibility/pull/940), [#941](https://github.com/PHPCompatibility/PHPCompatibility/pull/941), [#943](https://github.com/PHPCompatibility/PHPCompatibility/pull/943), [#944](https://github.com/PHPCompatibility/PHPCompatibility/pull/944), [#951](https://github.com/PHPCompatibility/PHPCompatibility/pull/951), [#950](https://github.com/PHPCompatibility/PHPCompatibility/pull/950). Fixes [#734](https://github.com/PHPCompatibility/PHPCompatibility/issues/734).
|
29 |
+
- :green_heart: Travis: various tweaks. The builds against PHP 7.4 are no longer allowed to fail. [#935](https://github.com/PHPCompatibility/PHPCompatibility/pull/935), [#938](https://github.com/PHPCompatibility/PHPCompatibility/pull/938)
|
30 |
+
For running the sniffs on PHP 7.4, it is recommended to use PHP_CodeSniffer 3.5.0+ as PHP_CodeSniffer itself is
|
31 |
+
not compatible with PHP 7.4 until version 3.5.0.
|
32 |
+
|
33 |
+
### Fixed
|
34 |
+
- :bug: `PHPCompatibility.Classes.NewClasses`: two new PHP 7.4 classes were being checked as if they were Exceptions. [#945](https://github.com/PHPCompatibility/PHPCompatibility/pull/945)
|
35 |
+
|
36 |
+
### Credits
|
37 |
+
Thanks go out to [William Entriken] for their contribution to this version. :clap:
|
38 |
+
|
39 |
+
|
40 |
+
## [9.3.4] - 2019-11-15
|
41 |
+
|
42 |
+
See all related issues and PRs in the [9.3.4 milestone].
|
43 |
+
|
44 |
+
### Fixed
|
45 |
+
- :bug: `PHPCompatibility.Keywords.ForbiddenNames`: false positive for list when used in a `foreach()` condition. [#930](https://github.com/PHPCompatibility/PHPCompatibility/pull/930). Fixes [#928](https://github.com/PHPCompatibility/PHPCompatibility/issues/928), [#929](https://github.com/PHPCompatibility/PHPCompatibility/pull/929)
|
46 |
+
|
47 |
+
### Credits
|
48 |
+
Thanks go out to [Sergii Bondarenko] for their contribution to this version. :clap:
|
49 |
+
|
50 |
+
|
51 |
+
## [9.3.3] - 2019-11-11
|
52 |
+
|
53 |
+
See all related issues and PRs in the [9.3.3 milestone].
|
54 |
+
|
55 |
+
### Added
|
56 |
+
- :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of yet more (undocumented) PHP 7.2 Sodium constants. [#924](https://github.com/PHPCompatibility/PHPCompatibility/pull/924)
|
57 |
+
- :star: `PHPCompatibility.Keywords.ForbiddenNames` sniff: detect the use of more reserved keywords which are not allowed to be used to name certain constructs. [#923](https://github.com/PHPCompatibility/PHPCompatibility/pull/923). Fixes [#922](https://github.com/PHPCompatibility/PHPCompatibility/issues/922)
|
58 |
+
|
59 |
+
### Fixed
|
60 |
+
- :bug: `PHPCompatibility.FunctionNameRestrictions.RemovedPHP4StyleConstructors`: false positive detecting PHP4-style constructors when declared in interfaces. The class implementing the interface will not have the same name as the interface, so the actual method would not be regarded as a PHP4 style constructor. [#921](https://github.com/PHPCompatibility/PHPCompatibility/pull/921)
|
61 |
+
|
62 |
+
### Credits
|
63 |
+
Thanks go out to [Nikhil] for their contribution to this version. :clap:
|
64 |
+
|
65 |
+
|
66 |
+
## [9.3.2] - 2019-10-16
|
67 |
+
|
68 |
+
See all related issues and PRs in the [9.3.2 milestone].
|
69 |
+
|
70 |
+
### Added
|
71 |
+
- :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of the PHP 7.2 `SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13` constant. [#915](https://github.com/PHPCompatibility/PHPCompatibility/pull/915)
|
72 |
+
- :books: Readme: a list of projects which are build upon or extend PHPCompatibility. [#904](https://github.com/PHPCompatibility/PHPCompatibility/pull/904)
|
73 |
+
|
74 |
+
### Changed
|
75 |
+
- :pushpin: `PHPCompatibility.FunctionNameRestrictions.RemovedPHP4StyleConstructors`: minor efficiency fix to make the sniff faster. [#912](https://github.com/PHPCompatibility/PHPCompatibility/pull/912)
|
76 |
+
- :pushpin: `PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames`: functions marked as `@deprecated` in the function docblock will now be ignored by this sniff. [#917](https://github.com/PHPCompatibility/PHPCompatibility/pull/917). Fixes [#911](https://github.com/PHPCompatibility/PHPCompatibility/issues/911)
|
77 |
+
- :pencil: `PHPCompatibility.FunctionDeclarations.ForbiddenToStringParameters`: the `$ooScopeTokens` property is now `protected`, it should never have been `public` in the first place. [#907](https://github.com/PHPCompatibility/PHPCompatibility/pull/907)
|
78 |
+
- :recycle: More code documentation fixes. [#903](https://github.com/PHPCompatibility/PHPCompatibility/pull/903), [#916](https://github.com/PHPCompatibility/PHPCompatibility/pull/916)
|
79 |
+
- :books: Readme/Contributing: various tweaks. [#904](https://github.com/PHPCompatibility/PHPCompatibility/pull/904), [#905](https://github.com/PHPCompatibility/PHPCompatibility/pull/905)
|
80 |
+
|
81 |
+
### Fixed
|
82 |
+
- :bug: `PHPCompatibility.FunctionUse.OptionalToRequiredFunctionParameters`: false positive when a class is instantiated which has the same name as one of the affected functions. [#914](https://github.com/PHPCompatibility/PHPCompatibility/pull/914). Fixes [#913](https://github.com/PHPCompatibility/PHPCompatibility/issues/913)
|
83 |
+
- :bug: `PHPCompatibility.FunctionUse.RequiredToOptionalFunctionParameters`: false positive when a class is instantiated which has the same name as one of the affected functions. [#914](https://github.com/PHPCompatibility/PHPCompatibility/pull/914)
|
84 |
+
- :bug: `PHPCompatibility.MethodUse.NewDirectCallsToClone`: false positive on calling `__clone()` from within the class being cloned [#910](https://github.com/PHPCompatibility/PHPCompatibility/pull/910). Fixes [#629 (comment)](https://github.com/PHPCompatibility/PHPCompatibility/issues/629#issuecomment-532607809)
|
85 |
+
- :bug: `PHPCompatibility.Miscellaneous.ValidIntegers`: binary numbers using an uppercase `B` were not always recognized correctly. [#909](https://github.com/PHPCompatibility/PHPCompatibility/pull/909)
|
86 |
+
|
87 |
+
|
88 |
+
## [9.3.1] - 2019-09-06
|
89 |
+
|
90 |
+
See all related issues and PRs in the [9.3.1 milestone].
|
91 |
+
|
92 |
+
### Changed
|
93 |
+
- :recycle: A whole slew of code documentation fixes. [#892](https://github.com/PHPCompatibility/PHPCompatibility/pull/892), [#895](https://github.com/PHPCompatibility/PHPCompatibility/pull/895), [#896](https://github.com/PHPCompatibility/PHPCompatibility/pull/896), [#897](https://github.com/PHPCompatibility/PHPCompatibility/pull/897), [#898](https://github.com/PHPCompatibility/PHPCompatibility/pull/898), [#899](https://github.com/PHPCompatibility/PHPCompatibility/pull/899), [#900](https://github.com/PHPCompatibility/PHPCompatibility/pull/900)
|
94 |
+
- :wrench: Travis: minor tweaks to the build script. [#893](https://github.com/PHPCompatibility/PHPCompatibility/pull/893)
|
95 |
+
|
96 |
+
### Fixed
|
97 |
+
- :bug: `PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder`: false positive when an array item in the second parameter contained a ternary. [#891](https://github.com/PHPCompatibility/PHPCompatibility/pull/891). Fixes [#890](https://github.com/PHPCompatibility/PHPCompatibility/issues/890)
|
98 |
+
- :bug: `PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder`: will now take array casts into account when determining which parameter is `$pieces`. [#891](https://github.com/PHPCompatibility/PHPCompatibility/pull/891).
|
99 |
+
- :bug: `PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder`: hardening of the logic to not examine the second parameter when the first is just and only a text string (`$glue`). [#891](https://github.com/PHPCompatibility/PHPCompatibility/pull/891).
|
100 |
+
|
101 |
+
|
102 |
+
## [9.3.0] - 2019-08-29
|
103 |
+
|
104 |
+
See all related issues and PRs in the [9.3.0 milestone].
|
105 |
+
|
106 |
+
To keep informed of the progress of covering "_everything PHP 7.4_" in PHPCompatibility, please subscribe to issue [#808](https://github.com/PHPCompatibility/PHPCompatibility/issues/808).
|
107 |
+
|
108 |
+
### Changes expected in PHPCompatibility 10.0.0
|
109 |
+
The next version of PHPCompatibility is expected to include a new external dependency.
|
110 |
+
|
111 |
+
In this same release, support for PHP < 5.4 and PHP_CodeSniffer < 2.6.0 will be dropped.
|
112 |
+
|
113 |
+
The `10.0.0` release is expected around the same time as the release of PHP 7.4 - end of November/beginning of December 2019.
|
114 |
+
|
115 |
+
### Added
|
116 |
+
- :star2: New `PHPCompatibility.Miscellaneous.NewPHPOpenTagEOF` sniff to detect a stand-alone PHP open tag at the end of a file, without trailing newline, as will be supported as of PHP 7.4. [#843](https://github.com/PHPCompatibility/PHPCompatibility/pull/846)
|
117 |
+
- :star2: New `PHPCompatibility.ParameterValues.ForbiddenStripTagsSelfClosingXHTML` sniff to detect calls to `strip_tags()` passing self-closing XHTML tags in the `$allowable_tags` parameter. This has not been supported since PHP 5.3.4. [#866](https://github.com/PHPCompatibility/PHPCompatibility/pull/866)
|
118 |
+
- :star2: New `PHPCompatibility.ParameterValues.NewHTMLEntitiesEncodingDefault` sniff to detect calls to `html_entity_decode()`, `htmlentities()` and `htmlspecialchars()` which are impacted by the change to the default value of the `$encoding` parameter in PHP 5.4. [#862](https://github.com/PHPCompatibility/PHPCompatibility/pull/862)
|
119 |
+
- :star2: New `PHPCompatibility.ParameterValues.NewIconvMbstringCharsetDefault` sniff to detect code impacted by the change in the `default_charset` value in PHP 5.6. [#864](https://github.com/PHPCompatibility/PHPCompatibility/pull/864) Fixes [#839](https://github.com/PHPCompatibility/PHPCompatibility/issues/839)
|
120 |
+
- :star2: New `PHPCompatibility.ParameterValues.NewIDNVariantDefault` sniff to detect calls to `idn_to_ascii()` and `idn_to_utf8()` impacted by the PHP 7.4 change in the default value for the `$variant` parameter. [#861](https://github.com/PHPCompatibility/PHPCompatibility/pull/861)
|
121 |
+
- :star2: New `PHPCompatibility.ParameterValues.NewPasswordAlgoConstantValues` sniff to detect calls to `password_hash()` and `password_needs_rehash()` impacted by the changed value of the `PASSWORD_DEFAULT`, `PASSWORD_BCRYPT`, `PASSWORD_ARGON2I` and `PASSWORD_ARGON2ID` constants in PHP 7.4. [#865](https://github.com/PHPCompatibility/PHPCompatibility/pull/865)
|
122 |
+
- :star2: New `PHPCompatibility.ParameterValues.NewProcOpenCmdArray` sniff to detect calls to `proc_open()` passing an array for the `$cmd` parameter as supported as of PHP 7.4. [#869](https://github.com/PHPCompatibility/PHPCompatibility/pull/869)
|
123 |
+
- :star2: New `PHPCompatibility.ParameterValues.NewStripTagsAllowableTagsArray` sniff to detect calls to `strip_tags()` passing an array for the `$allowable_tags` parameter as will be supported as of PHP 7.4. [#867](https://github.com/PHPCompatibility/PHPCompatibility/pull/867)
|
124 |
+
- :star2: New `PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder` sniff to detect `implode()` being called with `$glue` and `$pieces` in reverse order from the documented argument order. This was previously allowed for historical reasons, but will be deprecated in PHP 7.4. [#846](https://github.com/PHPCompatibility/PHPCompatibility/pull/846)
|
125 |
+
- :star2: New `PHPCompatibility.ParameterValues.RemovedMbStrrposEncodingThirdParam` sniff to detect the `$encoding` being passed as the third, instead of the fourth parameter, to `mb_strrpos()` as has been soft deprecated since PHP 5.2 and will be hard deprecated as of PHP 7.4. [#860](https://github.com/PHPCompatibility/PHPCompatibility/pull/860)
|
126 |
+
- :star2: New `PHPCompatibility.Syntax.RemovedCurlyBraceArrayAccess` sniff to detect array and string offset access using curly braces as will be deprecated as of PHP 7.4. [#855](https://github.com/PHPCompatibility/PHPCompatibility/pull/855)
|
127 |
+
- In contrast to any other sniff in the PHPCompatibility standard, this sniff contains an auto-fixer.
|
128 |
+
- :star2: New `PHPCompatibility.TextStrings.NewUnicodeEscapeSequence` sniff to detect use of the PHP 7.0+ unicode codepoint escape sequences and issues with invalid sequences. [#856](https://github.com/PHPCompatibility/PHPCompatibility/pull/856)
|
129 |
+
- :star2: New `PHPCompatibility.Upgrade.LowPHP` sniff to give users of old PHP versions advance warning when support will be dropped in the near future. [#838](https://github.com/PHPCompatibility/PHPCompatibility/pull/838)
|
130 |
+
At this moment, the intention is to drop support for PHP 5.3 by the end of this year.
|
131 |
+
- :star: `PHPCompatibility.Classes.NewClasses` sniff: recognize the new `WeakReference` class as introduced in PHP 7.4. [#857](https://github.com/PHPCompatibility/PHPCompatibility/pull/857)
|
132 |
+
- :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of new Curl constants as introduced in PHP 7.3.5. [#878](https://github.com/PHPCompatibility/PHPCompatibility/pull/878)
|
133 |
+
- :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of the revived `T_BAD_CHARACTER` constant as re-introduced in PHP 7.4. [#882](https://github.com/PHPCompatibility/PHPCompatibility/pull/882)
|
134 |
+
- :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of the new `IMG_FILTER_SCATTER` and `PASSWORD_ARGON2_PROVIDER` constants as introduced in PHP 7.4. [#887](https://github.com/PHPCompatibility/PHPCompatibility/pull/887)
|
135 |
+
- :star: `PHPCompatibility.Constants.RemovedConstants` sniff: detection of use of the `CURLPIPE_HTTP1` constant which will be deprecated in PHP 7.4. [#879](https://github.com/PHPCompatibility/PHPCompatibility/pull/879)
|
136 |
+
- :star: `PHPCompatibility.Constants.RemovedConstants` sniff: detection of use of the `FILTER_SANITIZE_MAGIC_QUOTES` constant which will be deprecated in PHP 7.4. [#845](https://github.com/PHPCompatibility/PHPCompatibility/pull/845)
|
137 |
+
- :star: `PHPCompatibility.Constants.RemovedConstants` sniff: detection of use of the `T_CHARACTER` and `T_BAD_CHARACTER` constants which were removed in PHP 7.0. [#882](https://github.com/PHPCompatibility/PHPCompatibility/pull/882)
|
138 |
+
- :star: `PHPCompatibility.FunctionDeclarations.NewMagicMethods` sniff: recognize the new `__serialize()` and `__unserialize()` magic methods as introduced in PHP 7.4. [#868](https://github.com/PHPCompatibility/PHPCompatibility/pull/868)
|
139 |
+
- :star: `PHPCompatibility.FunctionDeclarations.NewMagicMethods` sniff: recognize the PHP 5.0 `__construct()` and `__destruct()` magic methods. [#884](https://github.com/PHPCompatibility/PHPCompatibility/pull/884)
|
140 |
+
- :star: `PHPCompatibility.FunctionDeclarations.NonStaticMagicMethods` sniff: recognize the new `__serialize()` and `__unserialize()` magic methods as introduced in PHP 7.4. [#868](https://github.com/PHPCompatibility/PHPCompatibility/pull/868)
|
141 |
+
- :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: recognize the new PHP 7.4 function `imagecreatefromtga()`. [#873](https://github.com/PHPCompatibility/PHPCompatibility/pull/873)
|
142 |
+
- :star: `PHPCompatibility.FunctionUse.RemovedFunctionParameters` sniff: recognize the deprecation of the `$age` parameter of the `curl_version()` function. [#874](https://github.com/PHPCompatibility/PHPCompatibility/pull/874)
|
143 |
+
- :star: `PHPCompatibility.FunctionUse.RemovedFunctions` sniff: recognize the PHP 7.4 deprecated `convert_cyr_string()()`, `ezmlm_hash()`, `get_magic_quotes_gpc()`, `get_magic_quotes_runtime()`, `hebrevc()`, `is_real()`, `money_format()` and `restore_include_path()` functions. [#847](https://github.com/PHPCompatibility/PHPCompatibility/pull/847)
|
144 |
+
- :star: `PHPCompatibility.IniDirectives.NewIniDirectives` sniff: detect use of the new PHP 7.4 `zend.exception_ignore_args` ini directive. [#871](https://github.com/PHPCompatibility/PHPCompatibility/pull/871)
|
145 |
+
- :star: `PHPCompatibility.IniDirectives.RemovedIniDirectives` sniff: detect use of the `allow_url_include` ini directive which is deprecated as of PHP 7.4. [#870](https://github.com/PHPCompatibility/PHPCompatibility/pull/870)
|
146 |
+
- :star: `PHPCompatibility.IniDirectives.RemovedIniDirectives` sniff: detection of use of the `opcache.load_comments` directive which was removed in PHP 7.0. [#883](https://github.com/PHPCompatibility/PHPCompatibility/pull/883)
|
147 |
+
- :star: `PHPCompatibility.ParameterValues.NewHashAlgorithms`: recognize use of the new PHP 7.4 `crc32c` hash algorithm. [#872](https://github.com/PHPCompatibility/PHPCompatibility/pull/872)
|
148 |
+
- :star: `PHPCompatibility.TypeCasts.RemovedTypeCasts` sniff: detect usage of the `(real)` type cast which will be deprecated in PHP 7.4. [#844](https://github.com/PHPCompatibility/PHPCompatibility/pull/844)
|
149 |
+
- :star: Recognize the `recode` extension functionality which will be removed in PHP 7.4 (moved to PECL) in the `RemovedExtensions` and `RemovedFunctions` sniffs. [#841](https://github.com/PHPCompatibility/PHPCompatibility/pull/841)
|
150 |
+
- :star: Recognize the `OPcache` extension functionality which was be introduced in PHP 5.5, but not yet fully accounted for in the `NewFunctions` and `NewIniDirectives` sniffs. [#883](https://github.com/PHPCompatibility/PHPCompatibility/pull/883)
|
151 |
+
- :star: New `getCompleteTextString()` utility method to the `PHPCompatibility\Sniff` class. [#856](https://github.com/PHPCompatibility/PHPCompatibility/pull/856)
|
152 |
+
- :umbrella: Unit test for the `PHPCompatibility.Upgrade.LowPHPCS` sniff.
|
153 |
+
- :umbrella: Some extra unit tests for the `PHPCompatibility.ParameterValues.NewNegativeStringOffset`, `PHPCompatibility.ParameterValues.RemovedMbStringModifiers` and sniffs. [#876](https://github.com/PHPCompatibility/PHPCompatibility/pull/876), [#877](https://github.com/PHPCompatibility/PHPCompatibility/pull/877)
|
154 |
+
- :books: `CONTRIBUTING.md`: Added a list of typical sources for information about changes to PHP. [#875](https://github.com/PHPCompatibility/PHPCompatibility/pull/875)
|
155 |
+
|
156 |
+
### Changed
|
157 |
+
- :pushpin: `PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString` sniff: the sniff will now also examine the function docblock, if available, and will throw an error when a `@throws` tag is found in the docblock. [#880](https://github.com/PHPCompatibility/PHPCompatibility/pull/880). Fixes [#863](https://github.com/PHPCompatibility/PHPCompatibility/issues/863)
|
158 |
+
- :pushpin: `PHPCompatibility.FunctionDeclarations.NonStaticMagicMethods` sniff: will now also check the visibility and `static` (or not) requirements of the magic `__construct()`, `__destruct()`, `__clone()`, `__debugInfo()`, `__invoke()` and `__set_state()` methods. [#885](https://github.com/PHPCompatibility/PHPCompatibility/pull/885)
|
159 |
+
- :pushpin: `PHPCompatibility.Syntax.NewArrayStringDereferencing` sniff: the sniff will now also recognize array string dereferencing using curly braces as was (silently) supported since PHP 7.0. [#851](https://github.com/PHPCompatibility/PHPCompatibility/pull/851)
|
160 |
+
- The sniff will now also throw errors for each dereference found on the array/string, not just the first one.
|
161 |
+
- :pushpin: `PHPCompatibility.Syntax.NewClassMemberAccess` sniff: the sniff will now also recognize class member access on instantiation and cloning using curly braces as was (silently) supported since PHP 7.0. [#852](https://github.com/PHPCompatibility/PHPCompatibility/pull/852)
|
162 |
+
- The sniff will now also throw errors for each access detected, not just the first one.
|
163 |
+
- The line number on which the error is thrown in now set more precisely.
|
164 |
+
- :pushpin: `PHPCompatibility.Syntax.NewFunctionArrayDereferencing` sniff: the sniff will now also recognize function array dereferencing using curly braces as was (silently) supported since PHP 7.0. [#853](https://github.com/PHPCompatibility/PHPCompatibility/pull/853)
|
165 |
+
- The sniff will now also throw errors for each access detected, not just the first one.
|
166 |
+
- The line number on which the error is thrown in now set more precisely.
|
167 |
+
- :recycle: Various code clean-up and improvements. [#849](https://github.com/PHPCompatibility/PHPCompatibility/pull/849), [#850](https://github.com/PHPCompatibility/PHPCompatibility/pull/850)
|
168 |
+
- :recycle: Various minor inline documentation fixes. [#854](https://github.com/PHPCompatibility/PHPCompatibility/pull/854), [#886](https://github.com/PHPCompatibility/PHPCompatibility/pull/886)
|
169 |
+
- :wrench: Travis: various tweaks to the build script. [#834](https://github.com/PHPCompatibility/PHPCompatibility/pull/834), [#842](https://github.com/PHPCompatibility/PHPCompatibility/pull/842)
|
170 |
+
|
171 |
+
### Fixed
|
172 |
+
- :bug: `PHPCompatibility.FunctionDeclarations.ForbiddenParametersWithSameName` sniff: variable names are case-sensitive, so recognition of same named parameters should be done in a case-sensitive manner. [#848](https://github.com/PHPCompatibility/PHPCompatibility/pull/848)
|
173 |
+
- :bug: `PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString` sniff: Exceptions thrown within a `try` should not trigger the sniff. [#880](https://github.com/PHPCompatibility/PHPCompatibility/pull/880). Fixes [#863](https://github.com/PHPCompatibility/PHPCompatibility/issues/863)
|
174 |
+
- :bug: `PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString` sniff: the `$ooScopeTokens` property should never have been a public property. [#880](https://github.com/PHPCompatibility/PHPCompatibility/pull/880).
|
175 |
+
- :umbrella: Some of the unit tests for the `PHPCompatibility.Operators.RemovedTernaryAssociativity` sniff were not being run. [#836](https://github.com/PHPCompatibility/PHPCompatibility/pull/836)
|
176 |
+
|
177 |
+
|
178 |
+
## [9.2.0] - 2019-06-28
|
179 |
+
|
180 |
+
See all related issues and PRs in the [9.2.0 milestone].
|
181 |
+
|
182 |
+
To keep informed of the progress of covering "_everything PHP 7.4_" in PHPCompatibility, please subscribe to issue [#808](https://github.com/PHPCompatibility/PHPCompatibility/issues/808).
|
183 |
+
|
184 |
+
### Added
|
185 |
+
- :star2: New `PHPCompatibility.Classes.ForbiddenAbstractPrivateMethods` sniff to detect methods declared as both `private` as well as `abstract`. This was allowed between PHP 5.0.0 and 5.0.4, but disallowed in PHP 5.1 as the behaviour of `private` and `abstract` are mutually exclusive. [#822](https://github.com/PHPCompatibility/PHPCompatibility/pull/822)
|
186 |
+
- :star2: New `PHPCompatibility.Classes.NewTypedProperties` sniff to detect PHP 7.4 typed property declarations. [#801](https://github.com/PHPCompatibility/PHPCompatibility/pull/801), [#829](https://github.com/PHPCompatibility/PHPCompatibility/pull/829)
|
187 |
+
- :star2: New `PHPCompatibility.Classes.RemovedOrphanedParent` sniff to detect the use of the `parent` keyword in classes without a parent (non-extended classes). This code pattern is deprecated in PHP 7.4 and will become a compile-error in PHP 8.0. [#818](https://github.com/PHPCompatibility/PHPCompatibility/pull/818)
|
188 |
+
- :star2: New `PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString` sniff to detect throwing exceptions from `__toString()` methods. This would previously result in a fatal error, but will be allowed as of PHP 7.4. [#814](https://github.com/PHPCompatibility/PHPCompatibility/pull/814)
|
189 |
+
- :star2: New `PHPCompatibility.FunctionDeclarations.ForbiddenToStringParameters` sniff to detect `__toString()` function declarations expecting parameters. This was disallowed in PHP 5.3. [#815](https://github.com/PHPCompatibility/PHPCompatibility/pull/815)
|
190 |
+
- :star2: New `PHPCompatibility.MethodUse.ForbiddenToStringParameters` sniff to detect direct calls to `__toString()` magic methods passing parameters. This was disallowed in PHP 5.3. [#830](https://github.com/PHPCompatibility/PHPCompatibility/pull/830)
|
191 |
+
- :star2: New `PHPCompatibility.Operators.ChangedConcatOperatorPrecedence` sniff to detect code affected by the upcoming change in operator precedence for the concatenation operator. The concatenation operator precedence will be lowered in PHP 8.0, with deprecation notices for code affected being thrown in PHP 7.4. [#805](https://github.com/PHPCompatibility/PHPCompatibility/pull/805)
|
192 |
+
- :star2: New `PHPCompatibility.Operators.RemovedTernaryAssociativity` sniff to detect code relying on left-associativity of the ternary operator. This behaviour will be deprecated in PHP 7.4 and removed in PHP 8.0. [#810](https://github.com/PHPCompatibility/PHPCompatibility/pull/810)
|
193 |
+
- :star2: New `PHPCompatibility.Syntax.NewArrayUnpacking` sniff to detect the use of the spread operator to unpack arrays when declaring a new array, as introduced in PHP 7.4. [#804](https://github.com/PHPCompatibility/PHPCompatibility/pull/804)
|
194 |
+
- :star: `PHPCompatibility.Classes.NewClasses` sniff: recognize the new `ReflectionReference` class as introduced in PHP 7.4. [#820](https://github.com/PHPCompatibility/PHPCompatibility/pull/820)
|
195 |
+
- :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of the new PHP 7.4 Core (Standard), MBString, Socket and Tidy constants. [#821](https://github.com/PHPCompatibility/PHPCompatibility/pull/821)
|
196 |
+
- :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: detect usage of the new PHP 7.4 `get_mangled_object_vars()`, `mb_str_split()`, `openssl_x509_verify()`, `password_algos()`, `pcntl_unshare()`, `sapi_windows_set_ctrl_handler()` and `sapi_windows_generate_ctrl_event()` functions. [#811](https://github.com/PHPCompatibility/PHPCompatibility/pull/811), [#819](https://github.com/PHPCompatibility/PHPCompatibility/pull/819), [#827](https://github.com/PHPCompatibility/PHPCompatibility/pull/827)
|
197 |
+
- :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: recognize the new OCI functions as introduced in PHP 7.2.14 and PHP 7.3.1. [#786](https://github.com/PHPCompatibility/PHPCompatibility/pull/786)
|
198 |
+
- :star: `PHPCompatibility.FunctionUse.RemovedFunctions` sniff: recognize the PHP 7.4 deprecated `ldap_control_paged_result_response()` and `ldap_control_paged_result()` functions. [#831](https://github.com/PHPCompatibility/PHPCompatibility/pull/831)
|
199 |
+
- :star: `PHPCompatibility.FunctionUse.RemovedFunctions` sniff: recognize the `Payflow Pro/pfpro` functions as removed in PHP 5.1. [#823](https://github.com/PHPCompatibility/PHPCompatibility/pull/823)
|
200 |
+
- :star: `PHPCompatibility.FunctionUse.RequiredToOptionalFunctionParameters` sniff: account for the parameters for `array_merge()` and `array_merge_recursive()` becoming optional in PHP 7.4. [#817](https://github.com/PHPCompatibility/PHPCompatibility/pull/817)
|
201 |
+
- :star: `PHPCompatibility.IniDirectives.RemovedIniDirectives` sniff: recognize the `Payflow Pro/pfpro` ini directives as removed in PHP 5.1. [#823](https://github.com/PHPCompatibility/PHPCompatibility/pull/823)
|
202 |
+
- :star: Recognize the `interbase/Firebird` extension functionality which will be removed in PHP 7.4 (moved to PECL) in the `RemovedConstants`, `RemovedExtensions`, `RemovedFunctions` and `RemovedIniDirectives` sniffs. [#807](https://github.com/PHPCompatibility/PHPCompatibility/pull/807)
|
203 |
+
- :star: Recognize the `wddx` extension functionality which will be removed in PHP 7.4 (moved to PECL) in the `RemovedExtensions` and `RemovedFunctions` sniffs. [#826](https://github.com/PHPCompatibility/PHPCompatibility/pull/826)
|
204 |
+
- :star: New `isShortTernary()` and `isUnaryPlusMinus()` utility methods to the `PHPCompatibility\Sniff` class. [#810](https://github.com/PHPCompatibility/PHPCompatibility/pull/810), [#805](https://github.com/PHPCompatibility/PHPCompatibility/pull/805)
|
205 |
+
|
206 |
+
### Changed
|
207 |
+
- :pencil2: The `PHPCompatibility.Extensions.RemovedExtensions` sniff will now only report on the removed `Payflow Pro` extension when a function uses `pfpro_` as a prefix. Previously, it used the `pfpro` prefix (without underscore) for detection. [#812](https://github.com/PHPCompatibility/PHPCompatibility/pull/812)
|
208 |
+
- :pencil2: The error message thrown when the `T_ELLIPSIS` token, i.e. the spread operator, is detected. [#803](https://github.com/PHPCompatibility/PHPCompatibility/pull/803)
|
209 |
+
PHP 7.4 adds a third use-case for the spread operator. The adjusted error message accounts for this.
|
210 |
+
- :umbrella: `PHPCompatibility.FunctionDeclarations.NewParamTypeDeclarations` is now also tested with parameters using the splat operator. [#802](https://github.com/PHPCompatibility/PHPCompatibility/pull/802)
|
211 |
+
- :books: The documentation now uses the GitHub repo of `PHP_CodeSniffer` as the canonical entry point for `PHP_CodeSniffer`. Previously, it would point to the PEAR package. [#788](https://github.com/PHPCompatibility/PHPCompatibility/pull/788)
|
212 |
+
- :books: The links in the changelog now all point to the `PHPCompatibility/PHPCompatibility` repo and no longer to the (deprecated) `wimg/PHPCompatibility` repo. [#828](https://github.com/PHPCompatibility/PHPCompatibility/pull/828)
|
213 |
+
- :recycle: Various minor inline documentation improvements. [#825](https://github.com/PHPCompatibility/PHPCompatibility/pull/825)
|
214 |
+
- :wrench: Various performance optimizations and code simplifications. [#783](https://github.com/PHPCompatibility/PHPCompatibility/pull/783), [#784](https://github.com/PHPCompatibility/PHPCompatibility/pull/784), [#795](https://github.com/PHPCompatibility/PHPCompatibility/pull/795), [#813](https://github.com/PHPCompatibility/PHPCompatibility/pull/813)
|
215 |
+
- :green_heart: Travis: build tests are now being run against PHP 7.4 (unstable) as well. [#790](https://github.com/PHPCompatibility/PHPCompatibility/pull/790)
|
216 |
+
Note: the builds are currently not (yet) tested against PHP 8.0 (unstable) as there is no compatible PHPUnit version available (yet).
|
217 |
+
- :wrench: Travis: The build script has been refactored to use [stages](https://docs.travis-ci.com/user/build-stages/) to get the most relevant results faster. Additionally some more tweaks have been made to improve and/or simplify the build script. [#798](https://github.com/PHPCompatibility/PHPCompatibility/pull/798)
|
218 |
+
- :wrench: Build/PHPCS: warnings are no longer allowed for the PHPCompatibility native code. [#800](https://github.com/PHPCompatibility/PHPCompatibility/pull/800)
|
219 |
+
- :wrench: Build/PHPCS: added variable assignment alignment check and file include check to the PHPCompatibility native CS configuration. [#824](https://github.com/PHPCompatibility/PHPCompatibility/pull/824)
|
220 |
+
- :wrench: The minimum version for the recommended `DealerDirect/phpcodesniffer-composer-installer` Composer plugin has been upped to `0.5.0`. [#791](https://github.com/PHPCompatibility/PHPCompatibility/pull/791)
|
221 |
+
|
222 |
+
### Fixed
|
223 |
+
- :bug: The `PHPCompatibility.Extensions.RemovedExtensions` sniff contained a typo in the alternative recommended for the removed `mcve` extension. [#806](https://github.com/PHPCompatibility/PHPCompatibility/pull/806)
|
224 |
+
- :bug: The `PHPCompatibility.Extensions.RemovedExtensions` sniff listed the wrong removal version number for the `Payflow Pro/pfpro` extension (PHP 5.3 instead of the correct 5.1). [#823](https://github.com/PHPCompatibility/PHPCompatibility/pull/823)
|
225 |
+
|
226 |
+
### Credits
|
227 |
+
Thanks go out to [Yılmaz] and [Tim Millwood] for their contribution to this version. :clap:
|
228 |
+
|
229 |
+
|
230 |
+
## [9.1.1] - 2018-12-31
|
231 |
+
|
232 |
+
See all related issues and PRs in the [9.1.1 milestone].
|
233 |
+
|
234 |
+
### Fixed
|
235 |
+
- :bug: `ForbiddenThisUseContexts`: false positive for unsetting `$this['key']` on objects implementing `ArrayAccess`. [#781](https://github.com/PHPCompatibility/PHPCompatibility/pull/781). Fixes [#780](https://github.com/PHPCompatibility/PHPCompatibility/issues/780)
|
236 |
+
|
237 |
+
## [9.1.0] - 2018-12-16
|
238 |
+
|
239 |
+
See all related issues and PRs in the [9.1.0 milestone].
|
240 |
+
|
241 |
+
### Added
|
242 |
+
- :star2: New `PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue` sniff to detect code which could be affected by the PHP 7.0 change in the values reported by `func_get_arg()`, `func_get_args()`, `debug_backtrace()` and exception backtraces. [#750](https://github.com/PHPCompatibility/PHPCompatibility/pull/750). Fixes [#585](https://github.com/PHPCompatibility/PHPCompatibility/pull/585).
|
243 |
+
- :star2: New `PHPCompatibility.MethodUse.NewDirectCallsToClone` sniff to detect direct call to a `__clone()` magic method which wasn't allowed prior to PHP 7.0. [#743](https://github.com/PHPCompatibility/PHPCompatibility/pull/743). Fixes [#629](https://github.com/PHPCompatibility/PHPCompatibility/issues/629).
|
244 |
+
- :star2: New `PHPCompatibility.Variables.ForbiddenThisUseContext` sniff to detect most of the inconsistencies surrounding the use of the `$this` variable, which were removed in PHP 7.1. [#762](https://github.com/PHPCompatibility/PHPCompatibility/pull/762), [#771](https://github.com/PHPCompatibility/PHPCompatibility/pull/771). Fixes [#262](https://github.com/PHPCompatibility/PHPCompatibility/issues/262) and [#740](https://github.com/PHPCompatibility/PHPCompatibility/issues/740).
|
245 |
+
- :star: `NewClasses`: detection of more native PHP Exceptions. [#743](https://github.com/PHPCompatibility/PHPCompatibility/pull/743), [#753](https://github.com/PHPCompatibility/PHPCompatibility/pull/753)
|
246 |
+
- :star: `NewConstants` : detection of the new PHP 7.3 Curl, Stream Crypto and LDAP constants and some more PHP 7.0 Tokenizer constants. [#752](https://github.com/PHPCompatibility/PHPCompatibility/pull/752), [#767](https://github.com/PHPCompatibility/PHPCompatibility/pull/767), [#778](https://github.com/PHPCompatibility/PHPCompatibility/pull/778)
|
247 |
+
- :star: `NewFunctions` sniff: recognize (more) new LDAP functions as introduced in PHP 7.3. [#768](https://github.com/PHPCompatibility/PHPCompatibility/pull/768)
|
248 |
+
- :star: `NewFunctionParameters` sniff: recognize the new `$serverctrls` parameter which was added to a number of LDAP functions in PHP 7.3. [#769](https://github.com/PHPCompatibility/PHPCompatibility/pull/769)
|
249 |
+
- :star: `NewIniDirectives` sniff: recognize the new `imap.enable_insecure_rsh` ini directive as introduced in PHP 7.1.25, 7.2.13 and 7.3.0. [#770](https://github.com/PHPCompatibility/PHPCompatibility/pull/770)
|
250 |
+
- :star: `NewInterfaces` sniff: recognize two more Session related interfaces which were introduced in PHP 5.5.1 and 7.0 respectively. [#748](https://github.com/PHPCompatibility/PHPCompatibility/pull/748)
|
251 |
+
- :star: Duplicate of upstream `findStartOfStatement()` method to the `PHPCompatibility\PHPCSHelper` class to allow for PHPCS cross-version usage of that method. [#750](https://github.com/PHPCompatibility/PHPCompatibility/pull/750)
|
252 |
+
|
253 |
+
### Changed
|
254 |
+
- :pushpin: `RemovedPHP4StyleConstructors`: will now also detect PHP4-style constructors when declared in interfaces. [#751](https://github.com/PHPCompatibility/PHPCompatibility/pull/751)
|
255 |
+
- :pushpin: `Sniff::validDirectScope()`: the return value of this method has changed. Previously it would always be a boolean. It will stil return `false` when no valid direct scope has been found, but it will now return the `stackPtr` to the scope token if a _valid_ direct scope was encountered. [#758](https://github.com/PHPCompatibility/PHPCompatibility/pull/758)
|
256 |
+
- :rewind: `NewOperators` : updated the version number for `T_COALESCE_EQUAL`. [#746](https://github.com/PHPCompatibility/PHPCompatibility/pull/746)
|
257 |
+
- :pencil: Minor improvement to an error message in the unit test suite. [#742](https://github.com/PHPCompatibility/PHPCompatibility/pull/742)
|
258 |
+
- :recycle: Various code clean-up and improvements. [#745](https://github.com/PHPCompatibility/PHPCompatibility/pull/745), [#756](https://github.com/PHPCompatibility/PHPCompatibility/pull/756), [#774](https://github.com/PHPCompatibility/PHPCompatibility/pull/774)
|
259 |
+
- :recycle: Various minor inline documentation fixes. [#749](https://github.com/PHPCompatibility/PHPCompatibility/pull/749), [#757](https://github.com/PHPCompatibility/PHPCompatibility/pull/757)
|
260 |
+
- :umbrella: Improved code coverage recording. [#744](https://github.com/PHPCompatibility/PHPCompatibility/pull/744), [#776](https://github.com/PHPCompatibility/PHPCompatibility/pull/776)
|
261 |
+
- :green_heart: Travis: build tests are now being run against PHP 7.3 as well. [#511](https://github.com/PHPCompatibility/PHPCompatibility/pull/511)
|
262 |
+
Note: full PHP 7.3 support is only available in combination with PHP_CodeSniffer 2.9.2 or 3.3.1+ due to an incompatibility within PHP_CodeSniffer itself.
|
263 |
+
|
264 |
+
### Fixed
|
265 |
+
- :white_check_mark: Compatibility with the upcoming release of PHPCS 3.4.0. Deal with changed behaviour of the PHPCS `Tokenizer` regarding binary type casts. [#760](https://github.com/PHPCompatibility/PHPCompatibility/pull/760)
|
266 |
+
- :bug: `InternalInterfaces`: false negative for implemented/extended interfaces prefixed with a namespace separator. [#775](https://github.com/PHPCompatibility/PHPCompatibility/pull/775)
|
267 |
+
- :bug: `NewClasses`: the introduction version of various native PHP Exceptions has been corrected. [#743](https://github.com/PHPCompatibility/PHPCompatibility/pull/743), [#753](https://github.com/PHPCompatibility/PHPCompatibility/pull/753)
|
268 |
+
- :bug: `NewInterfaces`: false negative for implemented/extended interfaces prefixed with a namespace separator. [#775](https://github.com/PHPCompatibility/PHPCompatibility/pull/775)
|
269 |
+
- :bug: `RemovedPHP4StyleConstructors`: the sniff would examine methods in nested anonymous classes as if they were methods of the higher level class. [#751](https://github.com/PHPCompatibility/PHPCompatibility/pull/751)
|
270 |
+
- :rewind: `RemovedPHP4StyleConstructors`: the sniff will no longer throw false positives for the first method in an anonymous class when used in combination with PHPCS 2.3.x. [#751](https://github.com/PHPCompatibility/PHPCompatibility/pull/751)
|
271 |
+
- :rewind: `ReservedFunctionNames`: fixed incorrect error message text for methods in anonymous classes when used in combination with PHPCS 2.3.x. [#755](https://github.com/PHPCompatibility/PHPCompatibility/pull/755)
|
272 |
+
- :bug: `ReservedFunctionNames`: prevent duplicate errors being thrown for methods in nested anonymous classes. [#755](https://github.com/PHPCompatibility/PHPCompatibility/pull/755)
|
273 |
+
- :bug: `PHPCSHelper::findEndOfStatement()`: minor bug fix. [#749](https://github.com/PHPCompatibility/PHPCompatibility/pull/749)
|
274 |
+
- :bug: `Sniff::isClassProperty()`: class properties for classes nested in conditions or function calls were not always recognized as class properties. [#758](https://github.com/PHPCompatibility/PHPCompatibility/pull/758)
|
275 |
+
|
276 |
+
### Credits
|
277 |
+
Thanks go out to [Jonathan Champ] for his contribution to this version. :clap:
|
278 |
+
|
279 |
+
|
280 |
+
## [9.0.0] - 2018-10-07
|
281 |
+
|
282 |
+
**IMPORTANT**: This release contains **breaking changes**. Please read the below information carefully before upgrading!
|
283 |
+
|
284 |
+
All sniffs have been placed in meaningful categories and a number of sniffs have been renamed to have more consistent, meaningful and future-proof names.
|
285 |
+
|
286 |
+
Both the `PHPCompatibilityJoomla` [[GH](https://github.com/PHPCompatibility/PHPCompatibilityJoomla) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-joomla)] as well as the `PHPCompatibilityWP` [[GH](https://github.com/PHPCompatibility/PHPCompatibilityWP)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp)] rulesets have already been adjusted for this change and have released a new version which is compatible with this version of PHPCompatibility.
|
287 |
+
|
288 |
+
Aside from those CMS-based rulesets, this project now also offers a number of polyfill-library specific rulesets, such as `PHPCompatibilityPasswordCompat` [[GH](https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-passwordcompat)] for @ircmaxell's [`password_compat`](https://github.com/ircmaxell/password_compat) libary, `PHPCompatibilityParagonieRandomCompat` and `PHPCompatibilityParagonieSodiumCompat` [[GH](https://github.com/PHPCompatibility/PHPCompatibilityParagonie)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-paragonie)] for the [Paragonie polyfills](https://github.com/paragonie?utf8=?&q=polyfill) and a number of rulesets related to various [polyfills offered by the Symfony project](https://github.com/symfony?utf8=?&q=polyfill) [[GH](https://github.com/PHPCompatibility/PHPCompatibilitySymfony)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-symfony)].
|
289 |
+
|
290 |
+
If your project uses one of these polyfills, please consider using these special polyfill rulesets to prevent false positives.
|
291 |
+
|
292 |
+
Also as of this version, [Juliette Reinders Folmer] is now officially a co-maintainer of this package.
|
293 |
+
|
294 |
+
### Upgrade instructions
|
295 |
+
|
296 |
+
* If you have `<exclude name="..."/>` directives in your own project's custom ruleset which relate to sniffs from the PHPCompatibility library, you will need to update your ruleset to use the new sniff names.
|
297 |
+
* If you use the new [PHPCS 3.2+ inline annotations](https://github.com/squizlabs/PHP_CodeSniffer/releases/3.2.0), i.e. `// phpcs:ignore Standard.Category.SniffName`, in combination with PHPCompatibility sniff names, you will need to update these annotations.
|
298 |
+
* If you use neither of the above, you should be fine and upgrading should be painless.
|
299 |
+
|
300 |
+
### Overview of all the sniff renames:
|
301 |
+
|
302 |
+
Old Category.SniffName | New Category.SniffName
|
303 |
+
--- | ---
|
304 |
+
**PHP**.ArgumentFunctionsUsage | **FunctionUse**.ArgumentFunctionsUsage
|
305 |
+
**PHP**.CaseSensitiveKeywords | **Keywords**.CaseSensitiveKeywords
|
306 |
+
**PHP**.ConstantArraysUsingConst | **InitialValue**.**New**ConstantArraysUsingConst
|
307 |
+
**PHP**.ConstantArraysUsingDefine | **InitialValue**.**New**ConstantArraysUsingDefine
|
308 |
+
**PHP**.**Deprecated**Functions | **FunctionUse**.**Removed**Functions
|
309 |
+
**PHP**.**Deprecated**IniDirectives | **IniDirectives**.**Removed**IniDirectives
|
310 |
+
**PHP**.**Deprecated**MagicAutoload | **FunctionNameRestrictions**.**Removed**MagicAutoload
|
311 |
+
**PHP**.**Deprecated**NewReference | **Syntax**.**Removed**NewReference
|
312 |
+
**PHP**.**Deprecated**PHP4StyleConstructors | **FunctionNameRestrictions**.**Removed**PHP4StyleConstructors
|
313 |
+
**PHP**.**Deprecated**TypeCasts | **TypeCasts**.**Removed**TypeCasts
|
314 |
+
**PHP**.DiscouragedSwitchContinue | **ControlStructures**.DiscouragedSwitchContinue
|
315 |
+
**PHP**.DynamicAccessToStatic | **Syntax**.**New**DynamicAccessToStatic
|
316 |
+
**PHP**.EmptyNonVariable | **LanguageConstructs**.**New**EmptyNonVariable
|
317 |
+
**PHP**.ForbiddenBreakContinueOutsideLoop | **ControlStructures**.ForbiddenBreakContinueOutsideLoop
|
318 |
+
**PHP**.ForbiddenBreakContinueVariableArguments | **ControlStructures**.ForbiddenBreakContinueVariableArguments
|
319 |
+
**PHP**.ForbiddenCallTimePassByReference | **Syntax**.ForbiddenCallTimePassByReference
|
320 |
+
**PHP**.Forbidden**ClosureUseVariableNames** | **FunctionDeclarations**.Forbidden**VariableNamesInClosureUse**
|
321 |
+
**PHP**.ForbiddenEmptyListAssignment | **Lists**.ForbiddenEmptyListAssignment
|
322 |
+
**PHP**.Forbidden**Function**ParametersWithSameName | **FunctionDeclarations**.ForbiddenParametersWithSameName
|
323 |
+
**PHP**.ForbiddenGlobalVariableVariable | **Variables**.ForbiddenGlobalVariableVariable
|
324 |
+
**PHP**.ForbiddenNames | **Keywords**.ForbiddenNames
|
325 |
+
**PHP**.ForbiddenNamesAsDeclared | **Keywords**.ForbiddenNamesAsDeclared
|
326 |
+
**PHP**.ForbiddenNamesAsInvokedFunctions | **Keywords**.ForbiddenNamesAsInvokedFunctions
|
327 |
+
**PHP**.ForbiddenNegativeBitshift | **Operators**.ForbiddenNegativeBitshift
|
328 |
+
**PHP**.ForbiddenSwitchWithMultipleDefaultBlocks | **ControlStructures**.ForbiddenSwitchWithMultipleDefaultBlocks
|
329 |
+
**PHP**.InternalInterfaces | **Interfaces**.InternalInterfaces
|
330 |
+
**PHP**.LateStaticBinding | **Classes**.**New**LateStaticBinding
|
331 |
+
**PHP**.**MbstringReplaceE**Modifier | **ParameterValues**.**RemovedMbstring**Modifier**s**
|
332 |
+
**PHP**.NewAnonymousClasses | **Classes**.NewAnonymousClasses
|
333 |
+
**PHP**.NewArrayStringDereferencing | **Syntax**.NewArrayStringDereferencing
|
334 |
+
**PHP**.NewClasses | **Classes**.NewClasses
|
335 |
+
**PHP**.NewClassMemberAccess | **Syntax**.NewClassMemberAccess
|
336 |
+
**PHP**.NewClosure | **FunctionDeclarations**.NewClosure
|
337 |
+
**PHP**.NewConstants | **Constants**.NewConstants
|
338 |
+
**PHP**.NewConstantScalarExpressions | **InitialValue**.NewConstantScalarExpressions
|
339 |
+
**PHP**.NewConstVisibility | **Classes**.NewConstVisibility
|
340 |
+
**PHP**.NewExecutionDirectives | **ControlStructures**.NewExecutionDirectives
|
341 |
+
**PHP**.NewFunctionArrayDereferencing | **Syntax**.NewFunctionArrayDereferencing
|
342 |
+
**PHP**.NewFunctionParameters | **FunctionUse**.NewFunctionParameters
|
343 |
+
**PHP**.NewFunctions | **FunctionUse**.NewFunctions
|
344 |
+
**PHP**.NewGeneratorReturn | **Generators**.NewGeneratorReturn
|
345 |
+
**PHP**.NewGroupUseDeclarations | **UseDeclarations**.NewGroupUseDeclarations
|
346 |
+
**PHP**.NewHashAlgorithms | **ParameterValues**.NewHashAlgorithms
|
347 |
+
**PHP**.NewHeredoc**Initialize** | **InitialValue**.NewHeredoc
|
348 |
+
**PHP**.NewIniDirectives | **IniDirectives**.NewIniDirectives
|
349 |
+
**PHP**.NewInterfaces | **Interfaces**.NewInterfaces
|
350 |
+
**PHP**.NewKeywords | **Keywords**.NewKeywords
|
351 |
+
**PHP**.NewLanguageConstructs | **LanguageConstructs**.NewLanguageConstructs
|
352 |
+
**PHP**.NewMagicClassConstant | **Constants**.NewMagicClassConstant
|
353 |
+
**PHP**.NewMagicMethods | **FunctionNameRestrictions**.NewMagicMethods
|
354 |
+
**PHP**.NewMultiCatch | **ControlStructures**.NewMultiCatch
|
355 |
+
**PHP**.NewNullableTypes | **FunctionDeclarations**.NewNullableTypes
|
356 |
+
**PHP**.NewReturnTypeDeclarations | **FunctionDeclarations**.NewReturnTypeDeclarations
|
357 |
+
**PHP**.New**Scalar**TypeDeclarations | **FunctionDeclarations**.New**Param**TypeDeclarations
|
358 |
+
**PHP**.NewTrailingComma | **Syntax**.New**FunctionCall**TrailingComma
|
359 |
+
**PHP**.NewTypeCasts | **TypeCasts**.NewTypeCasts
|
360 |
+
**PHP**.NewUseConstFunction | **UseDeclarations**.NewUseConstFunction
|
361 |
+
**PHP**.NonStaticMagicMethods | **FunctionDeclarations**.NonStaticMagicMethods
|
362 |
+
**PHP**.OptionalRequiredFunctionParameters | **FunctionUse**.Optional**To**RequiredFunctionParameters
|
363 |
+
**PHP**.ParameterShadowSuperGlobals | **FunctionDeclarations**.**Forbidden**ParameterShadowSuperGlobals
|
364 |
+
**PHP**.**PCRENew**Modifiers | **ParameterValues**.**NewPCRE**Modifiers
|
365 |
+
**PHP**.**PregReplaceE**Modifier | **ParameterValues**.**RemovedPCRE**Modifier**s**
|
366 |
+
**PHP**.RemovedAlternativePHPTags | **Miscellaneous**.RemovedAlternativePHPTags
|
367 |
+
**PHP**.RemovedConstants | **Constants**.RemovedConstants
|
368 |
+
**PHP**.RemovedExtensions | **Extensions**.RemovedExtensions
|
369 |
+
**PHP**.RemovedFunctionParameters | **FunctionUse**.RemovedFunctionParameters
|
370 |
+
**PHP**.RemovedGlobalVariables | **Variables**.Removed**Predefined**GlobalVariables
|
371 |
+
**PHP**.RemovedHashAlgorithms | **ParameterValues**.RemovedHashAlgorithms
|
372 |
+
**PHP**.ReservedFunctionNames | **FunctionNameRestrictions**.ReservedFunctionNames
|
373 |
+
**PHP**.RequiredOptionalFunctionParameters | **FunctionUse**.Required**To**OptionalFunctionParameters
|
374 |
+
**PHP**.ShortArray | **Syntax**.**New**ShortArray
|
375 |
+
**PHP**.Ternary**Operators** | **Operators**.**NewShort**Ternary
|
376 |
+
**PHP**.ValidIntegers | **Miscellaneous**.ValidIntegers
|
377 |
+
**PHP**.**VariableVariables** | **Variables**.**NewUniformVariableSyntax**
|
378 |
+
|
379 |
+
### Changelog for version 9.0.0
|
380 |
+
|
381 |
+
See all related issues and PRs in the [9.0.0 milestone].
|
382 |
+
|
383 |
+
### Added
|
384 |
+
- :star2: New `PHPCompatibility.ControlStructures.NewForeachExpressionReferencing` sniff to detect referencing of `$value` within a `foreach()` when the iterated array is not a variable. This was not supported prior to PHP 5.5. [#664](https://github.com/PHPCompatibility/PHPCompatibility/pull/664)
|
385 |
+
- :star2: New `PHPCompatibility.ControlStructures.NewListInForeach` sniff to detect unpacking nested arrays into separate variables via the `list()` construct in a `foreach()` statement. This was not supported prior to PHP 5.5. [#657](https://github.com/PHPCompatibility/PHPCompatibility/pull/657)
|
386 |
+
- :star2: New `PHPCompatibility.FunctionNameRestrictions.RemovedNamespacedAssert` sniff to detect declaring a function called `assert()` within a namespace. This has been deprecated as of PHP 7.3. [#735](https://github.com/PHPCompatibility/PHPCompatibility/pull/735). Partially fixes [#718](https://github.com/PHPCompatibility/PHPCompatibility/issues/718).
|
387 |
+
- :star2: New `PHPCompatibility.Lists.AssignmentOrder` sniff to detect `list()` constructs affected by the change in assignment order in PHP 7.0. [#656](https://github.com/PHPCompatibility/PHPCompatibility/pull/656)
|
388 |
+
- :star2: New `PHPCompatibility.Lists.NewKeyedList` sniff to detect usage of keys in `list()`, support for which was added in PHP 7.1. [#655](https://github.com/PHPCompatibility/PHPCompatibility/pull/655). Fixes [#252](https://github.com/PHPCompatibility/PHPCompatibility/issues/252).
|
389 |
+
- :star2: New `PHPCompatibility.Lists.NewListReferenceAssignment` sniff to detect reference assignments being used in `list()` constructs, support for which has been added in PHP 7.3. [#731](https://github.com/PHPCompatibility/PHPCompatibility/pull/731)
|
390 |
+
- :star2: New `PHPCompatibility.Lists.NewShortList` sniff to detect the shorthand array syntax `[]` being used for symmetric array destructuring as introduced in PHP 7.1. [#654](https://github.com/PHPCompatibility/PHPCompatibility/pull/654). Fixes [#248](https://github.com/PHPCompatibility/PHPCompatibility/issues/248).
|
391 |
+
- :star2: New `PHPCompatibility.Operators.NewOperators` sniff which checks for usage of the pow, pow equals, spaceship and coalesce (equals) operators. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738)
|
392 |
+
These checks were previously contained within the `PHPCompatibility.LanguageConstructs.NewLanguageConstructs` sniff.
|
393 |
+
- :star2: New `PHPCompatibility.ParameterValues.ForbiddenGetClassNull` sniff to detect `null` being passed to `get_class()`, support for which has been removed in PHP 7.2 [#659](https://github.com/PHPCompatibility/PHPCompatibility/pull/659). Fixes [#557](https://github.com/PHPCompatibility/PHPCompatibility/issues/557).
|
394 |
+
- :star2: New `PHPCompatibility.ParameterValues.NewArrayReduceInitialType` sniff to detect non-integers being passed as the `$initial` parameter to the `array_reduce()` function, which was not supported before PHP 5.3. [#666](https://github.com/PHPCompatibility/PHPCompatibility/pull/666). Fixes [#649](https://github.com/PHPCompatibility/PHPCompatibility/issues/649)
|
395 |
+
- :star2: New `PHPCompatibility.ParameterValues.NewFopenModes` sniff to examine the `$mode` parameter passed to `fopen()` for modes not available in older PHP versions. [#658](https://github.com/PHPCompatibility/PHPCompatibility/pull/658)
|
396 |
+
- :star2: New `PHPCompatibility.ParameterValues.NewNegativeStringOffset` sniff to detect negative string offsets being passed to string manipulation functions which was not supported before PHP 7.1. [#662](https://github.com/PHPCompatibility/PHPCompatibility/pull/662). Partially fixes [#253](https://github.com/PHPCompatibility/PHPCompatibility/issues/253).
|
397 |
+
- :star2: New `PHPCompatibility.ParameterValues.NewPackFormats` sniff to examine the `$format` parameter passed to `pack()` for formats not available in older PHP versions. [#665](https://github.com/PHPCompatibility/PHPCompatibility/pull/665)
|
398 |
+
- :star2: New `PHPCompatibility.ParameterValues.RemovedIconvEncoding` sniff to detect the PHP 5.6 deprecated encoding `$type`s being passed to `iconv_set_encoding()`. [#660](https://github.com/PHPCompatibility/PHPCompatibility/pull/660). Fixes [#475](https://github.com/PHPCompatibility/PHPCompatibility/issues/475).
|
399 |
+
- :star2: New `PHPCompatibility.ParameterValues.RemovedNonCryptoHashes` sniff to detect non-cryptographic hash algorithms being passed to various `hash_*()` functions. This is no longer accepted as of PHP 7.2. [#663](https://github.com/PHPCompatibility/PHPCompatibility/pull/663). Fixes [#559](https://github.com/PHPCompatibility/PHPCompatibility/issues/559)
|
400 |
+
- :star2: New `PHPCompatibility.ParameterValues.RemovedSetlocaleString` sniff to detect string literals being passed to the `$category` parameter of the `setlocale()` function. This behaviour was deprecated in PHP 4.2 and support has been removed in PHP 7.0. [#661](https://github.com/PHPCompatibility/PHPCompatibility/pull/661)
|
401 |
+
- :star2: New `PHPCompatibility.Syntax.NewFlexibleHeredocNowdoc` sniff to detect the new heredoc/nowdoc format as allowed as of PHP 7.3. [#736](https://github.com/PHPCompatibility/PHPCompatibility/pull/736). Fixes [#705](https://github.com/PHPCompatibility/PHPCompatibility/issues/705).
|
402 |
+
Note: This sniff is only supported in combination with PHP_CodeSniffer 2.6.0 and higher.
|
403 |
+
- :star: `PHPCompatibility.Classes.NewClasses` sniff: recognize the new `CompileError` and `JsonException` classes as introduced in PHP 7.3. [#676](https://github.com/PHPCompatibility/PHPCompatibility/pull/676)
|
404 |
+
- :star: `PHPCompatibility.Constants.NewConstants` sniff: recognize new constants which are being introduced in PHP 7.3. [#678](https://github.com/PHPCompatibility/PHPCompatibility/pull/678)
|
405 |
+
- :star: `PHPCompatibility.Constants.RemovedConstants` sniff: recognize constants which have been deprecated or removed in PHP 7.3. [#710](https://github.com/PHPCompatibility/PHPCompatibility/pull/710). Partially fixes [#718](https://github.com/PHPCompatibility/PHPCompatibility/issues/718).
|
406 |
+
- :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: recognize various new functions being introduced in PHP 7.3. [#679](https://github.com/PHPCompatibility/PHPCompatibility/pull/679)
|
407 |
+
- :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: recognize the `sapi_windows_*()`, `hash_hkdf()` and `pcntl_signal_get_handler()` functions as introduced in PHP 7.1. [#728](https://github.com/PHPCompatibility/PHPCompatibility/pull/728)
|
408 |
+
- :star: `PHPCompatibility.FunctionUse.RemovedFunctionParameters` sniff: recognize the deprecation of the `$case_insensitive` parameter for the `define()` function in PHP 7.3. [#706](https://github.com/PHPCompatibility/PHPCompatibility/pull/706)
|
409 |
+
- :star: `PHPCompatibility.FunctionUse.RemovedFunctions` sniff: recognize the PHP 7.3 deprecation of the `image2wbmp()`, `fgetss()` and `gzgetss()` functions, as well as the deprecation of undocumented Mbstring function aliases. [#681](https://github.com/PHPCompatibility/PHPCompatibility/pull/681), [#714](https://github.com/PHPCompatibility/PHPCompatibility/pull/714), [#720](https://github.com/PHPCompatibility/PHPCompatibility/pull/720). Partially fixes [#718](https://github.com/PHPCompatibility/PHPCompatibility/issues/718).
|
410 |
+
- :star: `PHPCompatibility.FunctionUse.RequiredToOptionalFunctionParameters` sniff: account for the second parameter for `array_push()` and `array_unshift()` becoming optional in PHP 7.3, as well as for the `$mode` parameter for a range of `ftp_*()` functions becoming optional. [#680](https://github.com/PHPCompatibility/PHPCompatibility/pull/680)
|
411 |
+
- :star: `PHPCompatibility.IniDirectives.NewIniDirectives` sniff: recognize new `syslog` and `session` ini directives as introduced in PHP 7.3. [#702](https://github.com/PHPCompatibility/PHPCompatibility/pull/702), [#719](https://github.com/PHPCompatibility/PHPCompatibility/pull/719), [#730](https://github.com/PHPCompatibility/PHPCompatibility/pull/730)
|
412 |
+
- :star: `PHPCompatibility.IniDirectives.NewIniDirectives` sniff: recognize some more ini directives which were introduced in PHP 7.1. [#727](https://github.com/PHPCompatibility/PHPCompatibility/pull/727)
|
413 |
+
- :star: `PHPCompatibility.IniDirectives.RemovedIniDirectived` sniff: recognize ini directives removed in PHP 7.3. [#677](https://github.com/PHPCompatibility/PHPCompatibility/pull/677), [#717](https://github.com/PHPCompatibility/PHPCompatibility/pull/717). Partially fixes [#718](https://github.com/PHPCompatibility/PHPCompatibility/issues/718).
|
414 |
+
- :star: New `isNumericCalculation()` and `isVariable()` utility methods to the `PHPCompatibility\Sniff` class. [#664](https://github.com/PHPCompatibility/PHPCompatibility/pull/664), [#666](https://github.com/PHPCompatibility/PHPCompatibility/pull/666)
|
415 |
+
- :books: A section about the new sniff naming conventions to the `Contributing` file. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738)
|
416 |
+
|
417 |
+
### Changed
|
418 |
+
- :fire: All sniffs have been placed in meaningful categories and a number of sniffs have been renamed to have more consistent, meaningful and future-proof names. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738). Fixes [#601](https://github.com/PHPCompatibility/PHPCompatibility/issues/601), [#692](https://github.com/PHPCompatibility/PHPCompatibility/issues/692)
|
419 |
+
See the table at the top of this changelog for details of all the file renames.
|
420 |
+
- :umbrella: The unit test files have been moved about as well. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738)
|
421 |
+
* The directory structure for these now mirrors the default directory structure used by PHPCS itself.
|
422 |
+
* The file names of the unit test files have been adjusted for the changes made in the sniffs.
|
423 |
+
* The unit test case files have been renamed and moved to the same directory as the actual test file they apply to.
|
424 |
+
* The `BaseSniffTest::sniffFile()` method has been adjusted to match. The signature of this method has changed. Where it previously expected a relative path to the unit test case file, it now expects an absolute path.
|
425 |
+
* The unit tests for the utility methods in the `PHPCompatibility\Sniff` class have been moved to a new `PHPCompatibility\Util\Tests\Core` subdirectory.
|
426 |
+
* The bootstrap file used for PHPUnit has been moved to the project root directory and renamed `phpunit-bootstrap.php`.
|
427 |
+
- :twisted_rightwards_arrows: The `PHPCompatibility.LanguageConstructs.NewLanguageConstructs` sniff has been split into two sniffs. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738)
|
428 |
+
The `PHPCompatibility.LanguageConstructs.NewLanguageConstructs` sniff now contains just the checks for the namespace separator and the ellipsis.
|
429 |
+
The new `PHPCompatibility.Operators.NewOperators` sniff now contains the checks regarding the pow, pow equals, spaceship and coalesce (equals) operators.
|
430 |
+
- :pushpin: The `PHPCompatibility.ParameterValues.RemovedMbstringModifiers` sniff will now also recognize removed regex modifiers when used within a function call to one of the undocumented Mbstring function aliases for the Mbstring regex functions. [#715](https://github.com/PHPCompatibility/PHPCompatibility/pull/715)
|
431 |
+
- :pushpin: The `PHPCompatibility\Sniff::getFunctionCallParameter()` utility method now allows for closures called via a variable. [#723](https://github.com/PHPCompatibility/PHPCompatibility/pull/723)
|
432 |
+
- :pencil2: `PHPCompatibility.Upgrade.LowPHPCS`: the minimum supported PHPCS version is now 2.3.0. [#699](https://github.com/PHPCompatibility/PHPCompatibility/pull/699)
|
433 |
+
- :pencil2: Minor inline documentation improvements. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738)
|
434 |
+
- :umbrella: Minor improvements to the unit tests for the `PHPCompatibility.FunctionNameRestrctions.RemovedMagicAutoload` sniff. [#716](https://github.com/PHPCompatibility/PHPCompatibility/pull/716)
|
435 |
+
- :recycle: Minor other optimizations. [#698](https://github.com/PHPCompatibility/PHPCompatibility/pull/698), [#697](https://github.com/PHPCompatibility/PHPCompatibility/pull/697)
|
436 |
+
- :wrench: Minor improvements to the build tools. [#701](https://github.com/PHPCompatibility/PHPCompatibility/pull/701)
|
437 |
+
- :wrench: Removed some unnecessary inline annotations. [#700](https://github.com/PHPCompatibility/PHPCompatibility/pull/700)
|
438 |
+
- :books: Replaced some of the badges in the Readme file. [#721](https://github.com/PHPCompatibility/PHPCompatibility/pull/721), [#722](https://github.com/PHPCompatibility/PHPCompatibility/pull/722)
|
439 |
+
- :books: Composer: updated the list of package authors. [#739](https://github.com/PHPCompatibility/PHPCompatibility/pull/739)
|
440 |
+
|
441 |
+
### Removed
|
442 |
+
- :no_entry_sign: Support for PHP_CodeSniffer 1.x and low 2.x versions. The new minimum version of PHP_CodeSniffer to be able to use this library is 2.3.0. [#699](https://github.com/PHPCompatibility/PHPCompatibility/pull/699). Fixes [#691](https://github.com/PHPCompatibility/PHPCompatibility/issues/691).
|
443 |
+
The minimum _recommended_ version of PHP_CodeSniffer remains the same, i.e. 2.6.0.
|
444 |
+
- :no_entry_sign: The `\PHPCompatibility\Sniff::inUseScope()` method has been removed as it is no longer needed now support for PHPCS 1.x has been dropped. [#699](https://github.com/PHPCompatibility/PHPCompatibility/pull/699)
|
445 |
+
- :no_entry_sign: Composer: The `autoload` section has been removed from the `composer.json` file. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738). Fixes [#568](https://github.com/PHPCompatibility/PHPCompatibility/issues/568).
|
446 |
+
Autoloading for this library is done via the PHP_CodeSniffer default mechanism, enhanced with our own autoloader, so the Composer autoloader shouldn't be needed and was causing issues in a particular use-case.
|
447 |
+
|
448 |
+
### Fixed
|
449 |
+
- :bug: `PHPCompatibility.FunctionUse.NewFunctionParameters` sniff: The new `$mode` parameter of the `php_uname()` function was added in PHP 4.3, not in PHP 7.0 as was previously being reported.
|
450 |
+
The previous implementation of this check was based on an error in the PHP documentation. The error in the PHP documentation has been rectified and the sniff has followed suit. [#711](https://github.com/PHPCompatibility/PHPCompatibility/pull/711)
|
451 |
+
- :bug: `PHPCompatibility.Generators.NewGeneratorReturn` sniff: The sniff would throw false positives for `return` statements in nested constructs and did not correctly detect the scope which should be examined. [#725](https://github.com/PHPCompatibility/PHPCompatibility/pull/725). Fixes [#724](https://github.com/PHPCompatibility/PHPCompatibility/pull/724).
|
452 |
+
- :bug: `PHPCompatibility.Keywords.NewKeywords` sniff: PHP magic constants are case _in_sensitive. This sniff now accounts for this. [#707](https://github.com/PHPCompatibility/PHPCompatibility/pull/707)
|
453 |
+
- :bug: Various bugs in the `PHPCompatibility.Syntax.ForbiddenCallTimePassByReference` sniff [#723](https://github.com/PHPCompatibility/PHPCompatibility/pull/723):
|
454 |
+
- Closures called via a variable will now also be examined. (false negative)
|
455 |
+
- References within arrays/closures passed as function call parameters would incorrectly trigger an error. (false positive)
|
456 |
+
- :green_heart: Compatibility with PHPUnit 7.2. [#712](https://github.com/PHPCompatibility/PHPCompatibility/pull/712)
|
457 |
+
|
458 |
+
### Credits
|
459 |
+
Thanks go out to [Jonathan Champ] for his contribution to this version. :clap:
|
460 |
+
|
461 |
+
|
462 |
## [8.2.0] - 2018-07-17
|
463 |
|
464 |
See all related issues and PRs in the [8.2.0 milestone].
|
580 |
See all related issues and PRs in the [8.1.0 milestone].
|
581 |
|
582 |
### Added
|
583 |
+
- :star2: New `NewConstants` and `RemovedConstants` sniffs to detect usage of new/removed PHP constants for all PHP versions from PHP 5 up. [#526](https://github.com/PHPCompatibility/PHPCompatibility/pull/525), [#551](https://github.com/PHPCompatibility/PHPCompatibility/pull/551), [#566](https://github.com/PHPCompatibility/PHPCompatibility/pull/566). Fixes [#263](https://github.com/PHPCompatibility/PHPCompatibility/issues/263).
|
584 |
+
- :star2: New `MagicAutoloadDeprecation` sniff to detect deprecated `__autoload()` functions as deprecated in PHP 7.2. [#540](https://github.com/PHPCompatibility/PHPCompatibility/pull/540)
|
585 |
+
- :star2: New `OptionalRequiredFunctionParameter` sniff to check for missing function call parameters which were required and only became optional in a later PHP version. [#524](https://github.com/PHPCompatibility/PHPCompatibility/pull/524)
|
586 |
+
- :star2: New `DynamicAccessToStatic` sniff to detect dynamic access to static methods and properties, as well as class constants, prior to PHP 5.3. [#535](https://github.com/PHPCompatibility/PHPCompatibility/pull/535). Fixes [#534](https://github.com/PHPCompatibility/PHPCompatibility/issues/534).
|
587 |
+
- :star: `DeprecatedFunctions` sniff: recognize yet more PHP 7.2 deprecated functions. [#561](https://github.com/PHPCompatibility/PHPCompatibility/pull/561), [#566](https://github.com/PHPCompatibility/PHPCompatibility/pull/566)
|
588 |
+
- :star: `DeprecatedIniDirectives` sniff: recognize the last of the PHP 7.2 deprecated ini directives. [#566](https://github.com/PHPCompatibility/PHPCompatibility/pull/566), [#567](https://github.com/PHPCompatibility/PHPCompatibility/pull/567)
|
589 |
+
- :star: `NewFunctions` : detection of all new PHP 7.2 functions added. [#522](https://github.com/PHPCompatibility/PHPCompatibility/pull/522), [#545](https://github.com/PHPCompatibility/PHPCompatibility/pull/545), [#551](https://github.com/PHPCompatibility/PHPCompatibility/pull/551), [#565](https://github.com/PHPCompatibility/PHPCompatibility/pull/565)
|
590 |
+
- :star: `RemovedExtensions` : report on usage of the `mcrypt` extension which has been removed in PHP 7.2. [#566](https://github.com/PHPCompatibility/PHPCompatibility/pull/566)
|
591 |
+
- :star: `RemovedGlobalVariables` : detection of the use of `$php_errormsg` with `track_errors` which has been deprecated in PHP 7.2. [#528](https://github.com/PHPCompatibility/PHPCompatibility/pull/528)
|
592 |
+
- :books: Documentation : added reporting usage instructions. [#533](https://github.com/PHPCompatibility/PHPCompatibility/pull/533), [#552](https://github.com/PHPCompatibility/PHPCompatibility/pull/552)
|
593 |
|
594 |
### Changed
|
595 |
+
- :pushpin: `NewClosures` : downgraded "$this found in closure outside class" to warning. [#536](https://github.com/PHPCompatibility/PHPCompatibility/pull/535). Fixes [#527](https://github.com/PHPCompatibility/PHPCompatibility/issues/527).
|
596 |
+
- :pushpin: `ForbiddenGlobalVariableVariable` : the sniff will now throw an error for each variable in a `global` statement which is no longer supported and show the variable found to make it easier to fix this. Previously only one error would be thrown per `global` statement. [#564](https://github.com/PHPCompatibility/PHPCompatibility/pull/564)
|
597 |
+
- :pushpin: `ForbiddenGlobalVariableVariable` : the sniff will now throw `warning`s for non-bare variables used in a `global` statement as those are discouraged since PHP 7.0. [#564](https://github.com/PHPCompatibility/PHPCompatibility/pull/564)
|
598 |
+
- :rewind: `NewLanguageConstructs` : updated the version number for `T_COALESCE_EQUAL`. [#523](https://github.com/PHPCompatibility/PHPCompatibility/pull/523)
|
599 |
+
- :pencil2: `Sniff::getTestVersion()` : simplified regex logic. [#520](https://github.com/PHPCompatibility/PHPCompatibility/pull/520)
|
600 |
+
- :green_heart: Travis : build tests are now being run against PHP 7.2 as well. [#511](https://github.com/PHPCompatibility/PHPCompatibility/pull/511)
|
601 |
+
- :wrench: Improved check for superfluous whitespaces in files. [#542](https://github.com/PHPCompatibility/PHPCompatibility/pull/542)
|
602 |
+
- :wrench: Build/PHPCS : stabilized the exclude patterns. [#529](https://github.com/PHPCompatibility/PHPCompatibility/pull/529)
|
603 |
+
- :wrench: Build/PHPCS : added array indentation check. [#538](https://github.com/PHPCompatibility/PHPCompatibility/pull/538)
|
604 |
+
- :white_check_mark: PHPCS cross-version compatibility : sync `FindExtendedClassname()` method with upstream. [#507](https://github.com/PHPCompatibility/PHPCompatibility/pull/507)
|
605 |
+
- :wrench: The minimum version for the recommended `DealerDirect/phpcodesniffer-composer-installer` Composer plugin has been upped to `0.4.3`. [#548](https://github.com/PHPCompatibility/PHPCompatibility/pull/548)
|
606 |
|
607 |
### Fixed
|
608 |
+
- :bug: `ForbiddenCallTimePassByReference` : a false positive was being thrown when a global constant was followed by a _bitwise and_. [#562](https://github.com/PHPCompatibility/PHPCompatibility/pull/562). Fixes [#39](https://github.com/PHPCompatibility/PHPCompatibility/issues/39).
|
609 |
+
- :bug: `ForbiddenGlobalVariableVariable` : the sniff was overzealous and would also report on `global` in combination with variable variables which are still supported. [#564](https://github.com/PHPCompatibility/PHPCompatibility/pull/564). Fixes [#537](https://github.com/PHPCompatibility/PHPCompatibility/issues/537).
|
610 |
+
- :bug: `ForbiddenGlobalVariableVariable` : variables interspersed with whitespace and/or comments were not being reported. [#564](https://github.com/PHPCompatibility/PHPCompatibility/pull/564)
|
611 |
+
- :rewind: `ForbiddenNamesAsInvokedFunctions` : improved recognition of function invocations using forbidden words and prevent warnings for keywords which are no longer forbidden as method names in PHP 7.0+. [#516](https://github.com/PHPCompatibility/PHPCompatibility/pull/516). Fixes [#515](https://github.com/PHPCompatibility/PHPCompatibility/issues/515)
|
612 |
+
- :bug: `VariableVariables` : variables interspersed with whitespace and/or comments were not being reported. [#563](https://github.com/PHPCompatibility/PHPCompatibility/pull/563)
|
613 |
+
- :umbrella: Fixed some unintentional syntax errors in test files. [#539](https://github.com/PHPCompatibility/PHPCompatibility/pull/539)
|
614 |
+
- :umbrella: Tests : fixed case numbering error. [#525](https://github.com/PHPCompatibility/PHPCompatibility/pull/525)
|
615 |
+
- :books: Tests : added missing test skip explanation. [#521](https://github.com/PHPCompatibility/PHPCompatibility/pull/521)
|
616 |
+
- :wrench: Fixed PHPCS whitespaces. [#543](https://github.com/PHPCompatibility/PHPCompatibility/pull/543)
|
617 |
+
- :wrench: Fixed code test coverage verification. [#550](https://github.com/PHPCompatibility/PHPCompatibility/pull/550). Fixes [#549](https://github.com/PHPCompatibility/PHPCompatibility/issues/549).
|
618 |
|
619 |
### Credits
|
620 |
Thanks go out to [Juliette Reinders Folmer] and [Jonathan Van Belle] for their contributions to this version. :clap:
|
625 |
See all related issues and PRs in the [8.0.1 milestone].
|
626 |
|
627 |
### Added
|
628 |
+
- :star2: New `DeprecatedTypeCasts` sniff to detect deprecated and removed type casts, such as the `(unset)` type cast as deprecated in PHP 7.2. [#498](https://github.com/PHPCompatibility/PHPCompatibility/pull/498)
|
629 |
+
- :star2: New `NewTypeCasts` sniff to detect type casts not present in older PHP versions such as the `(binary)` type cast as added in PHP 5.2.1. [#497](https://github.com/PHPCompatibility/PHPCompatibility/pull/497)
|
630 |
+
- :star: `NewGroupUseDeclaration`: Detection of PHP 7.2 trailing comma's in group use statements. [#504](https://github.com/PHPCompatibility/PHPCompatibility/pull/504)
|
631 |
+
- :star: `DeprecatedFunctions` sniff: recognize some more PHP 7.2 deprecated functions. [#501](https://github.com/PHPCompatibility/PHPCompatibility/pull/501)
|
632 |
+
- :star: `DeprecatedIniDirectives` sniff: recognize more PHP 7.2 deprecated ini directives. [#500](https://github.com/PHPCompatibility/PHPCompatibility/pull/500)
|
633 |
+
- :star: `ForbiddenNames` sniff: recognize `object` as a forbidden keyword since PHP 7.2. [#499](https://github.com/PHPCompatibility/PHPCompatibility/pull/499)
|
634 |
+
- :star: `NewReturnTypeDeclarations` sniff: recognize generic `parent`, PHP 7.1 `iterable` and PHP 7.2 `object` return type declarations. [#505](https://github.com/PHPCompatibility/PHPCompatibility/pull/505), [#499](https://github.com/PHPCompatibility/PHPCompatibility/pull/499)
|
635 |
+
- :star: `NewScalarTypeDeclarations` sniff: recognize PHP 7.2 `object` type declarion. [#499](https://github.com/PHPCompatibility/PHPCompatibility/pull/499)
|
636 |
|
637 |
### Changed
|
638 |
+
- :pencil2: Improved clarity of the deprecated functions alternative in the error message. [#502](https://github.com/PHPCompatibility/PHPCompatibility/pull/502)
|
639 |
|
640 |
### Fixed
|
641 |
+
- :fire_engine: Temporary hotfix for installed_paths (pending [upstream fix](https://github.com/squizlabs/PHP_CodeSniffer/issues/1591).) [#503](https://github.com/PHPCompatibility/PHPCompatibility/pull/503)
|
642 |
|
643 |
### Credits
|
644 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
755 |
See all related issues and PRs in the [8.0.0 milestone].
|
756 |
|
757 |
### Added
|
758 |
+
- :two_hearts: Support for PHP CodeSniffer 3.x. [#482](https://github.com/PHPCompatibility/PHPCompatibility/pull/482), [#481](https://github.com/PHPCompatibility/PHPCompatibility/pull/481), [#480](https://github.com/PHPCompatibility/PHPCompatibility/pull/480), [#488](https://github.com/PHPCompatibility/PHPCompatibility/pull/488), [#489](https://github.com/PHPCompatibility/PHPCompatibility/pull/489), [#495](https://github.com/PHPCompatibility/PHPCompatibility/pull/495)
|
759 |
|
760 |
### Changed
|
761 |
- :gift: As of this version PHPCompatibility will use semantic versioning.
|
762 |
+
- :fire: The directory structure of the repository has changed for better compatibility with installation via Composer. [#446](https://github.com/PHPCompatibility/PHPCompatibility/pull/446). Fixes [#102](https://github.com/PHPCompatibility/PHPCompatibility/issues/102), [#107](https://github.com/PHPCompatibility/PHPCompatibility/issues/107)
|
763 |
+
- :pencil2: The custom `functionWhitelist` property for the `PHPCompatibility.PHP.RemovedExtensions` sniff is now only supported in combination with PHP CodeSniffer 2.6.0 or higher (due to an upstream bug which was fixed in PHPCS 2.6.0). [#482](https://github.com/PHPCompatibility/PHPCompatibility/pull/482)
|
764 |
+
- :wrench: Improved the information provided to Composer from the `composer.json` file. [#446](https://github.com/PHPCompatibility/PHPCompatibility/pull/446), [#482](https://github.com/PHPCompatibility/PHPCompatibility/pull/482), [#486](https://github.com/PHPCompatibility/PHPCompatibility/pull/486)
|
765 |
+
- :wrench: Release archives will no longer contain the unit tests and other typical development files. You can still get these by using Composer with `--prefer-source` or by checking out a git clone of the repository. [#494](https://github.com/PHPCompatibility/PHPCompatibility/pull/494)
|
766 |
+
- :wrench: A variety of minor improvements to the build process. [#485](https://github.com/PHPCompatibility/PHPCompatibility/pull/485), [#486](https://github.com/PHPCompatibility/PHPCompatibility/pull/486), [#487](https://github.com/PHPCompatibility/PHPCompatibility/pull/487)
|
767 |
+
- :wrench: Some files for use by contributors have been renamed to use `.dist` extensions or moved for easier access. [#478](https://github.com/PHPCompatibility/PHPCompatibility/pull/478), [#479](https://github.com/PHPCompatibility/PHPCompatibility/pull/479), [#483](https://github.com/PHPCompatibility/PHPCompatibility/pull/483), [#493](https://github.com/PHPCompatibility/PHPCompatibility/pull/493)
|
768 |
+
- :books: The installation instructions in the Readme. [#496](https://github.com/PHPCompatibility/PHPCompatibility/pull/496)
|
769 |
+
- :books: The unit test instructions in the Contributing file. [#496](https://github.com/PHPCompatibility/PHPCompatibility/pull/496)
|
770 |
+
- :books: Improved the example code in the Readme. [#490](https://github.com/PHPCompatibility/PHPCompatibility/pull/490)
|
771 |
|
772 |
### Removed
|
773 |
- :no_entry_sign: Support for PHP 5.1 and 5.2.
|
774 |
|
775 |
+
The sniffs can now only be run on PHP 5.3 or higher in combination with PHPCS 1.5.6 or 2.x and on PHP 5.4 or higher in combination with PHPCS 3.x. [#484](https://github.com/PHPCompatibility/PHPCompatibility/pull/484), [#482](https://github.com/PHPCompatibility/PHPCompatibility/pull/482)
|
776 |
|
777 |
### Credits
|
778 |
Thanks go out to [Gary Jones] and [Juliette Reinders Folmer] for their contributions to this version. :clap:
|
783 |
See all related issues and PRs in the [7.1.5 milestone].
|
784 |
|
785 |
### Added
|
786 |
+
- :star: The `NewKeywords` sniff will now also sniff for `yield from` which was introduced in PHP 7.0. [#477](https://github.com/PHPCompatibility/PHPCompatibility/pull/477). Fixes [#476](https://github.com/PHPCompatibility/PHPCompatibility/issues/476)
|
787 |
+
- :books: The LGPL-3.0 license. [#447](https://github.com/PHPCompatibility/PHPCompatibility/pull/447)
|
788 |
|
789 |
### Changed
|
790 |
+
- :rewind: The `NewExecutionDirectives` sniff will now also report on execution directives when used in combination with PHPCS 2.0.0-2.3.3. [#451](https://github.com/PHPCompatibility/PHPCompatibility/pull/451)
|
791 |
+
- :rewind: The `getMethodParameters()` utility method will no longer break when used with PHPCS 1.5.x < 1.5.6. This affected a number of sniffs. [#452](https://github.com/PHPCompatibility/PHPCompatibility/pull/452)
|
792 |
+
- :rewind: The `inUseScope()` utility method will no longer break when used with PHPCS 2.0.0 - 2.2.0. This affected a number of sniffs. [#454](https://github.com/PHPCompatibility/PHPCompatibility/pull/454)
|
793 |
+
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#443](https://github.com/PHPCompatibility/PHPCompatibility/pull/443), [#474](https://github.com/PHPCompatibility/PHPCompatibility/pull/474)
|
794 |
+
- :pencil2: Renamed a test file for consistency. [#453](https://github.com/PHPCompatibility/PHPCompatibility/pull/453)
|
795 |
+
- :wrench: Code style clean up. [#429](https://github.com/PHPCompatibility/PHPCompatibility/pull/429)
|
796 |
+
- :wrench: Prevent Composer installing PHPCS 3.x. **_PHPCS 3.x is not (yet) supported by the PHPCompatibility standard, but will be in the near future._** [#444](https://github.com/PHPCompatibility/PHPCompatibility/pull/444)
|
797 |
+
- :green_heart: The code base will now be checked for consistent code style during build testing. [#429](https://github.com/PHPCompatibility/PHPCompatibility/pull/429)
|
798 |
+
- :green_heart: The sniffs are now also tested against HHVM for consistent results. _Note: the sniffs do not contain any HHVM specific checks nor is there any intention to add them at this time._ [#450](https://github.com/PHPCompatibility/PHPCompatibility/pull/450)
|
799 |
+
- :books: Made it explicit that - at this moment - PHPCS 3.x is not (yet) supported. [#444](https://github.com/PHPCompatibility/PHPCompatibility/pull/444)
|
800 |
+
- :books: Minor improvements to the Readme. [#448](https://github.com/PHPCompatibility/PHPCompatibility/pull/448), [#449](https://github.com/PHPCompatibility/PHPCompatibility/pull/449), [#468](https://github.com/PHPCompatibility/PHPCompatibility/pull/468)
|
801 |
+
- :books: Minor improvements to the Contributing guidelines. [#467](https://github.com/PHPCompatibility/PHPCompatibility/pull/467)
|
802 |
|
803 |
### Removed
|
804 |
+
- :no_entry_sign: The `DefaultTimeZoneRequired` sniff. This sniff was checking server settings rather than code. [#458](https://github.com/PHPCompatibility/PHPCompatibility/pull/458). Fixes [#457](https://github.com/PHPCompatibility/PHPCompatibility/issues/457)
|
805 |
+
- :no_entry_sign: The `NewMagicClassConstant` sniff as introduced in v 7.1.4 contained two additional checks for not strictly compatibility related issues. One of these was plainly wrong, the other opinionated. Both have been removed. [#442](https://github.com/PHPCompatibility/PHPCompatibility/pull/442). Fixes [#436](https://github.com/PHPCompatibility/PHPCompatibility/issues/436)
|
806 |
|
807 |
### Fixed
|
808 |
+
- :bug: `NewClass` sniff: was reporting an incorrect introduction version number for a few of the Exception classes. [#441](https://github.com/PHPCompatibility/PHPCompatibility/pull/441). Fixes [#440](https://github.com/PHPCompatibility/PHPCompatibility/issues/440).
|
809 |
+
- :bug: `ForbiddenBreakContinueVariableArguments` sniff: was incorrectly reporting an error if the `break` or `continue` was followed by a PHP closing tag (breaking out of PHP). [#462](https://github.com/PHPCompatibility/PHPCompatibility/pull/462). Fixes [#460](https://github.com/PHPCompatibility/PHPCompatibility/issues/460)
|
810 |
+
- :bug: `ForbiddenGlobalVariableVariable` sniff: was incorrectly reporting an error if the `global` statement was followed by a PHP closing tag (breaking out of PHP). [#463](https://github.com/PHPCompatibility/PHPCompatibility/pull/463).
|
811 |
+
- :bug: `DeprecatedFunctions` sniff: was reporting false positives for classes using the same name as a deprecated function. [#465](https://github.com/PHPCompatibility/PHPCompatibility/pull/465). Fixes [#464](https://github.com/PHPCompatibility/PHPCompatibility/issues/464)
|
812 |
|
813 |
### Credits
|
814 |
Thanks go out to [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap:
|
819 |
See all related issues and PRs in the [7.1.4 milestone].
|
820 |
|
821 |
### Added
|
822 |
+
- :star2: New `CaseSensitiveKeywords` sniff to detect use of non-lowercase `self`, `static` and `parent` keywords which could cause compatibility issues pre-PHP 5.5. [#382](https://github.com/PHPCompatibility/PHPCompatibility/pull/382)
|
823 |
+
- :star2: New `ConstantArraysUsingConst` sniff to detect constants defined using the `const` keyword being assigned an array value which was not supported prior to PHP 5.6. [#397](https://github.com/PHPCompatibility/PHPCompatibility/pull/397)
|
824 |
+
- :star2: New `ForbiddenClosureUseVariableNames` sniff to detect PHP 7.1 forbidden variable names in closure use statements. [#386](https://github.com/PHPCompatibility/PHPCompatibility/pull/386). Fixes [#374](https://github.com/PHPCompatibility/PHPCompatibility/issues/374)
|
825 |
+
- :star2: New `NewArrayStringDereferencing` sniff to detect array and string literal dereferencing as introduced in PHP 5.5. [#388](https://github.com/PHPCompatibility/PHPCompatibility/pull/388)
|
826 |
+
- :star2: New `NewHeredocInitialize` sniff to detect initialization of static variables and class properties/constants using the heredoc syntax which is supported since PHP 5.3. [#391](https://github.com/PHPCompatibility/PHPCompatibility/pull/391). Fixes [#51](https://github.com/PHPCompatibility/PHPCompatibility/issues/51)
|
827 |
+
- :star2: New `NewMagicClassConstant` sniff to detect use of the magic `::class` constant as introduced in PHP 5.5. [#403](https://github.com/PHPCompatibility/PHPCompatibility/pull/403). Fixes [#364](https://github.com/PHPCompatibility/PHPCompatibility/issues/364).
|
828 |
+
- :star2: New `NewUseConstFunction` sniff to detect use statements importing constants and functions as introduced in PHP 5.6. [#401](https://github.com/PHPCompatibility/PHPCompatibility/pull/401)
|
829 |
+
- :star: `DeprecatedFunctions` sniff: recognize PHP 7.2 deprecated GD functions. [#392](https://github.com/PHPCompatibility/PHPCompatibility/pull/392)
|
830 |
+
- :star: `DeprecatedIniDirectives` sniff: recognize PHP 7.2 deprecated `mbstring.func_overload` directive. [#377](https://github.com/PHPCompatibility/PHPCompatibility/pull/377)
|
831 |
+
- :star: `NewClasses` sniff: check for the PHP 5.1 `libXMLError` class. [#412](https://github.com/PHPCompatibility/PHPCompatibility/pull/412)
|
832 |
+
- :star: `NewClasses` sniff: recognize all native PHP Exception classes. [#418](https://github.com/PHPCompatibility/PHPCompatibility/pull/418)
|
833 |
+
- :star: `NewClosure` sniff: check for closures being declared as static and closures using `$this`. Both of which was not supported pre-PHP 5.4. [#389](https://github.com/PHPCompatibility/PHPCompatibility/pull/389). Fixes [#24](https://github.com/PHPCompatibility/PHPCompatibility/issues/24).
|
834 |
+
- :star: `NewFunctionParameters` sniff: recognize new `exclude_disabled` parameter for the `get_defined_functions()` function as introduced in PHP 7.0.15. [#375](https://github.com/PHPCompatibility/PHPCompatibility/pull/375)
|
835 |
+
- :star: `NewFunctions` sniff: recognize new PHP 7.2 socket related functions. [#376](https://github.com/PHPCompatibility/PHPCompatibility/pull/376)
|
836 |
+
- :star: `NewInterfaces` sniff: check for some more PHP native interfaces. [#411](https://github.com/PHPCompatibility/PHPCompatibility/pull/411)
|
837 |
+
- :star: New `isClassProperty()`, `isClassConstant()` and `validDirectScope()` utility methods to the `PHPCompatibility_Sniff` class. [#393](https://github.com/PHPCompatibility/PHPCompatibility/pull/393), [#391](https://github.com/PHPCompatibility/PHPCompatibility/pull/391).
|
838 |
+
- :star: New `getTypeHintsFromFunctionDeclaration()` utility method to the `PHPCompatibility_Sniff` class. [#414](https://github.com/PHPCompatibility/PHPCompatibility/pull/414).
|
839 |
+
- :umbrella: Unit tests against false positives for the `NewMagicMethods` sniff. [#381](https://github.com/PHPCompatibility/PHPCompatibility/pull/381)
|
840 |
+
- :umbrella: More unit tests for the `getTestVersion()` utility method. [#405](https://github.com/PHPCompatibility/PHPCompatibility/pull/405), [#430](https://github.com/PHPCompatibility/PHPCompatibility/pull/430)
|
841 |
+
- :green_heart: The XML of the ruleset will now be validated and checked for consistent code style during the build testing by Travis. [#433](https://github.com/PHPCompatibility/PHPCompatibility/pull/433)
|
842 |
+
- :books: Readme: information about setting `installed_paths` via a custom ruleset. [#407](https://github.com/PHPCompatibility/PHPCompatibility/pull/407)
|
843 |
+
- :books: `Changelog.md` file containing a record of notable changes since the first tagged release. [#421](https://github.com/PHPCompatibility/PHPCompatibility/pull/421)
|
844 |
|
845 |
### Changed
|
846 |
+
- :pushpin: The `ForbiddenNamesAsDeclared` sniff will now emit `warning`s for soft reserved keywords. [#406](https://github.com/PHPCompatibility/PHPCompatibility/pull/406), [#370](https://github.com/PHPCompatibility/PHPCompatibility/pull/370).
|
847 |
+
- :pushpin: The `ForbiddenNames` sniff will now allow for the more liberal rules for usage of reserved keywords as of PHP 7.0. [#417](https://github.com/PHPCompatibility/PHPCompatibility/pull/417)
|
848 |
+
- :pushpin: The `InternalInterfaces`, `NewClasses`, `NewConstVisibility`, `NewInterfaces`, `NewMagicMethods`, `NonStaticMagicMethods` and `RemovedGlobalVariables` sniffs will now also sniff for and correctly report violations in combination with anonymous classes. [#378](https://github.com/PHPCompatibility/PHPCompatibility/pull/378), [#383](https://github.com/PHPCompatibility/PHPCompatibility/pull/383), [#393](https://github.com/PHPCompatibility/PHPCompatibility/pull/393), [#394](https://github.com/PHPCompatibility/PHPCompatibility/pull/394), [#395](https://github.com/PHPCompatibility/PHPCompatibility/pull/395), [#396](https://github.com/PHPCompatibility/PHPCompatibility/pull/396). Fixes [#351](https://github.com/PHPCompatibility/PHPCompatibility/issues/351) and [#333](https://github.com/PHPCompatibility/PHPCompatibility/issues/333).
|
849 |
+
- :pushpin: The `NewClasses` and `NewInterfaces` sniffs will now also report on new classes/interfaces when used as type hints. [#414](https://github.com/PHPCompatibility/PHPCompatibility/pull/414), [#416](https://github.com/PHPCompatibility/PHPCompatibility/pull/416). Fixes [#352](https://github.com/PHPCompatibility/PHPCompatibility/issues/352)
|
850 |
+
- :pushpin: The `NewClasses` sniff will now also report on Exception classes when used in (multi-)`catch` statements. [#418](https://github.com/PHPCompatibility/PHPCompatibility/pull/418). Fixes [#373](https://github.com/PHPCompatibility/PHPCompatibility/issues/373).
|
851 |
+
- :pushpin: The `NewScalarTypeDeclarations` sniff will now report on new type hints even when the type hint is nullable. [#379](https://github.com/PHPCompatibility/PHPCompatibility/pull/379)
|
852 |
+
- :twisted_rightwards_arrows: The `NewNowdoc` sniff has been renamed to `NewNowdocQuotedHeredoc` and will now also check for double quoted heredoc identifiers as introduced in PHP 5.3. [#390](https://github.com/PHPCompatibility/PHPCompatibility/pull/390)
|
853 |
+
- :rewind: The `NewClasses` sniff will now also report anonymous classes which `extend` a new sniff when used in combination with PHPCS 2.4.0-2.8.0. [#432](https://github.com/PHPCompatibility/PHPCompatibility/pull/432). Fixes [#334](https://github.com/PHPCompatibility/PHPCompatibility/issues/334).
|
854 |
+
- :pencil2: `NewFunctionParameter` sniff: version number precision for two parameters. [#384](https://github.com/PHPCompatibility/PHPCompatibility/pull/384), [#428](https://github.com/PHPCompatibility/PHPCompatibility/pull/428)
|
855 |
+
- :umbrella: Skipping two unit tests for the `ForbiddenClosureUseVariable` sniff when run on PHPCS 2.5.1 as these cause an infinite loop due to an upstream bug. [#408](https://github.com/PHPCompatibility/PHPCompatibility/pull/408)
|
856 |
+
- :umbrella: Skipping unit tests involving `trait`s in combination with PHP < 5.4 and PHPCS < 2.4.0 as `trait`s are not recognized in those circumstances. [#431](https://github.com/PHPCompatibility/PHPCompatibility/pull/431)
|
857 |
+
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#385](https://github.com/PHPCompatibility/PHPCompatibility/pull/385), [#387](https://github.com/PHPCompatibility/PHPCompatibility/pull/387), [#415](https://github.com/PHPCompatibility/PHPCompatibility/pull/415), [#423](https://github.com/PHPCompatibility/PHPCompatibility/pull/423), [#424](https://github.com/PHPCompatibility/PHPCompatibility/pull/424)
|
858 |
+
- :recycle: Minor simplification of the PHPUnit 6 compatibility layer and other test code. [#426](https://github.com/PHPCompatibility/PHPCompatibility/pull/426), [#425](https://github.com/PHPCompatibility/PHPCompatibility/pull/425)
|
859 |
+
- General housekeeping. [#398](https://github.com/PHPCompatibility/PHPCompatibility/pull/398), [#400](https://github.com/PHPCompatibility/PHPCompatibility/pull/400)
|
860 |
+
- :wrench: Minor tweaks to the Travis build script. [#409](https://github.com/PHPCompatibility/PHPCompatibility/pull/409)
|
861 |
+
- :green_heart: The sniffs are now also tested against PHP nightly for consistent results. [#380](https://github.com/PHPCompatibility/PHPCompatibility/pull/380)
|
862 |
|
863 |
### Fixed
|
864 |
+
- :fire: Using unbounded ranges in `testVersion` resulted in unreported errors when used with sniffs using the `supportsBelow()` method. This affected the results of approximately half the sniffs. [#430](https://github.com/PHPCompatibility/PHPCompatibility/pull/430)
|
865 |
+
- :bug: The `ForbiddenNames` sniff would throw false positives for `use` statements with the `final` modifier in traits. [#402](https://github.com/PHPCompatibility/PHPCompatibility/pull/402).
|
866 |
+
- :bug: The `ForbiddenNames` sniff would fail to report on functions declared to return by reference using a reserved keyword as the function name. [#413](https://github.com/PHPCompatibility/PHPCompatibility/pull/413)
|
867 |
+
- :bug: The `ForbiddenNames` sniff would only examine the first part of a namespace and not report on reserved keywords used in subsequent parts of a nested namespace. [#419](https://github.com/PHPCompatibility/PHPCompatibility/pull/419)
|
868 |
+
- :bug: The `ForbiddenNames` sniff would not always correctly report on use statements importing constants or functions using reserved keywords. [#420](https://github.com/PHPCompatibility/PHPCompatibility/pull/420)
|
869 |
+
- :bug: The `NewKeywords` sniff would sometimes fail to report on the `const` keyword when used in a class, but not for a class constant. [#424](https://github.com/PHPCompatibility/PHPCompatibility/pull/424)
|
870 |
+
- :green_heart: PHPCS has released version 3.0 and updated the `master` branch to reflect this. This was causing the builds to fail. [#422](https://github.com/PHPCompatibility/PHPCompatibility/pull/422)
|
871 |
|
872 |
### Credits
|
873 |
Thanks go out to [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap:
|
881 |
- :zap: The `testVersion` config parameter now allows for specifying unbounded ranges.
|
882 |
For example: specifying `-5.6` means: check for compatibility with all PHP versions up to and including PHP 5.6;
|
883 |
Specifying `7.0-` means: check for compatibility with all PHP versions from PHP 7.0 upwards.
|
884 |
+
For more information about setting the `testVersion`, see [Using the compatibility sniffs](https://github.com/PHPCompatibility/PHPCompatibility#using-the-compatibility-sniffs) in the readme.
|
885 |
+
- :umbrella: Unit test for multi-line short arrays for the `ShortArray` sniff. [#347](https://github.com/PHPCompatibility/PHPCompatibility/pull/347)
|
886 |
+
- :umbrella: Various additional unit tests against false positives. [#345](https://github.com/PHPCompatibility/PHPCompatibility/pull/345), [#369](https://github.com/PHPCompatibility/PHPCompatibility/pull/369)
|
887 |
+
- :umbrella: Unit tests for the `supportsBelow()`, `supportsAbove()` and `getTestVersion()` utility methods. [#363](https://github.com/PHPCompatibility/PHPCompatibility/pull/363)
|
888 |
+
- :books: Readme: information about installation of the standard using git check-out. [#349](https://github.com/PHPCompatibility/PHPCompatibility/pull/349)
|
889 |
+
- :books: `Contributing.md` file with information about reporting bugs, requesting features, making pull requests and running the unit tests. [#350](https://github.com/PHPCompatibility/PHPCompatibility/pull/350)
|
890 |
|
891 |
### Changed
|
892 |
+
- :pushpin: The `ForbiddenFunctionParametersWithSameName`, `NewScalarTypeDeclarations`, `ParameterShadowSuperGlobals` sniff will now also sniff for and report violations in closures. [#331](https://github.com/PHPCompatibility/PHPCompatibility/pull/331)
|
893 |
+
- :twisted_rightwards_arrows: :rewind: The check for the PHP 5.3 `nowdoc` structure has been moved from the `NewKeywords` sniff to a new stand-alone `NewNowdoc` sniff which will now also recognize this structure when the sniffs are run on PHP 5.2. [#335](https://github.com/PHPCompatibility/PHPCompatibility/pull/335)
|
894 |
+
- :rewind: The `ForbiddenNames` sniff will now also correctly recognize reserved keywords used in a declared namespace when run on PHP 5.2. [#362](https://github.com/PHPCompatibility/PHPCompatibility/pull/362)
|
895 |
+
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#360](https://github.com/PHPCompatibility/PHPCompatibility/pull/360)
|
896 |
- :recycle: The unit tests would previously run each test case file against all PHPCompatibility sniffs. Now, they will only be tested against the sniff which the test case file is intended to test. This allows for more test cases to be tested, more precise testing in combination with `testVersion` settings and makes the unit tests run ~6 x faster.
|
897 |
+
Relevant additional unit tests have been added and others adjusted. [#369](https://github.com/PHPCompatibility/PHPCompatibility/pull/369)
|
898 |
+
- :recycle: Refactoring/tidying up of some unit test code. [#343](https://github.com/PHPCompatibility/PHPCompatibility/pull/343), [#345](https://github.com/PHPCompatibility/PHPCompatibility/pull/345), [#356](https://github.com/PHPCompatibility/PHPCompatibility/pull/356), [#355](https://github.com/PHPCompatibility/PHPCompatibility/pull/355), [#359](https://github.com/PHPCompatibility/PHPCompatibility/pull/359)
|
899 |
+
- General housekeeping. [#346](https://github.com/PHPCompatibility/PHPCompatibility/pull/346)
|
900 |
+
- :books: Readme: Clarify minimum requirements and influence on the results. [#348](https://github.com/PHPCompatibility/PHPCompatibility/pull/348)
|
901 |
|
902 |
### Removed
|
903 |
+
- :twisted_rightwards_arrows: Removed the `LongArrays` sniff. The checks it contained have been moved into the `RemovedGlobalVariables` sniff. Both sniffs essentially did the same thing, just for different PHP native superglobals. [#354](https://github.com/PHPCompatibility/PHPCompatibility/pull/354)
|
904 |
|
905 |
### Fixed
|
906 |
+
- :bug: The `PregReplaceEModifier` sniff would throw a false positive if a quote character was used as the regex delimiter. [#357](https://github.com/PHPCompatibility/PHPCompatibility/pull/357)
|
907 |
+
- :bug: `RemovedGlobalVariables` sniff would report false positives for class properties shadowing the removed `$HTTP_RAW_POST_DATA` variables. [#354](https://github.com/PHPCompatibility/PHPCompatibility/pull/354).
|
908 |
+
- :bug: The `getFQClassNameFromNewToken()` utility function could go into an infinite loop causing PHP to run out of memory when examining unfinished code (examination during live coding). [#338](https://github.com/PHPCompatibility/PHPCompatibility/pull/338), [#342](https://github.com/PHPCompatibility/PHPCompatibility/pull/342)
|
909 |
+
- :bug: The `determineNamespace()` utility method would in certain cases not break out a loop. [#358](https://github.com/PHPCompatibility/PHPCompatibility/pull/358)
|
910 |
+
- :wrench: Travis script: Minor tweak for PHP 5.2 compatibility. [#341](https://github.com/PHPCompatibility/PHPCompatibility/pull/341)
|
911 |
+
- :wrench: The unit test suite is now also compatible with PHPUnit 6. [#365](https://github.com/PHPCompatibility/PHPCompatibility/pull/365)
|
912 |
+
- :books: Readme: Typo in the composer instructions. [#344](https://github.com/PHPCompatibility/PHPCompatibility/pull/344)
|
913 |
|
914 |
### Credits
|
915 |
Thanks go out to [Arthur Edamov], [Juliette Reinders Folmer], [Mark Clements] and [Tadas Juozapaitis] for their contributions to this version. :clap:
|
920 |
See all related issues and PRs in the [7.1.2 milestone].
|
921 |
|
922 |
### Added
|
923 |
+
- :star2: New `VariableVariables` sniff to detect variables variables for which the behaviour has changed in PHP 7.0. [#310](https://github.com/PHPCompatibility/PHPCompatibility/pull/310) Fixes [#309](https://github.com/PHPCompatibility/PHPCompatibility/issues/309).
|
924 |
+
- :star: The `NewReturnTypeDeclarations` sniff will now also sniff for non-scalar return type declarations, i.e. `array`, `callable`, `self` or a class name. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323)
|
925 |
+
- :star: The `NewLanguageConstructs` sniff will now also sniff for the null coalesce equal operator `??=`. This operator is slated to be introduced in PHP 7.2 and PHPCS already accounts for it. [#340](https://github.com/PHPCompatibility/PHPCompatibility/pull/340)
|
926 |
+
- :star: New `getReturnTypeHintToken()` utility method to the `PHPCompatibility_Sniff` class to retrieve return type hints from function declarations in a cross-PHPCS-version compatible way. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323).
|
927 |
+
- :star: New `stripVariables()` utility method to the `PHPCompatibility_Sniff` class to strip variables from interpolated text strings. [#341](https://github.com/PHPCompatibility/PHPCompatibility/pull/314).
|
928 |
+
- :umbrella: Additional unit tests covering previously uncovered code. [#308](https://github.com/PHPCompatibility/PHPCompatibility/pull/308)
|
929 |
|
930 |
### Changed
|
931 |
+
- :pushpin: The `MbstringReplaceEModifier`, `PregReplaceEModifier` and `NewExecutionDirectives` sniffs will now also correctly interpret double quoted text strings with interpolated variables. [#341](https://github.com/PHPCompatibility/PHPCompatibility/pull/314), [#324](https://github.com/PHPCompatibility/PHPCompatibility/pull/324).
|
932 |
+
- :pushpin: The `NewNullableTypes` sniff will now also report on nullable (return) type hints when used with closures. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323)
|
933 |
+
- :pushpin: The `NewReturnTypeDeclarations` sniff will now also report on return type hints when used with closures. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323)
|
934 |
+
- :pushpin: Allow for anonymous classes in the `inClassScope()` utility method. [#315](https://github.com/PHPCompatibility/PHPCompatibility/pull/315)
|
935 |
+
- :pushpin: The function call parameter related utility functions can now also be used to get the individual items from an array declaration. [#300](https://github.com/PHPCompatibility/PHPCompatibility/pull/300)
|
936 |
+
- :twisted_rightwards_arrows: The `NewScalarReturnTypeDeclarations` sniff has been renamed to `NewReturnTypeDeclarations`. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323)
|
937 |
+
- :rewind: The `ForbiddenNames` sniff will now also correctly ignore anonymous classes when used in combination with PHPCS < 2.3.4. [#319](https://github.com/PHPCompatibility/PHPCompatibility/pull/319)
|
938 |
+
- :rewind: The `NewAnonymousClasses` sniff will now correctly recognize and report on anonymous classes when used in combination with PHPCS < 2.5.2. [#325](https://github.com/PHPCompatibility/PHPCompatibility/pull/325)
|
939 |
+
- :rewind: The `NewGroupUseDeclarations` sniff will now correctly recognize and report on group use statements when used in combination with PHPCS < 2.6.0. [#320](https://github.com/PHPCompatibility/PHPCompatibility/pull/320)
|
940 |
+
- :rewind: The `NewNullableTypes` sniff will now correctly recognize and report on nullable return types when used in combination with PHPCS < 2.6.0. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323)
|
941 |
+
- :rewind: The `NewReturnTypeDeclarations` sniff will now correctly recognize and report on new return types when used in combination with PHPCS < 2.6.0. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323)
|
942 |
+
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#317](https://github.com/PHPCompatibility/PHPCompatibility/pull/317)
|
943 |
+
- :recycle: Defer to upstream `hasCondition()` utility method where appropriate. [#315](https://github.com/PHPCompatibility/PHPCompatibility/pull/315)
|
944 |
+
- :recycle: Minor refactoring of some unit test code. [#304](https://github.com/PHPCompatibility/PHPCompatibility/pull/304), [#303](https://github.com/PHPCompatibility/PHPCompatibility/pull/303), [#318](https://github.com/PHPCompatibility/PHPCompatibility/pull/318)
|
945 |
+
- :wrench: All unit tests now have appropriate `@group` annotations allowing for quicker/easier testing of a select group of tests/sniffs. [#305](https://github.com/PHPCompatibility/PHPCompatibility/pull/305)
|
946 |
+
- :wrench: All unit tests now have appropriate `@covers` annotations to improve code coverage reporting and remove bleed through of accidental coverage. [#307](https://github.com/PHPCompatibility/PHPCompatibility/pull/307)
|
947 |
+
- :wrench: Minor tweaks to the travis script. [#322](https://github.com/PHPCompatibility/PHPCompatibility/pull/322)
|
948 |
+
- :green_heart: The PHPCompatibility code base itself will now be checked for cross-version compatibility during build testing. [#322](https://github.com/PHPCompatibility/PHPCompatibility/pull/322)
|
949 |
|
950 |
### Fixed
|
951 |
+
- :bug: The `ConstantArraysUsingDefine` sniff would throw false positives if the value of the `define()` was retrieved via a function call and an array parameter was passed. [#327](https://github.com/PHPCompatibility/PHPCompatibility/pull/327)
|
952 |
+
- :bug: The `ForbiddenCallTimePassByReference` sniff would throw false positives on assign by reference within function calls or conditions. [#302](https://github.com/PHPCompatibility/PHPCompatibility/pull/302) Fixes the last two cases reported in [#68](https://github.com/PHPCompatibility/PHPCompatibility/issues/68#issuecomment-231366445)
|
953 |
+
- :bug: The `ForbiddenGlobalVariableVariableSniff` sniff would only examine the first variable in a `global ...` statement causing unreported issues if subsequent variables were variable variables. [#316](https://github.com/PHPCompatibility/PHPCompatibility/pull/316)
|
954 |
+
- :bug: The `NewKeywords` sniff would throw a false positive for the `const` keyword when encountered in an interface. [#312](https://github.com/PHPCompatibility/PHPCompatibility/pull/312)
|
955 |
+
- :bug: The `NewNullableTypes` sniff would not report on nullable return types for namespaced classnames used as a type hint. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323)
|
956 |
+
- :bug: The `PregReplaceEModifier` sniff would always consider the first parameter passed as a single regex, while it could also be an array of regexes. This led to false positives and potentially unreported use of the `e` modifier when an array of regexes was passed. [#300](https://github.com/PHPCompatibility/PHPCompatibility/pull/300)
|
957 |
+
- :bug: The `PregReplaceEModifier` sniff could misidentify the regex delimiter when the regex to be examined was concatenated together from various text strings taken from a compound parameter leading to false positives. [#300](https://github.com/PHPCompatibility/PHPCompatibility/pull/300)
|
958 |
+
- :white_check_mark: Compatibility with PHPCS 2.7.x. Deal with changed behaviour of the upstream PHP tokenizer and utility function(s). [#313](https://github.com/PHPCompatibility/PHPCompatibility/pull/313), [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323), [#326](https://github.com/PHPCompatibility/PHPCompatibility/pull/326), [#340](https://github.com/PHPCompatibility/PHPCompatibility/pull/340)
|
959 |
|
960 |
### Credits
|
961 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
966 |
See all related issues and PRs in the [7.1.1 milestone].
|
967 |
|
968 |
### Added
|
969 |
+
- :star: `ForbiddenNamesAsDeclared` sniff: detection of the PHP 7.1 `iterable` and `void` reserved keywords when used to name classes, interfaces or traits. [#298](https://github.com/PHPCompatibility/PHPCompatibility/pull/298)
|
970 |
|
971 |
### Fixed
|
972 |
+
- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would incorrectly throw an error if the `clone` keyword was used with parenthesis. [#299](https://github.com/PHPCompatibility/PHPCompatibility/pull/299). Fixes [#284](https://github.com/PHPCompatibility/PHPCompatibility/issues/284)
|
973 |
|
974 |
### Credits
|
975 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
980 |
See all related issues and PRs in the [7.1.0 milestone].
|
981 |
|
982 |
### Added
|
983 |
+
- :star: New `stringToErrorCode()`, `arrayKeysToLowercase()` and `addMessage()` utility methods to the `PHPCompatibility_Sniff` class. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291).
|
984 |
|
985 |
### Changed
|
986 |
+
- :pushpin: All sniff error messages now have modular error codes allowing for selectively disabling individual checks - and even selectively disabling individual sniff for specific files - without disabling the complete sniff. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291)
|
987 |
+
- :pencil2: Minor changes to some of the error message texts for consistency across sniffs. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291)
|
988 |
+
- :recycle: Refactored the complex version sniffs to reduce code duplication. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291)
|
989 |
+
- :recycle: Miscellaneous other refactoring for improved performance and sniff accuracy. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291)
|
990 |
+
- :umbrella: The unit tests for the `RemovedExtensions` sniff now verify that the correct alternative extension is being suggested. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291)
|
991 |
|
992 |
### Credits
|
993 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
998 |
See all related issues and PRs in the [7.0.8 milestone].
|
999 |
|
1000 |
### Added
|
1001 |
+
- :star2: New `ForbiddenNamesAsDeclared` sniff: detection of the [other reserved keywords](http://php.net/manual/en/reserved.other-reserved-words.php) which are reserved as of PHP 7.0 (or higher). [#287](https://github.com/PHPCompatibility/PHPCompatibility/pull/287). Fixes [#115](https://github.com/PHPCompatibility/PHPCompatibility/issues/115).
|
1002 |
These were previously sniffed for by the `ForbiddenNames` and `ForbiddenNamesAsInvokedFunctions` sniffs causing false positives as the rules for their reservation are different from the rules for "normal" [reserved keywords](http://php.net/manual/en/reserved.keywords.php).
|
1003 |
+
- :star: New `inUseScope()` utility method to the `PHPCompatibility_Sniff` class which handles PHPCS cross-version compatibility when determining the scope of a `use` statement. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271).
|
1004 |
+
- :umbrella: More unit tests for the `ForbiddenNames` sniff. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271).
|
1005 |
|
1006 |
### Changed
|
1007 |
+
- :pushpin: _Deprecated_ functionality should throw a `warning`. _Removed_ or otherwise unavailable functionality should throw an `error`. This distinction was previously not consistently applied everywhere. [#286](https://github.com/PHPCompatibility/PHPCompatibility/pull/286)
|
1008 |
This change affects the following sniffs:
|
1009 |
* `DeprecatedPHP4StyleConstructors` will now throw a `warning` instead of an `error` for deprecated PHP4 style class constructors.
|
1010 |
* `ForbiddenCallTimePassByReference` will now throw a `warning` if the `testVersion` is `5.3` and an `error` if the `testVersion` if `5.4` or higher.
|
1011 |
* `MbstringReplaceEModifier` will now throw a `warning` instead of an `error` for usage of the deprecated `e` modifier.
|
1012 |
+
* `PregReplaceEModifier` will now throw a `warning` if the `testVersion` is `5.5` or `5.6` and an `error` if the `testVersion` if `7.0` or higher. Fixes [#290](https://github.com/PHPCompatibility/PHPCompatibility/issues/290).
|
1013 |
* `TernaryOperators` will now throw an `error` when the `testVersion` < `5.3` and the middle part has been omitted.
|
1014 |
* `ValidIntegers` will now throw a `warning` when an invalid binary integer is detected.
|
1015 |
+
- :pencil2: `DeprecatedFunctions` and `DeprecatedIniDirectives` sniffs: minor change in the sniff error message text. Use _"removed"_ rather than the ominous _"forbidden"_. [#285](https://github.com/PHPCompatibility/PHPCompatibility/pull/285)
|
1016 |
Also updated relevant internal variable names and documentation to match.
|
1017 |
|
1018 |
### Fixed
|
1019 |
+
- :bug: `ForbiddenNames` sniff would throw false positives for `use` statements which changed the visibility of methods in traits. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271).
|
1020 |
+
- :bug: `ForbiddenNames` sniff would not report reserved keywords when used in combination with `use function` or `use const`. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271).
|
1021 |
+
- :bug: `ForbiddenNames` sniff would potentially - unintentionally - skip over tokens, thereby - potentially - not reporting all errors. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271).
|
1022 |
+
- :wrench: Composer config: `prefer-stable` should be a root element of the json file. Fixes [#277](https://github.com/PHPCompatibility/PHPCompatibility/issues/277).
|
1023 |
|
1024 |
### Credits
|
1025 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
1030 |
See all related issues and PRs in the [7.0.7 milestone].
|
1031 |
|
1032 |
### Added
|
1033 |
+
- :star2: New `ForbiddenBreakContinueOutsideLoop` sniff: verify that `break`/`continue` is not used outside of a loop structure. This will cause fatal errors since PHP 7.0. [#278](https://github.com/PHPCompatibility/PHPCompatibility/pull/278). Fixes [#275](https://github.com/PHPCompatibility/PHPCompatibility/issues/275)
|
1034 |
+
- :star2: New `NewConstVisibility` sniff: detect visibility indicators for `class` and `interface` constants as introduced in PHP 7.1. [#280](https://github.com/PHPCompatibility/PHPCompatibility/pull/280). Fixes [#249](https://github.com/PHPCompatibility/PHPCompatibility/issues/249)
|
1035 |
+
- :star2: New `NewHashAlgorithms` sniff to check used hash algorithms against the PHP version in which they were introduced. [#242](https://github.com/PHPCompatibility/PHPCompatibility/pull/242)
|
1036 |
+
- :star2: New `NewMultiCatch` sniff: detect catch statements catching multiple Exceptions as introduced in PHP 7.1. [#281](https://github.com/PHPCompatibility/PHPCompatibility/pull/281). Fixes [#251](https://github.com/PHPCompatibility/PHPCompatibility/issues/251)
|
1037 |
+
- :star2: New `NewNullableTypes` sniff: detect nullable parameter and return type hints (only supported in PHPCS >= 2.3.4) as introduced in PHP 7.1. [#282](https://github.com/PHPCompatibility/PHPCompatibility/pull/282). Fixes [#247](https://github.com/PHPCompatibility/PHPCompatibility/issues/247)
|
1038 |
+
- :star: `DeprecatedIniDirectives` sniff: recognize PHP 7.1 removed `session` ini directives. [#256](https://github.com/PHPCompatibility/PHPCompatibility/pull/256)
|
1039 |
+
- :star: `NewFunctions` sniff: recognize new `socket_export_stream()` function as introduced in PHP 7.0.7. [#264](https://github.com/PHPCompatibility/PHPCompatibility/pull/264)
|
1040 |
+
- :star: `NewFunctions` sniff: recognize new `curl_...()`, `is_iterable()`, `pcntl_async_signals()`, `session_create_id()`, `session_gc()` functions as introduced in PHP 7.1. [#273](https://github.com/PHPCompatibility/PHPCompatibility/pull/273)
|
1041 |
+
- :star: `NewFunctionParameters` sniff: recognize new OpenSSL function parameters as introduced in PHP 7.1. [#258](https://github.com/PHPCompatibility/PHPCompatibility/pull/258)
|
1042 |
+
- :star: `NewIniDirectives` sniff: recognize new `session` ini directives as introduced in PHP 7.1. [#259](https://github.com/PHPCompatibility/PHPCompatibility/pull/259)
|
1043 |
+
- :star: `NewScalarReturnTypeDeclarations` sniff: recognize PHP 7.1 `void` return type hint. [#250](https://github.com/PHPCompatibility/PHPCompatibility/pull/250)
|
1044 |
+
- :star: `NewScalarTypeDeclarations` sniff: recognize PHP 7.1 `iterable` type hint. [#255](https://github.com/PHPCompatibility/PHPCompatibility/pull/255)
|
1045 |
+
- :star: Recognize the PHP 7.1 deprecated `mcrypt` functionality in the `RemovedExtensions`, `DeprecatedFunctions` and `DeprecatedIniDirectives` sniffs. [#257](https://github.com/PHPCompatibility/PHPCompatibility/pull/257)
|
1046 |
|
1047 |
### Changed
|
1048 |
+
- :pushpin: `LongArrays` sniff used to only throw `warning`s. It will now throw `error`s for PHP versions in which the long superglobals have been removed. [#270](https://github.com/PHPCompatibility/PHPCompatibility/pull/270)
|
1049 |
+
- :pushpin: The `NewIniDirectives` sniff used to always throw an `warning`. Now it will throw an `error` when a new ini directive is used in combination with `ini_set()`. [#246](https://github.com/PHPCompatibility/PHPCompatibility/pull/246).
|
1050 |
+
- :pushpin: `RemovedHashAlgorithms` sniff: also recognize removed algorithms when used with the PHP 5.5+ `hash_pbkdf2()` function. [#240](https://github.com/PHPCompatibility/PHPCompatibility/pull/240)
|
1051 |
+
- :pushpin: Properly recognize nullable type hints in the `getMethodParameters()` utility method. [#282](https://github.com/PHPCompatibility/PHPCompatibility/pull/282)
|
1052 |
+
- :pencil2: `DeprecatedPHP4StyleConstructors` sniff: minor error message text fix. [#236](https://github.com/PHPCompatibility/PHPCompatibility/pull/236)
|
1053 |
+
- :pencil2: `NewIniDirectives` sniff: improved precision for the introduction version numbers being reported. [#246](https://github.com/PHPCompatibility/PHPCompatibility/pull/246)
|
1054 |
+
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#238](https://github.com/PHPCompatibility/PHPCompatibility/pull/238), [#244](https://github.com/PHPCompatibility/PHPCompatibility/pull/244), [#240](https://github.com/PHPCompatibility/PHPCompatibility/pull/240), [#276](https://github.com/PHPCompatibility/PHPCompatibility/pull/276)
|
1055 |
+
- :umbrella: Re-activate the unit tests for the `NewScalarReturnTypeDeclarations` sniff. [#250](https://github.com/PHPCompatibility/PHPCompatibility/pull/250)
|
1056 |
|
1057 |
### Fixed
|
1058 |
+
- :bug: The `DeprecatedPHP4StyleConstructors` sniff would not report errors when the case of the class name and the PHP4 constructor function name did not match. [#236](https://github.com/PHPCompatibility/PHPCompatibility/pull/236)
|
1059 |
+
- :bug: `LongArrays` sniff would report false positives for class properties shadowing removed PHP superglobals. [#270](https://github.com/PHPCompatibility/PHPCompatibility/pull/270). Fixes [#268](https://github.com/PHPCompatibility/PHPCompatibility/issues/268).
|
1060 |
+
- :bug: The `NewClasses` sniff would not report errors when the case of the class name used and "official" class name did not match. [#237](https://github.com/PHPCompatibility/PHPCompatibility/pull/237)
|
1061 |
+
- :bug: The `NewIniDirectives` sniff would report violations against the PHP version in which the ini directive was introduced. This should be the version below it. [#246](https://github.com/PHPCompatibility/PHPCompatibility/pull/246)
|
1062 |
+
- :bug: `PregReplaceEModifier` sniff would report false positives for compound regex parameters with different quote types. [#266](https://github.com/PHPCompatibility/PHPCompatibility/pull/266). Fixes [#265](https://github.com/PHPCompatibility/PHPCompatibility/issues/265).
|
1063 |
+
- :bug: `RemovedGlobalVariables` sniff would report false positives for lowercase/mixed cased variables shadowing superglobals. [#245](https://github.com/PHPCompatibility/PHPCompatibility/pull/245).
|
1064 |
+
- :bug: The `RemovedHashAlgorithms` sniff would not report errors when the case of the hash function name used and "official" class name did not match. [#240](https://github.com/PHPCompatibility/PHPCompatibility/pull/240)
|
1065 |
+
- :bug: The `ShortArray` sniff would report all violations on the line of the PHP open tag, not on the lines of the short array open/close tags. [#238](https://github.com/PHPCompatibility/PHPCompatibility/pull/238)
|
1066 |
|
1067 |
### Credits
|
1068 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
1073 |
See all related issues and PRs in the [7.0.6 milestone].
|
1074 |
|
1075 |
### Added
|
1076 |
+
- :star: New `stripQuotes()` utility method in the `PHPCompatibility_Sniff` base class to strip quotes which surround text strings in a consistent manner. [#224](https://github.com/PHPCompatibility/PHPCompatibility/pull/224)
|
1077 |
+
- :books: Readme: Add _PHP Version Support_ section. [#225](https://github.com/PHPCompatibility/PHPCompatibility/pull/225)
|
1078 |
|
1079 |
### Changed
|
1080 |
+
- :pushpin: The `ForbiddenCallTimePassByReference` sniff will now also report the deprecation as of PHP 5.3, not just its removal as of PHP 5.4. [#203](https://github.com/PHPCompatibility/PHPCompatibility/pull/203)
|
1081 |
+
- :pushpin: The `NewFunctionArrayDereferencing` sniff will now also check _method_ calls for array dereferencing, not just function calls. [#229](https://github.com/PHPCompatibility/PHPCompatibility/pull/229). Fixes [#227](https://github.com/PHPCompatibility/PHPCompatibility/issues/227).
|
1082 |
+
- :pencil2: The `NewExecutionDirectives` sniff will now throw `warning`s instead of `error`s for invalid values encountered in execution directives. [#223](https://github.com/PHPCompatibility/PHPCompatibility/pull/223)
|
1083 |
+
- :pencil2: Minor miscellaneous fixes. [#231](https://github.com/PHPCompatibility/PHPCompatibility/pull/231)
|
1084 |
+
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#219](https://github.com/PHPCompatibility/PHPCompatibility/pull/219), [#203](https://github.com/PHPCompatibility/PHPCompatibility/pull/203)
|
1085 |
+
- :recycle: Defer to upstream `findImplementedInterfaceNames()` utility method when it exists. [#222](https://github.com/PHPCompatibility/PHPCompatibility/pull/222)
|
1086 |
+
- :wrench: Exclude the test files from analysis by Scrutinizer CI. [#230](https://github.com/PHPCompatibility/PHPCompatibility/pull/230)
|
1087 |
|
1088 |
### Removed
|
1089 |
+
- :no_entry_sign: Some redundant code. [#232](https://github.com/PHPCompatibility/PHPCompatibility/pull/232)
|
1090 |
|
1091 |
### Fixed
|
1092 |
+
- :bug: The `EmptyNonVariable` sniff would throw false positives for variable variables and for array access with a (partially) variable array index. [#212](https://github.com/PHPCompatibility/PHPCompatibility/pull/212). Fixes [#210](https://github.com/PHPCompatibility/PHPCompatibility/issues/210).
|
1093 |
+
- :bug: The `NewFunctionArrayDereferencing` sniff would throw false positives for lines of code containing both a function call as well as square brackets, even when they were unrelated. [#228](https://github.com/PHPCompatibility/PHPCompatibility/pull/228). Fixes [#226](https://github.com/PHPCompatibility/PHPCompatibility/issues/226).
|
1094 |
+
- :bug: `ParameterShadowSuperGlobals` sniff would report false positives for lowercase/mixed cased variables shadowing superglobals. [#218](https://github.com/PHPCompatibility/PHPCompatibility/pull/218). Fixes [#214](https://github.com/PHPCompatibility/PHPCompatibility/issues/214).
|
1095 |
+
- :bug: The `determineNamespace()` utility method now accounts properly for namespaces within scoped `declare()` statements. [#221](https://github.com/PHPCompatibility/PHPCompatibility/pull/221)
|
1096 |
+
- :books: Readme: Logo alignment in the Credits section. [#233](https://github.com/PHPCompatibility/PHPCompatibility/pull/233)
|
1097 |
|
1098 |
### Credits
|
1099 |
Thanks go out to [Jason Stallings], [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap:
|
1104 |
See all related issues and PRs in the [7.0.5 milestone].
|
1105 |
|
1106 |
### Added
|
1107 |
+
- :star2: New `MbstringReplaceEModifier` sniff to detect the use of the PHP 7.1 deprecated `e` modifier in Mbstring regex functions. [#202](https://github.com/PHPCompatibility/PHPCompatibility/pull/202)
|
1108 |
+
- :star: The `ForbiddenBreakContinueVariableArguments` sniff will now also report on `break 0`/`continue 0` which is not allowed since PHP 5.4. [#209](https://github.com/PHPCompatibility/PHPCompatibility/pull/209)
|
1109 |
+
- :star: New `getFunctionCallParameters()`, `getFunctionCallParameter()` utility methods in the `PHPCompatibility_Sniff` base class. [#170](https://github.com/PHPCompatibility/PHPCompatibility/pull/170)
|
1110 |
+
- :star: New `tokenHasScope()` utility method in the `PHPCompatibility_Sniff` base class. [#189](https://github.com/PHPCompatibility/PHPCompatibility/pull/189)
|
1111 |
+
- :umbrella: Unit test for `goto` and `callable` detection and some other miscellanous extra unit tests for the `NewKeywords` sniff. [#189](https://github.com/PHPCompatibility/PHPCompatibility/pull/189)
|
1112 |
+
- :books: Readme: Information for sniff developers about running unit tests for _other_ sniff libraries using the PHPCS native test framework without running into conflicts with the PHPCompatibility specific unit test framework. [#217](https://github.com/PHPCompatibility/PHPCompatibility/pull/217)
|
1113 |
|
1114 |
### Changed
|
1115 |
+
- :pushpin: The `ForbiddenNames` sniff will now also check interface declarations for usage of reserved keywords. [#200](https://github.com/PHPCompatibility/PHPCompatibility/pull/200)
|
1116 |
+
- :pushpin: `PregReplaceEModifier` sniff: improved handling of regexes build up of a combination of variables, function calls and/or text strings. [#201](https://github.com/PHPCompatibility/PHPCompatibility/pull/201)
|
1117 |
+
- :rewind: The `NewKeywords` sniff will now also correctly recognize new keywords when used in combination with older PHPCS versions and/or run on older PHP versions. [#189](https://github.com/PHPCompatibility/PHPCompatibility/pull/189)
|
1118 |
+
- :pencil2: `PregReplaceEModifier` sniff: minor improvement to the error message text. [#201](https://github.com/PHPCompatibility/PHPCompatibility/pull/201)
|
1119 |
+
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#170](https://github.com/PHPCompatibility/PHPCompatibility/pull/170), [#188](https://github.com/PHPCompatibility/PHPCompatibility/pull/188), [#189](https://github.com/PHPCompatibility/PHPCompatibility/pull/189), [#199](https://github.com/PHPCompatibility/PHPCompatibility/pull/199), [#200](https://github.com/PHPCompatibility/PHPCompatibility/pull/200), [#201](https://github.com/PHPCompatibility/PHPCompatibility/pull/201), [#208](https://github.com/PHPCompatibility/PHPCompatibility/pull/208)
|
1120 |
+
- :wrench: The unit tests for the utility methods have been moved to their own subdirectory within `Tests`. [#215](https://github.com/PHPCompatibility/PHPCompatibility/pull/215)
|
1121 |
+
- :green_heart: The sniffs are now also tested against PHP 7.1 for consistent results. [#216](https://github.com/PHPCompatibility/PHPCompatibility/pull/216)
|
1122 |
|
1123 |
### Removed
|
1124 |
+
- :no_entry_sign: Some redundant code. [26d0b6](https://github.com/PHPCompatibility/PHPCompatibility/commit/26d0b6cf0921f75d93a4faaf09c390f386dde9ff) and [841616](https://github.com/PHPCompatibility/PHPCompatibility/commit/8416162ea81f4067226324f5948f4a50f7958a9b)
|
1125 |
|
1126 |
### Fixed
|
1127 |
+
- :bug: `ConstantArraysUsingDefine` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#199](https://github.com/PHPCompatibility/PHPCompatibility/pull/199)
|
1128 |
+
- :bug: The `DeprecatedIniDirectives` and `NewIniDirectives` sniffs could potentially trigger on the ini value instead of the ini directive name. [#170](https://github.com/PHPCompatibility/PHPCompatibility/pull/170)
|
1129 |
+
- :bug: `ForbiddenNames` sniff: Reserved keywords when used as the name of a constant declared using `define()` would always be reported independently of the `testVersion` set. [#200](https://github.com/PHPCompatibility/PHPCompatibility/pull/200)
|
1130 |
+
- :bug: `PregReplaceEModifier` sniff would not report errors when the function name used was not in lowercase. [#201](https://github.com/PHPCompatibility/PHPCompatibility/pull/201)
|
1131 |
+
- :bug: `TernaryOperators` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#188](https://github.com/PHPCompatibility/PHPCompatibility/pull/188)
|
1132 |
+
- :bug: The `getFQClassNameFromNewToken()` and `getFQClassNameFromDoubleColonToken()` utility methods would get confused when the class name was a variable instead of being hard-coded, resulting in a PHP warning being thown. [#206](https://github.com/PHPCompatibility/PHPCompatibility/pull/206). Fixes [#205](https://github.com/PHPCompatibility/PHPCompatibility/issues/205).
|
1133 |
+
- :bug: The `getFunctionCallParameters()` utility method would incorrectly identify an extra parameter if the last parameter passed to a function would have an - unnecessary - comma after it. The `getFunctionCallParameters()` utility method also did not handle parameters passed as short arrays correctly. [#213](https://github.com/PHPCompatibility/PHPCompatibility/pull/213). Fixes [#211](https://github.com/PHPCompatibility/PHPCompatibility/issues/211).
|
1134 |
+
- :umbrella: Unit tests for the `NewFunctionArrayDereferencing` sniff were not being run due to a naming error. [#208](https://github.com/PHPCompatibility/PHPCompatibility/pull/208)
|
1135 |
+
- :books: Readme: Information about setting the `testVersion` from a custom ruleset was incorrect. [#204](https://github.com/PHPCompatibility/PHPCompatibility/pull/204)
|
1136 |
+
- :wrench: Path to PHPCS in the unit tests breaking for non-Composer installs. [#198](https://github.com/PHPCompatibility/PHPCompatibility/pull/198)
|
1137 |
|
1138 |
### Credits
|
1139 |
Thanks go out to [Juliette Reinders Folmer] and [Yoshiaki Yoshida] for their contributions to this version. :clap:
|
1144 |
See all related issues and PRs in the [7.0.4 milestone].
|
1145 |
|
1146 |
### Added
|
1147 |
+
- :star2: New `EmptyNonVariable` sniff: detection of empty being used on non-variables for PHP < 5.5. [#187](https://github.com/PHPCompatibility/PHPCompatibility/pull/187)
|
1148 |
+
- :star2: New `NewMagicMethods` sniff: detection of declaration of magic methods before the method became "magic". Includes a check for the changed behaviour for the `__toString()` magic method in PHP 5.2. [#176](https://github.com/PHPCompatibility/PHPCompatibility/pull/176). Fixes [#64](https://github.com/PHPCompatibility/PHPCompatibility/issues/64).
|
1149 |
+
- :star2: New `RemovedAlternativePHPTags` sniff: detection of ASP and script open tags for which support was removed in PHP 7.0. [#184](https://github.com/PHPCompatibility/PHPCompatibility/pull/184), [#193](https://github.com/PHPCompatibility/PHPCompatibility/pull/193). Fixes [#127](https://github.com/PHPCompatibility/PHPCompatibility/issues/127).
|
1150 |
- :star: `NonStaticMagicMethods` sniff: detection of the `__callStatic()`, `__sleep()`, `__toString()` and `__set_state()` magic methods.
|
1151 |
+
- :green_heart: Lint all non-test case files for syntax errors during the build testing by Travis. [#192](https://github.com/PHPCompatibility/PHPCompatibility/pull/192)
|
1152 |
|
1153 |
### Changed
|
1154 |
+
- :pushpin: `NonStaticMagicMethods` sniff: will now also sniff `trait`s for magic methods. [#174](https://github.com/PHPCompatibility/PHPCompatibility/pull/174)
|
1155 |
+
- :pushpin: `NonStaticMagicMethods` sniff: will now also check for magic methods which should be declared as `static`. [#174](https://github.com/PHPCompatibility/PHPCompatibility/pull/174)
|
1156 |
+
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#178](https://github.com/PHPCompatibility/PHPCompatibility/pull/178), [#179](https://github.com/PHPCompatibility/PHPCompatibility/pull/179), [#174](https://github.com/PHPCompatibility/PHPCompatibility/pull/174), [#171](https://github.com/PHPCompatibility/PHPCompatibility/pull/171)
|
1157 |
+
- :recycle: The unit test suite now internally caches PHPCS run results in combination with a set `testVersion` to speed up the running of the unit tests. These are now ~3 x faster. [#148](https://github.com/PHPCompatibility/PHPCompatibility/pull/148)
|
1158 |
- :books: Readme: Minor clarification of the minimum requirements.
|
1159 |
- :books: Readme: Advise to use the latest stable version of this repository.
|
1160 |
+
- :wrench: The unit tests can now be run with PHPCS installed in an arbitrary location by passing the location through an environment option. [#191](https://github.com/PHPCompatibility/PHPCompatibility/pull/191).
|
1161 |
+
- :wrench: Improved coveralls configuration and compatibility. [#194](https://github.com/PHPCompatibility/PHPCompatibility/pull/194)
|
1162 |
+
- :green_heart: The sniffs are now also tested against PHP 5.2 for consistent results. Except for namespace, trait and group use related errors, most sniffs work as intended on PHP 5.2. [#196](https://github.com/PHPCompatibility/PHPCompatibility/pull/196)
|
1163 |
|
1164 |
### Fixed
|
1165 |
+
- :bug: The `ForbiddenBreakContinueVariableArguments` sniff would not report on `break`/`continue` with a closure as an argument. [#171](https://github.com/PHPCompatibility/PHPCompatibility/pull/171)
|
1166 |
+
- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would not report on reserved keywords which were not lowercase. [#186](https://github.com/PHPCompatibility/PHPCompatibility/pull/186)
|
1167 |
+
- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would not report on the `goto` and `namespace` keywords when run on PHP 5.2. [#193](https://github.com/PHPCompatibility/PHPCompatibility/pull/193)
|
1168 |
+
- :bug: `NewAnonymousClasses` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#195](https://github.com/PHPCompatibility/PHPCompatibility/pull/195).
|
1169 |
+
- :bug: `NewGroupUseDeclarations` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#190](https://github.com/PHPCompatibility/PHPCompatibility/pull/190).
|
1170 |
+
- :bug: The `NonStaticMagicMethods` sniff would not report on magic methods when the function name as declared was not in the same case as used in the PHP manual. [#174](https://github.com/PHPCompatibility/PHPCompatibility/pull/174)
|
1171 |
+
- :wrench: The unit tests would exit with `0` if PHPCS could not be found. [#191](https://github.com/PHPCompatibility/PHPCompatibility/pull/191)
|
1172 |
+
- :green_heart: The PHPCompatibility library itself was not fully compatible with PHP 5.2. [#193](https://github.com/PHPCompatibility/PHPCompatibility/pull/193)
|
1173 |
|
1174 |
### Credits
|
1175 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
1180 |
See all related issues and PRs in the [7.0.3 milestone].
|
1181 |
|
1182 |
### Added
|
1183 |
+
- :star2: New `InternalInterfaces` sniff: detection of internal PHP interfaces being which should not be implemented by user land classes. [#144](https://github.com/PHPCompatibility/PHPCompatibility/pull/144)
|
1184 |
+
- :star2: New `LateStaticBinding` sniff: detection of PHP 5.3 late static binding. [#177](https://github.com/PHPCompatibility/PHPCompatibility/pull/177)
|
1185 |
+
- :star2: New `NewExecutionDirectives` sniff: verify execution directives set with `declare()`. [#169](https://github.com/PHPCompatibility/PHPCompatibility/pull/169)
|
1186 |
+
- :star2: New `NewInterfaces` sniff: detection of the use of newly introduced PHP native interfaces. This sniff will also detect unsupported methods when a class implements the `Serializable` interface. [#144](https://github.com/PHPCompatibility/PHPCompatibility/pull/144)
|
1187 |
+
- :star2: New `RequiredOptionalFunctionParameters` sniff: detection of missing function parameters which were required in earlier PHP versions only to become optional in later versions. [#165](https://github.com/PHPCompatibility/PHPCompatibility/pull/165)
|
1188 |
+
- :star2: New `ValidIntegers` sniff: detection of binary integers for PHP < 5.4, detection of hexademical numeric strings for which recognition as hex integers was removed in PHP 7.0, detection of invalid binary and octal integers. [#160](https://github.com/PHPCompatibility/PHPCompatibility/pull/160). Fixes [#55](https://github.com/PHPCompatibility/PHPCompatibility/issues/55).
|
1189 |
+
- :star: `DeprecatedExtensions` sniff: detect removal of the `ereg` extension in PHP 7. [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149)
|
1190 |
+
- :star: `DeprecatedFunctions` sniff: detection of the PHP 5.0.5 deprecated `php_check_syntax()` and PHP 5.4 deprecated `mysqli_get_cache_stats()` functions. [#155](https://github.com/PHPCompatibility/PHPCompatibility/pull/155).
|
1191 |
+
- :star: `DeprecatedFunctions` sniff: detect deprecation of a number of the `mysqli` functions in PHP 5.3. [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149)
|
1192 |
+
- :star: `DeprecatedFunctions` sniff: detect removal of the `call_user_method()`, `ldap_sort()`, `ereg_*()` and `mysql_*()` functions in PHP 7.0. [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149)
|
1193 |
+
- :star: `DeprecatedIniDirectives` sniff: detection of a _lot_ more deprecated/removed ini directives. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146)
|
1194 |
+
- :star: `NewFunctionParameters` sniff: detection of a _lot_ more new function parameters. [#164](https://github.com/PHPCompatibility/PHPCompatibility/pull/164)
|
1195 |
+
- :star: `NewFunctions` sniff: detection of numerous extra new functions. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/161)
|
1196 |
+
- :star: `NewIniDirectives` sniff: detection of a _lot_ more new ini directives. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146)
|
1197 |
+
- :star: `NewLanguageConstructs` sniff: detection of the PHP 5.6 ellipsis `...` construct. [#175](https://github.com/PHPCompatibility/PHPCompatibility/pull/175)
|
1198 |
+
- :star: `NewScalarTypeDeclarations` sniff: detection of PHP 5.1 `array` and PHP 5.4 `callable` type hints. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168)
|
1199 |
+
- :star: `RemovedFunctionParameters` sniff: detection of a few extra removed function parameters. [#163](https://github.com/PHPCompatibility/PHPCompatibility/pull/163)
|
1200 |
+
- :star: Detection of functions and methods with a double underscore prefix as these are reserved by PHP for future use. The existing upstream `Generic.NamingConventions.CamelCapsFunctionName` sniff is re-used for this with some customization. [#173](https://github.com/PHPCompatibility/PHPCompatibility/pull/173)
|
1201 |
+
- :star: New `getFQClassNameFromNewToken()`, `getFQExtendedClassName()`, `getFQClassNameFromDoubleColonToken()`, `getFQName()`, `isNamespaced()`, `determineNamespace()` and `getDeclaredNamespaceName()` utility methods in the `PHPCompatibility_Sniff` base class for namespace determination. [#162](https://github.com/PHPCompatibility/PHPCompatibility/pull/162)
|
1202 |
+
- :recycle: New `inClassScope()` utility method in the `PHPCompatibility_Sniff` base class. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168)
|
1203 |
+
- :recycle: New `doesFunctionCallHaveParameters()` and `getFunctionCallParameterCount()` utility methods in the `PHPCompatibility_Sniff` base class. [#153](https://github.com/PHPCompatibility/PHPCompatibility/pull/153)
|
1204 |
- :umbrella: Unit test for `__halt_compiler()` detection by the `NewKeywords` sniff.
|
1205 |
+
- :umbrella: Unit tests for the `NewFunctions` sniff. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/161)
|
1206 |
+
- :umbrella: Unit tests for the `ParameterShadowSuperGlobals` sniff. [#180](https://github.com/PHPCompatibility/PHPCompatibility/pull/180)
|
1207 |
+
- :wrench: Minimal config for Scrutinizer CI. [#145](https://github.com/PHPCompatibility/PHPCompatibility/pull/145).
|
1208 |
|
1209 |
### Changed
|
1210 |
+
- :pushpin: The `DeprecatedIniDirectives` and the `NewIniDirectives` sniffs will now indicate an alternative ini directive in case the directive has been renamed. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146)
|
1211 |
+
- :pushpin: The `NewClasses` sniff will now also report on new classes being extended by child classes. [#140](https://github.com/PHPCompatibility/PHPCompatibility/pull/140).
|
1212 |
+
- :pushpin: The `NewClasses` sniff will now also report on static use of new classes. [#162](https://github.com/PHPCompatibility/PHPCompatibility/pull/162).
|
1213 |
+
- :pushpin: The `NewScalarTypeDeclarations` sniff will now throw an error on use of type hints pre-PHP 5.0. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168)
|
1214 |
+
- :pushpin: The `NewScalarTypeDeclarations` sniff will now verify type hints used against typical mistakes. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168)
|
1215 |
+
- :pushpin: The `ParameterShadowSuperGlobals` sniff will now do a case-insensitive variable name compare. [#180](https://github.com/PHPCompatibility/PHPCompatibility/pull/180)
|
1216 |
+
- :pushpin: The `RemovedFunctionParameters` sniff will now also report `warning`s on deprecation of function parameters. [#163](https://github.com/PHPCompatibility/PHPCompatibility/pull/163)
|
1217 |
+
- :twisted_rightwards_arrows: The check for `JsonSerializable` has been moved from the `NewClasses` sniff to the `NewInterfaces` sniff. [#162](https://github.com/PHPCompatibility/PHPCompatibility/pull/162)
|
1218 |
+
- :rewind: The `NewLanguageConstructs` sniff will now also recognize new language constructs when used in combination with PHPCS 1.5.x. [#175](https://github.com/PHPCompatibility/PHPCompatibility/pull/175)
|
1219 |
+
- :pencil2: `NewFunctionParameters` sniff: use correct name for the new parameter for the `dirname()` function. [#164](https://github.com/PHPCompatibility/PHPCompatibility/pull/164)
|
1220 |
+
- :pencil2: `NewScalarTypeDeclarations` sniff: minor change in the sniff error message text. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168)
|
1221 |
+
- :pencil2: `RemovedFunctionParameters` sniff: minor change in the sniff error message text. [#163](https://github.com/PHPCompatibility/PHPCompatibility/pull/163)
|
1222 |
+
- :pencil2: The `ParameterShadowSuperGlobals` sniff now extends the `PHPCompatibility_Sniff` class. [#180](https://github.com/PHPCompatibility/PHPCompatibility/pull/180)
|
1223 |
+
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#181](https://github.com/PHPCompatibility/PHPCompatibility/pull/181), [#182](https://github.com/PHPCompatibility/PHPCompatibility/pull/182), [#166](https://github.com/PHPCompatibility/PHPCompatibility/pull/166), [#167](https://github.com/PHPCompatibility/PHPCompatibility/pull/167), [#172](https://github.com/PHPCompatibility/PHPCompatibility/pull/172), [#180](https://github.com/PHPCompatibility/PHPCompatibility/pull/180), [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146), [#138](https://github.com/PHPCompatibility/PHPCompatibility/pull/138)
|
1224 |
+
- :recycle: Various refactoring to remove code duplication in the unit tests and add proper test skip notifications where relevant. [#139](https://github.com/PHPCompatibility/PHPCompatibility/pull/139), [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149)
|
1225 |
|
1226 |
### Fixed
|
1227 |
+
- :bug: The `DeprecatedFunctions` sniff was reporting an incorrect deprecation/removal version number for a few functions. [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149)
|
1228 |
+
- :bug: The `DeprecatedIniDirectives` sniff was in select cases reporting deprecation of an ini directive prior to removal, while the ini directive was never deprecated prior to its removal. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146)
|
1229 |
+
- :bug: The `DeprecatedPHP4StyleConstructors` sniff would cause false positives for methods with the same name as the class in namespaced classes. [#167](https://github.com/PHPCompatibility/PHPCompatibility/pull/167)
|
1230 |
+
- :bug: The `ForbiddenEmptyListAssignment` sniff did not report errors when there were only comments or parentheses between the list parentheses. [#166](https://github.com/PHPCompatibility/PHPCompatibility/pull/166)
|
1231 |
+
- :bug: The `ForbiddenEmptyListAssignment` sniff will no longer cause false positives during live coding. [#166](https://github.com/PHPCompatibility/PHPCompatibility/pull/166)
|
1232 |
+
- :bug: The `NewClasses` sniff would potentially misidentify namespaced classes as PHP native classes. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/162)
|
1233 |
+
- :bug: The `NewFunctions` sniff would fail to identify called functions when the function call was not lowercase. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/161)
|
1234 |
+
- :bug: The `NewFunctions` sniff would potentially misidentify namespaced userland functions as new functions. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/161)
|
1235 |
+
- :bug: The `NewIniDirectives` sniff was reporting an incorrect introduction version number for a few ini directives. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146)
|
1236 |
+
- :bug: `NewKeywords` sniff: the use of the `const` keyword should only be reported when used outside of a class for PHP < 5.3. [#147](https://github.com/PHPCompatibility/PHPCompatibility/pull/147). Fixes [#129](https://github.com/PHPCompatibility/PHPCompatibility/issues/129).
|
1237 |
+
- :bug: The `RemovedExtensions` sniff was incorrectly reporting a number of extensions as being removed in PHP 5.3 while they were actually removed in PHP 5.1. [#156](https://github.com/PHPCompatibility/PHPCompatibility/pull/156)
|
1238 |
+
- :bug: :recycle: The `NewFunctionParameters` and `RemovedFunctionParameters` now use the new `doesFunctionCallHaveParameters()` and `getFunctionCallParameterCount()` utility methods for improved accuracy in identifying function parameters. This fixes several false positives. [#153](https://github.com/PHPCompatibility/PHPCompatibility/pull/153) Fixes [#120](https://github.com/PHPCompatibility/PHPCompatibility/issues/120), [#151](https://github.com/PHPCompatibility/PHPCompatibility/issues/151), [#152](https://github.com/PHPCompatibility/PHPCompatibility/issues/152).
|
1239 |
+
- :bug: A number of sniffs would return `false` if the examined construct was not found. This could potentially cause race conditions/infinite sniff loops. [#138](https://github.com/PHPCompatibility/PHPCompatibility/pull/138)
|
1240 |
+
- :wrench: The unit tests would fail to run when used in combination with a PEAR install of PHPCS. [#157](https://github.com/PHPCompatibility/PHPCompatibility/pull/157).
|
1241 |
+
- :green_heart: Unit tests failing against PHPCS 2.6.1. [#158](https://github.com/PHPCompatibility/PHPCompatibility/pull/158)
|
1242 |
The unit tests *will* still fail against PHPCS 2.6.2 due to a bug in PHPCS itself. This bug does not affect the running of the sniffs outside of a unit test context.
|
1243 |
|
1244 |
### Credits
|
1250 |
See all related issues and PRs in the [7.0.2 milestone].
|
1251 |
|
1252 |
### Added
|
1253 |
+
- :star: `RemovedExtensions` sniff: ability to whitelist userland functions for which the function prefix overlaps with a prefix of a deprecated/removed extension. [#130](https://github.com/PHPCompatibility/PHPCompatibility/pull/130). Fixes [#123](https://github.com/PHPCompatibility/PHPCompatibility/issues/123).
|
1254 |
+
To use this feature, add the `functionWhitelist` property in your custom ruleset. For more information, see the [README](https://github.com/PHPCompatibility/PHPCompatibility#phpcompatibility-specific-options).
|
1255 |
|
1256 |
### Changed
|
1257 |
+
- :pencil2: A number of sniffs contained `public` class properties. Within PHPCS, `public` properties can be overruled via a custom ruleset. This was not the intention, so the visibility of these properties has been changed to `protected`. [#135](https://github.com/PHPCompatibility/PHPCompatibility/pull/135)
|
1258 |
- :wrench: Composer config: Stable packages are preferred over unstable/dev.
|
1259 |
+
- :pencil2: Ruleset name. [#134](https://github.com/PHPCompatibility/PHPCompatibility/pull/134)
|
1260 |
|
1261 |
### Credits
|
1262 |
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
|
1267 |
See all related issues and PRs in the [7.0.1 milestone].
|
1268 |
|
1269 |
### Changed
|
1270 |
+
- :pushpin: The `DeprecatedIniDirectives` sniff used to throw an `error` when a deprecated ini directive was used in combination with `ini_get()`. It will now throw a `warning` instead. [#122](https://github.com/PHPCompatibility/PHPCompatibility/pull/122) Fixes [#119](https://github.com/PHPCompatibility/PHPCompatibility/issues/119).
|
1271 |
Usage of deprecated ini directives in combination with `ini_set()` will still throw an `error`.
|
1272 |
+
- :pushpin: The `PregReplaceEModifier` sniff now also detects the `e` modifier when used with the `preg_filter()` function. While this is undocumented, the `e` modifier was supported by the `preg_filter()` function as well. [#128](https://github.com/PHPCompatibility/PHPCompatibility/pull/128)
|
1273 |
+
- :pencil2: The `RemovedExtensions` sniff contained superfluous deprecation information in the error message. [#131](https://github.com/PHPCompatibility/PHPCompatibility/pull/131)
|
1274 |
|
1275 |
### Removed
|
1276 |
+
- :wrench: Duplicate builds from the Travis CI build matrix. [#132](https://github.com/PHPCompatibility/PHPCompatibility/pull/132)
|
1277 |
|
1278 |
### Fixed
|
1279 |
+
- :bug: The `ForbiddenNames` sniff did not allow for the PHP 5.6 `use function ...` and `use const ...` syntax. [#126](https://github.com/PHPCompatibility/PHPCompatibility/pull/126) Fixes [#124](https://github.com/PHPCompatibility/PHPCompatibility/issues/124).
|
1280 |
+
- :bug: The `NewClasses` sniff failed to detect new classes when the class was instantiated without parenthesis, i.e. `new NewClass;`. [#121](https://github.com/PHPCompatibility/PHPCompatibility/pull/121)
|
1281 |
+
- :bug: The `PregReplaceEModifier` sniff failed to detect the `e` modifier when using bracket delimiters for the regex other than the `{}` brackets. [#128](https://github.com/PHPCompatibility/PHPCompatibility/pull/128)
|
1282 |
- :green_heart: Unit tests failing against PHPCS 2.6.1.
|
1283 |
|
1284 |
### Credits
|
1290 |
See all related issues and PRs in the [7.0 milestone].
|
1291 |
|
1292 |
### Added
|
1293 |
+
- :zap: Ability to specify a range of PHP versions against which to test your code base for compatibility, i.e. `--runtime-set testVersion 5.0-5.4` will now test your code for compatibility with PHP 5.0 up to PHP 5.4. [#99](https://github.com/PHPCompatibility/PHPCompatibility/pull/99)
|
1294 |
+
- :star2: New `NewFunctionArrayDereferencing` sniff to detect function array dereferencing as introduced in PHP 5.4. Fixes [#52](https://github.com/PHPCompatibility/PHPCompatibility/issues/52).
|
1295 |
+
- :star2: New `ShortArray` sniff to detect short array syntax as introduced in PHP 5.4. [#97](https://github.com/PHPCompatibility/PHPCompatibility/pull/97). Fixes [#47](https://github.com/PHPCompatibility/PHPCompatibility/issues/47).
|
1296 |
+
- :star2: New `TernaryOperators` sniff to detect ternaries without the middle part (`elvis` operator) as introduced in PHP 5.3. [#101](https://github.com/PHPCompatibility/PHPCompatibility/pull/101), [#103](https://github.com/PHPCompatibility/PHPCompatibility/pull/103). Fixes [#49](https://github.com/PHPCompatibility/PHPCompatibility/issues/49).
|
1297 |
+
- :star2: New `ConstantArraysUsingDefine` sniff to detect constants declared using `define()` being assigned an `array` value which was not allowed prior to PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1298 |
+
- :star2: New `DeprecatedPHP4StyleConstructors` sniff to detect PHP 4 style class constructor methods which are deprecated as of PHP 7. [#109](https://github.com/PHPCompatibility/PHPCompatibility/pull/109).
|
1299 |
+
- :star2: New `ForbiddenEmptyListAssignment` sniff to detect empty list() assignments which have been removed in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1300 |
+
- :star2: New `ForbiddenFunctionParametersWithSameName` sniff to detect functions declared with multiple same-named parameters which is no longer accepted since PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1301 |
+
- :star2: New `ForbiddenGlobalVariableVariable` sniff to detect variable variables being made `global` which is not allowed since PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1302 |
+
- :star2: New `ForbiddenNegativeBitshift` sniff to detect bitwise shifts by negative number which will throw an ArithmeticError in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1303 |
+
- :star2: New `ForbiddenSwitchWithMultipleDefaultBlocks` sniff to detect switch statements with multiple default blocks which is not allowed since PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1304 |
+
- :star2: New `NewAnonymousClasses` sniff to detect anonymous classes as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1305 |
+
- :star2: New `NewClosure` sniff to detect anonymous functions as introduced in PHP 5.3. Fixes [#35](https://github.com/PHPCompatibility/PHPCompatibility/issues/35)
|
1306 |
+
- :star2: New `NewFunctionParameters` sniff to detect use of new parameters in build-in PHP functions. Initially only sniffing for the new PHP 7.0 function parameters and the new PHP 5.3+ `before_needle` parameter for the `strstr()` function. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110), [#112](https://github.com/PHPCompatibility/PHPCompatibility/pull/112). Fixes [#27](https://github.com/PHPCompatibility/PHPCompatibility/issues/27).
|
1307 |
+
- :star2: New `NewGroupUseDeclarations` sniff to detect group use declarations as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1308 |
+
- :star2: New `NewScalarReturnTypeDeclarations` sniff to detect scalar return type hints as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1309 |
+
- :star2: New `NewScalarTypeDeclarations` sniff to detect scalar function parameter type hints as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1310 |
+
- :star2: New `RemovedFunctionParameters` sniff to detect use of removed parameters in build-in PHP functions. Initially only sniffing for the function parameters removed in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1311 |
+
- :star2: New `RemovedGlobalVariables` sniff to detect the PHP 7.0 removed `$HTTP_RAW_POST_DATA` superglobal. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1312 |
+
- :star: `DeprecatedFunctions` sniff: detection of the PHP 5.4 deprecated OCI8 functions. [#93](https://github.com/PHPCompatibility/PHPCompatibility/pull/93)
|
1313 |
+
- :star: `ForbiddenNamesAsInvokedFunctions` sniff: recognize PHP 5.5 `finally` as a reserved keywords when invoked as a function. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1314 |
+
- :star: `NewKeywords` sniff: detection of the use of the PHP 5.1+ `__halt_compiler` keyword. Fixes [#50](https://github.com/PHPCompatibility/PHPCompatibility/issues/50).
|
1315 |
+
- :star: `NewKeywords` sniff: detection of the PHP 5.3+ `nowdoc` syntax. Fixes [#48](https://github.com/PHPCompatibility/PHPCompatibility/issues/48).
|
1316 |
+
- :star: `NewKeywords` sniff: detection of the use of the `const` keyword outside of a class for PHP < 5.3. Fixes [#50](https://github.com/PHPCompatibility/PHPCompatibility/issues/50).
|
1317 |
+
- :star: `DeprecatedFunctions` sniff: recognize PHP 7.0 deprecated and removed functions. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1318 |
+
- :star: `DeprecatedIniDirectives` sniff: recognize PHP 7.0 removed ini directives. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1319 |
+
- :star: `ForbiddenNamesAsInvokedFunctions` sniff: recognize new PHP 7.0 reserved keywords when invoked as functions. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1320 |
+
- :star: `ForbiddenNames` sniff: recognize new PHP 7.0 reserved keywords. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1321 |
+
- :star: `NewFunctions` sniff: recognize new functions as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1322 |
+
- :star: `NewLanguageConstructs` sniff: recognize new PHP 7.0 `<=>` "spaceship" and `??` null coalescing operators. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1323 |
+
- :star: `RemovedExtensions` sniff: recognize PHP 7.0 removed `ereg`, `mssql`, `mysql` and `sybase_ct` extensions. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1324 |
+
- :umbrella: Additional unit tests for the `NewLanguageConstructs` sniff. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1325 |
- :books: Readme: New section containing information about the use of the `testVersion` config variable.
|
1326 |
- :books: Readme: Sponsor credits.
|
1327 |
|
1328 |
### Changed
|
1329 |
+
- :pushpin: The `DeprecatedIniDirectives` sniff used to always throw an `warning`. Now it will throw an `error` when a removed ini directive is used. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110).
|
1330 |
+
- :pushpin: The `DeprecatedNewReference` sniff will now throw an error when the `testVersion` includes PHP 7.0 or higher. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1331 |
+
- :pushpin: The `ForbiddenNames` sniff now supports detection of reserved keywords when used in combination with PHP 7 anonymous classes. [#108](https://github.com/PHPCompatibility/PHPCompatibility/pull/108), [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110).
|
1332 |
+
- :pushpin: The `PregReplaceEModifier` sniff will now throw an error when the `testVersion` includes PHP 7.0 or higher. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
|
1333 |
+
- :pencil2: `NewKeywords` sniff: clarified the error message text for the `use` keyword. Fixes [#46](https://github.com/PHPCompatibility/PHPCompatibility/issues/46).
|
1334 |
+
- :recycle: Minor refactor of the `testVersion` related utility functions. [#98](https://github.com/PHPCompatibility/PHPCompatibility/pull/98)
|
1335 |
+
- :wrench: Add autoload to the `composer.json` file. [#96](https://github.com/PHPCompatibility/PHPCompatibility/pull/96) Fixes [#67](https://github.com/PHPCompatibility/PHPCompatibility/issues/67).
|
1336 |
+
- :wrench: Minor other updates to the `composer.json` file. [#75](https://github.com/PHPCompatibility/PHPCompatibility/pull/75)
|
1337 |
- :wrench: Improved creation of the code coverage reports needed by coveralls via Travis.
|
1338 |
- :green_heart: The sniffs are now also tested against PHP 7.0 for consistent results.
|
1339 |
|
1340 |
### Fixed
|
1341 |
+
- :bug: The `ForbiddenCallTimePassByReference` sniff was throwing `Undefined index` notices when used in combination with PHPCS 2.2.0. [#100](https://github.com/PHPCompatibility/PHPCompatibility/pull/100). Fixes [#42](https://github.com/PHPCompatibility/PHPCompatibility/issues/42).
|
1342 |
+
- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would incorrectly throw an error if the `throw` keyword was used with parenthesis. Fixes [#118](https://github.com/PHPCompatibility/PHPCompatibility/issues/118).
|
1343 |
+
- :bug: The `PregReplaceEModifier` sniff incorrectly identified `e`'s in the pattern as the `e` modifier when using `{}` bracket delimiters for the regex. [#94](https://github.com/PHPCompatibility/PHPCompatibility/pull/94)
|
1344 |
+
- :bug: The `RemovedExtensions` sniff was throwing an `error` instead of a `warning` for deprecated, but not (yet) removed extensions. Fixes [#62](https://github.com/PHPCompatibility/PHPCompatibility/issues/62).
|
1345 |
|
1346 |
### Credits
|
1347 |
Thanks go out to AlexMiroshnikov, [Chris Abernethy], [dgudgeon], [djaenecke], [Eugene Maslovich], [Ken Guest], Koen Eelen, [Komarov Alexey], [Mark Clements] and [Remko van Bezooijen] for their contributions to this version. :clap:
|
1352 |
See all related issues and PRs in the [5.6 milestone].
|
1353 |
|
1354 |
### Added
|
1355 |
+
- :star2: New: `NewLanguageConstructs` sniff. The initial version of this sniff checks for the PHP 5.6 `**` power operator and the `**=` power assignment operator. [#87](https://github.com/PHPCompatibility/PHPCompatibility/pull/87). Fixes [#60](https://github.com/PHPCompatibility/PHPCompatibility/issues/60).
|
1356 |
+
- :star2: New: `ParameterShadowSuperGlobals` sniff which covers the PHP 5.4 change _Parameter names that shadow super globals now cause a fatal error.`_. [#74](https://github.com/PHPCompatibility/PHPCompatibility/pull/74)
|
1357 |
+
- :star2: New: `PregReplaceEModifier` sniff which detects usage of the `e` modifier in literal regular expressions used with `preg_replace()`. The `e` modifier will not (yet) be detected when the regex passed is a variable or constant. [#81](https://github.com/PHPCompatibility/PHPCompatibility/pull/81), [#84](https://github.com/PHPCompatibility/PHPCompatibility/pull/84). Fixes [#71](https://github.com/PHPCompatibility/PHPCompatibility/issues/71), [#83](https://github.com/PHPCompatibility/PHPCompatibility/issues/83).
|
1358 |
- :star: `DeprecatedIniDirectives` sniff: PHP 5.6 deprecated ini directives.
|
1359 |
+
- :star: `NewKeywords` sniff: detection of the `goto` keyword introduced in PHP 5.3 and the `callable` keyword introduced in PHP 5.4. [#57](https://github.com/PHPCompatibility/PHPCompatibility/pull/57)
|
1360 |
+
- :recycle: `PHPCompatibility_Sniff` base class initially containing the `supportsAbove()` and `supportsBelow()` utility methods. (Nearly) All sniffs now extend this base class and use these methods to determine whether or not violations should be reported for a set `testVersion`. [#77](https://github.com/PHPCompatibility/PHPCompatibility/pull/77)
|
1361 |
+
- :books: Readme: Composer installation instructions. [#32](https://github.com/PHPCompatibility/PHPCompatibility/pull/32), [#61](https://github.com/PHPCompatibility/PHPCompatibility/pull/61)
|
1362 |
+
- :wrench: `.gitignore` to ignore vendor and IDE related directories. [#78](https://github.com/PHPCompatibility/PHPCompatibility/pull/78)
|
1363 |
- :green_heart: Code coverage checking via coveralls.
|
1364 |
|
1365 |
### Changed
|
1366 |
+
- :twisted_rightwards_arrows: The check for the `\` namespace separator has been moved from the `NewKeywords` sniff to the `NewLanguageConstructs` sniff. [#88](https://github.com/PHPCompatibility/PHPCompatibility/pull/88)
|
1367 |
- :pencil2: `DeprecatedIniDirectives` sniff: minor change in the sniff error message text.
|
1368 |
- :pencil2: `DeprecatedFunctions` sniff: minor change in the sniff error message text.
|
1369 |
+
- :wrench: Minor updates to the `composer.json` file. [#31](https://github.com/PHPCompatibility/PHPCompatibility/pull/31), [34](https://github.com/PHPCompatibility/PHPCompatibility/pull/34), [#70](https://github.com/PHPCompatibility/PHPCompatibility/pull/70)
|
1370 |
- :wrench: Tests: The unit tests can now be run without configuration.
|
1371 |
+
- :wrench: Tests: Skipped unit tests will now be annotated as such. [#85](https://github.com/PHPCompatibility/PHPCompatibility/pull/85)
|
1372 |
- :green_heart: The sniffs are now also tested against PHP 5.6 for consistent results.
|
1373 |
- :green_heart: The sniffs are now also tested against PHPCS 2.0+.
|
1374 |
+
- :green_heart: The sniffs are now tested using the new container-based infrastructure in Travis CI. [#37](https://github.com/PHPCompatibility/PHPCompatibility/pull/37)
|
1375 |
|
1376 |
### Fixed
|
1377 |
+
- :bug: The `ForbiddenCallTimePassByReference` sniff was throwing false positives when a bitwise and `&` was used in combination with class constants and class properties within function calls. [#44](https://github.com/PHPCompatibility/PHPCompatibility/pull/44). Fixes [#39](https://github.com/PHPCompatibility/PHPCompatibility/issues/39).
|
1378 |
+
- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff was throwing false positives in certain cases when a comment separated a `try` from the `catch` block. [#29](https://github.com/PHPCompatibility/PHPCompatibility/pull/29)
|
1379 |
+
- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff was incorrectly reporting `instanceof` as being introduced in PHP 5.4 while it has been around since PHP 5.0. [#80](https://github.com/PHPCompatibility/PHPCompatibility/pull/80)
|
1380 |
+
- :white_check_mark: Compatibility with PHPCS 2.0 - 2.3. [#63](https://github.com/PHPCompatibility/PHPCompatibility/pull/63), [#65](https://github.com/PHPCompatibility/PHPCompatibility/pull/65)
|
1381 |
|
1382 |
### Credits
|
1383 |
Thanks go out to Daniel Jänecke, [Declan Kelly], [Dominic], [Jaap van Otterdijk], [Marin Crnkovic], [Mark Clements], [Nick Pack], [Oliver Klee], [Rowan Collins] and [Sam Van der Borght] for their contributions to this version. :clap:
|
1391 |
|
1392 |
|
1393 |
|
1394 |
+
[Unreleased]: https://github.com/PHPCompatibility/PHPCompatibility/compare/master...HEAD
|
1395 |
+
[9.3.5]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.4...9.3.5
|
1396 |
+
[9.3.4]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.3...9.3.4
|
1397 |
+
[9.3.3]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.2...9.3.3
|
1398 |
+
[9.3.2]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.1...9.3.2
|
1399 |
+
[9.3.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.0...9.3.1
|
1400 |
+
[9.3.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.2.0...9.3.0
|
1401 |
+
[9.2.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.1.1...9.2.0
|
1402 |
+
[9.1.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.1.0...9.1.1
|
1403 |
+
[9.1.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.0.0...9.1.0
|
1404 |
+
[9.0.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/8.2.0...9.0.0
|
1405 |
+
[8.2.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/8.1.0...8.2.0
|
1406 |
+
[8.1.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/8.0.1...8.1.0
|
1407 |
+
[8.0.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/8.0.0...8.0.1
|
1408 |
+
[8.0.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.5...8.0.0
|
1409 |
+
[7.1.5]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.4...7.1.5
|
1410 |
+
[7.1.4]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.3...7.1.4
|
1411 |
+
[7.1.3]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.2...7.1.3
|
1412 |
+
[7.1.2]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.1...7.1.2
|
1413 |
+
[7.1.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.0...7.1.1
|
1414 |
+
[7.1.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.8...7.1.0
|
1415 |
+
[7.0.8]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.7...7.0.8
|
1416 |
+
[7.0.7]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.6...7.0.7
|
1417 |
+
[7.0.6]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.5...7.0.6
|
1418 |
+
[7.0.5]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.4...7.0.5
|
1419 |
+
[7.0.4]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.3...7.0.4
|
1420 |
+
[7.0.3]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.2...7.0.3
|
1421 |
+
[7.0.2]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.1...7.0.2
|
1422 |
+
[7.0.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0...7.0.1
|
1423 |
+
[7.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/5.6...7.0
|
1424 |
+
[5.6]: https://github.com/PHPCompatibility/PHPCompatibility/compare/5.5...5.6
|
1425 |
+
|
1426 |
+
[9.3.5 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/34
|
1427 |
+
[9.3.4 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/33
|
1428 |
+
[9.3.3 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/32
|
1429 |
+
[9.3.2 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/31
|
1430 |
+
[9.3.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/30
|
1431 |
+
[9.3.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/29
|
1432 |
+
[9.2.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/28
|
1433 |
+
[9.1.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/27
|
1434 |
+
[9.1.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/25
|
1435 |
+
[9.0.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/24
|
1436 |
+
[8.2.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/22
|
1437 |
+
[8.1.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/21
|
1438 |
+
[8.0.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/20
|
1439 |
+
[8.0.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/19
|
1440 |
+
[7.1.5 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/17
|
1441 |
+
[7.1.4 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/15
|
1442 |
+
[7.1.3 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/14
|
1443 |
+
[7.1.2 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/13
|
1444 |
+
[7.1.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/12
|
1445 |
+
[7.1.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/11
|
1446 |
+
[7.0.8 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/10
|
1447 |
+
[7.0.7 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/9
|
1448 |
+
[7.0.6 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/8
|
1449 |
+
[7.0.5 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/7
|
1450 |
+
[7.0.4 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/6
|
1451 |
+
[7.0.3 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/5
|
1452 |
+
[7.0.2 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/4
|
1453 |
+
[7.0.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/3
|
1454 |
+
[7.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/2
|
1455 |
+
[5.6 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/1
|
1456 |
+
[5.5 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/16
|
1457 |
|
1458 |
[Arthur Edamov]: https://github.com/edamov
|
1459 |
[Chris Abernethy]: https://github.com/cabernet-zerve
|
1465 |
[Gary Jones]: https://github.com/GaryJones
|
1466 |
[Jaap van Otterdijk]: https://github.com/jaapio
|
1467 |
[Jason Stallings]: https://github.com/octalmage
|
1468 |
+
[Jonathan Champ]: https://github.com/jrchamp
|
1469 |
[Jonathan Van Belle]: https://github.com/Grummfy
|
1470 |
[Juliette Reinders Folmer]: https://github.com/jrfnl
|
1471 |
[Ken Guest]: https://github.com/kenguest
|
1474 |
[Mark Clements]: https://github.com/MarkMaldaba
|
1475 |
[Michael Babker]: https://github.com/mbabker
|
1476 |
[Nick Pack]: https://github.com/nickpack
|
1477 |
+
[Nikhil]: https://github.com/Nikschavan
|
1478 |
[Oliver Klee]: https://github.com/oliverklee
|
1479 |
[Remko van Bezooijen]: https://github.com/emkookmer
|
1480 |
[Rowan Collins]: https://github.com/IMSoP
|
1481 |
[Ryan Neufeld]: https://github.com/ryanneufeld
|
1482 |
[Sam Van der Borght]: https://github.com/samvdb
|
1483 |
+
[Sergii Bondarenko]: https://github.com/BR0kEN-
|
1484 |
[Tadas Juozapaitis]: https://github.com/kasp3r
|
1485 |
+
[Tim Millwood]: https://github.com/timmillwood
|
1486 |
+
[William Entriken]: https://github.com/fulldecent
|
1487 |
+
[Yılmaz]: https://github.com/edigu
|
1488 |
[Yoshiaki Yoshida]: https://github.com/kakakakakku
|
|
vendor/phpcompatibility/php-compatibility/PHPCSAliases.php
CHANGED
@@ -1,13 +1,17 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
3 |
* PHPCS cross-version compatibility helper.
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
|
|
|
|
8 |
*/
|
9 |
|
10 |
-
|
11 |
/*
|
12 |
* Alias a number of PHPCS 3.x classes to their PHPCS 2.x equivalents.
|
13 |
*
|
@@ -17,11 +21,11 @@
|
|
17 |
* {@internal The PHPCS file have been reorganized in PHPCS 3.x, quite
|
18 |
* a few "old" classes have been split and spread out over several "new"
|
19 |
* classes. In other words, this will only work for a limited number
|
20 |
-
* of classes.}
|
21 |
*
|
22 |
* {@internal The `class_exists` wrappers are needed to play nice with other
|
23 |
* external PHPCS standards creating cross-version compatibility in the same
|
24 |
-
* manner.}
|
25 |
*/
|
26 |
if (defined('PHPCOMPATIBILITY_PHPCS_ALIASES_SET') === false) {
|
27 |
if (interface_exists('\PHP_CodeSniffer_Sniff') === false) {
|
@@ -48,15 +52,11 @@ if (defined('PHPCOMPATIBILITY_PHPCS_ALIASES_SET') === false) {
|
|
48 |
/*
|
49 |
* Register an autoloader.
|
50 |
*
|
51 |
-
* {@internal
|
52 |
-
* needed
|
53 |
-
*
|
54 |
-
* minimum PHPCS 3.x requirement for PHPCompatibility has gone up to 3.1.
|
55 |
-
* Upstream issue: {@link https://github.com/squizlabs/PHP_CodeSniffer/issues/1564} }}
|
56 |
*
|
57 |
-
*
|
58 |
-
* **is** needed to run the sniffs.
|
59 |
-
* Upstream issue: {@link https://github.com/squizlabs/PHP_CodeSniffer/issues/1591} }}
|
60 |
*/
|
61 |
spl_autoload_register(function ($class) {
|
62 |
// Only try & load our own classes.
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
+
*
|
5 |
* PHPCS cross-version compatibility helper.
|
6 |
*
|
7 |
+
* @package PHPCompatibility
|
8 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
9 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
10 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
11 |
+
*
|
12 |
+
* @since 8.0.0
|
13 |
*/
|
14 |
|
|
|
15 |
/*
|
16 |
* Alias a number of PHPCS 3.x classes to their PHPCS 2.x equivalents.
|
17 |
*
|
21 |
* {@internal The PHPCS file have been reorganized in PHPCS 3.x, quite
|
22 |
* a few "old" classes have been split and spread out over several "new"
|
23 |
* classes. In other words, this will only work for a limited number
|
24 |
+
* of classes.}
|
25 |
*
|
26 |
* {@internal The `class_exists` wrappers are needed to play nice with other
|
27 |
* external PHPCS standards creating cross-version compatibility in the same
|
28 |
+
* manner.}
|
29 |
*/
|
30 |
if (defined('PHPCOMPATIBILITY_PHPCS_ALIASES_SET') === false) {
|
31 |
if (interface_exists('\PHP_CodeSniffer_Sniff') === false) {
|
52 |
/*
|
53 |
* Register an autoloader.
|
54 |
*
|
55 |
+
* {@internal When `installed_paths` is set via the ruleset, this autoloader
|
56 |
+
* is needed to run the sniffs.
|
57 |
+
* Upstream issue: {@link https://github.com/squizlabs/PHP_CodeSniffer/issues/1591} }
|
|
|
|
|
58 |
*
|
59 |
+
* @since 8.0.0
|
|
|
|
|
60 |
*/
|
61 |
spl_autoload_register(function ($class) {
|
62 |
// Only try & load our own classes.
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractComplexVersionSniff.php
CHANGED
@@ -1,20 +1,21 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
namespace PHPCompatibility;
|
11 |
|
|
|
|
|
12 |
/**
|
13 |
-
*
|
14 |
*
|
15 |
-
* @
|
16 |
-
* @package PHPCompatibility
|
17 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
18 |
*/
|
19 |
abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersionInterface
|
20 |
{
|
@@ -24,6 +25,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
|
|
24 |
* Handle the retrieval of relevant information and - if necessary - throwing of an
|
25 |
* error/warning for an item.
|
26 |
*
|
|
|
|
|
27 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
28 |
* @param int $stackPtr The position of the relevant token in
|
29 |
* the stack.
|
@@ -31,7 +34,7 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
|
|
31 |
*
|
32 |
* @return void
|
33 |
*/
|
34 |
-
public function handleFeature(
|
35 |
{
|
36 |
$itemArray = $this->getItemArray($itemInfo);
|
37 |
$errorInfo = $this->getErrorInfo($itemArray, $itemInfo);
|
@@ -45,6 +48,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
|
|
45 |
/**
|
46 |
* Determine whether an error/warning should be thrown for an item based on collected information.
|
47 |
*
|
|
|
|
|
48 |
* @param array $errorInfo Detail information about an item.
|
49 |
*
|
50 |
* @return bool
|
@@ -55,6 +60,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
|
|
55 |
/**
|
56 |
* Get an array of the non-PHP-version array keys used in a sub-array.
|
57 |
*
|
|
|
|
|
58 |
* @return array
|
59 |
*/
|
60 |
protected function getNonVersionArrayKeys()
|
@@ -67,6 +74,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
|
|
67 |
* Retrieve a subset of an item array containing only the array keys which
|
68 |
* contain PHP version information.
|
69 |
*
|
|
|
|
|
70 |
* @param array $itemArray Version and other information about an item.
|
71 |
*
|
72 |
* @return array Array with only the version information.
|
@@ -80,6 +89,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
|
|
80 |
/**
|
81 |
* Get the item name to be used for the creation of the error code and in the error message.
|
82 |
*
|
|
|
|
|
83 |
* @param array $itemInfo Base information about the item.
|
84 |
* @param array $errorInfo Detail information about an item.
|
85 |
*
|
@@ -94,6 +105,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
|
|
94 |
/**
|
95 |
* Get the error message template for a specific sniff.
|
96 |
*
|
|
|
|
|
97 |
* @return string
|
98 |
*/
|
99 |
abstract protected function getErrorMsgTemplate();
|
@@ -102,6 +115,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
|
|
102 |
/**
|
103 |
* Allow for concrete child classes to filter the error message before it's passed to PHPCS.
|
104 |
*
|
|
|
|
|
105 |
* @param string $error The error message which was created.
|
106 |
* @param array $itemInfo Base information about the item this error message applies to.
|
107 |
* @param array $errorInfo Detail information about an item this error message applies to.
|
@@ -117,6 +132,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
|
|
117 |
/**
|
118 |
* Allow for concrete child classes to filter the error data before it's passed to PHPCS.
|
119 |
*
|
|
|
|
|
120 |
* @param array $data The error data array which was created.
|
121 |
* @param array $itemInfo Base information about the item this error message applies to.
|
122 |
* @param array $errorInfo Detail information about an item this error message applies to.
|
@@ -127,6 +144,4 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
|
|
127 |
{
|
128 |
return $data;
|
129 |
}
|
130 |
-
|
131 |
-
|
132 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
namespace PHPCompatibility;
|
12 |
|
13 |
+
use PHP_CodeSniffer_File as File;
|
14 |
+
|
15 |
/**
|
16 |
+
* Abstract base class for sniffs based on complex arrays with PHP version information.
|
17 |
*
|
18 |
+
* @since 7.1.0
|
|
|
|
|
19 |
*/
|
20 |
abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersionInterface
|
21 |
{
|
25 |
* Handle the retrieval of relevant information and - if necessary - throwing of an
|
26 |
* error/warning for an item.
|
27 |
*
|
28 |
+
* @since 7.1.0
|
29 |
+
*
|
30 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
31 |
* @param int $stackPtr The position of the relevant token in
|
32 |
* the stack.
|
34 |
*
|
35 |
* @return void
|
36 |
*/
|
37 |
+
public function handleFeature(File $phpcsFile, $stackPtr, array $itemInfo)
|
38 |
{
|
39 |
$itemArray = $this->getItemArray($itemInfo);
|
40 |
$errorInfo = $this->getErrorInfo($itemArray, $itemInfo);
|
48 |
/**
|
49 |
* Determine whether an error/warning should be thrown for an item based on collected information.
|
50 |
*
|
51 |
+
* @since 7.1.0
|
52 |
+
*
|
53 |
* @param array $errorInfo Detail information about an item.
|
54 |
*
|
55 |
* @return bool
|
60 |
/**
|
61 |
* Get an array of the non-PHP-version array keys used in a sub-array.
|
62 |
*
|
63 |
+
* @since 7.1.0
|
64 |
+
*
|
65 |
* @return array
|
66 |
*/
|
67 |
protected function getNonVersionArrayKeys()
|
74 |
* Retrieve a subset of an item array containing only the array keys which
|
75 |
* contain PHP version information.
|
76 |
*
|
77 |
+
* @since 7.1.0
|
78 |
+
*
|
79 |
* @param array $itemArray Version and other information about an item.
|
80 |
*
|
81 |
* @return array Array with only the version information.
|
89 |
/**
|
90 |
* Get the item name to be used for the creation of the error code and in the error message.
|
91 |
*
|
92 |
+
* @since 7.1.0
|
93 |
+
*
|
94 |
* @param array $itemInfo Base information about the item.
|
95 |
* @param array $errorInfo Detail information about an item.
|
96 |
*
|
105 |
/**
|
106 |
* Get the error message template for a specific sniff.
|
107 |
*
|
108 |
+
* @since 7.1.0
|
109 |
+
*
|
110 |
* @return string
|
111 |
*/
|
112 |
abstract protected function getErrorMsgTemplate();
|
115 |
/**
|
116 |
* Allow for concrete child classes to filter the error message before it's passed to PHPCS.
|
117 |
*
|
118 |
+
* @since 7.1.0
|
119 |
+
*
|
120 |
* @param string $error The error message which was created.
|
121 |
* @param array $itemInfo Base information about the item this error message applies to.
|
122 |
* @param array $errorInfo Detail information about an item this error message applies to.
|
132 |
/**
|
133 |
* Allow for concrete child classes to filter the error data before it's passed to PHPCS.
|
134 |
*
|
135 |
+
* @since 7.1.0
|
136 |
+
*
|
137 |
* @param array $data The error data array which was created.
|
138 |
* @param array $itemInfo Base information about the item this error message applies to.
|
139 |
* @param array $errorInfo Detail information about an item this error message applies to.
|
144 |
{
|
145 |
return $data;
|
146 |
}
|
147 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractFunctionCallParameterSniff.php
CHANGED
@@ -1,24 +1,23 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
namespace PHPCompatibility;
|
11 |
|
12 |
use PHPCompatibility\Sniff;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
-
* \PHPCompatibility\AbstractFunctionCallParameterSniff.
|
16 |
-
*
|
17 |
* Abstract class to use as a base for examining the parameter values passed to function calls.
|
18 |
*
|
19 |
-
* @
|
20 |
-
* @package PHPCompatibility
|
21 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
22 |
*/
|
23 |
abstract class AbstractFunctionCallParameterSniff extends Sniff
|
24 |
{
|
@@ -29,6 +28,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
|
|
29 |
* the method called is of the right class/object.
|
30 |
* Checking that is outside of the scope of this abstract sniff.
|
31 |
*
|
|
|
|
|
32 |
* @var bool False (default) if the sniff is looking for function calls.
|
33 |
* True if the sniff is looking for method calls.
|
34 |
*/
|
@@ -37,6 +38,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
|
|
37 |
/**
|
38 |
* Functions the sniff is looking for. Should be defined in the child class.
|
39 |
*
|
|
|
|
|
40 |
* @var array The only requirement for this array is that the top level
|
41 |
* array keys are the names of the functions you're looking for.
|
42 |
* Other than that, the array can have arbitrary content
|
@@ -48,21 +51,25 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
|
|
48 |
* List of tokens which when they preceed the $stackPtr indicate that this
|
49 |
* is not a function call.
|
50 |
*
|
|
|
|
|
51 |
* @var array
|
52 |
*/
|
53 |
private $ignoreTokens = array(
|
54 |
-
T_DOUBLE_COLON => true,
|
55 |
-
T_OBJECT_OPERATOR => true,
|
56 |
-
T_FUNCTION => true,
|
57 |
-
T_NEW => true,
|
58 |
-
T_CONST => true,
|
59 |
-
T_USE => true,
|
60 |
);
|
61 |
|
62 |
|
63 |
/**
|
64 |
* Returns an array of tokens this test wants to listen for.
|
65 |
*
|
|
|
|
|
66 |
* @return array
|
67 |
*/
|
68 |
public function register()
|
@@ -70,20 +77,23 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
|
|
70 |
// Handle case-insensitivity of function names.
|
71 |
$this->targetFunctions = $this->arrayKeysToLowercase($this->targetFunctions);
|
72 |
|
73 |
-
return array(T_STRING);
|
74 |
}
|
75 |
|
76 |
|
77 |
/**
|
78 |
* Processes this test, when one of its tokens is encountered.
|
79 |
*
|
|
|
|
|
80 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
81 |
* @param int $stackPtr The position of the current token in
|
82 |
* the stack passed in $tokens.
|
83 |
*
|
84 |
-
* @return void
|
|
|
85 |
*/
|
86 |
-
public function process(
|
87 |
{
|
88 |
if ($this->bowOutEarly() === true) {
|
89 |
return;
|
@@ -97,11 +107,11 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
|
|
97 |
return;
|
98 |
}
|
99 |
|
100 |
-
$prevNonEmpty = $phpcsFile->findPrevious(
|
101 |
|
102 |
if ($this->isMethod === true) {
|
103 |
-
if ($tokens[$prevNonEmpty]['code'] !== T_DOUBLE_COLON
|
104 |
-
&& $tokens[$prevNonEmpty]['code'] !== T_OBJECT_OPERATOR
|
105 |
) {
|
106 |
// Not a call to a PHP method.
|
107 |
return;
|
@@ -112,8 +122,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
|
|
112 |
return;
|
113 |
}
|
114 |
|
115 |
-
if ($tokens[$prevNonEmpty]['code'] === T_NS_SEPARATOR
|
116 |
-
&& $tokens[$prevNonEmpty - 1]['code'] === T_STRING
|
117 |
) {
|
118 |
// Namespaced function.
|
119 |
return;
|
@@ -133,6 +143,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
|
|
133 |
/**
|
134 |
* Do a version check to determine if this sniff needs to run at all.
|
135 |
*
|
|
|
|
|
136 |
* If the check done in a child class is not specific to one PHP version,
|
137 |
* this function should return `false`.
|
138 |
*
|
@@ -146,6 +158,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
|
|
146 |
*
|
147 |
* This method has to be made concrete in child classes.
|
148 |
*
|
|
|
|
|
149 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
150 |
* @param int $stackPtr The position of the current token in the stack.
|
151 |
* @param string $functionName The token content (function name) which was matched.
|
@@ -154,7 +168,7 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
|
|
154 |
* @return int|void Integer stack pointer to skip forward or void to continue
|
155 |
* normal file processing.
|
156 |
*/
|
157 |
-
abstract public function processParameters(
|
158 |
|
159 |
|
160 |
/**
|
@@ -163,6 +177,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
|
|
163 |
* Defaults to doing nothing. Can be overloaded in child classes to handle functions
|
164 |
* were parameters are expected, but none found.
|
165 |
*
|
|
|
|
|
166 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
167 |
* @param int $stackPtr The position of the current token in the stack.
|
168 |
* @param string $functionName The token content (function name) which was matched.
|
@@ -170,8 +186,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
|
|
170 |
* @return int|void Integer stack pointer to skip forward or void to continue
|
171 |
* normal file processing.
|
172 |
*/
|
173 |
-
public function processNoParameters(
|
174 |
{
|
175 |
return;
|
176 |
}
|
177 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
namespace PHPCompatibility;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
|
17 |
/**
|
|
|
|
|
18 |
* Abstract class to use as a base for examining the parameter values passed to function calls.
|
19 |
*
|
20 |
+
* @since 8.2.0
|
|
|
|
|
21 |
*/
|
22 |
abstract class AbstractFunctionCallParameterSniff extends Sniff
|
23 |
{
|
28 |
* the method called is of the right class/object.
|
29 |
* Checking that is outside of the scope of this abstract sniff.
|
30 |
*
|
31 |
+
* @since 8.2.0
|
32 |
+
*
|
33 |
* @var bool False (default) if the sniff is looking for function calls.
|
34 |
* True if the sniff is looking for method calls.
|
35 |
*/
|
38 |
/**
|
39 |
* Functions the sniff is looking for. Should be defined in the child class.
|
40 |
*
|
41 |
+
* @since 8.2.0
|
42 |
+
*
|
43 |
* @var array The only requirement for this array is that the top level
|
44 |
* array keys are the names of the functions you're looking for.
|
45 |
* Other than that, the array can have arbitrary content
|
51 |
* List of tokens which when they preceed the $stackPtr indicate that this
|
52 |
* is not a function call.
|
53 |
*
|
54 |
+
* @since 8.2.0
|
55 |
+
*
|
56 |
* @var array
|
57 |
*/
|
58 |
private $ignoreTokens = array(
|
59 |
+
\T_DOUBLE_COLON => true,
|
60 |
+
\T_OBJECT_OPERATOR => true,
|
61 |
+
\T_FUNCTION => true,
|
62 |
+
\T_NEW => true,
|
63 |
+
\T_CONST => true,
|
64 |
+
\T_USE => true,
|
65 |
);
|
66 |
|
67 |
|
68 |
/**
|
69 |
* Returns an array of tokens this test wants to listen for.
|
70 |
*
|
71 |
+
* @since 8.2.0
|
72 |
+
*
|
73 |
* @return array
|
74 |
*/
|
75 |
public function register()
|
77 |
// Handle case-insensitivity of function names.
|
78 |
$this->targetFunctions = $this->arrayKeysToLowercase($this->targetFunctions);
|
79 |
|
80 |
+
return array(\T_STRING);
|
81 |
}
|
82 |
|
83 |
|
84 |
/**
|
85 |
* Processes this test, when one of its tokens is encountered.
|
86 |
*
|
87 |
+
* @since 8.2.0
|
88 |
+
*
|
89 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
90 |
* @param int $stackPtr The position of the current token in
|
91 |
* the stack passed in $tokens.
|
92 |
*
|
93 |
+
* @return int|void Integer stack pointer to skip forward or void to continue
|
94 |
+
* normal file processing.
|
95 |
*/
|
96 |
+
public function process(File $phpcsFile, $stackPtr)
|
97 |
{
|
98 |
if ($this->bowOutEarly() === true) {
|
99 |
return;
|
107 |
return;
|
108 |
}
|
109 |
|
110 |
+
$prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
111 |
|
112 |
if ($this->isMethod === true) {
|
113 |
+
if ($tokens[$prevNonEmpty]['code'] !== \T_DOUBLE_COLON
|
114 |
+
&& $tokens[$prevNonEmpty]['code'] !== \T_OBJECT_OPERATOR
|
115 |
) {
|
116 |
// Not a call to a PHP method.
|
117 |
return;
|
122 |
return;
|
123 |
}
|
124 |
|
125 |
+
if ($tokens[$prevNonEmpty]['code'] === \T_NS_SEPARATOR
|
126 |
+
&& $tokens[$prevNonEmpty - 1]['code'] === \T_STRING
|
127 |
) {
|
128 |
// Namespaced function.
|
129 |
return;
|
143 |
/**
|
144 |
* Do a version check to determine if this sniff needs to run at all.
|
145 |
*
|
146 |
+
* @since 8.2.0
|
147 |
+
*
|
148 |
* If the check done in a child class is not specific to one PHP version,
|
149 |
* this function should return `false`.
|
150 |
*
|
158 |
*
|
159 |
* This method has to be made concrete in child classes.
|
160 |
*
|
161 |
+
* @since 8.2.0
|
162 |
+
*
|
163 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
164 |
* @param int $stackPtr The position of the current token in the stack.
|
165 |
* @param string $functionName The token content (function name) which was matched.
|
168 |
* @return int|void Integer stack pointer to skip forward or void to continue
|
169 |
* normal file processing.
|
170 |
*/
|
171 |
+
abstract public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters);
|
172 |
|
173 |
|
174 |
/**
|
177 |
* Defaults to doing nothing. Can be overloaded in child classes to handle functions
|
178 |
* were parameters are expected, but none found.
|
179 |
*
|
180 |
+
* @since 8.2.0
|
181 |
+
*
|
182 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
183 |
* @param int $stackPtr The position of the current token in the stack.
|
184 |
* @param string $functionName The token content (function name) which was matched.
|
186 |
* @return int|void Integer stack pointer to skip forward or void to continue
|
187 |
* normal file processing.
|
188 |
*/
|
189 |
+
public function processNoParameters(File $phpcsFile, $stackPtr, $functionName)
|
190 |
{
|
191 |
return;
|
192 |
}
|
193 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractNewFeatureSniff.php
CHANGED
@@ -1,20 +1,21 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
namespace PHPCompatibility;
|
11 |
|
|
|
|
|
12 |
/**
|
13 |
-
*
|
14 |
*
|
15 |
-
* @
|
16 |
-
* @package PHPCompatibility
|
17 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
18 |
*/
|
19 |
abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
|
20 |
{
|
@@ -23,6 +24,8 @@ abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
|
|
23 |
/**
|
24 |
* Determine whether an error/warning should be thrown for an item based on collected information.
|
25 |
*
|
|
|
|
|
26 |
* @param array $errorInfo Detail information about an item.
|
27 |
*
|
28 |
* @return bool
|
@@ -36,6 +39,8 @@ abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
|
|
36 |
/**
|
37 |
* Retrieve the relevant detail (version) information for use in an error message.
|
38 |
*
|
|
|
|
|
39 |
* @param array $itemArray Version and other information about the item.
|
40 |
* @param array $itemInfo Base information about the item.
|
41 |
*
|
@@ -67,6 +72,8 @@ abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
|
|
67 |
/**
|
68 |
* Get the error message template for this sniff.
|
69 |
*
|
|
|
|
|
70 |
* @return string
|
71 |
*/
|
72 |
protected function getErrorMsgTemplate()
|
@@ -78,6 +85,8 @@ abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
|
|
78 |
/**
|
79 |
* Generates the error or warning for this item.
|
80 |
*
|
|
|
|
|
81 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
82 |
* @param int $stackPtr The position of the relevant token in
|
83 |
* the stack.
|
@@ -87,7 +96,7 @@ abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
|
|
87 |
*
|
88 |
* @return void
|
89 |
*/
|
90 |
-
public function addError(
|
91 |
{
|
92 |
$itemName = $this->getItemName($itemInfo, $errorInfo);
|
93 |
$error = $this->getErrorMsgTemplate();
|
@@ -103,6 +112,4 @@ abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
|
|
103 |
|
104 |
$this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data);
|
105 |
}
|
106 |
-
|
107 |
-
|
108 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
namespace PHPCompatibility;
|
12 |
|
13 |
+
use PHP_CodeSniffer_File as File;
|
14 |
+
|
15 |
/**
|
16 |
+
* Base class for new feature sniffs.
|
17 |
*
|
18 |
+
* @since 7.1.0
|
|
|
|
|
19 |
*/
|
20 |
abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
|
21 |
{
|
24 |
/**
|
25 |
* Determine whether an error/warning should be thrown for an item based on collected information.
|
26 |
*
|
27 |
+
* @since 7.1.0
|
28 |
+
*
|
29 |
* @param array $errorInfo Detail information about an item.
|
30 |
*
|
31 |
* @return bool
|
39 |
/**
|
40 |
* Retrieve the relevant detail (version) information for use in an error message.
|
41 |
*
|
42 |
+
* @since 7.1.0
|
43 |
+
*
|
44 |
* @param array $itemArray Version and other information about the item.
|
45 |
* @param array $itemInfo Base information about the item.
|
46 |
*
|
72 |
/**
|
73 |
* Get the error message template for this sniff.
|
74 |
*
|
75 |
+
* @since 7.1.0
|
76 |
+
*
|
77 |
* @return string
|
78 |
*/
|
79 |
protected function getErrorMsgTemplate()
|
85 |
/**
|
86 |
* Generates the error or warning for this item.
|
87 |
*
|
88 |
+
* @since 7.1.0
|
89 |
+
*
|
90 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
91 |
* @param int $stackPtr The position of the relevant token in
|
92 |
* the stack.
|
96 |
*
|
97 |
* @return void
|
98 |
*/
|
99 |
+
public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
|
100 |
{
|
101 |
$itemName = $this->getItemName($itemInfo, $errorInfo);
|
102 |
$error = $this->getErrorMsgTemplate();
|
112 |
|
113 |
$this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data);
|
114 |
}
|
115 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractRemovedFeatureSniff.php
CHANGED
@@ -1,20 +1,21 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
namespace PHPCompatibility;
|
11 |
|
|
|
|
|
12 |
/**
|
13 |
-
*
|
14 |
*
|
15 |
-
* @
|
16 |
-
* @package PHPCompatibility
|
17 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
18 |
*/
|
19 |
abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
|
20 |
{
|
@@ -23,6 +24,8 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
|
|
23 |
/**
|
24 |
* Determine whether an error/warning should be thrown for an item based on collected information.
|
25 |
*
|
|
|
|
|
26 |
* @param array $errorInfo Detail information about an item.
|
27 |
*
|
28 |
* @return bool
|
@@ -38,6 +41,8 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
|
|
38 |
*
|
39 |
* By default, removed feature version arrays, contain an additional 'alternative' array key.
|
40 |
*
|
|
|
|
|
41 |
* @return array
|
42 |
*/
|
43 |
protected function getNonVersionArrayKeys()
|
@@ -49,6 +54,8 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
|
|
49 |
/**
|
50 |
* Retrieve the relevant detail (version) information for use in an error message.
|
51 |
*
|
|
|
|
|
52 |
* @param array $itemArray Version and other information about the item.
|
53 |
* @param array $itemInfo Base information about the item.
|
54 |
*
|
@@ -89,6 +96,8 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
|
|
89 |
/**
|
90 |
* Get the error message template for suggesting an alternative for a specific sniff.
|
91 |
*
|
|
|
|
|
92 |
* @return string
|
93 |
*/
|
94 |
protected function getAlternativeOptionTemplate()
|
@@ -100,6 +109,8 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
|
|
100 |
/**
|
101 |
* Generates the error or warning for this item.
|
102 |
*
|
|
|
|
|
103 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
104 |
* @param int $stackPtr The position of the relevant token in
|
105 |
* the stack.
|
@@ -109,7 +120,7 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
|
|
109 |
*
|
110 |
* @return void
|
111 |
*/
|
112 |
-
public function addError(
|
113 |
{
|
114 |
$itemName = $this->getItemName($itemInfo, $errorInfo);
|
115 |
$error = $this->getErrorMsgTemplate();
|
@@ -130,7 +141,7 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
|
|
130 |
}
|
131 |
|
132 |
// Remove the last 'and' from the message.
|
133 |
-
$error = substr($error, 0, (strlen($error) - 5));
|
134 |
|
135 |
if ($errorInfo['alternative'] !== '') {
|
136 |
$error .= $this->getAlternativeOptionTemplate();
|
@@ -141,8 +152,5 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
|
|
141 |
$data = $this->filterErrorData($data, $itemInfo, $errorInfo);
|
142 |
|
143 |
$this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data);
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
namespace PHPCompatibility;
|
12 |
|
13 |
+
use PHP_CodeSniffer_File as File;
|
14 |
+
|
15 |
/**
|
16 |
+
* Base class for removed feature sniffs.
|
17 |
*
|
18 |
+
* @since 7.1.0
|
|
|
|
|
19 |
*/
|
20 |
abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
|
21 |
{
|
24 |
/**
|
25 |
* Determine whether an error/warning should be thrown for an item based on collected information.
|
26 |
*
|
27 |
+
* @since 7.1.0
|
28 |
+
*
|
29 |
* @param array $errorInfo Detail information about an item.
|
30 |
*
|
31 |
* @return bool
|
41 |
*
|
42 |
* By default, removed feature version arrays, contain an additional 'alternative' array key.
|
43 |
*
|
44 |
+
* @since 7.1.0
|
45 |
+
*
|
46 |
* @return array
|
47 |
*/
|
48 |
protected function getNonVersionArrayKeys()
|
54 |
/**
|
55 |
* Retrieve the relevant detail (version) information for use in an error message.
|
56 |
*
|
57 |
+
* @since 7.1.0
|
58 |
+
*
|
59 |
* @param array $itemArray Version and other information about the item.
|
60 |
* @param array $itemInfo Base information about the item.
|
61 |
*
|
96 |
/**
|
97 |
* Get the error message template for suggesting an alternative for a specific sniff.
|
98 |
*
|
99 |
+
* @since 7.1.0
|
100 |
+
*
|
101 |
* @return string
|
102 |
*/
|
103 |
protected function getAlternativeOptionTemplate()
|
109 |
/**
|
110 |
* Generates the error or warning for this item.
|
111 |
*
|
112 |
+
* @since 7.1.0
|
113 |
+
*
|
114 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
115 |
* @param int $stackPtr The position of the relevant token in
|
116 |
* the stack.
|
120 |
*
|
121 |
* @return void
|
122 |
*/
|
123 |
+
public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
|
124 |
{
|
125 |
$itemName = $this->getItemName($itemInfo, $errorInfo);
|
126 |
$error = $this->getErrorMsgTemplate();
|
141 |
}
|
142 |
|
143 |
// Remove the last 'and' from the message.
|
144 |
+
$error = substr($error, 0, (\strlen($error) - 5));
|
145 |
|
146 |
if ($errorInfo['alternative'] !== '') {
|
147 |
$error .= $this->getAlternativeOptionTemplate();
|
152 |
$data = $this->filterErrorData($data, $itemInfo, $errorInfo);
|
153 |
|
154 |
$this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data);
|
155 |
+
}
|
156 |
+
}
|
|
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/ComplexVersionInterface.php
CHANGED
@@ -1,24 +1,25 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
namespace PHPCompatibility;
|
11 |
|
|
|
|
|
12 |
/**
|
13 |
-
*
|
14 |
*
|
15 |
* Interface to be implemented by sniffs using a multi-dimensional array of
|
16 |
* PHP features (functions, classes etc) being sniffed for with version
|
17 |
* information in sub-arrays.
|
18 |
*
|
19 |
-
* @
|
20 |
-
* @package PHPCompatibility
|
21 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
22 |
*/
|
23 |
interface ComplexVersionInterface
|
24 |
{
|
@@ -28,6 +29,8 @@ interface ComplexVersionInterface
|
|
28 |
* Handle the retrieval of relevant information and - if necessary - throwing of an
|
29 |
* error/warning for an item.
|
30 |
*
|
|
|
|
|
31 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
32 |
* @param int $stackPtr The position of the relevant token in
|
33 |
* the stack.
|
@@ -35,12 +38,14 @@ interface ComplexVersionInterface
|
|
35 |
*
|
36 |
* @return void
|
37 |
*/
|
38 |
-
public function handleFeature(
|
39 |
|
40 |
|
41 |
/**
|
42 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
43 |
*
|
|
|
|
|
44 |
* @param array $itemInfo Base information about the item.
|
45 |
*
|
46 |
* @return array Version and other information about the item.
|
@@ -51,6 +56,8 @@ interface ComplexVersionInterface
|
|
51 |
/**
|
52 |
* Retrieve the relevant detail (version) information for use in an error message.
|
53 |
*
|
|
|
|
|
54 |
* @param array $itemArray Version and other information about the item.
|
55 |
* @param array $itemInfo Base information about the item.
|
56 |
*
|
@@ -62,6 +69,8 @@ interface ComplexVersionInterface
|
|
62 |
/**
|
63 |
* Generates the error or warning for this item.
|
64 |
*
|
|
|
|
|
65 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
66 |
* @param int $stackPtr The position of the relevant token in
|
67 |
* the stack.
|
@@ -71,7 +80,5 @@ interface ComplexVersionInterface
|
|
71 |
*
|
72 |
* @return void
|
73 |
*/
|
74 |
-
public function addError(
|
75 |
-
|
76 |
-
|
77 |
-
}//end interface
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
namespace PHPCompatibility;
|
12 |
|
13 |
+
use PHP_CodeSniffer_File as File;
|
14 |
+
|
15 |
/**
|
16 |
+
* Complex Version Interface.
|
17 |
*
|
18 |
* Interface to be implemented by sniffs using a multi-dimensional array of
|
19 |
* PHP features (functions, classes etc) being sniffed for with version
|
20 |
* information in sub-arrays.
|
21 |
*
|
22 |
+
* @since 7.1.0
|
|
|
|
|
23 |
*/
|
24 |
interface ComplexVersionInterface
|
25 |
{
|
29 |
* Handle the retrieval of relevant information and - if necessary - throwing of an
|
30 |
* error/warning for an item.
|
31 |
*
|
32 |
+
* @since 7.1.0
|
33 |
+
*
|
34 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
35 |
* @param int $stackPtr The position of the relevant token in
|
36 |
* the stack.
|
38 |
*
|
39 |
* @return void
|
40 |
*/
|
41 |
+
public function handleFeature(File $phpcsFile, $stackPtr, array $itemInfo);
|
42 |
|
43 |
|
44 |
/**
|
45 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
46 |
*
|
47 |
+
* @since 7.1.0
|
48 |
+
*
|
49 |
* @param array $itemInfo Base information about the item.
|
50 |
*
|
51 |
* @return array Version and other information about the item.
|
56 |
/**
|
57 |
* Retrieve the relevant detail (version) information for use in an error message.
|
58 |
*
|
59 |
+
* @since 7.1.0
|
60 |
+
*
|
61 |
* @param array $itemArray Version and other information about the item.
|
62 |
* @param array $itemInfo Base information about the item.
|
63 |
*
|
69 |
/**
|
70 |
* Generates the error or warning for this item.
|
71 |
*
|
72 |
+
* @since 7.1.0
|
73 |
+
*
|
74 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
75 |
* @param int $stackPtr The position of the relevant token in
|
76 |
* the stack.
|
80 |
*
|
81 |
* @return void
|
82 |
*/
|
83 |
+
public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo);
|
84 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/PHPCSHelper.php
CHANGED
@@ -1,17 +1,20 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
namespace PHPCompatibility;
|
11 |
|
|
|
|
|
|
|
|
|
12 |
/**
|
13 |
-
* \PHPCompatibility\PHPCSHelper
|
14 |
-
*
|
15 |
* PHPCS cross-version compatibility helper class.
|
16 |
*
|
17 |
* A number of PHPCS classes were split up into several classes in PHPCS 3.x
|
@@ -19,9 +22,15 @@ namespace PHPCompatibility;
|
|
19 |
* This class provides helper methods for functions which were contained in
|
20 |
* one of these classes and which are used within the PHPCompatibility library.
|
21 |
*
|
22 |
-
*
|
23 |
-
*
|
24 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
*/
|
26 |
class PHPCSHelper
|
27 |
{
|
@@ -29,15 +38,17 @@ class PHPCSHelper
|
|
29 |
/**
|
30 |
* Get the PHPCS version number.
|
31 |
*
|
|
|
|
|
32 |
* @return string
|
33 |
*/
|
34 |
public static function getVersion()
|
35 |
{
|
36 |
-
if (defined('\PHP_CodeSniffer\Config::VERSION')) {
|
37 |
// PHPCS 3.x.
|
38 |
return \PHP_CodeSniffer\Config::VERSION;
|
39 |
} else {
|
40 |
-
// PHPCS
|
41 |
return \PHP_CodeSniffer::VERSION;
|
42 |
}
|
43 |
}
|
@@ -48,6 +59,8 @@ class PHPCSHelper
|
|
48 |
*
|
49 |
* PHPCS cross-version compatibility helper.
|
50 |
*
|
|
|
|
|
51 |
* @param string $key The name of the config value.
|
52 |
* @param string|null $value The value to set. If null, the config entry
|
53 |
* is deleted, reverting it to the default value.
|
@@ -62,7 +75,7 @@ class PHPCSHelper
|
|
62 |
// PHPCS 3.x.
|
63 |
\PHP_CodeSniffer\Config::setConfigData($key, $value, $temp);
|
64 |
} else {
|
65 |
-
// PHPCS
|
66 |
\PHP_CodeSniffer::setConfigData($key, $value, $temp);
|
67 |
}
|
68 |
}
|
@@ -71,6 +84,8 @@ class PHPCSHelper
|
|
71 |
/**
|
72 |
* Get the value of a single PHPCS config key.
|
73 |
*
|
|
|
|
|
74 |
* @param string $key The name of the config value.
|
75 |
*
|
76 |
* @return string|null
|
@@ -81,7 +96,7 @@ class PHPCSHelper
|
|
81 |
// PHPCS 3.x.
|
82 |
return \PHP_CodeSniffer\Config::getConfigData($key);
|
83 |
} else {
|
84 |
-
// PHPCS
|
85 |
return \PHP_CodeSniffer::getConfigData($key);
|
86 |
}
|
87 |
}
|
@@ -93,21 +108,23 @@ class PHPCSHelper
|
|
93 |
* This config key can be set in the `CodeSniffer.conf` file, on the
|
94 |
* command-line or in a ruleset.
|
95 |
*
|
|
|
|
|
96 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
97 |
* @param string $key The name of the config value.
|
98 |
*
|
99 |
* @return string|null
|
100 |
*/
|
101 |
-
public static function getCommandLineData($phpcsFile, $key)
|
102 |
{
|
103 |
-
if (
|
104 |
// PHPCS 3.x.
|
105 |
$config = $phpcsFile->config;
|
106 |
if (isset($config->{$key})) {
|
107 |
return $config->{$key};
|
108 |
}
|
109 |
} else {
|
110 |
-
// PHPCS
|
111 |
$config = $phpcsFile->phpcs->cli->getCommandLineValues();
|
112 |
if (isset($config[$key])) {
|
113 |
return $config[$key];
|
@@ -118,17 +135,100 @@ class PHPCSHelper
|
|
118 |
}
|
119 |
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
/**
|
122 |
* Returns the position of the last non-whitespace token in a statement.
|
123 |
*
|
124 |
* {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File`
|
125 |
-
* class and introduced in PHPCS 2.1.0.
|
126 |
*
|
127 |
* Once the minimum supported PHPCS version for this standard goes beyond
|
128 |
* that, this method can be removed and calls to it replaced with
|
129 |
* `$phpcsFile->findEndOfStatement($start, $ignore)` calls.
|
130 |
*
|
131 |
-
* Last synced with PHPCS version: PHPCS 3.3.0-alpha at commit f5d899dcb5c534a1c3cca34668624517856ba823}
|
|
|
|
|
132 |
*
|
133 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
134 |
* @param int $start The position to start searching from in the token stack.
|
@@ -136,7 +236,7 @@ class PHPCSHelper
|
|
136 |
*
|
137 |
* @return int
|
138 |
*/
|
139 |
-
public static function findEndOfStatement(
|
140 |
{
|
141 |
if (version_compare(self::getVersion(), '3.3.0', '>=') === true) {
|
142 |
return $phpcsFile->findEndOfStatement($start, $ignore);
|
@@ -144,16 +244,16 @@ class PHPCSHelper
|
|
144 |
|
145 |
$tokens = $phpcsFile->getTokens();
|
146 |
$endTokens = array(
|
147 |
-
T_COLON => true,
|
148 |
-
T_COMMA => true,
|
149 |
-
T_DOUBLE_ARROW => true,
|
150 |
-
T_SEMICOLON => true,
|
151 |
-
T_CLOSE_PARENTHESIS => true,
|
152 |
-
T_CLOSE_SQUARE_BRACKET => true,
|
153 |
-
T_CLOSE_CURLY_BRACKET => true,
|
154 |
-
T_CLOSE_SHORT_ARRAY => true,
|
155 |
-
T_OPEN_TAG => true,
|
156 |
-
T_CLOSE_TAG => true,
|
157 |
);
|
158 |
|
159 |
if ($ignore !== null) {
|
@@ -170,12 +270,12 @@ class PHPCSHelper
|
|
170 |
for ($i = $start; $i < $phpcsFile->numTokens; $i++) {
|
171 |
if ($i !== $start && isset($endTokens[$tokens[$i]['code']]) === true) {
|
172 |
// Found the end of the statement.
|
173 |
-
if ($tokens[$i]['code'] === T_CLOSE_PARENTHESIS
|
174 |
-
|| $tokens[$i]['code'] === T_CLOSE_SQUARE_BRACKET
|
175 |
-
|| $tokens[$i]['code'] === T_CLOSE_CURLY_BRACKET
|
176 |
-
|| $tokens[$i]['code'] === T_CLOSE_SHORT_ARRAY
|
177 |
-
|| $tokens[$i]['code'] === T_OPEN_TAG
|
178 |
-
|| $tokens[$i]['code'] === T_CLOSE_TAG
|
179 |
) {
|
180 |
return $lastNotEmpty;
|
181 |
}
|
@@ -188,7 +288,7 @@ class PHPCSHelper
|
|
188 |
&& ($i === $tokens[$i]['scope_opener']
|
189 |
|| $i === $tokens[$i]['scope_condition'])
|
190 |
) {
|
191 |
-
if ($i === $start && isset(
|
192 |
return $tokens[$i]['scope_closer'];
|
193 |
}
|
194 |
|
@@ -203,14 +303,13 @@ class PHPCSHelper
|
|
203 |
$i = $tokens[$i]['parenthesis_closer'];
|
204 |
}
|
205 |
|
206 |
-
if (isset(
|
207 |
$lastNotEmpty = $i;
|
208 |
}
|
209 |
}//end for
|
210 |
|
211 |
return ($phpcsFile->numTokens - 1);
|
212 |
-
|
213 |
-
}//end findEndOfStatement()
|
214 |
|
215 |
|
216 |
/**
|
@@ -228,14 +327,17 @@ class PHPCSHelper
|
|
228 |
* that, this method can be removed and calls to it replaced with
|
229 |
* `$phpcsFile->findExtendedClassName($stackPtr)` calls.
|
230 |
*
|
231 |
-
* Last synced with PHPCS version: PHPCS 3.1.0-alpha at commit a9efcc9b0703f3f9f4a900623d4e97128a6aafc6}
|
|
|
|
|
|
|
232 |
*
|
233 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
234 |
* @param int $stackPtr The position of the class token in the stack.
|
235 |
*
|
236 |
* @return string|false
|
237 |
*/
|
238 |
-
public static function findExtendedClassName(
|
239 |
{
|
240 |
if (version_compare(self::getVersion(), '3.1.0', '>=') === true) {
|
241 |
return $phpcsFile->findExtendedClassName($stackPtr);
|
@@ -248,7 +350,7 @@ class PHPCSHelper
|
|
248 |
return false;
|
249 |
}
|
250 |
|
251 |
-
if ($tokens[$stackPtr]['code'] !== T_CLASS
|
252 |
&& $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS'
|
253 |
&& $tokens[$stackPtr]['type'] !== 'T_INTERFACE'
|
254 |
) {
|
@@ -260,15 +362,15 @@ class PHPCSHelper
|
|
260 |
}
|
261 |
|
262 |
$classCloserIndex = $tokens[$stackPtr]['scope_closer'];
|
263 |
-
$extendsIndex = $phpcsFile->findNext(T_EXTENDS, $stackPtr, $classCloserIndex);
|
264 |
if ($extendsIndex === false) {
|
265 |
return false;
|
266 |
}
|
267 |
|
268 |
$find = array(
|
269 |
-
T_NS_SEPARATOR,
|
270 |
-
T_STRING,
|
271 |
-
T_WHITESPACE,
|
272 |
);
|
273 |
|
274 |
$end = $phpcsFile->findNext($find, ($extendsIndex + 1), $classCloserIndex, true);
|
@@ -280,8 +382,7 @@ class PHPCSHelper
|
|
280 |
}
|
281 |
|
282 |
return $name;
|
283 |
-
|
284 |
-
}//end findExtendedClassName()
|
285 |
|
286 |
|
287 |
/**
|
@@ -294,14 +395,17 @@ class PHPCSHelper
|
|
294 |
* in PHPCS 2.8.0, so only defer to upstream for higher versions.
|
295 |
* Once the minimum supported PHPCS version for this sniff library goes beyond
|
296 |
* that, this method can be removed and calls to it replaced with
|
297 |
-
* `$phpcsFile->findImplementedInterfaceNames($stackPtr)` calls.}
|
|
|
|
|
|
|
298 |
*
|
299 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
300 |
* @param int $stackPtr The position of the class token.
|
301 |
*
|
302 |
* @return array|false
|
303 |
*/
|
304 |
-
public static function findImplementedInterfaceNames(
|
305 |
{
|
306 |
if (version_compare(self::getVersion(), '2.7.1', '>') === true) {
|
307 |
return $phpcsFile->findImplementedInterfaceNames($stackPtr);
|
@@ -314,7 +418,7 @@ class PHPCSHelper
|
|
314 |
return false;
|
315 |
}
|
316 |
|
317 |
-
if ($tokens[$stackPtr]['code'] !== T_CLASS
|
318 |
&& $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS'
|
319 |
) {
|
320 |
return false;
|
@@ -325,16 +429,16 @@ class PHPCSHelper
|
|
325 |
}
|
326 |
|
327 |
$classOpenerIndex = $tokens[$stackPtr]['scope_opener'];
|
328 |
-
$implementsIndex = $phpcsFile->findNext(T_IMPLEMENTS, $stackPtr, $classOpenerIndex);
|
329 |
if ($implementsIndex === false) {
|
330 |
return false;
|
331 |
}
|
332 |
|
333 |
$find = array(
|
334 |
-
T_NS_SEPARATOR,
|
335 |
-
T_STRING,
|
336 |
-
T_WHITESPACE,
|
337 |
-
T_COMMA,
|
338 |
);
|
339 |
|
340 |
$end = $phpcsFile->findNext($find, ($implementsIndex + 1), ($classOpenerIndex + 1), true);
|
@@ -348,8 +452,7 @@ class PHPCSHelper
|
|
348 |
$names = array_map('trim', $names);
|
349 |
return $names;
|
350 |
}
|
351 |
-
|
352 |
-
}//end findImplementedInterfaceNames()
|
353 |
|
354 |
|
355 |
/**
|
@@ -377,7 +480,10 @@ class PHPCSHelper
|
|
377 |
* {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File`
|
378 |
* class.
|
379 |
*
|
380 |
-
* Last synced with PHPCS version: PHPCS 3.3.0-alpha at commit 53a28408d345044c0360c2c1b4a2aaebf4a3b8c9}
|
|
|
|
|
|
|
381 |
*
|
382 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
383 |
* @param int $stackPtr The position in the stack of the
|
@@ -388,7 +494,7 @@ class PHPCSHelper
|
|
388 |
* @throws \PHP_CodeSniffer_Exception If the specified $stackPtr is not of
|
389 |
* type T_FUNCTION or T_CLOSURE.
|
390 |
*/
|
391 |
-
public static function getMethodParameters(
|
392 |
{
|
393 |
if (version_compare(self::getVersion(), '3.3.0', '>=') === true) {
|
394 |
return $phpcsFile->getMethodParameters($stackPtr);
|
@@ -401,10 +507,10 @@ class PHPCSHelper
|
|
401 |
return false;
|
402 |
}
|
403 |
|
404 |
-
if ($tokens[$stackPtr]['code'] !== T_FUNCTION
|
405 |
-
&& $tokens[$stackPtr]['code'] !== T_CLOSURE
|
406 |
) {
|
407 |
-
throw new
|
408 |
}
|
409 |
|
410 |
$opener = $tokens[$stackPtr]['parenthesis_opener'];
|
@@ -477,7 +583,7 @@ class PHPCSHelper
|
|
477 |
// also be a constant used as a default value.
|
478 |
$prevComma = false;
|
479 |
for ($t = $i; $t >= $opener; $t--) {
|
480 |
-
if ($tokens[$t]['code'] === T_COMMA) {
|
481 |
$prevComma = $t;
|
482 |
break;
|
483 |
}
|
@@ -486,7 +592,7 @@ class PHPCSHelper
|
|
486 |
if ($prevComma !== false) {
|
487 |
$nextEquals = false;
|
488 |
for ($t = $prevComma; $t < $i; $t++) {
|
489 |
-
if ($tokens[$t]['code'] === T_EQUAL) {
|
490 |
$nextEquals = $t;
|
491 |
break;
|
492 |
}
|
@@ -568,6 +674,5 @@ class PHPCSHelper
|
|
568 |
}//end for
|
569 |
|
570 |
return $vars;
|
571 |
-
|
572 |
-
}//end getMethodParameters()
|
573 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
namespace PHPCompatibility;
|
12 |
|
13 |
+
use PHP_CodeSniffer_Exception as PHPCS_Exception;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
+
|
17 |
/**
|
|
|
|
|
18 |
* PHPCS cross-version compatibility helper class.
|
19 |
*
|
20 |
* A number of PHPCS classes were split up into several classes in PHPCS 3.x
|
22 |
* This class provides helper methods for functions which were contained in
|
23 |
* one of these classes and which are used within the PHPCompatibility library.
|
24 |
*
|
25 |
+
* Additionally, this class contains some duplicates of PHPCS native methods.
|
26 |
+
* These methods have received bug fixes or improved functionality between the
|
27 |
+
* lowest supported PHPCS version and the latest PHPCS stable version and
|
28 |
+
* to provide the same results cross-version, PHPCompatibility needs to use
|
29 |
+
* the up-to-date versions of these methods.
|
30 |
+
*
|
31 |
+
* @since 8.0.0
|
32 |
+
* @since 8.2.0 The duplicate PHPCS methods have been moved from the `Sniff`
|
33 |
+
* base class to this class.
|
34 |
*/
|
35 |
class PHPCSHelper
|
36 |
{
|
38 |
/**
|
39 |
* Get the PHPCS version number.
|
40 |
*
|
41 |
+
* @since 8.0.0
|
42 |
+
*
|
43 |
* @return string
|
44 |
*/
|
45 |
public static function getVersion()
|
46 |
{
|
47 |
+
if (\defined('\PHP_CodeSniffer\Config::VERSION')) {
|
48 |
// PHPCS 3.x.
|
49 |
return \PHP_CodeSniffer\Config::VERSION;
|
50 |
} else {
|
51 |
+
// PHPCS 2.x.
|
52 |
return \PHP_CodeSniffer::VERSION;
|
53 |
}
|
54 |
}
|
59 |
*
|
60 |
* PHPCS cross-version compatibility helper.
|
61 |
*
|
62 |
+
* @since 8.0.0
|
63 |
+
*
|
64 |
* @param string $key The name of the config value.
|
65 |
* @param string|null $value The value to set. If null, the config entry
|
66 |
* is deleted, reverting it to the default value.
|
75 |
// PHPCS 3.x.
|
76 |
\PHP_CodeSniffer\Config::setConfigData($key, $value, $temp);
|
77 |
} else {
|
78 |
+
// PHPCS 2.x.
|
79 |
\PHP_CodeSniffer::setConfigData($key, $value, $temp);
|
80 |
}
|
81 |
}
|
84 |
/**
|
85 |
* Get the value of a single PHPCS config key.
|
86 |
*
|
87 |
+
* @since 8.0.0
|
88 |
+
*
|
89 |
* @param string $key The name of the config value.
|
90 |
*
|
91 |
* @return string|null
|
96 |
// PHPCS 3.x.
|
97 |
return \PHP_CodeSniffer\Config::getConfigData($key);
|
98 |
} else {
|
99 |
+
// PHPCS 2.x.
|
100 |
return \PHP_CodeSniffer::getConfigData($key);
|
101 |
}
|
102 |
}
|
108 |
* This config key can be set in the `CodeSniffer.conf` file, on the
|
109 |
* command-line or in a ruleset.
|
110 |
*
|
111 |
+
* @since 8.2.0
|
112 |
+
*
|
113 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
114 |
* @param string $key The name of the config value.
|
115 |
*
|
116 |
* @return string|null
|
117 |
*/
|
118 |
+
public static function getCommandLineData(File $phpcsFile, $key)
|
119 |
{
|
120 |
+
if (class_exists('\PHP_CodeSniffer\Config')) {
|
121 |
// PHPCS 3.x.
|
122 |
$config = $phpcsFile->config;
|
123 |
if (isset($config->{$key})) {
|
124 |
return $config->{$key};
|
125 |
}
|
126 |
} else {
|
127 |
+
// PHPCS 2.x.
|
128 |
$config = $phpcsFile->phpcs->cli->getCommandLineValues();
|
129 |
if (isset($config[$key])) {
|
130 |
return $config[$key];
|
135 |
}
|
136 |
|
137 |
|
138 |
+
/**
|
139 |
+
* Returns the position of the first non-whitespace token in a statement.
|
140 |
+
*
|
141 |
+
* {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File`
|
142 |
+
* class and introduced in PHPCS 2.1.0 and improved in PHPCS 2.7.1.
|
143 |
+
*
|
144 |
+
* Once the minimum supported PHPCS version for this standard goes beyond
|
145 |
+
* that, this method can be removed and calls to it replaced with
|
146 |
+
* `$phpcsFile->findStartOfStatement($start, $ignore)` calls.
|
147 |
+
*
|
148 |
+
* Last synced with PHPCS version: PHPCS 3.3.2 at commit 6ad28354c04b364c3c71a34e4a18b629cc3b231e}
|
149 |
+
*
|
150 |
+
* @since 9.1.0
|
151 |
+
*
|
152 |
+
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
153 |
+
* @param int $start The position to start searching from in the token stack.
|
154 |
+
* @param int|array $ignore Token types that should not be considered stop points.
|
155 |
+
*
|
156 |
+
* @return int
|
157 |
+
*/
|
158 |
+
public static function findStartOfStatement(File $phpcsFile, $start, $ignore = null)
|
159 |
+
{
|
160 |
+
if (version_compare(self::getVersion(), '2.7.1', '>=') === true) {
|
161 |
+
return $phpcsFile->findStartOfStatement($start, $ignore);
|
162 |
+
}
|
163 |
+
|
164 |
+
$tokens = $phpcsFile->getTokens();
|
165 |
+
$endTokens = Tokens::$blockOpeners;
|
166 |
+
|
167 |
+
$endTokens[\T_COLON] = true;
|
168 |
+
$endTokens[\T_COMMA] = true;
|
169 |
+
$endTokens[\T_DOUBLE_ARROW] = true;
|
170 |
+
$endTokens[\T_SEMICOLON] = true;
|
171 |
+
$endTokens[\T_OPEN_TAG] = true;
|
172 |
+
$endTokens[\T_CLOSE_TAG] = true;
|
173 |
+
$endTokens[\T_OPEN_SHORT_ARRAY] = true;
|
174 |
+
|
175 |
+
if ($ignore !== null) {
|
176 |
+
$ignore = (array) $ignore;
|
177 |
+
foreach ($ignore as $code) {
|
178 |
+
if (isset($endTokens[$code]) === true) {
|
179 |
+
unset($endTokens[$code]);
|
180 |
+
}
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
$lastNotEmpty = $start;
|
185 |
+
|
186 |
+
for ($i = $start; $i >= 0; $i--) {
|
187 |
+
if (isset($endTokens[$tokens[$i]['code']]) === true) {
|
188 |
+
// Found the end of the previous statement.
|
189 |
+
return $lastNotEmpty;
|
190 |
+
}
|
191 |
+
|
192 |
+
if (isset($tokens[$i]['scope_opener']) === true
|
193 |
+
&& $i === $tokens[$i]['scope_closer']
|
194 |
+
) {
|
195 |
+
// Found the end of the previous scope block.
|
196 |
+
return $lastNotEmpty;
|
197 |
+
}
|
198 |
+
|
199 |
+
// Skip nested statements.
|
200 |
+
if (isset($tokens[$i]['bracket_opener']) === true
|
201 |
+
&& $i === $tokens[$i]['bracket_closer']
|
202 |
+
) {
|
203 |
+
$i = $tokens[$i]['bracket_opener'];
|
204 |
+
} elseif (isset($tokens[$i]['parenthesis_opener']) === true
|
205 |
+
&& $i === $tokens[$i]['parenthesis_closer']
|
206 |
+
) {
|
207 |
+
$i = $tokens[$i]['parenthesis_opener'];
|
208 |
+
}
|
209 |
+
|
210 |
+
if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === false) {
|
211 |
+
$lastNotEmpty = $i;
|
212 |
+
}
|
213 |
+
}//end for
|
214 |
+
|
215 |
+
return 0;
|
216 |
+
}
|
217 |
+
|
218 |
+
|
219 |
/**
|
220 |
* Returns the position of the last non-whitespace token in a statement.
|
221 |
*
|
222 |
* {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File`
|
223 |
+
* class and introduced in PHPCS 2.1.0 and improved in PHPCS 2.7.1 and 3.3.0.
|
224 |
*
|
225 |
* Once the minimum supported PHPCS version for this standard goes beyond
|
226 |
* that, this method can be removed and calls to it replaced with
|
227 |
* `$phpcsFile->findEndOfStatement($start, $ignore)` calls.
|
228 |
*
|
229 |
+
* Last synced with PHPCS version: PHPCS 3.3.0-alpha at commit f5d899dcb5c534a1c3cca34668624517856ba823}
|
230 |
+
*
|
231 |
+
* @since 8.2.0
|
232 |
*
|
233 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
234 |
* @param int $start The position to start searching from in the token stack.
|
236 |
*
|
237 |
* @return int
|
238 |
*/
|
239 |
+
public static function findEndOfStatement(File $phpcsFile, $start, $ignore = null)
|
240 |
{
|
241 |
if (version_compare(self::getVersion(), '3.3.0', '>=') === true) {
|
242 |
return $phpcsFile->findEndOfStatement($start, $ignore);
|
244 |
|
245 |
$tokens = $phpcsFile->getTokens();
|
246 |
$endTokens = array(
|
247 |
+
\T_COLON => true,
|
248 |
+
\T_COMMA => true,
|
249 |
+
\T_DOUBLE_ARROW => true,
|
250 |
+
\T_SEMICOLON => true,
|
251 |
+
\T_CLOSE_PARENTHESIS => true,
|
252 |
+
\T_CLOSE_SQUARE_BRACKET => true,
|
253 |
+
\T_CLOSE_CURLY_BRACKET => true,
|
254 |
+
\T_CLOSE_SHORT_ARRAY => true,
|
255 |
+
\T_OPEN_TAG => true,
|
256 |
+
\T_CLOSE_TAG => true,
|
257 |
);
|
258 |
|
259 |
if ($ignore !== null) {
|
270 |
for ($i = $start; $i < $phpcsFile->numTokens; $i++) {
|
271 |
if ($i !== $start && isset($endTokens[$tokens[$i]['code']]) === true) {
|
272 |
// Found the end of the statement.
|
273 |
+
if ($tokens[$i]['code'] === \T_CLOSE_PARENTHESIS
|
274 |
+
|| $tokens[$i]['code'] === \T_CLOSE_SQUARE_BRACKET
|
275 |
+
|| $tokens[$i]['code'] === \T_CLOSE_CURLY_BRACKET
|
276 |
+
|| $tokens[$i]['code'] === \T_CLOSE_SHORT_ARRAY
|
277 |
+
|| $tokens[$i]['code'] === \T_OPEN_TAG
|
278 |
+
|| $tokens[$i]['code'] === \T_CLOSE_TAG
|
279 |
) {
|
280 |
return $lastNotEmpty;
|
281 |
}
|
288 |
&& ($i === $tokens[$i]['scope_opener']
|
289 |
|| $i === $tokens[$i]['scope_condition'])
|
290 |
) {
|
291 |
+
if ($i === $start && isset(Tokens::$scopeOpeners[$tokens[$i]['code']]) === true) {
|
292 |
return $tokens[$i]['scope_closer'];
|
293 |
}
|
294 |
|
303 |
$i = $tokens[$i]['parenthesis_closer'];
|
304 |
}
|
305 |
|
306 |
+
if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === false) {
|
307 |
$lastNotEmpty = $i;
|
308 |
}
|
309 |
}//end for
|
310 |
|
311 |
return ($phpcsFile->numTokens - 1);
|
312 |
+
}
|
|
|
313 |
|
314 |
|
315 |
/**
|
327 |
* that, this method can be removed and calls to it replaced with
|
328 |
* `$phpcsFile->findExtendedClassName($stackPtr)` calls.
|
329 |
*
|
330 |
+
* Last synced with PHPCS version: PHPCS 3.1.0-alpha at commit a9efcc9b0703f3f9f4a900623d4e97128a6aafc6}
|
331 |
+
*
|
332 |
+
* @since 7.1.4
|
333 |
+
* @since 8.2.0 Moved from the `Sniff` class to this class.
|
334 |
*
|
335 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
336 |
* @param int $stackPtr The position of the class token in the stack.
|
337 |
*
|
338 |
* @return string|false
|
339 |
*/
|
340 |
+
public static function findExtendedClassName(File $phpcsFile, $stackPtr)
|
341 |
{
|
342 |
if (version_compare(self::getVersion(), '3.1.0', '>=') === true) {
|
343 |
return $phpcsFile->findExtendedClassName($stackPtr);
|
350 |
return false;
|
351 |
}
|
352 |
|
353 |
+
if ($tokens[$stackPtr]['code'] !== \T_CLASS
|
354 |
&& $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS'
|
355 |
&& $tokens[$stackPtr]['type'] !== 'T_INTERFACE'
|
356 |
) {
|
362 |
}
|
363 |
|
364 |
$classCloserIndex = $tokens[$stackPtr]['scope_closer'];
|
365 |
+
$extendsIndex = $phpcsFile->findNext(\T_EXTENDS, $stackPtr, $classCloserIndex);
|
366 |
if ($extendsIndex === false) {
|
367 |
return false;
|
368 |
}
|
369 |
|
370 |
$find = array(
|
371 |
+
\T_NS_SEPARATOR,
|
372 |
+
\T_STRING,
|
373 |
+
\T_WHITESPACE,
|
374 |
);
|
375 |
|
376 |
$end = $phpcsFile->findNext($find, ($extendsIndex + 1), $classCloserIndex, true);
|
382 |
}
|
383 |
|
384 |
return $name;
|
385 |
+
}
|
|
|
386 |
|
387 |
|
388 |
/**
|
395 |
* in PHPCS 2.8.0, so only defer to upstream for higher versions.
|
396 |
* Once the minimum supported PHPCS version for this sniff library goes beyond
|
397 |
* that, this method can be removed and calls to it replaced with
|
398 |
+
* `$phpcsFile->findImplementedInterfaceNames($stackPtr)` calls.}
|
399 |
+
*
|
400 |
+
* @since 7.0.3
|
401 |
+
* @since 8.2.0 Moved from the `Sniff` class to this class.
|
402 |
*
|
403 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
404 |
* @param int $stackPtr The position of the class token.
|
405 |
*
|
406 |
* @return array|false
|
407 |
*/
|
408 |
+
public static function findImplementedInterfaceNames(File $phpcsFile, $stackPtr)
|
409 |
{
|
410 |
if (version_compare(self::getVersion(), '2.7.1', '>') === true) {
|
411 |
return $phpcsFile->findImplementedInterfaceNames($stackPtr);
|
418 |
return false;
|
419 |
}
|
420 |
|
421 |
+
if ($tokens[$stackPtr]['code'] !== \T_CLASS
|
422 |
&& $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS'
|
423 |
) {
|
424 |
return false;
|
429 |
}
|
430 |
|
431 |
$classOpenerIndex = $tokens[$stackPtr]['scope_opener'];
|
432 |
+
$implementsIndex = $phpcsFile->findNext(\T_IMPLEMENTS, $stackPtr, $classOpenerIndex);
|
433 |
if ($implementsIndex === false) {
|
434 |
return false;
|
435 |
}
|
436 |
|
437 |
$find = array(
|
438 |
+
\T_NS_SEPARATOR,
|
439 |
+
\T_STRING,
|
440 |
+
\T_WHITESPACE,
|
441 |
+
\T_COMMA,
|
442 |
);
|
443 |
|
444 |
$end = $phpcsFile->findNext($find, ($implementsIndex + 1), ($classOpenerIndex + 1), true);
|
452 |
$names = array_map('trim', $names);
|
453 |
return $names;
|
454 |
}
|
455 |
+
}
|
|
|
456 |
|
457 |
|
458 |
/**
|
480 |
* {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File`
|
481 |
* class.
|
482 |
*
|
483 |
+
* Last synced with PHPCS version: PHPCS 3.3.0-alpha at commit 53a28408d345044c0360c2c1b4a2aaebf4a3b8c9}
|
484 |
+
*
|
485 |
+
* @since 7.0.3
|
486 |
+
* @since 8.2.0 Moved from the `Sniff` class to this class.
|
487 |
*
|
488 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
489 |
* @param int $stackPtr The position in the stack of the
|
494 |
* @throws \PHP_CodeSniffer_Exception If the specified $stackPtr is not of
|
495 |
* type T_FUNCTION or T_CLOSURE.
|
496 |
*/
|
497 |
+
public static function getMethodParameters(File $phpcsFile, $stackPtr)
|
498 |
{
|
499 |
if (version_compare(self::getVersion(), '3.3.0', '>=') === true) {
|
500 |
return $phpcsFile->getMethodParameters($stackPtr);
|
507 |
return false;
|
508 |
}
|
509 |
|
510 |
+
if ($tokens[$stackPtr]['code'] !== \T_FUNCTION
|
511 |
+
&& $tokens[$stackPtr]['code'] !== \T_CLOSURE
|
512 |
) {
|
513 |
+
throw new PHPCS_Exception('$stackPtr must be of type T_FUNCTION or T_CLOSURE');
|
514 |
}
|
515 |
|
516 |
$opener = $tokens[$stackPtr]['parenthesis_opener'];
|
583 |
// also be a constant used as a default value.
|
584 |
$prevComma = false;
|
585 |
for ($t = $i; $t >= $opener; $t--) {
|
586 |
+
if ($tokens[$t]['code'] === \T_COMMA) {
|
587 |
$prevComma = $t;
|
588 |
break;
|
589 |
}
|
592 |
if ($prevComma !== false) {
|
593 |
$nextEquals = false;
|
594 |
for ($t = $prevComma; $t < $i; $t++) {
|
595 |
+
if ($tokens[$t]['code'] === \T_EQUAL) {
|
596 |
$nextEquals = $t;
|
597 |
break;
|
598 |
}
|
674 |
}//end for
|
675 |
|
676 |
return $vars;
|
677 |
+
}
|
|
|
678 |
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniff.php
CHANGED
@@ -1,47 +1,61 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @category PHP
|
6 |
* @package PHPCompatibility
|
7 |
-
* @
|
8 |
-
* @
|
|
|
9 |
*/
|
10 |
|
11 |
namespace PHPCompatibility;
|
12 |
|
13 |
use PHPCompatibility\PHPCSHelper;
|
|
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
-
*
|
17 |
*
|
18 |
-
* @
|
19 |
-
* @package PHPCompatibility
|
20 |
-
* @author Wim Godden <wim.godden@cu.be>
|
21 |
-
* @copyright 2014 Cu.be Solutions bvba
|
22 |
*/
|
23 |
-
abstract class Sniff implements
|
24 |
{
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
const REGEX_COMPLEX_VARS = '`(?:(\{)?(?<!\\\\)\$)?(\{)?(?<!\\\\)\$(\{)?(?P<varname>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)(?:->\$?(?P>varname)|\[[^\]]+\]|::\$?(?P>varname)|\([^\)]*\))*(?(3)\}|)(?(2)\}|)(?(1)\}|)`';
|
27 |
|
28 |
/**
|
29 |
* List of superglobals as an array of strings.
|
30 |
*
|
31 |
-
* Used by the
|
|
|
|
|
|
|
32 |
*
|
33 |
* @var array
|
34 |
*/
|
35 |
protected $superglobals = array(
|
36 |
-
'$GLOBALS',
|
37 |
-
'$_SERVER',
|
38 |
-
'$_GET',
|
39 |
-
'$_POST',
|
40 |
-
'$_FILES',
|
41 |
-
'$_COOKIE',
|
42 |
-
'$_SESSION',
|
43 |
-
'$_REQUEST',
|
44 |
-
'$_ENV',
|
45 |
);
|
46 |
|
47 |
/**
|
@@ -50,6 +64,9 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
50 |
* Used by the new/removed hash algorithm sniffs.
|
51 |
* Key is the function name, value is the 1-based parameter position in the function call.
|
52 |
*
|
|
|
|
|
|
|
53 |
* @var array
|
54 |
*/
|
55 |
protected $hashAlgoFunctions = array(
|
@@ -68,6 +85,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
68 |
* Used by the new/removed ini directives sniffs.
|
69 |
* Key is the function name, value is the 1-based parameter position in the function call.
|
70 |
*
|
|
|
|
|
71 |
* @var array
|
72 |
*/
|
73 |
protected $iniFunctions = array(
|
@@ -94,6 +113,9 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
94 |
* PHP version numbers should always be in Major.Minor format. Both "5", "5.3.2"
|
95 |
* would be treated as invalid, and ignored.
|
96 |
*
|
|
|
|
|
|
|
97 |
* @return array $arrTestVersions will hold an array containing min/max version
|
98 |
* of PHP that we are checking against (see above). If only a
|
99 |
* single version number is specified, then this is used as
|
@@ -132,7 +154,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
132 |
if (version_compare($min, $max, '>')) {
|
133 |
trigger_error(
|
134 |
"Invalid range in testVersion setting: '" . $testVersion . "'",
|
135 |
-
E_USER_WARNING
|
136 |
);
|
137 |
return $default;
|
138 |
} else {
|
@@ -144,7 +166,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
144 |
|
145 |
trigger_error(
|
146 |
"Invalid testVersion setting: '" . $testVersion . "'",
|
147 |
-
E_USER_WARNING
|
148 |
);
|
149 |
return $default;
|
150 |
}
|
@@ -163,6 +185,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
163 |
*
|
164 |
* Should be used when sniffing for *old* PHP features (deprecated/removed).
|
165 |
*
|
|
|
|
|
166 |
* @param string $phpVersion A PHP version number in 'major.minor' format.
|
167 |
*
|
168 |
* @return bool True if testVersion has not been provided or if the PHP version
|
@@ -174,14 +198,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
174 |
$testVersion = $this->getTestVersion();
|
175 |
$testVersion = $testVersion[1];
|
176 |
|
177 |
-
if (is_null($testVersion)
|
178 |
|| version_compare($testVersion, $phpVersion) >= 0
|
179 |
) {
|
180 |
return true;
|
181 |
} else {
|
182 |
return false;
|
183 |
}
|
184 |
-
}
|
185 |
|
186 |
|
187 |
/**
|
@@ -190,6 +214,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
190 |
*
|
191 |
* Should be used when sniffing for *new* PHP features.
|
192 |
*
|
|
|
|
|
193 |
* @param string $phpVersion A PHP version number in 'major.minor' format.
|
194 |
*
|
195 |
* @return bool True if the PHP version is equal to or lower than the lowest
|
@@ -201,19 +227,21 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
201 |
$testVersion = $this->getTestVersion();
|
202 |
$testVersion = $testVersion[0];
|
203 |
|
204 |
-
if (is_null($testVersion) === false
|
205 |
&& version_compare($testVersion, $phpVersion) <= 0
|
206 |
) {
|
207 |
return true;
|
208 |
} else {
|
209 |
return false;
|
210 |
}
|
211 |
-
}
|
212 |
|
213 |
|
214 |
/**
|
215 |
* Add a PHPCS message to the output stack as either a warning or an error.
|
216 |
*
|
|
|
|
|
217 |
* @param \PHP_CodeSniffer_File $phpcsFile The file the message applies to.
|
218 |
* @param string $message The message.
|
219 |
* @param int $stackPtr The position of the token
|
@@ -227,7 +255,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
227 |
*
|
228 |
* @return void
|
229 |
*/
|
230 |
-
public function addMessage(
|
231 |
{
|
232 |
if ($isError === true) {
|
233 |
$phpcsFile->addError($message, $stackPtr, $code, $data);
|
@@ -242,6 +270,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
242 |
*
|
243 |
* Pre-empt issues with arbitrary strings being used as error codes in XML and PHP.
|
244 |
*
|
|
|
|
|
245 |
* @param string $baseString Arbitrary string.
|
246 |
*
|
247 |
* @return string
|
@@ -257,6 +287,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
257 |
*
|
258 |
* Intended for use with the contents of a T_CONSTANT_ENCAPSED_STRING / T_DOUBLE_QUOTED_STRING.
|
259 |
*
|
|
|
|
|
260 |
* @param string $string The raw string.
|
261 |
*
|
262 |
* @return string String without quotes around it.
|
@@ -272,6 +304,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
272 |
*
|
273 |
* Intended for use with the contents of a T_DOUBLE_QUOTED_STRING.
|
274 |
*
|
|
|
|
|
275 |
* @param string $string The raw string.
|
276 |
*
|
277 |
* @return string String without variables in it.
|
@@ -289,22 +323,22 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
289 |
/**
|
290 |
* Make all top level array keys in an array lowercase.
|
291 |
*
|
|
|
|
|
292 |
* @param array $array Initial array.
|
293 |
*
|
294 |
* @return array Same array, but with all lowercase top level keys.
|
295 |
*/
|
296 |
public function arrayKeysToLowercase($array)
|
297 |
{
|
298 |
-
|
299 |
-
$keys = array_map('strtolower', $keys);
|
300 |
-
return array_combine($keys, $array);
|
301 |
}
|
302 |
|
303 |
|
304 |
/**
|
305 |
* Checks if a function call has parameters.
|
306 |
*
|
307 |
-
* Expects to be passed the T_STRING stack pointer for the function call.
|
308 |
* If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
|
309 |
*
|
310 |
* Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer, it
|
@@ -313,12 +347,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
313 |
* @link https://github.com/PHPCompatibility/PHPCompatibility/issues/120
|
314 |
* @link https://github.com/PHPCompatibility/PHPCompatibility/issues/152
|
315 |
*
|
|
|
|
|
316 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
317 |
* @param int $stackPtr The position of the function call token.
|
318 |
*
|
319 |
* @return bool
|
320 |
*/
|
321 |
-
public function doesFunctionCallHaveParameters(
|
322 |
{
|
323 |
$tokens = $phpcsFile->getTokens();
|
324 |
|
@@ -328,14 +364,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
328 |
}
|
329 |
|
330 |
// Is this one of the tokens this function handles ?
|
331 |
-
if (in_array($tokens[$stackPtr]['code'], array(T_STRING, T_ARRAY, T_OPEN_SHORT_ARRAY), true) === false) {
|
332 |
return false;
|
333 |
}
|
334 |
|
335 |
-
$nextNonEmpty = $phpcsFile->findNext(
|
336 |
|
337 |
// Deal with short array syntax.
|
338 |
-
if ($tokens[$stackPtr]['code'] === T_OPEN_SHORT_ARRAY) {
|
339 |
if (isset($tokens[$stackPtr]['bracket_closer']) === false) {
|
340 |
return false;
|
341 |
}
|
@@ -350,7 +386,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
350 |
|
351 |
// Deal with function calls & long arrays.
|
352 |
// Next non-empty token should be the open parenthesis.
|
353 |
-
if ($nextNonEmpty === false && $tokens[$nextNonEmpty]['code'] !== T_OPEN_PARENTHESIS) {
|
354 |
return false;
|
355 |
}
|
356 |
|
@@ -359,7 +395,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
359 |
}
|
360 |
|
361 |
$closeParenthesis = $tokens[$nextNonEmpty]['parenthesis_closer'];
|
362 |
-
$nextNextNonEmpty = $phpcsFile->findNext(
|
363 |
|
364 |
if ($nextNextNonEmpty === $closeParenthesis) {
|
365 |
// No parameters.
|
@@ -373,7 +409,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
373 |
/**
|
374 |
* Count the number of parameters a function call has been passed.
|
375 |
*
|
376 |
-
* Expects to be passed the T_STRING stack pointer for the function call.
|
377 |
* If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
|
378 |
*
|
379 |
* Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer,
|
@@ -383,25 +419,27 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
383 |
* @link https://github.com/PHPCompatibility/PHPCompatibility/issues/114
|
384 |
* @link https://github.com/PHPCompatibility/PHPCompatibility/issues/151
|
385 |
*
|
|
|
|
|
386 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
387 |
* @param int $stackPtr The position of the function call token.
|
388 |
*
|
389 |
* @return int
|
390 |
*/
|
391 |
-
public function getFunctionCallParameterCount(
|
392 |
{
|
393 |
if ($this->doesFunctionCallHaveParameters($phpcsFile, $stackPtr) === false) {
|
394 |
return 0;
|
395 |
}
|
396 |
|
397 |
-
return count($this->getFunctionCallParameters($phpcsFile, $stackPtr));
|
398 |
}
|
399 |
|
400 |
|
401 |
/**
|
402 |
* Get information on all parameters passed to a function call.
|
403 |
*
|
404 |
-
* Expects to be passed the T_STRING stack pointer for the function call.
|
405 |
* If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
|
406 |
*
|
407 |
* Will return an multi-dimentional array with the start token pointer, end token
|
@@ -411,30 +449,32 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
411 |
* Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer,
|
412 |
* it will tokenize the values / key/value pairs contained in the array call.
|
413 |
*
|
|
|
|
|
414 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
415 |
* @param int $stackPtr The position of the function call token.
|
416 |
*
|
417 |
* @return array
|
418 |
*/
|
419 |
-
public function getFunctionCallParameters(
|
420 |
{
|
421 |
if ($this->doesFunctionCallHaveParameters($phpcsFile, $stackPtr) === false) {
|
422 |
return array();
|
423 |
}
|
424 |
|
425 |
-
// Ok, we know we have a T_STRING, T_ARRAY or T_OPEN_SHORT_ARRAY with parameters
|
426 |
// and valid open & close brackets/parenthesis.
|
427 |
$tokens = $phpcsFile->getTokens();
|
428 |
|
429 |
// Mark the beginning and end tokens.
|
430 |
-
if ($tokens[$stackPtr]['code'] === T_OPEN_SHORT_ARRAY) {
|
431 |
$opener = $stackPtr;
|
432 |
$closer = $tokens[$stackPtr]['bracket_closer'];
|
433 |
|
434 |
$nestedParenthesisCount = 0;
|
435 |
|
436 |
} else {
|
437 |
-
$opener = $phpcsFile->findNext(
|
438 |
$closer = $tokens[$opener]['parenthesis_closer'];
|
439 |
|
440 |
$nestedParenthesisCount = 1;
|
@@ -442,14 +482,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
442 |
|
443 |
// Which nesting level is the one we are interested in ?
|
444 |
if (isset($tokens[$opener]['nested_parenthesis'])) {
|
445 |
-
$nestedParenthesisCount += count($tokens[$opener]['nested_parenthesis']);
|
446 |
}
|
447 |
|
448 |
$parameters = array();
|
449 |
$nextComma = $opener;
|
450 |
$paramStart = $opener + 1;
|
451 |
$cnt = 1;
|
452 |
-
while (($nextComma = $phpcsFile->findNext(array(T_COMMA, $tokens[$closer]['code'], T_OPEN_SHORT_ARRAY, T_CLOSURE), $nextComma + 1, $closer + 1)) !== false) {
|
453 |
// Ignore anything within short array definition brackets.
|
454 |
if ($tokens[$nextComma]['type'] === 'T_OPEN_SHORT_ARRAY'
|
455 |
&& (isset($tokens[$nextComma]['bracket_opener'])
|
@@ -475,7 +515,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
475 |
// Ignore comma's at a lower nesting level.
|
476 |
if ($tokens[$nextComma]['type'] === 'T_COMMA'
|
477 |
&& isset($tokens[$nextComma]['nested_parenthesis'])
|
478 |
-
&& count($tokens[$nextComma]['nested_parenthesis']) !== $nestedParenthesisCount
|
479 |
) {
|
480 |
continue;
|
481 |
}
|
@@ -490,10 +530,12 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
490 |
$parameters[$cnt]['end'] = $nextComma - 1;
|
491 |
$parameters[$cnt]['raw'] = trim($phpcsFile->getTokensAsString($paramStart, ($nextComma - $paramStart)));
|
492 |
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
|
|
|
|
497 |
if ($hasNextParam === false) {
|
498 |
break;
|
499 |
}
|
@@ -510,20 +552,22 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
510 |
/**
|
511 |
* Get information on a specific parameter passed to a function call.
|
512 |
*
|
513 |
-
* Expects to be passed the T_STRING stack pointer for the function call.
|
514 |
* If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
|
515 |
*
|
516 |
* Will return a array with the start token pointer, end token pointer and the raw value
|
517 |
* of the parameter at a specific offset.
|
518 |
* If the specified parameter is not found, will return false.
|
519 |
*
|
|
|
|
|
520 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
521 |
* @param int $stackPtr The position of the function call token.
|
522 |
* @param int $paramOffset The 1-based index position of the parameter to retrieve.
|
523 |
*
|
524 |
* @return array|false
|
525 |
*/
|
526 |
-
public function getFunctionCallParameter(
|
527 |
{
|
528 |
$parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr);
|
529 |
|
@@ -542,6 +586,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
542 |
* will check that the token has at least one condition which is of a
|
543 |
* type defined in $validScopes.
|
544 |
*
|
|
|
|
|
545 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
546 |
* @param int $stackPtr The position of the token.
|
547 |
* @param array|int $validScopes Optional. Array of valid scopes
|
@@ -553,7 +599,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
553 |
* If the $scopeTypes are set: True if *one* of the conditions is a
|
554 |
* valid scope, false otherwise.
|
555 |
*/
|
556 |
-
public function tokenHasScope(
|
557 |
{
|
558 |
$tokens = $phpcsFile->getTokens();
|
559 |
|
@@ -579,6 +625,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
579 |
/**
|
580 |
* Verify whether a token is within a class scope.
|
581 |
*
|
|
|
|
|
582 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
583 |
* @param int $stackPtr The position of the token.
|
584 |
* @param bool $strict Whether to strictly check for the T_CLASS
|
@@ -587,84 +635,35 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
587 |
*
|
588 |
* @return bool True if within class scope, false otherwise.
|
589 |
*/
|
590 |
-
public function inClassScope(
|
591 |
{
|
592 |
-
$validScopes = array(T_CLASS);
|
593 |
-
if (defined('T_ANON_CLASS') === true) {
|
594 |
-
$validScopes[] = T_ANON_CLASS;
|
595 |
}
|
596 |
|
597 |
if ($strict === false) {
|
598 |
-
$validScopes[] = T_INTERFACE;
|
599 |
-
|
600 |
-
if (defined('T_TRAIT')) {
|
601 |
-
// phpcs:ignore PHPCompatibility.PHP.NewConstants.t_traitFound
|
602 |
-
$validScopes[] = T_TRAIT;
|
603 |
-
}
|
604 |
}
|
605 |
|
606 |
return $phpcsFile->hasCondition($stackPtr, $validScopes);
|
607 |
}
|
608 |
|
609 |
|
610 |
-
/**
|
611 |
-
* Verify whether a token is within a scoped use statement.
|
612 |
-
*
|
613 |
-
* PHPCS cross-version compatibility method.
|
614 |
-
*
|
615 |
-
* In PHPCS 1.x no conditions are set for a scoped use statement.
|
616 |
-
* This method works around that limitation.
|
617 |
-
*
|
618 |
-
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
619 |
-
* @param int $stackPtr The position of the token.
|
620 |
-
*
|
621 |
-
* @return bool True if within use scope, false otherwise.
|
622 |
-
*/
|
623 |
-
public function inUseScope(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
624 |
-
{
|
625 |
-
static $isLowPHPCS, $ignoreTokens;
|
626 |
-
|
627 |
-
if (isset($isLowPHPCS) === false) {
|
628 |
-
$isLowPHPCS = version_compare(PHPCSHelper::getVersion(), '2.3.0', '<');
|
629 |
-
}
|
630 |
-
if (isset($ignoreTokens) === false) {
|
631 |
-
$ignoreTokens = \PHP_CodeSniffer_Tokens::$emptyTokens;
|
632 |
-
$ignoreTokens[T_STRING] = T_STRING;
|
633 |
-
$ignoreTokens[T_AS] = T_AS;
|
634 |
-
$ignoreTokens[T_PUBLIC] = T_PUBLIC;
|
635 |
-
$ignoreTokens[T_PROTECTED] = T_PROTECTED;
|
636 |
-
$ignoreTokens[T_PRIVATE] = T_PRIVATE;
|
637 |
-
}
|
638 |
-
|
639 |
-
// PHPCS 2.0.
|
640 |
-
if ($isLowPHPCS === false) {
|
641 |
-
return $phpcsFile->hasCondition($stackPtr, T_USE);
|
642 |
-
} else {
|
643 |
-
// PHPCS 1.x.
|
644 |
-
$tokens = $phpcsFile->getTokens();
|
645 |
-
$maybeCurlyOpen = $phpcsFile->findPrevious($ignoreTokens, ($stackPtr - 1), null, true);
|
646 |
-
if ($tokens[$maybeCurlyOpen]['code'] === T_OPEN_CURLY_BRACKET) {
|
647 |
-
$maybeUseStatement = $phpcsFile->findPrevious($ignoreTokens, ($maybeCurlyOpen - 1), null, true);
|
648 |
-
if ($tokens[$maybeUseStatement]['code'] === T_USE) {
|
649 |
-
return true;
|
650 |
-
}
|
651 |
-
}
|
652 |
-
return false;
|
653 |
-
}
|
654 |
-
}
|
655 |
-
|
656 |
-
|
657 |
/**
|
658 |
* Returns the fully qualified class name for a new class instantiation.
|
659 |
*
|
660 |
* Returns an empty string if the class name could not be reliably inferred.
|
661 |
*
|
|
|
|
|
662 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
663 |
* @param int $stackPtr The position of a T_NEW token.
|
664 |
*
|
665 |
* @return string
|
666 |
*/
|
667 |
-
public function getFQClassNameFromNewToken(
|
668 |
{
|
669 |
$tokens = $phpcsFile->getTokens();
|
670 |
|
@@ -673,30 +672,30 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
673 |
return '';
|
674 |
}
|
675 |
|
676 |
-
if ($tokens[$stackPtr]['code'] !== T_NEW) {
|
677 |
return '';
|
678 |
}
|
679 |
|
680 |
-
$start = $phpcsFile->findNext(
|
681 |
if ($start === false) {
|
682 |
return '';
|
683 |
}
|
684 |
|
685 |
// Bow out if the next token is a variable as we don't know where it was defined.
|
686 |
-
if ($tokens[$start]['code'] === T_VARIABLE) {
|
687 |
return '';
|
688 |
}
|
689 |
|
690 |
// Bow out if the next token is the class keyword.
|
691 |
-
if ($tokens[$start]['type'] === 'T_ANON_CLASS' || $tokens[$start]['code'] === T_CLASS) {
|
692 |
return '';
|
693 |
}
|
694 |
|
695 |
$find = array(
|
696 |
-
T_NS_SEPARATOR,
|
697 |
-
T_STRING,
|
698 |
-
T_NAMESPACE,
|
699 |
-
T_WHITESPACE,
|
700 |
);
|
701 |
|
702 |
$end = $phpcsFile->findNext($find, ($start + 1), null, true, null, true);
|
@@ -713,12 +712,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
713 |
* Returns an empty string if the class does not extend another class or if
|
714 |
* the class name could not be reliably inferred.
|
715 |
*
|
|
|
|
|
716 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
717 |
* @param int $stackPtr The position of a T_CLASS token.
|
718 |
*
|
719 |
* @return string
|
720 |
*/
|
721 |
-
public function getFQExtendedClassName(
|
722 |
{
|
723 |
$tokens = $phpcsFile->getTokens();
|
724 |
|
@@ -727,7 +728,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
727 |
return '';
|
728 |
}
|
729 |
|
730 |
-
if ($tokens[$stackPtr]['code'] !== T_CLASS
|
731 |
&& $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS'
|
732 |
&& $tokens[$stackPtr]['type'] !== 'T_INTERFACE'
|
733 |
) {
|
@@ -735,7 +736,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
735 |
}
|
736 |
|
737 |
$extends = PHPCSHelper::findExtendedClassName($phpcsFile, $stackPtr);
|
738 |
-
if (empty($extends) || is_string($extends) === false) {
|
739 |
return '';
|
740 |
}
|
741 |
|
@@ -749,12 +750,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
749 |
*
|
750 |
* Returns an empty string if the class name could not be reliably inferred.
|
751 |
*
|
|
|
|
|
752 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
753 |
* @param int $stackPtr The position of a T_NEW token.
|
754 |
*
|
755 |
* @return string
|
756 |
*/
|
757 |
-
public function getFQClassNameFromDoubleColonToken(
|
758 |
{
|
759 |
$tokens = $phpcsFile->getTokens();
|
760 |
|
@@ -763,23 +766,23 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
763 |
return '';
|
764 |
}
|
765 |
|
766 |
-
if ($tokens[$stackPtr]['code'] !== T_DOUBLE_COLON) {
|
767 |
return '';
|
768 |
}
|
769 |
|
770 |
// Nothing to do if previous token is a variable as we don't know where it was defined.
|
771 |
-
if ($tokens[$stackPtr - 1]['code'] === T_VARIABLE) {
|
772 |
return '';
|
773 |
}
|
774 |
|
775 |
// Nothing to do if 'parent' or 'static' as we don't know how far the class tree extends.
|
776 |
-
if (in_array($tokens[$stackPtr - 1]['code'], array(T_PARENT, T_STATIC), true)) {
|
777 |
return '';
|
778 |
}
|
779 |
|
780 |
// Get the classname from the class declaration if self is used.
|
781 |
-
if ($tokens[$stackPtr - 1]['code'] === T_SELF) {
|
782 |
-
$classDeclarationPtr = $phpcsFile->findPrevious(T_CLASS, $stackPtr - 1);
|
783 |
if ($classDeclarationPtr === false) {
|
784 |
return '';
|
785 |
}
|
@@ -788,10 +791,10 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
788 |
}
|
789 |
|
790 |
$find = array(
|
791 |
-
T_NS_SEPARATOR,
|
792 |
-
T_STRING,
|
793 |
-
T_NAMESPACE,
|
794 |
-
T_WHITESPACE,
|
795 |
);
|
796 |
|
797 |
$start = $phpcsFile->findPrevious($find, $stackPtr - 1, null, true, null, true);
|
@@ -813,13 +816,15 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
813 |
* Checks if a class/function/constant name is already fully qualified and
|
814 |
* if not, enrich it with the relevant namespace information.
|
815 |
*
|
|
|
|
|
816 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
817 |
* @param int $stackPtr The position of the token.
|
818 |
* @param string $name The class / function / constant name.
|
819 |
*
|
820 |
* @return string
|
821 |
*/
|
822 |
-
public function getFQName(
|
823 |
{
|
824 |
if (strpos($name, '\\') === 0) {
|
825 |
// Already fully qualified.
|
@@ -844,15 +849,20 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
844 |
/**
|
845 |
* Is the class/function/constant name namespaced or global ?
|
846 |
*
|
|
|
|
|
847 |
* @param string $FQName Fully Qualified name of a class, function etc.
|
848 |
* I.e. should always start with a `\`.
|
849 |
*
|
850 |
* @return bool True if namespaced, false if global.
|
|
|
|
|
|
|
851 |
*/
|
852 |
public function isNamespaced($FQName)
|
853 |
{
|
854 |
if (strpos($FQName, '\\') !== 0) {
|
855 |
-
throw new
|
856 |
}
|
857 |
|
858 |
return (strpos(substr($FQName, 1), '\\') !== false);
|
@@ -862,12 +872,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
862 |
/**
|
863 |
* Determine the namespace name an arbitrary token lives in.
|
864 |
*
|
|
|
|
|
865 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
866 |
* @param int $stackPtr The token position for which to determine the namespace.
|
867 |
*
|
868 |
* @return string Namespace name or empty string if it couldn't be determined or no namespace applies.
|
869 |
*/
|
870 |
-
public function determineNamespace(
|
871 |
{
|
872 |
$tokens = $phpcsFile->getTokens();
|
873 |
|
@@ -878,7 +890,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
878 |
|
879 |
// Check for scoped namespace {}.
|
880 |
if (empty($tokens[$stackPtr]['conditions']) === false) {
|
881 |
-
$namespacePtr = $phpcsFile->getCondition($stackPtr, T_NAMESPACE);
|
882 |
if ($namespacePtr !== false) {
|
883 |
$namespace = $this->getDeclaredNamespaceName($phpcsFile, $namespacePtr);
|
884 |
if ($namespace !== false) {
|
@@ -900,7 +912,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
900 |
$previousNSToken = $stackPtr;
|
901 |
$namespace = false;
|
902 |
do {
|
903 |
-
$previousNSToken = $phpcsFile->findPrevious(T_NAMESPACE, ($previousNSToken - 1));
|
904 |
|
905 |
// Stop if we encounter a scoped namespace declaration as we already know we're not in one.
|
906 |
if (empty($tokens[$previousNSToken]['scope_condition']) === false && $tokens[$previousNSToken]['scope_condition'] === $previousNSToken) {
|
@@ -925,13 +937,15 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
925 |
* For hierarchical namespaces, the name will be composed of several tokens,
|
926 |
* i.e. MyProject\Sub\Level which will be returned together as one string.
|
927 |
*
|
|
|
|
|
928 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
929 |
* @param int|bool $stackPtr The position of a T_NAMESPACE token.
|
930 |
*
|
931 |
* @return string|false Namespace name or false if not a namespace declaration.
|
932 |
* Namespace name can be an empty string for global namespace declaration.
|
933 |
*/
|
934 |
-
public function getDeclaredNamespaceName(
|
935 |
{
|
936 |
$tokens = $phpcsFile->getTokens();
|
937 |
|
@@ -940,27 +954,29 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
940 |
return false;
|
941 |
}
|
942 |
|
943 |
-
if ($tokens[$stackPtr]['code'] !== T_NAMESPACE) {
|
944 |
return false;
|
945 |
}
|
946 |
|
947 |
-
if ($tokens[($stackPtr + 1)]['code'] === T_NS_SEPARATOR) {
|
948 |
-
// Not a namespace declaration, but use of, i.e. namespace\someFunction()
|
949 |
return false;
|
950 |
}
|
951 |
|
952 |
-
$nextToken = $phpcsFile->findNext(
|
953 |
-
if ($tokens[$nextToken]['code'] === T_OPEN_CURLY_BRACKET) {
|
954 |
-
|
955 |
-
|
|
|
|
|
956 |
return '';
|
957 |
}
|
958 |
|
959 |
// Ok, this should be a namespace declaration, so get all the parts together.
|
960 |
$validTokens = array(
|
961 |
-
T_STRING => true,
|
962 |
-
T_NS_SEPARATOR => true,
|
963 |
-
T_WHITESPACE => true,
|
964 |
);
|
965 |
|
966 |
$namespaceName = '';
|
@@ -981,6 +997,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
981 |
*
|
982 |
* Expects to be passed T_RETURN_TYPE, T_FUNCTION or T_CLOSURE token.
|
983 |
*
|
|
|
|
|
984 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
985 |
* @param int $stackPtr The position of the token.
|
986 |
*
|
@@ -988,15 +1006,15 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
988 |
* no return type was found or the passed token was
|
989 |
* not of the correct type.
|
990 |
*/
|
991 |
-
public function getReturnTypeHintToken(
|
992 |
{
|
993 |
$tokens = $phpcsFile->getTokens();
|
994 |
|
995 |
-
if (defined('T_RETURN_TYPE') && $tokens[$stackPtr]['code'] === T_RETURN_TYPE) {
|
996 |
return $stackPtr;
|
997 |
}
|
998 |
|
999 |
-
if ($tokens[$stackPtr]['code'] !== T_FUNCTION && $tokens[$stackPtr]['code'] !== T_CLOSURE) {
|
1000 |
return false;
|
1001 |
}
|
1002 |
|
@@ -1009,7 +1027,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1009 |
if (isset($tokens[$stackPtr]['scope_opener'])) {
|
1010 |
$endOfFunctionDeclaration = $tokens[$stackPtr]['scope_opener'];
|
1011 |
} else {
|
1012 |
-
$nextSemiColon = $phpcsFile->findNext(T_SEMICOLON, ($tokens[$stackPtr]['parenthesis_closer'] + 1), null, false, null, true);
|
1013 |
if ($nextSemiColon !== false) {
|
1014 |
$endOfFunctionDeclaration = $nextSemiColon;
|
1015 |
}
|
@@ -1020,7 +1038,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1020 |
}
|
1021 |
|
1022 |
$hasColon = $phpcsFile->findNext(
|
1023 |
-
array(T_COLON, T_INLINE_ELSE),
|
1024 |
($tokens[$stackPtr]['parenthesis_closer'] + 1),
|
1025 |
$endOfFunctionDeclaration
|
1026 |
);
|
@@ -1038,11 +1056,11 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1038 |
* As of PHPCS 3.3.0 `array` as a type declaration will be tokenized as `T_STRING`.
|
1039 |
*/
|
1040 |
$unrecognizedTypes = array(
|
1041 |
-
T_CALLABLE,
|
1042 |
-
T_SELF,
|
1043 |
-
T_PARENT,
|
1044 |
-
T_ARRAY, // PHPCS < 2.4.0.
|
1045 |
-
T_STRING,
|
1046 |
);
|
1047 |
|
1048 |
return $phpcsFile->findPrevious($unrecognizedTypes, ($endOfFunctionDeclaration - 1), $hasColon);
|
@@ -1062,31 +1080,31 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1062 |
* Expects to be passed a T_RETURN_TYPE token or the return value from a call to
|
1063 |
* the Sniff::getReturnTypeHintToken() method.
|
1064 |
*
|
|
|
|
|
1065 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1066 |
* @param int $stackPtr The position of the return type token.
|
1067 |
*
|
1068 |
-
* @return string
|
1069 |
*/
|
1070 |
-
public function getReturnTypeHintName(
|
1071 |
{
|
1072 |
$tokens = $phpcsFile->getTokens();
|
1073 |
|
1074 |
// In older PHPCS versions, the nullable indicator will turn a return type colon into a T_INLINE_ELSE.
|
1075 |
-
$colon = $phpcsFile->findPrevious(array(T_COLON, T_INLINE_ELSE, T_FUNCTION, T_CLOSE_PARENTHESIS), ($stackPtr - 1));
|
1076 |
if ($colon === false
|
1077 |
-
|| ($tokens[$colon]['code'] !== T_COLON && $tokens[$colon]['code'] !== T_INLINE_ELSE)
|
1078 |
) {
|
1079 |
// Shouldn't happen, just in case.
|
1080 |
-
return;
|
1081 |
}
|
1082 |
|
1083 |
-
$emptyTokens = array_flip(\PHP_CodeSniffer_Tokens::$emptyTokens); // PHPCS 1.x compat.
|
1084 |
-
|
1085 |
$returnTypeHint = '';
|
1086 |
for ($i = ($colon + 1); $i <= $stackPtr; $i++) {
|
1087 |
// As of PHPCS 3.3.0+, all tokens are tokenized as "normal", so T_CALLABLE, T_SELF etc are
|
1088 |
// all possible, just exclude anything that's regarded as empty and the nullable indicator.
|
1089 |
-
if (isset(
|
1090 |
continue;
|
1091 |
}
|
1092 |
|
@@ -1094,7 +1112,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1094 |
continue;
|
1095 |
}
|
1096 |
|
1097 |
-
if (defined('T_NULLABLE') === false && $tokens[$i]['code'] === T_INLINE_THEN) {
|
1098 |
// Old PHPCS.
|
1099 |
continue;
|
1100 |
}
|
@@ -1114,17 +1132,19 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1114 |
* anonymous classes. Along the same lines, the`getMemberProperties()`
|
1115 |
* method does not support the `var` prefix.
|
1116 |
*
|
|
|
|
|
1117 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
1118 |
* @param int $stackPtr The position in the stack of the
|
1119 |
* T_VARIABLE token to verify.
|
1120 |
*
|
1121 |
* @return bool
|
1122 |
*/
|
1123 |
-
public function isClassProperty(
|
1124 |
{
|
1125 |
$tokens = $phpcsFile->getTokens();
|
1126 |
|
1127 |
-
if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== T_VARIABLE) {
|
1128 |
return false;
|
1129 |
}
|
1130 |
|
@@ -1134,10 +1154,21 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1134 |
'T_ANON_CLASS' => true,
|
1135 |
'T_TRAIT' => true,
|
1136 |
);
|
1137 |
-
|
|
|
|
|
1138 |
// Make sure it's not a method parameter.
|
1139 |
if (empty($tokens[$stackPtr]['nested_parenthesis']) === true) {
|
1140 |
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1141 |
}
|
1142 |
}
|
1143 |
|
@@ -1148,17 +1179,19 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1148 |
/**
|
1149 |
* Check whether a T_CONST token is a class constant declaration.
|
1150 |
*
|
|
|
|
|
1151 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
1152 |
* @param int $stackPtr The position in the stack of the
|
1153 |
* T_CONST token to verify.
|
1154 |
*
|
1155 |
* @return bool
|
1156 |
*/
|
1157 |
-
public function isClassConstant(
|
1158 |
{
|
1159 |
$tokens = $phpcsFile->getTokens();
|
1160 |
|
1161 |
-
if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== T_CONST) {
|
1162 |
return false;
|
1163 |
}
|
1164 |
|
@@ -1168,7 +1201,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1168 |
'T_ANON_CLASS' => true,
|
1169 |
'T_INTERFACE' => true,
|
1170 |
);
|
1171 |
-
if ($this->validDirectScope($phpcsFile, $stackPtr, $validScopes)
|
1172 |
return true;
|
1173 |
}
|
1174 |
|
@@ -1182,17 +1215,19 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1182 |
*
|
1183 |
* Used to check, for instance, if a T_CONST is a class constant.
|
1184 |
*
|
|
|
|
|
1185 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
1186 |
* @param int $stackPtr The position in the stack of the
|
1187 |
-
*
|
1188 |
* @param array $validScopes Array of token types.
|
1189 |
* Keys should be the token types in string
|
1190 |
* format to allow for newer token types.
|
1191 |
* Value is irrelevant.
|
1192 |
*
|
1193 |
-
* @return bool
|
1194 |
*/
|
1195 |
-
protected function validDirectScope(
|
1196 |
{
|
1197 |
$tokens = $phpcsFile->getTokens();
|
1198 |
|
@@ -1211,7 +1246,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1211 |
}
|
1212 |
|
1213 |
if (isset($validScopes[$tokens[$ptr]['type']]) === true) {
|
1214 |
-
return
|
1215 |
}
|
1216 |
|
1217 |
return false;
|
@@ -1226,6 +1261,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1226 |
* Strips potential nullable indicator and potential global namespace
|
1227 |
* indicator from the type hints before returning them.
|
1228 |
*
|
|
|
|
|
1229 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1230 |
* @param int $stackPtr The position of the token.
|
1231 |
*
|
@@ -1234,16 +1271,16 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1234 |
* - no type hints were found
|
1235 |
* - or the passed token was not of the correct type.
|
1236 |
*/
|
1237 |
-
public function getTypeHintsFromFunctionDeclaration(
|
1238 |
{
|
1239 |
$tokens = $phpcsFile->getTokens();
|
1240 |
|
1241 |
-
if ($tokens[$stackPtr]['code'] !== T_FUNCTION && $tokens[$stackPtr]['code'] !== T_CLOSURE) {
|
1242 |
return array();
|
1243 |
}
|
1244 |
|
1245 |
$parameters = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
|
1246 |
-
if (empty($parameters) || is_array($parameters) === false) {
|
1247 |
return array();
|
1248 |
}
|
1249 |
|
@@ -1272,13 +1309,15 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1272 |
/**
|
1273 |
* Get the hash algorithm name from the parameter in a hash function call.
|
1274 |
*
|
|
|
|
|
1275 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
1276 |
* @param int $stackPtr The position of the T_STRING function token.
|
1277 |
*
|
1278 |
* @return string|false The algorithm name without quotes if this was a relevant hash
|
1279 |
* function call or false if it was not.
|
1280 |
*/
|
1281 |
-
public function getHashAlgorithmParameter(
|
1282 |
{
|
1283 |
$tokens = $phpcsFile->getTokens();
|
1284 |
|
@@ -1287,7 +1326,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1287 |
return false;
|
1288 |
}
|
1289 |
|
1290 |
-
if ($tokens[$stackPtr]['code'] !== T_STRING) {
|
1291 |
return false;
|
1292 |
}
|
1293 |
|
@@ -1316,12 +1355,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1316 |
/**
|
1317 |
* Determine whether an arbitrary T_STRING token is the use of a global constant.
|
1318 |
*
|
|
|
|
|
1319 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1320 |
-
* @param int $stackPtr The position of the
|
1321 |
*
|
1322 |
* @return bool
|
1323 |
*/
|
1324 |
-
public function isUseOfGlobalConstant(
|
1325 |
{
|
1326 |
static $isLowPHPCS, $isLowPHP;
|
1327 |
|
@@ -1333,7 +1374,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1333 |
}
|
1334 |
|
1335 |
// Is this one of the tokens this function handles ?
|
1336 |
-
if ($tokens[$stackPtr]['code'] !== T_STRING) {
|
1337 |
return false;
|
1338 |
}
|
1339 |
|
@@ -1341,16 +1382,16 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1341 |
if (isset($isLowPHPCS, $isLowPHP) === false) {
|
1342 |
$isLowPHP = false;
|
1343 |
$isLowPHPCS = false;
|
1344 |
-
if (version_compare(PHP_VERSION_ID, '50400', '<')) {
|
1345 |
$isLowPHP = true;
|
1346 |
$isLowPHPCS = version_compare(PHPCSHelper::getVersion(), '2.4.0', '<');
|
1347 |
}
|
1348 |
}
|
1349 |
|
1350 |
-
$next = $phpcsFile->findNext(
|
1351 |
if ($next !== false
|
1352 |
-
&& ($tokens[$next]['code'] === T_OPEN_PARENTHESIS
|
1353 |
-
|| $tokens[$next]['code'] === T_DOUBLE_COLON)
|
1354 |
) {
|
1355 |
// Function call or declaration.
|
1356 |
return false;
|
@@ -1378,10 +1419,10 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1378 |
'T_PRIVATE' => true,
|
1379 |
);
|
1380 |
|
1381 |
-
$prev = $phpcsFile->findPrevious(
|
1382 |
if ($prev !== false
|
1383 |
&& (isset($tokensToIgnore[$tokens[$prev]['type']]) === true
|
1384 |
-
|| ($tokens[$prev]['code'] === T_STRING
|
1385 |
&& (($isLowPHPCS === true
|
1386 |
&& $tokens[$prev]['content'] === 'trait')
|
1387 |
|| ($isLowPHP === true
|
@@ -1392,15 +1433,15 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1392 |
}
|
1393 |
|
1394 |
if ($prev !== false
|
1395 |
-
&& $tokens[$prev]['code'] === T_NS_SEPARATOR
|
1396 |
-
&& $tokens[($prev - 1)]['code'] === T_STRING
|
1397 |
) {
|
1398 |
// Namespaced constant of the same name.
|
1399 |
return false;
|
1400 |
}
|
1401 |
|
1402 |
if ($prev !== false
|
1403 |
-
&& $tokens[$prev]['code'] === T_CONST
|
1404 |
&& $this->isClassConstant($phpcsFile, $prev) === true
|
1405 |
) {
|
1406 |
// Class constant declaration of the same name.
|
@@ -1416,14 +1457,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1416 |
}
|
1417 |
}
|
1418 |
|
1419 |
-
$firstOnLine = $phpcsFile->findNext(
|
1420 |
-
if ($firstOnLine !== false && $tokens[$firstOnLine]['code'] === T_USE) {
|
1421 |
-
$nextOnLine = $phpcsFile->findNext(
|
1422 |
if ($nextOnLine !== false) {
|
1423 |
-
if (($tokens[$nextOnLine]['code'] === T_STRING && $tokens[$nextOnLine]['content'] === 'const')
|
1424 |
-
|| $tokens[$nextOnLine]['code'] === T_CONST // Happens in some PHPCS versions.
|
1425 |
) {
|
1426 |
-
$hasNsSep = $phpcsFile->findNext(T_NS_SEPARATOR, ($nextOnLine + 1), $stackPtr);
|
1427 |
if ($hasNsSep !== false) {
|
1428 |
// Namespaced const (group) use statement.
|
1429 |
return false;
|
@@ -1448,6 +1489,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1448 |
*
|
1449 |
* Note: Zero is *not* regarded as a positive number.
|
1450 |
*
|
|
|
|
|
1451 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1452 |
* @param int $start Start of the snippet (inclusive), i.e. this
|
1453 |
* token will be examined as part of the snippet.
|
@@ -1459,7 +1502,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1459 |
* False if not or if it could not be reliably determined
|
1460 |
* (variable or calculations and such).
|
1461 |
*/
|
1462 |
-
public function isPositiveNumber(
|
1463 |
{
|
1464 |
$number = $this->isNumber($phpcsFile, $start, $end, $allowFloats);
|
1465 |
|
@@ -1480,6 +1523,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1480 |
*
|
1481 |
* Note: Zero is *not* regarded as a negative number.
|
1482 |
*
|
|
|
|
|
1483 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1484 |
* @param int $start Start of the snippet (inclusive), i.e. this
|
1485 |
* token will be examined as part of the snippet.
|
@@ -1491,7 +1536,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1491 |
* False if not or if it could not be reliably determined
|
1492 |
* (variable or calculations and such).
|
1493 |
*/
|
1494 |
-
public function isNegativeNumber(
|
1495 |
{
|
1496 |
$number = $this->isNumber($phpcsFile, $start, $end, $allowFloats);
|
1497 |
|
@@ -1500,7 +1545,6 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1500 |
}
|
1501 |
|
1502 |
return ($number < 0);
|
1503 |
-
|
1504 |
}
|
1505 |
|
1506 |
/**
|
@@ -1515,6 +1559,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1515 |
* Mainly intended for examining variable assignments, function call parameters, array values
|
1516 |
* where the start and end of the snippet to examine is very clear.
|
1517 |
*
|
|
|
|
|
1518 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1519 |
* @param int $start Start of the snippet (inclusive), i.e. this
|
1520 |
* token will be examined as part of the snippet.
|
@@ -1529,19 +1575,18 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1529 |
* number or if it could not be reliably determined
|
1530 |
* (variable or calculations and such).
|
1531 |
*/
|
1532 |
-
protected function isNumber(
|
1533 |
{
|
1534 |
-
$stringTokens
|
1535 |
-
$stringTokens += array_flip(\PHP_CodeSniffer_Tokens::$stringTokens); // Flipping for PHPCS 1.x compat.
|
1536 |
|
1537 |
-
$validTokens
|
1538 |
-
$validTokens[T_LNUMBER] = true;
|
1539 |
-
$validTokens[T_TRUE] = true; // Evaluates to int 1.
|
1540 |
-
$validTokens[T_FALSE] = true; // Evaluates to int 0.
|
1541 |
-
$validTokens[T_NULL] = true; // Evaluates to int 0.
|
1542 |
|
1543 |
if ($allowFloats === true) {
|
1544 |
-
$validTokens[T_DNUMBER] = true;
|
1545 |
}
|
1546 |
|
1547 |
$maybeValidTokens = $stringTokens + $validTokens;
|
@@ -1554,17 +1599,17 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1554 |
return false;
|
1555 |
}
|
1556 |
|
1557 |
-
$nextNonEmpty = $phpcsFile->findNext(
|
1558 |
while ($nextNonEmpty !== false
|
1559 |
-
&& ($tokens[$nextNonEmpty]['code'] === T_PLUS
|
1560 |
-
|| $tokens[$nextNonEmpty]['code'] === T_MINUS)
|
1561 |
) {
|
1562 |
|
1563 |
-
if ($tokens[$nextNonEmpty]['code'] === T_MINUS) {
|
1564 |
$negativeNumber = ($negativeNumber === false) ? true : false;
|
1565 |
}
|
1566 |
|
1567 |
-
$nextNonEmpty = $phpcsFile->findNext(
|
1568 |
}
|
1569 |
|
1570 |
if ($nextNonEmpty === false || isset($maybeValidTokens[$tokens[$nextNonEmpty]['code']]) === false) {
|
@@ -1572,23 +1617,23 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1572 |
}
|
1573 |
|
1574 |
$content = false;
|
1575 |
-
if ($tokens[$nextNonEmpty]['code'] === T_LNUMBER
|
1576 |
-
|| $tokens[$nextNonEmpty]['code'] === T_DNUMBER
|
1577 |
) {
|
1578 |
$content = (float) $tokens[$nextNonEmpty]['content'];
|
1579 |
-
} elseif ($tokens[$nextNonEmpty]['code'] === T_TRUE) {
|
1580 |
$content = 1.0;
|
1581 |
-
} elseif ($tokens[$nextNonEmpty]['code'] === T_FALSE
|
1582 |
-
|| $tokens[$nextNonEmpty]['code'] === T_NULL
|
1583 |
) {
|
1584 |
$content = 0.0;
|
1585 |
} elseif (isset($stringTokens[$tokens[$nextNonEmpty]['code']]) === true) {
|
1586 |
|
1587 |
-
if ($tokens[$nextNonEmpty]['code'] === T_START_HEREDOC
|
1588 |
-
|| $tokens[$nextNonEmpty]['code'] === T_START_NOWDOC
|
1589 |
) {
|
1590 |
// Skip past heredoc/nowdoc opener to the first content.
|
1591 |
-
$firstDocToken = $phpcsFile->findNext(array(T_HEREDOC, T_NOWDOC), ($nextNonEmpty + 1), $searchEnd);
|
1592 |
if ($firstDocToken === false) {
|
1593 |
// Live coding or parse error.
|
1594 |
return false;
|
@@ -1597,7 +1642,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1597 |
$stringContent = $content = $tokens[$firstDocToken]['content'];
|
1598 |
|
1599 |
// Skip forward to the end in preparation for the next part of the examination.
|
1600 |
-
$nextNonEmpty = $phpcsFile->findNext(array(T_END_HEREDOC, T_END_NOWDOC), ($nextNonEmpty + 1), $searchEnd);
|
1601 |
if ($nextNonEmpty === false) {
|
1602 |
// Live coding or parse error.
|
1603 |
return false;
|
@@ -1618,7 +1663,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1618 |
|
1619 |
/*
|
1620 |
* Regexes based on the formats outlined in the manual, created by JRF.
|
1621 |
-
* @link
|
1622 |
*/
|
1623 |
$regexInt = '`^\s*[0-9]+`';
|
1624 |
$regexFloat = '`^\s*(?:[+-]?(?:(?:(?P<LNUM>[0-9]+)|(?P<DNUM>([0-9]*\.(?P>LNUM)|(?P>LNUM)\.[0-9]*)))[eE][+-]?(?P>LNUM))|(?P>DNUM))`';
|
@@ -1655,7 +1700,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1655 |
// use that to get the numeric value if possible.
|
1656 |
// If the filter extension is not available, the value will be zero, but so be it.
|
1657 |
if (function_exists('filter_var')) {
|
1658 |
-
$filtered = filter_var($hexNumberString[1], FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX);
|
1659 |
if ($filtered !== false) {
|
1660 |
$content = $filtered;
|
1661 |
}
|
@@ -1664,7 +1709,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1664 |
}
|
1665 |
|
1666 |
// OK, so we have a number, now is there still more code after it ?
|
1667 |
-
$nextNonEmpty = $phpcsFile->findNext(
|
1668 |
if ($nextNonEmpty !== false) {
|
1669 |
return false;
|
1670 |
}
|
@@ -1681,18 +1726,147 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1681 |
}
|
1682 |
|
1683 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1684 |
/**
|
1685 |
* Determine whether a T_OPEN/CLOSE_SHORT_ARRAY token is a list() construct.
|
1686 |
*
|
1687 |
* Note: A variety of PHPCS versions have bugs in the tokenizing of short arrays.
|
1688 |
* In that case, the tokens are identified as T_OPEN/CLOSE_SQUARE_BRACKET.
|
1689 |
*
|
|
|
|
|
1690 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1691 |
* @param int $stackPtr The position of the function call token.
|
1692 |
*
|
1693 |
* @return bool
|
1694 |
*/
|
1695 |
-
public function isShortList(
|
1696 |
{
|
1697 |
$tokens = $phpcsFile->getTokens();
|
1698 |
|
@@ -1702,21 +1876,21 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1702 |
}
|
1703 |
|
1704 |
// Is this one of the tokens this function handles ?
|
1705 |
-
if ($tokens[$stackPtr]['code'] !== T_OPEN_SHORT_ARRAY
|
1706 |
-
&& $tokens[$stackPtr]['code'] !== T_CLOSE_SHORT_ARRAY
|
1707 |
) {
|
1708 |
return false;
|
1709 |
}
|
1710 |
|
1711 |
switch ($tokens[$stackPtr]['code']) {
|
1712 |
-
case T_OPEN_SHORT_ARRAY:
|
1713 |
if (isset($tokens[$stackPtr]['bracket_closer']) === true) {
|
1714 |
$opener = $stackPtr;
|
1715 |
$closer = $tokens[$stackPtr]['bracket_closer'];
|
1716 |
}
|
1717 |
break;
|
1718 |
|
1719 |
-
case T_CLOSE_SHORT_ARRAY:
|
1720 |
if (isset($tokens[$stackPtr]['bracket_opener']) === true) {
|
1721 |
$opener = $tokens[$stackPtr]['bracket_opener'];
|
1722 |
$closer = $stackPtr;
|
@@ -1733,21 +1907,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1733 |
* PHPCS cross-version compatibility: work around for square brackets misidentified
|
1734 |
* as short array when preceded by a variable variable in older PHPCS versions.
|
1735 |
*/
|
1736 |
-
$prevNonEmpty = $phpcsFile->findPrevious(
|
1737 |
-
\PHP_CodeSniffer_Tokens::$emptyTokens,
|
1738 |
-
($opener - 1),
|
1739 |
-
null,
|
1740 |
-
true,
|
1741 |
-
null,
|
1742 |
-
true
|
1743 |
-
);
|
1744 |
|
1745 |
if ($prevNonEmpty !== false
|
1746 |
-
&& $tokens[$prevNonEmpty]['code'] === T_CLOSE_CURLY_BRACKET
|
1747 |
&& isset($tokens[$prevNonEmpty]['bracket_opener']) === true
|
1748 |
) {
|
1749 |
$maybeVariableVariable = $phpcsFile->findPrevious(
|
1750 |
-
|
1751 |
($tokens[$prevNonEmpty]['bracket_opener'] - 1),
|
1752 |
null,
|
1753 |
true,
|
@@ -1755,34 +1922,27 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1755 |
true
|
1756 |
);
|
1757 |
|
1758 |
-
if ($tokens[$maybeVariableVariable]['code'] === T_VARIABLE
|
1759 |
-
|| $tokens[$maybeVariableVariable]['code'] === T_DOLLAR
|
1760 |
) {
|
1761 |
return false;
|
1762 |
}
|
1763 |
}
|
1764 |
|
1765 |
-
$nextNonEmpty = $phpcsFile->findNext(
|
1766 |
-
\PHP_CodeSniffer_Tokens::$emptyTokens,
|
1767 |
-
($closer + 1),
|
1768 |
-
null,
|
1769 |
-
true,
|
1770 |
-
null,
|
1771 |
-
true
|
1772 |
-
);
|
1773 |
|
1774 |
-
if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === T_EQUAL) {
|
1775 |
return true;
|
1776 |
}
|
1777 |
|
1778 |
if ($prevNonEmpty !== false
|
1779 |
-
&& $tokens[$prevNonEmpty]['code'] === T_AS
|
1780 |
&& isset($tokens[$prevNonEmpty]['nested_parenthesis']) === true
|
1781 |
) {
|
1782 |
$parentheses = array_reverse($tokens[$prevNonEmpty]['nested_parenthesis'], true);
|
1783 |
foreach ($parentheses as $open => $close) {
|
1784 |
if (isset($tokens[$open]['parenthesis_owner'])
|
1785 |
-
&& $tokens[$tokens[$open]['parenthesis_owner']]['code'] === T_FOREACH
|
1786 |
) {
|
1787 |
return true;
|
1788 |
}
|
@@ -1793,7 +1953,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1793 |
$parentOpener = $opener;
|
1794 |
do {
|
1795 |
$parentOpener = $phpcsFile->findPrevious(
|
1796 |
-
array(T_OPEN_SHORT_ARRAY, T_OPEN_SQUARE_BRACKET),
|
1797 |
($parentOpener - 1),
|
1798 |
null,
|
1799 |
false,
|
@@ -1816,10 +1976,10 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1816 |
$phpcsVersion = PHPCSHelper::getVersion();
|
1817 |
if ((version_compare($phpcsVersion, '2.0', '>') === true
|
1818 |
&& version_compare($phpcsVersion, '2.8', '<') === true)
|
1819 |
-
&& $tokens[$parentOpener]['code'] === T_OPEN_SQUARE_BRACKET
|
1820 |
) {
|
1821 |
$nextNonEmpty = $phpcsFile->findNext(
|
1822 |
-
|
1823 |
($tokens[$parentOpener]['bracket_closer'] + 1),
|
1824 |
null,
|
1825 |
true,
|
@@ -1827,7 +1987,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1827 |
true
|
1828 |
);
|
1829 |
|
1830 |
-
if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === T_EQUAL) {
|
1831 |
return true;
|
1832 |
}
|
1833 |
|
@@ -1839,4 +1999,269 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
|
|
1839 |
|
1840 |
return false;
|
1841 |
}
|
1842 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
|
|
5 |
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
namespace PHPCompatibility;
|
12 |
|
13 |
use PHPCompatibility\PHPCSHelper;
|
14 |
+
use PHP_CodeSniffer_Exception as PHPCS_Exception;
|
15 |
+
use PHP_CodeSniffer_File as File;
|
16 |
+
use PHP_CodeSniffer_Sniff as PHPCS_Sniff;
|
17 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
18 |
|
19 |
/**
|
20 |
+
* Base class from which all PHPCompatibility sniffs extend.
|
21 |
*
|
22 |
+
* @since 5.6
|
|
|
|
|
|
|
23 |
*/
|
24 |
+
abstract class Sniff implements PHPCS_Sniff
|
25 |
{
|
26 |
|
27 |
+
/**
|
28 |
+
* Regex to match variables in a double quoted string.
|
29 |
+
*
|
30 |
+
* This matches plain variables, but also more complex variables, such
|
31 |
+
* as $obj->prop, self::prop and $var[].
|
32 |
+
*
|
33 |
+
* @since 7.1.2
|
34 |
+
*
|
35 |
+
* @var string
|
36 |
+
*/
|
37 |
const REGEX_COMPLEX_VARS = '`(?:(\{)?(?<!\\\\)\$)?(\{)?(?<!\\\\)\$(\{)?(?P<varname>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)(?:->\$?(?P>varname)|\[[^\]]+\]|::\$?(?P>varname)|\([^\)]*\))*(?(3)\}|)(?(2)\}|)(?(1)\}|)`';
|
38 |
|
39 |
/**
|
40 |
* List of superglobals as an array of strings.
|
41 |
*
|
42 |
+
* Used by the ForbiddenParameterShadowSuperGlobals and ForbiddenClosureUseVariableNames sniffs.
|
43 |
+
*
|
44 |
+
* @since 7.0.0
|
45 |
+
* @since 7.1.4 Moved from the `ForbiddenParameterShadowSuperGlobals` sniff to the base `Sniff` class.
|
46 |
*
|
47 |
* @var array
|
48 |
*/
|
49 |
protected $superglobals = array(
|
50 |
+
'$GLOBALS' => true,
|
51 |
+
'$_SERVER' => true,
|
52 |
+
'$_GET' => true,
|
53 |
+
'$_POST' => true,
|
54 |
+
'$_FILES' => true,
|
55 |
+
'$_COOKIE' => true,
|
56 |
+
'$_SESSION' => true,
|
57 |
+
'$_REQUEST' => true,
|
58 |
+
'$_ENV' => true,
|
59 |
);
|
60 |
|
61 |
/**
|
64 |
* Used by the new/removed hash algorithm sniffs.
|
65 |
* Key is the function name, value is the 1-based parameter position in the function call.
|
66 |
*
|
67 |
+
* @since 5.5
|
68 |
+
* @since 7.0.7 Moved from the `RemovedHashAlgorithms` sniff to the base `Sniff` class.
|
69 |
+
*
|
70 |
* @var array
|
71 |
*/
|
72 |
protected $hashAlgoFunctions = array(
|
85 |
* Used by the new/removed ini directives sniffs.
|
86 |
* Key is the function name, value is the 1-based parameter position in the function call.
|
87 |
*
|
88 |
+
* @since 7.1.0
|
89 |
+
*
|
90 |
* @var array
|
91 |
*/
|
92 |
protected $iniFunctions = array(
|
113 |
* PHP version numbers should always be in Major.Minor format. Both "5", "5.3.2"
|
114 |
* would be treated as invalid, and ignored.
|
115 |
*
|
116 |
+
* @since 7.0.0
|
117 |
+
* @since 7.1.3 Now allows for partial ranges such as `5.2-`.
|
118 |
+
*
|
119 |
* @return array $arrTestVersions will hold an array containing min/max version
|
120 |
* of PHP that we are checking against (see above). If only a
|
121 |
* single version number is specified, then this is used as
|
154 |
if (version_compare($min, $max, '>')) {
|
155 |
trigger_error(
|
156 |
"Invalid range in testVersion setting: '" . $testVersion . "'",
|
157 |
+
\E_USER_WARNING
|
158 |
);
|
159 |
return $default;
|
160 |
} else {
|
166 |
|
167 |
trigger_error(
|
168 |
"Invalid testVersion setting: '" . $testVersion . "'",
|
169 |
+
\E_USER_WARNING
|
170 |
);
|
171 |
return $default;
|
172 |
}
|
185 |
*
|
186 |
* Should be used when sniffing for *old* PHP features (deprecated/removed).
|
187 |
*
|
188 |
+
* @since 5.6
|
189 |
+
*
|
190 |
* @param string $phpVersion A PHP version number in 'major.minor' format.
|
191 |
*
|
192 |
* @return bool True if testVersion has not been provided or if the PHP version
|
198 |
$testVersion = $this->getTestVersion();
|
199 |
$testVersion = $testVersion[1];
|
200 |
|
201 |
+
if (\is_null($testVersion)
|
202 |
|| version_compare($testVersion, $phpVersion) >= 0
|
203 |
) {
|
204 |
return true;
|
205 |
} else {
|
206 |
return false;
|
207 |
}
|
208 |
+
}
|
209 |
|
210 |
|
211 |
/**
|
214 |
*
|
215 |
* Should be used when sniffing for *new* PHP features.
|
216 |
*
|
217 |
+
* @since 5.6
|
218 |
+
*
|
219 |
* @param string $phpVersion A PHP version number in 'major.minor' format.
|
220 |
*
|
221 |
* @return bool True if the PHP version is equal to or lower than the lowest
|
227 |
$testVersion = $this->getTestVersion();
|
228 |
$testVersion = $testVersion[0];
|
229 |
|
230 |
+
if (\is_null($testVersion) === false
|
231 |
&& version_compare($testVersion, $phpVersion) <= 0
|
232 |
) {
|
233 |
return true;
|
234 |
} else {
|
235 |
return false;
|
236 |
}
|
237 |
+
}
|
238 |
|
239 |
|
240 |
/**
|
241 |
* Add a PHPCS message to the output stack as either a warning or an error.
|
242 |
*
|
243 |
+
* @since 7.1.0
|
244 |
+
*
|
245 |
* @param \PHP_CodeSniffer_File $phpcsFile The file the message applies to.
|
246 |
* @param string $message The message.
|
247 |
* @param int $stackPtr The position of the token
|
255 |
*
|
256 |
* @return void
|
257 |
*/
|
258 |
+
public function addMessage(File $phpcsFile, $message, $stackPtr, $isError, $code = 'Found', $data = array())
|
259 |
{
|
260 |
if ($isError === true) {
|
261 |
$phpcsFile->addError($message, $stackPtr, $code, $data);
|
270 |
*
|
271 |
* Pre-empt issues with arbitrary strings being used as error codes in XML and PHP.
|
272 |
*
|
273 |
+
* @since 7.1.0
|
274 |
+
*
|
275 |
* @param string $baseString Arbitrary string.
|
276 |
*
|
277 |
* @return string
|
287 |
*
|
288 |
* Intended for use with the contents of a T_CONSTANT_ENCAPSED_STRING / T_DOUBLE_QUOTED_STRING.
|
289 |
*
|
290 |
+
* @since 7.0.6
|
291 |
+
*
|
292 |
* @param string $string The raw string.
|
293 |
*
|
294 |
* @return string String without quotes around it.
|
304 |
*
|
305 |
* Intended for use with the contents of a T_DOUBLE_QUOTED_STRING.
|
306 |
*
|
307 |
+
* @since 7.1.2
|
308 |
+
*
|
309 |
* @param string $string The raw string.
|
310 |
*
|
311 |
* @return string String without variables in it.
|
323 |
/**
|
324 |
* Make all top level array keys in an array lowercase.
|
325 |
*
|
326 |
+
* @since 7.1.0
|
327 |
+
*
|
328 |
* @param array $array Initial array.
|
329 |
*
|
330 |
* @return array Same array, but with all lowercase top level keys.
|
331 |
*/
|
332 |
public function arrayKeysToLowercase($array)
|
333 |
{
|
334 |
+
return array_change_key_case($array, \CASE_LOWER);
|
|
|
|
|
335 |
}
|
336 |
|
337 |
|
338 |
/**
|
339 |
* Checks if a function call has parameters.
|
340 |
*
|
341 |
+
* Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call.
|
342 |
* If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
|
343 |
*
|
344 |
* Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer, it
|
347 |
* @link https://github.com/PHPCompatibility/PHPCompatibility/issues/120
|
348 |
* @link https://github.com/PHPCompatibility/PHPCompatibility/issues/152
|
349 |
*
|
350 |
+
* @since 7.0.3
|
351 |
+
*
|
352 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
353 |
* @param int $stackPtr The position of the function call token.
|
354 |
*
|
355 |
* @return bool
|
356 |
*/
|
357 |
+
public function doesFunctionCallHaveParameters(File $phpcsFile, $stackPtr)
|
358 |
{
|
359 |
$tokens = $phpcsFile->getTokens();
|
360 |
|
364 |
}
|
365 |
|
366 |
// Is this one of the tokens this function handles ?
|
367 |
+
if (\in_array($tokens[$stackPtr]['code'], array(\T_STRING, \T_ARRAY, \T_OPEN_SHORT_ARRAY, \T_VARIABLE), true) === false) {
|
368 |
return false;
|
369 |
}
|
370 |
|
371 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
|
372 |
|
373 |
// Deal with short array syntax.
|
374 |
+
if ($tokens[$stackPtr]['code'] === \T_OPEN_SHORT_ARRAY) {
|
375 |
if (isset($tokens[$stackPtr]['bracket_closer']) === false) {
|
376 |
return false;
|
377 |
}
|
386 |
|
387 |
// Deal with function calls & long arrays.
|
388 |
// Next non-empty token should be the open parenthesis.
|
389 |
+
if ($nextNonEmpty === false && $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS) {
|
390 |
return false;
|
391 |
}
|
392 |
|
395 |
}
|
396 |
|
397 |
$closeParenthesis = $tokens[$nextNonEmpty]['parenthesis_closer'];
|
398 |
+
$nextNextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $nextNonEmpty + 1, $closeParenthesis + 1, true);
|
399 |
|
400 |
if ($nextNextNonEmpty === $closeParenthesis) {
|
401 |
// No parameters.
|
409 |
/**
|
410 |
* Count the number of parameters a function call has been passed.
|
411 |
*
|
412 |
+
* Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call.
|
413 |
* If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
|
414 |
*
|
415 |
* Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer,
|
419 |
* @link https://github.com/PHPCompatibility/PHPCompatibility/issues/114
|
420 |
* @link https://github.com/PHPCompatibility/PHPCompatibility/issues/151
|
421 |
*
|
422 |
+
* @since 7.0.3
|
423 |
+
*
|
424 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
425 |
* @param int $stackPtr The position of the function call token.
|
426 |
*
|
427 |
* @return int
|
428 |
*/
|
429 |
+
public function getFunctionCallParameterCount(File $phpcsFile, $stackPtr)
|
430 |
{
|
431 |
if ($this->doesFunctionCallHaveParameters($phpcsFile, $stackPtr) === false) {
|
432 |
return 0;
|
433 |
}
|
434 |
|
435 |
+
return \count($this->getFunctionCallParameters($phpcsFile, $stackPtr));
|
436 |
}
|
437 |
|
438 |
|
439 |
/**
|
440 |
* Get information on all parameters passed to a function call.
|
441 |
*
|
442 |
+
* Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call.
|
443 |
* If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
|
444 |
*
|
445 |
* Will return an multi-dimentional array with the start token pointer, end token
|
449 |
* Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer,
|
450 |
* it will tokenize the values / key/value pairs contained in the array call.
|
451 |
*
|
452 |
+
* @since 7.0.5 Split off from the `getFunctionCallParameterCount()` method.
|
453 |
+
*
|
454 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
455 |
* @param int $stackPtr The position of the function call token.
|
456 |
*
|
457 |
* @return array
|
458 |
*/
|
459 |
+
public function getFunctionCallParameters(File $phpcsFile, $stackPtr)
|
460 |
{
|
461 |
if ($this->doesFunctionCallHaveParameters($phpcsFile, $stackPtr) === false) {
|
462 |
return array();
|
463 |
}
|
464 |
|
465 |
+
// Ok, we know we have a T_STRING, T_VARIABLE, T_ARRAY or T_OPEN_SHORT_ARRAY with parameters
|
466 |
// and valid open & close brackets/parenthesis.
|
467 |
$tokens = $phpcsFile->getTokens();
|
468 |
|
469 |
// Mark the beginning and end tokens.
|
470 |
+
if ($tokens[$stackPtr]['code'] === \T_OPEN_SHORT_ARRAY) {
|
471 |
$opener = $stackPtr;
|
472 |
$closer = $tokens[$stackPtr]['bracket_closer'];
|
473 |
|
474 |
$nestedParenthesisCount = 0;
|
475 |
|
476 |
} else {
|
477 |
+
$opener = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
|
478 |
$closer = $tokens[$opener]['parenthesis_closer'];
|
479 |
|
480 |
$nestedParenthesisCount = 1;
|
482 |
|
483 |
// Which nesting level is the one we are interested in ?
|
484 |
if (isset($tokens[$opener]['nested_parenthesis'])) {
|
485 |
+
$nestedParenthesisCount += \count($tokens[$opener]['nested_parenthesis']);
|
486 |
}
|
487 |
|
488 |
$parameters = array();
|
489 |
$nextComma = $opener;
|
490 |
$paramStart = $opener + 1;
|
491 |
$cnt = 1;
|
492 |
+
while (($nextComma = $phpcsFile->findNext(array(\T_COMMA, $tokens[$closer]['code'], \T_OPEN_SHORT_ARRAY, \T_CLOSURE), $nextComma + 1, $closer + 1)) !== false) {
|
493 |
// Ignore anything within short array definition brackets.
|
494 |
if ($tokens[$nextComma]['type'] === 'T_OPEN_SHORT_ARRAY'
|
495 |
&& (isset($tokens[$nextComma]['bracket_opener'])
|
515 |
// Ignore comma's at a lower nesting level.
|
516 |
if ($tokens[$nextComma]['type'] === 'T_COMMA'
|
517 |
&& isset($tokens[$nextComma]['nested_parenthesis'])
|
518 |
+
&& \count($tokens[$nextComma]['nested_parenthesis']) !== $nestedParenthesisCount
|
519 |
) {
|
520 |
continue;
|
521 |
}
|
530 |
$parameters[$cnt]['end'] = $nextComma - 1;
|
531 |
$parameters[$cnt]['raw'] = trim($phpcsFile->getTokensAsString($paramStart, ($nextComma - $paramStart)));
|
532 |
|
533 |
+
/*
|
534 |
+
* Check if there are more tokens before the closing parenthesis.
|
535 |
+
* Prevents code like the following from setting a third parameter:
|
536 |
+
* `functionCall( $param1, $param2, );`.
|
537 |
+
*/
|
538 |
+
$hasNextParam = $phpcsFile->findNext(Tokens::$emptyTokens, $nextComma + 1, $closer, true, null, true);
|
539 |
if ($hasNextParam === false) {
|
540 |
break;
|
541 |
}
|
552 |
/**
|
553 |
* Get information on a specific parameter passed to a function call.
|
554 |
*
|
555 |
+
* Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call.
|
556 |
* If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
|
557 |
*
|
558 |
* Will return a array with the start token pointer, end token pointer and the raw value
|
559 |
* of the parameter at a specific offset.
|
560 |
* If the specified parameter is not found, will return false.
|
561 |
*
|
562 |
+
* @since 7.0.5
|
563 |
+
*
|
564 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
565 |
* @param int $stackPtr The position of the function call token.
|
566 |
* @param int $paramOffset The 1-based index position of the parameter to retrieve.
|
567 |
*
|
568 |
* @return array|false
|
569 |
*/
|
570 |
+
public function getFunctionCallParameter(File $phpcsFile, $stackPtr, $paramOffset)
|
571 |
{
|
572 |
$parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr);
|
573 |
|
586 |
* will check that the token has at least one condition which is of a
|
587 |
* type defined in $validScopes.
|
588 |
*
|
589 |
+
* @since 7.0.5 Largely split off from the `inClassScope()` method.
|
590 |
+
*
|
591 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
592 |
* @param int $stackPtr The position of the token.
|
593 |
* @param array|int $validScopes Optional. Array of valid scopes
|
599 |
* If the $scopeTypes are set: True if *one* of the conditions is a
|
600 |
* valid scope, false otherwise.
|
601 |
*/
|
602 |
+
public function tokenHasScope(File $phpcsFile, $stackPtr, $validScopes = null)
|
603 |
{
|
604 |
$tokens = $phpcsFile->getTokens();
|
605 |
|
625 |
/**
|
626 |
* Verify whether a token is within a class scope.
|
627 |
*
|
628 |
+
* @since 7.0.3
|
629 |
+
*
|
630 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
631 |
* @param int $stackPtr The position of the token.
|
632 |
* @param bool $strict Whether to strictly check for the T_CLASS
|
635 |
*
|
636 |
* @return bool True if within class scope, false otherwise.
|
637 |
*/
|
638 |
+
public function inClassScope(File $phpcsFile, $stackPtr, $strict = true)
|
639 |
{
|
640 |
+
$validScopes = array(\T_CLASS);
|
641 |
+
if (\defined('T_ANON_CLASS') === true) {
|
642 |
+
$validScopes[] = \T_ANON_CLASS;
|
643 |
}
|
644 |
|
645 |
if ($strict === false) {
|
646 |
+
$validScopes[] = \T_INTERFACE;
|
647 |
+
$validScopes[] = \T_TRAIT;
|
|
|
|
|
|
|
|
|
648 |
}
|
649 |
|
650 |
return $phpcsFile->hasCondition($stackPtr, $validScopes);
|
651 |
}
|
652 |
|
653 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
654 |
/**
|
655 |
* Returns the fully qualified class name for a new class instantiation.
|
656 |
*
|
657 |
* Returns an empty string if the class name could not be reliably inferred.
|
658 |
*
|
659 |
+
* @since 7.0.3
|
660 |
+
*
|
661 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
662 |
* @param int $stackPtr The position of a T_NEW token.
|
663 |
*
|
664 |
* @return string
|
665 |
*/
|
666 |
+
public function getFQClassNameFromNewToken(File $phpcsFile, $stackPtr)
|
667 |
{
|
668 |
$tokens = $phpcsFile->getTokens();
|
669 |
|
672 |
return '';
|
673 |
}
|
674 |
|
675 |
+
if ($tokens[$stackPtr]['code'] !== \T_NEW) {
|
676 |
return '';
|
677 |
}
|
678 |
|
679 |
+
$start = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
|
680 |
if ($start === false) {
|
681 |
return '';
|
682 |
}
|
683 |
|
684 |
// Bow out if the next token is a variable as we don't know where it was defined.
|
685 |
+
if ($tokens[$start]['code'] === \T_VARIABLE) {
|
686 |
return '';
|
687 |
}
|
688 |
|
689 |
// Bow out if the next token is the class keyword.
|
690 |
+
if ($tokens[$start]['type'] === 'T_ANON_CLASS' || $tokens[$start]['code'] === \T_CLASS) {
|
691 |
return '';
|
692 |
}
|
693 |
|
694 |
$find = array(
|
695 |
+
\T_NS_SEPARATOR,
|
696 |
+
\T_STRING,
|
697 |
+
\T_NAMESPACE,
|
698 |
+
\T_WHITESPACE,
|
699 |
);
|
700 |
|
701 |
$end = $phpcsFile->findNext($find, ($start + 1), null, true, null, true);
|
712 |
* Returns an empty string if the class does not extend another class or if
|
713 |
* the class name could not be reliably inferred.
|
714 |
*
|
715 |
+
* @since 7.0.3
|
716 |
+
*
|
717 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
718 |
* @param int $stackPtr The position of a T_CLASS token.
|
719 |
*
|
720 |
* @return string
|
721 |
*/
|
722 |
+
public function getFQExtendedClassName(File $phpcsFile, $stackPtr)
|
723 |
{
|
724 |
$tokens = $phpcsFile->getTokens();
|
725 |
|
728 |
return '';
|
729 |
}
|
730 |
|
731 |
+
if ($tokens[$stackPtr]['code'] !== \T_CLASS
|
732 |
&& $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS'
|
733 |
&& $tokens[$stackPtr]['type'] !== 'T_INTERFACE'
|
734 |
) {
|
736 |
}
|
737 |
|
738 |
$extends = PHPCSHelper::findExtendedClassName($phpcsFile, $stackPtr);
|
739 |
+
if (empty($extends) || \is_string($extends) === false) {
|
740 |
return '';
|
741 |
}
|
742 |
|
750 |
*
|
751 |
* Returns an empty string if the class name could not be reliably inferred.
|
752 |
*
|
753 |
+
* @since 7.0.3
|
754 |
+
*
|
755 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
756 |
* @param int $stackPtr The position of a T_NEW token.
|
757 |
*
|
758 |
* @return string
|
759 |
*/
|
760 |
+
public function getFQClassNameFromDoubleColonToken(File $phpcsFile, $stackPtr)
|
761 |
{
|
762 |
$tokens = $phpcsFile->getTokens();
|
763 |
|
766 |
return '';
|
767 |
}
|
768 |
|
769 |
+
if ($tokens[$stackPtr]['code'] !== \T_DOUBLE_COLON) {
|
770 |
return '';
|
771 |
}
|
772 |
|
773 |
// Nothing to do if previous token is a variable as we don't know where it was defined.
|
774 |
+
if ($tokens[$stackPtr - 1]['code'] === \T_VARIABLE) {
|
775 |
return '';
|
776 |
}
|
777 |
|
778 |
// Nothing to do if 'parent' or 'static' as we don't know how far the class tree extends.
|
779 |
+
if (\in_array($tokens[$stackPtr - 1]['code'], array(\T_PARENT, \T_STATIC), true)) {
|
780 |
return '';
|
781 |
}
|
782 |
|
783 |
// Get the classname from the class declaration if self is used.
|
784 |
+
if ($tokens[$stackPtr - 1]['code'] === \T_SELF) {
|
785 |
+
$classDeclarationPtr = $phpcsFile->findPrevious(\T_CLASS, $stackPtr - 1);
|
786 |
if ($classDeclarationPtr === false) {
|
787 |
return '';
|
788 |
}
|
791 |
}
|
792 |
|
793 |
$find = array(
|
794 |
+
\T_NS_SEPARATOR,
|
795 |
+
\T_STRING,
|
796 |
+
\T_NAMESPACE,
|
797 |
+
\T_WHITESPACE,
|
798 |
);
|
799 |
|
800 |
$start = $phpcsFile->findPrevious($find, $stackPtr - 1, null, true, null, true);
|
816 |
* Checks if a class/function/constant name is already fully qualified and
|
817 |
* if not, enrich it with the relevant namespace information.
|
818 |
*
|
819 |
+
* @since 7.0.3
|
820 |
+
*
|
821 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
822 |
* @param int $stackPtr The position of the token.
|
823 |
* @param string $name The class / function / constant name.
|
824 |
*
|
825 |
* @return string
|
826 |
*/
|
827 |
+
public function getFQName(File $phpcsFile, $stackPtr, $name)
|
828 |
{
|
829 |
if (strpos($name, '\\') === 0) {
|
830 |
// Already fully qualified.
|
849 |
/**
|
850 |
* Is the class/function/constant name namespaced or global ?
|
851 |
*
|
852 |
+
* @since 7.0.3
|
853 |
+
*
|
854 |
* @param string $FQName Fully Qualified name of a class, function etc.
|
855 |
* I.e. should always start with a `\`.
|
856 |
*
|
857 |
* @return bool True if namespaced, false if global.
|
858 |
+
*
|
859 |
+
* @throws \PHP_CodeSniffer_Exception If the name in the passed parameter
|
860 |
+
* is not fully qualified.
|
861 |
*/
|
862 |
public function isNamespaced($FQName)
|
863 |
{
|
864 |
if (strpos($FQName, '\\') !== 0) {
|
865 |
+
throw new PHPCS_Exception('$FQName must be a fully qualified name');
|
866 |
}
|
867 |
|
868 |
return (strpos(substr($FQName, 1), '\\') !== false);
|
872 |
/**
|
873 |
* Determine the namespace name an arbitrary token lives in.
|
874 |
*
|
875 |
+
* @since 7.0.3
|
876 |
+
*
|
877 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
878 |
* @param int $stackPtr The token position for which to determine the namespace.
|
879 |
*
|
880 |
* @return string Namespace name or empty string if it couldn't be determined or no namespace applies.
|
881 |
*/
|
882 |
+
public function determineNamespace(File $phpcsFile, $stackPtr)
|
883 |
{
|
884 |
$tokens = $phpcsFile->getTokens();
|
885 |
|
890 |
|
891 |
// Check for scoped namespace {}.
|
892 |
if (empty($tokens[$stackPtr]['conditions']) === false) {
|
893 |
+
$namespacePtr = $phpcsFile->getCondition($stackPtr, \T_NAMESPACE);
|
894 |
if ($namespacePtr !== false) {
|
895 |
$namespace = $this->getDeclaredNamespaceName($phpcsFile, $namespacePtr);
|
896 |
if ($namespace !== false) {
|
912 |
$previousNSToken = $stackPtr;
|
913 |
$namespace = false;
|
914 |
do {
|
915 |
+
$previousNSToken = $phpcsFile->findPrevious(\T_NAMESPACE, ($previousNSToken - 1));
|
916 |
|
917 |
// Stop if we encounter a scoped namespace declaration as we already know we're not in one.
|
918 |
if (empty($tokens[$previousNSToken]['scope_condition']) === false && $tokens[$previousNSToken]['scope_condition'] === $previousNSToken) {
|
937 |
* For hierarchical namespaces, the name will be composed of several tokens,
|
938 |
* i.e. MyProject\Sub\Level which will be returned together as one string.
|
939 |
*
|
940 |
+
* @since 7.0.3
|
941 |
+
*
|
942 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
943 |
* @param int|bool $stackPtr The position of a T_NAMESPACE token.
|
944 |
*
|
945 |
* @return string|false Namespace name or false if not a namespace declaration.
|
946 |
* Namespace name can be an empty string for global namespace declaration.
|
947 |
*/
|
948 |
+
public function getDeclaredNamespaceName(File $phpcsFile, $stackPtr)
|
949 |
{
|
950 |
$tokens = $phpcsFile->getTokens();
|
951 |
|
954 |
return false;
|
955 |
}
|
956 |
|
957 |
+
if ($tokens[$stackPtr]['code'] !== \T_NAMESPACE) {
|
958 |
return false;
|
959 |
}
|
960 |
|
961 |
+
if ($tokens[($stackPtr + 1)]['code'] === \T_NS_SEPARATOR) {
|
962 |
+
// Not a namespace declaration, but use of, i.e. `namespace\someFunction();`.
|
963 |
return false;
|
964 |
}
|
965 |
|
966 |
+
$nextToken = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
|
967 |
+
if ($tokens[$nextToken]['code'] === \T_OPEN_CURLY_BRACKET) {
|
968 |
+
/*
|
969 |
+
* Declaration for global namespace when using multiple namespaces in a file.
|
970 |
+
* I.e.: `namespace {}`.
|
971 |
+
*/
|
972 |
return '';
|
973 |
}
|
974 |
|
975 |
// Ok, this should be a namespace declaration, so get all the parts together.
|
976 |
$validTokens = array(
|
977 |
+
\T_STRING => true,
|
978 |
+
\T_NS_SEPARATOR => true,
|
979 |
+
\T_WHITESPACE => true,
|
980 |
);
|
981 |
|
982 |
$namespaceName = '';
|
997 |
*
|
998 |
* Expects to be passed T_RETURN_TYPE, T_FUNCTION or T_CLOSURE token.
|
999 |
*
|
1000 |
+
* @since 7.1.2
|
1001 |
+
*
|
1002 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1003 |
* @param int $stackPtr The position of the token.
|
1004 |
*
|
1006 |
* no return type was found or the passed token was
|
1007 |
* not of the correct type.
|
1008 |
*/
|
1009 |
+
public function getReturnTypeHintToken(File $phpcsFile, $stackPtr)
|
1010 |
{
|
1011 |
$tokens = $phpcsFile->getTokens();
|
1012 |
|
1013 |
+
if (\defined('T_RETURN_TYPE') && $tokens[$stackPtr]['code'] === \T_RETURN_TYPE) {
|
1014 |
return $stackPtr;
|
1015 |
}
|
1016 |
|
1017 |
+
if ($tokens[$stackPtr]['code'] !== \T_FUNCTION && $tokens[$stackPtr]['code'] !== \T_CLOSURE) {
|
1018 |
return false;
|
1019 |
}
|
1020 |
|
1027 |
if (isset($tokens[$stackPtr]['scope_opener'])) {
|
1028 |
$endOfFunctionDeclaration = $tokens[$stackPtr]['scope_opener'];
|
1029 |
} else {
|
1030 |
+
$nextSemiColon = $phpcsFile->findNext(\T_SEMICOLON, ($tokens[$stackPtr]['parenthesis_closer'] + 1), null, false, null, true);
|
1031 |
if ($nextSemiColon !== false) {
|
1032 |
$endOfFunctionDeclaration = $nextSemiColon;
|
1033 |
}
|
1038 |
}
|
1039 |
|
1040 |
$hasColon = $phpcsFile->findNext(
|
1041 |
+
array(\T_COLON, \T_INLINE_ELSE),
|
1042 |
($tokens[$stackPtr]['parenthesis_closer'] + 1),
|
1043 |
$endOfFunctionDeclaration
|
1044 |
);
|
1056 |
* As of PHPCS 3.3.0 `array` as a type declaration will be tokenized as `T_STRING`.
|
1057 |
*/
|
1058 |
$unrecognizedTypes = array(
|
1059 |
+
\T_CALLABLE,
|
1060 |
+
\T_SELF,
|
1061 |
+
\T_PARENT,
|
1062 |
+
\T_ARRAY, // PHPCS < 2.4.0.
|
1063 |
+
\T_STRING,
|
1064 |
);
|
1065 |
|
1066 |
return $phpcsFile->findPrevious($unrecognizedTypes, ($endOfFunctionDeclaration - 1), $hasColon);
|
1080 |
* Expects to be passed a T_RETURN_TYPE token or the return value from a call to
|
1081 |
* the Sniff::getReturnTypeHintToken() method.
|
1082 |
*
|
1083 |
+
* @since 8.2.0
|
1084 |
+
*
|
1085 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1086 |
* @param int $stackPtr The position of the return type token.
|
1087 |
*
|
1088 |
+
* @return string The name of the return type token.
|
1089 |
*/
|
1090 |
+
public function getReturnTypeHintName(File $phpcsFile, $stackPtr)
|
1091 |
{
|
1092 |
$tokens = $phpcsFile->getTokens();
|
1093 |
|
1094 |
// In older PHPCS versions, the nullable indicator will turn a return type colon into a T_INLINE_ELSE.
|
1095 |
+
$colon = $phpcsFile->findPrevious(array(\T_COLON, \T_INLINE_ELSE, \T_FUNCTION, \T_CLOSE_PARENTHESIS), ($stackPtr - 1));
|
1096 |
if ($colon === false
|
1097 |
+
|| ($tokens[$colon]['code'] !== \T_COLON && $tokens[$colon]['code'] !== \T_INLINE_ELSE)
|
1098 |
) {
|
1099 |
// Shouldn't happen, just in case.
|
1100 |
+
return '';
|
1101 |
}
|
1102 |
|
|
|
|
|
1103 |
$returnTypeHint = '';
|
1104 |
for ($i = ($colon + 1); $i <= $stackPtr; $i++) {
|
1105 |
// As of PHPCS 3.3.0+, all tokens are tokenized as "normal", so T_CALLABLE, T_SELF etc are
|
1106 |
// all possible, just exclude anything that's regarded as empty and the nullable indicator.
|
1107 |
+
if (isset(Tokens::$emptyTokens[$tokens[$i]['code']])) {
|
1108 |
continue;
|
1109 |
}
|
1110 |
|
1112 |
continue;
|
1113 |
}
|
1114 |
|
1115 |
+
if (\defined('T_NULLABLE') === false && $tokens[$i]['code'] === \T_INLINE_THEN) {
|
1116 |
// Old PHPCS.
|
1117 |
continue;
|
1118 |
}
|
1132 |
* anonymous classes. Along the same lines, the`getMemberProperties()`
|
1133 |
* method does not support the `var` prefix.
|
1134 |
*
|
1135 |
+
* @since 7.1.4
|
1136 |
+
*
|
1137 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
1138 |
* @param int $stackPtr The position in the stack of the
|
1139 |
* T_VARIABLE token to verify.
|
1140 |
*
|
1141 |
* @return bool
|
1142 |
*/
|
1143 |
+
public function isClassProperty(File $phpcsFile, $stackPtr)
|
1144 |
{
|
1145 |
$tokens = $phpcsFile->getTokens();
|
1146 |
|
1147 |
+
if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_VARIABLE) {
|
1148 |
return false;
|
1149 |
}
|
1150 |
|
1154 |
'T_ANON_CLASS' => true,
|
1155 |
'T_TRAIT' => true,
|
1156 |
);
|
1157 |
+
|
1158 |
+
$scopePtr = $this->validDirectScope($phpcsFile, $stackPtr, $validScopes);
|
1159 |
+
if ($scopePtr !== false) {
|
1160 |
// Make sure it's not a method parameter.
|
1161 |
if (empty($tokens[$stackPtr]['nested_parenthesis']) === true) {
|
1162 |
return true;
|
1163 |
+
} else {
|
1164 |
+
$parenthesis = array_keys($tokens[$stackPtr]['nested_parenthesis']);
|
1165 |
+
$deepestOpen = array_pop($parenthesis);
|
1166 |
+
if ($deepestOpen < $scopePtr
|
1167 |
+
|| isset($tokens[$deepestOpen]['parenthesis_owner']) === false
|
1168 |
+
|| $tokens[$tokens[$deepestOpen]['parenthesis_owner']]['code'] !== \T_FUNCTION
|
1169 |
+
) {
|
1170 |
+
return true;
|
1171 |
+
}
|
1172 |
}
|
1173 |
}
|
1174 |
|
1179 |
/**
|
1180 |
* Check whether a T_CONST token is a class constant declaration.
|
1181 |
*
|
1182 |
+
* @since 7.1.4
|
1183 |
+
*
|
1184 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
1185 |
* @param int $stackPtr The position in the stack of the
|
1186 |
* T_CONST token to verify.
|
1187 |
*
|
1188 |
* @return bool
|
1189 |
*/
|
1190 |
+
public function isClassConstant(File $phpcsFile, $stackPtr)
|
1191 |
{
|
1192 |
$tokens = $phpcsFile->getTokens();
|
1193 |
|
1194 |
+
if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_CONST) {
|
1195 |
return false;
|
1196 |
}
|
1197 |
|
1201 |
'T_ANON_CLASS' => true,
|
1202 |
'T_INTERFACE' => true,
|
1203 |
);
|
1204 |
+
if ($this->validDirectScope($phpcsFile, $stackPtr, $validScopes) !== false) {
|
1205 |
return true;
|
1206 |
}
|
1207 |
|
1215 |
*
|
1216 |
* Used to check, for instance, if a T_CONST is a class constant.
|
1217 |
*
|
1218 |
+
* @since 7.1.4
|
1219 |
+
*
|
1220 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
1221 |
* @param int $stackPtr The position in the stack of the
|
1222 |
+
* token to verify.
|
1223 |
* @param array $validScopes Array of token types.
|
1224 |
* Keys should be the token types in string
|
1225 |
* format to allow for newer token types.
|
1226 |
* Value is irrelevant.
|
1227 |
*
|
1228 |
+
* @return int|bool StackPtr to the scope if valid, false otherwise.
|
1229 |
*/
|
1230 |
+
protected function validDirectScope(File $phpcsFile, $stackPtr, $validScopes)
|
1231 |
{
|
1232 |
$tokens = $phpcsFile->getTokens();
|
1233 |
|
1246 |
}
|
1247 |
|
1248 |
if (isset($validScopes[$tokens[$ptr]['type']]) === true) {
|
1249 |
+
return $ptr;
|
1250 |
}
|
1251 |
|
1252 |
return false;
|
1261 |
* Strips potential nullable indicator and potential global namespace
|
1262 |
* indicator from the type hints before returning them.
|
1263 |
*
|
1264 |
+
* @since 7.1.4
|
1265 |
+
*
|
1266 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1267 |
* @param int $stackPtr The position of the token.
|
1268 |
*
|
1271 |
* - no type hints were found
|
1272 |
* - or the passed token was not of the correct type.
|
1273 |
*/
|
1274 |
+
public function getTypeHintsFromFunctionDeclaration(File $phpcsFile, $stackPtr)
|
1275 |
{
|
1276 |
$tokens = $phpcsFile->getTokens();
|
1277 |
|
1278 |
+
if ($tokens[$stackPtr]['code'] !== \T_FUNCTION && $tokens[$stackPtr]['code'] !== \T_CLOSURE) {
|
1279 |
return array();
|
1280 |
}
|
1281 |
|
1282 |
$parameters = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
|
1283 |
+
if (empty($parameters) || \is_array($parameters) === false) {
|
1284 |
return array();
|
1285 |
}
|
1286 |
|
1309 |
/**
|
1310 |
* Get the hash algorithm name from the parameter in a hash function call.
|
1311 |
*
|
1312 |
+
* @since 7.0.7 Logic was originally contained in the `RemovedHashAlgorithms` sniff.
|
1313 |
+
*
|
1314 |
* @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
1315 |
* @param int $stackPtr The position of the T_STRING function token.
|
1316 |
*
|
1317 |
* @return string|false The algorithm name without quotes if this was a relevant hash
|
1318 |
* function call or false if it was not.
|
1319 |
*/
|
1320 |
+
public function getHashAlgorithmParameter(File $phpcsFile, $stackPtr)
|
1321 |
{
|
1322 |
$tokens = $phpcsFile->getTokens();
|
1323 |
|
1326 |
return false;
|
1327 |
}
|
1328 |
|
1329 |
+
if ($tokens[$stackPtr]['code'] !== \T_STRING) {
|
1330 |
return false;
|
1331 |
}
|
1332 |
|
1355 |
/**
|
1356 |
* Determine whether an arbitrary T_STRING token is the use of a global constant.
|
1357 |
*
|
1358 |
+
* @since 8.1.0
|
1359 |
+
*
|
1360 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1361 |
+
* @param int $stackPtr The position of the T_STRING token.
|
1362 |
*
|
1363 |
* @return bool
|
1364 |
*/
|
1365 |
+
public function isUseOfGlobalConstant(File $phpcsFile, $stackPtr)
|
1366 |
{
|
1367 |
static $isLowPHPCS, $isLowPHP;
|
1368 |
|
1374 |
}
|
1375 |
|
1376 |
// Is this one of the tokens this function handles ?
|
1377 |
+
if ($tokens[$stackPtr]['code'] !== \T_STRING) {
|
1378 |
return false;
|
1379 |
}
|
1380 |
|
1382 |
if (isset($isLowPHPCS, $isLowPHP) === false) {
|
1383 |
$isLowPHP = false;
|
1384 |
$isLowPHPCS = false;
|
1385 |
+
if (version_compare(\PHP_VERSION_ID, '50400', '<')) {
|
1386 |
$isLowPHP = true;
|
1387 |
$isLowPHPCS = version_compare(PHPCSHelper::getVersion(), '2.4.0', '<');
|
1388 |
}
|
1389 |
}
|
1390 |
|
1391 |
+
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
1392 |
if ($next !== false
|
1393 |
+
&& ($tokens[$next]['code'] === \T_OPEN_PARENTHESIS
|
1394 |
+
|| $tokens[$next]['code'] === \T_DOUBLE_COLON)
|
1395 |
) {
|
1396 |
// Function call or declaration.
|
1397 |
return false;
|
1419 |
'T_PRIVATE' => true,
|
1420 |
);
|
1421 |
|
1422 |
+
$prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
1423 |
if ($prev !== false
|
1424 |
&& (isset($tokensToIgnore[$tokens[$prev]['type']]) === true
|
1425 |
+
|| ($tokens[$prev]['code'] === \T_STRING
|
1426 |
&& (($isLowPHPCS === true
|
1427 |
&& $tokens[$prev]['content'] === 'trait')
|
1428 |
|| ($isLowPHP === true
|
1433 |
}
|
1434 |
|
1435 |
if ($prev !== false
|
1436 |
+
&& $tokens[$prev]['code'] === \T_NS_SEPARATOR
|
1437 |
+
&& $tokens[($prev - 1)]['code'] === \T_STRING
|
1438 |
) {
|
1439 |
// Namespaced constant of the same name.
|
1440 |
return false;
|
1441 |
}
|
1442 |
|
1443 |
if ($prev !== false
|
1444 |
+
&& $tokens[$prev]['code'] === \T_CONST
|
1445 |
&& $this->isClassConstant($phpcsFile, $prev) === true
|
1446 |
) {
|
1447 |
// Class constant declaration of the same name.
|
1457 |
}
|
1458 |
}
|
1459 |
|
1460 |
+
$firstOnLine = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true);
|
1461 |
+
if ($firstOnLine !== false && $tokens[$firstOnLine]['code'] === \T_USE) {
|
1462 |
+
$nextOnLine = $phpcsFile->findNext(Tokens::$emptyTokens, ($firstOnLine + 1), null, true);
|
1463 |
if ($nextOnLine !== false) {
|
1464 |
+
if (($tokens[$nextOnLine]['code'] === \T_STRING && $tokens[$nextOnLine]['content'] === 'const')
|
1465 |
+
|| $tokens[$nextOnLine]['code'] === \T_CONST // Happens in some PHPCS versions.
|
1466 |
) {
|
1467 |
+
$hasNsSep = $phpcsFile->findNext(\T_NS_SEPARATOR, ($nextOnLine + 1), $stackPtr);
|
1468 |
if ($hasNsSep !== false) {
|
1469 |
// Namespaced const (group) use statement.
|
1470 |
return false;
|
1489 |
*
|
1490 |
* Note: Zero is *not* regarded as a positive number.
|
1491 |
*
|
1492 |
+
* @since 8.2.0
|
1493 |
+
*
|
1494 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1495 |
* @param int $start Start of the snippet (inclusive), i.e. this
|
1496 |
* token will be examined as part of the snippet.
|
1502 |
* False if not or if it could not be reliably determined
|
1503 |
* (variable or calculations and such).
|
1504 |
*/
|
1505 |
+
public function isPositiveNumber(File $phpcsFile, $start, $end, $allowFloats = false)
|
1506 |
{
|
1507 |
$number = $this->isNumber($phpcsFile, $start, $end, $allowFloats);
|
1508 |
|
1523 |
*
|
1524 |
* Note: Zero is *not* regarded as a negative number.
|
1525 |
*
|
1526 |
+
* @since 8.2.0
|
1527 |
+
*
|
1528 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1529 |
* @param int $start Start of the snippet (inclusive), i.e. this
|
1530 |
* token will be examined as part of the snippet.
|
1536 |
* False if not or if it could not be reliably determined
|
1537 |
* (variable or calculations and such).
|
1538 |
*/
|
1539 |
+
public function isNegativeNumber(File $phpcsFile, $start, $end, $allowFloats = false)
|
1540 |
{
|
1541 |
$number = $this->isNumber($phpcsFile, $start, $end, $allowFloats);
|
1542 |
|
1545 |
}
|
1546 |
|
1547 |
return ($number < 0);
|
|
|
1548 |
}
|
1549 |
|
1550 |
/**
|
1559 |
* Mainly intended for examining variable assignments, function call parameters, array values
|
1560 |
* where the start and end of the snippet to examine is very clear.
|
1561 |
*
|
1562 |
+
* @since 8.2.0
|
1563 |
+
*
|
1564 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1565 |
* @param int $start Start of the snippet (inclusive), i.e. this
|
1566 |
* token will be examined as part of the snippet.
|
1575 |
* number or if it could not be reliably determined
|
1576 |
* (variable or calculations and such).
|
1577 |
*/
|
1578 |
+
protected function isNumber(File $phpcsFile, $start, $end, $allowFloats = false)
|
1579 |
{
|
1580 |
+
$stringTokens = Tokens::$heredocTokens + Tokens::$stringTokens;
|
|
|
1581 |
|
1582 |
+
$validTokens = array();
|
1583 |
+
$validTokens[\T_LNUMBER] = true;
|
1584 |
+
$validTokens[\T_TRUE] = true; // Evaluates to int 1.
|
1585 |
+
$validTokens[\T_FALSE] = true; // Evaluates to int 0.
|
1586 |
+
$validTokens[\T_NULL] = true; // Evaluates to int 0.
|
1587 |
|
1588 |
if ($allowFloats === true) {
|
1589 |
+
$validTokens[\T_DNUMBER] = true;
|
1590 |
}
|
1591 |
|
1592 |
$maybeValidTokens = $stringTokens + $validTokens;
|
1599 |
return false;
|
1600 |
}
|
1601 |
|
1602 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $start, $searchEnd, true);
|
1603 |
while ($nextNonEmpty !== false
|
1604 |
+
&& ($tokens[$nextNonEmpty]['code'] === \T_PLUS
|
1605 |
+
|| $tokens[$nextNonEmpty]['code'] === \T_MINUS)
|
1606 |
) {
|
1607 |
|
1608 |
+
if ($tokens[$nextNonEmpty]['code'] === \T_MINUS) {
|
1609 |
$negativeNumber = ($negativeNumber === false) ? true : false;
|
1610 |
}
|
1611 |
|
1612 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), $searchEnd, true);
|
1613 |
}
|
1614 |
|
1615 |
if ($nextNonEmpty === false || isset($maybeValidTokens[$tokens[$nextNonEmpty]['code']]) === false) {
|
1617 |
}
|
1618 |
|
1619 |
$content = false;
|
1620 |
+
if ($tokens[$nextNonEmpty]['code'] === \T_LNUMBER
|
1621 |
+
|| $tokens[$nextNonEmpty]['code'] === \T_DNUMBER
|
1622 |
) {
|
1623 |
$content = (float) $tokens[$nextNonEmpty]['content'];
|
1624 |
+
} elseif ($tokens[$nextNonEmpty]['code'] === \T_TRUE) {
|
1625 |
$content = 1.0;
|
1626 |
+
} elseif ($tokens[$nextNonEmpty]['code'] === \T_FALSE
|
1627 |
+
|| $tokens[$nextNonEmpty]['code'] === \T_NULL
|
1628 |
) {
|
1629 |
$content = 0.0;
|
1630 |
} elseif (isset($stringTokens[$tokens[$nextNonEmpty]['code']]) === true) {
|
1631 |
|
1632 |
+
if ($tokens[$nextNonEmpty]['code'] === \T_START_HEREDOC
|
1633 |
+
|| $tokens[$nextNonEmpty]['code'] === \T_START_NOWDOC
|
1634 |
) {
|
1635 |
// Skip past heredoc/nowdoc opener to the first content.
|
1636 |
+
$firstDocToken = $phpcsFile->findNext(array(\T_HEREDOC, \T_NOWDOC), ($nextNonEmpty + 1), $searchEnd);
|
1637 |
if ($firstDocToken === false) {
|
1638 |
// Live coding or parse error.
|
1639 |
return false;
|
1642 |
$stringContent = $content = $tokens[$firstDocToken]['content'];
|
1643 |
|
1644 |
// Skip forward to the end in preparation for the next part of the examination.
|
1645 |
+
$nextNonEmpty = $phpcsFile->findNext(array(\T_END_HEREDOC, \T_END_NOWDOC), ($nextNonEmpty + 1), $searchEnd);
|
1646 |
if ($nextNonEmpty === false) {
|
1647 |
// Live coding or parse error.
|
1648 |
return false;
|
1663 |
|
1664 |
/*
|
1665 |
* Regexes based on the formats outlined in the manual, created by JRF.
|
1666 |
+
* @link https://www.php.net/manual/en/language.types.float.php
|
1667 |
*/
|
1668 |
$regexInt = '`^\s*[0-9]+`';
|
1669 |
$regexFloat = '`^\s*(?:[+-]?(?:(?:(?P<LNUM>[0-9]+)|(?P<DNUM>([0-9]*\.(?P>LNUM)|(?P>LNUM)\.[0-9]*)))[eE][+-]?(?P>LNUM))|(?P>DNUM))`';
|
1700 |
// use that to get the numeric value if possible.
|
1701 |
// If the filter extension is not available, the value will be zero, but so be it.
|
1702 |
if (function_exists('filter_var')) {
|
1703 |
+
$filtered = filter_var($hexNumberString[1], \FILTER_VALIDATE_INT, \FILTER_FLAG_ALLOW_HEX);
|
1704 |
if ($filtered !== false) {
|
1705 |
$content = $filtered;
|
1706 |
}
|
1709 |
}
|
1710 |
|
1711 |
// OK, so we have a number, now is there still more code after it ?
|
1712 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), $searchEnd, true);
|
1713 |
if ($nextNonEmpty !== false) {
|
1714 |
return false;
|
1715 |
}
|
1726 |
}
|
1727 |
|
1728 |
|
1729 |
+
/**
|
1730 |
+
* Determine whether the tokens between $start and $end together form a numberic calculation
|
1731 |
+
* as recognized by PHP.
|
1732 |
+
*
|
1733 |
+
* The outcome of this function is reliable for `true`, `false` should be regarded as "undetermined".
|
1734 |
+
*
|
1735 |
+
* Mainly intended for examining variable assignments, function call parameters, array values
|
1736 |
+
* where the start and end of the snippet to examine is very clear.
|
1737 |
+
*
|
1738 |
+
* @since 9.0.0
|
1739 |
+
*
|
1740 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1741 |
+
* @param int $start Start of the snippet (inclusive), i.e. this
|
1742 |
+
* token will be examined as part of the snippet.
|
1743 |
+
* @param int $end End of the snippet (inclusive), i.e. this
|
1744 |
+
* token will be examined as part of the snippet.
|
1745 |
+
*
|
1746 |
+
* @return bool
|
1747 |
+
*/
|
1748 |
+
protected function isNumericCalculation(File $phpcsFile, $start, $end)
|
1749 |
+
{
|
1750 |
+
$arithmeticTokens = Tokens::$arithmeticTokens;
|
1751 |
+
|
1752 |
+
// phpcs:disable PHPCompatibility.Constants.NewConstants.t_powFound
|
1753 |
+
if (\defined('T_POW') && isset($arithmeticTokens[\T_POW]) === false) {
|
1754 |
+
// T_POW was not added to the arithmetic array until PHPCS 2.9.0.
|
1755 |
+
$arithmeticTokens[\T_POW] = \T_POW;
|
1756 |
+
}
|
1757 |
+
// phpcs:enable
|
1758 |
+
|
1759 |
+
$skipTokens = Tokens::$emptyTokens;
|
1760 |
+
$skipTokens[] = \T_MINUS;
|
1761 |
+
$skipTokens[] = \T_PLUS;
|
1762 |
+
|
1763 |
+
// Find the first arithmetic operator, but skip past +/- signs before numbers.
|
1764 |
+
$nextNonEmpty = ($start - 1);
|
1765 |
+
do {
|
1766 |
+
$nextNonEmpty = $phpcsFile->findNext($skipTokens, ($nextNonEmpty + 1), ($end + 1), true);
|
1767 |
+
$arithmeticOperator = $phpcsFile->findNext($arithmeticTokens, ($nextNonEmpty + 1), ($end + 1));
|
1768 |
+
} while ($nextNonEmpty !== false && $arithmeticOperator !== false && $nextNonEmpty === $arithmeticOperator);
|
1769 |
+
|
1770 |
+
if ($arithmeticOperator === false) {
|
1771 |
+
return false;
|
1772 |
+
}
|
1773 |
+
|
1774 |
+
$tokens = $phpcsFile->getTokens();
|
1775 |
+
$subsetStart = $start;
|
1776 |
+
$subsetEnd = ($arithmeticOperator - 1);
|
1777 |
+
|
1778 |
+
while ($this->isNumber($phpcsFile, $subsetStart, $subsetEnd, true) !== false
|
1779 |
+
&& isset($tokens[($arithmeticOperator + 1)]) === true
|
1780 |
+
) {
|
1781 |
+
// Recognize T_POW for PHPCS < 2.4.0 on low PHP versions.
|
1782 |
+
if (\defined('T_POW') === false
|
1783 |
+
&& $tokens[$arithmeticOperator]['code'] === \T_MULTIPLY
|
1784 |
+
&& $tokens[($arithmeticOperator + 1)]['code'] === \T_MULTIPLY
|
1785 |
+
&& isset($tokens[$arithmeticOperator + 2]) === true
|
1786 |
+
) {
|
1787 |
+
// Move operator one forward to the second * in T_POW.
|
1788 |
+
++$arithmeticOperator;
|
1789 |
+
}
|
1790 |
+
|
1791 |
+
$subsetStart = ($arithmeticOperator + 1);
|
1792 |
+
$nextNonEmpty = $arithmeticOperator;
|
1793 |
+
do {
|
1794 |
+
$nextNonEmpty = $phpcsFile->findNext($skipTokens, ($nextNonEmpty + 1), ($end + 1), true);
|
1795 |
+
$arithmeticOperator = $phpcsFile->findNext($arithmeticTokens, ($nextNonEmpty + 1), ($end + 1));
|
1796 |
+
} while ($nextNonEmpty !== false && $arithmeticOperator !== false && $nextNonEmpty === $arithmeticOperator);
|
1797 |
+
|
1798 |
+
if ($arithmeticOperator === false) {
|
1799 |
+
// Last calculation operator already reached.
|
1800 |
+
if ($this->isNumber($phpcsFile, $subsetStart, $end, true) !== false) {
|
1801 |
+
return true;
|
1802 |
+
}
|
1803 |
+
|
1804 |
+
return false;
|
1805 |
+
}
|
1806 |
+
|
1807 |
+
$subsetEnd = ($arithmeticOperator - 1);
|
1808 |
+
}
|
1809 |
+
|
1810 |
+
return false;
|
1811 |
+
}
|
1812 |
+
|
1813 |
+
|
1814 |
+
|
1815 |
+
/**
|
1816 |
+
* Determine whether a ternary is a short ternary, i.e. without "middle".
|
1817 |
+
*
|
1818 |
+
* N.B.: This is a back-fill for a new method which is expected to go into
|
1819 |
+
* PHP_CodeSniffer 3.5.0.
|
1820 |
+
* Once that method has been merged into PHPCS, this one should be moved
|
1821 |
+
* to the PHPCSHelper.php file.
|
1822 |
+
*
|
1823 |
+
* @since 9.2.0
|
1824 |
+
*
|
1825 |
+
* @codeCoverageIgnore Method as pulled upstream is accompanied by unit tests.
|
1826 |
+
*
|
1827 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1828 |
+
* @param int $stackPtr The position of the ternary operator
|
1829 |
+
* in the stack.
|
1830 |
+
*
|
1831 |
+
* @return bool True if short ternary, or false otherwise.
|
1832 |
+
*/
|
1833 |
+
public function isShortTernary(File $phpcsFile, $stackPtr)
|
1834 |
+
{
|
1835 |
+
$tokens = $phpcsFile->getTokens();
|
1836 |
+
if (isset($tokens[$stackPtr]) === false
|
1837 |
+
|| $tokens[$stackPtr]['code'] !== \T_INLINE_THEN
|
1838 |
+
) {
|
1839 |
+
return false;
|
1840 |
+
}
|
1841 |
+
|
1842 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
1843 |
+
if ($nextNonEmpty === false) {
|
1844 |
+
// Live coding or parse error.
|
1845 |
+
return false;
|
1846 |
+
}
|
1847 |
+
|
1848 |
+
if ($tokens[$nextNonEmpty]['code'] === \T_INLINE_ELSE) {
|
1849 |
+
return true;
|
1850 |
+
}
|
1851 |
+
|
1852 |
+
return false;
|
1853 |
+
}
|
1854 |
+
|
1855 |
+
|
1856 |
/**
|
1857 |
* Determine whether a T_OPEN/CLOSE_SHORT_ARRAY token is a list() construct.
|
1858 |
*
|
1859 |
* Note: A variety of PHPCS versions have bugs in the tokenizing of short arrays.
|
1860 |
* In that case, the tokens are identified as T_OPEN/CLOSE_SQUARE_BRACKET.
|
1861 |
*
|
1862 |
+
* @since 8.2.0
|
1863 |
+
*
|
1864 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1865 |
* @param int $stackPtr The position of the function call token.
|
1866 |
*
|
1867 |
* @return bool
|
1868 |
*/
|
1869 |
+
public function isShortList(File $phpcsFile, $stackPtr)
|
1870 |
{
|
1871 |
$tokens = $phpcsFile->getTokens();
|
1872 |
|
1876 |
}
|
1877 |
|
1878 |
// Is this one of the tokens this function handles ?
|
1879 |
+
if ($tokens[$stackPtr]['code'] !== \T_OPEN_SHORT_ARRAY
|
1880 |
+
&& $tokens[$stackPtr]['code'] !== \T_CLOSE_SHORT_ARRAY
|
1881 |
) {
|
1882 |
return false;
|
1883 |
}
|
1884 |
|
1885 |
switch ($tokens[$stackPtr]['code']) {
|
1886 |
+
case \T_OPEN_SHORT_ARRAY:
|
1887 |
if (isset($tokens[$stackPtr]['bracket_closer']) === true) {
|
1888 |
$opener = $stackPtr;
|
1889 |
$closer = $tokens[$stackPtr]['bracket_closer'];
|
1890 |
}
|
1891 |
break;
|
1892 |
|
1893 |
+
case \T_CLOSE_SHORT_ARRAY:
|
1894 |
if (isset($tokens[$stackPtr]['bracket_opener']) === true) {
|
1895 |
$opener = $tokens[$stackPtr]['bracket_opener'];
|
1896 |
$closer = $stackPtr;
|
1907 |
* PHPCS cross-version compatibility: work around for square brackets misidentified
|
1908 |
* as short array when preceded by a variable variable in older PHPCS versions.
|
1909 |
*/
|
1910 |
+
$prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($opener - 1), null, true, null, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1911 |
|
1912 |
if ($prevNonEmpty !== false
|
1913 |
+
&& $tokens[$prevNonEmpty]['code'] === \T_CLOSE_CURLY_BRACKET
|
1914 |
&& isset($tokens[$prevNonEmpty]['bracket_opener']) === true
|
1915 |
) {
|
1916 |
$maybeVariableVariable = $phpcsFile->findPrevious(
|
1917 |
+
Tokens::$emptyTokens,
|
1918 |
($tokens[$prevNonEmpty]['bracket_opener'] - 1),
|
1919 |
null,
|
1920 |
true,
|
1922 |
true
|
1923 |
);
|
1924 |
|
1925 |
+
if ($tokens[$maybeVariableVariable]['code'] === \T_VARIABLE
|
1926 |
+
|| $tokens[$maybeVariableVariable]['code'] === \T_DOLLAR
|
1927 |
) {
|
1928 |
return false;
|
1929 |
}
|
1930 |
}
|
1931 |
|
1932 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($closer + 1), null, true, null, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1933 |
|
1934 |
+
if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === \T_EQUAL) {
|
1935 |
return true;
|
1936 |
}
|
1937 |
|
1938 |
if ($prevNonEmpty !== false
|
1939 |
+
&& $tokens[$prevNonEmpty]['code'] === \T_AS
|
1940 |
&& isset($tokens[$prevNonEmpty]['nested_parenthesis']) === true
|
1941 |
) {
|
1942 |
$parentheses = array_reverse($tokens[$prevNonEmpty]['nested_parenthesis'], true);
|
1943 |
foreach ($parentheses as $open => $close) {
|
1944 |
if (isset($tokens[$open]['parenthesis_owner'])
|
1945 |
+
&& $tokens[$tokens[$open]['parenthesis_owner']]['code'] === \T_FOREACH
|
1946 |
) {
|
1947 |
return true;
|
1948 |
}
|
1953 |
$parentOpener = $opener;
|
1954 |
do {
|
1955 |
$parentOpener = $phpcsFile->findPrevious(
|
1956 |
+
array(\T_OPEN_SHORT_ARRAY, \T_OPEN_SQUARE_BRACKET),
|
1957 |
($parentOpener - 1),
|
1958 |
null,
|
1959 |
false,
|
1976 |
$phpcsVersion = PHPCSHelper::getVersion();
|
1977 |
if ((version_compare($phpcsVersion, '2.0', '>') === true
|
1978 |
&& version_compare($phpcsVersion, '2.8', '<') === true)
|
1979 |
+
&& $tokens[$parentOpener]['code'] === \T_OPEN_SQUARE_BRACKET
|
1980 |
) {
|
1981 |
$nextNonEmpty = $phpcsFile->findNext(
|
1982 |
+
Tokens::$emptyTokens,
|
1983 |
($tokens[$parentOpener]['bracket_closer'] + 1),
|
1984 |
null,
|
1985 |
true,
|
1987 |
true
|
1988 |
);
|
1989 |
|
1990 |
+
if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === \T_EQUAL) {
|
1991 |
return true;
|
1992 |
}
|
1993 |
|
1999 |
|
2000 |
return false;
|
2001 |
}
|
2002 |
+
|
2003 |
+
|
2004 |
+
/**
|
2005 |
+
* Determine whether the tokens between $start and $end could together represent a variable.
|
2006 |
+
*
|
2007 |
+
* @since 9.0.0
|
2008 |
+
*
|
2009 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
2010 |
+
* @param int $start Starting point stack pointer. Inclusive.
|
2011 |
+
* I.e. this token should be taken into account.
|
2012 |
+
* @param int $end End point stack pointer. Exclusive.
|
2013 |
+
* I.e. this token should not be taken into account.
|
2014 |
+
* @param int $targetNestingLevel The nesting level the variable should be at.
|
2015 |
+
*
|
2016 |
+
* @return bool
|
2017 |
+
*/
|
2018 |
+
public function isVariable(File $phpcsFile, $start, $end, $targetNestingLevel)
|
2019 |
+
{
|
2020 |
+
static $tokenBlackList, $bracketTokens;
|
2021 |
+
|
2022 |
+
// Create the token arrays only once.
|
2023 |
+
if (isset($tokenBlackList, $bracketTokens) === false) {
|
2024 |
+
|
2025 |
+
$tokenBlackList = array(
|
2026 |
+
\T_OPEN_PARENTHESIS => \T_OPEN_PARENTHESIS,
|
2027 |
+
\T_STRING_CONCAT => \T_STRING_CONCAT,
|
2028 |
+
);
|
2029 |
+
$tokenBlackList += Tokens::$assignmentTokens;
|
2030 |
+
$tokenBlackList += Tokens::$equalityTokens;
|
2031 |
+
$tokenBlackList += Tokens::$comparisonTokens;
|
2032 |
+
$tokenBlackList += Tokens::$operators;
|
2033 |
+
$tokenBlackList += Tokens::$booleanOperators;
|
2034 |
+
$tokenBlackList += Tokens::$castTokens;
|
2035 |
+
|
2036 |
+
/*
|
2037 |
+
* List of brackets which can be part of a variable variable.
|
2038 |
+
*
|
2039 |
+
* Key is the open bracket token, value the close bracket token.
|
2040 |
+
*/
|
2041 |
+
$bracketTokens = array(
|
2042 |
+
\T_OPEN_CURLY_BRACKET => \T_CLOSE_CURLY_BRACKET,
|
2043 |
+
\T_OPEN_SQUARE_BRACKET => \T_CLOSE_SQUARE_BRACKET,
|
2044 |
+
);
|
2045 |
+
}
|
2046 |
+
|
2047 |
+
$tokens = $phpcsFile->getTokens();
|
2048 |
+
|
2049 |
+
// If no variable at all was found, then it's definitely a no-no.
|
2050 |
+
$hasVariable = $phpcsFile->findNext(\T_VARIABLE, $start, $end);
|
2051 |
+
if ($hasVariable === false) {
|
2052 |
+
return false;
|
2053 |
+
}
|
2054 |
+
|
2055 |
+
// Check if the variable found is at the right level. Deeper levels are always an error.
|
2056 |
+
if (isset($tokens[$hasVariable]['nested_parenthesis'])
|
2057 |
+
&& \count($tokens[$hasVariable]['nested_parenthesis']) !== $targetNestingLevel
|
2058 |
+
) {
|
2059 |
+
return false;
|
2060 |
+
}
|
2061 |
+
|
2062 |
+
// Ok, so the first variable is at the right level, now are there any
|
2063 |
+
// blacklisted tokens within the empty() ?
|
2064 |
+
$hasBadToken = $phpcsFile->findNext($tokenBlackList, $start, $end);
|
2065 |
+
if ($hasBadToken === false) {
|
2066 |
+
return true;
|
2067 |
+
}
|
2068 |
+
|
2069 |
+
// If there are also bracket tokens, the blacklisted token might be part of a variable
|
2070 |
+
// variable, but if there are no bracket tokens, we know we have an error.
|
2071 |
+
$hasBrackets = $phpcsFile->findNext($bracketTokens, $start, $end);
|
2072 |
+
if ($hasBrackets === false) {
|
2073 |
+
return false;
|
2074 |
+
}
|
2075 |
+
|
2076 |
+
// Ok, we have both a blacklisted token as well as brackets, so we need to walk
|
2077 |
+
// the tokens of the variable variable.
|
2078 |
+
for ($i = $start; $i < $end; $i++) {
|
2079 |
+
// If this is a bracket token, skip to the end of the bracketed expression.
|
2080 |
+
if (isset($bracketTokens[$tokens[$i]['code']], $tokens[$i]['bracket_closer'])) {
|
2081 |
+
$i = $tokens[$i]['bracket_closer'];
|
2082 |
+
continue;
|
2083 |
+
}
|
2084 |
+
|
2085 |
+
// If it's a blacklisted token, not within brackets, we have an error.
|
2086 |
+
if (isset($tokenBlackList[$tokens[$i]['code']])) {
|
2087 |
+
return false;
|
2088 |
+
}
|
2089 |
+
}
|
2090 |
+
|
2091 |
+
return true;
|
2092 |
+
}
|
2093 |
+
|
2094 |
+
/**
|
2095 |
+
* Determine whether a T_MINUS/T_PLUS token is a unary operator.
|
2096 |
+
*
|
2097 |
+
* N.B.: This is a back-fill for a new method which is expected to go into
|
2098 |
+
* PHP_CodeSniffer 3.5.0.
|
2099 |
+
* Once that method has been merged into PHPCS, this one should be moved
|
2100 |
+
* to the PHPCSHelper.php file.
|
2101 |
+
*
|
2102 |
+
* @since 9.2.0
|
2103 |
+
*
|
2104 |
+
* @codeCoverageIgnore Method as pulled upstream is accompanied by unit tests.
|
2105 |
+
*
|
2106 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
2107 |
+
* @param int $stackPtr The position of the plus/minus token.
|
2108 |
+
*
|
2109 |
+
* @return bool True if the token passed is a unary operator.
|
2110 |
+
* False otherwise or if the token is not a T_PLUS/T_MINUS token.
|
2111 |
+
*/
|
2112 |
+
public static function isUnaryPlusMinus(File $phpcsFile, $stackPtr)
|
2113 |
+
{
|
2114 |
+
$tokens = $phpcsFile->getTokens();
|
2115 |
+
|
2116 |
+
if (isset($tokens[$stackPtr]) === false
|
2117 |
+
|| ($tokens[$stackPtr]['code'] !== \T_PLUS
|
2118 |
+
&& $tokens[$stackPtr]['code'] !== \T_MINUS)
|
2119 |
+
) {
|
2120 |
+
return false;
|
2121 |
+
}
|
2122 |
+
|
2123 |
+
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
2124 |
+
if ($next === false) {
|
2125 |
+
// Live coding or parse error.
|
2126 |
+
return false;
|
2127 |
+
}
|
2128 |
+
|
2129 |
+
if (isset(Tokens::$operators[$tokens[$next]['code']]) === true) {
|
2130 |
+
// Next token is an operator, so this is not a unary.
|
2131 |
+
return false;
|
2132 |
+
}
|
2133 |
+
|
2134 |
+
$prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
2135 |
+
|
2136 |
+
if ($tokens[$prev]['code'] === \T_RETURN) {
|
2137 |
+
// Just returning a positive/negative value; eg. (return -1).
|
2138 |
+
return true;
|
2139 |
+
}
|
2140 |
+
|
2141 |
+
if (isset(Tokens::$operators[$tokens[$prev]['code']]) === true) {
|
2142 |
+
// Just trying to operate on a positive/negative value; eg. ($var * -1).
|
2143 |
+
return true;
|
2144 |
+
}
|
2145 |
+
|
2146 |
+
if (isset(Tokens::$comparisonTokens[$tokens[$prev]['code']]) === true) {
|
2147 |
+
// Just trying to compare a positive/negative value; eg. ($var === -1).
|
2148 |
+
return true;
|
2149 |
+
}
|
2150 |
+
|
2151 |
+
if (isset(Tokens::$booleanOperators[$tokens[$prev]['code']]) === true) {
|
2152 |
+
// Just trying to compare a positive/negative value; eg. ($var || -1 === $b).
|
2153 |
+
return true;
|
2154 |
+
}
|
2155 |
+
|
2156 |
+
if (isset(Tokens::$assignmentTokens[$tokens[$prev]['code']]) === true) {
|
2157 |
+
// Just trying to assign a positive/negative value; eg. ($var = -1).
|
2158 |
+
return true;
|
2159 |
+
}
|
2160 |
+
|
2161 |
+
if (isset(Tokens::$castTokens[$tokens[$prev]['code']]) === true) {
|
2162 |
+
// Just casting a positive/negative value; eg. (string) -$var.
|
2163 |
+
return true;
|
2164 |
+
}
|
2165 |
+
|
2166 |
+
// Other indicators that a plus/minus sign is a unary operator.
|
2167 |
+
$invalidTokens = array(
|
2168 |
+
\T_COMMA => true,
|
2169 |
+
\T_OPEN_PARENTHESIS => true,
|
2170 |
+
\T_OPEN_SQUARE_BRACKET => true,
|
2171 |
+
\T_OPEN_SHORT_ARRAY => true,
|
2172 |
+
\T_COLON => true,
|
2173 |
+
\T_INLINE_THEN => true,
|
2174 |
+
\T_INLINE_ELSE => true,
|
2175 |
+
\T_CASE => true,
|
2176 |
+
\T_OPEN_CURLY_BRACKET => true,
|
2177 |
+
\T_STRING_CONCAT => true,
|
2178 |
+
);
|
2179 |
+
|
2180 |
+
if (isset($invalidTokens[$tokens[$prev]['code']]) === true) {
|
2181 |
+
// Just trying to use a positive/negative value; eg. myFunction($var, -2).
|
2182 |
+
return true;
|
2183 |
+
}
|
2184 |
+
|
2185 |
+
return false;
|
2186 |
+
}
|
2187 |
+
|
2188 |
+
/**
|
2189 |
+
* Get the complete contents of a multi-line text string.
|
2190 |
+
*
|
2191 |
+
* N.B.: This is a back-fill for a new method which is expected to go into
|
2192 |
+
* PHP_CodeSniffer 3.5.0.
|
2193 |
+
* Once that method has been merged into PHPCS, this one should be moved
|
2194 |
+
* to the PHPCSHelper.php file.
|
2195 |
+
*
|
2196 |
+
* @since 9.3.0
|
2197 |
+
*
|
2198 |
+
* @codeCoverageIgnore Method as pulled upstream is accompanied by unit tests.
|
2199 |
+
*
|
2200 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
2201 |
+
* @param int $stackPtr Pointer to the first text string token
|
2202 |
+
* of a multi-line text string or to a
|
2203 |
+
* Nowdoc/Heredoc opener.
|
2204 |
+
* @param bool $stripQuotes Optional. Whether to strip text delimiter
|
2205 |
+
* quotes off the resulting text string.
|
2206 |
+
* Defaults to true.
|
2207 |
+
*
|
2208 |
+
* @return string
|
2209 |
+
*
|
2210 |
+
* @throws \PHP_CodeSniffer_Exception If the specified position is not a
|
2211 |
+
* valid text string token or if the
|
2212 |
+
* token is not the first text string token.
|
2213 |
+
*/
|
2214 |
+
public function getCompleteTextString(File $phpcsFile, $stackPtr, $stripQuotes = true)
|
2215 |
+
{
|
2216 |
+
$tokens = $phpcsFile->getTokens();
|
2217 |
+
|
2218 |
+
// Must be the start of a text string token.
|
2219 |
+
if ($tokens[$stackPtr]['code'] !== \T_START_HEREDOC
|
2220 |
+
&& $tokens[$stackPtr]['code'] !== \T_START_NOWDOC
|
2221 |
+
&& $tokens[$stackPtr]['code'] !== \T_CONSTANT_ENCAPSED_STRING
|
2222 |
+
&& $tokens[$stackPtr]['code'] !== \T_DOUBLE_QUOTED_STRING
|
2223 |
+
) {
|
2224 |
+
throw new PHPCS_Exception('$stackPtr must be of type T_START_HEREDOC, T_START_NOWDOC, T_CONSTANT_ENCAPSED_STRING or T_DOUBLE_QUOTED_STRING');
|
2225 |
+
}
|
2226 |
+
|
2227 |
+
if ($tokens[$stackPtr]['code'] === \T_CONSTANT_ENCAPSED_STRING
|
2228 |
+
|| $tokens[$stackPtr]['code'] === \T_DOUBLE_QUOTED_STRING
|
2229 |
+
) {
|
2230 |
+
$prev = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
|
2231 |
+
if ($tokens[$stackPtr]['code'] === $tokens[$prev]['code']) {
|
2232 |
+
throw new PHPCS_Exception('$stackPtr must be the start of the text string');
|
2233 |
+
}
|
2234 |
+
}
|
2235 |
+
|
2236 |
+
switch ($tokens[$stackPtr]['code']) {
|
2237 |
+
case \T_START_HEREDOC:
|
2238 |
+
$stripQuotes = false;
|
2239 |
+
$targetType = \T_HEREDOC;
|
2240 |
+
$current = ($stackPtr + 1);
|
2241 |
+
break;
|
2242 |
+
|
2243 |
+
case \T_START_NOWDOC:
|
2244 |
+
$stripQuotes = false;
|
2245 |
+
$targetType = \T_NOWDOC;
|
2246 |
+
$current = ($stackPtr + 1);
|
2247 |
+
break;
|
2248 |
+
|
2249 |
+
default:
|
2250 |
+
$targetType = $tokens[$stackPtr]['code'];
|
2251 |
+
$current = $stackPtr;
|
2252 |
+
break;
|
2253 |
+
}
|
2254 |
+
|
2255 |
+
$string = '';
|
2256 |
+
do {
|
2257 |
+
$string .= $tokens[$current]['content'];
|
2258 |
+
++$current;
|
2259 |
+
} while ($tokens[$current]['code'] === $targetType);
|
2260 |
+
|
2261 |
+
if ($stripQuotes === true) {
|
2262 |
+
return $this->stripQuotes($string);
|
2263 |
+
}
|
2264 |
+
|
2265 |
+
return $string;
|
2266 |
+
}
|
2267 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/ForbiddenAbstractPrivateMethodsSniff.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
+
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace PHPCompatibility\Sniffs\Classes;
|
12 |
+
|
13 |
+
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Abstract private methods are not allowed since PHP 5.1.
|
18 |
+
*
|
19 |
+
* Abstract private methods were supported between PHP 5.0.0 and PHP 5.0.4, but
|
20 |
+
* were then disallowed on the grounds that the behaviours of `private` and `abstract`
|
21 |
+
* are mutually exclusive.
|
22 |
+
*
|
23 |
+
* PHP version 5.1
|
24 |
+
*
|
25 |
+
* @link https://www.php.net/manual/en/migration51.oop.php#migration51.oop-methods
|
26 |
+
*
|
27 |
+
* @since 9.2.0
|
28 |
+
*/
|
29 |
+
class ForbiddenAbstractPrivateMethodsSniff extends Sniff
|
30 |
+
{
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Valid scopes to check for abstract private methods.
|
34 |
+
*
|
35 |
+
* @since 9.2.0
|
36 |
+
*
|
37 |
+
* @var array
|
38 |
+
*/
|
39 |
+
public $ooScopeTokens = array(
|
40 |
+
'T_CLASS' => true,
|
41 |
+
'T_TRAIT' => true,
|
42 |
+
'T_ANON_CLASS' => true,
|
43 |
+
);
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Returns an array of tokens this test wants to listen for.
|
47 |
+
*
|
48 |
+
* @since 9.2.0
|
49 |
+
*
|
50 |
+
* @return array
|
51 |
+
*/
|
52 |
+
public function register()
|
53 |
+
{
|
54 |
+
return array(\T_FUNCTION);
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Processes this test, when one of its tokens is encountered.
|
59 |
+
*
|
60 |
+
* @since 9.2.0
|
61 |
+
*
|
62 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
63 |
+
* @param int $stackPtr The position of the current token
|
64 |
+
* in the stack passed in $tokens.
|
65 |
+
*
|
66 |
+
* @return void
|
67 |
+
*/
|
68 |
+
public function process(File $phpcsFile, $stackPtr)
|
69 |
+
{
|
70 |
+
if ($this->supportsAbove('5.1') === false) {
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
|
74 |
+
if ($this->validDirectScope($phpcsFile, $stackPtr, $this->ooScopeTokens) === false) {
|
75 |
+
// Function, not method.
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
|
79 |
+
$properties = $phpcsFile->getMethodProperties($stackPtr);
|
80 |
+
if ($properties['scope'] !== 'private' || $properties['is_abstract'] !== true) {
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
|
84 |
+
$phpcsFile->addError(
|
85 |
+
'Abstract methods cannot be declared as private since PHP 5.1',
|
86 |
+
$stackPtr,
|
87 |
+
'Found'
|
88 |
+
);
|
89 |
+
}
|
90 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Classes}/NewAnonymousClassesSniff.php
RENAMED
@@ -1,28 +1,28 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Wim Godden <wim.godden@cu.be>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
|
|
|
|
15 |
|
16 |
/**
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* Anonymous classes are supported in PHP 7.0
|
20 |
*
|
21 |
* PHP version 7.0
|
22 |
*
|
23 |
-
* @
|
24 |
-
* @
|
25 |
-
*
|
|
|
26 |
*/
|
27 |
class NewAnonymousClassesSniff extends Sniff
|
28 |
{
|
@@ -33,44 +33,50 @@ class NewAnonymousClassesSniff extends Sniff
|
|
33 |
* The dedicated anonymous class token is added from the `register()`
|
34 |
* method if the token is available.
|
35 |
*
|
|
|
|
|
36 |
* @var array
|
37 |
*/
|
38 |
private $indicators = array(
|
39 |
-
T_CLASS => T_CLASS,
|
40 |
);
|
41 |
|
42 |
/**
|
43 |
* Returns an array of tokens this test wants to listen for.
|
44 |
*
|
|
|
|
|
45 |
* @return array
|
46 |
*/
|
47 |
public function register()
|
48 |
{
|
49 |
-
if (defined('T_ANON_CLASS')) {
|
50 |
-
$this->indicators[T_ANON_CLASS] = T_ANON_CLASS;
|
51 |
}
|
52 |
|
53 |
-
return array(T_NEW);
|
54 |
-
}
|
55 |
|
56 |
|
57 |
/**
|
58 |
* Processes this test, when one of its tokens is encountered.
|
59 |
*
|
|
|
|
|
60 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
61 |
* @param int $stackPtr The position of the current token in the
|
62 |
* stack passed in $tokens.
|
63 |
*
|
64 |
* @return void
|
65 |
*/
|
66 |
-
public function process(
|
67 |
{
|
68 |
if ($this->supportsBelow('5.6') === false) {
|
69 |
return;
|
70 |
}
|
71 |
|
72 |
$tokens = $phpcsFile->getTokens();
|
73 |
-
$nextNonEmpty = $phpcsFile->findNext(
|
74 |
if ($nextNonEmpty === false || isset($this->indicators[$tokens[$nextNonEmpty]['code']]) === false) {
|
75 |
return;
|
76 |
}
|
@@ -81,8 +87,5 @@ class NewAnonymousClassesSniff extends Sniff
|
|
81 |
$stackPtr,
|
82 |
'Found'
|
83 |
);
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\Classes;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
|
17 |
/**
|
18 |
+
* Anonymous classes are supported since PHP 7.0.
|
|
|
|
|
19 |
*
|
20 |
* PHP version 7.0
|
21 |
*
|
22 |
+
* @link https://www.php.net/manual/en/language.oop5.anonymous.php
|
23 |
+
* @link https://wiki.php.net/rfc/anonymous_classes
|
24 |
+
*
|
25 |
+
* @since 7.0.0
|
26 |
*/
|
27 |
class NewAnonymousClassesSniff extends Sniff
|
28 |
{
|
33 |
* The dedicated anonymous class token is added from the `register()`
|
34 |
* method if the token is available.
|
35 |
*
|
36 |
+
* @since 7.1.2
|
37 |
+
*
|
38 |
* @var array
|
39 |
*/
|
40 |
private $indicators = array(
|
41 |
+
\T_CLASS => \T_CLASS,
|
42 |
);
|
43 |
|
44 |
/**
|
45 |
* Returns an array of tokens this test wants to listen for.
|
46 |
*
|
47 |
+
* @since 7.0.0
|
48 |
+
*
|
49 |
* @return array
|
50 |
*/
|
51 |
public function register()
|
52 |
{
|
53 |
+
if (\defined('T_ANON_CLASS')) {
|
54 |
+
$this->indicators[\T_ANON_CLASS] = \T_ANON_CLASS;
|
55 |
}
|
56 |
|
57 |
+
return array(\T_NEW);
|
58 |
+
}
|
59 |
|
60 |
|
61 |
/**
|
62 |
* Processes this test, when one of its tokens is encountered.
|
63 |
*
|
64 |
+
* @since 7.0.0
|
65 |
+
*
|
66 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
67 |
* @param int $stackPtr The position of the current token in the
|
68 |
* stack passed in $tokens.
|
69 |
*
|
70 |
* @return void
|
71 |
*/
|
72 |
+
public function process(File $phpcsFile, $stackPtr)
|
73 |
{
|
74 |
if ($this->supportsBelow('5.6') === false) {
|
75 |
return;
|
76 |
}
|
77 |
|
78 |
$tokens = $phpcsFile->getTokens();
|
79 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
|
80 |
if ($nextNonEmpty === false || isset($this->indicators[$tokens[$nextNonEmpty]['code']]) === false) {
|
81 |
return;
|
82 |
}
|
87 |
$stackPtr,
|
88 |
'Found'
|
89 |
);
|
90 |
+
}
|
91 |
+
}
|
|
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Classes}/NewClassesSniff.php
RENAMED
@@ -1,24 +1,34 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @category PHP
|
6 |
* @package PHPCompatibility
|
7 |
-
* @
|
8 |
-
* @
|
|
|
9 |
*/
|
10 |
|
11 |
-
namespace PHPCompatibility\Sniffs\
|
12 |
|
13 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
|
|
14 |
|
15 |
/**
|
16 |
-
*
|
17 |
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
*/
|
23 |
class NewClassesSniff extends AbstractNewFeatureSniff
|
24 |
{
|
@@ -29,6 +39,8 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
29 |
* The array lists : version number with false (not present) or true (present).
|
30 |
* If's sufficient to list the first version where the class appears.
|
31 |
*
|
|
|
|
|
32 |
* @var array(string => array(string => bool))
|
33 |
*/
|
34 |
protected $newClasses = array(
|
@@ -384,6 +396,26 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
384 |
'7.1' => true,
|
385 |
),
|
386 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
);
|
388 |
|
389 |
/**
|
@@ -395,17 +427,42 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
395 |
* {@internal Classes listed here do not need to be added to the $newClasses
|
396 |
* property as well.
|
397 |
* This list is automatically added to the $newClasses property
|
398 |
-
* in the `register()` method.}
|
|
|
|
|
|
|
|
|
399 |
*
|
400 |
* @var array(string => array(string => bool))
|
401 |
*/
|
402 |
protected $newExceptions = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
'Exception' => array(
|
404 |
// According to the docs introduced in PHP 5.1, but this appears to be.
|
405 |
// an error. Class was introduced with try/catch keywords in PHP 5.0.
|
406 |
'4.4' => false,
|
407 |
'5.0' => true,
|
408 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
'ErrorException' => array(
|
410 |
'5.0' => false,
|
411 |
'5.1' => true,
|
@@ -434,6 +491,10 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
434 |
'5.0' => false,
|
435 |
'5.1' => true,
|
436 |
),
|
|
|
|
|
|
|
|
|
437 |
'OutOfBoundsException' => array(
|
438 |
'5.0' => false,
|
439 |
'5.1' => true,
|
@@ -446,6 +507,10 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
446 |
'5.0' => false,
|
447 |
'5.1' => true,
|
448 |
),
|
|
|
|
|
|
|
|
|
449 |
'RangeException' => array(
|
450 |
'5.0' => false,
|
451 |
'5.1' => true,
|
@@ -462,26 +527,6 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
462 |
'5.0' => false,
|
463 |
'5.1' => true,
|
464 |
),
|
465 |
-
'DOMException' => array(
|
466 |
-
'4.4' => false,
|
467 |
-
'5.0' => true,
|
468 |
-
),
|
469 |
-
'mysqli_sql_exception' => array(
|
470 |
-
'4.4' => false,
|
471 |
-
'5.0' => true,
|
472 |
-
),
|
473 |
-
'PDOException' => array(
|
474 |
-
'5.0' => false,
|
475 |
-
'5.1' => true,
|
476 |
-
),
|
477 |
-
'ReflectionException' => array(
|
478 |
-
'4.4' => false,
|
479 |
-
'5.0' => true,
|
480 |
-
),
|
481 |
-
'SoapFault' => array(
|
482 |
-
'4.4' => false,
|
483 |
-
'5.0' => true,
|
484 |
-
),
|
485 |
|
486 |
'PharException' => array(
|
487 |
'5.2' => false,
|
@@ -494,8 +539,8 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
494 |
),
|
495 |
|
496 |
'IntlException' => array(
|
497 |
-
'5.
|
498 |
-
'5.5
|
499 |
),
|
500 |
|
501 |
'Error' => array(
|
@@ -522,6 +567,10 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
522 |
'5.6' => false,
|
523 |
'7.0' => true,
|
524 |
),
|
|
|
|
|
|
|
|
|
525 |
'UI\Exception\InvalidArgumentException' => array(
|
526 |
'5.6' => false,
|
527 |
'7.0' => true,
|
@@ -535,12 +584,46 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
535 |
'7.0' => false,
|
536 |
'7.1' => true,
|
537 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
538 |
);
|
539 |
|
540 |
|
541 |
/**
|
542 |
* Returns an array of tokens this test wants to listen for.
|
543 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
544 |
* @return array
|
545 |
*/
|
546 |
public function register()
|
@@ -553,38 +636,38 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
553 |
$this->newClasses = array_merge($this->newClasses, $this->newExceptions);
|
554 |
|
555 |
$targets = array(
|
556 |
-
T_NEW,
|
557 |
-
T_CLASS,
|
558 |
-
T_DOUBLE_COLON,
|
559 |
-
T_FUNCTION,
|
560 |
-
T_CLOSURE,
|
561 |
-
T_CATCH,
|
562 |
);
|
563 |
|
564 |
-
if (defined('T_ANON_CLASS')) {
|
565 |
-
|
566 |
-
$targets[] = T_ANON_CLASS;
|
567 |
}
|
568 |
|
569 |
-
if (defined('T_RETURN_TYPE')) {
|
570 |
-
$targets[] = T_RETURN_TYPE;
|
571 |
}
|
572 |
|
573 |
return $targets;
|
574 |
-
|
575 |
-
}//end register()
|
576 |
|
577 |
|
578 |
/**
|
579 |
* Processes this test, when one of its tokens is encountered.
|
580 |
*
|
|
|
|
|
581 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
582 |
* @param int $stackPtr The position of the current token in
|
583 |
* the stack passed in $tokens.
|
584 |
*
|
585 |
* @return void
|
586 |
*/
|
587 |
-
public function process(
|
588 |
{
|
589 |
$tokens = $phpcsFile->getTokens();
|
590 |
|
@@ -613,20 +696,21 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
613 |
$this->processSingularToken($phpcsFile, $stackPtr);
|
614 |
break;
|
615 |
}
|
616 |
-
|
617 |
-
}//end process()
|
618 |
|
619 |
|
620 |
/**
|
621 |
* Processes this test for when a token resulting in a singular class name is encountered.
|
622 |
*
|
|
|
|
|
623 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
624 |
* @param int $stackPtr The position of the current token in
|
625 |
* the stack passed in $tokens.
|
626 |
*
|
627 |
* @return void
|
628 |
*/
|
629 |
-
private function processSingularToken(
|
630 |
{
|
631 |
$tokens = $phpcsFile->getTokens();
|
632 |
$FQClassName = '';
|
@@ -657,14 +741,15 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
657 |
'nameLc' => $classNameLc,
|
658 |
);
|
659 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
660 |
-
|
661 |
-
}//end processSingularToken()
|
662 |
|
663 |
|
664 |
/**
|
665 |
* Processes this test for when a function token is encountered.
|
666 |
*
|
667 |
-
* - Detect new classes when used as a type
|
|
|
|
|
668 |
*
|
669 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
670 |
* @param int $stackPtr The position of the current token in
|
@@ -672,11 +757,11 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
672 |
*
|
673 |
* @return void
|
674 |
*/
|
675 |
-
private function processFunctionToken(
|
676 |
{
|
677 |
// Retrieve typehints stripped of global NS indicator and/or nullable indicator.
|
678 |
$typeHints = $this->getTypeHintsFromFunctionDeclaration($phpcsFile, $stackPtr);
|
679 |
-
if (empty($typeHints) || is_array($typeHints) === false) {
|
680 |
return;
|
681 |
}
|
682 |
|
@@ -700,13 +785,15 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
700 |
*
|
701 |
* - Detect exceptions when used in a catch statement.
|
702 |
*
|
|
|
|
|
703 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
704 |
* @param int $stackPtr The position of the current token in
|
705 |
* the stack passed in $tokens.
|
706 |
*
|
707 |
* @return void
|
708 |
*/
|
709 |
-
private function processCatchToken(
|
710 |
{
|
711 |
$tokens = $phpcsFile->getTokens();
|
712 |
|
@@ -720,12 +807,12 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
720 |
$name = '';
|
721 |
$listen = array(
|
722 |
// Parts of a (namespaced) class name.
|
723 |
-
T_STRING => true,
|
724 |
-
T_NS_SEPARATOR => true,
|
725 |
// End/split tokens.
|
726 |
-
T_VARIABLE => false,
|
727 |
-
T_BITWISE_OR => false,
|
728 |
-
T_CLOSE_CURLY_BRACKET => false, // Shouldn't be needed as we expect a var before this.
|
729 |
);
|
730 |
|
731 |
for ($i = ($opener + 1); $i < $closer; $i++) {
|
@@ -766,15 +853,21 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
766 |
*
|
767 |
* - Detect new classes when used as a return type declaration.
|
768 |
*
|
|
|
|
|
769 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
770 |
* @param int $stackPtr The position of the current token in
|
771 |
* the stack passed in $tokens.
|
772 |
*
|
773 |
* @return void
|
774 |
*/
|
775 |
-
private function processReturnTypeToken(
|
776 |
{
|
777 |
-
$returnTypeHint
|
|
|
|
|
|
|
|
|
778 |
$returnTypeHint = ltrim($returnTypeHint, '\\');
|
779 |
$returnTypeHintLc = strtolower($returnTypeHint);
|
780 |
|
@@ -794,6 +887,8 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
794 |
/**
|
795 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
796 |
*
|
|
|
|
|
797 |
* @param array $itemInfo Base information about the item.
|
798 |
*
|
799 |
* @return array Version and other information about the item.
|
@@ -807,12 +902,12 @@ class NewClassesSniff extends AbstractNewFeatureSniff
|
|
807 |
/**
|
808 |
* Get the error message template for this sniff.
|
809 |
*
|
|
|
|
|
810 |
* @return string
|
811 |
*/
|
812 |
protected function getErrorMsgTemplate()
|
813 |
{
|
814 |
return 'The built-in class ' . parent::getErrorMsgTemplate();
|
815 |
}
|
816 |
-
|
817 |
-
|
818 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
|
|
5 |
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\Classes;
|
12 |
|
13 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
17 |
+
* Detect use of new PHP native classes.
|
18 |
*
|
19 |
+
* The sniff analyses the following constructs to find usage of new classes:
|
20 |
+
* - Class instantiation using the `new` keyword.
|
21 |
+
* - (Anonymous) Class declarations to detect new classes being extended by userland classes.
|
22 |
+
* - Static use of class properties, constants or functions using the double colon.
|
23 |
+
* - Function/closure declarations to detect new classes used as parameter type declarations.
|
24 |
+
* - Function/closure declarations to detect new classes used as return type declarations.
|
25 |
+
* - Try/catch statements to detect new exception classes being caught.
|
26 |
+
*
|
27 |
+
* PHP version All
|
28 |
+
*
|
29 |
+
* @since 5.5
|
30 |
+
* @since 5.6 Now extends the base `Sniff` class.
|
31 |
+
* @since 7.1.0 Now extends the `AbstractNewFeatureSniff` class.
|
32 |
*/
|
33 |
class NewClassesSniff extends AbstractNewFeatureSniff
|
34 |
{
|
39 |
* The array lists : version number with false (not present) or true (present).
|
40 |
* If's sufficient to list the first version where the class appears.
|
41 |
*
|
42 |
+
* @since 5.5
|
43 |
+
*
|
44 |
* @var array(string => array(string => bool))
|
45 |
*/
|
46 |
protected $newClasses = array(
|
396 |
'7.1' => true,
|
397 |
),
|
398 |
|
399 |
+
'FFI' => array(
|
400 |
+
'7.3' => false,
|
401 |
+
'7.4' => true,
|
402 |
+
),
|
403 |
+
'FFI\CData' => array(
|
404 |
+
'7.3' => false,
|
405 |
+
'7.4' => true,
|
406 |
+
),
|
407 |
+
'FFI\CType' => array(
|
408 |
+
'7.3' => false,
|
409 |
+
'7.4' => true,
|
410 |
+
),
|
411 |
+
'ReflectionReference' => array(
|
412 |
+
'7.3' => false,
|
413 |
+
'7.4' => true,
|
414 |
+
),
|
415 |
+
'WeakReference' => array(
|
416 |
+
'7.3' => false,
|
417 |
+
'7.4' => true,
|
418 |
+
),
|
419 |
);
|
420 |
|
421 |
/**
|
427 |
* {@internal Classes listed here do not need to be added to the $newClasses
|
428 |
* property as well.
|
429 |
* This list is automatically added to the $newClasses property
|
430 |
+
* in the `register()` method.}
|
431 |
+
*
|
432 |
+
* {@internal Helper to update this list: https://3v4l.org/MhlUp}
|
433 |
+
*
|
434 |
+
* @since 7.1.4
|
435 |
*
|
436 |
* @var array(string => array(string => bool))
|
437 |
*/
|
438 |
protected $newExceptions = array(
|
439 |
+
'com_exception' => array(
|
440 |
+
'4.4' => false,
|
441 |
+
'5.0' => true,
|
442 |
+
),
|
443 |
+
'DOMException' => array(
|
444 |
+
'4.4' => false,
|
445 |
+
'5.0' => true,
|
446 |
+
),
|
447 |
'Exception' => array(
|
448 |
// According to the docs introduced in PHP 5.1, but this appears to be.
|
449 |
// an error. Class was introduced with try/catch keywords in PHP 5.0.
|
450 |
'4.4' => false,
|
451 |
'5.0' => true,
|
452 |
),
|
453 |
+
'ReflectionException' => array(
|
454 |
+
'4.4' => false,
|
455 |
+
'5.0' => true,
|
456 |
+
),
|
457 |
+
'SoapFault' => array(
|
458 |
+
'4.4' => false,
|
459 |
+
'5.0' => true,
|
460 |
+
),
|
461 |
+
'SQLiteException' => array(
|
462 |
+
'4.4' => false,
|
463 |
+
'5.0' => true,
|
464 |
+
),
|
465 |
+
|
466 |
'ErrorException' => array(
|
467 |
'5.0' => false,
|
468 |
'5.1' => true,
|
491 |
'5.0' => false,
|
492 |
'5.1' => true,
|
493 |
),
|
494 |
+
'mysqli_sql_exception' => array(
|
495 |
+
'5.0' => false,
|
496 |
+
'5.1' => true,
|
497 |
+
),
|
498 |
'OutOfBoundsException' => array(
|
499 |
'5.0' => false,
|
500 |
'5.1' => true,
|
507 |
'5.0' => false,
|
508 |
'5.1' => true,
|
509 |
),
|
510 |
+
'PDOException' => array(
|
511 |
+
'5.0' => false,
|
512 |
+
'5.1' => true,
|
513 |
+
),
|
514 |
'RangeException' => array(
|
515 |
'5.0' => false,
|
516 |
'5.1' => true,
|
527 |
'5.0' => false,
|
528 |
'5.1' => true,
|
529 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
|
531 |
'PharException' => array(
|
532 |
'5.2' => false,
|
539 |
),
|
540 |
|
541 |
'IntlException' => array(
|
542 |
+
'5.4' => false,
|
543 |
+
'5.5' => true,
|
544 |
),
|
545 |
|
546 |
'Error' => array(
|
567 |
'5.6' => false,
|
568 |
'7.0' => true,
|
569 |
),
|
570 |
+
'ClosedGeneratorException' => array(
|
571 |
+
'5.6' => false,
|
572 |
+
'7.0' => true,
|
573 |
+
),
|
574 |
'UI\Exception\InvalidArgumentException' => array(
|
575 |
'5.6' => false,
|
576 |
'7.0' => true,
|
584 |
'7.0' => false,
|
585 |
'7.1' => true,
|
586 |
),
|
587 |
+
|
588 |
+
'SodiumException' => array(
|
589 |
+
'7.1' => false,
|
590 |
+
'7.2' => true,
|
591 |
+
),
|
592 |
+
|
593 |
+
'CompileError' => array(
|
594 |
+
'7.2' => false,
|
595 |
+
'7.3' => true,
|
596 |
+
),
|
597 |
+
'JsonException' => array(
|
598 |
+
'7.2' => false,
|
599 |
+
'7.3' => true,
|
600 |
+
),
|
601 |
+
|
602 |
+
'FFI\Exception' => array(
|
603 |
+
'7.3' => false,
|
604 |
+
'7.4' => true,
|
605 |
+
),
|
606 |
+
'FFI\ParserException' => array(
|
607 |
+
'7.3' => false,
|
608 |
+
'7.4' => true,
|
609 |
+
),
|
610 |
);
|
611 |
|
612 |
|
613 |
/**
|
614 |
* Returns an array of tokens this test wants to listen for.
|
615 |
*
|
616 |
+
* @since 5.5
|
617 |
+
* @since 7.0.3 - Now also targets the `class` keyword to detect extended classes.
|
618 |
+
* - Now also targets double colons to detect static class use.
|
619 |
+
* @since 7.1.4 - Now also targets anonymous classes to detect extended classes.
|
620 |
+
* - Now also targets functions/closures to detect new classes used
|
621 |
+
* as parameter type declarations.
|
622 |
+
* - Now also targets the `catch` control structure to detect new
|
623 |
+
* exception classes being caught.
|
624 |
+
* @since 8.2.0 Now also targets the `T_RETURN_TYPE` token to detect new classes used
|
625 |
+
* as return type declarations.
|
626 |
+
*
|
627 |
* @return array
|
628 |
*/
|
629 |
public function register()
|
636 |
$this->newClasses = array_merge($this->newClasses, $this->newExceptions);
|
637 |
|
638 |
$targets = array(
|
639 |
+
\T_NEW,
|
640 |
+
\T_CLASS,
|
641 |
+
\T_DOUBLE_COLON,
|
642 |
+
\T_FUNCTION,
|
643 |
+
\T_CLOSURE,
|
644 |
+
\T_CATCH,
|
645 |
);
|
646 |
|
647 |
+
if (\defined('T_ANON_CLASS')) {
|
648 |
+
$targets[] = \T_ANON_CLASS;
|
|
|
649 |
}
|
650 |
|
651 |
+
if (\defined('T_RETURN_TYPE')) {
|
652 |
+
$targets[] = \T_RETURN_TYPE;
|
653 |
}
|
654 |
|
655 |
return $targets;
|
656 |
+
}
|
|
|
657 |
|
658 |
|
659 |
/**
|
660 |
* Processes this test, when one of its tokens is encountered.
|
661 |
*
|
662 |
+
* @since 5.5
|
663 |
+
*
|
664 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
665 |
* @param int $stackPtr The position of the current token in
|
666 |
* the stack passed in $tokens.
|
667 |
*
|
668 |
* @return void
|
669 |
*/
|
670 |
+
public function process(File $phpcsFile, $stackPtr)
|
671 |
{
|
672 |
$tokens = $phpcsFile->getTokens();
|
673 |
|
696 |
$this->processSingularToken($phpcsFile, $stackPtr);
|
697 |
break;
|
698 |
}
|
699 |
+
}
|
|
|
700 |
|
701 |
|
702 |
/**
|
703 |
* Processes this test for when a token resulting in a singular class name is encountered.
|
704 |
*
|
705 |
+
* @since 7.1.4
|
706 |
+
*
|
707 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
708 |
* @param int $stackPtr The position of the current token in
|
709 |
* the stack passed in $tokens.
|
710 |
*
|
711 |
* @return void
|
712 |
*/
|
713 |
+
private function processSingularToken(File $phpcsFile, $stackPtr)
|
714 |
{
|
715 |
$tokens = $phpcsFile->getTokens();
|
716 |
$FQClassName = '';
|
741 |
'nameLc' => $classNameLc,
|
742 |
);
|
743 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
744 |
+
}
|
|
|
745 |
|
746 |
|
747 |
/**
|
748 |
* Processes this test for when a function token is encountered.
|
749 |
*
|
750 |
+
* - Detect new classes when used as a parameter type declaration.
|
751 |
+
*
|
752 |
+
* @since 7.1.4
|
753 |
*
|
754 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
755 |
* @param int $stackPtr The position of the current token in
|
757 |
*
|
758 |
* @return void
|
759 |
*/
|
760 |
+
private function processFunctionToken(File $phpcsFile, $stackPtr)
|
761 |
{
|
762 |
// Retrieve typehints stripped of global NS indicator and/or nullable indicator.
|
763 |
$typeHints = $this->getTypeHintsFromFunctionDeclaration($phpcsFile, $stackPtr);
|
764 |
+
if (empty($typeHints) || \is_array($typeHints) === false) {
|
765 |
return;
|
766 |
}
|
767 |
|
785 |
*
|
786 |
* - Detect exceptions when used in a catch statement.
|
787 |
*
|
788 |
+
* @since 7.1.4
|
789 |
+
*
|
790 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
791 |
* @param int $stackPtr The position of the current token in
|
792 |
* the stack passed in $tokens.
|
793 |
*
|
794 |
* @return void
|
795 |
*/
|
796 |
+
private function processCatchToken(File $phpcsFile, $stackPtr)
|
797 |
{
|
798 |
$tokens = $phpcsFile->getTokens();
|
799 |
|
807 |
$name = '';
|
808 |
$listen = array(
|
809 |
// Parts of a (namespaced) class name.
|
810 |
+
\T_STRING => true,
|
811 |
+
\T_NS_SEPARATOR => true,
|
812 |
// End/split tokens.
|
813 |
+
\T_VARIABLE => false,
|
814 |
+
\T_BITWISE_OR => false,
|
815 |
+
\T_CLOSE_CURLY_BRACKET => false, // Shouldn't be needed as we expect a var before this.
|
816 |
);
|
817 |
|
818 |
for ($i = ($opener + 1); $i < $closer; $i++) {
|
853 |
*
|
854 |
* - Detect new classes when used as a return type declaration.
|
855 |
*
|
856 |
+
* @since 8.2.0
|
857 |
+
*
|
858 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
859 |
* @param int $stackPtr The position of the current token in
|
860 |
* the stack passed in $tokens.
|
861 |
*
|
862 |
* @return void
|
863 |
*/
|
864 |
+
private function processReturnTypeToken(File $phpcsFile, $stackPtr)
|
865 |
{
|
866 |
+
$returnTypeHint = $this->getReturnTypeHintName($phpcsFile, $stackPtr);
|
867 |
+
if (empty($returnTypeHint)) {
|
868 |
+
return;
|
869 |
+
}
|
870 |
+
|
871 |
$returnTypeHint = ltrim($returnTypeHint, '\\');
|
872 |
$returnTypeHintLc = strtolower($returnTypeHint);
|
873 |
|
887 |
/**
|
888 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
889 |
*
|
890 |
+
* @since 7.1.0
|
891 |
+
*
|
892 |
* @param array $itemInfo Base information about the item.
|
893 |
*
|
894 |
* @return array Version and other information about the item.
|
902 |
/**
|
903 |
* Get the error message template for this sniff.
|
904 |
*
|
905 |
+
* @since 7.1.0
|
906 |
+
*
|
907 |
* @return string
|
908 |
*/
|
909 |
protected function getErrorMsgTemplate()
|
910 |
{
|
911 |
return 'The built-in class ' . parent::getErrorMsgTemplate();
|
912 |
}
|
913 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Classes}/NewConstVisibilitySniff.php
RENAMED
@@ -1,62 +1,65 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
|
|
|
|
15 |
|
16 |
/**
|
17 |
-
* \PHPCompatibility\Sniffs\PHP\NewConstVisibility.
|
18 |
-
*
|
19 |
* Visibility for class constants is available since PHP 7.1.
|
20 |
*
|
21 |
* PHP version 7.1
|
22 |
*
|
23 |
-
* @
|
24 |
-
* @
|
25 |
-
*
|
|
|
26 |
*/
|
27 |
class NewConstVisibilitySniff extends Sniff
|
28 |
{
|
29 |
/**
|
30 |
* Returns an array of tokens this test wants to listen for.
|
31 |
*
|
|
|
|
|
32 |
* @return array
|
33 |
*/
|
34 |
public function register()
|
35 |
{
|
36 |
-
return array(T_CONST);
|
37 |
-
|
38 |
-
}//end register()
|
39 |
|
40 |
/**
|
41 |
* Processes this test, when one of its tokens is encountered.
|
42 |
*
|
|
|
|
|
43 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
44 |
* @param int $stackPtr The position of the current token
|
45 |
* in the stack passed in $tokens.
|
46 |
*
|
47 |
* @return void
|
48 |
*/
|
49 |
-
public function process(
|
50 |
{
|
51 |
if ($this->supportsBelow('7.0') === false) {
|
52 |
return;
|
53 |
}
|
54 |
|
55 |
$tokens = $phpcsFile->getTokens();
|
56 |
-
$prevToken = $phpcsFile->findPrevious(
|
57 |
|
58 |
// Is the previous token a visibility indicator ?
|
59 |
-
if ($prevToken === false ||
|
60 |
return;
|
61 |
}
|
62 |
|
@@ -73,7 +76,5 @@ class NewConstVisibilitySniff extends Sniff
|
|
73 |
'Found',
|
74 |
array($tokens[$prevToken]['content'])
|
75 |
);
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\Classes;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
|
17 |
/**
|
|
|
|
|
18 |
* Visibility for class constants is available since PHP 7.1.
|
19 |
*
|
20 |
* PHP version 7.1
|
21 |
*
|
22 |
+
* @link https://wiki.php.net/rfc/class_const_visibility
|
23 |
+
* @link https://www.php.net/manual/en/language.oop5.constants.php#language.oop5.basic.class.this
|
24 |
+
*
|
25 |
+
* @since 7.0.7
|
26 |
*/
|
27 |
class NewConstVisibilitySniff extends Sniff
|
28 |
{
|
29 |
/**
|
30 |
* Returns an array of tokens this test wants to listen for.
|
31 |
*
|
32 |
+
* @since 7.0.7
|
33 |
+
*
|
34 |
* @return array
|
35 |
*/
|
36 |
public function register()
|
37 |
{
|
38 |
+
return array(\T_CONST);
|
39 |
+
}
|
|
|
40 |
|
41 |
/**
|
42 |
* Processes this test, when one of its tokens is encountered.
|
43 |
*
|
44 |
+
* @since 7.0.7
|
45 |
+
*
|
46 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
47 |
* @param int $stackPtr The position of the current token
|
48 |
* in the stack passed in $tokens.
|
49 |
*
|
50 |
* @return void
|
51 |
*/
|
52 |
+
public function process(File $phpcsFile, $stackPtr)
|
53 |
{
|
54 |
if ($this->supportsBelow('7.0') === false) {
|
55 |
return;
|
56 |
}
|
57 |
|
58 |
$tokens = $phpcsFile->getTokens();
|
59 |
+
$prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
|
60 |
|
61 |
// Is the previous token a visibility indicator ?
|
62 |
+
if ($prevToken === false || isset(Tokens::$scopeModifiers[$tokens[$prevToken]['code']]) === false) {
|
63 |
return;
|
64 |
}
|
65 |
|
76 |
'Found',
|
77 |
array($tokens[$prevToken]['content'])
|
78 |
);
|
79 |
+
}
|
80 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/LateStaticBindingSniff.php → Classes/NewLateStaticBindingSniff.php}
RENAMED
@@ -1,59 +1,69 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
|
|
|
|
15 |
|
16 |
/**
|
17 |
-
*
|
|
|
|
|
|
|
|
|
18 |
*
|
19 |
* PHP version 5.3
|
20 |
*
|
21 |
-
* @
|
22 |
-
* @
|
23 |
-
*
|
|
|
|
|
24 |
*/
|
25 |
-
class
|
26 |
{
|
27 |
/**
|
28 |
* Returns an array of tokens this test wants to listen for.
|
29 |
*
|
|
|
|
|
30 |
* @return array
|
31 |
*/
|
32 |
public function register()
|
33 |
{
|
34 |
-
return array(T_STATIC);
|
35 |
-
|
36 |
-
}//end register()
|
37 |
|
38 |
|
39 |
/**
|
40 |
* Processes this test, when one of its tokens is encountered.
|
41 |
*
|
|
|
|
|
42 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
43 |
* @param int $stackPtr The position of the current token in the
|
44 |
* stack passed in $tokens.
|
45 |
*
|
46 |
* @return void
|
47 |
*/
|
48 |
-
public function process(
|
49 |
{
|
50 |
-
$nextNonEmpty = $phpcsFile->findNext(
|
51 |
if ($nextNonEmpty === false) {
|
52 |
return;
|
53 |
}
|
54 |
|
55 |
$tokens = $phpcsFile->getTokens();
|
56 |
-
if ($tokens[$nextNonEmpty]['code'] !== T_DOUBLE_COLON) {
|
57 |
return;
|
58 |
}
|
59 |
|
@@ -74,8 +84,5 @@ class LateStaticBindingSniff extends Sniff
|
|
74 |
'OutsideClassScope'
|
75 |
);
|
76 |
}
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\Classes;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
|
17 |
/**
|
18 |
+
* Detect use of late static binding as introduced in PHP 5.3.
|
19 |
+
*
|
20 |
+
* Checks for:
|
21 |
+
* - Late static binding as introduced in PHP 5.3.
|
22 |
+
* - Late static binding being used outside of class scope (unsupported).
|
23 |
*
|
24 |
* PHP version 5.3
|
25 |
*
|
26 |
+
* @link https://www.php.net/manual/en/language.oop5.late-static-bindings.php
|
27 |
+
* @link https://wiki.php.net/rfc/lsb_parentself_forwarding
|
28 |
+
*
|
29 |
+
* @since 7.0.3
|
30 |
+
* @since 9.0.0 Renamed from `LateStaticBindingSniff` to `NewLateStaticBindingSniff`.
|
31 |
*/
|
32 |
+
class NewLateStaticBindingSniff extends Sniff
|
33 |
{
|
34 |
/**
|
35 |
* Returns an array of tokens this test wants to listen for.
|
36 |
*
|
37 |
+
* @since 7.0.3
|
38 |
+
*
|
39 |
* @return array
|
40 |
*/
|
41 |
public function register()
|
42 |
{
|
43 |
+
return array(\T_STATIC);
|
44 |
+
}
|
|
|
45 |
|
46 |
|
47 |
/**
|
48 |
* Processes this test, when one of its tokens is encountered.
|
49 |
*
|
50 |
+
* @since 7.0.3
|
51 |
+
*
|
52 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
53 |
* @param int $stackPtr The position of the current token in the
|
54 |
* stack passed in $tokens.
|
55 |
*
|
56 |
* @return void
|
57 |
*/
|
58 |
+
public function process(File $phpcsFile, $stackPtr)
|
59 |
{
|
60 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
|
61 |
if ($nextNonEmpty === false) {
|
62 |
return;
|
63 |
}
|
64 |
|
65 |
$tokens = $phpcsFile->getTokens();
|
66 |
+
if ($tokens[$nextNonEmpty]['code'] !== \T_DOUBLE_COLON) {
|
67 |
return;
|
68 |
}
|
69 |
|
84 |
'OutsideClassScope'
|
85 |
);
|
86 |
}
|
87 |
+
}
|
88 |
+
}
|
|
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewTypedPropertiesSniff.php
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
+
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace PHPCompatibility\Sniffs\Classes;
|
12 |
+
|
13 |
+
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Typed class property declarations are available since PHP 7.4.
|
19 |
+
*
|
20 |
+
* PHP version 7.4
|
21 |
+
*
|
22 |
+
* @link https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.typed-properties
|
23 |
+
* @link https://wiki.php.net/rfc/typed_properties_v2
|
24 |
+
*
|
25 |
+
* @since 9.2.0
|
26 |
+
*/
|
27 |
+
class NewTypedPropertiesSniff extends Sniff
|
28 |
+
{
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Valid property modifier keywords.
|
32 |
+
*
|
33 |
+
* @since 9.2.0
|
34 |
+
*
|
35 |
+
* @var array
|
36 |
+
*/
|
37 |
+
private $modifierKeywords = array(
|
38 |
+
\T_PRIVATE => \T_PRIVATE,
|
39 |
+
\T_PROTECTED => \T_PROTECTED,
|
40 |
+
\T_PUBLIC => \T_PUBLIC,
|
41 |
+
\T_STATIC => \T_STATIC,
|
42 |
+
\T_VAR => \T_VAR,
|
43 |
+
);
|
44 |
+
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Returns an array of tokens this test wants to listen for.
|
48 |
+
*
|
49 |
+
* @since 9.2.0
|
50 |
+
*
|
51 |
+
* @return array
|
52 |
+
*/
|
53 |
+
public function register()
|
54 |
+
{
|
55 |
+
return array(\T_VARIABLE);
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Processes this test, when one of its tokens is encountered.
|
60 |
+
*
|
61 |
+
* @since 9.2.0
|
62 |
+
*
|
63 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
64 |
+
* @param int $stackPtr The position of the current token in the
|
65 |
+
* stack passed in $tokens.
|
66 |
+
*
|
67 |
+
* @return int|void Integer stack pointer to skip forward or void to continue
|
68 |
+
* normal file processing.
|
69 |
+
*/
|
70 |
+
public function process(File $phpcsFile, $stackPtr)
|
71 |
+
{
|
72 |
+
if ($this->isClassProperty($phpcsFile, $stackPtr) === false) {
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
|
76 |
+
$find = $this->modifierKeywords;
|
77 |
+
$find += array(
|
78 |
+
\T_SEMICOLON => \T_SEMICOLON,
|
79 |
+
\T_OPEN_CURLY_BRACKET => \T_OPEN_CURLY_BRACKET,
|
80 |
+
);
|
81 |
+
|
82 |
+
$tokens = $phpcsFile->getTokens();
|
83 |
+
$modifier = $phpcsFile->findPrevious($find, ($stackPtr - 1));
|
84 |
+
if ($modifier === false
|
85 |
+
|| $tokens[$modifier]['code'] === \T_SEMICOLON
|
86 |
+
|| $tokens[$modifier]['code'] === \T_OPEN_CURLY_BRACKET
|
87 |
+
) {
|
88 |
+
// Parse error. Ignore.
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
|
92 |
+
$type = $phpcsFile->findNext(Tokens::$emptyTokens, ($modifier + 1), null, true);
|
93 |
+
if ($tokens[$type]['code'] === \T_VARIABLE) {
|
94 |
+
return;
|
95 |
+
}
|
96 |
+
|
97 |
+
// Still here ? In that case, this will be a typed property.
|
98 |
+
if ($this->supportsBelow('7.3') === true) {
|
99 |
+
$phpcsFile->addError(
|
100 |
+
'Typed properties are not supported in PHP 7.3 or earlier',
|
101 |
+
$type,
|
102 |
+
'Found'
|
103 |
+
);
|
104 |
+
}
|
105 |
+
|
106 |
+
if ($this->supportsAbove('7.4') === true) {
|
107 |
+
// Examine the type to verify it's valid.
|
108 |
+
if ($tokens[$type]['type'] === 'T_NULLABLE'
|
109 |
+
// Needed to support PHPCS < 3.5.0 which doesn't correct to the nullable token type yet.
|
110 |
+
|| $tokens[$type]['code'] === \T_INLINE_THEN
|
111 |
+
) {
|
112 |
+
$type = $phpcsFile->findNext(Tokens::$emptyTokens, ($type + 1), null, true);
|
113 |
+
}
|
114 |
+
|
115 |
+
$content = $tokens[$type]['content'];
|
116 |
+
if ($content === 'void' || $content === 'callable') {
|
117 |
+
$phpcsFile->addError(
|
118 |
+
'%s is not supported as a type declaration for properties',
|
119 |
+
$type,
|
120 |
+
'InvalidType',
|
121 |
+
array($content)
|
122 |
+
);
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
$endOfStatement = $phpcsFile->findNext(\T_SEMICOLON, ($stackPtr + 1));
|
127 |
+
if ($endOfStatement !== false) {
|
128 |
+
// Don't throw the same error multiple times for multi-property declarations.
|
129 |
+
return ($endOfStatement + 1);
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/RemovedOrphanedParentSniff.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
+
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace PHPCompatibility\Sniffs\Classes;
|
12 |
+
|
13 |
+
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Using `parent` inside a class without parent is deprecated since PHP 7.4.
|
18 |
+
*
|
19 |
+
* This will throw a compile-time error in the future. Currently an error will only
|
20 |
+
* be generated if/when the parent is accessed at run-time.
|
21 |
+
*
|
22 |
+
* PHP version 7.4
|
23 |
+
*
|
24 |
+
* @link https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.core.parent
|
25 |
+
*
|
26 |
+
* @since 9.2.0
|
27 |
+
*/
|
28 |
+
class RemovedOrphanedParentSniff extends Sniff
|
29 |
+
{
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Class scopes to check the class declaration.
|
33 |
+
*
|
34 |
+
* @since 9.2.0
|
35 |
+
*
|
36 |
+
* @var array
|
37 |
+
*/
|
38 |
+
public $classScopeTokens = array(
|
39 |
+
'T_CLASS' => true,
|
40 |
+
'T_ANON_CLASS' => true,
|
41 |
+
);
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns an array of tokens this test wants to listen for.
|
45 |
+
*
|
46 |
+
* @since 9.2.0
|
47 |
+
*
|
48 |
+
* @return array
|
49 |
+
*/
|
50 |
+
public function register()
|
51 |
+
{
|
52 |
+
return array(\T_PARENT);
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Processes this test, when one of its tokens is encountered.
|
57 |
+
*
|
58 |
+
* @since 9.2.0
|
59 |
+
*
|
60 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
61 |
+
* @param int $stackPtr The position of the current token
|
62 |
+
* in the stack passed in $tokens.
|
63 |
+
*
|
64 |
+
* @return void
|
65 |
+
*/
|
66 |
+
public function process(File $phpcsFile, $stackPtr)
|
67 |
+
{
|
68 |
+
if ($this->supportsAbove('7.4') === false) {
|
69 |
+
return;
|
70 |
+
}
|
71 |
+
|
72 |
+
$tokens = $phpcsFile->getTokens();
|
73 |
+
|
74 |
+
if (empty($tokens[$stackPtr]['conditions']) === true) {
|
75 |
+
// Use within the global namespace. Not our concern.
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
|
79 |
+
/*
|
80 |
+
* Find the class within which this parent keyword is used.
|
81 |
+
*/
|
82 |
+
$conditions = $tokens[$stackPtr]['conditions'];
|
83 |
+
$conditions = array_reverse($conditions, true);
|
84 |
+
$classPtr = false;
|
85 |
+
|
86 |
+
foreach ($conditions as $ptr => $type) {
|
87 |
+
if (isset($this->classScopeTokens[$tokens[$ptr]['type']])) {
|
88 |
+
$classPtr = $ptr;
|
89 |
+
break;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
if ($classPtr === false) {
|
94 |
+
// Use outside of a class scope. Not our concern.
|
95 |
+
return;
|
96 |
+
}
|
97 |
+
|
98 |
+
if (isset($tokens[$classPtr]['scope_opener']) === false) {
|
99 |
+
// No scope opener known. Probably a parse error.
|
100 |
+
return;
|
101 |
+
}
|
102 |
+
|
103 |
+
$extends = $phpcsFile->findNext(\T_EXTENDS, ($classPtr + 1), $tokens[$classPtr]['scope_opener']);
|
104 |
+
if ($extends !== false) {
|
105 |
+
// Class has a parent.
|
106 |
+
return;
|
107 |
+
}
|
108 |
+
|
109 |
+
$phpcsFile->addError(
|
110 |
+
'Using "parent" inside a class without parent is deprecated since PHP 7.4',
|
111 |
+
$stackPtr,
|
112 |
+
'Deprecated'
|
113 |
+
);
|
114 |
+
}
|
115 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Constants}/NewConstantsSniff.php
RENAMED
@@ -1,22 +1,24 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
-
namespace PHPCompatibility\Sniffs\
|
11 |
|
12 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
|
|
13 |
|
14 |
/**
|
15 |
-
*
|
16 |
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* @
|
20 |
*/
|
21 |
class NewConstantsSniff extends AbstractNewFeatureSniff
|
22 |
{
|
@@ -27,9 +29,11 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
|
|
27 |
* The array lists : version number with false (not present) or true (present).
|
28 |
* If's sufficient to list the first version where the constant appears.
|
29 |
*
|
30 |
-
* Note: PHP
|
|
|
|
|
31 |
*
|
32 |
-
* @var array(string => array(string => bool
|
33 |
*/
|
34 |
protected $newConstants = array(
|
35 |
'E_STRICT' => array(
|
@@ -2148,10 +2152,19 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
|
|
2148 |
'7.0' => true,
|
2149 |
),
|
2150 |
// Tokenizer:
|
|
|
|
|
|
|
|
|
2151 |
'T_SPACESHIP' => array(
|
2152 |
'5.6' => false,
|
2153 |
'7.0' => true,
|
2154 |
),
|
|
|
|
|
|
|
|
|
|
|
2155 |
// Zlib:
|
2156 |
// The first three are in the PHP 5.4 changelog, but the Extension constant page says 7.0.
|
2157 |
'ZLIB_ENCODING_RAW' => array(
|
@@ -2677,6 +2690,22 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
|
|
2677 |
'7.1' => false,
|
2678 |
'7.2' => true,
|
2679 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2680 |
'SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES' => array(
|
2681 |
'7.1' => false,
|
2682 |
'7.2' => true,
|
@@ -2725,6 +2754,22 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
|
|
2725 |
'7.1' => false,
|
2726 |
'7.2' => true,
|
2727 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2728 |
'SODIUM_CRYPTO_AUTH_BYTES' => array(
|
2729 |
'7.1' => false,
|
2730 |
'7.2' => true,
|
@@ -2825,6 +2870,10 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
|
|
2825 |
'7.1' => false,
|
2826 |
'7.2' => true,
|
2827 |
),
|
|
|
|
|
|
|
|
|
2828 |
'SODIUM_CRYPTO_PWHASH_ALG_DEFAULT' => array(
|
2829 |
'7.1' => false,
|
2830 |
'7.2' => true,
|
@@ -2913,6 +2962,38 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
|
|
2913 |
'7.1' => false,
|
2914 |
'7.2' => true,
|
2915 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2916 |
'SODIUM_CRYPTO_SIGN_BYTES' => array(
|
2917 |
'7.1' => false,
|
2918 |
'7.2' => true,
|
@@ -2941,30 +3022,692 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
|
|
2941 |
'7.1' => false,
|
2942 |
'7.2' => true,
|
2943 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2944 |
);
|
2945 |
|
2946 |
|
2947 |
/**
|
2948 |
* Returns an array of tokens this test wants to listen for.
|
2949 |
*
|
|
|
|
|
2950 |
* @return array
|
2951 |
*/
|
2952 |
public function register()
|
2953 |
{
|
2954 |
-
return array(T_STRING);
|
2955 |
-
|
2956 |
-
}//end register()
|
2957 |
|
2958 |
/**
|
2959 |
* Processes this test, when one of its tokens is encountered.
|
2960 |
*
|
|
|
|
|
2961 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
2962 |
* @param int $stackPtr The position of the current token in the
|
2963 |
* stack passed in $tokens.
|
2964 |
*
|
2965 |
* @return void
|
2966 |
*/
|
2967 |
-
public function process(
|
2968 |
{
|
2969 |
$tokens = $phpcsFile->getTokens();
|
2970 |
$constantName = $tokens[$stackPtr]['content'];
|
@@ -2981,13 +3724,14 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
|
|
2981 |
'name' => $constantName,
|
2982 |
);
|
2983 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
2984 |
-
|
2985 |
-
}//end process()
|
2986 |
|
2987 |
|
2988 |
/**
|
2989 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
2990 |
*
|
|
|
|
|
2991 |
* @param array $itemInfo Base information about the item.
|
2992 |
*
|
2993 |
* @return array Version and other information about the item.
|
@@ -3001,12 +3745,12 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
|
|
3001 |
/**
|
3002 |
* Get the error message template for this sniff.
|
3003 |
*
|
|
|
|
|
3004 |
* @return string
|
3005 |
*/
|
3006 |
protected function getErrorMsgTemplate()
|
3007 |
{
|
3008 |
return 'The constant "%s" is not present in PHP version %s or earlier';
|
3009 |
}
|
3010 |
-
|
3011 |
-
|
3012 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\Constants;
|
12 |
|
13 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
17 |
+
* Detect use of new PHP native global constants.
|
18 |
*
|
19 |
+
* PHP version All
|
20 |
+
*
|
21 |
+
* @since 8.1.0
|
22 |
*/
|
23 |
class NewConstantsSniff extends AbstractNewFeatureSniff
|
24 |
{
|
29 |
* The array lists : version number with false (not present) or true (present).
|
30 |
* If's sufficient to list the first version where the constant appears.
|
31 |
*
|
32 |
+
* Note: PHP constants are case-sensitive!
|
33 |
+
*
|
34 |
+
* @since 8.1.0
|
35 |
*
|
36 |
+
* @var array(string => array(string => bool))
|
37 |
*/
|
38 |
protected $newConstants = array(
|
39 |
'E_STRICT' => array(
|
2152 |
'7.0' => true,
|
2153 |
),
|
2154 |
// Tokenizer:
|
2155 |
+
'T_COALESCE' => array(
|
2156 |
+
'5.6' => false,
|
2157 |
+
'7.0' => true,
|
2158 |
+
),
|
2159 |
'T_SPACESHIP' => array(
|
2160 |
'5.6' => false,
|
2161 |
'7.0' => true,
|
2162 |
),
|
2163 |
+
'T_YIELD_FROM' => array(
|
2164 |
+
'5.6' => false,
|
2165 |
+
'7.0' => true,
|
2166 |
+
),
|
2167 |
+
|
2168 |
// Zlib:
|
2169 |
// The first three are in the PHP 5.4 changelog, but the Extension constant page says 7.0.
|
2170 |
'ZLIB_ENCODING_RAW' => array(
|
2690 |
'7.1' => false,
|
2691 |
'7.2' => true,
|
2692 |
),
|
2693 |
+
'SODIUM_BASE64_VARIANT_ORIGINAL' => array(
|
2694 |
+
'7.1' => false,
|
2695 |
+
'7.2' => true,
|
2696 |
+
),
|
2697 |
+
'SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING' => array(
|
2698 |
+
'7.1' => false,
|
2699 |
+
'7.2' => true,
|
2700 |
+
),
|
2701 |
+
'SODIUM_BASE64_VARIANT_URLSAFE' => array(
|
2702 |
+
'7.1' => false,
|
2703 |
+
'7.2' => true,
|
2704 |
+
),
|
2705 |
+
'SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING' => array(
|
2706 |
+
'7.1' => false,
|
2707 |
+
'7.2' => true,
|
2708 |
+
),
|
2709 |
'SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES' => array(
|
2710 |
'7.1' => false,
|
2711 |
'7.2' => true,
|
2754 |
'7.1' => false,
|
2755 |
'7.2' => true,
|
2756 |
),
|
2757 |
+
'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES' => array(
|
2758 |
+
'7.1' => false,
|
2759 |
+
'7.2' => true,
|
2760 |
+
),
|
2761 |
+
'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES' => array(
|
2762 |
+
'7.1' => false,
|
2763 |
+
'7.2' => true,
|
2764 |
+
),
|
2765 |
+
'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES' => array(
|
2766 |
+
'7.1' => false,
|
2767 |
+
'7.2' => true,
|
2768 |
+
),
|
2769 |
+
'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES' => array(
|
2770 |
+
'7.1' => false,
|
2771 |
+
'7.2' => true,
|
2772 |
+
),
|
2773 |
'SODIUM_CRYPTO_AUTH_BYTES' => array(
|
2774 |
'7.1' => false,
|
2775 |
'7.2' => true,
|
2870 |
'7.1' => false,
|
2871 |
'7.2' => true,
|
2872 |
),
|
2873 |
+
'SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13' => array(
|
2874 |
+
'7.1' => false,
|
2875 |
+
'7.2' => true,
|
2876 |
+
),
|
2877 |
'SODIUM_CRYPTO_PWHASH_ALG_DEFAULT' => array(
|
2878 |
'7.1' => false,
|
2879 |
'7.2' => true,
|
2962 |
'7.1' => false,
|
2963 |
'7.2' => true,
|
2964 |
),
|
2965 |
+
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES' => array(
|
2966 |
+
'7.1' => false,
|
2967 |
+
'7.2' => true,
|
2968 |
+
),
|
2969 |
+
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES' => array(
|
2970 |
+
'7.1' => false,
|
2971 |
+
'7.2' => true,
|
2972 |
+
),
|
2973 |
+
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES' => array(
|
2974 |
+
'7.1' => false,
|
2975 |
+
'7.2' => true,
|
2976 |
+
),
|
2977 |
+
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX' => array(
|
2978 |
+
'7.1' => false,
|
2979 |
+
'7.2' => true,
|
2980 |
+
),
|
2981 |
+
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE' => array(
|
2982 |
+
'7.1' => false,
|
2983 |
+
'7.2' => true,
|
2984 |
+
),
|
2985 |
+
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH' => array(
|
2986 |
+
'7.1' => false,
|
2987 |
+
'7.2' => true,
|
2988 |
+
),
|
2989 |
+
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY' => array(
|
2990 |
+
'7.1' => false,
|
2991 |
+
'7.2' => true,
|
2992 |
+
),
|
2993 |
+
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL' => array(
|
2994 |
+
'7.1' => false,
|
2995 |
+
'7.2' => true,
|
2996 |
+
),
|
2997 |
'SODIUM_CRYPTO_SIGN_BYTES' => array(
|
2998 |
'7.1' => false,
|
2999 |
'7.2' => true,
|
3022 |
'7.1' => false,
|
3023 |
'7.2' => true,
|
3024 |
),
|
3025 |
+
|
3026 |
+
'CURLAUTH_BEARER' => array(
|
3027 |
+
'7.2' => false,
|
3028 |
+
'7.3' => true,
|
3029 |
+
),
|
3030 |
+
'CURLAUTH_GSSAPI' => array(
|
3031 |
+
'7.2' => false,
|
3032 |
+
'7.3' => true,
|
3033 |
+
),
|
3034 |
+
'CURLE_WEIRD_SERVER_REPLY' => array(
|
3035 |
+
'7.2' => false,
|
3036 |
+
'7.3' => true,
|
3037 |
+
),
|
3038 |
+
'CURLINFO_APPCONNECT_TIME_T' => array(
|
3039 |
+
'7.2' => false,
|
3040 |
+
'7.3' => true,
|
3041 |
+
),
|
3042 |
+
'CURLINFO_CONNECT_TIME_T' => array(
|
3043 |
+
'7.2' => false,
|
3044 |
+
'7.3' => true,
|
3045 |
+
),
|
3046 |
+
'CURLINFO_CONTENT_LENGTH_DOWNLOAD_T' => array(
|
3047 |
+
'7.2' => false,
|
3048 |
+
'7.3' => true,
|
3049 |
+
),
|
3050 |
+
'CURLINFO_CONTENT_LENGTH_UPLOAD_T' => array(
|
3051 |
+
'7.2' => false,
|
3052 |
+
'7.3' => true,
|
3053 |
+
),
|
3054 |
+
'CURLINFO_FILETIME_T' => array(
|
3055 |
+
'7.2' => false,
|
3056 |
+
'7.3' => true,
|
3057 |
+
),
|
3058 |
+
'CURLINFO_HTTP_VERSION' => array(
|
3059 |
+
'7.2' => false,
|
3060 |
+
'7.3' => true,
|
3061 |
+
),
|
3062 |
+
'CURLINFO_NAMELOOKUP_TIME_T' => array(
|
3063 |
+
'7.2' => false,
|
3064 |
+
'7.3' => true,
|
3065 |
+
),
|
3066 |
+
'CURLINFO_PRETRANSFER_TIME_T' => array(
|
3067 |
+
'7.2' => false,
|
3068 |
+
'7.3' => true,
|
3069 |
+
),
|
3070 |
+
'CURLINFO_PROTOCOL' => array(
|
3071 |
+
'7.2' => false,
|
3072 |
+
'7.3' => true,
|
3073 |
+
),
|
3074 |
+
'CURLINFO_PROXY_SSL_VERIFYRESULT' => array(
|
3075 |
+
'7.2' => false,
|
3076 |
+
'7.3' => true,
|
3077 |
+
),
|
3078 |
+
'CURLINFO_REDIRECT_TIME_T' => array(
|
3079 |
+
'7.2' => false,
|
3080 |
+
'7.3' => true,
|
3081 |
+
),
|
3082 |
+
'CURLINFO_SCHEME' => array(
|
3083 |
+
'7.2' => false,
|
3084 |
+
'7.3' => true,
|
3085 |
+
),
|
3086 |
+
'CURLINFO_SIZE_DOWNLOAD_T' => array(
|
3087 |
+
'7.2' => false,
|
3088 |
+
'7.3' => true,
|
3089 |
+
),
|
3090 |
+
'CURLINFO_SIZE_UPLOAD_T' => array(
|
3091 |
+
'7.2' => false,
|
3092 |
+
'7.3' => true,
|
3093 |
+
),
|
3094 |
+
'CURLINFO_SPEED_DOWNLOAD_T' => array(
|
3095 |
+
'7.2' => false,
|
3096 |
+
'7.3' => true,
|
3097 |
+
),
|
3098 |
+
'CURLINFO_SPEED_UPLOAD_T' => array(
|
3099 |
+
'7.2' => false,
|
3100 |
+
'7.3' => true,
|
3101 |
+
),
|
3102 |
+
'CURLINFO_STARTTRANSFER_TIME_T' => array(
|
3103 |
+
'7.2' => false,
|
3104 |
+
'7.3' => true,
|
3105 |
+
),
|
3106 |
+
'CURLINFO_TOTAL_TIME_T' => array(
|
3107 |
+
'7.2' => false,
|
3108 |
+
'7.3' => true,
|
3109 |
+
),
|
3110 |
+
'CURL_LOCK_DATA_CONNECT' => array(
|
3111 |
+
'7.2' => false,
|
3112 |
+
'7.3' => true,
|
3113 |
+
),
|
3114 |
+
'CURL_LOCK_DATA_PSL' => array(
|
3115 |
+
'7.2' => false,
|
3116 |
+
'7.3' => true,
|
3117 |
+
),
|
3118 |
+
'CURL_MAX_READ_SIZE' => array(
|
3119 |
+
'7.2' => false,
|
3120 |
+
'7.3' => true,
|
3121 |
+
),
|
3122 |
+
'CURLOPT_ABSTRACT_UNIX_SOCKET' => array(
|
3123 |
+
'7.2' => false,
|
3124 |
+
'7.3' => true,
|
3125 |
+
),
|
3126 |
+
'CURLOPT_DISALLOW_USERNAME_IN_URL' => array(
|
3127 |
+
'7.2' => false,
|
3128 |
+
'7.3' => true,
|
3129 |
+
),
|
3130 |
+
'CURLOPT_DNS_SHUFFLE_ADDRESSES' => array(
|
3131 |
+
'7.2' => false,
|
3132 |
+
'7.3' => true,
|
3133 |
+
),
|
3134 |
+
'CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS' => array(
|
3135 |
+
'7.2' => false,
|
3136 |
+
'7.3' => true,
|
3137 |
+
),
|
3138 |
+
'CURLOPT_HAPROXYPROTOCOL' => array(
|
3139 |
+
'7.2' => false,
|
3140 |
+
'7.3' => true,
|
3141 |
+
),
|
3142 |
+
'CURLOPT_KEEP_SENDING_ON_ERROR' => array(
|
3143 |
+
'7.2' => false,
|
3144 |
+
'7.3' => true,
|
3145 |
+
),
|
3146 |
+
'CURLOPT_PRE_PROXY' => array(
|
3147 |
+
'7.2' => false,
|
3148 |
+
'7.3' => true,
|
3149 |
+
),
|
3150 |
+
'CURLOPT_PROXY_CAINFO' => array(
|
3151 |
+
'7.2' => false,
|
3152 |
+
'7.3' => true,
|
3153 |
+
),
|
3154 |
+
'CURLOPT_PROXY_CAPATH' => array(
|
3155 |
+
'7.2' => false,
|
3156 |
+
'7.3' => true,
|
3157 |
+
),
|
3158 |
+
'CURLOPT_PROXY_CRLFILE' => array(
|
3159 |
+
'7.2' => false,
|
3160 |
+
'7.3' => true,
|
3161 |
+
),
|
3162 |
+
'CURLOPT_PROXY_KEYPASSWD' => array(
|
3163 |
+
'7.2' => false,
|
3164 |
+
'7.3' => true,
|
3165 |
+
),
|
3166 |
+
'CURLOPT_PROXY_PINNEDPUBLICKEY' => array(
|
3167 |
+
'7.2' => false,
|
3168 |
+
'7.3' => true,
|
3169 |
+
),
|
3170 |
+
'CURLOPT_PROXY_SSLCERT' => array(
|
3171 |
+
'7.2' => false,
|
3172 |
+
'7.3' => true,
|
3173 |
+
),
|
3174 |
+
'CURLOPT_PROXY_SSLCERTTYPE' => array(
|
3175 |
+
'7.2' => false,
|
3176 |
+
'7.3' => true,
|
3177 |
+
),
|
3178 |
+
'CURLOPT_PROXY_SSL_CIPHER_LIST' => array(
|
3179 |
+
'7.2' => false,
|
3180 |
+
'7.3' => true,
|
3181 |
+
),
|
3182 |
+
'CURLOPT_PROXY_SSLKEY' => array(
|
3183 |
+
'7.2' => false,
|
3184 |
+
'7.3' => true,
|
3185 |
+
),
|
3186 |
+
'CURLOPT_PROXY_SSLKEYTYPE' => array(
|
3187 |
+
'7.2' => false,
|
3188 |
+
'7.3' => true,
|
3189 |
+
),
|
3190 |
+
'CURLOPT_PROXY_SSL_OPTIONS' => array(
|
3191 |
+
'7.2' => false,
|
3192 |
+
'7.3' => true,
|
3193 |
+
),
|
3194 |
+
'CURLOPT_PROXY_SSL_VERIFYHOST' => array(
|
3195 |
+
'7.2' => false,
|
3196 |
+
'7.3' => true,
|
3197 |
+
),
|
3198 |
+
'CURLOPT_PROXY_SSL_VERIFYPEER' => array(
|
3199 |
+
'7.2' => false,
|
3200 |
+
'7.3' => true,
|
3201 |
+
),
|
3202 |
+
'CURLOPT_PROXY_SSLVERSION' => array(
|
3203 |
+
'7.2' => false,
|
3204 |
+
'7.3' => true,
|
3205 |
+
),
|
3206 |
+
'CURLOPT_PROXY_TLS13_CIPHERS' => array(
|
3207 |
+
'7.2' => false,
|
3208 |
+
'7.3' => true,
|
3209 |
+
),
|
3210 |
+
'CURLOPT_PROXY_TLSAUTH_PASSWORD' => array(
|
3211 |
+
'7.2' => false,
|
3212 |
+
'7.3' => true,
|
3213 |
+
),
|
3214 |
+
'CURLOPT_PROXY_TLSAUTH_TYPE' => array(
|
3215 |
+
'7.2' => false,
|
3216 |
+
'7.3' => true,
|
3217 |
+
),
|
3218 |
+
'CURLOPT_PROXY_TLSAUTH_USERNAME' => array(
|
3219 |
+
'7.2' => false,
|
3220 |
+
'7.3' => true,
|
3221 |
+
),
|
3222 |
+
'CURLOPT_REQUEST_TARGET' => array(
|
3223 |
+
'7.2' => false,
|
3224 |
+
'7.3' => true,
|
3225 |
+
),
|
3226 |
+
'CURLOPT_SOCKS5_AUTH' => array(
|
3227 |
+
'7.2' => false,
|
3228 |
+
'7.3' => true,
|
3229 |
+
),
|
3230 |
+
'CURLOPT_SSH_COMPRESSION' => array(
|
3231 |
+
'7.2' => false,
|
3232 |
+
'7.3' => true,
|
3233 |
+
),
|
3234 |
+
'CURLOPT_SUPPRESS_CONNECT_HEADERS' => array(
|
3235 |
+
'7.2' => false,
|
3236 |
+
'7.3' => true,
|
3237 |
+
),
|
3238 |
+
'CURLOPT_TIMEVALUE_LARGE' => array(
|
3239 |
+
'7.2' => false,
|
3240 |
+
'7.3' => true,
|
3241 |
+
),
|
3242 |
+
'CURLOPT_TLS13_CIPHERS' => array(
|
3243 |
+
'7.2' => false,
|
3244 |
+
'7.3' => true,
|
3245 |
+
),
|
3246 |
+
'CURLPROXY_HTTPS' => array(
|
3247 |
+
'7.2' => false,
|
3248 |
+
'7.3' => true,
|
3249 |
+
),
|
3250 |
+
'CURLSSH_AUTH_GSSAPI' => array(
|
3251 |
+
'7.2' => false,
|
3252 |
+
'7.3' => true,
|
3253 |
+
),
|
3254 |
+
'CURL_SSLVERSION_MAX_DEFAULT' => array(
|
3255 |
+
'7.2' => false,
|
3256 |
+
'7.3' => true,
|
3257 |
+
),
|
3258 |
+
'CURL_SSLVERSION_MAX_NONE' => array(
|
3259 |
+
'7.2' => false,
|
3260 |
+
'7.3' => true,
|
3261 |
+
),
|
3262 |
+
'CURL_SSLVERSION_MAX_TLSv1_0' => array(
|
3263 |
+
'7.2' => false,
|
3264 |
+
'7.3' => true,
|
3265 |
+
),
|
3266 |
+
'CURL_SSLVERSION_MAX_TLSv1_1' => array(
|
3267 |
+
'7.2' => false,
|
3268 |
+
'7.3' => true,
|
3269 |
+
),
|
3270 |
+
'CURL_SSLVERSION_MAX_TLSv1_2' => array(
|
3271 |
+
'7.2' => false,
|
3272 |
+
'7.3' => true,
|
3273 |
+
),
|
3274 |
+
'CURL_SSLVERSION_MAX_TLSv1_3' => array(
|
3275 |
+
'7.2' => false,
|
3276 |
+
'7.3' => true,
|
3277 |
+
),
|
3278 |
+
'CURL_SSLVERSION_TLSv1_3' => array(
|
3279 |
+
'7.2' => false,
|
3280 |
+
'7.3' => true,
|
3281 |
+
),
|
3282 |
+
'CURL_VERSION_ASYNCHDNS' => array(
|
3283 |
+
'7.2' => false,
|
3284 |
+
'7.3' => true,
|
3285 |
+
),
|
3286 |
+
'CURL_VERSION_BROTLI' => array(
|
3287 |
+
'7.2' => false,
|
3288 |
+
'7.3' => true,
|
3289 |
+
),
|
3290 |
+
'CURL_VERSION_CONV' => array(
|
3291 |
+
'7.2' => false,
|
3292 |
+
'7.3' => true,
|
3293 |
+
),
|
3294 |
+
'CURL_VERSION_DEBUG' => array(
|
3295 |
+
'7.2' => false,
|
3296 |
+
'7.3' => true,
|
3297 |
+
),
|
3298 |
+
'CURL_VERSION_GSSAPI' => array(
|
3299 |
+
'7.2' => false,
|
3300 |
+
'7.3' => true,
|
3301 |
+
),
|
3302 |
+
'CURL_VERSION_GSSNEGOTIATE' => array(
|
3303 |
+
'7.2' => false,
|
3304 |
+
'7.3' => true,
|
3305 |
+
),
|
3306 |
+
'CURL_VERSION_HTTPS_PROXY' => array(
|
3307 |
+
'7.2' => false,
|
3308 |
+
'7.3' => true,
|
3309 |
+
),
|
3310 |
+
'CURL_VERSION_IDN' => array(
|
3311 |
+
'7.2' => false,
|
3312 |
+
'7.3' => true,
|
3313 |
+
),
|
3314 |
+
'CURL_VERSION_LARGEFILE' => array(
|
3315 |
+
'7.2' => false,
|
3316 |
+
'7.3' => true,
|
3317 |
+
),
|
3318 |
+
'CURL_VERSION_MULTI_SSL' => array(
|
3319 |
+
'7.2' => false,
|
3320 |
+
'7.3' => true,
|
3321 |
+
),
|
3322 |
+
'CURL_VERSION_NTLM' => array(
|
3323 |
+
'7.2' => false,
|
3324 |
+
'7.3' => true,
|
3325 |
+
),
|
3326 |
+
'CURL_VERSION_NTLM_WB' => array(
|
3327 |
+
'7.2' => false,
|
3328 |
+
'7.3' => true,
|
3329 |
+
),
|
3330 |
+
'CURL_VERSION_SPNEGO' => array(
|
3331 |
+
'7.2' => false,
|
3332 |
+
'7.3' => true,
|
3333 |
+
),
|
3334 |
+
'CURL_VERSION_SSPI' => array(
|
3335 |
+
'7.2' => false,
|
3336 |
+
'7.3' => true,
|
3337 |
+
),
|
3338 |
+
'CURL_VERSION_TLSAUTH_SRP' => array(
|
3339 |
+
'7.2' => false,
|
3340 |
+
'7.3' => true,
|
3341 |
+
),
|
3342 |
+
'FILTER_SANITIZE_ADD_SLASHES' => array(
|
3343 |
+
'7.2' => false,
|
3344 |
+
'7.3' => true,
|
3345 |
+
),
|
3346 |
+
'JSON_THROW_ON_ERROR' => array(
|
3347 |
+
'7.2' => false,
|
3348 |
+
'7.3' => true,
|
3349 |
+
),
|
3350 |
+
'LDAP_CONTROL_MANAGEDSAIT' => array(
|
3351 |
+
'7.2' => false,
|
3352 |
+
'7.3' => true,
|
3353 |
+
),
|
3354 |
+
'LDAP_CONTROL_PROXY_AUTHZ' => array(
|
3355 |
+
'7.2' => false,
|
3356 |
+
'7.3' => true,
|
3357 |
+
),
|
3358 |
+
'LDAP_CONTROL_SUBENTRIES' => array(
|
3359 |
+
'7.2' => false,
|
3360 |
+
'7.3' => true,
|
3361 |
+
),
|
3362 |
+
'LDAP_CONTROL_VALUESRETURNFILTER' => array(
|
3363 |
+
'7.2' => false,
|
3364 |
+
'7.3' => true,
|
3365 |
+
),
|
3366 |
+
'LDAP_CONTROL_ASSERT' => array(
|
3367 |
+
'7.2' => false,
|
3368 |
+
'7.3' => true,
|
3369 |
+
),
|
3370 |
+
'LDAP_CONTROL_PRE_READ' => array(
|
3371 |
+
'7.2' => false,
|
3372 |
+
'7.3' => true,
|
3373 |
+
),
|
3374 |
+
'LDAP_CONTROL_POST_READ' => array(
|
3375 |
+
'7.2' => false,
|
3376 |
+
'7.3' => true,
|
3377 |
+
),
|
3378 |
+
'LDAP_CONTROL_SORTREQUEST' => array(
|
3379 |
+
'7.2' => false,
|
3380 |
+
'7.3' => true,
|
3381 |
+
),
|
3382 |
+
'LDAP_CONTROL_SORTRESPONSE' => array(
|
3383 |
+
'7.2' => false,
|
3384 |
+
'7.3' => true,
|
3385 |
+
),
|
3386 |
+
'LDAP_CONTROL_PAGEDRESULTS' => array(
|
3387 |
+
'7.2' => false,
|
3388 |
+
'7.3' => true,
|
3389 |
+
),
|
3390 |
+
'LDAP_CONTROL_AUTHZID_REQUEST' => array(
|
3391 |
+
'7.2' => false,
|
3392 |
+
'7.3' => true,
|
3393 |
+
),
|
3394 |
+
'LDAP_CONTROL_AUTHZID_RESPONSE' => array(
|
3395 |
+
'7.2' => false,
|
3396 |
+
'7.3' => true,
|
3397 |
+
),
|
3398 |
+
'LDAP_CONTROL_SYNC' => array(
|
3399 |
+
'7.2' => false,
|
3400 |
+
'7.3' => true,
|
3401 |
+
),
|
3402 |
+
'LDAP_CONTROL_SYNC_STATE' => array(
|
3403 |
+
'7.2' => false,
|
3404 |
+
'7.3' => true,
|
3405 |
+
),
|
3406 |
+
'LDAP_CONTROL_SYNC_DONE' => array(
|
3407 |
+
'7.2' => false,
|
3408 |
+
'7.3' => true,
|
3409 |
+
),
|
3410 |
+
'LDAP_CONTROL_DONTUSECOPY' => array(
|
3411 |
+
'7.2' => false,
|
3412 |
+
'7.3' => true,
|
3413 |
+
),
|
3414 |
+
'LDAP_CONTROL_PASSWORDPOLICYREQUEST' => array(
|
3415 |
+
'7.2' => false,
|
3416 |
+
'7.3' => true,
|
3417 |
+
),
|
3418 |
+
'LDAP_CONTROL_PASSWORDPOLICYRESPONSE' => array(
|
3419 |
+
'7.2' => false,
|
3420 |
+
'7.3' => true,
|
3421 |
+
),
|
3422 |
+
'LDAP_CONTROL_X_INCREMENTAL_VALUES' => array(
|
3423 |
+
'7.2' => false,
|
3424 |
+
'7.3' => true,
|
3425 |
+
),
|
3426 |
+
'LDAP_CONTROL_X_DOMAIN_SCOPE' => array(
|
3427 |
+
'7.2' => false,
|
3428 |
+
'7.3' => true,
|
3429 |
+
),
|
3430 |
+
'LDAP_CONTROL_X_PERMISSIVE_MODIFY' => array(
|
3431 |
+
'7.2' => false,
|
3432 |
+
'7.3' => true,
|
3433 |
+
),
|
3434 |
+
'LDAP_CONTROL_X_SEARCH_OPTIONS' => array(
|
3435 |
+
'7.2' => false,
|
3436 |
+
'7.3' => true,
|
3437 |
+
),
|
3438 |
+
'LDAP_CONTROL_X_TREE_DELETE' => array(
|
3439 |
+
'7.2' => false,
|
3440 |
+
'7.3' => true,
|
3441 |
+
),
|
3442 |
+
'LDAP_CONTROL_X_EXTENDED_DN' => array(
|
3443 |
+
'7.2' => false,
|
3444 |
+
'7.3' => true,
|
3445 |
+
),
|
3446 |
+
'LDAP_CONTROL_VLVREQUEST' => array(
|
3447 |
+
'7.2' => false,
|
3448 |
+
'7.3' => true,
|
3449 |
+
),
|
3450 |
+
'LDAP_CONTROL_VLVRESPONSE' => array(
|
3451 |
+
'7.2' => false,
|
3452 |
+
'7.3' => true,
|
3453 |
+
),
|
3454 |
+
'MB_CASE_FOLD' => array(
|
3455 |
+
'7.2' => false,
|
3456 |
+
'7.3' => true,
|
3457 |
+
),
|
3458 |
+
'MB_CASE_UPPER_SIMPLE' => array(
|
3459 |
+
'7.2' => false,
|
3460 |
+
'7.3' => true,
|
3461 |
+
),
|
3462 |
+
'MB_CASE_LOWER_SIMPLE' => array(
|
3463 |
+
'7.2' => false,
|
3464 |
+
'7.3' => true,
|
3465 |
+
),
|
3466 |
+
'MB_CASE_TITLE_SIMPLE' => array(
|
3467 |
+
'7.2' => false,
|
3468 |
+
'7.3' => true,
|
3469 |
+
),
|
3470 |
+
'MB_CASE_FOLD_SIMPLE' => array(
|
3471 |
+
'7.2' => false,
|
3472 |
+
'7.3' => true,
|
3473 |
+
),
|
3474 |
+
'PGSQL_DIAG_SCHEMA_NAME' => array(
|
3475 |
+
'7.2' => false,
|
3476 |
+
'7.3' => true,
|
3477 |
+
),
|
3478 |
+
'PGSQL_DIAG_TABLE_NAME' => array(
|
3479 |
+
'7.2' => false,
|
3480 |
+
'7.3' => true,
|
3481 |
+
),
|
3482 |
+
'PGSQL_DIAG_COLUMN_NAME' => array(
|
3483 |
+
'7.2' => false,
|
3484 |
+
'7.3' => true,
|
3485 |
+
),
|
3486 |
+
'PGSQL_DIAG_DATATYPE_NAME' => array(
|
3487 |
+
'7.2' => false,
|
3488 |
+
'7.3' => true,
|
3489 |
+
),
|
3490 |
+
'PGSQL_DIAG_CONSTRAINT_NAME' => array(
|
3491 |
+
'7.2' => false,
|
3492 |
+
'7.3' => true,
|
3493 |
+
),
|
3494 |
+
'PGSQL_DIAG_SEVERITY_NONLOCALIZED' => array(
|
3495 |
+
'7.2' => false,
|
3496 |
+
'7.3' => true,
|
3497 |
+
),
|
3498 |
+
'PASSWORD_ARGON2ID' => array(
|
3499 |
+
'7.2' => false,
|
3500 |
+
'7.3' => true,
|
3501 |
+
),
|
3502 |
+
'STREAM_CRYPTO_PROTO_SSLv3' => array(
|
3503 |
+
'7.2' => false,
|
3504 |
+
'7.3' => true,
|
3505 |
+
),
|
3506 |
+
'STREAM_CRYPTO_PROTO_TLSv1_0' => array(
|
3507 |
+
'7.2' => false,
|
3508 |
+
'7.3' => true,
|
3509 |
+
),
|
3510 |
+
'STREAM_CRYPTO_PROTO_TLSv1_1' => array(
|
3511 |
+
'7.2' => false,
|
3512 |
+
'7.3' => true,
|
3513 |
+
),
|
3514 |
+
'STREAM_CRYPTO_PROTO_TLSv1_2' => array(
|
3515 |
+
'7.2' => false,
|
3516 |
+
'7.3' => true,
|
3517 |
+
),
|
3518 |
+
|
3519 |
+
'CURL_VERSION_ALTSVC' => array(
|
3520 |
+
'7.3.5' => false,
|
3521 |
+
'7.3.6' => true,
|
3522 |
+
),
|
3523 |
+
'CURL_VERSION_CURLDEBUG' => array(
|
3524 |
+
'7.3.5' => false,
|
3525 |
+
'7.3.6' => true,
|
3526 |
+
),
|
3527 |
+
|
3528 |
+
'IMG_FILTER_SCATTER' => array(
|
3529 |
+
'7.3' => false,
|
3530 |
+
'7.4' => true,
|
3531 |
+
),
|
3532 |
+
'MB_ONIGURUMA_VERSION' => array(
|
3533 |
+
'7.3' => false,
|
3534 |
+
'7.4' => true,
|
3535 |
+
),
|
3536 |
+
'SO_LABEL' => array(
|
3537 |
+
'7.3' => false,
|
3538 |
+
'7.4' => true,
|
3539 |
+
),
|
3540 |
+
'SO_PEERLABEL' => array(
|
3541 |
+
'7.3' => false,
|
3542 |
+
'7.4' => true,
|
3543 |
+
),
|
3544 |
+
'SO_LISTENQLIMIT' => array(
|
3545 |
+
'7.3' => false,
|
3546 |
+
'7.4' => true,
|
3547 |
+
),
|
3548 |
+
'SO_LISTENQLEN' => array(
|
3549 |
+
'7.3' => false,
|
3550 |
+
'7.4' => true,
|
3551 |
+
),
|
3552 |
+
'SO_USER_COOKIE' => array(
|
3553 |
+
'7.3' => false,
|
3554 |
+
'7.4' => true,
|
3555 |
+
),
|
3556 |
+
'PASSWORD_ARGON2_PROVIDER' => array(
|
3557 |
+
'7.3' => false,
|
3558 |
+
'7.4' => true,
|
3559 |
+
),
|
3560 |
+
'PHP_WINDOWS_EVENT_CTRL_C' => array(
|
3561 |
+
'7.3' => false,
|
3562 |
+
'7.4' => true,
|
3563 |
+
),
|
3564 |
+
'PHP_WINDOWS_EVENT_CTRL_BREAK' => array(
|
3565 |
+
'7.3' => false,
|
3566 |
+
'7.4' => true,
|
3567 |
+
),
|
3568 |
+
'T_BAD_CHARACTER' => array(
|
3569 |
+
'7.3' => false,
|
3570 |
+
'7.4' => true,
|
3571 |
+
),
|
3572 |
+
'TIDY_TAG_ARTICLE' => array(
|
3573 |
+
'7.3' => false,
|
3574 |
+
'7.4' => true,
|
3575 |
+
),
|
3576 |
+
'TIDY_TAG_ASIDE' => array(
|
3577 |
+
'7.3' => false,
|
3578 |
+
'7.4' => true,
|
3579 |
+
),
|
3580 |
+
'TIDY_TAG_AUDIO' => array(
|
3581 |
+
'7.3' => false,
|
3582 |
+
'7.4' => true,
|
3583 |
+
),
|
3584 |
+
'TIDY_TAG_BDI' => array(
|
3585 |
+
'7.3' => false,
|
3586 |
+
'7.4' => true,
|
3587 |
+
),
|
3588 |
+
'TIDY_TAG_CANVAS' => array(
|
3589 |
+
'7.3' => false,
|
3590 |
+
'7.4' => true,
|
3591 |
+
),
|
3592 |
+
'TIDY_TAG_COMMAND' => array(
|
3593 |
+
'7.3' => false,
|
3594 |
+
'7.4' => true,
|
3595 |
+
),
|
3596 |
+
'TIDY_TAG_DATALIST' => array(
|
3597 |
+
'7.3' => false,
|
3598 |
+
'7.4' => true,
|
3599 |
+
),
|
3600 |
+
'TIDY_TAG_DETAILS' => array(
|
3601 |
+
'7.3' => false,
|
3602 |
+
'7.4' => true,
|
3603 |
+
),
|
3604 |
+
'TIDY_TAG_DIALOG' => array(
|
3605 |
+
'7.3' => false,
|
3606 |
+
'7.4' => true,
|
3607 |
+
),
|
3608 |
+
'TIDY_TAG_FIGCAPTION' => array(
|
3609 |
+
'7.3' => false,
|
3610 |
+
'7.4' => true,
|
3611 |
+
),
|
3612 |
+
'TIDY_TAG_FIGURE' => array(
|
3613 |
+
'7.3' => false,
|
3614 |
+
'7.4' => true,
|
3615 |
+
),
|
3616 |
+
'TIDY_TAG_FOOTER' => array(
|
3617 |
+
'7.3' => false,
|
3618 |
+
'7.4' => true,
|
3619 |
+
),
|
3620 |
+
'TIDY_TAG_HEADER' => array(
|
3621 |
+
'7.3' => false,
|
3622 |
+
'7.4' => true,
|
3623 |
+
),
|
3624 |
+
'TIDY_TAG_HGROUP' => array(
|
3625 |
+
'7.3' => false,
|
3626 |
+
'7.4' => true,
|
3627 |
+
),
|
3628 |
+
'TIDY_TAG_MAIN' => array(
|
3629 |
+
'7.3' => false,
|
3630 |
+
'7.4' => true,
|
3631 |
+
),
|
3632 |
+
'TIDY_TAG_MARK' => array(
|
3633 |
+
'7.3' => false,
|
3634 |
+
'7.4' => true,
|
3635 |
+
),
|
3636 |
+
'TIDY_TAG_MENUITEM' => array(
|
3637 |
+
'7.3' => false,
|
3638 |
+
'7.4' => true,
|
3639 |
+
),
|
3640 |
+
'TIDY_TAG_METER' => array(
|
3641 |
+
'7.3' => false,
|
3642 |
+
'7.4' => true,
|
3643 |
+
),
|
3644 |
+
'TIDY_TAG_NAV' => array(
|
3645 |
+
'7.3' => false,
|
3646 |
+
'7.4' => true,
|
3647 |
+
),
|
3648 |
+
'TIDY_TAG_OUTPUT' => array(
|
3649 |
+
'7.3' => false,
|
3650 |
+
'7.4' => true,
|
3651 |
+
),
|
3652 |
+
'TIDY_TAG_PROGRESS' => array(
|
3653 |
+
'7.3' => false,
|
3654 |
+
'7.4' => true,
|
3655 |
+
),
|
3656 |
+
'TIDY_TAG_SECTION' => array(
|
3657 |
+
'7.3' => false,
|
3658 |
+
'7.4' => true,
|
3659 |
+
),
|
3660 |
+
'TIDY_TAG_SOURCE' => array(
|
3661 |
+
'7.3' => false,
|
3662 |
+
'7.4' => true,
|
3663 |
+
),
|
3664 |
+
'TIDY_TAG_SUMMARY' => array(
|
3665 |
+
'7.3' => false,
|
3666 |
+
'7.4' => true,
|
3667 |
+
),
|
3668 |
+
'TIDY_TAG_TEMPLATE' => array(
|
3669 |
+
'7.3' => false,
|
3670 |
+
'7.4' => true,
|
3671 |
+
),
|
3672 |
+
'TIDY_TAG_TIME' => array(
|
3673 |
+
'7.3' => false,
|
3674 |
+
'7.4' => true,
|
3675 |
+
),
|
3676 |
+
'TIDY_TAG_TRACK' => array(
|
3677 |
+
'7.3' => false,
|
3678 |
+
'7.4' => true,
|
3679 |
+
),
|
3680 |
+
'TIDY_TAG_VIDEO' => array(
|
3681 |
+
'7.3' => false,
|
3682 |
+
'7.4' => true,
|
3683 |
+
),
|
3684 |
);
|
3685 |
|
3686 |
|
3687 |
/**
|
3688 |
* Returns an array of tokens this test wants to listen for.
|
3689 |
*
|
3690 |
+
* @since 8.1.0
|
3691 |
+
*
|
3692 |
* @return array
|
3693 |
*/
|
3694 |
public function register()
|
3695 |
{
|
3696 |
+
return array(\T_STRING);
|
3697 |
+
}
|
|
|
3698 |
|
3699 |
/**
|
3700 |
* Processes this test, when one of its tokens is encountered.
|
3701 |
*
|
3702 |
+
* @since 8.1.0
|
3703 |
+
*
|
3704 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
3705 |
* @param int $stackPtr The position of the current token in the
|
3706 |
* stack passed in $tokens.
|
3707 |
*
|
3708 |
* @return void
|
3709 |
*/
|
3710 |
+
public function process(File $phpcsFile, $stackPtr)
|
3711 |
{
|
3712 |
$tokens = $phpcsFile->getTokens();
|
3713 |
$constantName = $tokens[$stackPtr]['content'];
|
3724 |
'name' => $constantName,
|
3725 |
);
|
3726 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
3727 |
+
}
|
|
|
3728 |
|
3729 |
|
3730 |
/**
|
3731 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
3732 |
*
|
3733 |
+
* @since 8.1.0
|
3734 |
+
*
|
3735 |
* @param array $itemInfo Base information about the item.
|
3736 |
*
|
3737 |
* @return array Version and other information about the item.
|
3745 |
/**
|
3746 |
* Get the error message template for this sniff.
|
3747 |
*
|
3748 |
+
* @since 8.1.0
|
3749 |
+
*
|
3750 |
* @return string
|
3751 |
*/
|
3752 |
protected function getErrorMsgTemplate()
|
3753 |
{
|
3754 |
return 'The constant "%s" is not present in PHP version %s or earlier';
|
3755 |
}
|
3756 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Constants}/NewMagicClassConstantSniff.php
RENAMED
@@ -1,29 +1,32 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
|
|
|
|
15 |
|
16 |
/**
|
17 |
-
*
|
18 |
*
|
19 |
-
* The special ClassName::class constant is available as of PHP 5.5.0, and allows
|
20 |
-
* fully qualified class name resolution at compile.
|
21 |
*
|
22 |
* PHP version 5.5
|
23 |
*
|
24 |
-
* @
|
25 |
-
* @
|
26 |
-
*
|
|
|
|
|
27 |
*/
|
28 |
class NewMagicClassConstantSniff extends Sniff
|
29 |
{
|
@@ -31,23 +34,27 @@ class NewMagicClassConstantSniff extends Sniff
|
|
31 |
/**
|
32 |
* Returns an array of tokens this test wants to listen for.
|
33 |
*
|
|
|
|
|
34 |
* @return array
|
35 |
*/
|
36 |
public function register()
|
37 |
{
|
38 |
-
return array(T_STRING);
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
* Processes this test, when one of its tokens is encountered.
|
43 |
*
|
|
|
|
|
44 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
45 |
* @param int $stackPtr The position of the current token in the
|
46 |
* stack passed in $tokens.
|
47 |
*
|
48 |
* @return void
|
49 |
*/
|
50 |
-
public function process(
|
51 |
{
|
52 |
if ($this->supportsBelow('5.4') === false) {
|
53 |
return;
|
@@ -59,8 +66,8 @@ class NewMagicClassConstantSniff extends Sniff
|
|
59 |
return;
|
60 |
}
|
61 |
|
62 |
-
$prevToken = $phpcsFile->findPrevious(
|
63 |
-
if ($prevToken === false || $tokens[$prevToken]['code'] !== T_DOUBLE_COLON) {
|
64 |
return;
|
65 |
}
|
66 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\Constants;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
|
17 |
/**
|
18 |
+
* Detect usage of the magic `::class` constant introduced in PHP 5.5.
|
19 |
*
|
20 |
+
* The special `ClassName::class` constant is available as of PHP 5.5.0, and allows
|
21 |
+
* for fully qualified class name resolution at compile time.
|
22 |
*
|
23 |
* PHP version 5.5
|
24 |
*
|
25 |
+
* @link https://wiki.php.net/rfc/class_name_scalars
|
26 |
+
* @link https://www.php.net/manual/en/language.oop5.constants.php#example-186
|
27 |
+
*
|
28 |
+
* @since 7.1.4
|
29 |
+
* @since 7.1.5 Removed the incorrect checks against invalid usage of the constant.
|
30 |
*/
|
31 |
class NewMagicClassConstantSniff extends Sniff
|
32 |
{
|
34 |
/**
|
35 |
* Returns an array of tokens this test wants to listen for.
|
36 |
*
|
37 |
+
* @since 7.1.4
|
38 |
+
*
|
39 |
* @return array
|
40 |
*/
|
41 |
public function register()
|
42 |
{
|
43 |
+
return array(\T_STRING);
|
44 |
}
|
45 |
|
46 |
/**
|
47 |
* Processes this test, when one of its tokens is encountered.
|
48 |
*
|
49 |
+
* @since 7.1.4
|
50 |
+
*
|
51 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
52 |
* @param int $stackPtr The position of the current token in the
|
53 |
* stack passed in $tokens.
|
54 |
*
|
55 |
* @return void
|
56 |
*/
|
57 |
+
public function process(File $phpcsFile, $stackPtr)
|
58 |
{
|
59 |
if ($this->supportsBelow('5.4') === false) {
|
60 |
return;
|
66 |
return;
|
67 |
}
|
68 |
|
69 |
+
$prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
|
70 |
+
if ($prevToken === false || $tokens[$prevToken]['code'] !== \T_DOUBLE_COLON) {
|
71 |
return;
|
72 |
}
|
73 |
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Constants}/RemovedConstantsSniff.php
RENAMED
@@ -1,22 +1,24 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
-
namespace PHPCompatibility\Sniffs\
|
11 |
|
12 |
use PHPCompatibility\AbstractRemovedFeatureSniff;
|
|
|
13 |
|
14 |
/**
|
15 |
-
*
|
16 |
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* @
|
20 |
*/
|
21 |
class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
|
22 |
{
|
@@ -27,9 +29,14 @@ class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
|
|
27 |
* The array lists : version number with false (deprecated) or true (removed).
|
28 |
* If's sufficient to list the first version where the constant was deprecated/removed.
|
29 |
*
|
|
|
|
|
|
|
30 |
* Note: PHP Constants are case-sensitive!
|
31 |
*
|
32 |
-
* @
|
|
|
|
|
33 |
*/
|
34 |
protected $removedConstants = array(
|
35 |
// Disabled since PHP 5.3.0 due to thread safety issues.
|
@@ -59,6 +66,12 @@ class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
|
|
59 |
'PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT' => array(
|
60 |
'7.0' => true,
|
61 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
'INTL_IDNA_VARIANT_2003' => array(
|
64 |
'7.2' => false,
|
@@ -272,31 +285,247 @@ class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
|
|
272 |
'7.1' => false,
|
273 |
'7.2' => true,
|
274 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
);
|
276 |
|
277 |
|
278 |
/**
|
279 |
* Returns an array of tokens this test wants to listen for.
|
280 |
*
|
|
|
|
|
281 |
* @return array
|
282 |
*/
|
283 |
public function register()
|
284 |
{
|
285 |
-
return array(T_STRING);
|
286 |
-
|
287 |
-
}//end register()
|
288 |
|
289 |
|
290 |
/**
|
291 |
* Processes this test, when one of its tokens is encountered.
|
292 |
*
|
|
|
|
|
293 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
294 |
* @param int $stackPtr The position of the current token in
|
295 |
* the stack passed in $tokens.
|
296 |
*
|
297 |
* @return void
|
298 |
*/
|
299 |
-
public function process(
|
300 |
{
|
301 |
$tokens = $phpcsFile->getTokens();
|
302 |
$constantName = $tokens[$stackPtr]['content'];
|
@@ -313,13 +542,14 @@ class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
|
|
313 |
'name' => $constantName,
|
314 |
);
|
315 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
316 |
-
|
317 |
-
}//end process()
|
318 |
|
319 |
|
320 |
/**
|
321 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
322 |
*
|
|
|
|
|
323 |
* @param array $itemInfo Base information about the item.
|
324 |
*
|
325 |
* @return array Version and other information about the item.
|
@@ -333,11 +563,12 @@ class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
|
|
333 |
/**
|
334 |
* Get the error message template for this sniff.
|
335 |
*
|
|
|
|
|
336 |
* @return string
|
337 |
*/
|
338 |
protected function getErrorMsgTemplate()
|
339 |
{
|
340 |
return 'The constant "%s" is ';
|
341 |
}
|
342 |
-
|
343 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\Constants;
|
12 |
|
13 |
use PHPCompatibility\AbstractRemovedFeatureSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
17 |
+
* Detect use of deprecated and/or removed PHP native global constants.
|
18 |
*
|
19 |
+
* PHP version All
|
20 |
+
*
|
21 |
+
* @since 8.1.0
|
22 |
*/
|
23 |
class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
|
24 |
{
|
29 |
* The array lists : version number with false (deprecated) or true (removed).
|
30 |
* If's sufficient to list the first version where the constant was deprecated/removed.
|
31 |
*
|
32 |
+
* Optional, the array can contain an `alternative` key listing an alternative constant
|
33 |
+
* to be used instead.
|
34 |
+
*
|
35 |
* Note: PHP Constants are case-sensitive!
|
36 |
*
|
37 |
+
* @since 8.1.0
|
38 |
+
*
|
39 |
+
* @var array(string => array(string => bool|string))
|
40 |
*/
|
41 |
protected $removedConstants = array(
|
42 |
// Disabled since PHP 5.3.0 due to thread safety issues.
|
66 |
'PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT' => array(
|
67 |
'7.0' => true,
|
68 |
),
|
69 |
+
'T_CHARACTER' => array(
|
70 |
+
'7.0' => true,
|
71 |
+
),
|
72 |
+
'T_BAD_CHARACTER' => array(
|
73 |
+
'7.0' => true,
|
74 |
+
),
|
75 |
|
76 |
'INTL_IDNA_VARIANT_2003' => array(
|
77 |
'7.2' => false,
|
285 |
'7.1' => false,
|
286 |
'7.2' => true,
|
287 |
),
|
288 |
+
|
289 |
+
'PHPDBG_FILE' => array(
|
290 |
+
'7.3' => true,
|
291 |
+
),
|
292 |
+
'PHPDBG_METHOD' => array(
|
293 |
+
'7.3' => true,
|
294 |
+
),
|
295 |
+
'PHPDBG_LINENO' => array(
|
296 |
+
'7.3' => true,
|
297 |
+
),
|
298 |
+
'PHPDBG_FUNC' => array(
|
299 |
+
'7.3' => true,
|
300 |
+
),
|
301 |
+
'FILTER_FLAG_SCHEME_REQUIRED' => array(
|
302 |
+
'7.3' => false,
|
303 |
+
),
|
304 |
+
'FILTER_FLAG_HOST_REQUIRED' => array(
|
305 |
+
'7.3' => false,
|
306 |
+
),
|
307 |
+
|
308 |
+
'CURLPIPE_HTTP1' => array(
|
309 |
+
'7.4' => false,
|
310 |
+
),
|
311 |
+
'FILTER_SANITIZE_MAGIC_QUOTES' => array(
|
312 |
+
'7.4' => false,
|
313 |
+
'alternative' => 'FILTER_SANITIZE_ADD_SLASHES',
|
314 |
+
),
|
315 |
+
'IBASE_BKP_CONVERT' => array(
|
316 |
+
'7.4' => true,
|
317 |
+
),
|
318 |
+
'IBASE_BKP_IGNORE_CHECKSUMS' => array(
|
319 |
+
'7.4' => true,
|
320 |
+
),
|
321 |
+
'IBASE_BKP_IGNORE_LIMBO' => array(
|
322 |
+
'7.4' => true,
|
323 |
+
),
|
324 |
+
'IBASE_BKP_METADATA_ONLY' => array(
|
325 |
+
'7.4' => true,
|
326 |
+
),
|
327 |
+
'IBASE_BKP_NO_GARBAGE_COLLECT' => array(
|
328 |
+
'7.4' => true,
|
329 |
+
),
|
330 |
+
'IBASE_BKP_NON_TRANSPORTABLE' => array(
|
331 |
+
'7.4' => true,
|
332 |
+
),
|
333 |
+
'IBASE_BKP_OLD_DESCRIPTIONS' => array(
|
334 |
+
'7.4' => true,
|
335 |
+
),
|
336 |
+
'IBASE_COMMITTED' => array(
|
337 |
+
'7.4' => true,
|
338 |
+
),
|
339 |
+
'IBASE_CONCURRENCY' => array(
|
340 |
+
'7.4' => true,
|
341 |
+
),
|
342 |
+
'IBASE_CONSISTENCY' => array(
|
343 |
+
'7.4' => true,
|
344 |
+
),
|
345 |
+
'IBASE_DEFAULT' => array(
|
346 |
+
'7.4' => true,
|
347 |
+
),
|
348 |
+
'IBASE_FETCH_ARRAYS' => array(
|
349 |
+
'7.4' => true,
|
350 |
+
),
|
351 |
+
'IBASE_FETCH_BLOBS' => array(
|
352 |
+
'7.4' => true,
|
353 |
+
),
|
354 |
+
'IBASE_NOWAIT' => array(
|
355 |
+
'7.4' => true,
|
356 |
+
),
|
357 |
+
'IBASE_PRP_ACCESS_MODE' => array(
|
358 |
+
'7.4' => true,
|
359 |
+
),
|
360 |
+
'IBASE_PRP_ACTIVATE' => array(
|
361 |
+
'7.4' => true,
|
362 |
+
),
|
363 |
+
'IBASE_PRP_AM_READONLY' => array(
|
364 |
+
'7.4' => true,
|
365 |
+
),
|
366 |
+
'IBASE_PRP_AM_READWRITE' => array(
|
367 |
+
'7.4' => true,
|
368 |
+
),
|
369 |
+
'IBASE_PRP_DENY_NEW_ATTACHMENTS' => array(
|
370 |
+
'7.4' => true,
|
371 |
+
),
|
372 |
+
'IBASE_PRP_DENY_NEW_TRANSACTIONS' => array(
|
373 |
+
'7.4' => true,
|
374 |
+
),
|
375 |
+
'IBASE_PRP_DB_ONLINE' => array(
|
376 |
+
'7.4' => true,
|
377 |
+
),
|
378 |
+
'IBASE_PRP_PAGE_BUFFERS' => array(
|
379 |
+
'7.4' => true,
|
380 |
+
),
|
381 |
+
'IBASE_PRP_RES' => array(
|
382 |
+
'7.4' => true,
|
383 |
+
),
|
384 |
+
'IBASE_PRP_RES_USE_FULL' => array(
|
385 |
+
'7.4' => true,
|
386 |
+
),
|
387 |
+
'IBASE_PRP_RESERVE_SPACE' => array(
|
388 |
+
'7.4' => true,
|
389 |
+
),
|
390 |
+
'IBASE_PRP_SET_SQL_DIALECT' => array(
|
391 |
+
'7.4' => true,
|
392 |
+
),
|
393 |
+
'IBASE_PRP_SHUTDOWN_DB' => array(
|
394 |
+
'7.4' => true,
|
395 |
+
),
|
396 |
+
'IBASE_PRP_SWEEP_INTERVAL' => array(
|
397 |
+
'7.4' => true,
|
398 |
+
),
|
399 |
+
'IBASE_PRP_WM_ASYNC' => array(
|
400 |
+
'7.4' => true,
|
401 |
+
),
|
402 |
+
'IBASE_PRP_WM_SYNC' => array(
|
403 |
+
'7.4' => true,
|
404 |
+
),
|
405 |
+
'IBASE_PRP_WRITE_MODE' => array(
|
406 |
+
'7.4' => true,
|
407 |
+
),
|
408 |
+
'IBASE_READ' => array(
|
409 |
+
'7.4' => true,
|
410 |
+
),
|
411 |
+
'IBASE_RES_CREATE' => array(
|
412 |
+
'7.4' => true,
|
413 |
+
),
|
414 |
+
'IBASE_RES_DEACTIVATE_IDX' => array(
|
415 |
+
'7.4' => true,
|
416 |
+
),
|
417 |
+
'IBASE_RES_NO_SHADOW' => array(
|
418 |
+
'7.4' => true,
|
419 |
+
),
|
420 |
+
'IBASE_RES_NO_VALIDITY' => array(
|
421 |
+
'7.4' => true,
|
422 |
+
),
|
423 |
+
'IBASE_RES_ONE_AT_A_TIME' => array(
|
424 |
+
'7.4' => true,
|
425 |
+
),
|
426 |
+
'IBASE_RES_REPLACE' => array(
|
427 |
+
'7.4' => true,
|
428 |
+
),
|
429 |
+
'IBASE_RES_USE_ALL_SPACE' => array(
|
430 |
+
'7.4' => true,
|
431 |
+
),
|
432 |
+
'IBASE_RPR_CHECK_DB' => array(
|
433 |
+
'7.4' => true,
|
434 |
+
),
|
435 |
+
'IBASE_RPR_FULL' => array(
|
436 |
+
'7.4' => true,
|
437 |
+
),
|
438 |
+
'IBASE_RPR_IGNORE_CHECKSUM' => array(
|
439 |
+
'7.4' => true,
|
440 |
+
),
|
441 |
+
'IBASE_RPR_KILL_SHADOWS' => array(
|
442 |
+
'7.4' => true,
|
443 |
+
),
|
444 |
+
'IBASE_RPR_MEND_DB' => array(
|
445 |
+
'7.4' => true,
|
446 |
+
),
|
447 |
+
'IBASE_RPR_SWEEP_DB' => array(
|
448 |
+
'7.4' => true,
|
449 |
+
),
|
450 |
+
'IBASE_RPR_VALIDATE_DB' => array(
|
451 |
+
'7.4' => true,
|
452 |
+
),
|
453 |
+
'IBASE_STS_DATA_PAGES' => array(
|
454 |
+
'7.4' => true,
|
455 |
+
),
|
456 |
+
'IBASE_STS_DB_LOG' => array(
|
457 |
+
'7.4' => true,
|
458 |
+
),
|
459 |
+
'IBASE_STS_HDR_PAGES' => array(
|
460 |
+
'7.4' => true,
|
461 |
+
),
|
462 |
+
'IBASE_STS_IDX_PAGES' => array(
|
463 |
+
'7.4' => true,
|
464 |
+
),
|
465 |
+
'IBASE_STS_SYS_RELATIONS' => array(
|
466 |
+
'7.4' => true,
|
467 |
+
),
|
468 |
+
'IBASE_SVC_GET_ENV' => array(
|
469 |
+
'7.4' => true,
|
470 |
+
),
|
471 |
+
'IBASE_SVC_GET_ENV_LOCK' => array(
|
472 |
+
'7.4' => true,
|
473 |
+
),
|
474 |
+
'IBASE_SVC_GET_ENV_MSG' => array(
|
475 |
+
'7.4' => true,
|
476 |
+
),
|
477 |
+
'IBASE_SVC_GET_USERS' => array(
|
478 |
+
'7.4' => true,
|
479 |
+
),
|
480 |
+
'IBASE_SVC_IMPLEMENTATION' => array(
|
481 |
+
'7.4' => true,
|
482 |
+
),
|
483 |
+
'IBASE_SVC_SERVER_VERSION' => array(
|
484 |
+
'7.4' => true,
|
485 |
+
),
|
486 |
+
'IBASE_SVC_SVR_DB_INFO' => array(
|
487 |
+
'7.4' => true,
|
488 |
+
),
|
489 |
+
'IBASE_SVC_USER_DBPATH' => array(
|
490 |
+
'7.4' => true,
|
491 |
+
),
|
492 |
+
'IBASE_UNIXTIME' => array(
|
493 |
+
'7.4' => true,
|
494 |
+
),
|
495 |
+
'IBASE_WAIT' => array(
|
496 |
+
'7.4' => true,
|
497 |
+
),
|
498 |
+
'IBASE_WRITE' => array(
|
499 |
+
'7.4' => true,
|
500 |
+
),
|
501 |
);
|
502 |
|
503 |
|
504 |
/**
|
505 |
* Returns an array of tokens this test wants to listen for.
|
506 |
*
|
507 |
+
* @since 8.1.0
|
508 |
+
*
|
509 |
* @return array
|
510 |
*/
|
511 |
public function register()
|
512 |
{
|
513 |
+
return array(\T_STRING);
|
514 |
+
}
|
|
|
515 |
|
516 |
|
517 |
/**
|
518 |
* Processes this test, when one of its tokens is encountered.
|
519 |
*
|
520 |
+
* @since 8.1.0
|
521 |
+
*
|
522 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
523 |
* @param int $stackPtr The position of the current token in
|
524 |
* the stack passed in $tokens.
|
525 |
*
|
526 |
* @return void
|
527 |
*/
|
528 |
+
public function process(File $phpcsFile, $stackPtr)
|
529 |
{
|
530 |
$tokens = $phpcsFile->getTokens();
|
531 |
$constantName = $tokens[$stackPtr]['content'];
|
542 |
'name' => $constantName,
|
543 |
);
|
544 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
545 |
+
}
|
|
|
546 |
|
547 |
|
548 |
/**
|
549 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
550 |
*
|
551 |
+
* @since 8.1.0
|
552 |
+
*
|
553 |
* @param array $itemInfo Base information about the item.
|
554 |
*
|
555 |
* @return array Version and other information about the item.
|
563 |
/**
|
564 |
* Get the error message template for this sniff.
|
565 |
*
|
566 |
+
* @since 8.1.0
|
567 |
+
*
|
568 |
* @return string
|
569 |
*/
|
570 |
protected function getErrorMsgTemplate()
|
571 |
{
|
572 |
return 'The constant "%s" is ';
|
573 |
}
|
574 |
+
}
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → ControlStructures}/DiscouragedSwitchContinueSniff.php
RENAMED
@@ -1,29 +1,35 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
15 |
-
use
|
|
|
16 |
|
17 |
/**
|
18 |
-
*
|
19 |
*
|
20 |
-
* PHP 7.3 will throw a warning when continue is used to target a switch
|
|
|
|
|
21 |
*
|
22 |
* PHP version 7.3
|
23 |
*
|
24 |
-
* @
|
25 |
-
* @
|
26 |
-
* @
|
|
|
|
|
|
|
|
|
27 |
*/
|
28 |
class DiscouragedSwitchContinueSniff extends Sniff
|
29 |
{
|
@@ -31,6 +37,8 @@ class DiscouragedSwitchContinueSniff extends Sniff
|
|
31 |
/**
|
32 |
* Token codes of control structures which can be targeted using continue.
|
33 |
*
|
|
|
|
|
34 |
* @var array
|
35 |
*/
|
36 |
protected $loopStructures = array(
|
@@ -44,6 +52,8 @@ class DiscouragedSwitchContinueSniff extends Sniff
|
|
44 |
/**
|
45 |
* Tokens which start a new case within a switch.
|
46 |
*
|
|
|
|
|
47 |
* @var array
|
48 |
*/
|
49 |
protected $caseTokens = array(
|
@@ -56,6 +66,8 @@ class DiscouragedSwitchContinueSniff extends Sniff
|
|
56 |
*
|
57 |
* This array is enriched with the arithmetic operators in the register() method.
|
58 |
*
|
|
|
|
|
59 |
* @var array
|
60 |
*/
|
61 |
protected $acceptedLevelTokens = array(
|
@@ -64,28 +76,18 @@ class DiscouragedSwitchContinueSniff extends Sniff
|
|
64 |
\T_CLOSE_PARENTHESIS => \T_CLOSE_PARENTHESIS,
|
65 |
);
|
66 |
|
67 |
-
/**
|
68 |
-
* PHPCS cross-version compatible version of the Tokens::$emptyTokens array.
|
69 |
-
*
|
70 |
-
* @var array
|
71 |
-
*/
|
72 |
-
private $emptyTokens = array();
|
73 |
|
74 |
/**
|
75 |
* Returns an array of tokens this test wants to listen for.
|
76 |
*
|
|
|
|
|
77 |
* @return array
|
78 |
*/
|
79 |
public function register()
|
80 |
{
|
81 |
-
$
|
82 |
-
$this->
|
83 |
-
if (version_compare(PHPCSHelper::getVersion(), '2.0', '<')) {
|
84 |
-
$arithmeticTokens = array_combine($arithmeticTokens, $arithmeticTokens);
|
85 |
-
$this->emptyTokens = array_combine($this->emptyTokens, $this->emptyTokens);
|
86 |
-
}
|
87 |
-
|
88 |
-
$this->acceptedLevelTokens = $this->acceptedLevelTokens + $arithmeticTokens + $this->emptyTokens;
|
89 |
|
90 |
return array(\T_SWITCH);
|
91 |
}
|
@@ -93,13 +95,15 @@ class DiscouragedSwitchContinueSniff extends Sniff
|
|
93 |
/**
|
94 |
* Processes this test, when one of its tokens is encountered.
|
95 |
*
|
|
|
|
|
96 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
97 |
* @param int $stackPtr The position of the current token in the
|
98 |
* stack passed in $tokens.
|
99 |
*
|
100 |
* @return void
|
101 |
*/
|
102 |
-
public function process(
|
103 |
{
|
104 |
if ($this->supportsAbove('7.3') === false) {
|
105 |
return;
|
@@ -178,7 +182,7 @@ class DiscouragedSwitchContinueSniff extends Sniff
|
|
178 |
continue 2;
|
179 |
}
|
180 |
|
181 |
-
if (isset(
|
182 |
continue;
|
183 |
}
|
184 |
|
@@ -231,5 +235,4 @@ class DiscouragedSwitchContinueSniff extends Sniff
|
|
231 |
|
232 |
} while ($caseDefault < $switchCloser);
|
233 |
}
|
234 |
-
|
235 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\ControlStructures;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
|
17 |
/**
|
18 |
+
* Detect use of `continue` in `switch` control structures.
|
19 |
*
|
20 |
+
* As of PHP 7.3, PHP will throw a warning when `continue` is used to target a `switch`
|
21 |
+
* control structure.
|
22 |
+
* The sniff takes numeric arguments used with `continue` into account.
|
23 |
*
|
24 |
* PHP version 7.3
|
25 |
*
|
26 |
+
* @link https://www.php.net/manual/en/migration73.incompatible.php#migration73.incompatible.core.continue-targeting-switch
|
27 |
+
* @link https://wiki.php.net/rfc/continue_on_switch_deprecation
|
28 |
+
* @link https://github.com/php/php-src/commit/04e3523b7d095341f65ed5e71a3cac82fca690e4
|
29 |
+
* (actual implementation which is different from the RFC).
|
30 |
+
* @link https://www.php.net/manual/en/control-structures.switch.php
|
31 |
+
*
|
32 |
+
* @since 8.2.0
|
33 |
*/
|
34 |
class DiscouragedSwitchContinueSniff extends Sniff
|
35 |
{
|
37 |
/**
|
38 |
* Token codes of control structures which can be targeted using continue.
|
39 |
*
|
40 |
+
* @since 8.2.0
|
41 |
+
*
|
42 |
* @var array
|
43 |
*/
|
44 |
protected $loopStructures = array(
|
52 |
/**
|
53 |
* Tokens which start a new case within a switch.
|
54 |
*
|
55 |
+
* @since 8.2.0
|
56 |
+
*
|
57 |
* @var array
|
58 |
*/
|
59 |
protected $caseTokens = array(
|
66 |
*
|
67 |
* This array is enriched with the arithmetic operators in the register() method.
|
68 |
*
|
69 |
+
* @since 8.2.0
|
70 |
+
*
|
71 |
* @var array
|
72 |
*/
|
73 |
protected $acceptedLevelTokens = array(
|
76 |
\T_CLOSE_PARENTHESIS => \T_CLOSE_PARENTHESIS,
|
77 |
);
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
/**
|
81 |
* Returns an array of tokens this test wants to listen for.
|
82 |
*
|
83 |
+
* @since 8.2.0
|
84 |
+
*
|
85 |
* @return array
|
86 |
*/
|
87 |
public function register()
|
88 |
{
|
89 |
+
$this->acceptedLevelTokens += Tokens::$arithmeticTokens;
|
90 |
+
$this->acceptedLevelTokens += Tokens::$emptyTokens;
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
return array(\T_SWITCH);
|
93 |
}
|
95 |
/**
|
96 |
* Processes this test, when one of its tokens is encountered.
|
97 |
*
|
98 |
+
* @since 8.2.0
|
99 |
+
*
|
100 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
101 |
* @param int $stackPtr The position of the current token in the
|
102 |
* stack passed in $tokens.
|
103 |
*
|
104 |
* @return void
|
105 |
*/
|
106 |
+
public function process(File $phpcsFile, $stackPtr)
|
107 |
{
|
108 |
if ($this->supportsAbove('7.3') === false) {
|
109 |
return;
|
182 |
continue 2;
|
183 |
}
|
184 |
|
185 |
+
if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === true) {
|
186 |
continue;
|
187 |
}
|
188 |
|
235 |
|
236 |
} while ($caseDefault < $switchCloser);
|
237 |
}
|
|
|
238 |
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → ControlStructures}/ForbiddenBreakContinueOutsideLoopSniff.php
RENAMED
@@ -1,28 +1,28 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
|
|
15 |
|
16 |
/**
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* Forbids use of break or continue statements outside of looping structures.
|
20 |
*
|
21 |
* PHP version 7.0
|
22 |
*
|
23 |
-
* @
|
24 |
-
* @
|
25 |
-
* @
|
|
|
|
|
26 |
*/
|
27 |
class ForbiddenBreakContinueOutsideLoopSniff extends Sniff
|
28 |
{
|
@@ -30,50 +30,57 @@ class ForbiddenBreakContinueOutsideLoopSniff extends Sniff
|
|
30 |
/**
|
31 |
* Token codes of control structure in which usage of break/continue is valid.
|
32 |
*
|
|
|
|
|
33 |
* @var array
|
34 |
*/
|
35 |
protected $validLoopStructures = array(
|
36 |
-
T_FOR => true,
|
37 |
-
T_FOREACH => true,
|
38 |
-
T_WHILE => true,
|
39 |
-
T_DO => true,
|
40 |
-
T_SWITCH => true,
|
41 |
);
|
42 |
|
43 |
/**
|
44 |
* Token codes which did not correctly get a condition assigned in older PHPCS versions.
|
45 |
*
|
|
|
|
|
46 |
* @var array
|
47 |
*/
|
48 |
protected $backCompat = array(
|
49 |
-
T_CASE => true,
|
50 |
-
T_DEFAULT => true,
|
51 |
);
|
52 |
|
53 |
/**
|
54 |
* Returns an array of tokens this test wants to listen for.
|
55 |
*
|
|
|
|
|
56 |
* @return array
|
57 |
*/
|
58 |
public function register()
|
59 |
{
|
60 |
return array(
|
61 |
-
T_BREAK,
|
62 |
-
T_CONTINUE,
|
63 |
);
|
64 |
-
|
65 |
-
}//end register()
|
66 |
|
67 |
/**
|
68 |
* Processes this test, when one of its tokens is encountered.
|
69 |
*
|
|
|
|
|
70 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
71 |
* @param int $stackPtr The position of the current token in the
|
72 |
* stack passed in $tokens.
|
73 |
*
|
74 |
* @return void
|
75 |
*/
|
76 |
-
public function process(
|
77 |
{
|
78 |
$tokens = $phpcsFile->getTokens();
|
79 |
$token = $tokens[$stackPtr];
|
@@ -105,7 +112,5 @@ class ForbiddenBreakContinueOutsideLoopSniff extends Sniff
|
|
105 |
}
|
106 |
|
107 |
$this->addMessage($phpcsFile, $error, $stackPtr, $isError, $errorCode, $data);
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\ControlStructures;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
17 |
+
* Detect using `break` and/or `continue` statements outside of a looping structure.
|
|
|
|
|
18 |
*
|
19 |
* PHP version 7.0
|
20 |
*
|
21 |
+
* @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.break-continue
|
22 |
+
* @link https://www.php.net/manual/en/control-structures.break.php
|
23 |
+
* @link https://www.php.net/manual/en/control-structures.continue.php
|
24 |
+
*
|
25 |
+
* @since 7.0.7
|
26 |
*/
|
27 |
class ForbiddenBreakContinueOutsideLoopSniff extends Sniff
|
28 |
{
|
30 |
/**
|
31 |
* Token codes of control structure in which usage of break/continue is valid.
|
32 |
*
|
33 |
+
* @since 7.0.7
|
34 |
+
*
|
35 |
* @var array
|
36 |
*/
|
37 |
protected $validLoopStructures = array(
|
38 |
+
\T_FOR => true,
|
39 |
+
\T_FOREACH => true,
|
40 |
+
\T_WHILE => true,
|
41 |
+
\T_DO => true,
|
42 |
+
\T_SWITCH => true,
|
43 |
);
|
44 |
|
45 |
/**
|
46 |
* Token codes which did not correctly get a condition assigned in older PHPCS versions.
|
47 |
*
|
48 |
+
* @since 7.0.7
|
49 |
+
*
|
50 |
* @var array
|
51 |
*/
|
52 |
protected $backCompat = array(
|
53 |
+
\T_CASE => true,
|
54 |
+
\T_DEFAULT => true,
|
55 |
);
|
56 |
|
57 |
/**
|
58 |
* Returns an array of tokens this test wants to listen for.
|
59 |
*
|
60 |
+
* @since 7.0.7
|
61 |
+
*
|
62 |
* @return array
|
63 |
*/
|
64 |
public function register()
|
65 |
{
|
66 |
return array(
|
67 |
+
\T_BREAK,
|
68 |
+
\T_CONTINUE,
|
69 |
);
|
70 |
+
}
|
|
|
71 |
|
72 |
/**
|
73 |
* Processes this test, when one of its tokens is encountered.
|
74 |
*
|
75 |
+
* @since 7.0.7
|
76 |
+
*
|
77 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
78 |
* @param int $stackPtr The position of the current token in the
|
79 |
* stack passed in $tokens.
|
80 |
*
|
81 |
* @return void
|
82 |
*/
|
83 |
+
public function process(File $phpcsFile, $stackPtr)
|
84 |
{
|
85 |
$tokens = $phpcsFile->getTokens();
|
86 |
$token = $tokens[$stackPtr];
|
112 |
}
|
113 |
|
114 |
$this->addMessage($phpcsFile, $error, $stackPtr, $isError, $errorCode, $data);
|
115 |
+
}
|
116 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → ControlStructures}/ForbiddenBreakContinueVariableArgumentsSniff.php
RENAMED
@@ -1,30 +1,34 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* PHP version 5.4
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
* @package PHPCompatibility
|
9 |
-
* @
|
10 |
-
* @
|
|
|
11 |
*/
|
12 |
|
13 |
-
namespace PHPCompatibility\Sniffs\
|
14 |
|
15 |
use PHPCompatibility\Sniff;
|
|
|
|
|
16 |
|
17 |
/**
|
18 |
-
*
|
19 |
*
|
20 |
-
*
|
|
|
|
|
21 |
*
|
22 |
* PHP version 5.4
|
23 |
*
|
24 |
-
* @
|
25 |
-
* @
|
26 |
-
* @
|
27 |
-
*
|
|
|
|
|
28 |
*/
|
29 |
class ForbiddenBreakContinueVariableArgumentsSniff extends Sniff
|
30 |
{
|
@@ -33,6 +37,9 @@ class ForbiddenBreakContinueVariableArgumentsSniff extends Sniff
|
|
33 |
*
|
34 |
* Array key is the error code. Array value will be used as part of the error message.
|
35 |
*
|
|
|
|
|
|
|
36 |
* @var array
|
37 |
*/
|
38 |
private $errorTypes = array(
|
@@ -43,43 +50,46 @@ class ForbiddenBreakContinueVariableArgumentsSniff extends Sniff
|
|
43 |
/**
|
44 |
* Returns an array of tokens this test wants to listen for.
|
45 |
*
|
|
|
|
|
46 |
* @return array
|
47 |
*/
|
48 |
public function register()
|
49 |
{
|
50 |
-
return array(T_BREAK, T_CONTINUE);
|
51 |
-
|
52 |
-
}//end register()
|
53 |
|
54 |
/**
|
55 |
* Processes this test, when one of its tokens is encountered.
|
56 |
*
|
|
|
|
|
57 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
58 |
* @param int $stackPtr The position of the current token in the
|
59 |
* stack passed in $tokens.
|
60 |
*
|
61 |
* @return void
|
62 |
*/
|
63 |
-
public function process(
|
64 |
{
|
65 |
if ($this->supportsAbove('5.4') === false) {
|
66 |
return;
|
67 |
}
|
68 |
|
69 |
$tokens = $phpcsFile->getTokens();
|
70 |
-
$nextSemicolonToken = $phpcsFile->findNext(array(T_SEMICOLON, T_CLOSE_TAG), ($stackPtr), null, false);
|
71 |
$errorType = '';
|
72 |
for ($curToken = $stackPtr + 1; $curToken < $nextSemicolonToken; $curToken++) {
|
73 |
if ($tokens[$curToken]['type'] === 'T_STRING') {
|
74 |
// If the next non-whitespace token after the string
|
75 |
// is an opening parenthesis then it's a function call.
|
76 |
-
$openBracket = $phpcsFile->findNext(
|
77 |
-
if ($tokens[$openBracket]['code'] === T_OPEN_PARENTHESIS) {
|
78 |
$errorType = 'variableArgument';
|
79 |
break;
|
80 |
}
|
81 |
|
82 |
-
} elseif (in_array($tokens[$curToken]['type'], array('T_VARIABLE', 'T_FUNCTION', 'T_CLOSURE'), true)) {
|
83 |
$errorType = 'variableArgument';
|
84 |
break;
|
85 |
|
@@ -96,7 +106,5 @@ class ForbiddenBreakContinueVariableArgumentsSniff extends Sniff
|
|
96 |
|
97 |
$phpcsFile->addError($error, $stackPtr, $errorCode, $data);
|
98 |
}
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
|
|
|
|
|
|
5 |
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\ControlStructures;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
|
17 |
/**
|
18 |
+
* Detects using 0 and variable numeric arguments on `break` and `continue` statements.
|
19 |
*
|
20 |
+
* This sniff checks for:
|
21 |
+
* - Using `break` and/or `continue` with a variable as the numeric argument.
|
22 |
+
* - Using `break` and/or `continue` with a zero - 0 - as the numeric argument.
|
23 |
*
|
24 |
* PHP version 5.4
|
25 |
*
|
26 |
+
* @link https://www.php.net/manual/en/migration54.incompatible.php
|
27 |
+
* @link https://www.php.net/manual/en/control-structures.break.php
|
28 |
+
* @link https://www.php.net/manual/en/control-structures.continue.php
|
29 |
+
*
|
30 |
+
* @since 5.5
|
31 |
+
* @since 5.6 Now extends the base `Sniff` class.
|
32 |
*/
|
33 |
class ForbiddenBreakContinueVariableArgumentsSniff extends Sniff
|
34 |
{
|
37 |
*
|
38 |
* Array key is the error code. Array value will be used as part of the error message.
|
39 |
*
|
40 |
+
* @since 7.0.5
|
41 |
+
* @since 7.1.0 Changed from class constants to property.
|
42 |
+
*
|
43 |
* @var array
|
44 |
*/
|
45 |
private $errorTypes = array(
|
50 |
/**
|
51 |
* Returns an array of tokens this test wants to listen for.
|
52 |
*
|
53 |
+
* @since 5.5
|
54 |
+
*
|
55 |
* @return array
|
56 |
*/
|
57 |
public function register()
|
58 |
{
|
59 |
+
return array(\T_BREAK, \T_CONTINUE);
|
60 |
+
}
|
|
|
61 |
|
62 |
/**
|
63 |
* Processes this test, when one of its tokens is encountered.
|
64 |
*
|
65 |
+
* @since 5.5
|
66 |
+
*
|
67 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
68 |
* @param int $stackPtr The position of the current token in the
|
69 |
* stack passed in $tokens.
|
70 |
*
|
71 |
* @return void
|
72 |
*/
|
73 |
+
public function process(File $phpcsFile, $stackPtr)
|
74 |
{
|
75 |
if ($this->supportsAbove('5.4') === false) {
|
76 |
return;
|
77 |
}
|
78 |
|
79 |
$tokens = $phpcsFile->getTokens();
|
80 |
+
$nextSemicolonToken = $phpcsFile->findNext(array(\T_SEMICOLON, \T_CLOSE_TAG), ($stackPtr), null, false);
|
81 |
$errorType = '';
|
82 |
for ($curToken = $stackPtr + 1; $curToken < $nextSemicolonToken; $curToken++) {
|
83 |
if ($tokens[$curToken]['type'] === 'T_STRING') {
|
84 |
// If the next non-whitespace token after the string
|
85 |
// is an opening parenthesis then it's a function call.
|
86 |
+
$openBracket = $phpcsFile->findNext(Tokens::$emptyTokens, $curToken + 1, null, true);
|
87 |
+
if ($tokens[$openBracket]['code'] === \T_OPEN_PARENTHESIS) {
|
88 |
$errorType = 'variableArgument';
|
89 |
break;
|
90 |
}
|
91 |
|
92 |
+
} elseif (\in_array($tokens[$curToken]['type'], array('T_VARIABLE', 'T_FUNCTION', 'T_CLOSURE'), true)) {
|
93 |
$errorType = 'variableArgument';
|
94 |
break;
|
95 |
|
106 |
|
107 |
$phpcsFile->addError($error, $stackPtr, $errorCode, $data);
|
108 |
}
|
109 |
+
}
|
110 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → ControlStructures}/ForbiddenSwitchWithMultipleDefaultBlocksSniff.php
RENAMED
@@ -1,28 +1,27 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Wim Godden <wim@cu.be>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
|
|
15 |
|
16 |
/**
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* Switch statements can not have multiple default blocks since PHP 7.0
|
20 |
*
|
21 |
* PHP version 7.0
|
22 |
*
|
23 |
-
* @
|
24 |
-
* @
|
25 |
-
*
|
|
|
26 |
*/
|
27 |
class ForbiddenSwitchWithMultipleDefaultBlocksSniff extends Sniff
|
28 |
{
|
@@ -30,24 +29,27 @@ class ForbiddenSwitchWithMultipleDefaultBlocksSniff extends Sniff
|
|
30 |
/**
|
31 |
* Returns an array of tokens this test wants to listen for.
|
32 |
*
|
|
|
|
|
33 |
* @return array
|
34 |
*/
|
35 |
public function register()
|
36 |
{
|
37 |
-
return array(T_SWITCH);
|
38 |
-
|
39 |
-
}//end register()
|
40 |
|
41 |
/**
|
42 |
* Processes this test, when one of its tokens is encountered.
|
43 |
*
|
|
|
|
|
44 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
45 |
* @param int $stackPtr The position of the current token
|
46 |
* in the stack passed in $tokens.
|
47 |
*
|
48 |
* @return void
|
49 |
*/
|
50 |
-
public function process(
|
51 |
{
|
52 |
if ($this->supportsAbove('7.0') === false) {
|
53 |
return;
|
@@ -61,7 +63,7 @@ class ForbiddenSwitchWithMultipleDefaultBlocksSniff extends Sniff
|
|
61 |
$defaultToken = $stackPtr;
|
62 |
$defaultCount = 0;
|
63 |
$targetLevel = $tokens[$stackPtr]['level'] + 1;
|
64 |
-
while ($defaultCount < 2 && ($defaultToken = $phpcsFile->findNext(array(T_DEFAULT), $defaultToken + 1, $tokens[$stackPtr]['scope_closer'])) !== false) {
|
65 |
// Same level or one below (= two default cases after each other).
|
66 |
if ($tokens[$defaultToken]['level'] === $targetLevel || $tokens[$defaultToken]['level'] === ($targetLevel + 1)) {
|
67 |
$defaultCount++;
|
@@ -75,6 +77,5 @@ class ForbiddenSwitchWithMultipleDefaultBlocksSniff extends Sniff
|
|
75 |
'Found'
|
76 |
);
|
77 |
}
|
78 |
-
}
|
79 |
-
|
80 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\ControlStructures;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
17 |
+
* Switch statements can not have multiple default blocks since PHP 7.0.
|
|
|
|
|
18 |
*
|
19 |
* PHP version 7.0
|
20 |
*
|
21 |
+
* @link https://wiki.php.net/rfc/switch.default.multiple
|
22 |
+
* @link https://www.php.net/manual/en/control-structures.switch.php
|
23 |
+
*
|
24 |
+
* @since 7.0.0
|
25 |
*/
|
26 |
class ForbiddenSwitchWithMultipleDefaultBlocksSniff extends Sniff
|
27 |
{
|
29 |
/**
|
30 |
* Returns an array of tokens this test wants to listen for.
|
31 |
*
|
32 |
+
* @since 7.0.0
|
33 |
+
*
|
34 |
* @return array
|
35 |
*/
|
36 |
public function register()
|
37 |
{
|
38 |
+
return array(\T_SWITCH);
|
39 |
+
}
|
|
|
40 |
|
41 |
/**
|
42 |
* Processes this test, when one of its tokens is encountered.
|
43 |
*
|
44 |
+
* @since 7.0.0
|
45 |
+
*
|
46 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
47 |
* @param int $stackPtr The position of the current token
|
48 |
* in the stack passed in $tokens.
|
49 |
*
|
50 |
* @return void
|
51 |
*/
|
52 |
+
public function process(File $phpcsFile, $stackPtr)
|
53 |
{
|
54 |
if ($this->supportsAbove('7.0') === false) {
|
55 |
return;
|
63 |
$defaultToken = $stackPtr;
|
64 |
$defaultCount = 0;
|
65 |
$targetLevel = $tokens[$stackPtr]['level'] + 1;
|
66 |
+
while ($defaultCount < 2 && ($defaultToken = $phpcsFile->findNext(array(\T_DEFAULT), $defaultToken + 1, $tokens[$stackPtr]['scope_closer'])) !== false) {
|
67 |
// Same level or one below (= two default cases after each other).
|
68 |
if ($tokens[$defaultToken]['level'] === $targetLevel || $tokens[$defaultToken]['level'] === ($targetLevel + 1)) {
|
69 |
$defaultCount++;
|
77 |
'Found'
|
78 |
);
|
79 |
}
|
80 |
+
}
|
81 |
+
}
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → ControlStructures}/NewExecutionDirectivesSniff.php
RENAMED
@@ -1,23 +1,39 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
-
namespace PHPCompatibility\Sniffs\
|
11 |
|
12 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
13 |
use PHPCompatibility\PHPCSHelper;
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
-
*
|
17 |
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
*/
|
22 |
class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
23 |
{
|
@@ -29,7 +45,9 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
29 |
* If the execution order is conditional, add the condition as a string to the version nr.
|
30 |
* If's sufficient to list the first version where the execution directive appears.
|
31 |
*
|
32 |
-
* @
|
|
|
|
|
33 |
*/
|
34 |
protected $newDirectives = array(
|
35 |
'ticks' => array(
|
@@ -54,6 +72,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
54 |
/**
|
55 |
* Tokens to ignore when trying to find the value for the directive.
|
56 |
*
|
|
|
|
|
57 |
* @var array
|
58 |
*/
|
59 |
protected $ignoreTokens = array();
|
@@ -62,27 +82,31 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
62 |
/**
|
63 |
* Returns an array of tokens this test wants to listen for.
|
64 |
*
|
|
|
|
|
65 |
* @return array
|
66 |
*/
|
67 |
public function register()
|
68 |
{
|
69 |
-
$this->ignoreTokens
|
70 |
-
$this->ignoreTokens[T_EQUAL] = T_EQUAL;
|
71 |
|
72 |
-
return array(T_DECLARE);
|
73 |
-
}
|
74 |
|
75 |
|
76 |
/**
|
77 |
* Processes this test, when one of its tokens is encountered.
|
78 |
*
|
|
|
|
|
79 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
80 |
* @param int $stackPtr The position of the current token in
|
81 |
* the stack passed in $tokens.
|
82 |
*
|
83 |
* @return void
|
84 |
*/
|
85 |
-
public function process(
|
86 |
{
|
87 |
$tokens = $phpcsFile->getTokens();
|
88 |
|
@@ -94,15 +118,15 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
94 |
return;
|
95 |
}
|
96 |
|
97 |
-
// Deal with PHPCS
|
98 |
-
$openParenthesis = $phpcsFile->findNext(T_OPEN_PARENTHESIS, ($stackPtr + 1), null, false, null, true);
|
99 |
if ($openParenthesis === false || isset($tokens[$openParenthesis]['parenthesis_closer']) === false) {
|
100 |
return;
|
101 |
}
|
102 |
$closeParenthesis = $tokens[$openParenthesis]['parenthesis_closer'];
|
103 |
}
|
104 |
|
105 |
-
$directivePtr = $phpcsFile->findNext(T_STRING, ($openParenthesis + 1), $closeParenthesis, false);
|
106 |
if ($directivePtr === false) {
|
107 |
return;
|
108 |
}
|
@@ -133,13 +157,14 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
133 |
|
134 |
$this->addWarningOnInvalidValue($phpcsFile, $valuePtr, $directiveContent);
|
135 |
}
|
136 |
-
|
137 |
-
}//end process()
|
138 |
|
139 |
|
140 |
/**
|
141 |
* Determine whether an error/warning should be thrown for an item based on collected information.
|
142 |
*
|
|
|
|
|
143 |
* @param array $errorInfo Detail information about an item.
|
144 |
*
|
145 |
* @return bool
|
@@ -153,6 +178,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
153 |
/**
|
154 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
155 |
*
|
|
|
|
|
156 |
* @param array $itemInfo Base information about the item.
|
157 |
*
|
158 |
* @return array Version and other information about the item.
|
@@ -166,6 +193,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
166 |
/**
|
167 |
* Get an array of the non-PHP-version array keys used in a sub-array.
|
168 |
*
|
|
|
|
|
169 |
* @return array
|
170 |
*/
|
171 |
protected function getNonVersionArrayKeys()
|
@@ -180,6 +209,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
180 |
/**
|
181 |
* Retrieve the relevant detail (version) information for use in an error message.
|
182 |
*
|
|
|
|
|
183 |
* @param array $itemArray Version and other information about the item.
|
184 |
* @param array $itemInfo Base information about the item.
|
185 |
*
|
@@ -187,7 +218,7 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
187 |
*/
|
188 |
public function getErrorInfo(array $itemArray, array $itemInfo)
|
189 |
{
|
190 |
-
$errorInfo
|
191 |
$errorInfo['conditional_version'] = '';
|
192 |
$errorInfo['condition'] = '';
|
193 |
|
@@ -195,7 +226,7 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
195 |
|
196 |
if (empty($versionArray) === false) {
|
197 |
foreach ($versionArray as $version => $present) {
|
198 |
-
if (is_string($present) === true && $this->supportsBelow($version) === true) {
|
199 |
// We cannot test for compilation option (ok, except by scraping the output of phpinfo...).
|
200 |
$errorInfo['conditional_version'] = $version;
|
201 |
$errorInfo['condition'] = $present;
|
@@ -210,6 +241,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
210 |
/**
|
211 |
* Get the error message template for this sniff.
|
212 |
*
|
|
|
|
|
213 |
* @return string
|
214 |
*/
|
215 |
protected function getErrorMsgTemplate()
|
@@ -221,6 +254,11 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
221 |
/**
|
222 |
* Generates the error or warning for this item.
|
223 |
*
|
|
|
|
|
|
|
|
|
|
|
224 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
225 |
* @param int $stackPtr The position of the relevant token in
|
226 |
* the stack.
|
@@ -230,7 +268,7 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
230 |
*
|
231 |
* @return void
|
232 |
*/
|
233 |
-
public function addError(
|
234 |
{
|
235 |
if ($errorInfo['not_in_version'] !== '') {
|
236 |
parent::addError($phpcsFile, $stackPtr, $itemInfo, $errorInfo);
|
@@ -245,13 +283,15 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
245 |
|
246 |
$phpcsFile->addWarning($error, $stackPtr, $errorCode, $data);
|
247 |
}
|
248 |
-
|
249 |
-
}//end addError()
|
250 |
|
251 |
|
252 |
/**
|
253 |
* Generates a error or warning for this sniff.
|
254 |
*
|
|
|
|
|
|
|
255 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
256 |
* @param int $stackPtr The position of the execution directive value
|
257 |
* in the token array.
|
@@ -259,22 +299,22 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
259 |
*
|
260 |
* @return void
|
261 |
*/
|
262 |
-
protected function addWarningOnInvalidValue(
|
263 |
{
|
264 |
$tokens = $phpcsFile->getTokens();
|
265 |
|
266 |
$value = $tokens[$stackPtr]['content'];
|
267 |
-
if (
|
268 |
$value = $this->stripQuotes($value);
|
269 |
}
|
270 |
|
271 |
$isError = false;
|
272 |
if (isset($this->newDirectives[$directive]['valid_values'])) {
|
273 |
-
if (in_array($value, $this->newDirectives[$directive]['valid_values']) === false) {
|
274 |
$isError = true;
|
275 |
}
|
276 |
} elseif (isset($this->newDirectives[$directive]['valid_value_callback'])) {
|
277 |
-
$valid = call_user_func(array($this, $this->newDirectives[$directive]['valid_value_callback']), $value);
|
278 |
if ($valid === false) {
|
279 |
$isError = true;
|
280 |
}
|
@@ -290,7 +330,7 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
290 |
|
291 |
$phpcsFile->addWarning($error, $stackPtr, $errorCode, $data);
|
292 |
}
|
293 |
-
}
|
294 |
|
295 |
|
296 |
/**
|
@@ -298,6 +338,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
298 |
*
|
299 |
* Callback function to test whether the value for an execution directive is valid.
|
300 |
*
|
|
|
|
|
301 |
* @param mixed $value The value to test.
|
302 |
*
|
303 |
* @return bool
|
@@ -313,6 +355,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
313 |
*
|
314 |
* Callback function to test whether the value for an execution directive is valid.
|
315 |
*
|
|
|
|
|
316 |
* @param mixed $value The value to test.
|
317 |
*
|
318 |
* @return bool
|
@@ -324,13 +368,11 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
|
324 |
$encodings = mb_list_encodings();
|
325 |
}
|
326 |
|
327 |
-
if (empty($encodings) || is_array($encodings) === false) {
|
328 |
// If we can't test the encoding, let it pass through.
|
329 |
return true;
|
330 |
}
|
331 |
|
332 |
-
return in_array($value, $encodings, true);
|
333 |
}
|
334 |
-
|
335 |
-
|
336 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\ControlStructures;
|
12 |
|
13 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
14 |
use PHPCompatibility\PHPCSHelper;
|
15 |
+
use PHP_CodeSniffer_File as File;
|
16 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
17 |
|
18 |
/**
|
19 |
+
* Check for valid execution directives set with `declare()`.
|
20 |
*
|
21 |
+
* The sniff contains three distinct checks:
|
22 |
+
* - Check if the execution directive used is valid. PHP currently only supports
|
23 |
+
* three execution directives.
|
24 |
+
* - Check if the execution directive used is available in the PHP versions
|
25 |
+
* for which support is being checked.
|
26 |
+
* In the case of the `encoding` directive on PHP 5.3, support is conditional
|
27 |
+
* on the `--enable-zend-multibyte` compilation option. This will be indicated as such.
|
28 |
+
* - Check whether the value for the directive is valid.
|
29 |
+
*
|
30 |
+
* PHP version All
|
31 |
+
*
|
32 |
+
* @link https://www.php.net/manual/en/control-structures.declare.php
|
33 |
+
* @link https://wiki.php.net/rfc/scalar_type_hints_v5#strict_types_declare_directive
|
34 |
+
*
|
35 |
+
* @since 7.0.3
|
36 |
+
* @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.
|
37 |
*/
|
38 |
class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
|
39 |
{
|
45 |
* If the execution order is conditional, add the condition as a string to the version nr.
|
46 |
* If's sufficient to list the first version where the execution directive appears.
|
47 |
*
|
48 |
+
* @since 7.0.3
|
49 |
+
*
|
50 |
+
* @var array(string => array(string => bool|string|array))
|
51 |
*/
|
52 |
protected $newDirectives = array(
|
53 |
'ticks' => array(
|
72 |
/**
|
73 |
* Tokens to ignore when trying to find the value for the directive.
|
74 |
*
|
75 |
+
* @since 7.0.3
|
76 |
+
*
|
77 |
* @var array
|
78 |
*/
|
79 |
protected $ignoreTokens = array();
|
82 |
/**
|
83 |
* Returns an array of tokens this test wants to listen for.
|
84 |
*
|
85 |
+
* @since 7.0.3
|
86 |
+
*
|
87 |
* @return array
|
88 |
*/
|
89 |
public function register()
|
90 |
{
|
91 |
+
$this->ignoreTokens = Tokens::$emptyTokens;
|
92 |
+
$this->ignoreTokens[\T_EQUAL] = \T_EQUAL;
|
93 |
|
94 |
+
return array(\T_DECLARE);
|
95 |
+
}
|
96 |
|
97 |
|
98 |
/**
|
99 |
* Processes this test, when one of its tokens is encountered.
|
100 |
*
|
101 |
+
* @since 7.0.3
|
102 |
+
*
|
103 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
104 |
* @param int $stackPtr The position of the current token in
|
105 |
* the stack passed in $tokens.
|
106 |
*
|
107 |
* @return void
|
108 |
*/
|
109 |
+
public function process(File $phpcsFile, $stackPtr)
|
110 |
{
|
111 |
$tokens = $phpcsFile->getTokens();
|
112 |
|
118 |
return;
|
119 |
}
|
120 |
|
121 |
+
// Deal with PHPCS 2.3.0-2.3.3 which do not yet set the parenthesis properly for declare statements.
|
122 |
+
$openParenthesis = $phpcsFile->findNext(\T_OPEN_PARENTHESIS, ($stackPtr + 1), null, false, null, true);
|
123 |
if ($openParenthesis === false || isset($tokens[$openParenthesis]['parenthesis_closer']) === false) {
|
124 |
return;
|
125 |
}
|
126 |
$closeParenthesis = $tokens[$openParenthesis]['parenthesis_closer'];
|
127 |
}
|
128 |
|
129 |
+
$directivePtr = $phpcsFile->findNext(\T_STRING, ($openParenthesis + 1), $closeParenthesis, false);
|
130 |
if ($directivePtr === false) {
|
131 |
return;
|
132 |
}
|
157 |
|
158 |
$this->addWarningOnInvalidValue($phpcsFile, $valuePtr, $directiveContent);
|
159 |
}
|
160 |
+
}
|
|
|
161 |
|
162 |
|
163 |
/**
|
164 |
* Determine whether an error/warning should be thrown for an item based on collected information.
|
165 |
*
|
166 |
+
* @since 7.1.0
|
167 |
+
*
|
168 |
* @param array $errorInfo Detail information about an item.
|
169 |
*
|
170 |
* @return bool
|
178 |
/**
|
179 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
180 |
*
|
181 |
+
* @since 7.1.0
|
182 |
+
*
|
183 |
* @param array $itemInfo Base information about the item.
|
184 |
*
|
185 |
* @return array Version and other information about the item.
|
193 |
/**
|
194 |
* Get an array of the non-PHP-version array keys used in a sub-array.
|
195 |
*
|
196 |
+
* @since 7.1.0
|
197 |
+
*
|
198 |
* @return array
|
199 |
*/
|
200 |
protected function getNonVersionArrayKeys()
|
209 |
/**
|
210 |
* Retrieve the relevant detail (version) information for use in an error message.
|
211 |
*
|
212 |
+
* @since 7.1.0
|
213 |
+
*
|
214 |
* @param array $itemArray Version and other information about the item.
|
215 |
* @param array $itemInfo Base information about the item.
|
216 |
*
|
218 |
*/
|
219 |
public function getErrorInfo(array $itemArray, array $itemInfo)
|
220 |
{
|
221 |
+
$errorInfo = parent::getErrorInfo($itemArray, $itemInfo);
|
222 |
$errorInfo['conditional_version'] = '';
|
223 |
$errorInfo['condition'] = '';
|
224 |
|
226 |
|
227 |
if (empty($versionArray) === false) {
|
228 |
foreach ($versionArray as $version => $present) {
|
229 |
+
if (\is_string($present) === true && $this->supportsBelow($version) === true) {
|
230 |
// We cannot test for compilation option (ok, except by scraping the output of phpinfo...).
|
231 |
$errorInfo['conditional_version'] = $version;
|
232 |
$errorInfo['condition'] = $present;
|
241 |
/**
|
242 |
* Get the error message template for this sniff.
|
243 |
*
|
244 |
+
* @since 7.1.0
|
245 |
+
*
|
246 |
* @return string
|
247 |
*/
|
248 |
protected function getErrorMsgTemplate()
|
254 |
/**
|
255 |
* Generates the error or warning for this item.
|
256 |
*
|
257 |
+
* @since 7.0.3
|
258 |
+
* @since 7.1.0 This method now overloads the method from the `AbstractNewFeatureSniff` class.
|
259 |
+
* - Renamed from `maybeAddError()` to `addError()`.
|
260 |
+
* - Changed visibility from `protected` to `public`.
|
261 |
+
*
|
262 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
263 |
* @param int $stackPtr The position of the relevant token in
|
264 |
* the stack.
|
268 |
*
|
269 |
* @return void
|
270 |
*/
|
271 |
+
public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
|
272 |
{
|
273 |
if ($errorInfo['not_in_version'] !== '') {
|
274 |
parent::addError($phpcsFile, $stackPtr, $itemInfo, $errorInfo);
|
283 |
|
284 |
$phpcsFile->addWarning($error, $stackPtr, $errorCode, $data);
|
285 |
}
|
286 |
+
}
|
|
|
287 |
|
288 |
|
289 |
/**
|
290 |
* Generates a error or warning for this sniff.
|
291 |
*
|
292 |
+
* @since 7.0.3
|
293 |
+
* @since 7.0.6 Renamed from `addErrorOnInvalidValue()` to `addWarningOnInvalidValue()`.
|
294 |
+
*
|
295 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
296 |
* @param int $stackPtr The position of the execution directive value
|
297 |
* in the token array.
|
299 |
*
|
300 |
* @return void
|
301 |
*/
|
302 |
+
protected function addWarningOnInvalidValue(File $phpcsFile, $stackPtr, $directive)
|
303 |
{
|
304 |
$tokens = $phpcsFile->getTokens();
|
305 |
|
306 |
$value = $tokens[$stackPtr]['content'];
|
307 |
+
if (isset(Tokens::$stringTokens[$tokens[$stackPtr]['code']]) === true) {
|
308 |
$value = $this->stripQuotes($value);
|
309 |
}
|
310 |
|
311 |
$isError = false;
|
312 |
if (isset($this->newDirectives[$directive]['valid_values'])) {
|
313 |
+
if (\in_array($value, $this->newDirectives[$directive]['valid_values']) === false) {
|
314 |
$isError = true;
|
315 |
}
|
316 |
} elseif (isset($this->newDirectives[$directive]['valid_value_callback'])) {
|
317 |
+
$valid = \call_user_func(array($this, $this->newDirectives[$directive]['valid_value_callback']), $value);
|
318 |
if ($valid === false) {
|
319 |
$isError = true;
|
320 |
}
|
330 |
|
331 |
$phpcsFile->addWarning($error, $stackPtr, $errorCode, $data);
|
332 |
}
|
333 |
+
}
|
334 |
|
335 |
|
336 |
/**
|
338 |
*
|
339 |
* Callback function to test whether the value for an execution directive is valid.
|
340 |
*
|
341 |
+
* @since 7.0.3
|
342 |
+
*
|
343 |
* @param mixed $value The value to test.
|
344 |
*
|
345 |
* @return bool
|
355 |
*
|
356 |
* Callback function to test whether the value for an execution directive is valid.
|
357 |
*
|
358 |
+
* @since 7.0.3
|
359 |
+
*
|
360 |
* @param mixed $value The value to test.
|
361 |
*
|
362 |
* @return bool
|
368 |
$encodings = mb_list_encodings();
|
369 |
}
|
370 |
|
371 |
+
if (empty($encodings) || \is_array($encodings) === false) {
|
372 |
// If we can't test the encoding, let it pass through.
|
373 |
return true;
|
374 |
}
|
375 |
|
376 |
+
return \in_array($value, $encodings, true);
|
377 |
}
|
378 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewForeachExpressionReferencingSniff.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
+
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace PHPCompatibility\Sniffs\ControlStructures;
|
12 |
+
|
13 |
+
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Detect `foreach` expression referencing.
|
18 |
+
*
|
19 |
+
* Before PHP 5.5.0, referencing `$value` in a `foreach` was only possible
|
20 |
+
* if the iterated array could be referenced (i.e. if it is a variable).
|
21 |
+
*
|
22 |
+
* PHP version 5.5
|
23 |
+
*
|
24 |
+
* @link https://www.php.net/manual/en/control-structures.foreach.php
|
25 |
+
*
|
26 |
+
* @since 9.0.0
|
27 |
+
*/
|
28 |
+
class NewForeachExpressionReferencingSniff extends Sniff
|
29 |
+
{
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Returns an array of tokens this test wants to listen for.
|
33 |
+
*
|
34 |
+
* @since 9.0.0
|
35 |
+
*
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
public function register()
|
39 |
+
{
|
40 |
+
return array(\T_FOREACH);
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Processes this test, when one of its tokens is encountered.
|
45 |
+
*
|
46 |
+
* @since 9.0.0
|
47 |
+
*
|
48 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
49 |
+
* @param int $stackPtr The position of the current token in the
|
50 |
+
* stack passed in $tokens.
|
51 |
+
*
|
52 |
+
* @return void
|
53 |
+
*/
|
54 |
+
public function process(File $phpcsFile, $stackPtr)
|
55 |
+
{
|
56 |
+
if ($this->supportsBelow('5.4') === false) {
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
+
$tokens = $phpcsFile->getTokens();
|
61 |
+
|
62 |
+
if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) {
|
63 |
+
return;
|
64 |
+
}
|
65 |
+
|
66 |
+
$opener = $tokens[$stackPtr]['parenthesis_opener'];
|
67 |
+
$closer = $tokens[$stackPtr]['parenthesis_closer'];
|
68 |
+
|
69 |
+
$asToken = $phpcsFile->findNext(\T_AS, ($opener + 1), $closer);
|
70 |
+
if ($asToken === false) {
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
|
74 |
+
/*
|
75 |
+
* Note: referencing $key is not allowed in any version, so this should only find referenced $values.
|
76 |
+
* If it does find a referenced key, it would be a parse error anyway.
|
77 |
+
*/
|
78 |
+
$hasReference = $phpcsFile->findNext(\T_BITWISE_AND, ($asToken + 1), $closer);
|
79 |
+
if ($hasReference === false) {
|
80 |
+
return;
|
81 |
+
}
|
82 |
+
|
83 |
+
$nestingLevel = 0;
|
84 |
+
if ($asToken !== ($opener + 1) && isset($tokens[$opener + 1]['nested_parenthesis'])) {
|
85 |
+
$nestingLevel = \count($tokens[$opener + 1]['nested_parenthesis']);
|
86 |
+
}
|
87 |
+
|
88 |
+
if ($this->isVariable($phpcsFile, ($opener + 1), $asToken, $nestingLevel) === true) {
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
|
92 |
+
// Non-variable detected before the `as` keyword.
|
93 |
+
$phpcsFile->addError(
|
94 |
+
'Referencing $value is only possible if the iterated array is a variable in PHP 5.4 or earlier.',
|
95 |
+
$hasReference,
|
96 |
+
'Found'
|
97 |
+
);
|
98 |
+
}
|
99 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewListInForeachSniff.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
+
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace PHPCompatibility\Sniffs\ControlStructures;
|
12 |
+
|
13 |
+
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Detect unpacking nested arrays with `list()` in a `foreach()` as available since PHP 5.5.
|
18 |
+
*
|
19 |
+
* PHP version 5.5
|
20 |
+
*
|
21 |
+
* @link https://www.php.net/manual/en/migration55.new-features.php#migration55.new-features.foreach-list
|
22 |
+
* @link https://wiki.php.net/rfc/foreachlist
|
23 |
+
* @link https://www.php.net/manual/en/control-structures.foreach.php#control-structures.foreach.list
|
24 |
+
*
|
25 |
+
* @since 9.0.0
|
26 |
+
*/
|
27 |
+
class NewListInForeachSniff extends Sniff
|
28 |
+
{
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Returns an array of tokens this test wants to listen for.
|
32 |
+
*
|
33 |
+
* @since 9.0.0
|
34 |
+
*
|
35 |
+
* @return array
|
36 |
+
*/
|
37 |
+
public function register()
|
38 |
+
{
|
39 |
+
return array(\T_FOREACH);
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Processes this test, when one of its tokens is encountered.
|
44 |
+
*
|
45 |
+
* @since 9.0.0
|
46 |
+
*
|
47 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
48 |
+
* @param int $stackPtr The position of the current token in the
|
49 |
+
* stack passed in $tokens.
|
50 |
+
*
|
51 |
+
* @return void
|
52 |
+
*/
|
53 |
+
public function process(File $phpcsFile, $stackPtr)
|
54 |
+
{
|
55 |
+
if ($this->supportsBelow('5.4') === false) {
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
|
59 |
+
$tokens = $phpcsFile->getTokens();
|
60 |
+
|
61 |
+
if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) {
|
62 |
+
return;
|
63 |
+
}
|
64 |
+
|
65 |
+
$opener = $tokens[$stackPtr]['parenthesis_opener'];
|
66 |
+
$closer = $tokens[$stackPtr]['parenthesis_closer'];
|
67 |
+
|
68 |
+
$asToken = $phpcsFile->findNext(\T_AS, ($opener + 1), $closer);
|
69 |
+
if ($asToken === false) {
|
70 |
+
return;
|
71 |
+
}
|
72 |
+
|
73 |
+
$hasList = $phpcsFile->findNext(array(\T_LIST, \T_OPEN_SHORT_ARRAY), ($asToken + 1), $closer);
|
74 |
+
if ($hasList === false) {
|
75 |
+
return;
|
76 |
+
}
|
77 |
+
|
78 |
+
$phpcsFile->addError(
|
79 |
+
'Unpacking nested arrays with list() in a foreach is not supported in PHP 5.4 or earlier.',
|
80 |
+
$hasList,
|
81 |
+
'Found'
|
82 |
+
);
|
83 |
+
}
|
84 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → ControlStructures}/NewMultiCatchSniff.php
RENAMED
@@ -1,52 +1,55 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
|
|
15 |
|
16 |
/**
|
17 |
-
* \PHPCompatibility\Sniffs\PHP\NewMultiCatch.
|
18 |
-
*
|
19 |
* Catching multiple exception types in one statement is available since PHP 7.1.
|
20 |
*
|
21 |
* PHP version 7.1
|
22 |
*
|
23 |
-
* @
|
24 |
-
* @
|
25 |
-
* @
|
|
|
|
|
26 |
*/
|
27 |
class NewMultiCatchSniff extends Sniff
|
28 |
{
|
29 |
/**
|
30 |
* Returns an array of tokens this test wants to listen for.
|
31 |
*
|
|
|
|
|
32 |
* @return array
|
33 |
*/
|
34 |
public function register()
|
35 |
{
|
36 |
-
return array(T_CATCH);
|
37 |
-
|
38 |
-
}//end register()
|
39 |
|
40 |
/**
|
41 |
* Processes this test, when one of its tokens is encountered.
|
42 |
*
|
|
|
|
|
43 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
44 |
* @param int $stackPtr The position of the current token
|
45 |
* in the stack passed in $tokens.
|
46 |
*
|
47 |
* @return void
|
48 |
*/
|
49 |
-
public function process(
|
50 |
{
|
51 |
if ($this->supportsBelow('7.0') === false) {
|
52 |
return;
|
@@ -60,7 +63,7 @@ class NewMultiCatchSniff extends Sniff
|
|
60 |
return;
|
61 |
}
|
62 |
|
63 |
-
$hasBitwiseOr = $phpcsFile->findNext(T_BITWISE_OR, $token['parenthesis_opener'], $token['parenthesis_closer']);
|
64 |
|
65 |
if ($hasBitwiseOr === false) {
|
66 |
return;
|
@@ -71,7 +74,5 @@ class NewMultiCatchSniff extends Sniff
|
|
71 |
$hasBitwiseOr,
|
72 |
'Found'
|
73 |
);
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\ControlStructures;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
|
|
|
|
17 |
* Catching multiple exception types in one statement is available since PHP 7.1.
|
18 |
*
|
19 |
* PHP version 7.1
|
20 |
*
|
21 |
+
* @link https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.mulit-catch-exception-handling
|
22 |
+
* @link https://wiki.php.net/rfc/multiple-catch
|
23 |
+
* @link https://www.php.net/manual/en/language.exceptions.php#language.exceptions.catch
|
24 |
+
*
|
25 |
+
* @since 7.0.7
|
26 |
*/
|
27 |
class NewMultiCatchSniff extends Sniff
|
28 |
{
|
29 |
/**
|
30 |
* Returns an array of tokens this test wants to listen for.
|
31 |
*
|
32 |
+
* @since 7.0.7
|
33 |
+
*
|
34 |
* @return array
|
35 |
*/
|
36 |
public function register()
|
37 |
{
|
38 |
+
return array(\T_CATCH);
|
39 |
+
}
|
|
|
40 |
|
41 |
/**
|
42 |
* Processes this test, when one of its tokens is encountered.
|
43 |
*
|
44 |
+
* @since 7.0.7
|
45 |
+
*
|
46 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
47 |
* @param int $stackPtr The position of the current token
|
48 |
* in the stack passed in $tokens.
|
49 |
*
|
50 |
* @return void
|
51 |
*/
|
52 |
+
public function process(File $phpcsFile, $stackPtr)
|
53 |
{
|
54 |
if ($this->supportsBelow('7.0') === false) {
|
55 |
return;
|
63 |
return;
|
64 |
}
|
65 |
|
66 |
+
$hasBitwiseOr = $phpcsFile->findNext(\T_BITWISE_OR, $token['parenthesis_opener'], $token['parenthesis_closer']);
|
67 |
|
68 |
if ($hasBitwiseOr === false) {
|
69 |
return;
|
74 |
$hasBitwiseOr,
|
75 |
'Found'
|
76 |
);
|
77 |
+
}
|
78 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Extensions}/RemovedExtensionsSniff.php
RENAMED
@@ -1,26 +1,39 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @category PHP
|
6 |
* @package PHPCompatibility
|
7 |
-
* @
|
8 |
-
* @
|
|
|
9 |
*/
|
10 |
|
11 |
-
namespace PHPCompatibility\Sniffs\
|
12 |
|
13 |
use PHPCompatibility\AbstractRemovedFeatureSniff;
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
-
*
|
17 |
*
|
18 |
-
*
|
|
|
19 |
*
|
20 |
-
*
|
21 |
-
*
|
22 |
-
*
|
23 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
*/
|
25 |
class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
26 |
{
|
@@ -31,23 +44,27 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
|
31 |
* prefix as one of the removed extensions.
|
32 |
*
|
33 |
* This property can be set from the ruleset, like so:
|
34 |
-
* <rule ref="PHPCompatibility.
|
35 |
* <properties>
|
36 |
* <property name="functionWhitelist" type="array" value="mysql_to_rfc3339,mysql_another_function" />
|
37 |
* </properties>
|
38 |
* </rule>
|
39 |
*
|
|
|
|
|
40 |
* @var array
|
41 |
*/
|
42 |
public $functionWhitelist;
|
43 |
|
44 |
/**
|
45 |
-
* A list of removed extensions with their alternative, if any
|
46 |
*
|
47 |
* The array lists : version number with false (deprecated) and true (removed).
|
48 |
* If's sufficient to list the first version where the extension was deprecated/removed.
|
49 |
*
|
50 |
-
* @
|
|
|
|
|
51 |
*/
|
52 |
protected $removedExtensions = array(
|
53 |
'activescript' => array(
|
@@ -95,6 +112,10 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
|
95 |
'5.2' => true,
|
96 |
'alternative' => null,
|
97 |
),
|
|
|
|
|
|
|
|
|
98 |
'ingres' => array(
|
99 |
'5.1' => true,
|
100 |
'alternative' => 'pecl/ingres',
|
@@ -110,7 +131,7 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
|
110 |
),
|
111 |
'mcve' => array(
|
112 |
'5.1' => true,
|
113 |
-
'alternative' => 'pecl/
|
114 |
),
|
115 |
'ming' => array(
|
116 |
'5.3' => true,
|
@@ -145,10 +166,14 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
|
145 |
'5.1' => true,
|
146 |
'alternative' => null,
|
147 |
),
|
148 |
-
'
|
149 |
-
'5.
|
150 |
'alternative' => null,
|
151 |
),
|
|
|
|
|
|
|
|
|
152 |
'sqlite' => array(
|
153 |
'5.4' => true,
|
154 |
'alternative' => null,
|
@@ -166,6 +191,10 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
|
166 |
'5.1' => true,
|
167 |
'alternative' => 'pecl/ffi',
|
168 |
),
|
|
|
|
|
|
|
|
|
169 |
'yp' => array(
|
170 |
'5.1' => true,
|
171 |
'alternative' => null,
|
@@ -175,6 +204,8 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
|
175 |
/**
|
176 |
* Returns an array of tokens this test wants to listen for.
|
177 |
*
|
|
|
|
|
178 |
* @return array
|
179 |
*/
|
180 |
public function register()
|
@@ -182,27 +213,28 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
|
182 |
// Handle case-insensitivity of function names.
|
183 |
$this->removedExtensions = $this->arrayKeysToLowercase($this->removedExtensions);
|
184 |
|
185 |
-
return array(T_STRING);
|
186 |
-
|
187 |
-
}//end register()
|
188 |
|
189 |
/**
|
190 |
* Processes this test, when one of its tokens is encountered.
|
191 |
*
|
|
|
|
|
192 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
193 |
* @param int $stackPtr The position of the current token in the
|
194 |
* stack passed in $tokens.
|
195 |
*
|
196 |
* @return void
|
197 |
*/
|
198 |
-
public function process(
|
199 |
{
|
200 |
$tokens = $phpcsFile->getTokens();
|
201 |
|
202 |
// Find the next non-empty token.
|
203 |
-
$openBracket = $phpcsFile->findNext(
|
204 |
|
205 |
-
if ($tokens[$openBracket]['code'] !== T_OPEN_PARENTHESIS) {
|
206 |
// Not a function call.
|
207 |
return;
|
208 |
}
|
@@ -213,20 +245,20 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
|
213 |
}
|
214 |
|
215 |
// Find the previous non-empty token.
|
216 |
-
$search =
|
217 |
-
$search[] = T_BITWISE_AND;
|
218 |
$previous = $phpcsFile->findPrevious($search, ($stackPtr - 1), null, true);
|
219 |
-
if ($tokens[$previous]['code'] === T_FUNCTION) {
|
220 |
// It's a function definition, not a function call.
|
221 |
return;
|
222 |
}
|
223 |
|
224 |
-
if ($tokens[$previous]['code'] === T_NEW) {
|
225 |
// We are creating an object, not calling a function.
|
226 |
return;
|
227 |
}
|
228 |
|
229 |
-
if ($tokens[$previous]['code'] === T_OBJECT_OPERATOR) {
|
230 |
// We are calling a method of an object.
|
231 |
return;
|
232 |
}
|
@@ -248,8 +280,7 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
|
248 |
break;
|
249 |
}
|
250 |
}
|
251 |
-
|
252 |
-
}//end process()
|
253 |
|
254 |
|
255 |
/**
|
@@ -257,6 +288,8 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
|
257 |
*
|
258 |
* Parsing the list late as it may be provided as a property, but also inline.
|
259 |
*
|
|
|
|
|
260 |
* @param string $content Content of the current token.
|
261 |
*
|
262 |
* @return bool
|
@@ -267,7 +300,7 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
|
267 |
return false;
|
268 |
}
|
269 |
|
270 |
-
if (is_string($this->functionWhitelist) === true) {
|
271 |
if (strpos($this->functionWhitelist, ',') !== false) {
|
272 |
$this->functionWhitelist = explode(',', $this->functionWhitelist);
|
273 |
} else {
|
@@ -275,19 +308,20 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
|
275 |
}
|
276 |
}
|
277 |
|
278 |
-
if (is_array($this->functionWhitelist) === true) {
|
279 |
$this->functionWhitelist = array_map('strtolower', $this->functionWhitelist);
|
280 |
-
return in_array($content, $this->functionWhitelist, true);
|
281 |
}
|
282 |
|
283 |
return false;
|
284 |
-
|
285 |
-
}//end isWhiteListed()
|
286 |
|
287 |
|
288 |
/**
|
289 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
290 |
*
|
|
|
|
|
291 |
* @param array $itemInfo Base information about the item.
|
292 |
*
|
293 |
* @return array Version and other information about the item.
|
@@ -301,12 +335,12 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
|
301 |
/**
|
302 |
* Get the error message template for this sniff.
|
303 |
*
|
|
|
|
|
304 |
* @return string
|
305 |
*/
|
306 |
protected function getErrorMsgTemplate()
|
307 |
{
|
308 |
return "Extension '%s' is ";
|
309 |
}
|
310 |
-
|
311 |
-
|
312 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
|
|
5 |
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\Extensions;
|
12 |
|
13 |
use PHPCompatibility\AbstractRemovedFeatureSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
|
17 |
/**
|
18 |
+
* Detect the use of deprecated and/or removed PHP extensions.
|
19 |
*
|
20 |
+
* This sniff examines function calls made and flags function calls to functions
|
21 |
+
* prefixed with the dedicated prefix from a deprecated/removed native PHP extension.
|
22 |
*
|
23 |
+
* Suggests alternative extensions if available.
|
24 |
+
*
|
25 |
+
* As userland functions may be prefixed with a prefix also used by a native
|
26 |
+
* PHP extension, the sniff offers the ability to whitelist specific functions
|
27 |
+
* from being flagged by this sniff via a property in a custom ruleset
|
28 |
+
* (since PHPCompatibility 7.0.2).
|
29 |
+
*
|
30 |
+
* {@internal This sniff is a candidate for removal once all functions from all
|
31 |
+
* deprecated/removed extensions have been added to the RemovedFunctions sniff.}
|
32 |
+
*
|
33 |
+
* PHP version All
|
34 |
+
*
|
35 |
+
* @since 5.5
|
36 |
+
* @since 7.1.0 Now extends the `AbstractRemovedFeatureSniff` instead of the base `Sniff` class.
|
37 |
*/
|
38 |
class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
|
39 |
{
|
44 |
* prefix as one of the removed extensions.
|
45 |
*
|
46 |
* This property can be set from the ruleset, like so:
|
47 |
+
* <rule ref="PHPCompatibility.Extensions.RemovedExtensions">
|
48 |
* <properties>
|
49 |
* <property name="functionWhitelist" type="array" value="mysql_to_rfc3339,mysql_another_function" />
|
50 |
* </properties>
|
51 |
* </rule>
|
52 |
*
|
53 |
+
* @since 7.0.2
|
54 |
+
*
|
55 |
* @var array
|
56 |
*/
|
57 |
public $functionWhitelist;
|
58 |
|
59 |
/**
|
60 |
+
* A list of removed extensions with their alternative, if any.
|
61 |
*
|
62 |
* The array lists : version number with false (deprecated) and true (removed).
|
63 |
* If's sufficient to list the first version where the extension was deprecated/removed.
|
64 |
*
|
65 |
+
* @since 5.5
|
66 |
+
*
|
67 |
+
* @var array(string => array(string => bool|string|null))
|
68 |
*/
|
69 |
protected $removedExtensions = array(
|
70 |
'activescript' => array(
|
112 |
'5.2' => true,
|
113 |
'alternative' => null,
|
114 |
),
|
115 |
+
'ibase' => array(
|
116 |
+
'7.4' => true,
|
117 |
+
'alternative' => 'pecl/ibase',
|
118 |
+
),
|
119 |
'ingres' => array(
|
120 |
'5.1' => true,
|
121 |
'alternative' => 'pecl/ingres',
|
131 |
),
|
132 |
'mcve' => array(
|
133 |
'5.1' => true,
|
134 |
+
'alternative' => 'pecl/mcve',
|
135 |
),
|
136 |
'ming' => array(
|
137 |
'5.3' => true,
|
166 |
'5.1' => true,
|
167 |
'alternative' => null,
|
168 |
),
|
169 |
+
'pfpro_' => array(
|
170 |
+
'5.1' => true,
|
171 |
'alternative' => null,
|
172 |
),
|
173 |
+
'recode' => array(
|
174 |
+
'7.4' => true,
|
175 |
+
'alternative' => 'iconv or mbstring',
|
176 |
+
),
|
177 |
'sqlite' => array(
|
178 |
'5.4' => true,
|
179 |
'alternative' => null,
|
191 |
'5.1' => true,
|
192 |
'alternative' => 'pecl/ffi',
|
193 |
),
|
194 |
+
'wddx' => array(
|
195 |
+
'7.4' => true,
|
196 |
+
'alternative' => 'pecl/wddx',
|
197 |
+
),
|
198 |
'yp' => array(
|
199 |
'5.1' => true,
|
200 |
'alternative' => null,
|
204 |
/**
|
205 |
* Returns an array of tokens this test wants to listen for.
|
206 |
*
|
207 |
+
* @since 5.5
|
208 |
+
*
|
209 |
* @return array
|
210 |
*/
|
211 |
public function register()
|
213 |
// Handle case-insensitivity of function names.
|
214 |
$this->removedExtensions = $this->arrayKeysToLowercase($this->removedExtensions);
|
215 |
|
216 |
+
return array(\T_STRING);
|
217 |
+
}
|
|
|
218 |
|
219 |
/**
|
220 |
* Processes this test, when one of its tokens is encountered.
|
221 |
*
|
222 |
+
* @since 5.5
|
223 |
+
*
|
224 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
225 |
* @param int $stackPtr The position of the current token in the
|
226 |
* stack passed in $tokens.
|
227 |
*
|
228 |
* @return void
|
229 |
*/
|
230 |
+
public function process(File $phpcsFile, $stackPtr)
|
231 |
{
|
232 |
$tokens = $phpcsFile->getTokens();
|
233 |
|
234 |
// Find the next non-empty token.
|
235 |
+
$openBracket = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
236 |
|
237 |
+
if ($tokens[$openBracket]['code'] !== \T_OPEN_PARENTHESIS) {
|
238 |
// Not a function call.
|
239 |
return;
|
240 |
}
|
245 |
}
|
246 |
|
247 |
// Find the previous non-empty token.
|
248 |
+
$search = Tokens::$emptyTokens;
|
249 |
+
$search[] = \T_BITWISE_AND;
|
250 |
$previous = $phpcsFile->findPrevious($search, ($stackPtr - 1), null, true);
|
251 |
+
if ($tokens[$previous]['code'] === \T_FUNCTION) {
|
252 |
// It's a function definition, not a function call.
|
253 |
return;
|
254 |
}
|
255 |
|
256 |
+
if ($tokens[$previous]['code'] === \T_NEW) {
|
257 |
// We are creating an object, not calling a function.
|
258 |
return;
|
259 |
}
|
260 |
|
261 |
+
if ($tokens[$previous]['code'] === \T_OBJECT_OPERATOR) {
|
262 |
// We are calling a method of an object.
|
263 |
return;
|
264 |
}
|
280 |
break;
|
281 |
}
|
282 |
}
|
283 |
+
}
|
|
|
284 |
|
285 |
|
286 |
/**
|
288 |
*
|
289 |
* Parsing the list late as it may be provided as a property, but also inline.
|
290 |
*
|
291 |
+
* @since 7.0.2
|
292 |
+
*
|
293 |
* @param string $content Content of the current token.
|
294 |
*
|
295 |
* @return bool
|
300 |
return false;
|
301 |
}
|
302 |
|
303 |
+
if (\is_string($this->functionWhitelist) === true) {
|
304 |
if (strpos($this->functionWhitelist, ',') !== false) {
|
305 |
$this->functionWhitelist = explode(',', $this->functionWhitelist);
|
306 |
} else {
|
308 |
}
|
309 |
}
|
310 |
|
311 |
+
if (\is_array($this->functionWhitelist) === true) {
|
312 |
$this->functionWhitelist = array_map('strtolower', $this->functionWhitelist);
|
313 |
+
return \in_array($content, $this->functionWhitelist, true);
|
314 |
}
|
315 |
|
316 |
return false;
|
317 |
+
}
|
|
|
318 |
|
319 |
|
320 |
/**
|
321 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
322 |
*
|
323 |
+
* @since 7.1.0
|
324 |
+
*
|
325 |
* @param array $itemInfo Base information about the item.
|
326 |
*
|
327 |
* @return array Version and other information about the item.
|
335 |
/**
|
336 |
* Get the error message template for this sniff.
|
337 |
*
|
338 |
+
* @since 7.1.0
|
339 |
+
*
|
340 |
* @return string
|
341 |
*/
|
342 |
protected function getErrorMsgTemplate()
|
343 |
{
|
344 |
return "Extension '%s' is ";
|
345 |
}
|
346 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/ParameterShadowSuperGlobalsSniff.php → FunctionDeclarations/ForbiddenParameterShadowSuperGlobalsSniff.php}
RENAMED
@@ -1,59 +1,60 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* PHP version 5.4
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
* @package PHPCompatibility
|
9 |
-
* @
|
10 |
-
* @
|
|
|
11 |
*/
|
12 |
|
13 |
-
namespace PHPCompatibility\Sniffs\
|
14 |
|
15 |
use PHPCompatibility\Sniff;
|
16 |
use PHPCompatibility\PHPCSHelper;
|
|
|
17 |
|
18 |
/**
|
19 |
-
*
|
20 |
*
|
21 |
-
*
|
22 |
-
*
|
23 |
-
* {@internal List of superglobals is maintained in the parent class.}}
|
24 |
*
|
25 |
* PHP version 5.4
|
26 |
*
|
27 |
-
* @
|
28 |
-
*
|
29 |
-
* @
|
30 |
-
* @copyright 2015 Declan Kelly
|
31 |
*/
|
32 |
-
class
|
33 |
{
|
34 |
|
35 |
/**
|
36 |
* Register the tokens to listen for.
|
37 |
*
|
|
|
|
|
|
|
38 |
* @return array
|
39 |
*/
|
40 |
public function register()
|
41 |
{
|
42 |
return array(
|
43 |
-
T_FUNCTION,
|
44 |
-
T_CLOSURE,
|
45 |
);
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
* Processes the test.
|
50 |
*
|
|
|
|
|
51 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
52 |
* @param int $stackPtr The position of the current token.
|
53 |
*
|
54 |
* @return void
|
55 |
*/
|
56 |
-
public function process(
|
57 |
{
|
58 |
if ($this->supportsAbove('5.4') === false) {
|
59 |
return;
|
@@ -61,12 +62,12 @@ class ParameterShadowSuperGlobalsSniff extends Sniff
|
|
61 |
|
62 |
// Get all parameters from function signature.
|
63 |
$parameters = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
|
64 |
-
if (empty($parameters) || is_array($parameters) === false) {
|
65 |
return;
|
66 |
}
|
67 |
|
68 |
foreach ($parameters as $param) {
|
69 |
-
if (
|
70 |
$error = 'Parameter shadowing super global (%s) causes fatal error since PHP 5.4';
|
71 |
$errorCode = $this->stringToErrorCode(substr($param['name'], 1)) . 'Found';
|
72 |
$data = array($param['name']);
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
|
|
|
|
|
|
5 |
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionDeclarations;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
use PHPCompatibility\PHPCSHelper;
|
15 |
+
use PHP_CodeSniffer_File as File;
|
16 |
|
17 |
/**
|
18 |
+
* Detect the use of superglobals as parameters for functions, support for which was removed in PHP 5.4.
|
19 |
*
|
20 |
+
* {@internal List of superglobals is maintained in the parent class.}
|
|
|
|
|
21 |
*
|
22 |
* PHP version 5.4
|
23 |
*
|
24 |
+
* @link https://www.php.net/manual/en/migration54.incompatible.php
|
25 |
+
*
|
26 |
+
* @since 7.0.0
|
|
|
27 |
*/
|
28 |
+
class ForbiddenParameterShadowSuperGlobalsSniff extends Sniff
|
29 |
{
|
30 |
|
31 |
/**
|
32 |
* Register the tokens to listen for.
|
33 |
*
|
34 |
+
* @since 7.0.0
|
35 |
+
* @since 7.1.3 Allows for closures.
|
36 |
+
*
|
37 |
* @return array
|
38 |
*/
|
39 |
public function register()
|
40 |
{
|
41 |
return array(
|
42 |
+
\T_FUNCTION,
|
43 |
+
\T_CLOSURE,
|
44 |
);
|
45 |
}
|
46 |
|
47 |
/**
|
48 |
* Processes the test.
|
49 |
*
|
50 |
+
* @since 7.0.0
|
51 |
+
*
|
52 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
53 |
* @param int $stackPtr The position of the current token.
|
54 |
*
|
55 |
* @return void
|
56 |
*/
|
57 |
+
public function process(File $phpcsFile, $stackPtr)
|
58 |
{
|
59 |
if ($this->supportsAbove('5.4') === false) {
|
60 |
return;
|
62 |
|
63 |
// Get all parameters from function signature.
|
64 |
$parameters = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
|
65 |
+
if (empty($parameters) || \is_array($parameters) === false) {
|
66 |
return;
|
67 |
}
|
68 |
|
69 |
foreach ($parameters as $param) {
|
70 |
+
if (isset($this->superglobals[$param['name']]) === true) {
|
71 |
$error = 'Parameter shadowing super global (%s) causes fatal error since PHP 5.4';
|
72 |
$errorCode = $this->stringToErrorCode(substr($param['name'], 1)) . 'Found';
|
73 |
$data = array($param['name']);
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/ForbiddenFunctionParametersWithSameNameSniff.php → FunctionDeclarations/ForbiddenParametersWithSameNameSniff.php}
RENAMED
@@ -1,57 +1,59 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Wim Godden <wim@cu.be>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
15 |
use PHPCompatibility\PHPCSHelper;
|
|
|
16 |
|
17 |
/**
|
18 |
-
*
|
19 |
-
*
|
20 |
-
* Functions can not have multiple parameters with the same name since PHP 7.0
|
21 |
*
|
22 |
* PHP version 7.0
|
23 |
*
|
24 |
-
* @
|
25 |
-
*
|
26 |
-
* @
|
27 |
*/
|
28 |
-
class
|
29 |
{
|
30 |
|
31 |
/**
|
32 |
* Returns an array of tokens this test wants to listen for.
|
33 |
*
|
|
|
|
|
|
|
34 |
* @return array
|
35 |
*/
|
36 |
public function register()
|
37 |
{
|
38 |
return array(
|
39 |
-
T_FUNCTION,
|
40 |
-
T_CLOSURE,
|
41 |
);
|
42 |
-
|
43 |
-
}//end register()
|
44 |
|
45 |
/**
|
46 |
* Processes this test, when one of its tokens is encountered.
|
47 |
*
|
|
|
|
|
48 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
49 |
* @param int $stackPtr The position of the current token
|
50 |
* in the stack passed in $tokens.
|
51 |
*
|
52 |
* @return void
|
53 |
*/
|
54 |
-
public function process(
|
55 |
{
|
56 |
if ($this->supportsAbove('7.0') === false) {
|
57 |
return;
|
@@ -66,23 +68,21 @@ class ForbiddenFunctionParametersWithSameNameSniff extends Sniff
|
|
66 |
|
67 |
// Get all parameters from method signature.
|
68 |
$parameters = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
|
69 |
-
if (empty($parameters) || is_array($parameters) === false) {
|
70 |
return;
|
71 |
}
|
72 |
|
73 |
$paramNames = array();
|
74 |
foreach ($parameters as $param) {
|
75 |
-
$paramNames[] =
|
76 |
}
|
77 |
|
78 |
-
if (count($paramNames) !== count(array_unique($paramNames))) {
|
79 |
$phpcsFile->addError(
|
80 |
'Functions can not have multiple parameters with the same name since PHP 7.0',
|
81 |
$stackPtr,
|
82 |
'Found'
|
83 |
);
|
84 |
}
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionDeclarations;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
use PHPCompatibility\PHPCSHelper;
|
15 |
+
use PHP_CodeSniffer_File as File;
|
16 |
|
17 |
/**
|
18 |
+
* Functions can not have multiple parameters with the same name since PHP 7.0.
|
|
|
|
|
19 |
*
|
20 |
* PHP version 7.0
|
21 |
*
|
22 |
+
* @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.func-parameters
|
23 |
+
*
|
24 |
+
* @since 7.0.0
|
25 |
*/
|
26 |
+
class ForbiddenParametersWithSameNameSniff extends Sniff
|
27 |
{
|
28 |
|
29 |
/**
|
30 |
* Returns an array of tokens this test wants to listen for.
|
31 |
*
|
32 |
+
* @since 7.0.0
|
33 |
+
* @since 7.1.3 Allows for closures.
|
34 |
+
*
|
35 |
* @return array
|
36 |
*/
|
37 |
public function register()
|
38 |
{
|
39 |
return array(
|
40 |
+
\T_FUNCTION,
|
41 |
+
\T_CLOSURE,
|
42 |
);
|
43 |
+
}
|
|
|
44 |
|
45 |
/**
|
46 |
* Processes this test, when one of its tokens is encountered.
|
47 |
*
|
48 |
+
* @since 7.0.0
|
49 |
+
*
|
50 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
51 |
* @param int $stackPtr The position of the current token
|
52 |
* in the stack passed in $tokens.
|
53 |
*
|
54 |
* @return void
|
55 |
*/
|
56 |
+
public function process(File $phpcsFile, $stackPtr)
|
57 |
{
|
58 |
if ($this->supportsAbove('7.0') === false) {
|
59 |
return;
|
68 |
|
69 |
// Get all parameters from method signature.
|
70 |
$parameters = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
|
71 |
+
if (empty($parameters) || \is_array($parameters) === false) {
|
72 |
return;
|
73 |
}
|
74 |
|
75 |
$paramNames = array();
|
76 |
foreach ($parameters as $param) {
|
77 |
+
$paramNames[] = $param['name'];
|
78 |
}
|
79 |
|
80 |
+
if (\count($paramNames) !== \count(array_unique($paramNames))) {
|
81 |
$phpcsFile->addError(
|
82 |
'Functions can not have multiple parameters with the same name since PHP 7.0',
|
83 |
$stackPtr,
|
84 |
'Found'
|
85 |
);
|
86 |
}
|
87 |
+
}
|
88 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenToStringParametersSniff.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
+
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionDeclarations;
|
12 |
+
|
13 |
+
use PHPCompatibility\Sniff;
|
14 |
+
use PHPCompatibility\PHPCSHelper;
|
15 |
+
use PHP_CodeSniffer_File as File;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* As of PHP 5.3, the __toString() magic method can no longer accept arguments.
|
19 |
+
*
|
20 |
+
* Sister-sniff to `PHPCompatibility.MethodUse.ForbiddenToStringParameters`.
|
21 |
+
*
|
22 |
+
* PHP version 5.3
|
23 |
+
*
|
24 |
+
* @link https://www.php.net/manual/en/migration53.incompatible.php
|
25 |
+
* @link https://www.php.net/manual/en/language.oop5.magic.php#object.tostring
|
26 |
+
*
|
27 |
+
* @since 9.2.0
|
28 |
+
*/
|
29 |
+
class ForbiddenToStringParametersSniff extends Sniff
|
30 |
+
{
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Valid scopes for the __toString() method to live in.
|
34 |
+
*
|
35 |
+
* @since 9.2.0
|
36 |
+
* @since 9.3.2 Visibility changed from `public` to `protected`.
|
37 |
+
*
|
38 |
+
* @var array
|
39 |
+
*/
|
40 |
+
protected $ooScopeTokens = array(
|
41 |
+
'T_CLASS' => true,
|
42 |
+
'T_INTERFACE' => true,
|
43 |
+
'T_TRAIT' => true,
|
44 |
+
'T_ANON_CLASS' => true,
|
45 |
+
);
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Returns an array of tokens this test wants to listen for.
|
49 |
+
*
|
50 |
+
* @since 9.2.0
|
51 |
+
*
|
52 |
+
* @return array
|
53 |
+
*/
|
54 |
+
public function register()
|
55 |
+
{
|
56 |
+
return array(\T_FUNCTION);
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Processes this test, when one of its tokens is encountered.
|
61 |
+
*
|
62 |
+
* @since 9.2.0
|
63 |
+
*
|
64 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
65 |
+
* @param int $stackPtr The position of the current token
|
66 |
+
* in the stack passed in $tokens.
|
67 |
+
*
|
68 |
+
* @return void
|
69 |
+
*/
|
70 |
+
public function process(File $phpcsFile, $stackPtr)
|
71 |
+
{
|
72 |
+
if ($this->supportsAbove('5.3') === false) {
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
|
76 |
+
$functionName = $phpcsFile->getDeclarationName($stackPtr);
|
77 |
+
if (strtolower($functionName) !== '__tostring') {
|
78 |
+
// Not the right function.
|
79 |
+
return;
|
80 |
+
}
|
81 |
+
|
82 |
+
if ($this->validDirectScope($phpcsFile, $stackPtr, $this->ooScopeTokens) === false) {
|
83 |
+
// Function, not method.
|
84 |
+
return;
|
85 |
+
}
|
86 |
+
|
87 |
+
$params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
|
88 |
+
if (empty($params)) {
|
89 |
+
// Function declared without parameters.
|
90 |
+
return;
|
91 |
+
}
|
92 |
+
|
93 |
+
$phpcsFile->addError(
|
94 |
+
'The __toString() magic method can no longer accept arguments since PHP 5.3',
|
95 |
+
$stackPtr,
|
96 |
+
'Declared'
|
97 |
+
);
|
98 |
+
}
|
99 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/ForbiddenClosureUseVariableNamesSniff.php → FunctionDeclarations/ForbiddenVariableNamesInClosureUseSniff.php}
RENAMED
@@ -1,55 +1,60 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
15 |
use PHPCompatibility\PHPCSHelper;
|
|
|
|
|
16 |
|
17 |
/**
|
18 |
-
*
|
19 |
*
|
20 |
-
* Variables bound to a closure via the use construct cannot use the same name
|
21 |
-
* as any superglobals,
|
22 |
*
|
23 |
* PHP version 7.1
|
24 |
*
|
25 |
-
* @
|
26 |
-
* @
|
27 |
-
*
|
|
|
28 |
*/
|
29 |
-
class
|
30 |
{
|
31 |
|
32 |
/**
|
33 |
* Returns an array of tokens this test wants to listen for.
|
34 |
*
|
|
|
|
|
35 |
* @return array
|
36 |
*/
|
37 |
public function register()
|
38 |
{
|
39 |
-
return array(T_USE);
|
40 |
-
|
41 |
-
}//end register()
|
42 |
|
43 |
/**
|
44 |
* Processes this test, when one of its tokens is encountered.
|
45 |
*
|
|
|
|
|
46 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
47 |
* @param int $stackPtr The position of the current token
|
48 |
* in the stack passed in $tokens.
|
49 |
*
|
50 |
* @return void
|
51 |
*/
|
52 |
-
public function process(
|
53 |
{
|
54 |
if ($this->supportsAbove('7.1') === false) {
|
55 |
return;
|
@@ -58,16 +63,16 @@ class ForbiddenClosureUseVariableNamesSniff extends Sniff
|
|
58 |
$tokens = $phpcsFile->getTokens();
|
59 |
|
60 |
// Verify this use statement is used with a closure - if so, it has to have parenthesis before it.
|
61 |
-
$previousNonEmpty = $phpcsFile->findPrevious(
|
62 |
-
if ($previousNonEmpty === false || $tokens[$previousNonEmpty]['code'] !== T_CLOSE_PARENTHESIS
|
63 |
|| isset($tokens[$previousNonEmpty]['parenthesis_opener']) === false
|
64 |
) {
|
65 |
return;
|
66 |
}
|
67 |
|
68 |
// ... and (a variable within) parenthesis after it.
|
69 |
-
$nextNonEmpty = $phpcsFile->findNext(
|
70 |
-
if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== T_OPEN_PARENTHESIS) {
|
71 |
return;
|
72 |
}
|
73 |
|
@@ -76,8 +81,8 @@ class ForbiddenClosureUseVariableNamesSniff extends Sniff
|
|
76 |
return;
|
77 |
}
|
78 |
|
79 |
-
$closurePtr = $phpcsFile->findPrevious(
|
80 |
-
if ($closurePtr === false || $tokens[$closurePtr]['code'] !== T_CLOSURE) {
|
81 |
return;
|
82 |
}
|
83 |
|
@@ -87,7 +92,7 @@ class ForbiddenClosureUseVariableNamesSniff extends Sniff
|
|
87 |
$errorMsg = 'Variables bound to a closure via the use construct cannot use the same name as superglobals, $this, or a declared parameter since PHP 7.1. Found: %s';
|
88 |
|
89 |
for ($i = ($nextNonEmpty + 1); $i < $tokens[$nextNonEmpty]['parenthesis_closer']; $i++) {
|
90 |
-
if ($tokens[$i]['code'] !== T_VARIABLE) {
|
91 |
continue;
|
92 |
}
|
93 |
|
@@ -98,7 +103,7 @@ class ForbiddenClosureUseVariableNamesSniff extends Sniff
|
|
98 |
continue;
|
99 |
}
|
100 |
|
101 |
-
if (
|
102 |
$phpcsFile->addError($errorMsg, $i, 'FoundSuperglobal', array($variableName));
|
103 |
continue;
|
104 |
}
|
@@ -113,7 +118,5 @@ class ForbiddenClosureUseVariableNamesSniff extends Sniff
|
|
113 |
}
|
114 |
}
|
115 |
}
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionDeclarations;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
use PHPCompatibility\PHPCSHelper;
|
15 |
+
use PHP_CodeSniffer_File as File;
|
16 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
17 |
|
18 |
/**
|
19 |
+
* Detect variable names forbidden to be used in closure `use` statements.
|
20 |
*
|
21 |
+
* Variables bound to a closure via the `use` construct cannot use the same name
|
22 |
+
* as any superglobals, `$this`, or any parameter since PHP 7.1.
|
23 |
*
|
24 |
* PHP version 7.1
|
25 |
*
|
26 |
+
* @link https://www.php.net/manual/en/migration71.incompatible.php#migration71.incompatible.lexical-names
|
27 |
+
* @link https://www.php.net/manual/en/functions.anonymous.php
|
28 |
+
*
|
29 |
+
* @since 7.1.4
|
30 |
*/
|
31 |
+
class ForbiddenVariableNamesInClosureUseSniff extends Sniff
|
32 |
{
|
33 |
|
34 |
/**
|
35 |
* Returns an array of tokens this test wants to listen for.
|
36 |
*
|
37 |
+
* @since 7.1.4
|
38 |
+
*
|
39 |
* @return array
|
40 |
*/
|
41 |
public function register()
|
42 |
{
|
43 |
+
return array(\T_USE);
|
44 |
+
}
|
|
|
45 |
|
46 |
/**
|
47 |
* Processes this test, when one of its tokens is encountered.
|
48 |
*
|
49 |
+
* @since 7.1.4
|
50 |
+
*
|
51 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
52 |
* @param int $stackPtr The position of the current token
|
53 |
* in the stack passed in $tokens.
|
54 |
*
|
55 |
* @return void
|
56 |
*/
|
57 |
+
public function process(File $phpcsFile, $stackPtr)
|
58 |
{
|
59 |
if ($this->supportsAbove('7.1') === false) {
|
60 |
return;
|
63 |
$tokens = $phpcsFile->getTokens();
|
64 |
|
65 |
// Verify this use statement is used with a closure - if so, it has to have parenthesis before it.
|
66 |
+
$previousNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
|
67 |
+
if ($previousNonEmpty === false || $tokens[$previousNonEmpty]['code'] !== \T_CLOSE_PARENTHESIS
|
68 |
|| isset($tokens[$previousNonEmpty]['parenthesis_opener']) === false
|
69 |
) {
|
70 |
return;
|
71 |
}
|
72 |
|
73 |
// ... and (a variable within) parenthesis after it.
|
74 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
|
75 |
+
if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS) {
|
76 |
return;
|
77 |
}
|
78 |
|
81 |
return;
|
82 |
}
|
83 |
|
84 |
+
$closurePtr = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($tokens[$previousNonEmpty]['parenthesis_opener'] - 1), null, true);
|
85 |
+
if ($closurePtr === false || $tokens[$closurePtr]['code'] !== \T_CLOSURE) {
|
86 |
return;
|
87 |
}
|
88 |
|
92 |
$errorMsg = 'Variables bound to a closure via the use construct cannot use the same name as superglobals, $this, or a declared parameter since PHP 7.1. Found: %s';
|
93 |
|
94 |
for ($i = ($nextNonEmpty + 1); $i < $tokens[$nextNonEmpty]['parenthesis_closer']; $i++) {
|
95 |
+
if ($tokens[$i]['code'] !== \T_VARIABLE) {
|
96 |
continue;
|
97 |
}
|
98 |
|
103 |
continue;
|
104 |
}
|
105 |
|
106 |
+
if (isset($this->superglobals[$variableName]) === true) {
|
107 |
$phpcsFile->addError($errorMsg, $i, 'FoundSuperglobal', array($variableName));
|
108 |
continue;
|
109 |
}
|
118 |
}
|
119 |
}
|
120 |
}
|
121 |
+
}
|
122 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionDeclarations}/NewClosureSniff.php
RENAMED
@@ -1,52 +1,74 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Wim Godden <wim@cu.be>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
|
|
|
|
15 |
|
16 |
/**
|
17 |
-
*
|
18 |
*
|
19 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
*
|
21 |
* PHP version 5.3
|
|
|
|
|
|
|
|
|
|
|
22 |
*
|
23 |
-
* @
|
24 |
-
* @package PHPCompatibility
|
25 |
-
* @author Wim Godden <wim@cu.be>
|
26 |
*/
|
27 |
class NewClosureSniff extends Sniff
|
28 |
{
|
29 |
/**
|
30 |
* Returns an array of tokens this test wants to listen for.
|
31 |
*
|
|
|
|
|
32 |
* @return array
|
33 |
*/
|
34 |
public function register()
|
35 |
{
|
36 |
-
return array(T_CLOSURE);
|
37 |
-
|
38 |
-
}//end register()
|
39 |
|
40 |
/**
|
41 |
* Processes this test, when one of its tokens is encountered.
|
42 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
44 |
* @param int $stackPtr The position of the current token
|
45 |
* in the stack passed in $tokens.
|
46 |
*
|
47 |
-
* @return void
|
|
|
48 |
*/
|
49 |
-
public function process(
|
50 |
{
|
51 |
if ($this->supportsBelow('5.2')) {
|
52 |
$phpcsFile->addError(
|
@@ -154,31 +176,34 @@ class NewClosureSniff extends Sniff
|
|
154 |
|
155 |
// Prevent double reporting for nested closures.
|
156 |
return $scopeEnd;
|
157 |
-
|
158 |
-
}//end process()
|
159 |
|
160 |
|
161 |
/**
|
162 |
* Check whether the closure is declared as static.
|
163 |
*
|
|
|
|
|
164 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
165 |
* @param int $stackPtr The position of the current token
|
166 |
* in the stack passed in $tokens.
|
167 |
*
|
168 |
* @return bool
|
169 |
*/
|
170 |
-
protected function isClosureStatic(
|
171 |
{
|
172 |
$tokens = $phpcsFile->getTokens();
|
173 |
-
$prevToken = $phpcsFile->findPrevious(
|
174 |
|
175 |
-
return ($prevToken !== false && $tokens[$prevToken]['code'] === T_STATIC);
|
176 |
}
|
177 |
|
178 |
|
179 |
/**
|
180 |
* Check if the code within a closure uses the $this variable.
|
181 |
*
|
|
|
|
|
182 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
183 |
* @param int $startToken The position within the closure to continue searching from.
|
184 |
* @param int $endToken The closure scope closer to stop searching at.
|
@@ -186,7 +211,7 @@ class NewClosureSniff extends Sniff
|
|
186 |
* @return int|false The stackPtr to the first $this usage if found or false if
|
187 |
* $this is not used.
|
188 |
*/
|
189 |
-
protected function findThisUsageInClosure(
|
190 |
{
|
191 |
// Make sure the $startToken is valid.
|
192 |
if ($startToken >= $endToken) {
|
@@ -194,7 +219,7 @@ class NewClosureSniff extends Sniff
|
|
194 |
}
|
195 |
|
196 |
return $phpcsFile->findNext(
|
197 |
-
T_VARIABLE,
|
198 |
$startToken,
|
199 |
$endToken,
|
200 |
false,
|
@@ -205,6 +230,8 @@ class NewClosureSniff extends Sniff
|
|
205 |
/**
|
206 |
* Check if the code within a closure uses "self/parent/static".
|
207 |
*
|
|
|
|
|
208 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
209 |
* @param int $startToken The position within the closure to continue searching from.
|
210 |
* @param int $endToken The closure scope closer to stop searching at.
|
@@ -212,7 +239,7 @@ class NewClosureSniff extends Sniff
|
|
212 |
* @return int|false The stackPtr to the first classRef usage if found or false if
|
213 |
* they are not used.
|
214 |
*/
|
215 |
-
protected function findClassRefUsageInClosure(
|
216 |
{
|
217 |
// Make sure the $startToken is valid.
|
218 |
if ($startToken >= $endToken) {
|
@@ -220,19 +247,18 @@ class NewClosureSniff extends Sniff
|
|
220 |
}
|
221 |
|
222 |
$tokens = $phpcsFile->getTokens();
|
223 |
-
$classRef = $phpcsFile->findNext(array(T_SELF, T_PARENT, T_STATIC), $startToken, $endToken);
|
224 |
|
225 |
-
if ($classRef === false || $tokens[$classRef]['code'] !== T_STATIC) {
|
226 |
return $classRef;
|
227 |
}
|
228 |
|
229 |
// T_STATIC, make sure it is used as a class reference.
|
230 |
-
$next = $phpcsFile->findNext(
|
231 |
-
if ($next === false || $tokens[$next]['code'] !== T_DOUBLE_COLON) {
|
232 |
return false;
|
233 |
}
|
234 |
|
235 |
return $classRef;
|
236 |
}
|
237 |
-
|
238 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionDeclarations;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
|
17 |
/**
|
18 |
+
* Detect closures and verify that the features used are supported.
|
19 |
*
|
20 |
+
* Version based checks:
|
21 |
+
* - Closures are available since PHP 5.3.
|
22 |
+
* - Closures can be declared as `static` since PHP 5.4.
|
23 |
+
* - Closures can use the `$this` variable within a class context since PHP 5.4.
|
24 |
+
* - Closures can use `self`/`parent`/`static` since PHP 5.4.
|
25 |
+
*
|
26 |
+
* Version independent checks:
|
27 |
+
* - Static closures don't have access to the `$this` variable.
|
28 |
+
* - Closures declared outside of a class context don't have access to the `$this`
|
29 |
+
* variable unless bound to an object.
|
30 |
*
|
31 |
* PHP version 5.3
|
32 |
+
* PHP version 5.4
|
33 |
+
*
|
34 |
+
* @link https://www.php.net/manual/en/functions.anonymous.php
|
35 |
+
* @link https://wiki.php.net/rfc/closures
|
36 |
+
* @link https://wiki.php.net/rfc/closures/object-extension
|
37 |
*
|
38 |
+
* @since 7.0.0
|
|
|
|
|
39 |
*/
|
40 |
class NewClosureSniff extends Sniff
|
41 |
{
|
42 |
/**
|
43 |
* Returns an array of tokens this test wants to listen for.
|
44 |
*
|
45 |
+
* @since 7.0.0
|
46 |
+
*
|
47 |
* @return array
|
48 |
*/
|
49 |
public function register()
|
50 |
{
|
51 |
+
return array(\T_CLOSURE);
|
52 |
+
}
|
|
|
53 |
|
54 |
/**
|
55 |
* Processes this test, when one of its tokens is encountered.
|
56 |
*
|
57 |
+
* @since 7.0.0
|
58 |
+
* @since 7.1.4 - Added check for closure being declared as static < 5.4.
|
59 |
+
* - Added check for use of `$this` variable in class context < 5.4.
|
60 |
+
* - Added check for use of `$this` variable in static closures (unsupported).
|
61 |
+
* - Added check for use of `$this` variable outside class context (unsupported).
|
62 |
+
* @since 8.2.0 Added check for use of `self`/`static`/`parent` < 5.4.
|
63 |
+
*
|
64 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
65 |
* @param int $stackPtr The position of the current token
|
66 |
* in the stack passed in $tokens.
|
67 |
*
|
68 |
+
* @return int|void Integer stack pointer to skip forward or void to continue
|
69 |
+
* normal file processing.
|
70 |
*/
|
71 |
+
public function process(File $phpcsFile, $stackPtr)
|
72 |
{
|
73 |
if ($this->supportsBelow('5.2')) {
|
74 |
$phpcsFile->addError(
|
176 |
|
177 |
// Prevent double reporting for nested closures.
|
178 |
return $scopeEnd;
|
179 |
+
}
|
|
|
180 |
|
181 |
|
182 |
/**
|
183 |
* Check whether the closure is declared as static.
|
184 |
*
|
185 |
+
* @since 7.1.4
|
186 |
+
*
|
187 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
188 |
* @param int $stackPtr The position of the current token
|
189 |
* in the stack passed in $tokens.
|
190 |
*
|
191 |
* @return bool
|
192 |
*/
|
193 |
+
protected function isClosureStatic(File $phpcsFile, $stackPtr)
|
194 |
{
|
195 |
$tokens = $phpcsFile->getTokens();
|
196 |
+
$prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
|
197 |
|
198 |
+
return ($prevToken !== false && $tokens[$prevToken]['code'] === \T_STATIC);
|
199 |
}
|
200 |
|
201 |
|
202 |
/**
|
203 |
* Check if the code within a closure uses the $this variable.
|
204 |
*
|
205 |
+
* @since 7.1.4
|
206 |
+
*
|
207 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
208 |
* @param int $startToken The position within the closure to continue searching from.
|
209 |
* @param int $endToken The closure scope closer to stop searching at.
|
211 |
* @return int|false The stackPtr to the first $this usage if found or false if
|
212 |
* $this is not used.
|
213 |
*/
|
214 |
+
protected function findThisUsageInClosure(File $phpcsFile, $startToken, $endToken)
|
215 |
{
|
216 |
// Make sure the $startToken is valid.
|
217 |
if ($startToken >= $endToken) {
|
219 |
}
|
220 |
|
221 |
return $phpcsFile->findNext(
|
222 |
+
\T_VARIABLE,
|
223 |
$startToken,
|
224 |
$endToken,
|
225 |
false,
|
230 |
/**
|
231 |
* Check if the code within a closure uses "self/parent/static".
|
232 |
*
|
233 |
+
* @since 8.2.0
|
234 |
+
*
|
235 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
236 |
* @param int $startToken The position within the closure to continue searching from.
|
237 |
* @param int $endToken The closure scope closer to stop searching at.
|
239 |
* @return int|false The stackPtr to the first classRef usage if found or false if
|
240 |
* they are not used.
|
241 |
*/
|
242 |
+
protected function findClassRefUsageInClosure(File $phpcsFile, $startToken, $endToken)
|
243 |
{
|
244 |
// Make sure the $startToken is valid.
|
245 |
if ($startToken >= $endToken) {
|
247 |
}
|
248 |
|
249 |
$tokens = $phpcsFile->getTokens();
|
250 |
+
$classRef = $phpcsFile->findNext(array(\T_SELF, \T_PARENT, \T_STATIC), $startToken, $endToken);
|
251 |
|
252 |
+
if ($classRef === false || $tokens[$classRef]['code'] !== \T_STATIC) {
|
253 |
return $classRef;
|
254 |
}
|
255 |
|
256 |
// T_STATIC, make sure it is used as a class reference.
|
257 |
+
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($classRef + 1), $endToken, true);
|
258 |
+
if ($next === false || $tokens[$next]['code'] !== \T_DOUBLE_COLON) {
|
259 |
return false;
|
260 |
}
|
261 |
|
262 |
return $classRef;
|
263 |
}
|
264 |
+
}
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewExceptionsFromToStringSniff.php
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
+
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionDeclarations;
|
12 |
+
|
13 |
+
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* As of PHP 7.4, throwing exceptions from a `__toString()` method is allowed.
|
19 |
+
*
|
20 |
+
* PHP version 7.4
|
21 |
+
*
|
22 |
+
* @link https://wiki.php.net/rfc/tostring_exceptions
|
23 |
+
* @link https://www.php.net/manual/en/language.oop5.magic.php#object.tostring
|
24 |
+
*
|
25 |
+
* @since 9.2.0
|
26 |
+
*/
|
27 |
+
class NewExceptionsFromToStringSniff extends Sniff
|
28 |
+
{
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Valid scopes for the __toString() method to live in.
|
32 |
+
*
|
33 |
+
* @since 9.2.0
|
34 |
+
* @since 9.3.0 Visibility changed from `public` to `protected`.
|
35 |
+
*
|
36 |
+
* @var array
|
37 |
+
*/
|
38 |
+
protected $ooScopeTokens = array(
|
39 |
+
'T_CLASS' => true,
|
40 |
+
'T_TRAIT' => true,
|
41 |
+
'T_ANON_CLASS' => true,
|
42 |
+
);
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Tokens which should be ignored when they preface a function declaration
|
46 |
+
* when trying to find the docblock (if any).
|
47 |
+
*
|
48 |
+
* Array will be added to in the register() method.
|
49 |
+
*
|
50 |
+
* @since 9.3.0
|
51 |
+
*
|
52 |
+
* @var array
|
53 |
+
*/
|
54 |
+
private $docblockIgnoreTokens = array(
|
55 |
+
\T_WHITESPACE => \T_WHITESPACE,
|
56 |
+
);
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Returns an array of tokens this test wants to listen for.
|
60 |
+
*
|
61 |
+
* @since 9.2.0
|
62 |
+
*
|
63 |
+
* @return array
|
64 |
+
*/
|
65 |
+
public function register()
|
66 |
+
{
|
67 |
+
// Enhance the array of tokens to ignore for finding the docblock.
|
68 |
+
$this->docblockIgnoreTokens += Tokens::$methodPrefixes;
|
69 |
+
if (isset(Tokens::$phpcsCommentTokens)) {
|
70 |
+
$this->docblockIgnoreTokens += Tokens::$phpcsCommentTokens;
|
71 |
+
}
|
72 |
+
|
73 |
+
return array(\T_FUNCTION);
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Processes this test, when one of its tokens is encountered.
|
78 |
+
*
|
79 |
+
* @since 9.2.0
|
80 |
+
*
|
81 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
82 |
+
* @param int $stackPtr The position of the current token
|
83 |
+
* in the stack passed in $tokens.
|
84 |
+
*
|
85 |
+
* @return void
|
86 |
+
*/
|
87 |
+
public function process(File $phpcsFile, $stackPtr)
|
88 |
+
{
|
89 |
+
if ($this->supportsBelow('7.3') === false) {
|
90 |
+
return;
|
91 |
+
}
|
92 |
+
|
93 |
+
$tokens = $phpcsFile->getTokens();
|
94 |
+
if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) {
|
95 |
+
// Abstract function, interface function, live coding or parse error.
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
|
99 |
+
$functionName = $phpcsFile->getDeclarationName($stackPtr);
|
100 |
+
if (strtolower($functionName) !== '__tostring') {
|
101 |
+
// Not the right function.
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
|
105 |
+
if ($this->validDirectScope($phpcsFile, $stackPtr, $this->ooScopeTokens) === false) {
|
106 |
+
// Function, not method.
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
|
110 |
+
/*
|
111 |
+
* Examine the content of the function.
|
112 |
+
*/
|
113 |
+
$error = 'Throwing exceptions from __toString() was not allowed prior to PHP 7.4';
|
114 |
+
$throwPtr = $tokens[$stackPtr]['scope_opener'];
|
115 |
+
$errorThrown = false;
|
116 |
+
|
117 |
+
do {
|
118 |
+
$throwPtr = $phpcsFile->findNext(\T_THROW, ($throwPtr + 1), $tokens[$stackPtr]['scope_closer']);
|
119 |
+
if ($throwPtr === false) {
|
120 |
+
break;
|
121 |
+
}
|
122 |
+
|
123 |
+
$conditions = $tokens[$throwPtr]['conditions'];
|
124 |
+
$conditions = array_reverse($conditions, true);
|
125 |
+
$inTryCatch = false;
|
126 |
+
foreach ($conditions as $ptr => $type) {
|
127 |
+
if ($type === \T_TRY) {
|
128 |
+
$inTryCatch = true;
|
129 |
+
break;
|
130 |
+
}
|
131 |
+
|
132 |
+
if ($ptr === $stackPtr) {
|
133 |
+
// Don't check the conditions outside the function scope.
|
134 |
+
break;
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
if ($inTryCatch === false) {
|
139 |
+
$phpcsFile->addError($error, $throwPtr, 'Found');
|
140 |
+
$errorThrown = true;
|
141 |
+
}
|
142 |
+
} while (true);
|
143 |
+
|
144 |
+
if ($errorThrown === true) {
|
145 |
+
// We've already thrown an error for this method, no need to examine the docblock.
|
146 |
+
return;
|
147 |
+
}
|
148 |
+
|
149 |
+
/*
|
150 |
+
* Check whether the function has a docblock and if so, whether it contains a @throws tag.
|
151 |
+
*
|
152 |
+
* {@internal This can be partially replaced by the findCommentAboveFunction()
|
153 |
+
* utility function in due time.}
|
154 |
+
*/
|
155 |
+
$commentEnd = $phpcsFile->findPrevious($this->docblockIgnoreTokens, ($stackPtr - 1), null, true);
|
156 |
+
if ($commentEnd === false || $tokens[$commentEnd]['code'] !== \T_DOC_COMMENT_CLOSE_TAG) {
|
157 |
+
return;
|
158 |
+
}
|
159 |
+
|
160 |
+
$commentStart = $tokens[$commentEnd]['comment_opener'];
|
161 |
+
foreach ($tokens[$commentStart]['comment_tags'] as $tag) {
|
162 |
+
if ($tokens[$tag]['content'] !== '@throws') {
|
163 |
+
continue;
|
164 |
+
}
|
165 |
+
|
166 |
+
// Found a throws tag.
|
167 |
+
$phpcsFile->addError($error, $stackPtr, 'ThrowsTagFoundInDocblock');
|
168 |
+
break;
|
169 |
+
}
|
170 |
+
}
|
171 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionDeclarations}/NewNullableTypesSniff.php
RENAMED
@@ -1,29 +1,30 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
15 |
use PHPCompatibility\PHPCSHelper;
|
|
|
|
|
16 |
|
17 |
/**
|
18 |
-
*
|
19 |
-
*
|
20 |
-
* Nullable type hints and return types are available since PHP 7.1.
|
21 |
*
|
22 |
* PHP version 7.1
|
23 |
*
|
24 |
-
* @
|
25 |
-
* @
|
26 |
-
* @
|
|
|
|
|
27 |
*/
|
28 |
class NewNullableTypesSniff extends Sniff
|
29 |
{
|
@@ -32,36 +33,39 @@ class NewNullableTypesSniff extends Sniff
|
|
32 |
*
|
33 |
* {@internal Not sniffing for T_NULLABLE which was introduced in PHPCS 2.7.2
|
34 |
* as in that case we can't distinguish between parameter type hints and
|
35 |
-
* return type hints for the error message.}
|
|
|
|
|
36 |
*
|
37 |
* @return array
|
38 |
*/
|
39 |
public function register()
|
40 |
{
|
41 |
$tokens = array(
|
42 |
-
T_FUNCTION,
|
43 |
-
T_CLOSURE,
|
44 |
);
|
45 |
|
46 |
-
if (defined('T_RETURN_TYPE')) {
|
47 |
-
$tokens[] = T_RETURN_TYPE;
|
48 |
}
|
49 |
|
50 |
return $tokens;
|
51 |
-
|
52 |
-
}//end register()
|
53 |
|
54 |
|
55 |
/**
|
56 |
* Processes this test, when one of its tokens is encountered.
|
57 |
*
|
|
|
|
|
58 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
59 |
* @param int $stackPtr The position of the current token
|
60 |
* in the stack passed in $tokens.
|
61 |
*
|
62 |
* @return void
|
63 |
*/
|
64 |
-
public function process(
|
65 |
{
|
66 |
if ($this->supportsBelow('7.0') === false) {
|
67 |
return;
|
@@ -70,7 +74,7 @@ class NewNullableTypesSniff extends Sniff
|
|
70 |
$tokens = $phpcsFile->getTokens();
|
71 |
$tokenCode = $tokens[$stackPtr]['code'];
|
72 |
|
73 |
-
if ($tokenCode === T_FUNCTION || $tokenCode === T_CLOSURE) {
|
74 |
$this->processFunctionDeclaration($phpcsFile, $stackPtr);
|
75 |
|
76 |
// Deal with older PHPCS version which don't recognize return type hints
|
@@ -82,24 +86,25 @@ class NewNullableTypesSniff extends Sniff
|
|
82 |
} else {
|
83 |
$this->processReturnType($phpcsFile, $stackPtr);
|
84 |
}
|
85 |
-
|
86 |
-
}//end process()
|
87 |
|
88 |
|
89 |
/**
|
90 |
* Process this test for function tokens.
|
91 |
*
|
|
|
|
|
92 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
93 |
* @param int $stackPtr The position of the current token
|
94 |
* in the stack passed in $tokens.
|
95 |
*
|
96 |
* @return void
|
97 |
*/
|
98 |
-
protected function processFunctionDeclaration(
|
99 |
{
|
100 |
$params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
|
101 |
|
102 |
-
if (empty($params) === false && is_array($params)) {
|
103 |
foreach ($params as $param) {
|
104 |
if ($param['nullable_type'] === true) {
|
105 |
$phpcsFile->addError(
|
@@ -117,13 +122,15 @@ class NewNullableTypesSniff extends Sniff
|
|
117 |
/**
|
118 |
* Process this test for return type tokens.
|
119 |
*
|
|
|
|
|
120 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
121 |
* @param int $stackPtr The position of the current token
|
122 |
* in the stack passed in $tokens.
|
123 |
*
|
124 |
* @return void
|
125 |
*/
|
126 |
-
protected function processReturnType(
|
127 |
{
|
128 |
$tokens = $phpcsFile->getTokens();
|
129 |
|
@@ -131,26 +138,26 @@ class NewNullableTypesSniff extends Sniff
|
|
131 |
return;
|
132 |
}
|
133 |
|
134 |
-
$previous = $phpcsFile->findPrevious(
|
135 |
|
136 |
// Deal with namespaced class names.
|
137 |
-
if ($tokens[$previous]['code'] === T_NS_SEPARATOR) {
|
138 |
-
$validTokens
|
139 |
-
$validTokens[]
|
140 |
-
$validTokens[] =
|
141 |
|
142 |
$stackPtr--;
|
143 |
|
144 |
-
while (
|
145 |
$stackPtr--;
|
146 |
}
|
147 |
|
148 |
-
$previous = $phpcsFile->findPrevious(
|
149 |
}
|
150 |
|
151 |
// T_NULLABLE token was introduced in PHPCS 2.7.2. Before that it identified as T_INLINE_THEN.
|
152 |
-
if ((defined('T_NULLABLE') === true && $tokens[$previous]['type'] === 'T_NULLABLE')
|
153 |
-
|| (defined('T_NULLABLE') === false && $tokens[$previous]['code'] === T_INLINE_THEN)
|
154 |
) {
|
155 |
$phpcsFile->addError(
|
156 |
'Nullable return types are not supported in PHP 7.0 or earlier.',
|
@@ -159,5 +166,4 @@ class NewNullableTypesSniff extends Sniff
|
|
159 |
);
|
160 |
}
|
161 |
}
|
162 |
-
|
163 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionDeclarations;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
use PHPCompatibility\PHPCSHelper;
|
15 |
+
use PHP_CodeSniffer_File as File;
|
16 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
17 |
|
18 |
/**
|
19 |
+
* Nullable parameter type declarations and return types are available since PHP 7.1.
|
|
|
|
|
20 |
*
|
21 |
* PHP version 7.1
|
22 |
*
|
23 |
+
* @link https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.nullable-types
|
24 |
+
* @link https://wiki.php.net/rfc/nullable_types
|
25 |
+
* @link https://www.php.net/manual/en/functions.arguments.php#example-146
|
26 |
+
*
|
27 |
+
* @since 7.0.7
|
28 |
*/
|
29 |
class NewNullableTypesSniff extends Sniff
|
30 |
{
|
33 |
*
|
34 |
* {@internal Not sniffing for T_NULLABLE which was introduced in PHPCS 2.7.2
|
35 |
* as in that case we can't distinguish between parameter type hints and
|
36 |
+
* return type hints for the error message.}
|
37 |
+
*
|
38 |
+
* @since 7.0.7
|
39 |
*
|
40 |
* @return array
|
41 |
*/
|
42 |
public function register()
|
43 |
{
|
44 |
$tokens = array(
|
45 |
+
\T_FUNCTION,
|
46 |
+
\T_CLOSURE,
|
47 |
);
|
48 |
|
49 |
+
if (\defined('T_RETURN_TYPE')) {
|
50 |
+
$tokens[] = \T_RETURN_TYPE;
|
51 |
}
|
52 |
|
53 |
return $tokens;
|
54 |
+
}
|
|
|
55 |
|
56 |
|
57 |
/**
|
58 |
* Processes this test, when one of its tokens is encountered.
|
59 |
*
|
60 |
+
* @since 7.0.7
|
61 |
+
*
|
62 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
63 |
* @param int $stackPtr The position of the current token
|
64 |
* in the stack passed in $tokens.
|
65 |
*
|
66 |
* @return void
|
67 |
*/
|
68 |
+
public function process(File $phpcsFile, $stackPtr)
|
69 |
{
|
70 |
if ($this->supportsBelow('7.0') === false) {
|
71 |
return;
|
74 |
$tokens = $phpcsFile->getTokens();
|
75 |
$tokenCode = $tokens[$stackPtr]['code'];
|
76 |
|
77 |
+
if ($tokenCode === \T_FUNCTION || $tokenCode === \T_CLOSURE) {
|
78 |
$this->processFunctionDeclaration($phpcsFile, $stackPtr);
|
79 |
|
80 |
// Deal with older PHPCS version which don't recognize return type hints
|
86 |
} else {
|
87 |
$this->processReturnType($phpcsFile, $stackPtr);
|
88 |
}
|
89 |
+
}
|
|
|
90 |
|
91 |
|
92 |
/**
|
93 |
* Process this test for function tokens.
|
94 |
*
|
95 |
+
* @since 7.0.7
|
96 |
+
*
|
97 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
98 |
* @param int $stackPtr The position of the current token
|
99 |
* in the stack passed in $tokens.
|
100 |
*
|
101 |
* @return void
|
102 |
*/
|
103 |
+
protected function processFunctionDeclaration(File $phpcsFile, $stackPtr)
|
104 |
{
|
105 |
$params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
|
106 |
|
107 |
+
if (empty($params) === false && \is_array($params)) {
|
108 |
foreach ($params as $param) {
|
109 |
if ($param['nullable_type'] === true) {
|
110 |
$phpcsFile->addError(
|
122 |
/**
|
123 |
* Process this test for return type tokens.
|
124 |
*
|
125 |
+
* @since 7.0.7
|
126 |
+
*
|
127 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
128 |
* @param int $stackPtr The position of the current token
|
129 |
* in the stack passed in $tokens.
|
130 |
*
|
131 |
* @return void
|
132 |
*/
|
133 |
+
protected function processReturnType(File $phpcsFile, $stackPtr)
|
134 |
{
|
135 |
$tokens = $phpcsFile->getTokens();
|
136 |
|
138 |
return;
|
139 |
}
|
140 |
|
141 |
+
$previous = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
142 |
|
143 |
// Deal with namespaced class names.
|
144 |
+
if ($tokens[$previous]['code'] === \T_NS_SEPARATOR) {
|
145 |
+
$validTokens = Tokens::$emptyTokens;
|
146 |
+
$validTokens[\T_STRING] = true;
|
147 |
+
$validTokens[\T_NS_SEPARATOR] = true;
|
148 |
|
149 |
$stackPtr--;
|
150 |
|
151 |
+
while (isset($validTokens[$tokens[($stackPtr - 1)]['code']]) === true) {
|
152 |
$stackPtr--;
|
153 |
}
|
154 |
|
155 |
+
$previous = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
156 |
}
|
157 |
|
158 |
// T_NULLABLE token was introduced in PHPCS 2.7.2. Before that it identified as T_INLINE_THEN.
|
159 |
+
if ((\defined('T_NULLABLE') === true && $tokens[$previous]['type'] === 'T_NULLABLE')
|
160 |
+
|| (\defined('T_NULLABLE') === false && $tokens[$previous]['code'] === \T_INLINE_THEN)
|
161 |
) {
|
162 |
$phpcsFile->addError(
|
163 |
'Nullable return types are not supported in PHP 7.0 or earlier.',
|
166 |
);
|
167 |
}
|
168 |
}
|
169 |
+
}
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/NewScalarTypeDeclarationsSniff.php → FunctionDeclarations/NewParamTypeDeclarationsSniff.php}
RENAMED
@@ -1,25 +1,49 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
-
namespace PHPCompatibility\Sniffs\
|
11 |
|
12 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
13 |
use PHPCompatibility\PHPCSHelper;
|
|
|
14 |
|
15 |
/**
|
16 |
-
*
|
17 |
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
*/
|
22 |
-
class
|
23 |
{
|
24 |
|
25 |
/**
|
@@ -28,7 +52,10 @@ class NewScalarTypeDeclarationsSniff extends AbstractNewFeatureSniff
|
|
28 |
* The array lists : version number with false (not present) or true (present).
|
29 |
* If's sufficient to list the first version where the keyword appears.
|
30 |
*
|
31 |
-
* @
|
|
|
|
|
|
|
32 |
*/
|
33 |
protected $newTypes = array(
|
34 |
'array' => array(
|
@@ -79,6 +106,8 @@ class NewScalarTypeDeclarationsSniff extends AbstractNewFeatureSniff
|
|
79 |
*
|
80 |
* The array lists : the invalid type hint => what was probably intended/alternative.
|
81 |
*
|
|
|
|
|
82 |
* @var array(string => string)
|
83 |
*/
|
84 |
protected $invalidTypes = array(
|
@@ -91,27 +120,37 @@ class NewScalarTypeDeclarationsSniff extends AbstractNewFeatureSniff
|
|
91 |
/**
|
92 |
* Returns an array of tokens this test wants to listen for.
|
93 |
*
|
|
|
|
|
|
|
94 |
* @return array
|
95 |
*/
|
96 |
public function register()
|
97 |
{
|
98 |
return array(
|
99 |
-
T_FUNCTION,
|
100 |
-
T_CLOSURE,
|
101 |
);
|
102 |
-
}
|
103 |
|
104 |
|
105 |
/**
|
106 |
* Processes this test, when one of its tokens is encountered.
|
107 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
109 |
* @param int $stackPtr The position of the current token in
|
110 |
* the stack passed in $tokens.
|
111 |
*
|
112 |
* @return void
|
113 |
*/
|
114 |
-
public function process(
|
115 |
{
|
116 |
// Get all parameters from method signature.
|
117 |
$paramNames = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
|
@@ -166,12 +205,14 @@ class NewScalarTypeDeclarationsSniff extends AbstractNewFeatureSniff
|
|
166 |
$phpcsFile->addError($error, $param['token'], 'InvalidTypeHintFound', $data);
|
167 |
}
|
168 |
}
|
169 |
-
}
|
170 |
|
171 |
|
172 |
/**
|
173 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
174 |
*
|
|
|
|
|
175 |
* @param array $itemInfo Base information about the item.
|
176 |
*
|
177 |
* @return array Version and other information about the item.
|
@@ -185,12 +226,12 @@ class NewScalarTypeDeclarationsSniff extends AbstractNewFeatureSniff
|
|
185 |
/**
|
186 |
* Get the error message template for this sniff.
|
187 |
*
|
|
|
|
|
188 |
* @return string
|
189 |
*/
|
190 |
protected function getErrorMsgTemplate()
|
191 |
{
|
192 |
return "'%s' type declaration is not present in PHP version %s or earlier";
|
193 |
}
|
194 |
-
|
195 |
-
|
196 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionDeclarations;
|
12 |
|
13 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
14 |
use PHPCompatibility\PHPCSHelper;
|
15 |
+
use PHP_CodeSniffer_File as File;
|
16 |
|
17 |
/**
|
18 |
+
* Detect and verify the use of parameter type declarations in function declarations.
|
19 |
*
|
20 |
+
* Parameter type declarations - class/interface names only - is available since PHP 5.0.
|
21 |
+
* - Since PHP 5.1, the `array` keyword can be used.
|
22 |
+
* - Since PHP 5.2, `self` and `parent` can be used. Previously, those were interpreted as
|
23 |
+
* class names.
|
24 |
+
* - Since PHP 5.4, the `callable` keyword.
|
25 |
+
* - Since PHP 7.0, scalar type declarations are available.
|
26 |
+
* - Since PHP 7.1, the `iterable` pseudo-type is available.
|
27 |
+
* - Since PHP 7.2, the generic `object` type is available.
|
28 |
+
*
|
29 |
+
* Additionally, this sniff does a cursory check for typical invalid type declarations,
|
30 |
+
* such as:
|
31 |
+
* - `boolean` (should be `bool`), `integer` (should be `int`) and `static`.
|
32 |
+
* - `self`/`parent` as type declaration used outside class context throws a fatal error since PHP 7.0.
|
33 |
+
*
|
34 |
+
* PHP version 5.0+
|
35 |
+
*
|
36 |
+
* @link https://www.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration
|
37 |
+
* @link https://wiki.php.net/rfc/callable
|
38 |
+
* @link https://wiki.php.net/rfc/scalar_type_hints_v5
|
39 |
+
* @link https://wiki.php.net/rfc/iterable
|
40 |
+
* @link https://wiki.php.net/rfc/object-typehint
|
41 |
+
*
|
42 |
+
* @since 7.0.0
|
43 |
+
* @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.
|
44 |
+
* @since 9.0.0 Renamed from `NewScalarTypeDeclarationsSniff` to `NewParamTypeDeclarationsSniff`.
|
45 |
*/
|
46 |
+
class NewParamTypeDeclarationsSniff extends AbstractNewFeatureSniff
|
47 |
{
|
48 |
|
49 |
/**
|
52 |
* The array lists : version number with false (not present) or true (present).
|
53 |
* If's sufficient to list the first version where the keyword appears.
|
54 |
*
|
55 |
+
* @since 7.0.0
|
56 |
+
* @since 7.0.3 Now lists all param type declarations, not just the PHP 7+ scalar ones.
|
57 |
+
*
|
58 |
+
* @var array(string => array(string => bool))
|
59 |
*/
|
60 |
protected $newTypes = array(
|
61 |
'array' => array(
|
106 |
*
|
107 |
* The array lists : the invalid type hint => what was probably intended/alternative.
|
108 |
*
|
109 |
+
* @since 7.0.3
|
110 |
+
*
|
111 |
* @var array(string => string)
|
112 |
*/
|
113 |
protected $invalidTypes = array(
|
120 |
/**
|
121 |
* Returns an array of tokens this test wants to listen for.
|
122 |
*
|
123 |
+
* @since 7.0.0
|
124 |
+
* @since 7.1.3 Now also checks closures.
|
125 |
+
*
|
126 |
* @return array
|
127 |
*/
|
128 |
public function register()
|
129 |
{
|
130 |
return array(
|
131 |
+
\T_FUNCTION,
|
132 |
+
\T_CLOSURE,
|
133 |
);
|
134 |
+
}
|
135 |
|
136 |
|
137 |
/**
|
138 |
* Processes this test, when one of its tokens is encountered.
|
139 |
*
|
140 |
+
* @since 7.0.0
|
141 |
+
* @since 7.0.3 - Added check for non-scalar type declarations.
|
142 |
+
* - Added check for invalid type declarations.
|
143 |
+
* - Added check for usage of `self` type declaration outside
|
144 |
+
* class scope.
|
145 |
+
* @since 8.2.0 Added check for `parent` type declaration outside class scope.
|
146 |
+
*
|
147 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
148 |
* @param int $stackPtr The position of the current token in
|
149 |
* the stack passed in $tokens.
|
150 |
*
|
151 |
* @return void
|
152 |
*/
|
153 |
+
public function process(File $phpcsFile, $stackPtr)
|
154 |
{
|
155 |
// Get all parameters from method signature.
|
156 |
$paramNames = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
|
205 |
$phpcsFile->addError($error, $param['token'], 'InvalidTypeHintFound', $data);
|
206 |
}
|
207 |
}
|
208 |
+
}
|
209 |
|
210 |
|
211 |
/**
|
212 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
213 |
*
|
214 |
+
* @since 7.1.0
|
215 |
+
*
|
216 |
* @param array $itemInfo Base information about the item.
|
217 |
*
|
218 |
* @return array Version and other information about the item.
|
226 |
/**
|
227 |
* Get the error message template for this sniff.
|
228 |
*
|
229 |
+
* @since 7.1.0
|
230 |
+
*
|
231 |
* @return string
|
232 |
*/
|
233 |
protected function getErrorMsgTemplate()
|
234 |
{
|
235 |
return "'%s' type declaration is not present in PHP version %s or earlier";
|
236 |
}
|
237 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionDeclarations}/NewReturnTypeDeclarationsSniff.php
RENAMED
@@ -1,26 +1,37 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Wim Godden <wim.godden@cu.be>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
|
|
15 |
|
16 |
/**
|
17 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
*
|
19 |
-
*
|
|
|
|
|
|
|
|
|
|
|
20 |
*
|
21 |
-
* @
|
22 |
-
* @
|
23 |
-
* @
|
24 |
*/
|
25 |
class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
|
26 |
{
|
@@ -31,7 +42,9 @@ class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
|
|
31 |
* The array lists : version number with false (not present) or true (present).
|
32 |
* If's sufficient to list the first version where the keyword appears.
|
33 |
*
|
34 |
-
* @
|
|
|
|
|
35 |
*/
|
36 |
protected $newTypes = array(
|
37 |
'int' => array(
|
@@ -90,39 +103,44 @@ class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
|
|
90 |
/**
|
91 |
* Returns an array of tokens this test wants to listen for.
|
92 |
*
|
|
|
|
|
|
|
93 |
* @return array
|
94 |
*/
|
95 |
public function register()
|
96 |
{
|
97 |
$tokens = array(
|
98 |
-
T_FUNCTION,
|
99 |
-
T_CLOSURE,
|
100 |
);
|
101 |
|
102 |
-
if (defined('T_RETURN_TYPE')) {
|
103 |
-
$tokens[] = T_RETURN_TYPE;
|
104 |
}
|
105 |
|
106 |
return $tokens;
|
107 |
-
}
|
108 |
|
109 |
|
110 |
/**
|
111 |
* Processes this test, when one of its tokens is encountered.
|
112 |
*
|
|
|
|
|
113 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
114 |
* @param int $stackPtr The position of the current token in
|
115 |
* the stack passed in $tokens.
|
116 |
*
|
117 |
* @return void
|
118 |
*/
|
119 |
-
public function process(
|
120 |
{
|
121 |
$tokens = $phpcsFile->getTokens();
|
122 |
|
123 |
// Deal with older PHPCS version which don't recognize return type hints
|
124 |
// as well as newer PHPCS versions (3.3.0+) where the tokenization has changed.
|
125 |
-
if ($tokens[$stackPtr]['code'] === T_FUNCTION || $tokens[$stackPtr]['code'] === T_CLOSURE) {
|
126 |
$returnTypeHint = $this->getReturnTypeHintToken($phpcsFile, $stackPtr);
|
127 |
if ($returnTypeHint !== false) {
|
128 |
$stackPtr = $returnTypeHint;
|
@@ -136,20 +154,22 @@ class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
|
|
136 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
137 |
}
|
138 |
// Handle class name based return types.
|
139 |
-
elseif ($tokens[$stackPtr]['code'] === T_STRING
|
140 |
-
|| (defined('T_RETURN_TYPE') && $tokens[$stackPtr]['code'] === T_RETURN_TYPE)
|
141 |
) {
|
142 |
$itemInfo = array(
|
143 |
'name' => 'Class name',
|
144 |
);
|
145 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
146 |
}
|
147 |
-
}
|
148 |
|
149 |
|
150 |
/**
|
151 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
152 |
*
|
|
|
|
|
153 |
* @param array $itemInfo Base information about the item.
|
154 |
*
|
155 |
* @return array Version and other information about the item.
|
@@ -163,12 +183,12 @@ class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
|
|
163 |
/**
|
164 |
* Get the error message template for this sniff.
|
165 |
*
|
|
|
|
|
166 |
* @return string
|
167 |
*/
|
168 |
protected function getErrorMsgTemplate()
|
169 |
{
|
170 |
return '%s return type is not present in PHP version %s or earlier';
|
171 |
}
|
172 |
-
|
173 |
-
|
174 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionDeclarations;
|
12 |
|
13 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
17 |
+
* Detect and verify the use of return type declarations in function declarations.
|
18 |
+
*
|
19 |
+
* Return type declarations are available since PHP 7.0.
|
20 |
+
* - Since PHP 7.1, the `iterable` and `void` pseudo-types are available.
|
21 |
+
* - Since PHP 7.2, the generic `object` type is available.
|
22 |
+
*
|
23 |
+
* PHP version 7.0+
|
24 |
*
|
25 |
+
* @link https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.return-type-declarations
|
26 |
+
* @link https://www.php.net/manual/en/functions.returning-values.php#functions.returning-values.type-declaration
|
27 |
+
* @link https://wiki.php.net/rfc/return_types
|
28 |
+
* @link https://wiki.php.net/rfc/iterable
|
29 |
+
* @link https://wiki.php.net/rfc/void_return_type
|
30 |
+
* @link https://wiki.php.net/rfc/object-typehint
|
31 |
*
|
32 |
+
* @since 7.0.0
|
33 |
+
* @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.
|
34 |
+
* @since 7.1.2 Renamed from `NewScalarReturnTypeDeclarationsSniff` to `NewReturnTypeDeclarationsSniff`.
|
35 |
*/
|
36 |
class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
|
37 |
{
|
42 |
* The array lists : version number with false (not present) or true (present).
|
43 |
* If's sufficient to list the first version where the keyword appears.
|
44 |
*
|
45 |
+
* @since 7.0.0
|
46 |
+
*
|
47 |
+
* @var array(string => array(string => bool))
|
48 |
*/
|
49 |
protected $newTypes = array(
|
50 |
'int' => array(
|
103 |
/**
|
104 |
* Returns an array of tokens this test wants to listen for.
|
105 |
*
|
106 |
+
* @since 7.0.0
|
107 |
+
* @since 7.1.2 Now also checks based on the function and closure keywords.
|
108 |
+
*
|
109 |
* @return array
|
110 |
*/
|
111 |
public function register()
|
112 |
{
|
113 |
$tokens = array(
|
114 |
+
\T_FUNCTION,
|
115 |
+
\T_CLOSURE,
|
116 |
);
|
117 |
|
118 |
+
if (\defined('T_RETURN_TYPE')) {
|
119 |
+
$tokens[] = \T_RETURN_TYPE;
|
120 |
}
|
121 |
|
122 |
return $tokens;
|
123 |
+
}
|
124 |
|
125 |
|
126 |
/**
|
127 |
* Processes this test, when one of its tokens is encountered.
|
128 |
*
|
129 |
+
* @since 7.0.0
|
130 |
+
*
|
131 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
132 |
* @param int $stackPtr The position of the current token in
|
133 |
* the stack passed in $tokens.
|
134 |
*
|
135 |
* @return void
|
136 |
*/
|
137 |
+
public function process(File $phpcsFile, $stackPtr)
|
138 |
{
|
139 |
$tokens = $phpcsFile->getTokens();
|
140 |
|
141 |
// Deal with older PHPCS version which don't recognize return type hints
|
142 |
// as well as newer PHPCS versions (3.3.0+) where the tokenization has changed.
|
143 |
+
if ($tokens[$stackPtr]['code'] === \T_FUNCTION || $tokens[$stackPtr]['code'] === \T_CLOSURE) {
|
144 |
$returnTypeHint = $this->getReturnTypeHintToken($phpcsFile, $stackPtr);
|
145 |
if ($returnTypeHint !== false) {
|
146 |
$stackPtr = $returnTypeHint;
|
154 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
155 |
}
|
156 |
// Handle class name based return types.
|
157 |
+
elseif ($tokens[$stackPtr]['code'] === \T_STRING
|
158 |
+
|| (\defined('T_RETURN_TYPE') && $tokens[$stackPtr]['code'] === \T_RETURN_TYPE)
|
159 |
) {
|
160 |
$itemInfo = array(
|
161 |
'name' => 'Class name',
|
162 |
);
|
163 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
164 |
}
|
165 |
+
}
|
166 |
|
167 |
|
168 |
/**
|
169 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
170 |
*
|
171 |
+
* @since 7.1.0
|
172 |
+
*
|
173 |
* @param array $itemInfo Base information about the item.
|
174 |
*
|
175 |
* @return array Version and other information about the item.
|
183 |
/**
|
184 |
* Get the error message template for this sniff.
|
185 |
*
|
186 |
+
* @since 7.1.0
|
187 |
+
*
|
188 |
* @return string
|
189 |
*/
|
190 |
protected function getErrorMsgTemplate()
|
191 |
{
|
192 |
return '%s return type is not present in PHP version %s or earlier';
|
193 |
}
|
194 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionDeclarations}/NonStaticMagicMethodsSniff.php
RENAMED
@@ -1,28 +1,30 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* PHP version 5.4
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
* @package PHPCompatibility
|
9 |
-
* @
|
10 |
-
* @
|
|
|
11 |
*/
|
12 |
|
13 |
-
namespace PHPCompatibility\Sniffs\
|
14 |
|
15 |
use PHPCompatibility\Sniff;
|
|
|
16 |
|
17 |
/**
|
18 |
-
* \PHPCompatibility\Sniffs\PHP\NonStaticMagicMethodsSniff.
|
19 |
-
*
|
20 |
* Verifies the use of the correct visibility and static properties of magic methods.
|
21 |
*
|
22 |
-
*
|
23 |
-
*
|
24 |
-
*
|
25 |
-
*
|
|
|
|
|
|
|
|
|
|
|
26 |
*/
|
27 |
class NonStaticMagicMethodsSniff extends Sniff
|
28 |
{
|
@@ -36,9 +38,23 @@ class NonStaticMagicMethodsSniff extends Sniff
|
|
36 |
* When a method does not have a specific requirement for either visibility or static,
|
37 |
* do *not* add the key.
|
38 |
*
|
|
|
|
|
|
|
|
|
39 |
* @var array(string)
|
40 |
*/
|
41 |
protected $magicMethods = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
'__get' => array(
|
43 |
'visibility' => 'public',
|
44 |
'static' => false,
|
@@ -70,48 +86,65 @@ class NonStaticMagicMethodsSniff extends Sniff
|
|
70 |
'visibility' => 'public',
|
71 |
),
|
72 |
'__set_state' => array(
|
|
|
73 |
'static' => true,
|
74 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
);
|
76 |
|
77 |
|
78 |
/**
|
79 |
* Returns an array of tokens this test wants to listen for.
|
80 |
*
|
|
|
|
|
|
|
|
|
81 |
* @return array
|
82 |
*/
|
83 |
public function register()
|
84 |
{
|
85 |
$targets = array(
|
86 |
-
T_CLASS,
|
87 |
-
T_INTERFACE,
|
|
|
88 |
);
|
89 |
|
90 |
-
if (defined('
|
91 |
-
|
92 |
-
$targets[] = T_TRAIT;
|
93 |
-
}
|
94 |
-
|
95 |
-
if (defined('T_ANON_CLASS')) {
|
96 |
-
// phpcs:ignore PHPCompatibility.PHP.NewConstants.t_anon_classFound
|
97 |
-
$targets[] = T_ANON_CLASS;
|
98 |
}
|
99 |
|
100 |
return $targets;
|
101 |
-
|
102 |
-
}//end register()
|
103 |
|
104 |
|
105 |
/**
|
106 |
* Processes this test, when one of its tokens is encountered.
|
107 |
*
|
|
|
|
|
108 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
109 |
* @param int $stackPtr The position of the current token in the
|
110 |
* stack passed in $tokens.
|
111 |
*
|
112 |
* @return void
|
113 |
*/
|
114 |
-
public function process(
|
115 |
{
|
116 |
// Should be removed, the requirement was previously also there, 5.3 just started throwing a warning about it.
|
117 |
if ($this->supportsAbove('5.3') === false) {
|
@@ -128,7 +161,7 @@ class NonStaticMagicMethodsSniff extends Sniff
|
|
128 |
$functionPtr = $stackPtr;
|
129 |
|
130 |
// Find all the functions in this class or interface.
|
131 |
-
while (($functionToken = $phpcsFile->findNext(T_FUNCTION, $functionPtr, $classScopeCloser)) !== false) {
|
132 |
/*
|
133 |
* Get the scope closer for this function in order to know how
|
134 |
* to advance to the next function.
|
@@ -179,8 +212,5 @@ class NonStaticMagicMethodsSniff extends Sniff
|
|
179 |
// Advance to next function.
|
180 |
$functionPtr = $scopeCloser;
|
181 |
}
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
|
|
|
|
|
|
5 |
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionDeclarations;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
|
|
|
|
17 |
* Verifies the use of the correct visibility and static properties of magic methods.
|
18 |
*
|
19 |
+
* The requirements have always existed, but as of PHP 5.3, a warning will be thrown
|
20 |
+
* when magic methods have the wrong modifiers.
|
21 |
+
*
|
22 |
+
* PHP version 5.3
|
23 |
+
*
|
24 |
+
* @link https://www.php.net/manual/en/language.oop5.magic.php
|
25 |
+
*
|
26 |
+
* @since 5.5
|
27 |
+
* @since 5.6 Now extends the base `Sniff` class.
|
28 |
*/
|
29 |
class NonStaticMagicMethodsSniff extends Sniff
|
30 |
{
|
38 |
* When a method does not have a specific requirement for either visibility or static,
|
39 |
* do *not* add the key.
|
40 |
*
|
41 |
+
* @since 5.5
|
42 |
+
* @since 5.6 The array format has changed to allow the sniff to also verify the
|
43 |
+
* use of the correct visibility for a magic method.
|
44 |
+
*
|
45 |
* @var array(string)
|
46 |
*/
|
47 |
protected $magicMethods = array(
|
48 |
+
'__construct' => array(
|
49 |
+
'static' => false,
|
50 |
+
),
|
51 |
+
'__destruct' => array(
|
52 |
+
'visibility' => 'public',
|
53 |
+
'static' => false,
|
54 |
+
),
|
55 |
+
'__clone' => array(
|
56 |
+
'static' => false,
|
57 |
+
),
|
58 |
'__get' => array(
|
59 |
'visibility' => 'public',
|
60 |
'static' => false,
|
86 |
'visibility' => 'public',
|
87 |
),
|
88 |
'__set_state' => array(
|
89 |
+
'visibility' => 'public',
|
90 |
'static' => true,
|
91 |
),
|
92 |
+
'__debuginfo' => array(
|
93 |
+
'visibility' => 'public',
|
94 |
+
'static' => false,
|
95 |
+
),
|
96 |
+
'__invoke' => array(
|
97 |
+
'visibility' => 'public',
|
98 |
+
'static' => false,
|
99 |
+
),
|
100 |
+
'__serialize' => array(
|
101 |
+
'visibility' => 'public',
|
102 |
+
'static' => false,
|
103 |
+
),
|
104 |
+
'__unserialize' => array(
|
105 |
+
'visibility' => 'public',
|
106 |
+
'static' => false,
|
107 |
+
),
|
108 |
);
|
109 |
|
110 |
|
111 |
/**
|
112 |
* Returns an array of tokens this test wants to listen for.
|
113 |
*
|
114 |
+
* @since 5.5
|
115 |
+
* @since 5.6 Now also checks traits.
|
116 |
+
* @since 7.1.4 Now also checks anonymous classes.
|
117 |
+
*
|
118 |
* @return array
|
119 |
*/
|
120 |
public function register()
|
121 |
{
|
122 |
$targets = array(
|
123 |
+
\T_CLASS,
|
124 |
+
\T_INTERFACE,
|
125 |
+
\T_TRAIT,
|
126 |
);
|
127 |
|
128 |
+
if (\defined('T_ANON_CLASS')) {
|
129 |
+
$targets[] = \T_ANON_CLASS;
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
}
|
131 |
|
132 |
return $targets;
|
133 |
+
}
|
|
|
134 |
|
135 |
|
136 |
/**
|
137 |
* Processes this test, when one of its tokens is encountered.
|
138 |
*
|
139 |
+
* @since 5.5
|
140 |
+
*
|
141 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
142 |
* @param int $stackPtr The position of the current token in the
|
143 |
* stack passed in $tokens.
|
144 |
*
|
145 |
* @return void
|
146 |
*/
|
147 |
+
public function process(File $phpcsFile, $stackPtr)
|
148 |
{
|
149 |
// Should be removed, the requirement was previously also there, 5.3 just started throwing a warning about it.
|
150 |
if ($this->supportsAbove('5.3') === false) {
|
161 |
$functionPtr = $stackPtr;
|
162 |
|
163 |
// Find all the functions in this class or interface.
|
164 |
+
while (($functionToken = $phpcsFile->findNext(\T_FUNCTION, $functionPtr, $classScopeCloser)) !== false) {
|
165 |
/*
|
166 |
* Get the scope closer for this function in order to know how
|
167 |
* to advance to the next function.
|
212 |
// Advance to next function.
|
213 |
$functionPtr = $scopeCloser;
|
214 |
}
|
215 |
+
}
|
216 |
+
}
|
|
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionNameRestrictions}/NewMagicMethodsSniff.php
RENAMED
@@ -1,24 +1,29 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
-
namespace PHPCompatibility\Sniffs\
|
11 |
|
12 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
|
|
13 |
|
14 |
/**
|
15 |
-
* \PHPCompatibility\Sniffs\PHP\NewMagicMethodsSniff.
|
16 |
-
*
|
17 |
* Warns for non-magic behaviour of magic methods prior to becoming magic.
|
18 |
*
|
19 |
-
*
|
20 |
-
*
|
21 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
22 |
*/
|
23 |
class NewMagicMethodsSniff extends AbstractNewFeatureSniff
|
24 |
{
|
@@ -30,9 +35,19 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
|
|
30 |
* The array lists : version number with false (not magic) or true (magic).
|
31 |
* If's sufficient to list the first version where the method became magic.
|
32 |
*
|
33 |
-
* @
|
|
|
|
|
34 |
*/
|
35 |
protected $newMagicMethods = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
'__get' => array(
|
37 |
'4.4' => false,
|
38 |
'5.0' => true,
|
@@ -72,31 +87,43 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
|
|
72 |
'5.2' => true,
|
73 |
'message' => 'The method %s() was not truly magical in PHP version %s and earlier. The associated magic functionality will only be called when directly combined with echo or print.',
|
74 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
);
|
76 |
|
77 |
|
78 |
/**
|
79 |
* Returns an array of tokens this test wants to listen for.
|
80 |
*
|
|
|
|
|
81 |
* @return array
|
82 |
*/
|
83 |
public function register()
|
84 |
{
|
85 |
-
return array(T_FUNCTION);
|
86 |
-
|
87 |
-
}//end register()
|
88 |
|
89 |
|
90 |
/**
|
91 |
* Processes this test, when one of its tokens is encountered.
|
92 |
*
|
|
|
|
|
93 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
94 |
* @param int $stackPtr The position of the current token in the
|
95 |
* stack passed in $tokens.
|
96 |
*
|
97 |
* @return void
|
98 |
*/
|
99 |
-
public function process(
|
100 |
{
|
101 |
$functionName = $phpcsFile->getDeclarationName($stackPtr);
|
102 |
$functionNameLc = strtolower($functionName);
|
@@ -114,13 +141,14 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
|
|
114 |
'nameLc' => $functionNameLc,
|
115 |
);
|
116 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
117 |
-
|
118 |
-
}//end process()
|
119 |
|
120 |
|
121 |
/**
|
122 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
123 |
*
|
|
|
|
|
124 |
* @param array $itemInfo Base information about the item.
|
125 |
*
|
126 |
* @return array Version and other information about the item.
|
@@ -134,6 +162,8 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
|
|
134 |
/**
|
135 |
* Get an array of the non-PHP-version array keys used in a sub-array.
|
136 |
*
|
|
|
|
|
137 |
* @return array
|
138 |
*/
|
139 |
protected function getNonVersionArrayKeys()
|
@@ -145,6 +175,8 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
|
|
145 |
/**
|
146 |
* Retrieve the relevant detail (version) information for use in an error message.
|
147 |
*
|
|
|
|
|
148 |
* @param array $itemArray Version and other information about the item.
|
149 |
* @param array $itemInfo Base information about the item.
|
150 |
*
|
@@ -167,6 +199,8 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
|
|
167 |
/**
|
168 |
* Get the error message template for this sniff.
|
169 |
*
|
|
|
|
|
170 |
* @return string
|
171 |
*/
|
172 |
protected function getErrorMsgTemplate()
|
@@ -178,6 +212,8 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
|
|
178 |
/**
|
179 |
* Allow for concrete child classes to filter the error message before it's passed to PHPCS.
|
180 |
*
|
|
|
|
|
181 |
* @param string $error The error message which was created.
|
182 |
* @param array $itemInfo Base information about the item this error message applies to.
|
183 |
* @param array $errorInfo Detail information about an item this error message applies to.
|
@@ -192,6 +228,4 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
|
|
192 |
|
193 |
return $error;
|
194 |
}
|
195 |
-
|
196 |
-
|
197 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
|
12 |
|
13 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
|
|
|
|
17 |
* Warns for non-magic behaviour of magic methods prior to becoming magic.
|
18 |
*
|
19 |
+
* PHP version 5.0+
|
20 |
+
*
|
21 |
+
* @link https://www.php.net/manual/en/language.oop5.magic.php
|
22 |
+
* @link https://wiki.php.net/rfc/closures#additional_goodyinvoke
|
23 |
+
* @link https://wiki.php.net/rfc/debug-info
|
24 |
+
*
|
25 |
+
* @since 7.0.4
|
26 |
+
* @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.
|
27 |
*/
|
28 |
class NewMagicMethodsSniff extends AbstractNewFeatureSniff
|
29 |
{
|
35 |
* The array lists : version number with false (not magic) or true (magic).
|
36 |
* If's sufficient to list the first version where the method became magic.
|
37 |
*
|
38 |
+
* @since 7.0.4
|
39 |
+
*
|
40 |
+
* @var array(string => array(string => bool|string))
|
41 |
*/
|
42 |
protected $newMagicMethods = array(
|
43 |
+
'__construct' => array(
|
44 |
+
'4.4' => false,
|
45 |
+
'5.0' => true,
|
46 |
+
),
|
47 |
+
'__destruct' => array(
|
48 |
+
'4.4' => false,
|
49 |
+
'5.0' => true,
|
50 |
+
),
|
51 |
'__get' => array(
|
52 |
'4.4' => false,
|
53 |
'5.0' => true,
|
87 |
'5.2' => true,
|
88 |
'message' => 'The method %s() was not truly magical in PHP version %s and earlier. The associated magic functionality will only be called when directly combined with echo or print.',
|
89 |
),
|
90 |
+
|
91 |
+
'__serialize' => array(
|
92 |
+
'7.3' => false,
|
93 |
+
'7.4' => true,
|
94 |
+
),
|
95 |
+
'__unserialize' => array(
|
96 |
+
'7.3' => false,
|
97 |
+
'7.4' => true,
|
98 |
+
),
|
99 |
);
|
100 |
|
101 |
|
102 |
/**
|
103 |
* Returns an array of tokens this test wants to listen for.
|
104 |
*
|
105 |
+
* @since 7.0.4
|
106 |
+
*
|
107 |
* @return array
|
108 |
*/
|
109 |
public function register()
|
110 |
{
|
111 |
+
return array(\T_FUNCTION);
|
112 |
+
}
|
|
|
113 |
|
114 |
|
115 |
/**
|
116 |
* Processes this test, when one of its tokens is encountered.
|
117 |
*
|
118 |
+
* @since 7.0.4
|
119 |
+
*
|
120 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
121 |
* @param int $stackPtr The position of the current token in the
|
122 |
* stack passed in $tokens.
|
123 |
*
|
124 |
* @return void
|
125 |
*/
|
126 |
+
public function process(File $phpcsFile, $stackPtr)
|
127 |
{
|
128 |
$functionName = $phpcsFile->getDeclarationName($stackPtr);
|
129 |
$functionNameLc = strtolower($functionName);
|
141 |
'nameLc' => $functionNameLc,
|
142 |
);
|
143 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
144 |
+
}
|
|
|
145 |
|
146 |
|
147 |
/**
|
148 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
149 |
*
|
150 |
+
* @since 7.1.0
|
151 |
+
*
|
152 |
* @param array $itemInfo Base information about the item.
|
153 |
*
|
154 |
* @return array Version and other information about the item.
|
162 |
/**
|
163 |
* Get an array of the non-PHP-version array keys used in a sub-array.
|
164 |
*
|
165 |
+
* @since 7.1.0
|
166 |
+
*
|
167 |
* @return array
|
168 |
*/
|
169 |
protected function getNonVersionArrayKeys()
|
175 |
/**
|
176 |
* Retrieve the relevant detail (version) information for use in an error message.
|
177 |
*
|
178 |
+
* @since 7.1.0
|
179 |
+
*
|
180 |
* @param array $itemArray Version and other information about the item.
|
181 |
* @param array $itemInfo Base information about the item.
|
182 |
*
|
199 |
/**
|
200 |
* Get the error message template for this sniff.
|
201 |
*
|
202 |
+
* @since 7.1.0
|
203 |
+
*
|
204 |
* @return string
|
205 |
*/
|
206 |
protected function getErrorMsgTemplate()
|
212 |
/**
|
213 |
* Allow for concrete child classes to filter the error message before it's passed to PHPCS.
|
214 |
*
|
215 |
+
* @since 7.1.0
|
216 |
+
*
|
217 |
* @param string $error The error message which was created.
|
218 |
* @param array $itemInfo Base information about the item this error message applies to.
|
219 |
* @param array $errorInfo Detail information about an item this error message applies to.
|
228 |
|
229 |
return $error;
|
230 |
}
|
231 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/DeprecatedMagicAutoloadSniff.php → FunctionNameRestrictions/RemovedMagicAutoloadSniff.php}
RENAMED
@@ -1,29 +1,38 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Wim Godden <wim.godden@cu.be>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
|
|
15 |
|
16 |
/**
|
17 |
-
*
|
|
|
|
|
|
|
|
|
18 |
*
|
19 |
-
* @
|
20 |
-
* @
|
21 |
-
* @
|
|
|
|
|
|
|
22 |
*/
|
23 |
-
class
|
24 |
{
|
25 |
/**
|
26 |
-
* Scopes to look for when testing using validDirectScope
|
|
|
|
|
27 |
*
|
28 |
* @var array
|
29 |
*/
|
@@ -38,23 +47,27 @@ class DeprecatedMagicAutoloadSniff extends Sniff
|
|
38 |
/**
|
39 |
* Returns an array of tokens this test wants to listen for.
|
40 |
*
|
|
|
|
|
41 |
* @return array
|
42 |
*/
|
43 |
public function register()
|
44 |
{
|
45 |
-
return array(T_FUNCTION);
|
46 |
-
}
|
47 |
|
48 |
/**
|
49 |
* Processes this test, when one of its tokens is encountered.
|
50 |
*
|
|
|
|
|
51 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
52 |
* @param int $stackPtr The position of the current token in the
|
53 |
* stack passed in $tokens.
|
54 |
*
|
55 |
* @return void
|
56 |
*/
|
57 |
-
public function process(
|
58 |
{
|
59 |
if ($this->supportsAbove('7.2') === false) {
|
60 |
return;
|
@@ -66,7 +79,7 @@ class DeprecatedMagicAutoloadSniff extends Sniff
|
|
66 |
return;
|
67 |
}
|
68 |
|
69 |
-
if ($this->validDirectScope($phpcsFile, $stackPtr, $this->checkForScopes)
|
70 |
return;
|
71 |
}
|
72 |
|
@@ -75,6 +88,5 @@ class DeprecatedMagicAutoloadSniff extends Sniff
|
|
75 |
}
|
76 |
|
77 |
$phpcsFile->addWarning('Use of __autoload() function is deprecated since PHP 7.2', $stackPtr, 'Found');
|
78 |
-
}
|
79 |
-
|
80 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
17 |
+
* Detect declaration of the magic `__autoload()` method.
|
18 |
+
*
|
19 |
+
* This method has been deprecated in PHP 7.2 in favour of `spl_autoload_register()`.
|
20 |
+
*
|
21 |
+
* PHP version 7.2
|
22 |
*
|
23 |
+
* @link https://www.php.net/manual/en/migration72.deprecated.php#migration72.deprecated.__autoload-method
|
24 |
+
* @link https://wiki.php.net/rfc/deprecations_php_7_2#autoload
|
25 |
+
* @link https://www.php.net/manual/en/function.autoload.php
|
26 |
+
*
|
27 |
+
* @since 8.1.0
|
28 |
+
* @since 9.0.0 Renamed from `DeprecatedMagicAutoloadSniff` to `RemovedMagicAutoloadSniff`.
|
29 |
*/
|
30 |
+
class RemovedMagicAutoloadSniff extends Sniff
|
31 |
{
|
32 |
/**
|
33 |
+
* Scopes to look for when testing using validDirectScope.
|
34 |
+
*
|
35 |
+
* @since 8.1.0
|
36 |
*
|
37 |
* @var array
|
38 |
*/
|
47 |
/**
|
48 |
* Returns an array of tokens this test wants to listen for.
|
49 |
*
|
50 |
+
* @since 8.1.0
|
51 |
+
*
|
52 |
* @return array
|
53 |
*/
|
54 |
public function register()
|
55 |
{
|
56 |
+
return array(\T_FUNCTION);
|
57 |
+
}
|
58 |
|
59 |
/**
|
60 |
* Processes this test, when one of its tokens is encountered.
|
61 |
*
|
62 |
+
* @since 8.1.0
|
63 |
+
*
|
64 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
65 |
* @param int $stackPtr The position of the current token in the
|
66 |
* stack passed in $tokens.
|
67 |
*
|
68 |
* @return void
|
69 |
*/
|
70 |
+
public function process(File $phpcsFile, $stackPtr)
|
71 |
{
|
72 |
if ($this->supportsAbove('7.2') === false) {
|
73 |
return;
|
79 |
return;
|
80 |
}
|
81 |
|
82 |
+
if ($this->validDirectScope($phpcsFile, $stackPtr, $this->checkForScopes) !== false) {
|
83 |
return;
|
84 |
}
|
85 |
|
88 |
}
|
89 |
|
90 |
$phpcsFile->addWarning('Use of __autoload() function is deprecated since PHP 7.2', $stackPtr, 'Found');
|
91 |
+
}
|
92 |
+
}
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedNamespacedAssertSniff.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
+
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
|
12 |
+
|
13 |
+
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Detect declaration of a namespaced function called `assert()`.
|
18 |
+
*
|
19 |
+
* As of PHP 7.3, a compile-time deprecation warning will be thrown when a function
|
20 |
+
* called `assert()` is declared. In PHP 8 this will become a compile-error.
|
21 |
+
*
|
22 |
+
* Methods are unaffected.
|
23 |
+
* Global, non-namespaced, `assert()` function declarations were always a fatal
|
24 |
+
* "function already declared" error, so not the concern of this sniff.
|
25 |
+
*
|
26 |
+
* PHP version 7.3
|
27 |
+
*
|
28 |
+
* @link https://www.php.net/manual/en/migration73.deprecated.php#migration73.deprecated.core.assert
|
29 |
+
* @link https://wiki.php.net/rfc/deprecations_php_7_3#defining_a_free-standing_assert_function
|
30 |
+
* @link https://www.php.net/manual/en/function.assert.php
|
31 |
+
*
|
32 |
+
* @since 9.0.0
|
33 |
+
*/
|
34 |
+
class RemovedNamespacedAssertSniff extends Sniff
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Scopes in which an `assert` function can be declared without issue.
|
38 |
+
*
|
39 |
+
* @since 9.0.0
|
40 |
+
*
|
41 |
+
* @var array
|
42 |
+
*/
|
43 |
+
private $scopes = array(
|
44 |
+
\T_CLASS,
|
45 |
+
\T_INTERFACE,
|
46 |
+
\T_TRAIT,
|
47 |
+
\T_CLOSURE,
|
48 |
+
);
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Returns an array of tokens this test wants to listen for.
|
52 |
+
*
|
53 |
+
* @since 9.0.0
|
54 |
+
*
|
55 |
+
* @return array
|
56 |
+
*/
|
57 |
+
public function register()
|
58 |
+
{
|
59 |
+
// Enrich the scopes list.
|
60 |
+
if (\defined('T_ANON_CLASS')) {
|
61 |
+
$this->scopes[] = \T_ANON_CLASS;
|
62 |
+
}
|
63 |
+
|
64 |
+
return array(\T_FUNCTION);
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Processes this test, when one of its tokens is encountered.
|
69 |
+
*
|
70 |
+
* @since 9.0.0
|
71 |
+
*
|
72 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
73 |
+
* @param int $stackPtr The position of the current token in the
|
74 |
+
* stack passed in $tokens.
|
75 |
+
*
|
76 |
+
* @return void
|
77 |
+
*/
|
78 |
+
public function process(File $phpcsFile, $stackPtr)
|
79 |
+
{
|
80 |
+
if ($this->supportsAbove('7.3') === false) {
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
|
84 |
+
$funcName = $phpcsFile->getDeclarationName($stackPtr);
|
85 |
+
|
86 |
+
if (strtolower($funcName) !== 'assert') {
|
87 |
+
return;
|
88 |
+
}
|
89 |
+
|
90 |
+
if ($phpcsFile->hasCondition($stackPtr, $this->scopes) === true) {
|
91 |
+
return;
|
92 |
+
}
|
93 |
+
|
94 |
+
if ($this->determineNamespace($phpcsFile, $stackPtr) === '') {
|
95 |
+
// Not a namespaced function declaration. This may be a parse error, but not our concern.
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
|
99 |
+
$phpcsFile->addWarning('Declaring a free-standing function called assert() is deprecated since PHP 7.3.', $stackPtr, 'Found');
|
100 |
+
}
|
101 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedPHP4StyleConstructorsSniff.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
+
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
|
12 |
+
|
13 |
+
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Detect declarations of PHP 4 style constructors which are deprecated as of PHP 7.0.0.
|
19 |
+
*
|
20 |
+
* PHP 4 style constructors - methods that have the same name as the class they are defined in -
|
21 |
+
* are deprecated as of PHP 7.0.0, and will be removed in the future.
|
22 |
+
* PHP 7 will emit `E_DEPRECATED` if a PHP 4 constructor is the only constructor defined
|
23 |
+
* within a class. Classes that implement a `__construct()` method are unaffected.
|
24 |
+
*
|
25 |
+
* Note: Methods with the same name as the class they are defined in _within a namespace_
|
26 |
+
* are not recognized as constructors anyway and therefore outside the scope of this sniff.
|
27 |
+
*
|
28 |
+
* PHP version 7.0
|
29 |
+
*
|
30 |
+
* @link https://www.php.net/manual/en/migration70.deprecated.php#migration70.deprecated.php4-constructors
|
31 |
+
* @link https://wiki.php.net/rfc/remove_php4_constructors
|
32 |
+
* @link https://www.php.net/manual/en/language.oop5.decon.php
|
33 |
+
*
|
34 |
+
* @since 7.0.0
|
35 |
+
* @since 7.0.8 This sniff now throws a warning instead of an error as the functionality is
|
36 |
+
* only deprecated (for now).
|
37 |
+
* @since 9.0.0 Renamed from `DeprecatedPHP4StyleConstructorsSniff` to `RemovedPHP4StyleConstructorsSniff`.
|
38 |
+
*/
|
39 |
+
class RemovedPHP4StyleConstructorsSniff extends Sniff
|
40 |
+
{
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Returns an array of tokens this test wants to listen for.
|
44 |
+
*
|
45 |
+
* @since 7.0.0
|
46 |
+
*
|
47 |
+
* @return array
|
48 |
+
*/
|
49 |
+
public function register()
|
50 |
+
{
|
51 |
+
return array(
|
52 |
+
\T_CLASS,
|
53 |
+
);
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Processes this test, when one of its tokens is encountered.
|
58 |
+
*
|
59 |
+
* @since 7.0.0
|
60 |
+
* @since 7.0.8 The message is downgraded from error to warning as - for now - support
|
61 |
+
* for PHP4-style constructors is just deprecated, not yet removed.
|
62 |
+
*
|
63 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
64 |
+
* @param int $stackPtr The position of the current token in the
|
65 |
+
* stack passed in $tokens.
|
66 |
+
*
|
67 |
+
* @return void
|
68 |
+
*/
|
69 |
+
public function process(File $phpcsFile, $stackPtr)
|
70 |
+
{
|
71 |
+
if ($this->supportsAbove('7.0') === false) {
|
72 |
+
return;
|
73 |
+
}
|
74 |
+
|
75 |
+
if ($this->determineNamespace($phpcsFile, $stackPtr) !== '') {
|
76 |
+
/*
|
77 |
+
* Namespaced methods with the same name as the class are treated as
|
78 |
+
* regular methods, so we can bow out if we're in a namespace.
|
79 |
+
*
|
80 |
+
* Note: the exception to this is PHP 5.3.0-5.3.2. This is currently
|
81 |
+
* not dealt with.
|
82 |
+
*/
|
83 |
+
return;
|
84 |
+
}
|
85 |
+
|
86 |
+
$tokens = $phpcsFile->getTokens();
|
87 |
+
|
88 |
+
$class = $tokens[$stackPtr];
|
89 |
+
|
90 |
+
if (isset($class['scope_closer']) === false) {
|
91 |
+
return;
|
92 |
+
}
|
93 |
+
|
94 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
95 |
+
if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_STRING) {
|
96 |
+
// Anonymous class in combination with PHPCS 2.3.x.
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
|
100 |
+
$scopeCloser = $class['scope_closer'];
|
101 |
+
$className = $tokens[$nextNonEmpty]['content'];
|
102 |
+
|
103 |
+
if (empty($className) || \is_string($className) === false) {
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
|
107 |
+
$nextFunc = $stackPtr;
|
108 |
+
$classNameLc = strtolower($className);
|
109 |
+
$newConstructorFound = false;
|
110 |
+
$oldConstructorFound = false;
|
111 |
+
$oldConstructorPos = -1;
|
112 |
+
while (($nextFunc = $phpcsFile->findNext(array(\T_FUNCTION, \T_DOC_COMMENT_OPEN_TAG), ($nextFunc + 1), $scopeCloser)) !== false) {
|
113 |
+
// Skip over docblocks.
|
114 |
+
if ($tokens[$nextFunc]['code'] === \T_DOC_COMMENT_OPEN_TAG) {
|
115 |
+
$nextFunc = $tokens[$nextFunc]['comment_closer'];
|
116 |
+
continue;
|
117 |
+
}
|
118 |
+
|
119 |
+
$functionScopeCloser = $nextFunc;
|
120 |
+
if (isset($tokens[$nextFunc]['scope_closer'])) {
|
121 |
+
// Normal (non-interface, non-abstract) method.
|
122 |
+
$functionScopeCloser = $tokens[$nextFunc]['scope_closer'];
|
123 |
+
}
|
124 |
+
|
125 |
+
$funcName = $phpcsFile->getDeclarationName($nextFunc);
|
126 |
+
if (empty($funcName) || \is_string($funcName) === false) {
|
127 |
+
$nextFunc = $functionScopeCloser;
|
128 |
+
continue;
|
129 |
+
}
|
130 |
+
|
131 |
+
$funcNameLc = strtolower($funcName);
|
132 |
+
|
133 |
+
if ($funcNameLc === '__construct') {
|
134 |
+
$newConstructorFound = true;
|
135 |
+
}
|
136 |
+
|
137 |
+
if ($funcNameLc === $classNameLc) {
|
138 |
+
$oldConstructorFound = true;
|
139 |
+
$oldConstructorPos = $nextFunc;
|
140 |
+
}
|
141 |
+
|
142 |
+
// If both have been found, no need to continue looping through the functions.
|
143 |
+
if ($newConstructorFound === true && $oldConstructorFound === true) {
|
144 |
+
break;
|
145 |
+
}
|
146 |
+
|
147 |
+
$nextFunc = $functionScopeCloser;
|
148 |
+
}
|
149 |
+
|
150 |
+
if ($newConstructorFound === false && $oldConstructorFound === true) {
|
151 |
+
$phpcsFile->addWarning(
|
152 |
+
'Use of deprecated PHP4 style class constructor is not supported since PHP 7.',
|
153 |
+
$oldConstructorPos,
|
154 |
+
'Found'
|
155 |
+
);
|
156 |
+
}
|
157 |
+
}
|
158 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/ReservedFunctionNamesSniff.php
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
+
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
|
12 |
+
|
13 |
+
use Generic_Sniffs_NamingConventions_CamelCapsFunctionNameSniff as PHPCS_CamelCapsFunctionNameSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Standards_AbstractScopeSniff as PHPCS_AbstractScopeSniff;
|
16 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* All function and method names starting with double underscore are reserved by PHP.
|
20 |
+
*
|
21 |
+
* PHP version All
|
22 |
+
*
|
23 |
+
* {@internal Extends an upstream sniff to benefit from the properties contained therein.
|
24 |
+
* The properties are lists of valid PHP magic function and method names, which
|
25 |
+
* should be ignored for the purposes of this sniff.
|
26 |
+
* As this sniff is not PHP version specific, we don't need access to the utility
|
27 |
+
* methods in the PHPCompatibility\Sniff, so extending the upstream sniff is fine.
|
28 |
+
* As the upstream sniff checks the same (and more, but we don't need the rest),
|
29 |
+
* the logic in this sniff is largely the same as used upstream.
|
30 |
+
* Extending the upstream sniff instead of including it via the ruleset, however,
|
31 |
+
* prevents hard to debug issues of errors not being reported from the upstream sniff
|
32 |
+
* if this library is used in combination with other rulesets.}
|
33 |
+
*
|
34 |
+
* @link https://www.php.net/manual/en/language.oop5.magic.php
|
35 |
+
*
|
36 |
+
* @since 8.2.0 This was previously, since 7.0.3, checked by the upstream sniff.
|
37 |
+
* @since 9.3.2 The sniff will now ignore functions marked as `@deprecated` by design.
|
38 |
+
*/
|
39 |
+
class ReservedFunctionNamesSniff extends PHPCS_CamelCapsFunctionNameSniff
|
40 |
+
{
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Overload the constructor to work round various PHPCS cross-version compatibility issues.
|
44 |
+
*
|
45 |
+
* @since 8.2.0
|
46 |
+
*/
|
47 |
+
public function __construct()
|
48 |
+
{
|
49 |
+
$scopeTokens = array(\T_CLASS, \T_INTERFACE, \T_TRAIT);
|
50 |
+
if (\defined('T_ANON_CLASS')) {
|
51 |
+
$scopeTokens[] = \T_ANON_CLASS;
|
52 |
+
}
|
53 |
+
|
54 |
+
// Call the grand-parent constructor directly.
|
55 |
+
PHPCS_AbstractScopeSniff::__construct($scopeTokens, array(\T_FUNCTION), true);
|
56 |
+
|
57 |
+
// Make sure debuginfo is included in the array. Upstream only includes it since 2.5.1.
|
58 |
+
$this->magicMethods['debuginfo'] = true;
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Processes the tokens within the scope.
|
64 |
+
*
|
65 |
+
* @since 8.2.0
|
66 |
+
*
|
67 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being processed.
|
68 |
+
* @param int $stackPtr The position where this token was
|
69 |
+
* found.
|
70 |
+
* @param int $currScope The position of the current scope.
|
71 |
+
*
|
72 |
+
* @return void
|
73 |
+
*/
|
74 |
+
protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
|
75 |
+
{
|
76 |
+
$tokens = $phpcsFile->getTokens();
|
77 |
+
|
78 |
+
/*
|
79 |
+
* Determine if this is a function which needs to be examined.
|
80 |
+
* The `processTokenWithinScope()` is called for each valid scope a method is in,
|
81 |
+
* so for nested classes, we need to make sure we only examine the token for
|
82 |
+
* the lowest level valid scope.
|
83 |
+
*/
|
84 |
+
$conditions = $tokens[$stackPtr]['conditions'];
|
85 |
+
end($conditions);
|
86 |
+
$deepestScope = key($conditions);
|
87 |
+
if ($deepestScope !== $currScope) {
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
|
91 |
+
if ($this->isFunctionDeprecated($phpcsFile, $stackPtr) === true) {
|
92 |
+
/*
|
93 |
+
* Deprecated functions don't have to comply with the naming conventions,
|
94 |
+
* otherwise functions deprecated in favour of a function with a compliant
|
95 |
+
* name would still trigger an error.
|
96 |
+
*/
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
|
100 |
+
$methodName = $phpcsFile->getDeclarationName($stackPtr);
|
101 |
+
if ($methodName === null) {
|
102 |
+
// Ignore closures.
|
103 |
+
return;
|
104 |
+
}
|
105 |
+
|
106 |
+
// Is this a magic method. i.e., is prefixed with "__" ?
|
107 |
+
if (preg_match('|^__[^_]|', $methodName) > 0) {
|
108 |
+
$magicPart = strtolower(substr($methodName, 2));
|
109 |
+
if (isset($this->magicMethods[$magicPart]) === false
|
110 |
+
&& isset($this->methodsDoubleUnderscore[$magicPart]) === false
|
111 |
+
) {
|
112 |
+
$className = '[anonymous class]';
|
113 |
+
$scopeNextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($currScope + 1), null, true);
|
114 |
+
if ($scopeNextNonEmpty !== false && $tokens[$scopeNextNonEmpty]['code'] === \T_STRING) {
|
115 |
+
$className = $tokens[$scopeNextNonEmpty]['content'];
|
116 |
+
}
|
117 |
+
|
118 |
+
$phpcsFile->addWarning(
|
119 |
+
'Method name "%s" is discouraged; PHP has reserved all method names with a double underscore prefix for future use.',
|
120 |
+
$stackPtr,
|
121 |
+
'MethodDoubleUnderscore',
|
122 |
+
array($className . '::' . $methodName)
|
123 |
+
);
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Processes the tokens outside the scope.
|
131 |
+
*
|
132 |
+
* @since 8.2.0
|
133 |
+
*
|
134 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being processed.
|
135 |
+
* @param int $stackPtr The position where this token was
|
136 |
+
* found.
|
137 |
+
*
|
138 |
+
* @return void
|
139 |
+
*/
|
140 |
+
protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
|
141 |
+
{
|
142 |
+
if ($this->isFunctionDeprecated($phpcsFile, $stackPtr) === true) {
|
143 |
+
/*
|
144 |
+
* Deprecated functions don't have to comply with the naming conventions,
|
145 |
+
* otherwise functions deprecated in favour of a function with a compliant
|
146 |
+
* name would still trigger an error.
|
147 |
+
*/
|
148 |
+
return;
|
149 |
+
}
|
150 |
+
|
151 |
+
$functionName = $phpcsFile->getDeclarationName($stackPtr);
|
152 |
+
if ($functionName === null) {
|
153 |
+
// Ignore closures.
|
154 |
+
return;
|
155 |
+
}
|
156 |
+
|
157 |
+
// Is this a magic function. i.e., it is prefixed with "__".
|
158 |
+
if (preg_match('|^__[^_]|', $functionName) > 0) {
|
159 |
+
$magicPart = strtolower(substr($functionName, 2));
|
160 |
+
if (isset($this->magicFunctions[$magicPart]) === false) {
|
161 |
+
$phpcsFile->addWarning(
|
162 |
+
'Function name "%s" is discouraged; PHP has reserved all method names with a double underscore prefix for future use.',
|
163 |
+
$stackPtr,
|
164 |
+
'FunctionDoubleUnderscore',
|
165 |
+
array($functionName)
|
166 |
+
);
|
167 |
+
}
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Check whether a function has been marked as deprecated via a @deprecated tag
|
174 |
+
* in the function docblock.
|
175 |
+
*
|
176 |
+
* @since 9.3.2
|
177 |
+
*
|
178 |
+
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
179 |
+
* @param int $stackPtr The position of a T_FUNCTION
|
180 |
+
* token in the stack.
|
181 |
+
*
|
182 |
+
* @return bool
|
183 |
+
*/
|
184 |
+
private function isFunctionDeprecated(File $phpcsFile, $stackPtr)
|
185 |
+
{
|
186 |
+
$tokens = $phpcsFile->getTokens();
|
187 |
+
$find = Tokens::$methodPrefixes;
|
188 |
+
$find[] = \T_WHITESPACE;
|
189 |
+
|
190 |
+
$commentEnd = $phpcsFile->findPrevious($find, ($stackPtr - 1), null, true);
|
191 |
+
if ($tokens[$commentEnd]['code'] !== \T_DOC_COMMENT_CLOSE_TAG) {
|
192 |
+
// Function doesn't have a doc comment or is using the wrong type of comment.
|
193 |
+
return false;
|
194 |
+
}
|
195 |
+
|
196 |
+
$commentStart = $tokens[$commentEnd]['comment_opener'];
|
197 |
+
foreach ($tokens[$commentStart]['comment_tags'] as $tag) {
|
198 |
+
if ($tokens[$tag]['content'] === '@deprecated') {
|
199 |
+
return true;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
return false;
|
204 |
+
}
|
205 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/ArgumentFunctionsReportCurrentValueSniff.php
ADDED
@@ -0,0 +1,455 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
+
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionUse;
|
12 |
+
|
13 |
+
use PHPCompatibility\Sniff;
|
14 |
+
use PHPCompatibility\PHPCSHelper;
|
15 |
+
use PHP_CodeSniffer_File as File;
|
16 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Functions inspecting function arguments report the current parameter value
|
20 |
+
* instead of the original since PHP 7.0.
|
21 |
+
*
|
22 |
+
* `func_get_arg()`, `func_get_args()`, `debug_backtrace()` and exception backtraces
|
23 |
+
* will no longer report the original parameter value as was passed to the function,
|
24 |
+
* but will instead provide the current value (which might have been modified).
|
25 |
+
*
|
26 |
+
* PHP version 7.0
|
27 |
+
*
|
28 |
+
* @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.func-parameter-modified
|
29 |
+
*
|
30 |
+
* @since 9.1.0
|
31 |
+
*/
|
32 |
+
class ArgumentFunctionsReportCurrentValueSniff extends Sniff
|
33 |
+
{
|
34 |
+
|
35 |
+
/**
|
36 |
+
* A list of functions that, when called, can behave differently in PHP 7
|
37 |
+
* when dealing with parameters of the function they're called in.
|
38 |
+
*
|
39 |
+
* @since 9.1.0
|
40 |
+
*
|
41 |
+
* @var array
|
42 |
+
*/
|
43 |
+
protected $changedFunctions = array(
|
44 |
+
'func_get_arg' => true,
|
45 |
+
'func_get_args' => true,
|
46 |
+
'debug_backtrace' => true,
|
47 |
+
'debug_print_backtrace' => true,
|
48 |
+
);
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Tokens to look out for to allow us to skip past nested scoped structures.
|
52 |
+
*
|
53 |
+
* @since 9.1.0
|
54 |
+
*
|
55 |
+
* @var array
|
56 |
+
*/
|
57 |
+
private $skipPastNested = array(
|
58 |
+
'T_CLASS' => true,
|
59 |
+
'T_ANON_CLASS' => true,
|
60 |
+
'T_INTERFACE' => true,
|
61 |
+
'T_TRAIT' => true,
|
62 |
+
'T_FUNCTION' => true,
|
63 |
+
'T_CLOSURE' => true,
|
64 |
+
);
|
65 |
+
|
66 |
+
/**
|
67 |
+
* List of tokens which when they preceed a T_STRING *within a function* indicate
|
68 |
+
* this is not a call to a PHP native function.
|
69 |
+
*
|
70 |
+
* This list already takes into account that nested scoped structures are being
|
71 |
+
* skipped over, so doesn't check for those again.
|
72 |
+
* Similarly, as constants won't have parentheses, those don't need to be checked
|
73 |
+
* for either.
|
74 |
+
*
|
75 |
+
* @since 9.1.0
|
76 |
+
*
|
77 |
+
* @var array
|
78 |
+
*/
|
79 |
+
private $noneFunctionCallIndicators = array(
|
80 |
+
\T_DOUBLE_COLON => true,
|
81 |
+
\T_OBJECT_OPERATOR => true,
|
82 |
+
);
|
83 |
+
|
84 |
+
/**
|
85 |
+
* The tokens for variable incrementing/decrementing.
|
86 |
+
*
|
87 |
+
* @since 9.1.0
|
88 |
+
*
|
89 |
+
* @var array
|
90 |
+
*/
|
91 |
+
private $plusPlusMinusMinus = array(
|
92 |
+
\T_DEC => true,
|
93 |
+
\T_INC => true,
|
94 |
+
);
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Tokens to ignore when determining the start of a statement.
|
98 |
+
*
|
99 |
+
* @since 9.1.0
|
100 |
+
*
|
101 |
+
* @var array
|
102 |
+
*/
|
103 |
+
private $ignoreForStartOfStatement = array(
|
104 |
+
\T_COMMA,
|
105 |
+
\T_DOUBLE_ARROW,
|
106 |
+
\T_OPEN_SQUARE_BRACKET,
|
107 |
+
\T_OPEN_PARENTHESIS,
|
108 |
+
);
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Returns an array of tokens this test wants to listen for.
|
112 |
+
*
|
113 |
+
* @since 9.1.0
|
114 |
+
*
|
115 |
+
* @return array
|
116 |
+
*/
|
117 |
+
public function register()
|
118 |
+
{
|
119 |
+
return array(
|
120 |
+
\T_FUNCTION,
|
121 |
+
\T_CLOSURE,
|
122 |
+
);
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Processes this test, when one of its tokens is encountered.
|
127 |
+
*
|
128 |
+
* @since 9.1.0
|
129 |
+
*
|
130 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
131 |
+
* @param int $stackPtr The position of the current token
|
132 |
+
* in the stack passed in $tokens.
|
133 |
+
*
|
134 |
+
* @return void
|
135 |
+
*/
|
136 |
+
public function process(File $phpcsFile, $stackPtr)
|
137 |
+
{
|
138 |
+
if ($this->supportsAbove('7.0') === false) {
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
|
142 |
+
$tokens = $phpcsFile->getTokens();
|
143 |
+
|
144 |
+
if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) {
|
145 |
+
// Abstract function, interface function, live coding or parse error.
|
146 |
+
return;
|
147 |
+
}
|
148 |
+
|
149 |
+
$scopeOpener = $tokens[$stackPtr]['scope_opener'];
|
150 |
+
$scopeCloser = $tokens[$stackPtr]['scope_closer'];
|
151 |
+
|
152 |
+
// Does the function declaration have parameters ?
|
153 |
+
$params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
|
154 |
+
if (empty($params)) {
|
155 |
+
// No named arguments found, so no risk of them being changed.
|
156 |
+
return;
|
157 |
+
}
|
158 |
+
|
159 |
+
$paramNames = array();
|
160 |
+
foreach ($params as $param) {
|
161 |
+
$paramNames[] = $param['name'];
|
162 |
+
}
|
163 |
+
|
164 |
+
for ($i = ($scopeOpener + 1); $i < $scopeCloser; $i++) {
|
165 |
+
if (isset($this->skipPastNested[$tokens[$i]['type']]) && isset($tokens[$i]['scope_closer'])) {
|
166 |
+
// Skip past nested structures.
|
167 |
+
$i = $tokens[$i]['scope_closer'];
|
168 |
+
continue;
|
169 |
+
}
|
170 |
+
|
171 |
+
if ($tokens[$i]['code'] !== \T_STRING) {
|
172 |
+
continue;
|
173 |
+
}
|
174 |
+
|
175 |
+
$foundFunctionName = strtolower($tokens[$i]['content']);
|
176 |
+
|
177 |
+
if (isset($this->changedFunctions[$foundFunctionName]) === false) {
|
178 |
+
// Not one of the target functions.
|
179 |
+
continue;
|
180 |
+
}
|
181 |
+
|
182 |
+
/*
|
183 |
+
* Ok, so is this really a function call to one of the PHP native functions ?
|
184 |
+
*/
|
185 |
+
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true);
|
186 |
+
if ($next === false || $tokens[$next]['code'] !== \T_OPEN_PARENTHESIS) {
|
187 |
+
// Live coding, parse error or not a function call.
|
188 |
+
continue;
|
189 |
+
}
|
190 |
+
|
191 |
+
$prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($i - 1), null, true);
|
192 |
+
if ($prev !== false) {
|
193 |
+
if (isset($this->noneFunctionCallIndicators[$tokens[$prev]['code']])) {
|
194 |
+
continue;
|
195 |
+
}
|
196 |
+
|
197 |
+
// Check for namespaced functions, ie: \foo\bar() not \bar().
|
198 |
+
if ($tokens[ $prev ]['code'] === \T_NS_SEPARATOR) {
|
199 |
+
$pprev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prev - 1), null, true);
|
200 |
+
if ($pprev !== false && $tokens[ $pprev ]['code'] === \T_STRING) {
|
201 |
+
continue;
|
202 |
+
}
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
/*
|
207 |
+
* Address some special cases.
|
208 |
+
*/
|
209 |
+
if ($foundFunctionName !== 'func_get_args') {
|
210 |
+
$paramOne = $this->getFunctionCallParameter($phpcsFile, $i, 1);
|
211 |
+
if ($paramOne !== false) {
|
212 |
+
switch ($foundFunctionName) {
|
213 |
+
/*
|
214 |
+
* Check if `debug_(print_)backtrace()` is called with the
|
215 |
+
* `DEBUG_BACKTRACE_IGNORE_ARGS` option.
|
216 |
+
*/
|
217 |
+
case 'debug_backtrace':
|
218 |
+
case 'debug_print_backtrace':
|
219 |
+
$hasIgnoreArgs = $phpcsFile->findNext(
|
220 |
+
\T_STRING,
|
221 |
+
$paramOne['start'],
|
222 |
+
($paramOne['end'] + 1),
|
223 |
+
false,
|
224 |
+
'DEBUG_BACKTRACE_IGNORE_ARGS'
|
225 |
+
);
|
226 |
+
|
227 |
+
if ($hasIgnoreArgs !== false) {
|
228 |
+
// Debug_backtrace() called with ignore args option.
|
229 |
+
continue 2;
|
230 |
+
}
|
231 |
+
break;
|
232 |
+
|
233 |
+
/*
|
234 |
+
* Collect the necessary information to only throw a notice if the argument
|
235 |
+
* touched/changed is in line with the passed $arg_num.
|
236 |
+
*
|
237 |
+
* Also, we can ignore `func_get_arg()` if the argument offset passed is
|
238 |
+
* higher than the number of named parameters.
|
239 |
+
*
|
240 |
+
* {@internal Note: This does not take calculations into account!
|
241 |
+
* Should be exceptionally rare and can - if needs be - be addressed at a later stage.}
|
242 |
+
*/
|
243 |
+
case 'func_get_arg':
|
244 |
+
$number = $phpcsFile->findNext(\T_LNUMBER, $paramOne['start'], ($paramOne['end'] + 1));
|
245 |
+
if ($number !== false) {
|
246 |
+
$argNumber = $tokens[$number]['content'];
|
247 |
+
|
248 |
+
if (isset($paramNames[$argNumber]) === false) {
|
249 |
+
// Requesting a non-named additional parameter. Ignore.
|
250 |
+
continue 2;
|
251 |
+
}
|
252 |
+
}
|
253 |
+
break;
|
254 |
+
}
|
255 |
+
}
|
256 |
+
} else {
|
257 |
+
/*
|
258 |
+
* Check if the call to func_get_args() happens to be in an array_slice() or
|
259 |
+
* array_splice() with an $offset higher than the number of named parameters.
|
260 |
+
* In that case, we can ignore it.
|
261 |
+
*
|
262 |
+
* {@internal Note: This does not take offset calculations into account!
|
263 |
+
* Should be exceptionally rare and can - if needs be - be addressed at a later stage.}
|
264 |
+
*/
|
265 |
+
if ($prev !== false && $tokens[$prev]['code'] === \T_OPEN_PARENTHESIS) {
|
266 |
+
|
267 |
+
$maybeFunctionCall = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prev - 1), null, true);
|
268 |
+
if ($maybeFunctionCall !== false
|
269 |
+
&& $tokens[$maybeFunctionCall]['code'] === \T_STRING
|
270 |
+
&& ($tokens[$maybeFunctionCall]['content'] === 'array_slice'
|
271 |
+
|| $tokens[$maybeFunctionCall]['content'] === 'array_splice')
|
272 |
+
) {
|
273 |
+
$parentFuncParamTwo = $this->getFunctionCallParameter($phpcsFile, $maybeFunctionCall, 2);
|
274 |
+
$number = $phpcsFile->findNext(
|
275 |
+
\T_LNUMBER,
|
276 |
+
$parentFuncParamTwo['start'],
|
277 |
+
($parentFuncParamTwo['end'] + 1)
|
278 |
+
);
|
279 |
+
|
280 |
+
if ($number !== false && isset($paramNames[$tokens[$number]['content']]) === false) {
|
281 |
+
// Requesting non-named additional parameters. Ignore.
|
282 |
+
continue ;
|
283 |
+
}
|
284 |
+
|
285 |
+
// Slice starts at a named argument, but we know which params are being accessed.
|
286 |
+
$paramNamesSubset = \array_slice($paramNames, $tokens[$number]['content']);
|
287 |
+
}
|
288 |
+
}
|
289 |
+
}
|
290 |
+
|
291 |
+
/*
|
292 |
+
* For debug_backtrace(), check if the result is being dereferenced and if so,
|
293 |
+
* whether the `args` index is used.
|
294 |
+
* I.e. whether `$index` in `debug_backtrace()[$stackFrame][$index]` is a string
|
295 |
+
* with the content `args`.
|
296 |
+
*
|
297 |
+
* Note: We already know that $next is the open parenthesis of the function call.
|
298 |
+
*/
|
299 |
+
if ($foundFunctionName === 'debug_backtrace' && isset($tokens[$next]['parenthesis_closer'])) {
|
300 |
+
$afterParenthesis = $phpcsFile->findNext(
|
301 |
+
Tokens::$emptyTokens,
|
302 |
+
($tokens[$next]['parenthesis_closer'] + 1),
|
303 |
+
null,
|
304 |
+
true
|
305 |
+
);
|
306 |
+
|
307 |
+
if ($tokens[$afterParenthesis]['code'] === \T_OPEN_SQUARE_BRACKET
|
308 |
+
&& isset($tokens[$afterParenthesis]['bracket_closer'])
|
309 |
+
) {
|
310 |
+
$afterStackFrame = $phpcsFile->findNext(
|
311 |
+
Tokens::$emptyTokens,
|
312 |
+
($tokens[$afterParenthesis]['bracket_closer'] + 1),
|
313 |
+
null,
|
314 |
+
true
|
315 |
+
);
|
316 |
+
|
317 |
+
if ($tokens[$afterStackFrame]['code'] === \T_OPEN_SQUARE_BRACKET
|
318 |
+
&& isset($tokens[$afterStackFrame]['bracket_closer'])
|
319 |
+
) {
|
320 |
+
$arrayIndex = $phpcsFile->findNext(
|
321 |
+
\T_CONSTANT_ENCAPSED_STRING,
|
322 |
+
($afterStackFrame + 1),
|
323 |
+
$tokens[$afterStackFrame]['bracket_closer']
|
324 |
+
);
|
325 |
+
|
326 |
+
if ($arrayIndex !== false && $this->stripQuotes($tokens[$arrayIndex]['content']) !== 'args') {
|
327 |
+
continue;
|
328 |
+
}
|
329 |
+
}
|
330 |
+
}
|
331 |
+
}
|
332 |
+
|
333 |
+
/*
|
334 |
+
* Only check for variables before the start of the statement to
|
335 |
+
* prevent false positives on the return value of the function call
|
336 |
+
* being assigned to one of the parameters, i.e.:
|
337 |
+
* `$param = func_get_args();`.
|
338 |
+
*/
|
339 |
+
$startOfStatement = PHPCSHelper::findStartOfStatement($phpcsFile, $i, $this->ignoreForStartOfStatement);
|
340 |
+
|
341 |
+
/*
|
342 |
+
* Ok, so we've found one of the target functions in the right scope.
|
343 |
+
* Now, let's check if any of the passed parameters were touched.
|
344 |
+
*/
|
345 |
+
$scanResult = 'clean';
|
346 |
+
for ($j = ($scopeOpener + 1); $j < $startOfStatement; $j++) {
|
347 |
+
if (isset($this->skipPastNested[$tokens[$j]['type']])
|
348 |
+
&& isset($tokens[$j]['scope_closer'])
|
349 |
+
) {
|
350 |
+
// Skip past nested structures.
|
351 |
+
$j = $tokens[$j]['scope_closer'];
|
352 |
+
continue;
|
353 |
+
}
|
354 |
+
|
355 |
+
if ($tokens[$j]['code'] !== \T_VARIABLE) {
|
356 |
+
continue;
|
357 |
+
}
|
358 |
+
|
359 |
+
if ($foundFunctionName === 'func_get_arg' && isset($argNumber)) {
|
360 |
+
if (isset($paramNames[$argNumber])
|
361 |
+
&& $tokens[$j]['content'] !== $paramNames[$argNumber]
|
362 |
+
) {
|
363 |
+
// Different param than the one requested by func_get_arg().
|
364 |
+
continue;
|
365 |
+
}
|
366 |
+
} elseif ($foundFunctionName === 'func_get_args' && isset($paramNamesSubset)) {
|
367 |
+
if (\in_array($tokens[$j]['content'], $paramNamesSubset, true) === false) {
|
368 |
+
// Different param than the ones requested by func_get_args().
|
369 |
+
continue;
|
370 |
+
}
|
371 |
+
} elseif (\in_array($tokens[$j]['content'], $paramNames, true) === false) {
|
372 |
+
// Variable is not one of the function parameters.
|
373 |
+
continue;
|
374 |
+
}
|
375 |
+
|
376 |
+
/*
|
377 |
+
* Ok, so we've found a variable which was passed as one of the parameters.
|
378 |
+
* Now, is this variable being changed, i.e. incremented, decremented or
|
379 |
+
* assigned something ?
|
380 |
+
*/
|
381 |
+
$scanResult = 'warning';
|
382 |
+
if (isset($variableToken) === false) {
|
383 |
+
$variableToken = $j;
|
384 |
+
}
|
385 |
+
|
386 |
+
$beforeVar = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($j - 1), null, true);
|
387 |
+
if ($beforeVar !== false && isset($this->plusPlusMinusMinus[$tokens[$beforeVar]['code']])) {
|
388 |
+
// Variable is being (pre-)incremented/decremented.
|
389 |
+
$scanResult = 'error';
|
390 |
+
$variableToken = $j;
|
391 |
+
break;
|
392 |
+
}
|
393 |
+
|
394 |
+
$afterVar = $phpcsFile->findNext(Tokens::$emptyTokens, ($j + 1), null, true);
|
395 |
+
if ($afterVar === false) {
|
396 |
+
// Shouldn't be possible, but just in case.
|
397 |
+
continue;
|
398 |
+
}
|
399 |
+
|
400 |
+
if (isset($this->plusPlusMinusMinus[$tokens[$afterVar]['code']])) {
|
401 |
+
// Variable is being (post-)incremented/decremented.
|
402 |
+
$scanResult = 'error';
|
403 |
+
$variableToken = $j;
|
404 |
+
break;
|
405 |
+
}
|
406 |
+
|
407 |
+
if ($tokens[$afterVar]['code'] === \T_OPEN_SQUARE_BRACKET
|
408 |
+
&& isset($tokens[$afterVar]['bracket_closer'])
|
409 |
+
) {
|
410 |
+
// Skip past array access on the variable.
|
411 |
+
while (($afterVar = $phpcsFile->findNext(Tokens::$emptyTokens, ($tokens[$afterVar]['bracket_closer'] + 1), null, true)) !== false) {
|
412 |
+
if ($tokens[$afterVar]['code'] !== \T_OPEN_SQUARE_BRACKET
|
413 |
+
|| isset($tokens[$afterVar]['bracket_closer']) === false
|
414 |
+
) {
|
415 |
+
break;
|
416 |
+
}
|
417 |
+
}
|
418 |
+
}
|
419 |
+
|
420 |
+
if ($afterVar !== false
|
421 |
+
&& isset(Tokens::$assignmentTokens[$tokens[$afterVar]['code']])
|
422 |
+
) {
|
423 |
+
// Variable is being assigned something.
|
424 |
+
$scanResult = 'error';
|
425 |
+
$variableToken = $j;
|
426 |
+
break;
|
427 |
+
}
|
428 |
+
}
|
429 |
+
|
430 |
+
unset($argNumber, $paramNamesSubset);
|
431 |
+
|
432 |
+
if ($scanResult === 'clean') {
|
433 |
+
continue;
|
434 |
+
}
|
435 |
+
|
436 |
+
$error = 'Since PHP 7.0, functions inspecting arguments, like %1$s(), no longer report the original value as passed to a parameter, but will instead provide the current value. The parameter "%2$s" was %4$s on line %3$s.';
|
437 |
+
$data = array(
|
438 |
+
$foundFunctionName,
|
439 |
+
$tokens[$variableToken]['content'],
|
440 |
+
$tokens[$variableToken]['line'],
|
441 |
+
);
|
442 |
+
|
443 |
+
if ($scanResult === 'error') {
|
444 |
+
$data[] = 'changed';
|
445 |
+
$phpcsFile->addError($error, $i, 'Changed', $data);
|
446 |
+
|
447 |
+
} elseif ($scanResult === 'warning') {
|
448 |
+
$data[] = 'used, and possibly changed (by reference),';
|
449 |
+
$phpcsFile->addWarning($error, $i, 'NeedsInspection', $data);
|
450 |
+
}
|
451 |
+
|
452 |
+
unset($variableToken);
|
453 |
+
}
|
454 |
+
}
|
455 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionUse}/ArgumentFunctionsUsageSniff.php
RENAMED
@@ -1,23 +1,24 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
|
|
|
|
15 |
|
16 |
/**
|
17 |
-
*
|
18 |
*
|
|
|
19 |
* - Prior to PHP 5.3, these functions could not be used as a function call parameter.
|
20 |
-
*
|
21 |
* - Calling these functions from the outermost scope of a file which has been included by
|
22 |
* calling `include` or `require` from within a function in the calling file, worked
|
23 |
* prior to PHP 5.3. As of PHP 5.3, this will generate a warning and will always return false/-1.
|
@@ -26,9 +27,9 @@ use PHPCompatibility\Sniff;
|
|
26 |
*
|
27 |
* PHP version 5.3
|
28 |
*
|
29 |
-
* @
|
30 |
-
*
|
31 |
-
* @
|
32 |
*/
|
33 |
class ArgumentFunctionsUsageSniff extends Sniff
|
34 |
{
|
@@ -36,6 +37,8 @@ class ArgumentFunctionsUsageSniff extends Sniff
|
|
36 |
/**
|
37 |
* The target functions for this sniff.
|
38 |
*
|
|
|
|
|
39 |
* @var array
|
40 |
*/
|
41 |
protected $targetFunctions = array(
|
@@ -48,24 +51,28 @@ class ArgumentFunctionsUsageSniff extends Sniff
|
|
48 |
/**
|
49 |
* Returns an array of tokens this test wants to listen for.
|
50 |
*
|
|
|
|
|
51 |
* @return array
|
52 |
*/
|
53 |
public function register()
|
54 |
{
|
55 |
-
return array(T_STRING);
|
56 |
}
|
57 |
|
58 |
|
59 |
/**
|
60 |
* Processes this test, when one of its tokens is encountered.
|
61 |
*
|
|
|
|
|
62 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
63 |
* @param int $stackPtr The position of the current token in the
|
64 |
* stack passed in $tokens.
|
65 |
*
|
66 |
* @return void
|
67 |
*/
|
68 |
-
public function process(
|
69 |
{
|
70 |
$tokens = $phpcsFile->getTokens();
|
71 |
$functionLc = strtolower($tokens[$stackPtr]['content']);
|
@@ -74,23 +81,23 @@ class ArgumentFunctionsUsageSniff extends Sniff
|
|
74 |
}
|
75 |
|
76 |
// Next non-empty token should be the open parenthesis.
|
77 |
-
$nextNonEmpty = $phpcsFile->findNext(
|
78 |
-
if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== T_OPEN_PARENTHESIS) {
|
79 |
return;
|
80 |
}
|
81 |
|
82 |
$ignore = array(
|
83 |
-
T_DOUBLE_COLON => true,
|
84 |
-
T_OBJECT_OPERATOR => true,
|
85 |
-
T_FUNCTION => true,
|
86 |
-
T_NEW => true,
|
87 |
);
|
88 |
|
89 |
-
$prevNonEmpty = $phpcsFile->findPrevious(
|
90 |
if (isset($ignore[$tokens[$prevNonEmpty]['code']]) === true) {
|
91 |
// Not a call to a PHP function.
|
92 |
return;
|
93 |
-
} elseif ($tokens[$prevNonEmpty]['code'] === T_NS_SEPARATOR && $tokens[$prevNonEmpty - 1]['code'] === T_STRING) {
|
94 |
// Namespaced function.
|
95 |
return;
|
96 |
}
|
@@ -98,12 +105,12 @@ class ArgumentFunctionsUsageSniff extends Sniff
|
|
98 |
$data = $tokens[$stackPtr]['content'];
|
99 |
|
100 |
/*
|
101 |
-
* Check for
|
102 |
*
|
103 |
* As PHPCS can not determine whether a file is included from within a function in
|
104 |
* another file, so always throw a warning/error.
|
105 |
*/
|
106 |
-
if ($phpcsFile->hasCondition($stackPtr, array(T_FUNCTION, T_CLOSURE)) === false) {
|
107 |
$isError = false;
|
108 |
$message = 'Use of %s() outside of a user-defined function is only supported if the file is included from within a user-defined function in another file prior to PHP 5.3.';
|
109 |
|
@@ -116,7 +123,7 @@ class ArgumentFunctionsUsageSniff extends Sniff
|
|
116 |
}
|
117 |
|
118 |
/*
|
119 |
-
* Check for
|
120 |
*/
|
121 |
if ($this->supportsBelow('5.2') === false) {
|
122 |
return;
|
@@ -135,13 +142,13 @@ class ArgumentFunctionsUsageSniff extends Sniff
|
|
135 |
$throwError = true;
|
136 |
} else {
|
137 |
$opener = key($tokens[$stackPtr]['nested_parenthesis']);
|
138 |
-
$prevNonEmpty = $phpcsFile->findPrevious(
|
139 |
-
if ($tokens[$prevNonEmpty]['code'] !== T_STRING) {
|
140 |
return;
|
141 |
}
|
142 |
|
143 |
-
$prevPrevNonEmpty = $phpcsFile->findPrevious(
|
144 |
-
if ($tokens[$prevPrevNonEmpty]['code'] === T_FUNCTION) {
|
145 |
return;
|
146 |
}
|
147 |
|
@@ -159,5 +166,4 @@ class ArgumentFunctionsUsageSniff extends Sniff
|
|
159 |
$data
|
160 |
);
|
161 |
}
|
162 |
-
|
163 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionUse;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
|
17 |
/**
|
18 |
+
* Detect usage of `func_get_args()`, `func_get_arg()` and `func_num_args()` in invalid context.
|
19 |
*
|
20 |
+
* Checks for:
|
21 |
* - Prior to PHP 5.3, these functions could not be used as a function call parameter.
|
|
|
22 |
* - Calling these functions from the outermost scope of a file which has been included by
|
23 |
* calling `include` or `require` from within a function in the calling file, worked
|
24 |
* prior to PHP 5.3. As of PHP 5.3, this will generate a warning and will always return false/-1.
|
27 |
*
|
28 |
* PHP version 5.3
|
29 |
*
|
30 |
+
* @link https://www.php.net/manual/en/migration53.incompatible.php
|
31 |
+
*
|
32 |
+
* @since 8.2.0
|
33 |
*/
|
34 |
class ArgumentFunctionsUsageSniff extends Sniff
|
35 |
{
|
37 |
/**
|
38 |
* The target functions for this sniff.
|
39 |
*
|
40 |
+
* @since 8.2.0
|
41 |
+
*
|
42 |
* @var array
|
43 |
*/
|
44 |
protected $targetFunctions = array(
|
51 |
/**
|
52 |
* Returns an array of tokens this test wants to listen for.
|
53 |
*
|
54 |
+
* @since 8.2.0
|
55 |
+
*
|
56 |
* @return array
|
57 |
*/
|
58 |
public function register()
|
59 |
{
|
60 |
+
return array(\T_STRING);
|
61 |
}
|
62 |
|
63 |
|
64 |
/**
|
65 |
* Processes this test, when one of its tokens is encountered.
|
66 |
*
|
67 |
+
* @since 8.2.0
|
68 |
+
*
|
69 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
70 |
* @param int $stackPtr The position of the current token in the
|
71 |
* stack passed in $tokens.
|
72 |
*
|
73 |
* @return void
|
74 |
*/
|
75 |
+
public function process(File $phpcsFile, $stackPtr)
|
76 |
{
|
77 |
$tokens = $phpcsFile->getTokens();
|
78 |
$functionLc = strtolower($tokens[$stackPtr]['content']);
|
81 |
}
|
82 |
|
83 |
// Next non-empty token should be the open parenthesis.
|
84 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
|
85 |
+
if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS) {
|
86 |
return;
|
87 |
}
|
88 |
|
89 |
$ignore = array(
|
90 |
+
\T_DOUBLE_COLON => true,
|
91 |
+
\T_OBJECT_OPERATOR => true,
|
92 |
+
\T_FUNCTION => true,
|
93 |
+
\T_NEW => true,
|
94 |
);
|
95 |
|
96 |
+
$prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
97 |
if (isset($ignore[$tokens[$prevNonEmpty]['code']]) === true) {
|
98 |
// Not a call to a PHP function.
|
99 |
return;
|
100 |
+
} elseif ($tokens[$prevNonEmpty]['code'] === \T_NS_SEPARATOR && $tokens[$prevNonEmpty - 1]['code'] === \T_STRING) {
|
101 |
// Namespaced function.
|
102 |
return;
|
103 |
}
|
105 |
$data = $tokens[$stackPtr]['content'];
|
106 |
|
107 |
/*
|
108 |
+
* Check for use of the functions in the global scope.
|
109 |
*
|
110 |
* As PHPCS can not determine whether a file is included from within a function in
|
111 |
* another file, so always throw a warning/error.
|
112 |
*/
|
113 |
+
if ($phpcsFile->hasCondition($stackPtr, array(\T_FUNCTION, \T_CLOSURE)) === false) {
|
114 |
$isError = false;
|
115 |
$message = 'Use of %s() outside of a user-defined function is only supported if the file is included from within a user-defined function in another file prior to PHP 5.3.';
|
116 |
|
123 |
}
|
124 |
|
125 |
/*
|
126 |
+
* Check for use of the functions as a parameter in a function call.
|
127 |
*/
|
128 |
if ($this->supportsBelow('5.2') === false) {
|
129 |
return;
|
142 |
$throwError = true;
|
143 |
} else {
|
144 |
$opener = key($tokens[$stackPtr]['nested_parenthesis']);
|
145 |
+
$prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($opener - 1), null, true);
|
146 |
+
if ($tokens[$prevNonEmpty]['code'] !== \T_STRING) {
|
147 |
return;
|
148 |
}
|
149 |
|
150 |
+
$prevPrevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prevNonEmpty - 1), null, true);
|
151 |
+
if ($tokens[$prevPrevNonEmpty]['code'] === \T_FUNCTION) {
|
152 |
return;
|
153 |
}
|
154 |
|
166 |
$data
|
167 |
);
|
168 |
}
|
|
|
169 |
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionUse}/NewFunctionParametersSniff.php
RENAMED
@@ -1,32 +1,41 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
-
namespace PHPCompatibility\Sniffs\
|
11 |
|
12 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
-
*
|
16 |
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* @
|
|
|
|
|
|
|
20 |
*/
|
21 |
class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
22 |
{
|
23 |
/**
|
24 |
-
* A list of new
|
25 |
*
|
26 |
* The array lists : version number with false (not present) or true (present).
|
27 |
* The index is the location of the parameter in the parameter list, starting at 0 !
|
28 |
* If's sufficient to list the first version where the function appears.
|
29 |
*
|
|
|
|
|
|
|
30 |
* @var array
|
31 |
*/
|
32 |
protected $newFunctionParameters = array(
|
@@ -400,6 +409,90 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
|
400 |
'5.5' => true,
|
401 |
),
|
402 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
'memory_get_peak_usage' => array(
|
404 |
0 => array(
|
405 |
'name' => 'real_usage',
|
@@ -606,8 +699,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
|
606 |
'php_uname' => array(
|
607 |
0 => array(
|
608 |
'name' => 'mode',
|
609 |
-
'
|
610 |
-
'
|
611 |
),
|
612 |
),
|
613 |
'preg_replace' => array(
|
@@ -623,6 +716,18 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
|
623 |
'5.0' => false,
|
624 |
'5.1' => true,
|
625 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
626 |
),
|
627 |
'round' => array(
|
628 |
2 => array(
|
@@ -839,6 +944,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
|
839 |
/**
|
840 |
* Returns an array of tokens this test wants to listen for.
|
841 |
*
|
|
|
|
|
842 |
* @return array
|
843 |
*/
|
844 |
public function register()
|
@@ -846,31 +953,33 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
|
846 |
// Handle case-insensitivity of function names.
|
847 |
$this->newFunctionParameters = $this->arrayKeysToLowercase($this->newFunctionParameters);
|
848 |
|
849 |
-
return array(T_STRING);
|
850 |
-
}
|
851 |
|
852 |
/**
|
853 |
* Processes this test, when one of its tokens is encountered.
|
854 |
*
|
|
|
|
|
855 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
856 |
* @param int $stackPtr The position of the current token in
|
857 |
* the stack passed in $tokens.
|
858 |
*
|
859 |
* @return void
|
860 |
*/
|
861 |
-
public function process(
|
862 |
{
|
863 |
$tokens = $phpcsFile->getTokens();
|
864 |
|
865 |
$ignore = array(
|
866 |
-
T_DOUBLE_COLON,
|
867 |
-
T_OBJECT_OPERATOR,
|
868 |
-
T_FUNCTION,
|
869 |
-
T_CONST,
|
870 |
);
|
871 |
|
872 |
-
$prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
|
873 |
-
if (
|
874 |
// Not a call to a PHP function.
|
875 |
return;
|
876 |
}
|
@@ -888,7 +997,7 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
|
888 |
}
|
889 |
|
890 |
// If the parameter count returned > 0, we know there will be valid open parenthesis.
|
891 |
-
$openParenthesis = $phpcsFile->findNext(
|
892 |
$parameterOffsetFound = $parameterCount - 1;
|
893 |
|
894 |
foreach ($this->newFunctionParameters[$functionLc] as $offset => $parameterDetails) {
|
@@ -901,13 +1010,14 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
|
901 |
$this->handleFeature($phpcsFile, $openParenthesis, $itemInfo);
|
902 |
}
|
903 |
}
|
904 |
-
|
905 |
-
}//end process()
|
906 |
|
907 |
|
908 |
/**
|
909 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
910 |
*
|
|
|
|
|
911 |
* @param array $itemInfo Base information about the item.
|
912 |
*
|
913 |
* @return array Version and other information about the item.
|
@@ -921,6 +1031,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
|
921 |
/**
|
922 |
* Get an array of the non-PHP-version array keys used in a sub-array.
|
923 |
*
|
|
|
|
|
924 |
* @return array
|
925 |
*/
|
926 |
protected function getNonVersionArrayKeys()
|
@@ -932,6 +1044,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
|
932 |
/**
|
933 |
* Retrieve the relevant detail (version) information for use in an error message.
|
934 |
*
|
|
|
|
|
935 |
* @param array $itemArray Version and other information about the item.
|
936 |
* @param array $itemInfo Base information about the item.
|
937 |
*
|
@@ -949,6 +1063,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
|
949 |
/**
|
950 |
* Get the item name to be used for the creation of the error code.
|
951 |
*
|
|
|
|
|
952 |
* @param array $itemInfo Base information about the item.
|
953 |
* @param array $errorInfo Detail information about an item.
|
954 |
*
|
@@ -963,6 +1079,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
|
963 |
/**
|
964 |
* Get the error message template for this sniff.
|
965 |
*
|
|
|
|
|
966 |
* @return string
|
967 |
*/
|
968 |
protected function getErrorMsgTemplate()
|
@@ -974,6 +1092,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
|
974 |
/**
|
975 |
* Allow for concrete child classes to filter the error data before it's passed to PHPCS.
|
976 |
*
|
|
|
|
|
977 |
* @param array $data The error data array which was created.
|
978 |
* @param array $itemInfo Base information about the item this error message applies to.
|
979 |
* @param array $errorInfo Detail information about an item this error message applies to.
|
@@ -986,6 +1106,4 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
|
986 |
array_unshift($data, $itemInfo['name'], $errorInfo['paramName']);
|
987 |
return $data;
|
988 |
}
|
989 |
-
|
990 |
-
|
991 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionUse;
|
12 |
|
13 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
|
17 |
/**
|
18 |
+
* Detect use of new function parameters in calls to native PHP functions.
|
19 |
*
|
20 |
+
* PHP version All
|
21 |
+
*
|
22 |
+
* @link https://www.php.net/manual/en/doc.changelog.php
|
23 |
+
*
|
24 |
+
* @since 7.0.0
|
25 |
+
* @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class..
|
26 |
*/
|
27 |
class NewFunctionParametersSniff extends AbstractNewFeatureSniff
|
28 |
{
|
29 |
/**
|
30 |
+
* A list of functions which have new parameters, not present in older versions.
|
31 |
*
|
32 |
* The array lists : version number with false (not present) or true (present).
|
33 |
* The index is the location of the parameter in the parameter list, starting at 0 !
|
34 |
* If's sufficient to list the first version where the function appears.
|
35 |
*
|
36 |
+
* @since 7.0.0
|
37 |
+
* @since 7.0.2 Visibility changed from `public` to `protected`.
|
38 |
+
*
|
39 |
* @var array
|
40 |
*/
|
41 |
protected $newFunctionParameters = array(
|
409 |
'5.5' => true,
|
410 |
),
|
411 |
),
|
412 |
+
'ldap_add' => array(
|
413 |
+
3 => array(
|
414 |
+
'name' => 'serverctrls',
|
415 |
+
'7.2' => false,
|
416 |
+
'7.3' => true,
|
417 |
+
),
|
418 |
+
),
|
419 |
+
'ldap_compare' => array(
|
420 |
+
4 => array(
|
421 |
+
'name' => 'serverctrls',
|
422 |
+
'7.2' => false,
|
423 |
+
'7.3' => true,
|
424 |
+
),
|
425 |
+
),
|
426 |
+
'ldap_delete' => array(
|
427 |
+
2 => array(
|
428 |
+
'name' => 'serverctrls',
|
429 |
+
'7.2' => false,
|
430 |
+
'7.3' => true,
|
431 |
+
),
|
432 |
+
),
|
433 |
+
'ldap_list' => array(
|
434 |
+
8 => array(
|
435 |
+
'name' => 'serverctrls',
|
436 |
+
'7.2' => false,
|
437 |
+
'7.3' => true,
|
438 |
+
),
|
439 |
+
),
|
440 |
+
'ldap_mod_add' => array(
|
441 |
+
3 => array(
|
442 |
+
'name' => 'serverctrls',
|
443 |
+
'7.2' => false,
|
444 |
+
'7.3' => true,
|
445 |
+
),
|
446 |
+
),
|
447 |
+
'ldap_mod_del' => array(
|
448 |
+
3 => array(
|
449 |
+
'name' => 'serverctrls',
|
450 |
+
'7.2' => false,
|
451 |
+
'7.3' => true,
|
452 |
+
),
|
453 |
+
),
|
454 |
+
'ldap_mod_replace' => array(
|
455 |
+
3 => array(
|
456 |
+
'name' => 'serverctrls',
|
457 |
+
'7.2' => false,
|
458 |
+
'7.3' => true,
|
459 |
+
),
|
460 |
+
),
|
461 |
+
'ldap_modify_batch' => array(
|
462 |
+
3 => array(
|
463 |
+
'name' => 'serverctrls',
|
464 |
+
'7.2' => false,
|
465 |
+
'7.3' => true,
|
466 |
+
),
|
467 |
+
),
|
468 |
+
'ldap_parse_result' => array(
|
469 |
+
6 => array(
|
470 |
+
'name' => 'serverctrls',
|
471 |
+
'7.2' => false,
|
472 |
+
'7.3' => true,
|
473 |
+
),
|
474 |
+
),
|
475 |
+
'ldap_read' => array(
|
476 |
+
8 => array(
|
477 |
+
'name' => 'serverctrls',
|
478 |
+
'7.2' => false,
|
479 |
+
'7.3' => true,
|
480 |
+
),
|
481 |
+
),
|
482 |
+
'ldap_rename' => array(
|
483 |
+
5 => array(
|
484 |
+
'name' => 'serverctrls',
|
485 |
+
'7.2' => false,
|
486 |
+
'7.3' => true,
|
487 |
+
),
|
488 |
+
),
|
489 |
+
'ldap_search' => array(
|
490 |
+
8 => array(
|
491 |
+
'name' => 'serverctrls',
|
492 |
+
'7.2' => false,
|
493 |
+
'7.3' => true,
|
494 |
+
),
|
495 |
+
),
|
496 |
'memory_get_peak_usage' => array(
|
497 |
0 => array(
|
498 |
'name' => 'real_usage',
|
699 |
'php_uname' => array(
|
700 |
0 => array(
|
701 |
'name' => 'mode',
|
702 |
+
'4.2' => false,
|
703 |
+
'4.3' => true,
|
704 |
),
|
705 |
),
|
706 |
'preg_replace' => array(
|
716 |
'5.0' => false,
|
717 |
'5.1' => true,
|
718 |
),
|
719 |
+
5 => array(
|
720 |
+
'name' => 'flags',
|
721 |
+
'7.3' => false,
|
722 |
+
'7.4' => true,
|
723 |
+
),
|
724 |
+
),
|
725 |
+
'preg_replace_callback_array' => array(
|
726 |
+
4 => array(
|
727 |
+
'name' => 'flags',
|
728 |
+
'7.3' => false,
|
729 |
+
'7.4' => true,
|
730 |
+
),
|
731 |
),
|
732 |
'round' => array(
|
733 |
2 => array(
|
944 |
/**
|
945 |
* Returns an array of tokens this test wants to listen for.
|
946 |
*
|
947 |
+
* @since 7.0.0
|
948 |
+
*
|
949 |
* @return array
|
950 |
*/
|
951 |
public function register()
|
953 |
// Handle case-insensitivity of function names.
|
954 |
$this->newFunctionParameters = $this->arrayKeysToLowercase($this->newFunctionParameters);
|
955 |
|
956 |
+
return array(\T_STRING);
|
957 |
+
}
|
958 |
|
959 |
/**
|
960 |
* Processes this test, when one of its tokens is encountered.
|
961 |
*
|
962 |
+
* @since 7.0.0
|
963 |
+
*
|
964 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
965 |
* @param int $stackPtr The position of the current token in
|
966 |
* the stack passed in $tokens.
|
967 |
*
|
968 |
* @return void
|
969 |
*/
|
970 |
+
public function process(File $phpcsFile, $stackPtr)
|
971 |
{
|
972 |
$tokens = $phpcsFile->getTokens();
|
973 |
|
974 |
$ignore = array(
|
975 |
+
\T_DOUBLE_COLON => true,
|
976 |
+
\T_OBJECT_OPERATOR => true,
|
977 |
+
\T_FUNCTION => true,
|
978 |
+
\T_CONST => true,
|
979 |
);
|
980 |
|
981 |
+
$prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
|
982 |
+
if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
|
983 |
// Not a call to a PHP function.
|
984 |
return;
|
985 |
}
|
997 |
}
|
998 |
|
999 |
// If the parameter count returned > 0, we know there will be valid open parenthesis.
|
1000 |
+
$openParenthesis = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
|
1001 |
$parameterOffsetFound = $parameterCount - 1;
|
1002 |
|
1003 |
foreach ($this->newFunctionParameters[$functionLc] as $offset => $parameterDetails) {
|
1010 |
$this->handleFeature($phpcsFile, $openParenthesis, $itemInfo);
|
1011 |
}
|
1012 |
}
|
1013 |
+
}
|
|
|
1014 |
|
1015 |
|
1016 |
/**
|
1017 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
1018 |
*
|
1019 |
+
* @since 7.1.0
|
1020 |
+
*
|
1021 |
* @param array $itemInfo Base information about the item.
|
1022 |
*
|
1023 |
* @return array Version and other information about the item.
|
1031 |
/**
|
1032 |
* Get an array of the non-PHP-version array keys used in a sub-array.
|
1033 |
*
|
1034 |
+
* @since 7.1.0
|
1035 |
+
*
|
1036 |
* @return array
|
1037 |
*/
|
1038 |
protected function getNonVersionArrayKeys()
|
1044 |
/**
|
1045 |
* Retrieve the relevant detail (version) information for use in an error message.
|
1046 |
*
|
1047 |
+
* @since 7.1.0
|
1048 |
+
*
|
1049 |
* @param array $itemArray Version and other information about the item.
|
1050 |
* @param array $itemInfo Base information about the item.
|
1051 |
*
|
1063 |
/**
|
1064 |
* Get the item name to be used for the creation of the error code.
|
1065 |
*
|
1066 |
+
* @since 7.1.0
|
1067 |
+
*
|
1068 |
* @param array $itemInfo Base information about the item.
|
1069 |
* @param array $errorInfo Detail information about an item.
|
1070 |
*
|
1079 |
/**
|
1080 |
* Get the error message template for this sniff.
|
1081 |
*
|
1082 |
+
* @since 7.1.0
|
1083 |
+
*
|
1084 |
* @return string
|
1085 |
*/
|
1086 |
protected function getErrorMsgTemplate()
|
1092 |
/**
|
1093 |
* Allow for concrete child classes to filter the error data before it's passed to PHPCS.
|
1094 |
*
|
1095 |
+
* @since 7.1.0
|
1096 |
+
*
|
1097 |
* @param array $data The error data array which was created.
|
1098 |
* @param array $itemInfo Base information about the item this error message applies to.
|
1099 |
* @param array $errorInfo Detail information about an item this error message applies to.
|
1106 |
array_unshift($data, $itemInfo['name'], $errorInfo['paramName']);
|
1107 |
return $data;
|
1108 |
}
|
1109 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionUse}/NewFunctionsSniff.php
RENAMED
@@ -1,22 +1,27 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
-
namespace PHPCompatibility\Sniffs\
|
11 |
|
12 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
|
|
13 |
|
14 |
/**
|
15 |
-
*
|
16 |
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* @
|
|
|
|
|
|
|
20 |
*/
|
21 |
class NewFunctionsSniff extends AbstractNewFeatureSniff
|
22 |
{
|
@@ -26,7 +31,14 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
|
|
26 |
* The array lists : version number with false (not present) or true (present).
|
27 |
* If's sufficient to list the first version where the function appears.
|
28 |
*
|
29 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
*/
|
31 |
protected $newFunctions = array(
|
32 |
'iterator_count' => array(
|
@@ -848,10 +860,6 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
|
|
848 |
'5.4' => false,
|
849 |
'5.5' => true,
|
850 |
),
|
851 |
-
'datefmt_get_calendar_object' => array(
|
852 |
-
'5.4' => false,
|
853 |
-
'5.5' => true,
|
854 |
-
),
|
855 |
'intlcal_create_instance' => array(
|
856 |
'5.4' => false,
|
857 |
'5.5' => true,
|
@@ -1116,6 +1124,31 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
|
|
1116 |
'5.4' => false,
|
1117 |
'5.5' => true,
|
1118 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1119 |
|
1120 |
'gmp_root' => array(
|
1121 |
'5.5' => false,
|
@@ -1275,6 +1308,10 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
|
|
1275 |
'7.0' => false,
|
1276 |
'7.1' => true,
|
1277 |
),
|
|
|
|
|
|
|
|
|
1278 |
'session_create_id' => array(
|
1279 |
'7.0' => false,
|
1280 |
'7.1' => true,
|
@@ -1283,7 +1320,27 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
|
|
1283 |
'7.0' => false,
|
1284 |
'7.1' => true,
|
1285 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1286 |
|
|
|
|
|
|
|
|
|
1287 |
'oci_register_taf_callback' => array(
|
1288 |
'7.1.6' => false,
|
1289 |
'7.1.7' => true,
|
@@ -1721,17 +1778,150 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
|
|
1721 |
'7.1' => false,
|
1722 |
'7.2' => true,
|
1723 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1724 |
|
|
|
|
|
|
|
|
|
1725 |
'is_countable' => array(
|
1726 |
'7.2' => false,
|
1727 |
'7.3' => true,
|
1728 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1729 |
);
|
1730 |
|
1731 |
|
1732 |
/**
|
1733 |
* Returns an array of tokens this test wants to listen for.
|
1734 |
*
|
|
|
|
|
1735 |
* @return array
|
1736 |
*/
|
1737 |
public function register()
|
@@ -1739,36 +1929,37 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
|
|
1739 |
// Handle case-insensitivity of function names.
|
1740 |
$this->newFunctions = $this->arrayKeysToLowercase($this->newFunctions);
|
1741 |
|
1742 |
-
return array(T_STRING);
|
1743 |
-
|
1744 |
-
}//end register()
|
1745 |
|
1746 |
/**
|
1747 |
* Processes this test, when one of its tokens is encountered.
|
1748 |
*
|
|
|
|
|
1749 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1750 |
* @param int $stackPtr The position of the current token in
|
1751 |
* the stack passed in $tokens.
|
1752 |
*
|
1753 |
* @return void
|
1754 |
*/
|
1755 |
-
public function process(
|
1756 |
{
|
1757 |
$tokens = $phpcsFile->getTokens();
|
1758 |
|
1759 |
$ignore = array(
|
1760 |
-
T_DOUBLE_COLON,
|
1761 |
-
T_OBJECT_OPERATOR,
|
1762 |
-
T_FUNCTION,
|
1763 |
-
T_CONST,
|
1764 |
);
|
1765 |
|
1766 |
-
$prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
|
1767 |
-
if (
|
1768 |
// Not a call to a PHP function.
|
1769 |
return;
|
1770 |
|
1771 |
-
} elseif ($tokens[$prevToken]['code'] === T_NS_SEPARATOR && $tokens[$prevToken - 1]['code'] === T_STRING) {
|
1772 |
// Namespaced function.
|
1773 |
return;
|
1774 |
}
|
@@ -1785,13 +1976,14 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
|
|
1785 |
'nameLc' => $functionLc,
|
1786 |
);
|
1787 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
1788 |
-
|
1789 |
-
}//end process()
|
1790 |
|
1791 |
|
1792 |
/**
|
1793 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
1794 |
*
|
|
|
|
|
1795 |
* @param array $itemInfo Base information about the item.
|
1796 |
*
|
1797 |
* @return array Version and other information about the item.
|
@@ -1805,12 +1997,12 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
|
|
1805 |
/**
|
1806 |
* Get the error message template for this sniff.
|
1807 |
*
|
|
|
|
|
1808 |
* @return string
|
1809 |
*/
|
1810 |
protected function getErrorMsgTemplate()
|
1811 |
{
|
1812 |
return 'The function %s() is not present in PHP version %s or earlier';
|
1813 |
}
|
1814 |
-
|
1815 |
-
|
1816 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionUse;
|
12 |
|
13 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
17 |
+
* Detect calls to new native PHP functions.
|
18 |
*
|
19 |
+
* PHP version All
|
20 |
+
*
|
21 |
+
* @since 5.5
|
22 |
+
* @since 5.6 Now extends the base `Sniff` class instead of the upstream
|
23 |
+
* `Generic.PHP.ForbiddenFunctions` sniff.
|
24 |
+
* @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class..
|
25 |
*/
|
26 |
class NewFunctionsSniff extends AbstractNewFeatureSniff
|
27 |
{
|
31 |
* The array lists : version number with false (not present) or true (present).
|
32 |
* If's sufficient to list the first version where the function appears.
|
33 |
*
|
34 |
+
* @since 5.5
|
35 |
+
* @since 5.6 Visibility changed from `protected` to `public`.
|
36 |
+
* @since 7.0.2 Visibility changed back from `public` to `protected`.
|
37 |
+
* The earlier change was made to be in line with the upstream sniff,
|
38 |
+
* but that sniff is no longer being extended.
|
39 |
+
* @since 7.0.8 Renamed from `$forbiddenFunctions` to the more descriptive `$newFunctions`.
|
40 |
+
*
|
41 |
+
* @var array(string => array(string => bool))
|
42 |
*/
|
43 |
protected $newFunctions = array(
|
44 |
'iterator_count' => array(
|
860 |
'5.4' => false,
|
861 |
'5.5' => true,
|
862 |
),
|
|
|
|
|
|
|
|
|
863 |
'intlcal_create_instance' => array(
|
864 |
'5.4' => false,
|
865 |
'5.5' => true,
|
1124 |
'5.4' => false,
|
1125 |
'5.5' => true,
|
1126 |
),
|
1127 |
+
'opcache_compile_file' => array(
|
1128 |
+
'5.4' => false,
|
1129 |
+
'5.5' => true,
|
1130 |
+
),
|
1131 |
+
'opcache_get_configuration' => array(
|
1132 |
+
'5.4' => false,
|
1133 |
+
'5.5' => true,
|
1134 |
+
),
|
1135 |
+
'opcache_get_status' => array(
|
1136 |
+
'5.4' => false,
|
1137 |
+
'5.5' => true,
|
1138 |
+
),
|
1139 |
+
'opcache_invalidate' => array(
|
1140 |
+
'5.4' => false,
|
1141 |
+
'5.5' => true,
|
1142 |
+
),
|
1143 |
+
'opcache_reset' => array(
|
1144 |
+
'5.4' => false,
|
1145 |
+
'5.5' => true,
|
1146 |
+
),
|
1147 |
+
|
1148 |
+
'opcache_is_script_cached' => array(
|
1149 |
+
'5.5.10' => false,
|
1150 |
+
'5.5.11' => true,
|
1151 |
+
),
|
1152 |
|
1153 |
'gmp_root' => array(
|
1154 |
'5.5' => false,
|
1308 |
'7.0' => false,
|
1309 |
'7.1' => true,
|
1310 |
),
|
1311 |
+
'pcntl_signal_get_handler' => array(
|
1312 |
+
'7.0' => false,
|
1313 |
+
'7.1' => true,
|
1314 |
+
),
|
1315 |
'session_create_id' => array(
|
1316 |
'7.0' => false,
|
1317 |
'7.1' => true,
|
1320 |
'7.0' => false,
|
1321 |
'7.1' => true,
|
1322 |
),
|
1323 |
+
'sapi_windows_cp_set' => array(
|
1324 |
+
'7.0' => false,
|
1325 |
+
'7.1' => true,
|
1326 |
+
),
|
1327 |
+
'sapi_windows_cp_get' => array(
|
1328 |
+
'7.0' => false,
|
1329 |
+
'7.1' => true,
|
1330 |
+
),
|
1331 |
+
'sapi_windows_cp_is_utf8' => array(
|
1332 |
+
'7.0' => false,
|
1333 |
+
'7.1' => true,
|
1334 |
+
),
|
1335 |
+
'sapi_windows_cp_conv' => array(
|
1336 |
+
'7.0' => false,
|
1337 |
+
'7.1' => true,
|
1338 |
+
),
|
1339 |
|
1340 |
+
'hash_hkdf' => array(
|
1341 |
+
'7.1.1' => false,
|
1342 |
+
'7.1.2' => true,
|
1343 |
+
),
|
1344 |
'oci_register_taf_callback' => array(
|
1345 |
'7.1.6' => false,
|
1346 |
'7.1.7' => true,
|
1778 |
'7.1' => false,
|
1779 |
'7.2' => true,
|
1780 |
),
|
1781 |
+
// Introduced in 7.2.14 and 7.3.1 simultanously.
|
1782 |
+
'oci_set_call_timeout' => array(
|
1783 |
+
'7.2.13' => false,
|
1784 |
+
'7.2.14' => true,
|
1785 |
+
),
|
1786 |
+
// Introduced in 7.2.14 and 7.3.1 simultanously.
|
1787 |
+
'oci_set_db_operation' => array(
|
1788 |
+
'7.2.13' => false,
|
1789 |
+
'7.2.14' => true,
|
1790 |
+
),
|
1791 |
|
1792 |
+
'hrtime' => array(
|
1793 |
+
'7.2' => false,
|
1794 |
+
'7.3' => true,
|
1795 |
+
),
|
1796 |
'is_countable' => array(
|
1797 |
'7.2' => false,
|
1798 |
'7.3' => true,
|
1799 |
),
|
1800 |
+
'array_key_first' => array(
|
1801 |
+
'7.2' => false,
|
1802 |
+
'7.3' => true,
|
1803 |
+
),
|
1804 |
+
'array_key_last' => array(
|
1805 |
+
'7.2' => false,
|
1806 |
+
'7.3' => true,
|
1807 |
+
),
|
1808 |
+
'fpm_get_status' => array(
|
1809 |
+
'7.2' => false,
|
1810 |
+
'7.3' => true,
|
1811 |
+
),
|
1812 |
+
'net_get_interfaces' => array(
|
1813 |
+
'7.2' => false,
|
1814 |
+
'7.3' => true,
|
1815 |
+
),
|
1816 |
+
'gmp_binomial' => array(
|
1817 |
+
'7.2' => false,
|
1818 |
+
'7.3' => true,
|
1819 |
+
),
|
1820 |
+
'gmp_lcm' => array(
|
1821 |
+
'7.2' => false,
|
1822 |
+
'7.3' => true,
|
1823 |
+
),
|
1824 |
+
'gmp_perfect_power' => array(
|
1825 |
+
'7.2' => false,
|
1826 |
+
'7.3' => true,
|
1827 |
+
),
|
1828 |
+
'gmp_kronecker' => array(
|
1829 |
+
'7.2' => false,
|
1830 |
+
'7.3' => true,
|
1831 |
+
),
|
1832 |
+
'ldap_add_ext' => array(
|
1833 |
+
'7.2' => false,
|
1834 |
+
'7.3' => true,
|
1835 |
+
),
|
1836 |
+
'ldap_bind_ext' => array(
|
1837 |
+
'7.2' => false,
|
1838 |
+
'7.3' => true,
|
1839 |
+
),
|
1840 |
+
'ldap_delete_ext' => array(
|
1841 |
+
'7.2' => false,
|
1842 |
+
'7.3' => true,
|
1843 |
+
),
|
1844 |
+
'ldap_exop_refresh' => array(
|
1845 |
+
'7.2' => false,
|
1846 |
+
'7.3' => true,
|
1847 |
+
),
|
1848 |
+
'ldap_mod_add_ext' => array(
|
1849 |
+
'7.2' => false,
|
1850 |
+
'7.3' => true,
|
1851 |
+
),
|
1852 |
+
'ldap_mod_replace_ext' => array(
|
1853 |
+
'7.2' => false,
|
1854 |
+
'7.3' => true,
|
1855 |
+
),
|
1856 |
+
'ldap_mod_del_ext' => array(
|
1857 |
+
'7.2' => false,
|
1858 |
+
'7.3' => true,
|
1859 |
+
),
|
1860 |
+
'ldap_rename_ext' => array(
|
1861 |
+
'7.2' => false,
|
1862 |
+
'7.3' => true,
|
1863 |
+
),
|
1864 |
+
'normalizer_get_raw_decomposition' => array(
|
1865 |
+
'7.2' => false,
|
1866 |
+
'7.3' => true,
|
1867 |
+
),
|
1868 |
+
'openssl_pkey_derive' => array(
|
1869 |
+
'7.2' => false,
|
1870 |
+
'7.3' => true,
|
1871 |
+
),
|
1872 |
+
'socket_wsaprotocol_info_export' => array(
|
1873 |
+
'7.2' => false,
|
1874 |
+
'7.3' => true,
|
1875 |
+
),
|
1876 |
+
'socket_wsaprotocol_info_import' => array(
|
1877 |
+
'7.2' => false,
|
1878 |
+
'7.3' => true,
|
1879 |
+
),
|
1880 |
+
'socket_wsaprotocol_info_release' => array(
|
1881 |
+
'7.2' => false,
|
1882 |
+
'7.3' => true,
|
1883 |
+
),
|
1884 |
+
|
1885 |
+
'get_mangled_object_vars' => array(
|
1886 |
+
'7.3' => false,
|
1887 |
+
'7.4' => true,
|
1888 |
+
),
|
1889 |
+
'imagecreatefromtga' => array(
|
1890 |
+
'7.3' => false,
|
1891 |
+
'7.4' => true,
|
1892 |
+
),
|
1893 |
+
'mb_str_split' => array(
|
1894 |
+
'7.3' => false,
|
1895 |
+
'7.4' => true,
|
1896 |
+
),
|
1897 |
+
'openssl_x509_verify' => array(
|
1898 |
+
'7.3' => false,
|
1899 |
+
'7.4' => true,
|
1900 |
+
),
|
1901 |
+
'password_algos' => array(
|
1902 |
+
'7.3' => false,
|
1903 |
+
'7.4' => true,
|
1904 |
+
),
|
1905 |
+
'pcntl_unshare' => array(
|
1906 |
+
'7.3' => false,
|
1907 |
+
'7.4' => true,
|
1908 |
+
),
|
1909 |
+
'sapi_windows_set_ctrl_handler' => array(
|
1910 |
+
'7.3' => false,
|
1911 |
+
'7.4' => true,
|
1912 |
+
),
|
1913 |
+
'sapi_windows_generate_ctrl_event' => array(
|
1914 |
+
'7.3' => false,
|
1915 |
+
'7.4' => true,
|
1916 |
+
),
|
1917 |
);
|
1918 |
|
1919 |
|
1920 |
/**
|
1921 |
* Returns an array of tokens this test wants to listen for.
|
1922 |
*
|
1923 |
+
* @since 5.6
|
1924 |
+
*
|
1925 |
* @return array
|
1926 |
*/
|
1927 |
public function register()
|
1929 |
// Handle case-insensitivity of function names.
|
1930 |
$this->newFunctions = $this->arrayKeysToLowercase($this->newFunctions);
|
1931 |
|
1932 |
+
return array(\T_STRING);
|
1933 |
+
}
|
|
|
1934 |
|
1935 |
/**
|
1936 |
* Processes this test, when one of its tokens is encountered.
|
1937 |
*
|
1938 |
+
* @since 5.5
|
1939 |
+
*
|
1940 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1941 |
* @param int $stackPtr The position of the current token in
|
1942 |
* the stack passed in $tokens.
|
1943 |
*
|
1944 |
* @return void
|
1945 |
*/
|
1946 |
+
public function process(File $phpcsFile, $stackPtr)
|
1947 |
{
|
1948 |
$tokens = $phpcsFile->getTokens();
|
1949 |
|
1950 |
$ignore = array(
|
1951 |
+
\T_DOUBLE_COLON => true,
|
1952 |
+
\T_OBJECT_OPERATOR => true,
|
1953 |
+
\T_FUNCTION => true,
|
1954 |
+
\T_CONST => true,
|
1955 |
);
|
1956 |
|
1957 |
+
$prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
|
1958 |
+
if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
|
1959 |
// Not a call to a PHP function.
|
1960 |
return;
|
1961 |
|
1962 |
+
} elseif ($tokens[$prevToken]['code'] === \T_NS_SEPARATOR && $tokens[$prevToken - 1]['code'] === \T_STRING) {
|
1963 |
// Namespaced function.
|
1964 |
return;
|
1965 |
}
|
1976 |
'nameLc' => $functionLc,
|
1977 |
);
|
1978 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
1979 |
+
}
|
|
|
1980 |
|
1981 |
|
1982 |
/**
|
1983 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
1984 |
*
|
1985 |
+
* @since 7.1.0
|
1986 |
+
*
|
1987 |
* @param array $itemInfo Base information about the item.
|
1988 |
*
|
1989 |
* @return array Version and other information about the item.
|
1997 |
/**
|
1998 |
* Get the error message template for this sniff.
|
1999 |
*
|
2000 |
+
* @since 7.1.0
|
2001 |
+
*
|
2002 |
* @return string
|
2003 |
*/
|
2004 |
protected function getErrorMsgTemplate()
|
2005 |
{
|
2006 |
return 'The function %s() is not present in PHP version %s or earlier';
|
2007 |
}
|
2008 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/OptionalRequiredFunctionParametersSniff.php → FunctionUse/OptionalToRequiredFunctionParametersSniff.php}
RENAMED
@@ -1,24 +1,31 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
-
namespace PHPCompatibility\Sniffs\
|
11 |
|
12 |
-
use PHPCompatibility\Sniffs\
|
|
|
13 |
|
14 |
/**
|
15 |
-
*
|
16 |
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
|
|
|
|
|
|
|
|
|
|
20 |
*/
|
21 |
-
class
|
22 |
{
|
23 |
|
24 |
/**
|
@@ -29,6 +36,8 @@ class OptionalRequiredFunctionParametersSniff extends RequiredOptionalFunctionPa
|
|
29 |
* The index is the location of the parameter in the parameter list, starting at 0 !
|
30 |
* If's sufficient to list the last version in which the parameter was not yet required.
|
31 |
*
|
|
|
|
|
32 |
* @var array
|
33 |
*/
|
34 |
protected $functionParameters = array(
|
@@ -52,6 +61,8 @@ class OptionalRequiredFunctionParametersSniff extends RequiredOptionalFunctionPa
|
|
52 |
/**
|
53 |
* Determine whether an error/warning should be thrown for an item based on collected information.
|
54 |
*
|
|
|
|
|
55 |
* @param array $errorInfo Detail information about an item.
|
56 |
*
|
57 |
* @return bool
|
@@ -67,6 +78,8 @@ class OptionalRequiredFunctionParametersSniff extends RequiredOptionalFunctionPa
|
|
67 |
/**
|
68 |
* Retrieve the relevant detail (version) information for use in an error message.
|
69 |
*
|
|
|
|
|
70 |
* @param array $itemArray Version and other information about the item.
|
71 |
* @param array $itemInfo Base information about the item.
|
72 |
*
|
@@ -102,13 +115,14 @@ class OptionalRequiredFunctionParametersSniff extends RequiredOptionalFunctionPa
|
|
102 |
$errorInfo['paramName'] = $itemArray['name'];
|
103 |
|
104 |
return $errorInfo;
|
105 |
-
|
106 |
-
}//end getErrorInfo()
|
107 |
|
108 |
|
109 |
/**
|
110 |
* Generates the error or warning for this item.
|
111 |
*
|
|
|
|
|
112 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
113 |
* @param int $stackPtr The position of the relevant token in
|
114 |
* the stack.
|
@@ -118,7 +132,7 @@ class OptionalRequiredFunctionParametersSniff extends RequiredOptionalFunctionPa
|
|
118 |
*
|
119 |
* @return void
|
120 |
*/
|
121 |
-
public function addError(
|
122 |
{
|
123 |
$error = 'The "%s" parameter for function %s() is missing. Passing this parameter is ';
|
124 |
if ($errorInfo['optionalRecommended'] === '') {
|
@@ -151,12 +165,9 @@ class OptionalRequiredFunctionParametersSniff extends RequiredOptionalFunctionPa
|
|
151 |
}
|
152 |
|
153 |
// Remove the last 'and' from the message.
|
154 |
-
$error = substr($error, 0, (strlen($error) - 5));
|
155 |
}
|
156 |
|
157 |
$this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data);
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionUse;
|
12 |
|
13 |
+
use PHPCompatibility\Sniffs\FunctionUse\RequiredToOptionalFunctionParametersSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
17 |
+
* Detect missing required function parameters in calls to native PHP functions.
|
18 |
*
|
19 |
+
* Specifically when those function parameters used to be optional in older PHP versions.
|
20 |
+
*
|
21 |
+
* PHP version All
|
22 |
+
*
|
23 |
+
* @link https://www.php.net/manual/en/doc.changelog.php
|
24 |
+
*
|
25 |
+
* @since 8.1.0
|
26 |
+
* @since 9.0.0 Renamed from `OptionalRequiredFunctionParametersSniff` to `OptionalToRequiredFunctionParametersSniff`.
|
27 |
*/
|
28 |
+
class OptionalToRequiredFunctionParametersSniff extends RequiredToOptionalFunctionParametersSniff
|
29 |
{
|
30 |
|
31 |
/**
|
36 |
* The index is the location of the parameter in the parameter list, starting at 0 !
|
37 |
* If's sufficient to list the last version in which the parameter was not yet required.
|
38 |
*
|
39 |
+
* @since 8.1.0
|
40 |
+
*
|
41 |
* @var array
|
42 |
*/
|
43 |
protected $functionParameters = array(
|
61 |
/**
|
62 |
* Determine whether an error/warning should be thrown for an item based on collected information.
|
63 |
*
|
64 |
+
* @since 8.1.0
|
65 |
+
*
|
66 |
* @param array $errorInfo Detail information about an item.
|
67 |
*
|
68 |
* @return bool
|
78 |
/**
|
79 |
* Retrieve the relevant detail (version) information for use in an error message.
|
80 |
*
|
81 |
+
* @since 8.1.0
|
82 |
+
*
|
83 |
* @param array $itemArray Version and other information about the item.
|
84 |
* @param array $itemInfo Base information about the item.
|
85 |
*
|
115 |
$errorInfo['paramName'] = $itemArray['name'];
|
116 |
|
117 |
return $errorInfo;
|
118 |
+
}
|
|
|
119 |
|
120 |
|
121 |
/**
|
122 |
* Generates the error or warning for this item.
|
123 |
*
|
124 |
+
* @since 8.1.0
|
125 |
+
*
|
126 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
127 |
* @param int $stackPtr The position of the relevant token in
|
128 |
* the stack.
|
132 |
*
|
133 |
* @return void
|
134 |
*/
|
135 |
+
public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
|
136 |
{
|
137 |
$error = 'The "%s" parameter for function %s() is missing. Passing this parameter is ';
|
138 |
if ($errorInfo['optionalRecommended'] === '') {
|
165 |
}
|
166 |
|
167 |
// Remove the last 'and' from the message.
|
168 |
+
$error = substr($error, 0, (\strlen($error) - 5));
|
169 |
}
|
170 |
|
171 |
$this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data);
|
172 |
+
}
|
173 |
+
}
|
|
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → FunctionUse}/RemovedFunctionParametersSniff.php
RENAMED
@@ -1,22 +1,28 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
-
namespace PHPCompatibility\Sniffs\
|
11 |
|
12 |
use PHPCompatibility\AbstractRemovedFeatureSniff;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
-
*
|
16 |
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* @
|
|
|
|
|
|
|
20 |
*/
|
21 |
class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
|
22 |
{
|
@@ -27,9 +33,30 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
|
|
27 |
* The index is the location of the parameter in the parameter list, starting at 0 !
|
28 |
* If's sufficient to list the first version where the function parameter was deprecated/removed.
|
29 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
* @var array
|
31 |
*/
|
32 |
protected $removedFunctionParameters = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
'gmmktime' => array(
|
34 |
6 => array(
|
35 |
'name' => 'is_dst',
|
@@ -62,6 +89,8 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
|
|
62 |
/**
|
63 |
* Returns an array of tokens this test wants to listen for.
|
64 |
*
|
|
|
|
|
65 |
* @return array
|
66 |
*/
|
67 |
public function register()
|
@@ -69,31 +98,33 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
|
|
69 |
// Handle case-insensitivity of function names.
|
70 |
$this->removedFunctionParameters = $this->arrayKeysToLowercase($this->removedFunctionParameters);
|
71 |
|
72 |
-
return array(T_STRING);
|
73 |
-
}
|
74 |
|
75 |
/**
|
76 |
* Processes this test, when one of its tokens is encountered.
|
77 |
*
|
|
|
|
|
78 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
79 |
* @param int $stackPtr The position of the current token in
|
80 |
* the stack passed in $tokens.
|
81 |
*
|
82 |
* @return void
|
83 |
*/
|
84 |
-
public function process(
|
85 |
{
|
86 |
$tokens = $phpcsFile->getTokens();
|
87 |
|
88 |
$ignore = array(
|
89 |
-
T_DOUBLE_COLON,
|
90 |
-
T_OBJECT_OPERATOR,
|
91 |
-
T_FUNCTION,
|
92 |
-
T_CONST,
|
93 |
);
|
94 |
|
95 |
-
$prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
|
96 |
-
if (
|
97 |
// Not a call to a PHP function.
|
98 |
return;
|
99 |
}
|
@@ -105,17 +136,24 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
|
|
105 |
return;
|
106 |
}
|
107 |
|
108 |
-
$
|
|
|
109 |
if ($parameterCount === 0) {
|
110 |
return;
|
111 |
}
|
112 |
|
113 |
// If the parameter count returned > 0, we know there will be valid open parenthesis.
|
114 |
-
$openParenthesis = $phpcsFile->findNext(
|
115 |
$parameterOffsetFound = $parameterCount - 1;
|
116 |
|
117 |
foreach ($this->removedFunctionParameters[$functionLc] as $offset => $parameterDetails) {
|
118 |
if ($offset <= $parameterOffsetFound) {
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
$itemInfo = array(
|
120 |
'name' => $function,
|
121 |
'nameLc' => $functionLc,
|
@@ -124,13 +162,14 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
|
|
124 |
$this->handleFeature($phpcsFile, $openParenthesis, $itemInfo);
|
125 |
}
|
126 |
}
|
127 |
-
|
128 |
-
}//end process()
|
129 |
|
130 |
|
131 |
/**
|
132 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
133 |
*
|
|
|
|
|
134 |
* @param array $itemInfo Base information about the item.
|
135 |
*
|
136 |
* @return array Version and other information about the item.
|
@@ -144,17 +183,21 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
|
|
144 |
/**
|
145 |
* Get an array of the non-PHP-version array keys used in a sub-array.
|
146 |
*
|
|
|
|
|
147 |
* @return array
|
148 |
*/
|
149 |
protected function getNonVersionArrayKeys()
|
150 |
{
|
151 |
-
return array('name');
|
152 |
}
|
153 |
|
154 |
|
155 |
/**
|
156 |
* Retrieve the relevant detail (version) information for use in an error message.
|
157 |
*
|
|
|
|
|
158 |
* @param array $itemArray Version and other information about the item.
|
159 |
* @param array $itemInfo Base information about the item.
|
160 |
*
|
@@ -172,6 +215,8 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
|
|
172 |
/**
|
173 |
* Get the item name to be used for the creation of the error code.
|
174 |
*
|
|
|
|
|
175 |
* @param array $itemInfo Base information about the item.
|
176 |
* @param array $errorInfo Detail information about an item.
|
177 |
*
|
@@ -186,6 +231,8 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
|
|
186 |
/**
|
187 |
* Get the error message template for this sniff.
|
188 |
*
|
|
|
|
|
189 |
* @return string
|
190 |
*/
|
191 |
protected function getErrorMsgTemplate()
|
@@ -197,6 +244,8 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
|
|
197 |
/**
|
198 |
* Filter the error data before it's passed to PHPCS.
|
199 |
*
|
|
|
|
|
200 |
* @param array $data The error data array which was created.
|
201 |
* @param array $itemInfo Base information about the item this error message applies to.
|
202 |
* @param array $errorInfo Detail information about an item this error message applies to.
|
@@ -210,5 +259,34 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
|
|
210 |
return $data;
|
211 |
}
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
|
214 |
-
|
|
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionUse;
|
12 |
|
13 |
use PHPCompatibility\AbstractRemovedFeatureSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
|
17 |
/**
|
18 |
+
* Detect use of deprecated/removed function parameters in calls to native PHP functions.
|
19 |
*
|
20 |
+
* PHP version All
|
21 |
+
*
|
22 |
+
* @link https://www.php.net/manual/en/doc.changelog.php
|
23 |
+
*
|
24 |
+
* @since 7.0.0
|
25 |
+
* @since 7.1.0 Now extends the `AbstractRemovedFeatureSniff` instead of the base `Sniff` class.
|
26 |
*/
|
27 |
class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
|
28 |
{
|
33 |
* The index is the location of the parameter in the parameter list, starting at 0 !
|
34 |
* If's sufficient to list the first version where the function parameter was deprecated/removed.
|
35 |
*
|
36 |
+
* The optional `callback` key can be used to pass a method name which should be called for an
|
37 |
+
* additional check. The method will be passed the parameter info and should return true
|
38 |
+
* if the notice should be thrown or false otherwise.
|
39 |
+
*
|
40 |
+
* @since 7.0.0
|
41 |
+
* @since 7.0.2 Visibility changed from `public` to `protected`.
|
42 |
+
* @since 9.3.0 Optional `callback` key.
|
43 |
+
*
|
44 |
* @var array
|
45 |
*/
|
46 |
protected $removedFunctionParameters = array(
|
47 |
+
'curl_version' => array(
|
48 |
+
0 => array(
|
49 |
+
'name' => 'age',
|
50 |
+
'7.4' => false,
|
51 |
+
'callback' => 'curlVersionInvalidValue',
|
52 |
+
),
|
53 |
+
),
|
54 |
+
'define' => array(
|
55 |
+
2 => array(
|
56 |
+
'name' => 'case_insensitive',
|
57 |
+
'7.3' => false, // Slated for removal in PHP 8.0.0.
|
58 |
+
),
|
59 |
+
),
|
60 |
'gmmktime' => array(
|
61 |
6 => array(
|
62 |
'name' => 'is_dst',
|
89 |
/**
|
90 |
* Returns an array of tokens this test wants to listen for.
|
91 |
*
|
92 |
+
* @since 7.0.0
|
93 |
+
*
|
94 |
* @return array
|
95 |
*/
|
96 |
public function register()
|
98 |
// Handle case-insensitivity of function names.
|
99 |
$this->removedFunctionParameters = $this->arrayKeysToLowercase($this->removedFunctionParameters);
|
100 |
|
101 |
+
return array(\T_STRING);
|
102 |
+
}
|
103 |
|
104 |
/**
|
105 |
* Processes this test, when one of its tokens is encountered.
|
106 |
*
|
107 |
+
* @since 7.0.0
|
108 |
+
*
|
109 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
110 |
* @param int $stackPtr The position of the current token in
|
111 |
* the stack passed in $tokens.
|
112 |
*
|
113 |
* @return void
|
114 |
*/
|
115 |
+
public function process(File $phpcsFile, $stackPtr)
|
116 |
{
|
117 |
$tokens = $phpcsFile->getTokens();
|
118 |
|
119 |
$ignore = array(
|
120 |
+
\T_DOUBLE_COLON => true,
|
121 |
+
\T_OBJECT_OPERATOR => true,
|
122 |
+
\T_FUNCTION => true,
|
123 |
+
\T_CONST => true,
|
124 |
);
|
125 |
|
126 |
+
$prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
|
127 |
+
if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
|
128 |
// Not a call to a PHP function.
|
129 |
return;
|
130 |
}
|
136 |
return;
|
137 |
}
|
138 |
|
139 |
+
$parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr);
|
140 |
+
$parameterCount = \count($parameters);
|
141 |
if ($parameterCount === 0) {
|
142 |
return;
|
143 |
}
|
144 |
|
145 |
// If the parameter count returned > 0, we know there will be valid open parenthesis.
|
146 |
+
$openParenthesis = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
|
147 |
$parameterOffsetFound = $parameterCount - 1;
|
148 |
|
149 |
foreach ($this->removedFunctionParameters[$functionLc] as $offset => $parameterDetails) {
|
150 |
if ($offset <= $parameterOffsetFound) {
|
151 |
+
if (isset($parameterDetails['callback']) && method_exists($this, $parameterDetails['callback'])) {
|
152 |
+
if ($this->{$parameterDetails['callback']}($phpcsFile, $parameters[($offset + 1)]) === false) {
|
153 |
+
continue;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
$itemInfo = array(
|
158 |
'name' => $function,
|
159 |
'nameLc' => $functionLc,
|
162 |
$this->handleFeature($phpcsFile, $openParenthesis, $itemInfo);
|
163 |
}
|
164 |
}
|
165 |
+
}
|
|
|
166 |
|
167 |
|
168 |
/**
|
169 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
170 |
*
|
171 |
+
* @since 7.1.0
|
172 |
+
*
|
173 |
* @param array $itemInfo Base information about the item.
|
174 |
*
|
175 |
* @return array Version and other information about the item.
|
183 |
/**
|
184 |
* Get an array of the non-PHP-version array keys used in a sub-array.
|
185 |
*
|
186 |
+
* @since 7.1.0
|
187 |
+
*
|
188 |
* @return array
|
189 |
*/
|
190 |
protected function getNonVersionArrayKeys()
|
191 |
{
|
192 |
+
return array('name', 'callback');
|
193 |
}
|
194 |
|
195 |
|
196 |
/**
|
197 |
* Retrieve the relevant detail (version) information for use in an error message.
|
198 |
*
|
199 |
+
* @since 7.1.0
|
200 |
+
*
|
201 |
* @param array $itemArray Version and other information about the item.
|
202 |
* @param array $itemInfo Base information about the item.
|
203 |
*
|
215 |
/**
|
216 |
* Get the item name to be used for the creation of the error code.
|
217 |
*
|
218 |
+
* @since 7.1.0
|
219 |
+
*
|
220 |
* @param array $itemInfo Base information about the item.
|
221 |
* @param array $errorInfo Detail information about an item.
|
222 |
*
|
231 |
/**
|
232 |
* Get the error message template for this sniff.
|
233 |
*
|
234 |
+
* @since 7.1.0
|
235 |
+
*
|
236 |
* @return string
|
237 |
*/
|
238 |
protected function getErrorMsgTemplate()
|
244 |
/**
|
245 |
* Filter the error data before it's passed to PHPCS.
|
246 |
*
|
247 |
+
* @since 7.1.0
|
248 |
+
*
|
249 |
* @param array $data The error data array which was created.
|
250 |
* @param array $itemInfo Base information about the item this error message applies to.
|
251 |
* @param array $errorInfo Detail information about an item this error message applies to.
|
259 |
return $data;
|
260 |
}
|
261 |
|
262 |
+
/**
|
263 |
+
* Check whether curl_version() was passed the default CURLVERSION_NOW.
|
264 |
+
*
|
265 |
+
* @since 9.3.0
|
266 |
+
*
|
267 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
268 |
+
* @param array $parameter Parameter info array.
|
269 |
+
*
|
270 |
+
* @return bool True if the value was not CURLVERSION_NOW, false otherwise.
|
271 |
+
*/
|
272 |
+
protected function curlVersionInvalidValue(File $phpcsFile, array $parameter)
|
273 |
+
{
|
274 |
+
$tokens = $phpcsFile->getTokens();
|
275 |
+
$raw = '';
|
276 |
+
for ($i = $parameter['start']; $i <= $parameter['end']; $i++) {
|
277 |
+
if (isset(Tokens::$emptyTokens[$tokens[$i]['code']])) {
|
278 |
+
continue;
|
279 |
+
}
|
280 |
+
|
281 |
+
$raw .= $tokens[$i]['content'];
|
282 |
+
}
|
283 |
+
|
284 |
+
if ($raw !== 'CURLVERSION_NOW'
|
285 |
+
&& $raw !== (string) \CURLVERSION_NOW
|
286 |
+
) {
|
287 |
+
return true;
|
288 |
+
}
|
289 |
|
290 |
+
return false;
|
291 |
+
}
|
292 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/DeprecatedFunctionsSniff.php → FunctionUse/RemovedFunctionsSniff.php}
RENAMED
@@ -1,24 +1,32 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
-
namespace PHPCompatibility\Sniffs\
|
11 |
|
12 |
use PHPCompatibility\AbstractRemovedFeatureSniff;
|
|
|
13 |
|
14 |
/**
|
15 |
-
*
|
16 |
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
*/
|
21 |
-
class
|
22 |
{
|
23 |
/**
|
24 |
* A list of deprecated and removed functions with their alternatives.
|
@@ -26,6 +34,13 @@ class DeprecatedFunctionsSniff extends AbstractRemovedFeatureSniff
|
|
26 |
* The array lists : version number with false (deprecated) or true (removed) and an alternative function.
|
27 |
* If no alternative exists, it is NULL, i.e, the function should just not be used.
|
28 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
* @var array(string => array(string => bool|string|null))
|
30 |
*/
|
31 |
protected $removedFunctions = array(
|
@@ -33,65 +48,64 @@ class DeprecatedFunctionsSniff extends AbstractRemovedFeatureSniff
|
|
33 |
'5.0.5' => true,
|
34 |
'alternative' => null,
|
35 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
'call_user_method' => array(
|
37 |
'5.3' => false,
|
38 |
-
'5.4' => false,
|
39 |
-
'5.5' => false,
|
40 |
-
'5.6' => false,
|
41 |
'7.0' => true,
|
42 |
'alternative' => 'call_user_func()',
|
43 |
),
|
44 |
'call_user_method_array' => array(
|
45 |
'5.3' => false,
|
46 |
-
'5.4' => false,
|
47 |
-
'5.5' => false,
|
48 |
-
'5.6' => false,
|
49 |
'7.0' => true,
|
50 |
'alternative' => 'call_user_func_array()',
|
51 |
),
|
52 |
'define_syslog_variables' => array(
|
53 |
'5.3' => false,
|
54 |
'5.4' => true,
|
55 |
-
'5.5' => true,
|
56 |
-
'5.6' => true,
|
57 |
'alternative' => null,
|
58 |
),
|
59 |
'dl' => array(
|
60 |
'5.3' => false,
|
61 |
-
'5.4' => false,
|
62 |
-
'5.5' => false,
|
63 |
-
'5.6' => false,
|
64 |
'alternative' => null,
|
65 |
),
|
66 |
'ereg' => array(
|
67 |
'5.3' => false,
|
68 |
-
'5.4' => false,
|
69 |
-
'5.5' => false,
|
70 |
-
'5.6' => false,
|
71 |
'7.0' => true,
|
72 |
'alternative' => 'preg_match()',
|
73 |
),
|
74 |
'ereg_replace' => array(
|
75 |
'5.3' => false,
|
76 |
-
'5.4' => false,
|
77 |
-
'5.5' => false,
|
78 |
-
'5.6' => false,
|
79 |
'7.0' => true,
|
80 |
'alternative' => 'preg_replace()',
|
81 |
),
|
82 |
'eregi' => array(
|
83 |
'5.3' => false,
|
84 |
-
'5.4' => false,
|
85 |
-
'5.5' => false,
|
86 |
-
'5.6' => false,
|
87 |
'7.0' => true,
|
88 |
'alternative' => 'preg_match()',
|
89 |
),
|
90 |
'eregi_replace' => array(
|
91 |
'5.3' => false,
|
92 |
-
'5.4' => false,
|
93 |
-
'5.5' => false,
|
94 |
-
'5.6' => false,
|
95 |
'7.0' => true,
|
96 |
'alternative' => 'preg_replace()',
|
97 |
),
|
@@ -134,495 +148,339 @@ class DeprecatedFunctionsSniff extends AbstractRemovedFeatureSniff
|
|
134 |
),
|
135 |
'mcrypt_generic_end' => array(
|
136 |
'5.3' => false,
|
137 |
-
'5.4' => false,
|
138 |
-
'5.5' => false,
|
139 |
-
'5.6' => false,
|
140 |
'7.0' => true,
|
141 |
'alternative' => 'mcrypt_generic_deinit()',
|
142 |
),
|
143 |
'mysql_db_query' => array(
|
144 |
'5.3' => false,
|
145 |
-
'5.4' => false,
|
146 |
-
'5.5' => false,
|
147 |
-
'5.6' => false,
|
148 |
'7.0' => true,
|
149 |
'alternative' => 'mysqli::select_db() and mysqli::query()',
|
150 |
),
|
151 |
'mysql_escape_string' => array(
|
152 |
'5.3' => false,
|
153 |
-
'5.4' => false,
|
154 |
-
'5.5' => false,
|
155 |
-
'5.6' => false,
|
156 |
'7.0' => true,
|
157 |
'alternative' => 'mysqli::real_escape_string()',
|
158 |
),
|
159 |
'mysql_list_dbs' => array(
|
160 |
'5.4' => false,
|
161 |
-
'5.5' => false,
|
162 |
-
'5.6' => false,
|
163 |
'7.0' => true,
|
164 |
'alternative' => null,
|
165 |
),
|
166 |
'mysqli_bind_param' => array(
|
167 |
'5.3' => false,
|
168 |
'5.4' => true,
|
169 |
-
'5.5' => true,
|
170 |
-
'5.6' => true,
|
171 |
'alternative' => 'mysqli_stmt::bind_param()',
|
172 |
),
|
173 |
'mysqli_bind_result' => array(
|
174 |
'5.3' => false,
|
175 |
'5.4' => true,
|
176 |
-
'5.5' => true,
|
177 |
-
'5.6' => true,
|
178 |
'alternative' => 'mysqli_stmt::bind_result()',
|
179 |
),
|
180 |
'mysqli_client_encoding' => array(
|
181 |
'5.3' => false,
|
182 |
'5.4' => true,
|
183 |
-
'5.5' => true,
|
184 |
-
'5.6' => true,
|
185 |
'alternative' => 'mysqli::character_set_name()',
|
186 |
),
|
187 |
'mysqli_fetch' => array(
|
188 |
'5.3' => false,
|
189 |
'5.4' => true,
|
190 |
-
'5.5' => true,
|
191 |
-
'5.6' => true,
|
192 |
'alternative' => 'mysqli_stmt::fetch()',
|
193 |
),
|
194 |
'mysqli_param_count' => array(
|
195 |
'5.3' => false,
|
196 |
'5.4' => true,
|
197 |
-
'5.5' => true,
|
198 |
-
'5.6' => true,
|
199 |
'alternative' => 'mysqli_stmt_param_count()',
|
200 |
),
|
201 |
'mysqli_get_metadata' => array(
|
202 |
'5.3' => false,
|
203 |
'5.4' => true,
|
204 |
-
'5.5' => true,
|
205 |
-
'5.6' => true,
|
206 |
'alternative' => 'mysqli_stmt::result_metadata()',
|
207 |
),
|
208 |
'mysqli_send_long_data' => array(
|
209 |
'5.3' => false,
|
210 |
'5.4' => true,
|
211 |
-
'5.5' => true,
|
212 |
-
'5.6' => true,
|
213 |
'alternative' => 'mysqli_stmt::send_long_data()',
|
214 |
),
|
215 |
'magic_quotes_runtime' => array(
|
216 |
'5.3' => false,
|
217 |
-
'5.4' => false,
|
218 |
-
'5.5' => false,
|
219 |
-
'5.6' => false,
|
220 |
'7.0' => true,
|
221 |
'alternative' => null,
|
222 |
),
|
223 |
'session_register' => array(
|
224 |
'5.3' => false,
|
225 |
'5.4' => true,
|
226 |
-
'5.5' => true,
|
227 |
-
'5.6' => true,
|
228 |
'alternative' => '$_SESSION',
|
229 |
),
|
230 |
'session_unregister' => array(
|
231 |
'5.3' => false,
|
232 |
'5.4' => true,
|
233 |
-
'5.5' => true,
|
234 |
-
'5.6' => true,
|
235 |
'alternative' => '$_SESSION',
|
236 |
),
|
237 |
'session_is_registered' => array(
|
238 |
'5.3' => false,
|
239 |
'5.4' => true,
|
240 |
-
'5.5' => true,
|
241 |
-
'5.6' => true,
|
242 |
'alternative' => '$_SESSION',
|
243 |
),
|
244 |
'set_magic_quotes_runtime' => array(
|
245 |
'5.3' => false,
|
246 |
-
'5.4' => false,
|
247 |
-
'5.5' => false,
|
248 |
-
'5.6' => false,
|
249 |
'7.0' => true,
|
250 |
'alternative' => null,
|
251 |
),
|
252 |
'set_socket_blocking' => array(
|
253 |
'5.3' => false,
|
254 |
-
'5.4' => false,
|
255 |
-
'5.5' => false,
|
256 |
-
'5.6' => false,
|
257 |
'7.0' => true,
|
258 |
'alternative' => 'stream_set_blocking()',
|
259 |
),
|
260 |
'split' => array(
|
261 |
'5.3' => false,
|
262 |
-
'5.4' => false,
|
263 |
-
'5.5' => false,
|
264 |
-
'5.6' => false,
|
265 |
'7.0' => true,
|
266 |
'alternative' => 'preg_split()',
|
267 |
),
|
268 |
'spliti' => array(
|
269 |
'5.3' => false,
|
270 |
-
'5.4' => false,
|
271 |
-
'5.5' => false,
|
272 |
-
'5.6' => false,
|
273 |
'7.0' => true,
|
274 |
'alternative' => 'preg_split()',
|
275 |
),
|
276 |
'sql_regcase' => array(
|
277 |
'5.3' => false,
|
278 |
-
'5.4' => false,
|
279 |
-
'5.5' => false,
|
280 |
-
'5.6' => false,
|
281 |
'7.0' => true,
|
282 |
'alternative' => null,
|
283 |
),
|
284 |
'php_logo_guid' => array(
|
285 |
'5.5' => true,
|
286 |
-
'5.6' => true,
|
287 |
'alternative' => null,
|
288 |
),
|
289 |
'php_egg_logo_guid' => array(
|
290 |
'5.5' => true,
|
291 |
-
'5.6' => true,
|
292 |
'alternative' => null,
|
293 |
),
|
294 |
'php_real_logo_guid' => array(
|
295 |
'5.5' => true,
|
296 |
-
'5.6' => true,
|
297 |
'alternative' => null,
|
298 |
),
|
299 |
'zend_logo_guid' => array(
|
300 |
'5.5' => true,
|
301 |
-
'5.6' => true,
|
302 |
'alternative' => null,
|
303 |
),
|
304 |
'datefmt_set_timezone_id' => array(
|
305 |
'5.5' => false,
|
306 |
-
'5.6' => false,
|
307 |
'7.0' => true,
|
308 |
'alternative' => 'IntlDateFormatter::setTimeZone()',
|
309 |
),
|
310 |
'mcrypt_ecb' => array(
|
311 |
'5.5' => false,
|
312 |
-
'5.6' => false,
|
313 |
'7.0' => true,
|
314 |
'alternative' => null,
|
315 |
),
|
316 |
'mcrypt_cbc' => array(
|
317 |
'5.5' => false,
|
318 |
-
'5.6' => false,
|
319 |
'7.0' => true,
|
320 |
'alternative' => null,
|
321 |
),
|
322 |
'mcrypt_cfb' => array(
|
323 |
'5.5' => false,
|
324 |
-
'5.6' => false,
|
325 |
'7.0' => true,
|
326 |
'alternative' => null,
|
327 |
),
|
328 |
'mcrypt_ofb' => array(
|
329 |
'5.5' => false,
|
330 |
-
'5.6' => false,
|
331 |
'7.0' => true,
|
332 |
'alternative' => null,
|
333 |
),
|
334 |
'ocibindbyname' => array(
|
335 |
'5.4' => false,
|
336 |
-
'5.5' => false,
|
337 |
-
'5.6' => false,
|
338 |
'alternative' => 'oci_bind_by_name()',
|
339 |
),
|
340 |
'ocicancel' => array(
|
341 |
'5.4' => false,
|
342 |
-
'5.5' => false,
|
343 |
-
'5.6' => false,
|
344 |
'alternative' => 'oci_cancel()',
|
345 |
),
|
346 |
'ocicloselob' => array(
|
347 |
'5.4' => false,
|
348 |
-
'5.5' => false,
|
349 |
-
'5.6' => false,
|
350 |
'alternative' => 'OCI-Lob::close()',
|
351 |
),
|
352 |
'ocicollappend' => array(
|
353 |
'5.4' => false,
|
354 |
-
'5.5' => false,
|
355 |
-
'5.6' => false,
|
356 |
'alternative' => 'OCI-Collection::append()',
|
357 |
),
|
358 |
'ocicollassign' => array(
|
359 |
'5.4' => false,
|
360 |
-
'5.5' => false,
|
361 |
-
'5.6' => false,
|
362 |
'alternative' => 'OCI-Collection::assign()',
|
363 |
),
|
364 |
'ocicollassignelem' => array(
|
365 |
'5.4' => false,
|
366 |
-
'5.5' => false,
|
367 |
-
'5.6' => false,
|
368 |
'alternative' => 'OCI-Collection::assignElem()',
|
369 |
),
|
370 |
'ocicollgetelem' => array(
|
371 |
'5.4' => false,
|
372 |
-
'5.5' => false,
|
373 |
-
'5.6' => false,
|
374 |
'alternative' => 'OCI-Collection::getElem()',
|
375 |
),
|
376 |
'ocicollmax' => array(
|
377 |
'5.4' => false,
|
378 |
-
'5.5' => false,
|
379 |
-
'5.6' => false,
|
380 |
'alternative' => 'OCI-Collection::max()',
|
381 |
),
|
382 |
'ocicollsize' => array(
|
383 |
'5.4' => false,
|
384 |
-
'5.5' => false,
|
385 |
-
'5.6' => false,
|
386 |
'alternative' => 'OCI-Collection::size()',
|
387 |
),
|
388 |
'ocicolltrim' => array(
|
389 |
'5.4' => false,
|
390 |
-
'5.5' => false,
|
391 |
-
'5.6' => false,
|
392 |
'alternative' => 'OCI-Collection::trim()',
|
393 |
),
|
394 |
'ocicolumnisnull' => array(
|
395 |
'5.4' => false,
|
396 |
-
'5.5' => false,
|
397 |
-
'5.6' => false,
|
398 |
'alternative' => 'oci_field_is_null()',
|
399 |
),
|
400 |
'ocicolumnname' => array(
|
401 |
'5.4' => false,
|
402 |
-
'5.5' => false,
|
403 |
-
'5.6' => false,
|
404 |
'alternative' => 'oci_field_name()',
|
405 |
),
|
406 |
'ocicolumnprecision' => array(
|
407 |
'5.4' => false,
|
408 |
-
'5.5' => false,
|
409 |
-
'5.6' => false,
|
410 |
'alternative' => 'oci_field_precision()',
|
411 |
),
|
412 |
'ocicolumnscale' => array(
|
413 |
'5.4' => false,
|
414 |
-
'5.5' => false,
|
415 |
-
'5.6' => false,
|
416 |
'alternative' => 'oci_field_scale()',
|
417 |
),
|
418 |
'ocicolumnsize' => array(
|
419 |
'5.4' => false,
|
420 |
-
'5.5' => false,
|
421 |
-
'5.6' => false,
|
422 |
'alternative' => 'oci_field_size()',
|
423 |
),
|
424 |
'ocicolumntype' => array(
|
425 |
'5.4' => false,
|
426 |
-
'5.5' => false,
|
427 |
-
'5.6' => false,
|
428 |
'alternative' => 'oci_field_type()',
|
429 |
),
|
430 |
'ocicolumntyperaw' => array(
|
431 |
'5.4' => false,
|
432 |
-
'5.5' => false,
|
433 |
-
'5.6' => false,
|
434 |
'alternative' => 'oci_field_type_raw()',
|
435 |
),
|
436 |
'ocicommit' => array(
|
437 |
'5.4' => false,
|
438 |
-
'5.5' => false,
|
439 |
-
'5.6' => false,
|
440 |
'alternative' => 'oci_commit()',
|
441 |
),
|
442 |
'ocidefinebyname' => array(
|
443 |
'5.4' => false,
|
444 |
-
'5.5' => false,
|
445 |
-
'5.6' => false,
|
446 |
'alternative' => 'oci_define_by_name()',
|
447 |
),
|
448 |
'ocierror' => array(
|
449 |
'5.4' => false,
|
450 |
-
'5.5' => false,
|
451 |
-
'5.6' => false,
|
452 |
'alternative' => 'oci_error()',
|
453 |
),
|
454 |
'ociexecute' => array(
|
455 |
'5.4' => false,
|
456 |
-
'5.5' => false,
|
457 |
-
'5.6' => false,
|
458 |
'alternative' => 'oci_execute()',
|
459 |
),
|
460 |
'ocifetch' => array(
|
461 |
'5.4' => false,
|
462 |
-
'5.5' => false,
|
463 |
-
'5.6' => false,
|
464 |
'alternative' => 'oci_fetch()',
|
465 |
),
|
466 |
'ocifetchinto' => array(
|
467 |
'5.4' => false,
|
468 |
-
'5.5' => false,
|
469 |
-
'5.6' => false,
|
470 |
'alternative' => null,
|
471 |
),
|
472 |
'ocifetchstatement' => array(
|
473 |
'5.4' => false,
|
474 |
-
'5.5' => false,
|
475 |
-
'5.6' => false,
|
476 |
'alternative' => 'oci_fetch_all()',
|
477 |
),
|
478 |
'ocifreecollection' => array(
|
479 |
'5.4' => false,
|
480 |
-
'5.5' => false,
|
481 |
-
'5.6' => false,
|
482 |
'alternative' => 'OCI-Collection::free()',
|
483 |
),
|
484 |
'ocifreecursor' => array(
|
485 |
'5.4' => false,
|
486 |
-
'5.5' => false,
|
487 |
-
'5.6' => false,
|
488 |
'alternative' => 'oci_free_statement()',
|
489 |
),
|
490 |
'ocifreedesc' => array(
|
491 |
'5.4' => false,
|
492 |
-
'5.5' => false,
|
493 |
-
'5.6' => false,
|
494 |
'alternative' => 'OCI-Lob::free()',
|
495 |
),
|
496 |
'ocifreestatement' => array(
|
497 |
'5.4' => false,
|
498 |
-
'5.5' => false,
|
499 |
-
'5.6' => false,
|
500 |
'alternative' => 'oci_free_statement()',
|
501 |
),
|
502 |
'ociinternaldebug' => array(
|
503 |
'5.4' => false,
|
504 |
-
'5.5' => false,
|
505 |
-
'5.6' => false,
|
506 |
'alternative' => 'oci_internal_debug()',
|
507 |
),
|
508 |
'ociloadlob' => array(
|
509 |
'5.4' => false,
|
510 |
-
'5.5' => false,
|
511 |
-
'5.6' => false,
|
512 |
'alternative' => 'OCI-Lob::load()',
|
513 |
),
|
514 |
'ocilogoff' => array(
|
515 |
'5.4' => false,
|
516 |
-
'5.5' => false,
|
517 |
-
'5.6' => false,
|
518 |
'alternative' => 'oci_close()',
|
519 |
),
|
520 |
'ocilogon' => array(
|
521 |
'5.4' => false,
|
522 |
-
'5.5' => false,
|
523 |
-
'5.6' => false,
|
524 |
'alternative' => 'oci_connect()',
|
525 |
),
|
526 |
'ocinewcollection' => array(
|
527 |
'5.4' => false,
|
528 |
-
'5.5' => false,
|
529 |
-
'5.6' => false,
|
530 |
'alternative' => 'oci_new_collection()',
|
531 |
),
|
532 |
'ocinewcursor' => array(
|
533 |
'5.4' => false,
|
534 |
-
'5.5' => false,
|
535 |
-
'5.6' => false,
|
536 |
'alternative' => 'oci_new_cursor()',
|
537 |
),
|
538 |
'ocinewdescriptor' => array(
|
539 |
'5.4' => false,
|
540 |
-
'5.5' => false,
|
541 |
-
'5.6' => false,
|
542 |
'alternative' => 'oci_new_descriptor()',
|
543 |
),
|
544 |
'ocinlogon' => array(
|
545 |
'5.4' => false,
|
546 |
-
'5.5' => false,
|
547 |
-
'5.6' => false,
|
548 |
'alternative' => 'oci_new_connect()',
|
549 |
),
|
550 |
'ocinumcols' => array(
|
551 |
'5.4' => false,
|
552 |
-
'5.5' => false,
|
553 |
-
'5.6' => false,
|
554 |
'alternative' => 'oci_num_fields()',
|
555 |
),
|
556 |
'ociparse' => array(
|
557 |
'5.4' => false,
|
558 |
-
'5.5' => false,
|
559 |
-
'5.6' => false,
|
560 |
'alternative' => 'oci_parse()',
|
561 |
),
|
562 |
'ociplogon' => array(
|
563 |
'5.4' => false,
|
564 |
-
'5.5' => false,
|
565 |
-
'5.6' => false,
|
566 |
'alternative' => 'oci_pconnect()',
|
567 |
),
|
568 |
'ociresult' => array(
|
569 |
'5.4' => false,
|
570 |
-
'5.5' => false,
|
571 |
-
'5.6' => false,
|
572 |
'alternative' => 'oci_result()',
|
573 |
),
|
574 |
'ocirollback' => array(
|
575 |
'5.4' => false,
|
576 |
-
'5.5' => false,
|
577 |
-
'5.6' => false,
|
578 |
'alternative' => 'oci_rollback()',
|
579 |
),
|
580 |
'ocirowcount' => array(
|
581 |
'5.4' => false,
|
582 |
-
'5.5' => false,
|
583 |
-
'5.6' => false,
|
584 |
'alternative' => 'oci_num_rows()',
|
585 |
),
|
586 |
'ocisavelob' => array(
|
587 |
'5.4' => false,
|
588 |
-
'5.5' => false,
|
589 |
-
'5.6' => false,
|
590 |
'alternative' => 'OCI-Lob::save()',
|
591 |
),
|
592 |
'ocisavelobfile' => array(
|
593 |
'5.4' => false,
|
594 |
-
'5.5' => false,
|
595 |
-
'5.6' => false,
|
596 |
'alternative' => 'OCI-Lob::import()',
|
597 |
),
|
598 |
'ociserverversion' => array(
|
599 |
'5.4' => false,
|
600 |
-
'5.5' => false,
|
601 |
-
'5.6' => false,
|
602 |
'alternative' => 'oci_server_version()',
|
603 |
),
|
604 |
'ocisetprefetch' => array(
|
605 |
'5.4' => false,
|
606 |
-
'5.5' => false,
|
607 |
-
'5.6' => false,
|
608 |
'alternative' => 'oci_set_prefetch()',
|
609 |
),
|
610 |
'ocistatementtype' => array(
|
611 |
'5.4' => false,
|
612 |
-
'5.5' => false,
|
613 |
-
'5.6' => false,
|
614 |
'alternative' => 'oci_statement_type()',
|
615 |
),
|
616 |
'ociwritelobtofile' => array(
|
617 |
'5.4' => false,
|
618 |
-
'5.5' => false,
|
619 |
-
'5.6' => false,
|
620 |
'alternative' => 'OCI-Lob::export()',
|
621 |
),
|
622 |
'ociwritetemporarylob' => array(
|
623 |
'5.4' => false,
|
624 |
-
'5.5' => false,
|
625 |
-
'5.6' => false,
|
626 |
'alternative' => 'OCI-Lob::writeTemporary()',
|
627 |
),
|
628 |
'mysqli_get_cache_stats' => array(
|
@@ -814,12 +672,352 @@ class DeprecatedFunctionsSniff extends AbstractRemovedFeatureSniff
|
|
814 |
'7.2' => false,
|
815 |
'alternative' => 'exif_read_data()',
|
816 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
817 |
);
|
818 |
|
819 |
|
820 |
/**
|
821 |
* Returns an array of tokens this test wants to listen for.
|
822 |
*
|
|
|
|
|
823 |
* @return array
|
824 |
*/
|
825 |
public function register()
|
@@ -827,36 +1025,37 @@ class DeprecatedFunctionsSniff extends AbstractRemovedFeatureSniff
|
|
827 |
// Handle case-insensitivity of function names.
|
828 |
$this->removedFunctions = $this->arrayKeysToLowercase($this->removedFunctions);
|
829 |
|
830 |
-
return array(T_STRING);
|
831 |
-
|
832 |
-
}//end register()
|
833 |
|
834 |
|
835 |
/**
|
836 |
* Processes this test, when one of its tokens is encountered.
|
837 |
*
|
|
|
|
|
838 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
839 |
* @param int $stackPtr The position of the current token in
|
840 |
* the stack passed in $tokens.
|
841 |
*
|
842 |
* @return void
|
843 |
*/
|
844 |
-
public function process(
|
845 |
{
|
846 |
$tokens = $phpcsFile->getTokens();
|
847 |
|
848 |
$ignore = array(
|
849 |
-
T_DOUBLE_COLON,
|
850 |
-
T_OBJECT_OPERATOR,
|
851 |
-
T_FUNCTION,
|
852 |
-
T_CLASS,
|
853 |
-
T_CONST,
|
854 |
-
T_USE,
|
855 |
-
T_NS_SEPARATOR,
|
856 |
);
|
857 |
|
858 |
-
$prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
|
859 |
-
if (
|
860 |
// Not a call to a PHP function.
|
861 |
return;
|
862 |
}
|
@@ -873,13 +1072,14 @@ class DeprecatedFunctionsSniff extends AbstractRemovedFeatureSniff
|
|
873 |
'nameLc' => $functionLc,
|
874 |
);
|
875 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
876 |
-
|
877 |
-
}//end process()
|
878 |
|
879 |
|
880 |
/**
|
881 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
882 |
*
|
|
|
|
|
883 |
* @param array $itemInfo Base information about the item.
|
884 |
*
|
885 |
* @return array Version and other information about the item.
|
@@ -893,12 +1093,12 @@ class DeprecatedFunctionsSniff extends AbstractRemovedFeatureSniff
|
|
893 |
/**
|
894 |
* Get the error message template for this sniff.
|
895 |
*
|
|
|
|
|
896 |
* @return string
|
897 |
*/
|
898 |
protected function getErrorMsgTemplate()
|
899 |
{
|
900 |
return 'Function %s() is ';
|
901 |
}
|
902 |
-
|
903 |
-
|
904 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionUse;
|
12 |
|
13 |
use PHPCompatibility\AbstractRemovedFeatureSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
17 |
+
* Detect calls to deprecated/removed native PHP functions.
|
18 |
*
|
19 |
+
* Suggests alternative if available.
|
20 |
+
*
|
21 |
+
* PHP version All
|
22 |
+
*
|
23 |
+
* @since 5.5
|
24 |
+
* @since 5.6 Now extends the base `Sniff` class instead of the upstream
|
25 |
+
* `Generic.PHP.ForbiddenFunctions` sniff.
|
26 |
+
* @since 7.1.0 Now extends the `AbstractRemovedFeatureSniff` instead of the base `Sniff` class.
|
27 |
+
* @since 9.0.0 Renamed from `DeprecatedFunctionsSniff` to `RemovedFunctionsSniff`.
|
28 |
*/
|
29 |
+
class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
|
30 |
{
|
31 |
/**
|
32 |
* A list of deprecated and removed functions with their alternatives.
|
34 |
* The array lists : version number with false (deprecated) or true (removed) and an alternative function.
|
35 |
* If no alternative exists, it is NULL, i.e, the function should just not be used.
|
36 |
*
|
37 |
+
* @since 5.5
|
38 |
+
* @since 5.6 Visibility changed from `protected` to `public`.
|
39 |
+
* @since 7.0.2 Visibility changed back from `public` to `protected`.
|
40 |
+
* The earlier change was made to be in line with the upstream sniff,
|
41 |
+
* but that sniff is no longer being extended.
|
42 |
+
* @since 7.0.8 Property renamed from `$forbiddenFunctions` to `$removedFunctions`.
|
43 |
+
*
|
44 |
* @var array(string => array(string => bool|string|null))
|
45 |
*/
|
46 |
protected $removedFunctions = array(
|
48 |
'5.0.5' => true,
|
49 |
'alternative' => null,
|
50 |
),
|
51 |
+
|
52 |
+
'pfpro_cleanup' => array(
|
53 |
+
'5.1' => true,
|
54 |
+
'alternative' => null,
|
55 |
+
),
|
56 |
+
'pfpro_init' => array(
|
57 |
+
'5.1' => true,
|
58 |
+
'alternative' => null,
|
59 |
+
),
|
60 |
+
'pfpro_process_raw' => array(
|
61 |
+
'5.1' => true,
|
62 |
+
'alternative' => null,
|
63 |
+
),
|
64 |
+
'pfpro_process' => array(
|
65 |
+
'5.1' => true,
|
66 |
+
'alternative' => null,
|
67 |
+
),
|
68 |
+
'pfpro_version' => array(
|
69 |
+
'5.1' => true,
|
70 |
+
'alternative' => null,
|
71 |
+
),
|
72 |
+
|
73 |
'call_user_method' => array(
|
74 |
'5.3' => false,
|
|
|
|
|
|
|
75 |
'7.0' => true,
|
76 |
'alternative' => 'call_user_func()',
|
77 |
),
|
78 |
'call_user_method_array' => array(
|
79 |
'5.3' => false,
|
|
|
|
|
|
|
80 |
'7.0' => true,
|
81 |
'alternative' => 'call_user_func_array()',
|
82 |
),
|
83 |
'define_syslog_variables' => array(
|
84 |
'5.3' => false,
|
85 |
'5.4' => true,
|
|
|
|
|
86 |
'alternative' => null,
|
87 |
),
|
88 |
'dl' => array(
|
89 |
'5.3' => false,
|
|
|
|
|
|
|
90 |
'alternative' => null,
|
91 |
),
|
92 |
'ereg' => array(
|
93 |
'5.3' => false,
|
|
|
|
|
|
|
94 |
'7.0' => true,
|
95 |
'alternative' => 'preg_match()',
|
96 |
),
|
97 |
'ereg_replace' => array(
|
98 |
'5.3' => false,
|
|
|
|
|
|
|
99 |
'7.0' => true,
|
100 |
'alternative' => 'preg_replace()',
|
101 |
),
|
102 |
'eregi' => array(
|
103 |
'5.3' => false,
|
|
|
|
|
|
|
104 |
'7.0' => true,
|
105 |
'alternative' => 'preg_match()',
|
106 |
),
|
107 |
'eregi_replace' => array(
|
108 |
'5.3' => false,
|
|
|
|
|
|
|
109 |
'7.0' => true,
|
110 |
'alternative' => 'preg_replace()',
|
111 |
),
|
148 |
),
|
149 |
'mcrypt_generic_end' => array(
|
150 |
'5.3' => false,
|
|
|
|
|
|
|
151 |
'7.0' => true,
|
152 |
'alternative' => 'mcrypt_generic_deinit()',
|
153 |
),
|
154 |
'mysql_db_query' => array(
|
155 |
'5.3' => false,
|
|
|
|
|
|
|
156 |
'7.0' => true,
|
157 |
'alternative' => 'mysqli::select_db() and mysqli::query()',
|
158 |
),
|
159 |
'mysql_escape_string' => array(
|
160 |
'5.3' => false,
|
|
|
|
|
|
|
161 |
'7.0' => true,
|
162 |
'alternative' => 'mysqli::real_escape_string()',
|
163 |
),
|
164 |
'mysql_list_dbs' => array(
|
165 |
'5.4' => false,
|
|
|
|
|
166 |
'7.0' => true,
|
167 |
'alternative' => null,
|
168 |
),
|
169 |
'mysqli_bind_param' => array(
|
170 |
'5.3' => false,
|
171 |
'5.4' => true,
|
|
|
|
|
172 |
'alternative' => 'mysqli_stmt::bind_param()',
|
173 |
),
|
174 |
'mysqli_bind_result' => array(
|
175 |
'5.3' => false,
|
176 |
'5.4' => true,
|
|
|
|
|
177 |
'alternative' => 'mysqli_stmt::bind_result()',
|
178 |
),
|
179 |
'mysqli_client_encoding' => array(
|
180 |
'5.3' => false,
|
181 |
'5.4' => true,
|
|
|
|
|
182 |
'alternative' => 'mysqli::character_set_name()',
|
183 |
),
|
184 |
'mysqli_fetch' => array(
|
185 |
'5.3' => false,
|
186 |
'5.4' => true,
|
|
|
|
|
187 |
'alternative' => 'mysqli_stmt::fetch()',
|
188 |
),
|
189 |
'mysqli_param_count' => array(
|
190 |
'5.3' => false,
|
191 |
'5.4' => true,
|
|
|
|
|
192 |
'alternative' => 'mysqli_stmt_param_count()',
|
193 |
),
|
194 |
'mysqli_get_metadata' => array(
|
195 |
'5.3' => false,
|
196 |
'5.4' => true,
|
|
|
|
|
197 |
'alternative' => 'mysqli_stmt::result_metadata()',
|
198 |
),
|
199 |
'mysqli_send_long_data' => array(
|
200 |
'5.3' => false,
|
201 |
'5.4' => true,
|
|
|
|
|
202 |
'alternative' => 'mysqli_stmt::send_long_data()',
|
203 |
),
|
204 |
'magic_quotes_runtime' => array(
|
205 |
'5.3' => false,
|
|
|
|
|
|
|
206 |
'7.0' => true,
|
207 |
'alternative' => null,
|
208 |
),
|
209 |
'session_register' => array(
|
210 |
'5.3' => false,
|
211 |
'5.4' => true,
|
|
|
|
|
212 |
'alternative' => '$_SESSION',
|
213 |
),
|
214 |
'session_unregister' => array(
|
215 |
'5.3' => false,
|
216 |
'5.4' => true,
|
|
|
|
|
217 |
'alternative' => '$_SESSION',
|
218 |
),
|
219 |
'session_is_registered' => array(
|
220 |
'5.3' => false,
|
221 |
'5.4' => true,
|
|
|
|
|
222 |
'alternative' => '$_SESSION',
|
223 |
),
|
224 |
'set_magic_quotes_runtime' => array(
|
225 |
'5.3' => false,
|
|
|
|
|
|
|
226 |
'7.0' => true,
|
227 |
'alternative' => null,
|
228 |
),
|
229 |
'set_socket_blocking' => array(
|
230 |
'5.3' => false,
|
|
|
|
|
|
|
231 |
'7.0' => true,
|
232 |
'alternative' => 'stream_set_blocking()',
|
233 |
),
|
234 |
'split' => array(
|
235 |
'5.3' => false,
|
|
|
|
|
|
|
236 |
'7.0' => true,
|
237 |
'alternative' => 'preg_split()',
|
238 |
),
|
239 |
'spliti' => array(
|
240 |
'5.3' => false,
|
|
|
|
|
|
|
241 |
'7.0' => true,
|
242 |
'alternative' => 'preg_split()',
|
243 |
),
|
244 |
'sql_regcase' => array(
|
245 |
'5.3' => false,
|
|
|
|
|
|
|
246 |
'7.0' => true,
|
247 |
'alternative' => null,
|
248 |
),
|
249 |
'php_logo_guid' => array(
|
250 |
'5.5' => true,
|
|
|
251 |
'alternative' => null,
|
252 |
),
|
253 |
'php_egg_logo_guid' => array(
|
254 |
'5.5' => true,
|
|
|
255 |
'alternative' => null,
|
256 |
),
|
257 |
'php_real_logo_guid' => array(
|
258 |
'5.5' => true,
|
|
|
259 |
'alternative' => null,
|
260 |
),
|
261 |
'zend_logo_guid' => array(
|
262 |
'5.5' => true,
|
|
|
263 |
'alternative' => null,
|
264 |
),
|
265 |
'datefmt_set_timezone_id' => array(
|
266 |
'5.5' => false,
|
|
|
267 |
'7.0' => true,
|
268 |
'alternative' => 'IntlDateFormatter::setTimeZone()',
|
269 |
),
|
270 |
'mcrypt_ecb' => array(
|
271 |
'5.5' => false,
|
|
|
272 |
'7.0' => true,
|
273 |
'alternative' => null,
|
274 |
),
|
275 |
'mcrypt_cbc' => array(
|
276 |
'5.5' => false,
|
|
|
277 |
'7.0' => true,
|
278 |
'alternative' => null,
|
279 |
),
|
280 |
'mcrypt_cfb' => array(
|
281 |
'5.5' => false,
|
|
|
282 |
'7.0' => true,
|
283 |
'alternative' => null,
|
284 |
),
|
285 |
'mcrypt_ofb' => array(
|
286 |
'5.5' => false,
|
|
|
287 |
'7.0' => true,
|
288 |
'alternative' => null,
|
289 |
),
|
290 |
'ocibindbyname' => array(
|
291 |
'5.4' => false,
|
|
|
|
|
292 |
'alternative' => 'oci_bind_by_name()',
|
293 |
),
|
294 |
'ocicancel' => array(
|
295 |
'5.4' => false,
|
|
|
|
|
296 |
'alternative' => 'oci_cancel()',
|
297 |
),
|
298 |
'ocicloselob' => array(
|
299 |
'5.4' => false,
|
|
|
|
|
300 |
'alternative' => 'OCI-Lob::close()',
|
301 |
),
|
302 |
'ocicollappend' => array(
|
303 |
'5.4' => false,
|
|
|
|
|
304 |
'alternative' => 'OCI-Collection::append()',
|
305 |
),
|
306 |
'ocicollassign' => array(
|
307 |
'5.4' => false,
|
|
|
|
|
308 |
'alternative' => 'OCI-Collection::assign()',
|
309 |
),
|
310 |
'ocicollassignelem' => array(
|
311 |
'5.4' => false,
|
|
|
|
|
312 |
'alternative' => 'OCI-Collection::assignElem()',
|
313 |
),
|
314 |
'ocicollgetelem' => array(
|
315 |
'5.4' => false,
|
|
|
|
|
316 |
'alternative' => 'OCI-Collection::getElem()',
|
317 |
),
|
318 |
'ocicollmax' => array(
|
319 |
'5.4' => false,
|
|
|
|
|
320 |
'alternative' => 'OCI-Collection::max()',
|
321 |
),
|
322 |
'ocicollsize' => array(
|
323 |
'5.4' => false,
|
|
|
|
|
324 |
'alternative' => 'OCI-Collection::size()',
|
325 |
),
|
326 |
'ocicolltrim' => array(
|
327 |
'5.4' => false,
|
|
|
|
|
328 |
'alternative' => 'OCI-Collection::trim()',
|
329 |
),
|
330 |
'ocicolumnisnull' => array(
|
331 |
'5.4' => false,
|
|
|
|
|
332 |
'alternative' => 'oci_field_is_null()',
|
333 |
),
|
334 |
'ocicolumnname' => array(
|
335 |
'5.4' => false,
|
|
|
|
|
336 |
'alternative' => 'oci_field_name()',
|
337 |
),
|
338 |
'ocicolumnprecision' => array(
|
339 |
'5.4' => false,
|
|
|
|
|
340 |
'alternative' => 'oci_field_precision()',
|
341 |
),
|
342 |
'ocicolumnscale' => array(
|
343 |
'5.4' => false,
|
|
|
|
|
344 |
'alternative' => 'oci_field_scale()',
|
345 |
),
|
346 |
'ocicolumnsize' => array(
|
347 |
'5.4' => false,
|
|
|
|
|
348 |
'alternative' => 'oci_field_size()',
|
349 |
),
|
350 |
'ocicolumntype' => array(
|
351 |
'5.4' => false,
|
|
|
|
|
352 |
'alternative' => 'oci_field_type()',
|
353 |
),
|
354 |
'ocicolumntyperaw' => array(
|
355 |
'5.4' => false,
|
|
|
|
|
356 |
'alternative' => 'oci_field_type_raw()',
|
357 |
),
|
358 |
'ocicommit' => array(
|
359 |
'5.4' => false,
|
|
|
|
|
360 |
'alternative' => 'oci_commit()',
|
361 |
),
|
362 |
'ocidefinebyname' => array(
|
363 |
'5.4' => false,
|
|
|
|
|
364 |
'alternative' => 'oci_define_by_name()',
|
365 |
),
|
366 |
'ocierror' => array(
|
367 |
'5.4' => false,
|
|
|
|
|
368 |
'alternative' => 'oci_error()',
|
369 |
),
|
370 |
'ociexecute' => array(
|
371 |
'5.4' => false,
|
|
|
|
|
372 |
'alternative' => 'oci_execute()',
|
373 |
),
|
374 |
'ocifetch' => array(
|
375 |
'5.4' => false,
|
|
|
|
|
376 |
'alternative' => 'oci_fetch()',
|
377 |
),
|
378 |
'ocifetchinto' => array(
|
379 |
'5.4' => false,
|
|
|
|
|
380 |
'alternative' => null,
|
381 |
),
|
382 |
'ocifetchstatement' => array(
|
383 |
'5.4' => false,
|
|
|
|
|
384 |
'alternative' => 'oci_fetch_all()',
|
385 |
),
|
386 |
'ocifreecollection' => array(
|
387 |
'5.4' => false,
|
|
|
|
|
388 |
'alternative' => 'OCI-Collection::free()',
|
389 |
),
|
390 |
'ocifreecursor' => array(
|
391 |
'5.4' => false,
|
|
|
|
|
392 |
'alternative' => 'oci_free_statement()',
|
393 |
),
|
394 |
'ocifreedesc' => array(
|
395 |
'5.4' => false,
|
|
|
|
|
396 |
'alternative' => 'OCI-Lob::free()',
|
397 |
),
|
398 |
'ocifreestatement' => array(
|
399 |
'5.4' => false,
|
|
|
|
|
400 |
'alternative' => 'oci_free_statement()',
|
401 |
),
|
402 |
'ociinternaldebug' => array(
|
403 |
'5.4' => false,
|
|
|
|
|
404 |
'alternative' => 'oci_internal_debug()',
|
405 |
),
|
406 |
'ociloadlob' => array(
|
407 |
'5.4' => false,
|
|
|
|
|
408 |
'alternative' => 'OCI-Lob::load()',
|
409 |
),
|
410 |
'ocilogoff' => array(
|
411 |
'5.4' => false,
|
|
|
|
|
412 |
'alternative' => 'oci_close()',
|
413 |
),
|
414 |
'ocilogon' => array(
|
415 |
'5.4' => false,
|
|
|
|
|
416 |
'alternative' => 'oci_connect()',
|
417 |
),
|
418 |
'ocinewcollection' => array(
|
419 |
'5.4' => false,
|
|
|
|
|
420 |
'alternative' => 'oci_new_collection()',
|
421 |
),
|
422 |
'ocinewcursor' => array(
|
423 |
'5.4' => false,
|
|
|
|
|
424 |
'alternative' => 'oci_new_cursor()',
|
425 |
),
|
426 |
'ocinewdescriptor' => array(
|
427 |
'5.4' => false,
|
|
|
|
|
428 |
'alternative' => 'oci_new_descriptor()',
|
429 |
),
|
430 |
'ocinlogon' => array(
|
431 |
'5.4' => false,
|
|
|
|
|
432 |
'alternative' => 'oci_new_connect()',
|
433 |
),
|
434 |
'ocinumcols' => array(
|
435 |
'5.4' => false,
|
|
|
|
|
436 |
'alternative' => 'oci_num_fields()',
|
437 |
),
|
438 |
'ociparse' => array(
|
439 |
'5.4' => false,
|
|
|
|
|
440 |
'alternative' => 'oci_parse()',
|
441 |
),
|
442 |
'ociplogon' => array(
|
443 |
'5.4' => false,
|
|
|
|
|
444 |
'alternative' => 'oci_pconnect()',
|
445 |
),
|
446 |
'ociresult' => array(
|
447 |
'5.4' => false,
|
|
|
|
|
448 |
'alternative' => 'oci_result()',
|
449 |
),
|
450 |
'ocirollback' => array(
|
451 |
'5.4' => false,
|
|
|
|
|
452 |
'alternative' => 'oci_rollback()',
|
453 |
),
|
454 |
'ocirowcount' => array(
|
455 |
'5.4' => false,
|
|
|
|
|
456 |
'alternative' => 'oci_num_rows()',
|
457 |
),
|
458 |
'ocisavelob' => array(
|
459 |
'5.4' => false,
|
|
|
|
|
460 |
'alternative' => 'OCI-Lob::save()',
|
461 |
),
|
462 |
'ocisavelobfile' => array(
|
463 |
'5.4' => false,
|
|
|
|
|
464 |
'alternative' => 'OCI-Lob::import()',
|
465 |
),
|
466 |
'ociserverversion' => array(
|
467 |
'5.4' => false,
|
|
|
|
|
468 |
'alternative' => 'oci_server_version()',
|
469 |
),
|
470 |
'ocisetprefetch' => array(
|
471 |
'5.4' => false,
|
|
|
|
|
472 |
'alternative' => 'oci_set_prefetch()',
|
473 |
),
|
474 |
'ocistatementtype' => array(
|
475 |
'5.4' => false,
|
|
|
|
|
476 |
'alternative' => 'oci_statement_type()',
|
477 |
),
|
478 |
'ociwritelobtofile' => array(
|
479 |
'5.4' => false,
|
|
|
|
|
480 |
'alternative' => 'OCI-Lob::export()',
|
481 |
),
|
482 |
'ociwritetemporarylob' => array(
|
483 |
'5.4' => false,
|
|
|
|
|
484 |
'alternative' => 'OCI-Lob::writeTemporary()',
|
485 |
),
|
486 |
'mysqli_get_cache_stats' => array(
|
672 |
'7.2' => false,
|
673 |
'alternative' => 'exif_read_data()',
|
674 |
),
|
675 |
+
|
676 |
+
'image2wbmp' => array(
|
677 |
+
'7.3' => false,
|
678 |
+
'alternative' => 'imagewbmp()',
|
679 |
+
),
|
680 |
+
'mbregex_encoding' => array(
|
681 |
+
'7.3' => false,
|
682 |
+
'alternative' => 'mb_regex_encoding()',
|
683 |
+
),
|
684 |
+
'mbereg' => array(
|
685 |
+
'7.3' => false,
|
686 |
+
'alternative' => 'mb_ereg()',
|
687 |
+
),
|
688 |
+
'mberegi' => array(
|
689 |
+
'7.3' => false,
|
690 |
+
'alternative' => 'mb_eregi()',
|
691 |
+
),
|
692 |
+
'mbereg_replace' => array(
|
693 |
+
'7.3' => false,
|
694 |
+
'alternative' => 'mb_ereg_replace()',
|
695 |
+
),
|
696 |
+
'mberegi_replace' => array(
|
697 |
+
'7.3' => false,
|
698 |
+
'alternative' => 'mb_eregi_replace()',
|
699 |
+
),
|
700 |
+
'mbsplit' => array(
|
701 |
+
'7.3' => false,
|
702 |
+
'alternative' => 'mb_split()',
|
703 |
+
),
|
704 |
+
'mbereg_match' => array(
|
705 |
+
'7.3' => false,
|
706 |
+
'alternative' => 'mb_ereg_match()',
|
707 |
+
),
|
708 |
+
'mbereg_search' => array(
|
709 |
+
'7.3' => false,
|
710 |
+
'alternative' => 'mb_ereg_search()',
|
711 |
+
),
|
712 |
+
'mbereg_search_pos' => array(
|
713 |
+
'7.3' => false,
|
714 |
+
'alternative' => 'mb_ereg_search_pos()',
|
715 |
+
),
|
716 |
+
'mbereg_search_regs' => array(
|
717 |
+
'7.3' => false,
|
718 |
+
'alternative' => 'mb_ereg_search_regs()',
|
719 |
+
),
|
720 |
+
'mbereg_search_init' => array(
|
721 |
+
'7.3' => false,
|
722 |
+
'alternative' => 'mb_ereg_search_init()',
|
723 |
+
),
|
724 |
+
'mbereg_search_getregs' => array(
|
725 |
+
'7.3' => false,
|
726 |
+
'alternative' => 'mb_ereg_search_getregs()',
|
727 |
+
),
|
728 |
+
'mbereg_search_getpos' => array(
|
729 |
+
'7.3' => false,
|
730 |
+
'alternative' => 'mb_ereg_search_getpos()',
|
731 |
+
),
|
732 |
+
'mbereg_search_setpos' => array(
|
733 |
+
'7.3' => false,
|
734 |
+
'alternative' => 'mb_ereg_search_setpos()',
|
735 |
+
),
|
736 |
+
'fgetss' => array(
|
737 |
+
'7.3' => false,
|
738 |
+
'alternative' => null,
|
739 |
+
),
|
740 |
+
'gzgetss' => array(
|
741 |
+
'7.3' => false,
|
742 |
+
'alternative' => null,
|
743 |
+
),
|
744 |
+
|
745 |
+
'convert_cyr_string' => array(
|
746 |
+
'7.4' => false,
|
747 |
+
'alternative' => 'mb_convert_encoding(), iconv() or UConverter',
|
748 |
+
),
|
749 |
+
'ezmlm_hash' => array(
|
750 |
+
'7.4' => false,
|
751 |
+
'alternative' => null,
|
752 |
+
),
|
753 |
+
'get_magic_quotes_gpc' => array(
|
754 |
+
'7.4' => false,
|
755 |
+
'alternative' => null,
|
756 |
+
),
|
757 |
+
'get_magic_quotes_runtime' => array(
|
758 |
+
'7.4' => false,
|
759 |
+
'alternative' => null,
|
760 |
+
),
|
761 |
+
'hebrevc' => array(
|
762 |
+
'7.4' => false,
|
763 |
+
'alternative' => null,
|
764 |
+
),
|
765 |
+
'is_real' => array(
|
766 |
+
'7.4' => false,
|
767 |
+
'alternative' => 'is_float()',
|
768 |
+
),
|
769 |
+
'money_format' => array(
|
770 |
+
'7.4' => false,
|
771 |
+
'alternative' => 'NumberFormatter::formatCurrency()',
|
772 |
+
),
|
773 |
+
'restore_include_path' => array(
|
774 |
+
'7.4' => false,
|
775 |
+
'alternative' => "ini_restore('include_path')",
|
776 |
+
),
|
777 |
+
'ibase_add_user' => array(
|
778 |
+
'7.4' => true,
|
779 |
+
'alternative' => null,
|
780 |
+
),
|
781 |
+
'ibase_affected_rows' => array(
|
782 |
+
'7.4' => true,
|
783 |
+
'alternative' => null,
|
784 |
+
),
|
785 |
+
'ibase_backup' => array(
|
786 |
+
'7.4' => true,
|
787 |
+
'alternative' => null,
|
788 |
+
),
|
789 |
+
'ibase_blob_add' => array(
|
790 |
+
'7.4' => true,
|
791 |
+
'alternative' => null,
|
792 |
+
),
|
793 |
+
'ibase_blob_cancel' => array(
|
794 |
+
'7.4' => true,
|
795 |
+
'alternative' => null,
|
796 |
+
),
|
797 |
+
'ibase_blob_close' => array(
|
798 |
+
'7.4' => true,
|
799 |
+
'alternative' => null,
|
800 |
+
),
|
801 |
+
'ibase_blob_create' => array(
|
802 |
+
'7.4' => true,
|
803 |
+
'alternative' => null,
|
804 |
+
),
|
805 |
+
'ibase_blob_echo' => array(
|
806 |
+
'7.4' => true,
|
807 |
+
'alternative' => null,
|
808 |
+
),
|
809 |
+
'ibase_blob_get' => array(
|
810 |
+
'7.4' => true,
|
811 |
+
'alternative' => null,
|
812 |
+
),
|
813 |
+
'ibase_blob_import' => array(
|
814 |
+
'7.4' => true,
|
815 |
+
'alternative' => null,
|
816 |
+
),
|
817 |
+
'ibase_blob_info' => array(
|
818 |
+
'7.4' => true,
|
819 |
+
'alternative' => null,
|
820 |
+
),
|
821 |
+
'ibase_blob_open' => array(
|
822 |
+
'7.4' => true,
|
823 |
+
'alternative' => null,
|
824 |
+
),
|
825 |
+
'ibase_close' => array(
|
826 |
+
'7.4' => true,
|
827 |
+
'alternative' => null,
|
828 |
+
),
|
829 |
+
'ibase_commit_ret' => array(
|
830 |
+
'7.4' => true,
|
831 |
+
'alternative' => null,
|
832 |
+
),
|
833 |
+
'ibase_commit' => array(
|
834 |
+
'7.4' => true,
|
835 |
+
'alternative' => null,
|
836 |
+
),
|
837 |
+
'ibase_connect' => array(
|
838 |
+
'7.4' => true,
|
839 |
+
'alternative' => null,
|
840 |
+
),
|
841 |
+
'ibase_db_info' => array(
|
842 |
+
'7.4' => true,
|
843 |
+
'alternative' => null,
|
844 |
+
),
|
845 |
+
'ibase_delete_user' => array(
|
846 |
+
'7.4' => true,
|
847 |
+
'alternative' => null,
|
848 |
+
),
|
849 |
+
'ibase_drop_db' => array(
|
850 |
+
'7.4' => true,
|
851 |
+
'alternative' => null,
|
852 |
+
),
|
853 |
+
'ibase_errcode' => array(
|
854 |
+
'7.4' => true,
|
855 |
+
'alternative' => null,
|
856 |
+
),
|
857 |
+
'ibase_errmsg' => array(
|
858 |
+
'7.4' => true,
|
859 |
+
'alternative' => null,
|
860 |
+
),
|
861 |
+
'ibase_execute' => array(
|
862 |
+
'7.4' => true,
|
863 |
+
'alternative' => null,
|
864 |
+
),
|
865 |
+
'ibase_fetch_assoc' => array(
|
866 |
+
'7.4' => true,
|
867 |
+
'alternative' => null,
|
868 |
+
),
|
869 |
+
'ibase_fetch_object' => array(
|
870 |
+
'7.4' => true,
|
871 |
+
'alternative' => null,
|
872 |
+
),
|
873 |
+
'ibase_fetch_row' => array(
|
874 |
+
'7.4' => true,
|
875 |
+
'alternative' => null,
|
876 |
+
),
|
877 |
+
'ibase_field_info' => array(
|
878 |
+
'7.4' => true,
|
879 |
+
'alternative' => null,
|
880 |
+
),
|
881 |
+
'ibase_free_event_handler' => array(
|
882 |
+
'7.4' => true,
|
883 |
+
'alternative' => null,
|
884 |
+
),
|
885 |
+
'ibase_free_query' => array(
|
886 |
+
'7.4' => true,
|
887 |
+
'alternative' => null,
|
888 |
+
),
|
889 |
+
'ibase_free_result' => array(
|
890 |
+
'7.4' => true,
|
891 |
+
'alternative' => null,
|
892 |
+
),
|
893 |
+
'ibase_gen_id' => array(
|
894 |
+
'7.4' => true,
|
895 |
+
'alternative' => null,
|
896 |
+
),
|
897 |
+
'ibase_maintain_db' => array(
|
898 |
+
'7.4' => true,
|
899 |
+
'alternative' => null,
|
900 |
+
),
|
901 |
+
'ibase_modify_user' => array(
|
902 |
+
'7.4' => true,
|
903 |
+
'alternative' => null,
|
904 |
+
),
|
905 |
+
'ibase_name_result' => array(
|
906 |
+
'7.4' => true,
|
907 |
+
'alternative' => null,
|
908 |
+
),
|
909 |
+
'ibase_num_fields' => array(
|
910 |
+
'7.4' => true,
|
911 |
+
'alternative' => null,
|
912 |
+
),
|
913 |
+
'ibase_num_params' => array(
|
914 |
+
'7.4' => true,
|
915 |
+
'alternative' => null,
|
916 |
+
),
|
917 |
+
'ibase_param_info' => array(
|
918 |
+
'7.4' => true,
|
919 |
+
'alternative' => null,
|
920 |
+
),
|
921 |
+
'ibase_pconnect' => array(
|
922 |
+
'7.4' => true,
|
923 |
+
'alternative' => null,
|
924 |
+
),
|
925 |
+
'ibase_prepare' => array(
|
926 |
+
'7.4' => true,
|
927 |
+
'alternative' => null,
|
928 |
+
),
|
929 |
+
'ibase_query' => array(
|
930 |
+
'7.4' => true,
|
931 |
+
'alternative' => null,
|
932 |
+
),
|
933 |
+
'ibase_restore' => array(
|
934 |
+
'7.4' => true,
|
935 |
+
'alternative' => null,
|
936 |
+
),
|
937 |
+
'ibase_rollback_ret' => array(
|
938 |
+
'7.4' => true,
|
939 |
+
'alternative' => null,
|
940 |
+
),
|
941 |
+
'ibase_rollback' => array(
|
942 |
+
'7.4' => true,
|
943 |
+
'alternative' => null,
|
944 |
+
),
|
945 |
+
'ibase_server_info' => array(
|
946 |
+
'7.4' => true,
|
947 |
+
'alternative' => null,
|
948 |
+
),
|
949 |
+
'ibase_service_attach' => array(
|
950 |
+
'7.4' => true,
|
951 |
+
'alternative' => null,
|
952 |
+
),
|
953 |
+
'ibase_service_detach' => array(
|
954 |
+
'7.4' => true,
|
955 |
+
'alternative' => null,
|
956 |
+
),
|
957 |
+
'ibase_set_event_handler' => array(
|
958 |
+
'7.4' => true,
|
959 |
+
'alternative' => null,
|
960 |
+
),
|
961 |
+
'ibase_trans' => array(
|
962 |
+
'7.4' => true,
|
963 |
+
'alternative' => null,
|
964 |
+
),
|
965 |
+
'ibase_wait_event' => array(
|
966 |
+
'7.4' => true,
|
967 |
+
'alternative' => null,
|
968 |
+
),
|
969 |
+
'ldap_control_paged_result_response' => array(
|
970 |
+
'7.4' => false,
|
971 |
+
'alternative' => 'ldap_search()',
|
972 |
+
),
|
973 |
+
'ldap_control_paged_result' => array(
|
974 |
+
'7.4' => false,
|
975 |
+
'alternative' => 'ldap_search()',
|
976 |
+
),
|
977 |
+
'recode_file' => array(
|
978 |
+
'7.4' => true,
|
979 |
+
'alternative' => 'the iconv or mbstring extension',
|
980 |
+
),
|
981 |
+
'recode_string' => array(
|
982 |
+
'7.4' => true,
|
983 |
+
'alternative' => 'the iconv or mbstring extension',
|
984 |
+
),
|
985 |
+
'recode' => array(
|
986 |
+
'7.4' => true,
|
987 |
+
'alternative' => 'the iconv or mbstring extension',
|
988 |
+
),
|
989 |
+
'wddx_add_vars' => array(
|
990 |
+
'7.4' => true,
|
991 |
+
'alternative' => null,
|
992 |
+
),
|
993 |
+
'wddx_deserialize' => array(
|
994 |
+
'7.4' => true,
|
995 |
+
'alternative' => null,
|
996 |
+
),
|
997 |
+
'wddx_packet_end' => array(
|
998 |
+
'7.4' => true,
|
999 |
+
'alternative' => null,
|
1000 |
+
),
|
1001 |
+
'wddx_packet_start' => array(
|
1002 |
+
'7.4' => true,
|
1003 |
+
'alternative' => null,
|
1004 |
+
),
|
1005 |
+
'wddx_serialize_value' => array(
|
1006 |
+
'7.4' => true,
|
1007 |
+
'alternative' => null,
|
1008 |
+
),
|
1009 |
+
'wddx_serialize_vars' => array(
|
1010 |
+
'7.4' => true,
|
1011 |
+
'alternative' => null,
|
1012 |
+
),
|
1013 |
);
|
1014 |
|
1015 |
|
1016 |
/**
|
1017 |
* Returns an array of tokens this test wants to listen for.
|
1018 |
*
|
1019 |
+
* @since 5.6
|
1020 |
+
*
|
1021 |
* @return array
|
1022 |
*/
|
1023 |
public function register()
|
1025 |
// Handle case-insensitivity of function names.
|
1026 |
$this->removedFunctions = $this->arrayKeysToLowercase($this->removedFunctions);
|
1027 |
|
1028 |
+
return array(\T_STRING);
|
1029 |
+
}
|
|
|
1030 |
|
1031 |
|
1032 |
/**
|
1033 |
* Processes this test, when one of its tokens is encountered.
|
1034 |
*
|
1035 |
+
* @since 5.5
|
1036 |
+
*
|
1037 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
1038 |
* @param int $stackPtr The position of the current token in
|
1039 |
* the stack passed in $tokens.
|
1040 |
*
|
1041 |
* @return void
|
1042 |
*/
|
1043 |
+
public function process(File $phpcsFile, $stackPtr)
|
1044 |
{
|
1045 |
$tokens = $phpcsFile->getTokens();
|
1046 |
|
1047 |
$ignore = array(
|
1048 |
+
\T_DOUBLE_COLON => true,
|
1049 |
+
\T_OBJECT_OPERATOR => true,
|
1050 |
+
\T_FUNCTION => true,
|
1051 |
+
\T_CLASS => true,
|
1052 |
+
\T_CONST => true,
|
1053 |
+
\T_USE => true,
|
1054 |
+
\T_NS_SEPARATOR => true,
|
1055 |
);
|
1056 |
|
1057 |
+
$prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
|
1058 |
+
if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
|
1059 |
// Not a call to a PHP function.
|
1060 |
return;
|
1061 |
}
|
1072 |
'nameLc' => $functionLc,
|
1073 |
);
|
1074 |
$this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
|
1075 |
+
}
|
|
|
1076 |
|
1077 |
|
1078 |
/**
|
1079 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
1080 |
*
|
1081 |
+
* @since 7.1.0
|
1082 |
+
*
|
1083 |
* @param array $itemInfo Base information about the item.
|
1084 |
*
|
1085 |
* @return array Version and other information about the item.
|
1093 |
/**
|
1094 |
* Get the error message template for this sniff.
|
1095 |
*
|
1096 |
+
* @since 7.1.0
|
1097 |
+
*
|
1098 |
* @return string
|
1099 |
*/
|
1100 |
protected function getErrorMsgTemplate()
|
1101 |
{
|
1102 |
return 'Function %s() is ';
|
1103 |
}
|
1104 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/RequiredOptionalFunctionParametersSniff.php → FunctionUse/RequiredToOptionalFunctionParametersSniff.php}
RENAMED
@@ -1,24 +1,33 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
-
namespace PHPCompatibility\Sniffs\
|
11 |
|
12 |
use PHPCompatibility\AbstractComplexVersionSniff;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
-
*
|
16 |
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
*/
|
21 |
-
class
|
22 |
{
|
23 |
|
24 |
/**
|
@@ -29,9 +38,39 @@ class RequiredOptionalFunctionParametersSniff extends AbstractComplexVersionSnif
|
|
29 |
* The index is the location of the parameter in the parameter list, starting at 0 !
|
30 |
* If's sufficient to list the last version in which the parameter was still required.
|
31 |
*
|
|
|
|
|
32 |
* @var array
|
33 |
*/
|
34 |
protected $functionParameters = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
'bcscale' => array(
|
36 |
0 => array(
|
37 |
'name' => 'scale',
|
@@ -39,6 +78,62 @@ class RequiredOptionalFunctionParametersSniff extends AbstractComplexVersionSnif
|
|
39 |
'7.3' => false,
|
40 |
),
|
41 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
'getenv' => array(
|
43 |
0 => array(
|
44 |
'name' => 'varname',
|
@@ -66,6 +161,8 @@ class RequiredOptionalFunctionParametersSniff extends AbstractComplexVersionSnif
|
|
66 |
/**
|
67 |
* Returns an array of tokens this test wants to listen for.
|
68 |
*
|
|
|
|
|
69 |
* @return array
|
70 |
*/
|
71 |
public function register()
|
@@ -73,31 +170,34 @@ class RequiredOptionalFunctionParametersSniff extends AbstractComplexVersionSnif
|
|
73 |
// Handle case-insensitivity of function names.
|
74 |
$this->functionParameters = $this->arrayKeysToLowercase($this->functionParameters);
|
75 |
|
76 |
-
return array(T_STRING);
|
77 |
-
}
|
78 |
|
79 |
/**
|
80 |
* Processes this test, when one of its tokens is encountered.
|
81 |
*
|
|
|
|
|
82 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
83 |
* @param int $stackPtr The position of the current token in
|
84 |
* the stack passed in $tokens.
|
85 |
*
|
86 |
* @return void
|
87 |
*/
|
88 |
-
public function process(
|
89 |
{
|
90 |
$tokens = $phpcsFile->getTokens();
|
91 |
|
92 |
$ignore = array(
|
93 |
-
T_DOUBLE_COLON,
|
94 |
-
T_OBJECT_OPERATOR,
|
95 |
-
T_FUNCTION,
|
96 |
-
T_CONST,
|
|
|
97 |
);
|
98 |
|
99 |
-
$prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
|
100 |
-
if (
|
101 |
// Not a call to a PHP function.
|
102 |
return;
|
103 |
}
|
@@ -110,10 +210,10 @@ class RequiredOptionalFunctionParametersSniff extends AbstractComplexVersionSnif
|
|
110 |
}
|
111 |
|
112 |
$parameterCount = $this->getFunctionCallParameterCount($phpcsFile, $stackPtr);
|
113 |
-
$openParenthesis = $phpcsFile->findNext(
|
114 |
|
115 |
// If the parameter count returned > 0, we know there will be valid open parenthesis.
|
116 |
-
if ($parameterCount === 0 && $tokens[$openParenthesis]['code'] !== T_OPEN_PARENTHESIS) {
|
117 |
return;
|
118 |
}
|
119 |
|
@@ -129,13 +229,14 @@ class RequiredOptionalFunctionParametersSniff extends AbstractComplexVersionSnif
|
|
129 |
$this->handleFeature($phpcsFile, $openParenthesis, $itemInfo);
|
130 |
}
|
131 |
}
|
132 |
-
|
133 |
-
}//end process()
|
134 |
|
135 |
|
136 |
/**
|
137 |
* Determine whether an error/warning should be thrown for an item based on collected information.
|
138 |
*
|
|
|
|
|
139 |
* @param array $errorInfo Detail information about an item.
|
140 |
*
|
141 |
* @return bool
|
@@ -149,6 +250,8 @@ class RequiredOptionalFunctionParametersSniff extends AbstractComplexVersionSnif
|
|
149 |
/**
|
150 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
151 |
*
|
|
|
|
|
152 |
* @param array $itemInfo Base information about the item.
|
153 |
*
|
154 |
* @return array Version and other information about the item.
|
@@ -162,6 +265,8 @@ class RequiredOptionalFunctionParametersSniff extends AbstractComplexVersionSnif
|
|
162 |
/**
|
163 |
* Get an array of the non-PHP-version array keys used in a sub-array.
|
164 |
*
|
|
|
|
|
165 |
* @return array
|
166 |
*/
|
167 |
protected function getNonVersionArrayKeys()
|
@@ -173,6 +278,8 @@ class RequiredOptionalFunctionParametersSniff extends AbstractComplexVersionSnif
|
|
173 |
/**
|
174 |
* Retrieve the relevant detail (version) information for use in an error message.
|
175 |
*
|
|
|
|
|
176 |
* @param array $itemArray Version and other information about the item.
|
177 |
* @param array $itemInfo Base information about the item.
|
178 |
*
|
@@ -198,13 +305,14 @@ class RequiredOptionalFunctionParametersSniff extends AbstractComplexVersionSnif
|
|
198 |
$errorInfo['paramName'] = $itemArray['name'];
|
199 |
|
200 |
return $errorInfo;
|
201 |
-
|
202 |
-
}//end getErrorInfo()
|
203 |
|
204 |
|
205 |
/**
|
206 |
* Get the error message template for this sniff.
|
207 |
*
|
|
|
|
|
208 |
* @return string
|
209 |
*/
|
210 |
protected function getErrorMsgTemplate()
|
@@ -216,6 +324,8 @@ class RequiredOptionalFunctionParametersSniff extends AbstractComplexVersionSnif
|
|
216 |
/**
|
217 |
* Generates the error or warning for this item.
|
218 |
*
|
|
|
|
|
219 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
220 |
* @param int $stackPtr The position of the relevant token in
|
221 |
* the stack.
|
@@ -225,7 +335,7 @@ class RequiredOptionalFunctionParametersSniff extends AbstractComplexVersionSnif
|
|
225 |
*
|
226 |
* @return void
|
227 |
*/
|
228 |
-
public function addError(
|
229 |
{
|
230 |
$error = $this->getErrorMsgTemplate();
|
231 |
$errorCode = $this->stringToErrorCode($itemInfo['name'] . '_' . $errorInfo['paramName']) . 'Missing';
|
@@ -236,8 +346,5 @@ class RequiredOptionalFunctionParametersSniff extends AbstractComplexVersionSnif
|
|
236 |
);
|
237 |
|
238 |
$phpcsFile->addError($error, $stackPtr, $errorCode, $data);
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\FunctionUse;
|
12 |
|
13 |
use PHPCompatibility\AbstractComplexVersionSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
|
17 |
/**
|
18 |
+
* Detect missing required function parameters in calls to native PHP functions.
|
19 |
*
|
20 |
+
* Specifically when those function parameters are no longer required in more recent PHP versions.
|
21 |
+
*
|
22 |
+
* PHP version All
|
23 |
+
*
|
24 |
+
* @link https://www.php.net/manual/en/doc.changelog.php
|
25 |
+
*
|
26 |
+
* @since 7.0.3
|
27 |
+
* @since 7.1.0 Now extends the `AbstractComplexVersionSniff` instead of the base `Sniff` class.
|
28 |
+
* @since 9.0.0 Renamed from `RequiredOptionalFunctionParametersSniff` to `RequiredToOptionalFunctionParametersSniff`.
|
29 |
*/
|
30 |
+
class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSniff
|
31 |
{
|
32 |
|
33 |
/**
|
38 |
* The index is the location of the parameter in the parameter list, starting at 0 !
|
39 |
* If's sufficient to list the last version in which the parameter was still required.
|
40 |
*
|
41 |
+
* @since 7.0.3
|
42 |
+
*
|
43 |
* @var array
|
44 |
*/
|
45 |
protected $functionParameters = array(
|
46 |
+
'array_merge' => array(
|
47 |
+
0 => array(
|
48 |
+
'name' => 'array(s) to merge',
|
49 |
+
'7.3' => true,
|
50 |
+
'7.4' => false,
|
51 |
+
),
|
52 |
+
),
|
53 |
+
'array_merge_recursive' => array(
|
54 |
+
0 => array(
|
55 |
+
'name' => 'array(s) to merge',
|
56 |
+
'7.3' => true,
|
57 |
+
'7.4' => false,
|
58 |
+
),
|
59 |
+
),
|
60 |
+
'array_push' => array(
|
61 |
+
1 => array(
|
62 |
+
'name' => 'element to push',
|
63 |
+
'7.2' => true,
|
64 |
+
'7.3' => false,
|
65 |
+
),
|
66 |
+
),
|
67 |
+
'array_unshift' => array(
|
68 |
+
1 => array(
|
69 |
+
'name' => 'element to prepend',
|
70 |
+
'7.2' => true,
|
71 |
+
'7.3' => false,
|
72 |
+
),
|
73 |
+
),
|
74 |
'bcscale' => array(
|
75 |
0 => array(
|
76 |
'name' => 'scale',
|
78 |
'7.3' => false,
|
79 |
),
|
80 |
),
|
81 |
+
'ftp_fget' => array(
|
82 |
+
3 => array(
|
83 |
+
'name' => 'mode',
|
84 |
+
'7.2' => true,
|
85 |
+
'7.3' => false,
|
86 |
+
),
|
87 |
+
),
|
88 |
+
'ftp_fput' => array(
|
89 |
+
3 => array(
|
90 |
+
'name' => 'mode',
|
91 |
+
'7.2' => true,
|
92 |
+
'7.3' => false,
|
93 |
+
),
|
94 |
+
),
|
95 |
+
'ftp_get' => array(
|
96 |
+
3 => array(
|
97 |
+
'name' => 'mode',
|
98 |
+
'7.2' => true,
|
99 |
+
'7.3' => false,
|
100 |
+
),
|
101 |
+
),
|
102 |
+
'ftp_nb_fget' => array(
|
103 |
+
3 => array(
|
104 |
+
'name' => 'mode',
|
105 |
+
'7.2' => true,
|
106 |
+
'7.3' => false,
|
107 |
+
),
|
108 |
+
),
|
109 |
+
'ftp_nb_fput' => array(
|
110 |
+
3 => array(
|
111 |
+
'name' => 'mode',
|
112 |
+
'7.2' => true,
|
113 |
+
'7.3' => false,
|
114 |
+
),
|
115 |
+
),
|
116 |
+
'ftp_nb_get' => array(
|
117 |
+
3 => array(
|
118 |
+
'name' => 'mode',
|
119 |
+
'7.2' => true,
|
120 |
+
'7.3' => false,
|
121 |
+
),
|
122 |
+
),
|
123 |
+
'ftp_nb_put' => array(
|
124 |
+
3 => array(
|
125 |
+
'name' => 'mode',
|
126 |
+
'7.2' => true,
|
127 |
+
'7.3' => false,
|
128 |
+
),
|
129 |
+
),
|
130 |
+
'ftp_put' => array(
|
131 |
+
3 => array(
|
132 |
+
'name' => 'mode',
|
133 |
+
'7.2' => true,
|
134 |
+
'7.3' => false,
|
135 |
+
),
|
136 |
+
),
|
137 |
'getenv' => array(
|
138 |
0 => array(
|
139 |
'name' => 'varname',
|
161 |
/**
|
162 |
* Returns an array of tokens this test wants to listen for.
|
163 |
*
|
164 |
+
* @since 7.0.3
|
165 |
+
*
|
166 |
* @return array
|
167 |
*/
|
168 |
public function register()
|
170 |
// Handle case-insensitivity of function names.
|
171 |
$this->functionParameters = $this->arrayKeysToLowercase($this->functionParameters);
|
172 |
|
173 |
+
return array(\T_STRING);
|
174 |
+
}
|
175 |
|
176 |
/**
|
177 |
* Processes this test, when one of its tokens is encountered.
|
178 |
*
|
179 |
+
* @since 7.0.3
|
180 |
+
*
|
181 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
182 |
* @param int $stackPtr The position of the current token in
|
183 |
* the stack passed in $tokens.
|
184 |
*
|
185 |
* @return void
|
186 |
*/
|
187 |
+
public function process(File $phpcsFile, $stackPtr)
|
188 |
{
|
189 |
$tokens = $phpcsFile->getTokens();
|
190 |
|
191 |
$ignore = array(
|
192 |
+
\T_DOUBLE_COLON => true,
|
193 |
+
\T_OBJECT_OPERATOR => true,
|
194 |
+
\T_FUNCTION => true,
|
195 |
+
\T_CONST => true,
|
196 |
+
\T_NEW => true,
|
197 |
);
|
198 |
|
199 |
+
$prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
|
200 |
+
if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
|
201 |
// Not a call to a PHP function.
|
202 |
return;
|
203 |
}
|
210 |
}
|
211 |
|
212 |
$parameterCount = $this->getFunctionCallParameterCount($phpcsFile, $stackPtr);
|
213 |
+
$openParenthesis = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
|
214 |
|
215 |
// If the parameter count returned > 0, we know there will be valid open parenthesis.
|
216 |
+
if ($parameterCount === 0 && $tokens[$openParenthesis]['code'] !== \T_OPEN_PARENTHESIS) {
|
217 |
return;
|
218 |
}
|
219 |
|
229 |
$this->handleFeature($phpcsFile, $openParenthesis, $itemInfo);
|
230 |
}
|
231 |
}
|
232 |
+
}
|
|
|
233 |
|
234 |
|
235 |
/**
|
236 |
* Determine whether an error/warning should be thrown for an item based on collected information.
|
237 |
*
|
238 |
+
* @since 7.1.0
|
239 |
+
*
|
240 |
* @param array $errorInfo Detail information about an item.
|
241 |
*
|
242 |
* @return bool
|
250 |
/**
|
251 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
252 |
*
|
253 |
+
* @since 7.1.0
|
254 |
+
*
|
255 |
* @param array $itemInfo Base information about the item.
|
256 |
*
|
257 |
* @return array Version and other information about the item.
|
265 |
/**
|
266 |
* Get an array of the non-PHP-version array keys used in a sub-array.
|
267 |
*
|
268 |
+
* @since 7.1.0
|
269 |
+
*
|
270 |
* @return array
|
271 |
*/
|
272 |
protected function getNonVersionArrayKeys()
|
278 |
/**
|
279 |
* Retrieve the relevant detail (version) information for use in an error message.
|
280 |
*
|
281 |
+
* @since 7.1.0
|
282 |
+
*
|
283 |
* @param array $itemArray Version and other information about the item.
|
284 |
* @param array $itemInfo Base information about the item.
|
285 |
*
|
305 |
$errorInfo['paramName'] = $itemArray['name'];
|
306 |
|
307 |
return $errorInfo;
|
308 |
+
}
|
|
|
309 |
|
310 |
|
311 |
/**
|
312 |
* Get the error message template for this sniff.
|
313 |
*
|
314 |
+
* @since 7.1.0
|
315 |
+
*
|
316 |
* @return string
|
317 |
*/
|
318 |
protected function getErrorMsgTemplate()
|
324 |
/**
|
325 |
* Generates the error or warning for this item.
|
326 |
*
|
327 |
+
* @since 7.1.0
|
328 |
+
*
|
329 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
330 |
* @param int $stackPtr The position of the relevant token in
|
331 |
* the stack.
|
335 |
*
|
336 |
* @return void
|
337 |
*/
|
338 |
+
public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
|
339 |
{
|
340 |
$error = $this->getErrorMsgTemplate();
|
341 |
$errorCode = $this->stringToErrorCode($itemInfo['name'] . '_' . $errorInfo['paramName']) . 'Missing';
|
346 |
);
|
347 |
|
348 |
$phpcsFile->addError($error, $stackPtr, $errorCode, $data);
|
349 |
+
}
|
350 |
+
}
|
|
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Generators/NewGeneratorReturnSniff.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
+
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace PHPCompatibility\Sniffs\Generators;
|
12 |
+
|
13 |
+
use PHPCompatibility\Sniff;
|
14 |
+
use PHPCompatibility\PHPCSHelper;
|
15 |
+
use PHP_CodeSniffer_File as File;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* As of PHP 7.0, a `return` statement can be used within a generator for a final expression to be returned.
|
19 |
+
*
|
20 |
+
* PHP version 7.0
|
21 |
+
*
|
22 |
+
* @link https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.generator-return-expressions
|
23 |
+
* @link https://wiki.php.net/rfc/generator-return-expressions
|
24 |
+
* @link https://www.php.net/manual/en/language.generators.syntax.php
|
25 |
+
*
|
26 |
+
* @since 8.2.0
|
27 |
+
*/
|
28 |
+
class NewGeneratorReturnSniff extends Sniff
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* Scope conditions within which a yield can exist.
|
32 |
+
*
|
33 |
+
* @since 9.0.0
|
34 |
+
*
|
35 |
+
* @var array
|
36 |
+
*/
|
37 |
+
private $validConditions = array(
|
38 |
+
\T_FUNCTION => \T_FUNCTION,
|
39 |
+
\T_CLOSURE => \T_CLOSURE,
|
40 |
+
);
|
41 |
+
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns an array of tokens this test wants to listen for.
|
45 |
+
*
|
46 |
+
* @since 8.2.0
|
47 |
+
*
|
48 |
+
* @return array
|
49 |
+
*/
|
50 |
+
public function register()
|
51 |
+
{
|
52 |
+
$targets = array(
|
53 |
+
\T_YIELD,
|
54 |
+
);
|
55 |
+
|
56 |
+
/*
|
57 |
+
* The `yield` keyword was introduced in PHP 5.5 with the token T_YIELD.
|
58 |
+
* The `yield from` keyword was introduced in PHP 7.0 and tokenizes as
|
59 |
+
* "T_YIELD T_WHITESPACE T_STRING".
|
60 |
+
*
|
61 |
+
* Pre-PHPCS 3.1.0, the T_YIELD token was not correctly back-filled for PHP < 5.5.
|
62 |
+
* Also, as of PHPCS 3.1.0, the PHPCS tokenizer adds a new T_YIELD_FROM
|
63 |
+
* token.
|
64 |
+
*
|
65 |
+
* So for PHP 5.3-5.4 icw PHPCS < 3.1.0, we need to look for T_STRING with content "yield".
|
66 |
+
* For PHP 5.5+ we need to look for T_YIELD.
|
67 |
+
* For PHPCS 3.1.0+, we also need to look for T_YIELD_FROM.
|
68 |
+
*/
|
69 |
+
if (version_compare(\PHP_VERSION_ID, '50500', '<') === true
|
70 |
+
&& version_compare(PHPCSHelper::getVersion(), '3.1.0', '<') === true
|
71 |
+
) {
|
72 |
+
$targets[] = \T_STRING;
|
73 |
+
}
|
74 |
+
|
75 |
+
if (\defined('T_YIELD_FROM')) {
|
76 |
+
$targets[] = \T_YIELD_FROM;
|
77 |
+
}
|
78 |
+
|
79 |
+
return $targets;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Processes this test, when one of its tokens is encountered.
|
84 |
+
*
|
85 |
+
* @since 8.2.0
|
86 |
+
*
|
87 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
88 |
+
* @param int $stackPtr The position of the current token in the
|
89 |
+
* stack passed in $tokens.
|
90 |
+
*
|
91 |
+
* @return void|int Void or a stack pointer to skip forward.
|
92 |
+
*/
|
93 |
+
public function process(File $phpcsFile, $stackPtr)
|
94 |
+
{
|
95 |
+
if ($this->supportsBelow('5.6') !== true) {
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
|
99 |
+
$tokens = $phpcsFile->getTokens();
|
100 |
+
|
101 |
+
if ($tokens[$stackPtr]['code'] === \T_STRING
|
102 |
+
&& $tokens[$stackPtr]['content'] !== 'yield'
|
103 |
+
) {
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
|
107 |
+
if (empty($tokens[$stackPtr]['conditions']) === true) {
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
+
// Walk the condition from inner to outer to see if we can find a valid function/closure scope.
|
112 |
+
$conditions = array_reverse($tokens[$stackPtr]['conditions'], true);
|
113 |
+
foreach ($conditions as $ptr => $type) {
|
114 |
+
if (isset($this->validConditions[$type]) === true) {
|
115 |
+
$function = $ptr;
|
116 |
+
break;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
if (isset($function) === false) {
|
121 |
+
// Yield outside function scope, fatal error, but not our concern.
|
122 |
+
return;
|
123 |
+
}
|
124 |
+
|
125 |
+
if (isset($tokens[$function]['scope_opener'], $tokens[$function]['scope_closer']) === false) {
|
126 |
+
// Can't reliably determine start/end of function scope.
|
127 |
+
return;
|
128 |
+
}
|
129 |
+
|
130 |
+
$targets = array(\T_RETURN, \T_CLOSURE, \T_FUNCTION, \T_CLASS);
|
131 |
+
if (\defined('T_ANON_CLASS')) {
|
132 |
+
$targets[] = \T_ANON_CLASS;
|
133 |
+
}
|
134 |
+
|
135 |
+
$current = $tokens[$function]['scope_opener'];
|
136 |
+
|
137 |
+
while (($current = $phpcsFile->findNext($targets, ($current + 1), $tokens[$function]['scope_closer'])) !== false) {
|
138 |
+
if ($tokens[$current]['code'] === \T_RETURN) {
|
139 |
+
$phpcsFile->addError(
|
140 |
+
'Returning a final expression from a generator was not supported in PHP 5.6 or earlier',
|
141 |
+
$current,
|
142 |
+
'ReturnFound'
|
143 |
+
);
|
144 |
+
|
145 |
+
return $tokens[$function]['scope_closer'];
|
146 |
+
}
|
147 |
+
|
148 |
+
// Found a nested scope in which return can exist without problems.
|
149 |
+
if (isset($tokens[$current]['scope_closer'])) {
|
150 |
+
// Skip past the nested scope.
|
151 |
+
$current = $tokens[$current]['scope_closer'];
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
// Don't examine this function again.
|
156 |
+
return $tokens[$function]['scope_closer'];
|
157 |
+
}
|
158 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → IniDirectives}/NewIniDirectivesSniff.php
RENAMED
@@ -1,26 +1,30 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @category PHP
|
6 |
* @package PHPCompatibility
|
7 |
-
* @
|
8 |
-
* @
|
|
|
9 |
*/
|
10 |
|
11 |
-
namespace PHPCompatibility\Sniffs\
|
12 |
|
13 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
|
|
14 |
|
15 |
/**
|
16 |
-
*
|
17 |
*
|
18 |
-
*
|
19 |
*
|
20 |
-
* @
|
21 |
-
* @
|
22 |
-
*
|
23 |
-
* @
|
|
|
|
|
|
|
24 |
*/
|
25 |
class NewIniDirectivesSniff extends AbstractNewFeatureSniff
|
26 |
{
|
@@ -30,6 +34,9 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
|
|
30 |
* The array lists : version number with false (not present) or true (present).
|
31 |
* If's sufficient to list the first version where the ini directive appears.
|
32 |
*
|
|
|
|
|
|
|
33 |
* @var array(string)
|
34 |
*/
|
35 |
protected $newIniDirectives = array(
|
@@ -426,6 +433,130 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
|
|
426 |
'5.4' => false,
|
427 |
'5.5' => true,
|
428 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
429 |
|
430 |
'session.use_strict_mode' => array(
|
431 |
'5.5.1' => false,
|
@@ -453,7 +584,36 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
|
|
453 |
'5.6' => false,
|
454 |
'7.0' => true,
|
455 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
457 |
'session.sid_length' => array(
|
458 |
'7.0' => false,
|
459 |
'7.1' => true,
|
@@ -462,41 +622,100 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
|
|
462 |
'7.0' => false,
|
463 |
'7.1' => true,
|
464 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
);
|
466 |
|
467 |
/**
|
468 |
* Returns an array of tokens this test wants to listen for.
|
469 |
*
|
|
|
|
|
470 |
* @return array
|
471 |
*/
|
472 |
public function register()
|
473 |
{
|
474 |
-
return array(T_STRING);
|
475 |
-
|
476 |
-
}//end register()
|
477 |
|
478 |
/**
|
479 |
* Processes this test, when one of its tokens is encountered.
|
480 |
*
|
|
|
|
|
481 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
482 |
* @param int $stackPtr The position of the current token in the
|
483 |
* stack passed in $tokens.
|
484 |
*
|
485 |
* @return void
|
486 |
*/
|
487 |
-
public function process(
|
488 |
{
|
489 |
$tokens = $phpcsFile->getTokens();
|
490 |
|
491 |
$ignore = array(
|
492 |
-
T_DOUBLE_COLON,
|
493 |
-
T_OBJECT_OPERATOR,
|
494 |
-
T_FUNCTION,
|
495 |
-
T_CONST,
|
496 |
);
|
497 |
|
498 |
-
$prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
|
499 |
-
if (
|
500 |
// Not a call to a PHP function.
|
501 |
return;
|
502 |
}
|
@@ -521,13 +740,14 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
|
|
521 |
'functionLc' => $functionLc,
|
522 |
);
|
523 |
$this->handleFeature($phpcsFile, $iniToken['end'], $itemInfo);
|
524 |
-
|
525 |
-
}//end process()
|
526 |
|
527 |
|
528 |
/**
|
529 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
530 |
*
|
|
|
|
|
531 |
* @param array $itemInfo Base information about the item.
|
532 |
*
|
533 |
* @return array Version and other information about the item.
|
@@ -541,6 +761,8 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
|
|
541 |
/**
|
542 |
* Get an array of the non-PHP-version array keys used in a sub-array.
|
543 |
*
|
|
|
|
|
544 |
* @return array
|
545 |
*/
|
546 |
protected function getNonVersionArrayKeys()
|
@@ -552,6 +774,8 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
|
|
552 |
/**
|
553 |
* Retrieve the relevant detail (version) information for use in an error message.
|
554 |
*
|
|
|
|
|
555 |
* @param array $itemArray Version and other information about the item.
|
556 |
* @param array $itemInfo Base information about the item.
|
557 |
*
|
@@ -578,6 +802,8 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
|
|
578 |
/**
|
579 |
* Get the error message template for this sniff.
|
580 |
*
|
|
|
|
|
581 |
* @return string
|
582 |
*/
|
583 |
protected function getErrorMsgTemplate()
|
@@ -589,6 +815,8 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
|
|
589 |
/**
|
590 |
* Allow for concrete child classes to filter the error message before it's passed to PHPCS.
|
591 |
*
|
|
|
|
|
592 |
* @param string $error The error message which was created.
|
593 |
* @param array $itemInfo Base information about the item this error message applies to.
|
594 |
* @param array $errorInfo Detail information about an item this error message applies to.
|
@@ -608,6 +836,8 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
|
|
608 |
/**
|
609 |
* Allow for concrete child classes to filter the error data before it's passed to PHPCS.
|
610 |
*
|
|
|
|
|
611 |
* @param array $data The error data array which was created.
|
612 |
* @param array $itemInfo Base information about the item this error message applies to.
|
613 |
* @param array $errorInfo Detail information about an item this error message applies to.
|
@@ -622,6 +852,4 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
|
|
622 |
|
623 |
return $data;
|
624 |
}
|
625 |
-
|
626 |
-
|
627 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
|
|
5 |
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\IniDirectives;
|
12 |
|
13 |
use PHPCompatibility\AbstractNewFeatureSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
17 |
+
* Detect the use of new INI directives through `ini_set()` or `ini_get()`.
|
18 |
*
|
19 |
+
* PHP version All
|
20 |
*
|
21 |
+
* @link https://www.php.net/manual/en/ini.list.php
|
22 |
+
* @link https://www.php.net/manual/en/ini.core.php
|
23 |
+
*
|
24 |
+
* @since 5.5
|
25 |
+
* @since 7.0.7 When a new directive is used with `ini_set()`, the sniff will now throw an error
|
26 |
+
* instead of a warning.
|
27 |
+
* @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class..
|
28 |
*/
|
29 |
class NewIniDirectivesSniff extends AbstractNewFeatureSniff
|
30 |
{
|
34 |
* The array lists : version number with false (not present) or true (present).
|
35 |
* If's sufficient to list the first version where the ini directive appears.
|
36 |
*
|
37 |
+
* @since 5.5
|
38 |
+
* @since 7.0.3 Support for 'alternative' has been added.
|
39 |
+
*
|
40 |
* @var array(string)
|
41 |
*/
|
42 |
protected $newIniDirectives = array(
|
433 |
'5.4' => false,
|
434 |
'5.5' => true,
|
435 |
),
|
436 |
+
'opcache.enable' => array(
|
437 |
+
'5.4' => false,
|
438 |
+
'5.5' => true,
|
439 |
+
),
|
440 |
+
'opcache.enable_cli' => array(
|
441 |
+
'5.4' => false,
|
442 |
+
'5.5' => true,
|
443 |
+
),
|
444 |
+
'opcache.memory_consumption' => array(
|
445 |
+
'5.4' => false,
|
446 |
+
'5.5' => true,
|
447 |
+
),
|
448 |
+
'opcache.interned_strings_buffer' => array(
|
449 |
+
'5.4' => false,
|
450 |
+
'5.5' => true,
|
451 |
+
),
|
452 |
+
'opcache.max_accelerated_files' => array(
|
453 |
+
'5.4' => false,
|
454 |
+
'5.5' => true,
|
455 |
+
),
|
456 |
+
'opcache.max_wasted_percentage' => array(
|
457 |
+
'5.4' => false,
|
458 |
+
'5.5' => true,
|
459 |
+
),
|
460 |
+
'opcache.use_cwd' => array(
|
461 |
+
'5.4' => false,
|
462 |
+
'5.5' => true,
|
463 |
+
),
|
464 |
+
'opcache.validate_timestamps' => array(
|
465 |
+
'5.4' => false,
|
466 |
+
'5.5' => true,
|
467 |
+
),
|
468 |
+
'opcache.revalidate_freq' => array(
|
469 |
+
'5.4' => false,
|
470 |
+
'5.5' => true,
|
471 |
+
),
|
472 |
+
'opcache.revalidate_path' => array(
|
473 |
+
'5.4' => false,
|
474 |
+
'5.5' => true,
|
475 |
+
),
|
476 |
+
'opcache.save_comments' => array(
|
477 |
+
'5.4' => false,
|
478 |
+
'5.5' => true,
|
479 |
+
),
|
480 |
+
'opcache.load_comments' => array(
|
481 |
+
'5.4' => false,
|
482 |
+
'5.5' => true,
|
483 |
+
),
|
484 |
+
'opcache.fast_shutdown' => array(
|
485 |
+
'5.4' => false,
|
486 |
+
'5.5' => true,
|
487 |
+
),
|
488 |
+
'opcache.enable_file_override' => array(
|
489 |
+
'5.4' => false,
|
490 |
+
'5.5' => true,
|
491 |
+
),
|
492 |
+
'opcache.optimization_level' => array(
|
493 |
+
'5.4' => false,
|
494 |
+
'5.5' => true,
|
495 |
+
),
|
496 |
+
'opcache.inherited_hack' => array(
|
497 |
+
'5.4' => false,
|
498 |
+
'5.5' => true,
|
499 |
+
),
|
500 |
+
'opcache.dups_fix' => array(
|
501 |
+
'5.4' => false,
|
502 |
+
'5.5' => true,
|
503 |
+
),
|
504 |
+
'opcache.blacklist_filename' => array(
|
505 |
+
'5.4' => false,
|
506 |
+
'5.5' => true,
|
507 |
+
),
|
508 |
+
'opcache.max_file_size' => array(
|
509 |
+
'5.4' => false,
|
510 |
+
'5.5' => true,
|
511 |
+
),
|
512 |
+
'opcache.consistency_checks' => array(
|
513 |
+
'5.4' => false,
|
514 |
+
'5.5' => true,
|
515 |
+
),
|
516 |
+
'opcache.force_restart_timeout' => array(
|
517 |
+
'5.4' => false,
|
518 |
+
'5.5' => true,
|
519 |
+
),
|
520 |
+
'opcache.error_log' => array(
|
521 |
+
'5.4' => false,
|
522 |
+
'5.5' => true,
|
523 |
+
),
|
524 |
+
'opcache.log_verbosity_level' => array(
|
525 |
+
'5.4' => false,
|
526 |
+
'5.5' => true,
|
527 |
+
),
|
528 |
+
'opcache.preferred_memory_model' => array(
|
529 |
+
'5.4' => false,
|
530 |
+
'5.5' => true,
|
531 |
+
),
|
532 |
+
'opcache.protect_memory' => array(
|
533 |
+
'5.4' => false,
|
534 |
+
'5.5' => true,
|
535 |
+
),
|
536 |
+
'opcache.mmap_base' => array(
|
537 |
+
'5.4' => false,
|
538 |
+
'5.5' => true,
|
539 |
+
),
|
540 |
+
'opcache.restrict_api' => array(
|
541 |
+
'5.4' => false,
|
542 |
+
'5.5' => true,
|
543 |
+
),
|
544 |
+
'opcache.file_update_protection' => array(
|
545 |
+
'5.4' => false,
|
546 |
+
'5.5' => true,
|
547 |
+
),
|
548 |
+
'opcache.huge_code_pages' => array(
|
549 |
+
'5.4' => false,
|
550 |
+
'5.5' => true,
|
551 |
+
),
|
552 |
+
'opcache.lockfile_path' => array(
|
553 |
+
'5.4' => false,
|
554 |
+
'5.5' => true,
|
555 |
+
),
|
556 |
+
'opcache.opt_debug_level' => array(
|
557 |
+
'5.4' => false,
|
558 |
+
'5.5' => true,
|
559 |
+
),
|
560 |
|
561 |
'session.use_strict_mode' => array(
|
562 |
'5.5.1' => false,
|
584 |
'5.6' => false,
|
585 |
'7.0' => true,
|
586 |
),
|
587 |
+
'opcache.file_cache' => array(
|
588 |
+
'5.6' => false,
|
589 |
+
'7.0' => true,
|
590 |
+
),
|
591 |
+
'opcache.file_cache_only' => array(
|
592 |
+
'5.6' => false,
|
593 |
+
'7.0' => true,
|
594 |
+
),
|
595 |
+
'opcache.file_cache_consistency_checks' => array(
|
596 |
+
'5.6' => false,
|
597 |
+
'7.0' => true,
|
598 |
+
),
|
599 |
+
'opcache.file_cache_fallback' => array(
|
600 |
+
'5.6' => false,
|
601 |
+
'7.0' => true,
|
602 |
+
), // Windows only.
|
603 |
|
604 |
+
'opcache.validate_permission' => array(
|
605 |
+
'7.0.13' => false,
|
606 |
+
'7.0.14' => true,
|
607 |
+
),
|
608 |
+
'opcache.validate_root' => array(
|
609 |
+
'7.0.13' => false,
|
610 |
+
'7.0.14' => true,
|
611 |
+
),
|
612 |
+
|
613 |
+
'hard_timeout' => array(
|
614 |
+
'7.0' => false,
|
615 |
+
'7.1' => true,
|
616 |
+
),
|
617 |
'session.sid_length' => array(
|
618 |
'7.0' => false,
|
619 |
'7.1' => true,
|
622 |
'7.0' => false,
|
623 |
'7.1' => true,
|
624 |
),
|
625 |
+
'session.trans_sid_hosts' => array(
|
626 |
+
'7.0' => false,
|
627 |
+
'7.1' => true,
|
628 |
+
),
|
629 |
+
'session.trans_sid_tags' => array(
|
630 |
+
'7.0' => false,
|
631 |
+
'7.1' => true,
|
632 |
+
),
|
633 |
+
'url_rewriter.hosts' => array(
|
634 |
+
'7.0' => false,
|
635 |
+
'7.1' => true,
|
636 |
+
),
|
637 |
+
|
638 |
+
// Introduced in PHP 7.1.25, 7.2.13, 7.3.0.
|
639 |
+
'imap.enable_insecure_rsh' => array(
|
640 |
+
'7.1.24' => false,
|
641 |
+
'7.1.25' => true,
|
642 |
+
),
|
643 |
+
|
644 |
+
'syslog.facility' => array(
|
645 |
+
'7.2' => false,
|
646 |
+
'7.3' => true,
|
647 |
+
),
|
648 |
+
'syslog.filter' => array(
|
649 |
+
'7.2' => false,
|
650 |
+
'7.3' => true,
|
651 |
+
),
|
652 |
+
'syslog.ident' => array(
|
653 |
+
'7.2' => false,
|
654 |
+
'7.3' => true,
|
655 |
+
),
|
656 |
+
'session.cookie_samesite' => array(
|
657 |
+
'7.2' => false,
|
658 |
+
'7.3' => true,
|
659 |
+
),
|
660 |
+
|
661 |
+
'ffi.enable' => array(
|
662 |
+
'7.3' => false,
|
663 |
+
'7.4' => true,
|
664 |
+
),
|
665 |
+
'ffi.preload' => array(
|
666 |
+
'7.3' => false,
|
667 |
+
'7.4' => true,
|
668 |
+
),
|
669 |
+
'opcache.cache_id' => array(
|
670 |
+
'7.3' => false,
|
671 |
+
'7.4' => true,
|
672 |
+
),
|
673 |
+
'opcache.preload' => array(
|
674 |
+
'7.3' => false,
|
675 |
+
'7.4' => true,
|
676 |
+
),
|
677 |
+
'zend.exception_ignore_args' => array(
|
678 |
+
'7.3' => false,
|
679 |
+
'7.4' => true,
|
680 |
+
),
|
681 |
);
|
682 |
|
683 |
/**
|
684 |
* Returns an array of tokens this test wants to listen for.
|
685 |
*
|
686 |
+
* @since 5.5
|
687 |
+
*
|
688 |
* @return array
|
689 |
*/
|
690 |
public function register()
|
691 |
{
|
692 |
+
return array(\T_STRING);
|
693 |
+
}
|
|
|
694 |
|
695 |
/**
|
696 |
* Processes this test, when one of its tokens is encountered.
|
697 |
*
|
698 |
+
* @since 5.5
|
699 |
+
*
|
700 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
701 |
* @param int $stackPtr The position of the current token in the
|
702 |
* stack passed in $tokens.
|
703 |
*
|
704 |
* @return void
|
705 |
*/
|
706 |
+
public function process(File $phpcsFile, $stackPtr)
|
707 |
{
|
708 |
$tokens = $phpcsFile->getTokens();
|
709 |
|
710 |
$ignore = array(
|
711 |
+
\T_DOUBLE_COLON => true,
|
712 |
+
\T_OBJECT_OPERATOR => true,
|
713 |
+
\T_FUNCTION => true,
|
714 |
+
\T_CONST => true,
|
715 |
);
|
716 |
|
717 |
+
$prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
|
718 |
+
if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
|
719 |
// Not a call to a PHP function.
|
720 |
return;
|
721 |
}
|
740 |
'functionLc' => $functionLc,
|
741 |
);
|
742 |
$this->handleFeature($phpcsFile, $iniToken['end'], $itemInfo);
|
743 |
+
}
|
|
|
744 |
|
745 |
|
746 |
/**
|
747 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
748 |
*
|
749 |
+
* @since 7.1.0
|
750 |
+
*
|
751 |
* @param array $itemInfo Base information about the item.
|
752 |
*
|
753 |
* @return array Version and other information about the item.
|
761 |
/**
|
762 |
* Get an array of the non-PHP-version array keys used in a sub-array.
|
763 |
*
|
764 |
+
* @since 7.1.0
|
765 |
+
*
|
766 |
* @return array
|
767 |
*/
|
768 |
protected function getNonVersionArrayKeys()
|
774 |
/**
|
775 |
* Retrieve the relevant detail (version) information for use in an error message.
|
776 |
*
|
777 |
+
* @since 7.1.0
|
778 |
+
*
|
779 |
* @param array $itemArray Version and other information about the item.
|
780 |
* @param array $itemInfo Base information about the item.
|
781 |
*
|
802 |
/**
|
803 |
* Get the error message template for this sniff.
|
804 |
*
|
805 |
+
* @since 7.1.0
|
806 |
+
*
|
807 |
* @return string
|
808 |
*/
|
809 |
protected function getErrorMsgTemplate()
|
815 |
/**
|
816 |
* Allow for concrete child classes to filter the error message before it's passed to PHPCS.
|
817 |
*
|
818 |
+
* @since 7.1.0
|
819 |
+
*
|
820 |
* @param string $error The error message which was created.
|
821 |
* @param array $itemInfo Base information about the item this error message applies to.
|
822 |
* @param array $errorInfo Detail information about an item this error message applies to.
|
836 |
/**
|
837 |
* Allow for concrete child classes to filter the error data before it's passed to PHPCS.
|
838 |
*
|
839 |
+
* @since 7.1.0
|
840 |
+
*
|
841 |
* @param array $data The error data array which was created.
|
842 |
* @param array $itemInfo Base information about the item this error message applies to.
|
843 |
* @param array $errorInfo Detail information about an item this error message applies to.
|
852 |
|
853 |
return $data;
|
854 |
}
|
855 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/DeprecatedIniDirectivesSniff.php → IniDirectives/RemovedIniDirectivesSniff.php}
RENAMED
@@ -1,35 +1,44 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @category PHP
|
6 |
* @package PHPCompatibility
|
7 |
-
* @
|
8 |
-
* @
|
|
|
9 |
*/
|
10 |
|
11 |
-
namespace PHPCompatibility\Sniffs\
|
12 |
|
13 |
use PHPCompatibility\AbstractRemovedFeatureSniff;
|
|
|
14 |
|
15 |
/**
|
16 |
-
*
|
17 |
*
|
18 |
-
*
|
19 |
*
|
20 |
-
* @
|
21 |
-
* @
|
22 |
-
*
|
23 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
24 |
*/
|
25 |
-
class
|
26 |
{
|
27 |
/**
|
28 |
-
* A list of deprecated INI directives.
|
29 |
*
|
30 |
* The array lists : version number with false (deprecated) and true (removed).
|
31 |
* If's sufficient to list the first version where the ini directive was deprecated/removed.
|
32 |
*
|
|
|
|
|
|
|
33 |
* @var array(string)
|
34 |
*/
|
35 |
protected $deprecatedIniDirectives = array(
|
@@ -37,6 +46,27 @@ class DeprecatedIniDirectivesSniff extends AbstractRemovedFeatureSniff
|
|
37 |
'5.1' => true,
|
38 |
'alternative' => 'fbsql.batchsize',
|
39 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
'ifx.allow_persistent' => array(
|
42 |
'5.2.1' => true,
|
@@ -182,6 +212,9 @@ class DeprecatedIniDirectivesSniff extends AbstractRemovedFeatureSniff
|
|
182 |
'xsl.security_prefs' => array(
|
183 |
'7.0' => true,
|
184 |
),
|
|
|
|
|
|
|
185 |
|
186 |
'mcrypt.algorithms_dir' => array(
|
187 |
'7.1' => false,
|
@@ -216,41 +249,89 @@ class DeprecatedIniDirectivesSniff extends AbstractRemovedFeatureSniff
|
|
216 |
'opcache.fast_shutdown' => array(
|
217 |
'7.2' => true,
|
218 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
);
|
220 |
|
221 |
/**
|
222 |
* Returns an array of tokens this test wants to listen for.
|
223 |
*
|
|
|
|
|
224 |
* @return array
|
225 |
*/
|
226 |
public function register()
|
227 |
{
|
228 |
-
return array(T_STRING);
|
229 |
-
|
230 |
-
}//end register()
|
231 |
|
232 |
/**
|
233 |
* Processes this test, when one of its tokens is encountered.
|
234 |
*
|
|
|
|
|
235 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
236 |
* @param int $stackPtr The position of the current token in the
|
237 |
* stack passed in $tokens.
|
238 |
*
|
239 |
* @return void
|
240 |
*/
|
241 |
-
public function process(
|
242 |
{
|
243 |
$tokens = $phpcsFile->getTokens();
|
244 |
|
245 |
$ignore = array(
|
246 |
-
T_DOUBLE_COLON,
|
247 |
-
T_OBJECT_OPERATOR,
|
248 |
-
T_FUNCTION,
|
249 |
-
T_CONST,
|
250 |
);
|
251 |
|
252 |
-
$prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
|
253 |
-
if (
|
254 |
// Not a call to a PHP function.
|
255 |
return;
|
256 |
}
|
@@ -275,13 +356,14 @@ class DeprecatedIniDirectivesSniff extends AbstractRemovedFeatureSniff
|
|
275 |
'functionLc' => $functionLc,
|
276 |
);
|
277 |
$this->handleFeature($phpcsFile, $iniToken['end'], $itemInfo);
|
278 |
-
|
279 |
-
}//end process()
|
280 |
|
281 |
|
282 |
/**
|
283 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
284 |
*
|
|
|
|
|
285 |
* @param array $itemInfo Base information about the item.
|
286 |
*
|
287 |
* @return array Version and other information about the item.
|
@@ -295,6 +377,8 @@ class DeprecatedIniDirectivesSniff extends AbstractRemovedFeatureSniff
|
|
295 |
/**
|
296 |
* Retrieve the relevant detail (version) information for use in an error message.
|
297 |
*
|
|
|
|
|
298 |
* @param array $itemArray Version and other information about the item.
|
299 |
* @param array $itemInfo Base information about the item.
|
300 |
*
|
@@ -316,6 +400,8 @@ class DeprecatedIniDirectivesSniff extends AbstractRemovedFeatureSniff
|
|
316 |
/**
|
317 |
* Get the error message template for this sniff.
|
318 |
*
|
|
|
|
|
319 |
* @return string
|
320 |
*/
|
321 |
protected function getErrorMsgTemplate()
|
@@ -327,12 +413,12 @@ class DeprecatedIniDirectivesSniff extends AbstractRemovedFeatureSniff
|
|
327 |
/**
|
328 |
* Get the error message template for suggesting an alternative for a specific sniff.
|
329 |
*
|
|
|
|
|
330 |
* @return string
|
331 |
*/
|
332 |
protected function getAlternativeOptionTemplate()
|
333 |
{
|
334 |
-
return str_replace(
|
335 |
}
|
336 |
-
|
337 |
-
|
338 |
-
}//end class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
|
|
5 |
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\IniDirectives;
|
12 |
|
13 |
use PHPCompatibility\AbstractRemovedFeatureSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
17 |
+
* Detect the use of deprecated and removed INI directives through `ini_set()` or `ini_get()`.
|
18 |
*
|
19 |
+
* PHP version All
|
20 |
*
|
21 |
+
* @link https://www.php.net/manual/en/ini.list.php
|
22 |
+
* @link https://www.php.net/manual/en/ini.core.php
|
23 |
+
*
|
24 |
+
* @since 5.5
|
25 |
+
* @since 7.0.0 This sniff now throws a warning (deprecated) or an error (removed) depending
|
26 |
+
* on the `testVersion` set. Previously it would always throw a warning.
|
27 |
+
* @since 7.0.1 The sniff will now only throw warnings for `ini_get()`.
|
28 |
+
* @since 7.1.0 Now extends the `AbstractRemovedFeatureSniff` instead of the base `Sniff` class.
|
29 |
+
* @since 9.0.0 Renamed from `DeprecatedIniDirectivesSniff` to `RemovedIniDirectivesSniff`.
|
30 |
*/
|
31 |
+
class RemovedIniDirectivesSniff extends AbstractRemovedFeatureSniff
|
32 |
{
|
33 |
/**
|
34 |
+
* A list of deprecated/removed INI directives.
|
35 |
*
|
36 |
* The array lists : version number with false (deprecated) and true (removed).
|
37 |
* If's sufficient to list the first version where the ini directive was deprecated/removed.
|
38 |
*
|
39 |
+
* @since 5.5
|
40 |
+
* @since 7.0.3 Support for 'alternative' has been added.
|
41 |
+
*
|
42 |
* @var array(string)
|
43 |
*/
|
44 |
protected $deprecatedIniDirectives = array(
|
46 |
'5.1' => true,
|
47 |
'alternative' => 'fbsql.batchsize',
|
48 |
),
|
49 |
+
'pfpro.defaulthost' => array(
|
50 |
+
'5.1' => true,
|
51 |
+
),
|
52 |
+
'pfpro.defaultport' => array(
|
53 |
+
'5.1' => true,
|
54 |
+
),
|
55 |
+
'pfpro.defaulttimeout' => array(
|
56 |
+
'5.1' => true,
|
57 |
+
),
|
58 |
+
'pfpro.proxyaddress' => array(
|
59 |
+
'5.1' => true,
|
60 |
+
),
|
61 |
+
'pfpro.proxyport' => array(
|
62 |
+
'5.1' => true,
|
63 |
+
),
|
64 |
+
'pfpro.proxylogon' => array(
|
65 |
+
'5.1' => true,
|
66 |
+
),
|
67 |
+
'pfpro.proxypassword' => array(
|
68 |
+
'5.1' => true,
|
69 |
+
),
|
70 |
|
71 |
'ifx.allow_persistent' => array(
|
72 |
'5.2.1' => true,
|
212 |
'xsl.security_prefs' => array(
|
213 |
'7.0' => true,
|
214 |
),
|
215 |
+
'opcache.load_comments' => array(
|
216 |
+
'7.0' => true,
|
217 |
+
),
|
218 |
|
219 |
'mcrypt.algorithms_dir' => array(
|
220 |
'7.1' => false,
|
249 |
'opcache.fast_shutdown' => array(
|
250 |
'7.2' => true,
|
251 |
),
|
252 |
+
|
253 |
+
'birdstep.max_links' => array(
|
254 |
+
'7.3' => true,
|
255 |
+
),
|
256 |
+
'opcache.inherited_hack' => array(
|
257 |
+
'5.3' => false, // Soft deprecated, i.e. ignored.
|
258 |
+
'7.3' => true,
|
259 |
+
),
|
260 |
+
'pdo_odbc.db2_instance_name' => array(
|
261 |
+
'7.3' => false, // Has been marked as deprecated in the manual from before this time. Now hard-deprecated.
|
262 |
+
),
|
263 |
+
|
264 |
+
'allow_url_include' => array(
|
265 |
+
'7.4' => false,
|
266 |
+
),
|
267 |
+
'ibase.allow_persistent' => array(
|
268 |
+
'7.4' => true,
|
269 |
+
),
|
270 |
+
'ibase.max_persistent' => array(
|
271 |
+
'7.4' => true,
|
272 |
+
),
|
273 |
+
'ibase.max_links' => array(
|
274 |
+
'7.4' => true,
|
275 |
+
),
|
276 |
+
'ibase.default_db' => array(
|
277 |
+
'7.4' => true,
|
278 |
+
),
|
279 |
+
'ibase.default_user' => array(
|
280 |
+
'7.4' => true,
|
281 |
+
),
|
282 |
+
'ibase.default_password' => array(
|
283 |
+
'7.4' => true,
|
284 |
+
),
|
285 |
+
'ibase.default_charset' => array(
|
286 |
+
'7.4' => true,
|
287 |
+
),
|
288 |
+
'ibase.timestampformat' => array(
|
289 |
+
'7.4' => true,
|
290 |
+
),
|
291 |
+
'ibase.dateformat' => array(
|
292 |
+
'7.4' => true,
|
293 |
+
),
|
294 |
+
'ibase.timeformat' => array(
|
295 |
+
'7.4' => true,
|
296 |
+
),
|
297 |
);
|
298 |
|
299 |
/**
|
300 |
* Returns an array of tokens this test wants to listen for.
|
301 |
*
|
302 |
+
* @since 5.5
|
303 |
+
*
|
304 |
* @return array
|
305 |
*/
|
306 |
public function register()
|
307 |
{
|
308 |
+
return array(\T_STRING);
|
309 |
+
}
|
|
|
310 |
|
311 |
/**
|
312 |
* Processes this test, when one of its tokens is encountered.
|
313 |
*
|
314 |
+
* @since 5.5
|
315 |
+
*
|
316 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
317 |
* @param int $stackPtr The position of the current token in the
|
318 |
* stack passed in $tokens.
|
319 |
*
|
320 |
* @return void
|
321 |
*/
|
322 |
+
public function process(File $phpcsFile, $stackPtr)
|
323 |
{
|
324 |
$tokens = $phpcsFile->getTokens();
|
325 |
|
326 |
$ignore = array(
|
327 |
+
\T_DOUBLE_COLON => true,
|
328 |
+
\T_OBJECT_OPERATOR => true,
|
329 |
+
\T_FUNCTION => true,
|
330 |
+
\T_CONST => true,
|
331 |
);
|
332 |
|
333 |
+
$prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
|
334 |
+
if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
|
335 |
// Not a call to a PHP function.
|
336 |
return;
|
337 |
}
|
356 |
'functionLc' => $functionLc,
|
357 |
);
|
358 |
$this->handleFeature($phpcsFile, $iniToken['end'], $itemInfo);
|
359 |
+
}
|
|
|
360 |
|
361 |
|
362 |
/**
|
363 |
* Get the relevant sub-array for a specific item from a multi-dimensional array.
|
364 |
*
|
365 |
+
* @since 7.1.0
|
366 |
+
*
|
367 |
* @param array $itemInfo Base information about the item.
|
368 |
*
|
369 |
* @return array Version and other information about the item.
|
377 |
/**
|
378 |
* Retrieve the relevant detail (version) information for use in an error message.
|
379 |
*
|
380 |
+
* @since 7.1.0
|
381 |
+
*
|
382 |
* @param array $itemArray Version and other information about the item.
|
383 |
* @param array $itemInfo Base information about the item.
|
384 |
*
|
400 |
/**
|
401 |
* Get the error message template for this sniff.
|
402 |
*
|
403 |
+
* @since 7.1.0
|
404 |
+
*
|
405 |
* @return string
|
406 |
*/
|
407 |
protected function getErrorMsgTemplate()
|
413 |
/**
|
414 |
* Get the error message template for suggesting an alternative for a specific sniff.
|
415 |
*
|
416 |
+
* @since 7.1.0
|
417 |
+
*
|
418 |
* @return string
|
419 |
*/
|
420 |
protected function getAlternativeOptionTemplate()
|
421 |
{
|
422 |
+
return str_replace('%s', "'%s'", parent::getAlternativeOptionTemplate());
|
423 |
}
|
424 |
+
}
|
|
|
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/ConstantArraysUsingConstSniff.php → InitialValue/NewConstantArraysUsingConstSniff.php}
RENAMED
@@ -1,52 +1,57 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
|
|
15 |
|
16 |
/**
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* Constant arrays using the constant keyword in PHP 5.6
|
20 |
*
|
21 |
* PHP version 5.6
|
22 |
*
|
23 |
-
* @
|
24 |
-
* @
|
25 |
-
*
|
|
|
|
|
26 |
*/
|
27 |
-
class
|
28 |
{
|
29 |
|
30 |
/**
|
31 |
* Returns an array of tokens this test wants to listen for.
|
32 |
*
|
|
|
|
|
33 |
* @return array
|
34 |
*/
|
35 |
public function register()
|
36 |
{
|
37 |
-
return array(T_CONST);
|
38 |
}
|
39 |
|
40 |
/**
|
41 |
* Processes this test, when one of its tokens is encountered.
|
42 |
*
|
|
|
|
|
43 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
44 |
* @param int $stackPtr The position of the current token in the
|
45 |
* stack passed in $tokens.
|
46 |
*
|
47 |
* @return void
|
48 |
*/
|
49 |
-
public function process(
|
50 |
{
|
51 |
if ($this->supportsBelow('5.5') !== true) {
|
52 |
return;
|
@@ -54,8 +59,8 @@ class ConstantArraysUsingConstSniff extends Sniff
|
|
54 |
|
55 |
$tokens = $phpcsFile->getTokens();
|
56 |
$find = array(
|
57 |
-
T_ARRAY
|
58 |
-
T_OPEN_SHORT_ARRAY
|
59 |
);
|
60 |
|
61 |
while (($hasArray = $phpcsFile->findNext($find, ($stackPtr + 1), null, false, null, true)) !== false) {
|
@@ -67,9 +72,9 @@ class ConstantArraysUsingConstSniff extends Sniff
|
|
67 |
|
68 |
// Skip past the content of the array.
|
69 |
$stackPtr = $hasArray;
|
70 |
-
if ($tokens[$hasArray]['code'] === T_OPEN_SHORT_ARRAY && isset($tokens[$hasArray]['bracket_closer'])) {
|
71 |
$stackPtr = $tokens[$hasArray]['bracket_closer'];
|
72 |
-
} elseif ($tokens[$hasArray]['code'] === T_ARRAY && isset($tokens[$hasArray]['parenthesis_closer'])) {
|
73 |
$stackPtr = $tokens[$hasArray]['parenthesis_closer'];
|
74 |
}
|
75 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\InitialValue;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
|
16 |
/**
|
17 |
+
* Detect declaration of constants using the `const` keyword with a (constant) array value
|
18 |
+
* as supported since PHP 5.6.
|
|
|
19 |
*
|
20 |
* PHP version 5.6
|
21 |
*
|
22 |
+
* @link https://wiki.php.net/rfc/const_scalar_exprs
|
23 |
+
* @link https://www.php.net/manual/en/language.constants.syntax.php
|
24 |
+
*
|
25 |
+
* @since 7.1.4
|
26 |
+
* @since 9.0.0 Renamed from `ConstantArraysUsingConstSniff` to `NewConstantArraysUsingConstSniff`.
|
27 |
*/
|
28 |
+
class NewConstantArraysUsingConstSniff extends Sniff
|
29 |
{
|
30 |
|
31 |
/**
|
32 |
* Returns an array of tokens this test wants to listen for.
|
33 |
*
|
34 |
+
* @since 7.1.4
|
35 |
+
*
|
36 |
* @return array
|
37 |
*/
|
38 |
public function register()
|
39 |
{
|
40 |
+
return array(\T_CONST);
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
* Processes this test, when one of its tokens is encountered.
|
45 |
*
|
46 |
+
* @since 7.1.4
|
47 |
+
*
|
48 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
49 |
* @param int $stackPtr The position of the current token in the
|
50 |
* stack passed in $tokens.
|
51 |
*
|
52 |
* @return void
|
53 |
*/
|
54 |
+
public function process(File $phpcsFile, $stackPtr)
|
55 |
{
|
56 |
if ($this->supportsBelow('5.5') !== true) {
|
57 |
return;
|
59 |
|
60 |
$tokens = $phpcsFile->getTokens();
|
61 |
$find = array(
|
62 |
+
\T_ARRAY => \T_ARRAY,
|
63 |
+
\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY,
|
64 |
);
|
65 |
|
66 |
while (($hasArray = $phpcsFile->findNext($find, ($stackPtr + 1), null, false, null, true)) !== false) {
|
72 |
|
73 |
// Skip past the content of the array.
|
74 |
$stackPtr = $hasArray;
|
75 |
+
if ($tokens[$hasArray]['code'] === \T_OPEN_SHORT_ARRAY && isset($tokens[$hasArray]['bracket_closer'])) {
|
76 |
$stackPtr = $tokens[$hasArray]['bracket_closer'];
|
77 |
+
} elseif ($tokens[$hasArray]['code'] === \T_ARRAY && isset($tokens[$hasArray]['parenthesis_closer'])) {
|
78 |
$stackPtr = $tokens[$hasArray]['parenthesis_closer'];
|
79 |
}
|
80 |
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantArraysUsingDefineSniff.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
+
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace PHPCompatibility\Sniffs\InitialValue;
|
12 |
+
|
13 |
+
use PHPCompatibility\Sniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Detect declaration of constants using `define()` with a (constant) array value
|
18 |
+
* as supported since PHP 7.0.
|
19 |
+
*
|
20 |
+
* PHP version 7.0
|
21 |
+
*
|
22 |
+
* @link https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.define-array
|
23 |
+
* @link https://www.php.net/manual/en/language.constants.syntax.php
|
24 |
+
*
|
25 |
+
* @since 7.0.0
|
26 |
+
* @since 9.0.0 Renamed from `ConstantArraysUsingDefineSniff` to `NewConstantArraysUsingDefineSniff`.
|
27 |
+
*/
|
28 |
+
class NewConstantArraysUsingDefineSniff extends Sniff
|
29 |
+
{
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Returns an array of tokens this test wants to listen for.
|
33 |
+
*
|
34 |
+
* @since 7.0.0
|
35 |
+
*
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
public function register()
|
39 |
+
{
|
40 |
+
return array(\T_STRING);
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Processes this test, when one of its tokens is encountered.
|
45 |
+
*
|
46 |
+
* @since 7.0.0
|
47 |
+
*
|
48 |
+
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
49 |
+
* @param int $stackPtr The position of the current token in the
|
50 |
+
* stack passed in $tokens.
|
51 |
+
*
|
52 |
+
* @return void
|
53 |
+
*/
|
54 |
+
public function process(File $phpcsFile, $stackPtr)
|
55 |
+
{
|
56 |
+
if ($this->supportsBelow('5.6') !== true) {
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
+
$tokens = $phpcsFile->getTokens();
|
61 |
+
|
62 |
+
$ignore = array(
|
63 |
+
\T_DOUBLE_COLON => true,
|
64 |
+
\T_OBJECT_OPERATOR => true,
|
65 |
+
\T_FUNCTION => true,
|
66 |
+
\T_CONST => true,
|
67 |
+
);
|
68 |
+
|
69 |
+
$prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
|
70 |
+
if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
|
71 |
+
// Not a call to a PHP function.
|
72 |
+
return;
|
73 |
+
}
|
74 |
+
|
75 |
+
$functionLc = strtolower($tokens[$stackPtr]['content']);
|
76 |
+
if ($functionLc !== 'define') {
|
77 |
+
return;
|
78 |
+
}
|
79 |
+
|
80 |
+
$secondParam = $this->getFunctionCallParameter($phpcsFile, $stackPtr, 2);
|
81 |
+
if (isset($secondParam['start'], $secondParam['end']) === false) {
|
82 |
+
return;
|
83 |
+
}
|
84 |
+
|
85 |
+
$targetNestingLevel = 0;
|
86 |
+
if (isset($tokens[$secondParam['start']]['nested_parenthesis'])) {
|
87 |
+
$targetNestingLevel = \count($tokens[$secondParam['start']]['nested_parenthesis']);
|
88 |
+
}
|
89 |
+
|
90 |
+
$array = $phpcsFile->findNext(array(\T_ARRAY, \T_OPEN_SHORT_ARRAY), $secondParam['start'], ($secondParam['end'] + 1));
|
91 |
+
if ($array !== false) {
|
92 |
+
if ((isset($tokens[$array]['nested_parenthesis']) === false && $targetNestingLevel === 0) || \count($tokens[$array]['nested_parenthesis']) === $targetNestingLevel) {
|
93 |
+
$phpcsFile->addError(
|
94 |
+
'Constant arrays using define are not allowed in PHP 5.6 or earlier',
|
95 |
+
$array,
|
96 |
+
'Found'
|
97 |
+
);
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → InitialValue}/NewConstantScalarExpressionsSniff.php
RENAMED
@@ -1,32 +1,34 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
use PHPCompatibility\Sniff;
|
15 |
use PHPCompatibility\PHPCSHelper;
|
|
|
|
|
16 |
|
17 |
/**
|
18 |
-
*
|
19 |
*
|
20 |
* Since PHP 5.6, it is now possible to provide a scalar expression involving
|
21 |
* numeric and string literals and/or constants in contexts where PHP previously
|
22 |
* expected a static value, such as constant and property declarations and
|
23 |
-
* default function
|
24 |
*
|
25 |
* PHP version 5.6
|
26 |
*
|
27 |
-
* @
|
28 |
-
* @
|
29 |
-
*
|
|
|
30 |
*/
|
31 |
class NewConstantScalarExpressionsSniff extends Sniff
|
32 |
{
|
@@ -34,6 +36,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
34 |
/**
|
35 |
* Error message.
|
36 |
*
|
|
|
|
|
37 |
* @var string
|
38 |
*/
|
39 |
const ERROR_PHRASE = 'Constant scalar expressions are not allowed %s in PHP 5.5 or earlier.';
|
@@ -41,6 +45,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
41 |
/**
|
42 |
* Partial error phrases to be used in combination with the error message constant.
|
43 |
*
|
|
|
|
|
44 |
* @var array
|
45 |
*/
|
46 |
protected $errorPhrases = array(
|
@@ -55,37 +61,42 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
55 |
*
|
56 |
* This list will be enriched in the setProperties() method.
|
57 |
*
|
|
|
|
|
58 |
* @var array
|
59 |
*/
|
60 |
protected $safeOperands = array(
|
61 |
-
T_LNUMBER => T_LNUMBER,
|
62 |
-
T_DNUMBER => T_DNUMBER,
|
63 |
-
T_CONSTANT_ENCAPSED_STRING => T_CONSTANT_ENCAPSED_STRING,
|
64 |
-
T_TRUE => T_TRUE,
|
65 |
-
T_FALSE => T_FALSE,
|
66 |
-
T_NULL => T_NULL,
|
67 |
-
|
68 |
-
T_LINE => T_LINE,
|
69 |
-
T_FILE => T_FILE,
|
70 |
-
T_DIR => T_DIR,
|
71 |
-
T_FUNC_C => T_FUNC_C,
|
72 |
-
T_CLASS_C => T_CLASS_C,
|
73 |
-
|
74 |
-
|
|
|
75 |
|
76 |
// Special cases:
|
77 |
-
T_NS_SEPARATOR => T_NS_SEPARATOR,
|
78 |
/*
|
79 |
* This can be neigh anything, but for any usage except constants,
|
80 |
* the T_STRING will be combined with non-allowed tokens, so we should be good.
|
81 |
*/
|
82 |
-
T_STRING => T_STRING,
|
83 |
);
|
84 |
|
85 |
|
86 |
/**
|
87 |
* Returns an array of tokens this test wants to listen for.
|
88 |
*
|
|
|
|
|
89 |
* @return array
|
90 |
*/
|
91 |
public function register()
|
@@ -94,11 +105,11 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
94 |
$this->setProperties();
|
95 |
|
96 |
return array(
|
97 |
-
T_CONST,
|
98 |
-
T_VARIABLE,
|
99 |
-
T_FUNCTION,
|
100 |
-
T_CLOSURE,
|
101 |
-
T_STATIC,
|
102 |
);
|
103 |
}
|
104 |
|
@@ -106,35 +117,22 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
106 |
/**
|
107 |
* Make some adjustments to the $safeOperands property.
|
108 |
*
|
|
|
|
|
109 |
* @return void
|
110 |
*/
|
111 |
public function setProperties()
|
112 |
{
|
113 |
-
|
114 |
-
|
115 |
-
* Not a problem for recognition as when the token is not available
|
116 |
-
* __TRAIT__ will be tokenized as T_STRING which will pass.
|
117 |
-
*/
|
118 |
-
if (defined('T_TRAIT_C') === true) {
|
119 |
-
// phpcs:ignore PHPCompatibility.PHP.NewConstants.t_trait_cFound
|
120 |
-
$this->safeOperands[T_TRAIT_C] = T_TRAIT_C;
|
121 |
-
}
|
122 |
-
|
123 |
-
$emptyTokens = \PHP_CodeSniffer_Tokens::$emptyTokens;
|
124 |
-
$heredocTokens = \PHP_CodeSniffer_Tokens::$heredocTokens;
|
125 |
-
if (version_compare(PHPCSHelper::getVersion(), '2.0', '<')) {
|
126 |
-
// PHPCS 1.x compat.
|
127 |
-
$emptyTokens = array_combine($emptyTokens, $emptyTokens);
|
128 |
-
$heredocTokens = array_combine($heredocTokens, $heredocTokens);
|
129 |
-
}
|
130 |
-
|
131 |
-
$this->safeOperands = $this->safeOperands + $heredocTokens + $emptyTokens;
|
132 |
}
|
133 |
|
134 |
|
135 |
/**
|
136 |
* Do a version check to determine if this sniff needs to run at all.
|
137 |
*
|
|
|
|
|
138 |
* @return bool
|
139 |
*/
|
140 |
protected function bowOutEarly()
|
@@ -146,13 +144,15 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
146 |
/**
|
147 |
* Processes this test, when one of its tokens is encountered.
|
148 |
*
|
|
|
|
|
149 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
150 |
* @param int $stackPtr The position of the current token in the
|
151 |
* stack passed in $tokens.
|
152 |
*
|
153 |
* @return void|int Null or integer stack pointer to skip forward.
|
154 |
*/
|
155 |
-
public function process(
|
156 |
{
|
157 |
if ($this->bowOutEarly() === true) {
|
158 |
return;
|
@@ -185,7 +185,7 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
185 |
// Which nesting level is the one we are interested in ?
|
186 |
$nestedParenthesisCount = 1;
|
187 |
if (isset($tokens[$opener]['nested_parenthesis'])) {
|
188 |
-
$nestedParenthesisCount += count($tokens[$opener]['nested_parenthesis']);
|
189 |
}
|
190 |
|
191 |
foreach ($params as $param) {
|
@@ -194,7 +194,7 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
194 |
}
|
195 |
|
196 |
$end = $param['token'];
|
197 |
-
while (($end = $phpcsFile->findNext(array(T_COMMA, T_CLOSE_PARENTHESIS), ($end + 1), ($closer + 1))) !== false) {
|
198 |
$maybeSkipTo = $this->isRealEndOfDeclaration($tokens, $end, $nestedParenthesisCount);
|
199 |
if ($maybeSkipTo !== true) {
|
200 |
$end = $maybeSkipTo;
|
@@ -202,7 +202,7 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
202 |
}
|
203 |
|
204 |
// Ignore closing parenthesis/bracket if not 'ours'.
|
205 |
-
if ($tokens[$end]['code'] === T_CLOSE_PARENTHESIS && $end !== $closer) {
|
206 |
continue;
|
207 |
}
|
208 |
|
@@ -227,7 +227,7 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
227 |
$type = 'const';
|
228 |
|
229 |
// Filter out non-property declarations.
|
230 |
-
if ($tokens[$stackPtr]['code'] === T_VARIABLE) {
|
231 |
if ($this->isClassProperty($phpcsFile, $stackPtr) === false) {
|
232 |
return;
|
233 |
}
|
@@ -239,16 +239,9 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
239 |
}
|
240 |
|
241 |
// Filter out late static binding and class properties.
|
242 |
-
if ($tokens[$stackPtr]['code'] === T_STATIC) {
|
243 |
-
$next = $phpcsFile->findNext(
|
244 |
-
|
245 |
-
($stackPtr + 1),
|
246 |
-
null,
|
247 |
-
true,
|
248 |
-
null,
|
249 |
-
true
|
250 |
-
);
|
251 |
-
if ($next === false || $tokens[$next]['code'] !== T_VARIABLE) {
|
252 |
// Late static binding.
|
253 |
return;
|
254 |
}
|
@@ -262,7 +255,7 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
262 |
$type = 'staticvar';
|
263 |
}
|
264 |
|
265 |
-
$endOfStatement = $phpcsFile->findNext(array(T_SEMICOLON, T_CLOSE_TAG), ($stackPtr + 1));
|
266 |
if ($endOfStatement === false) {
|
267 |
// No semi-colon - live coding.
|
268 |
return;
|
@@ -270,13 +263,13 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
270 |
|
271 |
$targetNestingLevel = 0;
|
272 |
if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) {
|
273 |
-
$targetNestingLevel = count($tokens[$stackPtr]['nested_parenthesis']);
|
274 |
}
|
275 |
|
276 |
// Examine each variable/constant in multi-declarations.
|
277 |
$start = $stackPtr;
|
278 |
$end = $stackPtr;
|
279 |
-
while (($end = $phpcsFile->findNext(array(T_COMMA, T_SEMICOLON, T_OPEN_SHORT_ARRAY, T_CLOSE_TAG), ($end + 1), ($endOfStatement + 1))) !== false) {
|
280 |
|
281 |
$maybeSkipTo = $this->isRealEndOfDeclaration($tokens, $end, $targetNestingLevel);
|
282 |
if ($maybeSkipTo !== true) {
|
@@ -284,10 +277,10 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
284 |
continue;
|
285 |
}
|
286 |
|
287 |
-
$start = $phpcsFile->findNext(
|
288 |
if ($start === false
|
289 |
-
|| ($tokens[$stackPtr]['code'] === T_CONST && $tokens[$start]['code'] !== T_STRING)
|
290 |
-
|| ($tokens[$stackPtr]['code'] !== T_CONST && $tokens[$start]['code'] !== T_VARIABLE)
|
291 |
) {
|
292 |
// Shouldn't be possible.
|
293 |
continue;
|
@@ -317,6 +310,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
317 |
/**
|
318 |
* Is a value declared and is the value declared valid pre-PHP 5.6 ?
|
319 |
*
|
|
|
|
|
320 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
321 |
* @param int $stackPtr The position of the current token in the
|
322 |
* stack passed in $tokens.
|
@@ -325,11 +320,11 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
325 |
*
|
326 |
* @return bool
|
327 |
*/
|
328 |
-
protected function isValidAssignment(
|
329 |
{
|
330 |
$tokens = $phpcsFile->getTokens();
|
331 |
-
$next = $phpcsFile->findNext(
|
332 |
-
if ($next === false || $tokens[$next]['code'] !== T_EQUAL) {
|
333 |
// No value assigned.
|
334 |
return true;
|
335 |
}
|
@@ -341,18 +336,20 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
341 |
/**
|
342 |
* Is a value declared and is the value declared constant as accepted in PHP 5.5 and lower ?
|
343 |
*
|
|
|
|
|
344 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
345 |
* @param array $tokens The token stack of the current file.
|
346 |
* @param int $start The stackPtr from which to start examining.
|
347 |
* @param int $end The end of the value definition (inclusive),
|
348 |
* i.e. this token will be examined as part of
|
349 |
* the snippet.
|
350 |
-
* @param
|
351 |
* the content of an array.
|
352 |
*
|
353 |
* @return bool
|
354 |
*/
|
355 |
-
protected function isStaticValue(
|
356 |
{
|
357 |
$nextNonSimple = $phpcsFile->findNext($this->safeOperands, $start, ($end + 1), true);
|
358 |
if ($nextNonSimple === false) {
|
@@ -363,8 +360,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
363 |
* OK, so we have at least one token which needs extra examination.
|
364 |
*/
|
365 |
switch ($tokens[$nextNonSimple]['code']) {
|
366 |
-
case T_MINUS:
|
367 |
-
case T_PLUS:
|
368 |
if ($this->isNumber($phpcsFile, $start, $end, true) !== false) {
|
369 |
// Int or float with sign.
|
370 |
return true;
|
@@ -372,39 +369,34 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
372 |
|
373 |
return false;
|
374 |
|
375 |
-
case T_NAMESPACE:
|
376 |
-
case T_PARENT:
|
377 |
-
case T_SELF:
|
378 |
-
case T_DOUBLE_COLON:
|
379 |
-
$nextNonEmpty = $phpcsFile->findNext(
|
380 |
-
|
381 |
-
|
382 |
-
($end + 1),
|
383 |
-
true
|
384 |
-
);
|
385 |
-
|
386 |
-
if ($tokens[$nextNonSimple]['code'] === T_NAMESPACE) {
|
387 |
// Allow only `namespace\...`.
|
388 |
-
if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== T_NS_SEPARATOR) {
|
389 |
return false;
|
390 |
}
|
391 |
-
} elseif ($tokens[$nextNonSimple]['code'] === T_PARENT
|
392 |
-
|| $tokens[$nextNonSimple]['code'] === T_SELF
|
393 |
) {
|
394 |
// Allow only `parent::` and `self::`.
|
395 |
-
if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== T_DOUBLE_COLON) {
|
396 |
return false;
|
397 |
}
|
398 |
-
} elseif ($tokens[$nextNonSimple]['code'] === T_DOUBLE_COLON) {
|
399 |
// Allow only `T_STRING::T_STRING`.
|
400 |
-
if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== T_STRING) {
|
401 |
return false;
|
402 |
}
|
403 |
|
404 |
-
$prevNonEmpty = $phpcsFile->findPrevious(
|
405 |
// No need to worry about parent/self, that's handled above and
|
406 |
// the double colon is skipped over in that case.
|
407 |
-
if ($prevNonEmpty === false || $tokens[$prevNonEmpty]['code'] !== T_STRING) {
|
408 |
return false;
|
409 |
}
|
410 |
}
|
@@ -412,8 +404,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
412 |
// Examine what comes after the namespace/parent/self/double colon, if anything.
|
413 |
return $this->isStaticValue($phpcsFile, $tokens, ($nextNonEmpty + 1), $end, $nestedArrays);
|
414 |
|
415 |
-
case T_ARRAY:
|
416 |
-
case T_OPEN_SHORT_ARRAY:
|
417 |
++$nestedArrays;
|
418 |
|
419 |
$arrayItems = $this->getFunctionCallParameters($phpcsFile, $nextNonSimple);
|
@@ -423,11 +415,11 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
423 |
$doubleArrow = false;
|
424 |
|
425 |
$maybeDoubleArrow = $phpcsFile->findNext(
|
426 |
-
array(T_DOUBLE_ARROW, T_ARRAY, T_OPEN_SHORT_ARRAY),
|
427 |
$item['start'],
|
428 |
($item['end'] + 1)
|
429 |
);
|
430 |
-
if ($maybeDoubleArrow !== false && $tokens[$maybeDoubleArrow]['code'] === T_DOUBLE_ARROW) {
|
431 |
// Double arrow is for this nesting level.
|
432 |
$doubleArrow = $maybeDoubleArrow;
|
433 |
}
|
@@ -459,18 +451,13 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
459 |
* able to get the array items.
|
460 |
*/
|
461 |
$closer = ($nextNonSimple + 1);
|
462 |
-
if ($tokens[$nextNonSimple]['code'] === T_OPEN_SHORT_ARRAY
|
463 |
&& isset($tokens[$nextNonSimple]['bracket_closer']) === true
|
464 |
) {
|
465 |
$closer = $tokens[$nextNonSimple]['bracket_closer'];
|
466 |
} else {
|
467 |
-
$maybeOpener = $phpcsFile->findNext(
|
468 |
-
|
469 |
-
($nextNonSimple + 1),
|
470 |
-
($end + 1),
|
471 |
-
true
|
472 |
-
);
|
473 |
-
if ($tokens[$maybeOpener]['code'] === T_OPEN_PARENTHESIS) {
|
474 |
$opener = $maybeOpener;
|
475 |
if (isset($tokens[$opener]['parenthesis_closer']) === true) {
|
476 |
$closer = $tokens[$opener]['parenthesis_closer'];
|
@@ -495,6 +482,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
495 |
/**
|
496 |
* Throw an error if a scalar expression is found.
|
497 |
*
|
|
|
|
|
498 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
499 |
* @param int $stackPtr The position of the token to link the error to.
|
500 |
* @param string $type Type of usage found.
|
@@ -502,7 +491,7 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
502 |
*
|
503 |
* @return void
|
504 |
*/
|
505 |
-
protected function throwError(
|
506 |
{
|
507 |
$error = static::ERROR_PHRASE;
|
508 |
$phrase = '';
|
@@ -530,6 +519,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
530 |
* Checks whether a certain part of a declaration needs to be skipped over or
|
531 |
* if it is the real end of the declaration.
|
532 |
*
|
|
|
|
|
533 |
* @param array $tokens Token stack of the current file.
|
534 |
* @param int $endPtr The token to examine as a candidate end pointer.
|
535 |
* @param int $targetLevel Target nesting level.
|
@@ -539,7 +530,7 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
539 |
private function isRealEndOfDeclaration($tokens, $endPtr, $targetLevel)
|
540 |
{
|
541 |
// Ignore anything within short array definition brackets for now.
|
542 |
-
if ($tokens[$endPtr]['code'] === T_OPEN_SHORT_ARRAY
|
543 |
&& (isset($tokens[$endPtr]['bracket_opener'])
|
544 |
&& $tokens[$endPtr]['bracket_opener'] === $endPtr)
|
545 |
&& isset($tokens[$endPtr]['bracket_closer'])
|
@@ -549,11 +540,11 @@ class NewConstantScalarExpressionsSniff extends Sniff
|
|
549 |
}
|
550 |
|
551 |
// Skip past comma's at a lower nesting level.
|
552 |
-
if ($tokens[$endPtr]['code'] === T_COMMA) {
|
553 |
// Check if a comma is at the nesting level we're targetting.
|
554 |
$nestingLevel = 0;
|
555 |
if (isset($tokens[$endPtr]['nested_parenthesis']) === true) {
|
556 |
-
$nestingLevel = count($tokens[$endPtr]['nested_parenthesis']);
|
557 |
}
|
558 |
if ($nestingLevel > $targetLevel) {
|
559 |
return $endPtr;
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\InitialValue;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
use PHPCompatibility\PHPCSHelper;
|
15 |
+
use PHP_CodeSniffer_File as File;
|
16 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
17 |
|
18 |
/**
|
19 |
+
* Detect constant scalar expressions being used to set an initial value.
|
20 |
*
|
21 |
* Since PHP 5.6, it is now possible to provide a scalar expression involving
|
22 |
* numeric and string literals and/or constants in contexts where PHP previously
|
23 |
* expected a static value, such as constant and property declarations and
|
24 |
+
* default values for function parameters.
|
25 |
*
|
26 |
* PHP version 5.6
|
27 |
*
|
28 |
+
* @link https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.const-scalar-exprs
|
29 |
+
* @link https://wiki.php.net/rfc/const_scalar_exprs
|
30 |
+
*
|
31 |
+
* @since 8.2.0
|
32 |
*/
|
33 |
class NewConstantScalarExpressionsSniff extends Sniff
|
34 |
{
|
36 |
/**
|
37 |
* Error message.
|
38 |
*
|
39 |
+
* @since 8.2.0
|
40 |
+
*
|
41 |
* @var string
|
42 |
*/
|
43 |
const ERROR_PHRASE = 'Constant scalar expressions are not allowed %s in PHP 5.5 or earlier.';
|
45 |
/**
|
46 |
* Partial error phrases to be used in combination with the error message constant.
|
47 |
*
|
48 |
+
* @since 8.2.0
|
49 |
+
*
|
50 |
* @var array
|
51 |
*/
|
52 |
protected $errorPhrases = array(
|
61 |
*
|
62 |
* This list will be enriched in the setProperties() method.
|
63 |
*
|
64 |
+
* @since 8.2.0
|
65 |
+
*
|
66 |
* @var array
|
67 |
*/
|
68 |
protected $safeOperands = array(
|
69 |
+
\T_LNUMBER => \T_LNUMBER,
|
70 |
+
\T_DNUMBER => \T_DNUMBER,
|
71 |
+
\T_CONSTANT_ENCAPSED_STRING => \T_CONSTANT_ENCAPSED_STRING,
|
72 |
+
\T_TRUE => \T_TRUE,
|
73 |
+
\T_FALSE => \T_FALSE,
|
74 |
+
\T_NULL => \T_NULL,
|
75 |
+
|
76 |
+
\T_LINE => \T_LINE,
|
77 |
+
\T_FILE => \T_FILE,
|
78 |
+
\T_DIR => \T_DIR,
|
79 |
+
\T_FUNC_C => \T_FUNC_C,
|
80 |
+
\T_CLASS_C => \T_CLASS_C,
|
81 |
+
\T_TRAIT_C => \T_TRAIT_C,
|
82 |
+
\T_METHOD_C => \T_METHOD_C,
|
83 |
+
\T_NS_C => \T_NS_C,
|
84 |
|
85 |
// Special cases:
|
86 |
+
\T_NS_SEPARATOR => \T_NS_SEPARATOR,
|
87 |
/*
|
88 |
* This can be neigh anything, but for any usage except constants,
|
89 |
* the T_STRING will be combined with non-allowed tokens, so we should be good.
|
90 |
*/
|
91 |
+
\T_STRING => \T_STRING,
|
92 |
);
|
93 |
|
94 |
|
95 |
/**
|
96 |
* Returns an array of tokens this test wants to listen for.
|
97 |
*
|
98 |
+
* @since 8.2.0
|
99 |
+
*
|
100 |
* @return array
|
101 |
*/
|
102 |
public function register()
|
105 |
$this->setProperties();
|
106 |
|
107 |
return array(
|
108 |
+
\T_CONST,
|
109 |
+
\T_VARIABLE,
|
110 |
+
\T_FUNCTION,
|
111 |
+
\T_CLOSURE,
|
112 |
+
\T_STATIC,
|
113 |
);
|
114 |
}
|
115 |
|
117 |
/**
|
118 |
* Make some adjustments to the $safeOperands property.
|
119 |
*
|
120 |
+
* @since 8.2.0
|
121 |
+
*
|
122 |
* @return void
|
123 |
*/
|
124 |
public function setProperties()
|
125 |
{
|
126 |
+
$this->safeOperands += Tokens::$heredocTokens;
|
127 |
+
$this->safeOperands += Tokens::$emptyTokens;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
|
130 |
|
131 |
/**
|
132 |
* Do a version check to determine if this sniff needs to run at all.
|
133 |
*
|
134 |
+
* @since 8.2.0
|
135 |
+
*
|
136 |
* @return bool
|
137 |
*/
|
138 |
protected function bowOutEarly()
|
144 |
/**
|
145 |
* Processes this test, when one of its tokens is encountered.
|
146 |
*
|
147 |
+
* @since 8.2.0
|
148 |
+
*
|
149 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
150 |
* @param int $stackPtr The position of the current token in the
|
151 |
* stack passed in $tokens.
|
152 |
*
|
153 |
* @return void|int Null or integer stack pointer to skip forward.
|
154 |
*/
|
155 |
+
public function process(File $phpcsFile, $stackPtr)
|
156 |
{
|
157 |
if ($this->bowOutEarly() === true) {
|
158 |
return;
|
185 |
// Which nesting level is the one we are interested in ?
|
186 |
$nestedParenthesisCount = 1;
|
187 |
if (isset($tokens[$opener]['nested_parenthesis'])) {
|
188 |
+
$nestedParenthesisCount += \count($tokens[$opener]['nested_parenthesis']);
|
189 |
}
|
190 |
|
191 |
foreach ($params as $param) {
|
194 |
}
|
195 |
|
196 |
$end = $param['token'];
|
197 |
+
while (($end = $phpcsFile->findNext(array(\T_COMMA, \T_CLOSE_PARENTHESIS), ($end + 1), ($closer + 1))) !== false) {
|
198 |
$maybeSkipTo = $this->isRealEndOfDeclaration($tokens, $end, $nestedParenthesisCount);
|
199 |
if ($maybeSkipTo !== true) {
|
200 |
$end = $maybeSkipTo;
|
202 |
}
|
203 |
|
204 |
// Ignore closing parenthesis/bracket if not 'ours'.
|
205 |
+
if ($tokens[$end]['code'] === \T_CLOSE_PARENTHESIS && $end !== $closer) {
|
206 |
continue;
|
207 |
}
|
208 |
|
227 |
$type = 'const';
|
228 |
|
229 |
// Filter out non-property declarations.
|
230 |
+
if ($tokens[$stackPtr]['code'] === \T_VARIABLE) {
|
231 |
if ($this->isClassProperty($phpcsFile, $stackPtr) === false) {
|
232 |
return;
|
233 |
}
|
239 |
}
|
240 |
|
241 |
// Filter out late static binding and class properties.
|
242 |
+
if ($tokens[$stackPtr]['code'] === \T_STATIC) {
|
243 |
+
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
|
244 |
+
if ($next === false || $tokens[$next]['code'] !== \T_VARIABLE) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
// Late static binding.
|
246 |
return;
|
247 |
}
|
255 |
$type = 'staticvar';
|
256 |
}
|
257 |
|
258 |
+
$endOfStatement = $phpcsFile->findNext(array(\T_SEMICOLON, \T_CLOSE_TAG), ($stackPtr + 1));
|
259 |
if ($endOfStatement === false) {
|
260 |
// No semi-colon - live coding.
|
261 |
return;
|
263 |
|
264 |
$targetNestingLevel = 0;
|
265 |
if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) {
|
266 |
+
$targetNestingLevel = \count($tokens[$stackPtr]['nested_parenthesis']);
|
267 |
}
|
268 |
|
269 |
// Examine each variable/constant in multi-declarations.
|
270 |
$start = $stackPtr;
|
271 |
$end = $stackPtr;
|
272 |
+
while (($end = $phpcsFile->findNext(array(\T_COMMA, \T_SEMICOLON, \T_OPEN_SHORT_ARRAY, \T_CLOSE_TAG), ($end + 1), ($endOfStatement + 1))) !== false) {
|
273 |
|
274 |
$maybeSkipTo = $this->isRealEndOfDeclaration($tokens, $end, $targetNestingLevel);
|
275 |
if ($maybeSkipTo !== true) {
|
277 |
continue;
|
278 |
}
|
279 |
|
280 |
+
$start = $phpcsFile->findNext(Tokens::$emptyTokens, ($start + 1), $end, true);
|
281 |
if ($start === false
|
282 |
+
|| ($tokens[$stackPtr]['code'] === \T_CONST && $tokens[$start]['code'] !== \T_STRING)
|
283 |
+
|| ($tokens[$stackPtr]['code'] !== \T_CONST && $tokens[$start]['code'] !== \T_VARIABLE)
|
284 |
) {
|
285 |
// Shouldn't be possible.
|
286 |
continue;
|
310 |
/**
|
311 |
* Is a value declared and is the value declared valid pre-PHP 5.6 ?
|
312 |
*
|
313 |
+
* @since 8.2.0
|
314 |
+
*
|
315 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
316 |
* @param int $stackPtr The position of the current token in the
|
317 |
* stack passed in $tokens.
|
320 |
*
|
321 |
* @return bool
|
322 |
*/
|
323 |
+
protected function isValidAssignment(File $phpcsFile, $stackPtr, $end)
|
324 |
{
|
325 |
$tokens = $phpcsFile->getTokens();
|
326 |
+
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), $end, true);
|
327 |
+
if ($next === false || $tokens[$next]['code'] !== \T_EQUAL) {
|
328 |
// No value assigned.
|
329 |
return true;
|
330 |
}
|
336 |
/**
|
337 |
* Is a value declared and is the value declared constant as accepted in PHP 5.5 and lower ?
|
338 |
*
|
339 |
+
* @since 8.2.0
|
340 |
+
*
|
341 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
342 |
* @param array $tokens The token stack of the current file.
|
343 |
* @param int $start The stackPtr from which to start examining.
|
344 |
* @param int $end The end of the value definition (inclusive),
|
345 |
* i.e. this token will be examined as part of
|
346 |
* the snippet.
|
347 |
+
* @param int $nestedArrays Optional. Array nesting level when examining
|
348 |
* the content of an array.
|
349 |
*
|
350 |
* @return bool
|
351 |
*/
|
352 |
+
protected function isStaticValue(File $phpcsFile, $tokens, $start, $end, $nestedArrays = 0)
|
353 |
{
|
354 |
$nextNonSimple = $phpcsFile->findNext($this->safeOperands, $start, ($end + 1), true);
|
355 |
if ($nextNonSimple === false) {
|
360 |
* OK, so we have at least one token which needs extra examination.
|
361 |
*/
|
362 |
switch ($tokens[$nextNonSimple]['code']) {
|
363 |
+
case \T_MINUS:
|
364 |
+
case \T_PLUS:
|
365 |
if ($this->isNumber($phpcsFile, $start, $end, true) !== false) {
|
366 |
// Int or float with sign.
|
367 |
return true;
|
369 |
|
370 |
return false;
|
371 |
|
372 |
+
case \T_NAMESPACE:
|
373 |
+
case \T_PARENT:
|
374 |
+
case \T_SELF:
|
375 |
+
case \T_DOUBLE_COLON:
|
376 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonSimple + 1), ($end + 1), true);
|
377 |
+
|
378 |
+
if ($tokens[$nextNonSimple]['code'] === \T_NAMESPACE) {
|
|
|
|
|
|
|
|
|
|
|
379 |
// Allow only `namespace\...`.
|
380 |
+
if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_NS_SEPARATOR) {
|
381 |
return false;
|
382 |
}
|
383 |
+
} elseif ($tokens[$nextNonSimple]['code'] === \T_PARENT
|
384 |
+
|| $tokens[$nextNonSimple]['code'] === \T_SELF
|
385 |
) {
|
386 |
// Allow only `parent::` and `self::`.
|
387 |
+
if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_DOUBLE_COLON) {
|
388 |
return false;
|
389 |
}
|
390 |
+
} elseif ($tokens[$nextNonSimple]['code'] === \T_DOUBLE_COLON) {
|
391 |
// Allow only `T_STRING::T_STRING`.
|
392 |
+
if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_STRING) {
|
393 |
return false;
|
394 |
}
|
395 |
|
396 |
+
$prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($nextNonSimple - 1), null, true);
|
397 |
// No need to worry about parent/self, that's handled above and
|
398 |
// the double colon is skipped over in that case.
|
399 |
+
if ($prevNonEmpty === false || $tokens[$prevNonEmpty]['code'] !== \T_STRING) {
|
400 |
return false;
|
401 |
}
|
402 |
}
|
404 |
// Examine what comes after the namespace/parent/self/double colon, if anything.
|
405 |
return $this->isStaticValue($phpcsFile, $tokens, ($nextNonEmpty + 1), $end, $nestedArrays);
|
406 |
|
407 |
+
case \T_ARRAY:
|
408 |
+
case \T_OPEN_SHORT_ARRAY:
|
409 |
++$nestedArrays;
|
410 |
|
411 |
$arrayItems = $this->getFunctionCallParameters($phpcsFile, $nextNonSimple);
|
415 |
$doubleArrow = false;
|
416 |
|
417 |
$maybeDoubleArrow = $phpcsFile->findNext(
|
418 |
+
array(\T_DOUBLE_ARROW, \T_ARRAY, \T_OPEN_SHORT_ARRAY),
|
419 |
$item['start'],
|
420 |
($item['end'] + 1)
|
421 |
);
|
422 |
+
if ($maybeDoubleArrow !== false && $tokens[$maybeDoubleArrow]['code'] === \T_DOUBLE_ARROW) {
|
423 |
// Double arrow is for this nesting level.
|
424 |
$doubleArrow = $maybeDoubleArrow;
|
425 |
}
|
451 |
* able to get the array items.
|
452 |
*/
|
453 |
$closer = ($nextNonSimple + 1);
|
454 |
+
if ($tokens[$nextNonSimple]['code'] === \T_OPEN_SHORT_ARRAY
|
455 |
&& isset($tokens[$nextNonSimple]['bracket_closer']) === true
|
456 |
) {
|
457 |
$closer = $tokens[$nextNonSimple]['bracket_closer'];
|
458 |
} else {
|
459 |
+
$maybeOpener = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonSimple + 1), ($end + 1), true);
|
460 |
+
if ($tokens[$maybeOpener]['code'] === \T_OPEN_PARENTHESIS) {
|
|
|
|
|
|
|
|
|
|
|
461 |
$opener = $maybeOpener;
|
462 |
if (isset($tokens[$opener]['parenthesis_closer']) === true) {
|
463 |
$closer = $tokens[$opener]['parenthesis_closer'];
|
482 |
/**
|
483 |
* Throw an error if a scalar expression is found.
|
484 |
*
|
485 |
+
* @since 8.2.0
|
486 |
+
*
|
487 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
488 |
* @param int $stackPtr The position of the token to link the error to.
|
489 |
* @param string $type Type of usage found.
|
491 |
*
|
492 |
* @return void
|
493 |
*/
|
494 |
+
protected function throwError(File $phpcsFile, $stackPtr, $type, $content = '')
|
495 |
{
|
496 |
$error = static::ERROR_PHRASE;
|
497 |
$phrase = '';
|
519 |
* Checks whether a certain part of a declaration needs to be skipped over or
|
520 |
* if it is the real end of the declaration.
|
521 |
*
|
522 |
+
* @since 8.2.0
|
523 |
+
*
|
524 |
* @param array $tokens Token stack of the current file.
|
525 |
* @param int $endPtr The token to examine as a candidate end pointer.
|
526 |
* @param int $targetLevel Target nesting level.
|
530 |
private function isRealEndOfDeclaration($tokens, $endPtr, $targetLevel)
|
531 |
{
|
532 |
// Ignore anything within short array definition brackets for now.
|
533 |
+
if ($tokens[$endPtr]['code'] === \T_OPEN_SHORT_ARRAY
|
534 |
&& (isset($tokens[$endPtr]['bracket_opener'])
|
535 |
&& $tokens[$endPtr]['bracket_opener'] === $endPtr)
|
536 |
&& isset($tokens[$endPtr]['bracket_closer'])
|
540 |
}
|
541 |
|
542 |
// Skip past comma's at a lower nesting level.
|
543 |
+
if ($tokens[$endPtr]['code'] === \T_COMMA) {
|
544 |
// Check if a comma is at the nesting level we're targetting.
|
545 |
$nestingLevel = 0;
|
546 |
if (isset($tokens[$endPtr]['nested_parenthesis']) === true) {
|
547 |
+
$nestingLevel = \count($tokens[$endPtr]['nested_parenthesis']);
|
548 |
}
|
549 |
if ($nestingLevel > $targetLevel) {
|
550 |
return $endPtr;
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP/NewHeredocInitializeSniff.php → InitialValue/NewHeredocSniff.php}
RENAMED
@@ -1,20 +1,21 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
*/
|
11 |
|
12 |
-
namespace PHPCompatibility\Sniffs\
|
13 |
|
14 |
-
use PHPCompatibility\Sniffs\
|
|
|
|
|
15 |
|
16 |
/**
|
17 |
-
*
|
18 |
*
|
19 |
* As of PHP 5.3.0, it's possible to initialize static variables, class properties
|
20 |
* and constants declared using the `const` keyword, using the Heredoc syntax.
|
@@ -26,16 +27,21 @@ use PHPCompatibility\Sniffs\PHP\NewConstantScalarExpressionsSniff;
|
|
26 |
*
|
27 |
* PHP version 5.3
|
28 |
*
|
29 |
-
* @
|
30 |
-
* @
|
31 |
-
*
|
|
|
|
|
|
|
32 |
*/
|
33 |
-
class
|
34 |
{
|
35 |
|
36 |
/**
|
37 |
* Error message.
|
38 |
*
|
|
|
|
|
39 |
* @var string
|
40 |
*/
|
41 |
const ERROR_PHRASE = 'Initializing %s using the Heredoc syntax was not supported in PHP 5.2 or earlier';
|
@@ -43,6 +49,8 @@ class NewHeredocInitializeSniff extends NewConstantScalarExpressionsSniff
|
|
43 |
/**
|
44 |
* Partial error phrases to be used in combination with the error message constant.
|
45 |
*
|
|
|
|
|
46 |
* @var array
|
47 |
*/
|
48 |
protected $errorPhrases = array(
|
@@ -56,6 +64,8 @@ class NewHeredocInitializeSniff extends NewConstantScalarExpressionsSniff
|
|
56 |
/**
|
57 |
* Do a version check to determine if this sniff needs to run at all.
|
58 |
*
|
|
|
|
|
59 |
* @return bool
|
60 |
*/
|
61 |
protected function bowOutEarly()
|
@@ -67,6 +77,8 @@ class NewHeredocInitializeSniff extends NewConstantScalarExpressionsSniff
|
|
67 |
/**
|
68 |
* Is a value declared and does the declared value not contain an heredoc ?
|
69 |
*
|
|
|
|
|
70 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
71 |
* @param int $stackPtr The position of the current token in the
|
72 |
* stack passed in $tokens.
|
@@ -74,15 +86,15 @@ class NewHeredocInitializeSniff extends NewConstantScalarExpressionsSniff
|
|
74 |
*
|
75 |
* @return bool True if no heredoc (or assignment) is found, false otherwise.
|
76 |
*/
|
77 |
-
protected function isValidAssignment(
|
78 |
{
|
79 |
$tokens = $phpcsFile->getTokens();
|
80 |
-
$next = $phpcsFile->findNext(
|
81 |
-
if ($next === false || $tokens[$next]['code'] !== T_EQUAL) {
|
82 |
// No value assigned.
|
83 |
return true;
|
84 |
}
|
85 |
|
86 |
-
return ($phpcsFile->findNext(T_START_HEREDOC, ($next + 1), $end, false, null, true) === false);
|
87 |
}
|
88 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
|
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\InitialValue;
|
12 |
|
13 |
+
use PHPCompatibility\Sniffs\InitialValue\NewConstantScalarExpressionsSniff;
|
14 |
+
use PHP_CodeSniffer_File as File;
|
15 |
+
use PHP_CodeSniffer_Tokens as Tokens;
|
16 |
|
17 |
/**
|
18 |
+
* Detect a heredoc being used to set an initial value.
|
19 |
*
|
20 |
* As of PHP 5.3.0, it's possible to initialize static variables, class properties
|
21 |
* and constants declared using the `const` keyword, using the Heredoc syntax.
|
27 |
*
|
28 |
* PHP version 5.3
|
29 |
*
|
30 |
+
* @link https://www.php.net/manual/en/migration53.new-features.php
|
31 |
+
* @link https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
|
32 |
+
*
|
33 |
+
* @since 7.1.4
|
34 |
+
* @since 8.2.0 Now extends the NewConstantScalarExpressionsSniff instead of the base Sniff class.
|
35 |
+
* @since 9.0.0 Renamed from `NewHeredocInitializeSniff` to `NewHeredocSniff`.
|
36 |
*/
|
37 |
+
class NewHeredocSniff extends NewConstantScalarExpressionsSniff
|
38 |
{
|
39 |
|
40 |
/**
|
41 |
* Error message.
|
42 |
*
|
43 |
+
* @since 8.2.0
|
44 |
+
*
|
45 |
* @var string
|
46 |
*/
|
47 |
const ERROR_PHRASE = 'Initializing %s using the Heredoc syntax was not supported in PHP 5.2 or earlier';
|
49 |
/**
|
50 |
* Partial error phrases to be used in combination with the error message constant.
|
51 |
*
|
52 |
+
* @since 8.2.0
|
53 |
+
*
|
54 |
* @var array
|
55 |
*/
|
56 |
protected $errorPhrases = array(
|
64 |
/**
|
65 |
* Do a version check to determine if this sniff needs to run at all.
|
66 |
*
|
67 |
+
* @since 8.2.0
|
68 |
+
*
|
69 |
* @return bool
|
70 |
*/
|
71 |
protected function bowOutEarly()
|
77 |
/**
|
78 |
* Is a value declared and does the declared value not contain an heredoc ?
|
79 |
*
|
80 |
+
* @since 8.2.0
|
81 |
+
*
|
82 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
83 |
* @param int $stackPtr The position of the current token in the
|
84 |
* stack passed in $tokens.
|
86 |
*
|
87 |
* @return bool True if no heredoc (or assignment) is found, false otherwise.
|
88 |
*/
|
89 |
+
protected function isValidAssignment(File $phpcsFile, $stackPtr, $end)
|
90 |
{
|
91 |
$tokens = $phpcsFile->getTokens();
|
92 |
+
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), $end, true);
|
93 |
+
if ($next === false || $tokens[$next]['code'] !== \T_EQUAL) {
|
94 |
// No value assigned.
|
95 |
return true;
|
96 |
}
|
97 |
|
98 |
+
return ($phpcsFile->findNext(\T_START_HEREDOC, ($next + 1), $end, false, null, true) === false);
|
99 |
}
|
100 |
}
|
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/{PHP → Interfaces}/InternalInterfacesSniff.php
RENAMED
@@ -1,23 +1,29 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
* @
|
|
|
8 |
*/
|
9 |
|
10 |
-
namespace PHPCompatibility\Sniffs\
|
11 |
|
12 |
use PHPCompatibility\Sniff;
|
13 |
use PHPCompatibility\PHPCSHelper;
|
|
|
14 |
|
15 |
/**
|
16 |
-
*
|
17 |
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
* @
|
|
|
|
|
|
|
|
|
21 |
*/
|
22 |
class InternalInterfacesSniff extends Sniff
|
23 |
{
|
@@ -27,6 +33,8 @@ class InternalInterfacesSniff extends Sniff
|
|
27 |
*
|
28 |
* The array lists : the error message to use.
|
29 |
*
|
|
|
|
|
30 |
* @var array(string => string)
|
31 |
*/
|
32 |
protected $internalInterfaces = array(
|
@@ -39,6 +47,8 @@ class InternalInterfacesSniff extends Sniff
|
|
39 |
/**
|
40 |
* Returns an array of tokens this test wants to listen for.
|
41 |
*
|
|
|
|
|
42 |
* @return array
|
43 |
*/
|
44 |
public function register()
|
@@ -46,36 +56,37 @@ class InternalInterfacesSniff extends Sniff
|
|
46 |
// Handle case-insensitivity of interface names.
|
47 |
$this->internalInterfaces = $this->arrayKeysToLowercase($this->internalInterfaces);
|
48 |
|
49 |
-
$targets = array(T_CLASS);
|
50 |
|
51 |
-
if (defined('T_ANON_CLASS')) {
|
52 |
-
|
53 |
-
$targets[] = T_ANON_CLASS;
|
54 |
}
|
55 |
|
56 |
return $targets;
|
57 |
-
|
58 |
-
}//end register()
|
59 |
|
60 |
|
61 |
/**
|
62 |
* Processes this test, when one of its tokens is encountered.
|
63 |
*
|
|
|
|
|
64 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
65 |
* @param int $stackPtr The position of the current token in
|
66 |
* the stack passed in $tokens.
|
67 |
*
|
68 |
* @return void
|
69 |
*/
|
70 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* PHPCompatibility, an external standard for PHP_CodeSniffer.
|
4 |
*
|
5 |
+
* @package PHPCompatibility
|
6 |
+
* @copyright 2012-2019 PHPCompatibility Contributors
|
7 |
+
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
8 |
+
* @link https://github.com/PHPCompatibility/PHPCompatibility
|
9 |
*/
|
10 |
|
11 |
+
namespace PHPCompatibility\Sniffs\Interfaces;
|
12 |
|
13 |
use PHPCompatibility\Sniff;
|
14 |
use PHPCompatibility\PHPCSHelper;
|
15 |
+
use PHP_CodeSniffer_File as File;
|
16 |
|
17 |
/**
|
18 |
+
* Detect classes which implement PHP native interfaces intended only for PHP internal use.
|
19 |
*
|
20 |
+
* PHP version 5.0+
|
21 |
+
*
|
22 |
+
* @link https://www.php.net/manual/en/class.traversable.php
|
23 |
+
* @link https://www.php.net/manual/en/class.throwable.php
|
24 |
+
* @link https://www.php.net/manual/en/class.datetimeinterface.php
|
25 |
+
*
|
26 |
+
* @since 7.0.3
|
27 |
*/
|
28 |
class InternalInterfacesSniff extends Sniff
|
29 |
{
|
33 |
*
|
34 |
* The array lists : the error message to use.
|
35 |
*
|
36 |
+
* @since 7.0.3
|
37 |
+
*
|
38 |
* @var array(string => string)
|
39 |
*/
|
40 |
protected $internalInterfaces = array(
|
47 |
/**
|
48 |
* Returns an array of tokens this test wants to listen for.
|
49 |
*
|
50 |
+
* @since 7.0.3
|
51 |
+
*
|
52 |
* @return array
|
53 |
*/
|
54 |
public function register()
|
56 |
// Handle case-insensitivity of interface names.
|
57 |
$this->internalInterfaces = $this->arrayKeysToLowercase($this->internalInterfaces);
|
58 |
|
59 |
+
$targets = array(\T_CLASS);
|
60 |
|
61 |
+
if (\defined('T_ANON_CLASS')) {
|
62 |
+
$targets[] = \T_ANON_CLASS;
|
|
|
63 |
}
|
64 |
|
65 |
return $targets;
|
66 |
+
}
|
|
|
67 |
|
68 |
|
69 |
/**
|
70 |
* Processes this test, when one of its tokens is encountered.
|
71 |
*
|
72 |
+
* @since 7.0.3
|
73 |
+
*
|
74 |
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
75 |
* @param int $stackPtr The position of the current token in
|
76 |
* the stack passed in $tokens.
|
77 |
*
|
78 |
* @return void
|
79 |
*/
|
80 |
+
|