diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..5ec3cc484d5ffc2b3d6a7100b673a716775bcebb --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,104 @@ +################ +# DrupalCI GitLabCI template +# +# Gitlab-ci.yml to replicate DrupalCI testing for Contrib +# +# With thanks to: +# * The GitLab Acceleration Initiative participants +# * DrupalSpoons +################ + +################ +# Guidelines +# +# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification. It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained. +# +# However, you can modify this template if you have additional needs for your project. +################ + +################ +# Includes +# +# Additional configuration can be provided through includes. +# One advantage of include files is that if they are updated upstream, the changes affect all pipelines using that include. +# +# Includes can be overridden by re-declaring anything provided in an include, here in gitlab-ci.yml +# https://docs.gitlab.com/ee/ci/yaml/includes.html#override-included-configuration-values +################ + +include: + ################ + # DrupalCI includes: + # As long as you include this, any future includes added by the Drupal Association will be accessible to your pipelines automatically. + # View these include files at https://git.drupalcode.org/project/gitlab_templates/ + ################ + - project: $_GITLAB_TEMPLATES_REPO + ref: $_GITLAB_TEMPLATES_REF + file: + - '/includes/include.drupalci.main.yml' + # EXPERIMENTAL: For Drupal 7, remove the above line and uncomment the below. + # - '/includes/include.drupalci.main-d7.yml' + - '/includes/include.drupalci.variables.yml' + - '/includes/include.drupalci.workflows.yml' + +################ +# Pipeline configuration variables +# +# These are the variables provided to the Run Pipeline form that a user may want to override. +# +# Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/includes/include.drupalci.variables.yml +################ +# variables: +# SKIP_ESLINT: '1' +# SKIP_PHPUNIT: 1 + +phpcs: + allow_failure: false +phpstan: + allow_failure: false + +################################################################################### +# +# * +# /( +# ((((, +# /((((((( +# ((((((((((* +# ,((((((((((((((( +# ,((((((((((((((((((( +# ((((((((((((((((((((((((* +# *((((((((((((((((((((((((((((( +# ((((((((((((((((((((((((((((((((((* +# *(((((((((((((((((( .(((((((((((((((((( +# ((((((((((((((((((. /(((((((((((((((((* +# /((((((((((((((((( .(((((((((((((((((, +# ,(((((((((((((((((( (((((((((((((((((( +# .(((((((((((((((((((( .((((((((((((((((( +# ((((((((((((((((((((((( ((((((((((((((((/ +# (((((((((((((((((((((((((((/ ,(((((((((((((((* +# .((((((((((((((/ /(((((((((((((. ,((((((((((((((( +# *(((((((((((((( ,(((((((((((((/ *((((((((((((((. +# ((((((((((((((, /(((((((((((((. ((((((((((((((, +# (((((((((((((/ ,(((((((((((((* ,(((((((((((((, +# *((((((((((((( .((((((((((((((( ,((((((((((((( +# ((((((((((((/ /((((((((((((((((((. ,((((((((((((/ +# ((((((((((((( *(((((((((((((((((((((((* *(((((((((((( +# ((((((((((((( ,(((((((((((((..((((((((((((( *(((((((((((( +# ((((((((((((, /((((((((((((* /((((((((((((/ (((((((((((( +# ((((((((((((( /((((((((((((/ (((((((((((((* (((((((((((( +# (((((((((((((/ /(((((((((((( ,((((((((((((, *(((((((((((( +# (((((((((((((( *(((((((((((/ *((((((((((((. ((((((((((((/ +# *((((((((((((((((((((((((((, /((((((((((((((((((((((((( +# ((((((((((((((((((((((((( ((((((((((((((((((((((((, +# .(((((((((((((((((((((((/ ,((((((((((((((((((((((( +# ((((((((((((((((((((((/ ,(((((((((((((((((((((/ +# *((((((((((((((((((((( (((((((((((((((((((((, +# ,(((((((((((((((((((((, ((((((((((((((((((((/ +# ,(((((((((((((((((((((* /(((((((((((((((((((( +# ((((((((((((((((((((((, ,/((((((((((((((((((((, +# ,((((((((((((((((((((((((((((((((((((((((((((((((((( +# .((((((((((((((((((((((((((((((((((((((((((((( +# .((((((((((((((((((((((((((((((((((((,. +# .,(((((((((((((((((((((((((. +# +################################################################################### diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000000000000000000000000000000000000..960e6c4309f90740844a025320dd34a1641fdb19 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,41 @@ +includes: + - phar://phpstan.phar/conf/bleedingEdge.neon + +parameters: + level: 0 + paths: + - . + ignoreErrors: + # new static() is a common pattern in Drupal core and contrib. + # https://www.drupal.org/docs/develop/development-tools/phpstan/handling-unsafe-usage-of-new-static + - + message: "#^Unsafe usage of new static#" + - + message: "#^Call to static method loadByEntity\\(\\) on an unknown class Drupal\\\\group\\\\Entity\\\\GroupContent\\.$#" + count: 1 + path: quick_node_clone.module + + - + message: "#^\\\\Drupal calls should be avoided in classes, use dependency injection instead$#" + count: 1 + path: src/Controller/QuickNodeCloneNodeController.php + + - + message: "#^Call to static method loadByEntity\\(\\) on an unknown class Drupal\\\\group\\\\Entity\\\\GroupContent\\.$#" + count: 1 + path: src/Entity/QuickNodeCloneEntityFormBuilder.php + + - + message: "#^Parameter \\$event of method Drupal\\\\quick_node_clone\\\\EventSubscriber\\\\AddressEventSubscriber\\:\\:onInitialValues\\(\\) has invalid type Drupal\\\\address\\\\Event\\\\InitialValuesEvent\\.$#" + count: 1 + path: src/EventSubscriber/AddressEventSubscriber.php + + - + message: "#^Class Drupal\\\\quick_node_clone\\\\Form\\\\QuickNodeCloneNodeForm extends @internal class Drupal\\\\node\\\\NodeForm\\.$#" + count: 1 + path: src/Form/QuickNodeCloneNodeForm.php + + - + message: "#^Method Drupal\\\\quick_node_clone\\\\Form\\\\QuickNodeCloneNodeForm\\:\\:save\\(\\) should return int but return statement is missing\\.$#" + count: 1 + path: src/Form/QuickNodeCloneNodeForm.php diff --git a/quick_node_clone.api.php b/quick_node_clone.api.php index c008f6545ba16356295ee992621c04c674669a0f..5a1ff402a3f6354b1287772a6dd17d7840d89b1c 100644 --- a/quick_node_clone.api.php +++ b/quick_node_clone.api.php @@ -1,7 +1,13 @@ <?php +/** + * @file + * API documentation. + */ + use Drupal\node\NodeInterface; use Drupal\paragraphs\Entity\Paragraph; + /** * @file * Hooks related to quick_node_clone module and it's plugins. diff --git a/quick_node_clone.module b/quick_node_clone.module index 2a5576bccacaf68b26c930b573c550274107e94e..21236991e59614516d668e83a0adb527ef951bac 100644 --- a/quick_node_clone.module +++ b/quick_node_clone.module @@ -8,8 +8,8 @@ use Drupal\Component\Utility\Html; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Url; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\Core\Url; use Drupal\group\Entity\GroupContent; /** diff --git a/src/Controller/QuickNodeCloneNodeAccess.php b/src/Controller/QuickNodeCloneNodeAccess.php index b8d971e91e1ef4d9ce986037b9f326c39f47d407..15a58fce8726a4d18057b17afafd6be5647d984a 100644 --- a/src/Controller/QuickNodeCloneNodeAccess.php +++ b/src/Controller/QuickNodeCloneNodeAccess.php @@ -2,8 +2,8 @@ namespace Drupal\quick_node_clone\Controller; -use Drupal\Core\Session\AccountInterface; use Drupal\Core\Access\AccessResult; +use Drupal\Core\Session\AccountInterface; use Drupal\node\Entity\Node; /** diff --git a/src/Controller/QuickNodeCloneNodeController.php b/src/Controller/QuickNodeCloneNodeController.php index b0b9034d50825c9805cd1c18afe760a9290a2763..919c58b0a343f1c341c05d70fed097b323fdf401 100644 --- a/src/Controller/QuickNodeCloneNodeController.php +++ b/src/Controller/QuickNodeCloneNodeController.php @@ -2,12 +2,12 @@ namespace Drupal\quick_node_clone\Controller; -use Drupal\node\Entity\Node; -use Drupal\quick_node_clone\Entity\QuickNodeCloneEntityFormBuilder; use Drupal\Core\Datetime\DateFormatterInterface; use Drupal\Core\Entity\EntityRepositoryInterface; use Drupal\Core\Render\RendererInterface; use Drupal\node\Controller\NodeController; +use Drupal\node\Entity\Node; +use Drupal\quick_node_clone\Entity\QuickNodeCloneEntityFormBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; diff --git a/src/Entity/QuickNodeCloneEntityFormBuilder.php b/src/Entity/QuickNodeCloneEntityFormBuilder.php index b917a5530d95004cda7207f620c8b04c5ae609fd..361dbdf2675917ad239409c0cf645c04a1a94233 100755 --- a/src/Entity/QuickNodeCloneEntityFormBuilder.php +++ b/src/Entity/QuickNodeCloneEntityFormBuilder.php @@ -11,12 +11,12 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormBuilderInterface; use Drupal\Core\Form\FormState; use Drupal\Core\Session\AccountInterface; +use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\Core\StringTranslation\TranslationInterface; +use Drupal\Core\TempStore\PrivateTempStoreFactory; use Drupal\group\Entity\GroupContent; use Drupal\node\Entity\Node; use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\Core\TempStore\PrivateTempStoreFactory; -use Drupal\Core\StringTranslation\StringTranslationTrait; -use Drupal\Core\StringTranslation\TranslationInterface; /** * Builds entity forms. diff --git a/src/Form/QuickNodeCloneEntitySettingsForm.php b/src/Form/QuickNodeCloneEntitySettingsForm.php index 34c8dd070fa46cc659ab1750c816af6fca8db921..202100e2ea2847280bddb105a9a15e04fc68f3e5 100644 --- a/src/Form/QuickNodeCloneEntitySettingsForm.php +++ b/src/Form/QuickNodeCloneEntitySettingsForm.php @@ -4,10 +4,10 @@ namespace Drupal\quick_node_clone\Form; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Entity\EntityFieldManagerInterface; +use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\field\Entity\FieldConfig; -use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/tests/src/Functional/QuickNodeCloneExcludeParagraphFieldsTest.php b/tests/src/Functional/QuickNodeCloneExcludeParagraphFieldsTest.php index ee5ca6280a935bd43a5386711615bb48a8ddee5d..bc60f13d5cb8a3ce4afd2a7b45b1fec3ff004156 100644 --- a/tests/src/Functional/QuickNodeCloneExcludeParagraphFieldsTest.php +++ b/tests/src/Functional/QuickNodeCloneExcludeParagraphFieldsTest.php @@ -2,8 +2,8 @@ namespace Drupal\Tests\quick_node_clone\Functional; -use Drupal\Tests\paragraphs\Functional\WidgetLegacy\ParagraphsTestBase; use Drupal\Tests\field_ui\Traits\FieldUiTestTrait; +use Drupal\Tests\paragraphs\Functional\WidgetLegacy\ParagraphsTestBase; use Drupal\Tests\paragraphs\FunctionalJavascript\ParagraphsTestBaseTrait; /**