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
Account for changes introduced in PHP 8.0 #809
Labels
Comments
This was referenced Jul 11, 2020
Merged
This was referenced Jul 19, 2020
Merged
This was referenced Jul 30, 2020
This was referenced Apr 11, 2021
sebastianstein
added a commit
to in2code-de/in2studyfinder
that referenced
this issue
Oct 28, 2022
Note: php-compatibility does currently not find all violations. For further information see: PHPCompatibility/PHPCompatibility#809
This was referenced Dec 5, 2022
This was referenced Dec 25, 2022
Merged
Merged
This was referenced Jan 2, 2023
This was referenced Aug 4, 2023
Merged
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is just an issue to keep track of which of the implemented RFCs for PHP 8.0 have been addressed.
This list should be updated when additional RFCs are accepted/implemented.
To Do
Reevaluate the current level of various engine notices/warnings
Notes:
Beware of changes in the PHP native function method signature across versions though! Reflection will only know the signature as per the PHP version the sniff is run on.
Proposes to change non-strict comparisons between strings and numbers to behave more reasonably.
Make all sorts in PHP stable by default
Notes after initial RFC review (by @jrfnl):
Notes for implementation:
return
statements within the closure.This case will have the least chance of successfully determining the type.
Resolve inconsistent handling of abstract and non-abstract methods during inheritance.
Resolve inconsistent handling of abstract and non-abstract methods during inheritance.
Notes after initial RFC review (by @jrfnl):
int
being contravariant withfloat
andarray
being co-variant with?array
orarray|false
.Consistently throw TypeError for parameter parsing failures of internal functions.
Notes:
Mind: there are a lot of PRs in php-src to go through to find all the changes.
Aside from the RFCs, there are also the changes which were made outside of the RFC process and are listed in:
Claimed
Status: WIP, includes working on new upstream utility class to handle LSP in PHPCSUtils
Owner: @jrfnl
Status: WIP. This needs quite a lot of work, but PHPCSUtils will support helpers in the (near) future.
Owner: @jrfnl
Important note: in PHPCS, this change is "undone" in the 3.x branch and backfilled in the 4.x branch.
Changes which we'll need to account for in sniffs:
NewConstants
- the new token constantsStatus: PR PHP 8.0: NewConstants: add some more new constants #1248
ForbiddenNames
- deal with reserved keywords now being allowed in namespace declarations.Status: PR PHP 8.0 | ForbiddenNames: don't report reserved names in namespace declarations #1402
Status: Nowhere near as easy as it sounds...., but ready, waiting for PHPCSUtils alpha4 before pulling
T_STRING
tokens and throw an error that that is no longer sufficient to find identifier names.This sniff will only be useful for a very limited public of sniff writers and other tooling authors who use the PHP Tokenizer extension. Even so, for that type of code, this is a significant change and a sniff to alert the user about it will be useful.
Status: WIP, this will probably need quite some code samples and defensive coding to prevent false positives when the tokens are examined individually (multi-part condition, cases in
switch
etc).Enforce signature of abstract trait methods.
Status: The "abstract private methods" part has been pulled as New
PHPCompatibility.FunctionDeclarations.AbstractPrivateMethods
sniff #1149. Rest still needs to be evaluated for sniffability.Owner: @jrfnl
Convert throw statement into an expression
Status: WIP
Owner: @coderimus
Fixes variable syntax edge cases.
=> Interpolated and non-interpolated strings has been pulled as PHP 8.0 | New
PHPCompatibility.Syntax.InterpolatedStringDereferencing
sniff #1242 (@elazar).=> Magic constant dereferencing sniff has been pulled as PHP 8.0: New
PHPCompatibility.Syntax.NewMagicConstantDereferencing
sniff #1233 (@jrfnl).=> Constant dereferencability has been pulled as PHP 5.6 / 8.0: NewConstantDereferencing: add support for constant array / object dereferencing #1263 (@elazar)
=> Class constant dereferencability has been pulled as PHP 8.0: NewNestedStaticAccess: add support for class constant dereferencing #1262 (@elazar).
=> "Arbitrary expression support for new and instanceof" still needs to be evaluated for sniffability.
Proposes to make implicit array keys consistent.
Owner: @Schrank
Has PR
NewAttributes
sniff #1279Covers the following four RFCs:
Use @@ instead of <<>> for attributes in PHP 8.0
Group Syntax, Rename PhpAttribute, Target Validation, Repeatable
Add structured metadata to declarations (classes, functions, properties, constants) for internal and userland use-cases.
NewNamedParametersSniff
sniff #1423This RFC proposes introducing named arguments.
Add new ?→ operator that skips null values
PHPCompatibility.FunctionDeclarations.ForbiddenFinalPrivateMethods
sniff #1201Proposes that inappropriate inheritance checks are removed for private methods
Review notes: The change in the inheritance checks themselves cannot be sniffed reliably as in nearly all cases the parent class and the child class won't be declared in the same file.
The only sniffable change I can see is the warning now thrown for
final private
method declarations. (@jrfnl)match
keyword (RFC) #1597 (NewKeywords)Introduce match expression
Also see upstream issue PHP 8.0 | Add support for match expressions squizlabs/PHP_CodeSniffer#3037
PHPCompatibility.Classes.NewConstructorPropertyPromotion
sniff #1417, PHP 8.0 | TypeDeclaration sniffs: examine properties declared in the constructor correctly #1447Adds a short-hand syntax to combine declaration of properties and the constructor.
PHPCompatibility.ControlStructures.NewNonCapturingCatch
sniff #1151Allow catching exceptions without a variable
Add the mixed type
PHPCompatibility.FunctionDeclarations.NewTrailingComma
sniff #1164Adds an object-based token_get_all() alternative, which is more ergonomic and uses less memory.
Allow using
string|Stringable
to expressstring|object-with-__toString()
.Adds support for
$object::class
.Adds support for
static
as a return type.A proposal to add union types
Upgrade DOM API to latest standard version
Just in Time Compiler.
Add a
WeakMap
classAdds a new function to return whether or not a string is contained within another.
Adds a new function to return the true type name of a variable, automatically resolving class names.
Exposes CMS API from OpenSSL
Reviewed and concluded non-sniffable
Review: Unless and until PHPCompatibility would start examining method calls with object variable resolution, there is nothing in this RFC (or the related PR/commit) which is sniffable.
Review: The only thing which would be sniffable would be to detect calls to
extension_loaded('json')
and the likes. Those calls are no longer necessary, but as those will continue to work without notices, this is not a PHPCompatibility issue.Process
If anyone starts work on updating PHPCompatibility to handle any of these issues, please either update the above list (if you can) or leave a comment below, so one of the maintainers can update the list.
Once PHP 8.0 comes out, individual issues should be opened for the changes which remain at that point in time.
The text was updated successfully, but these errors were encountered: