Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:

include:
- php: '7.4'
phpcompat: 'dev-develop as 9.99.99'
phpcompat: 'dev-develop as 10.99.99'
experimental: true

name: "Test: PHP ${{ matrix.php }} - PHPCompat ${{ matrix.phpcompat }}"
Expand Down Expand Up @@ -102,4 +102,7 @@ jobs:

# Make sure that known polyfills don't trigger any errors.
- name: Test the ruleset
run: vendor/bin/phpcs -ps ./Test/JoomlaTest.php --standard=PHPCompatibilityJoomla --runtime-set testVersion 5.3-
run: >
vendor/bin/phpcs -ps ./Test/JoomlaTest.php --standard=PHPCompatibilityJoomla
--exclude=PHPCompatibility.Upgrade.LowPHP
--runtime-set testVersion 5.3-
78 changes: 52 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# PHPCompatibilityJoomla

[![Latest Stable Version](https://img.shields.io/packagist/v/phpcompatibility/phpcompatibility-joomla?label=stable)](https://packagist.org/packages/phpcompatibility/phpcompatibility-joomla)
[![Latest Unstable Version](https://img.shields.io/badge/unstable-dev--develop-e68718.svg?maxAge=2419200)](https://packagist.org/packages/phpcompatibility/phpcompatibility-joomla)
[![Latest Stable Version](https://img.shields.io/packagist/v/phpcompatibility/phpcompatibility-joomla?label=stable)][packagist]
[![Latest Unstable Version](https://img.shields.io/badge/unstable-dev--develop-e68718.svg?maxAge=2419200)][packagist]
[![License](https://img.shields.io/github/license/PHPCompatibility/PHPCompatibilityJoomla?color=00a7a7)](https://github.com/PHPCompatibility/PHPCompatibilityJoomla/blob/master/LICENSE)
[![Build Status](https://github.com/PHPCompatibility/PHPCompatibilityJoomla/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/PHPCompatibility/PHPCompatibilityJoomla/actions/workflows/ci.yml)

Expand All @@ -12,36 +12,39 @@ Using PHPCompatibilityJoomla, you can analyse the codebase of a Joomla-based pro

A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects based on the Joomla CMS.

This Joomla specific ruleset prevents false positives from the [PHPCompatibility standard](https://github.com/PHPCompatibility/PHPCompatibility) by excluding back-fills and poly-fills which are provided by Joomla.
This Joomla specific ruleset prevents false positives from the [PHPCompatibility standard][PHPCompatibility] by excluding back-fills and polyfills which are provided by Joomla.


## Requirements
## Funding

**This project needs funding.**

The project team has spend thousands of hours creating and maintaining the PHPCompatibility packages. This is unsustainable without funding.

* [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer).
- PHP 5.3+ for use with [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) 2.3.0+.
- PHP 5.4+ for use with [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) 3.0.2+.
If you use PHPCompatibility, please fund this work by setting up a monthly contribution to the [PHP_CodeSniffer Open Collective].


## Requirements

* PHP > 5.4
* [PHP_CodeSniffer] >= 3.13.3.
Use the latest stable release of PHP_CodeSniffer for the best results.
The minimum _recommended_ version of PHP_CodeSniffer is version 2.6.0.
* [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility) 9.0.0+.
* [PHPCompatibilityParagonie](https://github.com/PHPCompatibility/PHPCompatibilityParagonie) 1.0.0+.
* [PHPCompatibilityPasswordCompat](https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat) 1.0.0+.
* [PHPCompatibilitySymfony](https://github.com/PHPCompatibility/PHPCompatibilitySymfony) 1.0.0+.
* [PHPCompatibility] 10.0.0+.
* [PHPCompatibilityParagonie] 2.0.0+.
* [PHPCompatibilityPasswordCompat] 2.0.0+.
* [PHPCompatibilitySymfony] 2.0.0+.


## Installation instructions

The only supported installation method is via [Composer](https://getcomposer.org/).
The only supported installation method is via [Composer].

If you don't have a Composer plugin installed to manage the `installed_paths` setting for PHP_CodeSniffer, run the following from the command-line:
```bash
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require --dev dealerdirect/phpcodesniffer-composer-installer:"^0.7" phpcompatibility/phpcompatibility-joomla:"*"
```
[Composer] will automatically install the project dependencies and register the external rulesets with PHP_CodeSniffer using the [Composer PHPCS plugin].

If you already have a Composer PHP_CodeSniffer plugin installed, run:
Run the following from the root of your project:
```bash
composer require --dev phpcompatibility/phpcompatibility-joomla:"*"
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require --dev phpcompatibility/phpcompatibility-joomla:"^3.0@dev"
```

Next, run:
Expand All @@ -51,11 +54,22 @@ vendor/bin/phpcs -i
If all went well, you will now see that the `PHPCompatibility`, `PHPCompatibilityJoomla` and several other PHPCompatibility standards are installed for PHP_CodeSniffer.


## Upgrade instructions

To upgrade this package, run the following command:
```bash
composer update --dev phpcompatibility/phpcompatibility-joomla --with-dependencies
```

> [!TIP]
> If you have a _root_ requirement in your project for one of the packages used by this project, you may need to update with `--with-all-dependencies` instead.


## How to use

Now you can use the following command to inspect your code:
You can now use the following command to inspect your code:
```bash
./vendor/bin/phpcs -p . --standard=PHPCompatibilityJoomla
vendor/bin/phpcs -p . --standard=PHPCompatibilityJoomla
```

By default, you will only receive notifications about deprecated and/or removed PHP features.
Expand All @@ -67,19 +81,31 @@ The minimum PHP requirement of the Joomla project at this time is PHP 5.3.10. If
For example:
```bash
# For a project which should be compatible with PHP 5.3 and higher:
./vendor/bin/phpcs -p . --standard=PHPCompatibilityJoomla --runtime-set testVersion 5.3-
vendor/bin/phpcs -p . --standard=PHPCompatibilityJoomla --runtime-set testVersion 5.3-
```

For more detailed information about setting the `testVersion`, see the README of the generic [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions) standard.
For more detailed information about setting the `testVersion`, see the README of the generic [PHPCompatibility][PHPCompatibility-testVersion] standard.


### Testing PHP files only

By default PHP_CodeSniffer will analyse PHP, JavaScript and CSS files. As the PHPCompatibility sniffs only target PHP code, you can make the run slightly faster by telling PHP_CodeSniffer to only check PHP files, like so:
By default PHP_CodeSniffer < 4.0 will analyse PHP, JavaScript and CSS files. As the PHPCompatibility sniffs only target PHP code, you can make the run slightly faster by telling PHP_CodeSniffer to only check PHP files, like so:
```bash
./vendor/bin/phpcs -p . --standard=PHPCompatibilityJoomla --extensions=php --runtime-set testVersion 5.3-
vendor/bin/phpcs -p . --standard=PHPCompatibilityJoomla --extensions=php --runtime-set testVersion 5.3-
```

## License

All code within the PHPCompatibility organisation is released under the GNU Lesser General Public License (LGPL). For more information, visit <https://www.gnu.org/licenses/lgpl-3.0.html>.


[packagist]: https://packagist.org/packages/phpcompatibility/phpcompatibility-joomla
[Composer]: https://getcomposer.org/
[Composer PHPCS plugin]: https://github.com/PHPCSStandards/composer-installer/
[PHP_CodeSniffer]: https://github.com/PHPCSStandards/PHP_CodeSniffer
[PHP_CodeSniffer Open Collective]: https://opencollective.com/php_codesniffer
[PHPCompatibility]: https://github.com/PHPCompatibility/PHPCompatibility
[PHPCompatibility-testVersion]: https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions
[PHPCompatibilityParagonie]: https://github.com/PHPCompatibility/PHPCompatibilityParagonie
[PHPCompatibilityPasswordCompat]: https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat
[PHPCompatibilitySymfony]: https://github.com/PHPCompatibility/PHPCompatibilitySymfony
14 changes: 4 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,10 @@
"lock": false
},
"require" : {
"phpcompatibility/php-compatibility" : "^9.0",
"phpcompatibility/phpcompatibility-paragonie" : "^1.0",
"phpcompatibility/phpcompatibility-symfony" : "^1.0"
},
"require-dev" : {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0"
},
"suggest" : {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
"phpcompatibility/php-compatibility" : "^10.0@dev",
"phpcompatibility/phpcompatibility-passwordcompat" : "^2.0@dev",
"phpcompatibility/phpcompatibility-paragonie" : "^2.0@dev",
"phpcompatibility/phpcompatibility-symfony" : "^2.0@dev"
},
"prefer-stable" : true
}