From 42965bff65528d02695f66b67a3b406a3e9885cf Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Sun, 25 Feb 2018 11:35:43 -0500 Subject: [PATCH] Bust Psalm statements cache when upgrading Psalm version --- src/Psalm/Provider/ClassLikeStorageCacheProvider.php | 2 ++ src/Psalm/Provider/FileStorageCacheProvider.php | 2 ++ src/psalm.php | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Psalm/Provider/ClassLikeStorageCacheProvider.php b/src/Psalm/Provider/ClassLikeStorageCacheProvider.php index 7c681f961..724656919 100644 --- a/src/Psalm/Provider/ClassLikeStorageCacheProvider.php +++ b/src/Psalm/Provider/ClassLikeStorageCacheProvider.php @@ -37,6 +37,8 @@ class ClassLikeStorageCacheProvider $this->modified_timestamps .= ' ' . filemtime($dependent_file_path); } + + $this->modified_timestamps .= PSALM_VERSION; } /** diff --git a/src/Psalm/Provider/FileStorageCacheProvider.php b/src/Psalm/Provider/FileStorageCacheProvider.php index 7a6cdbf18..a1ea3da7e 100644 --- a/src/Psalm/Provider/FileStorageCacheProvider.php +++ b/src/Psalm/Provider/FileStorageCacheProvider.php @@ -36,6 +36,8 @@ class FileStorageCacheProvider $this->modified_timestamps .= ' ' . filemtime($dependent_file_path); } + + $this->modified_timestamps .= PSALM_VERSION; } /** diff --git a/src/psalm.php b/src/psalm.php index f73d2211a..c27f308b7 100644 --- a/src/psalm.php +++ b/src/psalm.php @@ -141,10 +141,10 @@ $vendor_dir = getVendorDir($current_dir); requireAutoloaders($current_dir, isset($options['r']), $vendor_dir); +define('PSALM_VERSION', (string) \Muglug\PackageVersions\Versions::getVersion('vimeo/psalm')); + if (array_key_exists('v', $options)) { - /** @var string */ - $version = \Muglug\PackageVersions\Versions::getVersion('vimeo/psalm'); - echo 'Psalm ' . $version . PHP_EOL; + echo 'Psalm ' . PSALM_VERSION . PHP_EOL; exit; }