Version Description
Download this release
Release Info
Developer | diegoquinteiro |
Plugin | Instant Articles for WP |
Version | 4.2.1 |
Comparing to | |
See all releases |
Code changes from version 4.2.0 to 4.2.1
- CHANGELOG.md +9 -1
- compat.php +5 -0
- compat/class-instant-articles-comscore.php +61 -0
- compat/comscore.js +1 -0
- facebook-instant-articles.php +4 -4
- readme.txt +11 -3
- rules-configuration.json +12 -0
- vendor/composer/autoload_psr4.php +2 -1
- vendor/composer/autoload_static.php +10 -2
- vendor/composer/installed.json +87 -28
- vendor/doctrine/instantiator/.gitignore +5 -0
- vendor/doctrine/instantiator/.scrutinizer.yml +46 -0
- vendor/doctrine/instantiator/.travis.install.sh +14 -0
- vendor/doctrine/instantiator/.travis.yml +22 -0
- vendor/doctrine/instantiator/CONTRIBUTING.md +35 -0
- vendor/doctrine/instantiator/LICENSE +19 -0
- vendor/doctrine/instantiator/README.md +40 -0
- vendor/doctrine/instantiator/composer.json +45 -0
- vendor/doctrine/instantiator/phpmd.xml.dist +27 -0
- vendor/doctrine/instantiator/phpunit.xml.dist +22 -0
- vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php +29 -0
- vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/InvalidArgumentException.php +62 -0
- vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php +79 -0
- vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php +273 -0
- vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php +37 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorPerformance/InstantiatorPerformanceEvent.php +96 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/Exception/InvalidArgumentExceptionTest.php +83 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/Exception/UnexpectedValueExceptionTest.php +69 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php +219 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/AbstractClassAsset.php +29 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/ArrayObjectAsset.php +41 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/ExceptionAsset.php +41 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/FinalExceptionAsset.php +41 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/PharAsset.php +41 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/PharExceptionAsset.php +44 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/SerializableArrayObjectAsset.php +62 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/SimpleSerializableAsset.php +61 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/SimpleTraitAsset.php +29 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/UnCloneableAsset.php +50 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/UnserializeExceptionArrayObjectAsset.php +39 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/WakeUpNoticesAsset.php +38 -0
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/XMLReaderAsset.php +41 -0
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/.travis.yml +8 -7
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/CODE_OF_CONDUCT.md +3 -0
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/CONTRIBUTING.md +3 -0
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/README.md +1 -2
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/composer.json +8 -2
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/composer.lock +166 -287
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/examples/example-override-styling.php +0 -3
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/examples/example-quick-start.php +0 -3
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/examples/example-simple-styling.php +0 -3
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPArticle.php +26 -17
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPContext.php +3 -4
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPCoverImage.php +2 -5
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPHeader.php +15 -11
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/AMPArticleTest.php +4 -4
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/AMPCaptionTest.php +0 -22
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/AMPContextTest.php +0 -22
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/AMPCoverImageTest.php +2 -24
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/amp-converted.html +1 -1
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/test1-amp-converted.html +4 -4
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/test1-instant-article.html +1 -1
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/test2-amp-converted.html +6 -6
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/test3-amp-converted.html +3 -3
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/test4-amp-converted.html +4 -3
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/test5-amp-converted.html +3 -3
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/tutorial-amp-converted.html +48 -192
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/Utils/CSSBuilderTest.php +0 -20
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/Utils/FileUtilsPHPUnitTestCase.php +11 -21
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/Utils/Greeting.php +0 -1
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/Utils/HookTest.php +0 -20
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/Utils/ObserverTest.php +0 -21
- vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookResponseException.php +10 -1
- vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookResumableUploadException.php +35 -0
- vendor/facebook/graph-sdk/src/Facebook/Facebook.php +1 -1
- vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookResumableUploader.php +10 -0
- vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookTransferChunk.php +8 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphNode.php +2 -1
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php +3 -1
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphPage.php +10 -0
- vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookRedirectLoginHelper.php +2 -2
- vendor/facebook/graph-sdk/src/Facebook/Http/GraphRawResponse.php +3 -2
- vendor/squizlabs/php_codesniffer/phpcs.xml.dist +37 -36
- vendor/squizlabs/php_codesniffer/phpcs.xsd +8 -0
- vendor/squizlabs/php_codesniffer/src/Config.php +1 -1
- vendor/squizlabs/php_codesniffer/src/Files/File.php +60 -9
- vendor/squizlabs/php_codesniffer/src/Fixer.php +3 -3
- vendor/squizlabs/php_codesniffer/src/Ruleset.php +7 -0
- vendor/squizlabs/php_codesniffer/src/Runner.php +7 -0
- vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractPatternSniff.php +3 -3
- vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractScopeSniff.php +3 -3
- vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractVariableSniff.php +5 -5
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/SpaceAfterNotStandard.xml +25 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Classes/DuplicateClassNameSniff.php +1 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyPHPStatementSniff.php +144 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnusedFunctionParameterSniff.php +71 -12
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/InlineHTMLSniff.php +23 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/NoSpaceAfterCastSniff.php +3 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceAfterCastSniff.php +97 -13
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceAfterNotSniff.php +68 -10
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceBeforeCastSniff.php +73 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php +8 -12
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/OpeningFunctionBraceBsdAllmanSniff.php +1 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/CamelCapsFunctionNameSniff.php +25 -7
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/ConstructorNameSniff.php +26 -14
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/CharacterBeforePHPOpeningTagSniff.php +25 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/VersionControl/GitMergeConflictSniff.php +225 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/IncrementDecrementSpacingSniff.php +171 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php +12 -3
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php +2 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.1.inc +3 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.2.inc +1 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.php +4 -2
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/AssignmentInConditionUnitTest.inc +1 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/EmptyPHPStatementUnitTest.inc +54 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/EmptyPHPStatementUnitTest.inc.fixed +49 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/EmptyPHPStatementUnitTest.php +61 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.inc +44 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.php +8 -3
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.6.inc +2 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.7.inc +2 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.php +3 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/NoSpaceAfterCastUnitTest.inc +6 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/NoSpaceAfterCastUnitTest.inc.fixed +6 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/NoSpaceAfterCastUnitTest.php +1 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.inc +52 -2
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.inc.fixed +47 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.php +16 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterNotUnitTest.inc +82 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterNotUnitTest.inc.fixed +78 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterNotUnitTest.php +45 -6
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceBeforeCastUnitTest.inc +65 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceBeforeCastUnitTest.inc.fixed +65 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceBeforeCastUnitTest.php +78 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.inc +6 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.inc +18 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.php +2 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/ConstructorNameUnitTest.inc +28 -2
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/ConstructorNameUnitTest.php +1 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/CharacterBeforePHPOpeningTagUnitTest.3.inc +3 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.inc +3 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.inc.fixed +3 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.php +1 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.1.css +35 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.1.inc +61 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.2.css +32 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.2.inc +31 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.3.inc +43 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.4.inc +71 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.5.inc +34 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.6.inc +34 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.js +33 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.php +160 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/IncrementDecrementSpacingUnitTest.inc +17 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/IncrementDecrementSpacingUnitTest.inc.fixed +16 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/IncrementDecrementSpacingUnitTest.js +17 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/IncrementDecrementSpacingUnitTest.js.fixed +16 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/IncrementDecrementSpacingUnitTest.php +66 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.inc +4 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.inc.fixed +4 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.php +6 -7
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.1.inc +16 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.1.inc.fixed +16 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.2.inc +16 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.2.inc.fixed +16 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.php +11 -11
- vendor/squizlabs/php_codesniffer/src/Standards/Generic/ruleset.xml +2 -2
- vendor/squizlabs/php_codesniffer/src/Standards/MySource/ruleset.xml +13 -13
- vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php +1 -1
- vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/Functions/FunctionDeclarationSniff.php +22 -1
- vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/NamingConventions/ValidFunctionNameSniff.php +20 -3
- vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc +22 -1
- vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc.fixed +23 -1
- vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.php +1 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/FunctionDeclarationUnitTest.inc +75 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/FunctionDeclarationUnitTest.inc.fixed +73 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/FunctionDeclarationUnitTest.php +23 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/NamingConventions/ValidFunctionNameUnitTest.inc +15 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/NamingConventions/ValidFunctionNameUnitTest.php +3 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PEAR/ruleset.xml +33 -33
- vendor/squizlabs/php_codesniffer/src/Standards/PSR1/Sniffs/Methods/CamelCapsMethodNameSniff.php +14 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PSR1/Tests/Methods/CamelCapsMethodNameUnitTest.inc +9 -1
- vendor/squizlabs/php_codesniffer/src/Standards/PSR1/Tests/Methods/CamelCapsMethodNameUnitTest.php +1 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PSR1/ruleset.xml +28 -28
- vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Docs/Functions/NullableTypeDeclarationStandard.xml +32 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Sniffs/Functions/NullableTypeDeclarationSniff.php +91 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.inc +59 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.inc.fixed +57 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.php +63 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PSR12/ruleset.xml +4 -3
- vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Docs/Classes/PropertyDeclarationStandard.xml +20 -1
- vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Sniffs/Classes/PropertyDeclarationSniff.php +40 -4
- vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Sniffs/Methods/MethodDeclarationSniff.php +12 -5
- vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Sniffs/Namespaces/UseDeclarationSniff.php +1 -1
- vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.inc +17 -2
- vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.inc.fixed +42 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.php +7 -2
- vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Methods/MethodDeclarationUnitTest.inc +49 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Methods/MethodDeclarationUnitTest.inc.fixed +49 -0
- vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Methods/MethodDeclarationUnitTest.php +17 -1
- vendor/squizlabs/php_codesniffer/src/Standards/PSR2/ruleset.xml +193 -193
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Classes/ClassFileNameSniff.php +1 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Classes/SelfMemberReferenceSniff.php +69 -23
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php +4 -5
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Commenting/InlineCommentSniff.php +56 -58
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Formatting/OperatorBracketSniff.php +4 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Functions/FunctionDeclarationArgumentSpacingSniff.php +2 -2
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Functions/LowercaseFunctionKeywordsSniff.php +15 -11
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Objects/ObjectMemberCommaSniff.php +1 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Operators/ComparisonOperatorUsageSniff.php +10 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Scope/MethodScopeSniff.php +9 -6
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Scope/StaticThisUsageSniff.php +9 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/WhiteSpace/FunctionSpacingSniff.php +2 -2
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/WhiteSpace/ObjectOperatorSpacingSniff.php +29 -5
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/WhiteSpace/OperatorSpacingSniff.php +1 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/ClassFileNameUnitTest.inc +16 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/ClassFileNameUnitTest.php +16 -2
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/SelfMemberReferenceUnitTest.inc +54 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/SelfMemberReferenceUnitTest.inc.fixed +42 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/SelfMemberReferenceUnitTest.php +9 -3
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/ValidClassNameUnitTest.inc +6 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/InlineCommentUnitTest.inc +10 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/InlineCommentUnitTest.inc.fixed +10 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/InlineCommentUnitTest.php +1 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Formatting/OperatorBracketUnitTest.inc +4 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Formatting/OperatorBracketUnitTest.inc.fixed +4 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Formatting/OperatorBracketUnitTest.php +1 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Functions/FunctionDeclarationArgumentSpacingUnitTest.inc +8 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Functions/FunctionDeclarationArgumentSpacingUnitTest.inc.fixed +8 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Functions/FunctionDeclarationArgumentSpacingUnitTest.php +4 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Functions/LowercaseFunctionKeywordsUnitTest.inc +25 -6
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Functions/LowercaseFunctionKeywordsUnitTest.inc.fixed +26 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Functions/LowercaseFunctionKeywordsUnitTest.php +8 -5
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Objects/ObjectMemberCommaUnitTest.js +8 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Objects/ObjectMemberCommaUnitTest.js.fixed +47 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Objects/ObjectMemberCommaUnitTest.php +2 -7
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Operators/ComparisonOperatorUsageUnitTest.inc +2 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/MethodScopeUnitTest.inc +9 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/MethodScopeUnitTest.php +1 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/StaticThisUsageUnitTest.inc +21 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/StaticThisUsageUnitTest.php +3 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/CastSpacingUnitTest.inc +3 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/CastSpacingUnitTest.inc.fixed +9 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/CastSpacingUnitTest.php +1 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/FunctionSpacingUnitTest.inc +1 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/FunctionSpacingUnitTest.inc.fixed +1 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ObjectOperatorSpacingUnitTest.inc +1 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ObjectOperatorSpacingUnitTest.php +1 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.inc +4 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.inc.fixed +4 -0
- vendor/squizlabs/php_codesniffer/src/Standards/Squiz/ruleset.xml +2 -1
- vendor/squizlabs/php_codesniffer/src/Standards/Zend/ruleset.xml +26 -26
- vendor/squizlabs/php_codesniffer/src/Tokenizers/CSS.php +2 -1
- vendor/squizlabs/php_codesniffer/src/Tokenizers/JS.php +1 -1
- vendor/squizlabs/php_codesniffer/src/Tokenizers/PHP.php +38 -4
- vendor/squizlabs/php_codesniffer/src/Tokenizers/Tokenizer.php +26 -2
- vendor/squizlabs/php_codesniffer/src/Util/Cache.php +9 -4
- vendor/squizlabs/php_codesniffer/src/Util/Timing.php +1 -1
- vendor/squizlabs/php_codesniffer/src/Util/Tokens.php +11 -10
- vendor/squizlabs/php_codesniffer/tests/Core/File/FindEndOfStatementTest.php +1 -1
- vendor/squizlabs/php_codesniffer/tests/Core/File/GetMemberPropertiesTest.inc +18 -0
- vendor/squizlabs/php_codesniffer/tests/Core/File/GetMemberPropertiesTest.php +19 -0
- vendor/squizlabs/php_codesniffer/tests/Core/File/GetMethodPropertiesTest.inc +5 -0
- vendor/squizlabs/php_codesniffer/tests/Core/File/GetMethodPropertiesTest.php +48 -0
- vendor/squizlabs/php_codesniffer/tests/Standards/AbstractSniffUnitTest.php +1 -0
- vendor/squizlabs/php_codesniffer/tests/Standards/AllSniffs.php +3 -2
- vendor/squizlabs/php_codesniffer/tests/bootstrap.php +7 -4
- vendor/wp-coding-standards/wpcs/CHANGELOG.md +17 -0
- vendor/wp-coding-standards/wpcs/WordPress-Docs/ruleset.xml +3 -6
- vendor/wp-coding-standards/wpcs/WordPress/Sniff.php +3 -79
- vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php +1 -1
- vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php +2 -2
- vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/PrecisionAlignmentSniff.php +3 -3
- vendor/wp-coding-standards/wpcs/phpcs.xml.dist.sample +1 -1
- vipgo-helper.php +4 -0
- wizard/class-instant-articles-option-analytics.php +6 -0
CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1 |
## Change Log
|
2 |
|
3 |
-
### 4.2.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
- [#997](https://github.com/automattic/facebook-instant-articles-wp/pull/997) Removed fields from deprecated feature to enable comments/likes/share from media content (@everton-rosario)
|
5 |
|
6 |
### 4.1.1 (2018/07/17 15:45 +00:00)
|
1 |
## Change Log
|
2 |
|
3 |
+
### 4.2.1 (2020/06/10 21:11 +00:00)
|
4 |
+
- [#1049](https://github.com/automattic/facebook-instant-articles-wp/pull/1049) Add support for new guttenberg layout elements (@diegoquinteiro)
|
5 |
+
- [#1012](https://github.com/automattic/facebook-instant-articles-wp/pull/1012) update composer modules (@paulschreiber)
|
6 |
+
- [#1001](https://github.com/automattic/facebook-instant-articles-wp/pull/1001) Load functions which rely on `plugins_loaded` action hook in VIP Go environment (@paulschreiber)
|
7 |
+
- [#990](https://github.com/automattic/facebook-instant-articles-wp/pull/990) avoid undefined index error in $display_warning_column (@paulschreiber)
|
8 |
+
- [#1002](https://github.com/automattic/facebook-instant-articles-wp/pull/1002) add Comscore plugin (@paulschreiber)
|
9 |
+
- [#1007](https://github.com/automattic/facebook-instant-articles-wp/pull/1007) Update Facebook SDK versions (@paulschreiber)
|
10 |
+
|
11 |
+
### 4.2.0 (2018/11/29 18:14 +00:00)
|
12 |
- [#997](https://github.com/automattic/facebook-instant-articles-wp/pull/997) Removed fields from deprecated feature to enable comments/likes/share from media content (@everton-rosario)
|
13 |
|
14 |
### 4.1.1 (2018/07/17 15:45 +00:00)
|
compat.php
CHANGED
@@ -58,3 +58,8 @@ $playbuzz->init();
|
|
58 |
include( dirname( __FILE__ ) . '/compat/class-instant-articles-apester.php' );
|
59 |
$apester = new Instant_Articles_Apester;
|
60 |
$apester->init();
|
|
|
|
|
|
|
|
|
|
58 |
include( dirname( __FILE__ ) . '/compat/class-instant-articles-apester.php' );
|
59 |
$apester = new Instant_Articles_Apester;
|
60 |
$apester->init();
|
61 |
+
|
62 |
+
// Load support for Comscore
|
63 |
+
include( dirname( __FILE__ ) . '/compat/class-instant-articles-comscore.php' );
|
64 |
+
$comscore = new Instant_Articles_Comscore;
|
65 |
+
$comscore->init();
|
compat/class-instant-articles-comscore.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Support class for Comscore
|
5 |
+
*
|
6 |
+
* @since 0.1
|
7 |
+
*/
|
8 |
+
class Instant_Articles_Comscore {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Init the compat layer
|
12 |
+
*/
|
13 |
+
public function init() {
|
14 |
+
add_action( 'instant_articles_compat_registry_analytics', [ $this, 'add_to_registry' ] );
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Adds identifying information about this 3rd party plugin
|
19 |
+
* to the wider registry.
|
20 |
+
*
|
21 |
+
* @since 0.3
|
22 |
+
* @param array $registry Reference param. The registry where it will be stored.
|
23 |
+
*/
|
24 |
+
public function add_to_registry( &$registry ) {
|
25 |
+
|
26 |
+
$display_name = 'Comscore';
|
27 |
+
|
28 |
+
$identifier = 'Comscore';
|
29 |
+
|
30 |
+
$embed_code = $this->get_raw_embed_code();
|
31 |
+
|
32 |
+
$registry[ $identifier ] = [
|
33 |
+
'name' => $display_name,
|
34 |
+
'payload' => $embed_code,
|
35 |
+
];
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Returns the Comscore tracking code
|
40 |
+
*
|
41 |
+
* @since 0.3
|
42 |
+
*/
|
43 |
+
public function get_raw_embed_code() {
|
44 |
+
$settings_analytics = Instant_Articles_Option_Analytics::get_option_decoded();
|
45 |
+
if ( ! isset( $settings_analytics['comscore_id'] ) || empty( $settings_analytics['comscore_id'] ) ) {
|
46 |
+
return;
|
47 |
+
}
|
48 |
+
|
49 |
+
$comscore_id = intval( $settings_analytics['comscore_id'] );
|
50 |
+
if ( ! $comscore_id ) {
|
51 |
+
return;
|
52 |
+
}
|
53 |
+
|
54 |
+
$file_path = plugin_dir_path( __FILE__ ) . 'comscore.js';
|
55 |
+
$js = sprintf( file_get_contents( $file_path ), $comscore_id );
|
56 |
+
|
57 |
+
$code = '<script>' . $js . '</script>';
|
58 |
+
|
59 |
+
return $code;
|
60 |
+
}
|
61 |
+
}
|
compat/comscore.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
var _comscore=_comscore||[];_comscore.push({c1:"2",c2:"%d",options:{url_append:"comscorekw=fbia"}});(function(){var s=document.createElement("script"),el=document.getElementsByTagName("script")[0];s.async=true;s.src="https://sb.scorecardresearch.com/beacon.js";el.parentNode.insertBefore(s,el)})();
|
facebook-instant-articles.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Description: Add support for Instant Articles for Facebook to your WordPress site.
|
5 |
* Author: Automattic, Dekode, Facebook
|
6 |
* Author URI: https://vip.wordpress.com/plugins/instant-articles/
|
7 |
-
* Version: 4.2.
|
8 |
* Text Domain: instant-articles
|
9 |
* License: GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -35,7 +35,7 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
35 |
|
36 |
defined( 'ABSPATH' ) || die( 'Shame on you' );
|
37 |
|
38 |
-
define( 'IA_PLUGIN_VERSION', '4.2.
|
39 |
define( 'IA_PLUGIN_PATH_FULL', __FILE__ );
|
40 |
define( 'IA_PLUGIN_PATH', plugin_basename( __FILE__ ) );
|
41 |
define( 'IA_PLUGIN_FILE_BASENAME', pathinfo( __FILE__, PATHINFO_FILENAME ) );
|
@@ -419,7 +419,7 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
419 |
|
420 |
function fbia_indicator_column_heading( $columns ) {
|
421 |
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
422 |
-
$display_warning_column = $publishing_settings[ 'display_warning_column' ];
|
423 |
|
424 |
if( "1" === $display_warning_column ) {
|
425 |
$columns[ 'FBIA' ] = "<span title='Facebook Instant Article Distribution Status' class='fbia-col-heading'>FB IA Status</span>";
|
@@ -430,7 +430,7 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
430 |
|
431 |
function fbia_indication_column( $column_name, $post_ID ) {
|
432 |
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
433 |
-
$display_warning_column = $publishing_settings[ 'display_warning_column' ];
|
434 |
|
435 |
if( "1" === $display_warning_column ) {
|
436 |
$red_light = '<span title="Instant article is empty after transformation." class="instant-articles-col-status error"></span>';
|
4 |
* Description: Add support for Instant Articles for Facebook to your WordPress site.
|
5 |
* Author: Automattic, Dekode, Facebook
|
6 |
* Author URI: https://vip.wordpress.com/plugins/instant-articles/
|
7 |
+
* Version: 4.2.1
|
8 |
* Text Domain: instant-articles
|
9 |
* License: GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
35 |
|
36 |
defined( 'ABSPATH' ) || die( 'Shame on you' );
|
37 |
|
38 |
+
define( 'IA_PLUGIN_VERSION', '4.2.1' );
|
39 |
define( 'IA_PLUGIN_PATH_FULL', __FILE__ );
|
40 |
define( 'IA_PLUGIN_PATH', plugin_basename( __FILE__ ) );
|
41 |
define( 'IA_PLUGIN_FILE_BASENAME', pathinfo( __FILE__, PATHINFO_FILENAME ) );
|
419 |
|
420 |
function fbia_indicator_column_heading( $columns ) {
|
421 |
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
422 |
+
$display_warning_column = isset( $publishing_settings[ 'display_warning_column' ] ) ? $publishing_settings[ 'display_warning_column' ] : '0';
|
423 |
|
424 |
if( "1" === $display_warning_column ) {
|
425 |
$columns[ 'FBIA' ] = "<span title='Facebook Instant Article Distribution Status' class='fbia-col-heading'>FB IA Status</span>";
|
430 |
|
431 |
function fbia_indication_column( $column_name, $post_ID ) {
|
432 |
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
433 |
+
$display_warning_column = isset( $publishing_settings[ 'display_warning_column' ] ) ? $publishing_settings[ 'display_warning_column' ] : '0';
|
434 |
|
435 |
if( "1" === $display_warning_column ) {
|
436 |
$red_light = '<span title="Instant article is empty after transformation." class="instant-articles-col-status error"></span>';
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: trrine, olethomas, bjornjohansen, dekode, automattic, facebook
|
3 |
Tags: instant articles, facebook, mobile
|
4 |
Requires at least: 4.3
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 4.2.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -90,7 +90,15 @@ Usually simply visiting the permalinks settings page in the WordPress dashboard
|
|
90 |
== Changelog ==
|
91 |
## Change Log
|
92 |
|
93 |
-
### 4.2.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
- [#997](https://github.com/automattic/facebook-instant-articles-wp/pull/997) Removed fields from deprecated feature to enable comments/likes/share from media content (@everton-rosario)
|
95 |
|
96 |
### 4.1.1 (2018/07/17 15:45 +00:00)
|
2 |
Contributors: trrine, olethomas, bjornjohansen, dekode, automattic, facebook
|
3 |
Tags: instant articles, facebook, mobile
|
4 |
Requires at least: 4.3
|
5 |
+
Tested up to: 5.4.1
|
6 |
+
Stable tag: 4.2.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
90 |
== Changelog ==
|
91 |
## Change Log
|
92 |
|
93 |
+
### 4.2.1 (2020/06/10 21:11 +00:00)
|
94 |
+
- [#1049](https://github.com/automattic/facebook-instant-articles-wp/pull/1049) Add support for new guttenberg layout elements (@diegoquinteiro)
|
95 |
+
- [#1012](https://github.com/automattic/facebook-instant-articles-wp/pull/1012) update composer modules (@paulschreiber)
|
96 |
+
- [#1001](https://github.com/automattic/facebook-instant-articles-wp/pull/1001) Load functions which rely on `plugins_loaded` action hook in VIP Go environment (@paulschreiber)
|
97 |
+
- [#990](https://github.com/automattic/facebook-instant-articles-wp/pull/990) avoid undefined index error in $display_warning_column (@paulschreiber)
|
98 |
+
- [#1002](https://github.com/automattic/facebook-instant-articles-wp/pull/1002) add Comscore plugin (@paulschreiber)
|
99 |
+
- [#1007](https://github.com/automattic/facebook-instant-articles-wp/pull/1007) Update Facebook SDK versions (@paulschreiber)
|
100 |
+
|
101 |
+
### 4.2.0 (2018/11/29 18:14 +00:00)
|
102 |
- [#997](https://github.com/automattic/facebook-instant-articles-wp/pull/997) Removed fields from deprecated feature to enable comments/likes/share from media content (@everton-rosario)
|
103 |
|
104 |
### 4.1.1 (2018/07/17 15:45 +00:00)
|
rules-configuration.json
CHANGED
@@ -329,6 +329,15 @@
|
|
329 |
"attribute": "src"
|
330 |
}
|
331 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
}, {
|
333 |
"class": "VideoRule",
|
334 |
"selector" : "div.wp-video",
|
@@ -351,6 +360,9 @@
|
|
351 |
}, {
|
352 |
"class" : "PassThroughRule",
|
353 |
"selector" : "div.vce-gallery-small"
|
|
|
|
|
|
|
354 |
}, {
|
355 |
"class" : "IgnoreRule",
|
356 |
"selector" : "div.vce-gallery-slider"
|
329 |
"attribute": "src"
|
330 |
}
|
331 |
}
|
332 |
+
}, {
|
333 |
+
"class": "SlideshowRule",
|
334 |
+
"selector" : "figure.wp-block-gallery"
|
335 |
+
}, {
|
336 |
+
"class": "PassThroughRule",
|
337 |
+
"selector" : "ul.blocks-gallery-grid"
|
338 |
+
}, {
|
339 |
+
"class": "PassThroughRule",
|
340 |
+
"selector" : "li.blocks-gallery-item"
|
341 |
}, {
|
342 |
"class": "VideoRule",
|
343 |
"selector" : "div.wp-video",
|
360 |
}, {
|
361 |
"class" : "PassThroughRule",
|
362 |
"selector" : "div.vce-gallery-small"
|
363 |
+
}, {
|
364 |
+
"class": "PassthroughRule",
|
365 |
+
"selector": "div.wp-block-columns, div.wp-block-column"
|
366 |
}, {
|
367 |
"class" : "IgnoreRule",
|
368 |
"selector" : "div.vce-gallery-slider"
|
vendor/composer/autoload_psr4.php
CHANGED
@@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir);
|
|
7 |
|
8 |
return array(
|
9 |
'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'),
|
10 |
-
'Facebook\\InstantArticles\\' => array($vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles', $vendorDir . '/facebook/facebook-instant-articles-sdk-
|
11 |
'Facebook\\' => array($vendorDir . '/facebook/graph-sdk/src/Facebook'),
|
|
|
12 |
);
|
7 |
|
8 |
return array(
|
9 |
'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'),
|
10 |
+
'Facebook\\InstantArticles\\' => array($vendorDir . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles', $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles'),
|
11 |
'Facebook\\' => array($vendorDir . '/facebook/graph-sdk/src/Facebook'),
|
12 |
+
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
|
13 |
);
|
vendor/composer/autoload_static.php
CHANGED
@@ -20,6 +20,10 @@ class ComposerStaticInit8b1e91281cd41e15c5fb1bef205d265f
|
|
20 |
'Facebook\\InstantArticles\\' => 25,
|
21 |
'Facebook\\' => 9,
|
22 |
),
|
|
|
|
|
|
|
|
|
23 |
);
|
24 |
|
25 |
public static $prefixDirsPsr4 = array (
|
@@ -29,13 +33,17 @@ class ComposerStaticInit8b1e91281cd41e15c5fb1bef205d265f
|
|
29 |
),
|
30 |
'Facebook\\InstantArticles\\' =>
|
31 |
array (
|
32 |
-
0 => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles',
|
33 |
-
1 => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-
|
34 |
),
|
35 |
'Facebook\\' =>
|
36 |
array (
|
37 |
0 => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook',
|
38 |
),
|
|
|
|
|
|
|
|
|
39 |
);
|
40 |
|
41 |
public static function getInitializer(ClassLoader $loader)
|
20 |
'Facebook\\InstantArticles\\' => 25,
|
21 |
'Facebook\\' => 9,
|
22 |
),
|
23 |
+
'D' =>
|
24 |
+
array (
|
25 |
+
'Doctrine\\Instantiator\\' => 22,
|
26 |
+
),
|
27 |
);
|
28 |
|
29 |
public static $prefixDirsPsr4 = array (
|
33 |
),
|
34 |
'Facebook\\InstantArticles\\' =>
|
35 |
array (
|
36 |
+
0 => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles',
|
37 |
+
1 => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles',
|
38 |
),
|
39 |
'Facebook\\' =>
|
40 |
array (
|
41 |
0 => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook',
|
42 |
),
|
43 |
+
'Doctrine\\Instantiator\\' =>
|
44 |
+
array (
|
45 |
+
0 => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator',
|
46 |
+
),
|
47 |
);
|
48 |
|
49 |
public static function getInitializer(ClassLoader $loader)
|
vendor/composer/installed.json
CHANGED
@@ -1,27 +1,86 @@
|
|
1 |
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
{
|
3 |
"name": "facebook/facebook-instant-articles-sdk-extensions-in-php",
|
4 |
-
"version": "v0.
|
5 |
-
"version_normalized": "0.
|
6 |
"source": {
|
7 |
"type": "git",
|
8 |
"url": "https://github.com/facebook/facebook-instant-articles-sdk-extensions-in-php.git",
|
9 |
-
"reference": "
|
10 |
},
|
11 |
"dist": {
|
12 |
"type": "zip",
|
13 |
-
"url": "https://api.github.com/repos/facebook/facebook-instant-articles-sdk-extensions-in-php/zipball/
|
14 |
-
"reference": "
|
15 |
"shasum": ""
|
16 |
},
|
17 |
"require": {
|
18 |
-
"
|
|
|
19 |
"php": "^5.4 || ^7.0"
|
20 |
},
|
21 |
"require-dev": {
|
22 |
-
"
|
|
|
|
|
23 |
},
|
24 |
-
"time": "
|
25 |
"type": "library",
|
26 |
"installation-source": "dist",
|
27 |
"autoload": {
|
@@ -107,17 +166,17 @@
|
|
107 |
},
|
108 |
{
|
109 |
"name": "facebook/graph-sdk",
|
110 |
-
"version": "5.
|
111 |
-
"version_normalized": "5.
|
112 |
"source": {
|
113 |
"type": "git",
|
114 |
"url": "https://github.com/facebook/php-graph-sdk.git",
|
115 |
-
"reference": "
|
116 |
},
|
117 |
"dist": {
|
118 |
"type": "zip",
|
119 |
-
"url": "https://api.github.com/repos/facebook/php-graph-sdk/zipball/
|
120 |
-
"reference": "
|
121 |
"shasum": ""
|
122 |
},
|
123 |
"require": {
|
@@ -132,7 +191,7 @@
|
|
132 |
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client",
|
133 |
"paragonie/random_compat": "Provides a better CSPRNG option in PHP 5"
|
134 |
},
|
135 |
-
"time": "2018-
|
136 |
"type": "library",
|
137 |
"extra": {
|
138 |
"branch-alias": {
|
@@ -167,17 +226,17 @@
|
|
167 |
},
|
168 |
{
|
169 |
"name": "squizlabs/php_codesniffer",
|
170 |
-
"version": "3.
|
171 |
-
"version_normalized": "3.
|
172 |
"source": {
|
173 |
"type": "git",
|
174 |
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
175 |
-
"reference": "
|
176 |
},
|
177 |
"dist": {
|
178 |
"type": "zip",
|
179 |
-
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/
|
180 |
-
"reference": "
|
181 |
"shasum": ""
|
182 |
},
|
183 |
"require": {
|
@@ -189,7 +248,7 @@
|
|
189 |
"require-dev": {
|
190 |
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
191 |
},
|
192 |
-
"time": "2018-
|
193 |
"bin": [
|
194 |
"bin/phpcs",
|
195 |
"bin/phpcbf"
|
@@ -220,8 +279,8 @@
|
|
220 |
},
|
221 |
{
|
222 |
"name": "symfony/css-selector",
|
223 |
-
"version": "v2.8.
|
224 |
-
"version_normalized": "2.8.
|
225 |
"source": {
|
226 |
"type": "git",
|
227 |
"url": "https://github.com/symfony/css-selector.git",
|
@@ -275,17 +334,17 @@
|
|
275 |
},
|
276 |
{
|
277 |
"name": "wp-coding-standards/wpcs",
|
278 |
-
"version": "1.2.
|
279 |
-
"version_normalized": "1.2.
|
280 |
"source": {
|
281 |
"type": "git",
|
282 |
"url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
|
283 |
-
"reference": "
|
284 |
},
|
285 |
"dist": {
|
286 |
"type": "zip",
|
287 |
-
"url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/
|
288 |
-
"reference": "
|
289 |
"shasum": ""
|
290 |
},
|
291 |
"require": {
|
@@ -298,7 +357,7 @@
|
|
298 |
"suggest": {
|
299 |
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
|
300 |
},
|
301 |
-
"time": "2018-
|
302 |
"type": "phpcodesniffer-standard",
|
303 |
"installation-source": "dist",
|
304 |
"notification-url": "https://packagist.org/downloads/",
|
1 |
[
|
2 |
+
{
|
3 |
+
"name": "doctrine/instantiator",
|
4 |
+
"version": "1.0.5",
|
5 |
+
"version_normalized": "1.0.5.0",
|
6 |
+
"source": {
|
7 |
+
"type": "git",
|
8 |
+
"url": "https://github.com/doctrine/instantiator.git",
|
9 |
+
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
|
10 |
+
},
|
11 |
+
"dist": {
|
12 |
+
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
|
14 |
+
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
|
15 |
+
"shasum": ""
|
16 |
+
},
|
17 |
+
"require": {
|
18 |
+
"php": ">=5.3,<8.0-DEV"
|
19 |
+
},
|
20 |
+
"require-dev": {
|
21 |
+
"athletic/athletic": "~0.1.8",
|
22 |
+
"ext-pdo": "*",
|
23 |
+
"ext-phar": "*",
|
24 |
+
"phpunit/phpunit": "~4.0",
|
25 |
+
"squizlabs/php_codesniffer": "~2.0"
|
26 |
+
},
|
27 |
+
"time": "2015-06-14T21:17:01+00:00",
|
28 |
+
"type": "library",
|
29 |
+
"extra": {
|
30 |
+
"branch-alias": {
|
31 |
+
"dev-master": "1.0.x-dev"
|
32 |
+
}
|
33 |
+
},
|
34 |
+
"installation-source": "dist",
|
35 |
+
"autoload": {
|
36 |
+
"psr-4": {
|
37 |
+
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
|
38 |
+
}
|
39 |
+
},
|
40 |
+
"notification-url": "https://packagist.org/downloads/",
|
41 |
+
"license": [
|
42 |
+
"MIT"
|
43 |
+
],
|
44 |
+
"authors": [
|
45 |
+
{
|
46 |
+
"name": "Marco Pivetta",
|
47 |
+
"email": "ocramius@gmail.com",
|
48 |
+
"homepage": "http://ocramius.github.com/"
|
49 |
+
}
|
50 |
+
],
|
51 |
+
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
52 |
+
"homepage": "https://github.com/doctrine/instantiator",
|
53 |
+
"keywords": [
|
54 |
+
"constructor",
|
55 |
+
"instantiate"
|
56 |
+
]
|
57 |
+
},
|
58 |
{
|
59 |
"name": "facebook/facebook-instant-articles-sdk-extensions-in-php",
|
60 |
+
"version": "v0.2.1",
|
61 |
+
"version_normalized": "0.2.1.0",
|
62 |
"source": {
|
63 |
"type": "git",
|
64 |
"url": "https://github.com/facebook/facebook-instant-articles-sdk-extensions-in-php.git",
|
65 |
+
"reference": "de4470829537326987feadad6a19445c33a20383"
|
66 |
},
|
67 |
"dist": {
|
68 |
"type": "zip",
|
69 |
+
"url": "https://api.github.com/repos/facebook/facebook-instant-articles-sdk-extensions-in-php/zipball/de4470829537326987feadad6a19445c33a20383",
|
70 |
+
"reference": "de4470829537326987feadad6a19445c33a20383",
|
71 |
"shasum": ""
|
72 |
},
|
73 |
"require": {
|
74 |
+
"doctrine/instantiator": "<=1.0.5",
|
75 |
+
"facebook/facebook-instant-articles-sdk-php": "^1.8.3",
|
76 |
"php": "^5.4 || ^7.0"
|
77 |
},
|
78 |
"require-dev": {
|
79 |
+
"phpdocumentor/reflection-docblock": "^2.0",
|
80 |
+
"phpunit/phpunit": "^4.8",
|
81 |
+
"squizlabs/php_codesniffer": "^3.0.0"
|
82 |
},
|
83 |
+
"time": "2018-02-08T18:21:18+00:00",
|
84 |
"type": "library",
|
85 |
"installation-source": "dist",
|
86 |
"autoload": {
|
166 |
},
|
167 |
{
|
168 |
"name": "facebook/graph-sdk",
|
169 |
+
"version": "5.7.0",
|
170 |
+
"version_normalized": "5.7.0.0",
|
171 |
"source": {
|
172 |
"type": "git",
|
173 |
"url": "https://github.com/facebook/php-graph-sdk.git",
|
174 |
+
"reference": "2d8250638b33d73e7a87add65f47fabf91f8ad9b"
|
175 |
},
|
176 |
"dist": {
|
177 |
"type": "zip",
|
178 |
+
"url": "https://api.github.com/repos/facebook/php-graph-sdk/zipball/2d8250638b33d73e7a87add65f47fabf91f8ad9b",
|
179 |
+
"reference": "2d8250638b33d73e7a87add65f47fabf91f8ad9b",
|
180 |
"shasum": ""
|
181 |
},
|
182 |
"require": {
|
191 |
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client",
|
192 |
"paragonie/random_compat": "Provides a better CSPRNG option in PHP 5"
|
193 |
},
|
194 |
+
"time": "2018-12-11T22:56:31+00:00",
|
195 |
"type": "library",
|
196 |
"extra": {
|
197 |
"branch-alias": {
|
226 |
},
|
227 |
{
|
228 |
"name": "squizlabs/php_codesniffer",
|
229 |
+
"version": "3.4.0",
|
230 |
+
"version_normalized": "3.4.0.0",
|
231 |
"source": {
|
232 |
"type": "git",
|
233 |
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
234 |
+
"reference": "379deb987e26c7cd103a7b387aea178baec96e48"
|
235 |
},
|
236 |
"dist": {
|
237 |
"type": "zip",
|
238 |
+
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/379deb987e26c7cd103a7b387aea178baec96e48",
|
239 |
+
"reference": "379deb987e26c7cd103a7b387aea178baec96e48",
|
240 |
"shasum": ""
|
241 |
},
|
242 |
"require": {
|
248 |
"require-dev": {
|
249 |
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
250 |
},
|
251 |
+
"time": "2018-12-19T23:57:18+00:00",
|
252 |
"bin": [
|
253 |
"bin/phpcs",
|
254 |
"bin/phpcbf"
|
279 |
},
|
280 |
{
|
281 |
"name": "symfony/css-selector",
|
282 |
+
"version": "v2.8.49",
|
283 |
+
"version_normalized": "2.8.49.0",
|
284 |
"source": {
|
285 |
"type": "git",
|
286 |
"url": "https://github.com/symfony/css-selector.git",
|
334 |
},
|
335 |
{
|
336 |
"name": "wp-coding-standards/wpcs",
|
337 |
+
"version": "1.2.1",
|
338 |
+
"version_normalized": "1.2.1.0",
|
339 |
"source": {
|
340 |
"type": "git",
|
341 |
"url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
|
342 |
+
"reference": "f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c"
|
343 |
},
|
344 |
"dist": {
|
345 |
"type": "zip",
|
346 |
+
"url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c",
|
347 |
+
"reference": "f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c",
|
348 |
"shasum": ""
|
349 |
},
|
350 |
"require": {
|
357 |
"suggest": {
|
358 |
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
|
359 |
},
|
360 |
+
"time": "2018-12-18T09:43:51+00:00",
|
361 |
"type": "phpcodesniffer-standard",
|
362 |
"installation-source": "dist",
|
363 |
"notification-url": "https://packagist.org/downloads/",
|
vendor/doctrine/instantiator/.gitignore
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
phpunit.xml
|
2 |
+
composer.lock
|
3 |
+
build
|
4 |
+
vendor
|
5 |
+
coverage.clover
|
vendor/doctrine/instantiator/.scrutinizer.yml
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
before_commands:
|
2 |
+
- "composer install --prefer-source"
|
3 |
+
|
4 |
+
tools:
|
5 |
+
external_code_coverage:
|
6 |
+
timeout: 600
|
7 |
+
php_code_coverage:
|
8 |
+
enabled: true
|
9 |
+
test_command: ./vendor/bin/phpunit
|
10 |
+
php_code_sniffer:
|
11 |
+
enabled: true
|
12 |
+
config:
|
13 |
+
standard: PSR2
|
14 |
+
filter:
|
15 |
+
paths: ["src/*", "tests/*"]
|
16 |
+
php_cpd:
|
17 |
+
enabled: true
|
18 |
+
excluded_dirs: ["build/*", "tests", "vendor"]
|
19 |
+
php_cs_fixer:
|
20 |
+
enabled: true
|
21 |
+
config:
|
22 |
+
level: all
|
23 |
+
filter:
|
24 |
+
paths: ["src/*", "tests/*"]
|
25 |
+
php_loc:
|
26 |
+
enabled: true
|
27 |
+
excluded_dirs: ["build", "tests", "vendor"]
|
28 |
+
php_mess_detector:
|
29 |
+
enabled: true
|
30 |
+
config:
|
31 |
+
ruleset: phpmd.xml.dist
|
32 |
+
design_rules: { eval_expression: false }
|
33 |
+
filter:
|
34 |
+
paths: ["src/*"]
|
35 |
+
php_pdepend:
|
36 |
+
enabled: true
|
37 |
+
excluded_dirs: ["build", "tests", "vendor"]
|
38 |
+
php_analyzer:
|
39 |
+
enabled: true
|
40 |
+
filter:
|
41 |
+
paths: ["src/*", "tests/*"]
|
42 |
+
php_hhvm:
|
43 |
+
enabled: true
|
44 |
+
filter:
|
45 |
+
paths: ["src/*", "tests/*"]
|
46 |
+
sensiolabs_security_checker: true
|
vendor/doctrine/instantiator/.travis.install.sh
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
set -x
|
3 |
+
if [ "$TRAVIS_PHP_VERSION" = 'hhvm' ] || [ "$TRAVIS_PHP_VERSION" = 'hhvm-nightly' ] ; then
|
4 |
+
curl -sS https://getcomposer.org/installer > composer-installer.php
|
5 |
+
hhvm composer-installer.php
|
6 |
+
hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 composer.phar update --prefer-source
|
7 |
+
elif [ "$TRAVIS_PHP_VERSION" = '5.3.3' ] ; then
|
8 |
+
composer self-update
|
9 |
+
composer update --prefer-source --no-dev
|
10 |
+
composer dump-autoload
|
11 |
+
else
|
12 |
+
composer self-update
|
13 |
+
composer update --prefer-source
|
14 |
+
fi
|
vendor/doctrine/instantiator/.travis.yml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
language: php
|
2 |
+
|
3 |
+
php:
|
4 |
+
- 5.3.3
|
5 |
+
- 5.3
|
6 |
+
- 5.4
|
7 |
+
- 5.5
|
8 |
+
- 5.6
|
9 |
+
- hhvm
|
10 |
+
|
11 |
+
before_script:
|
12 |
+
- ./.travis.install.sh
|
13 |
+
- if [ $TRAVIS_PHP_VERSION = '5.6' ]; then PHPUNIT_FLAGS="--coverage-clover coverage.clover"; else PHPUNIT_FLAGS=""; fi
|
14 |
+
|
15 |
+
script:
|
16 |
+
- if [ $TRAVIS_PHP_VERSION = '5.3.3' ]; then phpunit; fi
|
17 |
+
- if [ $TRAVIS_PHP_VERSION != '5.3.3' ]; then ./vendor/bin/phpunit $PHPUNIT_FLAGS; fi
|
18 |
+
- if [ $TRAVIS_PHP_VERSION != '5.3.3' ]; then ./vendor/bin/phpcs --standard=PSR2 ./src/ ./tests/; fi
|
19 |
+
- if [[ $TRAVIS_PHP_VERSION != '5.3.3' && $TRAVIS_PHP_VERSION != '5.4.29' && $TRAVIS_PHP_VERSION != '5.5.13' ]]; then php -n ./vendor/bin/athletic -p ./tests/DoctrineTest/InstantiatorPerformance/ -f GroupedFormatter; fi
|
20 |
+
|
21 |
+
after_script:
|
22 |
+
- if [ $TRAVIS_PHP_VERSION = '5.6' ]; then wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
|
vendor/doctrine/instantiator/CONTRIBUTING.md
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Contributing
|
2 |
+
|
3 |
+
* Coding standard for the project is [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
|
4 |
+
* The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php)
|
5 |
+
* Any contribution must provide tests for additional introduced conditions
|
6 |
+
* Any un-confirmed issue needs a failing test case before being accepted
|
7 |
+
* Pull requests must be sent from a new hotfix/feature branch, not from `master`.
|
8 |
+
|
9 |
+
## Installation
|
10 |
+
|
11 |
+
To install the project and run the tests, you need to clone it first:
|
12 |
+
|
13 |
+
```sh
|
14 |
+
$ git clone git://github.com/doctrine/instantiator.git
|
15 |
+
```
|
16 |
+
|
17 |
+
You will then need to run a composer installation:
|
18 |
+
|
19 |
+
```sh
|
20 |
+
$ cd Instantiator
|
21 |
+
$ curl -s https://getcomposer.org/installer | php
|
22 |
+
$ php composer.phar update
|
23 |
+
```
|
24 |
+
|
25 |
+
## Testing
|
26 |
+
|
27 |
+
The PHPUnit version to be used is the one installed as a dev- dependency via composer:
|
28 |
+
|
29 |
+
```sh
|
30 |
+
$ ./vendor/bin/phpunit
|
31 |
+
```
|
32 |
+
|
33 |
+
Accepted coverage for new contributions is 80%. Any contribution not satisfying this requirement
|
34 |
+
won't be merged.
|
35 |
+
|
vendor/doctrine/instantiator/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2014 Doctrine Project
|
2 |
+
|
3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4 |
+
this software and associated documentation files (the "Software"), to deal in
|
5 |
+
the Software without restriction, including without limitation the rights to
|
6 |
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7 |
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8 |
+
so, subject to the following conditions:
|
9 |
+
|
10 |
+
The above copyright notice and this permission notice shall be included in all
|
11 |
+
copies or substantial portions of the Software.
|
12 |
+
|
13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19 |
+
SOFTWARE.
|
vendor/doctrine/instantiator/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Instantiator
|
2 |
+
|
3 |
+
This library provides a way of avoiding usage of constructors when instantiating PHP classes.
|
4 |
+
|
5 |
+
[![Build Status](https://travis-ci.org/doctrine/instantiator.svg?branch=master)](https://travis-ci.org/doctrine/instantiator)
|
6 |
+
[![Code Coverage](https://scrutinizer-ci.com/g/doctrine/instantiator/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/doctrine/instantiator/?branch=master)
|
7 |
+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/doctrine/instantiator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/doctrine/instantiator/?branch=master)
|
8 |
+
[![Dependency Status](https://www.versioneye.com/package/php--doctrine--instantiator/badge.svg)](https://www.versioneye.com/package/php--doctrine--instantiator)
|
9 |
+
[![HHVM Status](http://hhvm.h4cc.de/badge/doctrine/instantiator.png)](http://hhvm.h4cc.de/package/doctrine/instantiator)
|
10 |
+
|
11 |
+
[![Latest Stable Version](https://poser.pugx.org/doctrine/instantiator/v/stable.png)](https://packagist.org/packages/doctrine/instantiator)
|
12 |
+
[![Latest Unstable Version](https://poser.pugx.org/doctrine/instantiator/v/unstable.png)](https://packagist.org/packages/doctrine/instantiator)
|
13 |
+
|
14 |
+
## Installation
|
15 |
+
|
16 |
+
The suggested installation method is via [composer](https://getcomposer.org/):
|
17 |
+
|
18 |
+
```sh
|
19 |
+
php composer.phar require "doctrine/instantiator:~1.0.3"
|
20 |
+
```
|
21 |
+
|
22 |
+
## Usage
|
23 |
+
|
24 |
+
The instantiator is able to create new instances of any class without using the constructor or any API of the class
|
25 |
+
itself:
|
26 |
+
|
27 |
+
```php
|
28 |
+
$instantiator = new \Doctrine\Instantiator\Instantiator();
|
29 |
+
|
30 |
+
$instance = $instantiator->instantiate('My\\ClassName\\Here');
|
31 |
+
```
|
32 |
+
|
33 |
+
## Contributing
|
34 |
+
|
35 |
+
Please read the [CONTRIBUTING.md](CONTRIBUTING.md) contents if you wish to help out!
|
36 |
+
|
37 |
+
## Credits
|
38 |
+
|
39 |
+
This library was migrated from [ocramius/instantiator](https://github.com/Ocramius/Instantiator), which
|
40 |
+
has been donated to the doctrine organization, and which is now deprecated in favour of this package.
|
vendor/doctrine/instantiator/composer.json
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "doctrine/instantiator",
|
3 |
+
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
4 |
+
"type": "library",
|
5 |
+
"license": "MIT",
|
6 |
+
"homepage": "https://github.com/doctrine/instantiator",
|
7 |
+
"keywords": [
|
8 |
+
"instantiate",
|
9 |
+
"constructor"
|
10 |
+
],
|
11 |
+
"authors": [
|
12 |
+
{
|
13 |
+
"name": "Marco Pivetta",
|
14 |
+
"email": "ocramius@gmail.com",
|
15 |
+
"homepage": "http://ocramius.github.com/"
|
16 |
+
}
|
17 |
+
],
|
18 |
+
"require": {
|
19 |
+
"php": ">=5.3,<8.0-DEV"
|
20 |
+
},
|
21 |
+
"require-dev": {
|
22 |
+
"ext-phar": "*",
|
23 |
+
"ext-pdo": "*",
|
24 |
+
"phpunit/phpunit": "~4.0",
|
25 |
+
"squizlabs/php_codesniffer": "~2.0",
|
26 |
+
"athletic/athletic": "~0.1.8"
|
27 |
+
},
|
28 |
+
"autoload": {
|
29 |
+
"psr-4": {
|
30 |
+
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
|
31 |
+
}
|
32 |
+
},
|
33 |
+
"autoload-dev": {
|
34 |
+
"psr-0": {
|
35 |
+
"DoctrineTest\\InstantiatorPerformance\\": "tests",
|
36 |
+
"DoctrineTest\\InstantiatorTest\\": "tests",
|
37 |
+
"DoctrineTest\\InstantiatorTestAsset\\": "tests"
|
38 |
+
}
|
39 |
+
},
|
40 |
+
"extra": {
|
41 |
+
"branch-alias": {
|
42 |
+
"dev-master": "1.0.x-dev"
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
vendor/doctrine/instantiator/phpmd.xml.dist
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2 |
+
<ruleset
|
3 |
+
name="Instantiator rules"
|
4 |
+
xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
5 |
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
6 |
+
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
|
7 |
+
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
|
8 |
+
>
|
9 |
+
<rule ref="rulesets/cleancode.xml">
|
10 |
+
<!-- static access is used for caching purposes -->
|
11 |
+
<exclude name="StaticAccess"/>
|
12 |
+
</rule>
|
13 |
+
<rule ref="rulesets/codesize.xml"/>
|
14 |
+
<rule ref="rulesets/controversial.xml"/>
|
15 |
+
<rule ref="rulesets/design.xml"/>
|
16 |
+
<rule ref="rulesets/naming.xml"/>
|
17 |
+
<rule ref="rulesets/unusedcode.xml"/>
|
18 |
+
<rule
|
19 |
+
name="NPathComplexity"
|
20 |
+
message="The {0} {1}() has an NPath complexity of {2}. The configured NPath complexity threshold is {3}."
|
21 |
+
class="PHP_PMD_Rule_Design_NpathComplexity"
|
22 |
+
>
|
23 |
+
<properties>
|
24 |
+
<property name="minimum" description="The npath reporting threshold" value="10"/>
|
25 |
+
</properties>
|
26 |
+
</rule>
|
27 |
+
</ruleset>
|
vendor/doctrine/instantiator/phpunit.xml.dist
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<phpunit
|
3 |
+
bootstrap="./vendor/autoload.php"
|
4 |
+
colors="true"
|
5 |
+
convertErrorsToExceptions="true"
|
6 |
+
convertNoticesToExceptions="true"
|
7 |
+
convertWarningsToExceptions="true"
|
8 |
+
verbose="true"
|
9 |
+
stopOnFailure="false"
|
10 |
+
processIsolation="false"
|
11 |
+
backupGlobals="false"
|
12 |
+
syntaxCheck="true"
|
13 |
+
>
|
14 |
+
<testsuite name="Doctrine\Instantiator tests">
|
15 |
+
<directory>./tests/DoctrineTest/InstantiatorTest</directory>
|
16 |
+
</testsuite>
|
17 |
+
<filter>
|
18 |
+
<whitelist addUncoveredFilesFromWhitelist="true">
|
19 |
+
<directory suffix=".php">./src</directory>
|
20 |
+
</whitelist>
|
21 |
+
</filter>
|
22 |
+
</phpunit>
|
vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace Doctrine\Instantiator\Exception;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Base exception marker interface for the instantiator component
|
24 |
+
*
|
25 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
26 |
+
*/
|
27 |
+
interface ExceptionInterface
|
28 |
+
{
|
29 |
+
}
|
vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/InvalidArgumentException.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace Doctrine\Instantiator\Exception;
|
21 |
+
|
22 |
+
use InvalidArgumentException as BaseInvalidArgumentException;
|
23 |
+
use ReflectionClass;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Exception for invalid arguments provided to the instantiator
|
27 |
+
*
|
28 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
+
*/
|
30 |
+
class InvalidArgumentException extends BaseInvalidArgumentException implements ExceptionInterface
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* @param string $className
|
34 |
+
*
|
35 |
+
* @return self
|
36 |
+
*/
|
37 |
+
public static function fromNonExistingClass($className)
|
38 |
+
{
|
39 |
+
if (interface_exists($className)) {
|
40 |
+
return new self(sprintf('The provided type "%s" is an interface, and can not be instantiated', $className));
|
41 |
+
}
|
42 |
+
|
43 |
+
if (PHP_VERSION_ID >= 50400 && trait_exists($className)) {
|
44 |
+
return new self(sprintf('The provided type "%s" is a trait, and can not be instantiated', $className));
|
45 |
+
}
|
46 |
+
|
47 |
+
return new self(sprintf('The provided class "%s" does not exist', $className));
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @param ReflectionClass $reflectionClass
|
52 |
+
*
|
53 |
+
* @return self
|
54 |
+
*/
|
55 |
+
public static function fromAbstractClass(ReflectionClass $reflectionClass)
|
56 |
+
{
|
57 |
+
return new self(sprintf(
|
58 |
+
'The provided class "%s" is abstract, and can not be instantiated',
|
59 |
+
$reflectionClass->getName()
|
60 |
+
));
|
61 |
+
}
|
62 |
+
}
|
vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace Doctrine\Instantiator\Exception;
|
21 |
+
|
22 |
+
use Exception;
|
23 |
+
use ReflectionClass;
|
24 |
+
use UnexpectedValueException as BaseUnexpectedValueException;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Exception for given parameters causing invalid/unexpected state on instantiation
|
28 |
+
*
|
29 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
30 |
+
*/
|
31 |
+
class UnexpectedValueException extends BaseUnexpectedValueException implements ExceptionInterface
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* @param ReflectionClass $reflectionClass
|
35 |
+
* @param Exception $exception
|
36 |
+
*
|
37 |
+
* @return self
|
38 |
+
*/
|
39 |
+
public static function fromSerializationTriggeredException(ReflectionClass $reflectionClass, Exception $exception)
|
40 |
+
{
|
41 |
+
return new self(
|
42 |
+
sprintf(
|
43 |
+
'An exception was raised while trying to instantiate an instance of "%s" via un-serialization',
|
44 |
+
$reflectionClass->getName()
|
45 |
+
),
|
46 |
+
0,
|
47 |
+
$exception
|
48 |
+
);
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @param ReflectionClass $reflectionClass
|
53 |
+
* @param string $errorString
|
54 |
+
* @param int $errorCode
|
55 |
+
* @param string $errorFile
|
56 |
+
* @param int $errorLine
|
57 |
+
*
|
58 |
+
* @return UnexpectedValueException
|
59 |
+
*/
|
60 |
+
public static function fromUncleanUnSerialization(
|
61 |
+
ReflectionClass $reflectionClass,
|
62 |
+
$errorString,
|
63 |
+
$errorCode,
|
64 |
+
$errorFile,
|
65 |
+
$errorLine
|
66 |
+
) {
|
67 |
+
return new self(
|
68 |
+
sprintf(
|
69 |
+
'Could not produce an instance of "%s" via un-serialization, since an error was triggered '
|
70 |
+
. 'in file "%s" at line "%d"',
|
71 |
+
$reflectionClass->getName(),
|
72 |
+
$errorFile,
|
73 |
+
$errorLine
|
74 |
+
),
|
75 |
+
0,
|
76 |
+
new Exception($errorString, $errorCode)
|
77 |
+
);
|
78 |
+
}
|
79 |
+
}
|
vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php
ADDED
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace Doctrine\Instantiator;
|
21 |
+
|
22 |
+
use Closure;
|
23 |
+
use Doctrine\Instantiator\Exception\InvalidArgumentException;
|
24 |
+
use Doctrine\Instantiator\Exception\UnexpectedValueException;
|
25 |
+
use Exception;
|
26 |
+
use ReflectionClass;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* {@inheritDoc}
|
30 |
+
*
|
31 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
32 |
+
*/
|
33 |
+
final class Instantiator implements InstantiatorInterface
|
34 |
+
{
|
35 |
+
/**
|
36 |
+
* Markers used internally by PHP to define whether {@see \unserialize} should invoke
|
37 |
+
* the method {@see \Serializable::unserialize()} when dealing with classes implementing
|
38 |
+
* the {@see \Serializable} interface.
|
39 |
+
*/
|
40 |
+
const SERIALIZATION_FORMAT_USE_UNSERIALIZER = 'C';
|
41 |
+
const SERIALIZATION_FORMAT_AVOID_UNSERIALIZER = 'O';
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var \Closure[] of {@see \Closure} instances used to instantiate specific classes
|
45 |
+
*/
|
46 |
+
private static $cachedInstantiators = array();
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @var object[] of objects that can directly be cloned
|
50 |
+
*/
|
51 |
+
private static $cachedCloneables = array();
|
52 |
+
|
53 |
+
/**
|
54 |
+
* {@inheritDoc}
|
55 |
+
*/
|
56 |
+
public function instantiate($className)
|
57 |
+
{
|
58 |
+
if (isset(self::$cachedCloneables[$className])) {
|
59 |
+
return clone self::$cachedCloneables[$className];
|
60 |
+
}
|
61 |
+
|
62 |
+
if (isset(self::$cachedInstantiators[$className])) {
|
63 |
+
$factory = self::$cachedInstantiators[$className];
|
64 |
+
|
65 |
+
return $factory();
|
66 |
+
}
|
67 |
+
|
68 |
+
return $this->buildAndCacheFromFactory($className);
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Builds the requested object and caches it in static properties for performance
|
73 |
+
*
|
74 |
+
* @param string $className
|
75 |
+
*
|
76 |
+
* @return object
|
77 |
+
*/
|
78 |
+
private function buildAndCacheFromFactory($className)
|
79 |
+
{
|
80 |
+
$factory = self::$cachedInstantiators[$className] = $this->buildFactory($className);
|
81 |
+
$instance = $factory();
|
82 |
+
|
83 |
+
if ($this->isSafeToClone(new ReflectionClass($instance))) {
|
84 |
+
self::$cachedCloneables[$className] = clone $instance;
|
85 |
+
}
|
86 |
+
|
87 |
+
return $instance;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Builds a {@see \Closure} capable of instantiating the given $className without
|
92 |
+
* invoking its constructor.
|
93 |
+
*
|
94 |
+
* @param string $className
|
95 |
+
*
|
96 |
+
* @return Closure
|
97 |
+
*/
|
98 |
+
private function buildFactory($className)
|
99 |
+
{
|
100 |
+
$reflectionClass = $this->getReflectionClass($className);
|
101 |
+
|
102 |
+
if ($this->isInstantiableViaReflection($reflectionClass)) {
|
103 |
+
return function () use ($reflectionClass) {
|
104 |
+
return $reflectionClass->newInstanceWithoutConstructor();
|
105 |
+
};
|
106 |
+
}
|
107 |
+
|
108 |
+
$serializedString = sprintf(
|
109 |
+
'%s:%d:"%s":0:{}',
|
110 |
+
$this->getSerializationFormat($reflectionClass),
|
111 |
+
strlen($className),
|
112 |
+
$className
|
113 |
+
);
|
114 |
+
|
115 |
+
$this->checkIfUnSerializationIsSupported($reflectionClass, $serializedString);
|
116 |
+
|
117 |
+
return function () use ($serializedString) {
|
118 |
+
return unserialize($serializedString);
|
119 |
+
};
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* @param string $className
|
124 |
+
*
|
125 |
+
* @return ReflectionClass
|
126 |
+
*
|
127 |
+
* @throws InvalidArgumentException
|
128 |
+
*/
|
129 |
+
private function getReflectionClass($className)
|
130 |
+
{
|
131 |
+
if (! class_exists($className)) {
|
132 |
+
throw InvalidArgumentException::fromNonExistingClass($className);
|
133 |
+
}
|
134 |
+
|
135 |
+
$reflection = new ReflectionClass($className);
|
136 |
+
|
137 |
+
if ($reflection->isAbstract()) {
|
138 |
+
throw InvalidArgumentException::fromAbstractClass($reflection);
|
139 |
+
}
|
140 |
+
|
141 |
+
return $reflection;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* @param ReflectionClass $reflectionClass
|
146 |
+
* @param string $serializedString
|
147 |
+
*
|
148 |
+
* @throws UnexpectedValueException
|
149 |
+
*
|
150 |
+
* @return void
|
151 |
+
*/
|
152 |
+
private function checkIfUnSerializationIsSupported(ReflectionClass $reflectionClass, $serializedString)
|
153 |
+
{
|
154 |
+
set_error_handler(function ($code, $message, $file, $line) use ($reflectionClass, & $error) {
|
155 |
+
$error = UnexpectedValueException::fromUncleanUnSerialization(
|
156 |
+
$reflectionClass,
|
157 |
+
$message,
|
158 |
+
$code,
|
159 |
+
$file,
|
160 |
+
$line
|
161 |
+
);
|
162 |
+
});
|
163 |
+
|
164 |
+
$this->attemptInstantiationViaUnSerialization($reflectionClass, $serializedString);
|
165 |
+
|
166 |
+
restore_error_handler();
|
167 |
+
|
168 |
+
if ($error) {
|
169 |
+
throw $error;
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* @param ReflectionClass $reflectionClass
|
175 |
+
* @param string $serializedString
|
176 |
+
*
|
177 |
+
* @throws UnexpectedValueException
|
178 |
+
*
|
179 |
+
* @return void
|
180 |
+
*/
|
181 |
+
private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, $serializedString)
|
182 |
+
{
|
183 |
+
try {
|
184 |
+
unserialize($serializedString);
|
185 |
+
} catch (Exception $exception) {
|
186 |
+
restore_error_handler();
|
187 |
+
|
188 |
+
throw UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $exception);
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* @param ReflectionClass $reflectionClass
|
194 |
+
*
|
195 |
+
* @return bool
|
196 |
+
*/
|
197 |
+
private function isInstantiableViaReflection(ReflectionClass $reflectionClass)
|
198 |
+
{
|
199 |
+
if (\PHP_VERSION_ID >= 50600) {
|
200 |
+
return ! ($this->hasInternalAncestors($reflectionClass) && $reflectionClass->isFinal());
|
201 |
+
}
|
202 |
+
|
203 |
+
return \PHP_VERSION_ID >= 50400 && ! $this->hasInternalAncestors($reflectionClass);
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Verifies whether the given class is to be considered internal
|
208 |
+
*
|
209 |
+
* @param ReflectionClass $reflectionClass
|
210 |
+
*
|
211 |
+
* @return bool
|
212 |
+
*/
|
213 |
+
private function hasInternalAncestors(ReflectionClass $reflectionClass)
|
214 |
+
{
|
215 |
+
do {
|
216 |
+
if ($reflectionClass->isInternal()) {
|
217 |
+
return true;
|
218 |
+
}
|
219 |
+
} while ($reflectionClass = $reflectionClass->getParentClass());
|
220 |
+
|
221 |
+
return false;
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Verifies if the given PHP version implements the `Serializable` interface serialization
|
226 |
+
* with an incompatible serialization format. If that's the case, use serialization marker
|
227 |
+
* "C" instead of "O".
|
228 |
+
*
|
229 |
+
* @link http://news.php.net/php.internals/74654
|
230 |
+
*
|
231 |
+
* @param ReflectionClass $reflectionClass
|
232 |
+
*
|
233 |
+
* @return string the serialization format marker, either self::SERIALIZATION_FORMAT_USE_UNSERIALIZER
|
234 |
+
* or self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER
|
235 |
+
*/
|
236 |
+
private function getSerializationFormat(ReflectionClass $reflectionClass)
|
237 |
+
{
|
238 |
+
if ($this->isPhpVersionWithBrokenSerializationFormat()
|
239 |
+
&& $reflectionClass->implementsInterface('Serializable')
|
240 |
+
) {
|
241 |
+
return self::SERIALIZATION_FORMAT_USE_UNSERIALIZER;
|
242 |
+
}
|
243 |
+
|
244 |
+
return self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER;
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Checks whether the current PHP runtime uses an incompatible serialization format
|
249 |
+
*
|
250 |
+
* @return bool
|
251 |
+
*/
|
252 |
+
private function isPhpVersionWithBrokenSerializationFormat()
|
253 |
+
{
|
254 |
+
return PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513;
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Checks if a class is cloneable
|
259 |
+
*
|
260 |
+
* @param ReflectionClass $reflection
|
261 |
+
*
|
262 |
+
* @return bool
|
263 |
+
*/
|
264 |
+
private function isSafeToClone(ReflectionClass $reflection)
|
265 |
+
{
|
266 |
+
if (method_exists($reflection, 'isCloneable') && ! $reflection->isCloneable()) {
|
267 |
+
return false;
|
268 |
+
}
|
269 |
+
|
270 |
+
// not cloneable if it implements `__clone`, as we want to avoid calling it
|
271 |
+
return ! $reflection->hasMethod('__clone');
|
272 |
+
}
|
273 |
+
}
|
vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace Doctrine\Instantiator;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Instantiator provides utility methods to build objects without invoking their constructors
|
24 |
+
*
|
25 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
26 |
+
*/
|
27 |
+
interface InstantiatorInterface
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* @param string $className
|
31 |
+
*
|
32 |
+
* @return object
|
33 |
+
*
|
34 |
+
* @throws \Doctrine\Instantiator\Exception\ExceptionInterface
|
35 |
+
*/
|
36 |
+
public function instantiate($className);
|
37 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorPerformance/InstantiatorPerformanceEvent.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorPerformance;
|
21 |
+
|
22 |
+
use Athletic\AthleticEvent;
|
23 |
+
use Doctrine\Instantiator\Instantiator;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Performance tests for {@see \Doctrine\Instantiator\Instantiator}
|
27 |
+
*
|
28 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
+
*/
|
30 |
+
class InstantiatorPerformanceEvent extends AthleticEvent
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* @var \Doctrine\Instantiator\Instantiator
|
34 |
+
*/
|
35 |
+
private $instantiator;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* {@inheritDoc}
|
39 |
+
*/
|
40 |
+
protected function setUp()
|
41 |
+
{
|
42 |
+
$this->instantiator = new Instantiator();
|
43 |
+
|
44 |
+
$this->instantiator->instantiate(__CLASS__);
|
45 |
+
$this->instantiator->instantiate('ArrayObject');
|
46 |
+
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset');
|
47 |
+
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset');
|
48 |
+
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset');
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @iterations 20000
|
53 |
+
* @baseline
|
54 |
+
* @group instantiation
|
55 |
+
*/
|
56 |
+
public function testInstantiateSelf()
|
57 |
+
{
|
58 |
+
$this->instantiator->instantiate(__CLASS__);
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @iterations 20000
|
63 |
+
* @group instantiation
|
64 |
+
*/
|
65 |
+
public function testInstantiateInternalClass()
|
66 |
+
{
|
67 |
+
$this->instantiator->instantiate('ArrayObject');
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* @iterations 20000
|
72 |
+
* @group instantiation
|
73 |
+
*/
|
74 |
+
public function testInstantiateSimpleSerializableAssetClass()
|
75 |
+
{
|
76 |
+
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset');
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* @iterations 20000
|
81 |
+
* @group instantiation
|
82 |
+
*/
|
83 |
+
public function testInstantiateSerializableArrayObjectAsset()
|
84 |
+
{
|
85 |
+
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset');
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @iterations 20000
|
90 |
+
* @group instantiation
|
91 |
+
*/
|
92 |
+
public function testInstantiateUnCloneableAsset()
|
93 |
+
{
|
94 |
+
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset');
|
95 |
+
}
|
96 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/Exception/InvalidArgumentExceptionTest.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTest\Exception;
|
21 |
+
|
22 |
+
use Doctrine\Instantiator\Exception\InvalidArgumentException;
|
23 |
+
use PHPUnit_Framework_TestCase;
|
24 |
+
use ReflectionClass;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Tests for {@see \Doctrine\Instantiator\Exception\InvalidArgumentException}
|
28 |
+
*
|
29 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
30 |
+
*
|
31 |
+
* @covers \Doctrine\Instantiator\Exception\InvalidArgumentException
|
32 |
+
*/
|
33 |
+
class InvalidArgumentExceptionTest extends PHPUnit_Framework_TestCase
|
34 |
+
{
|
35 |
+
public function testFromNonExistingTypeWithNonExistingClass()
|
36 |
+
{
|
37 |
+
$className = __CLASS__ . uniqid();
|
38 |
+
$exception = InvalidArgumentException::fromNonExistingClass($className);
|
39 |
+
|
40 |
+
$this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\InvalidArgumentException', $exception);
|
41 |
+
$this->assertSame('The provided class "' . $className . '" does not exist', $exception->getMessage());
|
42 |
+
}
|
43 |
+
|
44 |
+
public function testFromNonExistingTypeWithTrait()
|
45 |
+
{
|
46 |
+
if (PHP_VERSION_ID < 50400) {
|
47 |
+
$this->markTestSkipped('Need at least PHP 5.4.0, as this test requires traits support to run');
|
48 |
+
}
|
49 |
+
|
50 |
+
$exception = InvalidArgumentException::fromNonExistingClass(
|
51 |
+
'DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset'
|
52 |
+
);
|
53 |
+
|
54 |
+
$this->assertSame(
|
55 |
+
'The provided type "DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset" is a trait, '
|
56 |
+
. 'and can not be instantiated',
|
57 |
+
$exception->getMessage()
|
58 |
+
);
|
59 |
+
}
|
60 |
+
|
61 |
+
public function testFromNonExistingTypeWithInterface()
|
62 |
+
{
|
63 |
+
$exception = InvalidArgumentException::fromNonExistingClass('Doctrine\\Instantiator\\InstantiatorInterface');
|
64 |
+
|
65 |
+
$this->assertSame(
|
66 |
+
'The provided type "Doctrine\\Instantiator\\InstantiatorInterface" is an interface, '
|
67 |
+
. 'and can not be instantiated',
|
68 |
+
$exception->getMessage()
|
69 |
+
);
|
70 |
+
}
|
71 |
+
|
72 |
+
public function testFromAbstractClass()
|
73 |
+
{
|
74 |
+
$reflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset');
|
75 |
+
$exception = InvalidArgumentException::fromAbstractClass($reflection);
|
76 |
+
|
77 |
+
$this->assertSame(
|
78 |
+
'The provided class "DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset" is abstract, '
|
79 |
+
. 'and can not be instantiated',
|
80 |
+
$exception->getMessage()
|
81 |
+
);
|
82 |
+
}
|
83 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/Exception/UnexpectedValueExceptionTest.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTest\Exception;
|
21 |
+
|
22 |
+
use Doctrine\Instantiator\Exception\UnexpectedValueException;
|
23 |
+
use Exception;
|
24 |
+
use PHPUnit_Framework_TestCase;
|
25 |
+
use ReflectionClass;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Tests for {@see \Doctrine\Instantiator\Exception\UnexpectedValueException}
|
29 |
+
*
|
30 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
31 |
+
*
|
32 |
+
* @covers \Doctrine\Instantiator\Exception\UnexpectedValueException
|
33 |
+
*/
|
34 |
+
class UnexpectedValueExceptionTest extends PHPUnit_Framework_TestCase
|
35 |
+
{
|
36 |
+
public function testFromSerializationTriggeredException()
|
37 |
+
{
|
38 |
+
$reflectionClass = new ReflectionClass($this);
|
39 |
+
$previous = new Exception();
|
40 |
+
$exception = UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $previous);
|
41 |
+
|
42 |
+
$this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\UnexpectedValueException', $exception);
|
43 |
+
$this->assertSame($previous, $exception->getPrevious());
|
44 |
+
$this->assertSame(
|
45 |
+
'An exception was raised while trying to instantiate an instance of "'
|
46 |
+
. __CLASS__ . '" via un-serialization',
|
47 |
+
$exception->getMessage()
|
48 |
+
);
|
49 |
+
}
|
50 |
+
|
51 |
+
public function testFromUncleanUnSerialization()
|
52 |
+
{
|
53 |
+
$reflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset');
|
54 |
+
$exception = UnexpectedValueException::fromUncleanUnSerialization($reflection, 'foo', 123, 'bar', 456);
|
55 |
+
|
56 |
+
$this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\UnexpectedValueException', $exception);
|
57 |
+
$this->assertSame(
|
58 |
+
'Could not produce an instance of "DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset" '
|
59 |
+
. 'via un-serialization, since an error was triggered in file "bar" at line "456"',
|
60 |
+
$exception->getMessage()
|
61 |
+
);
|
62 |
+
|
63 |
+
$previous = $exception->getPrevious();
|
64 |
+
|
65 |
+
$this->assertInstanceOf('Exception', $previous);
|
66 |
+
$this->assertSame('foo', $previous->getMessage());
|
67 |
+
$this->assertSame(123, $previous->getCode());
|
68 |
+
}
|
69 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php
ADDED
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTest;
|
21 |
+
|
22 |
+
use Doctrine\Instantiator\Exception\UnexpectedValueException;
|
23 |
+
use Doctrine\Instantiator\Instantiator;
|
24 |
+
use PHPUnit_Framework_TestCase;
|
25 |
+
use ReflectionClass;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Tests for {@see \Doctrine\Instantiator\Instantiator}
|
29 |
+
*
|
30 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
31 |
+
*
|
32 |
+
* @covers \Doctrine\Instantiator\Instantiator
|
33 |
+
*/
|
34 |
+
class InstantiatorTest extends PHPUnit_Framework_TestCase
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* @var Instantiator
|
38 |
+
*/
|
39 |
+
private $instantiator;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* {@inheritDoc}
|
43 |
+
*/
|
44 |
+
protected function setUp()
|
45 |
+
{
|
46 |
+
$this->instantiator = new Instantiator();
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @param string $className
|
51 |
+
*
|
52 |
+
* @dataProvider getInstantiableClasses
|
53 |
+
*/
|
54 |
+
public function testCanInstantiate($className)
|
55 |
+
{
|
56 |
+
$this->assertInstanceOf($className, $this->instantiator->instantiate($className));
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @param string $className
|
61 |
+
*
|
62 |
+
* @dataProvider getInstantiableClasses
|
63 |
+
*/
|
64 |
+
public function testInstantiatesSeparateInstances($className)
|
65 |
+
{
|
66 |
+
$instance1 = $this->instantiator->instantiate($className);
|
67 |
+
$instance2 = $this->instantiator->instantiate($className);
|
68 |
+
|
69 |
+
$this->assertEquals($instance1, $instance2);
|
70 |
+
$this->assertNotSame($instance1, $instance2);
|
71 |
+
}
|
72 |
+
|
73 |
+
public function testExceptionOnUnSerializationException()
|
74 |
+
{
|
75 |
+
if (defined('HHVM_VERSION')) {
|
76 |
+
$this->markTestSkipped(
|
77 |
+
'As of facebook/hhvm#3432, HHVM has no PDORow, and therefore '
|
78 |
+
. ' no internal final classes that cannot be instantiated'
|
79 |
+
);
|
80 |
+
}
|
81 |
+
|
82 |
+
$className = 'DoctrineTest\\InstantiatorTestAsset\\UnserializeExceptionArrayObjectAsset';
|
83 |
+
|
84 |
+
if (\PHP_VERSION_ID >= 50600) {
|
85 |
+
$className = 'PDORow';
|
86 |
+
}
|
87 |
+
|
88 |
+
if (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513) {
|
89 |
+
$className = 'DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset';
|
90 |
+
}
|
91 |
+
|
92 |
+
$this->setExpectedException('Doctrine\\Instantiator\\Exception\\UnexpectedValueException');
|
93 |
+
|
94 |
+
$this->instantiator->instantiate($className);
|
95 |
+
}
|
96 |
+
|
97 |
+
public function testNoticeOnUnSerializationException()
|
98 |
+
{
|
99 |
+
if (\PHP_VERSION_ID >= 50600) {
|
100 |
+
$this->markTestSkipped(
|
101 |
+
'PHP 5.6 supports `ReflectionClass#newInstanceWithoutConstructor()` for some internal classes'
|
102 |
+
);
|
103 |
+
}
|
104 |
+
|
105 |
+
try {
|
106 |
+
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset');
|
107 |
+
|
108 |
+
$this->fail('No exception was raised');
|
109 |
+
} catch (UnexpectedValueException $exception) {
|
110 |
+
$wakeUpNoticesReflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset');
|
111 |
+
$previous = $exception->getPrevious();
|
112 |
+
|
113 |
+
$this->assertInstanceOf('Exception', $previous);
|
114 |
+
|
115 |
+
// in PHP 5.4.29 and PHP 5.5.13, this case is not a notice, but an exception being thrown
|
116 |
+
if (! (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513)) {
|
117 |
+
$this->assertSame(
|
118 |
+
'Could not produce an instance of "DoctrineTest\\InstantiatorTestAsset\WakeUpNoticesAsset" '
|
119 |
+
. 'via un-serialization, since an error was triggered in file "'
|
120 |
+
. $wakeUpNoticesReflection->getFileName() . '" at line "36"',
|
121 |
+
$exception->getMessage()
|
122 |
+
);
|
123 |
+
|
124 |
+
$this->assertSame('Something went bananas while un-serializing this instance', $previous->getMessage());
|
125 |
+
$this->assertSame(\E_USER_NOTICE, $previous->getCode());
|
126 |
+
}
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @param string $invalidClassName
|
132 |
+
*
|
133 |
+
* @dataProvider getInvalidClassNames
|
134 |
+
*/
|
135 |
+
public function testInstantiationFromNonExistingClass($invalidClassName)
|
136 |
+
{
|
137 |
+
$this->setExpectedException('Doctrine\\Instantiator\\Exception\\InvalidArgumentException');
|
138 |
+
|
139 |
+
$this->instantiator->instantiate($invalidClassName);
|
140 |
+
}
|
141 |
+
|
142 |
+
public function testInstancesAreNotCloned()
|
143 |
+
{
|
144 |
+
$className = 'TemporaryClass' . uniqid();
|
145 |
+
|
146 |
+
eval('namespace ' . __NAMESPACE__ . '; class ' . $className . '{}');
|
147 |
+
|
148 |
+
$instance = $this->instantiator->instantiate(__NAMESPACE__ . '\\' . $className);
|
149 |
+
|
150 |
+
$instance->foo = 'bar';
|
151 |
+
|
152 |
+
$instance2 = $this->instantiator->instantiate(__NAMESPACE__ . '\\' . $className);
|
153 |
+
|
154 |
+
$this->assertObjectNotHasAttribute('foo', $instance2);
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Provides a list of instantiable classes (existing)
|
159 |
+
*
|
160 |
+
* @return string[][]
|
161 |
+
*/
|
162 |
+
public function getInstantiableClasses()
|
163 |
+
{
|
164 |
+
$classes = array(
|
165 |
+
array('stdClass'),
|
166 |
+
array(__CLASS__),
|
167 |
+
array('Doctrine\\Instantiator\\Instantiator'),
|
168 |
+
array('Exception'),
|
169 |
+
array('PharException'),
|
170 |
+
array('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset'),
|
171 |
+
array('DoctrineTest\\InstantiatorTestAsset\\ExceptionAsset'),
|
172 |
+
array('DoctrineTest\\InstantiatorTestAsset\\FinalExceptionAsset'),
|
173 |
+
array('DoctrineTest\\InstantiatorTestAsset\\PharExceptionAsset'),
|
174 |
+
array('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset'),
|
175 |
+
array('DoctrineTest\\InstantiatorTestAsset\\XMLReaderAsset'),
|
176 |
+
);
|
177 |
+
|
178 |
+
if (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513) {
|
179 |
+
return $classes;
|
180 |
+
}
|
181 |
+
|
182 |
+
$classes = array_merge(
|
183 |
+
$classes,
|
184 |
+
array(
|
185 |
+
array('PharException'),
|
186 |
+
array('ArrayObject'),
|
187 |
+
array('DoctrineTest\\InstantiatorTestAsset\\ArrayObjectAsset'),
|
188 |
+
array('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset'),
|
189 |
+
)
|
190 |
+
);
|
191 |
+
|
192 |
+
if (\PHP_VERSION_ID >= 50600) {
|
193 |
+
$classes[] = array('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset');
|
194 |
+
$classes[] = array('DoctrineTest\\InstantiatorTestAsset\\UnserializeExceptionArrayObjectAsset');
|
195 |
+
}
|
196 |
+
|
197 |
+
return $classes;
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Provides a list of instantiable classes (existing)
|
202 |
+
*
|
203 |
+
* @return string[][]
|
204 |
+
*/
|
205 |
+
public function getInvalidClassNames()
|
206 |
+
{
|
207 |
+
$classNames = array(
|
208 |
+
array(__CLASS__ . uniqid()),
|
209 |
+
array('Doctrine\\Instantiator\\InstantiatorInterface'),
|
210 |
+
array('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset'),
|
211 |
+
);
|
212 |
+
|
213 |
+
if (\PHP_VERSION_ID >= 50400) {
|
214 |
+
$classNames[] = array('DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset');
|
215 |
+
}
|
216 |
+
|
217 |
+
return $classNames;
|
218 |
+
}
|
219 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/AbstractClassAsset.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* A simple asset for an abstract class
|
24 |
+
*
|
25 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
26 |
+
*/
|
27 |
+
abstract class AbstractClassAsset
|
28 |
+
{
|
29 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/ArrayObjectAsset.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
+
|
22 |
+
use ArrayObject;
|
23 |
+
use BadMethodCallException;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Test asset that extends an internal PHP class
|
27 |
+
*
|
28 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
+
*/
|
30 |
+
class ArrayObjectAsset extends ArrayObject
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Constructor - should not be called
|
34 |
+
*
|
35 |
+
* @throws BadMethodCallException
|
36 |
+
*/
|
37 |
+
public function __construct()
|
38 |
+
{
|
39 |
+
throw new BadMethodCallException('Not supposed to be called!');
|
40 |
+
}
|
41 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/ExceptionAsset.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
+
|
22 |
+
use BadMethodCallException;
|
23 |
+
use Exception;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Test asset that extends an internal PHP base exception
|
27 |
+
*
|
28 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
+
*/
|
30 |
+
class ExceptionAsset extends Exception
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Constructor - should not be called
|
34 |
+
*
|
35 |
+
* @throws BadMethodCallException
|
36 |
+
*/
|
37 |
+
public function __construct()
|
38 |
+
{
|
39 |
+
throw new BadMethodCallException('Not supposed to be called!');
|
40 |
+
}
|
41 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/FinalExceptionAsset.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
+
|
22 |
+
use BadMethodCallException;
|
23 |
+
use Exception;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Test asset that extends an internal PHP base exception
|
27 |
+
*
|
28 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
+
*/
|
30 |
+
final class FinalExceptionAsset extends Exception
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Constructor - should not be called
|
34 |
+
*
|
35 |
+
* @throws BadMethodCallException
|
36 |
+
*/
|
37 |
+
public function __construct()
|
38 |
+
{
|
39 |
+
throw new BadMethodCallException('Not supposed to be called!');
|
40 |
+
}
|
41 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/PharAsset.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
+
|
22 |
+
use BadMethodCallException;
|
23 |
+
use Phar;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Test asset that extends an internal PHP class
|
27 |
+
*
|
28 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
+
*/
|
30 |
+
class PharAsset extends Phar
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Constructor - should not be called
|
34 |
+
*
|
35 |
+
* @throws BadMethodCallException
|
36 |
+
*/
|
37 |
+
public function __construct()
|
38 |
+
{
|
39 |
+
throw new BadMethodCallException('Not supposed to be called!');
|
40 |
+
}
|
41 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/PharExceptionAsset.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
+
|
22 |
+
use BadMethodCallException;
|
23 |
+
use PharException;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Test asset that extends an internal PHP class
|
27 |
+
* This class should be serializable without problems
|
28 |
+
* and without getting the "Erroneous data format for unserializing"
|
29 |
+
* error
|
30 |
+
*
|
31 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
32 |
+
*/
|
33 |
+
class PharExceptionAsset extends PharException
|
34 |
+
{
|
35 |
+
/**
|
36 |
+
* Constructor - should not be called
|
37 |
+
*
|
38 |
+
* @throws BadMethodCallException
|
39 |
+
*/
|
40 |
+
public function __construct()
|
41 |
+
{
|
42 |
+
throw new BadMethodCallException('Not supposed to be called!');
|
43 |
+
}
|
44 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/SerializableArrayObjectAsset.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
+
|
22 |
+
use ArrayObject;
|
23 |
+
use BadMethodCallException;
|
24 |
+
use Serializable;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Serializable test asset that also extends an internal class
|
28 |
+
*
|
29 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
30 |
+
*/
|
31 |
+
class SerializableArrayObjectAsset extends ArrayObject implements Serializable
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Constructor - should not be called
|
35 |
+
*
|
36 |
+
* @throws BadMethodCallException
|
37 |
+
*/
|
38 |
+
public function __construct()
|
39 |
+
{
|
40 |
+
throw new BadMethodCallException('Not supposed to be called!');
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* {@inheritDoc}
|
45 |
+
*/
|
46 |
+
public function serialize()
|
47 |
+
{
|
48 |
+
return '';
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* {@inheritDoc}
|
53 |
+
*
|
54 |
+
* Should not be called
|
55 |
+
*
|
56 |
+
* @throws BadMethodCallException
|
57 |
+
*/
|
58 |
+
public function unserialize($serialized)
|
59 |
+
{
|
60 |
+
throw new BadMethodCallException('Not supposed to be called!');
|
61 |
+
}
|
62 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/SimpleSerializableAsset.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
+
|
22 |
+
use BadMethodCallException;
|
23 |
+
use Serializable;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Base serializable test asset
|
27 |
+
*
|
28 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
+
*/
|
30 |
+
class SimpleSerializableAsset implements Serializable
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Constructor - should not be called
|
34 |
+
*
|
35 |
+
* @throws BadMethodCallException
|
36 |
+
*/
|
37 |
+
public function __construct()
|
38 |
+
{
|
39 |
+
throw new BadMethodCallException('Not supposed to be called!');
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* {@inheritDoc}
|
44 |
+
*/
|
45 |
+
public function serialize()
|
46 |
+
{
|
47 |
+
return '';
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* {@inheritDoc}
|
52 |
+
*
|
53 |
+
* Should not be called
|
54 |
+
*
|
55 |
+
* @throws BadMethodCallException
|
56 |
+
*/
|
57 |
+
public function unserialize($serialized)
|
58 |
+
{
|
59 |
+
throw new BadMethodCallException('Not supposed to be called!');
|
60 |
+
}
|
61 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/SimpleTraitAsset.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* A simple trait with no attached logic
|
24 |
+
*
|
25 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
26 |
+
*/
|
27 |
+
trait SimpleTraitAsset
|
28 |
+
{
|
29 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/UnCloneableAsset.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
+
|
22 |
+
use BadMethodCallException;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Base un-cloneable asset
|
26 |
+
*
|
27 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
28 |
+
*/
|
29 |
+
class UnCloneableAsset
|
30 |
+
{
|
31 |
+
/**
|
32 |
+
* Constructor - should not be called
|
33 |
+
*
|
34 |
+
* @throws BadMethodCallException
|
35 |
+
*/
|
36 |
+
public function __construct()
|
37 |
+
{
|
38 |
+
throw new BadMethodCallException('Not supposed to be called!');
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Magic `__clone` - should not be invoked
|
43 |
+
*
|
44 |
+
* @throws BadMethodCallException
|
45 |
+
*/
|
46 |
+
public function __clone()
|
47 |
+
{
|
48 |
+
throw new BadMethodCallException('Not supposed to be called!');
|
49 |
+
}
|
50 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/UnserializeExceptionArrayObjectAsset.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
+
|
22 |
+
use ArrayObject;
|
23 |
+
use BadMethodCallException;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* A simple asset for an abstract class
|
27 |
+
*
|
28 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
+
*/
|
30 |
+
class UnserializeExceptionArrayObjectAsset extends ArrayObject
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* {@inheritDoc}
|
34 |
+
*/
|
35 |
+
public function __wakeup()
|
36 |
+
{
|
37 |
+
throw new BadMethodCallException();
|
38 |
+
}
|
39 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/WakeUpNoticesAsset.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
+
|
22 |
+
use ArrayObject;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* A simple asset for an abstract class
|
26 |
+
*
|
27 |
+
* @author Marco Pivetta <ocramius@gmail.com>
|
28 |
+
*/
|
29 |
+
class WakeUpNoticesAsset extends ArrayObject
|
30 |
+
{
|
31 |
+
/**
|
32 |
+
* Wakeup method called after un-serialization
|
33 |
+
*/
|
34 |
+
public function __wakeup()
|
35 |
+
{
|
36 |
+
trigger_error('Something went bananas while un-serializing this instance');
|
37 |
+
}
|
38 |
+
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/XMLReaderAsset.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
+
|
22 |
+
use BadMethodCallException;
|
23 |
+
use XMLReader;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Test asset that extends an internal PHP class
|
27 |
+
*
|
28 |
+
* @author Dave Marshall <dave@atst.io>
|
29 |
+
*/
|
30 |
+
class XMLReaderAsset extends XMLReader
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Constructor - should not be called
|
34 |
+
*
|
35 |
+
* @throws BadMethodCallException
|
36 |
+
*/
|
37 |
+
public function __construct()
|
38 |
+
{
|
39 |
+
throw new BadMethodCallException('Not supposed to be called!');
|
40 |
+
}
|
41 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/.travis.yml
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
language: php
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
9 |
|
10 |
dist: trusty
|
11 |
sudo: false
|
@@ -18,7 +19,7 @@ before_install:
|
|
18 |
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi
|
19 |
- travis_retry composer self-update
|
20 |
- composer validate
|
21 |
-
- composer config github-oauth.github.com $GITHUB_TOKEN
|
22 |
|
23 |
install:
|
24 |
- travis_retry composer install --no-interaction --prefer-dist
|
1 |
language: php
|
2 |
|
3 |
+
matrix:
|
4 |
+
include:
|
5 |
+
- php: 5.5
|
6 |
+
env: WITH_CS=true
|
7 |
+
- php: 5.6
|
8 |
+
- php: 7.0
|
9 |
+
- php: 7.1
|
10 |
|
11 |
dist: trusty
|
12 |
sudo: false
|
19 |
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi
|
20 |
- travis_retry composer self-update
|
21 |
- composer validate
|
22 |
+
- if [[ -n "$GITHUB_TOKEN" ]]; then composer config github-oauth.github.com $GITHUB_TOKEN; fi
|
23 |
|
24 |
install:
|
25 |
- travis_retry composer install --no-interaction --prefer-dist
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
# Code of Conduct
|
2 |
+
|
3 |
+
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.facebook.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/CONTRIBUTING.md
CHANGED
@@ -3,6 +3,9 @@ We want to make contributing to this project as easy and transparent as possible
|
|
3 |
|
4 |
We accept contributions via pull requests on [GitHub](https://github.com/facebook/facebook-instant-articles-sdk-extensions-in-php).
|
5 |
|
|
|
|
|
|
|
6 |
## Pull Requests
|
7 |
- **Sign the CLA** - In order to accept your pull request, we need you to submit a [Contributor License Agreement](https://code.facebook.com/cla). You only need to do this once to work on any of Facebook's open source projects.
|
8 |
|
3 |
|
4 |
We accept contributions via pull requests on [GitHub](https://github.com/facebook/facebook-instant-articles-sdk-extensions-in-php).
|
5 |
|
6 |
+
## Code of Conduct
|
7 |
+
The code of conduct is described in [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md)
|
8 |
+
|
9 |
## Pull Requests
|
10 |
- **Sign the CLA** - In order to accept your pull request, we need you to submit a [Contributor License Agreement](https://code.facebook.com/cla). You only need to do this once to work on any of Facebook's open source projects.
|
11 |
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
The Facebook Instant Articles SDK Extensions in PHP provides a native PHP interface for converting valid Instant Articles into AMP. This gives developers the ability to have AMP content right after getting his own Instant Article markup format ready.
|
7 |
|
8 |
The Extension package consists of:
|
9 |
-
- **Environment**: PHP >= 5.4
|
10 |
- **Dependencies**: It relies solely on the [Instant Articles SDK](https://github.com/Facebook/facebook-instant-articles-sdk-php) and its dependencies to get the Instant Article markup format available into the Elements object tree structure. It also depends on [Composer](https://getcomposer.org/) dependency manager.
|
11 |
- **AMP**: The AMP transformation was based on the current implementation and definition from [AMP project](https://www.ampproject.org/).
|
12 |
|
@@ -74,7 +74,6 @@ ___
|
|
74 |
|
75 |
If you are encountering problems, the following tips may help in troubleshooting issues:
|
76 |
|
77 |
-
- Set the `threshold` in the [configuration of the Logger](https://logging.apache.org/log4php/docs/configuration.html#PHP) to `DEBUG` to expose more details about the items processed by the Transformer, conversely, to make it more quiet set it to `INFO`, check [this script](https://github.com/facebook/facebook-instant-articles-sdk-extensions-in-php/blob/master/examples/quiet_logger.php) for details.
|
78 |
- If your images are having dimension/aspect ratio problems, please check the [the quick start example](https://github.com/facebook/facebook-instant-articles-sdk-extensions-in-php/blob/master/examples/example-quick-start.php) for more information.
|
79 |
- At the moment, we have no way to determine a video's width and height, you need to explicitly pass that information via properties, see how to do it [here](https://github.com/facebook/facebook-instant-articles-sdk-extensions-in-php/blob/master/examples/example-quick-start.php).
|
80 |
|
6 |
The Facebook Instant Articles SDK Extensions in PHP provides a native PHP interface for converting valid Instant Articles into AMP. This gives developers the ability to have AMP content right after getting his own Instant Article markup format ready.
|
7 |
|
8 |
The Extension package consists of:
|
9 |
+
- **Environment**: PHP >= 5.4
|
10 |
- **Dependencies**: It relies solely on the [Instant Articles SDK](https://github.com/Facebook/facebook-instant-articles-sdk-php) and its dependencies to get the Instant Article markup format available into the Elements object tree structure. It also depends on [Composer](https://getcomposer.org/) dependency manager.
|
11 |
- **AMP**: The AMP transformation was based on the current implementation and definition from [AMP project](https://www.ampproject.org/).
|
12 |
|
74 |
|
75 |
If you are encountering problems, the following tips may help in troubleshooting issues:
|
76 |
|
|
|
77 |
- If your images are having dimension/aspect ratio problems, please check the [the quick start example](https://github.com/facebook/facebook-instant-articles-sdk-extensions-in-php/blob/master/examples/example-quick-start.php) for more information.
|
78 |
- At the moment, we have no way to determine a video's width and height, you need to explicitly pass that information via properties, see how to do it [here](https://github.com/facebook/facebook-instant-articles-sdk-extensions-in-php/blob/master/examples/example-quick-start.php).
|
79 |
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/composer.json
CHANGED
@@ -9,12 +9,18 @@
|
|
9 |
"name": "Facebook",
|
10 |
"homepage": "https://github.com/facebook/facebook-instant-articles-sdk-extensions-in-php/contributors"
|
11 |
}],
|
|
|
|
|
|
|
12 |
"require": {
|
|
|
13 |
"php": "^5.4 || ^7.0",
|
14 |
-
"facebook/facebook-instant-articles-sdk-php": "^1.
|
15 |
},
|
16 |
"require-dev": {
|
17 |
-
"phpunit/phpunit": "^4.8"
|
|
|
|
|
18 |
},
|
19 |
"autoload": {
|
20 |
"psr-4": {
|
9 |
"name": "Facebook",
|
10 |
"homepage": "https://github.com/facebook/facebook-instant-articles-sdk-extensions-in-php/contributors"
|
11 |
}],
|
12 |
+
"config": {
|
13 |
+
"sort-packages": true
|
14 |
+
},
|
15 |
"require": {
|
16 |
+
"doctrine/instantiator": "<=1.0.5",
|
17 |
"php": "^5.4 || ^7.0",
|
18 |
+
"facebook/facebook-instant-articles-sdk-php": "^1.8.3"
|
19 |
},
|
20 |
"require-dev": {
|
21 |
+
"phpunit/phpunit": "^4.8",
|
22 |
+
"squizlabs/php_codesniffer": "^3.0.0",
|
23 |
+
"phpdocumentor/reflection-docblock": "^2.0"
|
24 |
},
|
25 |
"autoload": {
|
26 |
"psr-4": {
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/composer.lock
CHANGED
@@ -4,62 +4,88 @@
|
|
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 |
-
"
|
|
|
8 |
"packages": [
|
9 |
{
|
10 |
-
"name": "
|
11 |
-
"version": "
|
12 |
"source": {
|
13 |
"type": "git",
|
14 |
-
"url": "https://
|
15 |
-
"reference": "
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
},
|
17 |
"require": {
|
18 |
-
"php": ">=5.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
},
|
20 |
"type": "library",
|
|
|
|
|
|
|
|
|
|
|
21 |
"autoload": {
|
22 |
-
"
|
23 |
-
"src/
|
24 |
-
|
25 |
},
|
26 |
"notification-url": "https://packagist.org/downloads/",
|
27 |
"license": [
|
28 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
],
|
30 |
-
"description": "A
|
31 |
-
"homepage": "
|
32 |
"keywords": [
|
33 |
-
"
|
34 |
-
"
|
35 |
-
"php"
|
36 |
],
|
37 |
-
"time": "
|
38 |
},
|
39 |
{
|
40 |
"name": "facebook/facebook-instant-articles-sdk-php",
|
41 |
-
"version": "v1.
|
42 |
"source": {
|
43 |
"type": "git",
|
44 |
"url": "https://github.com/facebook/facebook-instant-articles-sdk-php.git",
|
45 |
-
"reference": "
|
46 |
},
|
47 |
"dist": {
|
48 |
"type": "zip",
|
49 |
-
"url": "https://api.github.com/repos/facebook/facebook-instant-articles-sdk-php/zipball/
|
50 |
-
"reference": "
|
51 |
"shasum": ""
|
52 |
},
|
53 |
"require": {
|
54 |
-
"apache/log4php": "2.3.0",
|
55 |
"facebook/graph-sdk": "~5.0",
|
56 |
"php": "^5.4 || ^7.0",
|
57 |
-
"symfony/css-selector": "2.8.*
|
58 |
},
|
59 |
"require-dev": {
|
60 |
"fzaninotto/faker": "^1.6.0",
|
61 |
-
"
|
62 |
-
"
|
|
|
|
|
63 |
},
|
64 |
"type": "library",
|
65 |
"autoload": {
|
@@ -85,20 +111,20 @@
|
|
85 |
"instant",
|
86 |
"sdk"
|
87 |
],
|
88 |
-
"time": "
|
89 |
},
|
90 |
{
|
91 |
"name": "facebook/graph-sdk",
|
92 |
-
"version": "5.
|
93 |
"source": {
|
94 |
"type": "git",
|
95 |
"url": "https://github.com/facebook/php-graph-sdk.git",
|
96 |
-
"reference": "
|
97 |
},
|
98 |
"dist": {
|
99 |
"type": "zip",
|
100 |
-
"url": "https://api.github.com/repos/facebook/php-graph-sdk/zipball/
|
101 |
-
"reference": "
|
102 |
"shasum": ""
|
103 |
},
|
104 |
"require": {
|
@@ -143,29 +169,29 @@
|
|
143 |
"facebook",
|
144 |
"sdk"
|
145 |
],
|
146 |
-
"time": "2017-
|
147 |
},
|
148 |
{
|
149 |
"name": "symfony/css-selector",
|
150 |
-
"version": "
|
151 |
"source": {
|
152 |
"type": "git",
|
153 |
"url": "https://github.com/symfony/css-selector.git",
|
154 |
-
"reference": "
|
155 |
},
|
156 |
"dist": {
|
157 |
"type": "zip",
|
158 |
-
"url": "https://api.github.com/repos/symfony/css-selector/zipball/
|
159 |
-
"reference": "
|
160 |
"shasum": ""
|
161 |
},
|
162 |
"require": {
|
163 |
-
"php": ">=5.
|
164 |
},
|
165 |
"type": "library",
|
166 |
"extra": {
|
167 |
"branch-alias": {
|
168 |
-
"dev-master": "
|
169 |
}
|
170 |
},
|
171 |
"autoload": {
|
@@ -196,194 +222,43 @@
|
|
196 |
],
|
197 |
"description": "Symfony CssSelector Component",
|
198 |
"homepage": "https://symfony.com",
|
199 |
-
"time": "
|
200 |
}
|
201 |
],
|
202 |
"packages-dev": [
|
203 |
-
{
|
204 |
-
"name": "doctrine/instantiator",
|
205 |
-
"version": "1.0.5",
|
206 |
-
"source": {
|
207 |
-
"type": "git",
|
208 |
-
"url": "https://github.com/doctrine/instantiator.git",
|
209 |
-
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
|
210 |
-
},
|
211 |
-
"dist": {
|
212 |
-
"type": "zip",
|
213 |
-
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
|
214 |
-
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
|
215 |
-
"shasum": ""
|
216 |
-
},
|
217 |
-
"require": {
|
218 |
-
"php": ">=5.3,<8.0-DEV"
|
219 |
-
},
|
220 |
-
"require-dev": {
|
221 |
-
"athletic/athletic": "~0.1.8",
|
222 |
-
"ext-pdo": "*",
|
223 |
-
"ext-phar": "*",
|
224 |
-
"phpunit/phpunit": "~4.0",
|
225 |
-
"squizlabs/php_codesniffer": "~2.0"
|
226 |
-
},
|
227 |
-
"type": "library",
|
228 |
-
"extra": {
|
229 |
-
"branch-alias": {
|
230 |
-
"dev-master": "1.0.x-dev"
|
231 |
-
}
|
232 |
-
},
|
233 |
-
"autoload": {
|
234 |
-
"psr-4": {
|
235 |
-
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
|
236 |
-
}
|
237 |
-
},
|
238 |
-
"notification-url": "https://packagist.org/downloads/",
|
239 |
-
"license": [
|
240 |
-
"MIT"
|
241 |
-
],
|
242 |
-
"authors": [
|
243 |
-
{
|
244 |
-
"name": "Marco Pivetta",
|
245 |
-
"email": "ocramius@gmail.com",
|
246 |
-
"homepage": "http://ocramius.github.com/"
|
247 |
-
}
|
248 |
-
],
|
249 |
-
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
250 |
-
"homepage": "https://github.com/doctrine/instantiator",
|
251 |
-
"keywords": [
|
252 |
-
"constructor",
|
253 |
-
"instantiate"
|
254 |
-
],
|
255 |
-
"time": "2015-06-14T21:17:01+00:00"
|
256 |
-
},
|
257 |
-
{
|
258 |
-
"name": "phpdocumentor/reflection-common",
|
259 |
-
"version": "1.0",
|
260 |
-
"source": {
|
261 |
-
"type": "git",
|
262 |
-
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
|
263 |
-
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c"
|
264 |
-
},
|
265 |
-
"dist": {
|
266 |
-
"type": "zip",
|
267 |
-
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
|
268 |
-
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
|
269 |
-
"shasum": ""
|
270 |
-
},
|
271 |
-
"require": {
|
272 |
-
"php": ">=5.5"
|
273 |
-
},
|
274 |
-
"require-dev": {
|
275 |
-
"phpunit/phpunit": "^4.6"
|
276 |
-
},
|
277 |
-
"type": "library",
|
278 |
-
"extra": {
|
279 |
-
"branch-alias": {
|
280 |
-
"dev-master": "1.0.x-dev"
|
281 |
-
}
|
282 |
-
},
|
283 |
-
"autoload": {
|
284 |
-
"psr-4": {
|
285 |
-
"phpDocumentor\\Reflection\\": [
|
286 |
-
"src"
|
287 |
-
]
|
288 |
-
}
|
289 |
-
},
|
290 |
-
"notification-url": "https://packagist.org/downloads/",
|
291 |
-
"license": [
|
292 |
-
"MIT"
|
293 |
-
],
|
294 |
-
"authors": [
|
295 |
-
{
|
296 |
-
"name": "Jaap van Otterdijk",
|
297 |
-
"email": "opensource@ijaap.nl"
|
298 |
-
}
|
299 |
-
],
|
300 |
-
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
|
301 |
-
"homepage": "http://www.phpdoc.org",
|
302 |
-
"keywords": [
|
303 |
-
"FQSEN",
|
304 |
-
"phpDocumentor",
|
305 |
-
"phpdoc",
|
306 |
-
"reflection",
|
307 |
-
"static analysis"
|
308 |
-
],
|
309 |
-
"time": "2015-12-27T11:43:31+00:00"
|
310 |
-
},
|
311 |
{
|
312 |
"name": "phpdocumentor/reflection-docblock",
|
313 |
-
"version": "
|
314 |
"source": {
|
315 |
"type": "git",
|
316 |
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
317 |
-
"reference": "
|
318 |
},
|
319 |
"dist": {
|
320 |
"type": "zip",
|
321 |
-
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/
|
322 |
-
"reference": "
|
323 |
"shasum": ""
|
324 |
},
|
325 |
"require": {
|
326 |
-
"php": ">=5.
|
327 |
-
"phpdocumentor/reflection-common": "^1.0@dev",
|
328 |
-
"phpdocumentor/type-resolver": "^0.2.0",
|
329 |
-
"webmozart/assert": "^1.0"
|
330 |
},
|
331 |
"require-dev": {
|
332 |
-
"
|
333 |
-
"phpunit/phpunit": "^4.4"
|
334 |
-
},
|
335 |
-
"type": "library",
|
336 |
-
"autoload": {
|
337 |
-
"psr-4": {
|
338 |
-
"phpDocumentor\\Reflection\\": [
|
339 |
-
"src/"
|
340 |
-
]
|
341 |
-
}
|
342 |
-
},
|
343 |
-
"notification-url": "https://packagist.org/downloads/",
|
344 |
-
"license": [
|
345 |
-
"MIT"
|
346 |
-
],
|
347 |
-
"authors": [
|
348 |
-
{
|
349 |
-
"name": "Mike van Riel",
|
350 |
-
"email": "me@mikevanriel.com"
|
351 |
-
}
|
352 |
-
],
|
353 |
-
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
354 |
-
"time": "2016-09-30T07:12:33+00:00"
|
355 |
-
},
|
356 |
-
{
|
357 |
-
"name": "phpdocumentor/type-resolver",
|
358 |
-
"version": "0.2.1",
|
359 |
-
"source": {
|
360 |
-
"type": "git",
|
361 |
-
"url": "https://github.com/phpDocumentor/TypeResolver.git",
|
362 |
-
"reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb"
|
363 |
-
},
|
364 |
-
"dist": {
|
365 |
-
"type": "zip",
|
366 |
-
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb",
|
367 |
-
"reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb",
|
368 |
-
"shasum": ""
|
369 |
-
},
|
370 |
-
"require": {
|
371 |
-
"php": ">=5.5",
|
372 |
-
"phpdocumentor/reflection-common": "^1.0"
|
373 |
},
|
374 |
-
"
|
375 |
-
"
|
376 |
-
"
|
377 |
},
|
378 |
"type": "library",
|
379 |
"extra": {
|
380 |
"branch-alias": {
|
381 |
-
"dev-master": "
|
382 |
}
|
383 |
},
|
384 |
"autoload": {
|
385 |
-
"psr-
|
386 |
-
"phpDocumentor
|
387 |
"src/"
|
388 |
]
|
389 |
}
|
@@ -395,40 +270,40 @@
|
|
395 |
"authors": [
|
396 |
{
|
397 |
"name": "Mike van Riel",
|
398 |
-
"email": "
|
399 |
}
|
400 |
],
|
401 |
-
"time": "2016-
|
402 |
},
|
403 |
{
|
404 |
"name": "phpspec/prophecy",
|
405 |
-
"version": "
|
406 |
"source": {
|
407 |
"type": "git",
|
408 |
"url": "https://github.com/phpspec/prophecy.git",
|
409 |
-
"reference": "
|
410 |
},
|
411 |
"dist": {
|
412 |
"type": "zip",
|
413 |
-
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/
|
414 |
-
"reference": "
|
415 |
"shasum": ""
|
416 |
},
|
417 |
"require": {
|
418 |
"doctrine/instantiator": "^1.0.2",
|
419 |
"php": "^5.3|^7.0",
|
420 |
-
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
|
421 |
"sebastian/comparator": "^1.1|^2.0",
|
422 |
"sebastian/recursion-context": "^1.0|^2.0|^3.0"
|
423 |
},
|
424 |
"require-dev": {
|
425 |
"phpspec/phpspec": "^2.5|^3.2",
|
426 |
-
"phpunit/phpunit": "^4.8 || ^5.
|
427 |
},
|
428 |
"type": "library",
|
429 |
"extra": {
|
430 |
"branch-alias": {
|
431 |
-
"dev-master": "1.
|
432 |
}
|
433 |
},
|
434 |
"autoload": {
|
@@ -461,7 +336,7 @@
|
|
461 |
"spy",
|
462 |
"stub"
|
463 |
],
|
464 |
-
"time": "2017-
|
465 |
},
|
466 |
{
|
467 |
"name": "phpunit/php-code-coverage",
|
@@ -523,20 +398,20 @@
|
|
523 |
"testing",
|
524 |
"xunit"
|
525 |
],
|
526 |
-
"time": "2015-10-
|
527 |
},
|
528 |
{
|
529 |
"name": "phpunit/php-file-iterator",
|
530 |
-
"version": "1.4.
|
531 |
"source": {
|
532 |
"type": "git",
|
533 |
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
534 |
-
"reference": "
|
535 |
},
|
536 |
"dist": {
|
537 |
"type": "zip",
|
538 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/
|
539 |
-
"reference": "
|
540 |
"shasum": ""
|
541 |
},
|
542 |
"require": {
|
@@ -570,7 +445,7 @@
|
|
570 |
"filesystem",
|
571 |
"iterator"
|
572 |
],
|
573 |
-
"time": "
|
574 |
},
|
575 |
{
|
576 |
"name": "phpunit/php-text-template",
|
@@ -611,7 +486,7 @@
|
|
611 |
"keywords": [
|
612 |
"template"
|
613 |
],
|
614 |
-
"time": "2015-06-
|
615 |
},
|
616 |
{
|
617 |
"name": "phpunit/php-timer",
|
@@ -660,20 +535,20 @@
|
|
660 |
"keywords": [
|
661 |
"timer"
|
662 |
],
|
663 |
-
"time": "2017-02-
|
664 |
},
|
665 |
{
|
666 |
"name": "phpunit/php-token-stream",
|
667 |
-
"version": "1.4.
|
668 |
"source": {
|
669 |
"type": "git",
|
670 |
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
671 |
-
"reference": "
|
672 |
},
|
673 |
"dist": {
|
674 |
"type": "zip",
|
675 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/
|
676 |
-
"reference": "
|
677 |
"shasum": ""
|
678 |
},
|
679 |
"require": {
|
@@ -709,20 +584,20 @@
|
|
709 |
"keywords": [
|
710 |
"tokenizer"
|
711 |
],
|
712 |
-
"time": "2017-
|
713 |
},
|
714 |
{
|
715 |
"name": "phpunit/phpunit",
|
716 |
-
"version": "4.8.
|
717 |
"source": {
|
718 |
"type": "git",
|
719 |
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
720 |
-
"reference": "
|
721 |
},
|
722 |
"dist": {
|
723 |
"type": "zip",
|
724 |
-
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/
|
725 |
-
"reference": "
|
726 |
"shasum": ""
|
727 |
},
|
728 |
"require": {
|
@@ -781,7 +656,7 @@
|
|
781 |
"testing",
|
782 |
"xunit"
|
783 |
],
|
784 |
-
"time": "2017-
|
785 |
},
|
786 |
{
|
787 |
"name": "phpunit/phpunit-mock-objects",
|
@@ -837,7 +712,7 @@
|
|
837 |
"mock",
|
838 |
"xunit"
|
839 |
],
|
840 |
-
"time": "2015-10-
|
841 |
},
|
842 |
{
|
843 |
"name": "sebastian/comparator",
|
@@ -901,7 +776,7 @@
|
|
901 |
"compare",
|
902 |
"equality"
|
903 |
],
|
904 |
-
"time": "2017-01-
|
905 |
},
|
906 |
{
|
907 |
"name": "sebastian/diff",
|
@@ -953,7 +828,7 @@
|
|
953 |
"keywords": [
|
954 |
"diff"
|
955 |
],
|
956 |
-
"time": "2017-05-
|
957 |
},
|
958 |
{
|
959 |
"name": "sebastian/environment",
|
@@ -1003,7 +878,7 @@
|
|
1003 |
"environment",
|
1004 |
"hhvm"
|
1005 |
],
|
1006 |
-
"time": "2016-08-
|
1007 |
},
|
1008 |
{
|
1009 |
"name": "sebastian/exporter",
|
@@ -1070,7 +945,7 @@
|
|
1070 |
"export",
|
1071 |
"exporter"
|
1072 |
],
|
1073 |
-
"time": "2016-06-
|
1074 |
},
|
1075 |
{
|
1076 |
"name": "sebastian/global-state",
|
@@ -1121,7 +996,7 @@
|
|
1121 |
"keywords": [
|
1122 |
"global state"
|
1123 |
],
|
1124 |
-
"time": "2015-10-
|
1125 |
},
|
1126 |
{
|
1127 |
"name": "sebastian/recursion-context",
|
@@ -1174,7 +1049,7 @@
|
|
1174 |
],
|
1175 |
"description": "Provides functionality to recursively process PHP variables",
|
1176 |
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
1177 |
-
"time": "2016-10-
|
1178 |
},
|
1179 |
{
|
1180 |
"name": "sebastian/version",
|
@@ -1209,94 +1084,98 @@
|
|
1209 |
],
|
1210 |
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
1211 |
"homepage": "https://github.com/sebastianbergmann/version",
|
1212 |
-
"time": "2015-06-
|
1213 |
},
|
1214 |
{
|
1215 |
-
"name": "
|
1216 |
-
"version": "
|
1217 |
"source": {
|
1218 |
"type": "git",
|
1219 |
-
"url": "https://github.com/
|
1220 |
-
"reference": "
|
1221 |
},
|
1222 |
"dist": {
|
1223 |
"type": "zip",
|
1224 |
-
"url": "https://api.github.com/repos/
|
1225 |
-
"reference": "
|
1226 |
"shasum": ""
|
1227 |
},
|
1228 |
"require": {
|
1229 |
-
"
|
|
|
|
|
|
|
1230 |
},
|
1231 |
"require-dev": {
|
1232 |
-
"
|
1233 |
-
},
|
1234 |
-
"suggest": {
|
1235 |
-
"symfony/console": "For validating YAML files using the lint command"
|
1236 |
},
|
|
|
|
|
|
|
|
|
1237 |
"type": "library",
|
1238 |
"extra": {
|
1239 |
"branch-alias": {
|
1240 |
-
"dev-master": "3.
|
1241 |
}
|
1242 |
},
|
1243 |
-
"autoload": {
|
1244 |
-
"psr-4": {
|
1245 |
-
"Symfony\\Component\\Yaml\\": ""
|
1246 |
-
},
|
1247 |
-
"exclude-from-classmap": [
|
1248 |
-
"/Tests/"
|
1249 |
-
]
|
1250 |
-
},
|
1251 |
"notification-url": "https://packagist.org/downloads/",
|
1252 |
"license": [
|
1253 |
-
"
|
1254 |
],
|
1255 |
"authors": [
|
1256 |
{
|
1257 |
-
"name": "
|
1258 |
-
"
|
1259 |
-
},
|
1260 |
-
{
|
1261 |
-
"name": "Symfony Community",
|
1262 |
-
"homepage": "https://symfony.com/contributors"
|
1263 |
}
|
1264 |
],
|
1265 |
-
"description": "
|
1266 |
-
"homepage": "
|
1267 |
-
"
|
|
|
|
|
|
|
|
|
1268 |
},
|
1269 |
{
|
1270 |
-
"name": "
|
1271 |
-
"version": "
|
1272 |
"source": {
|
1273 |
"type": "git",
|
1274 |
-
"url": "https://github.com/
|
1275 |
-
"reference": "
|
1276 |
},
|
1277 |
"dist": {
|
1278 |
"type": "zip",
|
1279 |
-
"url": "https://api.github.com/repos/
|
1280 |
-
"reference": "
|
1281 |
"shasum": ""
|
1282 |
},
|
1283 |
"require": {
|
1284 |
-
"php": "^5.
|
|
|
|
|
|
|
1285 |
},
|
1286 |
"require-dev": {
|
1287 |
-
"
|
1288 |
-
|
|
|
|
|
1289 |
},
|
1290 |
"type": "library",
|
1291 |
"extra": {
|
1292 |
"branch-alias": {
|
1293 |
-
"dev-master": "
|
1294 |
}
|
1295 |
},
|
1296 |
"autoload": {
|
1297 |
"psr-4": {
|
1298 |
-
"
|
1299 |
-
}
|
|
|
|
|
|
|
1300 |
},
|
1301 |
"notification-url": "https://packagist.org/downloads/",
|
1302 |
"license": [
|
@@ -1304,17 +1183,17 @@
|
|
1304 |
],
|
1305 |
"authors": [
|
1306 |
{
|
1307 |
-
"name": "
|
1308 |
-
"email": "
|
|
|
|
|
|
|
|
|
1309 |
}
|
1310 |
],
|
1311 |
-
"description": "
|
1312 |
-
"
|
1313 |
-
|
1314 |
-
"check",
|
1315 |
-
"validate"
|
1316 |
-
],
|
1317 |
-
"time": "2016-11-23T20:04:58+00:00"
|
1318 |
}
|
1319 |
],
|
1320 |
"aliases": [],
|
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 |
+
"hash": "46491c1f496deba27513795d2136c4ee",
|
8 |
+
"content-hash": "a01d8ebabee19a0d370df859423c6939",
|
9 |
"packages": [
|
10 |
{
|
11 |
+
"name": "doctrine/instantiator",
|
12 |
+
"version": "1.0.5",
|
13 |
"source": {
|
14 |
"type": "git",
|
15 |
+
"url": "https://github.com/doctrine/instantiator.git",
|
16 |
+
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
|
17 |
+
},
|
18 |
+
"dist": {
|
19 |
+
"type": "zip",
|
20 |
+
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
|
21 |
+
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
|
22 |
+
"shasum": ""
|
23 |
},
|
24 |
"require": {
|
25 |
+
"php": ">=5.3,<8.0-DEV"
|
26 |
+
},
|
27 |
+
"require-dev": {
|
28 |
+
"athletic/athletic": "~0.1.8",
|
29 |
+
"ext-pdo": "*",
|
30 |
+
"ext-phar": "*",
|
31 |
+
"phpunit/phpunit": "~4.0",
|
32 |
+
"squizlabs/php_codesniffer": "~2.0"
|
33 |
},
|
34 |
"type": "library",
|
35 |
+
"extra": {
|
36 |
+
"branch-alias": {
|
37 |
+
"dev-master": "1.0.x-dev"
|
38 |
+
}
|
39 |
+
},
|
40 |
"autoload": {
|
41 |
+
"psr-4": {
|
42 |
+
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
|
43 |
+
}
|
44 |
},
|
45 |
"notification-url": "https://packagist.org/downloads/",
|
46 |
"license": [
|
47 |
+
"MIT"
|
48 |
+
],
|
49 |
+
"authors": [
|
50 |
+
{
|
51 |
+
"name": "Marco Pivetta",
|
52 |
+
"email": "ocramius@gmail.com",
|
53 |
+
"homepage": "http://ocramius.github.com/"
|
54 |
+
}
|
55 |
],
|
56 |
+
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
57 |
+
"homepage": "https://github.com/doctrine/instantiator",
|
58 |
"keywords": [
|
59 |
+
"constructor",
|
60 |
+
"instantiate"
|
|
|
61 |
],
|
62 |
+
"time": "2015-06-14 21:17:01"
|
63 |
},
|
64 |
{
|
65 |
"name": "facebook/facebook-instant-articles-sdk-php",
|
66 |
+
"version": "v1.8.3",
|
67 |
"source": {
|
68 |
"type": "git",
|
69 |
"url": "https://github.com/facebook/facebook-instant-articles-sdk-php.git",
|
70 |
+
"reference": "37439793352206aa2e600d3bb8c361442fb09b73"
|
71 |
},
|
72 |
"dist": {
|
73 |
"type": "zip",
|
74 |
+
"url": "https://api.github.com/repos/facebook/facebook-instant-articles-sdk-php/zipball/37439793352206aa2e600d3bb8c361442fb09b73",
|
75 |
+
"reference": "37439793352206aa2e600d3bb8c361442fb09b73",
|
76 |
"shasum": ""
|
77 |
},
|
78 |
"require": {
|
|
|
79 |
"facebook/graph-sdk": "~5.0",
|
80 |
"php": "^5.4 || ^7.0",
|
81 |
+
"symfony/css-selector": "2.8.*"
|
82 |
},
|
83 |
"require-dev": {
|
84 |
"fzaninotto/faker": "^1.6.0",
|
85 |
+
"phpdocumentor/reflection-docblock": "^2.0",
|
86 |
+
"phpunit/phpunit": "4.8.*",
|
87 |
+
"squizlabs/php_codesniffer": "^2.6.0",
|
88 |
+
"symfony/yaml": "2.1.*"
|
89 |
},
|
90 |
"type": "library",
|
91 |
"autoload": {
|
111 |
"instant",
|
112 |
"sdk"
|
113 |
],
|
114 |
+
"time": "2018-02-04 23:12:58"
|
115 |
},
|
116 |
{
|
117 |
"name": "facebook/graph-sdk",
|
118 |
+
"version": "5.6.1",
|
119 |
"source": {
|
120 |
"type": "git",
|
121 |
"url": "https://github.com/facebook/php-graph-sdk.git",
|
122 |
+
"reference": "2f9639c15ae043911f40ffe44080b32bac2c5280"
|
123 |
},
|
124 |
"dist": {
|
125 |
"type": "zip",
|
126 |
+
"url": "https://api.github.com/repos/facebook/php-graph-sdk/zipball/2f9639c15ae043911f40ffe44080b32bac2c5280",
|
127 |
+
"reference": "2f9639c15ae043911f40ffe44080b32bac2c5280",
|
128 |
"shasum": ""
|
129 |
},
|
130 |
"require": {
|
169 |
"facebook",
|
170 |
"sdk"
|
171 |
],
|
172 |
+
"time": "2017-08-16 17:28:07"
|
173 |
},
|
174 |
{
|
175 |
"name": "symfony/css-selector",
|
176 |
+
"version": "v2.8.34",
|
177 |
"source": {
|
178 |
"type": "git",
|
179 |
"url": "https://github.com/symfony/css-selector.git",
|
180 |
+
"reference": "c5b39674eacd34adedbef78227c57109caa9e318"
|
181 |
},
|
182 |
"dist": {
|
183 |
"type": "zip",
|
184 |
+
"url": "https://api.github.com/repos/symfony/css-selector/zipball/c5b39674eacd34adedbef78227c57109caa9e318",
|
185 |
+
"reference": "c5b39674eacd34adedbef78227c57109caa9e318",
|
186 |
"shasum": ""
|
187 |
},
|
188 |
"require": {
|
189 |
+
"php": ">=5.3.9"
|
190 |
},
|
191 |
"type": "library",
|
192 |
"extra": {
|
193 |
"branch-alias": {
|
194 |
+
"dev-master": "2.8-dev"
|
195 |
}
|
196 |
},
|
197 |
"autoload": {
|
222 |
],
|
223 |
"description": "Symfony CssSelector Component",
|
224 |
"homepage": "https://symfony.com",
|
225 |
+
"time": "2018-01-03 07:36:31"
|
226 |
}
|
227 |
],
|
228 |
"packages-dev": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
{
|
230 |
"name": "phpdocumentor/reflection-docblock",
|
231 |
+
"version": "2.0.5",
|
232 |
"source": {
|
233 |
"type": "git",
|
234 |
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
235 |
+
"reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b"
|
236 |
},
|
237 |
"dist": {
|
238 |
"type": "zip",
|
239 |
+
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e6a969a640b00d8daa3c66518b0405fb41ae0c4b",
|
240 |
+
"reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b",
|
241 |
"shasum": ""
|
242 |
},
|
243 |
"require": {
|
244 |
+
"php": ">=5.3.3"
|
|
|
|
|
|
|
245 |
},
|
246 |
"require-dev": {
|
247 |
+
"phpunit/phpunit": "~4.0"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
},
|
249 |
+
"suggest": {
|
250 |
+
"dflydev/markdown": "~1.0",
|
251 |
+
"erusev/parsedown": "~1.0"
|
252 |
},
|
253 |
"type": "library",
|
254 |
"extra": {
|
255 |
"branch-alias": {
|
256 |
+
"dev-master": "2.0.x-dev"
|
257 |
}
|
258 |
},
|
259 |
"autoload": {
|
260 |
+
"psr-0": {
|
261 |
+
"phpDocumentor": [
|
262 |
"src/"
|
263 |
]
|
264 |
}
|
270 |
"authors": [
|
271 |
{
|
272 |
"name": "Mike van Riel",
|
273 |
+
"email": "mike.vanriel@naenius.com"
|
274 |
}
|
275 |
],
|
276 |
+
"time": "2016-01-25 08:17:30"
|
277 |
},
|
278 |
{
|
279 |
"name": "phpspec/prophecy",
|
280 |
+
"version": "1.7.3",
|
281 |
"source": {
|
282 |
"type": "git",
|
283 |
"url": "https://github.com/phpspec/prophecy.git",
|
284 |
+
"reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf"
|
285 |
},
|
286 |
"dist": {
|
287 |
"type": "zip",
|
288 |
+
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf",
|
289 |
+
"reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf",
|
290 |
"shasum": ""
|
291 |
},
|
292 |
"require": {
|
293 |
"doctrine/instantiator": "^1.0.2",
|
294 |
"php": "^5.3|^7.0",
|
295 |
+
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0",
|
296 |
"sebastian/comparator": "^1.1|^2.0",
|
297 |
"sebastian/recursion-context": "^1.0|^2.0|^3.0"
|
298 |
},
|
299 |
"require-dev": {
|
300 |
"phpspec/phpspec": "^2.5|^3.2",
|
301 |
+
"phpunit/phpunit": "^4.8.35 || ^5.7"
|
302 |
},
|
303 |
"type": "library",
|
304 |
"extra": {
|
305 |
"branch-alias": {
|
306 |
+
"dev-master": "1.7.x-dev"
|
307 |
}
|
308 |
},
|
309 |
"autoload": {
|
336 |
"spy",
|
337 |
"stub"
|
338 |
],
|
339 |
+
"time": "2017-11-24 13:59:53"
|
340 |
},
|
341 |
{
|
342 |
"name": "phpunit/php-code-coverage",
|
398 |
"testing",
|
399 |
"xunit"
|
400 |
],
|
401 |
+
"time": "2015-10-06 15:47:00"
|
402 |
},
|
403 |
{
|
404 |
"name": "phpunit/php-file-iterator",
|
405 |
+
"version": "1.4.5",
|
406 |
"source": {
|
407 |
"type": "git",
|
408 |
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
409 |
+
"reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4"
|
410 |
},
|
411 |
"dist": {
|
412 |
"type": "zip",
|
413 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4",
|
414 |
+
"reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4",
|
415 |
"shasum": ""
|
416 |
},
|
417 |
"require": {
|
445 |
"filesystem",
|
446 |
"iterator"
|
447 |
],
|
448 |
+
"time": "2017-11-27 13:52:08"
|
449 |
},
|
450 |
{
|
451 |
"name": "phpunit/php-text-template",
|
486 |
"keywords": [
|
487 |
"template"
|
488 |
],
|
489 |
+
"time": "2015-06-21 13:50:34"
|
490 |
},
|
491 |
{
|
492 |
"name": "phpunit/php-timer",
|
535 |
"keywords": [
|
536 |
"timer"
|
537 |
],
|
538 |
+
"time": "2017-02-26 11:10:40"
|
539 |
},
|
540 |
{
|
541 |
"name": "phpunit/php-token-stream",
|
542 |
+
"version": "1.4.12",
|
543 |
"source": {
|
544 |
"type": "git",
|
545 |
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
546 |
+
"reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16"
|
547 |
},
|
548 |
"dist": {
|
549 |
"type": "zip",
|
550 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16",
|
551 |
+
"reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16",
|
552 |
"shasum": ""
|
553 |
},
|
554 |
"require": {
|
584 |
"keywords": [
|
585 |
"tokenizer"
|
586 |
],
|
587 |
+
"time": "2017-12-04 08:55:13"
|
588 |
},
|
589 |
{
|
590 |
"name": "phpunit/phpunit",
|
591 |
+
"version": "4.8.36",
|
592 |
"source": {
|
593 |
"type": "git",
|
594 |
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
595 |
+
"reference": "46023de9a91eec7dfb06cc56cb4e260017298517"
|
596 |
},
|
597 |
"dist": {
|
598 |
"type": "zip",
|
599 |
+
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517",
|
600 |
+
"reference": "46023de9a91eec7dfb06cc56cb4e260017298517",
|
601 |
"shasum": ""
|
602 |
},
|
603 |
"require": {
|
656 |
"testing",
|
657 |
"xunit"
|
658 |
],
|
659 |
+
"time": "2017-06-21 08:07:12"
|
660 |
},
|
661 |
{
|
662 |
"name": "phpunit/phpunit-mock-objects",
|
712 |
"mock",
|
713 |
"xunit"
|
714 |
],
|
715 |
+
"time": "2015-10-02 06:51:40"
|
716 |
},
|
717 |
{
|
718 |
"name": "sebastian/comparator",
|
776 |
"compare",
|
777 |
"equality"
|
778 |
],
|
779 |
+
"time": "2017-01-29 09:50:25"
|
780 |
},
|
781 |
{
|
782 |
"name": "sebastian/diff",
|
828 |
"keywords": [
|
829 |
"diff"
|
830 |
],
|
831 |
+
"time": "2017-05-22 07:24:03"
|
832 |
},
|
833 |
{
|
834 |
"name": "sebastian/environment",
|
878 |
"environment",
|
879 |
"hhvm"
|
880 |
],
|
881 |
+
"time": "2016-08-18 05:49:44"
|
882 |
},
|
883 |
{
|
884 |
"name": "sebastian/exporter",
|
945 |
"export",
|
946 |
"exporter"
|
947 |
],
|
948 |
+
"time": "2016-06-17 09:04:28"
|
949 |
},
|
950 |
{
|
951 |
"name": "sebastian/global-state",
|
996 |
"keywords": [
|
997 |
"global state"
|
998 |
],
|
999 |
+
"time": "2015-10-12 03:26:01"
|
1000 |
},
|
1001 |
{
|
1002 |
"name": "sebastian/recursion-context",
|
1049 |
],
|
1050 |
"description": "Provides functionality to recursively process PHP variables",
|
1051 |
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
1052 |
+
"time": "2016-10-03 07:41:43"
|
1053 |
},
|
1054 |
{
|
1055 |
"name": "sebastian/version",
|
1084 |
],
|
1085 |
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
1086 |
"homepage": "https://github.com/sebastianbergmann/version",
|
1087 |
+
"time": "2015-06-21 13:59:46"
|
1088 |
},
|
1089 |
{
|
1090 |
+
"name": "squizlabs/php_codesniffer",
|
1091 |
+
"version": "3.2.2",
|
1092 |
"source": {
|
1093 |
"type": "git",
|
1094 |
+
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
1095 |
+
"reference": "d7c00c3000ac0ce79c96fcbfef86b49a71158cd1"
|
1096 |
},
|
1097 |
"dist": {
|
1098 |
"type": "zip",
|
1099 |
+
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d7c00c3000ac0ce79c96fcbfef86b49a71158cd1",
|
1100 |
+
"reference": "d7c00c3000ac0ce79c96fcbfef86b49a71158cd1",
|
1101 |
"shasum": ""
|
1102 |
},
|
1103 |
"require": {
|
1104 |
+
"ext-simplexml": "*",
|
1105 |
+
"ext-tokenizer": "*",
|
1106 |
+
"ext-xmlwriter": "*",
|
1107 |
+
"php": ">=5.4.0"
|
1108 |
},
|
1109 |
"require-dev": {
|
1110 |
+
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0"
|
|
|
|
|
|
|
1111 |
},
|
1112 |
+
"bin": [
|
1113 |
+
"bin/phpcs",
|
1114 |
+
"bin/phpcbf"
|
1115 |
+
],
|
1116 |
"type": "library",
|
1117 |
"extra": {
|
1118 |
"branch-alias": {
|
1119 |
+
"dev-master": "3.x-dev"
|
1120 |
}
|
1121 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1122 |
"notification-url": "https://packagist.org/downloads/",
|
1123 |
"license": [
|
1124 |
+
"BSD-3-Clause"
|
1125 |
],
|
1126 |
"authors": [
|
1127 |
{
|
1128 |
+
"name": "Greg Sherwood",
|
1129 |
+
"role": "lead"
|
|
|
|
|
|
|
|
|
1130 |
}
|
1131 |
],
|
1132 |
+
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
1133 |
+
"homepage": "http://www.squizlabs.com/php-codesniffer",
|
1134 |
+
"keywords": [
|
1135 |
+
"phpcs",
|
1136 |
+
"standards"
|
1137 |
+
],
|
1138 |
+
"time": "2017-12-19 21:44:46"
|
1139 |
},
|
1140 |
{
|
1141 |
+
"name": "symfony/yaml",
|
1142 |
+
"version": "v3.4.4",
|
1143 |
"source": {
|
1144 |
"type": "git",
|
1145 |
+
"url": "https://github.com/symfony/yaml.git",
|
1146 |
+
"reference": "eab73b6c21d27ae4cd037c417618dfd4befb0bfe"
|
1147 |
},
|
1148 |
"dist": {
|
1149 |
"type": "zip",
|
1150 |
+
"url": "https://api.github.com/repos/symfony/yaml/zipball/eab73b6c21d27ae4cd037c417618dfd4befb0bfe",
|
1151 |
+
"reference": "eab73b6c21d27ae4cd037c417618dfd4befb0bfe",
|
1152 |
"shasum": ""
|
1153 |
},
|
1154 |
"require": {
|
1155 |
+
"php": "^5.5.9|>=7.0.8"
|
1156 |
+
},
|
1157 |
+
"conflict": {
|
1158 |
+
"symfony/console": "<3.4"
|
1159 |
},
|
1160 |
"require-dev": {
|
1161 |
+
"symfony/console": "~3.4|~4.0"
|
1162 |
+
},
|
1163 |
+
"suggest": {
|
1164 |
+
"symfony/console": "For validating YAML files using the lint command"
|
1165 |
},
|
1166 |
"type": "library",
|
1167 |
"extra": {
|
1168 |
"branch-alias": {
|
1169 |
+
"dev-master": "3.4-dev"
|
1170 |
}
|
1171 |
},
|
1172 |
"autoload": {
|
1173 |
"psr-4": {
|
1174 |
+
"Symfony\\Component\\Yaml\\": ""
|
1175 |
+
},
|
1176 |
+
"exclude-from-classmap": [
|
1177 |
+
"/Tests/"
|
1178 |
+
]
|
1179 |
},
|
1180 |
"notification-url": "https://packagist.org/downloads/",
|
1181 |
"license": [
|
1183 |
],
|
1184 |
"authors": [
|
1185 |
{
|
1186 |
+
"name": "Fabien Potencier",
|
1187 |
+
"email": "fabien@symfony.com"
|
1188 |
+
},
|
1189 |
+
{
|
1190 |
+
"name": "Symfony Community",
|
1191 |
+
"homepage": "https://symfony.com/contributors"
|
1192 |
}
|
1193 |
],
|
1194 |
+
"description": "Symfony Yaml Component",
|
1195 |
+
"homepage": "https://symfony.com",
|
1196 |
+
"time": "2018-01-21 19:05:02"
|
|
|
|
|
|
|
|
|
1197 |
}
|
1198 |
],
|
1199 |
"aliases": [],
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/examples/example-override-styling.php
CHANGED
@@ -11,9 +11,6 @@ require_once __DIR__ . '/../vendor/autoload.php';
|
|
11 |
|
12 |
use Facebook\InstantArticles\AMP\AMPArticle;
|
13 |
|
14 |
-
// Prevents the logger from dumping too much info, check the file for details
|
15 |
-
include __DIR__ . '/quiet_logger.php';
|
16 |
-
|
17 |
// Load instant article file into string
|
18 |
$instant_article_string = file_get_contents(__DIR__.'/instant-article-example.html');
|
19 |
|
11 |
|
12 |
use Facebook\InstantArticles\AMP\AMPArticle;
|
13 |
|
|
|
|
|
|
|
14 |
// Load instant article file into string
|
15 |
$instant_article_string = file_get_contents(__DIR__.'/instant-article-example.html');
|
16 |
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/examples/example-quick-start.php
CHANGED
@@ -9,9 +9,6 @@
|
|
9 |
|
10 |
require_once __DIR__ . '/../vendor/autoload.php';
|
11 |
|
12 |
-
// Prevents the logger from dumping too much info, check the file for details
|
13 |
-
include __DIR__ . '/quiet_logger.php';
|
14 |
-
|
15 |
use Facebook\InstantArticles\AMP\AMPArticle;
|
16 |
|
17 |
// Load instant article file into string
|
9 |
|
10 |
require_once __DIR__ . '/../vendor/autoload.php';
|
11 |
|
|
|
|
|
|
|
12 |
use Facebook\InstantArticles\AMP\AMPArticle;
|
13 |
|
14 |
// Load instant article file into string
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/examples/example-simple-styling.php
CHANGED
@@ -11,9 +11,6 @@ require_once __DIR__ . '/../vendor/autoload.php';
|
|
11 |
|
12 |
use Facebook\InstantArticles\AMP\AMPArticle;
|
13 |
|
14 |
-
// Prevents the logger from dumping too much info, check the file for details
|
15 |
-
include __DIR__ . '/quiet_logger.php';
|
16 |
-
|
17 |
// Load instant article file into string
|
18 |
$instant_article_string = file_get_contents(__DIR__.'/instant-article-example.html');
|
19 |
$properties = array(
|
11 |
|
12 |
use Facebook\InstantArticles\AMP\AMPArticle;
|
13 |
|
|
|
|
|
|
|
14 |
// Load instant article file into string
|
15 |
$instant_article_string = file_get_contents(__DIR__.'/instant-article-example.html');
|
16 |
$properties = array(
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPArticle.php
CHANGED
@@ -139,10 +139,10 @@ class AMPArticle extends Element implements InstantArticleInterface
|
|
139 |
return $this->instantArticle;
|
140 |
}
|
141 |
|
142 |
-
public function render($doctype = '<!doctype html>', $format = true)
|
143 |
{
|
144 |
$doctype = is_null($doctype) ? '<!doctype html>' : $doctype;
|
145 |
-
$rendered = parent::render($doctype, $format);
|
146 |
|
147 |
// Makes empty value attribute definition, since we use DOMDocument::saveXML()
|
148 |
$rendered = str_replace('amp=""', 'amp', $rendered);
|
@@ -197,19 +197,12 @@ class AMPArticle extends Element implements InstantArticleInterface
|
|
197 |
* The format of the $properties['analytics'] should be a list of strings
|
198 |
* containing the raw markup of the analytics tags (either amp-analytics or amp-pixel).
|
199 |
*/
|
200 |
-
public function buildAnalytics($context
|
201 |
{
|
202 |
if (!isset($this->properties[self::ANALYTICS_KEY])) {
|
203 |
return null;
|
204 |
}
|
205 |
|
206 |
-
if ($context === null) {
|
207 |
-
$context = $this->getContext();
|
208 |
-
if ($context === null) {
|
209 |
-
throw new Exception('No context found.');
|
210 |
-
}
|
211 |
-
}
|
212 |
-
|
213 |
$document = $context->getDocument();
|
214 |
$container = $document->createDocumentFragment();
|
215 |
|
@@ -278,7 +271,7 @@ class AMPArticle extends Element implements InstantArticleInterface
|
|
278 |
$this->ampHeader->genArticlePublishDate($this->dateFormat);
|
279 |
|
280 |
// Add the analytics code
|
281 |
-
$analytics = $this->buildAnalytics();
|
282 |
if ($analytics !== null) {
|
283 |
$head->appendChild($this->buildCustomElementScriptEntry('amp-analytics', 'https://cdn.ampproject.org/v0/amp-analytics-0.1.js', $context));
|
284 |
$body->insertBefore($analytics, $body->firstChild);
|
@@ -350,8 +343,10 @@ class AMPArticle extends Element implements InstantArticleInterface
|
|
350 |
|
351 |
// Builds title and append to head
|
352 |
$title = $context->createElement('title', $head);
|
353 |
-
$
|
354 |
-
|
|
|
|
|
355 |
|
356 |
return $head;
|
357 |
}
|
@@ -417,6 +412,8 @@ class AMPArticle extends Element implements InstantArticleInterface
|
|
417 |
$context->getHead()->appendChild($this->buildCustomElementScriptEntry('amp-iframe', 'https://cdn.ampproject.org/v0/amp-iframe-0.1.js', $context));
|
418 |
}
|
419 |
$childElement = $this->observer->applyFilters('IA_INTERACTIVE', $this->buildIframe($child, $context, 'interactive', true), $child, $context);
|
|
|
|
|
420 |
} else if (Type::is($child, Map::getClassName())) {
|
421 |
if (!$containsIframe) {
|
422 |
$containsIframe = true;
|
@@ -427,7 +424,7 @@ class AMPArticle extends Element implements InstantArticleInterface
|
|
427 |
$childElement->setAttribute('class', $context->buildCssClass('related-articles'));
|
428 |
// TODO RelatedArticles is not covered yet, since AMP didn't get a good structure for it up to date.
|
429 |
} else if (Type::is($child, Analytics::getClassName())) {
|
430 |
-
if ($this->buildAnalytics() === null) {
|
431 |
$context->addWarning(
|
432 |
'Your Instant Article has analytics code, and you didn\'t provide an AMP analytics json. Your data will not be tracked. See the documentation at https://www.ampproject.org/docs/reference/components/amp-analytics on how to build your analytics component for AMP.',
|
433 |
$child
|
@@ -1350,20 +1347,32 @@ class AMPArticle extends Element implements InstantArticleInterface
|
|
1350 |
$header = $this->instantArticle->getHeader();
|
1351 |
$published = $header->getPublished();
|
1352 |
$modified = $header->getModified();
|
|
|
|
|
1353 |
|
1354 |
$metadata = array(
|
1355 |
'@context' => 'http://schema.org',
|
1356 |
'@type' => 'NewsArticle',
|
1357 |
'mainEntityOfPage' => $this->instantArticle->getCanonicalURL(),
|
1358 |
-
'headline' => $this->instantArticle->getHeader()->getTitle()->getPlainText(),
|
1359 |
-
'datePublished' => date_format($published->getDatetime(), 'c'),
|
1360 |
-
'description' => $this->instantArticle->getFirstParagraph()->getPlainText(),
|
1361 |
);
|
1362 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1363 |
if ($modified) {
|
1364 |
$metadata['dateModified'] = date_format($modified->getDatetime(), 'c');
|
1365 |
}
|
1366 |
|
|
|
1367 |
$authors = $header->getAuthors();
|
1368 |
foreach ($authors as $author) {
|
1369 |
$metadata['author'] = array(
|
139 |
return $this->instantArticle;
|
140 |
}
|
141 |
|
142 |
+
public function render($doctype = '<!doctype html>', $format = true, $validate = true)
|
143 |
{
|
144 |
$doctype = is_null($doctype) ? '<!doctype html>' : $doctype;
|
145 |
+
$rendered = parent::render($doctype, $format, $validate);
|
146 |
|
147 |
// Makes empty value attribute definition, since we use DOMDocument::saveXML()
|
148 |
$rendered = str_replace('amp=""', 'amp', $rendered);
|
197 |
* The format of the $properties['analytics'] should be a list of strings
|
198 |
* containing the raw markup of the analytics tags (either amp-analytics or amp-pixel).
|
199 |
*/
|
200 |
+
public function buildAnalytics($context)
|
201 |
{
|
202 |
if (!isset($this->properties[self::ANALYTICS_KEY])) {
|
203 |
return null;
|
204 |
}
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
$document = $context->getDocument();
|
207 |
$container = $document->createDocumentFragment();
|
208 |
|
271 |
$this->ampHeader->genArticlePublishDate($this->dateFormat);
|
272 |
|
273 |
// Add the analytics code
|
274 |
+
$analytics = $this->buildAnalytics($context);
|
275 |
if ($analytics !== null) {
|
276 |
$head->appendChild($this->buildCustomElementScriptEntry('amp-analytics', 'https://cdn.ampproject.org/v0/amp-analytics-0.1.js', $context));
|
277 |
$body->insertBefore($analytics, $body->firstChild);
|
343 |
|
344 |
// Builds title and append to head
|
345 |
$title = $context->createElement('title', $head);
|
346 |
+
if ($context->getInstantArticle() && $context->getInstantArticle()->getHeader() && $context->getInstantArticle()->getHeader()->getTitle()) {
|
347 |
+
$titleText = $context->getInstantArticle()->getHeader()->getTitle()->textToDOMDocumentFragment($context->getDocument());
|
348 |
+
$title->appendChild($titleText);
|
349 |
+
}
|
350 |
|
351 |
return $head;
|
352 |
}
|
412 |
$context->getHead()->appendChild($this->buildCustomElementScriptEntry('amp-iframe', 'https://cdn.ampproject.org/v0/amp-iframe-0.1.js', $context));
|
413 |
}
|
414 |
$childElement = $this->observer->applyFilters('IA_INTERACTIVE', $this->buildIframe($child, $context, 'interactive', true), $child, $context);
|
415 |
+
} else if ((Type::is($child, Interactive::getClassName()) || Type::is($child, SocialEmbed::getClassName()))) {
|
416 |
+
$childElement = $context->getDocument()->importNode($child->getHtml(), true);
|
417 |
} else if (Type::is($child, Map::getClassName())) {
|
418 |
if (!$containsIframe) {
|
419 |
$containsIframe = true;
|
424 |
$childElement->setAttribute('class', $context->buildCssClass('related-articles'));
|
425 |
// TODO RelatedArticles is not covered yet, since AMP didn't get a good structure for it up to date.
|
426 |
} else if (Type::is($child, Analytics::getClassName())) {
|
427 |
+
if ($this->buildAnalytics($context) === null) {
|
428 |
$context->addWarning(
|
429 |
'Your Instant Article has analytics code, and you didn\'t provide an AMP analytics json. Your data will not be tracked. See the documentation at https://www.ampproject.org/docs/reference/components/amp-analytics on how to build your analytics component for AMP.',
|
430 |
$child
|
1347 |
$header = $this->instantArticle->getHeader();
|
1348 |
$published = $header->getPublished();
|
1349 |
$modified = $header->getModified();
|
1350 |
+
$title = $this->instantArticle->getHeader()->getTitle();
|
1351 |
+
$description = $this->instantArticle->getFirstParagraph();
|
1352 |
|
1353 |
$metadata = array(
|
1354 |
'@context' => 'http://schema.org',
|
1355 |
'@type' => 'NewsArticle',
|
1356 |
'mainEntityOfPage' => $this->instantArticle->getCanonicalURL(),
|
|
|
|
|
|
|
1357 |
);
|
1358 |
|
1359 |
+
if ($title) {
|
1360 |
+
$metadata['headline'] = $title->getPlainText();
|
1361 |
+
}
|
1362 |
+
|
1363 |
+
if ($published) {
|
1364 |
+
$metadata['datePublished'] = date_format($published->getDatetime(), 'c');
|
1365 |
+
}
|
1366 |
+
|
1367 |
+
if ($description) {
|
1368 |
+
$metadata['description'] = $description->getPlainText();
|
1369 |
+
}
|
1370 |
+
|
1371 |
if ($modified) {
|
1372 |
$metadata['dateModified'] = date_format($modified->getDatetime(), 'c');
|
1373 |
}
|
1374 |
|
1375 |
+
|
1376 |
$authors = $header->getAuthors();
|
1377 |
foreach ($authors as $author) {
|
1378 |
$metadata['author'] = array(
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPContext.php
CHANGED
@@ -86,7 +86,7 @@ class AMPContext
|
|
86 |
if (!isset($document) || $document === null) {
|
87 |
$document = new \DOMDocument();
|
88 |
}
|
89 |
-
Type::enforce($document,
|
90 |
$this->document = $document;
|
91 |
return $this;
|
92 |
}
|
@@ -203,7 +203,7 @@ class AMPContext
|
|
203 |
*/
|
204 |
private function withInstantArticle($instantArticle)
|
205 |
{
|
206 |
-
Type::enforce($instantArticle, InstantArticle::
|
207 |
$this->instantArticle = $instantArticle;
|
208 |
return $this;
|
209 |
}
|
@@ -585,8 +585,7 @@ class AMPContext
|
|
585 |
*/
|
586 |
public function addItem($item)
|
587 |
{
|
588 |
-
$
|
589 |
-
Type::enforce($item, get_class($element));
|
590 |
$this->articleItems[] = $item;
|
591 |
}
|
592 |
|
86 |
if (!isset($document) || $document === null) {
|
87 |
$document = new \DOMDocument();
|
88 |
}
|
89 |
+
Type::enforce($document, 'DOMDocument');
|
90 |
$this->document = $document;
|
91 |
return $this;
|
92 |
}
|
203 |
*/
|
204 |
private function withInstantArticle($instantArticle)
|
205 |
{
|
206 |
+
Type::enforce($instantArticle, InstantArticle::getClassName());
|
207 |
$this->instantArticle = $instantArticle;
|
208 |
return $this;
|
209 |
}
|
585 |
*/
|
586 |
public function addItem($item)
|
587 |
{
|
588 |
+
Type::enforce($item, 'DOMNode');
|
|
|
589 |
$this->articleItems[] = $item;
|
590 |
}
|
591 |
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPCoverImage.php
CHANGED
@@ -67,15 +67,12 @@ class AMPCoverImage
|
|
67 |
$this->ampImgTag->setAttribute('src', $imageURL);
|
68 |
$this->ampImgTag->setAttribute('width', (string) $imageWidth);
|
69 |
$this->ampImgTag->setAttribute('height', (string) $imageHeight);
|
|
|
70 |
|
71 |
$imageCSSClass = $this->ampImgTag->getAttribute('class');
|
72 |
$containerCSSClass = $this->containerTag->getAttribute('class');
|
73 |
$this->context->getCssBuilder()
|
74 |
-
->addProperty("amp-img.$imageCSSClass", 'transform', "translate({$translateX}px, {$translateY}px)")
|
75 |
-
->addProperty("div.$containerCSSClass", 'width', AMPContext::DEFAULT_WIDTH.'px')
|
76 |
-
->addProperty("div.$containerCSSClass", 'height', AMPContext::DEFAULT_HEIGHT.'px')
|
77 |
-
->addProperty("div.$containerCSSClass", 'overflow', 'hidden');
|
78 |
-
|
79 |
}
|
80 |
|
81 |
public function build()
|
67 |
$this->ampImgTag->setAttribute('src', $imageURL);
|
68 |
$this->ampImgTag->setAttribute('width', (string) $imageWidth);
|
69 |
$this->ampImgTag->setAttribute('height', (string) $imageHeight);
|
70 |
+
$this->ampImgTag->setAttribute('layout', 'responsive');
|
71 |
|
72 |
$imageCSSClass = $this->ampImgTag->getAttribute('class');
|
73 |
$containerCSSClass = $this->containerTag->getAttribute('class');
|
74 |
$this->context->getCssBuilder()
|
75 |
+
->addProperty("amp-img.$imageCSSClass", 'transform', "translate({$translateX}px, {$translateY}px)");
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
|
78 |
public function build()
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPHeader.php
CHANGED
@@ -38,13 +38,12 @@ class AMPHeader
|
|
38 |
|
39 |
private function genTitle()
|
40 |
{
|
41 |
-
$iaTitle = $this->iaHeader()
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
$this->context->buildSpacingDiv($this->header);
|
48 |
}
|
49 |
|
50 |
private function genHeaderBar()
|
@@ -120,10 +119,15 @@ class AMPHeader
|
|
120 |
|
121 |
public function genArticlePublishDate($dateFormat)
|
122 |
{
|
123 |
-
$
|
124 |
-
$
|
125 |
-
$
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
127 |
}
|
128 |
|
129 |
public function build()
|
38 |
|
39 |
private function genTitle()
|
40 |
{
|
41 |
+
$iaTitle = $this->iaHeader()->getTitle();
|
42 |
+
if ($iaTitle) {
|
43 |
+
$h1 = $this->context->createElement('h1', $this->header, 'header-h1');
|
44 |
+
$h1->appendChild($iaTitle->textToDOMDocumentFragment($this->context->getDocument()));
|
45 |
+
$this->context->buildSpacingDiv($this->header);
|
46 |
+
}
|
|
|
47 |
}
|
48 |
|
49 |
private function genHeaderBar()
|
119 |
|
120 |
public function genArticlePublishDate($dateFormat)
|
121 |
{
|
122 |
+
$published = $this->iaHeader()->getPublished();
|
123 |
+
if ($published) {
|
124 |
+
$datetime = $published->getDatetime();
|
125 |
+
$this->publishDateElement->appendChild(
|
126 |
+
$this->context->getDocument()->createTextNode(
|
127 |
+
date_format($datetime, $dateFormat)
|
128 |
+
)
|
129 |
+
);
|
130 |
+
}
|
131 |
}
|
132 |
|
133 |
public function build()
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/AMPArticleTest.php
CHANGED
@@ -25,7 +25,7 @@ class AMPArticleTest extends FileUtilsPHPUnitTestCase
|
|
25 |
$instant_article->addMetaProperty('op:generator:transformer:version', '1.0.0');
|
26 |
$result = $instant_article->render('', true)."\n";
|
27 |
|
28 |
-
$this->
|
29 |
}
|
30 |
|
31 |
public function testTransformIAtoAMPTest1()
|
@@ -131,7 +131,7 @@ class AMPArticleTest extends FileUtilsPHPUnitTestCase
|
|
131 |
$ampExpectedNoStyles = $this->getMarkupWithoutStyles($ampExpected);
|
132 |
$ampRenderedNoStyles = $this->getMarkupWithoutStyles($ampRendered);
|
133 |
|
134 |
-
$this->
|
135 |
}
|
136 |
|
137 |
public function runIAtoAMPTest($test, $customProperties = null)
|
@@ -182,7 +182,7 @@ class AMPArticleTest extends FileUtilsPHPUnitTestCase
|
|
182 |
{
|
183 |
$discoveryMetadata = $this->getDiscoveryMetadata($test);
|
184 |
|
185 |
-
$this->
|
186 |
}
|
187 |
|
188 |
public function testSchemaOrgContext()
|
@@ -219,7 +219,7 @@ class AMPArticleTest extends FileUtilsPHPUnitTestCase
|
|
219 |
{
|
220 |
$key = 'dateModified';
|
221 |
$discoveryMetadata = $this->getDiscoveryMetadata('tutorial');
|
222 |
-
$this->
|
223 |
}
|
224 |
|
225 |
public function testSchemaOrgAuthor()
|
25 |
$instant_article->addMetaProperty('op:generator:transformer:version', '1.0.0');
|
26 |
$result = $instant_article->render('', true)."\n";
|
27 |
|
28 |
+
$this->assertEqualsHtml($html_file, $result);
|
29 |
}
|
30 |
|
31 |
public function testTransformIAtoAMPTest1()
|
131 |
$ampExpectedNoStyles = $this->getMarkupWithoutStyles($ampExpected);
|
132 |
$ampRenderedNoStyles = $this->getMarkupWithoutStyles($ampRendered);
|
133 |
|
134 |
+
$this->assertEqualsHtml($ampExpectedNoStyles, $ampRenderedNoStyles);
|
135 |
}
|
136 |
|
137 |
public function runIAtoAMPTest($test, $customProperties = null)
|
182 |
{
|
183 |
$discoveryMetadata = $this->getDiscoveryMetadata($test);
|
184 |
|
185 |
+
$this->assertArrayNotHasKey($key, $discoveryMetadata, "Found unexpected '$key' key in Schema.org metadata");
|
186 |
}
|
187 |
|
188 |
public function testSchemaOrgContext()
|
219 |
{
|
220 |
$key = 'dateModified';
|
221 |
$discoveryMetadata = $this->getDiscoveryMetadata('tutorial');
|
222 |
+
$this->assertArrayHasKey($key, $discoveryMetadata, "Did not found expected '$key' key in Schema.org metadata");
|
223 |
}
|
224 |
|
225 |
public function testSchemaOrgAuthor()
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/AMPCaptionTest.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\AMP;
|
10 |
|
11 |
-
|
12 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
13 |
use Facebook\InstantArticles\Elements\Header;
|
14 |
use Facebook\InstantArticles\Elements\Image;
|
@@ -19,27 +18,6 @@ use PHPUnit\Framework;
|
|
19 |
|
20 |
class AMPCaptionTest extends Framework\TestCase
|
21 |
{
|
22 |
-
|
23 |
-
protected function setUp()
|
24 |
-
{
|
25 |
-
\Logger::configure(
|
26 |
-
[
|
27 |
-
'rootLogger' => [
|
28 |
-
'appenders' => ['facebook-instantarticles-traverser']
|
29 |
-
],
|
30 |
-
'appenders' => [
|
31 |
-
'facebook-instantarticles-traverser' => [
|
32 |
-
'class' => 'LoggerAppenderConsole',
|
33 |
-
'threshold' => 'INFO',
|
34 |
-
'layout' => [
|
35 |
-
'class' => 'LoggerLayoutSimple'
|
36 |
-
]
|
37 |
-
]
|
38 |
-
]
|
39 |
-
]
|
40 |
-
);
|
41 |
-
}
|
42 |
-
|
43 |
private function genInstantArticle()
|
44 |
{
|
45 |
return InstantArticle::create()
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\AMP;
|
10 |
|
|
|
11 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
12 |
use Facebook\InstantArticles\Elements\Header;
|
13 |
use Facebook\InstantArticles\Elements\Image;
|
18 |
|
19 |
class AMPCaptionTest extends Framework\TestCase
|
20 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
private function genInstantArticle()
|
22 |
{
|
23 |
return InstantArticle::create()
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/AMPContextTest.php
CHANGED
@@ -12,30 +12,8 @@ use Facebook\InstantArticles\Elements\InstantArticle;
|
|
12 |
use Facebook\InstantArticles\Elements\Paragraph;
|
13 |
use PHPUnit\Framework;
|
14 |
|
15 |
-
|
16 |
-
|
17 |
class AMPContextTest extends Framework\TestCase
|
18 |
{
|
19 |
-
protected function setUp()
|
20 |
-
{
|
21 |
-
\Logger::configure(
|
22 |
-
[
|
23 |
-
'rootLogger' => [
|
24 |
-
'appenders' => ['facebook-instantarticles-traverser']
|
25 |
-
],
|
26 |
-
'appenders' => [
|
27 |
-
'facebook-instantarticles-traverser' => [
|
28 |
-
'class' => 'LoggerAppenderConsole',
|
29 |
-
'threshold' => 'INFO',
|
30 |
-
'layout' => [
|
31 |
-
'class' => 'LoggerLayoutSimple'
|
32 |
-
]
|
33 |
-
]
|
34 |
-
]
|
35 |
-
]
|
36 |
-
);
|
37 |
-
}
|
38 |
-
|
39 |
public function testContextCreation()
|
40 |
{
|
41 |
$context = AMPContext::create(new \DOMDocument(), InstantArticle::create());
|
12 |
use Facebook\InstantArticles\Elements\Paragraph;
|
13 |
use PHPUnit\Framework;
|
14 |
|
|
|
|
|
15 |
class AMPContextTest extends Framework\TestCase
|
16 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
public function testContextCreation()
|
18 |
{
|
19 |
$context = AMPContext::create(new \DOMDocument(), InstantArticle::create());
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/AMPCoverImageTest.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\AMP;
|
10 |
|
11 |
-
|
12 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
13 |
use Facebook\InstantArticles\Elements\Header;
|
14 |
use Facebook\InstantArticles\Elements\Image;
|
@@ -19,27 +18,6 @@ use PHPUnit\Framework;
|
|
19 |
|
20 |
class AMPCoverImageTest extends Framework\TestCase
|
21 |
{
|
22 |
-
|
23 |
-
protected function setUp()
|
24 |
-
{
|
25 |
-
\Logger::configure(
|
26 |
-
[
|
27 |
-
'rootLogger' => [
|
28 |
-
'appenders' => ['facebook-instantarticles-traverser']
|
29 |
-
],
|
30 |
-
'appenders' => [
|
31 |
-
'facebook-instantarticles-traverser' => [
|
32 |
-
'class' => 'LoggerAppenderConsole',
|
33 |
-
'threshold' => 'INFO',
|
34 |
-
'layout' => [
|
35 |
-
'class' => 'LoggerLayoutSimple'
|
36 |
-
]
|
37 |
-
]
|
38 |
-
]
|
39 |
-
]
|
40 |
-
);
|
41 |
-
}
|
42 |
-
|
43 |
private function genInstantArticle()
|
44 |
{
|
45 |
return InstantArticle::create()
|
@@ -95,7 +73,7 @@ class AMPCoverImageTest extends Framework\TestCase
|
|
95 |
$expected =
|
96 |
'<div class="ia2amp-cover-image">'.
|
97 |
'<figure class="ia2amp-figure">'.
|
98 |
-
'<amp-img class="ia2amp-header-cover-img" src="http://blog.wod.expert/wp-content/uploads/2017/03/fail1.jpg" width="422" height="240"/>'.
|
99 |
'<figcaption class="ia2amp-figcaption ia2amp-op-small">Some caption to the image</figcaption>'.
|
100 |
'</figure>'.
|
101 |
'</div>';
|
@@ -116,7 +94,7 @@ class AMPCoverImageTest extends Framework\TestCase
|
|
116 |
{
|
117 |
$expected =
|
118 |
'<div class="ia2amp-cover-image">'.
|
119 |
-
'<amp-img class="ia2amp-header-cover-img" src="http://blog.wod.expert/wp-content/uploads/2017/03/fail1.jpg" width="422" height="240"/>'.
|
120 |
'</div>';
|
121 |
$instantArticle = $this->genInstantArticle();
|
122 |
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\AMP;
|
10 |
|
|
|
11 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
12 |
use Facebook\InstantArticles\Elements\Header;
|
13 |
use Facebook\InstantArticles\Elements\Image;
|
18 |
|
19 |
class AMPCoverImageTest extends Framework\TestCase
|
20 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
private function genInstantArticle()
|
22 |
{
|
23 |
return InstantArticle::create()
|
73 |
$expected =
|
74 |
'<div class="ia2amp-cover-image">'.
|
75 |
'<figure class="ia2amp-figure">'.
|
76 |
+
'<amp-img class="ia2amp-header-cover-img" src="http://blog.wod.expert/wp-content/uploads/2017/03/fail1.jpg" width="422" height="240" layout="responsive"/>'.
|
77 |
'<figcaption class="ia2amp-figcaption ia2amp-op-small">Some caption to the image</figcaption>'.
|
78 |
'</figure>'.
|
79 |
'</div>';
|
94 |
{
|
95 |
$expected =
|
96 |
'<div class="ia2amp-cover-image">'.
|
97 |
+
'<amp-img class="ia2amp-header-cover-img" src="http://blog.wod.expert/wp-content/uploads/2017/03/fail1.jpg" width="422" height="240" layout="responsive"/>'.
|
98 |
'</div>';
|
99 |
$instantArticle = $this->genInstantArticle();
|
100 |
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/amp-converted.html
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
<amp-img src="http://blog.wod.expert/wp-content/uploads/2017/03/fail1.jpg" width="380" height="215"></amp-img>
|
19 |
<div class="ia2amp-header-bar">
|
20 |
<div class="ia2amp-header-bar-img-container">
|
21 |
-
<amp-img src="http://blog.wod.expert/wp-content/uploads/2017/03/wod-expert-horizontal@033x.png" width="200" height="40"></amp-img>
|
22 |
</div>
|
23 |
</div>
|
24 |
<h2 class="ia2amp-header-category">motivational</h2>
|
18 |
<amp-img src="http://blog.wod.expert/wp-content/uploads/2017/03/fail1.jpg" width="380" height="215"></amp-img>
|
19 |
<div class="ia2amp-header-bar">
|
20 |
<div class="ia2amp-header-bar-img-container">
|
21 |
+
<amp-img src="http://blog.wod.expert/wp-content/uploads/2017/03/wod-expert-horizontal@033x.png" width="200" height="40" layout="responsive"></amp-img>
|
22 |
</div>
|
23 |
</div>
|
24 |
<h2 class="ia2amp-header-category">motivational</h2>
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/test1-amp-converted.html
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
<style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style>
|
9 |
</noscript>
|
10 |
<link rel="canonical" href="http://blog.wod.expert/very-first-wod/"/>
|
11 |
-
<style amp-custom>amp-img.ia2amp-header-cover-img {transform: translate(-21px, 0px);}
|
12 |
<script type="application/ld+json">{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"http://blog.wod.expert/very-first-wod/","headline":"Very First WOD!","datePublished":"2016-05-10T18:05:36+00:00","description":"The first WOD we never forget! Just to be sure we are talking about same thing, WOD stands for \u201cWorkout of the Day\u201d. \u00a0You feel you\u2019re already gone on the warm up session.","dateModified":"2017-03-17T16:46:07+00:00","author":{"@type":"Person","name":"\u00c9verton Ros\u00e1rio"},"image":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/03/fail1.jpg","width":800,"height":454},"publisher":{"@type":"Organization","name":"WOD Expert","logo":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/04/wod-expert-amp-org-logo.png","width":600,"height":60}}}</script>
|
13 |
<title>Very First WOD!</title>
|
14 |
<script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script>
|
@@ -18,13 +18,13 @@
|
|
18 |
<header class="ia2amp-header">
|
19 |
<div class="ia2amp-cover-image">
|
20 |
<figure class="ia2amp-figure">
|
21 |
-
<amp-img class="ia2amp-header-cover-img" src="http://blog.wod.expert/wp-content/uploads/2017/03/fail1.jpg" width="422" height="240"></amp-img>
|
22 |
<figcaption class="ia2amp-figcaption ia2amp-op-small">Flickr/crossfitpaleodietfitnessclassess</figcaption>
|
23 |
</figure>
|
24 |
</div>
|
25 |
<div class="ia2amp-header-bar">
|
26 |
<div class="ia2amp-header-bar-img-container">
|
27 |
-
<amp-img src="https://fb-s-c-a.akamaihd.net/h-ak-xpa1/v/t39.5687-6/17351511_1229084560538118_5982709905105092608_n.png?_nc_log=1&
|
28 |
</div>
|
29 |
</div>
|
30 |
<div class="ia2amp-spacing after-header-bar before-header-category"></div>
|
@@ -70,7 +70,7 @@
|
|
70 |
<p class="ia2amp-p">No matter which will be your very first workout. It can be one of the benchmark’s fancy named workouts or any unnamed workout, it doesn’t matter: you will “complete”, or better to say: you will suffer on it even just doing with the lightest weight on the box, using rubber, doing half of the repetitions, but still you will suck on performing it! Don’t feel ashamed of that!</p>
|
71 |
<div class="ia2amp-spacing after-p before-interactive"></div>
|
72 |
<div class="ia2amp-interactive">
|
73 |
-
<amp-iframe src="https://www.youtube.com/embed/P_uDhI-5FqE?start=258&
|
74 |
</div>
|
75 |
<div class="ia2amp-spacing after-interactive before-p"></div>
|
76 |
<p class="ia2amp-p">Have you made thru it? What was your feeling by the end, even not finishing, or doing half of workout? You will pick one side here: Either you will get addicted and return every day, or you will just drop out. Which one you took?</p>
|
8 |
<style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style>
|
9 |
</noscript>
|
10 |
<link rel="canonical" href="http://blog.wod.expert/very-first-wod/"/>
|
11 |
+
<style amp-custom>amp-img.ia2amp-header-cover-img {transform: translate(-21px, 0px);}html {background-color: rgb(238,238,238);}.ia2amp-header-category {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header-h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header-h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header h3 {font-family: Helvetica Neue;text-align: LEFT;text-transform: uppercase;color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;}.ia2amp-header-bar {background-color: rgb(102,102,102);}.ia2amp-h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-p {font-family: Georgia;text-align: LEFT;text-transform: none;color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;}.ia2amp-article a {font-family: Georgia;text-decoration: underline;color: rgb(0,0,0);}.ia2amp-blockquote {font-family: Georgia;text-align: LEFT;display: BLOCK;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 32px 0 46px;border-top-color: rgb(0,0,0);border-right-color: rgb(0,0,0);border-bottom-color: rgb(0,0,0);border-left-color: rgb(0,0,0);border-width: 0 0 0 2px;border-style: solid;}.ia2amp-pullquote {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-pullquote cite {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-small h1 {font-family: Helvetica Neue Bold;display: INLINE;text-transform: none;background-color: rgb(0,255,255);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-small h2 {font-family: Helvetica Neue;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-medium h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-medium h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-large h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-large h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-extra-large h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-extra-large h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-figcaption cite {font-family: Helvetica Neue;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(191,191,191);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-footer {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}/*Global Styles*/ .ia2amp-header-bar { margin: -5px 0 0 0; height: 55px; font: 0/0 a; } .ia2amp-header-bar:before { content: ' '; display: inline-block; vertical-align: middle; height: 100%; width: 16.4px; } .ia2amp-header-bar-img-container { display: inline-block; vertical-align: middle; } .ia2amp-header-category { font-size: 10px; line-height: 12px; display: block; font-weight: normal; } .ia2amp-header-h1 { font-size: 24px; line-height: 30px; display: block; font-weight: normal; } .ia2amp-header-h2 { font-size: 16px; line-height: 20px; display: block; font-weight: normal; } .ia2amp-header h3 { font-size: 8px; line-height: 12px; display: block; font-weight: normal; } .ia2amp-h1, .ia2amp-h2, .ia2amp-h3 { display: block; font-weight: normal; } .ia2amp-h1 { font-size: 19px; line-height: 23px; } .ia2amp-h2 { font-size: 16px; line-height: 20px; } .ia2amp-p { font-size: 14px; line-height: 20px; display: inline-block; } .ia2amp-p a { margin: 0; } .ia2amp-blockquote { font-size: 14px; line-height: 20px; padding: 0px 13.2px 0px 18.8px; } .ia2amp-spacing { display: block; height: 18.8px; margin: 0 16.4px 0 16.4px; } header figure figcaption { display: none; } .ia2amp-figure { margin: 0; } .ia2amp-op-small h1, .ia2amp-op-small h2 { font-size: 10px; display: block; } .ia2amp-op-medium h1, .ia2amp-op-medium h2 { font-size: 14px; display: block; } .ia2amp-op-large h1, .ia2amp-op-large h2 { font-size: 16px; display: block; } .ia2amp-op-extra-large h1, .ia2amp-op-extra-large h2 { font-size: 23px; display: block; } .ia2amp-figcaption cite { font-size: 8px; display: block; } .ia2amp-op-left { text-align: left; } .ia2amp-op-center { text-align: center; } .ia2amp-op-right { text-align: right; } .ia2amp-figure { position: relative; } figcaption.ia2amp-op-vertical-center { position: absolute; z-index: 1000; } .ia2amp-footer { display: block; font-size: 12px; line-height: 17px; } .ia2amp-footer aside p { margin: 0; } .ia2amp-spacing.after-header-bar.before-header-category { height: 18.8px; } .ia2amp-spacing.after-header-category.before-header-h1, .ia2amp-spacing.after-header-h1.before-header-h2 { height: 13.2px; } .ia2amp-spacing.after-h1.before-h2 { height: 13.2px; } .ia2amp-spacing.after-li.before-li { height: 13.2px; } .ia2amp-spacing.after-footer.before-footer { height: 18.8px; } .ia2amp-spacing.after-header-h1.before-header-author, .ia2amp-spacing.after-header-h2.before-header-author { height: 18.8px; } .ia2amp-spacing.after-header-author.before-header-date { height: 0; } .ia2amp-spacing.after-header-date.before-h1, .ia2amp-spacing.after-header-date.before-h2, .ia2amp-spacing.after-header-date.before-p { height: 26.4px; } .ia2amp-spacing.after-h1.before-p, .ia2amp-spacing.after-h2.before-p, .ia2amp-spacing.after-h3.before-p { height: 18.8px; } .ia2amp-spacing.after-blockquote.before-p { height: 18.8px; } .ia2amp-spacing.after-slideshow, .ia2amp-spacing.before-slideshow, .ia2amp-spacing.after-interactive, .ia2amp-spacing.before-interactive, .ia2amp-spacing.after-image, .ia2amp-spacing.before-image, .ia2amp-spacing.after-figcaption-small, .ia2amp-spacing.after-figcaption-medium, .ia2amp-spacing.after-figcaption-large, .ia2amp-spacing.after-figcaption-extra-large { height: 26.4px; } </style>
|
12 |
<script type="application/ld+json">{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"http://blog.wod.expert/very-first-wod/","headline":"Very First WOD!","datePublished":"2016-05-10T18:05:36+00:00","description":"The first WOD we never forget! Just to be sure we are talking about same thing, WOD stands for \u201cWorkout of the Day\u201d. \u00a0You feel you\u2019re already gone on the warm up session.","dateModified":"2017-03-17T16:46:07+00:00","author":{"@type":"Person","name":"\u00c9verton Ros\u00e1rio"},"image":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/03/fail1.jpg","width":800,"height":454},"publisher":{"@type":"Organization","name":"WOD Expert","logo":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/04/wod-expert-amp-org-logo.png","width":600,"height":60}}}</script>
|
13 |
<title>Very First WOD!</title>
|
14 |
<script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script>
|
18 |
<header class="ia2amp-header">
|
19 |
<div class="ia2amp-cover-image">
|
20 |
<figure class="ia2amp-figure">
|
21 |
+
<amp-img class="ia2amp-header-cover-img" src="http://blog.wod.expert/wp-content/uploads/2017/03/fail1.jpg" width="422" height="240" layout="responsive"></amp-img>
|
22 |
<figcaption class="ia2amp-figcaption ia2amp-op-small">Flickr/crossfitpaleodietfitnessclassess</figcaption>
|
23 |
</figure>
|
24 |
</div>
|
25 |
<div class="ia2amp-header-bar">
|
26 |
<div class="ia2amp-header-bar-img-container">
|
27 |
+
<amp-img src="https://fb-s-c-a.akamaihd.net/h-ak-xpa1/v/t39.5687-6/17351511_1229084560538118_5982709905105092608_n.png?_nc_log=1&oh=c8337650a88e7fdb6d31088a15a7d9d8&oe=599B24B5&__gda__=1502041799_7139cf314c7cdaa52fa44ba26fd253f8" width="223" height="44"></amp-img>
|
28 |
</div>
|
29 |
</div>
|
30 |
<div class="ia2amp-spacing after-header-bar before-header-category"></div>
|
70 |
<p class="ia2amp-p">No matter which will be your very first workout. It can be one of the benchmark’s fancy named workouts or any unnamed workout, it doesn’t matter: you will “complete”, or better to say: you will suffer on it even just doing with the lightest weight on the box, using rubber, doing half of the repetitions, but still you will suck on performing it! Don’t feel ashamed of that!</p>
|
71 |
<div class="ia2amp-spacing after-p before-interactive"></div>
|
72 |
<div class="ia2amp-interactive">
|
73 |
+
<amp-iframe src="https://www.youtube.com/embed/P_uDhI-5FqE?start=258&feature=oembed" width="380" height="240" sandbox="allow-scripts allow-same-origin" layout="responsive" frameborder="0"></amp-iframe>
|
74 |
</div>
|
75 |
<div class="ia2amp-spacing after-interactive before-p"></div>
|
76 |
<p class="ia2amp-p">Have you made thru it? What was your feeling by the end, even not finishing, or doing half of workout? You will pick one side here: Either you will get addicted and return every day, or you will just drop out. Which one you took?</p>
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/test1-instant-article.html
CHANGED
@@ -42,7 +42,7 @@
|
|
42 |
</figure>
|
43 |
<p>No matter which will be your very first workout. It can be one of the benchmark’s fancy named workouts or any unnamed workout, it doesn’t matter: you will “complete”, or better to say: you will suffer on it even just doing with the lightest weight on the box, using rubber, doing half of the repetitions, but still you will suck on performing it! Don’t feel ashamed of that!</p>
|
44 |
<figure class="op-interactive">
|
45 |
-
<iframe src="https://www.youtube.com/embed/P_uDhI-5FqE?start=258&
|
46 |
</figure>
|
47 |
<p>Have you made thru it? What was your feeling by the end, even not finishing, or doing half of workout? You will pick one side here: Either you will get addicted and return every day, or you will just drop out. Which one you took?</p>
|
48 |
<p>I guess I already know your answer, once you are coming here!</p>
|
42 |
</figure>
|
43 |
<p>No matter which will be your very first workout. It can be one of the benchmark’s fancy named workouts or any unnamed workout, it doesn’t matter: you will “complete”, or better to say: you will suffer on it even just doing with the lightest weight on the box, using rubber, doing half of the repetitions, but still you will suck on performing it! Don’t feel ashamed of that!</p>
|
44 |
<figure class="op-interactive">
|
45 |
+
<iframe src="https://www.youtube.com/embed/P_uDhI-5FqE?start=258&feature=oembed" class="no-margin" width="525" height="295"></iframe>
|
46 |
</figure>
|
47 |
<p>Have you made thru it? What was your feeling by the end, even not finishing, or doing half of workout? You will pick one side here: Either you will get addicted and return every day, or you will just drop out. Which one you took?</p>
|
48 |
<p>I guess I already know your answer, once you are coming here!</p>
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/test2-amp-converted.html
CHANGED
@@ -8,18 +8,18 @@
|
|
8 |
<style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style>
|
9 |
</noscript>
|
10 |
<link rel="canonical" href="http://blog.wod.expert/break-your-reps-before-you-die/"/>
|
11 |
-
<style amp-custom>amp-img.ia2amp-header-cover-img {transform: translate(0px, 0px);}
|
12 |
<script type="application/ld+json">{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"http://blog.wod.expert/break-your-reps-before-you-die/","headline":"Break your reps, before you die!","datePublished":"2016-05-17T12:47:46+00:00","description":"Having a good strategy to tackle the series in WODs are fundamental to achieve the best result given your particular physical condition. Comparing yourself to the top athletes, or trying to use their strategy probably won\u2019t work well, unless you are a top athlete! By good strategy I mean planing basically how fast you will perform your movements and how you will play your pauses. There is no better person in the world to know you better than yourself.","dateModified":"2017-03-17T16:45:18+00:00","author":{"@type":"Person","name":"\u00c9verton Ros\u00e1rio"},"image":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/03/wod-break.jpg","width":380,"height":240},"publisher":{"@type":"Organization","name":"WOD Expert","logo":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/04/wod-expert-amp-org-logo.png","width":600,"height":60}}}</script>
|
13 |
<title>Break your reps, before you die!</title>
|
14 |
</head>
|
15 |
<body class="ia2amp-body">
|
16 |
<header class="ia2amp-header">
|
17 |
<div class="ia2amp-cover-image">
|
18 |
-
<amp-img class="ia2amp-header-cover-img" src="http://blog.wod.expert/wp-content/uploads/2017/03/wod-break.jpg" width="380" height="240"></amp-img>
|
19 |
</div>
|
20 |
<div class="ia2amp-header-bar">
|
21 |
<div class="ia2amp-header-bar-img-container">
|
22 |
-
<amp-img src="https://fb-s-c-a.akamaihd.net/h-ak-xpa1/v/t39.5687-6/17351511_1229084560538118_5982709905105092608_n.png?_nc_log=1&
|
23 |
</div>
|
24 |
</div>
|
25 |
<div class="ia2amp-spacing after-header-bar before-header-category"></div>
|
@@ -74,11 +74,11 @@
|
|
74 |
<amp-img layout="responsive" src="http://blog.wod.expert/wp-content/uploads/2017/03/muscles-300x255.jpg" width="380" height="240"></amp-img>
|
75 |
</div>
|
76 |
<div class="ia2amp-spacing after-image before-p"></div>
|
77 |
-
<p class="ia2amp-p">Glucose -&
|
78 |
<div class="ia2amp-spacing after-p before-p"></div>
|
79 |
-
<p class="ia2amp-p">Oxygen -&
|
80 |
<div class="ia2amp-spacing after-p before-p"></div>
|
81 |
-
<p class="ia2amp-p">Strong muscle fibers -&
|
82 |
<div class="ia2amp-spacing after-p before-p"></div>
|
83 |
<p class="ia2amp-p">As you exercise during your workout, you will feel your breathing go faster, and this is something you should try to avoid while contracting your muscles, because once you are contracting your muscles without the proper oxygen levels, you start the glycolysis process, which generates lactic acid causing your muscle fatigue.</p>
|
84 |
<div class="ia2amp-spacing after-p before-h2"></div>
|
8 |
<style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style>
|
9 |
</noscript>
|
10 |
<link rel="canonical" href="http://blog.wod.expert/break-your-reps-before-you-die/"/>
|
11 |
+
<style amp-custom>amp-img.ia2amp-header-cover-img {transform: translate(0px, 0px);}html {background-color: rgb(238,238,238);}.ia2amp-header-category {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header-h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header-h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header h3 {font-family: Helvetica Neue;text-align: LEFT;text-transform: uppercase;color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;}.ia2amp-header-bar {background-color: rgb(102,102,102);}.ia2amp-h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-p {font-family: Georgia;text-align: LEFT;text-transform: none;color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;}.ia2amp-article a {font-family: Georgia;text-decoration: underline;color: rgb(0,0,0);}.ia2amp-blockquote {font-family: Georgia;text-align: LEFT;display: BLOCK;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 32px 0 46px;border-top-color: rgb(0,0,0);border-right-color: rgb(0,0,0);border-bottom-color: rgb(0,0,0);border-left-color: rgb(0,0,0);border-width: 0 0 0 2px;border-style: solid;}.ia2amp-pullquote {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-pullquote cite {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-small h1 {font-family: Helvetica Neue Bold;display: INLINE;text-transform: none;background-color: rgb(0,255,255);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-small h2 {font-family: Helvetica Neue;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-medium h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-medium h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-large h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-large h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-extra-large h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-extra-large h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-figcaption cite {font-family: Helvetica Neue;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(191,191,191);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-footer {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}/*Global Styles*/ .ia2amp-header-bar { margin: -5px 0 0 0; height: 55px; font: 0/0 a; } .ia2amp-header-bar:before { content: ' '; display: inline-block; vertical-align: middle; height: 100%; width: 16.4px; } .ia2amp-header-bar-img-container { display: inline-block; vertical-align: middle; } .ia2amp-header-category { font-size: 10px; line-height: 12px; display: block; font-weight: normal; } .ia2amp-header-h1 { font-size: 24px; line-height: 30px; display: block; font-weight: normal; } .ia2amp-header-h2 { font-size: 16px; line-height: 20px; display: block; font-weight: normal; } .ia2amp-header h3 { font-size: 8px; line-height: 12px; display: block; font-weight: normal; } .ia2amp-h1, .ia2amp-h2, .ia2amp-h3 { display: block; font-weight: normal; } .ia2amp-h1 { font-size: 19px; line-height: 23px; } .ia2amp-h2 { font-size: 16px; line-height: 20px; } .ia2amp-p { font-size: 14px; line-height: 20px; display: inline-block; } .ia2amp-p a { margin: 0; } .ia2amp-blockquote { font-size: 14px; line-height: 20px; padding: 0px 13.2px 0px 18.8px; } .ia2amp-spacing { display: block; height: 18.8px; margin: 0 16.4px 0 16.4px; } header figure figcaption { display: none; } .ia2amp-figure { margin: 0; } .ia2amp-op-small h1, .ia2amp-op-small h2 { font-size: 10px; display: block; } .ia2amp-op-medium h1, .ia2amp-op-medium h2 { font-size: 14px; display: block; } .ia2amp-op-large h1, .ia2amp-op-large h2 { font-size: 16px; display: block; } .ia2amp-op-extra-large h1, .ia2amp-op-extra-large h2 { font-size: 23px; display: block; } .ia2amp-figcaption cite { font-size: 8px; display: block; } .ia2amp-op-left { text-align: left; } .ia2amp-op-center { text-align: center; } .ia2amp-op-right { text-align: right; } .ia2amp-figure { position: relative; } figcaption.ia2amp-op-vertical-center { position: absolute; z-index: 1000; } .ia2amp-footer { display: block; font-size: 12px; line-height: 17px; } .ia2amp-footer aside p { margin: 0; } .ia2amp-spacing.after-header-bar.before-header-category { height: 18.8px; } .ia2amp-spacing.after-header-category.before-header-h1, .ia2amp-spacing.after-header-h1.before-header-h2 { height: 13.2px; } .ia2amp-spacing.after-h1.before-h2 { height: 13.2px; } .ia2amp-spacing.after-li.before-li { height: 13.2px; } .ia2amp-spacing.after-footer.before-footer { height: 18.8px; } .ia2amp-spacing.after-header-h1.before-header-author, .ia2amp-spacing.after-header-h2.before-header-author { height: 18.8px; } .ia2amp-spacing.after-header-author.before-header-date { height: 0; } .ia2amp-spacing.after-header-date.before-h1, .ia2amp-spacing.after-header-date.before-h2, .ia2amp-spacing.after-header-date.before-p { height: 26.4px; } .ia2amp-spacing.after-h1.before-p, .ia2amp-spacing.after-h2.before-p, .ia2amp-spacing.after-h3.before-p { height: 18.8px; } .ia2amp-spacing.after-blockquote.before-p { height: 18.8px; } .ia2amp-spacing.after-slideshow, .ia2amp-spacing.before-slideshow, .ia2amp-spacing.after-interactive, .ia2amp-spacing.before-interactive, .ia2amp-spacing.after-image, .ia2amp-spacing.before-image, .ia2amp-spacing.after-figcaption-small, .ia2amp-spacing.after-figcaption-medium, .ia2amp-spacing.after-figcaption-large, .ia2amp-spacing.after-figcaption-extra-large { height: 26.4px; } </style>
|
12 |
<script type="application/ld+json">{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"http://blog.wod.expert/break-your-reps-before-you-die/","headline":"Break your reps, before you die!","datePublished":"2016-05-17T12:47:46+00:00","description":"Having a good strategy to tackle the series in WODs are fundamental to achieve the best result given your particular physical condition. Comparing yourself to the top athletes, or trying to use their strategy probably won\u2019t work well, unless you are a top athlete! By good strategy I mean planing basically how fast you will perform your movements and how you will play your pauses. There is no better person in the world to know you better than yourself.","dateModified":"2017-03-17T16:45:18+00:00","author":{"@type":"Person","name":"\u00c9verton Ros\u00e1rio"},"image":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/03/wod-break.jpg","width":380,"height":240},"publisher":{"@type":"Organization","name":"WOD Expert","logo":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/04/wod-expert-amp-org-logo.png","width":600,"height":60}}}</script>
|
13 |
<title>Break your reps, before you die!</title>
|
14 |
</head>
|
15 |
<body class="ia2amp-body">
|
16 |
<header class="ia2amp-header">
|
17 |
<div class="ia2amp-cover-image">
|
18 |
+
<amp-img class="ia2amp-header-cover-img" src="http://blog.wod.expert/wp-content/uploads/2017/03/wod-break.jpg" width="380" height="240" layout="responsive"></amp-img>
|
19 |
</div>
|
20 |
<div class="ia2amp-header-bar">
|
21 |
<div class="ia2amp-header-bar-img-container">
|
22 |
+
<amp-img src="https://fb-s-c-a.akamaihd.net/h-ak-xpa1/v/t39.5687-6/17351511_1229084560538118_5982709905105092608_n.png?_nc_log=1&oh=c8337650a88e7fdb6d31088a15a7d9d8&oe=599B24B5&__gda__=1502041799_7139cf314c7cdaa52fa44ba26fd253f8" width="223" height="44"></amp-img>
|
23 |
</div>
|
24 |
</div>
|
25 |
<div class="ia2amp-spacing after-header-bar before-header-category"></div>
|
74 |
<amp-img layout="responsive" src="http://blog.wod.expert/wp-content/uploads/2017/03/muscles-300x255.jpg" width="380" height="240"></amp-img>
|
75 |
</div>
|
76 |
<div class="ia2amp-spacing after-image before-p"></div>
|
77 |
+
<p class="ia2amp-p">Glucose -> connected to your nutrition quality and how well you are eating before your workouts</p>
|
78 |
<div class="ia2amp-spacing after-p before-p"></div>
|
79 |
+
<p class="ia2amp-p">Oxygen -> How efficiency your breathing is and how well your heart rate is pumping the oxygen thru your blood.</p>
|
80 |
<div class="ia2amp-spacing after-p before-p"></div>
|
81 |
+
<p class="ia2amp-p">Strong muscle fibers -> That weight shouldn’t be heavier than your max for that movement.</p>
|
82 |
<div class="ia2amp-spacing after-p before-p"></div>
|
83 |
<p class="ia2amp-p">As you exercise during your workout, you will feel your breathing go faster, and this is something you should try to avoid while contracting your muscles, because once you are contracting your muscles without the proper oxygen levels, you start the glycolysis process, which generates lactic acid causing your muscle fatigue.</p>
|
84 |
<div class="ia2amp-spacing after-p before-h2"></div>
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/test3-amp-converted.html
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
<style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style>
|
9 |
</noscript>
|
10 |
<link rel="canonical" href="http://blog.wod.expert/open-2017/"/>
|
11 |
-
<style amp-custom>amp-img.ia2amp-header-cover-img {transform: translate(0px, 0px);}
|
12 |
<script type="application/ld+json">{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"http://blog.wod.expert/open-2017/","headline":"Open 2017","datePublished":"2017-02-24T22:30:40+00:00","description":"\n The\n CrossFit Games\n are coming and the Open is the very first step for anyone try to fight for a spot on the regionals, then on the games! Pretty much almost all other sport modalities have a pre-selected group of athletes, teams or league affiliates. Sometimes the path is simply impossible: Try to get your football team to play on the NFL, it will be simply something near impossible, no matter how good that team is. Of course if your team is not part of the League you simply can\u2019t. Not going into the merits of having a team on NFL, since this is not the point here.\n ","dateModified":"2017-04-05T17:57:54+00:00","author":{"@type":"Person","name":"\u00c9verton Ros\u00e1rio"},"image":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/02/CrossFitGamesLogo-wide.png","width":380,"height":240},"publisher":{"@type":"Organization","name":"WOD Expert","logo":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/04/wod-expert-amp-org-logo.png","width":600,"height":60}}}</script>
|
13 |
<title>Open 2017</title>
|
14 |
<script async custom-element="amp-video" src="https://cdn.ampproject.org/v0/amp-video-0.1.js"></script>
|
@@ -17,13 +17,13 @@
|
|
17 |
<header class="ia2amp-header">
|
18 |
<div class="ia2amp-cover-image">
|
19 |
<figure class="ia2amp-figure">
|
20 |
-
<amp-img class="ia2amp-header-cover-img" src="http://blog.wod.expert/wp-content/uploads/2017/02/CrossFitGamesLogo-wide.png" width="380" height="240"></amp-img>
|
21 |
<figcaption class="ia2amp-figcaption ia2amp-op-small">CrossFit Games 2017 Logo</figcaption>
|
22 |
</figure>
|
23 |
</div>
|
24 |
<div class="ia2amp-header-bar">
|
25 |
<div class="ia2amp-header-bar-img-container">
|
26 |
-
<amp-img src="https://fb-s-c-a.akamaihd.net/h-ak-xpa1/v/t39.5687-6/17351511_1229084560538118_5982709905105092608_n.png?_nc_log=1&
|
27 |
</div>
|
28 |
</div>
|
29 |
<div class="ia2amp-spacing after-header-bar before-header-h1"></div>
|
8 |
<style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style>
|
9 |
</noscript>
|
10 |
<link rel="canonical" href="http://blog.wod.expert/open-2017/"/>
|
11 |
+
<style amp-custom>amp-img.ia2amp-header-cover-img {transform: translate(0px, 0px);}html {background-color: rgb(238,238,238);}.ia2amp-header-category {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header-h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header-h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header h3 {font-family: Helvetica Neue;text-align: LEFT;text-transform: uppercase;color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;}.ia2amp-header-bar {background-color: rgb(102,102,102);}.ia2amp-h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-p {font-family: Georgia;text-align: LEFT;text-transform: none;color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;}.ia2amp-article a {font-family: Georgia;text-decoration: underline;color: rgb(0,0,0);}.ia2amp-blockquote {font-family: Georgia;text-align: LEFT;display: BLOCK;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 32px 0 46px;border-top-color: rgb(0,0,0);border-right-color: rgb(0,0,0);border-bottom-color: rgb(0,0,0);border-left-color: rgb(0,0,0);border-width: 0 0 0 2px;border-style: solid;}.ia2amp-pullquote {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-pullquote cite {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-small h1 {font-family: Helvetica Neue Bold;display: INLINE;text-transform: none;background-color: rgb(0,255,255);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-small h2 {font-family: Helvetica Neue;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-medium h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-medium h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-large h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-large h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-extra-large h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-extra-large h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-figcaption cite {font-family: Helvetica Neue;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(191,191,191);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-footer {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}/*Global Styles*/ .ia2amp-header-bar { margin: -5px 0 0 0; height: 55px; font: 0/0 a; } .ia2amp-header-bar:before { content: ' '; display: inline-block; vertical-align: middle; height: 100%; width: 16.4px; } .ia2amp-header-bar-img-container { display: inline-block; vertical-align: middle; } .ia2amp-header-category { font-size: 10px; line-height: 12px; display: block; font-weight: normal; } .ia2amp-header-h1 { font-size: 24px; line-height: 30px; display: block; font-weight: normal; } .ia2amp-header-h2 { font-size: 16px; line-height: 20px; display: block; font-weight: normal; } .ia2amp-header h3 { font-size: 8px; line-height: 12px; display: block; font-weight: normal; } .ia2amp-h1, .ia2amp-h2, .ia2amp-h3 { display: block; font-weight: normal; } .ia2amp-h1 { font-size: 19px; line-height: 23px; } .ia2amp-h2 { font-size: 16px; line-height: 20px; } .ia2amp-p { font-size: 14px; line-height: 20px; display: inline-block; } .ia2amp-p a { margin: 0; } .ia2amp-blockquote { font-size: 14px; line-height: 20px; padding: 0px 13.2px 0px 18.8px; } .ia2amp-spacing { display: block; height: 18.8px; margin: 0 16.4px 0 16.4px; } header figure figcaption { display: none; } .ia2amp-figure { margin: 0; } .ia2amp-op-small h1, .ia2amp-op-small h2 { font-size: 10px; display: block; } .ia2amp-op-medium h1, .ia2amp-op-medium h2 { font-size: 14px; display: block; } .ia2amp-op-large h1, .ia2amp-op-large h2 { font-size: 16px; display: block; } .ia2amp-op-extra-large h1, .ia2amp-op-extra-large h2 { font-size: 23px; display: block; } .ia2amp-figcaption cite { font-size: 8px; display: block; } .ia2amp-op-left { text-align: left; } .ia2amp-op-center { text-align: center; } .ia2amp-op-right { text-align: right; } .ia2amp-figure { position: relative; } figcaption.ia2amp-op-vertical-center { position: absolute; z-index: 1000; } .ia2amp-footer { display: block; font-size: 12px; line-height: 17px; } .ia2amp-footer aside p { margin: 0; } .ia2amp-spacing.after-header-bar.before-header-category { height: 18.8px; } .ia2amp-spacing.after-header-category.before-header-h1, .ia2amp-spacing.after-header-h1.before-header-h2 { height: 13.2px; } .ia2amp-spacing.after-h1.before-h2 { height: 13.2px; } .ia2amp-spacing.after-li.before-li { height: 13.2px; } .ia2amp-spacing.after-footer.before-footer { height: 18.8px; } .ia2amp-spacing.after-header-h1.before-header-author, .ia2amp-spacing.after-header-h2.before-header-author { height: 18.8px; } .ia2amp-spacing.after-header-author.before-header-date { height: 0; } .ia2amp-spacing.after-header-date.before-h1, .ia2amp-spacing.after-header-date.before-h2, .ia2amp-spacing.after-header-date.before-p { height: 26.4px; } .ia2amp-spacing.after-h1.before-p, .ia2amp-spacing.after-h2.before-p, .ia2amp-spacing.after-h3.before-p { height: 18.8px; } .ia2amp-spacing.after-blockquote.before-p { height: 18.8px; } .ia2amp-spacing.after-slideshow, .ia2amp-spacing.before-slideshow, .ia2amp-spacing.after-interactive, .ia2amp-spacing.before-interactive, .ia2amp-spacing.after-image, .ia2amp-spacing.before-image, .ia2amp-spacing.after-figcaption-small, .ia2amp-spacing.after-figcaption-medium, .ia2amp-spacing.after-figcaption-large, .ia2amp-spacing.after-figcaption-extra-large { height: 26.4px; } </style>
|
12 |
<script type="application/ld+json">{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"http://blog.wod.expert/open-2017/","headline":"Open 2017","datePublished":"2017-02-24T22:30:40+00:00","description":"\n The\n CrossFit Games\n are coming and the Open is the very first step for anyone try to fight for a spot on the regionals, then on the games! Pretty much almost all other sport modalities have a pre-selected group of athletes, teams or league affiliates. Sometimes the path is simply impossible: Try to get your football team to play on the NFL, it will be simply something near impossible, no matter how good that team is. Of course if your team is not part of the League you simply can\u2019t. Not going into the merits of having a team on NFL, since this is not the point here.\n ","dateModified":"2017-04-05T17:57:54+00:00","author":{"@type":"Person","name":"\u00c9verton Ros\u00e1rio"},"image":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/02/CrossFitGamesLogo-wide.png","width":380,"height":240},"publisher":{"@type":"Organization","name":"WOD Expert","logo":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/04/wod-expert-amp-org-logo.png","width":600,"height":60}}}</script>
|
13 |
<title>Open 2017</title>
|
14 |
<script async custom-element="amp-video" src="https://cdn.ampproject.org/v0/amp-video-0.1.js"></script>
|
17 |
<header class="ia2amp-header">
|
18 |
<div class="ia2amp-cover-image">
|
19 |
<figure class="ia2amp-figure">
|
20 |
+
<amp-img class="ia2amp-header-cover-img" src="http://blog.wod.expert/wp-content/uploads/2017/02/CrossFitGamesLogo-wide.png" width="380" height="240" layout="responsive"></amp-img>
|
21 |
<figcaption class="ia2amp-figcaption ia2amp-op-small">CrossFit Games 2017 Logo</figcaption>
|
22 |
</figure>
|
23 |
</div>
|
24 |
<div class="ia2amp-header-bar">
|
25 |
<div class="ia2amp-header-bar-img-container">
|
26 |
+
<amp-img src="https://fb-s-c-a.akamaihd.net/h-ak-xpa1/v/t39.5687-6/17351511_1229084560538118_5982709905105092608_n.png?_nc_log=1&oh=c8337650a88e7fdb6d31088a15a7d9d8&oe=599B24B5&__gda__=1502041799_7139cf314c7cdaa52fa44ba26fd253f8" width="223" height="44"></amp-img>
|
27 |
</div>
|
28 |
</div>
|
29 |
<div class="ia2amp-spacing after-header-bar before-header-h1"></div>
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/test4-amp-converted.html
CHANGED
@@ -8,18 +8,18 @@
|
|
8 |
<style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style>
|
9 |
</noscript>
|
10 |
<link rel="canonical" href="http://blog.wod.expert/du-damm-u-double-unders/"/>
|
11 |
-
<style amp-custom>amp-img.ia2amp-header-cover-img {transform: translate(0px, 0px);}
|
12 |
<script type="application/ld+json">{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"http://blog.wod.expert/du-damm-u-double-unders/","headline":"DU \u2013 Damm U (Double Unders)!","datePublished":"2016-05-15T20:57:00+00:00","description":"Damm you Double Unders (DU)! I guess lots of people will agree with the DAMM part\u2026 But why the Double Unders are so problematic since it is just a simple jumping rope? Well, maybe not that simple! \ud83d\ude09","dateModified":"2017-03-17T15:40:25+00:00","author":{"@type":"Person","name":"\u00c9verton Ros\u00e1rio"},"image":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2016/05/jumprope.jpg","width":380,"height":240},"publisher":{"@type":"Organization","name":"WOD Expert","logo":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/04/wod-expert-amp-org-logo.png","width":600,"height":60}}}</script>
|
13 |
<title>DU – Damm U (Double Unders)!</title>
|
14 |
</head>
|
15 |
<body class="ia2amp-body">
|
16 |
<header class="ia2amp-header">
|
17 |
<div class="ia2amp-cover-image">
|
18 |
-
<amp-img class="ia2amp-header-cover-img" src="http://blog.wod.expert/wp-content/uploads/2016/05/jumprope.jpg" width="380" height="240"></amp-img>
|
19 |
</div>
|
20 |
<div class="ia2amp-header-bar">
|
21 |
<div class="ia2amp-header-bar-img-container">
|
22 |
-
<amp-img src="https://fb-s-c-a.akamaihd.net/h-ak-xpa1/v/t39.5687-6/17351511_1229084560538118_5982709905105092608_n.png?_nc_log=1&
|
23 |
</div>
|
24 |
</div>
|
25 |
<div class="ia2amp-spacing after-header-bar before-header-category"></div>
|
@@ -50,6 +50,7 @@
|
|
50 |
is a popular exercise done on a
|
51 |
<a href="http://athletics.wikia.com/wiki/Jump_rope">jump rope</a>
|
52 |
in which the rope makes two passes per jump instead of just one.”
|
|
|
53 |
<a href="http://athletics.wikia.com/wiki/Double_Unders">Athlepedia</a>
|
54 |
</blockquote>
|
55 |
<div class="ia2amp-spacing after-blockquote before-p"></div>
|
8 |
<style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style>
|
9 |
</noscript>
|
10 |
<link rel="canonical" href="http://blog.wod.expert/du-damm-u-double-unders/"/>
|
11 |
+
<style amp-custom>amp-img.ia2amp-header-cover-img {transform: translate(0px, 0px);}html {background-color: rgb(238,238,238);}.ia2amp-header-category {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header-h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header-h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header h3 {font-family: Helvetica Neue;text-align: LEFT;text-transform: uppercase;color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;}.ia2amp-header-bar {background-color: rgb(102,102,102);}.ia2amp-h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-p {font-family: Georgia;text-align: LEFT;text-transform: none;color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;}.ia2amp-article a {font-family: Georgia;text-decoration: underline;color: rgb(0,0,0);}.ia2amp-blockquote {font-family: Georgia;text-align: LEFT;display: BLOCK;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 32px 0 46px;border-top-color: rgb(0,0,0);border-right-color: rgb(0,0,0);border-bottom-color: rgb(0,0,0);border-left-color: rgb(0,0,0);border-width: 0 0 0 2px;border-style: solid;}.ia2amp-pullquote {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-pullquote cite {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-small h1 {font-family: Helvetica Neue Bold;display: INLINE;text-transform: none;background-color: rgb(0,255,255);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-small h2 {font-family: Helvetica Neue;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-medium h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-medium h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-large h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-large h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-extra-large h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-extra-large h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-figcaption cite {font-family: Helvetica Neue;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(191,191,191);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-footer {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}/*Global Styles*/ .ia2amp-header-bar { margin: -5px 0 0 0; height: 55px; font: 0/0 a; } .ia2amp-header-bar:before { content: ' '; display: inline-block; vertical-align: middle; height: 100%; width: 16.4px; } .ia2amp-header-bar-img-container { display: inline-block; vertical-align: middle; } .ia2amp-header-category { font-size: 10px; line-height: 12px; display: block; font-weight: normal; } .ia2amp-header-h1 { font-size: 24px; line-height: 30px; display: block; font-weight: normal; } .ia2amp-header-h2 { font-size: 16px; line-height: 20px; display: block; font-weight: normal; } .ia2amp-header h3 { font-size: 8px; line-height: 12px; display: block; font-weight: normal; } .ia2amp-h1, .ia2amp-h2, .ia2amp-h3 { display: block; font-weight: normal; } .ia2amp-h1 { font-size: 19px; line-height: 23px; } .ia2amp-h2 { font-size: 16px; line-height: 20px; } .ia2amp-p { font-size: 14px; line-height: 20px; display: inline-block; } .ia2amp-p a { margin: 0; } .ia2amp-blockquote { font-size: 14px; line-height: 20px; padding: 0px 13.2px 0px 18.8px; } .ia2amp-spacing { display: block; height: 18.8px; margin: 0 16.4px 0 16.4px; } header figure figcaption { display: none; } .ia2amp-figure { margin: 0; } .ia2amp-op-small h1, .ia2amp-op-small h2 { font-size: 10px; display: block; } .ia2amp-op-medium h1, .ia2amp-op-medium h2 { font-size: 14px; display: block; } .ia2amp-op-large h1, .ia2amp-op-large h2 { font-size: 16px; display: block; } .ia2amp-op-extra-large h1, .ia2amp-op-extra-large h2 { font-size: 23px; display: block; } .ia2amp-figcaption cite { font-size: 8px; display: block; } .ia2amp-op-left { text-align: left; } .ia2amp-op-center { text-align: center; } .ia2amp-op-right { text-align: right; } .ia2amp-figure { position: relative; } figcaption.ia2amp-op-vertical-center { position: absolute; z-index: 1000; } .ia2amp-footer { display: block; font-size: 12px; line-height: 17px; } .ia2amp-footer aside p { margin: 0; } .ia2amp-spacing.after-header-bar.before-header-category { height: 18.8px; } .ia2amp-spacing.after-header-category.before-header-h1, .ia2amp-spacing.after-header-h1.before-header-h2 { height: 13.2px; } .ia2amp-spacing.after-h1.before-h2 { height: 13.2px; } .ia2amp-spacing.after-li.before-li { height: 13.2px; } .ia2amp-spacing.after-footer.before-footer { height: 18.8px; } .ia2amp-spacing.after-header-h1.before-header-author, .ia2amp-spacing.after-header-h2.before-header-author { height: 18.8px; } .ia2amp-spacing.after-header-author.before-header-date { height: 0; } .ia2amp-spacing.after-header-date.before-h1, .ia2amp-spacing.after-header-date.before-h2, .ia2amp-spacing.after-header-date.before-p { height: 26.4px; } .ia2amp-spacing.after-h1.before-p, .ia2amp-spacing.after-h2.before-p, .ia2amp-spacing.after-h3.before-p { height: 18.8px; } .ia2amp-spacing.after-blockquote.before-p { height: 18.8px; } .ia2amp-spacing.after-slideshow, .ia2amp-spacing.before-slideshow, .ia2amp-spacing.after-interactive, .ia2amp-spacing.before-interactive, .ia2amp-spacing.after-image, .ia2amp-spacing.before-image, .ia2amp-spacing.after-figcaption-small, .ia2amp-spacing.after-figcaption-medium, .ia2amp-spacing.after-figcaption-large, .ia2amp-spacing.after-figcaption-extra-large { height: 26.4px; } </style>
|
12 |
<script type="application/ld+json">{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"http://blog.wod.expert/du-damm-u-double-unders/","headline":"DU \u2013 Damm U (Double Unders)!","datePublished":"2016-05-15T20:57:00+00:00","description":"Damm you Double Unders (DU)! I guess lots of people will agree with the DAMM part\u2026 But why the Double Unders are so problematic since it is just a simple jumping rope? Well, maybe not that simple! \ud83d\ude09","dateModified":"2017-03-17T15:40:25+00:00","author":{"@type":"Person","name":"\u00c9verton Ros\u00e1rio"},"image":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2016/05/jumprope.jpg","width":380,"height":240},"publisher":{"@type":"Organization","name":"WOD Expert","logo":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/04/wod-expert-amp-org-logo.png","width":600,"height":60}}}</script>
|
13 |
<title>DU – Damm U (Double Unders)!</title>
|
14 |
</head>
|
15 |
<body class="ia2amp-body">
|
16 |
<header class="ia2amp-header">
|
17 |
<div class="ia2amp-cover-image">
|
18 |
+
<amp-img class="ia2amp-header-cover-img" src="http://blog.wod.expert/wp-content/uploads/2016/05/jumprope.jpg" width="380" height="240" layout="responsive"></amp-img>
|
19 |
</div>
|
20 |
<div class="ia2amp-header-bar">
|
21 |
<div class="ia2amp-header-bar-img-container">
|
22 |
+
<amp-img src="https://fb-s-c-a.akamaihd.net/h-ak-xpa1/v/t39.5687-6/17351511_1229084560538118_5982709905105092608_n.png?_nc_log=1&oh=c8337650a88e7fdb6d31088a15a7d9d8&oe=599B24B5&__gda__=1502041799_7139cf314c7cdaa52fa44ba26fd253f8" width="223" height="44"></amp-img>
|
23 |
</div>
|
24 |
</div>
|
25 |
<div class="ia2amp-spacing after-header-bar before-header-category"></div>
|
50 |
is a popular exercise done on a
|
51 |
<a href="http://athletics.wikia.com/wiki/Jump_rope">jump rope</a>
|
52 |
in which the rope makes two passes per jump instead of just one.”
|
53 |
+
|
54 |
<a href="http://athletics.wikia.com/wiki/Double_Unders">Athlepedia</a>
|
55 |
</blockquote>
|
56 |
<div class="ia2amp-spacing after-blockquote before-p"></div>
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/test5-amp-converted.html
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
<style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style>
|
9 |
</noscript>
|
10 |
<link rel="canonical" href="http://blog.wod.expert/wall-ball-or-ball-shot/"/>
|
11 |
-
<style amp-custom>amp-img.ia2amp-header-cover-img {transform: translate(0px, 0px);}
|
12 |
<script type="application/ld+json">{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"http://blog.wod.expert/wall-ball-or-ball-shot/","headline":"Wall Ball or Ball Shot?","datePublished":"2016-05-20T13:48:38+00:00","description":"\n Both expressions seems correct and in common shares the requisite of\n breaking parallel line\n while squatting. Just for correctness, the Wall Ball Shot is the best title to use.\n ","dateModified":"2017-03-17T15:38:31+00:00","author":{"@type":"Person","name":"\u00c9verton Ros\u00e1rio"},"image":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/03/rich-wallball.jpg","width":380,"height":240},"publisher":{"@type":"Organization","name":"WOD Expert","logo":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/04/wod-expert-amp-org-logo.png","width":600,"height":60}}}</script>
|
13 |
<title>Wall Ball or Ball Shot?</title>
|
14 |
<script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script>
|
@@ -17,13 +17,13 @@
|
|
17 |
<header class="ia2amp-header">
|
18 |
<div class="ia2amp-cover-image">
|
19 |
<figure class="ia2amp-figure">
|
20 |
-
<amp-img class="ia2amp-header-cover-img" src="http://blog.wod.expert/wp-content/uploads/2017/03/rich-wallball.jpg" width="380" height="240"></amp-img>
|
21 |
<figcaption class="ia2amp-figcaption ia2amp-op-small">Rich Froning at Wall Ball Shot</figcaption>
|
22 |
</figure>
|
23 |
</div>
|
24 |
<div class="ia2amp-header-bar">
|
25 |
<div class="ia2amp-header-bar-img-container">
|
26 |
-
<amp-img src="https://fb-s-c-a.akamaihd.net/h-ak-xpa1/v/t39.5687-6/17351511_1229084560538118_5982709905105092608_n.png?_nc_log=1&
|
27 |
</div>
|
28 |
</div>
|
29 |
<div class="ia2amp-spacing after-header-bar before-header-category"></div>
|
8 |
<style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style>
|
9 |
</noscript>
|
10 |
<link rel="canonical" href="http://blog.wod.expert/wall-ball-or-ball-shot/"/>
|
11 |
+
<style amp-custom>amp-img.ia2amp-header-cover-img {transform: translate(0px, 0px);}html {background-color: rgb(238,238,238);}.ia2amp-header-category {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header-h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header-h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header h3 {font-family: Helvetica Neue;text-align: LEFT;text-transform: uppercase;color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;}.ia2amp-header-bar {background-color: rgb(102,102,102);}.ia2amp-h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-p {font-family: Georgia;text-align: LEFT;text-transform: none;color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;}.ia2amp-article a {font-family: Georgia;text-decoration: underline;color: rgb(0,0,0);}.ia2amp-blockquote {font-family: Georgia;text-align: LEFT;display: BLOCK;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 32px 0 46px;border-top-color: rgb(0,0,0);border-right-color: rgb(0,0,0);border-bottom-color: rgb(0,0,0);border-left-color: rgb(0,0,0);border-width: 0 0 0 2px;border-style: solid;}.ia2amp-pullquote {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-pullquote cite {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-small h1 {font-family: Helvetica Neue Bold;display: INLINE;text-transform: none;background-color: rgb(0,255,255);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-small h2 {font-family: Helvetica Neue;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-medium h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-medium h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-large h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-large h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-extra-large h1 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-extra-large h2 {font-family: Georgia;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-figcaption cite {font-family: Helvetica Neue;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(191,191,191);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-footer {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}/*Global Styles*/ .ia2amp-header-bar { margin: -5px 0 0 0; height: 55px; font: 0/0 a; } .ia2amp-header-bar:before { content: ' '; display: inline-block; vertical-align: middle; height: 100%; width: 16.4px; } .ia2amp-header-bar-img-container { display: inline-block; vertical-align: middle; } .ia2amp-header-category { font-size: 10px; line-height: 12px; display: block; font-weight: normal; } .ia2amp-header-h1 { font-size: 24px; line-height: 30px; display: block; font-weight: normal; } .ia2amp-header-h2 { font-size: 16px; line-height: 20px; display: block; font-weight: normal; } .ia2amp-header h3 { font-size: 8px; line-height: 12px; display: block; font-weight: normal; } .ia2amp-h1, .ia2amp-h2, .ia2amp-h3 { display: block; font-weight: normal; } .ia2amp-h1 { font-size: 19px; line-height: 23px; } .ia2amp-h2 { font-size: 16px; line-height: 20px; } .ia2amp-p { font-size: 14px; line-height: 20px; display: inline-block; } .ia2amp-p a { margin: 0; } .ia2amp-blockquote { font-size: 14px; line-height: 20px; padding: 0px 13.2px 0px 18.8px; } .ia2amp-spacing { display: block; height: 18.8px; margin: 0 16.4px 0 16.4px; } header figure figcaption { display: none; } .ia2amp-figure { margin: 0; } .ia2amp-op-small h1, .ia2amp-op-small h2 { font-size: 10px; display: block; } .ia2amp-op-medium h1, .ia2amp-op-medium h2 { font-size: 14px; display: block; } .ia2amp-op-large h1, .ia2amp-op-large h2 { font-size: 16px; display: block; } .ia2amp-op-extra-large h1, .ia2amp-op-extra-large h2 { font-size: 23px; display: block; } .ia2amp-figcaption cite { font-size: 8px; display: block; } .ia2amp-op-left { text-align: left; } .ia2amp-op-center { text-align: center; } .ia2amp-op-right { text-align: right; } .ia2amp-figure { position: relative; } figcaption.ia2amp-op-vertical-center { position: absolute; z-index: 1000; } .ia2amp-footer { display: block; font-size: 12px; line-height: 17px; } .ia2amp-footer aside p { margin: 0; } .ia2amp-spacing.after-header-bar.before-header-category { height: 18.8px; } .ia2amp-spacing.after-header-category.before-header-h1, .ia2amp-spacing.after-header-h1.before-header-h2 { height: 13.2px; } .ia2amp-spacing.after-h1.before-h2 { height: 13.2px; } .ia2amp-spacing.after-li.before-li { height: 13.2px; } .ia2amp-spacing.after-footer.before-footer { height: 18.8px; } .ia2amp-spacing.after-header-h1.before-header-author, .ia2amp-spacing.after-header-h2.before-header-author { height: 18.8px; } .ia2amp-spacing.after-header-author.before-header-date { height: 0; } .ia2amp-spacing.after-header-date.before-h1, .ia2amp-spacing.after-header-date.before-h2, .ia2amp-spacing.after-header-date.before-p { height: 26.4px; } .ia2amp-spacing.after-h1.before-p, .ia2amp-spacing.after-h2.before-p, .ia2amp-spacing.after-h3.before-p { height: 18.8px; } .ia2amp-spacing.after-blockquote.before-p { height: 18.8px; } .ia2amp-spacing.after-slideshow, .ia2amp-spacing.before-slideshow, .ia2amp-spacing.after-interactive, .ia2amp-spacing.before-interactive, .ia2amp-spacing.after-image, .ia2amp-spacing.before-image, .ia2amp-spacing.after-figcaption-small, .ia2amp-spacing.after-figcaption-medium, .ia2amp-spacing.after-figcaption-large, .ia2amp-spacing.after-figcaption-extra-large { height: 26.4px; } </style>
|
12 |
<script type="application/ld+json">{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"http://blog.wod.expert/wall-ball-or-ball-shot/","headline":"Wall Ball or Ball Shot?","datePublished":"2016-05-20T13:48:38+00:00","description":"\n Both expressions seems correct and in common shares the requisite of\n breaking parallel line\n while squatting. Just for correctness, the Wall Ball Shot is the best title to use.\n ","dateModified":"2017-03-17T15:38:31+00:00","author":{"@type":"Person","name":"\u00c9verton Ros\u00e1rio"},"image":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/03/rich-wallball.jpg","width":380,"height":240},"publisher":{"@type":"Organization","name":"WOD Expert","logo":{"@type":"ImageObject","url":"http://blog.wod.expert/wp-content/uploads/2017/04/wod-expert-amp-org-logo.png","width":600,"height":60}}}</script>
|
13 |
<title>Wall Ball or Ball Shot?</title>
|
14 |
<script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script>
|
17 |
<header class="ia2amp-header">
|
18 |
<div class="ia2amp-cover-image">
|
19 |
<figure class="ia2amp-figure">
|
20 |
+
<amp-img class="ia2amp-header-cover-img" src="http://blog.wod.expert/wp-content/uploads/2017/03/rich-wallball.jpg" width="380" height="240" layout="responsive"></amp-img>
|
21 |
<figcaption class="ia2amp-figcaption ia2amp-op-small">Rich Froning at Wall Ball Shot</figcaption>
|
22 |
</figure>
|
23 |
</div>
|
24 |
<div class="ia2amp-header-bar">
|
25 |
<div class="ia2amp-header-bar-img-container">
|
26 |
+
<amp-img src="https://fb-s-c-a.akamaihd.net/h-ak-xpa1/v/t39.5687-6/17351511_1229084560538118_5982709905105092608_n.png?_nc_log=1&oh=c8337650a88e7fdb6d31088a15a7d9d8&oe=599B24B5&__gda__=1502041799_7139cf314c7cdaa52fa44ba26fd253f8" width="223" height="44"></amp-img>
|
27 |
</div>
|
28 |
</div>
|
29 |
<div class="ia2amp-spacing after-header-bar before-header-category"></div>
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/articles/tutorial-amp-converted.html
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
<style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style>
|
9 |
</noscript>
|
10 |
<link rel="canonical" href="http://blog.wod.expert/example1"/>
|
11 |
-
<style amp-custom>amp-img.ia2amp-header-cover-img {transform: translate(0px, 0px);}
|
12 |
<script type="application/ld+json">{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"http://blog.wod.expert/example1","headline":" Instant Articles ","datePublished":"2016-02-04T08:00:00-08:00","description":"Yes, it\u2019s true. Instant Articles open on mobile devices really quickly.","dateModified":"2016-02-04T08:00:00-08:00","author":{"@type":"Person","name":"\n Instant Articles Team\n "},"image":{"@type":"ImageObject","url":"https://s3.amazonaws.com/instantarticles/examples/fb_beach_flower.jpg","width":380,"height":240}}</script>
|
13 |
<title> Instant Articles </title>
|
14 |
<script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script>
|
@@ -18,7 +18,7 @@
|
|
18 |
<body class="ia2amp-body">
|
19 |
<header class="ia2amp-header">
|
20 |
<div class="ia2amp-cover-image">
|
21 |
-
<amp-img class="ia2amp-header-cover-img" src="https://s3.amazonaws.com/instantarticles/examples/fb_beach_flower.jpg" width="380" height="240"></amp-img>
|
22 |
</div>
|
23 |
<div class="ia2amp-header-bar"></div>
|
24 |
<div class="ia2amp-spacing after-header-bar before-header-category"></div>
|
@@ -37,222 +37,78 @@
|
|
37 |
<h3 class="ia2amp-header-date">February 04, 2016</h3>
|
38 |
<div class="ia2amp-spacing after-header-date before-p"></div>
|
39 |
</header>
|
40 |
-
<article class="ia2amp-article">
|
41 |
-
|
42 |
-
<div class="ia2amp-spacing after-p before-p"></div>
|
43 |
-
<p class="ia2amp-p">But that’s just the beginning of it. Instant Articles are buttery smooth and addictive. Once you’ve read a few, you’ll never want to go back.</p>
|
44 |
-
<div class="ia2amp-spacing after-p before-p"></div>
|
45 |
-
<p class="ia2amp-p">The Facebook-native format is packed with innovative ways to tell deeply engaging, interactive stories. Thanks to the powerful, built-in media features and customizable typographic elements, Instant Articles gives you awesome new editorial tools to use while delivering a decidedly superior experience for your readers.</p>
|
46 |
-
<div class="ia2amp-spacing after-p before-p"></div>
|
47 |
-
<p class="ia2amp-p">More than half of Instant Articles readers scroll 90% of the way through their articles, while, historically, 38% of web readers haven’t made it past the first line of other online media.</p>
|
48 |
-
<div class="ia2amp-spacing after-p before-p"></div>
|
49 |
-
<p class="ia2amp-p">This article gives you a quick highlight tour of Instant Articles features and shows you how to make magic with the format. You’ll be happy to find that Instant Articles are not only delightful but surprisingly easy to create.</p>
|
50 |
-
<div class="ia2amp-spacing after-p before-h1"></div>
|
51 |
-
<h1 class="ia2amp-h1"> Photography </h1>
|
52 |
-
<div class="ia2amp-spacing after-h1 before-p"></div>
|
53 |
-
<p class="ia2amp-p">All photographs are interactive by default. When tapped an image will expand to fill the screen, then readers can tilt the phone back and forth to explore the margins.</p>
|
54 |
-
<div class="ia2amp-spacing after-p"></div>
|
55 |
-
<div class="ia2amp-image">
|
56 |
-
<figure class="ia2amp-figure">
|
57 |
-
<amp-img layout="responsive" src="https://s3.amazonaws.com/instantarticles/examples/fb_rails.jpg" width="380" height="240"></amp-img>
|
58 |
-
<figcaption class="ia2amp-figcaption ia2amp-op-small"><h1>Photograph Example</h1>
|
59 |
Tap this image to make it expand. Tilt the phone right and left and see what happens.
|
60 |
|
61 |
-
<cite>Eduardo Tardin/Facebook</cite></figcaption>
|
62 |
-
|
63 |
-
</div>
|
64 |
-
<div class="ia2amp-spacing before-p"></div>
|
65 |
-
<p class="ia2amp-p">To return to the article, tap the image again. The interactive mode works best with high-definition photos containing rich visual information. For low-resolution media, we recommend using the non-interactive setting so that it will remain in-line in the correct aspect ratio and your readers won’t tap into a mushy, pixelated experience.</p>
|
66 |
-
<div class="ia2amp-spacing after-p before-h2"></div>
|
67 |
-
<h2 class="ia2amp-h2">Social Feedback</h2>
|
68 |
-
<div class="ia2amp-spacing after-h2 before-p"></div>
|
69 |
-
<p class="ia2amp-p">You can add native Facebook Likes and Comments buttons to images, giving readers extra opportunities to engage with individual elements in your stories. This feature currently works for photographs and videos.</p>
|
70 |
-
<div class="ia2amp-spacing after-p before-h2"></div>
|
71 |
-
<h2 class="ia2amp-h2">Slideshow</h2>
|
72 |
-
<div class="ia2amp-spacing after-h2 before-p"></div>
|
73 |
-
<p class="ia2amp-p">You can also group collections of images into slideshows that scroll horizontally.</p>
|
74 |
-
<div class="ia2amp-spacing after-p before-slideshow"></div>
|
75 |
-
<div class="ia2amp-slideshow">
|
76 |
-
<figure class="ia2amp-figure">
|
77 |
-
<amp-carousel width="380" height="240">
|
78 |
-
<div class="ia2amp-slideshow-image">
|
79 |
-
<figure class="ia2amp-figure">
|
80 |
-
<amp-img src="https://s3.amazonaws.com/instantarticles/examples/fb_beach_flower.jpg" width="380" height="240"></amp-img>
|
81 |
-
<figcaption class="ia2amp-figcaption ia2amp-op-small"><h1> 1/5
|
82 |
This caption becomes visible once you enter the slideshow by tapping the first image.
|
83 |
Eduardo Tardin/Facebook
|
84 |
-
</h1></figcaption>
|
85 |
-
|
86 |
-
</div>
|
87 |
-
<div class="ia2amp-slideshow-image">
|
88 |
-
<figure class="ia2amp-figure">
|
89 |
-
<amp-img src="https://s3.amazonaws.com/instantarticles/examples/fb_rocks.jpg" width="380" height="240"></amp-img>
|
90 |
-
<figcaption class="ia2amp-figcaption ia2amp-op-small"><h1> 2/5
|
91 |
Each photo in a slideshow can have its own caption.
|
92 |
Eduardo Tardin/Facebook
|
93 |
-
</h1></figcaption>
|
94 |
-
|
95 |
-
</div>
|
96 |
-
<div class="ia2amp-slideshow-image">
|
97 |
-
<figure class="ia2amp-figure">
|
98 |
-
<amp-img src="https://s3.amazonaws.com/instantarticles/examples/fb_sunset.jpg" width="380" height="240"></amp-img>
|
99 |
-
<figcaption class="ia2amp-figcaption ia2amp-op-small"><h1> 3/5
|
100 |
This is the third photo of the slideshow.
|
101 |
Eduardo Tardin/Facebook
|
102 |
-
</h1></figcaption>
|
103 |
-
|
104 |
-
</div>
|
105 |
-
<div class="ia2amp-slideshow-image">
|
106 |
-
<figure class="ia2amp-figure">
|
107 |
-
<amp-img src="https://s3.amazonaws.com/instantarticles/examples/fb_cave_ocean.jpg" width="380" height="240"></amp-img>
|
108 |
-
<figcaption class="ia2amp-figcaption ia2amp-op-small"><h1> 4/5
|
109 |
The fourth photo of the slideshow.
|
110 |
Eduardo Tardin/Facebook
|
111 |
-
</h1></figcaption>
|
112 |
-
|
113 |
-
</div>
|
114 |
-
<div class="ia2amp-slideshow-image">
|
115 |
-
<figure class="ia2amp-figure">
|
116 |
-
<amp-img src="https://s3.amazonaws.com/instantarticles/examples/fb_boat.jpg" width="380" height="240"></amp-img>
|
117 |
-
<figcaption class="ia2amp-figcaption ia2amp-op-small"><h1> 5/5
|
118 |
The fifth photo of the slideshow.
|
119 |
Eduardo Tardin/Facebook
|
120 |
-
</h1></figcaption>
|
121 |
-
|
122 |
-
</div>
|
123 |
-
</amp-carousel>
|
124 |
-
<figcaption class="ia2amp-figcaption ia2amp-op-small"><h1>Slideshow Example</h1>
|
125 |
The slideshow caption is visible in-line in the main body of the story. You can also add individual captions for each image in the gallery, which become visible only after entering the slideshow. Tap on the first image to open it.
|
126 |
-
</figcaption>
|
127 |
-
|
128 |
-
</div>
|
129 |
-
<div class="ia2amp-spacing after-slideshow"></div>
|
130 |
-
<div class="ia2amp-video">
|
131 |
-
<figure class="ia2amp-figure">
|
132 |
-
<amp-video src="https://s3.amazonaws.com/instantarticles/examples/fb_movie_pt.mov" width="380" height="240"></amp-video>
|
133 |
-
<figcaption class="ia2amp-figcaption ia2amp-op-small"><h1> 6+ </h1>
|
134 |
Adendum and mixed video + image in a slideshow.
|
135 |
|
136 |
-
<cite>Instant Articles/Facebook</cite></figcaption>
|
137 |
-
|
138 |
-
</div>
|
139 |
-
<div class="ia2amp-spacing before-h1"></div>
|
140 |
-
<h1 class="ia2amp-h1">Video</h1>
|
141 |
-
<div class="ia2amp-spacing after-h1 before-p"></div>
|
142 |
-
<p class="ia2amp-p">Native videos in Instant Articles play automatically, by default, as soon as they scroll into view on the reader’s screen—a powerful way to make the page come to life. You have many options for presenting videos. Here’s an interactive one with play controls. </p>
|
143 |
-
<div class="ia2amp-spacing after-p"></div>
|
144 |
-
<div class="ia2amp-video">
|
145 |
-
<figure class="ia2amp-figure">
|
146 |
-
<amp-video src="https://s3.amazonaws.com/instantarticles/examples/fb_hiperlapse_sp.mp4" width="380" height="240"></amp-video>
|
147 |
-
<figcaption class="ia2amp-figcaption ia2amp-op-small"><h1><b>2:57</b> | Interactive Video Example</h1>
|
148 |
When this video first scrolls into sight, it appears in-line in its correct aspect ratio and plays automatically with the volume off. By tapping it, the video expands to fill the screen and can be turned to view horizontally. The soundtrack becomes audible, and play controls, with scrubber, are accessible.
|
149 |
-
</figcaption>
|
150 |
-
|
151 |
-
</div>
|
152 |
-
<div class="ia2amp-spacing before-p"></div>
|
153 |
-
<p class="ia2amp-p"> To hide play controls, tap the video again; the pause/play icons and scrubber can be toggled on and off this way. You can also rotate the phone sideways while the video is in-line to view it in landscape mode.</p>
|
154 |
-
<div class="ia2amp-spacing after-p before-p"></div>
|
155 |
-
<p class="ia2amp-p">Alternately, try using a short video to add color and mood to a story. Disable the play controls and set it to loop with a cross-fade.</p>
|
156 |
-
<div class="ia2amp-spacing after-p"></div>
|
157 |
-
<div class="ia2amp-video">
|
158 |
-
<figure class="ia2amp-figure">
|
159 |
-
<amp-video src="https://s3.amazonaws.com/instantarticles/examples/fb_hiperlapse_sp.mp4" width="380" height="240"></amp-video>
|
160 |
-
<figcaption class="ia2amp-figcaption ia2amp-op-small"><h1>Ambient Video Example</h1>
|
161 |
Tap the video to expand and then tilt to explore. Think of this kind of interactive video as a moving photograph. It gives curious readers an opportunity to explore a living scene and become immersed in a new way. Looping continuously, the video adds atmosphere to an article and can be used to emphasize a section break.
|
162 |
-
<cite>Eduardo Tardin/Facebook</cite></figcaption>
|
163 |
-
</figure>
|
164 |
-
</div>
|
165 |
-
<div class="ia2amp-spacing before-p"></div>
|
166 |
-
<p class="ia2amp-p">You can also ingest GIFs natively—no need for third-party players.</p>
|
167 |
-
<div class="ia2amp-spacing after-p"></div>
|
168 |
-
<div class="ia2amp-image">
|
169 |
-
<figure class="ia2amp-figure">
|
170 |
-
<amp-img layout="responsive" src="https://s3.amazonaws.com/instantarticles/examples/fb_cat.gif" width="380" height="240"></amp-img>
|
171 |
-
<figcaption class="ia2amp-figcaption ia2amp-op-large ia2amp-op-vertical-below">
|
172 |
We know GIFs are exciting, but please try to calm down.
|
173 |
|
174 |
<cite>
|
175 |
Eduardo Tardin/Facebook
|
176 |
-
</cite></figcaption>
|
177 |
-
|
178 |
-
</div>
|
179 |
-
<div class="ia2amp-spacing before-h1"></div>
|
180 |
-
<h1 class="ia2amp-h1"> Cartography </h1>
|
181 |
-
<div class="ia2amp-spacing after-h1 before-p"></div>
|
182 |
-
<p class="ia2amp-p">Another great way to add information and texture to your stories: maps! Instant Articles has two cartographic features that deliver additional context to news and help readers situate it in the wider world.</p>
|
183 |
-
<div class="ia2amp-spacing after-p"></div>
|
184 |
-
<div class="ia2amp-image">
|
185 |
-
<figure class="ia2amp-figure">
|
186 |
-
<amp-img layout="responsive" src="https://s3.amazonaws.com/instantarticles/examples/fb_volcano.jpg" width="380" height="240"></amp-img>
|
187 |
-
<figcaption class="ia2amp-figcaption ia2amp-op-small"><h1>Geotagging Example</h1>
|
188 |
Major news events often occur in locations unfamiliar to readers. Photos and videos in Instant Articles can easily be geotagged, such as this image of Mount Etna, so that readers can tap the globe icon to see where the action is happening. By pinching this map, you can zoom in to see details on the snow-capped slopes of the volcano or zoom out far enough to see the boot of Italy—and beyond.
|
189 |
|
190 |
-
<cite>gnuckx/Flickr</cite></figcaption>
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
<div class="ia2amp-spacing after-h1 before-p"></div>
|
204 |
-
<p class="ia2amp-p">Don’t forget to make use of pull quotes and block quotes. Give the quote extra punch by customizing its color using the <a href="https://developers.facebook.com/docs/instant-articles/design/creating-styles">Style Editor</a>. </p>
|
205 |
-
<div class="ia2amp-spacing after-p before-pullquote"></div>
|
206 |
-
<aside class="ia2amp-pullquote">
|
207 |
Being connected means having opportunity. We’re connecting the world so one day everyone can fulfill their dreams.
|
208 |
|
209 |
-
<cite>Mark Zuckerberg</cite></aside>
|
210 |
-
<div class="ia2amp-spacing after-pullquote before-p"></div>
|
211 |
-
<p class="ia2amp-p">To include a long excerpt from another source, such as the following example from Sheryl Sandberg’s <em>Lean In: Women, Work, and the Will to Lead</em>, use a block quote. It’s in the same style as the body text but set off with a rule on the left margin.</p>
|
212 |
-
<div class="ia2amp-spacing after-p before-blockquote"></div>
|
213 |
-
<blockquote class="ia2amp-blockquote">
|
214 |
But knowing that things could be worse should not stop us from trying to make them better. When the suffragettes marched in the streets, they envisioned a century later, men and women would be truly equal. A century later, we are still squinting, trying to bring that vision into focus.
|
215 |
-
</blockquote>
|
216 |
-
|
217 |
-
<h1 class="ia2amp-h1">In-line Related Articles</h1>
|
218 |
-
<div class="ia2amp-spacing after-h1 before-p"></div>
|
219 |
-
<div class="ia2amp-spacing after-p before-spacing after-p"></div>
|
220 |
-
<p class="ia2amp-related-articles">Pique reader interest in more articles from your publication with an in-line related articles element. Choose up to 3 stories and guide readers to other engaging articles. </p>
|
221 |
-
<div class="ia2amp-spacing after-spacing after-p before-p"></div>
|
222 |
-
<p class="ia2amp-p">You can also add a related articles element in the footer. Scroll down to the bottom of the story to see that feature in action.</p>
|
223 |
-
<div class="ia2amp-spacing after-p before-h1"></div>
|
224 |
-
<h1 class="ia2amp-h1">Customizing the Formatting</h1>
|
225 |
-
<div class="ia2amp-spacing after-h1 before-p"></div>
|
226 |
-
<p class="ia2amp-p">To create advanced effects, you can play with different layout settings on your media elements. To create full-bleed layouts with a magazine-like feel, for example, you can crop a series of photos vertically and stack them in-line without spacing or text in between.</p>
|
227 |
-
<div class="ia2amp-spacing after-p before-h2"></div>
|
228 |
-
<h2 class="ia2amp-h2">Fullscreen Media</h2>
|
229 |
-
<div class="ia2amp-spacing after-h2 before-p"></div>
|
230 |
-
<p class="ia2amp-p"> Another option is to set images or videos to fullscreen mode, in which case the art crops automatically so that it bleeds off the screen frame and snaps gently into place. It’s kind of like a digital gatefold, giving readers a chance to enjoy a special moment in the story. See how this next image pauses briefly when you scroll it into view.</p>
|
231 |
-
<div class="ia2amp-spacing after-p"></div>
|
232 |
-
<div class="ia2amp-image">
|
233 |
-
<figure class="ia2amp-figure">
|
234 |
-
<amp-img layout="responsive" src="https://s3.amazonaws.com/instantarticles/examples/fb_station.jpg" width="380" height="240"></amp-img>
|
235 |
-
<figcaption class="ia2amp-figcaption ia2amp-op-large"><h1> “I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can’t see from the center.” </h1>
|
236 |
Kurt Vonnegut
|
237 |
-
</figcaption>
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
<div class="ia2amp-spacing after-h1 before-p"></div>
|
245 |
-
<p class="ia2amp-p">You can create any embed for other social networks as well. <a href="https://twitter.com/theellenshow/status/440322224407314432">Ellen #oscar</a>. </p>
|
246 |
-
<div class="ia2amp-spacing after-p before-h1"></div>
|
247 |
-
<h1 class="ia2amp-h1">Next</h1>
|
248 |
-
<div class="ia2amp-spacing after-h1 before-p"></div>
|
249 |
-
<p class="ia2amp-p">Get inspired by some of the incredible showcase articles that we’ve posted on the <a href="https://www.facebook.com/instantArticles/?fref=ts">Instant Articles Facebook page</a>. Whether you want to create a specially designed long read filled with multimedia elements or to quickly publish an on-the-scene video connected to an evolving news story, Instant Articles has the features and flexibility to help you deliver stories that not only load fast but are hard to forget.</p>
|
250 |
-
<div class="ia2amp-spacing after-p before-p"></div>
|
251 |
-
<p class="ia2amp-p">Look at this format as a tool box. How you choose to use Instant Articles and what you make with them are limited only by your imagination. We plan on continuously adding tools to the kit, based on your experiences and feedback. Our team is eager to work with publishers, bloggers and independent journalists to help you deliver your stories to new audiences with the most impact and multimedia goodness possible.</p>
|
252 |
-
<div class="ia2amp-spacing after-p"></div>
|
253 |
-
<footer class="ia2amp-footer">
|
254 |
-
<small>© Facebook</small>
|
255 |
-
</footer>
|
256 |
-
</article>
|
257 |
</body>
|
258 |
</html>
|
8 |
<style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style>
|
9 |
</noscript>
|
10 |
<link rel="canonical" href="http://blog.wod.expert/example1"/>
|
11 |
+
<style amp-custom>amp-img.ia2amp-header-cover-img {transform: translate(0px, 0px);}html {background-color: rgb(255,255,255);}.ia2amp-header-category {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header-h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header-h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header h3 {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-header-bar {background-color: rgb(255,255,255);}.ia2amp-h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-p {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-article a {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;text-decoration: underline;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-blockquote {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 32px 0 46px;border-top-color: rgb(0,0,0);border-right-color: rgb(0,0,0);border-bottom-color: rgb(0,0,0);border-left-color: rgb(0,0,0);border-width: 0 0 0 2px;border-style: solid;}.ia2amp-pullquote {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-pullquote cite {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-small h1 {font-family: Helvetica Neue Bold;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-small h2 {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-medium h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-medium h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-large h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-large h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-extra-large h1 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-op-extra-large h2 {font-family: Georgia;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(128,128,128);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-figcaption cite {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: uppercase;background-color: rgba(255,255,255,0);color: rgb(191,191,191);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}.ia2amp-footer {font-family: Helvetica Neue;text-align: LEFT;display: INLINE;text-transform: none;background-color: rgba(255,255,255,0);color: rgb(0,0,0);margin: 0 16.4px 0 16.4px;padding: 0 0 0 0;border-width: 0 0 0 0;border-style: solid;}/* Custom CSS for default style goes here */ /* p { background-color: rgb(255,00,00); } */ </style>
|
12 |
<script type="application/ld+json">{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"http://blog.wod.expert/example1","headline":" Instant Articles ","datePublished":"2016-02-04T08:00:00-08:00","description":"Yes, it\u2019s true. Instant Articles open on mobile devices really quickly.","dateModified":"2016-02-04T08:00:00-08:00","author":{"@type":"Person","name":"\n Instant Articles Team\n "},"image":{"@type":"ImageObject","url":"https://s3.amazonaws.com/instantarticles/examples/fb_beach_flower.jpg","width":380,"height":240}}</script>
|
13 |
<title> Instant Articles </title>
|
14 |
<script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script>
|
18 |
<body class="ia2amp-body">
|
19 |
<header class="ia2amp-header">
|
20 |
<div class="ia2amp-cover-image">
|
21 |
+
<amp-img class="ia2amp-header-cover-img" src="https://s3.amazonaws.com/instantarticles/examples/fb_beach_flower.jpg" width="380" height="240" layout="responsive"></amp-img>
|
22 |
</div>
|
23 |
<div class="ia2amp-header-bar"></div>
|
24 |
<div class="ia2amp-spacing after-header-bar before-header-category"></div>
|
37 |
<h3 class="ia2amp-header-date">February 04, 2016</h3>
|
38 |
<div class="ia2amp-spacing after-header-date before-p"></div>
|
39 |
</header>
|
40 |
+
<article class="ia2amp-article"><p class="ia2amp-p">Yes, it’s true. Instant Articles open on mobile devices really quickly.</p><div class="ia2amp-spacing after-p before-p"></div><p class="ia2amp-p">But that’s just the beginning of it. Instant Articles are buttery smooth and addictive. Once you’ve read a few, you’ll never want to go back.</p><div class="ia2amp-spacing after-p before-p"></div><p class="ia2amp-p">The Facebook-native format is packed with innovative ways to tell deeply engaging, interactive stories. Thanks to the powerful, built-in media features and customizable typographic elements, Instant Articles gives you awesome new editorial tools to use while delivering a decidedly superior experience for your readers.</p><div class="ia2amp-spacing after-p before-p"></div><p class="ia2amp-p">More than half of Instant Articles readers scroll 90% of the way through their articles, while, historically, 38% of web readers haven’t made it past the first line of other online media.</p><div class="ia2amp-spacing after-p before-p"></div><p class="ia2amp-p">This article gives you a quick highlight tour of Instant Articles features and shows you how to make magic with the format. You’ll be happy to find that Instant Articles are not only delightful but surprisingly easy to create.</p><div class="ia2amp-spacing after-p before-h1"></div><h1 class="ia2amp-h1"> Photography </h1><div class="ia2amp-spacing after-h1 before-p"></div><p class="ia2amp-p">All photographs are interactive by default. When tapped an image will expand to fill the screen, then readers can tilt the phone back and forth to explore the margins.</p><div class="ia2amp-spacing after-p"></div><div class="ia2amp-image"><figure class="ia2amp-figure"><amp-img layout="responsive" src="https://s3.amazonaws.com/instantarticles/examples/fb_rails.jpg" width="380" height="240"></amp-img><figcaption class="ia2amp-figcaption ia2amp-op-small"><h1>Photograph Example</h1>
|
41 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
Tap this image to make it expand. Tilt the phone right and left and see what happens.
|
43 |
|
44 |
+
<cite>Eduardo Tardin/Facebook</cite></figcaption></figure></div><div class="ia2amp-spacing before-p"></div><p class="ia2amp-p">To return to the article, tap the image again. The interactive mode works best with high-definition photos containing rich visual information. For low-resolution media, we recommend using the non-interactive setting so that it will remain in-line in the correct aspect ratio and your readers won’t tap into a mushy, pixelated experience.</p><div class="ia2amp-spacing after-p before-h2"></div><h2 class="ia2amp-h2">Social Feedback</h2><div class="ia2amp-spacing after-h2 before-p"></div><p class="ia2amp-p">You can add native Facebook Likes and Comments buttons to images, giving readers extra opportunities to engage with individual elements in your stories. This feature currently works for photographs and videos.</p><div class="ia2amp-spacing after-p before-h2"></div><h2 class="ia2amp-h2">Slideshow</h2><div class="ia2amp-spacing after-h2 before-p"></div><p class="ia2amp-p">You can also group collections of images into slideshows that scroll horizontally.</p><div class="ia2amp-spacing after-p before-slideshow"></div><div class="ia2amp-slideshow"><figure class="ia2amp-figure"><amp-carousel width="380" height="240"><div class="ia2amp-slideshow-image"><figure class="ia2amp-figure"><amp-img src="https://s3.amazonaws.com/instantarticles/examples/fb_beach_flower.jpg" width="380" height="240"></amp-img><figcaption class="ia2amp-figcaption ia2amp-op-small"><h1>
|
45 |
+
1/5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
This caption becomes visible once you enter the slideshow by tapping the first image.
|
47 |
Eduardo Tardin/Facebook
|
48 |
+
</h1></figcaption></figure></div><div class="ia2amp-slideshow-image"><figure class="ia2amp-figure"><amp-img src="https://s3.amazonaws.com/instantarticles/examples/fb_rocks.jpg" width="380" height="240"></amp-img><figcaption class="ia2amp-figcaption ia2amp-op-small"><h1>
|
49 |
+
2/5
|
|
|
|
|
|
|
|
|
|
|
50 |
Each photo in a slideshow can have its own caption.
|
51 |
Eduardo Tardin/Facebook
|
52 |
+
</h1></figcaption></figure></div><div class="ia2amp-slideshow-image"><figure class="ia2amp-figure"><amp-img src="https://s3.amazonaws.com/instantarticles/examples/fb_sunset.jpg" width="380" height="240"></amp-img><figcaption class="ia2amp-figcaption ia2amp-op-small"><h1>
|
53 |
+
3/5
|
|
|
|
|
|
|
|
|
|
|
54 |
This is the third photo of the slideshow.
|
55 |
Eduardo Tardin/Facebook
|
56 |
+
</h1></figcaption></figure></div><div class="ia2amp-slideshow-image"><figure class="ia2amp-figure"><amp-img src="https://s3.amazonaws.com/instantarticles/examples/fb_cave_ocean.jpg" width="380" height="240"></amp-img><figcaption class="ia2amp-figcaption ia2amp-op-small"><h1>
|
57 |
+
4/5
|
|
|
|
|
|
|
|
|
|
|
58 |
The fourth photo of the slideshow.
|
59 |
Eduardo Tardin/Facebook
|
60 |
+
</h1></figcaption></figure></div><div class="ia2amp-slideshow-image"><figure class="ia2amp-figure"><amp-img src="https://s3.amazonaws.com/instantarticles/examples/fb_boat.jpg" width="380" height="240"></amp-img><figcaption class="ia2amp-figcaption ia2amp-op-small"><h1>
|
61 |
+
5/5
|
|
|
|
|
|
|
|
|
|
|
62 |
The fifth photo of the slideshow.
|
63 |
Eduardo Tardin/Facebook
|
64 |
+
</h1></figcaption></figure></div></amp-carousel><figcaption class="ia2amp-figcaption ia2amp-op-small"><h1>Slideshow Example</h1>
|
65 |
+
|
|
|
|
|
|
|
66 |
The slideshow caption is visible in-line in the main body of the story. You can also add individual captions for each image in the gallery, which become visible only after entering the slideshow. Tap on the first image to open it.
|
67 |
+
</figcaption></figure></div><div class="ia2amp-spacing after-slideshow"></div><div class="ia2amp-video"><figure class="ia2amp-figure"><amp-video src="https://s3.amazonaws.com/instantarticles/examples/fb_movie_pt.mov" width="380" height="240"></amp-video><figcaption class="ia2amp-figcaption ia2amp-op-small"><h1> 6+ </h1>
|
68 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
Adendum and mixed video + image in a slideshow.
|
70 |
|
71 |
+
<cite>Instant Articles/Facebook</cite></figcaption></figure></div><div class="ia2amp-spacing before-h1"></div><h1 class="ia2amp-h1">Video</h1><div class="ia2amp-spacing after-h1 before-p"></div><p class="ia2amp-p">Native videos in Instant Articles play automatically, by default, as soon as they scroll into view on the reader’s screen—a powerful way to make the page come to life. You have many options for presenting videos. Here’s an interactive one with play controls. </p><div class="ia2amp-spacing after-p"></div><div class="ia2amp-video"><figure class="ia2amp-figure"><amp-video src="https://s3.amazonaws.com/instantarticles/examples/fb_hiperlapse_sp.mp4" width="380" height="240"></amp-video><figcaption class="ia2amp-figcaption ia2amp-op-small"><h1><b>2:57</b> | Interactive Video Example</h1>
|
72 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
When this video first scrolls into sight, it appears in-line in its correct aspect ratio and plays automatically with the volume off. By tapping it, the video expands to fill the screen and can be turned to view horizontally. The soundtrack becomes audible, and play controls, with scrubber, are accessible.
|
74 |
+
</figcaption></figure></div><div class="ia2amp-spacing before-p"></div><p class="ia2amp-p"> To hide play controls, tap the video again; the pause/play icons and scrubber can be toggled on and off this way. You can also rotate the phone sideways while the video is in-line to view it in landscape mode.</p><div class="ia2amp-spacing after-p before-p"></div><p class="ia2amp-p">Alternately, try using a short video to add color and mood to a story. Disable the play controls and set it to loop with a cross-fade.</p><div class="ia2amp-spacing after-p"></div><div class="ia2amp-video"><figure class="ia2amp-figure"><amp-video src="https://s3.amazonaws.com/instantarticles/examples/fb_hiperlapse_sp.mp4" width="380" height="240"></amp-video><figcaption class="ia2amp-figcaption ia2amp-op-small"><h1>Ambient Video Example</h1>
|
75 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
Tap the video to expand and then tilt to explore. Think of this kind of interactive video as a moving photograph. It gives curious readers an opportunity to explore a living scene and become immersed in a new way. Looping continuously, the video adds atmosphere to an article and can be used to emphasize a section break.
|
77 |
+
<cite>Eduardo Tardin/Facebook</cite></figcaption></figure></div><div class="ia2amp-spacing before-p"></div><p class="ia2amp-p">You can also ingest GIFs natively—no need for third-party players.</p><div class="ia2amp-spacing after-p"></div><div class="ia2amp-image"><figure class="ia2amp-figure"><amp-img layout="responsive" src="https://s3.amazonaws.com/instantarticles/examples/fb_cat.gif" width="380" height="240"></amp-img><figcaption class="ia2amp-figcaption ia2amp-op-large ia2amp-op-vertical-below">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
We know GIFs are exciting, but please try to calm down.
|
79 |
|
80 |
<cite>
|
81 |
Eduardo Tardin/Facebook
|
82 |
+
</cite></figcaption></figure></div><div class="ia2amp-spacing before-h1"></div><h1 class="ia2amp-h1"> Cartography </h1><div class="ia2amp-spacing after-h1 before-p"></div><p class="ia2amp-p">Another great way to add information and texture to your stories: maps! Instant Articles has two cartographic features that deliver additional context to news and help readers situate it in the wider world.</p><div class="ia2amp-spacing after-p"></div><div class="ia2amp-image"><figure class="ia2amp-figure"><amp-img layout="responsive" src="https://s3.amazonaws.com/instantarticles/examples/fb_volcano.jpg" width="380" height="240"></amp-img><figcaption class="ia2amp-figcaption ia2amp-op-small"><h1>Geotagging Example</h1>
|
83 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
Major news events often occur in locations unfamiliar to readers. Photos and videos in Instant Articles can easily be geotagged, such as this image of Mount Etna, so that readers can tap the globe icon to see where the action is happening. By pinching this map, you can zoom in to see details on the snow-capped slopes of the volcano or zoom out far enough to see the boot of Italy—and beyond.
|
85 |
|
86 |
+
<cite>gnuckx/Flickr</cite></figcaption></figure></div><div class="ia2amp-spacing before-p"></div><p class="ia2amp-p">Rotating contour maps can be inserted in stories with a simple code block, giving readers a bird’s-eye view of topography and the ability to pinch and zoom in or out.</p><div class="ia2amp-spacing after-p"></div><div></div><div class="ia2amp-spacing before-h1"></div><h1 class="ia2amp-h1">Embeds</h1><div class="ia2amp-spacing after-h1 before-p"></div><p class="ia2amp-p">Instant Articles deliver rich, multimedia stories even when you don’t own all the source media files. You might want to publish evolving news about an incident captured in video on YouTube. Or a listicle made up entirely of Tweets, Facebook posts, Instagrams and Vines. Instant Articles seamlessly integrate all types of web-based embeds, including your own interactive graphics, video players, ads and social media, such as this post from Mark Zuckerberg.</p><div class="ia2amp-spacing after-p before-spacing after-p"></div>
|
87 |
+
<!-- Include social media embed code here -->
|
88 |
+
<div id="fb-root"></div>
|
89 |
+
<script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3"; fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script>
|
90 |
+
<div class="fb-post" data-href="https://www.facebook.com/zuck/posts/10102531565693851" data-width="500">
|
91 |
+
<div class="fb-xfbml-parse-ignore">
|
92 |
+
<blockquote cite="https://www.facebook.com/zuck/posts/10102531565693851">
|
93 |
+
<p>The force is strong with this one.</p>
|
94 |
+
Posted by <a href="https://www.facebook.com/zuck">Mark Zuckerberg</a> on <a href="https://www.facebook.com/zuck/posts/10102531565693851">Thursday, December 17, 2015</a>
|
95 |
+
</blockquote>
|
96 |
+
</div>
|
97 |
+
</div>
|
98 |
+
<div class="ia2amp-spacing after-spacing after-p before-h1"></div><h1 class="ia2amp-h1">Typography</h1><div class="ia2amp-spacing after-h1 before-p"></div><p class="ia2amp-p">Don’t forget to make use of pull quotes and block quotes. Give the quote extra punch by customizing its color using the <a href="https://developers.facebook.com/docs/instant-articles/design/creating-styles">Style Editor</a>. </p><div class="ia2amp-spacing after-p before-pullquote"></div><aside class="ia2amp-pullquote">
|
|
|
|
|
|
|
|
|
99 |
Being connected means having opportunity. We’re connecting the world so one day everyone can fulfill their dreams.
|
100 |
|
101 |
+
<cite>Mark Zuckerberg</cite></aside><div class="ia2amp-spacing after-pullquote before-p"></div><p class="ia2amp-p">To include a long excerpt from another source, such as the following example from Sheryl Sandberg’s <em>Lean In: Women, Work, and the Will to Lead</em>, use a block quote. It’s in the same style as the body text but set off with a rule on the left margin.</p><div class="ia2amp-spacing after-p before-blockquote"></div><blockquote class="ia2amp-blockquote">
|
|
|
|
|
|
|
|
|
102 |
But knowing that things could be worse should not stop us from trying to make them better. When the suffragettes marched in the streets, they envisioned a century later, men and women would be truly equal. A century later, we are still squinting, trying to bring that vision into focus.
|
103 |
+
</blockquote><div class="ia2amp-spacing after-blockquote before-h1"></div><h1 class="ia2amp-h1">In-line Related Articles</h1><div class="ia2amp-spacing after-h1 before-p"></div><div class="ia2amp-spacing after-p before-spacing after-p"></div><p class="ia2amp-related-articles">Pique reader interest in more articles from your publication with an in-line related articles element. Choose up to 3 stories and guide readers to other engaging articles. </p><div class="ia2amp-spacing after-spacing after-p before-p"></div><p class="ia2amp-p">You can also add a related articles element in the footer. Scroll down to the bottom of the story to see that feature in action.</p><div class="ia2amp-spacing after-p before-h1"></div><h1 class="ia2amp-h1">Customizing the Formatting</h1><div class="ia2amp-spacing after-h1 before-p"></div><p class="ia2amp-p">To create advanced effects, you can play with different layout settings on your media elements. To create full-bleed layouts with a magazine-like feel, for example, you can crop a series of photos vertically and stack them in-line without spacing or text in between.</p><div class="ia2amp-spacing after-p before-h2"></div><h2 class="ia2amp-h2">Fullscreen Media</h2><div class="ia2amp-spacing after-h2 before-p"></div><p class="ia2amp-p"> Another option is to set images or videos to fullscreen mode, in which case the art crops automatically so that it bleeds off the screen frame and snaps gently into place. It’s kind of like a digital gatefold, giving readers a chance to enjoy a special moment in the story. See how this next image pauses briefly when you scroll it into view.</p><div class="ia2amp-spacing after-p"></div><div class="ia2amp-image"><figure class="ia2amp-figure"><amp-img layout="responsive" src="https://s3.amazonaws.com/instantarticles/examples/fb_station.jpg" width="380" height="240"></amp-img><figcaption class="ia2amp-figcaption ia2amp-op-large"><h1> “I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can’t see from the center.” </h1>
|
104 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
Kurt Vonnegut
|
106 |
+
</figcaption></figure></div><div class="ia2amp-spacing before-p"></div><p class="ia2amp-p">Visit the <a href="https://developers.facebook.com/docs/instant-articles/guides/design">Instant Articles Design Guide</a> to learn how to customize your typography and layout. The <a href="https://developers.facebook.com/docs/instant-articles/reference">Format Reference</a> describes the HTML-5 markup used to set interactive features and vary the presentation modes for media.</p><div class="ia2amp-spacing after-p before-h1"></div><h1 class="ia2amp-h1">Twitter embed</h1><div class="ia2amp-spacing after-h1 before-p"></div><p class="ia2amp-p">You can create any embed for other social networks as well. <a href="https://twitter.com/theellenshow/status/440322224407314432">Ellen #oscar</a>. </p><div class="ia2amp-spacing after-p before-spacing after-p"></div>
|
107 |
+
<blockquote class="twitter-tweet" data-lang="pt">
|
108 |
+
<p lang="en" dir="ltr">If only Bradley's arm was longer. Best photo ever. <a href="https://twitter.com/hashtag/oscars?src=hash">#oscars</a> <a href="http://t.co/C9U5NOtGap">pic.twitter.com/C9U5NOtGap</a></p>
|
109 |
+
— Ellen DeGeneres (@TheEllenShow) <a href="https://twitter.com/TheEllenShow/status/440322224407314432">3 de março de 2014</a>
|
110 |
+
</blockquote>
|
111 |
+
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
|
112 |
+
<div class="ia2amp-spacing after-spacing after-p before-h1"></div><h1 class="ia2amp-h1">Next</h1><div class="ia2amp-spacing after-h1 before-p"></div><p class="ia2amp-p">Get inspired by some of the incredible showcase articles that we’ve posted on the <a href="https://www.facebook.com/instantArticles/?fref=ts">Instant Articles Facebook page</a>. Whether you want to create a specially designed long read filled with multimedia elements or to quickly publish an on-the-scene video connected to an evolving news story, Instant Articles has the features and flexibility to help you deliver stories that not only load fast but are hard to forget.</p><div class="ia2amp-spacing after-p before-p"></div><p class="ia2amp-p">Look at this format as a tool box. How you choose to use Instant Articles and what you make with them are limited only by your imagination. We plan on continuously adding tools to the kit, based on your experiences and feedback. Our team is eager to work with publishers, bloggers and independent journalists to help you deliver your stories to new audiences with the most impact and multimedia goodness possible.</p><div class="ia2amp-spacing after-p"></div><footer class="ia2amp-footer"><small>© Facebook</small></footer></article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
</body>
|
114 |
</html>
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/Utils/CSSBuilderTest.php
CHANGED
@@ -12,26 +12,6 @@ use PHPUnit\Framework;
|
|
12 |
|
13 |
class CSSBuilderTest extends Framework\TestCase
|
14 |
{
|
15 |
-
protected function setUp()
|
16 |
-
{
|
17 |
-
\Logger::configure(
|
18 |
-
[
|
19 |
-
'rootLogger' => [
|
20 |
-
'appenders' => ['facebook-instantarticles-traverser']
|
21 |
-
],
|
22 |
-
'appenders' => [
|
23 |
-
'facebook-instantarticles-traverser' => [
|
24 |
-
'class' => 'LoggerAppenderConsole',
|
25 |
-
'threshold' => 'INFO',
|
26 |
-
'layout' => [
|
27 |
-
'class' => 'LoggerLayoutSimple'
|
28 |
-
]
|
29 |
-
]
|
30 |
-
]
|
31 |
-
]
|
32 |
-
);
|
33 |
-
}
|
34 |
-
|
35 |
public function genSimpleCSSFormatted($prefix = '')
|
36 |
{
|
37 |
return
|
12 |
|
13 |
class CSSBuilderTest extends Framework\TestCase
|
14 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
public function genSimpleCSSFormatted($prefix = '')
|
16 |
{
|
17 |
return
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/Utils/FileUtilsPHPUnitTestCase.php
CHANGED
@@ -11,28 +11,8 @@ namespace Facebook\InstantArticles\Utils;
|
|
11 |
use Facebook\InstantArticles\Parser\Parser;
|
12 |
use PHPUnit\Framework;
|
13 |
|
14 |
-
class FileUtilsPHPUnitTestCase extends Framework\TestCase
|
15 |
{
|
16 |
-
protected function setUp()
|
17 |
-
{
|
18 |
-
\Logger::configure(
|
19 |
-
[
|
20 |
-
'rootLogger' => [
|
21 |
-
'appenders' => ['facebook-instantarticles-traverser']
|
22 |
-
],
|
23 |
-
'appenders' => [
|
24 |
-
'facebook-instantarticles-traverser' => [
|
25 |
-
'class' => 'LoggerAppenderConsole',
|
26 |
-
'threshold' => 'INFO',
|
27 |
-
'layout' => [
|
28 |
-
'class' => 'LoggerLayoutSimple'
|
29 |
-
]
|
30 |
-
]
|
31 |
-
]
|
32 |
-
]
|
33 |
-
);
|
34 |
-
}
|
35 |
-
|
36 |
/**
|
37 |
* Loads HTML file using by default file_get_contents
|
38 |
*/
|
@@ -77,4 +57,14 @@ class FileUtilsPHPUnitTestCase extends Framework\TestCase
|
|
77 |
$parser = new Parser();
|
78 |
return $parser->parse($document);
|
79 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
11 |
use Facebook\InstantArticles\Parser\Parser;
|
12 |
use PHPUnit\Framework;
|
13 |
|
14 |
+
abstract class FileUtilsPHPUnitTestCase extends Framework\TestCase
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
/**
|
17 |
* Loads HTML file using by default file_get_contents
|
18 |
*/
|
57 |
$parser = new Parser();
|
58 |
return $parser->parse($document);
|
59 |
}
|
60 |
+
|
61 |
+
protected function assertEqualsHtml($expected, $actual)
|
62 |
+
{
|
63 |
+
$from = ['/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s', '/> </s'];
|
64 |
+
$to = ['>', '<', '\\1', '><'];
|
65 |
+
$this->assertEquals(
|
66 |
+
preg_replace($from, $to, $expected),
|
67 |
+
preg_replace($from, $to, $actual)
|
68 |
+
);
|
69 |
+
}
|
70 |
}
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/Utils/Greeting.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Utils;
|
10 |
|
11 |
-
|
12 |
/*
|
13 |
* Sample class used for testing the Observer.
|
14 |
*/
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Utils;
|
10 |
|
|
|
11 |
/*
|
12 |
* Sample class used for testing the Observer.
|
13 |
*/
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/Utils/HookTest.php
CHANGED
@@ -13,26 +13,6 @@ use PHPUnit\Framework;
|
|
13 |
|
14 |
class HookTest extends Framework\TestCase
|
15 |
{
|
16 |
-
protected function setUp()
|
17 |
-
{
|
18 |
-
\Logger::configure(
|
19 |
-
[
|
20 |
-
'rootLogger' => [
|
21 |
-
'appenders' => ['facebook-instantarticles-traverser']
|
22 |
-
],
|
23 |
-
'appenders' => [
|
24 |
-
'facebook-instantarticles-traverser' => [
|
25 |
-
'class' => 'LoggerAppenderConsole',
|
26 |
-
'threshold' => 'INFO',
|
27 |
-
'layout' => [
|
28 |
-
'class' => 'LoggerLayoutSimple'
|
29 |
-
]
|
30 |
-
]
|
31 |
-
]
|
32 |
-
]
|
33 |
-
);
|
34 |
-
}
|
35 |
-
|
36 |
public function methodHook()
|
37 |
{
|
38 |
return 'result';
|
13 |
|
14 |
class HookTest extends Framework\TestCase
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
public function methodHook()
|
17 |
{
|
18 |
return 'result';
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/Utils/ObserverTest.php
CHANGED
@@ -12,26 +12,6 @@ use PHPUnit\Framework;
|
|
12 |
|
13 |
class ObserverTest extends Framework\TestCase
|
14 |
{
|
15 |
-
protected function setUp()
|
16 |
-
{
|
17 |
-
\Logger::configure(
|
18 |
-
[
|
19 |
-
'rootLogger' => [
|
20 |
-
'appenders' => ['facebook-instantarticles-traverser']
|
21 |
-
],
|
22 |
-
'appenders' => [
|
23 |
-
'facebook-instantarticles-traverser' => [
|
24 |
-
'class' => 'LoggerAppenderConsole',
|
25 |
-
'threshold' => 'INFO',
|
26 |
-
'layout' => [
|
27 |
-
'class' => 'LoggerLayoutSimple'
|
28 |
-
]
|
29 |
-
]
|
30 |
-
]
|
31 |
-
]
|
32 |
-
);
|
33 |
-
}
|
34 |
-
|
35 |
public function testNoFilter()
|
36 |
{
|
37 |
$observererver = Observer::create();
|
@@ -44,7 +24,6 @@ class ObserverTest extends Framework\TestCase
|
|
44 |
$observer = Observer::create();
|
45 |
$observer->addFilter('name', function ($name) {
|
46 |
return "$name-san";
|
47 |
-
|
48 |
});
|
49 |
$name = $observer->applyFilters('name', "Bob");
|
50 |
$this->assertEquals('Bob-san', $name);
|
12 |
|
13 |
class ObserverTest extends Framework\TestCase
|
14 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
public function testNoFilter()
|
16 |
{
|
17 |
$observererver = Observer::create();
|
24 |
$observer = Observer::create();
|
25 |
$observer->addFilter('name', function ($name) {
|
26 |
return "$name-san";
|
|
|
27 |
});
|
28 |
$name = $observer->applyFilters('name', "Bob");
|
29 |
$this->assertEquals('Bob-san', $name);
|
vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookResponseException.php
CHANGED
@@ -90,11 +90,20 @@ class FacebookResponseException extends FacebookSDKException
|
|
90 |
// Video upload resumable error
|
91 |
case 1363030:
|
92 |
case 1363019:
|
93 |
-
case 1363037:
|
94 |
case 1363033:
|
95 |
case 1363021:
|
96 |
case 1363041:
|
97 |
return new static($response, new FacebookResumableUploadException($message, $code));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
}
|
100 |
|
90 |
// Video upload resumable error
|
91 |
case 1363030:
|
92 |
case 1363019:
|
|
|
93 |
case 1363033:
|
94 |
case 1363021:
|
95 |
case 1363041:
|
96 |
return new static($response, new FacebookResumableUploadException($message, $code));
|
97 |
+
case 1363037:
|
98 |
+
$previousException = new FacebookResumableUploadException($message, $code);
|
99 |
+
|
100 |
+
$startOffset = isset($data['error']['error_data']['start_offset']) ? (int) $data['error']['error_data']['start_offset'] : null;
|
101 |
+
$previousException->setStartOffset($startOffset);
|
102 |
+
|
103 |
+
$endOffset = isset($data['error']['error_data']['end_offset']) ? (int) $data['error']['error_data']['end_offset'] : null;
|
104 |
+
$previousException->setEndOffset($endOffset);
|
105 |
+
|
106 |
+
return new static($response, $previousException);
|
107 |
}
|
108 |
}
|
109 |
|
vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookResumableUploadException.php
CHANGED
@@ -30,4 +30,39 @@ namespace Facebook\Exceptions;
|
|
30 |
*/
|
31 |
class FacebookResumableUploadException extends FacebookSDKException
|
32 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
30 |
*/
|
31 |
class FacebookResumableUploadException extends FacebookSDKException
|
32 |
{
|
33 |
+
protected $startOffset;
|
34 |
+
|
35 |
+
protected $endOffset;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @return int|null
|
39 |
+
*/
|
40 |
+
public function getStartOffset()
|
41 |
+
{
|
42 |
+
return $this->startOffset;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @param int|null $startOffset
|
47 |
+
*/
|
48 |
+
public function setStartOffset($startOffset)
|
49 |
+
{
|
50 |
+
$this->startOffset = $startOffset;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @return int|null
|
55 |
+
*/
|
56 |
+
public function getEndOffset()
|
57 |
+
{
|
58 |
+
return $this->endOffset;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @param int|null $endOffset
|
63 |
+
*/
|
64 |
+
public function setEndOffset($endOffset)
|
65 |
+
{
|
66 |
+
$this->endOffset = $endOffset;
|
67 |
+
}
|
68 |
}
|
vendor/facebook/graph-sdk/src/Facebook/Facebook.php
CHANGED
@@ -53,7 +53,7 @@ class Facebook
|
|
53 |
/**
|
54 |
* @const string Version number of the Facebook PHP SDK.
|
55 |
*/
|
56 |
-
const VERSION = '5.
|
57 |
|
58 |
/**
|
59 |
* @const string Default Graph API version for requests.
|
53 |
/**
|
54 |
* @const string Version number of the Facebook PHP SDK.
|
55 |
*/
|
56 |
+
const VERSION = '5.7.0';
|
57 |
|
58 |
/**
|
59 |
* @const string Default Graph API version for requests.
|
vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookResumableUploader.php
CHANGED
@@ -121,6 +121,16 @@ class FacebookResumableUploader
|
|
121 |
throw $e;
|
122 |
}
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
// Return the same chunk entity so it can be retried.
|
125 |
return $chunk;
|
126 |
}
|
121 |
throw $e;
|
122 |
}
|
123 |
|
124 |
+
if (null !== $preException->getStartOffset() && null !== $preException->getEndOffset()) {
|
125 |
+
return new FacebookTransferChunk(
|
126 |
+
$chunk->getFile(),
|
127 |
+
$chunk->getUploadSessionId(),
|
128 |
+
$chunk->getVideoId(),
|
129 |
+
$preException->getStartOffset(),
|
130 |
+
$preException->getEndOffset()
|
131 |
+
);
|
132 |
+
}
|
133 |
+
|
134 |
// Return the same chunk entity so it can be retried.
|
135 |
return $chunk;
|
136 |
}
|
vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookTransferChunk.php
CHANGED
@@ -121,6 +121,14 @@ class FacebookTransferChunk
|
|
121 |
return $this->startOffset;
|
122 |
}
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
/**
|
125 |
* Get uploaded video Id
|
126 |
*
|
121 |
return $this->startOffset;
|
122 |
}
|
123 |
|
124 |
+
/**
|
125 |
+
* @return int
|
126 |
+
*/
|
127 |
+
public function getEndOffset()
|
128 |
+
{
|
129 |
+
return $this->endOffset;
|
130 |
+
}
|
131 |
+
|
132 |
/**
|
133 |
* Get uploaded video Id
|
134 |
*
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphNode.php
CHANGED
@@ -150,7 +150,8 @@ class GraphNode extends Collection
|
|
150 |
'backdated_time',
|
151 |
'issued_at',
|
152 |
'expires_at',
|
153 |
-
'publish_time'
|
|
|
154 |
], true);
|
155 |
}
|
156 |
|
150 |
'backdated_time',
|
151 |
'issued_at',
|
152 |
'expires_at',
|
153 |
+
'publish_time',
|
154 |
+
'joined'
|
155 |
], true);
|
156 |
}
|
157 |
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php
CHANGED
@@ -304,7 +304,9 @@ class GraphNodeFactory
|
|
304 |
return $this->safelyMakeGraphEdge($data, $subclassName, $parentKey, $parentNodeId);
|
305 |
}
|
306 |
// Sometimes Graph is a weirdo and returns a GraphNode under the "data" key
|
307 |
-
$
|
|
|
|
|
308 |
}
|
309 |
|
310 |
// Create GraphNode
|
304 |
return $this->safelyMakeGraphEdge($data, $subclassName, $parentKey, $parentNodeId);
|
305 |
}
|
306 |
// Sometimes Graph is a weirdo and returns a GraphNode under the "data" key
|
307 |
+
$outerData = $data;
|
308 |
+
unset($outerData['data']);
|
309 |
+
$data = $data['data'] + $outerData;
|
310 |
}
|
311 |
|
312 |
// Create GraphNode
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphPage.php
CHANGED
@@ -144,4 +144,14 @@ class GraphPage extends GraphNode
|
|
144 |
{
|
145 |
return $this->getField('perms');
|
146 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
144 |
{
|
145 |
return $this->getField('perms');
|
146 |
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Returns the `fan_count` (Number of people who likes to page) as int if present.
|
150 |
+
*
|
151 |
+
* @return int|null
|
152 |
+
*/
|
153 |
+
public function getFanCount()
|
154 |
+
{
|
155 |
+
return $this->getField('fan_count');
|
156 |
+
}
|
157 |
}
|
vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookRedirectLoginHelper.php
CHANGED
@@ -222,8 +222,8 @@ class FacebookRedirectLoginHelper
|
|
222 |
$this->resetCsrf();
|
223 |
|
224 |
$redirectUrl = $redirectUrl ?: $this->urlDetectionHandler->getCurrentUrl();
|
225 |
-
// At minimum we need to remove the '
|
226 |
-
$redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['code', 'state']);
|
227 |
|
228 |
return $this->oAuth2Client->getAccessTokenFromCode($code, $redirectUrl);
|
229 |
}
|
222 |
$this->resetCsrf();
|
223 |
|
224 |
$redirectUrl = $redirectUrl ?: $this->urlDetectionHandler->getCurrentUrl();
|
225 |
+
// At minimum we need to remove the 'code', 'enforce_https' and 'state' params
|
226 |
+
$redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['code', 'enforce_https', 'state']);
|
227 |
|
228 |
return $this->oAuth2Client->getAccessTokenFromCode($code, $redirectUrl);
|
229 |
}
|
vendor/facebook/graph-sdk/src/Facebook/Http/GraphRawResponse.php
CHANGED
@@ -104,8 +104,9 @@ class GraphRawResponse
|
|
104 |
*/
|
105 |
public function setHttpResponseCodeFromHeader($rawResponseHeader)
|
106 |
{
|
107 |
-
|
108 |
-
$
|
|
|
109 |
}
|
110 |
|
111 |
/**
|
104 |
*/
|
105 |
public function setHttpResponseCodeFromHeader($rawResponseHeader)
|
106 |
{
|
107 |
+
// https://tools.ietf.org/html/rfc7230#section-3.1.2
|
108 |
+
list($version, $status, $reason) = array_pad(explode(' ', $rawResponseHeader, 3), 3, null);
|
109 |
+
$this->httpResponseCode = (int) $status;
|
110 |
}
|
111 |
|
112 |
/**
|
vendor/squizlabs/php_codesniffer/phpcs.xml.dist
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<ruleset name="PHP_CodeSniffer">
|
3 |
<description>The coding standard for PHP_CodeSniffer itself.</description>
|
4 |
|
5 |
<file>autoload.php</file>
|
@@ -11,8 +11,8 @@
|
|
11 |
<exclude-pattern>*/Standards/*/Tests/*\.(inc|css|js)</exclude-pattern>
|
12 |
|
13 |
<arg name="basepath" value="."/>
|
14 |
-
<arg name="colors"
|
15 |
-
<arg name="parallel" value="75"
|
16 |
<arg value="np"/>
|
17 |
|
18 |
<!-- Don't hide tokenizer exceptions -->
|
@@ -22,40 +22,40 @@
|
|
22 |
|
23 |
<!-- Include the whole PEAR standard -->
|
24 |
<rule ref="PEAR">
|
25 |
-
<exclude name="PEAR.NamingConventions.ValidFunctionName"
|
26 |
-
<exclude name="PEAR.NamingConventions.ValidVariableName"
|
27 |
-
<exclude name="PEAR.Commenting.ClassComment"
|
28 |
-
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag"
|
29 |
-
<exclude name="PEAR.Commenting.FileComment.MissingPackageTag"
|
30 |
-
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag"
|
31 |
-
<exclude name="PEAR.Commenting.FileComment.MissingVersion"
|
32 |
-
<exclude name="PEAR.Commenting.InlineComment"
|
33 |
</rule>
|
34 |
|
35 |
<!-- Include some sniffs from other standards that don't conflict with PEAR -->
|
36 |
-
<rule ref="Squiz.Arrays.ArrayBracketSpacing"
|
37 |
-
<rule ref="Squiz.Arrays.ArrayDeclaration"
|
38 |
-
<rule ref="Squiz.Commenting.ClosingDeclarationComment"
|
39 |
-
<rule ref="Squiz.ControlStructures.ControlSignature"
|
40 |
-
<rule ref="Squiz.ControlStructures.ElseIfDeclaration"
|
41 |
-
<rule ref="Squiz.Commenting.BlockComment"
|
42 |
-
<rule ref="Squiz.Commenting.DocCommentAlignment"
|
43 |
-
<rule ref="Squiz.Commenting.EmptyCatchComment"
|
44 |
-
<rule ref="Squiz.Commenting.InlineComment"
|
45 |
-
<rule ref="Squiz.Commenting.LongConditionClosingComment"
|
46 |
-
<rule ref="Squiz.Commenting.PostStatementComment"
|
47 |
-
<rule ref="Squiz.Commenting.VariableComment"
|
48 |
-
<rule ref="Squiz.Formatting.OperatorBracket"
|
49 |
-
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"
|
50 |
-
<rule ref="Squiz.Operators.ComparisonOperatorUsage"
|
51 |
-
<rule ref="Squiz.PHP.DisallowInlineIf"
|
52 |
-
<rule ref="Squiz.Scope.MethodScope"
|
53 |
-
<rule ref="Squiz.Strings.ConcatenationSpacing"
|
54 |
-
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing"
|
55 |
-
<rule ref="Squiz.WhiteSpace.FunctionClosingBraceSpace"
|
56 |
-
<rule ref="Squiz.WhiteSpace.FunctionSpacing"
|
57 |
-
<rule ref="Squiz.WhiteSpace.OperatorSpacing"
|
58 |
-
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"
|
59 |
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
|
60 |
<rule ref="Generic.Commenting.Todo"/>
|
61 |
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
|
@@ -65,6 +65,7 @@
|
|
65 |
<rule ref="Generic.PHP.DeprecatedFunctions"/>
|
66 |
<rule ref="Generic.PHP.LowerCaseKeyword"/>
|
67 |
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
|
|
|
68 |
<rule ref="PSR2.Classes.PropertyDeclaration"/>
|
69 |
<rule ref="PSR2.Methods.MethodDeclaration"/>
|
70 |
<rule ref="PSR2.Files.EndFileNewline"/>
|
@@ -77,7 +78,7 @@
|
|
77 |
</properties>
|
78 |
</rule>
|
79 |
|
80 |
-
|
81 |
<rule ref="Generic.Arrays.ArrayIndent"/>
|
82 |
<rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
|
83 |
<severity>0</severity>
|
@@ -93,7 +94,7 @@
|
|
93 |
</rule>
|
94 |
|
95 |
<!-- Check var names, but we don't want leading underscores for private vars -->
|
96 |
-
<rule ref="Squiz.NamingConventions.ValidVariableName"
|
97 |
<rule ref="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore">
|
98 |
<severity>0</severity>
|
99 |
</rule>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
|
3 |
<description>The coding standard for PHP_CodeSniffer itself.</description>
|
4 |
|
5 |
<file>autoload.php</file>
|
11 |
<exclude-pattern>*/Standards/*/Tests/*\.(inc|css|js)</exclude-pattern>
|
12 |
|
13 |
<arg name="basepath" value="."/>
|
14 |
+
<arg name="colors"/>
|
15 |
+
<arg name="parallel" value="75"/>
|
16 |
<arg value="np"/>
|
17 |
|
18 |
<!-- Don't hide tokenizer exceptions -->
|
22 |
|
23 |
<!-- Include the whole PEAR standard -->
|
24 |
<rule ref="PEAR">
|
25 |
+
<exclude name="PEAR.NamingConventions.ValidFunctionName"/>
|
26 |
+
<exclude name="PEAR.NamingConventions.ValidVariableName"/>
|
27 |
+
<exclude name="PEAR.Commenting.ClassComment"/>
|
28 |
+
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag"/>
|
29 |
+
<exclude name="PEAR.Commenting.FileComment.MissingPackageTag"/>
|
30 |
+
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag"/>
|
31 |
+
<exclude name="PEAR.Commenting.FileComment.MissingVersion"/>
|
32 |
+
<exclude name="PEAR.Commenting.InlineComment"/>
|
33 |
</rule>
|
34 |
|
35 |
<!-- Include some sniffs from other standards that don't conflict with PEAR -->
|
36 |
+
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
|
37 |
+
<rule ref="Squiz.Arrays.ArrayDeclaration"/>
|
38 |
+
<rule ref="Squiz.Commenting.ClosingDeclarationComment"/>
|
39 |
+
<rule ref="Squiz.ControlStructures.ControlSignature"/>
|
40 |
+
<rule ref="Squiz.ControlStructures.ElseIfDeclaration"/>
|
41 |
+
<rule ref="Squiz.Commenting.BlockComment"/>
|
42 |
+
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
|
43 |
+
<rule ref="Squiz.Commenting.EmptyCatchComment"/>
|
44 |
+
<rule ref="Squiz.Commenting.InlineComment"/>
|
45 |
+
<rule ref="Squiz.Commenting.LongConditionClosingComment"/>
|
46 |
+
<rule ref="Squiz.Commenting.PostStatementComment"/>
|
47 |
+
<rule ref="Squiz.Commenting.VariableComment"/>
|
48 |
+
<rule ref="Squiz.Formatting.OperatorBracket"/>
|
49 |
+
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"/>
|
50 |
+
<rule ref="Squiz.Operators.ComparisonOperatorUsage"/>
|
51 |
+
<rule ref="Squiz.PHP.DisallowInlineIf"/>
|
52 |
+
<rule ref="Squiz.Scope.MethodScope"/>
|
53 |
+
<rule ref="Squiz.Strings.ConcatenationSpacing"/>
|
54 |
+
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing"/>
|
55 |
+
<rule ref="Squiz.WhiteSpace.FunctionClosingBraceSpace"/>
|
56 |
+
<rule ref="Squiz.WhiteSpace.FunctionSpacing"/>
|
57 |
+
<rule ref="Squiz.WhiteSpace.OperatorSpacing"/>
|
58 |
+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
|
59 |
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
|
60 |
<rule ref="Generic.Commenting.Todo"/>
|
61 |
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
|
65 |
<rule ref="Generic.PHP.DeprecatedFunctions"/>
|
66 |
<rule ref="Generic.PHP.LowerCaseKeyword"/>
|
67 |
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
|
68 |
+
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
|
69 |
<rule ref="PSR2.Classes.PropertyDeclaration"/>
|
70 |
<rule ref="PSR2.Methods.MethodDeclaration"/>
|
71 |
<rule ref="PSR2.Files.EndFileNewline"/>
|
78 |
</properties>
|
79 |
</rule>
|
80 |
|
81 |
+
<!-- We use custom indent rules for arrays -->
|
82 |
<rule ref="Generic.Arrays.ArrayIndent"/>
|
83 |
<rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
|
84 |
<severity>0</severity>
|
94 |
</rule>
|
95 |
|
96 |
<!-- Check var names, but we don't want leading underscores for private vars -->
|
97 |
+
<rule ref="Squiz.NamingConventions.ValidVariableName"/>
|
98 |
<rule ref="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore">
|
99 |
<severity>0</severity>
|
100 |
</rule>
|
vendor/squizlabs/php_codesniffer/phpcs.xsd
CHANGED
@@ -92,6 +92,14 @@
|
|
92 |
</xs:attribute>
|
93 |
<xs:attribute name="name" type="xs:string" use="required"></xs:attribute>
|
94 |
<xs:attribute name="value" type="xs:string"></xs:attribute>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
</xs:complexType>
|
96 |
</xs:element>
|
97 |
</xs:sequence>
|
92 |
</xs:attribute>
|
93 |
<xs:attribute name="name" type="xs:string" use="required"></xs:attribute>
|
94 |
<xs:attribute name="value" type="xs:string"></xs:attribute>
|
95 |
+
<xs:attribute name="extend">
|
96 |
+
<xs:simpleType>
|
97 |
+
<xs:restriction base="xs:string">
|
98 |
+
<xs:enumeration value="true"/>
|
99 |
+
<xs:enumeration value="false"/>
|
100 |
+
</xs:restriction>
|
101 |
+
</xs:simpleType>
|
102 |
+
</xs:attribute>
|
103 |
</xs:complexType>
|
104 |
</xs:element>
|
105 |
</xs:sequence>
|
vendor/squizlabs/php_codesniffer/src/Config.php
CHANGED
@@ -23,7 +23,7 @@ class Config
|
|
23 |
*
|
24 |
* @var string
|
25 |
*/
|
26 |
-
const VERSION = '3.
|
27 |
|
28 |
/**
|
29 |
* Package stability; either stable, beta or alpha.
|
23 |
*
|
24 |
* @var string
|
25 |
*/
|
26 |
+
const VERSION = '3.4.0';
|
27 |
|
28 |
/**
|
29 |
* Package stability; either stable, beta or alpha.
|
vendor/squizlabs/php_codesniffer/src/Files/File.php
CHANGED
@@ -321,6 +321,11 @@ class File
|
|
321 |
|
322 |
$this->parse();
|
323 |
|
|
|
|
|
|
|
|
|
|
|
324 |
$this->fixer->startFile($this);
|
325 |
|
326 |
if (PHP_CODESNIFFER_VERBOSITY > 2) {
|
@@ -564,6 +569,7 @@ class File
|
|
564 |
$this->tokenizer = new $tokenizerClass($this->content, $this->config, $this->eolChar);
|
565 |
$this->tokens = $this->tokenizer->getTokens();
|
566 |
} catch (TokenizerException $e) {
|
|
|
567 |
$this->addWarning($e->getMessage(), null, 'Internal.Tokenizer.Exception');
|
568 |
if (PHP_CODESNIFFER_VERBOSITY > 0) {
|
569 |
echo "[$this->tokenizerType => tokenizer error]... ";
|
@@ -964,6 +970,7 @@ class File
|
|
964 |
}
|
965 |
|
966 |
// Make sure we are not ignoring this file.
|
|
|
967 |
foreach ($checkCodes as $checkCode) {
|
968 |
$patterns = null;
|
969 |
|
@@ -996,16 +1003,34 @@ class File
|
|
996 |
|
997 |
$pattern = '`'.strtr($pattern, $replacements).'`i';
|
998 |
$matched = preg_match($pattern, $this->path);
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1003 |
$this->ignoredCodes[$checkCode] = true;
|
1004 |
return false;
|
1005 |
}
|
|
|
|
|
|
|
|
|
1006 |
}//end foreach
|
1007 |
}//end foreach
|
1008 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1009 |
$messageCount++;
|
1010 |
if ($fixable === true) {
|
1011 |
$this->fixableCount++;
|
@@ -1345,7 +1370,7 @@ class File
|
|
1345 |
case T_SELF:
|
1346 |
case T_PARENT:
|
1347 |
case T_STATIC:
|
1348 |
-
// Self
|
1349 |
if (isset($defaultStart) === false) {
|
1350 |
if ($typeHintToken === false) {
|
1351 |
$typeHintToken = $i;
|
@@ -1463,6 +1488,7 @@ class File
|
|
1463 |
* 'is_abstract' => false, // true if the abstract keyword was found.
|
1464 |
* 'is_final' => false, // true if the final keyword was found.
|
1465 |
* 'is_static' => false, // true if the static keyword was found.
|
|
|
1466 |
* );
|
1467 |
* </code>
|
1468 |
*
|
@@ -1541,6 +1567,7 @@ class File
|
|
1541 |
$returnType = '';
|
1542 |
$returnTypeToken = false;
|
1543 |
$nullableReturnType = false;
|
|
|
1544 |
|
1545 |
if (isset($this->tokens[$stackPtr]['parenthesis_closer']) === true) {
|
1546 |
$scopeOpener = null;
|
@@ -1576,6 +1603,9 @@ class File
|
|
1576 |
$returnType .= $this->tokens[$i]['content'];
|
1577 |
}
|
1578 |
}
|
|
|
|
|
|
|
1579 |
}//end if
|
1580 |
|
1581 |
if ($returnType !== '' && $nullableReturnType === true) {
|
@@ -1591,6 +1621,7 @@ class File
|
|
1591 |
'is_abstract' => $isAbstract,
|
1592 |
'is_final' => $isFinal,
|
1593 |
'is_static' => $isStatic,
|
|
|
1594 |
];
|
1595 |
|
1596 |
}//end getMethodProperties()
|
@@ -1650,6 +1681,18 @@ class File
|
|
1650 |
}
|
1651 |
}
|
1652 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1653 |
$valid = [
|
1654 |
T_PUBLIC => T_PUBLIC,
|
1655 |
T_PRIVATE => T_PRIVATE,
|
@@ -1902,15 +1945,23 @@ class File
|
|
1902 |
* Returns the content of the tokens from the specified start position in
|
1903 |
* the token stack for the specified length.
|
1904 |
*
|
1905 |
-
* @param int
|
1906 |
-
* @param int
|
1907 |
-
* @param
|
1908 |
-
*
|
1909 |
*
|
1910 |
* @return string The token contents.
|
1911 |
*/
|
1912 |
public function getTokensAsString($start, $length, $origContent=false)
|
1913 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1914 |
$str = '';
|
1915 |
$end = ($start + $length);
|
1916 |
if ($end > $this->numTokens) {
|
321 |
|
322 |
$this->parse();
|
323 |
|
324 |
+
// Check if tokenizer errors cause this file to be ignored.
|
325 |
+
if ($this->ignored === true) {
|
326 |
+
return;
|
327 |
+
}
|
328 |
+
|
329 |
$this->fixer->startFile($this);
|
330 |
|
331 |
if (PHP_CODESNIFFER_VERBOSITY > 2) {
|
569 |
$this->tokenizer = new $tokenizerClass($this->content, $this->config, $this->eolChar);
|
570 |
$this->tokens = $this->tokenizer->getTokens();
|
571 |
} catch (TokenizerException $e) {
|
572 |
+
$this->ignored = true;
|
573 |
$this->addWarning($e->getMessage(), null, 'Internal.Tokenizer.Exception');
|
574 |
if (PHP_CODESNIFFER_VERBOSITY > 0) {
|
575 |
echo "[$this->tokenizerType => tokenizer error]... ";
|
970 |
}
|
971 |
|
972 |
// Make sure we are not ignoring this file.
|
973 |
+
$included = null;
|
974 |
foreach ($checkCodes as $checkCode) {
|
975 |
$patterns = null;
|
976 |
|
1003 |
|
1004 |
$pattern = '`'.strtr($pattern, $replacements).'`i';
|
1005 |
$matched = preg_match($pattern, $this->path);
|
1006 |
+
|
1007 |
+
if ($matched === 0) {
|
1008 |
+
if ($excluding === false && $included === null) {
|
1009 |
+
// This file path is not being included.
|
1010 |
+
$included = false;
|
1011 |
+
}
|
1012 |
+
|
1013 |
+
continue;
|
1014 |
+
}
|
1015 |
+
|
1016 |
+
if ($excluding === true) {
|
1017 |
+
// This file path is being excluded.
|
1018 |
$this->ignoredCodes[$checkCode] = true;
|
1019 |
return false;
|
1020 |
}
|
1021 |
+
|
1022 |
+
// This file path is being included.
|
1023 |
+
$included = true;
|
1024 |
+
break;
|
1025 |
}//end foreach
|
1026 |
}//end foreach
|
1027 |
|
1028 |
+
if ($included === false) {
|
1029 |
+
// There were include rules set, but this file
|
1030 |
+
// path didn't match any of them.
|
1031 |
+
return false;
|
1032 |
+
}
|
1033 |
+
|
1034 |
$messageCount++;
|
1035 |
if ($fixable === true) {
|
1036 |
$this->fixableCount++;
|
1370 |
case T_SELF:
|
1371 |
case T_PARENT:
|
1372 |
case T_STATIC:
|
1373 |
+
// Self and parent are valid, static invalid, but was probably intended as type hint.
|
1374 |
if (isset($defaultStart) === false) {
|
1375 |
if ($typeHintToken === false) {
|
1376 |
$typeHintToken = $i;
|
1488 |
* 'is_abstract' => false, // true if the abstract keyword was found.
|
1489 |
* 'is_final' => false, // true if the final keyword was found.
|
1490 |
* 'is_static' => false, // true if the static keyword was found.
|
1491 |
+
* 'has_body' => false, // true if the method has a body
|
1492 |
* );
|
1493 |
* </code>
|
1494 |
*
|
1567 |
$returnType = '';
|
1568 |
$returnTypeToken = false;
|
1569 |
$nullableReturnType = false;
|
1570 |
+
$hasBody = true;
|
1571 |
|
1572 |
if (isset($this->tokens[$stackPtr]['parenthesis_closer']) === true) {
|
1573 |
$scopeOpener = null;
|
1603 |
$returnType .= $this->tokens[$i]['content'];
|
1604 |
}
|
1605 |
}
|
1606 |
+
|
1607 |
+
$end = $this->findNext([T_OPEN_CURLY_BRACKET, T_SEMICOLON], $this->tokens[$stackPtr]['parenthesis_closer']);
|
1608 |
+
$hasBody = $this->tokens[$end]['code'] === T_OPEN_CURLY_BRACKET;
|
1609 |
}//end if
|
1610 |
|
1611 |
if ($returnType !== '' && $nullableReturnType === true) {
|
1621 |
'is_abstract' => $isAbstract,
|
1622 |
'is_final' => $isFinal,
|
1623 |
'is_static' => $isStatic,
|
1624 |
+
'has_body' => $hasBody,
|
1625 |
];
|
1626 |
|
1627 |
}//end getMethodProperties()
|
1681 |
}
|
1682 |
}
|
1683 |
|
1684 |
+
// Make sure it's not a method parameter.
|
1685 |
+
if (empty($this->tokens[$stackPtr]['nested_parenthesis']) === false) {
|
1686 |
+
$parenthesis = array_keys($this->tokens[$stackPtr]['nested_parenthesis']);
|
1687 |
+
$deepestOpen = array_pop($parenthesis);
|
1688 |
+
if ($deepestOpen > $ptr
|
1689 |
+
&& isset($this->tokens[$deepestOpen]['parenthesis_owner']) === true
|
1690 |
+
&& $this->tokens[$this->tokens[$deepestOpen]['parenthesis_owner']]['code'] === T_FUNCTION
|
1691 |
+
) {
|
1692 |
+
throw new TokenizerException('$stackPtr is not a class member var');
|
1693 |
+
}
|
1694 |
+
}
|
1695 |
+
|
1696 |
$valid = [
|
1697 |
T_PUBLIC => T_PUBLIC,
|
1698 |
T_PRIVATE => T_PRIVATE,
|
1945 |
* Returns the content of the tokens from the specified start position in
|
1946 |
* the token stack for the specified length.
|
1947 |
*
|
1948 |
+
* @param int $start The position to start from in the token stack.
|
1949 |
+
* @param int $length The length of tokens to traverse from the start pos.
|
1950 |
+
* @param bool $origContent Whether the original content or the tab replaced
|
1951 |
+
* content should be used.
|
1952 |
*
|
1953 |
* @return string The token contents.
|
1954 |
*/
|
1955 |
public function getTokensAsString($start, $length, $origContent=false)
|
1956 |
{
|
1957 |
+
if (is_int($start) === false || isset($this->tokens[$start]) === false) {
|
1958 |
+
throw new RuntimeException('The $start position for getTokensAsString() must exist in the token stack');
|
1959 |
+
}
|
1960 |
+
|
1961 |
+
if (is_int($length) === false || $length <= 0) {
|
1962 |
+
return '';
|
1963 |
+
}
|
1964 |
+
|
1965 |
$str = '';
|
1966 |
$end = ($start + $length);
|
1967 |
if ($end > $this->numTokens) {
|
vendor/squizlabs/php_codesniffer/src/Fixer.php
CHANGED
@@ -351,7 +351,7 @@ class Fixer
|
|
351 |
}
|
352 |
|
353 |
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
354 |
-
$bt = debug_backtrace();
|
355 |
$sniff = $bt[1]['class'];
|
356 |
$line = $bt[0]['line'];
|
357 |
|
@@ -480,7 +480,7 @@ class Fixer
|
|
480 |
}
|
481 |
|
482 |
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
483 |
-
$bt = debug_backtrace();
|
484 |
if ($bt[1]['class'] === 'PHP_CodeSniffer\Fixer') {
|
485 |
$sniff = $bt[2]['class'];
|
486 |
$line = $bt[1]['line'];
|
@@ -592,7 +592,7 @@ class Fixer
|
|
592 |
}
|
593 |
|
594 |
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
595 |
-
$bt = debug_backtrace();
|
596 |
if ($bt[1]['class'] === 'PHP_CodeSniffer\Fixer') {
|
597 |
$sniff = $bt[2]['class'];
|
598 |
$line = $bt[1]['line'];
|
351 |
}
|
352 |
|
353 |
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
354 |
+
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
355 |
$sniff = $bt[1]['class'];
|
356 |
$line = $bt[0]['line'];
|
357 |
|
480 |
}
|
481 |
|
482 |
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
483 |
+
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
484 |
if ($bt[1]['class'] === 'PHP_CodeSniffer\Fixer') {
|
485 |
$sniff = $bt[2]['class'];
|
486 |
$line = $bt[1]['line'];
|
592 |
}
|
593 |
|
594 |
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
595 |
+
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
596 |
if ($bt[1]['class'] === 'PHP_CodeSniffer\Fixer') {
|
597 |
$sniff = $bt[2]['class'];
|
598 |
$line = $bt[1]['line'];
|
vendor/squizlabs/php_codesniffer/src/Ruleset.php
CHANGED
@@ -950,6 +950,13 @@ class Ruleset
|
|
950 |
&& (string) $prop['type'] === 'array'
|
951 |
) {
|
952 |
$values = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
953 |
if (isset($prop->element) === true) {
|
954 |
$printValue = '';
|
955 |
foreach ($prop->element as $element) {
|
950 |
&& (string) $prop['type'] === 'array'
|
951 |
) {
|
952 |
$values = [];
|
953 |
+
if (isset($prop['extend']) === true
|
954 |
+
&& (string) $prop['extend'] === 'true'
|
955 |
+
&& isset($this->ruleset[$code]['properties'][$name]) === true
|
956 |
+
) {
|
957 |
+
$values = $this->ruleset[$code]['properties'][$name];
|
958 |
+
}
|
959 |
+
|
960 |
if (isset($prop->element) === true) {
|
961 |
$printValue = '';
|
962 |
foreach ($prop->element as $element) {
|
vendor/squizlabs/php_codesniffer/src/Runner.php
CHANGED
@@ -175,6 +175,13 @@ class Runner
|
|
175 |
// Init the run and load the rulesets to set additional config vars.
|
176 |
$this->init();
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
// Override some of the command line settings that might break the fixes.
|
179 |
$this->config->generator = null;
|
180 |
$this->config->explain = false;
|
175 |
// Init the run and load the rulesets to set additional config vars.
|
176 |
$this->init();
|
177 |
|
178 |
+
// When processing STDIN, we only process one file at a time and
|
179 |
+
// we don't process all the way through, so we can't use the parallel
|
180 |
+
// running system.
|
181 |
+
if ($this->config->stdin === true) {
|
182 |
+
$this->config->parallel = 1;
|
183 |
+
}
|
184 |
+
|
185 |
// Override some of the command line settings that might break the fixes.
|
186 |
$this->config->generator = null;
|
187 |
$this->config->explain = false;
|
vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractPatternSniff.php
CHANGED
@@ -785,7 +785,7 @@ abstract class AbstractPatternSniff implements Sniff
|
|
785 |
$specialPattern = $this->createSkipPattern($pattern, ($i - 1));
|
786 |
$lastToken = ($i - $firstToken);
|
787 |
$firstToken = ($i + 3);
|
788 |
-
$i
|
789 |
|
790 |
if ($specialPattern['to'] !== 'unknown') {
|
791 |
$firstToken++;
|
@@ -794,12 +794,12 @@ abstract class AbstractPatternSniff implements Sniff
|
|
794 |
$specialPattern = ['type' => 'string'];
|
795 |
$lastToken = ($i - $firstToken);
|
796 |
$firstToken = ($i + 3);
|
797 |
-
$i
|
798 |
} else if (substr($pattern, $i, 3) === 'EOL') {
|
799 |
$specialPattern = ['type' => 'newline'];
|
800 |
$lastToken = ($i - $firstToken);
|
801 |
$firstToken = ($i + 3);
|
802 |
-
$i
|
803 |
}//end if
|
804 |
|
805 |
if ($specialPattern !== false || $isLastChar === true) {
|
785 |
$specialPattern = $this->createSkipPattern($pattern, ($i - 1));
|
786 |
$lastToken = ($i - $firstToken);
|
787 |
$firstToken = ($i + 3);
|
788 |
+
$i += 2;
|
789 |
|
790 |
if ($specialPattern['to'] !== 'unknown') {
|
791 |
$firstToken++;
|
794 |
$specialPattern = ['type' => 'string'];
|
795 |
$lastToken = ($i - $firstToken);
|
796 |
$firstToken = ($i + 3);
|
797 |
+
$i += 2;
|
798 |
} else if (substr($pattern, $i, 3) === 'EOL') {
|
799 |
$specialPattern = ['type' => 'newline'];
|
800 |
$lastToken = ($i - $firstToken);
|
801 |
$firstToken = ($i + 3);
|
802 |
+
$i += 2;
|
803 |
}//end if
|
804 |
|
805 |
if ($specialPattern !== false || $isLastChar === true) {
|
vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractScopeSniff.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
* parent::__construct(array(T_CLASS), array(T_FUNCTION));
|
12 |
* }
|
13 |
*
|
14 |
-
* protected function processTokenWithinScope(\PHP_CodeSniffer\Files\File $phpcsFile, $)
|
15 |
* {
|
16 |
* $className = $phpcsFile->getDeclarationName($currScope);
|
17 |
* echo 'encountered a method within class '.$className;
|
@@ -123,7 +123,7 @@ abstract class AbstractScopeSniff implements Sniff
|
|
123 |
*
|
124 |
* @return void|int Optionally returns a stack pointer. The sniff will not be
|
125 |
* called again on the current file until the returned stack
|
126 |
-
* pointer is reached. Return (
|
127 |
* the rest of the file.
|
128 |
* @see processTokenWithinScope()
|
129 |
*/
|
@@ -166,7 +166,7 @@ abstract class AbstractScopeSniff implements Sniff
|
|
166 |
*
|
167 |
* @return void|int Optionally returns a stack pointer. The sniff will not be
|
168 |
* called again on the current file until the returned stack
|
169 |
-
* pointer is reached. Return (
|
170 |
* the rest of the file.
|
171 |
*/
|
172 |
abstract protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope);
|
11 |
* parent::__construct(array(T_CLASS), array(T_FUNCTION));
|
12 |
* }
|
13 |
*
|
14 |
+
* protected function processTokenWithinScope(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr, $currScope)
|
15 |
* {
|
16 |
* $className = $phpcsFile->getDeclarationName($currScope);
|
17 |
* echo 'encountered a method within class '.$className;
|
123 |
*
|
124 |
* @return void|int Optionally returns a stack pointer. The sniff will not be
|
125 |
* called again on the current file until the returned stack
|
126 |
+
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
|
127 |
* the rest of the file.
|
128 |
* @see processTokenWithinScope()
|
129 |
*/
|
166 |
*
|
167 |
* @return void|int Optionally returns a stack pointer. The sniff will not be
|
168 |
* called again on the current file until the returned stack
|
169 |
+
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
|
170 |
* the rest of the file.
|
171 |
*/
|
172 |
abstract protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope);
|
vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractVariableSniff.php
CHANGED
@@ -73,7 +73,7 @@ abstract class AbstractVariableSniff extends AbstractScopeSniff
|
|
73 |
*
|
74 |
* @return void|int Optionally returns a stack pointer. The sniff will not be
|
75 |
* called again on the current file until the returned stack
|
76 |
-
* pointer is reached. Return (
|
77 |
* the rest of the file.
|
78 |
*/
|
79 |
final protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
|
@@ -157,7 +157,7 @@ abstract class AbstractVariableSniff extends AbstractScopeSniff
|
|
157 |
*
|
158 |
* @return void|int Optionally returns a stack pointer. The sniff will not be
|
159 |
* called again on the current file until the returned stack
|
160 |
-
* pointer is reached. Return (
|
161 |
* the rest of the file.
|
162 |
*/
|
163 |
final protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
|
@@ -188,7 +188,7 @@ abstract class AbstractVariableSniff extends AbstractScopeSniff
|
|
188 |
*
|
189 |
* @return void|int Optionally returns a stack pointer. The sniff will not be
|
190 |
* called again on the current file until the returned stack
|
191 |
-
* pointer is reached. Return (
|
192 |
* the rest of the file.
|
193 |
*/
|
194 |
abstract protected function processMemberVar(File $phpcsFile, $stackPtr);
|
@@ -203,7 +203,7 @@ abstract class AbstractVariableSniff extends AbstractScopeSniff
|
|
203 |
*
|
204 |
* @return void|int Optionally returns a stack pointer. The sniff will not be
|
205 |
* called again on the current file until the returned stack
|
206 |
-
* pointer is reached. Return (
|
207 |
* the rest of the file.
|
208 |
*/
|
209 |
abstract protected function processVariable(File $phpcsFile, $stackPtr);
|
@@ -222,7 +222,7 @@ abstract class AbstractVariableSniff extends AbstractScopeSniff
|
|
222 |
*
|
223 |
* @return void|int Optionally returns a stack pointer. The sniff will not be
|
224 |
* called again on the current file until the returned stack
|
225 |
-
* pointer is reached. Return (
|
226 |
* the rest of the file.
|
227 |
*/
|
228 |
abstract protected function processVariableInString(File $phpcsFile, $stackPtr);
|
73 |
*
|
74 |
* @return void|int Optionally returns a stack pointer. The sniff will not be
|
75 |
* called again on the current file until the returned stack
|
76 |
+
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
|
77 |
* the rest of the file.
|
78 |
*/
|
79 |
final protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
|
157 |
*
|
158 |
* @return void|int Optionally returns a stack pointer. The sniff will not be
|
159 |
* called again on the current file until the returned stack
|
160 |
+
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
|
161 |
* the rest of the file.
|
162 |
*/
|
163 |
final protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
|
188 |
*
|
189 |
* @return void|int Optionally returns a stack pointer. The sniff will not be
|
190 |
* called again on the current file until the returned stack
|
191 |
+
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
|
192 |
* the rest of the file.
|
193 |
*/
|
194 |
abstract protected function processMemberVar(File $phpcsFile, $stackPtr);
|
203 |
*
|
204 |
* @return void|int Optionally returns a stack pointer. The sniff will not be
|
205 |
* called again on the current file until the returned stack
|
206 |
+
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
|
207 |
* the rest of the file.
|
208 |
*/
|
209 |
abstract protected function processVariable(File $phpcsFile, $stackPtr);
|
222 |
*
|
223 |
* @return void|int Optionally returns a stack pointer. The sniff will not be
|
224 |
* called again on the current file until the returned stack
|
225 |
+
* pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
|
226 |
* the rest of the file.
|
227 |
*/
|
228 |
abstract protected function processVariableInString(File $phpcsFile, $stackPtr);
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/SpaceAfterNotStandard.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<documentation title="Space After NOT operator">
|
2 |
+
<standard>
|
3 |
+
<![CDATA[
|
4 |
+
Exactly one space is allowed after the NOT operator.
|
5 |
+
]]>
|
6 |
+
</standard>
|
7 |
+
<code_comparison>
|
8 |
+
<code title="Valid: A NOT operator followed by one space.">
|
9 |
+
<![CDATA[
|
10 |
+
if (!<em> </em>$someVar || !<em> </em>$x instanceOf stdClass) {};
|
11 |
+
]]>
|
12 |
+
</code>
|
13 |
+
<code title="Invalid: A NOT operator not followed by whitespace.">
|
14 |
+
<![CDATA[
|
15 |
+
if (!<em></em>$someVar || !<em></em>$x instanceOf stdClass) {};
|
16 |
+
]]>
|
17 |
+
</code>
|
18 |
+
<code title="Invalid: A NOT operator followed by a new line or more than one space.">
|
19 |
+
<![CDATA[
|
20 |
+
if (!<em> </em>$someVar || !<em>
|
21 |
+
</em>$x instanceOf stdClass) {};
|
22 |
+
]]>
|
23 |
+
</code>
|
24 |
+
</code_comparison>
|
25 |
+
</documentation>
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Classes/DuplicateClassNameSniff.php
CHANGED
@@ -52,6 +52,7 @@ class DuplicateClassNameSniff implements Sniff
|
|
52 |
$findTokens = [
|
53 |
T_CLASS,
|
54 |
T_INTERFACE,
|
|
|
55 |
T_NAMESPACE,
|
56 |
T_CLOSE_TAG,
|
57 |
];
|
52 |
$findTokens = [
|
53 |
T_CLASS,
|
54 |
T_INTERFACE,
|
55 |
+
T_TRAIT,
|
56 |
T_NAMESPACE,
|
57 |
T_CLOSE_TAG,
|
58 |
];
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyPHPStatementSniff.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Checks against empty PHP statements.
|
4 |
+
*
|
5 |
+
* - Check against two semi-colons with no executable code in between.
|
6 |
+
* - Check against an empty PHP open - close tag combination.
|
7 |
+
*
|
8 |
+
* @author Juliette Reinders Folmer <phpcs_nospam@adviesenzo.nl>
|
9 |
+
* @copyright 2017 Juliette Reinders Folmer. All rights reserved.
|
10 |
+
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis;
|
14 |
+
|
15 |
+
use PHP_CodeSniffer\Sniffs\Sniff;
|
16 |
+
use PHP_CodeSniffer\Files\File;
|
17 |
+
use PHP_CodeSniffer\Util\Tokens;
|
18 |
+
|
19 |
+
class EmptyPHPStatementSniff implements Sniff
|
20 |
+
{
|
21 |
+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Returns an array of tokens this test wants to listen for.
|
25 |
+
*
|
26 |
+
* @return int[]
|
27 |
+
*/
|
28 |
+
public function register()
|
29 |
+
{
|
30 |
+
return [
|
31 |
+
T_SEMICOLON,
|
32 |
+
T_CLOSE_TAG,
|
33 |
+
];
|
34 |
+
|
35 |
+
}//end register()
|
36 |
+
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Processes this test, when one of its tokens is encountered.
|
40 |
+
*
|
41 |
+
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
42 |
+
* @param int $stackPtr The position of the current token
|
43 |
+
* in the stack passed in $tokens.
|
44 |
+
*
|
45 |
+
* @return void
|
46 |
+
*/
|
47 |
+
public function process(File $phpcsFile, $stackPtr)
|
48 |
+
{
|
49 |
+
$tokens = $phpcsFile->getTokens();
|
50 |
+
|
51 |
+
switch ($tokens[$stackPtr]['type']) {
|
52 |
+
// Detect `something();;`.
|
53 |
+
case 'T_SEMICOLON':
|
54 |
+
$prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
55 |
+
|
56 |
+
if ($prevNonEmpty === false
|
57 |
+
|| ($tokens[$prevNonEmpty]['code'] !== T_SEMICOLON
|
58 |
+
&& $tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG
|
59 |
+
&& $tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG_WITH_ECHO)
|
60 |
+
) {
|
61 |
+
return;
|
62 |
+
}
|
63 |
+
|
64 |
+
if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) {
|
65 |
+
$nested = $tokens[$stackPtr]['nested_parenthesis'];
|
66 |
+
$lastCloser = array_pop($nested);
|
67 |
+
if (isset($tokens[$lastCloser]['parenthesis_owner']) === true
|
68 |
+
&& $tokens[$tokens[$lastCloser]['parenthesis_owner']]['code'] === T_FOR
|
69 |
+
) {
|
70 |
+
// Empty for() condition.
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
$fix = $phpcsFile->addFixableWarning(
|
76 |
+
'Empty PHP statement detected: superfluous semi-colon.',
|
77 |
+
$stackPtr,
|
78 |
+
'SemicolonWithoutCodeDetected'
|
79 |
+
);
|
80 |
+
if ($fix === true) {
|
81 |
+
$phpcsFile->fixer->beginChangeset();
|
82 |
+
|
83 |
+
if ($tokens[$prevNonEmpty]['code'] === T_OPEN_TAG
|
84 |
+
|| $tokens[$prevNonEmpty]['code'] === T_OPEN_TAG_WITH_ECHO
|
85 |
+
) {
|
86 |
+
// Check for superfluous whitespace after the semi-colon which will be
|
87 |
+
// removed as the `<?php ` open tag token already contains whitespace,
|
88 |
+
// either a space or a new line.
|
89 |
+
if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) {
|
90 |
+
$replacement = str_replace(' ', '', $tokens[($stackPtr + 1)]['content']);
|
91 |
+
$phpcsFile->fixer->replaceToken(($stackPtr + 1), $replacement);
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
for ($i = $stackPtr; $i > $prevNonEmpty; $i--) {
|
96 |
+
if ($tokens[$i]['code'] !== T_SEMICOLON
|
97 |
+
&& $tokens[$i]['code'] !== T_WHITESPACE
|
98 |
+
) {
|
99 |
+
break;
|
100 |
+
}
|
101 |
+
|
102 |
+
$phpcsFile->fixer->replaceToken($i, '');
|
103 |
+
}
|
104 |
+
|
105 |
+
$phpcsFile->fixer->endChangeset();
|
106 |
+
}//end if
|
107 |
+
break;
|
108 |
+
|
109 |
+
// Detect `<?php ? >`.
|
110 |
+
case 'T_CLOSE_TAG':
|
111 |
+
$prevNonEmpty = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
|
112 |
+
|
113 |
+
if ($prevNonEmpty === false
|
114 |
+
|| ($tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG
|
115 |
+
&& $tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG_WITH_ECHO)
|
116 |
+
) {
|
117 |
+
return;
|
118 |
+
}
|
119 |
+
|
120 |
+
$fix = $phpcsFile->addFixableWarning(
|
121 |
+
'Empty PHP open/close tag combination detected.',
|
122 |
+
$prevNonEmpty,
|
123 |
+
'EmptyPHPOpenCloseTagsDetected'
|
124 |
+
);
|
125 |
+
if ($fix === true) {
|
126 |
+
$phpcsFile->fixer->beginChangeset();
|
127 |
+
|
128 |
+
for ($i = $prevNonEmpty; $i <= $stackPtr; $i++) {
|
129 |
+
$phpcsFile->fixer->replaceToken($i, '');
|
130 |
+
}
|
131 |
+
|
132 |
+
$phpcsFile->fixer->endChangeset();
|
133 |
+
}
|
134 |
+
break;
|
135 |
+
|
136 |
+
default:
|
137 |
+
// Deliberately left empty.
|
138 |
+
break;
|
139 |
+
}//end switch
|
140 |
+
|
141 |
+
}//end process()
|
142 |
+
|
143 |
+
|
144 |
+
}//end class
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnusedFunctionParameterSniff.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Checks
|
4 |
*
|
5 |
* This sniff checks that all function parameters are used in the function body.
|
6 |
* One exception is made for empty function bodies or function bodies that only
|
@@ -58,8 +58,30 @@ class UnusedFunctionParameterSniff implements Sniff
|
|
58 |
return;
|
59 |
}
|
60 |
|
61 |
-
$
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
$params[$param['name']] = $stackPtr;
|
64 |
}
|
65 |
|
@@ -87,24 +109,24 @@ class UnusedFunctionParameterSniff implements Sniff
|
|
87 |
|
88 |
if ($foundContent === false) {
|
89 |
// A throw statement as the first content indicates an interface method.
|
90 |
-
if ($code === T_THROW) {
|
91 |
return;
|
92 |
}
|
93 |
|
94 |
// A return statement as the first content indicates an interface method.
|
95 |
if ($code === T_RETURN) {
|
96 |
$tmp = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true);
|
97 |
-
if ($tmp === false) {
|
98 |
return;
|
99 |
}
|
100 |
|
101 |
// There is a return.
|
102 |
-
if ($tokens[$tmp]['code'] === T_SEMICOLON) {
|
103 |
return;
|
104 |
}
|
105 |
|
106 |
$tmp = $phpcsFile->findNext(Tokens::$emptyTokens, ($tmp + 1), null, true);
|
107 |
-
if ($tmp !== false && $tokens[$tmp]['code'] === T_SEMICOLON) {
|
108 |
// There is a return <token>.
|
109 |
return;
|
110 |
}
|
@@ -163,12 +185,49 @@ class UnusedFunctionParameterSniff implements Sniff
|
|
163 |
}//end for
|
164 |
|
165 |
if ($foundContent === true && count($params) > 0) {
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
}
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
}//end process()
|
174 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Checks for unused function parameters.
|
4 |
*
|
5 |
* This sniff checks that all function parameters are used in the function body.
|
6 |
* One exception is made for empty function bodies or function bodies that only
|
58 |
return;
|
59 |
}
|
60 |
|
61 |
+
$errorCode = 'Found';
|
62 |
+
$implements = false;
|
63 |
+
$extends = false;
|
64 |
+
$classPtr = $phpcsFile->getCondition($stackPtr, T_CLASS);
|
65 |
+
if ($classPtr !== false) {
|
66 |
+
$implements = $phpcsFile->findImplementedInterfaceNames($classPtr);
|
67 |
+
$extends = $phpcsFile->findExtendedClassName($classPtr);
|
68 |
+
if ($extends !== false) {
|
69 |
+
$errorCode .= 'InExtendedClass';
|
70 |
+
} else if ($implements !== false) {
|
71 |
+
$errorCode .= 'InImplementedInterface';
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
$params = [];
|
76 |
+
$methodParams = $phpcsFile->getMethodParameters($stackPtr);
|
77 |
+
|
78 |
+
// Skip when no parameters found.
|
79 |
+
$methodParamsCount = count($methodParams);
|
80 |
+
if ($methodParamsCount === 0) {
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
|
84 |
+
foreach ($methodParams as $param) {
|
85 |
$params[$param['name']] = $stackPtr;
|
86 |
}
|
87 |
|
109 |
|
110 |
if ($foundContent === false) {
|
111 |
// A throw statement as the first content indicates an interface method.
|
112 |
+
if ($code === T_THROW && $implements !== false) {
|
113 |
return;
|
114 |
}
|
115 |
|
116 |
// A return statement as the first content indicates an interface method.
|
117 |
if ($code === T_RETURN) {
|
118 |
$tmp = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true);
|
119 |
+
if ($tmp === false && $implements !== false) {
|
120 |
return;
|
121 |
}
|
122 |
|
123 |
// There is a return.
|
124 |
+
if ($tokens[$tmp]['code'] === T_SEMICOLON && $implements !== false) {
|
125 |
return;
|
126 |
}
|
127 |
|
128 |
$tmp = $phpcsFile->findNext(Tokens::$emptyTokens, ($tmp + 1), null, true);
|
129 |
+
if ($tmp !== false && $tokens[$tmp]['code'] === T_SEMICOLON && $implements !== false) {
|
130 |
// There is a return <token>.
|
131 |
return;
|
132 |
}
|
185 |
}//end for
|
186 |
|
187 |
if ($foundContent === true && count($params) > 0) {
|
188 |
+
$error = 'The method parameter %s is never used';
|
189 |
+
|
190 |
+
// If there is only one parameter and it is unused, no need for additional errorcode toggling logic.
|
191 |
+
if ($methodParamsCount === 1) {
|
192 |
+
foreach ($params as $paramName => $position) {
|
193 |
+
$data = [$paramName];
|
194 |
+
$phpcsFile->addWarning($error, $position, $errorCode, $data);
|
195 |
+
}
|
196 |
+
|
197 |
+
return;
|
198 |
}
|
199 |
+
|
200 |
+
$foundLastUsed = false;
|
201 |
+
$lastIndex = ($methodParamsCount - 1);
|
202 |
+
$errorInfo = [];
|
203 |
+
for ($i = $lastIndex; $i >= 0; --$i) {
|
204 |
+
if ($foundLastUsed !== false) {
|
205 |
+
if (isset($params[$methodParams[$i]['name']]) === true) {
|
206 |
+
$errorInfo[$methodParams[$i]['name']] = [
|
207 |
+
'position' => $params[$methodParams[$i]['name']],
|
208 |
+
'errorcode' => $errorCode.'BeforeLastUsed',
|
209 |
+
];
|
210 |
+
}
|
211 |
+
} else {
|
212 |
+
if (isset($params[$methodParams[$i]['name']]) === false) {
|
213 |
+
$foundLastUsed = true;
|
214 |
+
} else {
|
215 |
+
$errorInfo[$methodParams[$i]['name']] = [
|
216 |
+
'position' => $params[$methodParams[$i]['name']],
|
217 |
+
'errorcode' => $errorCode.'AfterLastUsed',
|
218 |
+
];
|
219 |
+
}
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
if (count($errorInfo) > 0) {
|
224 |
+
$errorInfo = array_reverse($errorInfo);
|
225 |
+
foreach ($errorInfo as $paramName => $info) {
|
226 |
+
$data = [$paramName];
|
227 |
+
$phpcsFile->addWarning($error, $info['position'], $info['errorcode'], $data);
|
228 |
+
}
|
229 |
+
}
|
230 |
+
}//end if
|
231 |
|
232 |
}//end process()
|
233 |
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/InlineHTMLSniff.php
CHANGED
@@ -15,6 +15,19 @@ use PHP_CodeSniffer\Files\File;
|
|
15 |
class InlineHTMLSniff implements Sniff
|
16 |
{
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
/**
|
20 |
* Returns an array of tokens this test wants to listen for.
|
@@ -39,6 +52,16 @@ class InlineHTMLSniff implements Sniff
|
|
39 |
*/
|
40 |
public function process(File $phpcsFile, $stackPtr)
|
41 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
// Ignore shebang lines.
|
43 |
$tokens = $phpcsFile->getTokens();
|
44 |
if (substr($tokens[$stackPtr]['content'], 0, 2) === '#!') {
|
15 |
class InlineHTMLSniff implements Sniff
|
16 |
{
|
17 |
|
18 |
+
/**
|
19 |
+
* List of supported BOM definitions.
|
20 |
+
*
|
21 |
+
* Use encoding names as keys and hex BOM representations as values.
|
22 |
+
*
|
23 |
+
* @var array
|
24 |
+
*/
|
25 |
+
protected $bomDefinitions = [
|
26 |
+
'UTF-8' => 'efbbbf',
|
27 |
+
'UTF-16 (BE)' => 'feff',
|
28 |
+
'UTF-16 (LE)' => 'fffe',
|
29 |
+
];
|
30 |
+
|
31 |
|
32 |
/**
|
33 |
* Returns an array of tokens this test wants to listen for.
|
52 |
*/
|
53 |
public function process(File $phpcsFile, $stackPtr)
|
54 |
{
|
55 |
+
// Allow a byte-order mark.
|
56 |
+
$tokens = $phpcsFile->getTokens();
|
57 |
+
foreach ($this->bomDefinitions as $bomName => $expectedBomHex) {
|
58 |
+
$bomByteLength = (strlen($expectedBomHex) / 2);
|
59 |
+
$htmlBomHex = bin2hex(substr($tokens[0]['content'], 0, $bomByteLength));
|
60 |
+
if ($htmlBomHex === $expectedBomHex && strlen($tokens[0]['content']) === $bomByteLength) {
|
61 |
+
return;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
// Ignore shebang lines.
|
66 |
$tokens = $phpcsFile->getTokens();
|
67 |
if (substr($tokens[$stackPtr]['content'], 0, 2) === '#!') {
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/NoSpaceAfterCastSniff.php
CHANGED
@@ -5,6 +5,9 @@
|
|
5 |
* @author Greg Sherwood <gsherwood@squiz.net>
|
6 |
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
|
7 |
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
|
|
|
|
|
|
8 |
*/
|
9 |
|
10 |
namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting;
|
5 |
* @author Greg Sherwood <gsherwood@squiz.net>
|
6 |
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
|
7 |
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
8 |
+
*
|
9 |
+
* @deprecated 3.4.0 Use the Generic.Formatting.SpaceAfterCast sniff with
|
10 |
+
* the $spacing property set to 0 instead.
|
11 |
*/
|
12 |
|
13 |
namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceAfterCastSniff.php
CHANGED
@@ -16,6 +16,20 @@ use PHP_CodeSniffer\Util\Tokens;
|
|
16 |
class SpaceAfterCastSniff implements Sniff
|
17 |
{
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
/**
|
21 |
* Returns an array of tokens this test wants to listen for.
|
@@ -40,26 +54,96 @@ class SpaceAfterCastSniff implements Sniff
|
|
40 |
*/
|
41 |
public function process(File $phpcsFile, $stackPtr)
|
42 |
{
|
43 |
-
$tokens
|
|
|
44 |
|
45 |
-
if ($tokens[
|
46 |
-
$
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
$phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', 0);
|
53 |
return;
|
54 |
}
|
55 |
|
56 |
-
$phpcsFile->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
|
59 |
-
$error = 'A cast statement must be followed by a single space';
|
60 |
-
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'TooMuchSpace');
|
61 |
-
if ($fix === true) {
|
62 |
-
$phpcsFile->fixer->replaceToken(($stackPtr + 1), ' ');
|
63 |
}
|
64 |
}
|
65 |
|
16 |
class SpaceAfterCastSniff implements Sniff
|
17 |
{
|
18 |
|
19 |
+
/**
|
20 |
+
* The number of spaces desired after a cast token.
|
21 |
+
*
|
22 |
+
* @var integer
|
23 |
+
*/
|
24 |
+
public $spacing = 1;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Allow newlines instead of spaces.
|
28 |
+
*
|
29 |
+
* @var boolean
|
30 |
+
*/
|
31 |
+
public $ignoreNewlines = false;
|
32 |
+
|
33 |
|
34 |
/**
|
35 |
* Returns an array of tokens this test wants to listen for.
|
54 |
*/
|
55 |
public function process(File $phpcsFile, $stackPtr)
|
56 |
{
|
57 |
+
$tokens = $phpcsFile->getTokens();
|
58 |
+
$this->spacing = (int) $this->spacing;
|
59 |
|
60 |
+
if ($tokens[$stackPtr]['code'] === T_BINARY_CAST
|
61 |
+
&& $tokens[$stackPtr]['content'] === 'b'
|
62 |
+
) {
|
63 |
+
// You can't replace a space after this type of binary casting.
|
64 |
+
return;
|
65 |
+
}
|
66 |
+
|
67 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
68 |
+
if ($nextNonEmpty === false) {
|
69 |
+
return;
|
70 |
+
}
|
71 |
|
72 |
+
if ($this->ignoreNewlines === true
|
73 |
+
&& $tokens[$stackPtr]['line'] !== $tokens[$nextNonEmpty]['line']
|
74 |
+
) {
|
75 |
+
$phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', 'newline');
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
|
79 |
+
if ($this->spacing === 0 && $nextNonEmpty === ($stackPtr + 1)) {
|
80 |
$phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', 0);
|
81 |
return;
|
82 |
}
|
83 |
|
84 |
+
$nextNonWhitespace = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
|
85 |
+
if ($nextNonEmpty !== $nextNonWhitespace) {
|
86 |
+
$error = 'Expected %s space(s) after cast statement; comment found';
|
87 |
+
$data = [$this->spacing];
|
88 |
+
$phpcsFile->addError($error, $stackPtr, 'CommentFound', $data);
|
89 |
+
|
90 |
+
if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) {
|
91 |
+
$phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', $tokens[($stackPtr + 1)]['length']);
|
92 |
+
} else {
|
93 |
+
$phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', 0);
|
94 |
+
}
|
95 |
+
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
|
99 |
+
$found = 0;
|
100 |
+
if ($tokens[$stackPtr]['line'] !== $tokens[$nextNonEmpty]['line']) {
|
101 |
+
$found = 'newline';
|
102 |
+
} else if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) {
|
103 |
+
$found = $tokens[($stackPtr + 1)]['length'];
|
104 |
+
}
|
105 |
+
|
106 |
+
$phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', $found);
|
107 |
+
|
108 |
+
if ($found === $this->spacing) {
|
109 |
+
return;
|
110 |
+
}
|
111 |
+
|
112 |
+
$error = 'Expected %s space(s) after cast statement; %s found';
|
113 |
+
$data = [
|
114 |
+
$this->spacing,
|
115 |
+
$found,
|
116 |
+
];
|
117 |
+
|
118 |
+
$errorCode = 'TooMuchSpace';
|
119 |
+
if ($this->spacing !== 0) {
|
120 |
+
if ($found === 0) {
|
121 |
+
$errorCode = 'NoSpace';
|
122 |
+
} else if ($found !== 'newline' && $found < $this->spacing) {
|
123 |
+
$errorCode = 'TooLittleSpace';
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
$fix = $phpcsFile->addFixableError($error, $stackPtr, $errorCode, $data);
|
128 |
+
|
129 |
+
if ($fix === true) {
|
130 |
+
$padding = str_repeat(' ', $this->spacing);
|
131 |
+
if ($found === 0) {
|
132 |
+
$phpcsFile->fixer->addContent($stackPtr, $padding);
|
133 |
+
} else {
|
134 |
+
$phpcsFile->fixer->beginChangeset();
|
135 |
+
$start = ($stackPtr + 1);
|
136 |
+
|
137 |
+
if ($this->spacing > 0) {
|
138 |
+
$phpcsFile->fixer->replaceToken($start, $padding);
|
139 |
+
++$start;
|
140 |
+
}
|
141 |
+
|
142 |
+
for ($i = $start; $i < $nextNonWhitespace; $i++) {
|
143 |
+
$phpcsFile->fixer->replaceToken($i, '');
|
144 |
+
}
|
145 |
|
146 |
+
$phpcsFile->fixer->endChangeset();
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
}
|
149 |
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceAfterNotSniff.php
CHANGED
@@ -11,6 +11,7 @@ namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting;
|
|
11 |
|
12 |
use PHP_CodeSniffer\Sniffs\Sniff;
|
13 |
use PHP_CodeSniffer\Files\File;
|
|
|
14 |
|
15 |
class SpaceAfterNotSniff implements Sniff
|
16 |
{
|
@@ -25,6 +26,20 @@ class SpaceAfterNotSniff implements Sniff
|
|
25 |
'JS',
|
26 |
];
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
/**
|
30 |
* Returns an array of tokens this test wants to listen for.
|
@@ -49,25 +64,68 @@ class SpaceAfterNotSniff implements Sniff
|
|
49 |
*/
|
50 |
public function process(File $phpcsFile, $stackPtr)
|
51 |
{
|
52 |
-
$tokens
|
|
|
53 |
|
54 |
-
$
|
55 |
-
if ($
|
56 |
-
|
57 |
}
|
58 |
|
59 |
-
if ($
|
|
|
|
|
60 |
return;
|
61 |
}
|
62 |
|
63 |
-
$
|
64 |
-
|
|
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
if ($fix === true) {
|
67 |
-
|
68 |
-
|
|
|
69 |
} else {
|
70 |
-
$phpcsFile->fixer->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
}
|
73 |
|
11 |
|
12 |
use PHP_CodeSniffer\Sniffs\Sniff;
|
13 |
use PHP_CodeSniffer\Files\File;
|
14 |
+
use PHP_CodeSniffer\Util\Tokens;
|
15 |
|
16 |
class SpaceAfterNotSniff implements Sniff
|
17 |
{
|
26 |
'JS',
|
27 |
];
|
28 |
|
29 |
+
/**
|
30 |
+
* The number of spaces desired after the NOT operator.
|
31 |
+
*
|
32 |
+
* @var integer
|
33 |
+
*/
|
34 |
+
public $spacing = 1;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Allow newlines instead of spaces.
|
38 |
+
*
|
39 |
+
* @var boolean
|
40 |
+
*/
|
41 |
+
public $ignoreNewlines = false;
|
42 |
+
|
43 |
|
44 |
/**
|
45 |
* Returns an array of tokens this test wants to listen for.
|
64 |
*/
|
65 |
public function process(File $phpcsFile, $stackPtr)
|
66 |
{
|
67 |
+
$tokens = $phpcsFile->getTokens();
|
68 |
+
$this->spacing = (int) $this->spacing;
|
69 |
|
70 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
71 |
+
if ($nextNonEmpty === false) {
|
72 |
+
return;
|
73 |
}
|
74 |
|
75 |
+
if ($this->ignoreNewlines === true
|
76 |
+
&& $tokens[$stackPtr]['line'] !== $tokens[$nextNonEmpty]['line']
|
77 |
+
) {
|
78 |
return;
|
79 |
}
|
80 |
|
81 |
+
if ($this->spacing === 0 && $nextNonEmpty === ($stackPtr + 1)) {
|
82 |
+
return;
|
83 |
+
}
|
84 |
|
85 |
+
$nextNonWhitespace = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
|
86 |
+
if ($nextNonEmpty !== $nextNonWhitespace) {
|
87 |
+
$error = 'Expected %s space(s) after NOT operator; comment found';
|
88 |
+
$data = [$this->spacing];
|
89 |
+
$phpcsFile->addError($error, $stackPtr, 'CommentFound', $data);
|
90 |
+
return;
|
91 |
+
}
|
92 |
+
|
93 |
+
$found = 0;
|
94 |
+
if ($tokens[$stackPtr]['line'] !== $tokens[$nextNonEmpty]['line']) {
|
95 |
+
$found = 'newline';
|
96 |
+
} else if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) {
|
97 |
+
$found = $tokens[($stackPtr + 1)]['length'];
|
98 |
+
}
|
99 |
+
|
100 |
+
if ($found === $this->spacing) {
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
|
104 |
+
$error = 'Expected %s space(s) after NOT operator; %s found';
|
105 |
+
$data = [
|
106 |
+
$this->spacing,
|
107 |
+
$found,
|
108 |
+
];
|
109 |
+
|
110 |
+
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'Incorrect', $data);
|
111 |
if ($fix === true) {
|
112 |
+
$padding = str_repeat(' ', $this->spacing);
|
113 |
+
if ($found === 0) {
|
114 |
+
$phpcsFile->fixer->addContent($stackPtr, $padding);
|
115 |
} else {
|
116 |
+
$phpcsFile->fixer->beginChangeset();
|
117 |
+
$start = ($stackPtr + 1);
|
118 |
+
|
119 |
+
if ($this->spacing > 0) {
|
120 |
+
$phpcsFile->fixer->replaceToken($start, $padding);
|
121 |
+
++$start;
|
122 |
+
}
|
123 |
+
|
124 |
+
for ($i = $start; $i < $nextNonWhitespace; $i++) {
|
125 |
+
$phpcsFile->fixer->replaceToken($i, '');
|
126 |
+
}
|
127 |
+
|
128 |
+
$phpcsFile->fixer->endChangeset();
|
129 |
}
|
130 |
}
|
131 |
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceBeforeCastSniff.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ensures there is a single space before cast tokens.
|
4 |
+
*
|
5 |
+
* @author Greg Sherwood <gsherwood@squiz.net>
|
6 |
+
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
|
7 |
+
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
8 |
+
*/
|
9 |
+
|
10 |
+
namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting;
|
11 |
+
|
12 |
+
use PHP_CodeSniffer\Sniffs\Sniff;
|
13 |
+
use PHP_CodeSniffer\Files\File;
|
14 |
+
use PHP_CodeSniffer\Util\Tokens;
|
15 |
+
|
16 |
+
class SpaceBeforeCastSniff implements Sniff
|
17 |
+
{
|
18 |
+
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Returns an array of tokens this test wants to listen for.
|
22 |
+
*
|
23 |
+
* @return array
|
24 |
+
*/
|
25 |
+
public function register()
|
26 |
+
{
|
27 |
+
return Tokens::$castTokens;
|
28 |
+
|
29 |
+
}//end register()
|
30 |
+
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Processes this test, when one of its tokens is encountered.
|
34 |
+
*
|
35 |
+
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
36 |
+
* @param int $stackPtr The position of the current token in
|
37 |
+
* the stack passed in $tokens.
|
38 |
+
*
|
39 |
+
* @return void
|
40 |
+
*/
|
41 |
+
public function process(File $phpcsFile, $stackPtr)
|
42 |
+
{
|
43 |
+
$tokens = $phpcsFile->getTokens();
|
44 |
+
|
45 |
+
if ($tokens[$stackPtr]['column'] === 1) {
|
46 |
+
return;
|
47 |
+
}
|
48 |
+
|
49 |
+
if ($tokens[($stackPtr - 1)]['code'] !== T_WHITESPACE) {
|
50 |
+
$error = 'A cast statement must be preceded by a single space';
|
51 |
+
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'NoSpace');
|
52 |
+
if ($fix === true) {
|
53 |
+
$phpcsFile->fixer->addContentBefore($stackPtr, ' ');
|
54 |
+
}
|
55 |
+
|
56 |
+
$phpcsFile->recordMetric($stackPtr, 'Spacing before cast statement', 0);
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
+
$phpcsFile->recordMetric($stackPtr, 'Spacing before cast statement', $tokens[($stackPtr - 1)]['length']);
|
61 |
+
|
62 |
+
if ($tokens[($stackPtr - 1)]['column'] !== 1 && $tokens[($stackPtr - 1)]['length'] !== 1) {
|
63 |
+
$error = 'A cast statement must be preceded by a single space';
|
64 |
+
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'TooMuchSpace');
|
65 |
+
if ($fix === true) {
|
66 |
+
$phpcsFile->fixer->replaceToken(($stackPtr - 1), ' ');
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
}//end process()
|
71 |
+
|
72 |
+
|
73 |
+
}//end class
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php
CHANGED
@@ -105,7 +105,6 @@ class CallTimePassByReferenceSniff implements Sniff
|
|
105 |
continue;
|
106 |
}
|
107 |
|
108 |
-
// Checking this: $value = my_function(...[*]$arg...).
|
109 |
$tokenBefore = $phpcsFile->findPrevious(
|
110 |
Tokens::$emptyTokens,
|
111 |
($nextSeparator - 1),
|
@@ -114,7 +113,13 @@ class CallTimePassByReferenceSniff implements Sniff
|
|
114 |
);
|
115 |
|
116 |
if ($tokens[$tokenBefore]['code'] === T_BITWISE_AND) {
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
$tokenBefore = $phpcsFile->findPrevious(
|
119 |
Tokens::$emptyTokens,
|
120 |
($tokenBefore - 1),
|
@@ -122,16 +127,7 @@ class CallTimePassByReferenceSniff implements Sniff
|
|
122 |
true
|
123 |
);
|
124 |
|
125 |
-
|
126 |
-
// references. We use a blacklist approach as we prefer false
|
127 |
-
// positives to not identifying a pass-by-reference call at all.
|
128 |
-
$tokenCode = $tokens[$tokenBefore]['code'];
|
129 |
-
if ($tokenCode === T_VARIABLE
|
130 |
-
|| $tokenCode === T_CLOSE_PARENTHESIS
|
131 |
-
|| $tokenCode === T_CLOSE_SQUARE_BRACKET
|
132 |
-
|| $tokenCode === T_LNUMBER
|
133 |
-
|| isset(Tokens::$assignmentTokens[$tokenCode]) === true
|
134 |
-
) {
|
135 |
continue;
|
136 |
}
|
137 |
|
105 |
continue;
|
106 |
}
|
107 |
|
|
|
108 |
$tokenBefore = $phpcsFile->findPrevious(
|
109 |
Tokens::$emptyTokens,
|
110 |
($nextSeparator - 1),
|
113 |
);
|
114 |
|
115 |
if ($tokens[$tokenBefore]['code'] === T_BITWISE_AND) {
|
116 |
+
if ($phpcsFile->isReference($tokenBefore) === false) {
|
117 |
+
continue;
|
118 |
+
}
|
119 |
+
|
120 |
+
// We also want to ignore references used in assignment
|
121 |
+
// operations passed as function arguments, but isReference()
|
122 |
+
// sees them as valid references (which they are).
|
123 |
$tokenBefore = $phpcsFile->findPrevious(
|
124 |
Tokens::$emptyTokens,
|
125 |
($tokenBefore - 1),
|
127 |
true
|
128 |
);
|
129 |
|
130 |
+
if (isset(Tokens::$assignmentTokens[$tokens[$tokenBefore]['code']]) === true) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
continue;
|
132 |
}
|
133 |
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/OpeningFunctionBraceBsdAllmanSniff.php
CHANGED
@@ -34,7 +34,7 @@ class OpeningFunctionBraceBsdAllmanSniff implements Sniff
|
|
34 |
/**
|
35 |
* Registers the tokens that this sniff wants to listen for.
|
36 |
*
|
37 |
-
* @return
|
38 |
*/
|
39 |
public function register()
|
40 |
{
|
34 |
/**
|
35 |
* Registers the tokens that this sniff wants to listen for.
|
36 |
*
|
37 |
+
* @return int[]
|
38 |
*/
|
39 |
public function register()
|
40 |
{
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/CamelCapsFunctionNameSniff.php
CHANGED
@@ -48,17 +48,18 @@ class CamelCapsFunctionNameSniff extends AbstractScopeSniff
|
|
48 |
* @var array
|
49 |
*/
|
50 |
protected $methodsDoubleUnderscore = [
|
51 |
-
'
|
|
|
|
|
52 |
'getlastrequest' => true,
|
53 |
-
'getlastresponse' => true,
|
54 |
'getlastrequestheaders' => true,
|
|
|
55 |
'getlastresponseheaders' => true,
|
56 |
-
'getfunctions' => true,
|
57 |
'gettypes' => true,
|
58 |
-
'dorequest' => true,
|
59 |
'setcookie' => true,
|
60 |
'setlocation' => true,
|
61 |
'setsoapheaders' => true,
|
|
|
62 |
];
|
63 |
|
64 |
/**
|
@@ -98,6 +99,16 @@ class CamelCapsFunctionNameSniff extends AbstractScopeSniff
|
|
98 |
*/
|
99 |
protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
|
100 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
$methodName = $phpcsFile->getDeclarationName($stackPtr);
|
102 |
if ($methodName === null) {
|
103 |
// Ignore closures.
|
@@ -105,11 +116,18 @@ class CamelCapsFunctionNameSniff extends AbstractScopeSniff
|
|
105 |
}
|
106 |
|
107 |
$className = $phpcsFile->getDeclarationName($currScope);
|
|
|
|
|
|
|
|
|
108 |
$errorData = [$className.'::'.$methodName];
|
109 |
|
|
|
|
|
|
|
110 |
// Is this a magic method. i.e., is prefixed with "__" ?
|
111 |
if (preg_match('|^__[^_]|', $methodName) !== 0) {
|
112 |
-
$magicPart =
|
113 |
if (isset($this->magicMethods[$magicPart]) === true
|
114 |
|| isset($this->methodsDoubleUnderscore[$magicPart]) === true
|
115 |
) {
|
@@ -121,12 +139,12 @@ class CamelCapsFunctionNameSniff extends AbstractScopeSniff
|
|
121 |
}
|
122 |
|
123 |
// PHP4 constructors are allowed to break our rules.
|
124 |
-
if ($
|
125 |
return;
|
126 |
}
|
127 |
|
128 |
// PHP4 destructors are allowed to break our rules.
|
129 |
-
if ($
|
130 |
return;
|
131 |
}
|
132 |
|
48 |
* @var array
|
49 |
*/
|
50 |
protected $methodsDoubleUnderscore = [
|
51 |
+
'dorequest' => true,
|
52 |
+
'getcookies' => true,
|
53 |
+
'getfunctions' => true,
|
54 |
'getlastrequest' => true,
|
|
|
55 |
'getlastrequestheaders' => true,
|
56 |
+
'getlastresponse' => true,
|
57 |
'getlastresponseheaders' => true,
|
|
|
58 |
'gettypes' => true,
|
|
|
59 |
'setcookie' => true,
|
60 |
'setlocation' => true,
|
61 |
'setsoapheaders' => true,
|
62 |
+
'soapcall' => true,
|
63 |
];
|
64 |
|
65 |
/**
|
99 |
*/
|
100 |
protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
|
101 |
{
|
102 |
+
$tokens = $phpcsFile->getTokens();
|
103 |
+
|
104 |
+
// Determine if this is a function which needs to be examined.
|
105 |
+
$conditions = $tokens[$stackPtr]['conditions'];
|
106 |
+
end($conditions);
|
107 |
+
$deepestScope = key($conditions);
|
108 |
+
if ($deepestScope !== $currScope) {
|
109 |
+
return;
|
110 |
+
}
|
111 |
+
|
112 |
$methodName = $phpcsFile->getDeclarationName($stackPtr);
|
113 |
if ($methodName === null) {
|
114 |
// Ignore closures.
|
116 |
}
|
117 |
|
118 |
$className = $phpcsFile->getDeclarationName($currScope);
|
119 |
+
if (isset($className) === false) {
|
120 |
+
$className = '[Anonymous Class]';
|
121 |
+
}
|
122 |
+
|
123 |
$errorData = [$className.'::'.$methodName];
|
124 |
|
125 |
+
$methodNameLc = strtolower($methodName);
|
126 |
+
$classNameLc = strtolower($className);
|
127 |
+
|
128 |
// Is this a magic method. i.e., is prefixed with "__" ?
|
129 |
if (preg_match('|^__[^_]|', $methodName) !== 0) {
|
130 |
+
$magicPart = substr($methodNameLc, 2);
|
131 |
if (isset($this->magicMethods[$magicPart]) === true
|
132 |
|| isset($this->methodsDoubleUnderscore[$magicPart]) === true
|
133 |
) {
|
139 |
}
|
140 |
|
141 |
// PHP4 constructors are allowed to break our rules.
|
142 |
+
if ($methodNameLc === $classNameLc) {
|
143 |
return;
|
144 |
}
|
145 |
|
146 |
// PHP4 destructors are allowed to break our rules.
|
147 |
+
if ($methodNameLc === '_'.$classNameLc) {
|
148 |
return;
|
149 |
}
|
150 |
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/ConstructorNameSniff.php
CHANGED
@@ -56,33 +56,41 @@ class ConstructorNameSniff extends AbstractScopeSniff
|
|
56 |
*/
|
57 |
protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
|
58 |
{
|
59 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
if ($className !== $this->currentClass) {
|
61 |
$this->loadFunctionNamesInScope($phpcsFile, $currScope);
|
62 |
$this->currentClass = $className;
|
63 |
}
|
64 |
|
65 |
-
$methodName = $phpcsFile->getDeclarationName($stackPtr);
|
66 |
|
67 |
-
if (
|
68 |
-
if (in_array('__construct', $this->functionList) === false) {
|
69 |
$error = 'PHP4 style constructors are not allowed; use "__construct()" instead';
|
70 |
$phpcsFile->addError($error, $stackPtr, 'OldStyle');
|
71 |
}
|
72 |
-
} else if (
|
73 |
// Not a constructor.
|
74 |
return;
|
75 |
}
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
$parentClassName = $phpcsFile->findExtendedClassName($currScope);
|
80 |
-
if ($parentClassName === false) {
|
81 |
return;
|
82 |
}
|
83 |
|
84 |
-
|
85 |
-
if (
|
86 |
return;
|
87 |
}
|
88 |
|
@@ -90,7 +98,7 @@ class ConstructorNameSniff extends AbstractScopeSniff
|
|
90 |
$startIndex = $stackPtr;
|
91 |
while (($doubleColonIndex = $phpcsFile->findNext(T_DOUBLE_COLON, $startIndex, $endFunctionIndex)) !== false) {
|
92 |
if ($tokens[($doubleColonIndex + 1)]['code'] === T_STRING
|
93 |
-
&& $tokens[($doubleColonIndex + 1)]['content'] === $parentClassName
|
94 |
) {
|
95 |
$error = 'PHP4 style calls to parent constructors are not allowed; use "parent::__construct()" instead';
|
96 |
$phpcsFile->addError($error, ($doubleColonIndex + 1), 'OldStyleCall');
|
@@ -136,8 +144,12 @@ class ConstructorNameSniff extends AbstractScopeSniff
|
|
136 |
continue;
|
137 |
}
|
138 |
|
139 |
-
$
|
140 |
-
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
|
143 |
}//end loadFunctionNamesInScope()
|
56 |
*/
|
57 |
protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
|
58 |
{
|
59 |
+
$tokens = $phpcsFile->getTokens();
|
60 |
+
|
61 |
+
// Determine if this is a function which needs to be examined.
|
62 |
+
$conditions = $tokens[$stackPtr]['conditions'];
|
63 |
+
end($conditions);
|
64 |
+
$deepestScope = key($conditions);
|
65 |
+
if ($deepestScope !== $currScope) {
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
|
69 |
+
$className = strtolower($phpcsFile->getDeclarationName($currScope));
|
70 |
if ($className !== $this->currentClass) {
|
71 |
$this->loadFunctionNamesInScope($phpcsFile, $currScope);
|
72 |
$this->currentClass = $className;
|
73 |
}
|
74 |
|
75 |
+
$methodName = strtolower($phpcsFile->getDeclarationName($stackPtr));
|
76 |
|
77 |
+
if ($methodName === $className) {
|
78 |
+
if (in_array('__construct', $this->functionList, true) === false) {
|
79 |
$error = 'PHP4 style constructors are not allowed; use "__construct()" instead';
|
80 |
$phpcsFile->addError($error, $stackPtr, 'OldStyle');
|
81 |
}
|
82 |
+
} else if ($methodName !== '__construct') {
|
83 |
// Not a constructor.
|
84 |
return;
|
85 |
}
|
86 |
|
87 |
+
// Stop if the constructor doesn't have a body, like when it is abstract.
|
88 |
+
if (isset($tokens[$stackPtr]['scope_closer']) === false) {
|
|
|
|
|
89 |
return;
|
90 |
}
|
91 |
|
92 |
+
$parentClassName = strtolower($phpcsFile->findExtendedClassName($currScope));
|
93 |
+
if ($parentClassName === false) {
|
94 |
return;
|
95 |
}
|
96 |
|
98 |
$startIndex = $stackPtr;
|
99 |
while (($doubleColonIndex = $phpcsFile->findNext(T_DOUBLE_COLON, $startIndex, $endFunctionIndex)) !== false) {
|
100 |
if ($tokens[($doubleColonIndex + 1)]['code'] === T_STRING
|
101 |
+
&& strtolower($tokens[($doubleColonIndex + 1)]['content']) === $parentClassName
|
102 |
) {
|
103 |
$error = 'PHP4 style calls to parent constructors are not allowed; use "parent::__construct()" instead';
|
104 |
$phpcsFile->addError($error, ($doubleColonIndex + 1), 'OldStyleCall');
|
144 |
continue;
|
145 |
}
|
146 |
|
147 |
+
$this->functionList[] = trim(strtolower($phpcsFile->getDeclarationName($i)));
|
148 |
+
|
149 |
+
if (isset($tokens[$i]['scope_closer']) !== false) {
|
150 |
+
// Skip past nested functions and such.
|
151 |
+
$i = $tokens[$i]['scope_closer'];
|
152 |
+
}
|
153 |
}
|
154 |
|
155 |
}//end loadFunctionNamesInScope()
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/CharacterBeforePHPOpeningTagSniff.php
CHANGED
@@ -15,6 +15,19 @@ use PHP_CodeSniffer\Files\File;
|
|
15 |
class CharacterBeforePHPOpeningTagSniff implements Sniff
|
16 |
{
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
/**
|
20 |
* Returns an array of tokens this test wants to listen for.
|
@@ -41,10 +54,21 @@ class CharacterBeforePHPOpeningTagSniff implements Sniff
|
|
41 |
{
|
42 |
$expected = 0;
|
43 |
if ($stackPtr > 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
// Allow a shebang line.
|
45 |
$tokens = $phpcsFile->getTokens();
|
46 |
if (substr($tokens[0]['content'], 0, 2) === '#!') {
|
47 |
-
$expected
|
48 |
}
|
49 |
}
|
50 |
|
15 |
class CharacterBeforePHPOpeningTagSniff implements Sniff
|
16 |
{
|
17 |
|
18 |
+
/**
|
19 |
+
* List of supported BOM definitions.
|
20 |
+
*
|
21 |
+
* Use encoding names as keys and hex BOM representations as values.
|
22 |
+
*
|
23 |
+
* @var array
|
24 |
+
*/
|
25 |
+
protected $bomDefinitions = [
|
26 |
+
'UTF-8' => 'efbbbf',
|
27 |
+
'UTF-16 (BE)' => 'feff',
|
28 |
+
'UTF-16 (LE)' => 'fffe',
|
29 |
+
];
|
30 |
+
|
31 |
|
32 |
/**
|
33 |
* Returns an array of tokens this test wants to listen for.
|
54 |
{
|
55 |
$expected = 0;
|
56 |
if ($stackPtr > 0) {
|
57 |
+
// Allow a byte-order mark.
|
58 |
+
$tokens = $phpcsFile->getTokens();
|
59 |
+
foreach ($this->bomDefinitions as $bomName => $expectedBomHex) {
|
60 |
+
$bomByteLength = (strlen($expectedBomHex) / 2);
|
61 |
+
$htmlBomHex = bin2hex(substr($tokens[0]['content'], 0, $bomByteLength));
|
62 |
+
if ($htmlBomHex === $expectedBomHex) {
|
63 |
+
$expected++;
|
64 |
+
break;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
// Allow a shebang line.
|
69 |
$tokens = $phpcsFile->getTokens();
|
70 |
if (substr($tokens[0]['content'], 0, 2) === '#!') {
|
71 |
+
$expected++;
|
72 |
}
|
73 |
}
|
74 |
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/VersionControl/GitMergeConflictSniff.php
ADDED
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Check for merge conflict artifacts
|
4 |
+
*
|
5 |
+
* @author Juliette Reinders Folmer <phpcs_nospam@adviesenzo.nl>
|
6 |
+
* @copyright 2017 Juliette Reinders Folmer. All rights reserved.
|
7 |
+
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
8 |
+
*/
|
9 |
+
|
10 |
+
namespace PHP_CodeSniffer\Standards\Generic\Sniffs\VersionControl;
|
11 |
+
|
12 |
+
use PHP_CodeSniffer\Sniffs\Sniff;
|
13 |
+
use PHP_CodeSniffer\Files\File;
|
14 |
+
|
15 |
+
class GitMergeConflictSniff implements Sniff
|
16 |
+
{
|
17 |
+
|
18 |
+
/**
|
19 |
+
* A list of tokenizers this sniff supports.
|
20 |
+
*
|
21 |
+
* @var array
|
22 |
+
*/
|
23 |
+
public $supportedTokenizers = [
|
24 |
+
'PHP',
|
25 |
+
'JS',
|
26 |
+
'CSS',
|
27 |
+
];
|
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 [T_OPEN_TAG];
|
38 |
+
|
39 |
+
}//end register()
|
40 |
+
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Processes this test, when one of its tokens is encountered.
|
44 |
+
*
|
45 |
+
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
46 |
+
* @param int $stackPtr The position of the current token in the
|
47 |
+
* stack passed in $tokens.
|
48 |
+
*
|
49 |
+
* @return void
|
50 |
+
*/
|
51 |
+
public function process(File $phpcsFile, $stackPtr)
|
52 |
+
{
|
53 |
+
$tokens = $phpcsFile->getTokens();
|
54 |
+
$error = 'Merge conflict boundary found; type: %s';
|
55 |
+
|
56 |
+
$checkTokens = [
|
57 |
+
T_SL => true,
|
58 |
+
T_SR => true,
|
59 |
+
T_IS_IDENTICAL => true,
|
60 |
+
T_COMMENT => true,
|
61 |
+
T_DOC_COMMENT_STRING => true,
|
62 |
+
// PHP + CSS specific.
|
63 |
+
T_ENCAPSED_AND_WHITESPACE => true,
|
64 |
+
// PHP specific.
|
65 |
+
T_INLINE_HTML => true,
|
66 |
+
T_HEREDOC => true,
|
67 |
+
T_NOWDOC => true,
|
68 |
+
// JS specific.
|
69 |
+
T_ZSR => true,
|
70 |
+
];
|
71 |
+
|
72 |
+
for ($i = 0; $i < $phpcsFile->numTokens; $i++) {
|
73 |
+
if ($tokens[$i]['column'] !== 1 || isset($checkTokens[$tokens[$i]['code']]) === false) {
|
74 |
+
continue;
|
75 |
+
}
|
76 |
+
|
77 |
+
if ($phpcsFile->tokenizerType !== 'JS') {
|
78 |
+
switch ($tokens[$i]['code']) {
|
79 |
+
// Check for first non-comment, non-heredoc/nowdoc, non-inline HTML merge conflict opener.
|
80 |
+
case T_SL:
|
81 |
+
if (isset($tokens[($i + 1)], $tokens[($i + 2)]) !== false
|
82 |
+
&& $tokens[($i + 1)]['code'] === T_SL
|
83 |
+
&& $tokens[($i + 2)]['code'] === T_STRING
|
84 |
+
&& trim($tokens[($i + 2)]['content']) === '<<< HEAD'
|
85 |
+
) {
|
86 |
+
$phpcsFile->addError($error, $i, 'OpenerFound', ['opener']);
|
87 |
+
$i += 2;
|
88 |
+
}
|
89 |
+
break;
|
90 |
+
|
91 |
+
// Check for merge conflict closer which was opened in a heredoc/nowdoc.
|
92 |
+
case T_SR:
|
93 |
+
if (isset($tokens[($i + 1)], $tokens[($i + 2)], $tokens[($i + 3)], $tokens[($i + 4)]) !== false
|
94 |
+
&& $tokens[($i + 1)]['code'] === T_SR
|
95 |
+
&& $tokens[($i + 2)]['code'] === T_SR
|
96 |
+
&& $tokens[($i + 3)]['code'] === T_GREATER_THAN
|
97 |
+
&& $tokens[($i + 4)]['code'] === T_WHITESPACE
|
98 |
+
&& $tokens[($i + 4)]['content'] === ' '
|
99 |
+
) {
|
100 |
+
$phpcsFile->addError($error, $i, 'CloserFound', ['closer']);
|
101 |
+
$i += 4;
|
102 |
+
}
|
103 |
+
break;
|
104 |
+
|
105 |
+
// Check for merge conflict delimiter which opened in a CSS comment and closed outside.
|
106 |
+
case T_IS_IDENTICAL:
|
107 |
+
if (isset($tokens[($i + 1)], $tokens[($i + 2)], $tokens[($i + 3)]) !== false
|
108 |
+
&& $tokens[($i + 1)]['code'] === T_IS_IDENTICAL
|
109 |
+
&& $tokens[($i + 2)]['code'] === T_EQUAL
|
110 |
+
&& $tokens[($i + 3)]['code'] === T_WHITESPACE
|
111 |
+
&& $tokens[($i + 3)]['content'] === "\n"
|
112 |
+
) {
|
113 |
+
$phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']);
|
114 |
+
$i += 3;
|
115 |
+
}
|
116 |
+
break;
|
117 |
+
|
118 |
+
// - Check for delimiters and closers.
|
119 |
+
// - Inspect heredoc/nowdoc content, comments and inline HTML.
|
120 |
+
// - Check for subsequent merge conflict openers after the first broke the tokenizer.
|
121 |
+
case T_ENCAPSED_AND_WHITESPACE:
|
122 |
+
case T_COMMENT:
|
123 |
+
case T_DOC_COMMENT_STRING:
|
124 |
+
case T_INLINE_HTML:
|
125 |
+
case T_HEREDOC:
|
126 |
+
case T_NOWDOC:
|
127 |
+
if (substr($tokens[$i]['content'], 0, 12) === '<<<<<<< HEAD') {
|
128 |
+
$phpcsFile->addError($error, $i, 'OpenerFound', ['opener']);
|
129 |
+
break;
|
130 |
+
} else if (substr($tokens[$i]['content'], 0, 8) === '>>>>>>> ') {
|
131 |
+
$phpcsFile->addError($error, $i, 'CloserFound', ['closer']);
|
132 |
+
break;
|
133 |
+
}
|
134 |
+
|
135 |
+
if ($tokens[$i]['code'] === T_DOC_COMMENT_STRING) {
|
136 |
+
if ($tokens[$i]['content'] === '======='
|
137 |
+
&& $tokens[($i + 1)]['code'] === T_DOC_COMMENT_WHITESPACE
|
138 |
+
) {
|
139 |
+
$phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']);
|
140 |
+
break;
|
141 |
+
}
|
142 |
+
} else {
|
143 |
+
if ($tokens[$i]['content'] === "=======\n") {
|
144 |
+
$phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']);
|
145 |
+
}
|
146 |
+
}
|
147 |
+
break;
|
148 |
+
}//end switch
|
149 |
+
} else {
|
150 |
+
// Javascript file.
|
151 |
+
switch ($tokens[$i]['code']) {
|
152 |
+
// Merge conflict opener.
|
153 |
+
case T_SL:
|
154 |
+
if (isset($tokens[($i + 1)], $tokens[($i + 2)], $tokens[($i + 3)], $tokens[($i + 4)], $tokens[($i + 5)]) !== false
|
155 |
+
&& $tokens[($i + 1)]['code'] === T_SL
|
156 |
+
&& $tokens[($i + 2)]['code'] === T_SL
|
157 |
+
&& $tokens[($i + 3)]['code'] === T_LESS_THAN
|
158 |
+
&& $tokens[($i + 4)]['code'] === T_WHITESPACE
|
159 |
+
&& trim($tokens[($i + 5)]['content']) === 'HEAD'
|
160 |
+
) {
|
161 |
+
$phpcsFile->addError($error, $i, 'OpenerFound', ['opener']);
|
162 |
+
$i += 5;
|
163 |
+
}
|
164 |
+
break;
|
165 |
+
|
166 |
+
// Check for merge conflict delimiter.
|
167 |
+
case T_IS_IDENTICAL:
|
168 |
+
if (isset($tokens[($i + 1)], $tokens[($i + 2)], $tokens[($i + 3)]) !== false
|
169 |
+
&& $tokens[($i + 1)]['code'] === T_IS_IDENTICAL
|
170 |
+
&& $tokens[($i + 2)]['code'] === T_EQUAL
|
171 |
+
&& $tokens[($i + 3)]['code'] === T_WHITESPACE
|
172 |
+
&& $tokens[($i + 3)]['content'] === "\n"
|
173 |
+
) {
|
174 |
+
$phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']);
|
175 |
+
$i += 3;
|
176 |
+
}
|
177 |
+
break;
|
178 |
+
|
179 |
+
// Merge conflict closer.
|
180 |
+
case T_ZSR:
|
181 |
+
if ($tokens[$i]['code'] === T_ZSR
|
182 |
+
&& isset($tokens[($i + 1)], $tokens[($i + 2)]) === true
|
183 |
+
&& $tokens[($i + 1)]['code'] === T_ZSR
|
184 |
+
&& $tokens[($i + 2)]['code'] === T_GREATER_THAN
|
185 |
+
) {
|
186 |
+
$phpcsFile->addError($error, $i, 'CloserFound', ['closer']);
|
187 |
+
$i += 2;
|
188 |
+
}
|
189 |
+
break;
|
190 |
+
|
191 |
+
// Check for merge conflicts in all comments.
|
192 |
+
case T_COMMENT:
|
193 |
+
case T_DOC_COMMENT_STRING:
|
194 |
+
if (substr($tokens[$i]['content'], 0, 12) === '<<<<<<< HEAD') {
|
195 |
+
$phpcsFile->addError($error, $i, 'OpenerFound');
|
196 |
+
break;
|
197 |
+
} else if (substr($tokens[$i]['content'], 0, 8) === '>>>>>>> ') {
|
198 |
+
$phpcsFile->addError($error, $i, 'CloserFound', ['closer']);
|
199 |
+
break;
|
200 |
+
}
|
201 |
+
|
202 |
+
if ($tokens[$i]['code'] === T_DOC_COMMENT_STRING) {
|
203 |
+
if ($tokens[$i]['content'] === '======='
|
204 |
+
&& $tokens[($i + 1)]['code'] === T_DOC_COMMENT_WHITESPACE
|
205 |
+
) {
|
206 |
+
$phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']);
|
207 |
+
break;
|
208 |
+
}
|
209 |
+
} else {
|
210 |
+
if ($tokens[$i]['content'] === "=======\n") {
|
211 |
+
$phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']);
|
212 |
+
}
|
213 |
+
}
|
214 |
+
break;
|
215 |
+
}//end switch
|
216 |
+
}//end if
|
217 |
+
}//end for
|
218 |
+
|
219 |
+
// Ignore the rest of the file.
|
220 |
+
return ($phpcsFile->numTokens + 1);
|
221 |
+
|
222 |
+
}//end process()
|
223 |
+
|
224 |
+
|
225 |
+
}//end class
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/IncrementDecrementSpacingSniff.php
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Verifies spacing between variables and increment/decrement operators.
|
4 |
+
*
|
5 |
+
* @author Juliette Reinders Folmer <phpcs_nospam@adviesenzo.nl>
|
6 |
+
* @copyright 2018 Juliette Reinders Folmer. All rights reserved.
|
7 |
+
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
8 |
+
*/
|
9 |
+
|
10 |
+
namespace PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace;
|
11 |
+
|
12 |
+
use PHP_CodeSniffer\Sniffs\Sniff;
|
13 |
+
use PHP_CodeSniffer\Files\File;
|
14 |
+
use PHP_CodeSniffer\Util\Tokens;
|
15 |
+
|
16 |
+
class IncrementDecrementSpacingSniff implements Sniff
|
17 |
+
{
|
18 |
+
|
19 |
+
|
20 |
+
/**
|
21 |
+
* A list of tokenizers this sniff supports.
|
22 |
+
*
|
23 |
+
* @var array
|
24 |
+
*/
|
25 |
+
public $supportedTokenizers = [
|
26 |
+
'PHP',
|
27 |
+
'JS',
|
28 |
+
];
|
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 [
|
39 |
+
T_DEC,
|
40 |
+
T_INC,
|
41 |
+
];
|
42 |
+
|
43 |
+
}//end register()
|
44 |
+
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Processes this test, when one of its tokens is encountered.
|
48 |
+
*
|
49 |
+
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
50 |
+
* @param int $stackPtr The position of the current token in
|
51 |
+
* the stack passed in $tokens.
|
52 |
+
*
|
53 |
+
* @return void
|
54 |
+
*/
|
55 |
+
public function process(File $phpcsFile, $stackPtr)
|
56 |
+
{
|
57 |
+
$tokens = $phpcsFile->getTokens();
|
58 |
+
|
59 |
+
$tokenName = 'increment';
|
60 |
+
if ($tokens[$stackPtr]['code'] === T_DEC) {
|
61 |
+
$tokenName = 'decrement';
|
62 |
+
}
|
63 |
+
|
64 |
+
// Is this a pre-increment/decrement ?
|
65 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
66 |
+
if ($nextNonEmpty !== false
|
67 |
+
&& (($phpcsFile->tokenizerType === 'PHP' && $tokens[$nextNonEmpty]['code'] === T_VARIABLE)
|
68 |
+
|| ($phpcsFile->tokenizerType === 'JS' && $tokens[$nextNonEmpty]['code'] === T_STRING))
|
69 |
+
) {
|
70 |
+
if ($nextNonEmpty === ($stackPtr + 1)) {
|
71 |
+
$phpcsFile->recordMetric($stackPtr, 'Spacing between in/decrementor and variable', 0);
|
72 |
+
return;
|
73 |
+
}
|
74 |
+
|
75 |
+
$spaces = 0;
|
76 |
+
$fixable = true;
|
77 |
+
$nextNonWhitespace = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
|
78 |
+
if ($nextNonWhitespace !== $nextNonEmpty) {
|
79 |
+
$fixable = false;
|
80 |
+
$spaces = 'comment';
|
81 |
+
} else {
|
82 |
+
if ($tokens[$stackPtr]['line'] !== $tokens[$nextNonEmpty]['line']) {
|
83 |
+
$spaces = 'newline';
|
84 |
+
} else {
|
85 |
+
$spaces = $tokens[($stackPtr + 1)]['length'];
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
$phpcsFile->recordMetric($stackPtr, 'Spacing between in/decrementor and variable', $spaces);
|
90 |
+
|
91 |
+
$error = 'Expected no spaces between the %s operator and %s; %s found';
|
92 |
+
$errorCode = 'SpaceAfter'.ucfirst($tokenName);
|
93 |
+
$data = [
|
94 |
+
$tokenName,
|
95 |
+
$tokens[$nextNonEmpty]['content'],
|
96 |
+
$spaces,
|
97 |
+
];
|
98 |
+
|
99 |
+
if ($fixable === false) {
|
100 |
+
$phpcsFile->addError($error, $stackPtr, $errorCode, $data);
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
|
104 |
+
$fix = $phpcsFile->addFixableError($error, $stackPtr, $errorCode, $data);
|
105 |
+
if ($fix === true) {
|
106 |
+
$phpcsFile->fixer->beginChangeset();
|
107 |
+
for ($i = ($stackPtr + 1); $i < $nextNonEmpty; $i++) {
|
108 |
+
$phpcsFile->fixer->replaceToken($i, '');
|
109 |
+
}
|
110 |
+
|
111 |
+
$phpcsFile->fixer->endChangeset();
|
112 |
+
}
|
113 |
+
|
114 |
+
return;
|
115 |
+
}//end if
|
116 |
+
|
117 |
+
// Is this a post-increment/decrement ?
|
118 |
+
$prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
119 |
+
if ($prevNonEmpty !== false
|
120 |
+
&& (($phpcsFile->tokenizerType === 'PHP' && $tokens[$prevNonEmpty]['code'] === T_VARIABLE)
|
121 |
+
|| ($phpcsFile->tokenizerType === 'JS' && $tokens[$prevNonEmpty]['code'] === T_STRING))
|
122 |
+
) {
|
123 |
+
if ($prevNonEmpty === ($stackPtr - 1)) {
|
124 |
+
$phpcsFile->recordMetric($stackPtr, 'Spacing between in/decrementor and variable', 0);
|
125 |
+
return;
|
126 |
+
}
|
127 |
+
|
128 |
+
$spaces = 0;
|
129 |
+
$fixable = true;
|
130 |
+
$prevNonWhitespace = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
|
131 |
+
if ($prevNonWhitespace !== $prevNonEmpty) {
|
132 |
+
$fixable = false;
|
133 |
+
$spaces = 'comment';
|
134 |
+
} else {
|
135 |
+
if ($tokens[$stackPtr]['line'] !== $tokens[$nextNonEmpty]['line']) {
|
136 |
+
$spaces = 'newline';
|
137 |
+
} else {
|
138 |
+
$spaces = $tokens[($stackPtr - 1)]['length'];
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
$phpcsFile->recordMetric($stackPtr, 'Spacing between in/decrementor and variable', $spaces);
|
143 |
+
|
144 |
+
$error = 'Expected no spaces between %s and the %s operator; %s found';
|
145 |
+
$errorCode = 'SpaceAfter'.ucfirst($tokenName);
|
146 |
+
$data = [
|
147 |
+
$tokens[$prevNonEmpty]['content'],
|
148 |
+
$tokenName,
|
149 |
+
$spaces,
|
150 |
+
];
|
151 |
+
|
152 |
+
if ($fixable === false) {
|
153 |
+
$phpcsFile->addError($error, $stackPtr, $errorCode, $data);
|
154 |
+
return;
|
155 |
+
}
|
156 |
+
|
157 |
+
$fix = $phpcsFile->addFixableError($error, $stackPtr, $errorCode, $data);
|
158 |
+
if ($fix === true) {
|
159 |
+
$phpcsFile->fixer->beginChangeset();
|
160 |
+
for ($i = ($stackPtr - 1); $prevNonEmpty < $i; $i--) {
|
161 |
+
$phpcsFile->fixer->replaceToken($i, '');
|
162 |
+
}
|
163 |
+
|
164 |
+
$phpcsFile->fixer->endChangeset();
|
165 |
+
}
|
166 |
+
}//end if
|
167 |
+
|
168 |
+
}//end process()
|
169 |
+
|
170 |
+
|
171 |
+
}//end class
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php
CHANGED
@@ -11,7 +11,8 @@ namespace PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace;
|
|
11 |
|
12 |
use PHP_CodeSniffer\Sniffs\Sniff;
|
13 |
use PHP_CodeSniffer\Files\File;
|
14 |
-
use PHP_CodeSniffer\Util;
|
|
|
15 |
|
16 |
class LanguageConstructSpacingSniff implements Sniff
|
17 |
{
|
@@ -68,6 +69,14 @@ class LanguageConstructSpacingSniff implements Sniff
|
|
68 |
}
|
69 |
|
70 |
$content = $tokens[$stackPtr]['content'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
if ($tokens[$stackPtr]['code'] === T_YIELD_FROM
|
72 |
&& strtolower($content) !== 'yield from'
|
73 |
) {
|
@@ -87,7 +96,7 @@ class LanguageConstructSpacingSniff implements Sniff
|
|
87 |
}
|
88 |
|
89 |
$error = 'Language constructs must be followed by a single space; expected 1 space between YIELD FROM found "%s"';
|
90 |
-
$data = [
|
91 |
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'IncorrectYieldFrom', $data);
|
92 |
if ($fix === true) {
|
93 |
preg_match('/yield/i', $found, $yield);
|
@@ -113,7 +122,7 @@ class LanguageConstructSpacingSniff implements Sniff
|
|
113 |
$content = $tokens[($stackPtr + 1)]['content'];
|
114 |
if ($content !== ' ') {
|
115 |
$error = 'Language constructs must be followed by a single space; expected 1 space but found "%s"';
|
116 |
-
$data = [
|
117 |
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'IncorrectSingle', $data);
|
118 |
if ($fix === true) {
|
119 |
$phpcsFile->fixer->replaceToken(($stackPtr + 1), ' ');
|
11 |
|
12 |
use PHP_CodeSniffer\Sniffs\Sniff;
|
13 |
use PHP_CodeSniffer\Files\File;
|
14 |
+
use PHP_CodeSniffer\Util\Common;
|
15 |
+
use PHP_CodeSniffer\Util\Tokens;
|
16 |
|
17 |
class LanguageConstructSpacingSniff implements Sniff
|
18 |
{
|
69 |
}
|
70 |
|
71 |
$content = $tokens[$stackPtr]['content'];
|
72 |
+
if ($tokens[$stackPtr]['code'] === T_NAMESPACE) {
|
73 |
+
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
74 |
+
if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === T_NS_SEPARATOR) {
|
75 |
+
// Namespace keyword used as operator, not as the language construct.
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
if ($tokens[$stackPtr]['code'] === T_YIELD_FROM
|
81 |
&& strtolower($content) !== 'yield from'
|
82 |
) {
|
96 |
}
|
97 |
|
98 |
$error = 'Language constructs must be followed by a single space; expected 1 space between YIELD FROM found "%s"';
|
99 |
+
$data = [Common::prepareForOutput($found)];
|
100 |
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'IncorrectYieldFrom', $data);
|
101 |
if ($fix === true) {
|
102 |
preg_match('/yield/i', $found, $yield);
|
122 |
$content = $tokens[($stackPtr + 1)]['content'];
|
123 |
if ($content !== ' ') {
|
124 |
$error = 'Language constructs must be followed by a single space; expected 1 space but found "%s"';
|
125 |
+
$data = [Common::prepareForOutput($content)];
|
126 |
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'IncorrectSingle', $data);
|
127 |
if ($fix === true) {
|
128 |
$phpcsFile->fixer->replaceToken(($stackPtr + 1), ' ');
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php
CHANGED
@@ -583,7 +583,7 @@ class ScopeIndentSniff implements Sniff
|
|
583 |
}
|
584 |
|
585 |
if (isset($tokens[$scopeCloser]['scope_condition']) === true) {
|
586 |
-
$first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $tokens[$scopeCloser]['scope_condition'], true);
|
587 |
if ($this->debug === true) {
|
588 |
$line = $tokens[$first]['line'];
|
589 |
$type = $tokens[$first]['type'];
|
@@ -920,6 +920,7 @@ class ScopeIndentSniff implements Sniff
|
|
920 |
|| $tokens[$i]['code'] === T_START_NOWDOC
|
921 |
) {
|
922 |
$i = $phpcsFile->findNext([T_END_HEREDOC, T_END_NOWDOC], ($i + 1));
|
|
|
923 |
continue;
|
924 |
}
|
925 |
|
583 |
}
|
584 |
|
585 |
if (isset($tokens[$scopeCloser]['scope_condition']) === true) {
|
586 |
+
$first = $phpcsFile->findFirstOnLine([T_WHITESPACE, T_INLINE_HTML], $tokens[$scopeCloser]['scope_condition'], true);
|
587 |
if ($this->debug === true) {
|
588 |
$line = $tokens[$first]['line'];
|
589 |
$type = $tokens[$first]['type'];
|
920 |
|| $tokens[$i]['code'] === T_START_NOWDOC
|
921 |
) {
|
922 |
$i = $phpcsFile->findNext([T_END_HEREDOC, T_END_NOWDOC], ($i + 1));
|
923 |
+
$i = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true);
|
924 |
continue;
|
925 |
}
|
926 |
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.1.inc
CHANGED
@@ -3,6 +3,9 @@ class MyClass {}
|
|
3 |
class YourClass {}
|
4 |
interface MyInterface {}
|
5 |
interface YourInterface {}
|
|
|
|
|
6 |
class MyClass {}
|
7 |
interface MyInterface {}
|
|
|
8 |
?>
|
3 |
class YourClass {}
|
4 |
interface MyInterface {}
|
5 |
interface YourInterface {}
|
6 |
+
trait MyTrait {}
|
7 |
+
trait YourTrait {}
|
8 |
class MyClass {}
|
9 |
interface MyInterface {}
|
10 |
+
trait MyTrait {}
|
11 |
?>
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.2.inc
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
2 |
class MyClass {}
|
3 |
interface MyInterface {}
|
|
|
4 |
?>
|
1 |
<?php
|
2 |
class MyClass {}
|
3 |
interface MyInterface {}
|
4 |
+
trait MyTrait {}
|
5 |
?>
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.php
CHANGED
@@ -45,14 +45,16 @@ class DuplicateClassNameUnitTest extends AbstractSniffUnitTest
|
|
45 |
switch ($testFile) {
|
46 |
case 'DuplicateClassNameUnitTest.1.inc':
|
47 |
return [
|
48 |
-
|
49 |
-
|
|
|
50 |
];
|
51 |
break;
|
52 |
case 'DuplicateClassNameUnitTest.2.inc':
|
53 |
return [
|
54 |
2 => 1,
|
55 |
3 => 1,
|
|
|
56 |
];
|
57 |
break;
|
58 |
case 'DuplicateClassNameUnitTest.5.inc':
|
45 |
switch ($testFile) {
|
46 |
case 'DuplicateClassNameUnitTest.1.inc':
|
47 |
return [
|
48 |
+
8 => 1,
|
49 |
+
9 => 1,
|
50 |
+
10 => 1,
|
51 |
];
|
52 |
break;
|
53 |
case 'DuplicateClassNameUnitTest.2.inc':
|
54 |
return [
|
55 |
2 => 1,
|
56 |
3 => 1,
|
57 |
+
4 => 1,
|
58 |
];
|
59 |
break;
|
60 |
case 'DuplicateClassNameUnitTest.5.inc':
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/AssignmentInConditionUnitTest.inc
CHANGED
@@ -25,7 +25,7 @@ do {
|
|
25 |
|
26 |
while ( $sample === false ) {}
|
27 |
|
28 |
-
|
29 |
if (123 = $a) {}
|
30 |
if (strtolower($b) = $b) {}
|
31 |
if (array( 1 => 'a', 2 => 'b' ) = $b) {}
|
25 |
|
26 |
while ( $sample === false ) {}
|
27 |
|
28 |
+
// Silly, but not an assignment.
|
29 |
if (123 = $a) {}
|
30 |
if (strtolower($b) = $b) {}
|
31 |
if (array( 1 => 'a', 2 => 'b' ) = $b) {}
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/EmptyPHPStatementUnitTest.inc
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Test empty statement: two consecutive semi-colons without executable code between them.
|
5 |
+
*/
|
6 |
+
function_call(); // OK.
|
7 |
+
|
8 |
+
// The below examples are all bad.
|
9 |
+
function_call();;
|
10 |
+
|
11 |
+
function_call();
|
12 |
+
;
|
13 |
+
|
14 |
+
function_call();
|
15 |
+
/* some comment */;
|
16 |
+
|
17 |
+
function_call();
|
18 |
+
/* some comment */ ;
|
19 |
+
|
20 |
+
?>
|
21 |
+
<input name="<?php ; something_else(); ?>" />
|
22 |
+
<input name="<?php something_else(); ; ?>" />
|
23 |
+
|
24 |
+
/*
|
25 |
+
* Test empty statement: no code between PHP open and close tag.
|
26 |
+
*/
|
27 |
+
<input name="<?php something_else() ?>" /> <!-- OK. -->
|
28 |
+
<input name="<?php something_else(); ?>" /> <!-- OK. -->
|
29 |
+
<input name="<?php /* comment */ ?>" /> <!-- OK. -->
|
30 |
+
|
31 |
+
<input name="<?php ?>" /> <!-- Bad. -->
|
32 |
+
|
33 |
+
<input name="<?php
|
34 |
+
|
35 |
+
|
36 |
+
?>" /> <!-- Bad. -->
|
37 |
+
|
38 |
+
<!--
|
39 |
+
/*
|
40 |
+
* Test detecting & fixing a combination of the two above checks.
|
41 |
+
*/
|
42 |
+
-->
|
43 |
+
<?php ; ?>
|
44 |
+
|
45 |
+
<input name="<?php ; ?>" /> <!-- Bad. -->
|
46 |
+
|
47 |
+
<!-- Tests with short open echo tag. -->
|
48 |
+
<input name="<?= 'some text' ?>" /> <!-- OK. -->
|
49 |
+
<input name="<?= ?>" /> <!-- Bad. -->
|
50 |
+
<input name="<?= ; ?>" /> <!-- Bad. -->
|
51 |
+
|
52 |
+
<?php
|
53 |
+
// Guard against false positives for two consecutive semi-colons in a for statement.
|
54 |
+
for ( $i = 0; ; $i++ ) {}
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/EmptyPHPStatementUnitTest.inc.fixed
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Test empty statement: two consecutive semi-colons without executable code between them.
|
5 |
+
*/
|
6 |
+
function_call(); // OK.
|
7 |
+
|
8 |
+
// The below examples are all bad.
|
9 |
+
function_call();
|
10 |
+
|
11 |
+
function_call();
|
12 |
+
|
13 |
+
function_call();
|
14 |
+
/* some comment */
|
15 |
+
|
16 |
+
function_call();
|
17 |
+
/* some comment */
|
18 |
+
|
19 |
+
?>
|
20 |
+
<input name="<?php something_else(); ?>" />
|
21 |
+
<input name="<?php something_else(); ?>" />
|
22 |
+
|
23 |
+
/*
|
24 |
+
* Test empty statement: no code between PHP open and close tag.
|
25 |
+
*/
|
26 |
+
<input name="<?php something_else() ?>" /> <!-- OK. -->
|
27 |
+
<input name="<?php something_else(); ?>" /> <!-- OK. -->
|
28 |
+
<input name="<?php /* comment */ ?>" /> <!-- OK. -->
|
29 |
+
|
30 |
+
<input name="" /> <!-- Bad. -->
|
31 |
+
|
32 |
+
<input name="" /> <!-- Bad. -->
|
33 |
+
|
34 |
+
<!--
|
35 |
+
/*
|
36 |
+
* Test detecting & fixing a combination of the two above checks.
|
37 |
+
*/
|
38 |
+
-->
|
39 |
+
|
40 |
+
<input name="" /> <!-- Bad. -->
|
41 |
+
|
42 |
+
<!-- Tests with short open echo tag. -->
|
43 |
+
<input name="<?= 'some text' ?>" /> <!-- OK. -->
|
44 |
+
<input name="" /> <!-- Bad. -->
|
45 |
+
<input name="" /> <!-- Bad. -->
|
46 |
+
|
47 |
+
<?php
|
48 |
+
// Guard against false positives for two consecutive semi-colons in a for statement.
|
49 |
+
for ( $i = 0; ; $i++ ) {}
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/EmptyPHPStatementUnitTest.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Unit test class for the EmptyStatement sniff.
|
4 |
+
*
|
5 |
+
* @author Juliette Reinders Folmer <phpcs_nospam@adviesenzo.nl>
|
6 |
+
* @copyright 2017 Juliette Reinders Folmer. All rights reserved.
|
7 |
+
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
8 |
+
*/
|
9 |
+
|
10 |
+
namespace PHP_CodeSniffer\Standards\Generic\Tests\CodeAnalysis;
|
11 |
+
|
12 |
+
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
|
13 |
+
|
14 |
+
class EmptyPHPStatementUnitTest extends AbstractSniffUnitTest
|
15 |
+
{
|
16 |
+
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Returns the lines where errors should occur.
|
20 |
+
*
|
21 |
+
* The key of the array should represent the line number and the value
|
22 |
+
* should represent the number of errors that should occur on that line.
|
23 |
+
*
|
24 |
+
* @return array<int, int>
|
25 |
+
*/
|
26 |
+
public function getErrorList()
|
27 |
+
{
|
28 |
+
return [];
|
29 |
+
|
30 |
+
}//end getErrorList()
|
31 |
+
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Returns the lines where warnings should occur.
|
35 |
+
*
|
36 |
+
* The key of the array should represent the line number and the value
|
37 |
+
* should represent the number of warnings that should occur on that line.
|
38 |
+
*
|
39 |
+
* @return array<int, int>
|
40 |
+
*/
|
41 |
+
public function getWarningList()
|
42 |
+
{
|
43 |
+
return [
|
44 |
+
9 => 1,
|
45 |
+
12 => 1,
|
46 |
+
15 => 1,
|
47 |
+
18 => 1,
|
48 |
+
21 => 1,
|
49 |
+
22 => 1,
|
50 |
+
31 => 1,
|
51 |
+
33 => 1,
|
52 |
+
43 => 1,
|
53 |
+
45 => 1,
|
54 |
+
49 => 1,
|
55 |
+
50 => 1,
|
56 |
+
];
|
57 |
+
|
58 |
+
}//end getWarningList()
|
59 |
+
|
60 |
+
|
61 |
+
}//end class
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.inc
CHANGED
@@ -20,7 +20,7 @@ function foobar($a, &$b) {
|
|
20 |
return (preg_match('/foo/', $a, $b) !== 0);
|
21 |
}
|
22 |
|
23 |
-
class Foo {
|
24 |
function barfoo($a, $b) {
|
25 |
// Empty body means interface method in many cases.
|
26 |
}
|
@@ -78,3 +78,46 @@ function bar($x)
|
|
78 |
$foo = function ($a, $b) {
|
79 |
return $a * 2;
|
80 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
return (preg_match('/foo/', $a, $b) !== 0);
|
21 |
}
|
22 |
|
23 |
+
class Foo implements Bar {
|
24 |
function barfoo($a, $b) {
|
25 |
// Empty body means interface method in many cases.
|
26 |
}
|
78 |
$foo = function ($a, $b) {
|
79 |
return $a * 2;
|
80 |
};
|
81 |
+
|
82 |
+
function foobar() {
|
83 |
+
return;
|
84 |
+
}
|
85 |
+
|
86 |
+
|
87 |
+
/*
|
88 |
+
* The function signature of methods in extended classes and implemented
|
89 |
+
* interfaces has to mirror the parent class/interface.
|
90 |
+
* The overloaded method may not use all params.
|
91 |
+
*/
|
92 |
+
|
93 |
+
class MyClass {
|
94 |
+
public function something($a, $b) {
|
95 |
+
return $a * 2;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
class MyExtendedClass extends SomeClass {
|
100 |
+
public function something($a, $b) {
|
101 |
+
return $a * 2;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
class MyExtendedClass implements SomeInterface {
|
106 |
+
public function something($a, $b) {
|
107 |
+
return $a * 2;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
|
112 |
+
/*
|
113 |
+
* Functions may not use all params passed to them.
|
114 |
+
* Report different violations for params *before* and *after* the last param used.
|
115 |
+
*/
|
116 |
+
|
117 |
+
function something($a) {
|
118 |
+
return 'foobar';
|
119 |
+
}
|
120 |
+
|
121 |
+
function myCallback($a, $b, $c, $d) {
|
122 |
+
return $a * $c;
|
123 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.php
CHANGED
@@ -41,9 +41,14 @@ class UnusedFunctionParameterUnitTest extends AbstractSniffUnitTest
|
|
41 |
public function getWarningList()
|
42 |
{
|
43 |
return [
|
44 |
-
3
|
45 |
-
7
|
46 |
-
78
|
|
|
|
|
|
|
|
|
|
|
47 |
];
|
48 |
|
49 |
}//end getWarningList()
|
41 |
public function getWarningList()
|
42 |
{
|
43 |
return [
|
44 |
+
3 => 1,
|
45 |
+
7 => 1,
|
46 |
+
78 => 1,
|
47 |
+
94 => 1,
|
48 |
+
100 => 1,
|
49 |
+
106 => 1,
|
50 |
+
117 => 1,
|
51 |
+
121 => 2,
|
52 |
];
|
53 |
|
54 |
}//end getWarningList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.6.inc
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<?php
|
2 |
+
echo 'foo';
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.7.inc
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
foo<?php
|
2 |
+
echo 'foo';
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.php
CHANGED
@@ -34,6 +34,9 @@ class InlineHTMLUnitTest extends AbstractSniffUnitTest
|
|
34 |
case 'InlineHTMLUnitTest.4.inc':
|
35 |
return [1 => 1];
|
36 |
break;
|
|
|
|
|
|
|
37 |
default:
|
38 |
return [];
|
39 |
break;
|
34 |
case 'InlineHTMLUnitTest.4.inc':
|
35 |
return [1 => 1];
|
36 |
break;
|
37 |
+
case 'InlineHTMLUnitTest.7.inc':
|
38 |
+
return [1 => 1];
|
39 |
+
break;
|
40 |
default:
|
41 |
return [];
|
42 |
break;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/NoSpaceAfterCastUnitTest.inc
CHANGED
@@ -43,3 +43,9 @@ $var = (object) $var2;
|
|
43 |
$var = (unset) $var2;
|
44 |
$var = (unset)$var2;
|
45 |
$var = (unset) $var2;
|
|
|
|
|
|
|
|
|
|
|
|
43 |
$var = (unset) $var2;
|
44 |
$var = (unset)$var2;
|
45 |
$var = (unset) $var2;
|
46 |
+
|
47 |
+
$var = b"binary $foo";
|
48 |
+
$var = b"binary string";
|
49 |
+
$var = b'binary string';
|
50 |
+
$var = (binary) $string;
|
51 |
+
$var = (binary)$string;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/NoSpaceAfterCastUnitTest.inc.fixed
CHANGED
@@ -43,3 +43,9 @@ $var = (object)$var2;
|
|
43 |
$var = (unset)$var2;
|
44 |
$var = (unset)$var2;
|
45 |
$var = (unset)$var2;
|
|
|
|
|
|
|
|
|
|
|
|
43 |
$var = (unset)$var2;
|
44 |
$var = (unset)$var2;
|
45 |
$var = (unset)$var2;
|
46 |
+
|
47 |
+
$var = b"binary $foo";
|
48 |
+
$var = b"binary string";
|
49 |
+
$var = b'binary string';
|
50 |
+
$var = (binary)$string;
|
51 |
+
$var = (binary)$string;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/NoSpaceAfterCastUnitTest.php
CHANGED
@@ -48,6 +48,7 @@ class NoSpaceAfterCastUnitTest extends AbstractSniffUnitTest
|
|
48 |
41 => 1,
|
49 |
43 => 1,
|
50 |
45 => 1,
|
|
|
51 |
];
|
52 |
|
53 |
}//end getErrorList()
|
48 |
41 => 1,
|
49 |
43 => 1,
|
50 |
45 => 1,
|
51 |
+
50 => 1,
|
52 |
];
|
53 |
|
54 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.inc
CHANGED
@@ -10,7 +10,7 @@ $var = (integer) $var2;
|
|
10 |
|
11 |
$var = (string) $var2;
|
12 |
$var = (string)$var2;
|
13 |
-
$var = (string)
|
14 |
|
15 |
$var = (float) $var2;
|
16 |
$var = (float)$var2;
|
@@ -42,4 +42,54 @@ $var = (object) $var2;
|
|
42 |
|
43 |
$var = (unset) $var2;
|
44 |
$var = (unset)$var2;
|
45 |
-
$var = (unset)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
$var = (string) $var2;
|
12 |
$var = (string)$var2;
|
13 |
+
$var = (string) $var2;
|
14 |
|
15 |
$var = (float) $var2;
|
16 |
$var = (float)$var2;
|
42 |
|
43 |
$var = (unset) $var2;
|
44 |
$var = (unset)$var2;
|
45 |
+
$var = (unset) $var2;
|
46 |
+
|
47 |
+
$var = b"binary $foo";
|
48 |
+
$var = b"binary string";
|
49 |
+
$var = b'binary string';
|
50 |
+
$var = (binary) $string;
|
51 |
+
$var = (binary)$string;
|
52 |
+
|
53 |
+
$var = (boolean) /* comment */ $var2;
|
54 |
+
|
55 |
+
$var = (int)
|
56 |
+
$var2;
|
57 |
+
|
58 |
+
if ( (string) // phpcs:ignore Standard.Cat.SniffName -- for reasons.
|
59 |
+
$x === 'test'
|
60 |
+
) {}
|
61 |
+
|
62 |
+
// phpcs:set Generic.Formatting.SpaceAfterCast ignoreNewlines true
|
63 |
+
$var = (int)
|
64 |
+
$var1 + (bool) $var2;
|
65 |
+
|
66 |
+
if ( (string) // phpcs:ignore Standard.Cat.SniffName -- for reasons.
|
67 |
+
$x === 'test'
|
68 |
+
) {}
|
69 |
+
// phpcs:set Generic.Formatting.SpaceAfterCast ignoreNewlines false
|
70 |
+
|
71 |
+
// phpcs:set Generic.Formatting.SpaceAfterCast spacing 2
|
72 |
+
$var = (int) $var2;
|
73 |
+
$var = (string)$var2;
|
74 |
+
$var = (array) $var2;
|
75 |
+
$var = (unset) $var2;
|
76 |
+
$var = (boolean) /* comment */ $var2;
|
77 |
+
|
78 |
+
$var = (integer)
|
79 |
+
$var2;
|
80 |
+
|
81 |
+
// phpcs:set Generic.Formatting.SpaceAfterCast spacing 0
|
82 |
+
$var = (int) $var2;
|
83 |
+
$var = (string)$var2;
|
84 |
+
$var = (array) $var2;
|
85 |
+
$var = (unset) $var2;
|
86 |
+
$var = (boolean) /* comment */ $var2;
|
87 |
+
|
88 |
+
$var = (integer)
|
89 |
+
$var2;
|
90 |
+
|
91 |
+
// phpcs:set Generic.Formatting.SpaceAfterCast ignoreNewlines true
|
92 |
+
$var = (int)
|
93 |
+
$var1 + (bool) $var2;
|
94 |
+
// phpcs:set Generic.Formatting.SpaceAfterCast ignoreNewlines false
|
95 |
+
// phpcs:set Generic.Formatting.SpaceAfterCast spacing 1
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.inc.fixed
CHANGED
@@ -43,3 +43,50 @@ $var = (object) $var2;
|
|
43 |
$var = (unset) $var2;
|
44 |
$var = (unset) $var2;
|
45 |
$var = (unset) $var2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
$var = (unset) $var2;
|
44 |
$var = (unset) $var2;
|
45 |
$var = (unset) $var2;
|
46 |
+
|
47 |
+
$var = b"binary $foo";
|
48 |
+
$var = b"binary string";
|
49 |
+
$var = b'binary string';
|
50 |
+
$var = (binary) $string;
|
51 |
+
$var = (binary) $string;
|
52 |
+
|
53 |
+
$var = (boolean) /* comment */ $var2;
|
54 |
+
|
55 |
+
$var = (int) $var2;
|
56 |
+
|
57 |
+
if ( (string) // phpcs:ignore Standard.Cat.SniffName -- for reasons.
|
58 |
+
$x === 'test'
|
59 |
+
) {}
|
60 |
+
|
61 |
+
// phpcs:set Generic.Formatting.SpaceAfterCast ignoreNewlines true
|
62 |
+
$var = (int)
|
63 |
+
$var1 + (bool) $var2;
|
64 |
+
|
65 |
+
if ( (string) // phpcs:ignore Standard.Cat.SniffName -- for reasons.
|
66 |
+
$x === 'test'
|
67 |
+
) {}
|
68 |
+
// phpcs:set Generic.Formatting.SpaceAfterCast ignoreNewlines false
|
69 |
+
|
70 |
+
// phpcs:set Generic.Formatting.SpaceAfterCast spacing 2
|
71 |
+
$var = (int) $var2;
|
72 |
+
$var = (string) $var2;
|
73 |
+
$var = (array) $var2;
|
74 |
+
$var = (unset) $var2;
|
75 |
+
$var = (boolean) /* comment */ $var2;
|
76 |
+
|
77 |
+
$var = (integer) $var2;
|
78 |
+
|
79 |
+
// phpcs:set Generic.Formatting.SpaceAfterCast spacing 0
|
80 |
+
$var = (int)$var2;
|
81 |
+
$var = (string)$var2;
|
82 |
+
$var = (array)$var2;
|
83 |
+
$var = (unset)$var2;
|
84 |
+
$var = (boolean) /* comment */ $var2;
|
85 |
+
|
86 |
+
$var = (integer)$var2;
|
87 |
+
|
88 |
+
// phpcs:set Generic.Formatting.SpaceAfterCast ignoreNewlines true
|
89 |
+
$var = (int)
|
90 |
+
$var1 + (bool)$var2;
|
91 |
+
// phpcs:set Generic.Formatting.SpaceAfterCast ignoreNewlines false
|
92 |
+
// phpcs:set Generic.Formatting.SpaceAfterCast spacing 1
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.php
CHANGED
@@ -48,6 +48,22 @@ class SpaceAfterCastUnitTest extends AbstractSniffUnitTest
|
|
48 |
41 => 1,
|
49 |
44 => 1,
|
50 |
45 => 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
];
|
52 |
|
53 |
}//end getErrorList()
|
48 |
41 => 1,
|
49 |
44 => 1,
|
50 |
45 => 1,
|
51 |
+
51 => 1,
|
52 |
+
53 => 1,
|
53 |
+
55 => 1,
|
54 |
+
58 => 1,
|
55 |
+
64 => 1,
|
56 |
+
72 => 1,
|
57 |
+
73 => 1,
|
58 |
+
75 => 1,
|
59 |
+
76 => 1,
|
60 |
+
78 => 1,
|
61 |
+
82 => 1,
|
62 |
+
84 => 1,
|
63 |
+
85 => 1,
|
64 |
+
86 => 1,
|
65 |
+
88 => 1,
|
66 |
+
93 => 1,
|
67 |
];
|
68 |
|
69 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterNotUnitTest.inc
CHANGED
@@ -1,5 +1,86 @@
|
|
1 |
<?php
|
2 |
-
if (!$someVar || !$x instanceOf stdClass) {}
|
3 |
if (! $someVar || ! $x instanceOf stdClass) {}
|
|
|
|
|
4 |
if (!foo() && (!$x || true)) {}
|
5 |
$var = !($x || $y);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
|
|
2 |
if (! $someVar || ! $x instanceOf stdClass) {}
|
3 |
+
if (!$someVar || !$x instanceOf stdClass) {}
|
4 |
+
if (! $someVar || ! $x instanceOf stdClass) {}
|
5 |
if (!foo() && (!$x || true)) {}
|
6 |
$var = !($x || $y);
|
7 |
+
$var = ! ($x || $y);
|
8 |
+
$var = ! /*comment*/ ($x || $y);
|
9 |
+
|
10 |
+
$baz = function () {
|
11 |
+
return ! $bar;
|
12 |
+
};
|
13 |
+
|
14 |
+
if ( !
|
15 |
+
($x || $y)
|
16 |
+
) {
|
17 |
+
return !$bar;
|
18 |
+
}
|
19 |
+
|
20 |
+
if ( ! // phpcs:ignore Standard.Cat.SniffName -- for reasons.
|
21 |
+
($x || $y)
|
22 |
+
) {}
|
23 |
+
|
24 |
+
// phpcs:set Generic.Formatting.SpaceAfterNot ignoreNewlines true
|
25 |
+
if ( !
|
26 |
+
($x || $y)
|
27 |
+
) {
|
28 |
+
return !$bar;
|
29 |
+
}
|
30 |
+
|
31 |
+
if ( ! // phpcs:ignore Standard.Cat.SniffName -- for reasons.
|
32 |
+
($x || $y)
|
33 |
+
) {}
|
34 |
+
// phpcs:set Generic.Formatting.SpaceAfterNot ignoreNewlines false
|
35 |
+
|
36 |
+
// phpcs:set Generic.Formatting.SpaceAfterNot spacing 2
|
37 |
+
if (! $someVar || ! $x instanceOf stdClass) {}
|
38 |
+
if (!$someVar || !$x instanceOf stdClass) {}
|
39 |
+
if (! $someVar || ! $x instanceOf stdClass) {}
|
40 |
+
if (!foo() && (! $x || true)) {}
|
41 |
+
$var = ! ($x || $y);
|
42 |
+
$var = ! ($x || $y);
|
43 |
+
|
44 |
+
$baz = function () {
|
45 |
+
return ! $bar;
|
46 |
+
};
|
47 |
+
|
48 |
+
if ( !
|
49 |
+
($x || $y)
|
50 |
+
) {
|
51 |
+
return !$bar;
|
52 |
+
}
|
53 |
+
|
54 |
+
// phpcs:set Generic.Formatting.SpaceAfterNot spacing 0
|
55 |
+
if (!$someVar || !$x instanceOf stdClass) {}
|
56 |
+
if (! $someVar || ! $x instanceOf stdClass) {}
|
57 |
+
if (! foo() && (!$x || true)) {}
|
58 |
+
$var = ! ($x || $y);
|
59 |
+
$var = ! /*comment*/ ($x || $y);
|
60 |
+
|
61 |
+
$baz = function () {
|
62 |
+
return ! $bar;
|
63 |
+
};
|
64 |
+
|
65 |
+
if ( !
|
66 |
+
($x || $y)
|
67 |
+
) {
|
68 |
+
return ! $bar;
|
69 |
+
}
|
70 |
+
|
71 |
+
if ( ! // phpcs:ignore Standard.Cat.SniffName -- for reasons.
|
72 |
+
($x || $y)
|
73 |
+
) {}
|
74 |
+
|
75 |
+
// phpcs:set Generic.Formatting.SpaceAfterNot ignoreNewlines true
|
76 |
+
if ( !
|
77 |
+
($x || $y)
|
78 |
+
) {
|
79 |
+
return ! $bar;
|
80 |
+
}
|
81 |
+
|
82 |
+
if ( ! // phpcs:ignore Standard.Cat.SniffName -- for reasons.
|
83 |
+
($x || $y)
|
84 |
+
) {}
|
85 |
+
// phpcs:set Generic.Formatting.SpaceAfterNot ignoreNewlines false
|
86 |
+
// phpcs:set Generic.Formatting.SpaceAfterNot spacing 1
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterNotUnitTest.inc.fixed
CHANGED
@@ -1,5 +1,83 @@
|
|
1 |
<?php
|
2 |
if (! $someVar || ! $x instanceOf stdClass) {}
|
3 |
if (! $someVar || ! $x instanceOf stdClass) {}
|
|
|
4 |
if (! foo() && (! $x || true)) {}
|
5 |
$var = ! ($x || $y);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
if (! $someVar || ! $x instanceOf stdClass) {}
|
3 |
if (! $someVar || ! $x instanceOf stdClass) {}
|
4 |
+
if (! $someVar || ! $x instanceOf stdClass) {}
|
5 |
if (! foo() && (! $x || true)) {}
|
6 |
$var = ! ($x || $y);
|
7 |
+
$var = ! ($x || $y);
|
8 |
+
$var = ! /*comment*/ ($x || $y);
|
9 |
+
|
10 |
+
$baz = function () {
|
11 |
+
return ! $bar;
|
12 |
+
};
|
13 |
+
|
14 |
+
if ( ! ($x || $y)
|
15 |
+
) {
|
16 |
+
return ! $bar;
|
17 |
+
}
|
18 |
+
|
19 |
+
if ( ! // phpcs:ignore Standard.Cat.SniffName -- for reasons.
|
20 |
+
($x || $y)
|
21 |
+
) {}
|
22 |
+
|
23 |
+
// phpcs:set Generic.Formatting.SpaceAfterNot ignoreNewlines true
|
24 |
+
if ( !
|
25 |
+
($x || $y)
|
26 |
+
) {
|
27 |
+
return ! $bar;
|
28 |
+
}
|
29 |
+
|
30 |
+
if ( ! // phpcs:ignore Standard.Cat.SniffName -- for reasons.
|
31 |
+
($x || $y)
|
32 |
+
) {}
|
33 |
+
// phpcs:set Generic.Formatting.SpaceAfterNot ignoreNewlines false
|
34 |
+
|
35 |
+
// phpcs:set Generic.Formatting.SpaceAfterNot spacing 2
|
36 |
+
if (! $someVar || ! $x instanceOf stdClass) {}
|
37 |
+
if (! $someVar || ! $x instanceOf stdClass) {}
|
38 |
+
if (! $someVar || ! $x instanceOf stdClass) {}
|
39 |
+
if (! foo() && (! $x || true)) {}
|
40 |
+
$var = ! ($x || $y);
|
41 |
+
$var = ! ($x || $y);
|
42 |
+
|
43 |
+
$baz = function () {
|
44 |
+
return ! $bar;
|
45 |
+
};
|
46 |
+
|
47 |
+
if ( ! ($x || $y)
|
48 |
+
) {
|
49 |
+
return ! $bar;
|
50 |
+
}
|
51 |
+
|
52 |
+
// phpcs:set Generic.Formatting.SpaceAfterNot spacing 0
|
53 |
+
if (!$someVar || !$x instanceOf stdClass) {}
|
54 |
+
if (!$someVar || !$x instanceOf stdClass) {}
|
55 |
+
if (!foo() && (!$x || true)) {}
|
56 |
+
$var = !($x || $y);
|
57 |
+
$var = ! /*comment*/ ($x || $y);
|
58 |
+
|
59 |
+
$baz = function () {
|
60 |
+
return !$bar;
|
61 |
+
};
|
62 |
+
|
63 |
+
if ( !($x || $y)
|
64 |
+
) {
|
65 |
+
return !$bar;
|
66 |
+
}
|
67 |
+
|
68 |
+
if ( ! // phpcs:ignore Standard.Cat.SniffName -- for reasons.
|
69 |
+
($x || $y)
|
70 |
+
) {}
|
71 |
+
|
72 |
+
// phpcs:set Generic.Formatting.SpaceAfterNot ignoreNewlines true
|
73 |
+
if ( !
|
74 |
+
($x || $y)
|
75 |
+
) {
|
76 |
+
return !$bar;
|
77 |
+
}
|
78 |
+
|
79 |
+
if ( ! // phpcs:ignore Standard.Cat.SniffName -- for reasons.
|
80 |
+
($x || $y)
|
81 |
+
) {}
|
82 |
+
// phpcs:set Generic.Formatting.SpaceAfterNot ignoreNewlines false
|
83 |
+
// phpcs:set Generic.Formatting.SpaceAfterNot spacing 1
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterNotUnitTest.php
CHANGED
@@ -21,15 +21,54 @@ class SpaceAfterNotUnitTest extends AbstractSniffUnitTest
|
|
21 |
* The key of the array should represent the line number and the value
|
22 |
* should represent the number of errors that should occur on that line.
|
23 |
*
|
|
|
|
|
24 |
* @return array<int, int>
|
25 |
*/
|
26 |
-
public function getErrorList()
|
27 |
{
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
}//end getErrorList()
|
35 |
|
21 |
* The key of the array should represent the line number and the value
|
22 |
* should represent the number of errors that should occur on that line.
|
23 |
*
|
24 |
+
* @param string $testFile The name of the file being tested.
|
25 |
+
*
|
26 |
* @return array<int, int>
|
27 |
*/
|
28 |
+
public function getErrorList($testFile='')
|
29 |
{
|
30 |
+
switch ($testFile) {
|
31 |
+
case 'SpaceAfterNotUnitTest.inc':
|
32 |
+
return [
|
33 |
+
3 => 2,
|
34 |
+
4 => 2,
|
35 |
+
5 => 2,
|
36 |
+
6 => 1,
|
37 |
+
7 => 1,
|
38 |
+
8 => 1,
|
39 |
+
11 => 1,
|
40 |
+
14 => 1,
|
41 |
+
17 => 1,
|
42 |
+
20 => 1,
|
43 |
+
28 => 1,
|
44 |
+
38 => 2,
|
45 |
+
39 => 2,
|
46 |
+
40 => 1,
|
47 |
+
41 => 1,
|
48 |
+
42 => 1,
|
49 |
+
48 => 1,
|
50 |
+
51 => 1,
|
51 |
+
56 => 2,
|
52 |
+
57 => 1,
|
53 |
+
58 => 1,
|
54 |
+
59 => 1,
|
55 |
+
62 => 1,
|
56 |
+
65 => 1,
|
57 |
+
68 => 1,
|
58 |
+
71 => 1,
|
59 |
+
79 => 1,
|
60 |
+
];
|
61 |
+
|
62 |
+
case 'SpaceAfterNotUnitTest.js':
|
63 |
+
return [
|
64 |
+
2 => 2,
|
65 |
+
4 => 2,
|
66 |
+
5 => 1,
|
67 |
+
];
|
68 |
+
|
69 |
+
default:
|
70 |
+
return [];
|
71 |
+
}//end switch
|
72 |
|
73 |
}//end getErrorList()
|
74 |
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceBeforeCastUnitTest.inc
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$a = $a+(bool) $b;
|
4 |
+
$a = function_call((bool) $b);
|
5 |
+
if ((bool) $a ===(bool) $b) {}
|
6 |
+
|
7 |
+
$var = (int) $var2;
|
8 |
+
$var =(int) $var2;
|
9 |
+
$var = (int) $var2;
|
10 |
+
|
11 |
+
$var = (integer) $var2;
|
12 |
+
$var =(integer) $var2;
|
13 |
+
$var = (integer) $var2;
|
14 |
+
|
15 |
+
$var = (string) $var2;
|
16 |
+
$var =(string) $var2;
|
17 |
+
$var = (string) $var2;
|
18 |
+
|
19 |
+
$var = (float) $var2;
|
20 |
+
$var =(float) $var2;
|
21 |
+
$var = (float) $var2;
|
22 |
+
|
23 |
+
$var = (double) $var2;
|
24 |
+
$var =(double) $var2;
|
25 |
+
$var = (double) $var2;
|
26 |
+
|
27 |
+
$var = (real) $var2;
|
28 |
+
$var =(real) $var2;
|
29 |
+
$var = (real) $var2;
|
30 |
+
|
31 |
+
$var = (array) $var2;
|
32 |
+
$var =(array) $var2;
|
33 |
+
$var = (array) $var2;
|
34 |
+
|
35 |
+
$var = (bool) $var2;
|
36 |
+
$var =(bool) $var2;
|
37 |
+
$var = (bool) $var2;
|
38 |
+
|
39 |
+
$var = (boolean) $var2;
|
40 |
+
$var =(boolean) $var2;
|
41 |
+
$var = (boolean) $var2;
|
42 |
+
|
43 |
+
$var = (object) $var2;
|
44 |
+
$var =(object) $var2;
|
45 |
+
$var = (object) $var2;
|
46 |
+
|
47 |
+
$var = (unset) $var2;
|
48 |
+
$var =(unset) $var2;
|
49 |
+
$var = (unset) $var2;
|
50 |
+
|
51 |
+
$var = b"binary $foo";
|
52 |
+
$var =b"binary string";
|
53 |
+
$var = b'binary string';
|
54 |
+
$var = (binary) $string;
|
55 |
+
$var =(binary) $string;
|
56 |
+
$var = (binary) $string;
|
57 |
+
|
58 |
+
$var = array(
|
59 |
+
(bool) $a,
|
60 |
+
array(
|
61 |
+
(int) $b,
|
62 |
+
),
|
63 |
+
);
|
64 |
+
|
65 |
+
(bool) $a ? echo $b : echo $c;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceBeforeCastUnitTest.inc.fixed
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$a = $a+ (bool) $b;
|
4 |
+
$a = function_call( (bool) $b);
|
5 |
+
if ( (bool) $a === (bool) $b) {}
|
6 |
+
|
7 |
+
$var = (int) $var2;
|
8 |
+
$var = (int) $var2;
|
9 |
+
$var = (int) $var2;
|
10 |
+
|
11 |
+
$var = (integer) $var2;
|
12 |
+
$var = (integer) $var2;
|
13 |
+
$var = (integer) $var2;
|
14 |
+
|
15 |
+
$var = (string) $var2;
|
16 |
+
$var = (string) $var2;
|
17 |
+
$var = (string) $var2;
|
18 |
+
|
19 |
+
$var = (float) $var2;
|
20 |
+
$var = (float) $var2;
|
21 |
+
$var = (float) $var2;
|
22 |
+
|
23 |
+
$var = (double) $var2;
|
24 |
+
$var = (double) $var2;
|
25 |
+
$var = (double) $var2;
|
26 |
+
|
27 |
+
$var = (real) $var2;
|
28 |
+
$var = (real) $var2;
|
29 |
+
$var = (real) $var2;
|
30 |
+
|
31 |
+
$var = (array) $var2;
|
32 |
+
$var = (array) $var2;
|
33 |
+
$var = (array) $var2;
|
34 |
+
|
35 |
+
$var = (bool) $var2;
|
36 |
+
$var = (bool) $var2;
|
37 |
+
$var = (bool) $var2;
|
38 |
+
|
39 |
+
$var = (boolean) $var2;
|
40 |
+
$var = (boolean) $var2;
|
41 |
+
$var = (boolean) $var2;
|
42 |
+
|
43 |
+
$var = (object) $var2;
|
44 |
+
$var = (object) $var2;
|
45 |
+
$var = (object) $var2;
|
46 |
+
|
47 |
+
$var = (unset) $var2;
|
48 |
+
$var = (unset) $var2;
|
49 |
+
$var = (unset) $var2;
|
50 |
+
|
51 |
+
$var = b"binary $foo";
|
52 |
+
$var = b"binary string";
|
53 |
+
$var = b'binary string';
|
54 |
+
$var = (binary) $string;
|
55 |
+
$var = (binary) $string;
|
56 |
+
$var = (binary) $string;
|
57 |
+
|
58 |
+
$var = array(
|
59 |
+
(bool) $a,
|
60 |
+
array(
|
61 |
+
(int) $b,
|
62 |
+
),
|
63 |
+
);
|
64 |
+
|
65 |
+
(bool) $a ? echo $b : echo $c;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceBeforeCastUnitTest.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Unit test class for the SpaceBeforeCast sniff.
|
4 |
+
*
|
5 |
+
* @author Greg Sherwood <gsherwood@squiz.net>
|
6 |
+
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
|
7 |
+
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
8 |
+
*/
|
9 |
+
|
10 |
+
namespace PHP_CodeSniffer\Standards\Generic\Tests\Formatting;
|
11 |
+
|
12 |
+
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
|
13 |
+
|
14 |
+
class SpaceBeforeCastUnitTest extends AbstractSniffUnitTest
|
15 |
+
{
|
16 |
+
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Returns the lines where errors should occur.
|
20 |
+
*
|
21 |
+
* The key of the array should represent the line number and the value
|
22 |
+
* should represent the number of errors that should occur on that line.
|
23 |
+
*
|
24 |
+
* @return array<int, int>
|
25 |
+
*/
|
26 |
+
public function getErrorList()
|
27 |
+
{
|
28 |
+
return [
|
29 |
+
3 => 1,
|
30 |
+
4 => 1,
|
31 |
+
5 => 2,
|
32 |
+
8 => 1,
|
33 |
+
9 => 1,
|
34 |
+
12 => 1,
|
35 |
+
13 => 1,
|
36 |
+
16 => 1,
|
37 |
+
17 => 1,
|
38 |
+
20 => 1,
|
39 |
+
21 => 1,
|
40 |
+
24 => 1,
|
41 |
+
25 => 1,
|
42 |
+
28 => 1,
|
43 |
+
29 => 1,
|
44 |
+
32 => 1,
|
45 |
+
33 => 1,
|
46 |
+
36 => 1,
|
47 |
+
37 => 1,
|
48 |
+
40 => 1,
|
49 |
+
41 => 1,
|
50 |
+
44 => 1,
|
51 |
+
45 => 1,
|
52 |
+
48 => 1,
|
53 |
+
49 => 1,
|
54 |
+
52 => 1,
|
55 |
+
53 => 1,
|
56 |
+
55 => 1,
|
57 |
+
56 => 1,
|
58 |
+
];
|
59 |
+
|
60 |
+
}//end getErrorList()
|
61 |
+
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Returns the lines where warnings should occur.
|
65 |
+
*
|
66 |
+
* The key of the array should represent the line number and the value
|
67 |
+
* should represent the number of warnings that should occur on that line.
|
68 |
+
*
|
69 |
+
* @return array<int, int>
|
70 |
+
*/
|
71 |
+
public function getWarningList()
|
72 |
+
{
|
73 |
+
return [];
|
74 |
+
|
75 |
+
}//end getWarningList()
|
76 |
+
|
77 |
+
|
78 |
+
}//end class
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.inc
CHANGED
@@ -31,3 +31,9 @@ $foo = Bar(&$fooBar);
|
|
31 |
|
32 |
myfunc($myvar&$myvar);
|
33 |
myfunc($myvar[0]&$myvar);
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
myfunc($myvar&$myvar);
|
33 |
myfunc($myvar[0]&$myvar);
|
34 |
+
|
35 |
+
myfunc(myclass::MY_CONST&$myvar);
|
36 |
+
myfunc(MY_CONST&$myvar);
|
37 |
+
|
38 |
+
efg( true == &$b );
|
39 |
+
efg( true === &$b );
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.inc
CHANGED
@@ -147,3 +147,21 @@ $a = new class {
|
|
147 |
function __my_function() {}
|
148 |
|
149 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
function __my_function() {}
|
148 |
|
149 |
};
|
150 |
+
|
151 |
+
class FooBar extends \SoapClient {
|
152 |
+
public function __getCookies() {}
|
153 |
+
}
|
154 |
+
|
155 |
+
class Nested {
|
156 |
+
public function getAnonymousClass() {
|
157 |
+
return new class() {
|
158 |
+
public function nested_function() {}
|
159 |
+
function __something() {}
|
160 |
+
};
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
abstract class My_Class {
|
165 |
+
public function my_class() {}
|
166 |
+
public function _MY_CLASS() {}
|
167 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.php
CHANGED
@@ -61,6 +61,8 @@ class CamelCapsFunctionNameUnitTest extends AbstractSniffUnitTest
|
|
61 |
144 => 1,
|
62 |
146 => 1,
|
63 |
147 => 2,
|
|
|
|
|
64 |
];
|
65 |
|
66 |
return $errors;
|
61 |
144 => 1,
|
62 |
146 => 1,
|
63 |
147 => 2,
|
64 |
+
158 => 1,
|
65 |
+
159 => 1,
|
66 |
];
|
67 |
|
68 |
return $errors;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/ConstructorNameUnitTest.inc
CHANGED
@@ -8,7 +8,7 @@ class TestClass extends MyClass
|
|
8 |
}
|
9 |
|
10 |
function __construct() {
|
11 |
-
parent::
|
12 |
parent::__construct();
|
13 |
}
|
14 |
|
@@ -29,7 +29,7 @@ class MyClass
|
|
29 |
|
30 |
}
|
31 |
|
32 |
-
class
|
33 |
{
|
34 |
function __construct() {
|
35 |
something::MyNamespace();
|
@@ -64,3 +64,29 @@ foo(new class extends MyClass
|
|
64 |
}
|
65 |
|
66 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
}
|
9 |
|
10 |
function __construct() {
|
11 |
+
parent::MYCLASS();
|
12 |
parent::__construct();
|
13 |
}
|
14 |
|
29 |
|
30 |
}
|
31 |
|
32 |
+
class MyOtherClass extends \MyNamespace\SomeClass
|
33 |
{
|
34 |
function __construct() {
|
35 |
something::MyNamespace();
|
64 |
}
|
65 |
|
66 |
});
|
67 |
+
|
68 |
+
class OlderClass
|
69 |
+
{
|
70 |
+
function OlderClass() {}
|
71 |
+
|
72 |
+
function __CONSTRUCT() {}
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
// Issue #2178.
|
77 |
+
class Nested extends Another {
|
78 |
+
public function getAnonymousClass() {
|
79 |
+
return new class() extends Something {
|
80 |
+
public function nested() {
|
81 |
+
echo 'In method nested!';
|
82 |
+
parent::Another(); // OK.
|
83 |
+
}
|
84 |
+
|
85 |
+
public function __construct() {
|
86 |
+
parent::Another(); // OK.
|
87 |
+
}
|
88 |
+
};
|
89 |
+
}
|
90 |
+
|
91 |
+
abstract public function nested();
|
92 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/ConstructorNameUnitTest.php
CHANGED
@@ -30,6 +30,7 @@ class ConstructorNameUnitTest extends AbstractSniffUnitTest
|
|
30 |
11 => 1,
|
31 |
47 => 1,
|
32 |
62 => 1,
|
|
|
33 |
];
|
34 |
|
35 |
}//end getErrorList()
|
30 |
11 => 1,
|
31 |
47 => 1,
|
32 |
62 => 1,
|
33 |
+
91 => 1,
|
34 |
];
|
35 |
|
36 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/CharacterBeforePHPOpeningTagUnitTest.3.inc
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//some code
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.inc
CHANGED
@@ -42,3 +42,6 @@ function foo(
|
|
42 |
|
43 |
$foo = function (?Int $a, ? Callable $b)
|
44 |
:?INT{};
|
|
|
|
|
|
42 |
|
43 |
$foo = function (?Int $a, ? Callable $b)
|
44 |
:?INT{};
|
45 |
+
|
46 |
+
$var = (BInARY) $string;
|
47 |
+
$var = (binary)$string;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.inc.fixed
CHANGED
@@ -42,3 +42,6 @@ function foo(
|
|
42 |
|
43 |
$foo = function (?int $a, ? callable $b)
|
44 |
:?int{};
|
|
|
|
|
|
42 |
|
43 |
$foo = function (?int $a, ? callable $b)
|
44 |
:?int{};
|
45 |
+
|
46 |
+
$var = (binary) $string;
|
47 |
+
$var = (binary)$string;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.php
CHANGED
@@ -44,6 +44,7 @@ class LowerCaseTypeUnitTest extends AbstractSniffUnitTest
|
|
44 |
39 => 1,
|
45 |
43 => 2,
|
46 |
44 => 1,
|
|
|
47 |
];
|
48 |
|
49 |
}//end getErrorList()
|
44 |
39 => 1,
|
45 |
43 => 2,
|
46 |
44 => 1,
|
47 |
+
46 => 1,
|
48 |
];
|
49 |
|
50 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.1.css
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* This is a CSS comment.
|
3 |
+
<<<<<<< HEAD
|
4 |
+
* This is a merge conflict...
|
5 |
+
=======
|
6 |
+
* which should be detected.
|
7 |
+
>>>>>>> ref/heads/feature-branch
|
8 |
+
*/
|
9 |
+
|
10 |
+
.SettingsTabPaneWidgetType-tab-mid {
|
11 |
+
background: transparent url(tab_inact_mid.png) repeat-x;
|
12 |
+
<<<<<<< HEAD
|
13 |
+
line-height: -25px;
|
14 |
+
=======
|
15 |
+
line-height: -20px;
|
16 |
+
>>>>>>> ref/heads/feature-branch
|
17 |
+
cursor: pointer;
|
18 |
+
-moz-user-select: none;
|
19 |
+
}
|
20 |
+
|
21 |
+
/*
|
22 |
+
* The above tests are based on "normal" tokens.
|
23 |
+
* The below test checks that once the tokenizer breaks down because of
|
24 |
+
* unexpected merge conflict boundaries, subsequent boundaries will still
|
25 |
+
* be detected correctly.
|
26 |
+
*/
|
27 |
+
|
28 |
+
/*
|
29 |
+
* This is a CSS comment.
|
30 |
+
<<<<<<< HEAD
|
31 |
+
* This is a merge conflict...
|
32 |
+
=======
|
33 |
+
* which should be detected.
|
34 |
+
>>>>>>> ref/heads/feature-branch
|
35 |
+
*/
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.1.inc
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
var_dump(1 << -1);
|
4 |
+
var_dump(1 >> -1);
|
5 |
+
var_dump(
|
6 |
+
1
|
7 |
+
<<
|
8 |
+
-1
|
9 |
+
);
|
10 |
+
|
11 |
+
$string =
|
12 |
+
<<<EOD
|
13 |
+
This is a heredoc.
|
14 |
+
EOD;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* This is not a merge conflict, but a comment showing what
|
18 |
+
* a merge conflict boundary looks:
|
19 |
+
* <<<<<<< HEAD
|
20 |
+
*/
|
21 |
+
|
22 |
+
function test()
|
23 |
+
{
|
24 |
+
$arr = array(
|
25 |
+
'a' => 'a'
|
26 |
+
<<<<<<< HEAD
|
27 |
+
'b' => 'b'
|
28 |
+
=======
|
29 |
+
'c' => 'c'
|
30 |
+
>>>>>>> master
|
31 |
+
);
|
32 |
+
}
|
33 |
+
|
34 |
+
/*
|
35 |
+
* The above tests are based on "normal" tokens.
|
36 |
+
* The below test checks that once the tokenizer breaks down because of
|
37 |
+
* unexpected merge conflict boundaries - i.e. after the first merge conflict
|
38 |
+
* opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent
|
39 |
+
* merge conflict boundaries will still be detected correctly.
|
40 |
+
*/
|
41 |
+
|
42 |
+
/*
|
43 |
+
* Testing detecting subsequent merge conflicts.
|
44 |
+
*
|
45 |
+
<<<<<<< HEAD
|
46 |
+
* @var string $bar
|
47 |
+
*/
|
48 |
+
public function foo($bar){ }
|
49 |
+
|
50 |
+
/**
|
51 |
+
============
|
52 |
+
The above is not the boundary, the below is.
|
53 |
+
=======
|
54 |
+
* @var string $bar
|
55 |
+
>>>>>>> f19f8a5... Commit message
|
56 |
+
*/
|
57 |
+
|
58 |
+
// Test that stray boundaries, i.e. an opener without closer and such, are detected.
|
59 |
+
<<<<<<< HEAD
|
60 |
+
$a = 1;
|
61 |
+
=======
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.2.css
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* This is a CSS comment.
|
3 |
+
<<<<<<< HEAD
|
4 |
+
* This is a merge conflict started in a comment, ending in a CSS block.
|
5 |
+
*/
|
6 |
+
.SettingsTabPaneWidgetType-tab-mid {
|
7 |
+
background: transparent url(tab_inact_mid.png) repeat-x;
|
8 |
+
=======
|
9 |
+
* which should be detected.
|
10 |
+
**/
|
11 |
+
.SettingsTabPaneWidgetType-tab-start {
|
12 |
+
line-height: -25px;
|
13 |
+
>>>>>>> ref/heads/feature-branch
|
14 |
+
cursor: pointer;
|
15 |
+
-moz-user-select: none;
|
16 |
+
}
|
17 |
+
|
18 |
+
/*
|
19 |
+
* The above tests are based on "normal" tokens.
|
20 |
+
* The below test checks that once the tokenizer breaks down because of
|
21 |
+
* unexpected merge conflict boundaries, subsequent boundaries will still
|
22 |
+
* be detected correctly.
|
23 |
+
*/
|
24 |
+
|
25 |
+
/*
|
26 |
+
* This is a CSS comment.
|
27 |
+
<<<<<<< HEAD
|
28 |
+
* This is a merge conflict...
|
29 |
+
=======
|
30 |
+
* which should be detected.
|
31 |
+
>>>>>>> ref/heads/feature-branch
|
32 |
+
*/
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.2.inc
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
<<<<<<< HEAD
|
5 |
+
* @var string $bar
|
6 |
+
=======
|
7 |
+
* @var string $bar
|
8 |
+
>>>>>>> master
|
9 |
+
*/
|
10 |
+
|
11 |
+
/*
|
12 |
+
* Testing detecting merge conflicts using different comment styles.
|
13 |
+
*
|
14 |
+
<<<<<<< HEAD
|
15 |
+
* @var string $bar
|
16 |
+
*/
|
17 |
+
public function foo($bar){ }
|
18 |
+
|
19 |
+
/*
|
20 |
+
=======
|
21 |
+
* @var string $bar
|
22 |
+
>>>>>>> master
|
23 |
+
*/
|
24 |
+
|
25 |
+
// Comment
|
26 |
+
<<<<<<< HEAD
|
27 |
+
// Second comment line. NOTE: The above opener breaks the tokenizer.
|
28 |
+
=======
|
29 |
+
// New second comment line
|
30 |
+
>>>>>>> master
|
31 |
+
// Third comment line
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.3.inc
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- Test detecting merge conflicts in inline HTML. -->
|
2 |
+
<div class="abc">
|
3 |
+
<<<<<<< HEAD
|
4 |
+
<p id="test-this">Testing a merge conflict.</p>
|
5 |
+
=======
|
6 |
+
<p id="test-that">Another text string.</p>
|
7 |
+
>>>>>>> ref/heads/feature-branch
|
8 |
+
</div>
|
9 |
+
|
10 |
+
<!-- Test detecting merge conflicts in inline HTML. -->
|
11 |
+
<div class="abc">
|
12 |
+
<<<<<<< HEAD
|
13 |
+
<p id="test-this"><?php echo 'Testing a merge conflict.'; ?></p>
|
14 |
+
=======
|
15 |
+
<p id="test-that"><?php echo 'Another text string.'; ?></p>
|
16 |
+
>>>>>>> ref/heads/feature-branch
|
17 |
+
</div>
|
18 |
+
|
19 |
+
<?php
|
20 |
+
|
21 |
+
// Break the tokenizer.
|
22 |
+
<<<<<<< HEAD
|
23 |
+
$a = 1;
|
24 |
+
=======
|
25 |
+
$a = 2;
|
26 |
+
>>>>>>> master
|
27 |
+
|
28 |
+
/*
|
29 |
+
* The above tests are based on "normal" tokens.
|
30 |
+
* The below test checks that once the tokenizer breaks down because of
|
31 |
+
* unexpected merge conflict boundaries - i.e. after the first merge conflict
|
32 |
+
* opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent
|
33 |
+
* merge conflict boundaries will still be detected correctly.
|
34 |
+
*/
|
35 |
+
?>
|
36 |
+
|
37 |
+
<div class="abc">
|
38 |
+
<<<<<<< HEAD
|
39 |
+
<p id="test-this">Testing a merge conflict.</p>
|
40 |
+
=======
|
41 |
+
<p id="test-that">Another text string.</p>
|
42 |
+
>>>>>>> ref/heads/feature-branch
|
43 |
+
</div>
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.4.inc
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$string =
|
4 |
+
<<<EOD
|
5 |
+
Merge conflicts in heredocs
|
6 |
+
<<<<<<< HEAD
|
7 |
+
can be problematic.
|
8 |
+
=======
|
9 |
+
should also be detected.
|
10 |
+
>>>>>>> ref/heads/other-branchname
|
11 |
+
And now they are.
|
12 |
+
EOD;
|
13 |
+
|
14 |
+
// Heredoc with a merge conflict starter, the closer is outside the heredoc.
|
15 |
+
$string =
|
16 |
+
<<<EOT
|
17 |
+
Merge conflicts in heredocs
|
18 |
+
<<<<<<< HEAD
|
19 |
+
can be problematic.
|
20 |
+
EOD;
|
21 |
+
$a = 1;
|
22 |
+
=======
|
23 |
+
should also be detected.
|
24 |
+
EOT;
|
25 |
+
>>>>>>> ref/heads/other-branchname
|
26 |
+
|
27 |
+
// Merge conflict starter outside with a closer inside of the heredoc.
|
28 |
+
// This breaks the tokenizer.
|
29 |
+
<<<<<<< HEAD
|
30 |
+
$string =
|
31 |
+
<<<EOT
|
32 |
+
Merge conflicts in heredocs
|
33 |
+
can be problematic.
|
34 |
+
=======
|
35 |
+
$differentVarName =
|
36 |
+
<<<EOD
|
37 |
+
Merge conflicts in heredocs
|
38 |
+
should also be detected.
|
39 |
+
>>>>>>> ref/heads/other-branchname
|
40 |
+
EOD;
|
41 |
+
|
42 |
+
/*
|
43 |
+
* The above tests are based on "normal" tokens.
|
44 |
+
* The below test checks that once the tokenizer breaks down because of
|
45 |
+
* unexpected merge conflict boundaries - i.e. after the first merge conflict
|
46 |
+
* opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent
|
47 |
+
* merge conflict boundaries will still be detected correctly.
|
48 |
+
*/
|
49 |
+
|
50 |
+
$string =
|
51 |
+
<<<EOD
|
52 |
+
Merge conflicts in heredocs
|
53 |
+
<<<<<<< HEAD
|
54 |
+
can be problematic.
|
55 |
+
=======
|
56 |
+
should also be detected.
|
57 |
+
>>>>>>> ref/heads/other-branchname
|
58 |
+
And now they are.
|
59 |
+
EOD;
|
60 |
+
|
61 |
+
$string =
|
62 |
+
<<<EOD
|
63 |
+
Merge conflicts in heredocs
|
64 |
+
<<<<<<< HEAD
|
65 |
+
can be problematic.
|
66 |
+
EOD;
|
67 |
+
$a = 1;
|
68 |
+
=======
|
69 |
+
should also be detected.
|
70 |
+
EOT;
|
71 |
+
>>>>>>> ref/heads/other-branchname
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.5.inc
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$string =
|
4 |
+
<<<'EOD'
|
5 |
+
Merge conflicts in nowdocs
|
6 |
+
<<<<<<< HEAD
|
7 |
+
can be problematic.
|
8 |
+
=======
|
9 |
+
should also be detected.
|
10 |
+
>>>>>>> ref/heads/other-branchname
|
11 |
+
And now they are.
|
12 |
+
EOD;
|
13 |
+
|
14 |
+
// Break the tokenizer.
|
15 |
+
<<<<<<< HEAD
|
16 |
+
|
17 |
+
/*
|
18 |
+
* The above tests are based on "normal" tokens.
|
19 |
+
* The below test checks that once the tokenizer breaks down because of
|
20 |
+
* unexpected merge conflict boundaries - i.e. after the first merge conflict
|
21 |
+
* opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent
|
22 |
+
* merge conflict boundaries will still be detected correctly.
|
23 |
+
*/
|
24 |
+
|
25 |
+
$string =
|
26 |
+
<<<'EOD'
|
27 |
+
can be problematic.
|
28 |
+
<<<<<<< HEAD
|
29 |
+
were previously not detected.
|
30 |
+
=======
|
31 |
+
should also be detected.
|
32 |
+
>>>>>>> ref/heads/other-branchname
|
33 |
+
And now they are.
|
34 |
+
EOD;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.6.inc
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$string =
|
4 |
+
<<<"EOD"
|
5 |
+
Merge conflicts in PHP 7.3 indented heredocs
|
6 |
+
<<<<<<< HEAD
|
7 |
+
can be problematic.
|
8 |
+
=======
|
9 |
+
should also be detected.
|
10 |
+
>>>>>>> ref/heads/other-branchname
|
11 |
+
And now they are.
|
12 |
+
EOD;
|
13 |
+
|
14 |
+
// Break the tokenizer.
|
15 |
+
>>>>>>> master
|
16 |
+
|
17 |
+
/*
|
18 |
+
* The above tests are based on "normal" tokens.
|
19 |
+
* The below test checks that once the tokenizer breaks down because of
|
20 |
+
* unexpected merge conflict boundaries - i.e. after the first merge conflict
|
21 |
+
* opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent
|
22 |
+
* merge conflict boundaries will still be detected correctly.
|
23 |
+
*/
|
24 |
+
|
25 |
+
$string =
|
26 |
+
<<<"EOD"
|
27 |
+
Merge conflicts in PHP 7.3 indented heredocs
|
28 |
+
<<<<<<< HEAD
|
29 |
+
can be problematic.
|
30 |
+
=======
|
31 |
+
should also be detected.
|
32 |
+
>>>>>>> ref/heads/other-branchname
|
33 |
+
And now they are.
|
34 |
+
EOD;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.js
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
result = x?y:z;
|
3 |
+
result = x ? y : z;
|
4 |
+
|
5 |
+
<<<<<<< HEAD
|
6 |
+
if (something === true
|
7 |
+
=======
|
8 |
+
if (something === false
|
9 |
+
>>>>>>> develop
|
10 |
+
^ somethingElse === true
|
11 |
+
) {
|
12 |
+
<<<<<<< HEAD
|
13 |
+
return true;
|
14 |
+
=======
|
15 |
+
return false;
|
16 |
+
>>>>>>> develop
|
17 |
+
}
|
18 |
+
|
19 |
+
y = 1
|
20 |
+
+ 2
|
21 |
+
- 3;
|
22 |
+
|
23 |
+
/*
|
24 |
+
<<<<<<< HEAD
|
25 |
+
* @var string $bar
|
26 |
+
*/
|
27 |
+
if (something === true
|
28 |
+
|
29 |
+
/**
|
30 |
+
=======
|
31 |
+
* @var string $foo
|
32 |
+
>>>>>>> master
|
33 |
+
*/
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.php
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Unit test class for the GitMergeConflict sniff.
|
4 |
+
*
|
5 |
+
* @author Juliette Reinders Folmer <phpcs_nospam@adviesenzo.nl>
|
6 |
+
* @copyright 2017 Juliette Reinders Folmer. All rights reserved.
|
7 |
+
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
8 |
+
*/
|
9 |
+
|
10 |
+
namespace PHP_CodeSniffer\Standards\Generic\Tests\VersionControl;
|
11 |
+
|
12 |
+
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
|
13 |
+
|
14 |
+
class GitMergeConflictUnitTest extends AbstractSniffUnitTest
|
15 |
+
{
|
16 |
+
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Returns the lines where errors should occur.
|
20 |
+
*
|
21 |
+
* The key of the array should represent the line number and the value
|
22 |
+
* should represent the number of errors that should occur on that line.
|
23 |
+
*
|
24 |
+
* @param string $testFile The name of the file being tested.
|
25 |
+
*
|
26 |
+
* @return array<int, int>
|
27 |
+
*/
|
28 |
+
public function getErrorList($testFile='GitMergeConflictUnitTest.1.inc')
|
29 |
+
{
|
30 |
+
switch ($testFile) {
|
31 |
+
case 'GitMergeConflictUnitTest.1.inc':
|
32 |
+
return [
|
33 |
+
26 => 1,
|
34 |
+
28 => 1,
|
35 |
+
30 => 1,
|
36 |
+
45 => 1,
|
37 |
+
53 => 1,
|
38 |
+
55 => 1,
|
39 |
+
59 => 1,
|
40 |
+
61 => 1,
|
41 |
+
];
|
42 |
+
|
43 |
+
case 'GitMergeConflictUnitTest.2.inc':
|
44 |
+
return [
|
45 |
+
4 => 1,
|
46 |
+
6 => 1,
|
47 |
+
8 => 1,
|
48 |
+
14 => 1,
|
49 |
+
20 => 1,
|
50 |
+
22 => 1,
|
51 |
+
26 => 1,
|
52 |
+
28 => 1,
|
53 |
+
30 => 1,
|
54 |
+
];
|
55 |
+
|
56 |
+
case 'GitMergeConflictUnitTest.3.inc':
|
57 |
+
return [
|
58 |
+
3 => 1,
|
59 |
+
5 => 1,
|
60 |
+
7 => 1,
|
61 |
+
12 => 1,
|
62 |
+
14 => 1,
|
63 |
+
16 => 1,
|
64 |
+
22 => 1,
|
65 |
+
24 => 1,
|
66 |
+
26 => 1,
|
67 |
+
38 => 1,
|
68 |
+
40 => 1,
|
69 |
+
42 => 1,
|
70 |
+
];
|
71 |
+
|
72 |
+
case 'GitMergeConflictUnitTest.4.inc':
|
73 |
+
return [
|
74 |
+
6 => 1,
|
75 |
+
8 => 1,
|
76 |
+
10 => 1,
|
77 |
+
18 => 1,
|
78 |
+
22 => 1,
|
79 |
+
25 => 1,
|
80 |
+
29 => 1,
|
81 |
+
34 => 1,
|
82 |
+
39 => 1,
|
83 |
+
53 => 1,
|
84 |
+
55 => 1,
|
85 |
+
57 => 1,
|
86 |
+
64 => 1,
|
87 |
+
68 => 1,
|
88 |
+
71 => 1,
|
89 |
+
];
|
90 |
+
case 'GitMergeConflictUnitTest.5.inc':
|
91 |
+
case 'GitMergeConflictUnitTest.6.inc':
|
92 |
+
return [
|
93 |
+
6 => 1,
|
94 |
+
8 => 1,
|
95 |
+
10 => 1,
|
96 |
+
15 => 1,
|
97 |
+
28 => 1,
|
98 |
+
30 => 1,
|
99 |
+
32 => 1,
|
100 |
+
];
|
101 |
+
|
102 |
+
case 'GitMergeConflictUnitTest.1.css':
|
103 |
+
return [
|
104 |
+
3 => 1,
|
105 |
+
5 => 1,
|
106 |
+
7 => 1,
|
107 |
+
12 => 1,
|
108 |
+
14 => 1,
|
109 |
+
16 => 1,
|
110 |
+
30 => 1,
|
111 |
+
32 => 1,
|
112 |
+
34 => 1,
|
113 |
+
];
|
114 |
+
|
115 |
+
case 'GitMergeConflictUnitTest.2.css':
|
116 |
+
return [
|
117 |
+
3 => 1,
|
118 |
+
8 => 1,
|
119 |
+
13 => 1,
|
120 |
+
27 => 1,
|
121 |
+
29 => 1,
|
122 |
+
31 => 1,
|
123 |
+
];
|
124 |
+
|
125 |
+
case 'GitMergeConflictUnitTest.js':
|
126 |
+
return [
|
127 |
+
5 => 1,
|
128 |
+
7 => 1,
|
129 |
+
9 => 1,
|
130 |
+
12 => 1,
|
131 |
+
14 => 1,
|
132 |
+
16 => 1,
|
133 |
+
24 => 1,
|
134 |
+
30 => 1,
|
135 |
+
32 => 1,
|
136 |
+
];
|
137 |
+
|
138 |
+
default:
|
139 |
+
return [];
|
140 |
+
}//end switch
|
141 |
+
|
142 |
+
}//end getErrorList()
|
143 |
+
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Returns the lines where warnings should occur.
|
147 |
+
*
|
148 |
+
* The key of the array should represent the line number and the value
|
149 |
+
* should represent the number of warnings that should occur on that line.
|
150 |
+
*
|
151 |
+
* @return array<int, int>
|
152 |
+
*/
|
153 |
+
public function getWarningList()
|
154 |
+
{
|
155 |
+
return [];
|
156 |
+
|
157 |
+
}//end getWarningList()
|
158 |
+
|
159 |
+
|
160 |
+
}//end class
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/IncrementDecrementSpacingUnitTest.inc
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$i = 10;
|
4 |
+
--$i;
|
5 |
+
-- $i;
|
6 |
+
-- /*comment*/ $i;
|
7 |
+
++$i;
|
8 |
+
++
|
9 |
+
$i;
|
10 |
+
++/*comment*/$i;
|
11 |
+
|
12 |
+
$i--;
|
13 |
+
$i --;
|
14 |
+
$i /*comment*/ --;
|
15 |
+
$i++;
|
16 |
+
$i ++;
|
17 |
+
$i /*comment*/ ++;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/IncrementDecrementSpacingUnitTest.inc.fixed
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$i = 10;
|
4 |
+
--$i;
|
5 |
+
--$i;
|
6 |
+
-- /*comment*/ $i;
|
7 |
+
++$i;
|
8 |
+
++$i;
|
9 |
+
++/*comment*/$i;
|
10 |
+
|
11 |
+
$i--;
|
12 |
+
$i--;
|
13 |
+
$i /*comment*/ --;
|
14 |
+
$i++;
|
15 |
+
$i++;
|
16 |
+
$i /*comment*/ ++;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/IncrementDecrementSpacingUnitTest.js
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var i;
|
2 |
+
|
3 |
+
i = 10;
|
4 |
+
--i;
|
5 |
+
-- i;
|
6 |
+
-- /*comment*/ i;
|
7 |
+
++i;
|
8 |
+
++
|
9 |
+
i;
|
10 |
+
++/*comment*/i;
|
11 |
+
|
12 |
+
i--;
|
13 |
+
i --;
|
14 |
+
i /*comment*/ --;
|
15 |
+
i++;
|
16 |
+
i ++;
|
17 |
+
i /*comment*/ ++;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/IncrementDecrementSpacingUnitTest.js.fixed
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var i;
|
2 |
+
|
3 |
+
i = 10;
|
4 |
+
--i;
|
5 |
+
--i;
|
6 |
+
-- /*comment*/ i;
|
7 |
+
++i;
|
8 |
+
++i;
|
9 |
+
++/*comment*/i;
|
10 |
+
|
11 |
+
i--;
|
12 |
+
i--;
|
13 |
+
i /*comment*/ --;
|
14 |
+
i++;
|
15 |
+
i++;
|
16 |
+
i /*comment*/ ++;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/IncrementDecrementSpacingUnitTest.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Unit test class for the IncrementDecrementSpacing sniff.
|
4 |
+
*
|
5 |
+
* @author Juliette Reinders Folmer <phpcs_nospam@adviesenzo.nl>
|
6 |
+
* @copyright 2018 Juliette Reinders Folmer. All rights reserved.
|
7 |
+
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
8 |
+
*/
|
9 |
+
|
10 |
+
namespace PHP_CodeSniffer\Standards\Generic\Tests\WhiteSpace;
|
11 |
+
|
12 |
+
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
|
13 |
+
|
14 |
+
class IncrementDecrementSpacingUnitTest extends AbstractSniffUnitTest
|
15 |
+
{
|
16 |
+
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Returns the lines where errors should occur.
|
20 |
+
*
|
21 |
+
* The key of the array should represent the line number and the value
|
22 |
+
* should represent the number of errors that should occur on that line.
|
23 |
+
*
|
24 |
+
* @param string $testFile The name of the file being tested.
|
25 |
+
*
|
26 |
+
* @return array<int, int>
|
27 |
+
*/
|
28 |
+
public function getErrorList($testFile='IncrementDecrementSpacingUnitTest.inc')
|
29 |
+
{
|
30 |
+
switch ($testFile) {
|
31 |
+
case 'IncrementDecrementSpacingUnitTest.inc':
|
32 |
+
case 'IncrementDecrementSpacingUnitTest.js':
|
33 |
+
return [
|
34 |
+
5 => 1,
|
35 |
+
6 => 1,
|
36 |
+
8 => 1,
|
37 |
+
10 => 1,
|
38 |
+
13 => 1,
|
39 |
+
14 => 1,
|
40 |
+
16 => 1,
|
41 |
+
17 => 1,
|
42 |
+
];
|
43 |
+
|
44 |
+
default:
|
45 |
+
return [];
|
46 |
+
}//end switch
|
47 |
+
|
48 |
+
}//end getErrorList()
|
49 |
+
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Returns the lines where warnings should occur.
|
53 |
+
*
|
54 |
+
* The key of the array should represent the line number and the value
|
55 |
+
* should represent the number of warnings that should occur on that line.
|
56 |
+
*
|
57 |
+
* @return array<int, int>
|
58 |
+
*/
|
59 |
+
public function getWarningList()
|
60 |
+
{
|
61 |
+
return [];
|
62 |
+
|
63 |
+
}//end getWarningList()
|
64 |
+
|
65 |
+
|
66 |
+
}//end class
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.inc
CHANGED
@@ -49,8 +49,11 @@ namespace MyClass;
|
|
49 |
namespace MyClass;
|
50 |
namespace MyNamespace\MyClass;
|
51 |
namespace MyNamespace\MyClass;
|
|
|
|
|
|
|
52 |
namespace \MyNamespace\MyClass;
|
53 |
-
namespace
|
54 |
|
55 |
use MyClass;
|
56 |
use MyClass;
|
49 |
namespace MyClass;
|
50 |
namespace MyNamespace\MyClass;
|
51 |
namespace MyNamespace\MyClass;
|
52 |
+
|
53 |
+
// Namespace operator, not language construct.
|
54 |
+
namespace\MyNamespace\MyClass;
|
55 |
namespace \MyNamespace\MyClass;
|
56 |
+
namespace /*comment*/ \MyNamespace\MyClass;
|
57 |
|
58 |
use MyClass;
|
59 |
use MyClass;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.inc.fixed
CHANGED
@@ -45,8 +45,11 @@ namespace MyClass;
|
|
45 |
namespace MyClass;
|
46 |
namespace MyNamespace\MyClass;
|
47 |
namespace MyNamespace\MyClass;
|
|
|
|
|
|
|
48 |
namespace \MyNamespace\MyClass;
|
49 |
-
namespace
|
50 |
|
51 |
use MyClass;
|
52 |
use MyClass;
|
45 |
namespace MyClass;
|
46 |
namespace MyNamespace\MyClass;
|
47 |
namespace MyNamespace\MyClass;
|
48 |
+
|
49 |
+
// Namespace operator, not language construct.
|
50 |
+
namespace\MyNamespace\MyClass;
|
51 |
namespace \MyNamespace\MyClass;
|
52 |
+
namespace /*comment*/ \MyNamespace\MyClass;
|
53 |
|
54 |
use MyClass;
|
55 |
use MyClass;
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.php
CHANGED
@@ -44,14 +44,13 @@ class LanguageConstructSpacingUnitTest extends AbstractSniffUnitTest
|
|
44 |
46 => 2,
|
45 |
49 => 1,
|
46 |
51 => 1,
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
60 => 1,
|
51 |
-
64 => 1,
|
52 |
67 => 1,
|
53 |
-
|
54 |
-
|
|
|
55 |
];
|
56 |
|
57 |
}//end getErrorList()
|
44 |
46 => 2,
|
45 |
49 => 1,
|
46 |
51 => 1,
|
47 |
+
59 => 1,
|
48 |
+
61 => 1,
|
49 |
+
63 => 1,
|
|
|
|
|
50 |
67 => 1,
|
51 |
+
70 => 1,
|
52 |
+
71 => 1,
|
53 |
+
75 => 1,
|
54 |
];
|
55 |
|
56 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.1.inc
CHANGED
@@ -1294,6 +1294,15 @@ default:
|
|
1294 |
break;
|
1295 |
}
|
1296 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1297 |
if ($foo) {
|
1298 |
if ($oo) {
|
1299 |
/*
|
@@ -1316,6 +1325,13 @@ if ($oo) {
|
|
1316 |
}
|
1317 |
|
1318 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1319 |
<?php
|
1320 |
if (true) {
|
1321 |
}
|
1294 |
break;
|
1295 |
}
|
1296 |
|
1297 |
+
function test() {
|
1298 |
+
return [
|
1299 |
+
<<<'SQLDATA'
|
1300 |
+
DATA
|
1301 |
+
SQLDATA
|
1302 |
+
,
|
1303 |
+
];
|
1304 |
+
}
|
1305 |
+
|
1306 |
if ($foo) {
|
1307 |
if ($oo) {
|
1308 |
/*
|
1325 |
}
|
1326 |
|
1327 |
?>
|
1328 |
+
|
1329 |
+
<div>
|
1330 |
+
<?php if ($foo) {
|
1331 |
+
echo $foo;
|
1332 |
+
} ?>
|
1333 |
+
</div>
|
1334 |
+
|
1335 |
<?php
|
1336 |
if (true) {
|
1337 |
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.1.inc.fixed
CHANGED
@@ -1294,6 +1294,15 @@ switch ( $a ) {
|
|
1294 |
break;
|
1295 |
}
|
1296 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1297 |
if ($foo) {
|
1298 |
if ($oo) {
|
1299 |
/*
|
@@ -1316,6 +1325,13 @@ function foo()
|
|
1316 |
}
|
1317 |
|
1318 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1319 |
<?php
|
1320 |
if (true) {
|
1321 |
}
|
1294 |
break;
|
1295 |
}
|
1296 |
|
1297 |
+
function test() {
|
1298 |
+
return [
|
1299 |
+
<<<'SQLDATA'
|
1300 |
+
DATA
|
1301 |
+
SQLDATA
|
1302 |
+
,
|
1303 |
+
];
|
1304 |
+
}
|
1305 |
+
|
1306 |
if ($foo) {
|
1307 |
if ($oo) {
|
1308 |
/*
|
1325 |
}
|
1326 |
|
1327 |
?>
|
1328 |
+
|
1329 |
+
<div>
|
1330 |
+
<?php if ($foo) {
|
1331 |
+
echo $foo;
|
1332 |
+
} ?>
|
1333 |
+
</div>
|
1334 |
+
|
1335 |
<?php
|
1336 |
if (true) {
|
1337 |
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.2.inc
CHANGED
@@ -1294,6 +1294,15 @@ default:
|
|
1294 |
break;
|
1295 |
}
|
1296 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1297 |
if ($foo) {
|
1298 |
if ($oo) {
|
1299 |
/*
|
@@ -1316,6 +1325,13 @@ if ($oo) {
|
|
1316 |
}
|
1317 |
|
1318 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1319 |
<?php
|
1320 |
if (true) {
|
1321 |
}
|
1294 |
break;
|
1295 |
}
|
1296 |
|
1297 |
+
function test() {
|
1298 |
+
return [
|
1299 |
+
<<<'SQLDATA'
|
1300 |
+
DATA
|
1301 |
+
SQLDATA
|
1302 |
+
,
|
1303 |
+
];
|
1304 |
+
}
|
1305 |
+
|
1306 |
if ($foo) {
|
1307 |
if ($oo) {
|
1308 |
/*
|
1325 |
}
|
1326 |
|
1327 |
?>
|
1328 |
+
|
1329 |
+
<div>
|
1330 |
+
<?php if ($foo) {
|
1331 |
+
echo $foo;
|
1332 |
+
} ?>
|
1333 |
+
</div>
|
1334 |
+
|
1335 |
<?php
|
1336 |
if (true) {
|
1337 |
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.2.inc.fixed
CHANGED
@@ -1294,6 +1294,15 @@ switch ( $a ) {
|
|
1294 |
break;
|
1295 |
}
|
1296 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1297 |
if ($foo) {
|
1298 |
if ($oo) {
|
1299 |
/*
|
@@ -1316,6 +1325,13 @@ function foo()
|
|
1316 |
}
|
1317 |
|
1318 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1319 |
<?php
|
1320 |
if (true) {
|
1321 |
}
|
1294 |
break;
|
1295 |
}
|
1296 |
|
1297 |
+
function test() {
|
1298 |
+
return [
|
1299 |
+
<<<'SQLDATA'
|
1300 |
+
DATA
|
1301 |
+
SQLDATA
|
1302 |
+
,
|
1303 |
+
];
|
1304 |
+
}
|
1305 |
+
|
1306 |
if ($foo) {
|
1307 |
if ($oo) {
|
1308 |
/*
|
1325 |
}
|
1326 |
|
1327 |
?>
|
1328 |
+
|
1329 |
+
<div>
|
1330 |
+
<?php if ($foo) {
|
1331 |
+
echo $foo;
|
1332 |
+
} ?>
|
1333 |
+
</div>
|
1334 |
+
|
1335 |
<?php
|
1336 |
if (true) {
|
1337 |
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.php
CHANGED
@@ -162,20 +162,20 @@ class ScopeIndentUnitTest extends AbstractSniffUnitTest
|
|
162 |
1290 => 1,
|
163 |
1292 => 1,
|
164 |
1293 => 1,
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
1302 => 1,
|
170 |
-
1303 => 1,
|
171 |
-
1306 => 1,
|
172 |
1311 => 1,
|
173 |
-
|
174 |
-
|
175 |
1320 => 1,
|
176 |
-
1321 => 1,
|
177 |
1322 => 1,
|
178 |
-
|
|
|
|
|
|
|
|
|
179 |
];
|
180 |
|
181 |
}//end getErrorList()
|
162 |
1290 => 1,
|
163 |
1292 => 1,
|
164 |
1293 => 1,
|
165 |
+
1307 => 1,
|
166 |
+
1308 => 1,
|
167 |
+
1309 => 1,
|
168 |
+
1310 => 1,
|
|
|
|
|
|
|
169 |
1311 => 1,
|
170 |
+
1312 => 1,
|
171 |
+
1315 => 1,
|
172 |
1320 => 1,
|
|
|
173 |
1322 => 1,
|
174 |
+
1325 => 1,
|
175 |
+
1336 => 1,
|
176 |
+
1337 => 1,
|
177 |
+
1338 => 1,
|
178 |
+
1339 => 1,
|
179 |
];
|
180 |
|
181 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Generic/ruleset.xml
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<ruleset name="Generic">
|
3 |
-
|
4 |
</ruleset>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Generic" xsi:noNamespaceSchemaLocation="../../../phpcs.xsd">
|
3 |
+
<description>A collection of generic sniffs. This standard is not designed to be used to check code.</description>
|
4 |
</ruleset>
|
vendor/squizlabs/php_codesniffer/src/Standards/MySource/ruleset.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<ruleset name="MySource">
|
3 |
-
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
|
18 |
</ruleset>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MySource" xsi:noNamespaceSchemaLocation="../../../phpcs.xsd">
|
3 |
+
<description>The MySource coding standard builds on the Squiz coding standard. Currently used for MySource Mini development.</description>
|
4 |
|
5 |
+
<exclude-pattern>*/Tests/*</exclude-pattern>
|
6 |
+
<exclude-pattern>*/Oven/*</exclude-pattern>
|
7 |
+
<exclude-pattern>*/data/*</exclude-pattern>
|
8 |
+
<exclude-pattern>*/jquery.js</exclude-pattern>
|
9 |
+
<exclude-pattern>*/jquery.*.js</exclude-pattern>
|
10 |
+
<exclude-pattern>*/viper/*</exclude-pattern>
|
11 |
+
<exclude-pattern>DALConf.inc</exclude-pattern>
|
12 |
|
13 |
+
<!-- Include the whole Squiz standard except FunctionComment, which we override -->
|
14 |
+
<rule ref="Squiz">
|
15 |
+
<exclude name="Squiz.Commenting.FunctionComment"/>
|
16 |
+
</rule>
|
17 |
|
18 |
</ruleset>
|
vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php
CHANGED
@@ -546,7 +546,7 @@ class FunctionCallSignatureSniff implements Sniff
|
|
546 |
// If we are within an argument we should be ignoring commas
|
547 |
// as these are not signaling the end of an argument.
|
548 |
if ($inArg === false && $tokens[$i]['code'] === T_COMMA) {
|
549 |
-
$next = $phpcsFile->findNext(
|
550 |
if ($next === false) {
|
551 |
continue;
|
552 |
}
|
546 |
// If we are within an argument we should be ignoring commas
|
547 |
// as these are not signaling the end of an argument.
|
548 |
if ($inArg === false && $tokens[$i]['code'] === T_COMMA) {
|
549 |
+
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), $closeBracket, true);
|
550 |
if ($next === false) {
|
551 |
continue;
|
552 |
}
|
vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/Functions/FunctionDeclarationSniff.php
CHANGED
@@ -105,7 +105,7 @@ class FunctionDeclarationSniff implements Sniff
|
|
105 |
// Unfinished closures are tokenized as T_FUNCTION however, and can be excluded
|
106 |
// by checking for the scope_opener.
|
107 |
if ($tokens[$stackPtr]['code'] === T_FUNCTION
|
108 |
-
&& isset($tokens[$stackPtr]['scope_opener']) === true
|
109 |
) {
|
110 |
if ($tokens[($openBracket - 1)]['content'] === $phpcsFile->eolChar) {
|
111 |
$spaces = 'newline';
|
@@ -123,6 +123,27 @@ class FunctionDeclarationSniff implements Sniff
|
|
123 |
$phpcsFile->fixer->replaceToken(($openBracket - 1), '');
|
124 |
}
|
125 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
}//end if
|
127 |
|
128 |
// Must be one space before and after USE keyword for closures.
|
105 |
// Unfinished closures are tokenized as T_FUNCTION however, and can be excluded
|
106 |
// by checking for the scope_opener.
|
107 |
if ($tokens[$stackPtr]['code'] === T_FUNCTION
|
108 |
+
&& (isset($tokens[$stackPtr]['scope_opener']) === true || $phpcsFile->getMethodProperties($stackPtr)['has_body'] === false)
|
109 |
) {
|
110 |
if ($tokens[($openBracket - 1)]['content'] === $phpcsFile->eolChar) {
|
111 |
$spaces = 'newline';
|
123 |
$phpcsFile->fixer->replaceToken(($openBracket - 1), '');
|
124 |
}
|
125 |
}
|
126 |
+
|
127 |
+
// Must be no space before semicolon in abstract/interface methods.
|
128 |
+
if ($phpcsFile->getMethodProperties($stackPtr)['has_body'] === false) {
|
129 |
+
$end = $phpcsFile->findNext(T_SEMICOLON, $closeBracket);
|
130 |
+
if ($tokens[($end - 1)]['content'] === $phpcsFile->eolChar) {
|
131 |
+
$spaces = 'newline';
|
132 |
+
} else if ($tokens[($end - 1)]['code'] === T_WHITESPACE) {
|
133 |
+
$spaces = strlen($tokens[($end - 1)]['content']);
|
134 |
+
} else {
|
135 |
+
$spaces = 0;
|
136 |
+
}
|
137 |
+
|
138 |
+
if ($spaces !== 0) {
|
139 |
+
$error = 'Expected 0 spaces before semicolon; %s found';
|
140 |
+
$data = [$spaces];
|
141 |
+
$fix = $phpcsFile->addFixableError($error, $end, 'SpaceBeforeSemicolon', $data);
|
142 |
+
if ($fix === true) {
|
143 |
+
$phpcsFile->fixer->replaceToken(($end - 1), '');
|
144 |
+
}
|
145 |
+
}
|
146 |
+
}
|
147 |
}//end if
|
148 |
|
149 |
// Must be one space before and after USE keyword for closures.
|
vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/NamingConventions/ValidFunctionNameSniff.php
CHANGED
@@ -70,6 +70,16 @@ class ValidFunctionNameSniff extends AbstractScopeSniff
|
|
70 |
*/
|
71 |
protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
|
72 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
$methodName = $phpcsFile->getDeclarationName($stackPtr);
|
74 |
if ($methodName === null) {
|
75 |
// Ignore closures.
|
@@ -77,11 +87,18 @@ class ValidFunctionNameSniff extends AbstractScopeSniff
|
|
77 |
}
|
78 |
|
79 |
$className = $phpcsFile->getDeclarationName($currScope);
|
|
|
|
|
|
|
|
|
80 |
$errorData = [$className.'::'.$methodName];
|
81 |
|
|
|
|
|
|
|
82 |
// Is this a magic method. i.e., is prefixed with "__" ?
|
83 |
if (preg_match('|^__[^_]|', $methodName) !== 0) {
|
84 |
-
$magicPart =
|
85 |
if (isset($this->magicMethods[$magicPart]) === true) {
|
86 |
return;
|
87 |
}
|
@@ -91,12 +108,12 @@ class ValidFunctionNameSniff extends AbstractScopeSniff
|
|
91 |
}
|
92 |
|
93 |
// PHP4 constructors are allowed to break our rules.
|
94 |
-
if ($
|
95 |
return;
|
96 |
}
|
97 |
|
98 |
// PHP4 destructors are allowed to break our rules.
|
99 |
-
if ($
|
100 |
return;
|
101 |
}
|
102 |
|
70 |
*/
|
71 |
protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
|
72 |
{
|
73 |
+
$tokens = $phpcsFile->getTokens();
|
74 |
+
|
75 |
+
// Determine if this is a function which needs to be examined.
|
76 |
+
$conditions = $tokens[$stackPtr]['conditions'];
|
77 |
+
end($conditions);
|
78 |
+
$deepestScope = key($conditions);
|
79 |
+
if ($deepestScope !== $currScope) {
|
80 |
+
return;
|
81 |
+
}
|
82 |
+
|
83 |
$methodName = $phpcsFile->getDeclarationName($stackPtr);
|
84 |
if ($methodName === null) {
|
85 |
// Ignore closures.
|
87 |
}
|
88 |
|
89 |
$className = $phpcsFile->getDeclarationName($currScope);
|
90 |
+
if (isset($className) === false) {
|
91 |
+
$className = '[Anonymous Class]';
|
92 |
+
}
|
93 |
+
|
94 |
$errorData = [$className.'::'.$methodName];
|
95 |
|
96 |
+
$methodNameLc = strtolower($methodName);
|
97 |
+
$classNameLc = strtolower($className);
|
98 |
+
|
99 |
// Is this a magic method. i.e., is prefixed with "__" ?
|
100 |
if (preg_match('|^__[^_]|', $methodName) !== 0) {
|
101 |
+
$magicPart = substr($methodNameLc, 2);
|
102 |
if (isset($this->magicMethods[$magicPart]) === true) {
|
103 |
return;
|
104 |
}
|
108 |
}
|
109 |
|
110 |
// PHP4 constructors are allowed to break our rules.
|
111 |
+
if ($methodNameLc === $classNameLc) {
|
112 |
return;
|
113 |
}
|
114 |
|
115 |
// PHP4 destructors are allowed to break our rules.
|
116 |
+
if ($methodNameLc === '_'.$classNameLc) {
|
117 |
return;
|
118 |
}
|
119 |
|
vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc
CHANGED
@@ -390,8 +390,29 @@ $deprecated_functions = [
|
|
390 |
|
391 |
$deprecated_functions = [
|
392 |
'the_category_ID'
|
393 |
-
=> function_call( //
|
394 |
$a,
|
395 |
$b
|
396 |
),
|
397 |
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
|
391 |
$deprecated_functions = [
|
392 |
'the_category_ID'
|
393 |
+
=> function_call( // 9 spaces, not 8. This is the problem line.
|
394 |
$a,
|
395 |
$b
|
396 |
),
|
397 |
];
|
398 |
+
|
399 |
+
// phpcs:set PEAR.Functions.FunctionCallSignature allowMultipleArguments false
|
400 |
+
|
401 |
+
printf(
|
402 |
+
'<select name="%1$s" id="%2$s">%3$s</select>',
|
403 |
+
$obj->getName(), // Trailing comment.
|
404 |
+
$obj->getID(), // phpcs:ignore Standard.Category.SniffName -- for reasons.
|
405 |
+
$option
|
406 |
+
);
|
407 |
+
|
408 |
+
// Handling of PHP 7.3 trailing comma's.
|
409 |
+
functionCall($args, $foo,);
|
410 |
+
functionCall(
|
411 |
+
$args, $foo,
|
412 |
+
);
|
413 |
+
functionCall(
|
414 |
+
$args,
|
415 |
+
$foo,
|
416 |
+
);
|
417 |
+
|
418 |
+
// phpcs:set PEAR.Functions.FunctionCallSignature allowMultipleArguments true
|
vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc.fixed
CHANGED
@@ -403,8 +403,30 @@ $deprecated_functions = [
|
|
403 |
|
404 |
$deprecated_functions = [
|
405 |
'the_category_ID'
|
406 |
-
=> function_call( //
|
407 |
$a,
|
408 |
$b
|
409 |
),
|
410 |
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
|
404 |
$deprecated_functions = [
|
405 |
'the_category_ID'
|
406 |
+
=> function_call( // 9 spaces, not 8. This is the problem line.
|
407 |
$a,
|
408 |
$b
|
409 |
),
|
410 |
];
|
411 |
+
|
412 |
+
// phpcs:set PEAR.Functions.FunctionCallSignature allowMultipleArguments false
|
413 |
+
|
414 |
+
printf(
|
415 |
+
'<select name="%1$s" id="%2$s">%3$s</select>',
|
416 |
+
$obj->getName(), // Trailing comment.
|
417 |
+
$obj->getID(), // phpcs:ignore Standard.Category.SniffName -- for reasons.
|
418 |
+
$option
|
419 |
+
);
|
420 |
+
|
421 |
+
// Handling of PHP 7.3 trailing comma's.
|
422 |
+
functionCall($args, $foo,);
|
423 |
+
functionCall(
|
424 |
+
$args,
|
425 |
+
$foo,
|
426 |
+
);
|
427 |
+
functionCall(
|
428 |
+
$args,
|
429 |
+
$foo,
|
430 |
+
);
|
431 |
+
|
432 |
+
// phpcs:set PEAR.Functions.FunctionCallSignature allowMultipleArguments true
|
vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.php
CHANGED
@@ -111,6 +111,7 @@ class FunctionCallSignatureUnitTest extends AbstractSniffUnitTest
|
|
111 |
394 => 1,
|
112 |
395 => 1,
|
113 |
396 => 1,
|
|
|
114 |
];
|
115 |
|
116 |
}//end getErrorList()
|
111 |
394 => 1,
|
112 |
395 => 1,
|
113 |
396 => 1,
|
114 |
+
411 => 1,
|
115 |
];
|
116 |
|
117 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/FunctionDeclarationUnitTest.inc
CHANGED
@@ -239,3 +239,78 @@ function foo(
|
|
239 |
}
|
240 |
|
241 |
$a = function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
}
|
240 |
|
241 |
$a = function () {
|
242 |
+
|
243 |
+
function foo ()
|
244 |
+
{}
|
245 |
+
|
246 |
+
abstract class Foo {
|
247 |
+
function bar ()
|
248 |
+
{
|
249 |
+
}
|
250 |
+
|
251 |
+
abstract function baz () ;
|
252 |
+
|
253 |
+
abstract function qux () : void ;
|
254 |
+
}
|
255 |
+
|
256 |
+
interface Foo {
|
257 |
+
function bar () ;
|
258 |
+
|
259 |
+
function baz (
|
260 |
+
$longArgument,
|
261 |
+
$longerArgument,
|
262 |
+
$muchLongerArgument
|
263 |
+
) ;
|
264 |
+
|
265 |
+
function qux (
|
266 |
+
$longArgument,
|
267 |
+
$longerArgument,
|
268 |
+
$muchLongerArgument
|
269 |
+
) : void ;
|
270 |
+
}
|
271 |
+
|
272 |
+
trait Foo {
|
273 |
+
function bar ()
|
274 |
+
{
|
275 |
+
}
|
276 |
+
|
277 |
+
abstract function baz ()
|
278 |
+
;
|
279 |
+
}
|
280 |
+
|
281 |
+
if(true) {
|
282 |
+
abstract class Foo {
|
283 |
+
function bar ()
|
284 |
+
{
|
285 |
+
}
|
286 |
+
|
287 |
+
abstract function baz () ;
|
288 |
+
|
289 |
+
abstract function qux () : void ;
|
290 |
+
}
|
291 |
+
|
292 |
+
interface Foo {
|
293 |
+
function bar () ;
|
294 |
+
|
295 |
+
function baz (
|
296 |
+
$longArgument,
|
297 |
+
$longerArgument,
|
298 |
+
$muchLongerArgument
|
299 |
+
) ;
|
300 |
+
|
301 |
+
function qux (
|
302 |
+
$longArgument,
|
303 |
+
$longerArgument,
|
304 |
+
$muchLongerArgument
|
305 |
+
) : void ;
|
306 |
+
}
|
307 |
+
|
308 |
+
trait Foo {
|
309 |
+
function bar ()
|
310 |
+
{
|
311 |
+
}
|
312 |
+
|
313 |
+
abstract function baz ()
|
314 |
+
;
|
315 |
+
}
|
316 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/FunctionDeclarationUnitTest.inc.fixed
CHANGED
@@ -239,3 +239,76 @@ function foo(
|
|
239 |
}
|
240 |
|
241 |
$a = function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
}
|
240 |
|
241 |
$a = function () {
|
242 |
+
|
243 |
+
function foo()
|
244 |
+
{}
|
245 |
+
|
246 |
+
abstract class Foo {
|
247 |
+
function bar()
|
248 |
+
{
|
249 |
+
}
|
250 |
+
|
251 |
+
abstract function baz();
|
252 |
+
|
253 |
+
abstract function qux() : void;
|
254 |
+
}
|
255 |
+
|
256 |
+
interface Foo {
|
257 |
+
function bar();
|
258 |
+
|
259 |
+
function baz(
|
260 |
+
$longArgument,
|
261 |
+
$longerArgument,
|
262 |
+
$muchLongerArgument
|
263 |
+
);
|
264 |
+
|
265 |
+
function qux(
|
266 |
+
$longArgument,
|
267 |
+
$longerArgument,
|
268 |
+
$muchLongerArgument
|
269 |
+
) : void;
|
270 |
+
}
|
271 |
+
|
272 |
+
trait Foo {
|
273 |
+
function bar()
|
274 |
+
{
|
275 |
+
}
|
276 |
+
|
277 |
+
abstract function baz();
|
278 |
+
}
|
279 |
+
|
280 |
+
if(true) {
|
281 |
+
abstract class Foo {
|
282 |
+
function bar()
|
283 |
+
{
|
284 |
+
}
|
285 |
+
|
286 |
+
abstract function baz();
|
287 |
+
|
288 |
+
abstract function qux() : void;
|
289 |
+
}
|
290 |
+
|
291 |
+
interface Foo {
|
292 |
+
function bar();
|
293 |
+
|
294 |
+
function baz(
|
295 |
+
$longArgument,
|
296 |
+
$longerArgument,
|
297 |
+
$muchLongerArgument
|
298 |
+
);
|
299 |
+
|
300 |
+
function qux(
|
301 |
+
$longArgument,
|
302 |
+
$longerArgument,
|
303 |
+
$muchLongerArgument
|
304 |
+
) : void;
|
305 |
+
}
|
306 |
+
|
307 |
+
trait Foo {
|
308 |
+
function bar()
|
309 |
+
{
|
310 |
+
}
|
311 |
+
|
312 |
+
abstract function baz();
|
313 |
+
}
|
314 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/FunctionDeclarationUnitTest.php
CHANGED
@@ -59,6 +59,29 @@ class FunctionDeclarationUnitTest extends AbstractSniffUnitTest
|
|
59 |
223 => 1,
|
60 |
230 => 1,
|
61 |
237 => 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
];
|
63 |
} else {
|
64 |
$errors = [
|
59 |
223 => 1,
|
60 |
230 => 1,
|
61 |
237 => 1,
|
62 |
+
243 => 1,
|
63 |
+
247 => 1,
|
64 |
+
251 => 2,
|
65 |
+
253 => 2,
|
66 |
+
257 => 2,
|
67 |
+
259 => 1,
|
68 |
+
263 => 1,
|
69 |
+
265 => 1,
|
70 |
+
269 => 1,
|
71 |
+
273 => 1,
|
72 |
+
277 => 1,
|
73 |
+
278 => 1,
|
74 |
+
283 => 1,
|
75 |
+
287 => 2,
|
76 |
+
289 => 2,
|
77 |
+
293 => 2,
|
78 |
+
295 => 1,
|
79 |
+
299 => 1,
|
80 |
+
301 => 1,
|
81 |
+
305 => 1,
|
82 |
+
309 => 1,
|
83 |
+
313 => 1,
|
84 |
+
314 => 1,
|
85 |
];
|
86 |
} else {
|
87 |
$errors = [
|
vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/NamingConventions/ValidFunctionNameUnitTest.inc
CHANGED
@@ -205,3 +205,18 @@ $a = new class {
|
|
205 |
};
|
206 |
|
207 |
function send_system_email__to_user($body, $recipient){}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
};
|
206 |
|
207 |
function send_system_email__to_user($body, $recipient){}
|
208 |
+
|
209 |
+
class Nested {
|
210 |
+
public function getAnonymousClass() {
|
211 |
+
return new class() {
|
212 |
+
public function nested_function() {}
|
213 |
+
function __something() {}
|
214 |
+
private function something() {}
|
215 |
+
};
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
abstract class My_Class {
|
220 |
+
public function my_class() {}
|
221 |
+
public function _MY_CLASS() {}
|
222 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/NamingConventions/ValidFunctionNameUnitTest.php
CHANGED
@@ -119,6 +119,9 @@ class ValidFunctionNameUnitTest extends AbstractSniffUnitTest
|
|
119 |
203 => 1,
|
120 |
204 => 2,
|
121 |
207 => 2,
|
|
|
|
|
|
|
122 |
];
|
123 |
|
124 |
}//end getErrorList()
|
119 |
203 => 1,
|
120 |
204 => 2,
|
121 |
207 => 2,
|
122 |
+
212 => 1,
|
123 |
+
213 => 1,
|
124 |
+
214 => 1,
|
125 |
];
|
126 |
|
127 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/PEAR/ruleset.xml
CHANGED
@@ -1,41 +1,41 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<ruleset name="PEAR">
|
3 |
-
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
|
41 |
</ruleset>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PEAR" xsi:noNamespaceSchemaLocation="../../../phpcs.xsd">
|
3 |
+
<description>The PEAR coding standard.</description>
|
4 |
|
5 |
+
<!-- Include some additional sniffs from the Generic standard -->
|
6 |
+
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
|
7 |
+
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
|
8 |
+
<rule ref="Generic.PHP.LowerCaseConstant"/>
|
9 |
+
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
|
10 |
+
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
11 |
+
<rule ref="Generic.Commenting.DocComment"/>
|
12 |
+
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
|
13 |
|
14 |
+
<!-- Lines can be 85 chars long, but never show errors -->
|
15 |
+
<rule ref="Generic.Files.LineLength">
|
16 |
+
<properties>
|
17 |
+
<property name="lineLimit" value="85"/>
|
18 |
+
<property name="absoluteLineLimit" value="0"/>
|
19 |
+
</properties>
|
20 |
+
</rule>
|
21 |
|
22 |
+
<!-- Use Unix newlines -->
|
23 |
+
<rule ref="Generic.Files.LineEndings">
|
24 |
+
<properties>
|
25 |
+
<property name="eolChar" value="\n"/>
|
26 |
+
</properties>
|
27 |
+
</rule>
|
28 |
|
29 |
+
<!-- This message is not required as spaces are allowed for alignment -->
|
30 |
+
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma">
|
31 |
+
<severity>0</severity>
|
32 |
+
</rule>
|
33 |
|
34 |
+
<!-- Use warnings for inline control structures -->
|
35 |
+
<rule ref="Generic.ControlStructures.InlineControlStructure">
|
36 |
+
<properties>
|
37 |
+
<property name="error" value="false"/>
|
38 |
+
</properties>
|
39 |
+
</rule>
|
40 |
|
41 |
</ruleset>
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR1/Sniffs/Methods/CamelCapsMethodNameSniff.php
CHANGED
@@ -29,6 +29,16 @@ class CamelCapsMethodNameSniff extends GenericCamelCapsFunctionNameSniff
|
|
29 |
*/
|
30 |
protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
|
31 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
$methodName = $phpcsFile->getDeclarationName($stackPtr);
|
33 |
if ($methodName === null) {
|
34 |
// Ignore closures.
|
@@ -49,6 +59,10 @@ class CamelCapsMethodNameSniff extends GenericCamelCapsFunctionNameSniff
|
|
49 |
if ($testName !== '' && Common::isCamelCaps($testName, false, true, false) === false) {
|
50 |
$error = 'Method name "%s" is not in camel caps format';
|
51 |
$className = $phpcsFile->getDeclarationName($currScope);
|
|
|
|
|
|
|
|
|
52 |
$errorData = [$className.'::'.$methodName];
|
53 |
$phpcsFile->addError($error, $stackPtr, 'NotCamelCaps', $errorData);
|
54 |
$phpcsFile->recordMetric($stackPtr, 'CamelCase method name', 'no');
|
29 |
*/
|
30 |
protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
|
31 |
{
|
32 |
+
$tokens = $phpcsFile->getTokens();
|
33 |
+
|
34 |
+
// Determine if this is a function which needs to be examined.
|
35 |
+
$conditions = $tokens[$stackPtr]['conditions'];
|
36 |
+
end($conditions);
|
37 |
+
$deepestScope = key($conditions);
|
38 |
+
if ($deepestScope !== $currScope) {
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
|
42 |
$methodName = $phpcsFile->getDeclarationName($stackPtr);
|
43 |
if ($methodName === null) {
|
44 |
// Ignore closures.
|
59 |
if ($testName !== '' && Common::isCamelCaps($testName, false, true, false) === false) {
|
60 |
$error = 'Method name "%s" is not in camel caps format';
|
61 |
$className = $phpcsFile->getDeclarationName($currScope);
|
62 |
+
if (isset($className) === false) {
|
63 |
+
$className = '[Anonymous Class]';
|
64 |
+
}
|
65 |
+
|
66 |
$errorData = [$className.'::'.$methodName];
|
67 |
$phpcsFile->addError($error, $stackPtr, 'NotCamelCaps', $errorData);
|
68 |
$phpcsFile->recordMetric($stackPtr, 'CamelCase method name', 'no');
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR1/Tests/Methods/CamelCapsMethodNameUnitTest.inc
CHANGED
@@ -70,4 +70,12 @@ function ___tripleUnderscore() {} // Ok.
|
|
70 |
class triple {
|
71 |
public function ___tripleUnderscore() {} // Ok.
|
72 |
}
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
class triple {
|
71 |
public function ___tripleUnderscore() {} // Ok.
|
72 |
}
|
73 |
+
|
74 |
+
class Nested {
|
75 |
+
public function getAnonymousClass() {
|
76 |
+
return new class() {
|
77 |
+
public function nested_function() {}
|
78 |
+
};
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR1/Tests/Methods/CamelCapsMethodNameUnitTest.php
CHANGED
@@ -35,6 +35,7 @@ class CamelCapsMethodNameUnitTest extends AbstractSniffUnitTest
|
|
35 |
21 => 1,
|
36 |
25 => 1,
|
37 |
26 => 1,
|
|
|
38 |
];
|
39 |
|
40 |
}//end getErrorList()
|
35 |
21 => 1,
|
36 |
25 => 1,
|
37 |
26 => 1,
|
38 |
+
77 => 1,
|
39 |
];
|
40 |
|
41 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR1/ruleset.xml
CHANGED
@@ -1,46 +1,46 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<ruleset name="PSR1">
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
15 |
-
|
16 |
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
|
21 |
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
|
45 |
|
46 |
</ruleset>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PSR1" xsi:noNamespaceSchemaLocation="../../../phpcs.xsd">
|
3 |
+
<description>The PSR1 coding standard.</description>
|
4 |
|
5 |
+
<!-- 2. Files -->
|
6 |
|
7 |
+
<!-- 2.1. PHP Tags -->
|
8 |
|
9 |
+
<!-- PHP code MUST use the long <?php ?> tags or the short-echo <?= ?> tags; it MUST NOT use the other tag variations. -->
|
10 |
+
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
|
11 |
+
<rule ref="Generic.PHP.DisallowShortOpenTag.EchoFound">
|
12 |
+
<severity>0</severity>
|
13 |
+
</rule>
|
14 |
|
15 |
+
<!-- 2.2. Character Encoding -->
|
16 |
|
17 |
+
<!-- PHP code MUST use only UTF-8 without BOM. -->
|
18 |
+
<rule ref="Generic.Files.ByteOrderMark"/>
|
19 |
|
20 |
+
<!-- 2.3. Side Effects -->
|
21 |
|
22 |
+
<!-- A file SHOULD declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it SHOULD execute logic with side effects, but SHOULD NOT do both. -->
|
23 |
+
<!-- checked by PSR1.Files.SideEffects -->
|
24 |
|
25 |
+
<!-- 3. Namespace and Class Names -->
|
26 |
|
27 |
+
<!-- Namespaces and classes MUST follow PSR-0.
|
28 |
+
This means each class is in a file by itself, and is in a namespace of at least one level: a top-level vendor name. -->
|
29 |
+
<!-- checked by PSR1.Classes.ClassDeclaration -->
|
30 |
|
31 |
+
<!-- Class names MUST be declared in StudlyCaps. -->
|
32 |
+
<rule ref="Squiz.Classes.ValidClassName"/>
|
33 |
|
34 |
+
<!-- 4. Class Constants, Properties, and Methods -->
|
35 |
|
36 |
+
<!-- 4.1. Constants -->
|
37 |
|
38 |
+
<!-- Class constants MUST be declared in all upper case with underscore separators. -->
|
39 |
+
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
|
40 |
|
41 |
+
<!-- 4.3. Methods -->
|
42 |
|
43 |
+
<!-- Method names MUST be declared in camelCase(). -->
|
44 |
+
<!-- checked by PSR1.Methods.CamelCapsMethodName -->
|
45 |
|
46 |
</ruleset>
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Docs/Functions/NullableTypeDeclarationStandard.xml
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<documentation title="Nullable Type Declarations Functions">
|
2 |
+
<standard>
|
3 |
+
<![CDATA[
|
4 |
+
In nullable type declarations there MUST NOT be a space between the question mark and the type.
|
5 |
+
]]>
|
6 |
+
</standard>
|
7 |
+
<code_comparison>
|
8 |
+
<code title="Valid: no whitespace used.">
|
9 |
+
<![CDATA[
|
10 |
+
public function functionName(?string $arg1, ?int $arg2): ?string
|
11 |
+
{
|
12 |
+
}
|
13 |
+
]]>
|
14 |
+
</code>
|
15 |
+
<code title="Invalid: superfluous whitespace used.">
|
16 |
+
<![CDATA[
|
17 |
+
public function functionName(? string $arg1, ? int $arg2): ? string
|
18 |
+
{
|
19 |
+
}
|
20 |
+
]]>
|
21 |
+
</code>
|
22 |
+
<code title="Invalid: unexpected characters used.">
|
23 |
+
<![CDATA[
|
24 |
+
public function functionName(? /* nullable for a reason */ string $arg1): ?
|
25 |
+
// nullable for a reason
|
26 |
+
string
|
27 |
+
{
|
28 |
+
}
|
29 |
+
]]>
|
30 |
+
</code>
|
31 |
+
</code_comparison>
|
32 |
+
</documentation>
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Sniffs/Functions/NullableTypeDeclarationSniff.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Verifies that nullable typehints are lacking superfluous whitespace, e.g. ?int
|
4 |
+
*
|
5 |
+
* @author Greg Sherwood <gsherwood@squiz.net>
|
6 |
+
* @copyright 2006-2018 Squiz Pty Ltd (ABN 77 084 670 600)
|
7 |
+
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
8 |
+
*/
|
9 |
+
|
10 |
+
namespace PHP_CodeSniffer\Standards\PSR12\Sniffs\Functions;
|
11 |
+
|
12 |
+
use PHP_CodeSniffer\Files\File;
|
13 |
+
use PHP_CodeSniffer\Sniffs\Sniff;
|
14 |
+
use PHP_CodeSniffer\Util\Tokens;
|
15 |
+
|
16 |
+
class NullableTypeDeclarationSniff implements Sniff
|
17 |
+
{
|
18 |
+
|
19 |
+
/**
|
20 |
+
* An array of valid tokens after `T_NULLABLE` occurrences.
|
21 |
+
*
|
22 |
+
* @var array
|
23 |
+
*/
|
24 |
+
private $validTokens = [
|
25 |
+
T_STRING => true,
|
26 |
+
T_NS_SEPARATOR => true,
|
27 |
+
T_CALLABLE => true,
|
28 |
+
T_SELF => true,
|
29 |
+
T_PARENT => true,
|
30 |
+
];
|
31 |
+
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Returns an array of tokens this test wants to listen for.
|
35 |
+
*
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
public function register()
|
39 |
+
{
|
40 |
+
return [T_NULLABLE];
|
41 |
+
|
42 |
+
}//end register()
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Processes this test, when one of its tokens is encountered.
|
47 |
+
*
|
48 |
+
* @param \PHP_CodeSniffer\Files\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 |
+
$nextNonEmptyPtr = $phpcsFile->findNext([T_WHITESPACE], ($stackPtr + 1), null, true);
|
57 |
+
if ($nextNonEmptyPtr === false) {
|
58 |
+
// Parse error or live coding.
|
59 |
+
return;
|
60 |
+
}
|
61 |
+
|
62 |
+
$tokens = $phpcsFile->getTokens();
|
63 |
+
$nextNonEmptyCode = $tokens[$nextNonEmptyPtr]['code'];
|
64 |
+
$validTokenFound = isset($this->validTokens[$nextNonEmptyCode]);
|
65 |
+
|
66 |
+
if ($validTokenFound === true && $nextNonEmptyPtr === ($stackPtr + 1)) {
|
67 |
+
// Valid structure.
|
68 |
+
return;
|
69 |
+
}
|
70 |
+
|
71 |
+
$error = 'There must not be a space between the question mark and the type in nullable type declarations';
|
72 |
+
|
73 |
+
if ($validTokenFound === true) {
|
74 |
+
// No other tokens then whitespace tokens found; fixable.
|
75 |
+
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'WhitespaceFound');
|
76 |
+
if ($fix === true) {
|
77 |
+
for ($i = ($stackPtr + 1); $i < $nextNonEmptyPtr; $i++) {
|
78 |
+
$phpcsFile->fixer->replaceToken($i, '');
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
return;
|
83 |
+
}
|
84 |
+
|
85 |
+
// Non-whitespace tokens found; trigger error but don't fix.
|
86 |
+
$phpcsFile->addError($error, $stackPtr, 'UnexpectedCharactersFound');
|
87 |
+
|
88 |
+
}//end process()
|
89 |
+
|
90 |
+
|
91 |
+
}//end class
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.inc
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MyClass {
|
4 |
+
public function validNullableTypeHinting(
|
5 |
+
?array $array = null,
|
6 |
+
?MyObject $object
|
7 |
+
): ?MyObject
|
8 |
+
{
|
9 |
+
}
|
10 |
+
|
11 |
+
public function validWithFQN(
|
12 |
+
?\MyNameSpace\MyArray $array = null,
|
13 |
+
?\MyNameSpace\MyObject $object
|
14 |
+
): ?\MyNameSpace\MyObject
|
15 |
+
{
|
16 |
+
}
|
17 |
+
|
18 |
+
public function validReturnTypeForThisSniff():?MyObject
|
19 |
+
{
|
20 |
+
}
|
21 |
+
|
22 |
+
public function invalidTooMuchWhitespace(
|
23 |
+
? array $array = null,
|
24 |
+
? MyObject
|
25 |
+
):? MyObject
|
26 |
+
{
|
27 |
+
}
|
28 |
+
|
29 |
+
public function invalidWithFQNTooMuchWhitespace(
|
30 |
+
? \MyNameSpace\MyArray $array = null,
|
31 |
+
? \MyNameSpace\MyObject
|
32 |
+
):? \MyNameSpace\MyObject
|
33 |
+
{
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
// valid in lambda
|
38 |
+
array_map(function(?int $integer = null): ?int {
|
39 |
+
return $integer;
|
40 |
+
}, []);
|
41 |
+
|
42 |
+
// invalid in lambda
|
43 |
+
array_map(function(? int $integer = null): ? int {
|
44 |
+
return $integer;
|
45 |
+
}, []);
|
46 |
+
|
47 |
+
interface MyInterface {
|
48 |
+
public function invalidTypeHintsWithNewlinesAndComments( ?
|
49 |
+
string $varA,
|
50 |
+
? /* a comment, fixing is undesirable */ array $varB,
|
51 |
+
? // phpcs:ignore Standard.Cat.Sniff -- fixing is undesirable
|
52 |
+
int $varC
|
53 |
+
) ?
|
54 |
+
bool;
|
55 |
+
}
|
56 |
+
|
57 |
+
function testSelf( ? self $self ) : ? self {}
|
58 |
+
function testParent( ? parent $parent ) : ? parent {}
|
59 |
+
function testCallable( ? callable $callable ) : ? callable {}
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.inc.fixed
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MyClass {
|
4 |
+
public function validNullableTypeHinting(
|
5 |
+
?array $array = null,
|
6 |
+
?MyObject $object
|
7 |
+
): ?MyObject
|
8 |
+
{
|
9 |
+
}
|
10 |
+
|
11 |
+
public function validWithFQN(
|
12 |
+
?\MyNameSpace\MyArray $array = null,
|
13 |
+
?\MyNameSpace\MyObject $object
|
14 |
+
): ?\MyNameSpace\MyObject
|
15 |
+
{
|
16 |
+
}
|
17 |
+
|
18 |
+
public function validReturnTypeForThisSniff():?MyObject
|
19 |
+
{
|
20 |
+
}
|
21 |
+
|
22 |
+
public function invalidTooMuchWhitespace(
|
23 |
+
?array $array = null,
|
24 |
+
?MyObject
|
25 |
+
):?MyObject
|
26 |
+
{
|
27 |
+
}
|
28 |
+
|
29 |
+
public function invalidWithFQNTooMuchWhitespace(
|
30 |
+
?\MyNameSpace\MyArray $array = null,
|
31 |
+
?\MyNameSpace\MyObject
|
32 |
+
):?\MyNameSpace\MyObject
|
33 |
+
{
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
// valid in lambda
|
38 |
+
array_map(function(?int $integer = null): ?int {
|
39 |
+
return $integer;
|
40 |
+
}, []);
|
41 |
+
|
42 |
+
// invalid in lambda
|
43 |
+
array_map(function(?int $integer = null): ?int {
|
44 |
+
return $integer;
|
45 |
+
}, []);
|
46 |
+
|
47 |
+
interface MyInterface {
|
48 |
+
public function invalidTypeHintsWithNewlinesAndComments( ?string $varA,
|
49 |
+
? /* a comment, fixing is undesirable */ array $varB,
|
50 |
+
? // phpcs:ignore Standard.Cat.Sniff -- fixing is undesirable
|
51 |
+
int $varC
|
52 |
+
) ?bool;
|
53 |
+
}
|
54 |
+
|
55 |
+
function testSelf( ?self $self ) : ?self {}
|
56 |
+
function testParent( ?parent $parent ) : ?parent {}
|
57 |
+
function testCallable( ?callable $callable ) : ?callable {}
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Unit test class for the NullableWhitespace sniff.
|
4 |
+
*
|
5 |
+
* @author Greg Sherwood <gsherwood@squiz.net>
|
6 |
+
* @copyright 2006-2018 Squiz Pty Ltd (ABN 77 084 670 600)
|
7 |
+
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
8 |
+
*/
|
9 |
+
|
10 |
+
namespace PHP_CodeSniffer\Standards\PSR12\Tests\Functions;
|
11 |
+
|
12 |
+
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
|
13 |
+
|
14 |
+
class NullableTypeDeclarationUnitTest extends AbstractSniffUnitTest
|
15 |
+
{
|
16 |
+
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Returns the lines where errors should occur.
|
20 |
+
*
|
21 |
+
* The key of the array should represent the line number and the value
|
22 |
+
* should represent the number of errors that should occur on that line.
|
23 |
+
*
|
24 |
+
* @return array<int, int>
|
25 |
+
*/
|
26 |
+
protected function getErrorList()
|
27 |
+
{
|
28 |
+
return [
|
29 |
+
23 => 1,
|
30 |
+
24 => 1,
|
31 |
+
25 => 1,
|
32 |
+
30 => 1,
|
33 |
+
31 => 1,
|
34 |
+
32 => 1,
|
35 |
+
43 => 2,
|
36 |
+
48 => 1,
|
37 |
+
50 => 1,
|
38 |
+
51 => 1,
|
39 |
+
53 => 1,
|
40 |
+
57 => 2,
|
41 |
+
58 => 2,
|
42 |
+
59 => 2,
|
43 |
+
];
|
44 |
+
|
45 |
+
}//end getErrorList()
|
46 |
+
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Returns the lines where warnings should occur.
|
50 |
+
*
|
51 |
+
* The key of the array should represent the line number and the value
|
52 |
+
* should represent the number of warnings that should occur on that line.
|
53 |
+
*
|
54 |
+
* @return array<int, int>
|
55 |
+
*/
|
56 |
+
protected function getWarningList()
|
57 |
+
{
|
58 |
+
return [];
|
59 |
+
|
60 |
+
}//end getWarningList()
|
61 |
+
|
62 |
+
|
63 |
+
}//end class
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR12/ruleset.xml
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<ruleset name="PSR12">
|
3 |
<description>The PSR-12 coding standard.</description>
|
4 |
<arg name="tab-width" value="4"/>
|
5 |
|
@@ -183,6 +183,7 @@
|
|
183 |
<!-- When you have a return type declaration present there MUST be one space after the colon followed by the type declaration. The colon and declaration MUST be on the same line as the argument list closing parentheses with no spaces between the two characters. -->
|
184 |
|
185 |
<!-- In nullable type declarations there MUST NOT be a space between the question mark and the type. -->
|
|
|
186 |
|
187 |
<!-- 4.6 abstract, final, and static -->
|
188 |
|
@@ -214,8 +215,8 @@
|
|
214 |
The closing brace MUST be on the next line after the body
|
215 |
The body of each structure MUST be enclosed by braces. This standardizes how the structures look, and reduces the likelihood of introducing errors as new lines get added to the body. -->
|
216 |
<rule ref="Squiz.ControlStructures.ControlSignature"/>
|
217 |
-
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"
|
218 |
-
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"
|
219 |
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace"/>
|
220 |
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
|
221 |
<rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PSR12" xsi:noNamespaceSchemaLocation="../../../phpcs.xsd">
|
3 |
<description>The PSR-12 coding standard.</description>
|
4 |
<arg name="tab-width" value="4"/>
|
5 |
|
183 |
<!-- When you have a return type declaration present there MUST be one space after the colon followed by the type declaration. The colon and declaration MUST be on the same line as the argument list closing parentheses with no spaces between the two characters. -->
|
184 |
|
185 |
<!-- In nullable type declarations there MUST NOT be a space between the question mark and the type. -->
|
186 |
+
<!-- checked by PSR12.Functions.NullableTypeDeclaration -->
|
187 |
|
188 |
<!-- 4.6 abstract, final, and static -->
|
189 |
|
215 |
The closing brace MUST be on the next line after the body
|
216 |
The body of each structure MUST be enclosed by braces. This standardizes how the structures look, and reduces the likelihood of introducing errors as new lines get added to the body. -->
|
217 |
<rule ref="Squiz.ControlStructures.ControlSignature"/>
|
218 |
+
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/>
|
219 |
+
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/>
|
220 |
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace"/>
|
221 |
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
|
222 |
<rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Docs/Classes/PropertyDeclarationStandard.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<documentation title="Property Declarations">
|
2 |
<standard>
|
3 |
<![CDATA[
|
4 |
-
Property names should not be prefixed with an underscore to indicate visibility. Visibility should be used to declare properties rather than the var keyword. Only one property should be declared within a statement.
|
5 |
]]>
|
6 |
</standard>
|
7 |
<code_comparison>
|
@@ -55,6 +55,25 @@ class Foo
|
|
55 |
class Foo
|
56 |
{
|
57 |
private <em>$bar, $baz</em>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
]]>
|
60 |
</code>
|
1 |
<documentation title="Property Declarations">
|
2 |
<standard>
|
3 |
<![CDATA[
|
4 |
+
Property names should not be prefixed with an underscore to indicate visibility. Visibility should be used to declare properties rather than the var keyword. Only one property should be declared within a statement. The static declaration must come after the visibility declaration.
|
5 |
]]>
|
6 |
</standard>
|
7 |
<code_comparison>
|
55 |
class Foo
|
56 |
{
|
57 |
private <em>$bar, $baz</em>;
|
58 |
+
}
|
59 |
+
]]>
|
60 |
+
</code>
|
61 |
+
</code_comparison>
|
62 |
+
<code_comparison>
|
63 |
+
<code title="Valid: If declared as static, the static declaration must come after the visibility declaration.">
|
64 |
+
<![CDATA[
|
65 |
+
class Foo
|
66 |
+
{
|
67 |
+
public <em>static</em> $bar;
|
68 |
+
private $baz;
|
69 |
+
}
|
70 |
+
]]>
|
71 |
+
</code>
|
72 |
+
<code title="Invalid: Static declaration before the visibility declaration.">
|
73 |
+
<![CDATA[
|
74 |
+
class Foo
|
75 |
+
{
|
76 |
+
<em>static<em> protected $bar;
|
77 |
}
|
78 |
]]>
|
79 |
</code>
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Sniffs/Classes/PropertyDeclarationSniff.php
CHANGED
@@ -39,7 +39,7 @@ class PropertyDeclarationSniff extends AbstractVariableSniff
|
|
39 |
// for this, but also only process the first property in the list so we don't
|
40 |
// repeat errors.
|
41 |
$find = Tokens::$scopeModifiers;
|
42 |
-
$find = array_merge($find, [T_VARIABLE, T_VAR, T_SEMICOLON]);
|
43 |
$prev = $phpcsFile->findPrevious($find, ($stackPtr - 1));
|
44 |
if ($tokens[$prev]['code'] === T_VARIABLE) {
|
45 |
return;
|
@@ -51,18 +51,54 @@ class PropertyDeclarationSniff extends AbstractVariableSniff
|
|
51 |
}
|
52 |
|
53 |
$next = $phpcsFile->findNext([T_VARIABLE, T_SEMICOLON], ($stackPtr + 1));
|
54 |
-
if ($tokens[$next]['code'] === T_VARIABLE) {
|
55 |
$error = 'There must not be more than one property declared per statement';
|
56 |
$phpcsFile->addError($error, $stackPtr, 'Multiple');
|
57 |
}
|
58 |
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
$error = 'Visibility must be declared on property "%s"';
|
62 |
$data = [$tokens[$stackPtr]['content']];
|
63 |
$phpcsFile->addError($error, $stackPtr, 'ScopeMissing', $data);
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}//end processMemberVar()
|
67 |
|
68 |
|
39 |
// for this, but also only process the first property in the list so we don't
|
40 |
// repeat errors.
|
41 |
$find = Tokens::$scopeModifiers;
|
42 |
+
$find = array_merge($find, [T_VARIABLE, T_VAR, T_SEMICOLON, T_OPEN_CURLY_BRACKET]);
|
43 |
$prev = $phpcsFile->findPrevious($find, ($stackPtr - 1));
|
44 |
if ($tokens[$prev]['code'] === T_VARIABLE) {
|
45 |
return;
|
51 |
}
|
52 |
|
53 |
$next = $phpcsFile->findNext([T_VARIABLE, T_SEMICOLON], ($stackPtr + 1));
|
54 |
+
if ($next !== false && $tokens[$next]['code'] === T_VARIABLE) {
|
55 |
$error = 'There must not be more than one property declared per statement';
|
56 |
$phpcsFile->addError($error, $stackPtr, 'Multiple');
|
57 |
}
|
58 |
|
59 |
+
try {
|
60 |
+
$propertyInfo = $phpcsFile->getMemberProperties($stackPtr);
|
61 |
+
if (empty($propertyInfo) === true) {
|
62 |
+
return;
|
63 |
+
}
|
64 |
+
} catch (Exception $e) {
|
65 |
+
// Turns out not to be a property after all.
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
|
69 |
+
if ($propertyInfo['scope_specified'] === false) {
|
70 |
$error = 'Visibility must be declared on property "%s"';
|
71 |
$data = [$tokens[$stackPtr]['content']];
|
72 |
$phpcsFile->addError($error, $stackPtr, 'ScopeMissing', $data);
|
73 |
}
|
74 |
|
75 |
+
if ($propertyInfo['scope_specified'] === true && $propertyInfo['is_static'] === true) {
|
76 |
+
$scopePtr = $phpcsFile->findPrevious(Tokens::$scopeModifiers, ($stackPtr - 1));
|
77 |
+
$staticPtr = $phpcsFile->findPrevious(T_STATIC, ($stackPtr - 1));
|
78 |
+
if ($scopePtr < $staticPtr) {
|
79 |
+
return;
|
80 |
+
}
|
81 |
+
|
82 |
+
$error = 'The static declaration must come after the visibility declaration';
|
83 |
+
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'StaticBeforeVisibility');
|
84 |
+
if ($fix === true) {
|
85 |
+
$phpcsFile->fixer->beginChangeset();
|
86 |
+
|
87 |
+
for ($i = ($scopePtr + 1); $scopePtr < $stackPtr; $i++) {
|
88 |
+
if ($tokens[$i]['code'] !== T_WHITESPACE) {
|
89 |
+
break;
|
90 |
+
}
|
91 |
+
|
92 |
+
$phpcsFile->fixer->replaceToken($i, '');
|
93 |
+
}
|
94 |
+
|
95 |
+
$phpcsFile->fixer->replaceToken($scopePtr, '');
|
96 |
+
$phpcsFile->fixer->addContentBefore($staticPtr, $propertyInfo['scope'].' ');
|
97 |
+
|
98 |
+
$phpcsFile->fixer->endChangeset();
|
99 |
+
}
|
100 |
+
}//end if
|
101 |
+
|
102 |
}//end processMemberVar()
|
103 |
|
104 |
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Sniffs/Methods/MethodDeclarationSniff.php
CHANGED
@@ -22,7 +22,7 @@ class MethodDeclarationSniff extends AbstractScopeSniff
|
|
22 |
*/
|
23 |
public function __construct()
|
24 |
{
|
25 |
-
parent::__construct(
|
26 |
|
27 |
}//end __construct()
|
28 |
|
@@ -40,6 +40,14 @@ class MethodDeclarationSniff extends AbstractScopeSniff
|
|
40 |
{
|
41 |
$tokens = $phpcsFile->getTokens();
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
$methodName = $phpcsFile->getDeclarationName($stackPtr);
|
44 |
if ($methodName === null) {
|
45 |
// Ignore closures.
|
@@ -57,9 +65,8 @@ class MethodDeclarationSniff extends AbstractScopeSniff
|
|
57 |
$abstract = 0;
|
58 |
$final = 0;
|
59 |
|
60 |
-
$find
|
61 |
-
$
|
62 |
-
$prev = $phpcsFile->findPrevious($find, ($stackPtr - 1), null, true);
|
63 |
|
64 |
$prefix = $stackPtr;
|
65 |
while (($prefix = $phpcsFile->findPrevious(Tokens::$methodPrefixes, ($prefix - 1), $prev)) !== false) {
|
@@ -116,7 +123,7 @@ class MethodDeclarationSniff extends AbstractScopeSniff
|
|
116 |
$fixes[$static] = '';
|
117 |
$fixes[($static + 1)] = '';
|
118 |
if (isset($fixes[$visibility]) === true) {
|
119 |
-
$fixes[$visibility]
|
120 |
} else {
|
121 |
$fixes[$visibility] = $tokens[$visibility]['content'].' static';
|
122 |
}
|
22 |
*/
|
23 |
public function __construct()
|
24 |
{
|
25 |
+
parent::__construct(Tokens::$ooScopeTokens, [T_FUNCTION]);
|
26 |
|
27 |
}//end __construct()
|
28 |
|
40 |
{
|
41 |
$tokens = $phpcsFile->getTokens();
|
42 |
|
43 |
+
// Determine if this is a function which needs to be examined.
|
44 |
+
$conditions = $tokens[$stackPtr]['conditions'];
|
45 |
+
end($conditions);
|
46 |
+
$deepestScope = key($conditions);
|
47 |
+
if ($deepestScope !== $currScope) {
|
48 |
+
return;
|
49 |
+
}
|
50 |
+
|
51 |
$methodName = $phpcsFile->getDeclarationName($stackPtr);
|
52 |
if ($methodName === null) {
|
53 |
// Ignore closures.
|
65 |
$abstract = 0;
|
66 |
$final = 0;
|
67 |
|
68 |
+
$find = (Tokens::$methodPrefixes + Tokens::$emptyTokens);
|
69 |
+
$prev = $phpcsFile->findPrevious($find, ($stackPtr - 1), null, true);
|
|
|
70 |
|
71 |
$prefix = $stackPtr;
|
72 |
while (($prefix = $phpcsFile->findPrevious(Tokens::$methodPrefixes, ($prefix - 1), $prev)) !== false) {
|
123 |
$fixes[$static] = '';
|
124 |
$fixes[($static + 1)] = '';
|
125 |
if (isset($fixes[$visibility]) === true) {
|
126 |
+
$fixes[$visibility] .= ' static';
|
127 |
} else {
|
128 |
$fixes[$visibility] = $tokens[$visibility]['content'].' static';
|
129 |
}
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Sniffs/Namespaces/UseDeclarationSniff.php
CHANGED
@@ -119,7 +119,7 @@ class UseDeclarationSniff implements Sniff
|
|
119 |
$phpcsFile->fixer->replaceToken($i, '');
|
120 |
}
|
121 |
|
122 |
-
if ($tokens[$next]['
|
123 |
$phpcsFile->fixer->addContentBefore($next, 'use ');
|
124 |
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), $closingCurly, true);
|
125 |
$phpcsFile->fixer->addContentBefore($next, str_replace('use ', '', $baseUse));
|
119 |
$phpcsFile->fixer->replaceToken($i, '');
|
120 |
}
|
121 |
|
122 |
+
if ($tokens[$next]['content'] === 'const' || $tokens[$next]['content'] === 'function') {
|
123 |
$phpcsFile->fixer->addContentBefore($next, 'use ');
|
124 |
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), $closingCurly, true);
|
125 |
$phpcsFile->fixer->addContentBefore($next, str_replace('use ', '', $baseUse));
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.inc
CHANGED
@@ -7,7 +7,8 @@ class MyClass
|
|
7 |
$var = null;
|
8 |
|
9 |
var $var = null;
|
10 |
-
|
|
|
11 |
|
12 |
public $_var = null;
|
13 |
protected $_var = null;
|
@@ -17,6 +18,10 @@ class MyClass
|
|
17 |
public $foo,
|
18 |
$bar,
|
19 |
$var = null;
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
class foo
|
@@ -25,4 +30,14 @@ class foo
|
|
25 |
qux
|
26 |
BAZ;
|
27 |
}
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
$var = null;
|
8 |
|
9 |
var $var = null;
|
10 |
+
static $var = null;
|
11 |
+
public var $var = null; // Parse error.
|
12 |
|
13 |
public $_var = null;
|
14 |
protected $_var = null;
|
18 |
public $foo,
|
19 |
$bar,
|
20 |
$var = null;
|
21 |
+
|
22 |
+
protected
|
23 |
+
$foo,
|
24 |
+
$bar;
|
25 |
}
|
26 |
|
27 |
class foo
|
30 |
qux
|
31 |
BAZ;
|
32 |
}
|
33 |
+
|
34 |
+
class ABC {
|
35 |
+
public static $propA;
|
36 |
+
protected static $propB;
|
37 |
+
private static $propC;
|
38 |
+
static public $propD;
|
39 |
+
static
|
40 |
+
protected
|
41 |
+
$propE;
|
42 |
+
static private /*comment*/ $propF;
|
43 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.inc.fixed
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class MyClass
|
3 |
+
{
|
4 |
+
public $var = null;
|
5 |
+
protected $var = null;
|
6 |
+
private $var = null;
|
7 |
+
$var = null;
|
8 |
+
|
9 |
+
var $var = null;
|
10 |
+
static $var = null;
|
11 |
+
public var $var = null; // Parse error.
|
12 |
+
|
13 |
+
public $_var = null;
|
14 |
+
protected $_var = null;
|
15 |
+
private $_var = null;
|
16 |
+
|
17 |
+
public $foo, $bar, $var = null;
|
18 |
+
public $foo,
|
19 |
+
$bar,
|
20 |
+
$var = null;
|
21 |
+
|
22 |
+
protected
|
23 |
+
$foo,
|
24 |
+
$bar;
|
25 |
+
}
|
26 |
+
|
27 |
+
class foo
|
28 |
+
{
|
29 |
+
const bar = <<<BAZ
|
30 |
+
qux
|
31 |
+
BAZ;
|
32 |
+
}
|
33 |
+
|
34 |
+
class ABC {
|
35 |
+
public static $propA;
|
36 |
+
protected static $propB;
|
37 |
+
private static $propC;
|
38 |
+
public static $propD;
|
39 |
+
protected static
|
40 |
+
$propE;
|
41 |
+
private static /*comment*/ $propF;
|
42 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.php
CHANGED
@@ -29,8 +29,13 @@ class PropertyDeclarationUnitTest extends AbstractSniffUnitTest
|
|
29 |
7 => 1,
|
30 |
9 => 2,
|
31 |
10 => 1,
|
32 |
-
|
33 |
17 => 1,
|
|
|
|
|
|
|
|
|
|
|
34 |
];
|
35 |
|
36 |
}//end getErrorList()
|
@@ -47,9 +52,9 @@ class PropertyDeclarationUnitTest extends AbstractSniffUnitTest
|
|
47 |
public function getWarningList()
|
48 |
{
|
49 |
return [
|
50 |
-
12 => 1,
|
51 |
13 => 1,
|
52 |
14 => 1,
|
|
|
53 |
];
|
54 |
|
55 |
}//end getWarningList()
|
29 |
7 => 1,
|
30 |
9 => 2,
|
31 |
10 => 1,
|
32 |
+
11 => 1,
|
33 |
17 => 1,
|
34 |
+
18 => 1,
|
35 |
+
23 => 1,
|
36 |
+
38 => 1,
|
37 |
+
41 => 1,
|
38 |
+
42 => 1,
|
39 |
];
|
40 |
|
41 |
}//end getErrorList()
|
52 |
public function getWarningList()
|
53 |
{
|
54 |
return [
|
|
|
55 |
13 => 1,
|
56 |
14 => 1,
|
57 |
+
15 => 1,
|
58 |
];
|
59 |
|
60 |
}//end getWarningList()
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Methods/MethodDeclarationUnitTest.inc
CHANGED
@@ -1,6 +1,47 @@
|
|
1 |
<?php
|
2 |
|
3 |
class MyClass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
{
|
5 |
function _myFunction() {}
|
6 |
private function myFunction() {}
|
@@ -15,3 +56,11 @@ class MyClass
|
|
15 |
static protected final abstract function myFunction();
|
16 |
public function _() {}
|
17 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
|
3 |
class MyClass
|
4 |
+
{
|
5 |
+
function _myFunction() {}
|
6 |
+
private function myFunction() {}
|
7 |
+
function __myFunction() {}
|
8 |
+
public static function myFunction() {}
|
9 |
+
static public /*comment*/ function myFunction() {}
|
10 |
+
final public function myFunction() {}
|
11 |
+
public /*comment*/ final function myFunction() {}
|
12 |
+
abstract private function myFunction();
|
13 |
+
private /*comment*/ abstract function myFunction();
|
14 |
+
final public /*comment*/ static function myFunction() {}
|
15 |
+
static protected final abstract function myFunction();
|
16 |
+
public function _() {}
|
17 |
+
}
|
18 |
+
|
19 |
+
interface MyInterface
|
20 |
+
{
|
21 |
+
function _myFunction();
|
22 |
+
function __myFunction();
|
23 |
+
public static function myFunction();
|
24 |
+
static public function myFunction();
|
25 |
+
public function _();
|
26 |
+
}
|
27 |
+
|
28 |
+
trait MyTrait
|
29 |
+
{
|
30 |
+
function _myFunction() {}
|
31 |
+
private function myFunction() {}
|
32 |
+
function __myFunction() {}
|
33 |
+
public static function myFunction() {}
|
34 |
+
static public function myFunction() {}
|
35 |
+
final /*comment*/ public function myFunction() {}
|
36 |
+
public final function myFunction() {}
|
37 |
+
abstract private function myFunction();
|
38 |
+
private abstract function myFunction();
|
39 |
+
final public static function myFunction() {}
|
40 |
+
static /*comment*/ protected final abstract function myFunction();
|
41 |
+
public function _() {}
|
42 |
+
}
|
43 |
+
|
44 |
+
$a = new class()
|
45 |
{
|
46 |
function _myFunction() {}
|
47 |
private function myFunction() {}
|
56 |
static protected final abstract function myFunction();
|
57 |
public function _() {}
|
58 |
}
|
59 |
+
|
60 |
+
class Nested_Function {
|
61 |
+
public function getAnonymousClass() {
|
62 |
+
return new class() {
|
63 |
+
static private final function _nested_function() {}
|
64 |
+
};
|
65 |
+
}
|
66 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Methods/MethodDeclarationUnitTest.inc.fixed
CHANGED
@@ -1,6 +1,47 @@
|
|
1 |
<?php
|
2 |
|
3 |
class MyClass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
{
|
5 |
function _myFunction() {}
|
6 |
private function myFunction() {}
|
@@ -15,3 +56,11 @@ class MyClass
|
|
15 |
abstract final protected static function myFunction();
|
16 |
public function _() {}
|
17 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
|
3 |
class MyClass
|
4 |
+
{
|
5 |
+
function _myFunction() {}
|
6 |
+
private function myFunction() {}
|
7 |
+
function __myFunction() {}
|
8 |
+
public static function myFunction() {}
|
9 |
+
public static /*comment*/ function myFunction() {}
|
10 |
+
final public function myFunction() {}
|
11 |
+
final public /*comment*/ function myFunction() {}
|
12 |
+
abstract private function myFunction();
|
13 |
+
abstract private /*comment*/ function myFunction();
|
14 |
+
final public /*comment*/ static function myFunction() {}
|
15 |
+
abstract final protected static function myFunction();
|
16 |
+
public function _() {}
|
17 |
+
}
|
18 |
+
|
19 |
+
interface MyInterface
|
20 |
+
{
|
21 |
+
function _myFunction();
|
22 |
+
function __myFunction();
|
23 |
+
public static function myFunction();
|
24 |
+
public static function myFunction();
|
25 |
+
public function _();
|
26 |
+
}
|
27 |
+
|
28 |
+
trait MyTrait
|
29 |
+
{
|
30 |
+
function _myFunction() {}
|
31 |
+
private function myFunction() {}
|
32 |
+
function __myFunction() {}
|
33 |
+
public static function myFunction() {}
|
34 |
+
public static function myFunction() {}
|
35 |
+
final /*comment*/ public function myFunction() {}
|
36 |
+
final public function myFunction() {}
|
37 |
+
abstract private function myFunction();
|
38 |
+
abstract private function myFunction();
|
39 |
+
final public static function myFunction() {}
|
40 |
+
/*comment*/ abstract final protected static function myFunction();
|
41 |
+
public function _() {}
|
42 |
+
}
|
43 |
+
|
44 |
+
$a = new class()
|
45 |
{
|
46 |
function _myFunction() {}
|
47 |
private function myFunction() {}
|
56 |
abstract final protected static function myFunction();
|
57 |
public function _() {}
|
58 |
}
|
59 |
+
|
60 |
+
class Nested_Function {
|
61 |
+
public function getAnonymousClass() {
|
62 |
+
return new class() {
|
63 |
+
final private static function _nested_function() {}
|
64 |
+
};
|
65 |
+
}
|
66 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Methods/MethodDeclarationUnitTest.php
CHANGED
@@ -30,6 +30,16 @@ class MethodDeclarationUnitTest extends AbstractSniffUnitTest
|
|
30 |
11 => 1,
|
31 |
13 => 1,
|
32 |
15 => 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
];
|
34 |
|
35 |
}//end getErrorList()
|
@@ -45,7 +55,13 @@ class MethodDeclarationUnitTest extends AbstractSniffUnitTest
|
|
45 |
*/
|
46 |
public function getWarningList()
|
47 |
{
|
48 |
-
return [
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
}//end getWarningList()
|
51 |
|
30 |
11 => 1,
|
31 |
13 => 1,
|
32 |
15 => 3,
|
33 |
+
24 => 1,
|
34 |
+
34 => 1,
|
35 |
+
36 => 1,
|
36 |
+
38 => 1,
|
37 |
+
40 => 3,
|
38 |
+
50 => 1,
|
39 |
+
52 => 1,
|
40 |
+
54 => 1,
|
41 |
+
56 => 3,
|
42 |
+
63 => 2,
|
43 |
];
|
44 |
|
45 |
}//end getErrorList()
|
55 |
*/
|
56 |
public function getWarningList()
|
57 |
{
|
58 |
+
return [
|
59 |
+
5 => 1,
|
60 |
+
21 => 1,
|
61 |
+
30 => 1,
|
62 |
+
46 => 1,
|
63 |
+
63 => 1,
|
64 |
+
];
|
65 |
|
66 |
}//end getWarningList()
|
67 |
|
vendor/squizlabs/php_codesniffer/src/Standards/PSR2/ruleset.xml
CHANGED
@@ -1,201 +1,201 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<ruleset name="PSR2">
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
</ruleset>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PSR2" xsi:noNamespaceSchemaLocation="../../../phpcs.xsd">
|
3 |
+
<description>The PSR-2 coding standard.</description>
|
4 |
+
<arg name="tab-width" value="4"/>
|
5 |
+
|
6 |
+
<!-- 2. General -->
|
7 |
|
8 |
+
<!-- 2.1 Basic Coding Standard -->
|
9 |
+
|
10 |
+
<!-- Include the whole PSR-1 standard -->
|
11 |
+
<rule ref="PSR1"/>
|
12 |
|
13 |
+
<!-- 2.2 Files -->
|
14 |
|
15 |
+
<!-- All PHP files MUST use the Unix LF (linefeed) line ending. -->
|
16 |
+
<rule ref="Generic.Files.LineEndings">
|
17 |
+
<properties>
|
18 |
+
<property name="eolChar" value="\n"/>
|
19 |
+
</properties>
|
20 |
+
</rule>
|
21 |
|
22 |
+
<!-- All PHP files MUST end with a single blank line. -->
|
23 |
+
<!-- checked by PSR2.Files.EndFileNewline -->
|
24 |
|
25 |
+
<!-- The closing ?> tag MUST be omitted from files containing only PHP. -->
|
26 |
+
<!-- checked by PSR2.Files.ClosingTag -->
|
27 |
+
|
28 |
+
<!-- 2.3 Lines -->
|
29 |
+
|
30 |
+
<!-- The soft limit on line length MUST be 120 characters; automated style checkers MUST warn but MUST NOT error at the soft limit. -->
|
31 |
+
<rule ref="Generic.Files.LineLength">
|
32 |
+
<properties>
|
33 |
+
<property name="lineLimit" value="120"/>
|
34 |
+
<property name="absoluteLineLimit" value="0"/>
|
35 |
+
</properties>
|
36 |
+
</rule>
|
37 |
+
|
38 |
+
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
|
39 |
+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
|
40 |
+
<properties>
|
41 |
+
<property name="ignoreBlankLines" value="true"/>
|
42 |
+
</properties>
|
43 |
+
</rule>
|
44 |
+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
|
45 |
+
<severity>0</severity>
|
46 |
+
</rule>
|
47 |
+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile">
|
48 |
+
<severity>0</severity>
|
49 |
+
</rule>
|
50 |
+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
|
51 |
+
<severity>0</severity>
|
52 |
+
</rule>
|
53 |
+
|
54 |
+
<!-- There MUST NOT be more than one statement per line. -->
|
55 |
+
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
|
56 |
|
57 |
+
<!-- 2.4 Indenting -->
|
58 |
+
|
59 |
+
<!-- Code MUST use an indent of 4 spaces, and MUST NOT use tabs for indenting. -->
|
60 |
+
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
61 |
+
<properties>
|
62 |
+
<property name="ignoreIndentationTokens" type="array">
|
63 |
+
<element value="T_COMMENT"/>
|
64 |
+
<element value="T_DOC_COMMENT_OPEN_TAG"/>
|
65 |
+
</property>
|
66 |
+
</properties>
|
67 |
+
</rule>
|
68 |
+
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
69 |
+
|
70 |
+
<!-- 2.5 Keywords and True/False/Null -->
|
71 |
+
|
72 |
+
<!-- PHP keywords MUST be in lower case. -->
|
73 |
+
<rule ref="Generic.PHP.LowerCaseKeyword"/>
|
74 |
+
|
75 |
+
<!-- The PHP constants true, false, and null MUST be in lower case. -->
|
76 |
+
<rule ref="Generic.PHP.LowerCaseConstant"/>
|
77 |
+
|
78 |
+
<!-- 3. Namespace and Use Declarations -->
|
79 |
+
|
80 |
+
<!-- When present, there MUST be one blank line after the namespace declaration. -->
|
81 |
+
<!-- checked by PSR2.Namespaces.NamespaceDeclaration -->
|
82 |
+
|
83 |
+
<!-- When present, all use declarations MUST go after the namespace declaration.
|
84 |
+
There MUST be one use keyword per declaration.
|
85 |
+
There MUST be one blank line after the use block. -->
|
86 |
+
<!-- checked by PSR2.Namespaces.UseDeclaration -->
|
87 |
+
|
88 |
+
<!-- 4. Classes, Properties, and Methods -->
|
89 |
+
|
90 |
+
<!-- 4.1. Extends and Implements -->
|
91 |
+
|
92 |
+
<!-- The extends and implements keywords MUST be declared on the same line as the class name.
|
93 |
+
The opening brace for the class go MUST go on its own line; the closing brace for the class MUST go on the next line after the body.
|
94 |
+
Lists of implements MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one interface per line. -->
|
95 |
+
<!-- checked by PSR2.Classes.ClassDeclaration -->
|
96 |
+
|
97 |
+
<!-- 4.2. Properties -->
|
98 |
+
|
99 |
+
<!-- Visibility MUST be declared on all properties.
|
100 |
+
The var keyword MUST NOT be used to declare a property.
|
101 |
+
There MUST NOT be more than one property declared per statement.
|
102 |
+
Property names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility. -->
|
103 |
+
<!-- checked by PSR2.Classes.PropertyDeclaration -->
|
104 |
+
|
105 |
+
<!-- 4.3 Methods -->
|
106 |
+
|
107 |
+
<!-- Visibility MUST be declared on all methods. -->
|
108 |
+
<rule ref="Squiz.Scope.MethodScope"/>
|
109 |
+
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing"/>
|
110 |
+
|
111 |
+
<!-- Method names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility. -->
|
112 |
+
<!-- checked by PSR2.Methods.MethodDeclaration -->
|
113 |
+
|
114 |
+
<!-- Method names MUST NOT be declared with a space after the method name. The opening brace MUST go on its own line, and the closing brace MUST go on the next line following the body. There MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis. -->
|
115 |
+
<!-- checked by PSR2.Methods.FunctionClosingBrace -->
|
116 |
+
<rule ref="Squiz.Functions.FunctionDeclaration"/>
|
117 |
+
<rule ref="Squiz.Functions.LowercaseFunctionKeywords"/>
|
118 |
+
|
119 |
+
<!-- 4.4 Method Arguments -->
|
120 |
+
|
121 |
+
<!-- In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. -->
|
122 |
+
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
|
123 |
+
<properties>
|
124 |
+
<property name="equalsSpacing" value="1"/>
|
125 |
+
</properties>
|
126 |
+
</rule>
|
127 |
+
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint">
|
128 |
+
<severity>0</severity>
|
129 |
+
</rule>
|
130 |
+
|
131 |
+
<!-- Method arguments with default values MUST go at the end of the argument list. -->
|
132 |
+
<rule ref="PEAR.Functions.ValidDefaultValue"/>
|
133 |
+
|
134 |
+
<!-- Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument per line. When the argument list is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them. -->
|
135 |
+
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration"/>
|
136 |
+
|
137 |
+
<!-- 4.5 abstract, final, and static -->
|
138 |
+
|
139 |
+
<!-- When present, the abstract and final declarations MUST precede the visibility declaration.
|
140 |
+
When present, the static declaration MUST come after the visibility declaration. -->
|
141 |
+
<!-- checked by PSR2.Methods.MethodDeclaration -->
|
142 |
+
|
143 |
+
<!-- 4.6 Method and Function Calls -->
|
144 |
+
|
145 |
+
<!-- When making a method or function call, there MUST NOT be a space between the method or function name and the opening parenthesis, there MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis. In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma.
|
146 |
+
Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument per line. -->
|
147 |
+
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
|
148 |
+
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceAfterCloseBracket">
|
149 |
+
<severity>0</severity>
|
150 |
+
</rule>
|
151 |
+
<rule ref="PSR2.Methods.FunctionCallSignature.OpeningIndent">
|
152 |
+
<severity>0</severity>
|
153 |
+
</rule>
|
154 |
+
|
155 |
+
<!-- 5. Control Structures -->
|
156 |
+
|
157 |
+
<!-- The general style rules for control structures are as follows:
|
158 |
+
There MUST be one space after the control structure keyword
|
159 |
+
There MUST NOT be a space after the opening parenthesis
|
160 |
+
There MUST NOT be a space before the closing parenthesis
|
161 |
+
There MUST be one space between the closing parenthesis and the opening brace
|
162 |
+
The structure body MUST be indented once
|
163 |
+
The closing brace MUST be on the next line after the body -->
|
164 |
+
<rule ref="Squiz.ControlStructures.ControlSignature"/>
|
165 |
+
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/>
|
166 |
+
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/>
|
167 |
+
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace"/>
|
168 |
+
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
|
169 |
+
<rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
|
170 |
+
<rule ref="Squiz.ControlStructures.LowercaseDeclaration"/>
|
171 |
+
<!-- checked by PSR2.ControlStructures.ControlStructureSpacing -->
|
172 |
+
|
173 |
+
<!-- exclude this message as it is already checked Generic.PHP.LowerCaseKeyword -->
|
174 |
+
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.AsNotLower">
|
175 |
+
<severity>0</severity>
|
176 |
+
</rule>
|
177 |
+
|
178 |
+
<!-- The body of each structure MUST be enclosed by braces. This standardizes how the structures look, and reduces the likelihood of introducing errors as new lines get added to the body. -->
|
179 |
+
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
|
180 |
+
|
181 |
+
<!-- 5.1. if, elseif, else -->
|
182 |
+
|
183 |
+
<!-- The keyword elseif SHOULD be used instead of else if so that all control keywords look like single words. -->
|
184 |
+
<!-- checked by PSR2.ControlStructures.ElseIfDeclaration -->
|
185 |
+
|
186 |
+
<!-- 5.2. switch, case -->
|
187 |
+
|
188 |
+
<!-- The case statement MUST be indented once from switch, and the break keyword (or other terminating keyword) MUST be indented at the same level as the case body. There MUST be a comment such as // no break when fall-through is intentional in a non-empty case body. -->
|
189 |
+
<!-- checked by PSR2.ControlStructures.SwitchDeclaration -->
|
190 |
+
|
191 |
+
<!-- 6. Closures -->
|
192 |
+
|
193 |
+
<!-- Closures MUST be declared with a space after the function keyword, and a space before and after the use keyword.
|
194 |
+
The opening brace MUST go on the same line, and the closing brace MUST go on the next line following the body.
|
195 |
+
There MUST NOT be a space after the opening parenthesis of the argument list or variable list, and there MUST NOT be a space before the closing parenthesis of the argument list or variable list.
|
196 |
+
In the argument list and variable list, there MUST NOT be a space before each comma, and there MUST be one space after each comma.
|
197 |
+
Closure arguments with default values MUST go at the end of the argument list.
|
198 |
+
Argument lists and variable lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument or variable per line.
|
199 |
+
When the ending list (whether or arguments or variables) is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them. -->
|
200 |
+
<!-- checked in Squiz.Functions.MultiLineFunctionDeclaration -->
|
201 |
</ruleset>
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Classes/ClassFileNameSniff.php
CHANGED
@@ -26,6 +26,7 @@ class ClassFileNameSniff implements Sniff
|
|
26 |
return [
|
27 |
T_CLASS,
|
28 |
T_INTERFACE,
|
|
|
29 |
];
|
30 |
|
31 |
}//end register()
|
26 |
return [
|
27 |
T_CLASS,
|
28 |
T_INTERFACE,
|
29 |
+
T_TRAIT,
|
30 |
];
|
31 |
|
32 |
}//end register()
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Classes/SelfMemberReferenceSniff.php
CHANGED
@@ -16,6 +16,7 @@ namespace PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes;
|
|
16 |
|
17 |
use PHP_CodeSniffer\Sniffs\AbstractScopeSniff;
|
18 |
use PHP_CodeSniffer\Files\File;
|
|
|
19 |
|
20 |
class SelfMemberReferenceSniff extends AbstractScopeSniff
|
21 |
{
|
@@ -44,7 +45,25 @@ class SelfMemberReferenceSniff extends AbstractScopeSniff
|
|
44 |
{
|
45 |
$tokens = $phpcsFile->getTokens();
|
46 |
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
if ($tokens[$calledClassName]['code'] === T_SELF) {
|
49 |
if ($tokens[$calledClassName]['content'] !== 'self') {
|
50 |
$error = 'Must use "self::" for local static member reference; found "%s::"';
|
@@ -59,9 +78,10 @@ class SelfMemberReferenceSniff extends AbstractScopeSniff
|
|
59 |
} else if ($tokens[$calledClassName]['code'] === T_STRING) {
|
60 |
// If the class is called with a namespace prefix, build fully qualified
|
61 |
// namespace calls for both current scope class and requested class.
|
62 |
-
|
|
|
63 |
$declarationName = $this->getDeclarationNameWithNamespace($tokens, $calledClassName);
|
64 |
-
$declarationName =
|
65 |
$fullQualifiedClassName = $this->getNamespaceOfScope($phpcsFile, $currScope);
|
66 |
if ($fullQualifiedClassName === '\\') {
|
67 |
$fullQualifiedClassName = '';
|
@@ -76,25 +96,33 @@ class SelfMemberReferenceSniff extends AbstractScopeSniff
|
|
76 |
}
|
77 |
|
78 |
if ($declarationName === $fullQualifiedClassName) {
|
79 |
-
// Class name is the same as the current class, which is not allowed
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
|
92 |
-
$phpcsFile->fixer->replaceToken($
|
93 |
-
|
94 |
}
|
95 |
|
|
|
|
|
|
|
|
|
96 |
return;
|
97 |
-
}
|
98 |
}//end if
|
99 |
}//end if
|
100 |
|
@@ -102,10 +130,16 @@ class SelfMemberReferenceSniff extends AbstractScopeSniff
|
|
102 |
$found = strlen($tokens[($stackPtr - 1)]['content']);
|
103 |
$error = 'Expected 0 spaces before double colon; %s found';
|
104 |
$data = [$found];
|
105 |
-
$fix = $phpcsFile->addFixableError($error, $
|
106 |
|
107 |
if ($fix === true) {
|
108 |
-
$phpcsFile->fixer->
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
}
|
110 |
}
|
111 |
|
@@ -113,10 +147,16 @@ class SelfMemberReferenceSniff extends AbstractScopeSniff
|
|
113 |
$found = strlen($tokens[($stackPtr + 1)]['content']);
|
114 |
$error = 'Expected 0 spaces after double colon; %s found';
|
115 |
$data = [$found];
|
116 |
-
$fix = $phpcsFile->addFixableError($error, $
|
117 |
|
118 |
if ($fix === true) {
|
119 |
-
$phpcsFile->fixer->
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
}
|
121 |
}
|
122 |
|
@@ -153,9 +193,15 @@ class SelfMemberReferenceSniff extends AbstractScopeSniff
|
|
153 |
$currentPointer = $stackPtr;
|
154 |
while ($tokens[$currentPointer]['code'] === T_NS_SEPARATOR
|
155 |
|| $tokens[$currentPointer]['code'] === T_STRING
|
|
|
156 |
) {
|
|
|
|
|
|
|
|
|
|
|
157 |
$nameParts[] = $tokens[$currentPointer]['content'];
|
158 |
-
|
159 |
}
|
160 |
|
161 |
$nameParts = array_reverse($nameParts);
|
@@ -179,7 +225,7 @@ class SelfMemberReferenceSniff extends AbstractScopeSniff
|
|
179 |
$namespaceDeclaration = $phpcsFile->findPrevious(T_NAMESPACE, $stackPtr);
|
180 |
|
181 |
if ($namespaceDeclaration !== false) {
|
182 |
-
$endOfNamespaceDeclaration = $phpcsFile->findNext(T_SEMICOLON, $namespaceDeclaration);
|
183 |
$namespace = $this->getDeclarationNameWithNamespace(
|
184 |
$phpcsFile->getTokens(),
|
185 |
($endOfNamespaceDeclaration - 1)
|
16 |
|
17 |
use PHP_CodeSniffer\Sniffs\AbstractScopeSniff;
|
18 |
use PHP_CodeSniffer\Files\File;
|
19 |
+
use PHP_CodeSniffer\Util\Tokens;
|
20 |
|
21 |
class SelfMemberReferenceSniff extends AbstractScopeSniff
|
22 |
{
|
45 |
{
|
46 |
$tokens = $phpcsFile->getTokens();
|
47 |
|
48 |
+
// Determine if this is a double colon which needs to be examined.
|
49 |
+
$conditions = $tokens[$stackPtr]['conditions'];
|
50 |
+
$conditions = array_reverse($conditions, true);
|
51 |
+
foreach ($conditions as $conditionToken => $tokenCode) {
|
52 |
+
if ($tokenCode === T_CLASS || $tokenCode === T_ANON_CLASS || $tokenCode === T_CLOSURE) {
|
53 |
+
break;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
if ($conditionToken !== $currScope) {
|
58 |
+
return;
|
59 |
+
}
|
60 |
+
|
61 |
+
$calledClassName = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
62 |
+
if ($calledClassName === false) {
|
63 |
+
// Parse error.
|
64 |
+
return;
|
65 |
+
}
|
66 |
+
|
67 |
if ($tokens[$calledClassName]['code'] === T_SELF) {
|
68 |
if ($tokens[$calledClassName]['content'] !== 'self') {
|
69 |
$error = 'Must use "self::" for local static member reference; found "%s::"';
|
78 |
} else if ($tokens[$calledClassName]['code'] === T_STRING) {
|
79 |
// If the class is called with a namespace prefix, build fully qualified
|
80 |
// namespace calls for both current scope class and requested class.
|
81 |
+
$prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($calledClassName - 1), null, true);
|
82 |
+
if ($prevNonEmpty !== false && $tokens[$prevNonEmpty]['code'] === T_NS_SEPARATOR) {
|
83 |
$declarationName = $this->getDeclarationNameWithNamespace($tokens, $calledClassName);
|
84 |
+
$declarationName = ltrim($declarationName, '\\');
|
85 |
$fullQualifiedClassName = $this->getNamespaceOfScope($phpcsFile, $currScope);
|
86 |
if ($fullQualifiedClassName === '\\') {
|
87 |
$fullQualifiedClassName = '';
|
96 |
}
|
97 |
|
98 |
if ($declarationName === $fullQualifiedClassName) {
|
99 |
+
// Class name is the same as the current class, which is not allowed.
|
100 |
+
$error = 'Must use "self::" for local static member reference';
|
101 |
+
$fix = $phpcsFile->addFixableError($error, $calledClassName, 'NotUsed');
|
102 |
+
|
103 |
+
if ($fix === true) {
|
104 |
+
$phpcsFile->fixer->beginChangeset();
|
105 |
+
|
106 |
+
$currentPointer = ($stackPtr - 1);
|
107 |
+
while ($tokens[$currentPointer]['code'] === T_NS_SEPARATOR
|
108 |
+
|| $tokens[$currentPointer]['code'] === T_STRING
|
109 |
+
|| isset(Tokens::$emptyTokens[$tokens[$currentPointer]['code']]) === true
|
110 |
+
) {
|
111 |
+
if (isset(Tokens::$emptyTokens[$tokens[$currentPointer]['code']]) === true) {
|
112 |
+
--$currentPointer;
|
113 |
+
continue;
|
114 |
}
|
115 |
|
116 |
+
$phpcsFile->fixer->replaceToken($currentPointer, '');
|
117 |
+
--$currentPointer;
|
118 |
}
|
119 |
|
120 |
+
$phpcsFile->fixer->replaceToken($stackPtr, 'self::');
|
121 |
+
$phpcsFile->fixer->endChangeset();
|
122 |
+
|
123 |
+
// Fix potential whitespace issues in the next loop.
|
124 |
return;
|
125 |
+
}//end if
|
126 |
}//end if
|
127 |
}//end if
|
128 |
|
130 |
$found = strlen($tokens[($stackPtr - 1)]['content']);
|
131 |
$error = 'Expected 0 spaces before double colon; %s found';
|
132 |
$data = [$found];
|
133 |
+
$fix = $phpcsFile->addFixableError($error, ($stackPtr - 1), 'SpaceBefore', $data);
|
134 |
|
135 |
if ($fix === true) {
|
136 |
+
$phpcsFile->fixer->beginChangeset();
|
137 |
+
|
138 |
+
for ($i = ($stackPtr - 1); $tokens[$i]['code'] === T_WHITESPACE; $i--) {
|
139 |
+
$phpcsFile->fixer->replaceToken($i, '');
|
140 |
+
}
|
141 |
+
|
142 |
+
$phpcsFile->fixer->endChangeset();
|
143 |
}
|
144 |
}
|
145 |
|
147 |
$found = strlen($tokens[($stackPtr + 1)]['content']);
|
148 |
$error = 'Expected 0 spaces after double colon; %s found';
|
149 |
$data = [$found];
|
150 |
+
$fix = $phpcsFile->addFixableError($error, ($stackPtr - 1), 'SpaceAfter', $data);
|
151 |
|
152 |
if ($fix === true) {
|
153 |
+
$phpcsFile->fixer->beginChangeset();
|
154 |
+
|
155 |
+
for ($i = ($stackPtr + 1); $tokens[$i]['code'] === T_WHITESPACE; $i++) {
|
156 |
+
$phpcsFile->fixer->replaceToken($i, '');
|
157 |
+
}
|
158 |
+
|
159 |
+
$phpcsFile->fixer->endChangeset();
|
160 |
}
|
161 |
}
|
162 |
|
193 |
$currentPointer = $stackPtr;
|
194 |
while ($tokens[$currentPointer]['code'] === T_NS_SEPARATOR
|
195 |
|| $tokens[$currentPointer]['code'] === T_STRING
|
196 |
+
|| isset(Tokens::$emptyTokens[$tokens[$currentPointer]['code']]) === true
|
197 |
) {
|
198 |
+
if (isset(Tokens::$emptyTokens[$tokens[$currentPointer]['code']]) === true) {
|
199 |
+
--$currentPointer;
|
200 |
+
continue;
|
201 |
+
}
|
202 |
+
|
203 |
$nameParts[] = $tokens[$currentPointer]['content'];
|
204 |
+
--$currentPointer;
|
205 |
}
|
206 |
|
207 |
$nameParts = array_reverse($nameParts);
|
225 |
$namespaceDeclaration = $phpcsFile->findPrevious(T_NAMESPACE, $stackPtr);
|
226 |
|
227 |
if ($namespaceDeclaration !== false) {
|
228 |
+
$endOfNamespaceDeclaration = $phpcsFile->findNext([T_SEMICOLON, T_OPEN_CURLY_BRACKET], $namespaceDeclaration);
|
229 |
$namespace = $this->getDeclarationNameWithNamespace(
|
230 |
$phpcsFile->getTokens(),
|
231 |
($endOfNamespaceDeclaration - 1)
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php
CHANGED
@@ -38,12 +38,8 @@ class FunctionCommentSniff extends PEARFunctionCommentSniff
|
|
38 |
protected function processReturn(File $phpcsFile, $stackPtr, $commentStart)
|
39 |
{
|
40 |
$tokens = $phpcsFile->getTokens();
|
41 |
-
|
42 |
-
// Skip constructor and destructor.
|
43 |
-
$methodName = $phpcsFile->getDeclarationName($stackPtr);
|
44 |
-
$isSpecialMethod = ($methodName === '__construct' || $methodName === '__destruct');
|
45 |
-
|
46 |
$return = null;
|
|
|
47 |
foreach ($tokens[$commentStart]['comment_tags'] as $tag) {
|
48 |
if ($tokens[$tag]['content'] === '@return') {
|
49 |
if ($return !== null) {
|
@@ -56,6 +52,9 @@ class FunctionCommentSniff extends PEARFunctionCommentSniff
|
|
56 |
}
|
57 |
}
|
58 |
|
|
|
|
|
|
|
59 |
if ($isSpecialMethod === true) {
|
60 |
return;
|
61 |
}
|
38 |
protected function processReturn(File $phpcsFile, $stackPtr, $commentStart)
|
39 |
{
|
40 |
$tokens = $phpcsFile->getTokens();
|
|
|
|
|
|
|
|
|
|
|
41 |
$return = null;
|
42 |
+
|
43 |
foreach ($tokens[$commentStart]['comment_tags'] as $tag) {
|
44 |
if ($tokens[$tag]['content'] === '@return') {
|
45 |
if ($return !== null) {
|
52 |
}
|
53 |
}
|
54 |
|
55 |
+
// Skip constructor and destructor.
|
56 |
+
$methodName = $phpcsFile->getDeclarationName($stackPtr);
|
57 |
+
$isSpecialMethod = ($methodName === '__construct' || $methodName === '__destruct');
|
58 |
if ($isSpecialMethod === true) {
|
59 |
return;
|
60 |
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Commenting/InlineCommentSniff.php
CHANGED
@@ -152,14 +152,45 @@ class InlineCommentSniff implements Sniff
|
|
152 |
}
|
153 |
}
|
154 |
|
155 |
-
$comment = rtrim($tokens[$stackPtr]['content']);
|
156 |
-
|
157 |
// Only want inline comments.
|
158 |
-
if (substr($
|
159 |
return;
|
160 |
}
|
161 |
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
$spaceCount = 0;
|
164 |
$tabFound = false;
|
165 |
|
@@ -184,14 +215,14 @@ class InlineCommentSniff implements Sniff
|
|
184 |
ltrim(substr($comment, 2)),
|
185 |
$comment,
|
186 |
];
|
187 |
-
$fix = $phpcsFile->addFixableError($error, $
|
188 |
} else if ($spaceCount === 0) {
|
189 |
$error = 'No space found before comment text; expected "// %s" but found "%s"';
|
190 |
$data = [
|
191 |
substr($comment, 2),
|
192 |
$comment,
|
193 |
];
|
194 |
-
$fix = $phpcsFile->addFixableError($error, $
|
195 |
} else if ($spaceCount > 1) {
|
196 |
$error = 'Expected 1 space before comment text but found %s; use block comment if you need indentation';
|
197 |
$data = [
|
@@ -199,51 +230,16 @@ class InlineCommentSniff implements Sniff
|
|
199 |
substr($comment, (2 + $spaceCount)),
|
200 |
$comment,
|
201 |
];
|
202 |
-
$fix = $phpcsFile->addFixableError($error, $
|
203 |
}//end if
|
204 |
|
205 |
if ($fix === true) {
|
206 |
-
$newComment = '// '.ltrim($tokens[$
|
207 |
-
$phpcsFile->fixer->replaceToken($
|
208 |
}
|
209 |
-
}//end if
|
210 |
|
211 |
-
|
212 |
-
//
|
213 |
-
// work its way up.
|
214 |
-
$nextComment = $phpcsFile->findNext(T_COMMENT, ($stackPtr + 1), null, false);
|
215 |
-
if ($nextComment !== false
|
216 |
-
&& $tokens[$nextComment]['line'] === ($tokens[$stackPtr]['line'] + 1)
|
217 |
-
) {
|
218 |
-
$nextNonWhitespace = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), $nextComment, true);
|
219 |
-
if ($nextNonWhitespace === false) {
|
220 |
-
return;
|
221 |
-
}
|
222 |
-
}
|
223 |
-
|
224 |
-
$topComment = $stackPtr;
|
225 |
-
$lastComment = $stackPtr;
|
226 |
-
while (($topComment = $phpcsFile->findPrevious([T_COMMENT], ($lastComment - 1), null, false)) !== false) {
|
227 |
-
if ($tokens[$topComment]['line'] !== ($tokens[$lastComment]['line'] - 1)) {
|
228 |
-
break;
|
229 |
-
}
|
230 |
-
|
231 |
-
$nextNonWhitespace = $phpcsFile->findNext(T_WHITESPACE, ($topComment + 1), $lastComment, true);
|
232 |
-
if ($nextNonWhitespace !== false) {
|
233 |
-
break;
|
234 |
-
}
|
235 |
-
|
236 |
-
$lastComment = $topComment;
|
237 |
-
}
|
238 |
-
|
239 |
-
$topComment = $lastComment;
|
240 |
-
$commentText = '';
|
241 |
-
|
242 |
-
for ($i = $topComment; $i <= $stackPtr; $i++) {
|
243 |
-
if ($tokens[$i]['code'] === T_COMMENT) {
|
244 |
-
$commentText .= trim(substr($tokens[$i]['content'], 2));
|
245 |
-
}
|
246 |
-
}
|
247 |
|
248 |
if ($commentText === '') {
|
249 |
$error = 'Blank comments are not allowed';
|
@@ -252,12 +248,12 @@ class InlineCommentSniff implements Sniff
|
|
252 |
$phpcsFile->fixer->replaceToken($stackPtr, '');
|
253 |
}
|
254 |
|
255 |
-
return;
|
256 |
}
|
257 |
|
258 |
if (preg_match('/^\p{Ll}/u', $commentText) === 1) {
|
259 |
$error = 'Inline comments must start with a capital letter';
|
260 |
-
$phpcsFile->addError($error, $
|
261 |
}
|
262 |
|
263 |
// Only check the end of comment character if the start of the comment
|
@@ -279,24 +275,24 @@ class InlineCommentSniff implements Sniff
|
|
279 |
|
280 |
$ender = trim($ender, ' ,');
|
281 |
$data = [$ender];
|
282 |
-
$phpcsFile->addError($error, $
|
283 |
}
|
284 |
}
|
285 |
|
286 |
// Finally, the line below the last comment cannot be empty if this inline
|
287 |
// comment is on a line by itself.
|
288 |
if ($tokens[$previousContent]['line'] < $tokens[$stackPtr]['line']) {
|
289 |
-
$next = $phpcsFile->findNext(T_WHITESPACE, ($
|
290 |
if ($next === false) {
|
291 |
// Ignore if the comment is the last non-whitespace token in a file.
|
292 |
-
return;
|
293 |
}
|
294 |
|
295 |
if ($tokens[$next]['code'] === T_DOC_COMMENT_OPEN_TAG) {
|
296 |
// If this inline comment is followed by a docblock,
|
297 |
// ignore spacing as docblock/function etc spacing rules
|
298 |
// are likely to conflict with our rules.
|
299 |
-
return;
|
300 |
}
|
301 |
|
302 |
$errorCode = 'SpacingAfter';
|
@@ -313,21 +309,21 @@ class InlineCommentSniff implements Sniff
|
|
313 |
}
|
314 |
}
|
315 |
|
316 |
-
for ($i = ($
|
317 |
-
if ($tokens[$i]['line'] === ($tokens[$
|
318 |
if ($tokens[$i]['code'] !== T_WHITESPACE) {
|
319 |
-
return;
|
320 |
}
|
321 |
-
} else if ($tokens[$i]['line'] > ($tokens[$
|
322 |
break;
|
323 |
}
|
324 |
}
|
325 |
|
326 |
$error = 'There must be no blank line following an inline comment';
|
327 |
-
$fix = $phpcsFile->addFixableError($error, $
|
328 |
if ($fix === true) {
|
329 |
$phpcsFile->fixer->beginChangeset();
|
330 |
-
for ($i = ($
|
331 |
if ($tokens[$i]['line'] === $tokens[$next]['line']) {
|
332 |
break;
|
333 |
}
|
@@ -339,6 +335,8 @@ class InlineCommentSniff implements Sniff
|
|
339 |
}
|
340 |
}//end if
|
341 |
|
|
|
|
|
342 |
}//end process()
|
343 |
|
344 |
|
152 |
}
|
153 |
}
|
154 |
|
|
|
|
|
155 |
// Only want inline comments.
|
156 |
+
if (substr($tokens[$stackPtr]['content'], 0, 2) !== '//') {
|
157 |
return;
|
158 |
}
|
159 |
|
160 |
+
$commentTokens = [$stackPtr];
|
161 |
+
|
162 |
+
$nextComment = $stackPtr;
|
163 |
+
$lastComment = $stackPtr;
|
164 |
+
while (($nextComment = $phpcsFile->findNext(T_COMMENT, ($nextComment + 1), null, false)) !== false) {
|
165 |
+
if ($tokens[$nextComment]['line'] !== ($tokens[$lastComment]['line'] + 1)) {
|
166 |
+
break;
|
167 |
+
}
|
168 |
+
|
169 |
+
// Only want inline comments.
|
170 |
+
if (substr($tokens[$nextComment]['content'], 0, 2) !== '//') {
|
171 |
+
break;
|
172 |
+
}
|
173 |
+
|
174 |
+
// There is a comment on the very next line. If there is
|
175 |
+
// no code between the comments, they are part of the same
|
176 |
+
// comment block.
|
177 |
+
$prevNonWhitespace = $phpcsFile->findPrevious(T_WHITESPACE, ($nextComment - 1), $lastComment, true);
|
178 |
+
if ($prevNonWhitespace !== $lastComment) {
|
179 |
+
break;
|
180 |
+
}
|
181 |
+
|
182 |
+
$commentTokens[] = $nextComment;
|
183 |
+
$lastComment = $nextComment;
|
184 |
+
}//end while
|
185 |
+
|
186 |
+
$commentText = '';
|
187 |
+
foreach ($commentTokens as $lastCommentToken) {
|
188 |
+
$comment = rtrim($tokens[$lastCommentToken]['content']);
|
189 |
+
|
190 |
+
if (trim(substr($comment, 2)) === '') {
|
191 |
+
continue;
|
192 |
+
}
|
193 |
+
|
194 |
$spaceCount = 0;
|
195 |
$tabFound = false;
|
196 |
|
215 |
ltrim(substr($comment, 2)),
|
216 |
$comment,
|
217 |
];
|
218 |
+
$fix = $phpcsFile->addFixableError($error, $lastCommentToken, 'TabBefore', $data);
|
219 |
} else if ($spaceCount === 0) {
|
220 |
$error = 'No space found before comment text; expected "// %s" but found "%s"';
|
221 |
$data = [
|
222 |
substr($comment, 2),
|
223 |
$comment,
|
224 |
];
|
225 |
+
$fix = $phpcsFile->addFixableError($error, $lastCommentToken, 'NoSpaceBefore', $data);
|
226 |
} else if ($spaceCount > 1) {
|
227 |
$error = 'Expected 1 space before comment text but found %s; use block comment if you need indentation';
|
228 |
$data = [
|
230 |
substr($comment, (2 + $spaceCount)),
|
231 |
$comment,
|
232 |
];
|
233 |
+
$fix = $phpcsFile->addFixableError($error, $lastCommentToken, 'SpacingBefore', $data);
|
234 |
}//end if
|
235 |
|
236 |
if ($fix === true) {
|
237 |
+
$newComment = '// '.ltrim($tokens[$lastCommentToken]['content'], "/\t ");
|
238 |
+
$phpcsFile->fixer->replaceToken($lastCommentToken, $newComment);
|
239 |
}
|
|
|
240 |
|
241 |
+
$commentText .= trim(substr($tokens[$lastCommentToken]['content'], 2));
|
242 |
+
}//end foreach
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
|
244 |
if ($commentText === '') {
|
245 |
$error = 'Blank comments are not allowed';
|
248 |
$phpcsFile->fixer->replaceToken($stackPtr, '');
|
249 |
}
|
250 |
|
251 |
+
return ($lastCommentToken + 1);
|
252 |
}
|
253 |
|
254 |
if (preg_match('/^\p{Ll}/u', $commentText) === 1) {
|
255 |
$error = 'Inline comments must start with a capital letter';
|
256 |
+
$phpcsFile->addError($error, $stackPtr, 'NotCapital');
|
257 |
}
|
258 |
|
259 |
// Only check the end of comment character if the start of the comment
|
275 |
|
276 |
$ender = trim($ender, ' ,');
|
277 |
$data = [$ender];
|
278 |
+
$phpcsFile->addError($error, $lastCommentToken, 'InvalidEndChar', $data);
|
279 |
}
|
280 |
}
|
281 |
|
282 |
// Finally, the line below the last comment cannot be empty if this inline
|
283 |
// comment is on a line by itself.
|
284 |
if ($tokens[$previousContent]['line'] < $tokens[$stackPtr]['line']) {
|
285 |
+
$next = $phpcsFile->findNext(T_WHITESPACE, ($lastCommentToken + 1), null, true);
|
286 |
if ($next === false) {
|
287 |
// Ignore if the comment is the last non-whitespace token in a file.
|
288 |
+
return ($lastCommentToken + 1);
|
289 |
}
|
290 |
|
291 |
if ($tokens[$next]['code'] === T_DOC_COMMENT_OPEN_TAG) {
|
292 |
// If this inline comment is followed by a docblock,
|
293 |
// ignore spacing as docblock/function etc spacing rules
|
294 |
// are likely to conflict with our rules.
|
295 |
+
return ($lastCommentToken + 1);
|
296 |
}
|
297 |
|
298 |
$errorCode = 'SpacingAfter';
|
309 |
}
|
310 |
}
|
311 |
|
312 |
+
for ($i = ($lastCommentToken + 1); $i < $phpcsFile->numTokens; $i++) {
|
313 |
+
if ($tokens[$i]['line'] === ($tokens[$lastCommentToken]['line'] + 1)) {
|
314 |
if ($tokens[$i]['code'] !== T_WHITESPACE) {
|
315 |
+
return ($lastCommentToken + 1);
|
316 |
}
|
317 |
+
} else if ($tokens[$i]['line'] > ($tokens[$lastCommentToken]['line'] + 1)) {
|
318 |
break;
|
319 |
}
|
320 |
}
|
321 |
|
322 |
$error = 'There must be no blank line following an inline comment';
|
323 |
+
$fix = $phpcsFile->addFixableError($error, $lastCommentToken, $errorCode);
|
324 |
if ($fix === true) {
|
325 |
$phpcsFile->fixer->beginChangeset();
|
326 |
+
for ($i = ($lastCommentToken + 1); $i < $next; $i++) {
|
327 |
if ($tokens[$i]['line'] === $tokens[$next]['line']) {
|
328 |
break;
|
329 |
}
|
335 |
}
|
336 |
}//end if
|
337 |
|
338 |
+
return ($lastCommentToken + 1);
|
339 |
+
|
340 |
}//end process()
|
341 |
|
342 |
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Formatting/OperatorBracketSniff.php
CHANGED
@@ -104,6 +104,7 @@ class OperatorBracketSniff implements Sniff
|
|
104 |
T_COLON => true,
|
105 |
T_OPEN_PARENTHESIS => true,
|
106 |
T_OPEN_SQUARE_BRACKET => true,
|
|
|
107 |
T_OPEN_SHORT_ARRAY => true,
|
108 |
T_CASE => true,
|
109 |
];
|
@@ -143,6 +144,7 @@ class OperatorBracketSniff implements Sniff
|
|
143 |
T_CLOSE_SQUARE_BRACKET,
|
144 |
T_MODULUS,
|
145 |
T_NONE,
|
|
|
146 |
];
|
147 |
|
148 |
$allowed += Tokens::$operators;
|
@@ -273,6 +275,7 @@ class OperatorBracketSniff implements Sniff
|
|
273 |
T_DNUMBER => true,
|
274 |
T_STRING => true,
|
275 |
T_CONSTANT_ENCAPSED_STRING => true,
|
|
|
276 |
T_WHITESPACE => true,
|
277 |
T_NS_SEPARATOR => true,
|
278 |
T_THIS => true,
|
@@ -283,6 +286,7 @@ class OperatorBracketSniff implements Sniff
|
|
283 |
T_ISSET => true,
|
284 |
T_ARRAY => true,
|
285 |
T_NONE => true,
|
|
|
286 |
];
|
287 |
|
288 |
// Find the first token in the expression.
|
104 |
T_COLON => true,
|
105 |
T_OPEN_PARENTHESIS => true,
|
106 |
T_OPEN_SQUARE_BRACKET => true,
|
107 |
+
T_OPEN_CURLY_BRACKET => true,
|
108 |
T_OPEN_SHORT_ARRAY => true,
|
109 |
T_CASE => true,
|
110 |
];
|
144 |
T_CLOSE_SQUARE_BRACKET,
|
145 |
T_MODULUS,
|
146 |
T_NONE,
|
147 |
+
T_BITWISE_NOT,
|
148 |
];
|
149 |
|
150 |
$allowed += Tokens::$operators;
|
275 |
T_DNUMBER => true,
|
276 |
T_STRING => true,
|
277 |
T_CONSTANT_ENCAPSED_STRING => true,
|
278 |
+
T_DOUBLE_QUOTED_STRING => true,
|
279 |
T_WHITESPACE => true,
|
280 |
T_NS_SEPARATOR => true,
|
281 |
T_THIS => true,
|
286 |
T_ISSET => true,
|
287 |
T_ARRAY => true,
|
288 |
T_NONE => true,
|
289 |
+
T_BITWISE_NOT => true,
|
290 |
];
|
291 |
|
292 |
// Find the first token in the expression.
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Functions/FunctionDeclarationArgumentSpacingSniff.php
CHANGED
@@ -310,9 +310,9 @@ class FunctionDeclarationArgumentSpacingSniff implements Sniff
|
|
310 |
$fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingAfterHint', $data);
|
311 |
if ($fix === true) {
|
312 |
if ($gap === 0) {
|
313 |
-
$phpcsFile->fixer->addContent($
|
314 |
} else {
|
315 |
-
$phpcsFile->fixer->replaceToken(
|
316 |
}
|
317 |
}
|
318 |
}
|
310 |
$fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingAfterHint', $data);
|
311 |
if ($fix === true) {
|
312 |
if ($gap === 0) {
|
313 |
+
$phpcsFile->fixer->addContent($whitespace, ' ');
|
314 |
} else {
|
315 |
+
$phpcsFile->fixer->replaceToken($whitespace, ' ');
|
316 |
}
|
317 |
}
|
318 |
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Functions/LowercaseFunctionKeywordsSniff.php
CHANGED
@@ -11,6 +11,7 @@ namespace PHP_CodeSniffer\Standards\Squiz\Sniffs\Functions;
|
|
11 |
|
12 |
use PHP_CodeSniffer\Sniffs\Sniff;
|
13 |
use PHP_CodeSniffer\Files\File;
|
|
|
14 |
|
15 |
class LowercaseFunctionKeywordsSniff implements Sniff
|
16 |
{
|
@@ -23,13 +24,11 @@ class LowercaseFunctionKeywordsSniff implements Sniff
|
|
23 |
*/
|
24 |
public function register()
|
25 |
{
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
T_STATIC,
|
32 |
-
];
|
33 |
|
34 |
}//end register()
|
35 |
|
@@ -47,15 +46,20 @@ class LowercaseFunctionKeywordsSniff implements Sniff
|
|
47 |
{
|
48 |
$tokens = $phpcsFile->getTokens();
|
49 |
|
50 |
-
$content
|
51 |
-
|
|
|
52 |
$error = '%s keyword must be lowercase; expected "%s" but found "%s"';
|
53 |
$data = [
|
54 |
strtoupper($content),
|
55 |
-
|
56 |
$content,
|
57 |
];
|
58 |
-
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
|
61 |
}//end process()
|
11 |
|
12 |
use PHP_CodeSniffer\Sniffs\Sniff;
|
13 |
use PHP_CodeSniffer\Files\File;
|
14 |
+
use PHP_CodeSniffer\Util\Tokens;
|
15 |
|
16 |
class LowercaseFunctionKeywordsSniff implements Sniff
|
17 |
{
|
24 |
*/
|
25 |
public function register()
|
26 |
{
|
27 |
+
$tokens = Tokens::$methodPrefixes;
|
28 |
+
$tokens[] = T_FUNCTION;
|
29 |
+
$tokens[] = T_CLOSURE;
|
30 |
+
|
31 |
+
return $tokens;
|
|
|
|
|
32 |
|
33 |
}//end register()
|
34 |
|
46 |
{
|
47 |
$tokens = $phpcsFile->getTokens();
|
48 |
|
49 |
+
$content = $tokens[$stackPtr]['content'];
|
50 |
+
$contentLc = strtolower($content);
|
51 |
+
if ($content !== $contentLc) {
|
52 |
$error = '%s keyword must be lowercase; expected "%s" but found "%s"';
|
53 |
$data = [
|
54 |
strtoupper($content),
|
55 |
+
$contentLc,
|
56 |
$content,
|
57 |
];
|
58 |
+
|
59 |
+
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'FoundUppercase', $data);
|
60 |
+
if ($fix === true) {
|
61 |
+
$phpcsFile->fixer->replaceToken($stackPtr, $contentLc);
|
62 |
+
}
|
63 |
}
|
64 |
|
65 |
}//end process()
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Objects/ObjectMemberCommaSniff.php
CHANGED
@@ -52,7 +52,7 @@ class ObjectMemberCommaSniff implements Sniff
|
|
52 |
$prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
53 |
if ($tokens[$prev]['code'] === T_COMMA) {
|
54 |
$error = 'Last member of object must not be followed by a comma';
|
55 |
-
$fix = $phpcsFile->addFixableError($error, $prev, '
|
56 |
if ($fix === true) {
|
57 |
$phpcsFile->fixer->replaceToken($prev, '');
|
58 |
}
|
52 |
$prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
53 |
if ($tokens[$prev]['code'] === T_COMMA) {
|
54 |
$error = 'Last member of object must not be followed by a comma';
|
55 |
+
$fix = $phpcsFile->addFixableError($error, $prev, 'Found');
|
56 |
if ($fix === true) {
|
57 |
$phpcsFile->fixer->replaceToken($prev, '');
|
58 |
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Operators/ComparisonOperatorUsageSniff.php
CHANGED
@@ -116,7 +116,16 @@ class ComparisonOperatorUsageSniff implements Sniff
|
|
116 |
if (isset($tokens[$i]['scope_closer']) === true) {
|
117 |
break;
|
118 |
}
|
119 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
}//end for
|
121 |
|
122 |
$start = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true);
|
116 |
if (isset($tokens[$i]['scope_closer']) === true) {
|
117 |
break;
|
118 |
}
|
119 |
+
} else if ($tokens[$i]['code'] === T_OPEN_PARENTHESIS) {
|
120 |
+
// Stop if this is the start of a pair of
|
121 |
+
// parentheses that surrounds the inline
|
122 |
+
// IF statement.
|
123 |
+
if (isset($tokens[$i]['parenthesis_closer']) === true
|
124 |
+
&& $tokens[$i]['parenthesis_closer'] >= $stackPtr
|
125 |
+
) {
|
126 |
+
break;
|
127 |
+
}
|
128 |
+
}//end if
|
129 |
}//end for
|
130 |
|
131 |
$start = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true);
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Scope/MethodScopeSniff.php
CHANGED
@@ -22,7 +22,7 @@ class MethodScopeSniff extends AbstractScopeSniff
|
|
22 |
*/
|
23 |
public function __construct()
|
24 |
{
|
25 |
-
parent::__construct(
|
26 |
|
27 |
}//end __construct()
|
28 |
|
@@ -40,14 +40,17 @@ class MethodScopeSniff extends AbstractScopeSniff
|
|
40 |
{
|
41 |
$tokens = $phpcsFile->getTokens();
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
46 |
return;
|
47 |
}
|
48 |
|
49 |
-
|
50 |
-
|
|
|
51 |
return;
|
52 |
}
|
53 |
|
22 |
*/
|
23 |
public function __construct()
|
24 |
{
|
25 |
+
parent::__construct(Tokens::$ooScopeTokens, [T_FUNCTION]);
|
26 |
|
27 |
}//end __construct()
|
28 |
|
40 |
{
|
41 |
$tokens = $phpcsFile->getTokens();
|
42 |
|
43 |
+
// Determine if this is a function which needs to be examined.
|
44 |
+
$conditions = $tokens[$stackPtr]['conditions'];
|
45 |
+
end($conditions);
|
46 |
+
$deepestScope = key($conditions);
|
47 |
+
if ($deepestScope !== $currScope) {
|
48 |
return;
|
49 |
}
|
50 |
|
51 |
+
$methodName = $phpcsFile->getDeclarationName($stackPtr);
|
52 |
+
if ($methodName === null) {
|
53 |
+
// Ignore closures.
|
54 |
return;
|
55 |
}
|
56 |
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Scope/StaticThisUsageSniff.php
CHANGED
@@ -22,7 +22,7 @@ class StaticThisUsageSniff extends AbstractScopeSniff
|
|
22 |
*/
|
23 |
public function __construct()
|
24 |
{
|
25 |
-
parent::__construct([T_CLASS], [T_FUNCTION]);
|
26 |
|
27 |
}//end __construct()
|
28 |
|
@@ -41,6 +41,14 @@ class StaticThisUsageSniff extends AbstractScopeSniff
|
|
41 |
{
|
42 |
$tokens = $phpcsFile->getTokens();
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
// Ignore abstract functions.
|
45 |
if (isset($tokens[$stackPtr]['scope_closer']) === false) {
|
46 |
return;
|
22 |
*/
|
23 |
public function __construct()
|
24 |
{
|
25 |
+
parent::__construct([T_CLASS, T_TRAIT, T_ANON_CLASS], [T_FUNCTION]);
|
26 |
|
27 |
}//end __construct()
|
28 |
|
41 |
{
|
42 |
$tokens = $phpcsFile->getTokens();
|
43 |
|
44 |
+
// Determine if this is a function which needs to be examined.
|
45 |
+
$conditions = $tokens[$stackPtr]['conditions'];
|
46 |
+
end($conditions);
|
47 |
+
$deepestScope = key($conditions);
|
48 |
+
if ($deepestScope !== $currScope) {
|
49 |
+
return;
|
50 |
+
}
|
51 |
+
|
52 |
// Ignore abstract functions.
|
53 |
if (isset($tokens[$stackPtr]['scope_closer']) === false) {
|
54 |
return;
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/WhiteSpace/FunctionSpacingSniff.php
CHANGED
@@ -38,9 +38,9 @@ class FunctionSpacingSniff implements Sniff
|
|
38 |
public $spacingAfterLast = 2;
|
39 |
|
40 |
/**
|
41 |
-
*
|
42 |
*
|
43 |
-
* @var
|
44 |
*/
|
45 |
private $rulesetProperties = null;
|
46 |
|
38 |
public $spacingAfterLast = 2;
|
39 |
|
40 |
/**
|
41 |
+
* Original properties as set in a custom ruleset (if any).
|
42 |
*
|
43 |
+
* @var array
|
44 |
*/
|
45 |
private $rulesetProperties = null;
|
46 |
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/WhiteSpace/ObjectOperatorSpacingSniff.php
CHANGED
@@ -60,6 +60,15 @@ class ObjectOperatorSpacingSniff implements Sniff
|
|
60 |
}
|
61 |
}
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
if ($tokens[($stackPtr + 1)]['code'] !== T_WHITESPACE) {
|
64 |
$after = 0;
|
65 |
} else {
|
@@ -70,10 +79,7 @@ class ObjectOperatorSpacingSniff implements Sniff
|
|
70 |
}
|
71 |
}
|
72 |
|
73 |
-
$phpcsFile->recordMetric($stackPtr, 'Spacing before object operator', $before);
|
74 |
$phpcsFile->recordMetric($stackPtr, 'Spacing after object operator', $after);
|
75 |
-
|
76 |
-
$this->checkSpacingBeforeOperator($phpcsFile, $stackPtr, $before);
|
77 |
$this->checkSpacingAfterOperator($phpcsFile, $stackPtr, $after);
|
78 |
|
79 |
}//end process()
|
@@ -98,7 +104,16 @@ class ObjectOperatorSpacingSniff implements Sniff
|
|
98 |
$error = 'Space found before object operator';
|
99 |
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'Before');
|
100 |
if ($fix === true) {
|
101 |
-
$phpcsFile->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
}
|
103 |
|
104 |
return false;
|
@@ -128,7 +143,16 @@ class ObjectOperatorSpacingSniff implements Sniff
|
|
128 |
$error = 'Space found after object operator';
|
129 |
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'After');
|
130 |
if ($fix === true) {
|
131 |
-
$phpcsFile->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
|
134 |
return false;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
$phpcsFile->recordMetric($stackPtr, 'Spacing before object operator', $before);
|
64 |
+
$this->checkSpacingBeforeOperator($phpcsFile, $stackPtr, $before);
|
65 |
+
|
66 |
+
if (isset($tokens[($stackPtr + 1)]) === false
|
67 |
+
|| isset($tokens[($stackPtr + 2)]) === false
|
68 |
+
) {
|
69 |
+
return;
|
70 |
+
}
|
71 |
+
|
72 |
if ($tokens[($stackPtr + 1)]['code'] !== T_WHITESPACE) {
|
73 |
$after = 0;
|
74 |
} else {
|
79 |
}
|
80 |
}
|
81 |
|
|
|
82 |
$phpcsFile->recordMetric($stackPtr, 'Spacing after object operator', $after);
|
|
|
|
|
83 |
$this->checkSpacingAfterOperator($phpcsFile, $stackPtr, $after);
|
84 |
|
85 |
}//end process()
|
104 |
$error = 'Space found before object operator';
|
105 |
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'Before');
|
106 |
if ($fix === true) {
|
107 |
+
$tokens = $phpcsFile->getTokens();
|
108 |
+
$curPos = ($stackPtr - 1);
|
109 |
+
|
110 |
+
$phpcsFile->fixer->beginChangeset();
|
111 |
+
while ($tokens[$curPos]['code'] === T_WHITESPACE) {
|
112 |
+
$phpcsFile->fixer->replaceToken($curPos, '');
|
113 |
+
--$curPos;
|
114 |
+
}
|
115 |
+
|
116 |
+
$phpcsFile->fixer->endChangeset();
|
117 |
}
|
118 |
|
119 |
return false;
|
143 |
$error = 'Space found after object operator';
|
144 |
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'After');
|
145 |
if ($fix === true) {
|
146 |
+
$tokens = $phpcsFile->getTokens();
|
147 |
+
$curPos = ($stackPtr + 1);
|
148 |
+
|
149 |
+
$phpcsFile->fixer->beginChangeset();
|
150 |
+
while ($tokens[$curPos]['code'] === T_WHITESPACE) {
|
151 |
+
$phpcsFile->fixer->replaceToken($curPos, '');
|
152 |
+
++$curPos;
|
153 |
+
}
|
154 |
+
|
155 |
+
$phpcsFile->fixer->endChangeset();
|
156 |
}
|
157 |
|
158 |
return false;
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/WhiteSpace/OperatorSpacingSniff.php
CHANGED
@@ -332,6 +332,7 @@ class OperatorSpacingSniff implements Sniff
|
|
332 |
T_INLINE_THEN => true,
|
333 |
T_INLINE_ELSE => true,
|
334 |
T_CASE => true,
|
|
|
335 |
];
|
336 |
|
337 |
if (isset($invalidTokens[$tokens[$prev]['code']]) === true) {
|
332 |
T_INLINE_THEN => true,
|
333 |
T_INLINE_ELSE => true,
|
334 |
T_CASE => true,
|
335 |
+
T_OPEN_CURLY_BRACKET => true,
|
336 |
];
|
337 |
|
338 |
if (isset($invalidTokens[$tokens[$prev]['code']]) === true) {
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/ClassFileNameUnitTest.inc
CHANGED
@@ -3,12 +3,20 @@
|
|
3 |
|
4 |
// Valid class name (matching filename).
|
5 |
class ClassFileNameUnitTest {}
|
|
|
|
|
6 |
|
7 |
|
8 |
// Invalid filename matching class name (case sensitive).
|
9 |
class classFileNameUnitTest {}
|
10 |
class classfilenameunittest {}
|
11 |
class CLASSFILENAMEUNITTEST {}
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
|
14 |
// Invalid non-filename matching class names.
|
@@ -16,6 +24,14 @@ class CompletelyWrongClassName {}
|
|
16 |
class ClassFileNameUnitTestExtra {}
|
17 |
class ClassFileNameUnitTestInc {}
|
18 |
class ExtraClassFileNameUnitTest {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
|
21 |
?>
|
3 |
|
4 |
// Valid class name (matching filename).
|
5 |
class ClassFileNameUnitTest {}
|
6 |
+
interface ClassFileNameUnitTest {}
|
7 |
+
trait ClassFileNameUnitTest {}
|
8 |
|
9 |
|
10 |
// Invalid filename matching class name (case sensitive).
|
11 |
class classFileNameUnitTest {}
|
12 |
class classfilenameunittest {}
|
13 |
class CLASSFILENAMEUNITTEST {}
|
14 |
+
interface classFileNameUnitTest {}
|
15 |
+
interface classfilenameunittest {}
|
16 |
+
interface CLASSFILENAMEUNITTEST {}
|
17 |
+
trait classFileNameUnitTest {}
|
18 |
+
trait classfilenameunittest {}
|
19 |
+
trait CLASSFILENAMEUNITTEST {}
|
20 |
|
21 |
|
22 |
// Invalid non-filename matching class names.
|
24 |
class ClassFileNameUnitTestExtra {}
|
25 |
class ClassFileNameUnitTestInc {}
|
26 |
class ExtraClassFileNameUnitTest {}
|
27 |
+
interface CompletelyWrongClassName {}
|
28 |
+
interface ClassFileNameUnitTestExtra {}
|
29 |
+
interface ClassFileNameUnitTestInc {}
|
30 |
+
interface ExtraClassFileNameUnitTest {}
|
31 |
+
trait CompletelyWrongClassName {}
|
32 |
+
trait ClassFileNameUnitTestExtra {}
|
33 |
+
trait ClassFileNameUnitTestInc {}
|
34 |
+
trait ExtraClassFileNameUnitTest {}
|
35 |
|
36 |
|
37 |
?>
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/ClassFileNameUnitTest.php
CHANGED
@@ -26,13 +26,27 @@ class ClassFileNameUnitTest extends AbstractSniffUnitTest
|
|
26 |
public function getErrorList()
|
27 |
{
|
28 |
return [
|
29 |
-
9 => 1,
|
30 |
-
10 => 1,
|
31 |
11 => 1,
|
|
|
|
|
|
|
32 |
15 => 1,
|
33 |
16 => 1,
|
34 |
17 => 1,
|
35 |
18 => 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
];
|
37 |
|
38 |
}//end getErrorList()
|
26 |
public function getErrorList()
|
27 |
{
|
28 |
return [
|
|
|
|
|
29 |
11 => 1,
|
30 |
+
12 => 1,
|
31 |
+
13 => 1,
|
32 |
+
14 => 1,
|
33 |
15 => 1,
|
34 |
16 => 1,
|
35 |
17 => 1,
|
36 |
18 => 1,
|
37 |
+
19 => 1,
|
38 |
+
23 => 1,
|
39 |
+
24 => 1,
|
40 |
+
25 => 1,
|
41 |
+
26 => 1,
|
42 |
+
27 => 1,
|
43 |
+
28 => 1,
|
44 |
+
29 => 1,
|
45 |
+
30 => 1,
|
46 |
+
31 => 1,
|
47 |
+
32 => 1,
|
48 |
+
33 => 1,
|
49 |
+
34 => 1,
|
50 |
];
|
51 |
|
52 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/SelfMemberReferenceUnitTest.inc
CHANGED
@@ -31,6 +31,19 @@ class SelfMemberReferenceUnitTestExample
|
|
31 |
$testResults[] = self:: selfMemberReferenceUnitTestFunction();
|
32 |
$testResults[] = self :: selfMemberReferenceUnitTestFunction();
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
|
36 |
|
@@ -53,7 +66,7 @@ class MyClass {
|
|
53 |
|
54 |
public static function walk() {
|
55 |
$callback = function($value, $key) {
|
56 |
-
// This is valid because you
|
57 |
MyClass::test($value);
|
58 |
};
|
59 |
|
@@ -119,3 +132,43 @@ class Baz {
|
|
119 |
\Foo\Bar\Baz::something();
|
120 |
}
|
121 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
$testResults[] = self:: selfMemberReferenceUnitTestFunction();
|
32 |
$testResults[] = self :: selfMemberReferenceUnitTestFunction();
|
33 |
|
34 |
+
// Remove ALL the newlines
|
35 |
+
$testResults[] = self
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
::
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
selfMemberReferenceUnitTestFunction();
|
46 |
+
|
47 |
}
|
48 |
|
49 |
|
66 |
|
67 |
public static function walk() {
|
68 |
$callback = function($value, $key) {
|
69 |
+
// This is valid because you can't use self:: in a closure.
|
70 |
MyClass::test($value);
|
71 |
};
|
72 |
|
132 |
\Foo\Bar\Baz::something();
|
133 |
}
|
134 |
}
|
135 |
+
|
136 |
+
class Nested_Anon_Class {
|
137 |
+
public function getAnonymousClass() {
|
138 |
+
// Spacing/comments should not cause false negatives for the NotUsed error.
|
139 |
+
Nested_Anon_Class :: $prop;
|
140 |
+
Nested_Anon_Class
|
141 |
+
/* some comment */
|
142 |
+
|
143 |
+
::
|
144 |
+
|
145 |
+
// phpcs:ignore Standard.Category.SniffName -- for reasons.
|
146 |
+
Bar();
|
147 |
+
|
148 |
+
// Anonymous class is a different scope.
|
149 |
+
return new class() {
|
150 |
+
public function nested_function() {
|
151 |
+
Nested_Anon_Class::$prop;
|
152 |
+
Nested_Anon_Class::BAR;
|
153 |
+
}
|
154 |
+
};
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
// Test dealing with scoped namespaces.
|
159 |
+
namespace Foo\Baz {
|
160 |
+
class BarFoo {
|
161 |
+
public function foo() {
|
162 |
+
echo Foo\Baz\BarFoo::$prop;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
// Prevent false negative when namespace has whitespace/comments.
|
168 |
+
namespace Foo /*comment*/ \ Bah {
|
169 |
+
class BarFoo {
|
170 |
+
public function foo() {
|
171 |
+
echo Foo \ /*comment*/ Bah\BarFoo::$prop;
|
172 |
+
}
|
173 |
+
}
|
174 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/SelfMemberReferenceUnitTest.inc.fixed
CHANGED
@@ -31,6 +31,9 @@ class SelfMemberReferenceUnitTestExample
|
|
31 |
$testResults[] = self::selfMemberReferenceUnitTestFunction();
|
32 |
$testResults[] = self::selfMemberReferenceUnitTestFunction();
|
33 |
|
|
|
|
|
|
|
34 |
}
|
35 |
|
36 |
|
@@ -53,7 +56,7 @@ class MyClass {
|
|
53 |
|
54 |
public static function walk() {
|
55 |
$callback = function($value, $key) {
|
56 |
-
// This is valid because you
|
57 |
MyClass::test($value);
|
58 |
};
|
59 |
|
@@ -119,3 +122,41 @@ class Baz {
|
|
119 |
self::something();
|
120 |
}
|
121 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
$testResults[] = self::selfMemberReferenceUnitTestFunction();
|
32 |
$testResults[] = self::selfMemberReferenceUnitTestFunction();
|
33 |
|
34 |
+
// Remove ALL the newlines
|
35 |
+
$testResults[] = self::selfMemberReferenceUnitTestFunction();
|
36 |
+
|
37 |
}
|
38 |
|
39 |
|
56 |
|
57 |
public static function walk() {
|
58 |
$callback = function($value, $key) {
|
59 |
+
// This is valid because you can't use self:: in a closure.
|
60 |
MyClass::test($value);
|
61 |
};
|
62 |
|
122 |
self::something();
|
123 |
}
|
124 |
}
|
125 |
+
|
126 |
+
class Nested_Anon_Class {
|
127 |
+
public function getAnonymousClass() {
|
128 |
+
// Spacing/comments should not cause false negatives for the NotUsed error.
|
129 |
+
self::$prop;
|
130 |
+
|
131 |
+
/* some comment */
|
132 |
+
|
133 |
+
self::// phpcs:ignore Standard.Category.SniffName -- for reasons.
|
134 |
+
Bar();
|
135 |
+
|
136 |
+
// Anonymous class is a different scope.
|
137 |
+
return new class() {
|
138 |
+
public function nested_function() {
|
139 |
+
Nested_Anon_Class::$prop;
|
140 |
+
Nested_Anon_Class::BAR;
|
141 |
+
}
|
142 |
+
};
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
// Test dealing with scoped namespaces.
|
147 |
+
namespace Foo\Baz {
|
148 |
+
class BarFoo {
|
149 |
+
public function foo() {
|
150 |
+
echo self::$prop;
|
151 |
+
}
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
// Prevent false negative when namespace has whitespace/comments.
|
156 |
+
namespace Foo /*comment*/ \ Bah {
|
157 |
+
class BarFoo {
|
158 |
+
public function foo() {
|
159 |
+
echo /*comment*/ self::$prop;
|
160 |
+
}
|
161 |
+
}
|
162 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/SelfMemberReferenceUnitTest.php
CHANGED
@@ -32,9 +32,15 @@ class SelfMemberReferenceUnitTest extends AbstractSniffUnitTest
|
|
32 |
30 => 1,
|
33 |
31 => 1,
|
34 |
32 => 2,
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
];
|
39 |
|
40 |
}//end getErrorList()
|
32 |
30 => 1,
|
33 |
31 => 1,
|
34 |
32 => 2,
|
35 |
+
40 => 2,
|
36 |
+
92 => 1,
|
37 |
+
121 => 1,
|
38 |
+
132 => 1,
|
39 |
+
139 => 3,
|
40 |
+
140 => 1,
|
41 |
+
143 => 2,
|
42 |
+
162 => 1,
|
43 |
+
171 => 1,
|
44 |
];
|
45 |
|
46 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/ValidClassNameUnitTest.inc
CHANGED
@@ -139,3 +139,9 @@ trait Base
|
|
139 |
|
140 |
if ( class_exists( Test :: class ) ) {}
|
141 |
if ( class_exists( Test2 ::class ) ) {}
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
if ( class_exists( Test :: class ) ) {}
|
141 |
if ( class_exists( Test2 ::class ) ) {}
|
142 |
+
|
143 |
+
$foo = new class(
|
144 |
+
new class implements Countable {
|
145 |
+
}
|
146 |
+
) extends DateTime {
|
147 |
+
};
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/InlineCommentUnitTest.inc
CHANGED
@@ -139,6 +139,16 @@ class Foo
|
|
139 |
function bar(){}
|
140 |
}
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
/*
|
143 |
* N.B.: The below test line must be the last test in the file.
|
144 |
* Testing that a new line after an inline comment when it's the last non-whitespace
|
139 |
function bar(){}
|
140 |
}
|
141 |
|
142 |
+
if ($foo) {
|
143 |
+
}//end if
|
144 |
+
// Another comment here.
|
145 |
+
$foo++;
|
146 |
+
|
147 |
+
if ($foo) {
|
148 |
+
}//end if
|
149 |
+
// another comment here.
|
150 |
+
$foo++;
|
151 |
+
|
152 |
/*
|
153 |
* N.B.: The below test line must be the last test in the file.
|
154 |
* Testing that a new line after an inline comment when it's the last non-whitespace
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/InlineCommentUnitTest.inc.fixed
CHANGED
@@ -132,6 +132,16 @@ class Foo
|
|
132 |
function bar(){}
|
133 |
}
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
/*
|
136 |
* N.B.: The below test line must be the last test in the file.
|
137 |
* Testing that a new line after an inline comment when it's the last non-whitespace
|
132 |
function bar(){}
|
133 |
}
|
134 |
|
135 |
+
if ($foo) {
|
136 |
+
}//end if
|
137 |
+
// Another comment here.
|
138 |
+
$foo++;
|
139 |
+
|
140 |
+
if ($foo) {
|
141 |
+
}//end if
|
142 |
+
// another comment here.
|
143 |
+
$foo++;
|
144 |
+
|
145 |
/*
|
146 |
* N.B.: The below test line must be the last test in the file.
|
147 |
* Testing that a new line after an inline comment when it's the last non-whitespace
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/InlineCommentUnitTest.php
CHANGED
@@ -46,6 +46,7 @@ class InlineCommentUnitTest extends AbstractSniffUnitTest
|
|
46 |
118 => 1,
|
47 |
126 => 2,
|
48 |
130 => 2,
|
|
|
49 |
];
|
50 |
|
51 |
return $errors;
|
46 |
118 => 1,
|
47 |
126 => 2,
|
48 |
130 => 2,
|
49 |
+
149 => 1,
|
50 |
];
|
51 |
|
52 |
return $errors;
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Formatting/OperatorBracketUnitTest.inc
CHANGED
@@ -163,3 +163,7 @@ $var = $foo['blah'] + [];
|
|
163 |
$a = 2 * ${x} - ${minus};
|
164 |
|
165 |
$foo = $bar ?? $baz ?? '';
|
|
|
|
|
|
|
|
163 |
$a = 2 * ${x} - ${minus};
|
164 |
|
165 |
$foo = $bar ?? $baz ?? '';
|
166 |
+
|
167 |
+
$foo = $myString{-1};
|
168 |
+
|
169 |
+
$value = (binary) $blah + b"binary $foo";
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Formatting/OperatorBracketUnitTest.inc.fixed
CHANGED
@@ -163,3 +163,7 @@ $var = ($foo['blah'] + []);
|
|
163 |
$a = 2 * ${x} - ${minus};
|
164 |
|
165 |
$foo = ($bar ?? $baz ?? '');
|
|
|
|
|
|
|
|
163 |
$a = 2 * ${x} - ${minus};
|
164 |
|
165 |
$foo = ($bar ?? $baz ?? '');
|
166 |
+
|
167 |
+
$foo = $myString{-1};
|
168 |
+
|
169 |
+
$value = ((binary) $blah + b"binary $foo");
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Formatting/OperatorBracketUnitTest.php
CHANGED
@@ -65,6 +65,7 @@ class OperatorBracketUnitTest extends AbstractSniffUnitTest
|
|
65 |
161 => 1,
|
66 |
163 => 2,
|
67 |
165 => 2,
|
|
|
68 |
];
|
69 |
break;
|
70 |
case 'OperatorBracketUnitTest.js':
|
65 |
161 => 1,
|
66 |
163 => 2,
|
67 |
165 => 2,
|
68 |
+
169 => 1,
|
69 |
];
|
70 |
break;
|
71 |
case 'OperatorBracketUnitTest.js':
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Functions/FunctionDeclarationArgumentSpacingUnitTest.inc
CHANGED
@@ -87,3 +87,11 @@ function foo( // comment
|
|
87 |
|
88 |
function myFunc(/*...*/) {}
|
89 |
function myFunc( /*...*/ ) {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
function myFunc(/*...*/) {}
|
89 |
function myFunc( /*...*/ ) {}
|
90 |
+
|
91 |
+
function x(
|
92 |
+
?array $a,
|
93 |
+
?MyNamespace\MyClass $b,
|
94 |
+
?array $c,
|
95 |
+
?int $d
|
96 |
+
) {
|
97 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Functions/FunctionDeclarationArgumentSpacingUnitTest.inc.fixed
CHANGED
@@ -87,3 +87,11 @@ function foo( // comment
|
|
87 |
|
88 |
function myFunc(/*...*/) {}
|
89 |
function myFunc(/*...*/) {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
function myFunc(/*...*/) {}
|
89 |
function myFunc(/*...*/) {}
|
90 |
+
|
91 |
+
function x(
|
92 |
+
?array $a,
|
93 |
+
?MyNamespace\MyClass $b,
|
94 |
+
?array $c,
|
95 |
+
?int $d
|
96 |
+
) {
|
97 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Functions/FunctionDeclarationArgumentSpacingUnitTest.php
CHANGED
@@ -51,6 +51,10 @@ class FunctionDeclarationArgumentSpacingUnitTest extends AbstractSniffUnitTest
|
|
51 |
76 => 1,
|
52 |
81 => 1,
|
53 |
89 => 2,
|
|
|
|
|
|
|
|
|
54 |
];
|
55 |
|
56 |
}//end getErrorList()
|
51 |
76 => 1,
|
52 |
81 => 1,
|
53 |
89 => 2,
|
54 |
+
92 => 1,
|
55 |
+
93 => 1,
|
56 |
+
94 => 1,
|
57 |
+
95 => 1,
|
58 |
];
|
59 |
|
60 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Functions/LowercaseFunctionKeywordsUnitTest.inc
CHANGED
@@ -1,7 +1,26 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
// Correct.
|
3 |
+
function Foo() {}
|
4 |
+
$a = function() {};
|
5 |
+
|
6 |
+
abstract class Foo {
|
7 |
+
public function PublicFunction() {}
|
8 |
+
private function PrivateFunction() {}
|
9 |
+
protected function ProtectedFunction() {}
|
10 |
+
static function StaticFunction() {}
|
11 |
+
abstract protected function AbstractProtectedFunction();
|
12 |
+
final static public function FinalStaticPublicFunction() {}
|
13 |
+
}
|
14 |
+
|
15 |
+
// Incorrect.
|
16 |
+
Function Bar() {}
|
17 |
+
$a = FUNCTION() {};
|
18 |
+
|
19 |
+
abstract class Bar {
|
20 |
+
Public function PublicFunction() {}
|
21 |
+
Private function PrivateFunction() {}
|
22 |
+
Protected function ProtectedFunction() {}
|
23 |
+
Static function StaticFunction() {}
|
24 |
+
ABSTRACT proTECted FUNCTION AbstractProtectedFunction();
|
25 |
+
Final STATIC PUBLIC Function FinalStaticPublicFunction() {}
|
26 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Functions/LowercaseFunctionKeywordsUnitTest.inc.fixed
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Correct.
|
3 |
+
function Foo() {}
|
4 |
+
$a = function() {};
|
5 |
+
|
6 |
+
abstract class Foo {
|
7 |
+
public function PublicFunction() {}
|
8 |
+
private function PrivateFunction() {}
|
9 |
+
protected function ProtectedFunction() {}
|
10 |
+
static function StaticFunction() {}
|
11 |
+
abstract protected function AbstractProtectedFunction();
|
12 |
+
final static public function FinalStaticPublicFunction() {}
|
13 |
+
}
|
14 |
+
|
15 |
+
// Incorrect.
|
16 |
+
function Bar() {}
|
17 |
+
$a = function() {};
|
18 |
+
|
19 |
+
abstract class Bar {
|
20 |
+
public function PublicFunction() {}
|
21 |
+
private function PrivateFunction() {}
|
22 |
+
protected function ProtectedFunction() {}
|
23 |
+
static function StaticFunction() {}
|
24 |
+
abstract protected function AbstractProtectedFunction();
|
25 |
+
final static public function FinalStaticPublicFunction() {}
|
26 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Functions/LowercaseFunctionKeywordsUnitTest.php
CHANGED
@@ -26,11 +26,14 @@ class LowercaseFunctionKeywordsUnitTest extends AbstractSniffUnitTest
|
|
26 |
public function getErrorList()
|
27 |
{
|
28 |
return [
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
34 |
];
|
35 |
|
36 |
}//end getErrorList()
|
26 |
public function getErrorList()
|
27 |
{
|
28 |
return [
|
29 |
+
16 => 1,
|
30 |
+
17 => 1,
|
31 |
+
20 => 1,
|
32 |
+
21 => 1,
|
33 |
+
22 => 1,
|
34 |
+
23 => 1,
|
35 |
+
24 => 3,
|
36 |
+
25 => 4,
|
37 |
];
|
38 |
|
39 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Objects/ObjectMemberCommaUnitTest.js
CHANGED
@@ -37,3 +37,11 @@ AssetListingEditWidgetType.prototype = {
|
|
37 |
{
|
38 |
},
|
39 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
{
|
38 |
},
|
39 |
};
|
40 |
+
|
41 |
+
AssetListingEditWidgetType.prototype = {
|
42 |
+
// phpcs: disable Standard.Cat.SniffName -- testing annotation between closing brace and comma
|
43 |
+
init: function(data, assetid, editables)
|
44 |
+
{
|
45 |
+
},
|
46 |
+
// phpcs:enable
|
47 |
+
};
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Objects/ObjectMemberCommaUnitTest.js.fixed
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
this.request({ action: 'getTypeFormatContents' });
|
2 |
+
|
3 |
+
addTypeFormatButton.addClickEvent(function() {
|
4 |
+
self.addNewTypeFormat();
|
5 |
+
});
|
6 |
+
|
7 |
+
var x = {};
|
8 |
+
|
9 |
+
var y = {
|
10 |
+
VarOne : 'If you ask me, thats if you ask',
|
11 |
+
VarTwo : ['Alonzo played you', 'for a fool', 'esse'],
|
12 |
+
VarThree: function(arg) {
|
13 |
+
console.info(1);
|
14 |
+
}
|
15 |
+
};
|
16 |
+
|
17 |
+
var z = {
|
18 |
+
VarOne : 'If you ask me, thats if you ask',
|
19 |
+
VarTwo : ['Alonzo played you', 'for a fool', 'esse'],
|
20 |
+
VarThree: function(arg) {
|
21 |
+
console.info(1);
|
22 |
+
}
|
23 |
+
};
|
24 |
+
|
25 |
+
var x = function() {
|
26 |
+
console.info(2);
|
27 |
+
};
|
28 |
+
|
29 |
+
AssetListingEditWidgetType.prototype = {
|
30 |
+
init: function(data, assetid, editables)
|
31 |
+
{
|
32 |
+
}
|
33 |
+
};
|
34 |
+
|
35 |
+
AssetListingEditWidgetType.prototype = {
|
36 |
+
init: function(data, assetid, editables)
|
37 |
+
{
|
38 |
+
}
|
39 |
+
};
|
40 |
+
|
41 |
+
AssetListingEditWidgetType.prototype = {
|
42 |
+
// phpcs: disable Standard.Cat.SniffName -- testing annotation between closing brace and comma
|
43 |
+
init: function(data, assetid, editables)
|
44 |
+
{
|
45 |
+
}
|
46 |
+
// phpcs:enable
|
47 |
+
};
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Objects/ObjectMemberCommaUnitTest.php
CHANGED
@@ -21,20 +21,15 @@ class ObjectMemberCommaUnitTest extends AbstractSniffUnitTest
|
|
21 |
* The key of the array should represent the line number and the value
|
22 |
* should represent the number of errors that should occur on that line.
|
23 |
*
|
24 |
-
* @param string $testFile The name of the file being tested.
|
25 |
-
*
|
26 |
* @return array<int, int>
|
27 |
*/
|
28 |
-
public function getErrorList(
|
29 |
{
|
30 |
-
if ($testFile !== 'ObjectMemberCommaUnitTest.js') {
|
31 |
-
return [];
|
32 |
-
}
|
33 |
-
|
34 |
return [
|
35 |
1 => 1,
|
36 |
22 => 1,
|
37 |
38 => 1,
|
|
|
38 |
];
|
39 |
|
40 |
}//end getErrorList()
|
21 |
* The key of the array should represent the line number and the value
|
22 |
* should represent the number of errors that should occur on that line.
|
23 |
*
|
|
|
|
|
24 |
* @return array<int, int>
|
25 |
*/
|
26 |
+
public function getErrorList()
|
27 |
{
|
|
|
|
|
|
|
|
|
28 |
return [
|
29 |
1 => 1,
|
30 |
22 => 1,
|
31 |
38 => 1,
|
32 |
+
45 => 1,
|
33 |
];
|
34 |
|
35 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Operators/ComparisonOperatorUsageUnitTest.inc
CHANGED
@@ -134,3 +134,5 @@ function foo(string $bar, array $baz, ?MyClass $object) : MyClass {}
|
|
134 |
|
135 |
if (empty($argTags > 0)) {
|
136 |
}
|
|
|
|
134 |
|
135 |
if (empty($argTags > 0)) {
|
136 |
}
|
137 |
+
|
138 |
+
myFunction($var1 === true ? "" : "foobar");
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/MethodScopeUnitTest.inc
CHANGED
@@ -31,4 +31,12 @@ trait Trait_Test {
|
|
31 |
public function func1() {}
|
32 |
private function func1() {}
|
33 |
protected function func1() {}
|
34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
public function func1() {}
|
32 |
private function func1() {}
|
33 |
protected function func1() {}
|
34 |
+
}
|
35 |
+
|
36 |
+
class Nested {
|
37 |
+
public function getAnonymousClass() {
|
38 |
+
return new class() {
|
39 |
+
function __something() {}
|
40 |
+
};
|
41 |
+
}
|
42 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/MethodScopeUnitTest.php
CHANGED
@@ -28,6 +28,7 @@ class MethodScopeUnitTest extends AbstractSniffUnitTest
|
|
28 |
return [
|
29 |
6 => 1,
|
30 |
30 => 1,
|
|
|
31 |
];
|
32 |
|
33 |
}//end getErrorList()
|
28 |
return [
|
29 |
6 => 1,
|
30 |
30 => 1,
|
31 |
+
39 => 1,
|
32 |
];
|
33 |
|
34 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/StaticThisUsageUnitTest.inc
CHANGED
@@ -54,4 +54,25 @@ class MyClass
|
|
54 |
}
|
55 |
};
|
56 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
54 |
}
|
55 |
};
|
56 |
}
|
57 |
+
|
58 |
+
public function getAnonymousClass() {
|
59 |
+
return new class() {
|
60 |
+
public static function something() {
|
61 |
+
$this->doSomething();
|
62 |
+
}
|
63 |
+
};
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
trait MyTrait {
|
68 |
+
public static function myFunc() {
|
69 |
+
$this->doSomething();
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
$b = new class()
|
74 |
+
{
|
75 |
+
public static function myFunc() {
|
76 |
+
$this->doSomething();
|
77 |
+
}
|
78 |
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/StaticThisUsageUnitTest.php
CHANGED
@@ -31,6 +31,9 @@ class StaticThisUsageUnitTest extends AbstractSniffUnitTest
|
|
31 |
9 => 1,
|
32 |
14 => 1,
|
33 |
20 => 1,
|
|
|
|
|
|
|
34 |
];
|
35 |
|
36 |
}//end getErrorList()
|
31 |
9 => 1,
|
32 |
14 => 1,
|
33 |
20 => 1,
|
34 |
+
61 => 1,
|
35 |
+
69 => 1,
|
36 |
+
76 => 1,
|
37 |
];
|
38 |
|
39 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/CastSpacingUnitTest.inc
CHANGED
@@ -4,4 +4,6 @@ $var = ( int ) $var2;
|
|
4 |
$var = (int ) $var2;
|
5 |
$var = ( int) $var2;
|
6 |
$var = ( int ) $var2;
|
7 |
-
|
|
|
|
4 |
$var = (int ) $var2;
|
5 |
$var = ( int) $var2;
|
6 |
$var = ( int ) $var2;
|
7 |
+
|
8 |
+
$var = (binary) $var2;
|
9 |
+
$var = ( binary ) $var2;
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/CastSpacingUnitTest.inc.fixed
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$var = (int) $var2;
|
3 |
+
$var = (int) $var2;
|
4 |
+
$var = (int) $var2;
|
5 |
+
$var = (int) $var2;
|
6 |
+
$var = (int) $var2;
|
7 |
+
|
8 |
+
$var = (binary) $var2;
|
9 |
+
$var = (binary) $var2;
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/CastSpacingUnitTest.php
CHANGED
@@ -30,6 +30,7 @@ class CastSpacingUnitTest extends AbstractSniffUnitTest
|
|
30 |
4 => 1,
|
31 |
5 => 1,
|
32 |
6 => 1,
|
|
|
33 |
];
|
34 |
|
35 |
}//end getErrorList()
|
30 |
4 => 1,
|
31 |
5 => 1,
|
32 |
6 => 1,
|
33 |
+
9 => 1,
|
34 |
];
|
35 |
|
36 |
}//end getErrorList()
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/FunctionSpacingUnitTest.inc
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Comment
|
4 |
*/
|
5 |
-
|
6 |
|
7 |
include $blah;
|
8 |
|
2 |
/**
|
3 |
* Comment
|
4 |
*/
|
5 |
+
use Foo\{function bar, const BAZ};
|
6 |
|
7 |
include $blah;
|
8 |
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/FunctionSpacingUnitTest.inc.fixed
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Comment
|
4 |
*/
|
5 |
-
|
6 |
|
7 |
include $blah;
|
8 |
|
2 |
/**
|
3 |
* Comment
|
4 |
*/
|
5 |
+
use Foo\{function bar, const BAZ};
|
6 |
|
7 |
include $blah;
|
8 |
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ObjectOperatorSpacingUnitTest.inc
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
$this->testThis();
|
3 |
$this-> testThis();
|
4 |
$this -> testThis();
|
5 |
-
$this
|
6 |
$this/* comment here */ -> testThis();
|
7 |
$this
|
8 |
->testThis();
|
2 |
$this->testThis();
|
3 |
$this-> testThis();
|
4 |
$this -> testThis();
|
5 |
+
$this-> /* comment here */testThis();
|
6 |
$this/* comment here */ -> testThis();
|
7 |
$this
|
8 |
->testThis();
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ObjectOperatorSpacingUnitTest.php
CHANGED
@@ -28,6 +28,7 @@ class ObjectOperatorSpacingUnitTest extends AbstractSniffUnitTest
|
|
28 |
return [
|
29 |
3 => 1,
|
30 |
4 => 2,
|
|
|
31 |
6 => 2,
|
32 |
8 => 1,
|
33 |
9 => 1,
|
28 |
return [
|
29 |
3 => 1,
|
30 |
4 => 2,
|
31 |
+
5 => 1,
|
32 |
6 => 2,
|
33 |
8 => 1,
|
34 |
9 => 1,
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.inc
CHANGED
@@ -256,3 +256,7 @@ $foo = is_array($bar) ? array_map(
|
|
256 |
) : $bar;
|
257 |
|
258 |
function bar(): array {}
|
|
|
|
|
|
|
|
256 |
) : $bar;
|
257 |
|
258 |
function bar(): array {}
|
259 |
+
|
260 |
+
if ($line{-1} === ':') {
|
261 |
+
$line = substr($line, 0, -1);
|
262 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.inc.fixed
CHANGED
@@ -250,3 +250,7 @@ $foo = is_array($bar) ? array_map(
|
|
250 |
) : $bar;
|
251 |
|
252 |
function bar(): array {}
|
|
|
|
|
|
|
|
250 |
) : $bar;
|
251 |
|
252 |
function bar(): array {}
|
253 |
+
|
254 |
+
if ($line{-1} === ':') {
|
255 |
+
$line = substr($line, 0, -1);
|
256 |
+
}
|
vendor/squizlabs/php_codesniffer/src/Standards/Squiz/ruleset.xml
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<ruleset name="Squiz">
|
3 |
<description>The Squiz coding standard.</description>
|
4 |
|
5 |
<!-- Include some specific sniffs -->
|
@@ -20,6 +20,7 @@
|
|
20 |
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
|
21 |
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
22 |
<rule ref="Generic.WhiteSpace.LanguageConstructSpacing"/>
|
|
|
23 |
<rule ref="Generic.WhiteSpace.ScopeIndent"/>
|
24 |
<rule ref="PEAR.ControlStructures.MultiLineCondition"/>
|
25 |
<rule ref="PEAR.Files.IncludingFile"/>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Squiz" xsi:noNamespaceSchemaLocation="../../../phpcs.xsd">
|
3 |
<description>The Squiz coding standard.</description>
|
4 |
|
5 |
<!-- Include some specific sniffs -->
|
20 |
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
|
21 |
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
22 |
<rule ref="Generic.WhiteSpace.LanguageConstructSpacing"/>
|
23 |
+
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
|
24 |
<rule ref="Generic.WhiteSpace.ScopeIndent"/>
|
25 |
<rule ref="PEAR.ControlStructures.MultiLineCondition"/>
|
26 |
<rule ref="PEAR.Files.IncludingFile"/>
|
vendor/squizlabs/php_codesniffer/src/Standards/Zend/ruleset.xml
CHANGED
@@ -1,32 +1,32 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<ruleset name="Zend">
|
3 |
-
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
|
32 |
</ruleset>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Zend" xsi:noNamespaceSchemaLocation="../../../phpcs.xsd">
|
3 |
+
<description>A coding standard based on an early Zend Framework coding standard. Note that this standard is out of date.</description>
|
4 |
|
5 |
+
<!-- Include some sniffs from all around the place -->
|
6 |
+
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
|
7 |
+
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/>
|
8 |
+
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
|
9 |
+
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
10 |
+
<rule ref="PEAR.Classes.ClassDeclaration"/>
|
11 |
+
<rule ref="PEAR.ControlStructures.ControlSignature"/>
|
12 |
+
<rule ref="PEAR.Functions.FunctionCallSignature"/>
|
13 |
+
<rule ref="PEAR.Functions.ValidDefaultValue"/>
|
14 |
+
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace"/>
|
15 |
+
<rule ref="Squiz.Functions.GlobalFunction"/>
|
16 |
|
17 |
+
<!-- Lines can be 80 chars long, show errors at 120 chars -->
|
18 |
+
<rule ref="Generic.Files.LineLength">
|
19 |
+
<properties>
|
20 |
+
<property name="lineLimit" value="80"/>
|
21 |
+
<property name="absoluteLineLimit" value="120"/>
|
22 |
+
</properties>
|
23 |
+
</rule>
|
24 |
|
25 |
+
<!-- Use Unix newlines -->
|
26 |
+
<rule ref="Generic.Files.LineEndings">
|
27 |
+
<properties>
|
28 |
+
<property name="eolChar" value="\n"/>
|
29 |
+
</properties>
|
30 |
+
</rule>
|
31 |
|
32 |
</ruleset>
|
vendor/squizlabs/php_codesniffer/src/Tokenizers/CSS.php
CHANGED
@@ -91,6 +91,7 @@ class CSS extends PHP
|
|
91 |
|| $token['code'] === T_FOREACH
|
92 |
|| $token['code'] === T_WHILE
|
93 |
|| $token['code'] === T_DEC
|
|
|
94 |
) {
|
95 |
$token['type'] = 'T_STRING';
|
96 |
$token['code'] = T_STRING;
|
@@ -106,7 +107,7 @@ class CSS extends PHP
|
|
106 |
&& $tokens[($stackPtr + 1)]['content'] === 'PHPCS_CSS_T_OPEN_TAG'
|
107 |
) {
|
108 |
$content = '<?php';
|
109 |
-
for ($stackPtr
|
110 |
if ($tokens[$stackPtr]['code'] === T_BITWISE_XOR
|
111 |
&& $tokens[($stackPtr + 1)]['content'] === 'PHPCS_CSS_T_CLOSE_TAG'
|
112 |
) {
|
91 |
|| $token['code'] === T_FOREACH
|
92 |
|| $token['code'] === T_WHILE
|
93 |
|| $token['code'] === T_DEC
|
94 |
+
|| $token['code'] === T_NEW
|
95 |
) {
|
96 |
$token['type'] = 'T_STRING';
|
97 |
$token['code'] = T_STRING;
|
107 |
&& $tokens[($stackPtr + 1)]['content'] === 'PHPCS_CSS_T_OPEN_TAG'
|
108 |
) {
|
109 |
$content = '<?php';
|
110 |
+
for ($stackPtr += 3; $stackPtr < $numTokens; $stackPtr++) {
|
111 |
if ($tokens[$stackPtr]['code'] === T_BITWISE_XOR
|
112 |
&& $tokens[($stackPtr + 1)]['content'] === 'PHPCS_CSS_T_CLOSE_TAG'
|
113 |
) {
|
vendor/squizlabs/php_codesniffer/src/Tokenizers/JS.php
CHANGED
@@ -1013,7 +1013,7 @@ class JS extends Tokenizer
|
|
1013 |
echo "\t* found end of regular expression at token $regexEnd *".PHP_EOL;
|
1014 |
}
|
1015 |
|
1016 |
-
for ($next
|
1017 |
if ($chars[$next] !== ' ') {
|
1018 |
break;
|
1019 |
} else {
|
1013 |
echo "\t* found end of regular expression at token $regexEnd *".PHP_EOL;
|
1014 |
}
|
1015 |
|
1016 |
+
for ($next += 1; $next < $numChars; $next++) {
|
1017 |
if ($chars[$next] !== ' ') {
|
1018 |
break;
|
1019 |
} else {
|
vendor/squizlabs/php_codesniffer/src/Tokenizers/PHP.php
CHANGED
@@ -635,6 +635,37 @@ class PHP extends Tokenizer
|
|
635 |
continue;
|
636 |
}//end if
|
637 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
638 |
/*
|
639 |
If this is a heredoc, PHP will tokenize the whole
|
640 |
thing which causes problems when heredocs don't
|
@@ -750,7 +781,7 @@ class PHP extends Tokenizer
|
|
750 |
&& $tokens[($stackPtr + 2)][0] === T_STRING
|
751 |
&& strtolower($tokens[($stackPtr + 2)][1]) === 'from'
|
752 |
) {
|
753 |
-
// Could be multi-line, so just
|
754 |
$token[0] = T_YIELD_FROM;
|
755 |
$token[1] = $token[1].$tokens[($stackPtr + 1)][1].$tokens[($stackPtr + 2)][1];
|
756 |
|
@@ -1063,7 +1094,7 @@ class PHP extends Tokenizer
|
|
1063 |
// Non-empty content.
|
1064 |
if (is_array($tokens[$x]) === true && $tokens[$x][0] === T_USE) {
|
1065 |
// Found a use statements, so search ahead for the closing parenthesis.
|
1066 |
-
for ($x
|
1067 |
if (is_array($tokens[$x]) === false && $tokens[$x] === ')') {
|
1068 |
continue(2);
|
1069 |
}
|
@@ -1090,7 +1121,7 @@ class PHP extends Tokenizer
|
|
1090 |
$allowed += Util\Tokens::$emptyTokens;
|
1091 |
|
1092 |
// Find the start of the return type.
|
1093 |
-
for ($x
|
1094 |
if (is_array($tokens[$x]) === true
|
1095 |
&& isset(Util\Tokens::$emptyTokens[$tokens[$x][0]]) === true
|
1096 |
) {
|
@@ -1389,7 +1420,7 @@ class PHP extends Tokenizer
|
|
1389 |
// and T_CONST.
|
1390 |
if (($newToken['code'] === T_FUNCTION
|
1391 |
|| $newToken['code'] === T_CONST)
|
1392 |
-
&& $finalTokens[$lastNotEmptyToken]['code'] === T_USE
|
1393 |
) {
|
1394 |
$newToken['code'] = T_STRING;
|
1395 |
$newToken['type'] = 'T_STRING';
|
@@ -1942,6 +1973,9 @@ class PHP extends Tokenizer
|
|
1942 |
case '|':
|
1943 |
$newToken['type'] = 'T_BITWISE_OR';
|
1944 |
break;
|
|
|
|
|
|
|
1945 |
case '<':
|
1946 |
$newToken['type'] = 'T_LESS_THAN';
|
1947 |
break;
|
635 |
continue;
|
636 |
}//end if
|
637 |
|
638 |
+
/*
|
639 |
+
Detect binary casting and assign the casts their own token.
|
640 |
+
*/
|
641 |
+
|
642 |
+
if ($tokenIsArray === true
|
643 |
+
&& $token[0] === T_CONSTANT_ENCAPSED_STRING
|
644 |
+
&& (substr($token[1], 0, 2) === 'b"'
|
645 |
+
|| substr($token[1], 0, 2) === "b'")
|
646 |
+
) {
|
647 |
+
$finalTokens[$newStackPtr] = [
|
648 |
+
'code' => T_BINARY_CAST,
|
649 |
+
'type' => 'T_BINARY_CAST',
|
650 |
+
'content' => 'b',
|
651 |
+
];
|
652 |
+
$newStackPtr++;
|
653 |
+
$token[1] = substr($token[1], 1);
|
654 |
+
}
|
655 |
+
|
656 |
+
if ($tokenIsArray === true
|
657 |
+
&& $token[0] === T_STRING_CAST
|
658 |
+
&& preg_match('`^\(\s*binary\s*\)$`i', $token[1]) === 1
|
659 |
+
) {
|
660 |
+
$finalTokens[$newStackPtr] = [
|
661 |
+
'code' => T_BINARY_CAST,
|
662 |
+
'type' => 'T_BINARY_CAST',
|
663 |
+
'content' => $token[1],
|
664 |
+
];
|
665 |
+
$newStackPtr++;
|
666 |
+
continue;
|
667 |
+
}
|
668 |
+
|
669 |
/*
|
670 |
If this is a heredoc, PHP will tokenize the whole
|
671 |
thing which causes problems when heredocs don't
|
781 |
&& $tokens[($stackPtr + 2)][0] === T_STRING
|
782 |
&& strtolower($tokens[($stackPtr + 2)][1]) === 'from'
|
783 |
) {
|
784 |
+
// Could be multi-line, so just the token stack.
|
785 |
$token[0] = T_YIELD_FROM;
|
786 |
$token[1] = $token[1].$tokens[($stackPtr + 1)][1].$tokens[($stackPtr + 2)][1];
|
787 |
|
1094 |
// Non-empty content.
|
1095 |
if (is_array($tokens[$x]) === true && $tokens[$x][0] === T_USE) {
|
1096 |
// Found a use statements, so search ahead for the closing parenthesis.
|
1097 |
+
for ($x += 1; $x < $numTokens; $x++) {
|
1098 |
if (is_array($tokens[$x]) === false && $tokens[$x] === ')') {
|
1099 |
continue(2);
|
1100 |
}
|
1121 |
$allowed += Util\Tokens::$emptyTokens;
|
1122 |
|
1123 |
// Find the start of the return type.
|
1124 |
+
for ($x += 1; $x < $numTokens; $x++) {
|
1125 |
if (is_array($tokens[$x]) === true
|
1126 |
&& isset(Util\Tokens::$emptyTokens[$tokens[$x][0]]) === true
|
1127 |
) {
|
1420 |
// and T_CONST.
|
1421 |
if (($newToken['code'] === T_FUNCTION
|
1422 |
|| $newToken['code'] === T_CONST)
|
1423 |
+
&& ($finalTokens[$lastNotEmptyToken]['code'] === T_USE || $insideUseGroup === true)
|
1424 |
) {
|
1425 |
$newToken['code'] = T_STRING;
|
1426 |
$newToken['type'] = 'T_STRING';
|
1973 |
case '|':
|
1974 |
$newToken['type'] = 'T_BITWISE_OR';
|
1975 |
break;
|
1976 |
+
case '~':
|
1977 |
+
$newToken['type'] = 'T_BITWISE_NOT';
|
1978 |
+
break;
|
1979 |
case '<':
|
1980 |
$newToken['type'] = 'T_LESS_THAN';
|
1981 |
break;
|
vendor/squizlabs/php_codesniffer/src/Tokenizers/Tokenizer.php
CHANGED
@@ -87,7 +87,7 @@ abstract class Tokenizer
|
|
87 |
/**
|
88 |
* Checks the content to see if it looks minified.
|
89 |
*
|
90 |
-
* @param string $content The content to tokenize
|
91 |
* @param string $eolChar The EOL char used in the content.
|
92 |
*
|
93 |
* @return boolean
|
@@ -1078,6 +1078,30 @@ abstract class Tokenizer
|
|
1078 |
continue;
|
1079 |
}//end if
|
1080 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1081 |
// Found another opening condition but still haven't
|
1082 |
// found our opener, so we are never going to find one.
|
1083 |
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
@@ -1348,7 +1372,7 @@ abstract class Tokenizer
|
|
1348 |
*
|
1349 |
* The level map adds a 'level' index to each token which indicates the
|
1350 |
* depth that a token within a set of scope blocks. It also adds a
|
1351 |
-
* '
|
1352 |
* each of the scopes - position 0 being the first scope opener.
|
1353 |
*
|
1354 |
* @return void
|
87 |
/**
|
88 |
* Checks the content to see if it looks minified.
|
89 |
*
|
90 |
+
* @param string $content The content to tokenize.
|
91 |
* @param string $eolChar The EOL char used in the content.
|
92 |
*
|
93 |
* @return boolean
|
1078 |
continue;
|
1079 |
}//end if
|
1080 |
|
1081 |
+
if ($tokenType === T_CLASS) {
|
1082 |
+
// Probably an anonymous class inside another anonymous class,
|
1083 |
+
// so process it manually.
|
1084 |
+
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1085 |
+
$type = $this->tokens[$stackPtr]['type'];
|
1086 |
+
echo str_repeat("\t", $depth);
|
1087 |
+
echo "=> Found class before scope opener for $stackPtr:$type, processing manually".PHP_EOL;
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
if (isset($this->tokens[$i]['scope_closer']) === true) {
|
1091 |
+
// We've already processed this anon class.
|
1092 |
+
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1093 |
+
echo str_repeat("\t", $depth);
|
1094 |
+
echo '* already processed, skipping *'.PHP_EOL;
|
1095 |
+
}
|
1096 |
+
|
1097 |
+
$i = $this->tokens[$i]['scope_closer'];
|
1098 |
+
continue;
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
$i = self::recurseScopeMap($i, ($depth + 1), $ignore);
|
1102 |
+
continue;
|
1103 |
+
}//end if
|
1104 |
+
|
1105 |
// Found another opening condition but still haven't
|
1106 |
// found our opener, so we are never going to find one.
|
1107 |
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1372 |
*
|
1373 |
* The level map adds a 'level' index to each token which indicates the
|
1374 |
* depth that a token within a set of scope blocks. It also adds a
|
1375 |
+
* 'conditions' index which is an array of the scope conditions that opened
|
1376 |
* each of the scopes - position 0 being the first scope opener.
|
1377 |
*
|
1378 |
* @return void
|
vendor/squizlabs/php_codesniffer/src/Util/Cache.php
CHANGED
@@ -213,9 +213,14 @@ class Cache
|
|
213 |
ksort($paths);
|
214 |
$paths = array_reverse($paths);
|
215 |
|
216 |
-
$numFiles
|
217 |
-
|
218 |
$cacheFile = null;
|
|
|
|
|
|
|
|
|
|
|
219 |
foreach ($paths as $file => $count) {
|
220 |
if ($count !== $numFiles) {
|
221 |
unset($paths[$file]);
|
@@ -223,7 +228,7 @@ class Cache
|
|
223 |
}
|
224 |
|
225 |
$fileHash = substr(sha1($file), 0, 12);
|
226 |
-
$testFile = $
|
227 |
if ($cacheFile === null) {
|
228 |
// This will be our default location if we can't find
|
229 |
// an existing file.
|
@@ -243,7 +248,7 @@ class Cache
|
|
243 |
|
244 |
if ($cacheFile === null) {
|
245 |
// Unlikely, but just in case $paths is empty for some reason.
|
246 |
-
$cacheFile = $
|
247 |
}
|
248 |
}//end if
|
249 |
|
213 |
ksort($paths);
|
214 |
$paths = array_reverse($paths);
|
215 |
|
216 |
+
$numFiles = count($config->files);
|
217 |
+
|
218 |
$cacheFile = null;
|
219 |
+
$cacheDir = getenv('XDG_CACHE_HOME');
|
220 |
+
if ($cacheDir === false || is_dir($cacheDir) === false) {
|
221 |
+
$cacheDir = sys_get_temp_dir();
|
222 |
+
}
|
223 |
+
|
224 |
foreach ($paths as $file => $count) {
|
225 |
if ($count !== $numFiles) {
|
226 |
unset($paths[$file]);
|
228 |
}
|
229 |
|
230 |
$fileHash = substr(sha1($file), 0, 12);
|
231 |
+
$testFile = $cacheDir.DIRECTORY_SEPARATOR."phpcs.$fileHash.$cacheHash.cache";
|
232 |
if ($cacheFile === null) {
|
233 |
// This will be our default location if we can't find
|
234 |
// an existing file.
|
248 |
|
249 |
if ($cacheFile === null) {
|
250 |
// Unlikely, but just in case $paths is empty for some reason.
|
251 |
+
$cacheFile = $cacheDir.DIRECTORY_SEPARATOR."phpcs.$cacheHash.cache";
|
252 |
}
|
253 |
}//end if
|
254 |
|
vendor/squizlabs/php_codesniffer/src/Util/Timing.php
CHANGED
@@ -75,7 +75,7 @@ class Timing
|
|
75 |
$time = round($time).'ms';
|
76 |
}
|
77 |
|
78 |
-
$mem = round((memory_get_peak_usage(true) / (1024 * 1024)), 2).'
|
79 |
echo "Time: $time; Memory: $mem".PHP_EOL.PHP_EOL;
|
80 |
|
81 |
self::$printed = true;
|
75 |
$time = round($time).'ms';
|
76 |
}
|
77 |
|
78 |
+
$mem = round((memory_get_peak_usage(true) / (1024 * 1024)), 2).'MB';
|
79 |
echo "Time: $time; Memory: $mem".PHP_EOL.PHP_EOL;
|
80 |
|
81 |
self::$printed = true;
|
vendor/squizlabs/php_codesniffer/src/Util/Tokens.php
CHANGED
@@ -34,6 +34,7 @@ define('T_MODULUS', 'PHPCS_T_MODULUS');
|
|
34 |
define('T_BITWISE_AND', 'PHPCS_T_BITWISE_AND');
|
35 |
define('T_BITWISE_OR', 'PHPCS_T_BITWISE_OR');
|
36 |
define('T_BITWISE_XOR', 'PHPCS_T_BITWISE_XOR');
|
|
|
37 |
define('T_ARRAY_HINT', 'PHPCS_T_ARRAY_HINT');
|
38 |
define('T_GREATER_THAN', 'PHPCS_T_GREATER_THAN');
|
39 |
define('T_LESS_THAN', 'PHPCS_T_LESS_THAN');
|
@@ -144,9 +145,9 @@ final class Tokens
|
|
144 |
T_FUNCTION => 100,
|
145 |
T_CLOSURE => 100,
|
146 |
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
|
151 |
T_WHILE => 50,
|
152 |
T_FOR => 50,
|
@@ -163,9 +164,9 @@ final class Tokens
|
|
163 |
T_SELF => 25,
|
164 |
T_PARENT => 25,
|
165 |
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
|
170 |
T_BITWISE_AND => 8,
|
171 |
T_BITWISE_OR => 8,
|
@@ -200,9 +201,9 @@ final class Tokens
|
|
200 |
T_BOOLEAN_AND => 5,
|
201 |
T_BOOLEAN_OR => 5,
|
202 |
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
|
207 |
T_IS_EQUAL => 5,
|
208 |
T_IS_NOT_EQUAL => 5,
|
@@ -565,7 +566,7 @@ final class Tokens
|
|
565 |
];
|
566 |
|
567 |
/**
|
568 |
-
* Tokens that
|
569 |
*
|
570 |
* @var array<int, int>
|
571 |
*/
|
34 |
define('T_BITWISE_AND', 'PHPCS_T_BITWISE_AND');
|
35 |
define('T_BITWISE_OR', 'PHPCS_T_BITWISE_OR');
|
36 |
define('T_BITWISE_XOR', 'PHPCS_T_BITWISE_XOR');
|
37 |
+
define('T_BITWISE_NOT', 'PHPCS_T_BITWISE_NOT');
|
38 |
define('T_ARRAY_HINT', 'PHPCS_T_ARRAY_HINT');
|
39 |
define('T_GREATER_THAN', 'PHPCS_T_GREATER_THAN');
|
40 |
define('T_LESS_THAN', 'PHPCS_T_LESS_THAN');
|
145 |
T_FUNCTION => 100,
|
146 |
T_CLOSURE => 100,
|
147 |
|
148 |
+
/*
|
149 |
+
* Conditions.
|
150 |
+
*/
|
151 |
|
152 |
T_WHILE => 50,
|
153 |
T_FOR => 50,
|
164 |
T_SELF => 25,
|
165 |
T_PARENT => 25,
|
166 |
|
167 |
+
/*
|
168 |
+
* Operators and arithmetic.
|
169 |
+
*/
|
170 |
|
171 |
T_BITWISE_AND => 8,
|
172 |
T_BITWISE_OR => 8,
|
201 |
T_BOOLEAN_AND => 5,
|
202 |
T_BOOLEAN_OR => 5,
|
203 |
|
204 |
+
/*
|
205 |
+
* Equality.
|
206 |
+
*/
|
207 |
|
208 |
T_IS_EQUAL => 5,
|
209 |
T_IS_NOT_EQUAL => 5,
|
566 |
];
|
567 |
|
568 |
/**
|
569 |
+
* Tokens that open class and object scopes.
|
570 |
*
|
571 |
* @var array<int, int>
|
572 |
*/
|
vendor/squizlabs/php_codesniffer/tests/Core/File/FindEndOfStatementTest.php
CHANGED
@@ -145,7 +145,7 @@ class FindEndOfStatementTest extends TestCase
|
|
145 |
*/
|
146 |
public function testSwitch()
|
147 |
{
|
148 |
-
// Find the end of the
|
149 |
$start = ($this->phpcsFile->findNext(T_COMMENT, 0, null, false, '/* testSwitch */') + 2);
|
150 |
$found = $this->phpcsFile->findEndOfStatement($start);
|
151 |
|
145 |
*/
|
146 |
public function testSwitch()
|
147 |
{
|
148 |
+
// Find the end of the switch.
|
149 |
$start = ($this->phpcsFile->findNext(T_COMMENT, 0, null, false, '/* testSwitch */') + 2);
|
150 |
$found = $this->phpcsFile->findEndOfStatement($start);
|
151 |
|
vendor/squizlabs/php_codesniffer/tests/Core/File/GetMemberPropertiesTest.inc
CHANGED
@@ -117,3 +117,21 @@ $globalVariable = true;
|
|
117 |
|
118 |
/* testNotAVariable */
|
119 |
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
/* testNotAVariable */
|
119 |
return;
|
120 |
+
|
121 |
+
$a = ( $foo == $bar ? new stdClass() :
|
122 |
+
new class() {
|
123 |
+
/* testNestedProperty 1 */
|
124 |
+
public $var = true;
|
125 |
+
|
126 |
+
/* testNestedMethodParam 1 */
|
127 |
+
public function something($var = false) {}
|
128 |
+
}
|
129 |
+
);
|
130 |
+
|
131 |
+
function_call( 'param', new class {
|
132 |
+
/* testNestedProperty 2 */
|
133 |
+
public $year = 2017;
|
134 |
+
|
135 |
+
/* testNestedMethodParam 2 */
|
136 |
+
public function __construct( $open, $post_id ) {}
|
137 |
+
}, 10, 2 );
|
vendor/squizlabs/php_codesniffer/tests/Core/File/GetMemberPropertiesTest.php
CHANGED
@@ -302,6 +302,22 @@ class GetMemberPropertiesTest extends TestCase
|
|
302 |
'/* testInterfaceProperty */',
|
303 |
[],
|
304 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
];
|
306 |
|
307 |
}//end dataGetMemberProperties()
|
@@ -346,9 +362,12 @@ class GetMemberPropertiesTest extends TestCase
|
|
346 |
public function dataNotClassProperty()
|
347 |
{
|
348 |
return [
|
|
|
349 |
['/* testImportedGlobal */'],
|
350 |
['/* testLocalVariable */'],
|
351 |
['/* testGlobalVariable */'],
|
|
|
|
|
352 |
];
|
353 |
|
354 |
}//end dataNotClassProperty()
|
302 |
'/* testInterfaceProperty */',
|
303 |
[],
|
304 |
],
|
305 |
+
[
|
306 |
+
'/* testNestedProperty 1 */',
|
307 |
+
[
|
308 |
+
'scope' => 'public',
|
309 |
+
'scope_specified' => true,
|
310 |
+
'is_static' => false,
|
311 |
+
],
|
312 |
+
],
|
313 |
+
[
|
314 |
+
'/* testNestedProperty 2 */',
|
315 |
+
[
|
316 |
+
'scope' => 'public',
|
317 |
+
'scope_specified' => true,
|
318 |
+
'is_static' => false,
|
319 |
+
],
|
320 |
+
],
|
321 |
];
|
322 |
|
323 |
}//end dataGetMemberProperties()
|
362 |
public function dataNotClassProperty()
|
363 |
{
|
364 |
return [
|
365 |
+
['/* testMethodParam */'],
|
366 |
['/* testImportedGlobal */'],
|
367 |
['/* testLocalVariable */'],
|
368 |
['/* testGlobalVariable */'],
|
369 |
+
['/* testNestedMethodParam 1 */'],
|
370 |
+
['/* testNestedMethodParam 2 */'],
|
371 |
];
|
372 |
|
373 |
}//end dataNotClassProperty()
|
vendor/squizlabs/php_codesniffer/tests/Core/File/GetMethodPropertiesTest.inc
CHANGED
@@ -55,3 +55,8 @@ abstract class MyClass
|
|
55 |
abstract protected function myFunction(): bool;
|
56 |
}
|
57 |
|
|
|
|
|
|
|
|
|
|
55 |
abstract protected function myFunction(): bool;
|
56 |
}
|
57 |
|
58 |
+
interface MyInterface
|
59 |
+
{
|
60 |
+
/* testInterfaceMethod */
|
61 |
+
function myFunction();
|
62 |
+
}
|
vendor/squizlabs/php_codesniffer/tests/Core/File/GetMethodPropertiesTest.php
CHANGED
@@ -74,6 +74,7 @@ class GetMethodPropertiesTest extends TestCase
|
|
74 |
'is_abstract' => false,
|
75 |
'is_final' => false,
|
76 |
'is_static' => false,
|
|
|
77 |
];
|
78 |
|
79 |
$start = ($this->phpcsFile->numTokens - 1);
|
@@ -107,6 +108,7 @@ class GetMethodPropertiesTest extends TestCase
|
|
107 |
'is_abstract' => false,
|
108 |
'is_final' => false,
|
109 |
'is_static' => false,
|
|
|
110 |
];
|
111 |
|
112 |
$start = ($this->phpcsFile->numTokens - 1);
|
@@ -140,6 +142,7 @@ class GetMethodPropertiesTest extends TestCase
|
|
140 |
'is_abstract' => false,
|
141 |
'is_final' => false,
|
142 |
'is_static' => false,
|
|
|
143 |
];
|
144 |
|
145 |
$start = ($this->phpcsFile->numTokens - 1);
|
@@ -173,6 +176,7 @@ class GetMethodPropertiesTest extends TestCase
|
|
173 |
'is_abstract' => false,
|
174 |
'is_final' => false,
|
175 |
'is_static' => false,
|
|
|
176 |
];
|
177 |
|
178 |
$start = ($this->phpcsFile->numTokens - 1);
|
@@ -206,6 +210,7 @@ class GetMethodPropertiesTest extends TestCase
|
|
206 |
'is_abstract' => false,
|
207 |
'is_final' => false,
|
208 |
'is_static' => true,
|
|
|
209 |
];
|
210 |
|
211 |
$start = ($this->phpcsFile->numTokens - 1);
|
@@ -239,6 +244,7 @@ class GetMethodPropertiesTest extends TestCase
|
|
239 |
'is_abstract' => false,
|
240 |
'is_final' => true,
|
241 |
'is_static' => false,
|
|
|
242 |
];
|
243 |
|
244 |
$start = ($this->phpcsFile->numTokens - 1);
|
@@ -272,6 +278,7 @@ class GetMethodPropertiesTest extends TestCase
|
|
272 |
'is_abstract' => false,
|
273 |
'is_final' => false,
|
274 |
'is_static' => false,
|
|
|
275 |
];
|
276 |
|
277 |
$start = ($this->phpcsFile->numTokens - 1);
|
@@ -305,6 +312,7 @@ class GetMethodPropertiesTest extends TestCase
|
|
305 |
'is_abstract' => false,
|
306 |
'is_final' => false,
|
307 |
'is_static' => false,
|
|
|
308 |
];
|
309 |
|
310 |
$start = ($this->phpcsFile->numTokens - 1);
|
@@ -338,6 +346,7 @@ class GetMethodPropertiesTest extends TestCase
|
|
338 |
'is_abstract' => false,
|
339 |
'is_final' => false,
|
340 |
'is_static' => false,
|
|
|
341 |
];
|
342 |
|
343 |
$start = ($this->phpcsFile->numTokens - 1);
|
@@ -371,6 +380,7 @@ class GetMethodPropertiesTest extends TestCase
|
|
371 |
'is_abstract' => false,
|
372 |
'is_final' => false,
|
373 |
'is_static' => false,
|
|
|
374 |
];
|
375 |
|
376 |
$start = ($this->phpcsFile->numTokens - 1);
|
@@ -404,6 +414,7 @@ class GetMethodPropertiesTest extends TestCase
|
|
404 |
'is_abstract' => false,
|
405 |
'is_final' => false,
|
406 |
'is_static' => false,
|
|
|
407 |
];
|
408 |
|
409 |
$start = ($this->phpcsFile->numTokens - 1);
|
@@ -437,6 +448,7 @@ class GetMethodPropertiesTest extends TestCase
|
|
437 |
'is_abstract' => false,
|
438 |
'is_final' => false,
|
439 |
'is_static' => false,
|
|
|
440 |
];
|
441 |
|
442 |
$start = ($this->phpcsFile->numTokens - 1);
|
@@ -470,6 +482,7 @@ class GetMethodPropertiesTest extends TestCase
|
|
470 |
'is_abstract' => true,
|
471 |
'is_final' => false,
|
472 |
'is_static' => false,
|
|
|
473 |
];
|
474 |
|
475 |
$start = ($this->phpcsFile->numTokens - 1);
|
@@ -503,6 +516,7 @@ class GetMethodPropertiesTest extends TestCase
|
|
503 |
'is_abstract' => true,
|
504 |
'is_final' => false,
|
505 |
'is_static' => false,
|
|
|
506 |
];
|
507 |
|
508 |
$start = ($this->phpcsFile->numTokens - 1);
|
@@ -521,4 +535,38 @@ class GetMethodPropertiesTest extends TestCase
|
|
521 |
}//end testAbstractReturnMethod()
|
522 |
|
523 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
}//end class
|
74 |
'is_abstract' => false,
|
75 |
'is_final' => false,
|
76 |
'is_static' => false,
|
77 |
+
'has_body' => true,
|
78 |
];
|
79 |
|
80 |
$start = ($this->phpcsFile->numTokens - 1);
|
108 |
'is_abstract' => false,
|
109 |
'is_final' => false,
|
110 |
'is_static' => false,
|
111 |
+
'has_body' => true,
|
112 |
];
|
113 |
|
114 |
$start = ($this->phpcsFile->numTokens - 1);
|
142 |
'is_abstract' => false,
|
143 |
'is_final' => false,
|
144 |
'is_static' => false,
|
145 |
+
'has_body' => true,
|
146 |
];
|
147 |
|
148 |
$start = ($this->phpcsFile->numTokens - 1);
|
176 |
'is_abstract' => false,
|
177 |
'is_final' => false,
|
178 |
'is_static' => false,
|
179 |
+
'has_body' => true,
|
180 |
];
|
181 |
|
182 |
$start = ($this->phpcsFile->numTokens - 1);
|
210 |
'is_abstract' => false,
|
211 |
'is_final' => false,
|
212 |
'is_static' => true,
|
213 |
+
'has_body' => true,
|
214 |
];
|
215 |
|
216 |
$start = ($this->phpcsFile->numTokens - 1);
|
244 |
'is_abstract' => false,
|
245 |
'is_final' => true,
|
246 |
'is_static' => false,
|
247 |
+
'has_body' => true,
|
248 |
];
|
249 |
|
250 |
$start = ($this->phpcsFile->numTokens - 1);
|
278 |
'is_abstract' => false,
|
279 |
'is_final' => false,
|
280 |
'is_static' => false,
|
281 |
+
'has_body' => true,
|
282 |
];
|
283 |
|
284 |
$start = ($this->phpcsFile->numTokens - 1);
|
312 |
'is_abstract' => false,
|
313 |
'is_final' => false,
|
314 |
'is_static' => false,
|
315 |
+
'has_body' => true,
|
316 |
];
|
317 |
|
318 |
$start = ($this->phpcsFile->numTokens - 1);
|
346 |
'is_abstract' => false,
|
347 |
'is_final' => false,
|
348 |
'is_static' => false,
|
349 |
+
'has_body' => true,
|
350 |
];
|
351 |
|
352 |
$start = ($this->phpcsFile->numTokens - 1);
|
380 |
'is_abstract' => false,
|
381 |
'is_final' => false,
|
382 |
'is_static' => false,
|
383 |
+
'has_body' => true,
|
384 |
];
|
385 |
|
386 |
$start = ($this->phpcsFile->numTokens - 1);
|
414 |
'is_abstract' => false,
|
415 |
'is_final' => false,
|
416 |
'is_static' => false,
|
417 |
+
'has_body' => true,
|
418 |
];
|
419 |
|
420 |
$start = ($this->phpcsFile->numTokens - 1);
|
448 |
'is_abstract' => false,
|
449 |
'is_final' => false,
|
450 |
'is_static' => false,
|
451 |
+
'has_body' => true,
|
452 |
];
|
453 |
|
454 |
$start = ($this->phpcsFile->numTokens - 1);
|
482 |
'is_abstract' => true,
|
483 |
'is_final' => false,
|
484 |
'is_static' => false,
|
485 |
+
'has_body' => false,
|
486 |
];
|
487 |
|
488 |
$start = ($this->phpcsFile->numTokens - 1);
|
516 |
'is_abstract' => true,
|
517 |
'is_final' => false,
|
518 |
'is_static' => false,
|
519 |
+
'has_body' => false,
|
520 |
];
|
521 |
|
522 |
$start = ($this->phpcsFile->numTokens - 1);
|
535 |
}//end testAbstractReturnMethod()
|
536 |
|
537 |
|
538 |
+
/**
|
539 |
+
* Test a basic interface method.
|
540 |
+
*
|
541 |
+
* @return void
|
542 |
+
*/
|
543 |
+
public function testInterfaceMethod()
|
544 |
+
{
|
545 |
+
$expected = [
|
546 |
+
'scope' => 'public',
|
547 |
+
'scope_specified' => false,
|
548 |
+
'return_type' => '',
|
549 |
+
'nullable_return_type' => false,
|
550 |
+
'is_abstract' => false,
|
551 |
+
'is_final' => false,
|
552 |
+
'is_static' => false,
|
553 |
+
'has_body' => false,
|
554 |
+
];
|
555 |
+
|
556 |
+
$start = ($this->phpcsFile->numTokens - 1);
|
557 |
+
$function = $this->phpcsFile->findPrevious(
|
558 |
+
T_COMMENT,
|
559 |
+
$start,
|
560 |
+
null,
|
561 |
+
false,
|
562 |
+
'/* testInterfaceMethod */'
|
563 |
+
);
|
564 |
+
|
565 |
+
$found = $this->phpcsFile->getMethodProperties(($function + 3));
|
566 |
+
unset($found['return_type_token']);
|
567 |
+
$this->assertSame($expected, $found);
|
568 |
+
|
569 |
+
}//end testInterfaceMethod()
|
570 |
+
|
571 |
+
|
572 |
}//end class
|
vendor/squizlabs/php_codesniffer/tests/Standards/AbstractSniffUnitTest.php
CHANGED
@@ -127,6 +127,7 @@ abstract class AbstractSniffUnitTest extends TestCase
|
|
127 |
|
128 |
// Get a list of all test files to check.
|
129 |
$testFiles = $this->getTestFiles($testFileBase);
|
|
|
130 |
|
131 |
if (isset($GLOBALS['PHP_CODESNIFFER_CONFIG']) === true) {
|
132 |
$config = $GLOBALS['PHP_CODESNIFFER_CONFIG'];
|
127 |
|
128 |
// Get a list of all test files to check.
|
129 |
$testFiles = $this->getTestFiles($testFileBase);
|
130 |
+
$GLOBALS['PHP_CODESNIFFER_SNIFF_CASE_FILES'][] = $testFiles;
|
131 |
|
132 |
if (isset($GLOBALS['PHP_CODESNIFFER_CONFIG']) === true) {
|
133 |
$config = $GLOBALS['PHP_CODESNIFFER_CONFIG'];
|
vendor/squizlabs/php_codesniffer/tests/Standards/AllSniffs.php
CHANGED
@@ -40,8 +40,9 @@ class AllSniffs
|
|
40 |
*/
|
41 |
public static function suite()
|
42 |
{
|
43 |
-
$GLOBALS['PHP_CODESNIFFER_SNIFF_CODES']
|
44 |
-
$GLOBALS['PHP_CODESNIFFER_FIXABLE_CODES']
|
|
|
45 |
|
46 |
$suite = new TestSuite('PHP CodeSniffer Standards');
|
47 |
|
40 |
*/
|
41 |
public static function suite()
|
42 |
{
|
43 |
+
$GLOBALS['PHP_CODESNIFFER_SNIFF_CODES'] = [];
|
44 |
+
$GLOBALS['PHP_CODESNIFFER_FIXABLE_CODES'] = [];
|
45 |
+
$GLOBALS['PHP_CODESNIFFER_SNIFF_CASE_FILES'] = [];
|
46 |
|
47 |
$suite = new TestSuite('PHP CodeSniffer Standards');
|
48 |
|
vendor/squizlabs/php_codesniffer/tests/bootstrap.php
CHANGED
@@ -52,13 +52,16 @@ if (class_exists('PHPUnit_Framework_TestResult') === true && class_exists('PHPUn
|
|
52 |
*/
|
53 |
function printPHPCodeSnifferTestOutput()
|
54 |
{
|
55 |
-
$
|
|
|
|
|
|
|
56 |
|
57 |
echo PHP_EOL.PHP_EOL;
|
58 |
-
echo "
|
59 |
-
if ($
|
60 |
$fixes = count($GLOBALS['PHP_CODESNIFFER_FIXABLE_CODES']);
|
61 |
-
$percent = round(($fixes / $
|
62 |
echo "; $fixes were fixable ($percent%)";
|
63 |
}
|
64 |
|
52 |
*/
|
53 |
function printPHPCodeSnifferTestOutput()
|
54 |
{
|
55 |
+
$codeCount = count($GLOBALS['PHP_CODESNIFFER_SNIFF_CODES']);
|
56 |
+
$files = call_user_func_array('array_merge', $GLOBALS['PHP_CODESNIFFER_SNIFF_CASE_FILES']);
|
57 |
+
$files = array_unique($files);
|
58 |
+
$fileCount = count($files);
|
59 |
|
60 |
echo PHP_EOL.PHP_EOL;
|
61 |
+
echo "$fileCount sniff test files generated $codeCount unique error codes";
|
62 |
+
if ($codeCount > 0) {
|
63 |
$fixes = count($GLOBALS['PHP_CODESNIFFER_FIXABLE_CODES']);
|
64 |
+
$percent = round(($fixes / $codeCount * 100), 2);
|
65 |
echo "; $fixes were fixable ($percent%)";
|
66 |
}
|
67 |
|
vendor/wp-coding-standards/wpcs/CHANGELOG.md
CHANGED
@@ -8,6 +8,22 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
|
|
8 |
|
9 |
_No documentation available about unreleased changes as of yet._
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
## [1.2.0] - 2018-11-12
|
12 |
|
13 |
### Added
|
@@ -810,6 +826,7 @@ See the comparison for full list.
|
|
810 |
Initial tagged release.
|
811 |
|
812 |
[Unreleased]: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/compare/master...HEAD
|
|
|
813 |
[1.2.0]: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/compare/1.1.0...1.2.0
|
814 |
[1.1.0]: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/compare/1.0.0...1.1.0
|
815 |
[1.0.0]: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/compare/0.14.1...1.0.0
|
8 |
|
9 |
_No documentation available about unreleased changes as of yet._
|
10 |
|
11 |
+
## [1.2.1] - 2018-12-18
|
12 |
+
|
13 |
+
Note: This will be the last release supporting PHP_CodeSniffer 2.x.
|
14 |
+
|
15 |
+
### Changed
|
16 |
+
- The default value for `minimum_supported_wp_version`, as used by a [number of sniffs detecting usage of deprecated WP features](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#minimum-wp-version-to-check-for-usage-of-deprecated-functions-classes-and-function-parameters), has been updated to `4.7`.
|
17 |
+
- The `WordPress.NamingConventions.PrefixAllGlobals` sniff will now report the error for hook names and constant names declared with `define()` on the line containing the parameter for the hook/constant name. Previously, it would report the error on the line containing the function call.
|
18 |
+
- Various minor housekeeping fixes to inline documentation, rulesets, code.
|
19 |
+
|
20 |
+
### Removed
|
21 |
+
- `comment_author_email_link()`, `comment_author_email()`, `comment_author_IP()`, `comment_author_link()`, `comment_author_rss()`, `comment_author_url_link()`, `comment_author_url()`, `comment_author()`, `comment_date()`, `comment_excerpt()`, `comment_form_title()`, `comment_form()`, `comment_id_fields()`, `comment_ID()`, `comment_reply_link()`, `comment_text_rss()`, `comment_text()`, `comment_time()`, `comment_type()`, `comments_link()`, `comments_number()`, `comments_popup_link()`, `comments_popup_script()`, `comments_rss_link()`, `delete_get_calendar_cache()`, `edit_bookmark_link()`, `edit_comment_link()`, `edit_post_link()`, `edit_tag_link()`, `get_footer()`, `get_header()`, `get_sidebar()`, `get_the_title()`, `next_comments_link()`, `next_image_link()`, `next_post_link()`, `next_posts_link()`, `permalink_anchor()`, `posts_nav_link()`, `previous_comments_link()`, `previous_image_link()`, `previous_post_link()`, `previous_posts_link()`, `sticky_class()`, `the_attachment_link()`, `the_author_link()`, `the_author_meta()`, `the_author_posts_link()`, `the_author_posts()`, `the_category_rss()`, `the_category()`, `the_content_rss()`, `the_content()`, `the_date_xml()`, `the_excerpt_rss()`, `the_excerpt()`, `the_feed_link()`, `the_ID()`, `the_meta()`, `the_modified_author()`, `the_modified_date()`, `the_modified_time()`, `the_permalink()`, `the_post_thumbnail()`, `the_search_query()`, `the_shortlink()`, `the_tags()`, `the_taxonomies()`, `the_terms()`, `the_time()`, `the_title_rss()`, `the_title()`, `wp_enqueue_script()`, `wp_meta()`, `wp_shortlink_header()` and `wp_shortlink_wp_head()` from the list of auto-escaped functions `Sniff::$autoEscapedFunctions`. This affects the `WordPress.Security.EscapeOutput` sniff.
|
22 |
+
|
23 |
+
### Fixed
|
24 |
+
- The `WordPress.WhiteSpace.PrecisionAlignment` sniff would loose the value of a custom set `ignoreAlignmentTokens` property when scanning more than one file.
|
25 |
+
|
26 |
+
|
27 |
## [1.2.0] - 2018-11-12
|
28 |
|
29 |
### Added
|
826 |
Initial tagged release.
|
827 |
|
828 |
[Unreleased]: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/compare/master...HEAD
|
829 |
+
[1.2.1]: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/compare/1.2.0...1.2.1
|
830 |
[1.2.0]: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/compare/1.1.0...1.2.0
|
831 |
[1.1.0]: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/compare/1.0.0...1.1.0
|
832 |
[1.0.0]: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/compare/0.14.1...1.0.0
|
vendor/wp-coding-standards/wpcs/WordPress-Docs/ruleset.xml
CHANGED
@@ -61,6 +61,8 @@
|
|
61 |
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentNotCapital"/>
|
62 |
<!-- Excluded to allow param documentation for arrays -->
|
63 |
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamName"/>
|
|
|
|
|
64 |
<!-- WP doesn't require type hints -->
|
65 |
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing"/>
|
66 |
|
@@ -81,9 +83,6 @@
|
|
81 |
<exclude name="Squiz.Commenting.VariableComment.TagNotAllowed"/>
|
82 |
<!-- WP prefers @since first -->
|
83 |
<exclude name="Squiz.Commenting.VariableComment.VarOrder"/>
|
84 |
-
|
85 |
-
<!-- It is too early for PHP7 features to be required -->
|
86 |
-
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing"/>
|
87 |
</rule>
|
88 |
|
89 |
<rule ref="Generic.Commenting">
|
@@ -105,8 +104,6 @@
|
|
105 |
<exclude name="Generic.Commenting.DocComment.ContentBeforeClose"/>
|
106 |
|
107 |
<!-- WP allows @todo's in comments -->
|
108 |
-
<exclude name="Generic.Commenting.Todo
|
109 |
-
<!-- WP allows @todo's in comments -->
|
110 |
-
<exclude name="Generic.Commenting.Todo.TaskFound"/>
|
111 |
</rule>
|
112 |
</ruleset>
|
61 |
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentNotCapital"/>
|
62 |
<!-- Excluded to allow param documentation for arrays -->
|
63 |
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamName"/>
|
64 |
+
<!-- It is too early for PHP7 features to be required -->
|
65 |
+
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing"/>
|
66 |
<!-- WP doesn't require type hints -->
|
67 |
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing"/>
|
68 |
|
83 |
<exclude name="Squiz.Commenting.VariableComment.TagNotAllowed"/>
|
84 |
<!-- WP prefers @since first -->
|
85 |
<exclude name="Squiz.Commenting.VariableComment.VarOrder"/>
|
|
|
|
|
|
|
86 |
</rule>
|
87 |
|
88 |
<rule ref="Generic.Commenting">
|
104 |
<exclude name="Generic.Commenting.DocComment.ContentBeforeClose"/>
|
105 |
|
106 |
<!-- WP allows @todo's in comments -->
|
107 |
+
<exclude name="Generic.Commenting.Todo"/>
|
|
|
|
|
108 |
</rule>
|
109 |
</ruleset>
|
vendor/wp-coding-standards/wpcs/WordPress/Sniff.php
CHANGED
@@ -82,7 +82,7 @@ abstract class Sniff implements PHPCS_Sniff {
|
|
82 |
*
|
83 |
* @var string WordPress version.
|
84 |
*/
|
85 |
-
public $minimum_supported_version = '4.
|
86 |
|
87 |
/**
|
88 |
* Custom list of classes which test classes can extend.
|
@@ -178,40 +178,11 @@ abstract class Sniff implements PHPCS_Sniff {
|
|
178 |
'calendar_week_mod' => true,
|
179 |
'category_description' => true,
|
180 |
'checked' => true,
|
181 |
-
'comment_author_email_link' => true,
|
182 |
-
'comment_author_email' => true,
|
183 |
-
'comment_author_IP' => true,
|
184 |
-
'comment_author_link' => true,
|
185 |
-
'comment_author_rss' => true,
|
186 |
-
'comment_author_url_link' => true,
|
187 |
-
'comment_author_url' => true,
|
188 |
-
'comment_author' => true,
|
189 |
'comment_class' => true,
|
190 |
-
'comment_date' => true,
|
191 |
-
'comment_excerpt' => true,
|
192 |
-
'comment_form_title' => true,
|
193 |
-
'comment_form' => true,
|
194 |
-
'comment_id_fields' => true,
|
195 |
-
'comment_ID' => true,
|
196 |
-
'comment_reply_link' => true,
|
197 |
-
'comment_text_rss' => true,
|
198 |
-
'comment_text' => true,
|
199 |
-
'comment_time' => true,
|
200 |
-
'comment_type' => true,
|
201 |
-
'comments_link' => true,
|
202 |
-
'comments_number' => true,
|
203 |
-
'comments_popup_link' => true,
|
204 |
-
'comments_popup_script' => true,
|
205 |
-
'comments_rss_link' => true,
|
206 |
'count' => true,
|
207 |
-
'delete_get_calendar_cache' => true,
|
208 |
'disabled' => true,
|
209 |
'do_shortcode' => true,
|
210 |
'do_shortcode_tag' => true,
|
211 |
-
'edit_bookmark_link' => true,
|
212 |
-
'edit_comment_link' => true,
|
213 |
-
'edit_post_link' => true,
|
214 |
-
'edit_tag_link' => true,
|
215 |
'get_archives_link' => true,
|
216 |
'get_attachment_link' => true,
|
217 |
'get_avatar' => true,
|
@@ -220,30 +191,16 @@ abstract class Sniff implements PHPCS_Sniff {
|
|
220 |
'get_comment_author_link' => true,
|
221 |
'get_current_blog_id' => true,
|
222 |
'get_delete_post_link' => true,
|
223 |
-
'get_footer' => true,
|
224 |
-
'get_header' => true,
|
225 |
'get_search_form' => true,
|
226 |
'get_search_query' => true,
|
227 |
-
'get_sidebar' => true,
|
228 |
'get_the_author_link' => true,
|
229 |
'get_the_author' => true,
|
230 |
'get_the_date' => true,
|
231 |
'get_the_ID' => true,
|
232 |
'get_the_post_thumbnail' => true,
|
233 |
'get_the_term_list' => true,
|
234 |
-
'get_the_title' => true,
|
235 |
-
'next_comments_link' => true,
|
236 |
-
'next_image_link' => true,
|
237 |
-
'next_post_link' => true,
|
238 |
-
'next_posts_link' => true,
|
239 |
'paginate_comments_links' => true,
|
240 |
-
'permalink_anchor' => true,
|
241 |
'post_type_archive_title' => true,
|
242 |
-
'posts_nav_link' => true,
|
243 |
-
'previous_comments_link' => true,
|
244 |
-
'previous_image_link' => true,
|
245 |
-
'previous_post_link' => true,
|
246 |
-
'previous_posts_link' => true,
|
247 |
'readonly' => true,
|
248 |
'selected' => true,
|
249 |
'single_cat_title' => true,
|
@@ -251,45 +208,15 @@ abstract class Sniff implements PHPCS_Sniff {
|
|
251 |
'single_post_title' => true,
|
252 |
'single_tag_title' => true,
|
253 |
'single_term_title' => true,
|
254 |
-
'sticky_class' => true,
|
255 |
'tag_description' => true,
|
256 |
'term_description' => true,
|
257 |
-
'the_attachment_link' => true,
|
258 |
-
'the_author_link' => true,
|
259 |
-
'the_author_meta' => true,
|
260 |
-
'the_author_posts_link' => true,
|
261 |
-
'the_author_posts' => true,
|
262 |
'the_author' => true,
|
263 |
-
'the_category_rss' => true,
|
264 |
-
'the_category' => true,
|
265 |
-
'the_content_rss' => true,
|
266 |
-
'the_content' => true,
|
267 |
-
'the_date_xml' => true,
|
268 |
'the_date' => true,
|
269 |
-
'the_excerpt_rss' => true,
|
270 |
-
'the_excerpt' => true,
|
271 |
-
'the_feed_link' => true,
|
272 |
-
'the_ID' => true,
|
273 |
-
'the_meta' => true,
|
274 |
-
'the_modified_author' => true,
|
275 |
-
'the_modified_date' => true,
|
276 |
-
'the_modified_time' => true,
|
277 |
-
'the_permalink' => true,
|
278 |
-
'the_post_thumbnail' => true,
|
279 |
-
'the_search_query' => true,
|
280 |
-
'the_shortlink' => true,
|
281 |
-
'the_tags' => true,
|
282 |
-
'the_taxonomies' => true,
|
283 |
-
'the_terms' => true,
|
284 |
-
'the_time' => true,
|
285 |
'the_title_attribute' => true,
|
286 |
-
'the_title_rss' => true,
|
287 |
-
'the_title' => true,
|
288 |
'vip_powered_wpcom' => true,
|
289 |
'walk_nav_menu_tree' => true,
|
290 |
'wp_dropdown_categories' => true,
|
291 |
'wp_dropdown_users' => true,
|
292 |
-
'wp_enqueue_script' => true,
|
293 |
'wp_generate_tag_cloud' => true,
|
294 |
'wp_get_archives' => true,
|
295 |
'wp_get_attachment_image' => true,
|
@@ -301,11 +228,8 @@ abstract class Sniff implements PHPCS_Sniff {
|
|
301 |
'wp_list_comments' => true,
|
302 |
'wp_login_form' => true,
|
303 |
'wp_loginout' => true,
|
304 |
-
'wp_meta' => true,
|
305 |
'wp_nav_menu' => true,
|
306 |
'wp_register' => true,
|
307 |
-
'wp_shortlink_header' => true,
|
308 |
-
'wp_shortlink_wp_head' => true,
|
309 |
'wp_tag_cloud' => true,
|
310 |
'wp_title' => true,
|
311 |
);
|
@@ -2390,7 +2314,7 @@ abstract class Sniff implements PHPCS_Sniff {
|
|
2390 |
\T_STRING => true,
|
2391 |
\T_NS_SEPARATOR => true,
|
2392 |
);
|
2393 |
-
$validTokens
|
2394 |
|
2395 |
$namespaceName = '';
|
2396 |
while ( isset( $validTokens[ $this->tokens[ $nextToken ]['code'] ] ) ) {
|
@@ -2493,7 +2417,7 @@ abstract class Sniff implements PHPCS_Sniff {
|
|
2493 |
$deepest_open = array_pop( $parenthesis );
|
2494 |
if ( $deepest_open < $scopePtr
|
2495 |
|| isset( $this->tokens[ $deepest_open ]['parenthesis_owner'] ) === false
|
2496 |
-
|| T_FUNCTION !== $this->tokens[ $this->tokens[ $deepest_open ]['parenthesis_owner'] ]['code']
|
2497 |
) {
|
2498 |
return true;
|
2499 |
}
|
82 |
*
|
83 |
* @var string WordPress version.
|
84 |
*/
|
85 |
+
public $minimum_supported_version = '4.7';
|
86 |
|
87 |
/**
|
88 |
* Custom list of classes which test classes can extend.
|
178 |
'calendar_week_mod' => true,
|
179 |
'category_description' => true,
|
180 |
'checked' => true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
'comment_class' => true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
'count' => true,
|
|
|
183 |
'disabled' => true,
|
184 |
'do_shortcode' => true,
|
185 |
'do_shortcode_tag' => true,
|
|
|
|
|
|
|
|
|
186 |
'get_archives_link' => true,
|
187 |
'get_attachment_link' => true,
|
188 |
'get_avatar' => true,
|
191 |
'get_comment_author_link' => true,
|
192 |
'get_current_blog_id' => true,
|
193 |
'get_delete_post_link' => true,
|
|
|
|
|
194 |
'get_search_form' => true,
|
195 |
'get_search_query' => true,
|
|
|
196 |
'get_the_author_link' => true,
|
197 |
'get_the_author' => true,
|
198 |
'get_the_date' => true,
|
199 |
'get_the_ID' => true,
|
200 |
'get_the_post_thumbnail' => true,
|
201 |
'get_the_term_list' => true,
|
|
|
|
|
|
|
|
|
|
|
202 |
'paginate_comments_links' => true,
|
|
|
203 |
'post_type_archive_title' => true,
|
|
|
|
|
|
|
|
|
|
|
204 |
'readonly' => true,
|
205 |
'selected' => true,
|
206 |
'single_cat_title' => true,
|
208 |
'single_post_title' => true,
|
209 |
'single_tag_title' => true,
|
210 |
'single_term_title' => true,
|
|
|
211 |
'tag_description' => true,
|
212 |
'term_description' => true,
|
|
|
|
|
|
|
|
|
|
|
213 |
'the_author' => true,
|
|
|
|
|
|
|
|
|
|
|
214 |
'the_date' => true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
'the_title_attribute' => true,
|
|
|
|
|
216 |
'vip_powered_wpcom' => true,
|
217 |
'walk_nav_menu_tree' => true,
|
218 |
'wp_dropdown_categories' => true,
|
219 |
'wp_dropdown_users' => true,
|
|
|
220 |
'wp_generate_tag_cloud' => true,
|
221 |
'wp_get_archives' => true,
|
222 |
'wp_get_attachment_image' => true,
|
228 |
'wp_list_comments' => true,
|
229 |
'wp_login_form' => true,
|
230 |
'wp_loginout' => true,
|
|
|
231 |
'wp_nav_menu' => true,
|
232 |
'wp_register' => true,
|
|
|
|
|
233 |
'wp_tag_cloud' => true,
|
234 |
'wp_title' => true,
|
235 |
);
|
2314 |
\T_STRING => true,
|
2315 |
\T_NS_SEPARATOR => true,
|
2316 |
);
|
2317 |
+
$validTokens = $acceptedTokens + Tokens::$emptyTokens;
|
2318 |
|
2319 |
$namespaceName = '';
|
2320 |
while ( isset( $validTokens[ $this->tokens[ $nextToken ]['code'] ] ) ) {
|
2417 |
$deepest_open = array_pop( $parenthesis );
|
2418 |
if ( $deepest_open < $scopePtr
|
2419 |
|| isset( $this->tokens[ $deepest_open ]['parenthesis_owner'] ) === false
|
2420 |
+
|| \T_FUNCTION !== $this->tokens[ $this->tokens[ $deepest_open ]['parenthesis_owner'] ]['code']
|
2421 |
) {
|
2422 |
return true;
|
2423 |
}
|
vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php
CHANGED
@@ -801,7 +801,7 @@ class PrefixAllGlobalsSniff extends AbstractFunctionParameterSniff {
|
|
801 |
|
802 |
$data[] = $raw_content;
|
803 |
|
804 |
-
$recorded = $this->addMessage( self::ERROR_MSG, $
|
805 |
|
806 |
if ( true === $recorded ) {
|
807 |
$this->record_potential_prefix_metric( $stackPtr, $raw_content );
|
801 |
|
802 |
$data[] = $raw_content;
|
803 |
|
804 |
+
$recorded = $this->addMessage( self::ERROR_MSG, $first_non_empty, $is_error, $error_code, $data );
|
805 |
|
806 |
if ( true === $recorded ) {
|
807 |
$this->record_potential_prefix_metric( $stackPtr, $raw_content );
|
vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php
CHANGED
@@ -121,7 +121,7 @@ class I18nTextDomainFixerSniff extends AbstractFunctionParameterSniff {
|
|
121 |
*
|
122 |
* @since 1.2.0
|
123 |
*
|
124 |
-
* @var
|
125 |
*/
|
126 |
private $is_valid = false;
|
127 |
|
@@ -139,7 +139,7 @@ class I18nTextDomainFixerSniff extends AbstractFunctionParameterSniff {
|
|
139 |
*
|
140 |
* @since 1.2.0
|
141 |
*
|
142 |
-
* @var
|
143 |
*/
|
144 |
private $header_found = false;
|
145 |
|
121 |
*
|
122 |
* @since 1.2.0
|
123 |
*
|
124 |
+
* @var bool
|
125 |
*/
|
126 |
private $is_valid = false;
|
127 |
|
139 |
*
|
140 |
* @since 1.2.0
|
141 |
*
|
142 |
+
* @var bool
|
143 |
*/
|
144 |
private $header_found = false;
|
145 |
|
vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/PrecisionAlignmentSniff.php
CHANGED
@@ -91,7 +91,7 @@ class PrecisionAlignmentSniff extends Sniff {
|
|
91 |
}
|
92 |
|
93 |
// Handle any custom ignore tokens received from a ruleset.
|
94 |
-
$
|
95 |
|
96 |
$check_tokens = array(
|
97 |
'T_WHITESPACE' => true,
|
@@ -109,9 +109,9 @@ class PrecisionAlignmentSniff extends Sniff {
|
|
109 |
|| ( isset( $this->tokens[ ( $i + 1 ) ] )
|
110 |
&& \T_WHITESPACE === $this->tokens[ ( $i + 1 ) ]['code'] )
|
111 |
|| $this->tokens[ $i ]['content'] === $this->phpcsFile->eolChar
|
112 |
-
|| isset( $
|
113 |
|| ( isset( $this->tokens[ ( $i + 1 ) ] )
|
114 |
-
&& isset( $
|
115 |
) {
|
116 |
continue;
|
117 |
}
|
91 |
}
|
92 |
|
93 |
// Handle any custom ignore tokens received from a ruleset.
|
94 |
+
$ignoreAlignmentTokens = $this->merge_custom_array( $this->ignoreAlignmentTokens );
|
95 |
|
96 |
$check_tokens = array(
|
97 |
'T_WHITESPACE' => true,
|
109 |
|| ( isset( $this->tokens[ ( $i + 1 ) ] )
|
110 |
&& \T_WHITESPACE === $this->tokens[ ( $i + 1 ) ]['code'] )
|
111 |
|| $this->tokens[ $i ]['content'] === $this->phpcsFile->eolChar
|
112 |
+
|| isset( $ignoreAlignmentTokens[ $this->tokens[ $i ]['type'] ] )
|
113 |
|| ( isset( $this->tokens[ ( $i + 1 ) ] )
|
114 |
+
&& isset( $ignoreAlignmentTokens[ $this->tokens[ ( $i + 1 ) ]['type'] ] ) )
|
115 |
) {
|
116 |
continue;
|
117 |
}
|
vendor/wp-coding-standards/wpcs/phpcs.xml.dist.sample
CHANGED
@@ -69,7 +69,7 @@
|
|
69 |
the wiki:
|
70 |
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
|
71 |
-->
|
72 |
-
<config name="minimum_supported_wp_version" value="4.
|
73 |
|
74 |
<rule ref="WordPress.WP.I18n">
|
75 |
<properties>
|
69 |
the wiki:
|
70 |
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
|
71 |
-->
|
72 |
+
<config name="minimum_supported_wp_version" value="4.7"/>
|
73 |
|
74 |
<rule ref="WordPress.WP.I18n">
|
75 |
<properties>
|
vipgo-helper.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// make sure these function run in VIP Go environment where `plugins_loaded` is already fired when loading the plugin
|
3 |
+
add_action( 'after_setup_theme', 'instant_articles_load_textdomain' );
|
4 |
+
add_action( 'after_setup_theme', 'instant_articles_load_compat' );
|
wizard/class-instant-articles-option-analytics.php
CHANGED
@@ -29,6 +29,12 @@ class Instant_Articles_Option_Analytics extends Instant_Articles_Option {
|
|
29 |
'default' => array(),
|
30 |
),
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
'embed_code_enabled' => array(
|
33 |
'label' => 'Embed code',
|
34 |
'render' => 'checkbox',
|
29 |
'default' => array(),
|
30 |
),
|
31 |
|
32 |
+
'comscore_id' => array(
|
33 |
+
'label' => 'Comscore ID',
|
34 |
+
'render' => 'text',
|
35 |
+
'default' => false,
|
36 |
+
),
|
37 |
+
|
38 |
'embed_code_enabled' => array(
|
39 |
'label' => 'Embed code',
|
40 |
'render' => 'checkbox',
|