-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 593b5db
Showing
80 changed files
with
7,743 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[composer.{json,lock}] | ||
indent_size = 4 | ||
|
||
[*.neon] | ||
indent_style = tab | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.github/ export-ignore | ||
/.gitignore export-ignore | ||
/phpcs.xml.dist export-ignore | ||
/phpstan.neon.dist export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/phpstan-baseline.neon export-ignore | ||
/tests/ export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
github: mglaman | ||
ko_fi: mglaman |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: [ main ] | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
branches: [ main ] | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.1 | ||
extensions: gd | ||
coverage: none | ||
tools: composer:v2 | ||
|
||
- name: Install dependencies | ||
run: composer install --no-progress --prefer-dist | ||
- name: Composer validate | ||
run: composer validate --strict | ||
- name: Composer normalize | ||
run: composer normalize --dry-run | ||
- name: PHPCS | ||
run: php vendor/bin/phpcs | ||
static: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.1 | ||
extensions: gd | ||
coverage: none | ||
tools: composer:v2 | ||
- name: Install dependencies | ||
run: composer install --no-progress --prefer-dist | ||
- name: PHPStan | ||
run: php vendor/bin/phpstan analyze | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.1 | ||
extensions: gd | ||
coverage: none | ||
tools: composer:v2 | ||
- name: Install dependencies | ||
run: composer install --no-progress --prefer-dist | ||
- name: phpunit | ||
run: php vendor/bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/.phpunit.cache | ||
/.phpunit.result.cache | ||
|
||
/composer.lock | ||
/vendor | ||
|
||
/.idea | ||
|
||
/phpcs.xml | ||
/phpunit.xml | ||
/phpstan.neon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Matt Glaman | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Retrofit for Drupal | ||
|
||
The Retrofit provides compatibility layers for legacy Drupal code to allow run on any version of Drupal. | ||
|
||
## Installation | ||
|
||
```shell | ||
composer require mglaman/retrofit-drupal | ||
``` | ||
|
||
And that's it! 🎉 | ||
|
||
## How it works | ||
|
||
This library registers a service provider to integrate with Drupal automatically. | ||
|
||
## Usage | ||
|
||
Currently, the compatibility layers are drop-in replacements. This means you can use them in your code without any | ||
changes. Some functions are namespaced for compatibility. | ||
|
||
You must modify your Drupal 7 modules `.info` file to `info.yml`. | ||
|
||
* Add `type: module` | ||
* Add `core_version_requirement: >= 10` | ||
|
||
### Namespaced functions | ||
|
||
* `module_load_include` is now `Retrofit\Drupal\module_load_include` | ||
|
||
### Fixing placeholders in `t()` | ||
|
||
The `!` placeholder is no longer valid. Placeholders using `!` in `t()` need to be manually changed to `@` or `:`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Retrofit\Drupal\Provider; | ||
|
||
$GLOBALS['conf']['container_service_providers']['retrofit'] = Provider::class; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "mglaman/retrofit-drupal", | ||
"description": "Retrofit provides compatibility layers to run legacy Drupal code.", | ||
"license": "MIT", | ||
"type": "library", | ||
"authors": [ | ||
{ | ||
"name": "Matt Glaman", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.1", | ||
"drupal/core": "^10" | ||
}, | ||
"require-dev": { | ||
"ergebnis/composer-normalize": "^2.31", | ||
"mglaman/drupal-test-helpers": "^1.0", | ||
"mikey179/vfsstream": "^1.6", | ||
"phpspec/prophecy-phpunit": "^2.0", | ||
"phpstan/extension-installer": "^1.3", | ||
"phpstan/phpstan": "^1.10", | ||
"phpstan/phpstan-phpunit": "^1.3", | ||
"phpunit/phpunit": "^9.6", | ||
"squizlabs/php_codesniffer": "^3.7", | ||
"symfony/css-selector": "^6.3", | ||
"symfony/phpunit-bridge": "^6.2" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Retrofit\\Drupal\\": "src" | ||
}, | ||
"files": [ | ||
"src/constants.php", | ||
"src/functions.php", | ||
"bootstrap.php" | ||
] | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Retrofit\\Drupal\\Tests\\": "tests/src" | ||
} | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"phpstan/extension-installer": true, | ||
"ergebnis/composer-normalize": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="drupal-memory-kernel"> | ||
<arg name="colors"/> | ||
<arg name="extensions" value="php"/> | ||
<arg name="encoding" value="utf-8"/> | ||
<arg name="tab-width" value="4"/> | ||
<arg value="sp"/> | ||
|
||
<file>src</file> | ||
<file>tests</file> | ||
|
||
<rule ref="PSR12"> | ||
<!-- Already checked with the sniff Squiz.WhiteSpace.SemicolonSpacing.Incorrect --> | ||
<exclude name="PSR12.Files.DeclareStatement.SpaceFoundBeforeSemicolon"/> | ||
</rule> | ||
|
||
</ruleset> |
Oops, something went wrong.