Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: phpstan/phpstan-deprecation-rules
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1.x
Choose a base ref
...
head repository: phpstan/phpstan-deprecation-rules
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.0.x
Choose a head ref
Able to merge. These branches can be automatically merged.
Loading
Showing with 1,259 additions and 2,203 deletions.
  1. +0 −1 .gitattributes
  2. +0 −5 .github/renovate.json
  3. +24 −25 .github/workflows/build.yml
  4. +1 −1 .github/workflows/create-tag.yml
  5. +2 −2 .github/workflows/lock-closed-issues.yml
  6. +1 −1 .github/workflows/release-toot.yml
  7. +2 −2 .github/workflows/release.yml
  8. +1 −0 .gitignore
  9. +22 −0 LICENSE
  10. +8 −2 Makefile
  11. +4 −0 README.md
  12. +0 −1 build-cs/.gitignore
  13. +0 −13 build-cs/composer.json
  14. +0 −331 build-cs/composer.lock
  15. +4 −5 composer.json
  16. +0 −111 phpcs.xml
  17. +67 −0 phpstan-baseline.neon
  18. +1 −1 phpstan.neon
  19. +34 −18 rules.neon
  20. +3 −5 src/DependencyInjection/LazyDeprecatedScopeResolverProvider.php
  21. +0 −84 src/Rules/Deprecations/AccessDeprecatedPropertyRule.php
  22. +0 −110 src/Rules/Deprecations/AccessDeprecatedStaticPropertyRule.php
  23. +0 −73 src/Rules/Deprecations/CallToDeprecatedFunctionRule.php
  24. +0 −86 src/Rules/Deprecations/CallToDeprecatedMethodRule.php
  25. +0 −132 src/Rules/Deprecations/CallToDeprecatedStaticMethodRule.php
  26. +135 −0 src/Rules/Deprecations/CallWithDeprecatedIniOptionRule.php
  27. +0 −64 src/Rules/Deprecations/DeprecatedClassHelper.php
  28. +1 −1 src/Rules/Deprecations/DeprecatedScopeHelper.php
  29. +0 −139 src/Rules/Deprecations/FetchingClassConstOfDeprecatedClassRule.php
  30. +9 −8 src/Rules/Deprecations/FetchingDeprecatedConstRule.php
  31. +0 −104 src/Rules/Deprecations/ImplementationOfDeprecatedInterfaceRule.php
  32. +0 −101 src/Rules/Deprecations/InheritanceOfDeprecatedClassRule.php
  33. +0 −83 src/Rules/Deprecations/InheritanceOfDeprecatedInterfaceRule.php
  34. +0 −108 src/Rules/Deprecations/InstantiationOfDeprecatedClassRule.php
  35. +93 −0 src/Rules/Deprecations/RestrictedDeprecatedClassConstantUsageExtension.php
  36. +138 −0 src/Rules/Deprecations/RestrictedDeprecatedClassNameUsageExtension.php
  37. +55 −0 src/Rules/Deprecations/RestrictedDeprecatedFunctionUsageExtension.php
  38. +116 −0 src/Rules/Deprecations/RestrictedDeprecatedMethodUsageExtension.php
  39. +99 −0 src/Rules/Deprecations/RestrictedDeprecatedPropertyUsageExtension.php
  40. +0 −96 src/Rules/Deprecations/TypeHintDeprecatedInClassMethodSignatureRule.php
  41. +0 −73 src/Rules/Deprecations/TypeHintDeprecatedInClosureSignatureRule.php
  42. +0 −77 src/Rules/Deprecations/TypeHintDeprecatedInFunctionSignatureRule.php
  43. +0 −60 src/Rules/Deprecations/UsageOfDeprecatedCastRule.php
  44. +0 −83 src/Rules/Deprecations/UsageOfDeprecatedTraitRule.php
  45. +49 −0 tests/Rules/ClassConstantRuleTest.php
  46. +12 −6 tests/Rules/Deprecations/AccessDeprecatedPropertyRuleTest.php
  47. +12 −8 tests/Rules/Deprecations/AccessDeprecatedStaticPropertyRuleTest.php
  48. +12 −6 tests/Rules/Deprecations/CallToDeprecatedFunctionRuleTest.php
  49. +12 −6 tests/Rules/Deprecations/CallToDeprecatedMethodRuleTest.php
  50. +16 −24 tests/Rules/Deprecations/CallToDeprecatedStaticMethodRuleTest.php
  51. +47 −0 tests/Rules/Deprecations/CallWithDeprecatedIniOptionRuleTest.php
  52. +19 −0 tests/Rules/Deprecations/CustomDeprecatedScopeResolver.php
  53. +13 −23 tests/Rules/Deprecations/CustomDeprecatedScopeResolverTest.php
  54. +12 −20 tests/Rules/Deprecations/FetchingClassConstOfDeprecatedClassRuleTest.php
  55. +26 −30 tests/Rules/Deprecations/FetchingDeprecatedConstRuleTest.php
  56. +13 −7 tests/Rules/Deprecations/ImplementationOfDeprecatedInterfaceRuleTest.php
  57. +13 −7 tests/Rules/Deprecations/InheritanceOfDeprecatedClassRuleTest.php
  58. +12 −3 tests/Rules/Deprecations/InheritanceOfDeprecatedInterfaceRuleTest.php
  59. +12 −8 tests/Rules/Deprecations/InstantiationOfDeprecatedClassRuleTest.php
  60. +44 −0 tests/Rules/Deprecations/RestrictedDeprecatedClassNameUsageExtensionTest.php
  61. +17 −11 tests/Rules/Deprecations/TypeHintDeprecatedInClassMethodSignatureRuleTest.php
  62. +16 −10 tests/Rules/Deprecations/TypeHintDeprecatedInClosureSignatureRuleTest.php
  63. +17 −11 tests/Rules/Deprecations/TypeHintDeprecatedInFunctionSignatureRuleTest.php
  64. +13 −6 tests/Rules/Deprecations/UsageOfDeprecatedCastRuleTest.php
  65. +13 −7 tests/Rules/Deprecations/UsageOfDeprecatedTraitRuleTest.php
  66. +5 −0 tests/Rules/Deprecations/custom-deprecated-scope.neon
  67. +5 −0 tests/Rules/Deprecations/data/call-to-deprecated-static-method-definition.php
  68. +2 −0 tests/Rules/Deprecations/data/call-to-deprecated-static-method.php
  69. +19 −0 tests/Rules/Deprecations/data/call-with-deprecation-ini-option.php
  70. +1 −1 tests/Rules/Deprecations/data/typehint-class-method-deprecated-class-definition.php
  71. +3 −3 tests/Rules/Deprecations/data/typehint-class-method-deprecated-class.php
  72. +4 −0 tests/Rules/Deprecations/data/usage-of-deprecated-cast.php
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -6,6 +6,5 @@ tmp export-ignore
.gitattributes export-ignore
.gitignore export-ignore
Makefile export-ignore
phpcs.xml export-ignore
phpstan.neon export-ignore
phpunit.xml export-ignore
5 changes: 0 additions & 5 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -10,11 +10,6 @@
"enabled": true,
"groupName": "root-composer"
},
{
"matchPaths": ["build-cs/**"],
"enabled": true,
"groupName": "build-cs"
},
{
"matchPaths": [".github/**"],
"enabled": true,
49 changes: 24 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ on:
pull_request:
push:
branches:
- "1.1.x"
- "2.0.x"

jobs:
lint:
@@ -16,16 +16,16 @@ jobs:
strategy:
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"

steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
@@ -39,34 +39,41 @@ jobs:
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress"

- name: "Downgrade PHPUnit"
if: matrix.php-version == '7.2' || matrix.php-version == '7.3'
run: "composer require --dev phpunit/phpunit:^7.5.20 --update-with-dependencies"

- name: "Lint"
run: "make lint"

coding-standards:
coding-standard:
name: "Coding Standard"

runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Checkout build-cs"
uses: actions/checkout@v4
with:
repository: "phpstan/build-cs"
path: "build-cs"
ref: "2.x"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "8.0"
php-version: "8.2"

- name: "Validate Composer"
run: "composer validate"

- name: "Install dependencies"
run: "composer install --no-interaction --no-progress"

- name: "Install build-cs dependencies"
working-directory: "build-cs"
run: "composer install --no-interaction --no-progress"

- name: "Lint"
run: "make lint"

@@ -81,19 +88,19 @@ jobs:
fail-fast: false
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
dependencies:
- "lowest"
- "highest"

steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
@@ -109,10 +116,6 @@ jobs:
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress"

- name: "Downgrade PHPUnit"
if: matrix.php-version == '7.2' || matrix.php-version == '7.3'
run: "composer require --dev phpunit/phpunit:^7.5.20 --update-with-dependencies"

- name: "Tests"
run: "make tests"

@@ -124,19 +127,19 @@ jobs:
fail-fast: false
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
dependencies:
- "lowest"
- "highest"

steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
@@ -154,9 +157,5 @@ jobs:
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress"

- name: "Downgrade PHPUnit"
if: matrix.php-version == '7.2' || matrix.php-version == '7.3'
run: "composer require --dev phpunit/phpunit:^7.5.20 --update-with-dependencies"

- name: "PHPStan"
run: "make phpstan"
2 changes: 1 addition & 1 deletion .github/workflows/create-tag.yml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/lock-closed-issues.yml
Original file line number Diff line number Diff line change
@@ -2,13 +2,13 @@ name: 'Lock Issues'

on:
schedule:
- cron: '0 0 * * *'
- cron: '11 0 * * *'

jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v4
- uses: dessant/lock-threads@v5
with:
github-token: ${{ github.token }}
issue-inactive-days: '31'
2 changes: 1 addition & 1 deletion .github/workflows/release-toot.yml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ jobs:
toot:
runs-on: ubuntu-latest
steps:
- uses: cbrgm/mastodon-github-action@v1
- uses: cbrgm/mastodon-github-action@v2
if: ${{ !github.event.repository.private }}
with:
# GitHub event payload
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -14,11 +14,11 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Generate changelog
id: changelog
uses: metcalfc/changelog-generator@v4.1.0
uses: metcalfc/changelog-generator@v4.6.2
with:
myToken: ${{ secrets.PHPSTAN_BOT_TOKEN }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/tests/tmp
/build-cs
/vendor
/composer.lock
.phpunit.result.cache
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2016 Ondřej Mirtes
Copyright (c) 2025 PHPStan s.r.o.

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.
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -10,13 +10,19 @@ lint:
php vendor/bin/parallel-lint --colors \
src tests

.PHONY: cs-install
cs-install:
git clone https://github.com/phpstan/build-cs.git || true
git -C build-cs fetch origin && git -C build-cs reset --hard origin/2.x
composer install --working-dir build-cs

.PHONY: cs
cs:
composer install --working-dir build-cs && php build-cs/vendor/bin/phpcs
php build-cs/vendor/bin/phpcs --standard=build-cs/phpcs.xml src tests

.PHONY: cs-fix
cs-fix:
php build-cs/vendor/bin/phpcbf
php build-cs/vendor/bin/phpcbf --standard=build-cs/phpcs.xml src tests

.PHONY: phpstan
phpstan:
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -37,6 +37,10 @@ In case you don't own the code which you want to be considered deprecated, use [
class ThirdPartyClass {}
```

## Custom deprecation markers

You can implement extensions to support even e.g. custom `#[MyDeprecated]` attribute. [Learn more](https://phpstan.org/developing-extensions/custom-deprecations).


## Custom deprecated scopes

1 change: 0 additions & 1 deletion build-cs/.gitignore

This file was deleted.

13 changes: 0 additions & 13 deletions build-cs/composer.json

This file was deleted.

Loading