Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Draft Add HookConvert #308

Draft
wants to merge 64 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
b9c636c
Add HookConvert
Oct 17, 2024
846858f
Move to set list
nlighteneddesign Oct 17, 2024
1bce229
Fix name
nlighteneddesign Oct 17, 2024
9c6b3e2
Add naming rules to fix collisions
Oct 18, 2024
9211f27
Fix legacy hook use statements
Oct 18, 2024
7ca59a3
Fix hook use statement
Oct 18, 2024
a33cc76
Update return
Oct 18, 2024
13ccf24
Handle return statements
Oct 18, 2024
75bbed3
HookConvert
Oct 18, 2024
25ae097
Fix namespace
Oct 18, 2024
eaa26da
Update from upstream
Oct 18, 2024
f034d9b
Handle Variable
nlighteneddesign Oct 19, 2024
06bffcc
Update handle core vs contrib
Oct 19, 2024
64f4767
Fix duplicate comments and use statements
nlighteneddesign Oct 19, 2024
97dfebb
fix: revert adding the Hook into its own set and move class
bbrala Oct 20, 2024
0f434d3
feat: initial new test structure
bbrala Oct 20, 2024
d69b619
add comments
chx Oct 20, 2024
bb1bdbb
resolve __FUNCTION__
chx Oct 21, 2024
b242183
remove file doxygen
chx Oct 21, 2024
c71fd25
do not add backslash to true and friends
chx Oct 23, 2024
1154268
unqualify everything
chx Oct 23, 2024
e8385fa
rename
chx Oct 23, 2024
df749ab
and comment
chx Oct 23, 2024
037b361
one more rename
chx Oct 23, 2024
17de828
stop processing once done
chx Oct 23, 2024
8fe87f8
simplify
chx Oct 23, 2024
01c3dcf
simplify
chx Oct 23, 2024
78b85d5
move filename to init
chx Oct 23, 2024
0e49e60
add class doxygen
chx Oct 25, 2024
bd77e4d
not so final, eh?
chx Oct 25, 2024
a120784
style: fix codestyle
bbrala Oct 26, 2024
6e6c056
opsie
chx Oct 26, 2024
50a2197
hook_info
chx Oct 28, 2024
c37bef0
Two system module functions
chx Oct 29, 2024
1b3b6f5
cache_flush
chx Oct 30, 2024
234b634
Move return back inside fsecond if
nlighteneddesign Oct 31, 2024
ec0708e
_system_page_attachments arguments were missing
chx Nov 4, 2024
60e92e1
factor param-arg conversion out
chx Nov 5, 2024
dd1ede0
Do not convert system_info_alter
Nov 5, 2024
ddaa6e9
System info alter is fine
Nov 5, 2024
c5b61c3
Remove installer hooks
Nov 11, 2024
678a2ce
Fix duplicate use
Nov 20, 2024
48c4c44
Add install_tasks
nlighteneddesign Jan 13, 2025
3c7bbd9
Update HookConvertRector.php
nlighteneddesign Jan 15, 2025
b8dc5dd
Update HookConvertRector.php
nlighteneddesign Jan 15, 2025
abf275e
Ensure theme_suggestions are picked up
nlighteneddesign Jan 15, 2025
c000df6
Install tasks
nlighteneddesign Jan 15, 2025
8c0e454
build: fix codestyle
bbrala Jan 17, 2025
81ce5f3
fix: handle dry-run properly
bbrala Jan 17, 2025
ba77906
fix: rework tests to work with a module and depending files
bbrala Jan 17, 2025
8296e44
fix: invert condition
bbrala Jan 17, 2025
8aa9fa8
chore: rename module
bbrala Jan 17, 2025
006d158
fix: rename module to something more uniwue
bbrala Jan 17, 2025
ae1470d
build: fix stle
bbrala Jan 17, 2025
0bcce1b
fix: rename hook function name
bbrala Jan 17, 2025
17ba33c
build: fix codestyle
bbrala Jan 17, 2025
b453e49
fix: try and fix tests directory stuff
bbrala Jan 17, 2025
895c55b
build: update php cs config
bbrala Jan 17, 2025
620b8dc
fix: update expected
bbrala Jan 17, 2025
29323fc
fix: fix deprecations
bbrala Jan 17, 2025
0321be7
build: fix style
bbrala Jan 17, 2025
7dc67e0
Add more tests and remove the need for the custom printer.
bbrala Jan 18, 2025
2ac861d
Add missing class use statement
bbrala Jan 18, 2025
370833d
return is logical, it doesnt know what the return might be.
bbrala Jan 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/functional_test__single_rectors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

name: functional_test_single

# This test will run on every pull request, and on every commit on any branch
on:
push:
branches:
- main
pull_request:
schedule:
# Run tests every week (to check for rector changes)
- cron: '0 0 * * 0'

jobs:
run_functional_test_single:
name: Functional Test | single rectors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
coverage: none
tools: composer:v2
extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, gd
- name: Setup Drupal
uses: bluehorndigital/[email protected]
with:
version: '^11.0'
path: ~/drupal
- name: Install Drupal Rector
run: |
cd ~/drupal
composer require palantirnet/drupal-rector:@dev --no-progress
- name: Prepare rector_examples folder in the drupal modules directory
run: |
cd ~/drupal
mkdir -p web/modules/custom
cp -R vendor/palantirnet/drupal-rector/tests/functional/hookconvertrector/fixture/hookconvertrector web/modules/custom/hookconvertrector
# dry-run is expected to return exit code 2 if there are changes, which we are expecting to happen, here.
# an error code of 1 represents other errors.
# @see \Rector\Core\Console\ExitCode::CHANGED_CODE
- name: Run rector against Drupal (dry-run)
run: |
cd ~/drupal
for d in web/modules/custom/*; do
if [ -d "$d" ]; then
echo "Processing $d"
cp vendor/palantirnet/drupal-rector/tests/functional/$(basename ${d})/rector.php .
vendor/bin/rector process $d -vvv --dry-run --debug || if (($? == 2)); then true; else exit 1; fi
fi
done
- name: Run rector against Drupal
run: |
cd ~/drupal
for d in web/modules/custom/*; do
if [ -d "$d" ]; then
echo "Processing $d"
cp vendor/palantirnet/drupal-rector/tests/functional/$(basename ${d})/rector.php .
vendor/bin/rector process $d --debug
fi
done
# diff options:
# -r: recursive
# -u: show the joined context, like git diff
# -b: ignore whitespace
# -B: ignore lines that are only whitespace
- name: Check that the updated examples match expectations
run: |
cd ~/drupal
for d in web/modules/custom/*; do
if [ -d "$d" ]; then
diff -rubB "$d" "vendor/palantirnet/drupal-rector/tests/functional/$(basename ${d})/fixture/$(basename ${d})_updated"
fi
done
3 changes: 3 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
__DIR__.'/tests',
__DIR__.'/config/drupal-*',
])
->exclude([
'functional/hookconvertrector/fixture',
])
;

return (new PhpCsFixer\Config())
Expand Down
2 changes: 1 addition & 1 deletion src/Drupal8/Rector/Deprecation/DBRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DBRector extends AbstractRector implements ConfigurableRectorInterface
protected $optionsArgumentPosition;

/**
* @var \DrupalRector\Drupal8\Rector\ValueObject\DBConfiguration[]
* @var DBConfiguration[]
*/
private array $configuration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class DrupalServiceRenameRector extends AbstractRector implements ConfigurableRectorInterface
{
/**
* @var \DrupalRector\Drupal8\Rector\ValueObject\DrupalServiceRenameConfiguration[]
* @var DrupalServiceRenameConfiguration[]
*/
protected array $staticArgumentRenameConfigs = [];

Expand Down
2 changes: 1 addition & 1 deletion src/Drupal8/Rector/Deprecation/EntityLoadRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
final class EntityLoadRector extends AbstractRector implements ConfigurableRectorInterface
{
/**
* @var \DrupalRector\Drupal8\Rector\ValueObject\EntityLoadConfiguration[]
* @var EntityLoadConfiguration[]
*/
protected array $entityTypes;

Expand Down
2 changes: 1 addition & 1 deletion src/Drupal9/Rector/Deprecation/ExtensionPathRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class ExtensionPathRector extends AbstractRector implements ConfigurableRectorInterface
{
/**
* @var \DrupalRector\Drupal9\Rector\ValueObject\ExtensionPathConfiguration[]
* @var ExtensionPathConfiguration[]
*/
private array $configuration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function getNodeTypes(): array
*
* @throws ShouldNotHappenException
*
* @return array<int, ?\PhpParser\Node\Arg>
* @return array<int, ?Node\Arg>
*/
private function safeArgDestructure(Node\Expr\MethodCall $node): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Rector/AbstractDrupalCoreRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
abstract class AbstractDrupalCoreRector extends AbstractRector implements ConfigurableRectorInterface
{
/**
* @var array|\DrupalRector\Contract\VersionedConfigurationInterface[]
* @var array|VersionedConfigurationInterface[]
*/
protected array $configuration = [];

Expand Down
Loading
Loading