forked from smrealms/smr
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Scrutinizer Auto-Fixes #3
Merged
Merged
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
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
hemberger
added a commit
that referenced
this pull request
Jun 14, 2021
We need to be able to get the session var before we process any pages, but it is during page processing where we set the session var. Thus, we need to initialize the session var to an empty Page (as a kind of bootstrapping strategy). This fixes the following error: > Error Message: ErrorException: Undefined array key "" in /smr/src/lib/Smr/Session.php:259 > Stack trace: > #0 /smr/src/lib/Smr/Session.php(259): exception_error_handler(2, 'Undefined array...', '/smr/src/lib/Sm...', 259) > #1 /smr/src/lib/Default/AbstractSmrPlayer.class.php(2169): Smr\Session->getCurrentVar() > #2 /smr/src/tools/npc/npc.php(140): AbstractSmrPlayer->removeUnderAttack() > #3 /smr/src/tools/npc/npc.php(91): NPCStuff() > #4 {main}
hemberger
added a commit
that referenced
this pull request
Jun 14, 2021
The shop_hardware_processing.php script forwards the current LocationID in the session var to the next page. This was not being set as part of the preparation in npc.php (because the LocationID is not needed by anything the NPC does, i.e. no subsequent display page). However, it is no significant burden to provide this, so we pass along the sector ID to the `doUNO` function. Fixes the following error: > Error Message: Exception: Could not find "LocationID" in var! in /smr/src/lib/Default/Page.class.php:166 > Stack trace: > #0 /smr/src/engine/Default/shop_hardware_processing.php(64): Page->addVar('LocationID') > #1 /smr/src/lib/Default/Page.class.php(231): require('/smr/src/engine...') > #2 /smr/src/lib/Default/smr.inc.php(372): Page->process() > #3 /smr/src/tools/npc/npc.php(352): do_voodoo() > #4 /smr/src/tools/npc/npc.php(176): processContainer(Object(Page)) > #5 /smr/src/tools/npc/npc.php(91): NPCStuff() > #6 {main}
hemberger
added a commit
that referenced
this pull request
Jan 10, 2023
This was using the wrong interface to SmrSector::getSector, resulting in forcing an update of the cache unexpectedly due to the implicit type conversion from int to bool. This bug is as old as the repo. Now that we are using strict types, this invalid call throws, and so we fix it to prevent the erroneous forced update. Fixes PHPStan warning: > Parameter #3 $forceUpdate of static method SmrSector::getSector() expects bool, int given.
hemberger
added a commit
that referenced
this pull request
Jan 11, 2023
This was using the wrong interface to SmrSector::getSector, resulting in forcing an update of the cache unexpectedly due to the implicit type conversion from int to bool. This bug is as old as the repo. Now that we are using strict types, this invalid call throws, and so we fix it to prevent the erroneous forced update. Fixes PHPStan warning: > Parameter #3 $forceUpdate of static method SmrSector::getSector() expects bool, int given.
hemberger
added a commit
that referenced
this pull request
Feb 9, 2023
Use `str_ireplace` to perform word replacements instead of using `preg_replace`. This has a bunch of benefits: * The interface is much simpler, because arrays of search/replace terms can be input. * The `str_ireplace` function cannot error, unlike `preg_replace`. * In the live database, some of the search terms used regex characters, but were intended to be interpreted literally. With `str_ireplace`, all search terms are literals. Fixes PHPStan warnings: > Parameter #3 $subject of function preg_replace expects array|string, string|null given. > Function word_filter() should return string but returns string|null.
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.
@hemberger requested this pull request.
It consists of patches automatically generated for this project on Scrutinizer:
https://scrutinizer-ci.com/g/smrealms/smr/