-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Collections: deprecate all properties for methods #311
Merged
jrfnl
merged 17 commits into
develop
from
collections/deprecate-most-properties-for-methods
Apr 19, 2022
Merged
Collections: deprecate all properties for methods #311
jrfnl
merged 17 commits into
develop
from
collections/deprecate-most-properties-for-methods
Apr 19, 2022
Conversation
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
…of alternativeControlStructureSyntax*() Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only perfunctory unit tests for the new methods, as the `alternativeControlStructureSyntax*()` methods don't contain any actual logic. For now, it is just safeguarded that a) the methods are available and can be called and b) that the method is in line with the now deprecated property.
Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. **_Note: as this property has been introduced during the `alpha4` dev cycle, this property is being outright removed instead of being deprecated._** Includes only a perfunctory unit test for the new method, as the `arrayOpenTokensBC()` method doesn't contain any actual logic. For now, it is just safeguarded that the method is available, can be called and returns the expected type of return value. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only perfunctory unit tests for the new methods, as the `arrayTokens[BC]()` methods don't contain any actual logic. For now, it is just safeguarded that a) the methods are available and can be called and b) that the method is in line with the now deprecated property. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
…ierKeywords() Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only a perfunctory unit test for the new method, as the `classModifierKeywords()` method doesn't contain any actual logic. For now, it is just safeguarded that a) the method is available and can be called and b) that the method is in line with the now deprecated property. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only a perfunctory unit test for the new method, as the `closedScopes()` method doesn't contain any actual logic. For now, it is just safeguarded that a) the method is available and can be called and b) that the method is in line with the now deprecated property. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
…ructureTokens() Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only a perfunctory unit test for the new method, as the `controlStructureTokens()` method doesn't contain any actual logic. For now, it is just safeguarded that a) the method is available and can be called and b) that the method is in line with the now deprecated property. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
…ementDecrementOperators() Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only a perfunctory unit test for the new method, as the `incrementDecrementOperators()` method doesn't contain any actual logic. For now, it is just safeguarded that a) the method is available and can be called and b) that the method is in line with the now deprecated property. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only perfunctory unit tests for the new methods, as the `listTokens[BC]()` methods don't contain any actual logic. For now, it is just safeguarded that a) the methods are available and can be called and b) that the method is in line with the now deprecated property. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
…nstants() Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. **Note**: As PR 172 already introduced a method for the same in the `BCTokens` class as PHPCS 3.5.6 introduced a `Tokens` property for the same, no replacement has been added to the `Collections` class. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function in `BCTokens` instead.
…spaceDeclarationClosers() Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only a perfunctory unit test for the new method, as the `namespaceDeclarationClosers()` method doesn't contain any actual logic. For now, it is just safeguarded that a) the method is available and can be called and b) that the method is in line with the now deprecated property. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
…plement|Extend)() Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only perfunctory unit tests for the new methods, as the `ooCan(Implement|Extend)()` methods don't contain any actual logic. For now, it is just safeguarded that a) the methods are available and can be called and b) that the method is in line with the now deprecated property. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
…onstant|Property)Scopes() Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only perfunctory unit tests for the new methods, as the `oo(Constant|Property)Scopes()` methods don't contain any actual logic. For now, it is just safeguarded that a) the methods are available and can be called and b) that the method is in line with the now deprecated property. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
…eywords() Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only a perfunctory unit test for the new method, as the `ooHierarchyKeywords()` method doesn't contain any actual logic. For now, it is just safeguarded that a) the method is available and can be called and b) that the method is in line with the now deprecated property. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
…yModifierKeywords() Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only a perfunctory unit test for the new method, as the `propertyModifierKeywords()` method doesn't contain any actual logic. For now, it is just safeguarded that a) the method is available and can be called and b) that the method is in line with the now deprecated property. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
…okens[BC]() Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only perfunctory unit tests for the new methods, as the `shortArrayTokens[BC]()` methods don't contain any actual logic. For now, it is just safeguarded that a) the methods are available and can be called and b) that the method is in line with the now deprecated property. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
…ens[BC]() Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only perfunctory unit tests for the new methods, as the `shortListTokens[BC]()` methods don't contain any actual logic. For now, it is just safeguarded that a) the methods are available and can be called and b) that the method is in line with the now deprecated property. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
b07139e
to
18c7606
Compare
…artTokens() Over the last three PHP versions, PHP has steadily kept on introducing new tokens. In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead. With this in mind, all properties in the `Collections` class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later. The deprecated properties will be removed (or made `private`) before the `1.0.0` version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though. Includes only a perfunctory unit test for the new method, as the `textStingStartTokens()` method doesn't contain any actual logic. For now, it is just safeguarded that a) the method is available and can be called and b) that the method is in line with the now deprecated property. Includes replacing any references to this property in the PHPCSUtils codebase to now call the function instead.
18c7606
to
a44b016
Compare
jrfnl
added a commit
that referenced
this pull request
Dec 24, 2022
... and remove the remaining methods without logic (but which had a name change one way or the other). Follow-up after #202, #311. Includes updating the tests: * Mostly remove method specific tests and move those to the `PropertyBasedTokenArraysTest`. * For the "type" token arrays - update the order of the expected arrays.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Over the last three PHP versions, PHP has steadily kept on introducing new tokens.
In the context of this class, the introduction of a new token means that a collection can no longer be a property and must be changed to a method with some logic instead.
With this in mind, all properties in the
Collections
class are being deprecated in favour of methods, to prevent the BC-breaks this kind of change would cause if left till later.The deprecated properties will be removed (or made
private
) before the1.0.0
version is tagged. The deprecation in the upcoming alpha gives standards which have started to implement the use of PHPCSUtils a little time to switch over though.👉🏻 Note: in most cases, the method name is 100% the same as the property name, so switching over to the new methods should be a case of removing the
$
sign and adding parentheses()
after the name.Commit details
Note: Unless noted differently, each commit includes only perfunctory unit tests for the new methods, as the methods don't contain any actual logic.
For now, it is just safeguarded that a) the methods are available and can be called and b) that the method is in line with the now deprecated property.
Where applicable, each commit also includes replacing any references to the deprecated properties in the PHPCSUtils codebase to now call the functions instead.
Collections: deprecate
$alternativeControlStructureSyntax*
in favour ofalternativeControlStructureSyntax*()
Collections: remove
$arrayOpenTokensBC
in favour ofarrayOpenTokensBC()
Note: as this property has been introduced during the
alpha4
dev cycle, this property is being outright removed instead of being deprecated.Includes only a perfunctory unit test for the new method, as the
arrayOpenTokensBC()
method doesn't contain any actual logic.For now, it is just safeguarded that the method is available, can be called and returns the expected type of return value.
Collections: deprecate
$arrayTokens[BC]
in favour ofarrayTokens[BC]()
Collections: deprecate
$classModifierKeywords
in favour ofclassModifierKeywords()
Collections: deprecate
$closedScopes
in favour ofclosedScopes()
Collections: deprecate
$controlStructureTokens
in favour ofcontrolStructureTokens()
Collections: deprecate
$incrementDecrementOperators
in favour ofincrementDecrementOperators()
Collections: deprecate
$listTokens[BC]
in favour oflistTokens[BC]()
Collections: deprecate
$magicConstants
in favour ofBCTokens::magicConstants()
Note: As PR #172 already introduced a method for the same in the
BCTokens
class as PHPCS 3.5.6 introduced aTokens
property for the same, no replacement has been added to theCollections
class.Includes replacing any references to this property in the PHPCSUtils codebase to now call the function in
BCTokens
instead.Collections: deprecate
$namespaceDeclarationClosers
in favour ofnamespaceDeclarationClosers()
Collections: deprecate
$OOCan(Implement|Extend)
in favour ofooCan(Implement|Extend)()
Collections: deprecate
$OO(Constant|Property)Scopes
in favour ofoo(Constant|Property)Scopes()
Collections: deprecate
$OOHierarchyKeywords
in favour ofooHierarchyKeywords()
Collections: deprecate
$propertyModifierKeywords
in favour ofpropertyModifierKeywords()
Collections: deprecate
$shortArrayTokens[BC]
in favour ofshortArrayTokens[BC]()
Collections: deprecate
$shortListTokens[BC]
in favour ofshortListTokens[BC]()
Collections: deprecate
$textStingStartTokens
in favour oftextStingStartTokens()